@scalar/api-reference 1.25.127 → 1.25.128

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 (87) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/browser/standalone.js +16046 -15965
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReference.vue.js +40 -64
  6. package/dist/components/ApiReferenceLayout.vue.d.ts +2 -2
  7. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  8. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  9. package/dist/components/ApiReferenceLayout.vue2.js +158 -159
  10. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +1 -1
  11. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +1 -1
  12. package/dist/components/Content/ClientLibraries/ClientLibraries.vue2.js +69 -17
  13. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts +5 -1
  14. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts.map +1 -1
  15. package/dist/components/Content/ClientLibraries/ClientSelector.vue.js +2 -2
  16. package/dist/components/Content/ClientLibraries/ClientSelector.vue2.js +73 -94
  17. package/dist/components/Content/ClientLibraries/useFeaturedHttpClients.d.ts +16 -0
  18. package/dist/components/Content/ClientLibraries/useFeaturedHttpClients.d.ts.map +1 -0
  19. package/dist/components/Content/ClientLibraries/useFeaturedHttpClients.js +36 -0
  20. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  22. package/dist/components/Content/Schema/Schema.vue2.js +4 -1
  23. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +1 -1
  24. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  25. package/dist/components/Content/Schema/SchemaProperty.vue2.js +1 -1
  26. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  27. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +2 -2
  28. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +143 -124
  29. package/dist/components/GettingStarted.vue.d.ts.map +1 -1
  30. package/dist/components/GettingStarted.vue.js +1 -1
  31. package/dist/components/GettingStarted.vue2.js +13 -13
  32. package/dist/components/Layouts/ClassicLayout.vue.d.ts +3 -3
  33. package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
  34. package/dist/components/Layouts/Layouts.vue.d.ts +3 -3
  35. package/dist/components/Layouts/Layouts.vue.d.ts.map +1 -1
  36. package/dist/components/Layouts/ModernLayout.vue.d.ts +3 -3
  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/Section/CompactSection.vue.d.ts.map +1 -1
  40. package/dist/components/Section/CompactSection.vue.js +2 -2
  41. package/dist/components/Section/CompactSection.vue2.js +30 -29
  42. package/dist/esm.d.ts +5 -3
  43. package/dist/esm.d.ts.map +1 -1
  44. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts +2 -2
  45. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
  46. package/dist/features/ApiClientModal/useApiClient.d.ts +362 -342
  47. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  48. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  49. package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
  50. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +82 -74
  51. package/dist/features/ExampleResponses/ExampleResponse.vue.d.ts.map +1 -1
  52. package/dist/features/ExampleResponses/ExampleResponse.vue.js +2 -2
  53. package/dist/features/ExampleResponses/ExampleResponse.vue2.js +11 -11
  54. package/dist/features/ExampleResponses/ExampleResponses.vue.d.ts.map +1 -1
  55. package/dist/features/ExampleResponses/ExampleResponses.vue.js +2 -2
  56. package/dist/features/ExampleResponses/ExampleResponses.vue2.js +90 -78
  57. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts +1 -1
  58. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
  59. package/dist/features/Operation/components/ContentTypeSelect.vue.js +1 -1
  60. package/dist/features/Operation/components/ContentTypeSelect.vue2.js +29 -25
  61. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  62. package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
  63. package/dist/features/Operation/components/ParameterListItem.vue2.js +40 -47
  64. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  65. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  66. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  67. package/dist/helpers/get-request.d.ts +1 -1
  68. package/dist/helpers/get-request.d.ts.map +1 -1
  69. package/dist/hooks/index.d.ts +0 -1
  70. package/dist/hooks/index.d.ts.map +1 -1
  71. package/dist/hooks/useConfig.d.ts +3 -3
  72. package/dist/hooks/useConfig.d.ts.map +1 -1
  73. package/dist/hooks/useConfig.js +5 -4
  74. package/dist/index.js +17 -19
  75. package/dist/standalone/lib/html-api.d.ts +3 -3
  76. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  77. package/dist/standalone/lib/html-rendering.d.ts +23 -24
  78. package/dist/standalone/lib/html-rendering.d.ts.map +1 -1
  79. package/dist/standalone/lib/html-rendering.js +39 -29
  80. package/dist/stores/useHttpClientStore.d.ts.map +1 -1
  81. package/dist/style.css +1 -1
  82. package/dist/types.d.ts +19 -2
  83. package/dist/types.d.ts.map +1 -1
  84. package/package.json +11 -10
  85. package/dist/hooks/useDeprecationWarnings.d.ts +0 -6
  86. package/dist/hooks/useDeprecationWarnings.d.ts.map +0 -1
  87. package/dist/hooks/useDeprecationWarnings.js +0 -20
