@scalar/api-reference 1.31.2 → 1.31.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dist/browser/standalone.js +9428 -9384
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +72 -73
- package/dist/components/Badge/Badge.vue.d.ts.map +1 -1
- package/dist/components/Badge/Badge.vue.js +1 -1
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +2 -2
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue2.js +1 -1
- package/dist/components/Content/Introduction/Description.vue.d.ts.map +1 -1
- package/dist/components/Content/Introduction/Description.vue.js +2 -2
- package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
- package/dist/components/Content/Lazy/Loading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.js +77 -113
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +114 -105
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +35 -35
- package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.js +17 -15
- package/dist/components/Content/Schema/helpers/schema-name.d.ts +16 -0
- package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/schema-name.js +32 -0
- package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/OperationsList.vue.js +1 -1
- package/dist/components/Content/Tag/OperationsList.vue2.js +10 -9
- package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/OperationsListItem.vue.js +1 -1
- package/dist/components/Content/Tag/OperationsListItem.vue2.js +29 -28
- package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/TagList.vue.js +35 -34
- package/dist/components/DocumentSelector/DocumentSelector.vue.d.ts.map +1 -1
- package/dist/components/DocumentSelector/DocumentSelector.vue.js +21 -28
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +1 -20
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +12 -13
- package/dist/components/Section/CompactSection.vue.js +2 -2
- package/dist/components/Section/CompactSection.vue2.js +6 -6
- package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +2 -2
- package/dist/components/Sidebar/Sidebar.vue2.js +1 -1
- package/dist/components/Sidebar/SidebarElement.vue.js +1 -1
- package/dist/components/Sidebar/SidebarElement.vue2.js +5 -5
- package/dist/esm.d.ts.map +1 -1
- package/dist/features/DocumentSource/hooks/useDocumentFetcher.js +1 -1
- package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts +1 -1
- package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts.map +1 -1
- package/dist/features/DocumentSource/hooks/useDocumentSource.js +11 -11
- package/dist/features/DownloadLink/DownloadLink.vue.d.ts +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue2.js +45 -28
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue2.js +1 -1
- package/dist/features/Operation/components/ParameterHeaders.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterHeaders.vue.js +2 -2
- package/dist/features/Search/SearchButton.vue.d.ts.map +1 -1
- package/dist/features/Search/SearchButton.vue.js +2 -2
- package/dist/features/Search/SearchButton.vue2.js +16 -16
- package/dist/features/Search/SearchModal.vue.d.ts.map +1 -1
- package/dist/features/Search/SearchModal.vue.js +2 -2
- package/dist/features/Search/SearchModal.vue2.js +1 -1
- package/dist/features/Search/useSearchIndex.d.ts.map +1 -1
- package/dist/features/Search/useSearchIndex.js +29 -28
- package/dist/features/sidebar/helpers/create-sidebar.d.ts +26 -0
- package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +1 -0
- package/dist/features/sidebar/hooks/useSidebar.d.ts +23 -0
- package/dist/features/sidebar/hooks/useSidebar.d.ts.map +1 -0
- package/dist/features/sidebar/index.d.ts +2 -0
- package/dist/features/sidebar/index.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/get-tag.d.ts +4 -0
- package/dist/features/traverse-schema/helpers/get-tag.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/operation-id-params.d.ts +8 -0
- package/dist/features/traverse-schema/helpers/operation-id-params.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/operation-id-params.js +8 -0
- package/dist/features/traverse-schema/helpers/traverse-description.d.ts +9 -0
- package/dist/features/traverse-schema/helpers/traverse-description.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/traverse-document.d.ts +16 -0
- package/dist/features/traverse-schema/helpers/traverse-document.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +11 -0
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts +6 -0
- package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/traverse-tags.d.ts +9 -0
- package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -0
- package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts +6 -0
- package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -0
- package/dist/features/traverse-schema/index.d.ts +4 -0
- package/dist/features/traverse-schema/index.d.ts.map +1 -0
- package/dist/features/traverse-schema/types.d.ts +51 -0
- package/dist/features/traverse-schema/types.d.ts.map +1 -0
- package/dist/helpers/parse.d.ts.map +1 -1
- package/dist/helpers/parse.js +16 -16
- package/dist/hooks/useNavState.d.ts +9 -4
- package/dist/hooks/useNavState.d.ts.map +1 -1
- package/dist/hooks/useNavState.js +31 -29
- package/dist/hooks/useSidebar.d.ts.map +1 -1
- package/dist/hooks/useSidebar.js +69 -68
- package/dist/index.js +1 -1
- package/dist/legacy/fixtures/httpRequestMethods.js +2 -6
- package/dist/libs/download.d.ts +2 -1
- package/dist/libs/download.d.ts.map +1 -1
- package/dist/libs/download.js +23 -11
- package/dist/stores/useHttpClientStore.js +18 -18
- package/dist/style.css +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -11
- package/dist/components/HttpMethod/constants.d.ts +0 -9
- package/dist/components/HttpMethod/constants.d.ts.map +0 -1
- package/dist/components/HttpMethod/constants.js +0 -36
- package/dist/components/HttpMethod/utils/isRequestMethod.d.ts +0 -4
- package/dist/components/HttpMethod/utils/isRequestMethod.d.ts.map +0 -1
- package/dist/components/HttpMethod/utils/isRequestMethod.js +0 -7
- package/dist/helpers/freeze-element.d.ts +0 -11
- package/dist/helpers/freeze-element.d.ts.map +0 -1
- package/dist/helpers/freeze-element.js +0 -20
- package/dist/helpers/is-mac-os.d.ts +0 -5
- package/dist/helpers/is-mac-os.d.ts.map +0 -1
- package/dist/helpers/is-mac-os.js +0 -4
- package/dist/helpers/local-storage.d.ts +0 -8
- package/dist/helpers/local-storage.d.ts.map +0 -1
- package/dist/helpers/local-storage.js +0 -6
- package/dist/helpers/measure.d.ts +0 -21
- package/dist/helpers/measure.d.ts.map +0 -1
- package/dist/helpers/measure.js +0 -7
- package/dist/helpers/scroll-to-id.d.ts +0 -7
- package/dist/helpers/scroll-to-id.d.ts.map +0 -1
- package/dist/helpers/scroll-to-id.js +0 -21
- package/dist/helpers/sleep.d.ts +0 -6
- package/dist/helpers/sleep.d.ts.map +0 -1
- package/dist/helpers/sleep.js +0 -4
- package/dist/legacy/helpers/index.d.ts +0 -2
- package/dist/legacy/helpers/index.d.ts.map +0 -1
- package/dist/legacy/helpers/normalizeRequestMethod.d.ts +0 -6
- package/dist/legacy/helpers/normalizeRequestMethod.d.ts.map +0 -1
- package/dist/legacy/helpers/normalizeRequestMethod.js +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-document.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAOxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAE3F;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,aACjB,WAAW,CAAC,QAAQ,gFACgD,mBAAmB;;;CA6ClG,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import type { TraversedOperation } from '../../../features/traverse-schema/types';
|
|
3
|
+
import type { UseNavState } from '../../../hooks/useNavState.js';
|
|
4
|
+
/**
|
|
5
|
+
* Traverse the paths of the spec and build a map of tags and operations
|
|
6
|
+
*
|
|
7
|
+
* Default tag is to match what we have now we can improve later
|
|
8
|
+
* TODO: filter out internal and scalar-ignore tags
|
|
9
|
+
*/
|
|
10
|
+
export declare const traversePaths: (content: OpenAPIV3_1.Document, tagsDict: Map<string, OpenAPIV3_1.TagObject>, titlesMap: Map<string, string>, getOperationId: UseNavState["getOperationId"]) => Map<string, TraversedOperation[]>;
|
|
11
|
+
//# sourceMappingURL=traverse-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAuBtD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,YACf,WAAW,CAAC,QAAQ,YAEnB,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,aAEjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,kBACd,WAAW,CAAC,gBAAgB,CAAC,KAC5C,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAiClC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TraversedSchema } from '../../../features/traverse-schema/types';
|
|
2
|
+
import type { UseNavState } from '../../../hooks/useNavState.js';
|
|
3
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
4
|
+
/** Traverse components.schemas to create entries for models */
|
|
5
|
+
export declare const traverseSchemas: (content: OpenAPIV3_1.Document, titlesMap: Map<string, string>, getModelId: UseNavState["getModelId"]) => TraversedSchema[];
|
|
6
|
+
//# sourceMappingURL=traverse-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAoBxD,+DAA+D;AAC/D,eAAO,MAAM,eAAe,YACjB,WAAW,CAAC,QAAQ,aAElB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,cAClB,WAAW,CAAC,YAAY,CAAC,KACpC,eAAe,EAcjB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
3
|
+
import type { TraversedEntry } from '../../../features/traverse-schema/types';
|
|
4
|
+
import type { UseNavState } from '../../../hooks/useNavState.js';
|
|
5
|
+
type Options = Pick<UseNavState, 'getTagId'> & Pick<ApiReferenceConfiguration, 'tagsSorter' | 'operationsSorter'>;
|
|
6
|
+
/** Traverses our tags map creates entries, also handles sorting and tagGroups */
|
|
7
|
+
export declare const traverseTags: (content: OpenAPIV3_1.Document, tagsMap: Map<string, TraversedEntry[]>, tagsDict: Map<string, OpenAPIV3_1.TagObject>, titlesMap: Map<string, string>, { getTagId, tagsSorter, operationsSorter }: Options) => TraversedEntry[];
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=traverse-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,kCAAkC,CAAA;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGtD,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,GAAG,kBAAkB,CAAC,CAAA;AAuGjH,iFAAiF;AACjF,eAAO,MAAM,YAAY,YACd,WAAW,CAAC,QAAQ,WAEpB,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,YAE5B,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,aAEjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,8CACc,OAAO,KAClD,cAAc,EAyBhB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import type { TraversedEntry, TraversedWebhook } from '../../../features/traverse-schema/types';
|
|
3
|
+
import type { UseNavState } from '../../../hooks/useNavState.js';
|
|
4
|
+
/** When traversing webhooks, we pass in the tags in from operations to save on memory */
|
|
5
|
+
export declare const traverseWebhooks: (content: OpenAPIV3_1.Document, tagsMap: Map<string, TraversedEntry[]>, tagsDict: Map<string, OpenAPIV3_1.TagObject>, titlesMap: Map<string, string>, getWebhookId: UseNavState["getWebhookId"]) => TraversedWebhook[];
|
|
6
|
+
//# sourceMappingURL=traverse-webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAyBtD,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,YAClB,WAAW,CAAC,QAAQ,WAEpB,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,YAE5B,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,aAEjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,gBAChB,WAAW,CAAC,cAAc,CAAC,KACxC,gBAAgB,EA+BlB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/traverse-schema/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
2
|
+
import type { UseNavState } from '../../hooks/useNavState.js';
|
|
3
|
+
import type { Ref } from 'vue';
|
|
4
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
5
|
+
/** Description entry returned form traversing the document */
|
|
6
|
+
export type TraversedDescription = {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
children?: TraversedDescription[];
|
|
10
|
+
};
|
|
11
|
+
/** Operation entry returned form traversing the document */
|
|
12
|
+
export type TraversedOperation = {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
method: OpenAPIV3_1.HttpMethods;
|
|
16
|
+
path: string;
|
|
17
|
+
operation: OpenAPIV3_1.OperationObject;
|
|
18
|
+
};
|
|
19
|
+
/** Model entry returned form traversing the document */
|
|
20
|
+
export type TraversedSchema = {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
name: string;
|
|
24
|
+
schema: OpenAPIV3_1.SchemaObject;
|
|
25
|
+
};
|
|
26
|
+
/** Tag entry returned form traversing the document, includes tagGroups */
|
|
27
|
+
export type TraversedTag = {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
name: string;
|
|
31
|
+
children?: TraversedEntry[];
|
|
32
|
+
tag: OpenAPIV3_1.TagObject;
|
|
33
|
+
isGroup: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** Webhook entry returned form traversing the document, basically the same as an operaation but with name instead of path */
|
|
36
|
+
export type TraversedWebhook = {
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
method: OpenAPIV3_1.HttpMethods;
|
|
40
|
+
name: string;
|
|
41
|
+
webhook: OpenAPIV3_1.OperationObject;
|
|
42
|
+
};
|
|
43
|
+
/** Entries returned form traversing the document */
|
|
44
|
+
export type TraversedEntry = TraversedDescription | TraversedOperation | TraversedSchema | TraversedTag | TraversedWebhook;
|
|
45
|
+
/** Create sidebar options */
|
|
46
|
+
export type TraverseSpecOptions = {
|
|
47
|
+
config: Ref<ApiReferenceConfiguration>;
|
|
48
|
+
/** You can optionally pass in these refs in case you need them before the hook is instantiated */
|
|
49
|
+
isSidebarOpen?: Ref<boolean>;
|
|
50
|
+
} & Pick<UseNavState, 'getHeadingId' | 'getModelId' | 'getOperationId' | 'getSectionId' | 'getTagId' | 'getWebhookId'>;
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/traverse-schema/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,8DAA8D;AAC9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAClC,CAAA;AAED,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,WAAW,CAAC,WAAW,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,WAAW,CAAC,eAAe,CAAA;CACvC,CAAA;AAED,wDAAwD;AACxD,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,WAAW,CAAC,YAAY,CAAA;CACjC,CAAA;AAED,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;IAC3B,GAAG,EAAE,WAAW,CAAC,SAAS,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,6HAA6H;AAC7H,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,WAAW,CAAC,WAAW,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,WAAW,CAAC,eAAe,CAAA;CACrC,CAAA;AAED,oDAAoD;AACpD,MAAM,MAAM,cAAc,GACtB,oBAAoB,GACpB,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,gBAAgB,CAAA;AAEpB,6BAA6B;AAC7B,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,kGAAkG;IAClG,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAC7B,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,YAAY,GAAG,gBAAgB,GAAG,cAAc,GAAG,UAAU,GAAG,cAAc,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/helpers/parse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/helpers/parse.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAQhD;;;;GAIG;AACH,eAAO,MAAM,KAAK,yBAA0B,WAAW,CAAC,QAAQ,KAAG,OAAO,CAAC,IAAI,CAmB9E,CAAA"}
|
package/dist/helpers/parse.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { shouldIgnoreEntity as
|
|
1
|
+
import { shouldIgnoreEntity as m } from "@scalar/oas-utils/helpers";
|
|
2
2
|
import { createEmptySpecification as w } from "../libs/openapi.js";
|
|
3
|
-
import {
|
|
4
|
-
import { validRequestMethods as
|
|
3
|
+
import { normalizeHttpMethod as P } from "@scalar/helpers/http/normalize-http-method";
|
|
4
|
+
import { validRequestMethods as A } from "../legacy/fixtures/httpRequestMethods.js";
|
|
5
5
|
const C = (c) => new Promise(async (t, p) => {
|
|
6
6
|
try {
|
|
7
7
|
return t(b(c || w()));
|
|
@@ -17,22 +17,22 @@ const C = (c) => new Promise(async (t, p) => {
|
|
|
17
17
|
return Object.keys(t.webhooks ?? {}).forEach((s) => {
|
|
18
18
|
var d;
|
|
19
19
|
Object.keys(((d = t.webhooks) == null ? void 0 : d[s]) ?? {}).forEach((r) => {
|
|
20
|
-
var n,
|
|
20
|
+
var n, u, h, g;
|
|
21
21
|
const e = (n = t.webhooks) == null ? void 0 : n[s][r];
|
|
22
|
-
if (!(!e ||
|
|
22
|
+
if (!(!e || m(e))) {
|
|
23
23
|
if (Array.isArray(e.tags)) {
|
|
24
|
-
const o = (
|
|
24
|
+
const o = (u = e.tags) == null ? void 0 : u.map(
|
|
25
25
|
(a) => {
|
|
26
26
|
var y;
|
|
27
27
|
return (y = t.tags) == null ? void 0 : y.find((i) => i.name === a);
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
|
-
if (e.tags = o == null ? void 0 : o.filter((a) => !
|
|
30
|
+
if (e.tags = o == null ? void 0 : o.filter((a) => !m(a)), o != null && o.some((a) => m(a)))
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
p[s] === void 0 && (p[s] = {}), p[s][r] = {
|
|
34
34
|
// Transformed data
|
|
35
|
-
httpVerb:
|
|
35
|
+
httpVerb: P(r),
|
|
36
36
|
path: s,
|
|
37
37
|
operationId: (e == null ? void 0 : e.operationId) || s,
|
|
38
38
|
name: (e == null ? void 0 : e.summary) || s || "",
|
|
@@ -47,17 +47,17 @@ const C = (c) => new Promise(async (t, p) => {
|
|
|
47
47
|
});
|
|
48
48
|
}), Object.keys(((E = t.components) == null ? void 0 : E.schemas) ?? {}).forEach((s) => {
|
|
49
49
|
var d, r, e, n;
|
|
50
|
-
|
|
50
|
+
m((r = (d = t.components) == null ? void 0 : d.schemas) == null ? void 0 : r[s]) && ((n = (e = t.components) == null ? void 0 : e.schemas) == null || delete n[s]);
|
|
51
51
|
}), Object.keys(t.paths).forEach((s) => {
|
|
52
52
|
Object.keys(t.paths[s]).filter(
|
|
53
|
-
(r) =>
|
|
53
|
+
(r) => A.includes(r.toUpperCase())
|
|
54
54
|
).forEach((r) => {
|
|
55
|
-
var
|
|
55
|
+
var u, h, g, o, a, y;
|
|
56
56
|
const e = t.paths[s][r];
|
|
57
|
-
if (e === void 0 ||
|
|
57
|
+
if (e === void 0 || m(e))
|
|
58
58
|
return;
|
|
59
59
|
const n = {
|
|
60
|
-
httpVerb:
|
|
60
|
+
httpVerb: P(r),
|
|
61
61
|
path: s,
|
|
62
62
|
operationId: e.operationId || s,
|
|
63
63
|
name: e.summary || s || "",
|
|
@@ -65,7 +65,7 @@ const C = (c) => new Promise(async (t, p) => {
|
|
|
65
65
|
information: {
|
|
66
66
|
...e
|
|
67
67
|
},
|
|
68
|
-
pathParameters: (h = (
|
|
68
|
+
pathParameters: (h = (u = t.paths) == null ? void 0 : u[s]) == null ? void 0 : h.parameters
|
|
69
69
|
};
|
|
70
70
|
if (!e.tags || e.tags.length === 0) {
|
|
71
71
|
(g = t.tags) != null && g.find((f) => f.name === "default") || (o = t.tags) == null || o.push({
|
|
@@ -78,7 +78,7 @@ const C = (c) => new Promise(async (t, p) => {
|
|
|
78
78
|
} else
|
|
79
79
|
e.tags.forEach((i) => {
|
|
80
80
|
var k, x, j;
|
|
81
|
-
const f = (k = t.tags) == null ? void 0 : k.findIndex((
|
|
81
|
+
const f = (k = t.tags) == null ? void 0 : k.findIndex((R) => R.name === i);
|
|
82
82
|
f === -1 && ((x = t.tags) == null || x.push({
|
|
83
83
|
name: i,
|
|
84
84
|
description: ""
|
|
@@ -87,7 +87,7 @@ const C = (c) => new Promise(async (t, p) => {
|
|
|
87
87
|
typeof ((j = t.tags[I]) == null ? void 0 : j.operations) > "u" && (t.tags[I].operations = []), t.tags[I].operations.push(n);
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
-
}), t.tags = (O = t.tags) == null ? void 0 : O.filter((s) => !
|
|
90
|
+
}), t.tags = (O = t.tags) == null ? void 0 : O.filter((s) => !m(s)), {
|
|
91
91
|
...t,
|
|
92
92
|
webhooks: p
|
|
93
93
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
2
|
-
import type { Heading,
|
|
2
|
+
import type { Heading, OpenAPIV3_1 } from '@scalar/types/legacy';
|
|
3
3
|
import { type InjectionKey, type Ref } from 'vue';
|
|
4
4
|
export type NavState = {
|
|
5
5
|
/** The URL hash without the #, also the "hash" pulled from pathRouting */
|
|
@@ -45,16 +45,21 @@ export declare const useNavState: (_config?: Ref<ApiReferenceConfiguration>) =>
|
|
|
45
45
|
getWebhookId: (webhook?: {
|
|
46
46
|
name: string;
|
|
47
47
|
method?: string;
|
|
48
|
-
}) => string;
|
|
48
|
+
}, parentTag?: OpenAPIV3_1.TagObject) => string;
|
|
49
49
|
getModelId: (model?: {
|
|
50
50
|
name: string;
|
|
51
51
|
}) => string;
|
|
52
52
|
getHeadingId: (heading: Heading) => string;
|
|
53
|
-
getOperationId: (operation:
|
|
53
|
+
getOperationId: (operation: {
|
|
54
|
+
path: string;
|
|
55
|
+
method: OpenAPIV3_1.HttpMethods;
|
|
56
|
+
} & OpenAPIV3_1.OperationObject, parentTag: OpenAPIV3_1.TagObject) => string;
|
|
54
57
|
getPathRoutingId: (pathName: string) => string;
|
|
55
58
|
getSectionId: (hashStr?: string) => string;
|
|
56
|
-
getTagId: (tag:
|
|
59
|
+
getTagId: (tag: OpenAPIV3_1.TagObject) => string;
|
|
57
60
|
isIntersectionEnabled: Ref<boolean, boolean>;
|
|
58
61
|
updateHash: () => string;
|
|
59
62
|
};
|
|
63
|
+
/** Whats returned from the hook */
|
|
64
|
+
export type UseNavState = ReturnType<typeof useNavState>;
|
|
60
65
|
//# sourceMappingURL=useNavState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,EAAe,MAAM,KAAK,CAAA;AAE9D,MAAM,MAAM,QAAQ,GAAG;IACrB,0EAA0E;IAC1E,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjB,2CAA2C;IAC3C,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACvB,sFAAsF;IACtF,qBAAqB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACpC,CAAA;AACD,eAAO,MAAM,gBAAgB,EAAe,YAAY,CAAC,QAAQ,CAAC,CAAA;AAOlE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,aAAc,GAAG,CAAC,yBAAyB,CAAC;;IAiJhE,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BA/E4B,MAAM;IAiFrC;;;;;OAKG;oCArGkC,MAAM;IAuG3C;;;OAGG;uCA5HqC,MAAM;;6BAwFhB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,cAAc,WAAW,CAAC,SAAS;yBArCxE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BAXb,OAAO;gCA8BzB;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,WAAW,CAAC,WAAW,CAAA;KAChC,GAAG,WAAW,CAAC,eAAe,aACpB,WAAW,CAAC,SAAS;iCA1GE,MAAM;;oBA8FnB,WAAW,CAAC,SAAS;;;CA2E7C,CAAA;AAED,mCAAmC;AACnC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useConfig as b } from "./useConfig.js";
|
|
2
|
-
import { combineUrlAndPath as d } from "@scalar/
|
|
2
|
+
import { combineUrlAndPath as d } from "@scalar/helpers/url/merge-urls";
|
|
3
3
|
import { slug as i } from "github-slugger";
|
|
4
4
|
import { inject as y, ref as l } from "vue";
|
|
5
|
-
const P = Symbol(), U = l(!1),
|
|
5
|
+
const P = Symbol(), U = l(!1), x = l(""), k = l(""), T = (f) => {
|
|
6
6
|
const { isIntersectionEnabled: p, hash: r, hashPrefix: u } = y(P, {
|
|
7
7
|
isIntersectionEnabled: U,
|
|
8
|
-
hash:
|
|
9
|
-
hashPrefix:
|
|
8
|
+
hash: x,
|
|
9
|
+
hashPrefix: k
|
|
10
10
|
}), t = f ?? b(), g = (e) => {
|
|
11
|
-
var
|
|
11
|
+
var a;
|
|
12
12
|
if (!t.value.pathRouting)
|
|
13
13
|
return "";
|
|
14
|
-
const
|
|
15
|
-
return decodeURIComponent(e.replace(
|
|
14
|
+
const n = new RegExp("^" + ((a = t.value.pathRouting) == null ? void 0 : a.basePath) + "/?");
|
|
15
|
+
return decodeURIComponent(e.replace(n, ""));
|
|
16
16
|
}, v = (e = r.value) => {
|
|
17
17
|
var h;
|
|
18
|
-
const
|
|
19
|
-
return
|
|
18
|
+
const n = (h = e.match(/(tag\/[^/]+)/)) == null ? void 0 : h[0], a = e.startsWith("model") ? "models" : "", o = e.startsWith("webhook") ? "webhooks" : "";
|
|
19
|
+
return n || a || o;
|
|
20
20
|
}, c = () => t.value.pathRouting ? g(window.location.pathname) : (
|
|
21
21
|
// Must remove the prefix from the hash as the internal hash value should be pure
|
|
22
22
|
decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(u.value.length)
|
|
23
|
-
), m = () => r.value = c(), I = (e,
|
|
24
|
-
const
|
|
25
|
-
t.value.pathRouting ?
|
|
26
|
-
},
|
|
27
|
-
const o = new URL(
|
|
28
|
-
return t.value.pathRouting ? o.pathname = d(t.value.pathRouting.basePath, e) : o.hash = u.value + e, o.search =
|
|
29
|
-
},
|
|
23
|
+
), m = () => r.value = c(), I = (e, n = window.location.href) => {
|
|
24
|
+
const a = new URL(n);
|
|
25
|
+
t.value.pathRouting ? a.pathname = d(t.value.pathRouting.basePath, e) : a.hash = u.value + e, r.value = e, window.history.replaceState({}, "", a);
|
|
26
|
+
}, $ = (e, n = window.location.href, a = window.location.search) => {
|
|
27
|
+
const o = new URL(n);
|
|
28
|
+
return t.value.pathRouting ? o.pathname = d(t.value.pathRouting.basePath, e) : o.hash = u.value + e, o.search = a, o.toString();
|
|
29
|
+
}, w = (e = r.value) => `${u.value}${e}`, S = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", R = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${i(e.name)}` : "models", s = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${i(e.name ?? "")}`;
|
|
30
30
|
return {
|
|
31
31
|
hash: r,
|
|
32
32
|
/** Sets the prefix for the hash */
|
|
@@ -38,32 +38,34 @@ const P = Symbol(), U = l(!1), k = l(""), x = l(""), T = (f) => {
|
|
|
38
38
|
* @param hashTarget The hash to target with the return
|
|
39
39
|
* @returns The full hash
|
|
40
40
|
*/
|
|
41
|
-
getFullHash:
|
|
41
|
+
getFullHash: w,
|
|
42
42
|
/**
|
|
43
43
|
* Gets the hashed url with the prefix
|
|
44
44
|
* @param replacementHash The hash to replace the current hash with
|
|
45
45
|
* @param url The url to get the hashed url from
|
|
46
46
|
* @returns The hashed url
|
|
47
47
|
*/
|
|
48
|
-
getHashedUrl:
|
|
48
|
+
getHashedUrl: $,
|
|
49
49
|
/**
|
|
50
50
|
* Replaces the URL state with the new url and hash
|
|
51
51
|
* Replacement is used so that hash changes don't trigger the url hash watcher and cause a scroll
|
|
52
52
|
*/
|
|
53
53
|
replaceUrlState: I,
|
|
54
54
|
getReferenceId: c,
|
|
55
|
-
getWebhookId: (e) =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return typeof t.value.generateOperationSlug == "function" ? `${s(a)}/${t.value.generateOperationSlug({
|
|
61
|
-
path: e.path,
|
|
62
|
-
operationId: e.operationId,
|
|
63
|
-
method: e.httpVerb,
|
|
64
|
-
summary: (n = e.information) == null ? void 0 : n.summary
|
|
65
|
-
})}` : `${s(a)}/${e.httpVerb}${e.path}`;
|
|
55
|
+
getWebhookId: (e, n) => {
|
|
56
|
+
if (!(e != null && e.name))
|
|
57
|
+
return "webhooks";
|
|
58
|
+
const a = n ? `${s(n)}/` : "";
|
|
59
|
+
return typeof t.value.generateWebhookSlug == "function" ? `${a}webhook/${t.value.generateWebhookSlug(e)}` : `${a}webhook/${e.method}/${i(e.name)}`;
|
|
66
60
|
},
|
|
61
|
+
getModelId: R,
|
|
62
|
+
getHeadingId: S,
|
|
63
|
+
getOperationId: (e, n) => typeof t.value.generateOperationSlug == "function" ? `${s(n)}/${t.value.generateOperationSlug({
|
|
64
|
+
path: e.path,
|
|
65
|
+
operationId: e.operationId,
|
|
66
|
+
method: e.method,
|
|
67
|
+
summary: e.summary
|
|
68
|
+
})}` : `${s(n)}/${e.method}${e.path}`,
|
|
67
69
|
getPathRoutingId: g,
|
|
68
70
|
getSectionId: v,
|
|
69
71
|
getTagId: s,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSidebar.d.ts","sourceRoot":"","sources":["../../src/hooks/useSidebar.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"useSidebar.d.ts","sourceRoot":"","sources":["../../src/hooks/useSidebar.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI3E,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AAcvD,uDAAuD;AACvD,iBAAS,aAAa,CAAC,IAAI,EAAE,IAAI,QA0ChC;AAMD,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAIpD,iBAAS,0BAA0B,CAAC,GAAG,EAAE,MAAM,QAE9C;AAED,iBAAS,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,QAE3D;AAkOD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,IAAI,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM,CAAC,CAAA;IACnD,gBAAgB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,oBAAoB,KAAK,MAAM,CAAC,CAAA;CACvG,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,UAAU,OAAO,SAiBrE,CAAA;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,YAAY;;;;;;;;;;;;;qCAtBrB,MAAM,UAAU,OAAO;EA8FrE"}
|
package/dist/hooks/useSidebar.js
CHANGED
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
import { lazyBus as
|
|
2
|
-
import { scrollToId as F } from "
|
|
3
|
-
import { useNavState as
|
|
4
|
-
import { getHeadingsFromMarkdown as
|
|
5
|
-
import { isOperationDeprecated as U, hasModels as
|
|
6
|
-
import { ssrState as
|
|
7
|
-
import { reactive as
|
|
8
|
-
|
|
1
|
+
import { lazyBus as Z } from "../components/Content/Lazy/lazyBus.js";
|
|
2
|
+
import { scrollToId as F } from "@scalar/helpers/dom/scroll-to-id";
|
|
3
|
+
import { useNavState as $ } from "./useNavState.js";
|
|
4
|
+
import { getHeadingsFromMarkdown as ee, getLowestHeadingLevel as z } from "../libs/markdown.js";
|
|
5
|
+
import { isOperationDeprecated as U, hasModels as te, getModels as _, hasWebhooks as se } from "../libs/openapi.js";
|
|
6
|
+
import { ssrState as re } from "@scalar/oas-utils/helpers";
|
|
7
|
+
import { reactive as q, ref as w, watch as N, computed as J } from "vue";
|
|
8
|
+
import { operationIdParams as P } from "../features/traverse-schema/helpers/operation-id-params.js";
|
|
9
|
+
const oe = "introduction", O = w(null), c = w(void 0), g = q({});
|
|
9
10
|
function R(t) {
|
|
10
|
-
var p, s,
|
|
11
|
-
g.tagsSorter === "alpha" ? t.tags = (p = t.tags) == null ? void 0 : p.sort((r,
|
|
12
|
-
const a = (r,
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
}, i = (r,
|
|
11
|
+
var p, s, n;
|
|
12
|
+
g.tagsSorter === "alpha" ? t.tags = (p = t.tags) == null ? void 0 : p.sort((r, l) => r.name.localeCompare(l.name)) : typeof g.tagsSorter == "function" && (t.tags = (s = t.tags) == null ? void 0 : s.sort(g.tagsSorter));
|
|
13
|
+
const a = (r, l) => {
|
|
14
|
+
const I = r.name ?? r.path, m = l.name ?? l.path;
|
|
15
|
+
return I.localeCompare(m);
|
|
16
|
+
}, i = (r, l) => r.httpVerb.localeCompare(l.httpVerb);
|
|
16
17
|
let d;
|
|
17
|
-
return g.operationsSorter === "alpha" ? d = a : g.operationsSorter === "method" ? d = i : typeof g.operationsSorter == "function" && (d = g.operationsSorter), d && ((
|
|
18
|
-
var
|
|
19
|
-
r.operations = (
|
|
18
|
+
return g.operationsSorter === "alpha" ? d = a : g.operationsSorter === "method" ? d = i : typeof g.operationsSorter == "function" && (d = g.operationsSorter), d && ((n = t.tags) == null || n.forEach((r) => {
|
|
19
|
+
var l;
|
|
20
|
+
r.operations = (l = r.operations) == null ? void 0 : l.sort(d);
|
|
20
21
|
})), c.value = t;
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
-
function
|
|
23
|
+
const K = w(!1), Q = w(!1), y = q(re["useSidebarContent-collapsedSidebarItems"] ?? {});
|
|
24
|
+
function ae(t) {
|
|
24
25
|
y[t] = !y[t];
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function T(t, a) {
|
|
27
28
|
y[t] = a;
|
|
28
29
|
}
|
|
29
30
|
const x = w([]);
|
|
30
|
-
function
|
|
31
|
-
const a =
|
|
31
|
+
function ie(t) {
|
|
32
|
+
const a = ee(t), i = z(a);
|
|
32
33
|
return a.filter((d) => (
|
|
33
34
|
// highest level, eg. # Introduction
|
|
34
35
|
d.depth === i || // second highest level, eg. ## Authentication
|
|
35
36
|
d.depth === i + 1
|
|
36
37
|
));
|
|
37
38
|
}
|
|
38
|
-
const
|
|
39
|
+
const X = J(() => {
|
|
39
40
|
var M, C, E, B, D, L, j, G, V, W;
|
|
40
41
|
if (!O.value)
|
|
41
42
|
return { entries: [], titles: {} };
|
|
42
|
-
const { getHeadingId: t, getModelId: a, getOperationId: i, getTagId: d, getWebhookId: p } = O.value, s = {},
|
|
43
|
+
const { getHeadingId: t, getModelId: a, getOperationId: i, getTagId: d, getWebhookId: p } = O.value, s = {}, n = [];
|
|
43
44
|
let r = null;
|
|
44
45
|
x.value.forEach((e) => {
|
|
45
46
|
var o;
|
|
@@ -48,13 +49,13 @@ const Q = q(() => {
|
|
|
48
49
|
title: e.value,
|
|
49
50
|
show: !0,
|
|
50
51
|
children: []
|
|
51
|
-
},
|
|
52
|
+
}, n.push(r)) : r && ((o = r.children) == null || o.push({
|
|
52
53
|
id: t(e),
|
|
53
54
|
title: e.value,
|
|
54
55
|
show: !0
|
|
55
56
|
}));
|
|
56
57
|
});
|
|
57
|
-
const
|
|
58
|
+
const l = (C = (M = c.value) == null ? void 0 : M.tags) == null ? void 0 : C[0], m = l && ((e) => (e == null ? void 0 : e.length) !== 1 || e[0].name !== "default" || e[0].description !== "")((E = c.value) == null ? void 0 : E.tags) ? (D = (B = c.value) == null ? void 0 : B.tags) == null ? void 0 : D.filter((e) => {
|
|
58
59
|
var o;
|
|
59
60
|
return ((o = e.operations) == null ? void 0 : o.length) > 0;
|
|
60
61
|
}).map((e) => {
|
|
@@ -66,7 +67,7 @@ const Q = q(() => {
|
|
|
66
67
|
show: !0,
|
|
67
68
|
children: (o = e.operations) == null ? void 0 : o.map((u) => {
|
|
68
69
|
var v, b;
|
|
69
|
-
const f = i(u, e), h = u.name ?? u.path;
|
|
70
|
+
const f = i(P(u), e), h = u.name ?? u.path;
|
|
70
71
|
return s[f] = h, {
|
|
71
72
|
id: f,
|
|
72
73
|
title: h,
|
|
@@ -82,9 +83,9 @@ const Q = q(() => {
|
|
|
82
83
|
};
|
|
83
84
|
})
|
|
84
85
|
};
|
|
85
|
-
}) : (L =
|
|
86
|
+
}) : (L = l == null ? void 0 : l.operations) == null ? void 0 : L.map((e) => {
|
|
86
87
|
var f, h;
|
|
87
|
-
const o = i(e,
|
|
88
|
+
const o = i(P(e), l), u = e.name ?? e.path;
|
|
88
89
|
return s[o] = u, {
|
|
89
90
|
id: o,
|
|
90
91
|
title: u,
|
|
@@ -99,7 +100,7 @@ const Q = q(() => {
|
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
});
|
|
102
|
-
let S =
|
|
103
|
+
let S = te(c.value) && !K.value ? [
|
|
103
104
|
{
|
|
104
105
|
id: a(),
|
|
105
106
|
title: "Models",
|
|
@@ -114,7 +115,7 @@ const Q = q(() => {
|
|
|
114
115
|
};
|
|
115
116
|
})
|
|
116
117
|
}
|
|
117
|
-
] : [], k =
|
|
118
|
+
] : [], k = se(c.value) ? [
|
|
118
119
|
{
|
|
119
120
|
id: p(),
|
|
120
121
|
title: "Webhooks",
|
|
@@ -136,7 +137,7 @@ const Q = q(() => {
|
|
|
136
137
|
})
|
|
137
138
|
}
|
|
138
139
|
] : [];
|
|
139
|
-
const
|
|
140
|
+
const Y = (G = c.value) != null && G["x-tagGroups"] ? (W = (V = c.value) == null ? void 0 : V["x-tagGroups"]) == null ? void 0 : W.map((e) => {
|
|
140
141
|
var f;
|
|
141
142
|
const o = [];
|
|
142
143
|
return (f = e.tags) == null || f.map((h) => {
|
|
@@ -156,92 +157,92 @@ const Q = q(() => {
|
|
|
156
157
|
isGroup: !0
|
|
157
158
|
};
|
|
158
159
|
}) : void 0, H = [
|
|
159
|
-
...
|
|
160
|
-
...
|
|
160
|
+
...n,
|
|
161
|
+
...Y ?? m ?? [],
|
|
161
162
|
...k,
|
|
162
163
|
...S
|
|
163
164
|
];
|
|
164
|
-
return
|
|
165
|
-
|
|
165
|
+
return Q.value && H.forEach((e) => {
|
|
166
|
+
T(e.id, !0), e.show = !0;
|
|
166
167
|
}), {
|
|
167
168
|
entries: H,
|
|
168
169
|
titles: s
|
|
169
170
|
};
|
|
170
|
-
}),
|
|
171
|
+
}), ne = w(!1), le = J(() => {
|
|
171
172
|
var t, a, i;
|
|
172
|
-
return ((i = (t =
|
|
173
|
-
}),
|
|
173
|
+
return ((i = (t = X.value) == null ? void 0 : t.titles) == null ? void 0 : i[((a = O.value) == null ? void 0 : a.hash) ?? ""]) ?? "";
|
|
174
|
+
}), ue = (t, a) => {
|
|
174
175
|
var d;
|
|
175
176
|
const i = (d = O.value) == null ? void 0 : d.getSectionId(t);
|
|
176
177
|
if (i && i !== t)
|
|
177
178
|
if (y[i])
|
|
178
179
|
F(t, a);
|
|
179
180
|
else {
|
|
180
|
-
const p =
|
|
181
|
+
const p = Z.on((s) => {
|
|
181
182
|
s.id === t && (F(t, a), p());
|
|
182
183
|
});
|
|
183
|
-
|
|
184
|
+
T(i, !0);
|
|
184
185
|
}
|
|
185
186
|
};
|
|
186
|
-
function
|
|
187
|
+
function be(t) {
|
|
187
188
|
Object.assign(g, t);
|
|
188
|
-
const a =
|
|
189
|
+
const a = $();
|
|
189
190
|
O.value = a;
|
|
190
191
|
const { hash: i, getSectionId: d, getTagId: p } = a;
|
|
191
192
|
return t != null && t.parsedSpec && (R(t.parsedSpec), N(
|
|
192
193
|
() => {
|
|
193
|
-
var s,
|
|
194
|
-
return (
|
|
194
|
+
var s, n;
|
|
195
|
+
return (n = (s = c.value) == null ? void 0 : s.tags) == null ? void 0 : n.length;
|
|
195
196
|
},
|
|
196
197
|
() => {
|
|
197
|
-
var s,
|
|
198
|
+
var s, n;
|
|
198
199
|
if (i.value) {
|
|
199
200
|
const r = d(i.value);
|
|
200
|
-
r &&
|
|
201
|
+
r && T(r, !0);
|
|
201
202
|
} else {
|
|
202
|
-
const r = (
|
|
203
|
-
r &&
|
|
203
|
+
const r = (n = (s = c.value) == null ? void 0 : s.tags) == null ? void 0 : n[0];
|
|
204
|
+
r && T(p(r), !0);
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
207
|
), N(
|
|
207
208
|
() => {
|
|
208
|
-
var s,
|
|
209
|
-
return (
|
|
209
|
+
var s, n;
|
|
210
|
+
return (n = (s = c.value) == null ? void 0 : s.info) == null ? void 0 : n.description;
|
|
210
211
|
},
|
|
211
212
|
() => {
|
|
212
|
-
var r,
|
|
213
|
-
const s = (
|
|
213
|
+
var r, l, I, m;
|
|
214
|
+
const s = (I = (l = (r = c.value) == null ? void 0 : r.info) == null ? void 0 : l.description) == null ? void 0 : I.trim();
|
|
214
215
|
if (!s)
|
|
215
216
|
return x.value = [];
|
|
216
|
-
const
|
|
217
|
+
const n = ie(s);
|
|
217
218
|
if (s && !s.startsWith("#")) {
|
|
218
219
|
const S = {
|
|
219
|
-
depth: ((m =
|
|
220
|
+
depth: ((m = n[0]) == null ? void 0 : m.depth) ?? 1,
|
|
220
221
|
value: "Introduction",
|
|
221
|
-
slug:
|
|
222
|
+
slug: oe
|
|
222
223
|
};
|
|
223
|
-
|
|
224
|
+
n.unshift(S);
|
|
224
225
|
}
|
|
225
|
-
return x.value =
|
|
226
|
+
return x.value = n;
|
|
226
227
|
},
|
|
227
228
|
{
|
|
228
229
|
immediate: !0
|
|
229
230
|
}
|
|
230
231
|
)), {
|
|
231
232
|
breadcrumb: le,
|
|
232
|
-
items:
|
|
233
|
-
isSidebarOpen:
|
|
233
|
+
items: X,
|
|
234
|
+
isSidebarOpen: ne,
|
|
234
235
|
collapsedSidebarItems: y,
|
|
235
|
-
toggleCollapsedSidebarItem:
|
|
236
|
-
setCollapsedSidebarItem:
|
|
237
|
-
hideModels:
|
|
236
|
+
toggleCollapsedSidebarItem: ae,
|
|
237
|
+
setCollapsedSidebarItem: T,
|
|
238
|
+
hideModels: K,
|
|
238
239
|
setParsedSpec: R,
|
|
239
|
-
defaultOpenAllTags:
|
|
240
|
-
scrollToOperation:
|
|
240
|
+
defaultOpenAllTags: Q,
|
|
241
|
+
scrollToOperation: ue
|
|
241
242
|
};
|
|
242
243
|
}
|
|
243
244
|
export {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
oe as DEFAULT_INTRODUCTION_SLUG,
|
|
246
|
+
ue as scrollToOperation,
|
|
247
|
+
be as useSidebar
|
|
247
248
|
};
|