@scalar/api-reference 1.31.8 → 1.31.9

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 (183) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/browser/standalone.js +18613 -18470
  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 +10 -30
  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 +240 -222
  9. package/dist/components/Content/Content.vue.d.ts +2 -0
  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 +84 -74
  13. package/dist/components/Content/Introduction/Introduction.vue.d.ts +1 -3
  14. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  15. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  16. package/dist/components/Content/Introduction/Introduction.vue2.js +93 -83
  17. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Lazy/Loading.vue.js +84 -86
  19. package/dist/components/Content/Models/Models.vue.js +1 -1
  20. package/dist/components/Content/Models/Models.vue2.js +4 -4
  21. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  23. package/dist/components/Content/Schema/Schema.vue2.js +53 -53
  24. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +1 -1
  26. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  27. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  28. package/dist/components/Content/Schema/SchemaProperty.vue2.js +117 -112
  29. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  30. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +2 -2
  31. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +161 -191
  32. package/dist/components/Content/Schema/helpers/schema-name.d.ts +13 -0
  33. package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
  34. package/dist/components/Content/Schema/helpers/schema-name.js +59 -13
  35. package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
  36. package/dist/components/Content/Tag/OperationsList.vue.js +1 -1
  37. package/dist/components/Content/Tag/OperationsList.vue2.js +22 -25
  38. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts +2 -3
  39. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
  40. package/dist/components/Content/Tag/OperationsListItem.vue.js +2 -2
  41. package/dist/components/Content/Tag/OperationsListItem.vue2.js +46 -47
  42. package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
  43. package/dist/components/Content/Tag/Tag.vue.js +45 -47
  44. package/dist/components/Content/Tag/TagList.vue.d.ts +2 -0
  45. package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
  46. package/dist/components/Content/Tag/TagList.vue.js +40 -41
  47. package/dist/components/Content/Tag/TagSection.vue.d.ts.map +1 -1
  48. package/dist/components/Content/Tag/TagSection.vue.js +2 -2
  49. package/dist/components/Content/Tag/TagSection.vue2.js +21 -21
  50. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +16 -1
  51. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  52. package/dist/components/HttpMethod/HttpMethod.vue.js +12 -11
  53. package/dist/components/MobileHeader.vue.d.ts +1 -8
  54. package/dist/components/MobileHeader.vue.d.ts.map +1 -1
  55. package/dist/components/MobileHeader.vue.js +1 -1
  56. package/dist/components/MobileHeader.vue2.js +19 -19
  57. package/dist/components/Section/Section.vue.js +2 -2
  58. package/dist/components/Section/Section.vue2.js +1 -1
  59. package/dist/components/ShowMoreButton.vue.js +2 -2
  60. package/dist/components/ShowMoreButton.vue2.js +1 -1
  61. package/dist/components/Sidebar/Sidebar.vue.d.ts +2 -4
  62. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  63. package/dist/components/Sidebar/Sidebar.vue.js +1 -1
  64. package/dist/components/Sidebar/Sidebar.vue2.js +113 -159
  65. package/dist/components/Sidebar/SidebarElement.vue.d.ts +2 -11
  66. package/dist/components/Sidebar/SidebarElement.vue.d.ts.map +1 -1
  67. package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
  68. package/dist/components/Sidebar/SidebarElement.vue2.js +85 -81
  69. package/dist/components/Sidebar/SidebarHttpBadge.vue.d.ts +16 -1
  70. package/dist/components/Sidebar/SidebarHttpBadge.vue.d.ts.map +1 -1
  71. package/dist/components/Sidebar/SidebarHttpBadge.vue.js +2 -2
  72. package/dist/components/Sidebar/SidebarHttpBadge.vue2.js +11 -5
  73. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
  74. package/dist/features/ApiClientModal/ApiClientModal.vue.js +54 -42
  75. package/dist/features/ApiClientModal/useApiClient.d.ts +74 -72
  76. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  77. package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts +0 -2
  78. package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts.map +1 -1
  79. package/dist/features/DocumentSource/hooks/useDocumentSource.js +40 -67
  80. package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
  81. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +5 -5
  82. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  83. package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
  84. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +200 -179
  85. package/dist/features/Operation/Operation.vue.d.ts +0 -1
  86. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  87. package/dist/features/Operation/Operation.vue.js +31 -34
  88. package/dist/features/Operation/components/OperationParameters.vue.d.ts +3 -2
  89. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  90. package/dist/features/Operation/components/OperationParameters.vue.js +62 -64
  91. package/dist/features/Operation/components/OperationResponses.vue.d.ts +1 -2
  92. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  93. package/dist/features/Operation/components/OperationResponses.vue.js +2 -2
  94. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  95. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  96. package/dist/features/Operation/components/callbacks/Callback.vue2.js +31 -38
  97. package/dist/features/Operation/hooks/useResponses.d.ts +3 -3
  98. package/dist/features/Operation/hooks/useResponses.d.ts.map +1 -1
  99. package/dist/features/Operation/hooks/useResponses.js +12 -13
  100. package/dist/features/Operation/index.d.ts +0 -1
  101. package/dist/features/Operation/index.d.ts.map +1 -1
  102. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +4 -6
  103. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  104. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  105. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +85 -72
  106. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -4
  107. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  108. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  109. package/dist/features/Operation/layouts/ModernLayout.vue2.js +114 -98
  110. package/dist/features/Search/SearchModal.vue.js +2 -2
  111. package/dist/features/Search/SearchModal.vue2.js +1 -1
  112. package/dist/features/Search/useSearchIndex.d.ts.map +1 -1
  113. package/dist/features/Search/useSearchIndex.js +61 -64
  114. package/dist/features/sidebar/helpers/create-sidebar.d.ts +4 -2
  115. package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +1 -1
  116. package/dist/features/sidebar/helpers/create-sidebar.js +33 -0
  117. package/dist/features/sidebar/hooks/useSidebar.d.ts +2 -3
  118. package/dist/features/sidebar/hooks/useSidebar.d.ts.map +1 -1
  119. package/dist/features/sidebar/hooks/useSidebar.js +18 -0
  120. package/dist/features/sidebar/index.d.ts +2 -1
  121. package/dist/features/sidebar/index.d.ts.map +1 -1
  122. package/dist/features/traverse-schema/helpers/get-tag.d.ts +4 -2
  123. package/dist/features/traverse-schema/helpers/get-tag.d.ts.map +1 -1
  124. package/dist/features/traverse-schema/helpers/get-tag.js +7 -0
  125. package/dist/features/traverse-schema/helpers/traverse-description.js +33 -0
  126. package/dist/features/traverse-schema/helpers/traverse-document.d.ts.map +1 -1
  127. package/dist/features/traverse-schema/helpers/traverse-document.js +34 -0
  128. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +5 -3
  129. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -1
  130. package/dist/features/traverse-schema/helpers/traverse-paths.js +32 -0
  131. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts +2 -2
  132. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -1
  133. package/dist/features/traverse-schema/helpers/traverse-schemas.js +23 -0
  134. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts +2 -2
  135. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -1
  136. package/dist/features/traverse-schema/helpers/traverse-tags.js +43 -0
  137. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts +2 -2
  138. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -1
  139. package/dist/features/traverse-schema/helpers/traverse-webhooks.js +26 -0
  140. package/dist/features/traverse-schema/index.d.ts +3 -3
  141. package/dist/features/traverse-schema/index.d.ts.map +1 -1
  142. package/dist/features/traverse-schema/types.d.ts +8 -5
  143. package/dist/features/traverse-schema/types.d.ts.map +1 -1
  144. package/dist/helpers/parse.d.ts +2 -1
  145. package/dist/helpers/parse.d.ts.map +1 -1
  146. package/dist/helpers/parse.js +72 -88
  147. package/dist/hooks/useMultipleDocuments.d.ts +6 -6
  148. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
  149. package/dist/hooks/useNavState.d.ts +1 -1
  150. package/dist/hooks/useNavState.d.ts.map +1 -1
  151. package/dist/hooks/useNavState.js +14 -9
  152. package/dist/hooks/useOperation.d.ts +7 -7
  153. package/dist/hooks/useOperation.d.ts.map +1 -1
  154. package/dist/hooks/useOperation.js +13 -12
  155. package/dist/index.d.ts +0 -1
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +23 -25
  158. package/dist/legacy/fixtures/index.d.ts +1 -1
  159. package/dist/libs/openapi.d.ts +3 -4
  160. package/dist/libs/openapi.d.ts.map +1 -1
  161. package/dist/libs/openapi.js +8 -9
  162. package/dist/style.css +1 -1
  163. package/dist/v2/ApiReferenceWorkspace.vue.d.ts +4 -18
  164. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  165. package/dist/v2/ApiReferenceWorkspace.vue.js +68 -45
  166. package/package.json +16 -16
  167. package/dist/components/Content/Webhooks/index.d.ts +0 -2
  168. package/dist/components/Content/Webhooks/index.d.ts.map +0 -1
  169. package/dist/features/Operation/Webhooks.vue.d.ts +0 -7
  170. package/dist/features/Operation/Webhooks.vue.d.ts.map +0 -1
  171. package/dist/features/Operation/Webhooks.vue.js +0 -7
  172. package/dist/features/Operation/Webhooks.vue2.js +0 -121
  173. package/dist/features/Operation/components/Webhook.vue.d.ts +0 -7
  174. package/dist/features/Operation/components/Webhook.vue.d.ts.map +0 -1
  175. package/dist/features/Operation/components/Webhook.vue.js +0 -7
  176. package/dist/features/Operation/components/Webhook.vue2.js +0 -29
  177. package/dist/features/traverse-schema/helpers/operation-id-params.d.ts +0 -8
  178. package/dist/features/traverse-schema/helpers/operation-id-params.d.ts.map +0 -1
  179. package/dist/features/traverse-schema/helpers/operation-id-params.js +0 -8
  180. package/dist/hooks/useSidebar.d.ts +0 -53
  181. package/dist/hooks/useSidebar.d.ts.map +0 -1
  182. package/dist/hooks/useSidebar.js +0 -248
  183. package/dist/legacy/fixtures/httpRequestMethods.js +0 -14