@@ -1,11 +1,11 @@
1
- import type { ReferenceConfiguration } from '@scalar/types/legacy';
1
+ import { type ApiReferenceConfiguration } from '@scalar/types/api-reference';
2
2
  /**
3
3
  * Reading the configuration from the data-attributes.
4
4
  */
5
- export declare function getConfigurationFromDataAttributes(doc: Document): ReferenceConfiguration;
5
+ export declare function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfiguration;
6
6
  /**
7
7
  * Mount the Scalar API Reference on a given document.
8
8
  * Read the HTML data-attributes for configuration.
9
9
  */
10
- export declare function mountScalarApiReference(doc: Document, configuration: ReferenceConfiguration): void;
10
+ export declare function mountScalarApiReference(doc: Document, configuration: ApiReferenceConfiguration): void;
11
11
  //# sourceMappingURL=html-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAQlE;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,sBAAsB,CA8GxF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,sBAAsB,QAsF3F"}
1
+ {"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,KAAK,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAQ7G;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,yBAAyB,CA8G3F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,yBAAyB,QAsF9F"}
@@ -1,8 +1,9 @@
1
- import type { ReferenceConfiguration } from '../../types';
1
+ import { type ApiReferenceConfiguration } from '@scalar/types/api-reference';
2
+ import { z } from 'zod';
2
3
  /**
3
- * The CDN configuration for the Scalar API Reference.
4
+ * Zod schema for HTML rendering configuration
4
5
  */
5
- export type CdnConfiguration = {
6
+ export declare const htmlRenderingOptionsSchema: z.ZodObject<{
6
7
  /**
7
8
  * The URL to the Scalar API Reference JS CDN.
8
9
  *
@@ -12,40 +13,38 @@ export type CdnConfiguration = {
12
13
  *
13
14
  * @example https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.122
14
15
  */
15
- cdn?: string;
16
- };
17
- /**
18
- * The page title configuration for the Scalar API Reference.
19
- */
20
- export type PageTitleConfiguration = {
16
+ cdn: z.ZodDefault<z.ZodOptional<z.ZodString>>;
21
17
  /**
22
18
  * The title of the page.
23
19
  */
24
- pageTitle?: string;
25
- };
26
- export type HtmlRenderingConfiguration = ReferenceConfiguration & CdnConfiguration & PageTitleConfiguration;
20
+ pageTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ cdn: string;
23
+ pageTitle: string;
24
+ }, {
25
+ cdn?: string | undefined;
26
+ pageTitle?: string | undefined;
27
+ }>;
28
+ type HtmlRenderingOptions = z.infer<typeof htmlRenderingOptionsSchema>;
29
+ export type HtmlRenderingConfiguration = ApiReferenceConfiguration & HtmlRenderingOptions;
27
30
  /**
28
31
  * The HTML document to render the Scalar API reference.
32
+ *
33
+ * We must check the passed in configuration and not the parsedConfig for the theme as the parsedConfig will have it
34
+ * defaulted to 'default'
29
35
  */
30
- export declare function getHtmlDocument(configuration: HtmlRenderingConfiguration, customTheme?: string): string;
36
+ export declare const getHtmlDocument: (configuration: Partial<HtmlRenderingConfiguration>, customTheme?: string) => string;
31
37
  /**
32
38
  * The script tags to load the @scalar/api-reference package from the CDN.
33
39
  */
34
- export declare function getScriptTags(configuration: HtmlRenderingConfiguration): string;
40
+ export declare function getScriptTags(configuration: ApiReferenceConfiguration, cdn: string): string;
35
41
  /**
36
42
  * The configuration to pass to the @scalar/api-reference package.
37
43
  */
