@scalar/api-reference 1.50.0 → 1.52.0
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 +23 -0
- package/dist/browser/standalone.js +209 -207
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +47 -12
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -1
- package/dist/components/Content/Auth/Auth.vue.js.map +1 -1
- package/dist/components/Content/Auth/Auth.vue.script.js +2 -13
- package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
- package/dist/components/Content/Content.vue.d.ts +1 -0
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js.map +1 -1
- package/dist/components/Content/Content.vue.script.js +6 -5
- package/dist/components/Content/Content.vue.script.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.script.js +31 -21
- package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
- package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -1
- package/dist/features/Search/helpers/create-fuse-instance.js +4 -0
- package/dist/features/Search/helpers/create-fuse-instance.js.map +1 -1
- package/dist/features/Search/helpers/create-search-index.js +4 -3
- package/dist/features/Search/helpers/create-search-index.js.map +1 -1
- package/dist/features/Search/types.d.ts +2 -2
- package/dist/features/Search/types.d.ts.map +1 -1
- package/dist/helpers/map-config-plugins.d.ts +3 -2
- package/dist/helpers/map-config-plugins.d.ts.map +1 -1
- package/dist/helpers/map-config-plugins.js +13 -9
- package/dist/helpers/map-config-plugins.js.map +1 -1
- package/dist/helpers/openapi.d.ts +6 -14
- package/dist/helpers/openapi.d.ts.map +1 -1
- package/dist/helpers/openapi.js +24 -29
- package/dist/helpers/openapi.js.map +1 -1
- package/dist/helpers/safe-deep-clone.d.ts +17 -0
- package/dist/helpers/safe-deep-clone.d.ts.map +1 -0
- package/dist/helpers/safe-deep-clone.js +25 -0
- package/dist/helpers/safe-deep-clone.js.map +1 -0
- package/dist/helpers/storage.d.ts +5 -5
- package/dist/standalone/lib/html-api.d.ts.map +1 -1
- package/dist/standalone/lib/html-api.js +12 -12
- package/dist/standalone/lib/html-api.js.map +1 -1
- package/dist/style.css +64 -25
- package/package.json +11 -16
- package/dist/components/Content/Auth/helpers/get-default-security.d.ts +0 -18
- package/dist/components/Content/Auth/helpers/get-default-security.d.ts.map +0 -1
- package/dist/components/Content/Auth/helpers/get-default-security.js +0 -64
- package/dist/components/Content/Auth/helpers/get-default-security.js.map +0 -1
- package/dist/ssr.d.ts +0 -22
- package/dist/ssr.d.ts.map +0 -1
- package/dist/ssr.js +0 -7
|
@@ -88,10 +88,10 @@ export declare const authStorage: () => {
|
|
|
88
88
|
}) | undefined;
|
|
89
89
|
}) | {
|
|
90
90
|
implicit?: ({
|
|
91
|
+
refreshUrl: string;
|
|
91
92
|
scopes: {
|
|
92
93
|
[x: string]: string;
|
|
93
94
|
};
|
|
94
|
-
refreshUrl: string;
|
|
95
95
|
} & {
|
|
96
96
|
'x-scalar-security-query'?: {
|
|
97
97
|
[x: string]: string;
|
|
@@ -118,10 +118,10 @@ export declare const authStorage: () => {
|
|
|
118
118
|
'x-scalar-secret-redirect-uri': string;
|
|
119
119
|
}) | undefined;
|
|
120
120
|
password?: ({
|
|
121
|
+
refreshUrl: string;
|
|
121
122
|
scopes: {
|
|
122
123
|
[x: string]: string;
|
|
123
124
|
};
|
|
124
|
-
refreshUrl: string;
|
|
125
125
|
} & {
|
|
126
126
|
'x-scalar-security-query'?: {
|
|
127
127
|
[x: string]: string;
|
|
@@ -155,10 +155,10 @@ export declare const authStorage: () => {
|
|
|
155
155
|
'x-scalar-credentials-location'?: "body" | "header" | undefined;
|
|
156
156
|
}) | undefined;
|
|
157
157
|
clientCredentials?: ({
|
|
158
|
+
refreshUrl: string;
|
|
158
159
|
scopes: {
|
|
159
160
|
[x: string]: string;
|
|
160
161
|
};
|
|
161
|
-
refreshUrl: string;
|
|
162
162
|
} & {
|
|
163
163
|
'x-scalar-security-query'?: {
|
|
164
164
|
[x: string]: string;
|
|
@@ -189,10 +189,10 @@ export declare const authStorage: () => {
|
|
|
189
189
|
'x-scalar-credentials-location'?: "body" | "header" | undefined;
|
|
190
190
|
}) | undefined;
|
|
191
191
|
authorizationCode?: ({
|
|
192
|
+
refreshUrl: string;
|
|
192
193
|
scopes: {
|
|
193
194
|
[x: string]: string;
|
|
194
195
|
};
|
|
195
|
-
refreshUrl: string;
|
|
196
196
|
} & {
|
|
197
197
|
'x-scalar-security-query'?: {
|
|
198
198
|
[x: string]: string;
|
|
@@ -208,8 +208,8 @@ export declare const authStorage: () => {
|
|
|
208
208
|
} & {
|
|
209
209
|
'x-scalar-secret-token-url'?: string | undefined;
|
|
210
210
|
} & {
|
|
211
|
-
tokenUrl: string;
|
|
212
211
|
authorizationUrl: string;
|
|
212
|
+
tokenUrl: string;
|
|
213
213
|
} & {
|
|
214
214
|
'x-usePkce': "SHA-256" | "plain" | "no";
|
|
215
215
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mCAAmC,EACnC,kBAAkB,EACnB,MAAM,6BAA6B,CAAA;AASpC;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,mCAAmC,CA+GrG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,mCAAmC,QAiBnG;AAID,eAAO,MAAM,eAAe,GAAI,KAAK,QAAQ,EAAE,UAAU,OAAO,GAAG,IAAI,mBAatE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mCAAmC,EACnC,kBAAkB,EACnB,MAAM,6BAA6B,CAAA;AASpC;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,mCAAmC,CA+GrG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,mCAAmC,QAiBnG;AAID,eAAO,MAAM,eAAe,GAAI,KAAK,QAAQ,EAAE,UAAU,OAAO,GAAG,IAAI,mBAatE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBA4HhC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ApiReference_default from "../../components/ApiReference.vue.js";
|
|
2
|
-
import { createApp, h, reactive } from "vue";
|
|
2
|
+
import { createApp, createSSRApp, h, reactive } from "vue";
|
|
3
3
|
import "@scalar/types/api-reference";
|
|
4
4
|
import { createHead } from "@unhead/vue/client";
|
|
5
5
|
//#region src/standalone/lib/html-api.ts
|
|
@@ -13,14 +13,16 @@ import { createHead } from "@unhead/vue/client";
|
|
|
13
13
|
var createApiReference = (elementOrSelectorOrConfig, optionalConfiguration) => {
|
|
14
14
|
const idPrefix = "scalar-refs";
|
|
15
15
|
const props = reactive({ configuration: optionalConfiguration ?? elementOrSelectorOrConfig ?? {} });
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const createReferenceApp = (isSsr = false) => {
|
|
17
|
+
const referenceApp = isSsr ? createSSRApp(() => h(ApiReference_default, props)) : createApp(() => h(ApiReference_default, props));
|
|
18
|
+
referenceApp.use(createHead());
|
|
19
|
+
referenceApp.config.idPrefix = idPrefix;
|
|
20
|
+
return referenceApp;
|
|
21
|
+
};
|
|
22
|
+
const mountElement = optionalConfiguration ? typeof elementOrSelectorOrConfig === "string" ? document.querySelector(elementOrSelectorOrConfig) : elementOrSelectorOrConfig : null;
|
|
23
|
+
let app = createReferenceApp(!!optionalConfiguration && !!mountElement && mountElement.children.length > 0);
|
|
24
|
+
if (optionalConfiguration) if (mountElement) app.mount(mountElement);
|
|
25
|
+
else console.error("Could not find a mount point for API References:", elementOrSelectorOrConfig);
|
|
24
26
|
/**
|
|
25
27
|
* Reload the API Reference
|
|
26
28
|
* @deprecated
|
|
@@ -32,9 +34,7 @@ var createApiReference = (elementOrSelectorOrConfig, optionalConfiguration) => {
|
|
|
32
34
|
if (!currentElement) return;
|
|
33
35
|
if (currentElement && !document.body.contains(currentElement)) document.body.appendChild(currentElement);
|
|
34
36
|
app.unmount();
|
|
35
|
-
app =
|
|
36
|
-
app.use(createHead());
|
|
37
|
-
app.config.idPrefix = idPrefix;
|
|
37
|
+
app = createReferenceApp();
|
|
38
38
|
app.mount(currentElement);
|
|
39
39
|
}, false);
|
|
40
40
|
/** Destroy the current API Reference instance */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-api.js","names":[],"sources":["../../../src/standalone/lib/html-api.ts"],"sourcesContent":["import type {\n AnyApiReferenceConfiguration,\n ApiReferenceConfigurationWithSource,\n CreateApiReference,\n} from '@scalar/types/api-reference'\nimport { apiReferenceConfigurationWithSourceSchema } from '@scalar/types/api-reference'\nimport { createHead } from '@unhead/vue/client'\nimport { createApp, h, reactive } from 'vue'\n\nimport { default as ApiReference } from '@/components/ApiReference.vue'\n\nconst getSpecScriptTag = (doc: Document) => doc.getElementById('api-reference')\n\n/**\n * Reading the configuration from the data-attributes.\n */\nexport function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfigurationWithSource {\n const specElement = doc.querySelector('[data-spec]')\n const specUrlElement = doc.querySelector('[data-spec-url]')\n const configurationScriptElement = doc.querySelector('#api-reference[data-configuration]')\n\n const getConfiguration = () => {\n // <script data-configuration=\"{ … }\" />\n if (configurationScriptElement) {\n const configurationFromElement = configurationScriptElement.getAttribute('data-configuration')\n\n if (configurationFromElement) {\n return {\n _integration: 'html',\n ...JSON.parse(configurationFromElement.split('"').join('\"')),\n }\n }\n }\n\n return apiReferenceConfigurationWithSourceSchema.parse({ _integration: 'html' })\n }\n\n const getUrl = () => {\n // Let's first check if the user passed a spec URL in the configuration.\n if (getConfiguration().url) {\n return getConfiguration().url\n }\n\n if (getConfiguration().spec?.url) {\n return getConfiguration().spec?.url\n }\n\n // <script id=\"api-reference\" data-url=\"/scalar.json\" />\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const urlFromScriptTag = specScriptTag.getAttribute('data-url')?.trim()\n\n if (urlFromScriptTag) {\n return urlFromScriptTag\n }\n }\n\n // <div data-spec-url=\"/scalar.json\" />\n if (specUrlElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead.',\n )\n const urlFromSpecUrlElement = specUrlElement.getAttribute('data-spec-url')\n\n if (urlFromSpecUrlElement) {\n return urlFromSpecUrlElement\n }\n }\n\n return undefined\n }\n\n const getContent = (): string | undefined => {\n // <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const specFromScriptTag = specScriptTag.innerHTML?.trim()\n\n if (specFromScriptTag) {\n return specFromScriptTag\n }\n }\n\n // <div data-spec='{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}' />\n if (specElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec] HTML API is deprecated. Use the new <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script> API instead.',\n )\n const specFromSpecElement = specElement.getAttribute('data-spec')?.trim()\n\n if (specFromSpecElement) {\n return specFromSpecElement\n }\n }\n\n return undefined\n }\n\n const getProxyUrl = () => {\n // <script id=\"api-reference\" data-proxy-url=\"https://proxy.scalar.com\">…</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const proxyUrl = specScriptTag.getAttribute('data-proxy-url')\n\n if (proxyUrl) {\n return proxyUrl.trim()\n }\n }\n\n return undefined\n }\n\n // Ensure Reference Props are reactive\n if (!specUrlElement && !specElement && !getSpecScriptTag(doc)) {\n // Stay quiet.\n } else {\n const urlOrContent = getContent() ? { content: getContent() } : { url: getUrl() }\n\n return apiReferenceConfigurationWithSourceSchema.parse({\n _integration: 'html',\n proxyUrl: getProxyUrl(),\n ...getConfiguration(),\n ...urlOrContent,\n })\n }\n\n return apiReferenceConfigurationWithSourceSchema.parse({ _integration: 'html' })\n}\n\n/**\n * Mount the Scalar API Reference on a given document.\n * Read the HTML data-attributes for configuration.\n */\nexport function findDataAttributes(doc: Document, configuration: ApiReferenceConfigurationWithSource) {\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specElement = doc.querySelector('[data-spec]')\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specUrlElement = doc.querySelector('[data-spec-url]')\n\n if (configuration?.darkMode) {\n doc.body?.classList.add('dark-mode')\n } else {\n doc.body?.classList.add('light-mode')\n }\n\n const container = createContainer(doc, specElement || specUrlElement)\n\n if (container) {\n createApiReference(container, configuration)\n }\n}\n\n// If it's a script tag, we can't mount the Vue.js app inside that tag.\n// We need to add a new container element before the script tag.\nexport const createContainer = (doc: Document, element?: Element | null) => {\n let _container: Element | null = null\n\n const specScriptTag = getSpecScriptTag(doc)\n\n if (specScriptTag) {\n _container = doc.createElement('div')\n specScriptTag?.parentNode?.insertBefore(_container, specScriptTag)\n } else if (element) {\n _container = element\n }\n\n return _container\n}\n\n/**\n * Create (and mount) a new Scalar API Reference\n *\n * @example createApiReference({ url: '/scalar.json' }).mount('#app')\n * @example createApiReference('#app', { url: '/scalar.json' })\n * @example createApiReference(document.getElementById('app'), { url: '/scalar.json' })\n */\nexport const createApiReference: CreateApiReference = (\n elementOrSelectorOrConfig,\n optionalConfiguration?: AnyApiReferenceConfiguration,\n) => {\n // Create an id prefix for useId so we don't have collisions with other Vue apps\n const idPrefix = 'scalar-refs'\n\n const props = reactive<{ configuration: AnyApiReferenceConfiguration }>({\n // Either the configuration will be the second argument or it MUST be the first (configuration only)\n configuration: optionalConfiguration ?? (elementOrSelectorOrConfig as AnyApiReferenceConfiguration) ?? {},\n })\n\n // Create a new Vue app instance\n let app = createApp(() => h(ApiReference, props))\n\n // Meta tags, etc.\n app.use(createHead())\n\n app.config.idPrefix = idPrefix\n\n // If we have an optional config, then we must mount the element immediately (not sure why type is not narrowing)\n if (optionalConfiguration) {\n // If the element is a string, we need to find the actual DOM element\n const element =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (element) {\n app.mount(element)\n } else {\n console.error('Could not find a mount point for API References:', elementOrSelectorOrConfig)\n }\n }\n\n /**\n * Reload the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:reload-references',\n () => {\n console.warn(\n 'scalar:reload-references event has been deprecated, please use the scalarInstance.app.mount method instead.',\n )\n if (!props.configuration) {\n return\n }\n\n // Snag the current element\n const currentElement =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (!currentElement) {\n return\n }\n\n // Ensure we re-attach the element if it was unmounted\n if (currentElement && !document.body.contains(currentElement)) {\n document.body.appendChild(currentElement)\n }\n\n // Create a new Vue app instance\n app.unmount()\n app = createApp(() => h(ApiReference, props))\n app.use(createHead())\n app.config.idPrefix = idPrefix\n app.mount(currentElement)\n },\n false,\n )\n\n /** Destroy the current API Reference instance */\n const destroy = () => {\n props.configuration = {}\n app.unmount()\n }\n\n /**\n * Allow user to destroy the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:destroy-references',\n () => {\n console.warn('scalar:destroy-references event has been deprecated, please use scalarInstance.destroy instead.')\n destroy()\n },\n false,\n )\n\n /**\n * Allow user to update configuration\n * @deprecated\n */\n document.addEventListener(\n 'scalar:update-references-config',\n (ev) => {\n console.warn(\n 'scalar:update-references-config event has been deprecated, please use scalarInstance.updateConfiguration instead.',\n )\n if ('detail' in ev) {\n Object.assign(props, ev.detail)\n }\n },\n false,\n )\n\n const instance = {\n app,\n getConfiguration: () => props.configuration ?? {},\n updateConfiguration: (newConfig: AnyApiReferenceConfiguration) => {\n props.configuration = newConfig\n },\n destroy,\n }\n\n return instance\n}\n"],"mappings":";;;;;;;;;;;;AAgLA,IAAa,sBACX,2BACA,0BACG;CAEH,MAAM,WAAW;CAEjB,MAAM,QAAQ,SAA0D,EAEtE,eAAe,yBAA0B,6BAA8D,EAAE,EAC1G,CAAC;CAGF,IAAI,MAAM,gBAAgB,EAAE,sBAAc,MAAM,CAAC;AAGjD,KAAI,IAAI,YAAY,CAAC;AAErB,KAAI,OAAO,WAAW;AAGtB,KAAI,uBAAuB;EAEzB,MAAM,UACJ,OAAO,8BAA8B,WACjC,SAAS,cAAc,0BAA0B,GAChD;AAEP,MAAI,QACF,KAAI,MAAM,QAAQ;MAElB,SAAQ,MAAM,oDAAoD,0BAA0B;;;;;;AAQhG,UAAS,iBACP,kCACM;AACJ,UAAQ,KACN,8GACD;AACD,MAAI,CAAC,MAAM,cACT;EAIF,MAAM,iBACJ,OAAO,8BAA8B,WACjC,SAAS,cAAc,0BAA0B,GAChD;AAEP,MAAI,CAAC,eACH;AAIF,MAAI,kBAAkB,CAAC,SAAS,KAAK,SAAS,eAAe,CAC3D,UAAS,KAAK,YAAY,eAAe;AAI3C,MAAI,SAAS;AACb,QAAM,gBAAgB,EAAE,sBAAc,MAAM,CAAC;AAC7C,MAAI,IAAI,YAAY,CAAC;AACrB,MAAI,OAAO,WAAW;AACtB,MAAI,MAAM,eAAe;IAE3B,MACD;;CAGD,MAAM,gBAAgB;AACpB,QAAM,gBAAgB,EAAE;AACxB,MAAI,SAAS;;;;;;AAOf,UAAS,iBACP,mCACM;AACJ,UAAQ,KAAK,kGAAkG;AAC/G,WAAS;IAEX,MACD;;;;;AAMD,UAAS,iBACP,oCACC,OAAO;AACN,UAAQ,KACN,oHACD;AACD,MAAI,YAAY,GACd,QAAO,OAAO,OAAO,GAAG,OAAO;IAGnC,MACD;AAWD,QATiB;EACf;EACA,wBAAwB,MAAM,iBAAiB,EAAE;EACjD,sBAAsB,cAA4C;AAChE,SAAM,gBAAgB;;EAExB;EACD"}
|
|
1
|
+
{"version":3,"file":"html-api.js","names":[],"sources":["../../../src/standalone/lib/html-api.ts"],"sourcesContent":["import type {\n AnyApiReferenceConfiguration,\n ApiReferenceConfigurationWithSource,\n CreateApiReference,\n} from '@scalar/types/api-reference'\nimport { apiReferenceConfigurationWithSourceSchema } from '@scalar/types/api-reference'\nimport { createHead } from '@unhead/vue/client'\nimport { createApp, createSSRApp, h, reactive } from 'vue'\n\nimport { default as ApiReference } from '@/components/ApiReference.vue'\n\nconst getSpecScriptTag = (doc: Document) => doc.getElementById('api-reference')\n\n/**\n * Reading the configuration from the data-attributes.\n */\nexport function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfigurationWithSource {\n const specElement = doc.querySelector('[data-spec]')\n const specUrlElement = doc.querySelector('[data-spec-url]')\n const configurationScriptElement = doc.querySelector('#api-reference[data-configuration]')\n\n const getConfiguration = () => {\n // <script data-configuration=\"{ … }\" />\n if (configurationScriptElement) {\n const configurationFromElement = configurationScriptElement.getAttribute('data-configuration')\n\n if (configurationFromElement) {\n return {\n _integration: 'html',\n ...JSON.parse(configurationFromElement.split('"').join('\"')),\n }\n }\n }\n\n return apiReferenceConfigurationWithSourceSchema.parse({ _integration: 'html' })\n }\n\n const getUrl = () => {\n // Let's first check if the user passed a spec URL in the configuration.\n if (getConfiguration().url) {\n return getConfiguration().url\n }\n\n if (getConfiguration().spec?.url) {\n return getConfiguration().spec?.url\n }\n\n // <script id=\"api-reference\" data-url=\"/scalar.json\" />\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const urlFromScriptTag = specScriptTag.getAttribute('data-url')?.trim()\n\n if (urlFromScriptTag) {\n return urlFromScriptTag\n }\n }\n\n // <div data-spec-url=\"/scalar.json\" />\n if (specUrlElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead.',\n )\n const urlFromSpecUrlElement = specUrlElement.getAttribute('data-spec-url')\n\n if (urlFromSpecUrlElement) {\n return urlFromSpecUrlElement\n }\n }\n\n return undefined\n }\n\n const getContent = (): string | undefined => {\n // <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const specFromScriptTag = specScriptTag.innerHTML?.trim()\n\n if (specFromScriptTag) {\n return specFromScriptTag\n }\n }\n\n // <div data-spec='{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}' />\n if (specElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec] HTML API is deprecated. Use the new <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script> API instead.',\n )\n const specFromSpecElement = specElement.getAttribute('data-spec')?.trim()\n\n if (specFromSpecElement) {\n return specFromSpecElement\n }\n }\n\n return undefined\n }\n\n const getProxyUrl = () => {\n // <script id=\"api-reference\" data-proxy-url=\"https://proxy.scalar.com\">…</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const proxyUrl = specScriptTag.getAttribute('data-proxy-url')\n\n if (proxyUrl) {\n return proxyUrl.trim()\n }\n }\n\n return undefined\n }\n\n // Ensure Reference Props are reactive\n if (!specUrlElement && !specElement && !getSpecScriptTag(doc)) {\n // Stay quiet.\n } else {\n const urlOrContent = getContent() ? { content: getContent() } : { url: getUrl() }\n\n return apiReferenceConfigurationWithSourceSchema.parse({\n _integration: 'html',\n proxyUrl: getProxyUrl(),\n ...getConfiguration(),\n ...urlOrContent,\n })\n }\n\n return apiReferenceConfigurationWithSourceSchema.parse({ _integration: 'html' })\n}\n\n/**\n * Mount the Scalar API Reference on a given document.\n * Read the HTML data-attributes for configuration.\n */\nexport function findDataAttributes(doc: Document, configuration: ApiReferenceConfigurationWithSource) {\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specElement = doc.querySelector('[data-spec]')\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specUrlElement = doc.querySelector('[data-spec-url]')\n\n if (configuration?.darkMode) {\n doc.body?.classList.add('dark-mode')\n } else {\n doc.body?.classList.add('light-mode')\n }\n\n const container = createContainer(doc, specElement || specUrlElement)\n\n if (container) {\n createApiReference(container, configuration)\n }\n}\n\n// If it's a script tag, we can't mount the Vue.js app inside that tag.\n// We need to add a new container element before the script tag.\nexport const createContainer = (doc: Document, element?: Element | null) => {\n let _container: Element | null = null\n\n const specScriptTag = getSpecScriptTag(doc)\n\n if (specScriptTag) {\n _container = doc.createElement('div')\n specScriptTag?.parentNode?.insertBefore(_container, specScriptTag)\n } else if (element) {\n _container = element\n }\n\n return _container\n}\n\n/**\n * Create (and mount) a new Scalar API Reference\n *\n * @example createApiReference({ url: '/scalar.json' }).mount('#app')\n * @example createApiReference('#app', { url: '/scalar.json' })\n * @example createApiReference(document.getElementById('app'), { url: '/scalar.json' })\n */\nexport const createApiReference: CreateApiReference = (\n elementOrSelectorOrConfig,\n optionalConfiguration?: AnyApiReferenceConfiguration,\n) => {\n // Create an id prefix for useId so we don't have collisions with other Vue apps\n const idPrefix = 'scalar-refs'\n\n const props = reactive<{ configuration: AnyApiReferenceConfiguration }>({\n // Either the configuration will be the second argument or it MUST be the first (configuration only)\n configuration: optionalConfiguration ?? (elementOrSelectorOrConfig as AnyApiReferenceConfiguration) ?? {},\n })\n\n const createReferenceApp = (isSsr = false) => {\n const referenceApp = isSsr ? createSSRApp(() => h(ApiReference, props)) : createApp(() => h(ApiReference, props))\n\n // Meta tags, etc.\n referenceApp.use(createHead())\n referenceApp.config.idPrefix = idPrefix\n\n return referenceApp\n }\n\n // If we have an optional config, then we must mount the element immediately (not sure why type is not narrowing)\n const mountElement = optionalConfiguration\n ? typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n : null\n\n // Detect server-rendered content and use createSSRApp for hydration\n const shouldHydrate = !!optionalConfiguration && !!mountElement && mountElement.children.length > 0\n let app = createReferenceApp(shouldHydrate)\n\n if (optionalConfiguration) {\n if (mountElement) {\n app.mount(mountElement)\n } else {\n console.error('Could not find a mount point for API References:', elementOrSelectorOrConfig)\n }\n }\n\n /**\n * Reload the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:reload-references',\n () => {\n console.warn(\n 'scalar:reload-references event has been deprecated, please use the scalarInstance.app.mount method instead.',\n )\n if (!props.configuration) {\n return\n }\n\n // Snag the current element\n const currentElement =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (!currentElement) {\n return\n }\n\n // Ensure we re-attach the element if it was unmounted\n if (currentElement && !document.body.contains(currentElement)) {\n document.body.appendChild(currentElement)\n }\n\n // Create a new Vue app instance\n app.unmount()\n app = createReferenceApp()\n app.mount(currentElement)\n },\n false,\n )\n\n /** Destroy the current API Reference instance */\n const destroy = () => {\n props.configuration = {}\n app.unmount()\n }\n\n /**\n * Allow user to destroy the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:destroy-references',\n () => {\n console.warn('scalar:destroy-references event has been deprecated, please use scalarInstance.destroy instead.')\n destroy()\n },\n false,\n )\n\n /**\n * Allow user to update configuration\n * @deprecated\n */\n document.addEventListener(\n 'scalar:update-references-config',\n (ev) => {\n console.warn(\n 'scalar:update-references-config event has been deprecated, please use scalarInstance.updateConfiguration instead.',\n )\n if ('detail' in ev) {\n Object.assign(props, ev.detail)\n }\n },\n false,\n )\n\n const instance = {\n app,\n getConfiguration: () => props.configuration ?? {},\n updateConfiguration: (newConfig: AnyApiReferenceConfiguration) => {\n props.configuration = newConfig\n },\n destroy,\n }\n\n return instance\n}\n"],"mappings":";;;;;;;;;;;;AAgLA,IAAa,sBACX,2BACA,0BACG;CAEH,MAAM,WAAW;CAEjB,MAAM,QAAQ,SAA0D,EAEtE,eAAe,yBAA0B,6BAA8D,EAAE,EAC1G,CAAC;CAEF,MAAM,sBAAsB,QAAQ,UAAU;EAC5C,MAAM,eAAe,QAAQ,mBAAmB,EAAE,sBAAc,MAAM,CAAC,GAAG,gBAAgB,EAAE,sBAAc,MAAM,CAAC;AAGjH,eAAa,IAAI,YAAY,CAAC;AAC9B,eAAa,OAAO,WAAW;AAE/B,SAAO;;CAIT,MAAM,eAAe,wBACjB,OAAO,8BAA8B,WACnC,SAAS,cAAc,0BAA0B,GAChD,4BACH;CAIJ,IAAI,MAAM,mBADY,CAAC,CAAC,yBAAyB,CAAC,CAAC,gBAAgB,aAAa,SAAS,SAAS,EACvD;AAE3C,KAAI,sBACF,KAAI,aACF,KAAI,MAAM,aAAa;KAEvB,SAAQ,MAAM,oDAAoD,0BAA0B;;;;;AAQhG,UAAS,iBACP,kCACM;AACJ,UAAQ,KACN,8GACD;AACD,MAAI,CAAC,MAAM,cACT;EAIF,MAAM,iBACJ,OAAO,8BAA8B,WACjC,SAAS,cAAc,0BAA0B,GAChD;AAEP,MAAI,CAAC,eACH;AAIF,MAAI,kBAAkB,CAAC,SAAS,KAAK,SAAS,eAAe,CAC3D,UAAS,KAAK,YAAY,eAAe;AAI3C,MAAI,SAAS;AACb,QAAM,oBAAoB;AAC1B,MAAI,MAAM,eAAe;IAE3B,MACD;;CAGD,MAAM,gBAAgB;AACpB,QAAM,gBAAgB,EAAE;AACxB,MAAI,SAAS;;;;;;AAOf,UAAS,iBACP,mCACM;AACJ,UAAQ,KAAK,kGAAkG;AAC/G,WAAS;IAEX,MACD;;;;;AAMD,UAAS,iBACP,oCACC,OAAO;AACN,UAAQ,KACN,oHACD;AACD,MAAI,YAAY,GACd,QAAO,OAAO,OAAO,GAAG,OAAO;IAGnC,MACD;AAWD,QATiB;EACf;EACA,wBAAwB,MAAM,iBAAiB,EAAE;EACjD,sBAAsB,cAA4C;AAChE,SAAM,gBAAgB;;EAExB;EACD"}
|
package/dist/style.css
CHANGED
|
@@ -1680,10 +1680,10 @@ button.headers-card-title[data-v-ab19704d]:hover {
|
|
|
1680
1680
|
border-radius: var(--scalar-radius);
|
|
1681
1681
|
}
|
|
1682
1682
|
|
|
1683
|
-
.request-body[data-v-
|
|
1683
|
+
.request-body[data-v-f323f401] {
|
|
1684
1684
|
margin-top: 24px;
|
|
1685
1685
|
}
|
|
1686
|
-
.request-body-header[data-v-
|
|
1686
|
+
.request-body-header[data-v-f323f401] {
|
|
1687
1687
|
display: flex;
|
|
1688
1688
|
align-items: center;
|
|
1689
1689
|
justify-content: space-between;
|
|
@@ -1691,7 +1691,7 @@ button.headers-card-title[data-v-ab19704d]:hover {
|
|
|
1691
1691
|
border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);
|
|
1692
1692
|
flex-flow: wrap;
|
|
1693
1693
|
}
|
|
1694
|
-
.request-body-title[data-v-
|
|
1694
|
+
.request-body-title[data-v-f323f401] {
|
|
1695
1695
|
display: flex;
|
|
1696
1696
|
align-items: center;
|
|
1697
1697
|
gap: 8px;
|
|
@@ -1699,7 +1699,7 @@ button.headers-card-title[data-v-ab19704d]:hover {
|
|
|
1699
1699
|
font-weight: var(--scalar-semibold);
|
|
1700
1700
|
color: var(--scalar-color-1);
|
|
1701
1701
|
}
|
|
1702
|
-
.request-body-required[data-v-
|
|
1702
|
+
.request-body-required[data-v-f323f401] {
|
|
1703
1703
|
font-size: var(--scalar-micro);
|
|
1704
1704
|
color: var(--scalar-color-orange);
|
|
1705
1705
|
font-weight: normal;
|
|
@@ -1708,21 +1708,21 @@ button.headers-card-title[data-v-ab19704d]:hover {
|
|
|
1708
1708
|
padding: 2px 8px;
|
|
1709
1709
|
height: 20px;
|
|
1710
1710
|
}
|
|
1711
|
-
.request-body-description[data-v-
|
|
1711
|
+
.request-body-description[data-v-f323f401] {
|
|
1712
1712
|
margin-top: 6px;
|
|
1713
1713
|
font-size: var(--scalar-small);
|
|
1714
1714
|
width: 100%;
|
|
1715
1715
|
}
|
|
1716
1716
|
.request-body-header
|
|
1717
|
-
+ .request-body-schema[data-v-
|
|
1717
|
+
+ .request-body-schema[data-v-f323f401]:has(> .schema-card > .schema-card-description),
|
|
1718
1718
|
.request-body-header
|
|
1719
|
-
+ .request-body-schema[data-v-
|
|
1719
|
+
+ .request-body-schema[data-v-f323f401]:has(
|
|
1720
1720
|
> .schema-card > .schema-properties > * > .property--level-0
|
|
1721
1721
|
) {
|
|
1722
1722
|
/** Add a bit of space between the heading border and the schema description or properties */
|
|
1723
1723
|
padding-top: 8px;
|
|
1724
1724
|
}
|
|
1725
|
-
.request-body-description[data-v-
|
|
1725
|
+
.request-body-description[data-v-f323f401] .markdown * {
|
|
1726
1726
|
color: var(--scalar-color-2) !important;
|
|
1727
1727
|
}
|
|
1728
1728
|
|
|
@@ -3392,6 +3392,9 @@ body {
|
|
|
3392
3392
|
.scalar-app .-mx-2 {
|
|
3393
3393
|
margin-inline: -8px;
|
|
3394
3394
|
}
|
|
3395
|
+
.scalar-app .mx-1\.5 {
|
|
3396
|
+
margin-inline: 6px;
|
|
3397
|
+
}
|
|
3395
3398
|
.scalar-app .my-2 {
|
|
3396
3399
|
margin-block: 8px;
|
|
3397
3400
|
}
|
|
@@ -7869,12 +7872,18 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
7869
7872
|
.scalar-app .min-h-20 {
|
|
7870
7873
|
min-height: 80px;
|
|
7871
7874
|
}
|
|
7875
|
+
.scalar-app .min-h-\[4rem\] {
|
|
7876
|
+
min-height: 4rem;
|
|
7877
|
+
}
|
|
7872
7878
|
.scalar-app .min-h-\[64px\] {
|
|
7873
7879
|
min-height: 64px;
|
|
7874
7880
|
}
|
|
7875
7881
|
.scalar-app .min-h-\[65px\] {
|
|
7876
7882
|
min-height: 65px;
|
|
7877
7883
|
}
|
|
7884
|
+
.scalar-app .min-h-\[300px\] {
|
|
7885
|
+
min-height: 300px;
|
|
7886
|
+
}
|
|
7878
7887
|
.scalar-app .min-h-\[calc\(1rem\*4\)\] {
|
|
7879
7888
|
min-height: 4rem;
|
|
7880
7889
|
}
|
|
@@ -7899,6 +7908,9 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
7899
7908
|
.scalar-app .w-1\/2 {
|
|
7900
7909
|
width: 50%;
|
|
7901
7910
|
}
|
|
7911
|
+
.scalar-app .w-2 {
|
|
7912
|
+
width: 8px;
|
|
7913
|
+
}
|
|
7902
7914
|
.scalar-app .w-2\.5 {
|
|
7903
7915
|
width: 10px;
|
|
7904
7916
|
}
|
|
@@ -8484,7 +8496,7 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8484
8496
|
.scalar-app .border-\(--scalar-color-alert\) {
|
|
8485
8497
|
border-color: var(--scalar-color-alert);
|
|
8486
8498
|
}
|
|
8487
|
-
.scalar-app .border-border {
|
|
8499
|
+
.scalar-app .border-\[var\(--scalar-border-color\)\], .scalar-app .border-border {
|
|
8488
8500
|
border-color: var(--scalar-border-color);
|
|
8489
8501
|
}
|
|
8490
8502
|
.scalar-app .border-c-1 {
|
|
@@ -8521,6 +8533,18 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8521
8533
|
.scalar-app .bg-\(--scalar-background-alert\) {
|
|
8522
8534
|
background-color: var(--scalar-background-alert);
|
|
8523
8535
|
}
|
|
8536
|
+
.scalar-app .bg-\[var\(--scalar-background-1\)\] {
|
|
8537
|
+
background-color: var(--scalar-background-1);
|
|
8538
|
+
}
|
|
8539
|
+
.scalar-app .bg-\[var\(--scalar-background-2\)\] {
|
|
8540
|
+
background-color: var(--scalar-background-2);
|
|
8541
|
+
}
|
|
8542
|
+
.scalar-app .bg-\[var\(--scalar-background-3\)\] {
|
|
8543
|
+
background-color: var(--scalar-background-3);
|
|
8544
|
+
}
|
|
8545
|
+
.scalar-app .bg-\[var\(--scalar-color-green\)\] {
|
|
8546
|
+
background-color: var(--scalar-color-green);
|
|
8547
|
+
}
|
|
8524
8548
|
.scalar-app .bg-b-1 {
|
|
8525
8549
|
background-color: var(--scalar-background-1);
|
|
8526
8550
|
}
|
|
@@ -9179,6 +9203,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
9179
9203
|
--tw-shadow: 0 -8px 0 8px var(--tw-shadow-color, var(--scalar-background-1)), 0 0 8px 8px var(--tw-shadow-color, var(--scalar-background-1));
|
|
9180
9204
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
9181
9205
|
}
|
|
9206
|
+
.scalar-app .shadow-\[var\(--scalar-shadow-1\)\] {
|
|
9207
|
+
--tw-shadow: var(--scalar-shadow-1);
|
|
9208
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
9209
|
+
}
|
|
9182
9210
|
.scalar-app .shadow-border {
|
|
9183
9211
|
--tw-shadow: inset 0 0 0 var(--tw-shadow-color, var(--scalar-border-width)) var(--scalar-border-color);
|
|
9184
9212
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -9239,6 +9267,11 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
9239
9267
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
9240
9268
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
9241
9269
|
}
|
|
9270
|
+
.scalar-app .transition-all {
|
|
9271
|
+
transition-property: all;
|
|
9272
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
9273
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
9274
|
+
}
|
|
9242
9275
|
.scalar-app .transition-colors {
|
|
9243
9276
|
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
9244
9277
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
@@ -9601,6 +9634,9 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
9601
9634
|
.scalar-app .hover\:border-inherit:hover {
|
|
9602
9635
|
border-color: inherit;
|
|
9603
9636
|
}
|
|
9637
|
+
.scalar-app .hover\:bg-\[var\(--scalar-background-3\)\]:hover {
|
|
9638
|
+
background-color: var(--scalar-background-3);
|
|
9639
|
+
}
|
|
9604
9640
|
.scalar-app .hover\:bg-b-2:hover, .scalar-app .hover\:bg-b-2\/40:hover {
|
|
9605
9641
|
background-color: var(--scalar-background-2);
|
|
9606
9642
|
}
|
|
@@ -11908,6 +11944,9 @@ to {
|
|
|
11908
11944
|
gap: 1rem;
|
|
11909
11945
|
display: flex;
|
|
11910
11946
|
}
|
|
11947
|
+
.document-scripts-editors__container[data-v-8c8fa790] {
|
|
11948
|
+
min-height: 300px;
|
|
11949
|
+
}
|
|
11911
11950
|
.authenticationProvided[data-v-e3416cd5] {
|
|
11912
11951
|
color: var(--scalar-color-1);
|
|
11913
11952
|
font-weight: var(--scalar-semibold);
|
|
@@ -13469,7 +13508,7 @@ div + .userMessage[data-v-8e43ed7a] {
|
|
|
13469
13508
|
|
|
13470
13509
|
/* Configurable Layout Variables */
|
|
13471
13510
|
@layer scalar-config {
|
|
13472
|
-
.scalar-api-reference[data-v-
|
|
13511
|
+
.scalar-api-reference[data-v-f2a1208a] {
|
|
13473
13512
|
/* The header height */
|
|
13474
13513
|
--refs-header-height: calc(
|
|
13475
13514
|
var(--scalar-custom-header-height, 0px) + var(--scalar-header-height, 0px)
|
|
@@ -13491,20 +13530,20 @@ div + .userMessage[data-v-8e43ed7a] {
|
|
|
13491
13530
|
/* The maximum width of the content column */
|
|
13492
13531
|
--refs-content-max-width: var(--scalar-content-max-width, 1540px);
|
|
13493
13532
|
}
|
|
13494
|
-
.scalar-api-reference.references-classic[data-v-
|
|
13533
|
+
.scalar-api-reference.references-classic[data-v-f2a1208a] {
|
|
13495
13534
|
/* Classic layout is wider */
|
|
13496
13535
|
--refs-content-max-width: var(--scalar-content-max-width, 1420px);
|
|
13497
13536
|
min-height: 100dvh;
|
|
13498
13537
|
--refs-sidebar-width: 0;
|
|
13499
13538
|
}
|
|
13500
13539
|
}
|
|
13501
|
-
.t-doc__sidebar[data-v-
|
|
13540
|
+
.t-doc__sidebar[data-v-f2a1208a] {
|
|
13502
13541
|
z-index: 10;
|
|
13503
13542
|
}
|
|
13504
13543
|
|
|
13505
13544
|
/* ----------------------------------------------------- */
|
|
13506
13545
|
/* References Layout */
|
|
13507
|
-
.references-layout[data-v-
|
|
13546
|
+
.references-layout[data-v-f2a1208a] {
|
|
13508
13547
|
/* Try to fill the container */
|
|
13509
13548
|
min-height: 100dvh;
|
|
13510
13549
|
min-width: 100%;
|
|
@@ -13528,44 +13567,44 @@ div + .userMessage[data-v-8e43ed7a] {
|
|
|
13528
13567
|
|
|
13529
13568
|
background: var(--scalar-background-1);
|
|
13530
13569
|
}
|
|
13531
|
-
.references-editor[data-v-
|
|
13570
|
+
.references-editor[data-v-f2a1208a] {
|
|
13532
13571
|
grid-area: editor;
|
|
13533
13572
|
display: flex;
|
|
13534
13573
|
min-width: 0;
|
|
13535
13574
|
background: var(--scalar-background-1);
|
|
13536
13575
|
}
|
|
13537
|
-
.references-rendered[data-v-
|
|
13576
|
+
.references-rendered[data-v-f2a1208a] {
|
|
13538
13577
|
position: relative;
|
|
13539
13578
|
grid-area: rendered;
|
|
13540
13579
|
min-width: 0;
|
|
13541
13580
|
background: var(--scalar-background-1);
|
|
13542
13581
|
}
|
|
13543
|
-
.scalar-api-reference.references-classic[data-v-
|
|
13544
|
-
.references-classic .references-rendered[data-v-
|
|
13582
|
+
.scalar-api-reference.references-classic[data-v-f2a1208a],
|
|
13583
|
+
.references-classic .references-rendered[data-v-f2a1208a] {
|
|
13545
13584
|
height: initial !important;
|
|
13546
13585
|
max-height: initial !important;
|
|
13547
13586
|
}
|
|
13548
13587
|
@layer scalar-config {
|
|
13549
|
-
.references-sidebar[data-v-
|
|
13588
|
+
.references-sidebar[data-v-f2a1208a] {
|
|
13550
13589
|
/* Set a default width if references are enabled */
|
|
13551
13590
|
--refs-sidebar-width: var(--scalar-sidebar-width, 288px);
|
|
13552
13591
|
}
|
|
13553
13592
|
}
|
|
13554
13593
|
|
|
13555
13594
|
/* Footer */
|
|
13556
|
-
.references-footer[data-v-
|
|
13595
|
+
.references-footer[data-v-f2a1208a] {
|
|
13557
13596
|
grid-area: footer;
|
|
13558
13597
|
}
|
|
13559
13598
|
/* ----------------------------------------------------- */
|
|
13560
13599
|
/* Responsive / Mobile Layout */
|
|
13561
13600
|
@media (max-width: 1000px) {
|
|
13562
13601
|
/* Keep toolbar hidden on mobile without forcing desktop display mode. */
|
|
13563
|
-
.references-developer-tools[data-v-
|
|
13602
|
+
.references-developer-tools[data-v-f2a1208a] {
|
|
13564
13603
|
display: none;
|
|
13565
13604
|
}
|
|
13566
13605
|
|
|
13567
13606
|
/* Stack view on mobile */
|
|
13568
|
-
.references-layout[data-v-
|
|
13607
|
+
.references-layout[data-v-f2a1208a] {
|
|
13569
13608
|
/* Adjust the sidebar height to the viewport height minus the header height */
|
|
13570
13609
|
--refs-sidebar-height: calc(
|
|
13571
13610
|
var(--full-height, 100dvh) - var(--scalar-custom-header-height, 0px)
|
|
@@ -13580,13 +13619,13 @@ div + .userMessage[data-v-8e43ed7a] {
|
|
|
13580
13619
|
'rendered'
|
|
13581
13620
|
'footer';
|
|
13582
13621
|
}
|
|
13583
|
-
.references-editable[data-v-
|
|
13622
|
+
.references-editable[data-v-f2a1208a] {
|
|
13584
13623
|
grid-template-areas:
|
|
13585
13624
|
'header'
|
|
13586
13625
|
'navigation'
|
|
13587
13626
|
'editor';
|
|
13588
13627
|
}
|
|
13589
|
-
.references-rendered[data-v-
|
|
13628
|
+
.references-rendered[data-v-f2a1208a] {
|
|
13590
13629
|
position: static;
|
|
13591
13630
|
}
|
|
13592
13631
|
}
|
|
@@ -13597,12 +13636,12 @@ div + .userMessage[data-v-8e43ed7a] {
|
|
|
13597
13636
|
* when the new elements are available
|
|
13598
13637
|
*/
|
|
13599
13638
|
@media (max-width: 1000px) {
|
|
13600
|
-
.scalar-api-references-standalone-mobile[data-v-
|
|
13639
|
+
.scalar-api-references-standalone-mobile[data-v-f2a1208a]:not(.references-classic) {
|
|
13601
13640
|
--scalar-header-height: 50px;
|
|
13602
13641
|
}
|
|
13603
13642
|
}
|
|
13604
13643
|
|
|
13605
|
-
.darklight-reference[data-v-
|
|
13644
|
+
.darklight-reference[data-v-f2a1208a] {
|
|
13606
13645
|
width: 100%;
|
|
13607
13646
|
margin-top: auto;
|
|
13608
13647
|
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"vue",
|
|
21
21
|
"vue3"
|
|
22
22
|
],
|
|
23
|
-
"version": "1.
|
|
23
|
+
"version": "1.52.0",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22"
|
|
26
26
|
},
|
|
@@ -64,11 +64,6 @@
|
|
|
64
64
|
"types": "./dist/helpers/index.d.ts",
|
|
65
65
|
"default": "./dist/helpers/index.js"
|
|
66
66
|
},
|
|
67
|
-
"./ssr": {
|
|
68
|
-
"import": "./dist/ssr.js",
|
|
69
|
-
"types": "./dist/ssr.d.ts",
|
|
70
|
-
"default": "./dist/ssr.js"
|
|
71
|
-
},
|
|
72
67
|
"./style.css": "./dist/style.css",
|
|
73
68
|
"./browser/standalone.js": "./dist/browser/standalone.js"
|
|
74
69
|
},
|
|
@@ -91,20 +86,20 @@
|
|
|
91
86
|
"nanoid": "^5.1.6",
|
|
92
87
|
"vue": "^3.5.30",
|
|
93
88
|
"yaml": "^2.8.0",
|
|
94
|
-
"@scalar/agent-chat": "0.10.
|
|
95
|
-
"@scalar/api-client": "2.40.0",
|
|
96
|
-
"@scalar/code-highlight": "0.3.2",
|
|
89
|
+
"@scalar/agent-chat": "0.10.2",
|
|
97
90
|
"@scalar/components": "0.21.3",
|
|
98
|
-
"@scalar/icons": "0.7.2",
|
|
99
|
-
"@scalar/oas-utils": "0.10.15",
|
|
100
91
|
"@scalar/helpers": "0.4.3",
|
|
101
|
-
"@scalar/
|
|
102
|
-
"@scalar/
|
|
92
|
+
"@scalar/code-highlight": "0.3.2",
|
|
93
|
+
"@scalar/icons": "0.7.2",
|
|
94
|
+
"@scalar/oas-utils": "0.11.0",
|
|
95
|
+
"@scalar/api-client": "2.42.0",
|
|
96
|
+
"@scalar/sidebar": "0.8.19",
|
|
97
|
+
"@scalar/snippetz": "0.8.0",
|
|
103
98
|
"@scalar/themes": "0.15.2",
|
|
104
99
|
"@scalar/use-hooks": "0.4.2",
|
|
105
100
|
"@scalar/use-toasts": "0.10.1",
|
|
106
|
-
"@scalar/types": "0.
|
|
107
|
-
"@scalar/workspace-store": "0.
|
|
101
|
+
"@scalar/types": "0.8.0",
|
|
102
|
+
"@scalar/workspace-store": "0.44.0"
|
|
108
103
|
},
|
|
109
104
|
"devDependencies": {
|
|
110
105
|
"@hono/node-server": "^1.19.10",
|
|
@@ -121,7 +116,7 @@
|
|
|
121
116
|
"vite-plugin-banner": "^0.8.1",
|
|
122
117
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
123
118
|
"vitest": "4.1.0",
|
|
124
|
-
"@scalar/core": "0.
|
|
119
|
+
"@scalar/core": "0.5.0",
|
|
125
120
|
"@scalar/galaxy": "0.6.2"
|
|
126
121
|
},
|
|
127
122
|
"scripts": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
|
|
2
|
-
import type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example';
|
|
3
|
-
import type { SecurityRequirementObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
4
|
-
/**
|
|
5
|
-
* Extracts the default scopes for a security scheme.
|
|
6
|
-
* Only OAuth2 schemes can have default scopes via the x-default-scopes extension.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getDefaultScopes: (scheme: SecuritySchemeObject | undefined) => string[];
|
|
9
|
-
/**
|
|
10
|
-
* Determines the default security scheme to use for an operation.
|
|
11
|
-
*
|
|
12
|
-
* Priority order:
|
|
13
|
-
* 1. User-configured preferred security scheme (if provided)
|
|
14
|
-
* 2. First security requirement from the OpenAPI spec
|
|
15
|
-
* 3. null (no security required)
|
|
16
|
-
*/
|
|
17
|
-
export declare const getDefaultSecurity: (securityRequirements: SecurityRequirementObject[], preferredSecurityScheme: AuthenticationConfiguration["preferredSecurityScheme"], securitySchemes: MergedSecuritySchemes) => SecurityRequirementObject | null;
|
|
18
|
-
//# sourceMappingURL=get-default-security.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-security.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Auth/helpers/get-default-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAG9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAErE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,oBAAoB,GAAG,SAAS,KAAG,MAAM,EAMjF,CAAA;AAkED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,sBAAsB,yBAAyB,EAAE,EACjD,yBAAyB,2BAA2B,CAAC,yBAAyB,CAAC,EAC/E,iBAAiB,qBAAqB,KACrC,yBAAyB,GAAG,IAW9B,CAAA"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
-
import { unpackProxyObject } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
3
|
-
//#region src/components/Content/Auth/helpers/get-default-security.ts
|
|
4
|
-
/**
|
|
5
|
-
* Extracts the default scopes for a security scheme.
|
|
6
|
-
* Only OAuth2 schemes can have default scopes via the x-default-scopes extension.
|
|
7
|
-
*/
|
|
8
|
-
var getDefaultScopes = (scheme) => {
|
|
9
|
-
if (!scheme || scheme.type !== "oauth2") return [];
|
|
10
|
-
return scheme["x-default-scopes"] ?? [];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Hydrates an existing security requirement with configured default scopes.
|
|
14
|
-
* Explicit scopes from the OpenAPI requirement take precedence over x-default-scopes.
|
|
15
|
-
*/
|
|
16
|
-
var hydrateSecurityRequirement = (requirement, securitySchemes) => {
|
|
17
|
-
const hydratedRequirement = {};
|
|
18
|
-
for (const [schemeName, scopes] of Object.entries(unpackProxyObject(requirement, { depth: 1 }) ?? requirement)) {
|
|
19
|
-
if (Array.isArray(scopes) && scopes.length > 0) {
|
|
20
|
-
hydratedRequirement[schemeName] = scopes;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
hydratedRequirement[schemeName] = getDefaultScopes(getResolvedRef(securitySchemes[schemeName]));
|
|
24
|
-
}
|
|
25
|
-
return hydratedRequirement;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Processes a single scheme name and adds it to the accumulator with its default scopes.
|
|
29
|
-
*/
|
|
30
|
-
var addSchemeToRequirement = (acc, schemeName, securitySchemes) => {
|
|
31
|
-
acc[schemeName] = getDefaultScopes(getResolvedRef(securitySchemes[schemeName]));
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Converts the preferred security scheme configuration into a SecurityRequirementObject.
|
|
35
|
-
* Handles both flat arrays and nested arrays (for complex auth scenarios).
|
|
36
|
-
*/
|
|
37
|
-
var buildSecurityRequirementFromPreferred = (preferredSecurityScheme, securitySchemes) => {
|
|
38
|
-
if (!Array.isArray(preferredSecurityScheme)) {
|
|
39
|
-
const scheme = getResolvedRef(securitySchemes[preferredSecurityScheme]);
|
|
40
|
-
return { [preferredSecurityScheme]: getDefaultScopes(scheme) };
|
|
41
|
-
}
|
|
42
|
-
const requirement = {};
|
|
43
|
-
for (const item of preferredSecurityScheme) if (Array.isArray(item)) for (const schemeName of item) addSchemeToRequirement(requirement, schemeName, securitySchemes);
|
|
44
|
-
else addSchemeToRequirement(requirement, item, securitySchemes);
|
|
45
|
-
return requirement;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Determines the default security scheme to use for an operation.
|
|
49
|
-
*
|
|
50
|
-
* Priority order:
|
|
51
|
-
* 1. User-configured preferred security scheme (if provided)
|
|
52
|
-
* 2. First security requirement from the OpenAPI spec
|
|
53
|
-
* 3. null (no security required)
|
|
54
|
-
*/
|
|
55
|
-
var getDefaultSecurity = (securityRequirements, preferredSecurityScheme, securitySchemes) => {
|
|
56
|
-
if (preferredSecurityScheme) return buildSecurityRequirementFromPreferred(preferredSecurityScheme, securitySchemes);
|
|
57
|
-
const firstRequirement = securityRequirements[0];
|
|
58
|
-
if (firstRequirement) return hydrateSecurityRequirement(firstRequirement, securitySchemes);
|
|
59
|
-
return null;
|
|
60
|
-
};
|
|
61
|
-
//#endregion
|
|
62
|
-
export { getDefaultSecurity };
|
|
63
|
-
|
|
64
|
-
//# sourceMappingURL=get-default-security.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-security.js","names":[],"sources":["../../../../../src/components/Content/Auth/helpers/get-default-security.ts"],"sourcesContent":["import type { AuthenticationConfiguration } from '@scalar/types/api-reference'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type {\n SecurityRequirementObject,\n SecuritySchemeObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Extracts the default scopes for a security scheme.\n * Only OAuth2 schemes can have default scopes via the x-default-scopes extension.\n */\nexport const getDefaultScopes = (scheme: SecuritySchemeObject | undefined): string[] => {\n if (!scheme || scheme.type !== 'oauth2') {\n return []\n }\n\n return scheme['x-default-scopes'] ?? []\n}\n\n/**\n * Hydrates an existing security requirement with configured default scopes.\n * Explicit scopes from the OpenAPI requirement take precedence over x-default-scopes.\n */\nconst hydrateSecurityRequirement = (\n requirement: SecurityRequirementObject,\n securitySchemes: MergedSecuritySchemes,\n): SecurityRequirementObject => {\n const hydratedRequirement: SecurityRequirementObject = {}\n\n for (const [schemeName, scopes] of Object.entries(unpackProxyObject(requirement, { depth: 1 }) ?? requirement)) {\n if (Array.isArray(scopes) && scopes.length > 0) {\n hydratedRequirement[schemeName] = scopes\n continue\n }\n\n const scheme = getResolvedRef(securitySchemes[schemeName])\n hydratedRequirement[schemeName] = getDefaultScopes(scheme)\n }\n\n return hydratedRequirement\n}\n\n/**\n * Processes a single scheme name and adds it to the accumulator with its default scopes.\n */\nconst addSchemeToRequirement = (\n acc: SecurityRequirementObject,\n schemeName: string,\n securitySchemes: MergedSecuritySchemes,\n): void => {\n const scheme = getResolvedRef(securitySchemes[schemeName])\n acc[schemeName] = getDefaultScopes(scheme)\n}\n\n/**\n * Converts the preferred security scheme configuration into a SecurityRequirementObject.\n * Handles both flat arrays and nested arrays (for complex auth scenarios).\n */\nconst buildSecurityRequirementFromPreferred = (\n preferredSecurityScheme: string | (string | string[])[],\n securitySchemes: MergedSecuritySchemes,\n): SecurityRequirementObject => {\n if (!Array.isArray(preferredSecurityScheme)) {\n const scheme = getResolvedRef(securitySchemes[preferredSecurityScheme])\n return { [preferredSecurityScheme]: getDefaultScopes(scheme) }\n }\n\n const requirement: SecurityRequirementObject = {}\n\n for (const item of preferredSecurityScheme) {\n if (Array.isArray(item)) {\n // Handle nested arrays for complex auth (e.g., [['oauth2', 'apiKey'], 'basic'])\n for (const schemeName of item) {\n addSchemeToRequirement(requirement, schemeName, securitySchemes)\n }\n } else {\n addSchemeToRequirement(requirement, item, securitySchemes)\n }\n }\n\n return requirement\n}\n\n/**\n * Determines the default security scheme to use for an operation.\n *\n * Priority order:\n * 1. User-configured preferred security scheme (if provided)\n * 2. First security requirement from the OpenAPI spec\n * 3. null (no security required)\n */\nexport const getDefaultSecurity = (\n securityRequirements: SecurityRequirementObject[],\n preferredSecurityScheme: AuthenticationConfiguration['preferredSecurityScheme'],\n securitySchemes: MergedSecuritySchemes,\n): SecurityRequirementObject | null => {\n if (preferredSecurityScheme) {\n return buildSecurityRequirementFromPreferred(preferredSecurityScheme, securitySchemes)\n }\n\n const firstRequirement = securityRequirements[0]\n if (firstRequirement) {\n return hydrateSecurityRequirement(firstRequirement, securitySchemes)\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAaA,IAAa,oBAAoB,WAAuD;AACtF,KAAI,CAAC,UAAU,OAAO,SAAS,SAC7B,QAAO,EAAE;AAGX,QAAO,OAAO,uBAAuB,EAAE;;;;;;AAOzC,IAAM,8BACJ,aACA,oBAC8B;CAC9B,MAAM,sBAAiD,EAAE;AAEzD,MAAK,MAAM,CAAC,YAAY,WAAW,OAAO,QAAQ,kBAAkB,aAAa,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,EAAE;AAC9G,MAAI,MAAM,QAAQ,OAAO,IAAI,OAAO,SAAS,GAAG;AAC9C,uBAAoB,cAAc;AAClC;;AAIF,sBAAoB,cAAc,iBADnB,eAAe,gBAAgB,YAAY,CACA;;AAG5D,QAAO;;;;;AAMT,IAAM,0BACJ,KACA,YACA,oBACS;AAET,KAAI,cAAc,iBADH,eAAe,gBAAgB,YAAY,CAChB;;;;;;AAO5C,IAAM,yCACJ,yBACA,oBAC8B;AAC9B,KAAI,CAAC,MAAM,QAAQ,wBAAwB,EAAE;EAC3C,MAAM,SAAS,eAAe,gBAAgB,yBAAyB;AACvE,SAAO,GAAG,0BAA0B,iBAAiB,OAAO,EAAE;;CAGhE,MAAM,cAAyC,EAAE;AAEjD,MAAK,MAAM,QAAQ,wBACjB,KAAI,MAAM,QAAQ,KAAK,CAErB,MAAK,MAAM,cAAc,KACvB,wBAAuB,aAAa,YAAY,gBAAgB;KAGlE,wBAAuB,aAAa,MAAM,gBAAgB;AAI9D,QAAO;;;;;;;;;;AAWT,IAAa,sBACX,sBACA,yBACA,oBACqC;AACrC,KAAI,wBACF,QAAO,sCAAsC,yBAAyB,gBAAgB;CAGxF,MAAM,mBAAmB,qBAAqB;AAC9C,KAAI,iBACF,QAAO,2BAA2B,kBAAkB,gBAAgB;AAGtE,QAAO"}
|
package/dist/ssr.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSR entry point for @scalar/api-reference.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports the same components as the main entry. The ApiReference component
|
|
5
|
-
* is SSR-compatible and works with createSSRApp and renderToString from
|
|
6
|
-
* @vue/server-renderer.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import { createSSRApp } from 'vue'
|
|
11
|
-
* import { renderToString } from '@vue/server-renderer'
|
|
12
|
-
* import { ApiReference } from '@scalar/api-reference/ssr'
|
|
13
|
-
*
|
|
14
|
-
* const app = createSSRApp({
|
|
15
|
-
* render: () => h(ApiReference, { configuration: { url: '/openapi.json' } }),
|
|
16
|
-
* })
|
|
17
|
-
* const html = await renderToString(app)
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export type { ApiReferenceConfiguration, ReferenceProps } from './index.js';
|
|
21
|
-
export { ApiReference, GettingStarted, SearchButton, SearchModal, createApiReference, createEmptySpecification, } from './index.js';
|
|
22
|
-
//# sourceMappingURL=ssr.d.ts.map
|
package/dist/ssr.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,YAAY,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,SAAS,CAAA"}
|
package/dist/ssr.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createEmptySpecification } from "./helpers/openapi.js";
|
|
2
|
-
import SearchModal_default from "./features/Search/components/SearchModal.vue.js";
|
|
3
|
-
import SearchButton_default from "./features/Search/components/SearchButton.vue.js";
|
|
4
|
-
import ApiReference_default from "./components/ApiReference.vue.js";
|
|
5
|
-
import GettingStarted_default from "./components/GettingStarted.vue.js";
|
|
6
|
-
import { createApiReference } from "./standalone/lib/html-api.js";
|
|
7
|
-
export { ApiReference_default as ApiReference, GettingStarted_default as GettingStarted, SearchButton_default as SearchButton, SearchModal_default as SearchModal, createApiReference, createEmptySpecification };
|