@scalar/api-reference 1.28.2 → 1.28.4

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 (63) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/blocks/hooks/useBlockProps.d.ts +4 -5
  3. package/dist/blocks/hooks/useBlockProps.d.ts.map +1 -1
  4. package/dist/blocks/hooks/useBlockProps.js +10 -14
  5. package/dist/browser/standalone.js +5352 -5331
  6. package/dist/browser/webpack-stats.json +1 -1
  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 +103 -109
  10. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  11. package/dist/components/Content/Content.vue.js +2 -2
  12. package/dist/components/Content/Content.vue2.js +97 -71
  13. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  15. package/dist/components/Content/Introduction/Introduction.vue2.js +18 -18
  16. package/dist/components/Content/Lazy/Loading.vue.d.ts +3 -0
  17. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Lazy/Loading.vue.js +58 -56
  19. package/dist/components/Content/Tag/OperationsList.vue.d.ts +2 -0
  20. package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Tag/OperationsList.vue.js +2 -2
  22. package/dist/components/Content/Tag/OperationsList.vue2.js +22 -20
  23. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts +2 -0
  24. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Tag/OperationsListItem.vue.js +1 -1
  26. package/dist/components/Content/Tag/OperationsListItem.vue2.js +10 -8
  27. package/dist/components/Content/Tag/Tag.vue.d.ts +2 -0
  28. package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
  29. package/dist/components/Content/Tag/Tag.vue.js +38 -34
  30. package/dist/components/Content/Tag/TagList.vue.d.ts +3 -0
  31. package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
  32. package/dist/components/Content/Tag/TagList.vue.js +32 -30
  33. package/dist/components/Content/Tag/TagSection.vue.d.ts +2 -0
  34. package/dist/components/Content/Tag/TagSection.vue.d.ts.map +1 -1
  35. package/dist/components/Content/Tag/TagSection.vue.js +2 -2
  36. package/dist/components/Content/Tag/TagSection.vue2.js +16 -14
  37. package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
  38. package/dist/components/ShowMoreButton.vue.js +2 -2
  39. package/dist/features/ApiClientModal/useApiClient.d.ts +6 -6
  40. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  41. package/dist/features/BaseUrl/BaseUrl.vue.d.ts +6 -1
  42. package/dist/features/BaseUrl/BaseUrl.vue.d.ts.map +1 -1
  43. package/dist/features/BaseUrl/BaseUrl.vue.js +36 -32
  44. package/dist/features/Operation/Operation.vue.d.ts +1 -1
  45. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  46. package/dist/features/Operation/Operation.vue.js +13 -12
  47. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  48. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  49. package/dist/features/Operation/components/RequestBody.vue2.js +31 -22
  50. package/dist/features/Search/SearchButton.vue.d.ts.map +1 -1
  51. package/dist/features/Search/SearchButton.vue.js +2 -2
  52. package/dist/helpers/get-request.d.ts.map +1 -1
  53. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
  54. package/dist/hooks/useMultipleDocuments.js +49 -41
  55. package/dist/index.d.ts +1 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/standalone/lib/html-api.d.ts +8 -9
  59. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  60. package/dist/style.css +1 -1
  61. package/dist/types.d.ts +2 -2
  62. package/dist/types.d.ts.map +1 -1
  63. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAUhE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC7B,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAC;;AAmGF,wBAMG"}