38
- export declare function getConfiguration(givenConfiguration: HtmlRenderingConfiguration): string;
44
+ export declare const getConfiguration: (givenConfiguration: ApiReferenceConfiguration) => string;
39
45
  /**
40
46
  * The content to pass to the @scalar/api-reference package as the <script> tag content.
41
47
  */
42
- export declare function getScriptTagContent(configuration: HtmlRenderingConfiguration): string;
43
- /**
44
- * The CDN URL to load the @scalar/api-reference package from.
45
- */
46
- export declare function getCdnUrl(configuration: HtmlRenderingConfiguration): string;
47
- /**
48
- * The page title for the Scalar API Reference.
49
- */
50
- export declare function getPageTitle(configuration: HtmlRenderingConfiguration): string;
48
+ export declare const getScriptTagContent: (configuration: ApiReferenceConfiguration) => string;
49
+ export {};
51
50
  //# sourceMappingURL=html-rendering.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html-rendering.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAErD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,GAAG,gBAAgB,GAAG,sBAAsB,CAAA;AAE3G;;GAEG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,0BAA0B,EAAE,WAAW,CAAC,EAAE,MAAM,UAmB9F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,0BAA0B,UAQtE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,kBAAkB,EAAE,0BAA0B,UAa9E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,0BAA0B,UAM5E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,0BAA0B,UAElE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,0BAA0B,UAErE"}
