@scalar/api-reference 1.26.1 → 1.28.1
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 +59 -0
- package/README.md +2 -6
- package/dist/browser/standalone.js +3306 -3283
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Layouts/ModernLayout.vue.js +2 -2
- package/dist/components/Layouts/ModernLayout.vue2.js +9 -12
- package/dist/components/SingleApiReference.vue.d.ts.map +1 -1
- package/dist/components/SingleApiReference.vue.js +6 -6
- package/dist/esm.d.ts +5 -1
- package/dist/esm.d.ts.map +1 -1
- package/dist/esm.js +12 -9
- package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue2.js +16 -16
- package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.js +80 -5
- package/dist/features/Operation/components/ContentTypeSelect.vue2.js +2 -43
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +2 -2
- package/dist/features/Operation/components/ParameterListItem.vue2.js +33 -33
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +2 -2
- package/dist/features/Operation/components/RequestBody.vue2.js +15 -15
- package/dist/hooks/useMultipleDocuments.d.ts +9 -5
- package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
- package/dist/hooks/useMultipleDocuments.js +38 -38
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -72
- package/dist/standalone/lib/html-api.d.ts +30 -1
- package/dist/standalone/lib/html-api.d.ts.map +1 -1
- package/dist/standalone/lib/html-api.js +54 -0
- package/dist/standalone/lib/register-globals.d.ts +11 -0
- package/dist/standalone/lib/register-globals.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +8 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
2
|
+
import { type App } from 'vue';
|
|
2
3
|
/**
|
|
3
4
|
* Reading the configuration from the data-attributes.
|
|
4
5
|
*/
|
|
@@ -7,5 +8,33 @@ export declare function getConfigurationFromDataAttributes(doc: Document): ApiRe
|
|
|
7
8
|
* Mount the Scalar API Reference on a given document.
|
|
8
9
|
* Read the HTML data-attributes for configuration.
|
|
9
10
|
*/
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function findDataAttributes(doc: Document, configuration: ApiReferenceConfiguration): void;
|
|
12
|
+
export declare const createContainer: (doc: Document, element?: Element | null) => Element | null;
|
|
13
|
+
type ApiReferenceInstance = {
|
|
14
|
+
/** The vue app instance */
|
|
15
|
+
app: App<Element>;
|
|
16
|
+
/** Destroy the current API Reference instance */
|
|
17
|
+
destroy: () => void;
|
|
18
|
+
/** Get the current configuration */
|
|
19
|
+
getConfiguration: () => Partial<ApiReferenceConfiguration>;
|
|
20
|
+
/** Update the configuration */
|
|
21
|
+
updateConfiguration: (newConfig: Partial<ApiReferenceConfiguration>) => void;
|
|
22
|
+
};
|
|
23
|
+
/** Function overload for createApiReference to allow multiple different signatures */
|
|
24
|
+
export type CreateApiReference = {
|
|
25
|
+
/** Pass in the configuration only */
|
|
26
|
+
(configuration: Partial<ApiReferenceConfiguration>): ApiReferenceInstance;
|
|
27
|
+
/** Pass in the element or selector and configuration */
|
|
28
|
+
(elementOrSelector: Element | string, configuration: Partial<ApiReferenceConfiguration>): ApiReferenceInstance;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Create and mount a new Scalar API Reference
|
|
32
|
+
*
|
|
33
|
+
* @example createApiReference({ spec: { url: '/scalar.json' } })
|
|
34
|
+
* @example createApiReference('#api-reference', { spec: { url: '/scalar.json' } })
|
|
35
|
+
* @example createApiReference(document.body, { spec: { url: '/scalar.json' } })
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare const createApiReference: CreateApiReference;
|
|
39
|
+
export {};
|
|
11
40
|
//# 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,EAAE,KAAK,yBAAyB,EAAmC,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,yBAAyB,EAAmC,MAAM,6BAA6B,CAAA;AAE7G,OAAO,EAAE,KAAK,GAAG,EAA0B,MAAM,KAAK,CAAA;AAMtD;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,yBAAyB,CA+G3F;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,yBAAyB,QAiBzF;AAID,eAAO,MAAM,eAAe,QAAS,QAAQ,YAAY,OAAO,GAAG,IAAI,mBAatE,CAAA;AAGD,KAAK,oBAAoB,GAAG;IAC1B,2BAA2B;IAC3B,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACjB,iDAAiD;IACjD,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,oCAAoC;IACpC,gBAAgB,EAAE,MAAM,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAC1D,+BAA+B;IAC/B,mBAAmB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,yBAAyB,CAAC,KAAK,IAAI,CAAA;CAC7E,CAAA;AAED,sFAAsF;AACtF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,qCAAqC;IACrC,CAAC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,oBAAoB,CAAA;IACzE,wDAAwD;IACxD,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,oBAAoB,CAAA;CAC/G,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBA8GhC,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createHead as s } from "@unhead/vue";
|
|
2
|
+
import { reactive as u, createApp as c, h as d } from "vue";
|
|
3
|
+
import i from "../../components/ApiReference.vue.js";
|
|
4
|
+
const m = (n, o) => {
|
|
5
|
+
const t = u({
|
|
6
|
+
// Either the configuration will be the second arugment or it MUST be the first (configuration only)
|
|
7
|
+
configuration: o ?? n ?? {}
|
|
8
|
+
});
|
|
9
|
+
let a = c(() => d(i, t));
|
|
10
|
+
if (a.use(s()), o) {
|
|
11
|
+
const e = typeof n == "string" ? document.querySelector(n) : n;
|
|
12
|
+
e ? a.mount(e) : console.error("Could not find a mount point for API References:", n);
|
|
13
|
+
}
|
|
14
|
+
document.addEventListener(
|
|
15
|
+
"scalar:reload-references",
|
|
16
|
+
() => {
|
|
17
|
+
if (console.warn(
|
|
18
|
+
"scalar:reload-references event has been deprecated, please use the window.Scalar.app.mount method instead"
|
|
19
|
+
), !t.configuration)
|
|
20
|
+
return;
|
|
21
|
+
const e = typeof n == "string" ? document.querySelector(n) : n;
|
|
22
|
+
e && (e && !document.body.contains(e) && document.body.appendChild(e), a.unmount(), a = c(() => d(i, t)), a.use(s()), a.mount(e));
|
|
23
|
+
},
|
|
24
|
+
!1
|
|
25
|
+
);
|
|
26
|
+
const r = () => {
|
|
27
|
+
delete t.configuration, a.unmount();
|
|
28
|
+
};
|
|
29
|
+
return document.addEventListener(
|
|
30
|
+
"scalar:destroy-references",
|
|
31
|
+
() => {
|
|
32
|
+
console.warn("scalar:destroy-references event has been deprecated, please use window.Scalar.destroy instead"), r();
|
|
33
|
+
},
|
|
34
|
+
!1
|
|
35
|
+
), document.addEventListener(
|
|
36
|
+
"scalar:update-references-config",
|
|
37
|
+
(e) => {
|
|
38
|
+
console.warn(
|
|
39
|
+
"scalar:update-references-config event has been deprecated, please use window.Scalar.updateConfiguration instead"
|
|
40
|
+
), "detail" in e && Object.assign(t, e.detail);
|
|
41
|
+
},
|
|
42
|
+
!1
|
|
43
|
+
), {
|
|
44
|
+
app: a,
|
|
45
|
+
getConfiguration: () => t.configuration ?? {},
|
|
46
|
+
updateConfiguration: (e) => {
|
|
47
|
+
t.configuration = e;
|
|
48
|
+
},
|
|
49
|
+
destroy: r
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
m as createApiReference
|
|
54
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CreateApiReference } from '../../standalone/lib/html-api.js';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
Scalar: {
|
|
5
|
+
createApiReference: CreateApiReference;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Register any method on the global window.Scalar object, ensure the type is added to the window above */
|
|
10
|
+
export declare const registerGlobals: () => void;
|
|
11
|
+
//# sourceMappingURL=register-globals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-globals.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/register-globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAGvF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE;YACN,kBAAkB,EAAE,kBAAkB,CAAA;SACvC,CAAA;KACF;CACF;AAED,2GAA2G;AAC3G,eAAO,MAAM,eAAe,YAW3B,CAAA"}
|