@scalar/api-reference 1.25.102 → 1.25.104

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/blocks/constants.d.ts +9 -0
  3. package/dist/blocks/constants.d.ts.map +1 -0
  4. package/dist/blocks/constants.js +8 -0
  5. package/dist/blocks/helpers/getPointer.d.ts +22 -0
  6. package/dist/blocks/helpers/getPointer.d.ts.map +1 -0
  7. package/dist/blocks/helpers/getPointer.js +12 -0
  8. package/dist/blocks/hooks/useBlockProps.d.ts +32 -0
  9. package/dist/blocks/hooks/useBlockProps.d.ts.map +1 -0
  10. package/dist/blocks/hooks/useBlockProps.js +28 -0
  11. package/dist/browser/standalone.js +12846 -12739
  12. package/dist/browser/webpack-stats.json +1 -1
  13. package/dist/components/ApiReference.vue.js +31 -31
  14. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  15. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  16. package/dist/components/ApiReferenceLayout.vue2.js +2 -1
  17. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
  19. package/dist/components/Content/Introduction/Introduction.vue2.js +84 -70
  20. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -0
  21. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
  23. package/dist/components/Content/Schema/SchemaProperty.vue2.js +118 -111
  24. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +3 -3
  26. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +91 -77
  27. package/dist/components/Content/Schema/helpers/formatExample.d.ts +5 -0
  28. package/dist/components/Content/Schema/helpers/formatExample.d.ts.map +1 -0
  29. package/dist/components/Content/Schema/helpers/formatExample.js +6 -0
  30. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts +9 -0
  31. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts.map +1 -0
  32. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.js +20 -0
  33. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -1
  34. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  35. package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
  36. package/dist/components/Layouts/ClassicLayout.vue.js +30 -27
  37. package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
  38. package/dist/components/Layouts/ModernLayout.vue.js +2 -2
  39. package/dist/components/Layouts/ModernLayout.vue2.js +55 -50
  40. package/dist/features/ApiClientModal/useApiClient.d.ts +336 -254
  41. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  42. package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -1
  43. package/dist/features/DownloadLink/DownloadLink.vue.js +2 -2
  44. package/dist/features/DownloadLink/DownloadLink.vue2.js +10 -3
  45. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  46. package/dist/features/Operation/Operation.vue.js +37 -26
  47. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  48. package/dist/features/Operation/components/OperationResponses.vue.js +8 -7
  49. package/dist/features/Operation/components/ParameterList.vue.d.ts +2 -0
  50. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  51. package/dist/features/Operation/components/ParameterList.vue.js +2 -2
  52. package/dist/features/Operation/components/ParameterList.vue2.js +18 -16
  53. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +2 -0
  54. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  55. package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
  56. package/dist/features/Operation/components/ParameterListItem.vue2.js +27 -25
  57. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -0
  58. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  59. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  60. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +108 -101
  61. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -0
  62. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  63. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  64. package/dist/features/Operation/layouts/ModernLayout.vue2.js +54 -50
  65. package/dist/helpers/get-request.d.ts +2 -0
  66. package/dist/helpers/get-request.d.ts.map +1 -1
  67. package/dist/helpers/parse.d.ts.map +1 -1
  68. package/dist/helpers/parse.js +88 -68
  69. package/dist/index.d.ts +0 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +79 -83
  72. package/dist/style.css +1 -1
  73. package/package.json +11 -12
  74. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.d.ts +0 -10
  75. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.d.ts.map +0 -1
  76. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.js +0 -7
  77. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue2.js +0 -30
  78. package/dist/components/DarkModeToggle/DarkModeToggle.vue.d.ts +0 -11
  79. package/dist/components/DarkModeToggle/DarkModeToggle.vue.d.ts.map +0 -1
  80. package/dist/components/DarkModeToggle/DarkModeToggle.vue.js +0 -7
  81. package/dist/components/DarkModeToggle/DarkModeToggle.vue2.js +0 -31
  82. package/dist/components/DarkModeToggle/index.d.ts +0 -3
  83. package/dist/components/DarkModeToggle/index.d.ts.map +0 -1
  84. package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts +0 -10
  85. package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts.map +0 -1
  86. package/dist/embeds/ExampleRequest/index.d.ts +0 -2
  87. package/dist/embeds/ExampleRequest/index.d.ts.map +0 -1
  88. package/dist/embeds/ExampleResponses/ExampleResponses.vue.d.ts +0 -7
  89. package/dist/embeds/ExampleResponses/ExampleResponses.vue.d.ts.map +0 -1
  90. package/dist/embeds/ExampleResponses/index.d.ts +0 -2
  91. package/dist/embeds/ExampleResponses/index.d.ts.map +0 -1
  92. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +0 -782
  93. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts.map +0 -1
  94. package/dist/embeds/OpenApiDocument/index.d.ts +0 -3
  95. package/dist/embeds/OpenApiDocument/index.d.ts.map +0 -1
  96. package/dist/embeds/OpenApiDocument/types.d.ts +0 -3
  97. package/dist/embeds/OpenApiDocument/types.d.ts.map +0 -1
  98. package/dist/embeds/index.d.ts +0 -4
  99. package/dist/embeds/index.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @scalar/api-reference
