Skip to content

Commit 716a83a

Browse files
authored
feat(api-reference): request example block (scalar#6278)
* Revert "fix(api-reference): rollback store (scalar#6269)" This reverts commit 8c6f6fe. * docs(changeset): refactor: new request example block
1 parent 1c2b9f3 commit 716a83a

File tree

21 files changed

+318
-1181
lines changed

21 files changed

+318
-1181
lines changed

.changeset/healthy-snakes-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@scalar/api-reference': patch
3+
---
4+
5+
refactor: new request example block

packages/api-reference/src/blocks/hooks/useBlockProps.test.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

packages/api-reference/src/blocks/hooks/useBlockProps.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.

packages/api-reference/src/components/ApiReferenceLayout.vue

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ import {
1919
hasObtrusiveScrollbars,
2020
type ThemeId,
2121
} from '@scalar/themes'
22-
import {
23-
apiReferenceConfigurationSchema,
24-
type ApiReferenceConfiguration,
25-
} from '@scalar/types/api-reference'
22+
import { apiReferenceConfigurationSchema } from '@scalar/types/api-reference'
2623
import type { Spec } from '@scalar/types/legacy'
2724
import { useBreakpoints } from '@scalar/use-hooks/useBreakpoints'
2825
import { ScalarToasts, useToasts } from '@scalar/use-toasts'
@@ -54,7 +51,6 @@ import { useNavState } from '@/hooks/useNavState'
5451
import { downloadDocument, downloadEventBus } from '@/libs/download'
5552
import { createEmptySpecification } from '@/libs/openapi'
5653
import { createPluginManager, PLUGIN_MANAGER_SYMBOL } from '@/plugins'
57-
import { useHttpClientStore } from '@/stores/useHttpClientStore'
5854
import type {
5955
ReferenceLayoutProps,
6056
ReferenceLayoutSlot,
@@ -296,27 +292,6 @@ provide(
296292
}),
297293
)
298294
299-
/** Helper utility to map configuration props to the ApiReference internal state */
300-
function mapConfigToState<K extends keyof ApiReferenceConfiguration>(
301-
key: K,
302-
setter: (val: NonNullable<ApiReferenceConfiguration[K]>) => any,
303-
) {
304-
watch(
305-
() => configuration.value[key],
306-
(newValue) => {
307-
if (typeof newValue !== 'undefined') {
308-
setter(newValue)
309-
}
310-
},
311-
{ immediate: true },
312-
)
313-
}
314-
315-
// Hides any client snippets from the references
316-
const { setExcludedClients, setDefaultHttpClient } = useHttpClientStore()
317-
mapConfigToState('defaultHttpClient', setDefaultHttpClient)
318-
mapConfigToState('hiddenClients', setExcludedClients)
319-
320295
const themeStyleTag = computed(
321296
() => `<style>
322297
${getThemeStyles(configuration.value.theme, {

packages/api-reference/src/components/Content/Content.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import type { OpenAPIV3_1 } from '@scalar/openapi-types'
77
import type { Spec } from '@scalar/types/legacy'
88
import { computed } from 'vue'
99
10+
import { ClientLibraries } from '@/components/Content/ClientLibraries'
1011
import { BaseUrl } from '@/features/base-url'
1112
import { useConfig } from '@/hooks/useConfig'
1213
13-
import { ClientLibraries } from './ClientLibraries'
1414
import { Introduction } from './Introduction'
1515
import { Loading } from './Lazy'
1616
import { Models, ModelsAccordion } from './Models'

0 commit comments

Comments
 (0)