@@ -1,50 +1,49 @@
1
- import N from "fuse.js";
2
- import { ref as h, watch as E, computed as O } from "vue";
3
- import { useNavState as P } from "../../hooks/useNavState.js";
4
- import { useOperation as V } from "../../hooks/useOperation.js";
5
- import { useSidebar as A } from "../../hooks/useSidebar.js";
6
- import { getHeadingsFromMarkdown as B } from "../../libs/markdown.js";
7
- import { extractRequestBody as z, getModels as G } from "../../libs/openapi.js";
8
- import { operationIdParams as J } from "../traverse-schema/helpers/operation-id-params.js";
9
- function S({
10
- specification: R
1
+ import O from "fuse.js";
2
+ import { ref as u, watch as E, computed as R } from "vue";
3
+ import { useNavState as W } from "../../hooks/useNavState.js";
4
+ import { useOperation as j } from "../../hooks/useOperation.js";
5
+ import { getHeadingsFromMarkdown as A } from "../../libs/markdown.js";
6
+ import { extractRequestBody as B, getModels as P } from "../../libs/openapi.js";
7
+ import { useConfig as z } from "../../hooks/useConfig.js";
8
+ function Z({
9
+ specification: T
11
10
  }) {
12
- const { hideModels: T } = A(), { getHeadingId: j, getWebhookId: L, getModelId: W, getOperationId: q, getTagId: C } = P(), a = h([]), l = h([]), s = h(), r = h(""), c = new N(a.value, {
11
+ const { getHeadingId: V, getModelId: k, getTagId: C } = W(), L = z(), o = u([]), l = u([]), s = u(), r = u(""), d = new O(o.value, {
13
12
  keys: ["title", "description", "body"]
14
- }), m = () => {
15
- s.value = 0, l.value = c.search(r.value);
13
+ }), c = () => {
14
+ s.value = 0, l.value = d.search(r.value);
16
15
  };
17
16
  E(r, (e) => {
18
- e.length ? m() : l.value = [];
17
+ e.length ? c() : l.value = [];
19
18
  });
20
- function F() {
19
+ function q() {
21
20
  r.value = "", s.value = void 0, l.value = [];
22
21
  }
23
- const v = O(() => r.value.length === 0 ? a.value.slice(0, 25).map((i) => ({
22
+ const f = R(() => r.value.length === 0 ? o.value.slice(0, 25).map((i) => ({
24
23
  item: i
25
- })) : l.value.slice(0, 25)), H = O(
26
- () => typeof s.value == "number" ? v.value[s.value] : void 0
24
+ })) : l.value.slice(0, 25)), F = R(
25
+ () => typeof s.value == "number" ? f.value[s.value] : void 0
27
26
  );
28
27
  return E(
29
- R,
28
+ T,
30
29
  (e) => {
31
- var I, p, k, M;
32
- if (a.value = [], !((I = e == null ? void 0 : e.tags) != null && I.length) && !((p = e == null ? void 0 : e.webhooks) != null && p.length)) {
33
- c.setCollection([]);
30
+ var b, I, p, M;
31
+ if (o.value = [], !((b = e == null ? void 0 : e.tags) != null && b.length) && !((I = e == null ? void 0 : e.webhooks) != null && I.length)) {
32
+ d.setCollection([]);
34
33
  return;
35
34
  }
36
- const i = [], b = B(((k = e == null ? void 0 : e.info) == null ? void 0 : k.description) ?? "");
37
- b.length && (b.forEach((t) => {
35
+ const i = [], m = A(((p = e == null ? void 0 : e.info) == null ? void 0 : p.description) ?? "");
36
+ m.length && (m.forEach((t) => {
38
37
  i.push({
39
38
  type: "heading",
40
39
  title: `Info > ${t.value}`,
41
40
  description: "",
42
- href: `#${j(t)}`,
41
+ href: `#${V(t)}`,
43
42
  tag: t.slug,
44
43
  body: ""
45
44
  });
46
- }), a.value = a.value.concat(i)), (M = e == null ? void 0 : e.tags) == null || M.forEach((t) => {
47
- const D = {
45
+ }), o.value = o.value.concat(i)), (M = e == null ? void 0 : e.tags) == null || M.forEach((t) => {
46
+ const H = {
48
47
  title: t["x-displayName"] ?? t.name,
49
48
  href: `#${C(t)}`,
50
49
  description: t.description,
@@ -52,61 +51,59 @@ function S({
52
51
  tag: t.name,
53
52
  body: ""
54
53
  };
55
- a.value.push(D), t.operations && t.operations.forEach((o) => {
56
- const { parameterMap: d } = V(o), $ = z(o) || d.value;
57
- let f = null;
58
- typeof $ != "boolean" && (f = $);
59
- const x = {
54
+ o.value.push(H), t.operations && t.operations.forEach((a) => {
55
+ var x;
56
+ const { parameterMap: N } = j(a), D = B(a) || N.value;
57
+ let n = null;
58
+ typeof D != "boolean" && (n = D);
59
+ const $ = {
60
60
  type: "req",
61
- title: o.name ?? o.path,
62
- href: `#${q(J(o), t)}`,
63
- operationId: o.operationId,
64
- description: o.description ?? "",
65
- httpVerb: o.httpVerb,
66
- path: o.path,
61
+ title: a.name ?? a.path,
62
+ href: `#${a.id}`,
63
+ operationId: (x = a.information) == null ? void 0 : x.operationId,
64
+ description: a.description ?? "",
65
+ httpVerb: a.httpVerb,
66
+ path: a.path,
67
67
  tag: t.name,
68
- operation: o
68
+ operation: a
69
69
  };
70
- f && (x.body = f), a.value.push(x);
70
+ n && ($.body = n), o.value.push($);
71
71
  });
72
72
  });
73
- const u = e == null ? void 0 : e.webhooks, y = [];
74
- u && Object.keys(u).forEach((t) => {
75
- Object.keys(u[t]).forEach((o) => {
76
- var d;
77
- y.push({
78
- type: "webhook",
79
- title: "Webhook",
80
- href: `#${L({ name: t, method: o })}`,
81
- description: `${(d = u[t][o]) == null ? void 0 : d.name}`,
82
- httpVerb: o,
83
- tag: t,
84
- body: ""
85
- });
86
- }), a.value = a.value.concat(y);
73
+ const v = e == null ? void 0 : e.webhooks, y = [];
74
+ v && v.forEach((t) => {
75
+ y.push({
76
+ type: "webhook",
77
+ title: "Webhook",
78
+ href: `#${t.id}`,
79
+ description: `${t.name}`,
80
+ httpVerb: t.httpVerb,
81
+ tag: t.name,
82
+ body: ""
83
+ }), o.value = o.value.concat(y);
87
84
  });
88
- const n = T.value ? {} : G(e), g = [];
89
- n && (Object.keys(n).forEach((t) => {
85
+ const h = L.value.hideModels ? {} : P(e), g = [];
86
+ h && (Object.keys(h).forEach((t) => {
90
87
  g.push({
91
88
  type: "model",
92
89
  title: "Model",
93
- href: `#${W({ name: t })}`,
94
- description: n[t].title ?? t,
90
+ href: `#${k({ name: t })}`,
91
+ description: h[t].title ?? t,
95
92
  tag: t,
96
93
  body: ""
97
94
  });
98
- }), a.value = a.value.concat(g)), c.setCollection(a.value);
95
+ }), o.value = o.value.concat(g)), d.setCollection(o.value);
99
96
  },
100
97
  { immediate: !0 }
101
98
  ), {
102
- resetSearch: F,
103
- fuseSearch: m,
99
+ resetSearch: q,
100
+ fuseSearch: c,
104
101
  selectedSearchIndex: s,
105
- selectedSearchResult: H,
106
- searchResultsWithPlaceholderResults: v,
102
+ selectedSearchResult: F,
103
+ searchResultsWithPlaceholderResults: f,
107
104
  searchText: r
108
105
  };
109
106
  }
110
107
  export {
111
- S as useSearchIndex
108
+ Z as useSearchIndex
112
109
  };
@@ -3,6 +3,8 @@ import { type Ref } from 'vue';
3
3
  import type { TraverseSpecOptions } from '../../../features/traverse-schema';
4
4
  /** Track which sidebar items are opened */
5
5
  type CollapsedSidebarItems = Record<string, boolean>;
6
+ /** Sidebar initialization options */
7
+ export type SidebarOptions = TraverseSpecOptions;
6
8
  /**
7
9
  * Creating sidebar with only one traversal of the spec
8
10
  *
@@ -11,11 +13,11 @@ type CollapsedSidebarItems = Record<string, boolean>;
11
13
  * - update docs
12
14
  * - tagged models
13
15
  */
14
- export declare const createSidebar: (dereferencedDocument: Ref<OpenAPIV3_1.Document>, options: TraverseSpecOptions) => {
16
+ export declare const createSidebar: (dereferencedDocument: Ref<OpenAPIV3_1.Document>, options: SidebarOptions) => {
15
17
  collapsedSidebarItems: CollapsedSidebarItems;
16
18
  isSidebarOpen: Ref<boolean, boolean>;
17
19
  items: import("vue").ComputedRef<{
18
- entries: import("../../traverse-schema/types").TraversedEntry[];
20
+ entries: import("../../../features/traverse-schema").TraversedEntry[];
19
21
  titles: Map<string, string>;
20
22
  }>;
21
23
  scrollToOperation: (operationId: string, focus?: boolean) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"create-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/features/sidebar/helpers/create-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAA2B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAGvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAKrE,2CAA2C;AAC3C,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,yBAA0B,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,mBAAmB;;;;;;;qCAajE,MAAM,UAAU,OAAO;mCARzB,MAAM,SAAS,OAAO;sCADnB,MAAM;CAgDhD,CAAA"}
1
+ {"version":3,"file":"create-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/features/sidebar/helpers/create-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAA2B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAGvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAKrE,2CAA2C;AAC3C,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEpD,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,yBAA0B,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,cAAc;;;;;;;qCAa5D,MAAM,UAAU,OAAO;mCARzB,MAAM,SAAS,OAAO;sCADnB,MAAM;CAgDhD,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { reactive as b, ref as p, computed as S } from "vue";
2
+ import { lazyBus as g } from "../../../components/Content/Lazy/lazyBus.js";
3
+ import { scrollToId as l } from "@scalar/helpers/dom/scroll-to-id";
4
+ import { measure as v } from "@scalar/helpers/testing/measure";
5
+ import { traverseDocument as O } from "../../traverse-schema/helpers/traverse-document.js";
6
+ const x = (i, o) => {
7
+ const r = b({}), m = p(!1), a = (e) => r[e] = !r[e], c = (e, t) => r[e] = t, n = (e, t) => {
8
+ const s = o.getSectionId(e);
9
+ if (s && s !== e)
10
+ if (r[s])
11
+ l(e, t);
12
+ else {
13
+ const f = g.on((d) => {
14
+ d.id === e && (l(e, t), f());
15
+ });
16
+ c(s, !0);
17
+ }
18
+ }, u = S(() => {
19
+ const e = v("traverseDocument", () => O(i.value, o));
20
+ return o.config.value.defaultOpenAllTags && e.entries.forEach((t) => c(t.id, !0)), e;
21
+ });
22
+ return {
23
+ collapsedSidebarItems: r,
24
+ isSidebarOpen: m,
25
+ items: u,
26
+ scrollToOperation: n,
27
+ setCollapsedSidebarItem: c,
28
+ toggleCollapsedSidebarItem: a
29
+ };
30
+ };
31
+ export {
32
+ x as createSidebar
33
+ };
@@ -1,7 +1,6 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import { type InjectionKey, type Ref } from 'vue';
3
- import { createSidebar } from '../../../features/sidebar/helpers/create-sidebar';
4
- import type { TraverseSpecOptions } from '../../../features/traverse-schema';
3
+ import { createSidebar, type SidebarOptions } from '../../../features/sidebar/helpers/create-sidebar.js';
5
4
  type Sidebar = ReturnType<typeof createSidebar>;
6
5
  /**
7
6
  * Injection key for the sidebar instance.
@@ -10,7 +9,7 @@ type Sidebar = ReturnType<typeof createSidebar>;
10
9
  export declare const SIDEBAR_SYMBOL: InjectionKey<Sidebar>;
11
10
  type UseSidebar = {
12
11
  (): Sidebar;
13
- (content: Ref<OpenAPIV3_1.Document>, options: TraverseSpecOptions): Sidebar;
12
+ (content: Ref<OpenAPIV3_1.Document>, options: SidebarOptions): Sidebar;
14
13
  };
15
14
  /**
16
15
  * Composable for managing the sidebar state.
@@ -1 +1 @@
1
- {"version":3,"file":"useSidebar.d.ts","sourceRoot":"","sources":["../../../../src/features/sidebar/hooks/useSidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,EAAmB,MAAM,KAAK,CAAA;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAA;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAErE,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,OAAO,CAAY,CAAA;AAE7D,KAAK,UAAU,GAAG;IAChB,IAAI,OAAO,CAAA;IACX,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAA;CAC5E,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,UAuBxB,CAAA"}
1
+ {"version":3,"file":"useSidebar.d.ts","sourceRoot":"","sources":["../../../../src/features/sidebar/hooks/useSidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,EAAmB,MAAM,KAAK,CAAA;AAElE,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAG9F,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,OAAO,CAAY,CAAA;AAE7D,KAAK,UAAU,GAAG;IAChB,IAAI,OAAO,CAAA;IACX,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAA;CACvE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,UAuBxB,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { provide as t, inject as n } from "vue";
2
+ import { createSidebar as s } from "../helpers/create-sidebar.js";
3
+ const i = Symbol(), l = (e, r) => {
4
+ if (e && r) {
5
+ const a = s(e, r);
6
+ return t(i, a), a;
7
+ }
8
+ const o = n(i);
9
+ if (!o)
10
+ throw new Error(
11
+ "useSidebar() was called without a collection and no sidebar instance was found. Make sure to call useSidebar(collection) in a parent component first."
12
+ );
13
+ return o;
14
+ };
15
+ export {
16
+ i as SIDEBAR_SYMBOL,
17
+ l as useSidebar
18
+ };
@@ -1,2 +1,3 @@
1
- export { useSidebar, SIDEBAR_SYMBOL } from './hooks/useSidebar';
1
+ export { useSidebar, SIDEBAR_SYMBOL } from './hooks/useSidebar.js';
2
+ export { createSidebar, type SidebarOptions } from './helpers/create-sidebar.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAA"}
@@ -1,4 +1,6 @@
1
- import type { OpenAPIV3_1 } from '@scalar/openapi-types';
1
+ import type { TagsMap } from '../../../features/traverse-schema/types';
2
+ type TagMapValue = NonNullable<TagsMap extends Map<string, infer V> ? V : never>;
2
3
  /** Grabs the tag from the dict or creates one if it doesn't exist */
3
- export declare const getTag: (tagsDict: Map<string, OpenAPIV3_1.TagObject>, name: string) => import("@scalar/openapi-types").OpenAPIV3.TagObject;
4
+ export declare const getTag: (tagsMap: TagsMap, name: string) => TagMapValue;
5
+ export {};
4
6
  //# sourceMappingURL=get-tag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-tag.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/get-tag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,qEAAqE;AACrE,eAAO,MAAM,MAAM,aAAc,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,QAAQ,MAAM,wDAWhF,CAAA"}
1
+ {"version":3,"file":"get-tag.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/get-tag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAA;AAE/D,KAAK,WAAW,GAAG,WAAW,CAAC,OAAO,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;AAEhF,qEAAqE;AACrE,eAAO,MAAM,MAAM,YAAa,OAAO,QAAQ,MAAM,KAAG,WAWvD,CAAA"}
@@ -0,0 +1,7 @@
1
+ const r = (g, e) => {
2
+ let t = g.get(e);
3
+ return t || (t = { entries: [], tag: { name: e } }, g.set(e, t)), t;
4
+ };
5
+ export {
6
+ r as getTag
7
+ };
@@ -0,0 +1,33 @@
1
+ import { getHeadingsFromMarkdown as c, getLowestHeadingLevel as d } from "../../../libs/markdown.js";
2
+ const f = "introduction", v = (n, l, u) => {
3
+ var i;
4
+ if (!(n != null && n.trim()))
5
+ return [];
6
+ const h = c(n), o = d(h), r = [];
7
+ let s = null;
8
+ if (n && !n.trim().startsWith("#")) {
9
+ const e = {
10
+ depth: 1,
11
+ value: "Introduction",
12
+ slug: f
13
+ }, t = u(e), a = e.value;
14
+ r.push({
15
+ id: t,
16
+ title: a
17
+ }), l.set(t, a);
18
+ }
19
+ for (const e of h) {
20
+ if (e.depth !== o && e.depth !== o + 1)
21
+ continue;
22
+ const t = {
23
+ id: u(e),
24
+ title: e.value
25
+ };
26
+ l.set(t.id, t.title), e.depth === o ? (t.children = [], r.push(t), s = t) : s && ((i = s.children) == null || i.push(t));
27
+ }
28
+ return r;
29
+ };
30
+ export {
31
+ f as DEFAULT_INTRODUCTION_SLUG,
32
+ v as traverseDescription
33
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-document.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAOxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAE3F;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,aACjB,WAAW,CAAC,QAAQ,gFACgD,mBAAmB;;;CA6ClG,CAAA"}
1
+ {"version":3,"file":"traverse-document.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAOxD,OAAO,KAAK,EAAW,mBAAmB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAEpG;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,aACjB,WAAW,CAAC,QAAQ,gFACgD,mBAAmB;;;CA8ClG,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { traverseDescription as S } from "./traverse-description.js";
2
+ import { traversePaths as u } from "./traverse-paths.js";
3
+ import { traverseSchemas as M } from "./traverse-schemas.js";
4
+ import { traverseTags as b } from "./traverse-tags.js";
5
+ import { traverseWebhooks as k } from "./traverse-webhooks.js";
6
+ const x = (e, { config: a, getHeadingId: v, getOperationId: c, getWebhookId: i, getModelId: n, getTagId: f }) => {
7
+ var h, l, m;
8
+ const r = /* @__PURE__ */ new Map(), t = new Map(
9
+ ((h = e.tags) == null ? void 0 : h.map((s) => [s.name ?? "Untitled Tag", { tag: s, entries: [] }])) ?? []
10
+ );
11
+ u(e, t, r, c);
12
+ const o = S((l = e.info) == null ? void 0 : l.description, r, v), p = k(e, t, r, i), g = b(e, t, r, {
13
+ getTagId: f,
14
+ tagsSorter: a.value.tagsSorter,
15
+ operationsSorter: a.value.operationsSorter
16
+ });
17
+ if (o.push(...g), p.length && o.push({
18
+ id: i(),
19
+ isWebhooks: !0,
20
+ title: "Webhooks",
21
+ children: p
22
+ }), !a.value.hideModels && ((m = e.components) != null && m.schemas)) {
23
+ const s = M(e, t, r, n);
24
+ s.length && o.push({
25
+ id: n(),
26
+ title: "Models",
27
+ children: s
28
+ });
29
+ }
30
+ return { entries: o, titles: r };
31
+ };
32
+ export {
33
+ x as traverseDocument
34
+ };
@@ -1,11 +1,13 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
- import type { TraversedOperation } from '../../../features/traverse-schema/types';
2
+ import type { TraversedEntry } from '../../../features/traverse-schema/types';
3
3
  import type { UseNavState } from '../../../hooks/useNavState.js';
4
4
  /**
5
5
  * Traverse the paths of the spec and build a map of tags and operations
6
6
  *
7
7
  * Default tag is to match what we have now we can improve later
8
- * TODO: filter out internal and scalar-ignore tags
9
8
  */
10
- export declare const traversePaths: (content: OpenAPIV3_1.Document, tagsDict: Map<string, OpenAPIV3_1.TagObject>, titlesMap: Map<string, string>, getOperationId: UseNavState["getOperationId"]) => Map<string, TraversedOperation[]>;
9
+ export declare const traversePaths: (content: OpenAPIV3_1.Document, tagsMap: Map<string, {
10
+ tag: OpenAPIV3_1.TagObject;
11
+ entries: TraversedEntry[];
12
+ }>, titlesMap: Map<string, string>, getOperationId: UseNavState["getOperationId"]) => void;
11
13
  //# sourceMappingURL=traverse-paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAuBtD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,YACf,WAAW,CAAC,QAAQ,YAEnB,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,aAEjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,kBACd,WAAW,CAAC,gBAAgB,CAAC,KAC5C,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAiClC,CAAA"}
1
+ {"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,kCAAkC,CAAA;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAwBtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,YACf,WAAW,CAAC,QAAQ,WAEpB,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,aAEpE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,kBACd,WAAW,CAAC,gBAAgB,CAAC,SA+B9C,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { getTag as m } from "./get-tag.js";
2
+ import { httpMethods as b } from "@scalar/helpers/http/http-methods";
3
+ const x = (r, s, t = "Unknown", n, c, u) => {
4
+ const h = u({ ...r, method: s, path: t }, n);
5
+ return c.set(h, r.summary ?? t), {
6
+ id: h,
7
+ title: r.summary ?? t,
8
+ path: t,
9
+ method: s,
10
+ operation: r
11
+ };
12
+ }, a = (r, s, t, n) => {
13
+ Object.entries(r.paths ?? {}).forEach(([c, u]) => {
14
+ Object.entries(u ?? {}).forEach(([l, e]) => {
15
+ var E, g;
16
+ if (!(e["x-internal"] || e["x-scalar-ignore"] || !b.has(l)))
17
+ if ((E = e.tags) != null && E.length)
18
+ e.tags.forEach((f) => {
19
+ var i;
20
+ const { tag: y } = m(s, f);
21
+ (i = s.get(f)) == null || i.entries.push(x(e, l, c, y, t, n));
22
+ });
23
+ else {
24
+ const { tag: f } = m(s, "default");
25
+ (g = s.get("default")) == null || g.entries.push(x(e, l, c, f, t, n));
26
+ }
27
+ });
28
+ });
29
+ };
30
+ export {
31
+ a as traversePaths
32
+ };
@@ -1,6 +1,6 @@
1
- import type { TraversedSchema } from '../../../features/traverse-schema/types';
1
+ import type { TagsMap, TraversedSchema } from '../../../features/traverse-schema/types';
2
2
  import type { UseNavState } from '../../../hooks/useNavState.js';
3
3
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
4
4
  /** Traverse components.schemas to create entries for models */
5
- export declare const traverseSchemas: (content: OpenAPIV3_1.Document, titlesMap: Map<string, string>, getModelId: UseNavState["getModelId"]) => TraversedSchema[];
5
+ export declare const traverseSchemas: (content: OpenAPIV3_1.Document, tagsMap: TagsMap, titlesMap: Map<string, string>, getModelId: UseNavState["getModelId"]) => TraversedSchema[];
6
6
  //# sourceMappingURL=traverse-schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAoBxD,+DAA+D;AAC/D,eAAO,MAAM,eAAe,YACjB,WAAW,CAAC,QAAQ,aAElB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,cAClB,WAAW,CAAC,YAAY,CAAC,KACpC,eAAe,EAcjB,CAAA"}
1
+ {"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAqBxD,+DAA+D;AAC/D,eAAO,MAAM,eAAe,YACjB,WAAW,CAAC,QAAQ,WACpB,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,cAClB,WAAW,CAAC,YAAY,CAAC,KACpC,eAAe,EAuBjB,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { getTag as x } from "./get-tag.js";
2
+ const u = (c, s = "Unkown", o, r, t) => {
3
+ const e = r({ name: s }, t);
4
+ return o.set(e, s), {
5
+ id: e,
6
+ title: s,
7
+ name: s,
8
+ schema: c
9
+ };
10
+ }, m = (c, s, o, r) => {
11
+ var i, a;
12
+ const t = ((i = c.components) == null ? void 0 : i.schemas) ?? {}, e = [];
13
+ for (const n in t)
14
+ t[n]["x-internal"] || t[n]["x-scalar-ignore"] || !Object.hasOwn(t, n) || ((a = t[n]["x-tags"]) != null && a.length ? t[n]["x-tags"].forEach((h) => {
15
+ var g;
16
+ const { tag: f } = x(s, h);
17
+ (g = s.get(h)) == null || g.entries.push(u(t[n], n, o, r, f));
18
+ }) : e.push(u(t[n], n, o, r)));
19
+ return e;
20
+ };
21
+ export {
22
+ m as traverseSchemas
23
+ };
@@ -1,9 +1,9 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
3
- import type { TraversedEntry } from '../../../features/traverse-schema/types';
3
+ import type { TagsMap, TraversedEntry } from '../../../features/traverse-schema/types';
4
4
  import type { UseNavState } from '../../../hooks/useNavState.js';
5
5
  type Options = Pick<UseNavState, 'getTagId'> & Pick<ApiReferenceConfiguration, 'tagsSorter' | 'operationsSorter'>;
6
6
  /** Traverses our tags map creates entries, also handles sorting and tagGroups */
7
- export declare const traverseTags: (content: OpenAPIV3_1.Document, tagsMap: Map<string, TraversedEntry[]>, tagsDict: Map<string, OpenAPIV3_1.TagObject>, titlesMap: Map<string, string>, { getTagId, tagsSorter, operationsSorter }: Options) => TraversedEntry[];
7
+ export declare const traverseTags: (content: OpenAPIV3_1.Document, tagsMap: TagsMap, titlesMap: Map<string, string>, { getTagId, tagsSorter, operationsSorter }: Options) => TraversedEntry[];
8
8
  export {};
9
9
  //# sourceMappingURL=traverse-tags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,kCAAkC,CAAA;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGtD,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,GAAG,kBAAkB,CAAC,CAAA;AAuGjH,iFAAiF;AACjF,eAAO,MAAM,YAAY,YACd,WAAW,CAAC,QAAQ,WAEpB,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,YAE5B,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,aAEjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,8CACc,OAAO,KAClD,cAAc,EAyBhB,CAAA"}
1
+ {"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAgB,MAAM,kCAAkC,CAAA;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGtD,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,GAAG,kBAAkB,CAAC,CAAA;AAkGjH,iFAAiF;AACjF,eAAO,MAAM,YAAY,YACd,WAAW,CAAC,QAAQ,WACpB,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,8CACc,OAAO,KAClD,cAAc,EAyBhB,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { getTag as d } from "./get-tag.js";
2
+ const p = (n, o, m, c, h = !1) => {
3
+ const r = m(n), f = n["x-displayName"] || n.name || "Untitled Tag";
4
+ return o.set(r, f), {
5
+ id: r,
6
+ title: f,
7
+ tag: n,
8
+ children: c,
9
+ isGroup: h
10
+ };
11
+ }, u = (n, o, m, { getTagId: c, tagsSorter: h, operationsSorter: r }) => {
12
+ const f = n.includes("default"), l = f ? n.filter((s) => s !== "default") : n;
13
+ return h === "alpha" ? l.sort((s, i) => {
14
+ const a = d(o, s).tag["x-displayName"] || s || "Untitle Tag", t = d(o, i).tag["x-displayName"] || i || "Untitled Tag";
15
+ return a.localeCompare(t);
16
+ }) : typeof h == "function" && l.sort((s, i) => h(d(o, s).tag, d(o, i).tag)), f && l.push("default"), l.flatMap((s) => {
17
+ const { tag: i, entries: a } = d(o, s);
18
+ return i["x-internal"] || i["x-scalar-ignore"] ? [] : (r === "alpha" ? a.sort((t, e) => "method" in t && "method" in e ? t.title.localeCompare(e.title) : 0) : r === "method" ? a.sort((t, e) => "method" in t && "method" in e ? t.method.localeCompare(e.method) : 0) : typeof r == "function" && a.sort((t, e) => {
19
+ if (!("method" in t) || !("method" in e))
20
+ return 0;
21
+ const x = "path" in t ? t.path : t.name, y = "path" in e ? e.path : e.name, g = "operation" in t ? t.operation : t.webhook, T = "operation" in e ? e.operation : e.webhook;
22
+ return r(
23
+ { method: t.method, path: x, operation: g },
24
+ { method: e.method, path: y, operation: T }
25
+ );
26
+ }), a.length ? p(i, m, c, a) : []);
27
+ });
28
+ }, k = (n, o, m, { getTagId: c, tagsSorter: h, operationsSorter: r }) => {
29
+ if (n["x-tagGroups"])
30
+ return n["x-tagGroups"].flatMap((i) => {
31
+ const a = u(i.tags ?? [], o, m, {
32
+ getTagId: c,
33
+ tagsSorter: h,
34
+ operationsSorter: r
35
+ });
36
+ return a.length ? p(i, m, c, a, !0) : [];
37
+ });
38
+ const f = Array.from(o.keys()), l = u(f, o, m, { getTagId: c, tagsSorter: h, operationsSorter: r });
39
+ return l.length === 1 && l[0].title === "default" ? l[0].children ?? [] : l;
40
+ };
41
+ export {
42
+ k as traverseTags
43
+ };
@@ -1,6 +1,6 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
- import type { TraversedEntry, TraversedWebhook } from '../../../features/traverse-schema/types';
2
+ import type { TagsMap, TraversedWebhook } from '../../../features/traverse-schema/types';
3
3
  import type { UseNavState } from '../../../hooks/useNavState.js';
4
4
  /** When traversing webhooks, we pass in the tags in from operations to save on memory */
5
- export declare const traverseWebhooks: (content: OpenAPIV3_1.Document, tagsMap: Map<string, TraversedEntry[]>, tagsDict: Map<string, OpenAPIV3_1.TagObject>, titlesMap: Map<string, string>, getWebhookId: UseNavState["getWebhookId"]) => TraversedWebhook[];
5
+ export declare const traverseWebhooks: (content: OpenAPIV3_1.Document, tagsMap: TagsMap, titlesMap: Map<string, string>, getWebhookId: UseNavState["getWebhookId"]) => TraversedWebhook[];
6
6
  //# sourceMappingURL=traverse-webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAyBtD,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,YAClB,WAAW,CAAC,QAAQ,WAEpB,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,YAE5B,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,aAEjC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,gBAChB,WAAW,CAAC,cAAc,CAAC,KACxC,gBAAgB,EA+BlB,CAAA"}
1
+ {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../../src/features/traverse-schema/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAyBtD,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,YAClB,WAAW,CAAC,QAAQ,WAEpB,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,gBAChB,WAAW,CAAC,cAAc,CAAC,KACxC,gBAAgB,EA2BlB,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { getTag as l } from "./get-tag.js";
2
+ const i = (e, r, t = "Unknown", n, c, h) => {
3
+ const g = e.summary || t, o = c({ name: t, method: r }, h);
4
+ return n.set(o, g), {
5
+ id: o,
6
+ title: g,
7
+ name: t,
8
+ webhook: e,
9
+ method: r
10
+ };
11
+ }, x = (e, r, t, n) => {
12
+ const c = [];
13
+ return Object.entries(e.webhooks ?? {}).forEach(([h, g]) => {
14
+ Object.entries(g ?? {}).forEach(([u, s]) => {
15
+ var f;
16
+ s["x-internal"] || s["x-scalar-ignore"] || ((f = s.tags) != null && f.length ? s.tags.forEach((E) => {
17
+ var b;
18
+ const { tag: k } = l(r, E);
19
+ (b = r.get(E)) == null || b.entries.push(i(s, u, h, t, n, k));
20
+ }) : c.push(i(s, u, h, t, n)));
21
+ });
22
+ }), c;
23
+ };
24
+ export {
25
+ x as traverseWebhooks
26
+ };
@@ -1,4 +1,4 @@
1
- export type { TraverseSpecOptions } from './types';
2
- export { traverseDocument } from './helpers/traverse-document';
3
- export { operationIdParams } from './helpers/operation-id-params.js';
1
+ export type { TraverseSpecOptions, TraversedEntry, TraversedDescription, TraversedTag } from './types';
2
+ export { traverseDocument } from './helpers/traverse-document.js';
3
+ export { DEFAULT_INTRODUCTION_SLUG } from './helpers/traverse-description.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/traverse-schema/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/traverse-schema/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA"}