2
2
 
3
+ ## 1.25.104
4
+
5
+ ### Patch Changes
6
+
7
+ - ace02fe: fix: favors configuration integration in open client modal button
8
+ - 60cd6f1: feat: render the operation description from the new store
9
+ - 39df543: feat: flatten discriminators containing null
10
+ - e866487: feat(components): create dark light toggle components
11
+ - d2b1525: feat: version prefix
12
+ - Updated dependencies [2ad0407]
13
+ - Updated dependencies [ace02fe]
14
+ - Updated dependencies [60cd6f1]
15
+ - Updated dependencies [60cd6f1]
16
+ - Updated dependencies [e866487]
17
+ - Updated dependencies [6d03777]
18
+ - Updated dependencies [6d03777]
19
+ - Updated dependencies [7df4472]
20
+ - Updated dependencies [13333e6]
21
+ - Updated dependencies [64df4fc]
22
+ - Updated dependencies [08ac264]
23
+ - Updated dependencies [aff72f7]
24
+ - Updated dependencies [cb09e76]
25
+ - Updated dependencies [2ad0407]
26
+ - @scalar/api-client@2.2.33
27
+ - @scalar/components@0.13.14
28
+ - @scalar/types@0.0.26
29
+ - @scalar/use-hooks@0.1.14
30
+ - @scalar/themes@0.9.60
31
+ - @scalar/oas-utils@0.2.97
32
+ - @scalar/openapi-types@0.1.6
33
+ - @scalar/openapi-parser@0.10.4
34
+ - @scalar/code-highlight@0.0.19
35
+
36
+ ## 1.25.103
37
+
38
+ ### Patch Changes
39
+
40
+ - f9f5bdb: feat: remove examples from responses
41
+ - Updated dependencies [d3199be]
42
+ - @scalar/api-client@2.2.32
43
+
3
44
  ## 1.25.102
4
45
 
5
46
  ### Patch Changes