1
+ {"version":3,"file":"html-rendering.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC7G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,0BAA0B;IACrC;;;;;;;;OAQG;;IAEH;;OAEG;;;;;;;;EAEH,CAAA;AACF,KAAK,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEtE,MAAM,MAAM,0BAA0B,GAAG,yBAAyB,GAAG,oBAAoB,CAAA;AAEzF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,kBAAmB,OAAO,CAAC,0BAA0B,CAAC,iCAuBjF,CAAA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,yBAAyB,EAAE,GAAG,EAAE,MAAM,UAQlF;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,uBAAwB,yBAAyB,WAa7E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,kBAAmB,yBAAyB,WAKpE,CAAA"}
@@ -1,54 +1,64 @@
1
- function o(t, e) {
1
+ import { apiReferenceConfigurationSchema as o } from "@scalar/types/api-reference";
2
+ import { z as s } from "zod";
3
+ const a = s.object({
4
+ /**
5
+ * The URL to the Scalar API Reference JS CDN.
6
+ *
7
+ * Use this to pin a specific version of the Scalar API Reference.
8
+ *
9
+ * @default https://cdn.jsdelivr.net/npm/@scalar/api-reference
10
+ *
11
+ * @example https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.122
12
+ */
13
+ cdn: s.string().optional().default("https://cdn.jsdelivr.net/npm/@scalar/api-reference"),
14
+ /**
15
+ * The title of the page.
16
+ */
17
+ pageTitle: s.string().optional().default("Scalar API Reference")
18
+ }), h = (e, t = "") => {
19
+ const { cdn: n, pageTitle: c, ...i } = e, r = a.parse({ cdn: n, pageTitle: c, customTheme: t }), p = o.parse(i);
2
20
  return `
3
21
  <!DOCTYPE html>
4
22
  <html>
5
23
  <head>
6
- <title>${a(t)}</title>
24
+ <title>${r.pageTitle}</title>
7
25
  <meta charset="utf-8" />
8
26
  <meta
9
27
  name="viewport"
10
28
  content="width=device-width, initial-scale=1" />
11
29
  <style>
12
- ${t.theme ? null : e ?? ""}
30
+ ${e.theme ? "" : t}
13
31
  </style>
14
32
  </head>
15
33
  <body>
16
- ${r(t)}
34
+ ${l(p, r.cdn)}
17
35
  </body>
18
36
  </html>
19
37
  `;
20
- }
21
- function r(t) {
38
+ };
39
+ function l(e, t) {
22
40
  return `
23
41
  <script
24
42
  id="api-reference"
25
43
  type="application/json"
26
- data-configuration="${s(t)}">${p(t)}<\/script>
27
- <script src="${l(t)}"><\/script>
44
+ data-configuration="${d(e)}">${f(e)}<\/script>
45
+ <script src="${t}"><\/script>
28
46
  `;
29
47
  }
30
- function s(t) {
48
+ const d = (e) => {
31
49
  var n, c, i;
32
- const e = {
33
- ...t
50
+ const t = {
51
+ ...e
34
52
  };
35
- return (n = e.spec) != null && n.url ? (c = e.spec) != null && c.content && ((i = e.spec) == null || delete i.content) : delete e.spec, JSON.stringify(e).split('"').join("&quot;");
36
- }
37
- function p(t) {
38
- var e, n, c, i;
39
- return (e = t.spec) != null && e.content ? typeof ((n = t.spec) == null ? void 0 : n.content) == "function" ? JSON.stringify((c = t.spec) == null ? void 0 : c.content()) : JSON.stringify((i = t.spec) == null ? void 0 : i.content) : "";
40
- }
41
- function l(t) {
42
- return t.cdn || "https://cdn.jsdelivr.net/npm/@scalar/api-reference";
43
- }
44
- function a(t) {
45
- return t.pageTitle || "Scalar API Reference";
46
- }
53
+ return (n = t.spec) != null && n.url ? (c = t.spec) != null && c.content && ((i = t.spec) == null || delete i.content) : delete t.spec, JSON.stringify(t).split('"').join("&quot;");
54
+ }, f = (e) => {
55
+ var t, n, c, i;
56
+ return (t = e.spec) != null && t.content ? typeof ((n = e.spec) == null ? void 0 : n.content) == "function" ? JSON.stringify((c = e.spec) == null ? void 0 : c.content()) : JSON.stringify((i = e.spec) == null ? void 0 : i.content) : "";
57
+ };
47
58
  export {
48
- l as getCdnUrl,
49
- s as getConfiguration,
50
- o as getHtmlDocument,
51
- a as getPageTitle,
52
- p as getScriptTagContent,
53
- r as getScriptTags
59
+ d as getConfiguration,
60
+ h as getHtmlDocument,
61
+ f as getScriptTagContent,
62
+ l as getScriptTags,
63
+ a as htmlRenderingOptionsSchema
54
64
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useHttpClientStore.d.ts","sourceRoot":"","sources":["../../src/stores/useHttpClientStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,KAAK,GAAG,EAAqC,MAAM,KAAK,CAAA;AASjE;;;GAGG;AACH,iBAAS,cAAc,CAAC,MAAM,EAAE,eAAe,UAE9C;AAED;;;GAGG;AACH,iBAAS,cAAc,CAAC,MAAM,EAAE,eAAe,UAM9C;AAYD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAkD5F;AASD,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAMxE,iBAAS,oBAAoB,CAAC,UAAU,CAAC,EAAE,eAAe,QAQzD;AAkCD,iBAAS,UAAU,SAElB;AAYD,kEAAkE;AAClE,eAAO,MAAM,kBAAkB;;4BA/DY,QAAQ;4BAAa,MAAM;;;8BAuDrC,OAAO,CAAC,eAAe,CAAC;;qBAcP,GAAG,CAAC,aAAa,CAAC;4BACxC,aAAa;;;;;;CAaxC,CAAA"}
1
+ {"version":3,"file":"useHttpClientStore.d.ts","sourceRoot":"","sources":["../../src/stores/useHttpClientStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,KAAK,GAAG,EAAqC,MAAM,KAAK,CAAA;AASjE;;;GAGG;AACH,iBAAS,cAAc,CAAC,MAAM,EAAE,eAAe,UAE9C;AAED;;;GAGG;AACH,iBAAS,cAAc,CAAC,MAAM,EAAE,eAAe,UAM9C;AAYD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAkD5F;AASD,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAMxE,iBAAS,oBAAoB,CAAC,UAAU,CAAC,EAAE,eAAe,QAKzD;AAiCD,iBAAS,UAAU,SAElB;AAYD,kEAAkE;AAClE,eAAO,MAAM,kBAAkB;;4BA3DY,QAAQ;4BAAa,MAAM;;;8BAmDrC,OAAO,CAAC,eAAe,CAAC;;qBAcP,GAAG,CAAC,aAAa,CAAC;4BACxC,aAAa;;;;;;CAaxC,CAAA"}