@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +2 -6
  3. package/dist/browser/standalone.js +3306 -3283
  4. package/dist/browser/webpack-stats.json +1 -1
  5. package/dist/components/Layouts/ModernLayout.vue.js +2 -2
  6. package/dist/components/Layouts/ModernLayout.vue2.js +9 -12
  7. package/dist/components/SingleApiReference.vue.d.ts.map +1 -1
  8. package/dist/components/SingleApiReference.vue.js +6 -6
  9. package/dist/esm.d.ts +5 -1
  10. package/dist/esm.d.ts.map +1 -1
  11. package/dist/esm.js +12 -9
  12. package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
  13. package/dist/features/DownloadLink/DownloadLink.vue2.js +16 -16
  14. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts +1 -1
  15. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
  16. package/dist/features/Operation/components/ContentTypeSelect.vue.js +80 -5
  17. package/dist/features/Operation/components/ContentTypeSelect.vue2.js +2 -43
  18. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  19. package/dist/features/Operation/components/ParameterListItem.vue.js +2 -2
  20. package/dist/features/Operation/components/ParameterListItem.vue2.js +33 -33
  21. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  22. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  23. package/dist/features/Operation/components/RequestBody.vue2.js +15 -15
  24. package/dist/hooks/useMultipleDocuments.d.ts +9 -5
  25. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
  26. package/dist/hooks/useMultipleDocuments.js +38 -38
  27. package/dist/index.d.ts +6 -5
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +74 -72
  30. package/dist/standalone/lib/html-api.d.ts +30 -1
  31. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  32. package/dist/standalone/lib/html-api.js +54 -0
  33. package/dist/standalone/lib/register-globals.d.ts +11 -0
  34. package/dist/standalone/lib/register-globals.d.ts.map +1 -0
  35. package/dist/style.css +1 -1
  36. package/package.json +8 -8
