@scalar/api-reference 1.28.5 → 1.28.7

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 (153) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/browser/standalone.js +6284 -6218
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReference.vue.js +26 -15
  6. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  7. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  8. package/dist/components/ApiReferenceLayout.vue2.js +128 -129
  9. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +1 -1
  10. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +2 -2
  11. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  12. package/dist/components/Content/Content.vue.js +2 -2
  13. package/dist/components/Content/Content.vue2.js +57 -55
  14. package/dist/components/Content/Introduction/Description.vue.d.ts.map +1 -1
  15. package/dist/components/Content/Introduction/Description.vue.js +2 -2
  16. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  17. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  18. package/dist/components/Content/Introduction/Introduction.vue2.js +24 -24
  19. package/dist/components/Content/Lazy/Lazy.vue.d.ts.map +1 -1
  20. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Lazy/Loading.vue.js +4 -2
  22. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  23. package/dist/components/Content/Models/Models.vue.js +2 -2
  24. package/dist/components/Content/Models/Models.vue2.js +18 -17
  25. package/dist/components/Content/Schema/Schema.vue.d.ts +1 -0
  26. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  27. package/dist/components/Content/Schema/Schema.vue.js +4 -4
  28. package/dist/components/Content/Schema/Schema.vue2.js +79 -67
  29. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts +12 -0
  30. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -0
  31. package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +7 -0
  32. package/dist/components/Content/Schema/SchemaDiscriminator.vue2.js +109 -0
  33. package/dist/components/Content/Schema/SchemaHeading.vue.d.ts.map +1 -1
  34. package/dist/components/Content/Schema/SchemaHeading.vue.js +2 -2
  35. package/dist/components/Content/Schema/SchemaHeading.vue2.js +26 -31
  36. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +3 -0
  37. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  38. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  39. package/dist/components/Content/Schema/SchemaProperty.vue2.js +143 -141
  40. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  41. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
  42. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +83 -99
  43. package/dist/components/Content/Tag/OperationsList.vue.js +2 -2
  44. package/dist/components/Content/Tag/OperationsList.vue2.js +3 -3
  45. package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
  46. package/dist/components/Content/Tag/Tag.vue.js +41 -36
  47. package/dist/components/Content/Tag/TagList.vue.d.ts +2 -0
  48. package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
  49. package/dist/components/Content/Tag/TagList.vue.js +38 -36
  50. package/dist/components/Content/Tag/TagSection.vue.js +2 -2
  51. package/dist/components/Content/Tag/TagSection.vue2.js +3 -3
  52. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  53. package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
  54. package/dist/components/Layouts/ModernLayout.vue.js +1 -1
  55. package/dist/components/Section/CompactSection.vue.d.ts.map +1 -1
  56. package/dist/components/Section/CompactSection.vue.js +2 -2
  57. package/dist/components/Section/Section.vue.d.ts.map +1 -1
  58. package/dist/components/Section/Section.vue.js +2 -2
  59. package/dist/components/Section/SectionHeaderTag.vue.d.ts.map +1 -1
  60. package/dist/components/Section/SectionHeaderTag.vue.js +2 -2
  61. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  62. package/dist/components/Sidebar/Sidebar.vue.js +2 -2
  63. package/dist/components/Sidebar/Sidebar.vue2.js +2 -1
  64. package/dist/components/Sidebar/SidebarElement.vue.d.ts.map +1 -1
  65. package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
  66. package/dist/components/Sidebar/SidebarElement.vue2.js +40 -39
  67. package/dist/esm.d.ts.map +1 -1
  68. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
  69. package/dist/features/ApiClientModal/useApiClient.d.ts +2 -4
  70. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  71. package/dist/features/BaseUrl/BaseUrl.vue.d.ts.map +1 -1
  72. package/dist/features/BaseUrl/BaseUrl.vue.js +2 -1
  73. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  74. package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
  75. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +2 -1
  76. package/dist/features/ExampleResponses/ExampleResponses.vue.d.ts.map +1 -1
  77. package/dist/features/ExampleResponses/ExampleResponses.vue.js +3 -3
  78. package/dist/features/ExampleResponses/ExampleResponses.vue2.js +6 -8
  79. package/dist/features/Operation/Operation.vue.d.ts +2 -0
  80. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  81. package/dist/features/Operation/Operation.vue.js +13 -10
  82. package/dist/features/Operation/Webhooks.vue.d.ts.map +1 -1
  83. package/dist/features/Operation/Webhooks.vue.js +2 -2
  84. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
  85. package/dist/features/Operation/components/ContentTypeSelect.vue.js +4 -4
  86. package/dist/features/Operation/components/OperationParameters.vue.d.ts +2 -0
  87. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  88. package/dist/features/Operation/components/OperationParameters.vue.js +37 -31
  89. package/dist/features/Operation/components/OperationResponses.vue.d.ts +2 -0
  90. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  91. package/dist/features/Operation/components/OperationResponses.vue.js +15 -13
  92. package/dist/features/Operation/components/ParameterList.vue.d.ts +2 -0
  93. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  94. package/dist/features/Operation/components/ParameterList.vue.js +2 -2
  95. package/dist/features/Operation/components/ParameterList.vue2.js +14 -12
  96. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +2 -0
  97. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  98. package/dist/features/Operation/components/ParameterListItem.vue.js +2 -2
  99. package/dist/features/Operation/components/ParameterListItem.vue2.js +20 -18
  100. package/dist/features/Operation/components/RequestBody.vue.d.ts +2 -0
  101. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  102. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  103. package/dist/features/Operation/components/RequestBody.vue2.js +20 -18
  104. package/dist/features/Operation/hooks/useResponses.d.ts.map +1 -1
  105. package/dist/features/Operation/hooks/useResponses.js +2 -1
  106. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +2 -0
  107. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  108. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  109. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +29 -24
  110. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -0
  111. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  112. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  113. package/dist/features/Operation/layouts/ModernLayout.vue2.js +66 -56
  114. package/dist/features/Search/SearchModal.vue.d.ts.map +1 -1
  115. package/dist/features/Search/SearchModal.vue.js +2 -2
  116. package/dist/features/Search/SearchModal.vue2.js +2 -1
  117. package/dist/features/Search/useSearchIndex.d.ts.map +1 -1
  118. package/dist/features/Search/useSearchIndex.js +9 -9
  119. package/dist/helpers/index.d.ts +4 -4
  120. package/dist/helpers/scrollToId.d.ts.map +1 -1
  121. package/dist/helpers/specHelpers.js +15 -14
  122. package/dist/hooks/index.d.ts +0 -2
  123. package/dist/hooks/index.d.ts.map +1 -1
  124. package/dist/hooks/useMultipleDocuments.d.ts +7 -2
  125. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
  126. package/dist/hooks/useMultipleDocuments.js +43 -33
  127. package/dist/hooks/useNavState.d.ts +13 -4
  128. package/dist/hooks/useNavState.d.ts.map +1 -1
  129. package/dist/hooks/useNavState.js +52 -47
  130. package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
  131. package/dist/hooks/useSidebar.d.ts.map +1 -1
  132. package/dist/hooks/useSidebar.js +3 -2
  133. package/dist/index.d.ts +6 -4
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +39 -76
  136. package/dist/libs/operation.d.ts.map +1 -1
  137. package/dist/standalone/lib/html-api.d.ts +4 -4
  138. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  139. package/dist/stores/useHttpClientStore.d.ts.map +1 -1
  140. package/dist/style.css +1 -1
  141. package/dist/types.d.ts +1 -10
  142. package/dist/types.d.ts.map +1 -1
  143. package/package.json +12 -10
  144. package/dist/helpers/getVariableNames.js +0 -7
  145. package/dist/helpers/hasSecuritySchemes.js +0 -7
  146. package/dist/helpers/mapFromObject.js +0 -7
  147. package/dist/helpers/mergeAllObjects.js +0 -7
  148. package/dist/hooks/useClientStore.d.ts +0 -2
  149. package/dist/hooks/useClientStore.d.ts.map +0 -1
  150. package/dist/hooks/useClientStore.js +0 -5
  151. package/dist/hooks/useRefOnMount.d.ts +0 -6
  152. package/dist/hooks/useRefOnMount.d.ts.map +0 -1
  153. package/dist/hooks/useRefOnMount.js +0 -10