@@ -0,0 +1,9 @@
1
+ export declare const ERRORS: {
2
+ NO_ELEMENT_PROVIDED: string;
3
+ NO_URL_PROVIDED: string;
4
+ EMPTY_PATH: string;
5
+ };
6
+ export declare const WARNINGS: {
7
+ ELEMENT_NOT_FOUND: string;
8
+ };
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/blocks/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;CAOlB,CAAA;AAED,eAAO,MAAM,QAAQ;;CAGpB,CAAA"}
@@ -0,0 +1,8 @@
1
+ const o = {
2
+ NO_ELEMENT_PROVIDED: "Scalar Blocks: No HTML element provided to mount operation block. Please provide an HTML element to mount the operation block into.",
3
+ NO_URL_PROVIDED: "Scalar Blocks: No URL provided to import an OpenAPI document from. Please provide a URL to import an OpenAPI document from.",
4
+ EMPTY_PATH: "Path cannot be empty. Please provide a path to the operation you want to display."
5
+ };
6
+ export {
7
+ o as ERRORS
8
+ };
@@ -0,0 +1,22 @@
1
+ import type { OpenAPI } from '@scalar/openapi-types';
2
+ /**
3
+ * Pass an array of strings to get a valid OpenAPI pointer.
4
+ *
5
+ * Works with any path, but is typed to allow the paths that we support.
6
+ *
7
+ * @example
8
+ * ['paths', '/planets/{foo}', 'get'] > '#/paths/~1planets~1{foo}/get'
9
+ * ['components', 'schemas', 'Planet] > '#/components/schemas/Planet'
10
+ */
11
+ type ValidOpenApiPaths = ['paths', string, Lowercase<OpenAPI.HttpMethod> | string] | ['components', 'schemas', string];
12
+ /**
13
+ * Encodes a location string with paths
14
+ *
15
+ * @example
16
+ * getPointer(['paths', '/planets/{foo}', 'get'])
17
+ *
18
+ * '#/paths/~1planets~1{foo}/get'
19
+ */
20
+ export declare function getPointer(path: ValidOpenApiPaths): `#/${string}`;
21
+ export {};
22
+ //# sourceMappingURL=getPointer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPointer.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/getPointer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEpD;;;;;;;;GAQG;AACH,KAAK,iBAAiB,GAClB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,GACzD,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;AAErC;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAY9B,KAAK,MAAM,EAAE,CAChC"}
@@ -0,0 +1,12 @@
1
+ import { ERRORS as n } from "../constants.js";
2
+ import { escapeJsonPointer as e } from "@scalar/openapi-parser";
3
+ function m(o) {
4
+ o.unshift("#");
5
+ const r = o.map((t) => e(t.trim())).filter(Boolean).join("/");
6
+ if (r === "#")
7
+ throw new Error(n.EMPTY_PATH);
8
+ return r;
9
+ }
10
+ export {
11
+ m as getPointer
12
+ };
@@ -0,0 +1,32 @@
1
+ import type { createWorkspaceStore } from '@scalar/api-client/store';
2
+ import type { Request as RequestEntity } from '@scalar/oas-utils/entities/spec';
3
+ import { type ComputedRef } from 'vue';
4
+ export type StoreContext = ReturnType<typeof createWorkspaceStore>;
5
+ export type BlockProps = {
6
+ /**
7
+ * The store created by `createStore`
8
+ */
9
+ store: StoreContext | undefined;
10
+ /**
11
+ * The JSON pointer to the operation to use
12
+ *
13
+ * @example
14
+ * ```
15
+ * #/paths/test/get
16
+ * ```
17
+ */
18
+ location: `#/${string}`;
19
+ /**
20
+ * The name of the collection to use
21
+ *
22
+ * @default 'default'
23
+ */
24
+ collection?: string;
25
+ };
26
+ /**
27
+ * Provides computed properties for the block, based on the standardized interface of the `createStore` function.
28
+ */
29
+ export declare function useBlockProps({ store, location }: BlockProps): {
30
+ operation: ComputedRef<RequestEntity | undefined>;
31
+ };
32
+ //# sourceMappingURL=useBlockProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBlockProps.d.ts","sourceRoot":"","sources":["../../../src/blocks/hooks/useBlockProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAEV,OAAO,IAAI,aAAa,EACzB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,KAAK,CAAA;AAGhD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAElE,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,YAAY,GAAG,SAAS,CAAA;IAC/B;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAA;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG;IAC9D,SAAS,EAAE,WAAW,CAAC,aAAa,GAAG,SAAS,CAAC,CAAA;CAClD,CA8CA"}
@@ -0,0 +1,28 @@
1
+ import { unescapeJsonPointer as r } from "@scalar/openapi-parser";
2
+ import { computed as i } from "vue";
3
+ function h({ store: e, location: o }) {
4
+ const s = i(() => Object.values((e == null ? void 0 : e.collections) ?? {})[0]);
5
+ return {
6
+ operation: i(() => {
7
+ if (!(e != null && e.collections) || !e.requests)
8
+ return;
9
+ const c = Object.values(e.requests).filter(
10
+ (t) => {
11
+ var n;
12
+ return (n = s.value) == null ? void 0 : n.requests.includes(t.uid);
13
+ }
14
+ );
15
+ if (!o.startsWith("#/paths/"))
16
+ throw new Error(
17
+ "Invalid location, try using #/paths/$YOUR_ENDPOINT/$HTTP_METHOD. You can use the getPointer helper to generate a valid location: getPointer(['paths', '/planets/{planetId}', 'get'])"
18
+ );
19
+ return c.find((t) => {
20
+ const n = r(o.split("/")[2]), l = o.split("/")[3].toLocaleLowerCase();
21
+ return t.method === l && t.path === n;
22
+ });
23
+ })
24
+ };
25
+ }
26
+ export {
27
+ h as useBlockProps
28
+ };