@@ -1,47 +1,47 @@
1
- import { isDefined as h } from "@scalar/oas-utils/helpers";
2
- import { isConfigurationWithSources as s, apiReferenceConfigurationSchema as i } from "@scalar/types/api-reference";
3
- import w from "github-slugger";
4
- import { computed as m, ref as S, watch as p } from "vue";
5
- const c = "api", f = new w(), I = (e, n = 0) => {
6
- if (!(!(e != null && e.url) && !(e != null && e.content)))
7
- return f.reset(), e.title ? {
8
- ...e,
9
- slug: e.slug || f.slug(e.title),
10
- title: e.title
11
- } : e.slug ? {
12
- ...e,
13
- title: e.slug
1
+ import { isDefined as c } from "@scalar/oas-utils/helpers";
2
+ import { isConfigurationWithSources as i, apiReferenceConfigurationSchema as o } from "@scalar/types/api-reference";
3
+ import h from "github-slugger";
4
+ import { computed as m, ref as w, watch as S } from "vue";
5
+ const p = "api", f = new h(), I = (t, a = 0) => {
6
+ if (!(!(t != null && t.url) && !(t != null && t.content)))
7
+ return f.reset(), t.title ? {
8
+ ...t,
9
+ slug: t.slug || f.slug(t.title),
10
+ title: t.title
11
+ } : t.slug ? {
12
+ ...t,
13
+ title: t.slug
14
14
  } : {
15
- ...e,
16
- slug: `api-${n + 1}`,
17
- title: `API #${n + 1}`
15
+ ...t,
16
+ slug: `api-${a + 1}`,
17
+ title: `API #${a + 1}`
18
18
  };
19
- }, U = ({ configuration: e, initialIndex: n }) => {
20
- const a = m(() => {
21
- var r;
22
- return e.value ? (s(e.value) ? ((r = e.value.spec) == null ? void 0 : r.sources) ?? [] : [e.value].flat().map((t) => t.spec)).map((t, l) => t && I(t, l)).filter(h) : [];
23
- }), v = (u) => {
24
- if (a.value.length === 1)
19
+ }, U = ({ configuration: t, initialIndex: a }) => {
20
+ const s = m(() => {
21
+ var e;
22
+ return t.value ? (i(t.value) ? ((e = t.value) == null ? void 0 : e.sources) ?? [] : [t.value].flat().map((l) => l)).map((l, r) => l && I(l, r)).filter(c) : [];
23
+ }), v = (n) => {
24
+ if (s.value.length === 1)
25
25
  return;
26
- const r = new URL(window.location.href), t = a.value[u], l = (t == null ? void 0 : t.slug) ?? u.toString();
27
- r.searchParams.set(c, l), r.hash = "", window.scrollTo({ top: 0, behavior: "instant" }), window.history.replaceState({}, "", r.toString());
28
- }, o = S((() => {
29
- const r = new URL(window.location.href).searchParams.get(c) || "0", t = a.value.findIndex((d) => d.slug === r);
30
- if (t !== -1)
31
- return t;
32
- const l = Number.parseInt(r, 10);
33
- return !isNaN(l) && l >= 0 && l < a.value.length ? l : typeof n == "number" ? n : 0;
26
+ const e = new URL(window.location.href), l = s.value[n], r = (l == null ? void 0 : l.slug) ?? n.toString();
27
+ e.searchParams.set(p, r), e.hash = "", window.scrollTo({ top: 0, behavior: "instant" }), window.history.replaceState({}, "", e.toString());
28
+ }, u = w((() => {
29
+ const e = new URL(window.location.href).searchParams.get(p) || "0", l = s.value.findIndex((d) => d.slug === e);
30
+ if (l !== -1)
31
+ return l;
32
+ const r = Number.parseInt(e, 10);
33
+ return !isNaN(r) && r >= 0 && r < s.value.length ? r : typeof a == "number" ? a : 0;
34
34
  })()), g = m(() => {
35
- var u;
36
- return e.value && s(e.value) ? i.parse({
37
- ...e.value,
38
- spec: (u = e.value.spec) == null ? void 0 : u.sources[o.value]
39
- }) : i.parse([e.value].flat()[o.value] ?? {});
35
+ var n, e;
36
+ return t.value && i(t.value) ? o.parse({
37
+ ...t.value,
38
+ ...(e = (n = t.value) == null ? void 0 : n.sources) == null ? void 0 : e[u.value]
39
+ }) : o.parse([t.value].flat()[u.value] ?? {});
40
40
  });
41
- return p(o, v, { flush: "sync" }), {
41
+ return S(u, v, { flush: "sync" }), {
42
42
  selectedConfiguration: g,
43
- availableDocuments: a,
44
- selectedDocumentIndex: o
43
+ availableDocuments: s,
44
+ selectedDocumentIndex: u
45
45
  };
46
46
  };
47
47
  export {
package/dist/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  export { default as ApiReference } from './components/ApiReference.vue.js';
2
2
  export { default as ApiReferenceLayout } from './components/ApiReferenceLayout.vue.js';
3
3
  export { default as ModernLayout } from './components/Layouts/ModernLayout.vue.js';
4
- export * from './features/Search';
4
+ export { SearchButton, SearchModal } from './features/Search';
5
5
  export { default as GettingStarted } from './components/GettingStarted.vue.js';
6
- export { createScalarReferences } from './esm.js';
7
6
  export { useReactiveSpec } from './hooks/useReactiveSpec.js';
8
- export * from './components/Sidebar';
9
- export * from './components/Card';
10
- export * from './components/Layouts';
7
+ export { createApiReference } from './standalone/lib/html-api.js';
8
+ export { Sidebar } from './components/Sidebar';
9
+ export { Card, CardHeader, CardContent, CardFooter, CardTabHeader, CardTab } from './components/Card';
10
+ export { Layouts } from './components/Layouts';
11
11
  export * from './stores';
12
12
  export * from './helpers';
13
13
  export * from './types';
14
14
  export * from './hooks';
15
+ export { createScalarReferences } from './esm.js';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAC/E,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,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