1
+ {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAUhE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC7B,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAC;;AAoGF,wBAMG"}
@@ -1,10 +1,10 @@
1
- import { defineComponent as s, unref as r, openBlock as t, createElementBlock as l, Fragment as p, createBlock as a, createCommentVNode as m } from "vue";
2
- import { useWorkspace as c } from "@scalar/api-client/store";
1
+ import { defineComponent as l, unref as t, openBlock as n, createElementBlock as s, Fragment as c, createBlock as a, createCommentVNode as m } from "vue";
2
+ import { useWorkspace as p } from "@scalar/api-client/store";
3
3
  import { getPointer as d } from "../../blocks/helpers/getPointer.js";
4
4
  import { useBlockProps as f } from "../../blocks/hooks/useBlockProps.js";
5
5
  import u from "./layouts/ClassicLayout.vue.js";
6
6
  import O from "./layouts/ModernLayout.vue.js";
7
- const g = /* @__PURE__ */ s({
7
+ const g = /* @__PURE__ */ l({
8
8
  __name: "Operation",
9
9
  props: {
10
10
  id: {},
@@ -13,28 +13,29 @@ const g = /* @__PURE__ */ s({
13
13
  collection: {},
14
14
  server: {}
15
15
  },
16
- setup(n) {
17
- const i = c(), { operation: o } = f({
16
+ setup(o) {
17
+ const i = p(), { operation: r } = f({
18
18
  store: i,
19
+ collection: o.collection,
19
20
  location: d([
20
21
  "paths",
21
- n.transformedOperation.path,
22
- n.transformedOperation.httpVerb.toLowerCase()
22
+ o.transformedOperation.path,
23
+ o.transformedOperation.httpVerb.toLowerCase()
23
24
  ])
24
25
  });
25
- return (e, k) => e.collection && r(o) ? (t(), l(p, { key: 0 }, [
26
- e.layout === "classic" ? (t(), a(u, {
26
+ return (e, k) => e.collection && t(r) ? (n(), s(c, { key: 0 }, [
27
+ e.layout === "classic" ? (n(), a(u, {
27
28
  key: 0,
28
29
  id: e.id,
29
30
  collection: e.collection,
30
- operation: r(o),
31
+ operation: t(r),
31
32
  server: e.server,
32
33
  transformedOperation: e.transformedOperation
33
- }, null, 8, ["id", "collection", "operation", "server", "transformedOperation"])) : (t(), a(O, {
34
+ }, null, 8, ["id", "collection", "operation", "server", "transformedOperation"])) : (n(), a(O, {
34
35
  key: 1,
35
36
  id: e.id,
36
37
  collection: e.collection,
37
- operation: r(o),
38
+ operation: t(r),
38
39
  server: e.server,
39
40
  transformedOperation: e.transformedOperation
40
41
  }, null, 8, ["id", "collection", "operation", "server", "transformedOperation"]))
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/RequestBody.vue"],"names":[],"mappings":"AAmIA,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,sBAAsB,CAAA;AASpE,KAAK,WAAW,GAAG;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAqBjD,iBAAS,cAAc;WAyFT,OAAO,IAA6B;;uBARvB,GAAG;;;;EAa7B;AAWD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/RequestBody.vue"],"names":[],"mappings":"AA0IA,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,sBAAsB,CAAA;AASpE,KAAK,WAAW,GAAG;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAqBjD,iBAAS,cAAc;WAmGT,OAAO,IAA6B;;uBARvB,GAAG;;;;EAa7B;AAYD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./RequestBody.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1e0d96b3"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-73988f44"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
@@ -1,44 +1,53 @@
1
- import { defineComponent as p, computed as v, ref as f, openBlock as d, createElementBlock as c, createElementVNode as q, renderSlot as B, createVNode as i, unref as h, createCommentVNode as m } from "vue";
1
+ import { defineComponent as v, computed as q, ref as f, openBlock as o, createElementBlock as n, createElementVNode as B, renderSlot as h, createVNode as s, unref as m, createCommentVNode as r } from "vue";
2
+ import { ScalarMarkdown as k } from "@scalar/components";
2
3
  import b from "./ContentTypeSelect.vue.js";
3
- import k from "../../../components/Content/Schema/Schema.vue.js";
4
- const C = { key: 0 }, V = { class: "request-body-title" }, _ = {
4
+ import C from "../../../components/Content/Schema/Schema.vue.js";
5
+ const V = { key: 0 }, _ = { class: "request-body-title" }, S = {
6
+ key: 0,
7
+ class: "request-body-description"
8
+ }, N = {
5
9
  key: 0,
6
10
  class: "request-body-schema"
7
- }, j = /* @__PURE__ */ p({
11
+ }, g = /* @__PURE__ */ v({
8
12
  __name: "RequestBody",
9
13
  props: {
10
14
  requestBody: {}
11
15
  },
12
- setup(o) {
13
- var s;
14
- const n = v(
16
+ setup(l) {
17
+ var a;
18
+ const u = q(
15
19
  () => {
16
20
  var e;
17
- return Object.keys(((e = o.requestBody) == null ? void 0 : e.content) ?? {});
21
+ return Object.keys(((e = l.requestBody) == null ? void 0 : e.content) ?? {});
18
22
  }
19
23
  ), t = f("application/json");
20
- return (s = o.requestBody) != null && s.content && n.value.length > 0 && (t.value = n.value[0]), (e, l) => {
21
- var u, a, r;
22
- return e.requestBody ? (d(), c("div", C, [
23
- q("div", V, [
24
- B(e.$slots, "title", {}, void 0, !0),
25
- i(b, {
24
+ return (a = l.requestBody) != null && a.content && u.value.length > 0 && (t.value = u.value[0]), (e, d) => {
25
+ var i, c, y;
26
+ return e.requestBody ? (o(), n("div", V, [
27
+ B("div", _, [
28
+ h(e.$slots, "title", {}, void 0, !0),
29
+ s(b, {
26
30
  defaultValue: t.value,
27
31
  requestBody: e.requestBody,
28
- onSelectContentType: l[0] || (l[0] = ({ contentType: y }) => t.value = y)
29
- }, null, 8, ["defaultValue", "requestBody"])
32
+ onSelectContentType: d[0] || (d[0] = ({ contentType: p }) => t.value = p)
33
+ }, null, 8, ["defaultValue", "requestBody"]),
34
+ e.requestBody.description ? (o(), n("div", S, [
35
+ s(m(k), {
36
+ value: e.requestBody.description
37
+ }, null, 8, ["value"])
38
+ ])) : r("", !0)
30
39
  ]),
31
- (u = e.requestBody.content) != null && u[t.value] ? (d(), c("div", _, [
32
- i(h(k), {
40
+ (i = e.requestBody.content) != null && i[t.value] ? (o(), n("div", N, [
41
+ s(m(C), {
33
42
  compact: "",
34
43
  noncollapsible: "",
35
- value: (r = (a = e.requestBody.content) == null ? void 0 : a[t.value]) == null ? void 0 : r.schema
44
+ value: (y = (c = e.requestBody.content) == null ? void 0 : c[t.value]) == null ? void 0 : y.schema
36
45
  }, null, 8, ["value"])
37
- ])) : m("", !0)
38
- ])) : m("", !0);
46
+ ])) : r("", !0)
47
+ ])) : r("", !0);
39
48
  };
40
49
  }
41
50
  });
42
51
  export {
43
- j as default
52
+ g as default
44
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Search/SearchButton.vue"],"names":[],"mappings":"AAkIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAShD,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAC;;kBADe,MAAM;;AAgIzB,wBAOG"}
1
+ {"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Search/SearchButton.vue"],"names":[],"mappings":"AAoIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAShD,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAC;;kBADe,MAAM;;AAgIzB,wBAOG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./SearchButton.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-16490ca3"]]);
4
+ const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ed4be71c"]]);
5
5
  export {
6
- m as default
6
+ c as default
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-request.d.ts","sourceRoot":"","sources":["../../src/helpers/get-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,6CAA6C;AAC7C,eAAO,MAAM,UAAU,aAAc,cAAc,CAAC,UAAU,CAAC,QAAQ,MAAM,UAAU,MAAM;;;yBAEoyT,KAAK;kDAA4E,KAAK,8CAA8C,KAAK;wCAA6E,KAAK;8BAA6D,KAAK;+BAAyD,KAAK;;;;;;mBAAwR,CAAC;;;;;;;;;;;;;eAA0f,CAAC;mBAAkC,CAAC;cAAwC,CAAC;eAA8B,CAAC;aAA4B,CAAC;gBAA8H,CAAC;iBAAoD,CAAC;mBAAkC,CAAC;;;;;kCAAiM,eAAe;aADt7W,CAAA"}
1
+ {"version":3,"file":"get-request.d.ts","sourceRoot":"","sources":["../../src/helpers/get-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,6CAA6C;AAC7C,eAAO,MAAM,UAAU,aAAc,cAAc,CAAC,UAAU,CAAC,QAAQ,MAAM,UAAU,MAAM;;;yBAE2yT,KAAK;kDAA4E,KAAK,8CAA8C,KAAK;wCAA6E,KAAK;8BAA6D,KAAK;+BAAyD,KAAK;;;;;;mBAAwR,CAAC;;;;;;;;;;;;;eAA0f,CAAC;mBAAkC,CAAC;cAAwC,CAAC;eAA8B,CAAC;aAA4B,CAAC;gBAA8H,CAAC;iBAAoD,CAAC;mBAAkC,CAAC;;;;;kCAAiM,eAAe;aAD77W,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EAI1C,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CACd,OAAO,CAAC,yBAAyB,CAAC,GAClC,OAAO,CAAC,yBAAyB,CAAC,EAAE,GACpC,OAAO,CAAC,oCAAoC,CAAC,GAC7C,SAAS,CACZ,CAAA;IACD,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAsCD,eAAO,MAAM,oBAAoB,oCAAqC,yBAAyB;;;;;;;;;;;;;;mDAqGu8yB,GAAG;;;;eAAoJ,CAAC;mBAAqC,CAAC,mCAAmC,GAAG;iBAA0E,CAAC;gBAAkC,CAAC;;;;;;;;;;;;;;;;;;;yCAAwsC,GAAI;2CAA6E,GAAI;;;;;gBAA0J,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qBAA0D,GAAG;qCAAuE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;;mDAhGv04B,GAAG;;;;;CA+FV,CAAA"}
1
+ {"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EAI1C,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CACd,OAAO,CAAC,yBAAyB,CAAC,GAClC,OAAO,CAAC,yBAAyB,CAAC,EAAE,GACpC,OAAO,CAAC,oCAAoC,CAAC,GAC7C,SAAS,CACZ,CAAA;IACD,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAsCD,eAAO,MAAM,oBAAoB,oCAAqC,yBAAyB;;;;;;;;;;;;;;mDA8Gw8xB,GAAG;;;;eAAoJ,CAAC;mBAAqC,CAAC,mCAAmC,GAAG;iBAA0E,CAAC;gBAAkC,CAAC;;;;;;;;;;;;;;;;;;;yCAAwsC,GAAI;2CAA6E,GAAI;;;;;gBAA0J,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qBAA0D,GAAG;qCAAuE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;;mDA1G5y3B,GAAG;;;;;CAyGtC,CAAA"}
@@ -1,49 +1,57 @@
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
1
+ import { useNavState as h } from "./useNavState.js";
2
+ import { isDefined as w } from "@scalar/oas-utils/helpers";
3
+ import { isConfigurationWithSources as o, apiReferenceConfigurationSchema as m } from "@scalar/types/api-reference";
4
+ import S from "github-slugger";
5
+ import { computed as v, ref as I, watch as b } from "vue";
6
+ const f = "api", p = new S(), R = (e, s = 0) => {
7
+ if (!(!(e != null && e.url) && !(e != null && e.content)))
8
+ return p.reset(), e.title ? {
9
+ ...e,
10
+ slug: e.slug || p.slug(e.title),
11
+ title: e.title
12
+ } : e.slug ? {
13
+ ...e,
14
+ title: e.slug
14
15
  } : {
15
- ...t,
16
- slug: `api-${a + 1}`,
17
- title: `API #${a + 1}`
16
+ ...e,
17
+ slug: `api-${s + 1}`,
18
+ title: `API #${s + 1}`
18
19
  };
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)
20
+ }, T = ({ configuration: e, initialIndex: s }) => {
21
+ const { isIntersectionEnabled: i } = h(), n = v(() => {
22
+ var l;
23
+ return e.value ? (o(e.value) ? ((l = e.value) == null ? void 0 : l.sources) ?? [] : [e.value].flat().map((t) => t)).map((t, a) => t && R(t, a)).filter(w) : [];
24
+ }), c = (u) => {
25
+ if (n.value.length === 1)
25
26
  return;
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
- })()), g = m(() => {
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] ?? {});
27
+ const l = new URL(window.location.href), t = n.value[u], a = (t == null ? void 0 : t.slug) ?? u.toString();
28
+ l.searchParams.set(f, a), l.hash = "", window.history.replaceState({}, "", l.toString()), i.value = !1, window.scrollTo({ top: 0, behavior: "instant" }), setTimeout(() => i.value = !0, 300);
29
+ }, r = I((() => {
30
+ const l = new URL(window.location.href).searchParams.get(f) || "0", t = n.value.findIndex((g) => g.slug === l);
31
+ if (t !== -1)
32
+ return t;
33
+ const a = Number.parseInt(l, 10);
34
+ return !isNaN(a) && a >= 0 && a < n.value.length ? a : typeof s == "number" ? s : 0;
35
+ })()), d = v(() => {
36
+ var l, t;
37
+ if (e.value && o(e.value))
38
+ return m.parse({
39
+ ...e.value,
40
+ ...(t = (l = e.value) == null ? void 0 : l.sources) == null ? void 0 : t[r.value],
41
+ ...n.value[r.value]
42
+ });
43
+ const u = [e.value].flat()[r.value] ?? {};
44
+ return m.parse({
45
+ ...u,
46
+ ...n.value[r.value]
47
+ });
40
48
  });
41
- return S(u, v, { flush: "sync" }), {
42
- selectedConfiguration: g,
43
- availableDocuments: s,
44
- selectedDocumentIndex: u
49
+ return b(r, c, { flush: "sync" }), {
50
+ selectedConfiguration: d,
51
+ availableDocuments: n,
52
+ selectedDocumentIndex: r
45
53
  };
46
54
  };
47
55
  export {
48
- U as useMultipleDocuments
56
+ T as useMultipleDocuments
49
57
  };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { default as ModernLayout } from './components/Layouts/ModernLayout.vue.j
4
4
  export { SearchButton, SearchModal } from './features/Search';
5
5
  export { default as GettingStarted } from './components/GettingStarted.vue.js';
6
6
  export { useReactiveSpec } from './hooks/useReactiveSpec.js';
7
- export { createApiReference } from './standalone/lib/html-api.js';
7
+ export { type ApiReferenceInstance, createApiReference } from './standalone/lib/html-api.js';
8
8
  export { Sidebar } from './components/Sidebar';
9
9
  export { Card, CardHeader, CardContent, CardFooter, CardTabHeader, CardTab } from './components/Card';
10
10
  export { Layouts } from './components/Layouts';
@@ -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,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA"}
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,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,KAAK,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEzF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA"}