@@ -1,57 +1,67 @@
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) => {
1
+ import { isDefined as S } from "@scalar/oas-utils/helpers";
2
+ import { isConfigurationWithSources as p, apiReferenceConfigurationSchema as m } from "@scalar/types/api-reference";
3
+ import y from "github-slugger";
4
+ import { computed as v, ref as R, watch as b } from "vue";
5
+ const d = "api", w = new y(), A = (e, r = 0) => {
7
6
  if (!(!(e != null && e.url) && !(e != null && e.content)))
8
- return p.reset(), e.title ? {
7
+ return w.reset(), e.title ? {
9
8
  ...e,
10
- slug: e.slug || p.slug(e.title),
9
+ slug: e.slug || w.slug(e.title),
11
10
  title: e.title
12
11
  } : e.slug ? {
13
12
  ...e,
14
13
  title: e.slug
15
14
  } : {
16
15
  ...e,
17
- slug: `api-${s + 1}`,
18
- title: `API #${s + 1}`
16
+ slug: `api-${r + 1}`,
17
+ title: `API #${r + 1}`
19
18
  };
20
- }, T = ({ configuration: e, initialIndex: s }) => {
21
- const { isIntersectionEnabled: i } = h(), n = v(() => {
19
+ }, N = ({
20
+ configuration: e,
21
+ initialIndex: r,
22
+ isIntersectionEnabled: s,
23
+ hash: o,
24
+ hashPrefix: f
25
+ }) => {
26
+ const a = v(() => {
22
27
  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)
28
+ return e.value ? (p(e.value) ? ((l = e.value) == null ? void 0 : l.sources) ?? [] : [e.value].flat().map((t) => t)).map((t, n) => t && A(t, n)).filter(S) : [];
29
+ }), g = (i) => {
30
+ if (typeof window > "u" || a.value.length === 1)
26
31
  return;
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);
32
+ const l = new URL(window.location.href), t = a.value[i], n = (t == null ? void 0 : t.slug) ?? i.toString();
33
+ l.searchParams.set(d, n), l.hash = "", window.history.replaceState({}, "", l.toString()), o.value = "", f.value = "", s.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" });
34
+ }, u = R((() => {
35
+ if (typeof window > "u")
36
+ return typeof r == "number" ? r : 0;
37
+ const l = new URL(window.location.href).searchParams.get(d) || "0", t = a.value.findIndex((h) => h.slug === l);
31
38
  if (t !== -1)
32
39
  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(() => {
40
+ const n = Number.parseInt(l, 10);
41
+ return !isNaN(n) && n >= 0 && n < a.value.length ? n : typeof r == "number" ? r : 0;
42
+ })()), c = v(() => {
36
43
  var l, t;
37
- if (e.value && o(e.value))
44
+ if (e.value && p(e.value))
38
45
  return m.parse({
39
46
  ...e.value,
40
- ...(t = (l = e.value) == null ? void 0 : l.sources) == null ? void 0 : t[r.value],
41
- ...n.value[r.value]
47
+ ...(t = (l = e.value) == null ? void 0 : l.sources) == null ? void 0 : t[u.value],
48
+ ...a.value[u.value]
42
49
  });
43
- const u = [e.value].flat()[r.value] ?? {};
50
+ const i = [e.value].flat()[u.value] ?? {};
44
51
  return m.parse({
45
- ...u,
46
- ...n.value[r.value]
52
+ ...i,
53
+ ...a.value[u.value]
47
54
  });
48
55
  });
49
- return b(r, c, { flush: "sync" }), {
50
- selectedConfiguration: d,
51
- availableDocuments: n,
52
- selectedDocumentIndex: r
56
+ return b(u, g, { flush: "sync" }), {
57
+ selectedConfiguration: c,
58
+ availableDocuments: a,
59
+ selectedDocumentIndex: u,
60
+ isIntersectionEnabled: s,
61
+ hash: o,
62
+ hashPrefix: f
53
63
  };
54
64
  };
55
65
  export {
56
- T as useMultipleDocuments
66
+ N as useMultipleDocuments
57
67
  };
@@ -1,4 +1,14 @@
1
- import type { Heading, PathRouting, Tag, TransformedOperation } from '@scalar/types/legacy';
1
+ import type { Heading, Tag, TransformedOperation } from '@scalar/types/legacy';
2
+ import { type InjectionKey, type Ref } from 'vue';
3
+ export type NavState = {
4
+ /** The URL hash without the #, also the "hash" pulled from pathRouting */
5
+ hash: Ref<string>;
6
+ /** The prefix for the hash, used in ORG */
7
+ hashPrefix: Ref<string>;
8
+ /** Whether the intersection observer is enabled and updating the hash as we scroll */
9
+ isIntersectionEnabled: Ref<boolean>;
10
+ };
11
+ export declare const NAV_STATE_SYMBOL: InjectionKey<NavState>;
2
12
  /**
3
13
  * Hook which provides reactive hash state from the URL
4
14
  * Also hash is only readable by the client so keep that in mind for SSR
@@ -7,7 +17,7 @@ import type { Heading, PathRouting, Tag, TransformedOperation } from '@scalar/ty
7
17
  * when clicking on sidebar links or going backwards
8
18
  */
9
19
  export declare const useNavState: () => {
10
- hash: import("vue").Ref<string, string>;
20
+ hash: Ref<string, string>;
11
21
  /** Sets the prefix for the hash */
12
22
  setHashPrefix: (prefix: string) => void;
13
23
  /**
@@ -42,8 +52,7 @@ export declare const useNavState: () => {
42
52
  getPathRoutingId: (pathName: string) => string;
43
53
  getSectionId: (hashStr?: string) => string;
44
54
  getTagId: (tag: Tag) => string;
45
- isIntersectionEnabled: import("vue").Ref<boolean, boolean>;
46
- pathRouting: import("vue").Ref<PathRouting | undefined, PathRouting | undefined>;
55
+ isIntersectionEnabled: Ref<boolean, boolean>;
47
56
  updateHash: () => void;
48
57
  };
49
58
  //# sourceMappingURL=useNavState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks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MAAM;IAoH9C,0DAA0D;;6BAnC5B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;yBA9BrC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BAXb,OAAO;gCA6BH,oBAAoB,aAAa,GAAG;iCA/FnC,MAAM;;oBAwFnB,GAAG;;;CAkE3B,CAAA"}
@@ -1,75 +1,80 @@
1
- import { useConfig as f } from "./useConfig.js";
2
- import { ssrState as p, combineUrlAndPath as v } from "@scalar/oas-utils/helpers";
3
- import { slug as c } from "github-slugger";
4
- import { ref as s } from "vue";
5
- const u = s(""), l = s(p.hash ?? ""), r = s(), m = s(!1), h = (t) => {
6
- var n;
7
- if (!r.value) return "";
8
- const a = new RegExp("^" + ((n = r.value) == null ? void 0 : n.basePath) + "/?");
9
- return decodeURIComponent(t.replace(a, ""));
10
- }, w = (t = l.value) => {
11
- var i;
12
- const a = (i = t.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = t.startsWith("model") ? "models" : "", o = t.startsWith("webhook") ? "webhooks" : "";
13
- return a || n || o;
14
- }, I = () => {
15
- l.value = r.value ? h(window.location.pathname) : (
16
- // Must remove the prefix from the hash as the internal hash value should be pure
17
- decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(u.value.length)
18
- );
19
- }, $ = (t, a = window.location.href) => {
20
- const n = new URL(a);
21
- r.value ? n.pathname = v(r.value.basePath, t) : n.hash = u.value + t, l.value = t, window.history.replaceState({}, "", n);
22
- }, S = (t, a = window.location.href, n = window.location.search) => {
23
- const o = new URL(a);
24
- return o.hash = u.value + t, o.search = n, o.toString();
25
- }, U = (t = l.value) => `${u.value}${t}`, b = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(u.value.length)), x = () => {
26
- const t = f(), a = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", n = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${c(e.name)}` : "models", o = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${c(e.name)}`;
1
+ import { useConfig as $ } from "./useConfig.js";
2
+ import { combineUrlAndPath as R } from "@scalar/oas-utils/helpers";
3
+ import { slug as l } from "github-slugger";
4
+ import { ref as i, inject as b } from "vue";
5
+ const y = Symbol(), U = i(!1), P = i(""), k = i(""), C = () => {
6
+ const { isIntersectionEnabled: h, hash: r, hashPrefix: o } = b(y, {
7
+ isIntersectionEnabled: U,
8
+ hash: P,
9
+ hashPrefix: k
10
+ }), t = $(), c = (e) => {
11
+ var n;
12
+ if (!t.value.pathRouting)
13
+ return "";
14
+ const a = new RegExp("^" + ((n = t.value.pathRouting) == null ? void 0 : n.basePath) + "/?");
15
+ return decodeURIComponent(e.replace(a, ""));
16
+ }, d = (e = r.value) => {
17
+ var g;
18
+ const a = (g = e.match(/(tag\/[^/]+)/)) == null ? void 0 : g[0], n = e.startsWith("model") ? "models" : "", u = e.startsWith("webhook") ? "webhooks" : "";
19
+ return a || n || u;
20
+ }, f = () => {
21
+ r.value = t.value.pathRouting ? c(window.location.pathname) : (
22
+ // Must remove the prefix from the hash as the internal hash value should be pure
23
+ decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(o.value.length)
24
+ );
25
+ }, p = (e, a = window.location.href) => {
26
+ const n = new URL(a);
27
+ t.value.pathRouting ? n.pathname = R(t.value.pathRouting.basePath, e) : n.hash = o.value + e, r.value = e, window.history.replaceState({}, "", n);
28
+ }, m = (e, a = window.location.href, n = window.location.search) => {
29
+ const u = new URL(a);
30
+ return u.hash = o.value + e, u.search = n, u.toString();
31
+ }, v = (e = r.value) => `${o.value}${e}`, I = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(o.value.length)), w = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", S = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${l(e.name)}` : "models", s = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${l(e.name)}`;
27
32
  return {
28
- hash: l,
33
+ hash: r,
29
34
  /** Sets the prefix for the hash */
30
35
  setHashPrefix: (e) => {
31
- u.value = e;
36
+ o.value = e;
32
37
  },
33
38
  /**
34
39
  * Gets the full hash with the prefix
35
40
  * @param hashTarget The hash to target with the return
36
41
  * @returns The full hash
37
42
  */
38
- getFullHash: U,
43
+ getFullHash: v,
39
44
  /**
40
45
  * Gets the hashed url with the prefix
41
46
  * @param replacementHash The hash to replace the current hash with
42
47
  * @param url The url to get the hashed url from
43
48
  * @returns The hashed url
44
49
  */
45
- getHashedUrl: S,
50
+ getHashedUrl: m,
46
51
  /**
47
52
  * Replaces the URL state with the new url and hash
48
53
  * Replacement is used so that hash changes don't trigger the url hash watcher and cause a scroll
49
54
  */
50
- replaceUrlState: $,
55
+ replaceUrlState: p,
51
56
  /** Gets the portion of the hash used by the references */
52
- getReferenceHash: b,
53
- getWebhookId: (e) => e != null && e.name ? typeof t.value.generateWebhookSlug == "function" ? `webhook/${t.value.generateWebhookSlug(e)}` : `webhook/${e.method}/${c(e.name)}` : "webhooks",
54
- getModelId: n,
55
- getHeadingId: a,
56
- getOperationId: (e, g) => {
57
- var d;
58
- return typeof t.value.generateOperationSlug == "function" ? `${o(g)}/${t.value.generateOperationSlug({
57
+ getReferenceHash: I,
58
+ getWebhookId: (e) => e != null && e.name ? typeof t.value.generateWebhookSlug == "function" ? `webhook/${t.value.generateWebhookSlug(e)}` : `webhook/${e.method}/${l(e.name)}` : "webhooks",
59
+ getModelId: S,
60
+ getHeadingId: w,
61
+ getOperationId: (e, a) => {
62
+ var n;
63
+ return typeof t.value.generateOperationSlug == "function" ? `${s(a)}/${t.value.generateOperationSlug({
59
64
  path: e.path,
60
65
  operationId: e.operationId,
61
66
  method: e.httpVerb,
62
- summary: (d = e.information) == null ? void 0 : d.summary
63
- })}` : `${o(g)}/${e.httpVerb}${e.path}`;
67
+ summary: (n = e.information) == null ? void 0 : n.summary
68
+ })}` : `${s(a)}/${e.httpVerb}${e.path}`;
64
69
  },
65
- getPathRoutingId: h,
66
- getSectionId: w,
67
- getTagId: o,
68
- isIntersectionEnabled: m,
69
- pathRouting: r,
70
- updateHash: I
70
+ getPathRoutingId: c,
71
+ getSectionId: d,
72
+ getTagId: s,
73
+ isIntersectionEnabled: h,
74
+ updateHash: f
71
75
  };
72
76
  };
73
77
  export {
74
- x as useNavState
78
+ y as NAV_STATE_SYMBOL,
79
+ C as useNavState
75
80
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveSpec.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactiveSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAiC,MAAM,KAAK,CAAA;AAoD1E;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAA;IAChD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDA"}
1
+ {"version":3,"file":"useReactiveSpec.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactiveSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iB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;AAcD,uDAAuD;AACvD,iBAAS,aAAa,CAAC,IAAI,EAAE,IAAI,QA0ChC;AAMD,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAIpD,iBAAS,0BAA0B,CAAC,GAAG,EAAE,MAAM,QAE9C;AAED,iBAAS,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,QAE3D;AAkOD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,IAAI,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM,CAAC,CAAA;IACnD,gBAAgB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,oBAAoB,KAAK,MAAM,CAAC,CAAA;CACvG,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,UAAU,OAAO,SAiBrE,CAAA;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,YAAY;;;;;;;;;;;;;qCAtBrB,MAAM,UAAU,OAAO;EAiFrE"}
@@ -7,8 +7,8 @@ import { getLowestHeadingLevel as K } from "../helpers/getLowestHeadingLevel.js"
7
7
  import { hasModels as ee } from "../helpers/hasModels.js";
8
8
  import { getModels as P } from "../helpers/getModels.js";
9
9
  import { hasWebhooks as te } from "../helpers/hasWebhooks.js";
10
- import { scrollToId as R } from "../helpers/scrollToId.js";
11
10
  import { getHeadingsFromMarkdown as se } from "../helpers/getHeadingsFromMarkdown.js";
11
+ import { scrollToId as R } from "../helpers/scrollToId.js";
12
12
  const y = S(null), u = S(void 0), v = q({});
13
13
  function _(t) {
14
14
  var p, r, i;
@@ -41,7 +41,8 @@ function oe(t) {
41
41
  }
42
42
  const U = J(() => {
43
43
  var C, H, B, E, j, V, D, G, L, W;
44
- if (!y.value) return { entries: [], titles: {} };
44
+ if (!y.value)
45
+ return { entries: [], titles: {} };
45
46
  const { getHeadingId: t, getModelId: a, getOperationId: l, getTagId: c, getWebhookId: p } = y.value, r = {}, i = [];
46
47
  let s = null;
47
48
  k.value.forEach((e) => {
package/dist/index.d.ts CHANGED
@@ -8,9 +8,11 @@ export { type ApiReferenceInstance, createApiReference } from './standalone/lib/
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';
11
- export * from './stores';
12
- export * from './helpers';
13
- export * from './types';
14
- export * from './hooks';
11
+ export { parse } from './helpers/parse.js';
12
+ export { createEmptySpecification } from './helpers/createEmptySpecification.js';
13
+ export { useNavState } from './hooks/useNavState.js';
14
+ export { useSidebar } from './hooks/useSidebar.js';
15
+ export { useHttpClientStore } from './stores/useHttpClientStore.js';
16
+ export type { ApiReferenceConfiguration, ReferenceProps, ReferenceConfiguration, } from './types';
15
17
  export { createScalarReferences } from './esm.js';
16
18
  //# 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,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,o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