@scalar/api-reference 1.35.7 → 1.36.0

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 (168) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/browser/standalone.js +7953 -7994
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReferenceLayout.vue.js +1 -1
  6. package/dist/components/ApiReferenceLayout.vue2.js +148 -150
  7. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  8. package/dist/components/Content/Content.vue.js +44 -51
  9. package/dist/components/Content/Models/ClassicLayout.vue.d.ts +2 -1
  10. package/dist/components/Content/Models/ClassicLayout.vue.d.ts.map +1 -1
  11. package/dist/components/Content/Models/ClassicLayout.vue.js +2 -2
  12. package/dist/components/Content/Models/ClassicLayout.vue2.js +31 -33
  13. package/dist/components/Content/Models/Models.vue.d.ts +2 -2
  14. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  15. package/dist/components/Content/Models/Models.vue.js +24 -23
  16. package/dist/components/Content/Models/ModernLayout.vue.d.ts +1 -0
  17. package/dist/components/Content/Models/ModernLayout.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Models/ModernLayout.vue.js +2 -2
  19. package/dist/components/Content/Models/ModernLayout.vue2.js +40 -41
  20. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -2
  21. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Operations/TraversedEntry.vue.js +24 -24
  23. package/dist/components/Content/Operations/TraversedEntryContainer.vue.d.ts.map +1 -1
  24. package/dist/components/Content/Operations/TraversedEntryContainer.vue.js +1 -1
  25. package/dist/components/Content/Operations/get-current-index.d.ts +1 -1
  26. package/dist/components/Content/Operations/get-current-index.d.ts.map +1 -1
  27. package/dist/components/Content/Operations/get-current-index.js +1 -1
  28. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
  29. package/dist/components/Content/Schema/SchemaObjectProperties.vue.js +35 -45
  30. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +1 -1
  31. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  32. package/dist/components/Content/Schema/helpers/sort-property-names.d.ts +16 -0
  33. package/dist/components/Content/Schema/helpers/sort-property-names.d.ts.map +1 -0
  34. package/dist/components/Content/Schema/helpers/sort-property-names.js +36 -0
  35. package/dist/components/Content/Tags/ClassicLayout.vue.d.ts +1 -1
  36. package/dist/components/Content/Tags/ClassicLayout.vue.d.ts.map +1 -1
  37. package/dist/components/Content/Tags/ClassicLayout.vue.js +2 -2
  38. package/dist/components/Content/Tags/ClassicLayout.vue2.js +1 -1
  39. package/dist/components/Content/Tags/ModernLayout.vue.d.ts +1 -1
  40. package/dist/components/Content/Tags/ModernLayout.vue.d.ts.map +1 -1
  41. package/dist/components/Content/Tags/ModernLayout.vue.js +2 -2
  42. package/dist/components/Content/Tags/ModernLayout.vue2.js +2 -2
  43. package/dist/components/Content/Tags/Tag.vue.d.ts +1 -1
  44. package/dist/components/Content/Tags/Tag.vue.d.ts.map +1 -1
  45. package/dist/components/Content/Tags/TagSection.vue.d.ts +1 -1
  46. package/dist/components/Content/Tags/TagSection.vue.d.ts.map +1 -1
  47. package/dist/components/Content/Tags/TagSection.vue.js +4 -4
  48. package/dist/components/MobileHeader.vue.js +2 -2
  49. package/dist/components/MobileHeader.vue2.js +1 -1
  50. package/dist/components/OperationsList/OperationsList.vue.d.ts +1 -1
  51. package/dist/components/OperationsList/OperationsList.vue.d.ts.map +1 -1
  52. package/dist/components/OperationsList/OperationsList.vue.js +1 -1
  53. package/dist/components/OperationsList/OperationsList.vue2.js +9 -11
  54. package/dist/components/OperationsList/OperationsListItem.vue.d.ts +1 -1
  55. package/dist/components/OperationsList/OperationsListItem.vue.d.ts.map +1 -1
  56. package/dist/components/OperationsList/OperationsListItem.vue.js +2 -2
  57. package/dist/components/OperationsList/OperationsListItem.vue2.js +24 -27
  58. package/dist/components/Section/Section.vue.d.ts.map +1 -1
  59. package/dist/components/Section/Section.vue.js +2 -2
  60. package/dist/components/Section/Section.vue2.js +12 -13
  61. package/dist/components/Section/SectionAccordion.vue.d.ts.map +1 -1
  62. package/dist/components/Section/SectionAccordion.vue.js +1 -1
  63. package/dist/components/Section/SectionAccordion.vue2.js +36 -37
  64. package/dist/components/ShowMoreButton.vue.js +2 -2
  65. package/dist/components/ShowMoreButton.vue2.js +3 -3
  66. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  67. package/dist/features/Operation/Operation.vue.js +32 -22
  68. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  69. package/dist/features/Operation/components/RequestBody.vue.js +1 -1
  70. package/dist/features/Operation/components/RequestBody.vue2.js +59 -47
  71. package/dist/features/Operation/helpers/get-first-server.d.ts +9 -0
  72. package/dist/features/Operation/helpers/get-first-server.d.ts.map +1 -0
  73. package/dist/features/Operation/helpers/get-first-server.js +20 -0
  74. package/dist/features/Search/components/SearchButton.vue.d.ts +2 -0
  75. package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -1
  76. package/dist/features/Search/components/SearchButton.vue.js +19 -17
  77. package/dist/features/Search/components/SearchModal.vue.d.ts +2 -1
  78. package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -1
  79. package/dist/features/Search/components/SearchModal.vue.js +2 -2
  80. package/dist/features/Search/components/SearchModal.vue2.js +74 -75
  81. package/dist/features/Search/helpers/create-search-index.d.ts +2 -2
  82. package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
  83. package/dist/features/Search/helpers/create-search-index.js +68 -66
  84. package/dist/features/Search/hooks/useSearchIndex.d.ts +3 -2
  85. package/dist/features/Search/hooks/useSearchIndex.d.ts.map +1 -1
  86. package/dist/features/Search/hooks/useSearchIndex.js +13 -13
  87. package/dist/features/Search/types.d.ts +1 -1
  88. package/dist/features/Search/types.d.ts.map +1 -1
  89. package/dist/features/api-client-modal/useApiClient.d.ts +20 -20
  90. package/dist/helpers/test-utils.d.ts +367 -5
  91. package/dist/helpers/test-utils.d.ts.map +1 -1
  92. package/dist/hooks/useNavState.d.ts +1 -15
  93. package/dist/hooks/useNavState.d.ts.map +1 -1
  94. package/dist/hooks/useNavState.js +29 -53
  95. package/dist/index.d.ts +5 -6
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +16 -20
  98. package/dist/style.css +1 -1
  99. package/dist/{features/sidebar/components/Sidebar.vue.d.ts → v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue.d.ts} +1 -1
  100. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue.d.ts.map +1 -0
  101. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue.js +7 -0
  102. package/dist/{features/sidebar/components/Sidebar.vue2.js → v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue2.js} +15 -15
  103. package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/components/SidebarElement.vue.d.ts +1 -1
  104. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarElement.vue.d.ts.map +1 -0
  105. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarElement.vue.js +7 -0
  106. package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/components/SidebarElement.vue2.js +41 -43
  107. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarGroup.vue.d.ts.map +1 -0
  108. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarGroup.vue.js +7 -0
  109. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarHttpBadge.vue.d.ts.map +1 -0
  110. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarHttpBadge.vue.js +7 -0
  111. package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/components/SidebarHttpBadge.vue2.js +1 -1
  112. package/dist/v2/blocks/scalar-sidebar-block/helpers/create-sidebar.d.ts +385 -0
  113. package/dist/v2/blocks/scalar-sidebar-block/helpers/create-sidebar.d.ts.map +1 -0
  114. package/dist/v2/blocks/scalar-sidebar-block/helpers/create-sidebar.js +35 -0
  115. package/dist/v2/blocks/scalar-sidebar-block/helpers/generate-reverse-index.d.ts +189 -0
  116. package/dist/v2/blocks/scalar-sidebar-block/helpers/generate-reverse-index.d.ts.map +1 -0
  117. package/dist/v2/blocks/scalar-sidebar-block/helpers/generate-reverse-index.js +9 -0
  118. package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/hooks/useSidebar.d.ts +4 -8
  119. package/dist/v2/blocks/scalar-sidebar-block/hooks/useSidebar.d.ts.map +1 -0
  120. package/dist/v2/blocks/scalar-sidebar-block/hooks/useSidebar.js +18 -0
  121. package/dist/v2/blocks/scalar-sidebar-block/index.d.ts +4 -0
  122. package/dist/v2/blocks/scalar-sidebar-block/index.d.ts.map +1 -0
  123. package/dist/v2/helpers/map-configuration.d.ts.map +1 -1
  124. package/package.json +9 -9
  125. package/dist/features/sidebar/components/Sidebar.vue.d.ts.map +0 -1
  126. package/dist/features/sidebar/components/Sidebar.vue.js +0 -7
  127. package/dist/features/sidebar/components/SidebarElement.vue.d.ts.map +0 -1
  128. package/dist/features/sidebar/components/SidebarElement.vue.js +0 -7
  129. package/dist/features/sidebar/components/SidebarGroup.vue.d.ts.map +0 -1
  130. package/dist/features/sidebar/components/SidebarGroup.vue.js +0 -7
  131. package/dist/features/sidebar/components/SidebarHttpBadge.vue.d.ts.map +0 -1
  132. package/dist/features/sidebar/components/SidebarHttpBadge.vue.js +0 -7
  133. package/dist/features/sidebar/helpers/create-sidebar.d.ts +0 -28
  134. package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +0 -1
  135. package/dist/features/sidebar/helpers/create-sidebar.js +0 -32
  136. package/dist/features/sidebar/hooks/useSidebar.d.ts.map +0 -1
  137. package/dist/features/sidebar/hooks/useSidebar.js +0 -18
  138. package/dist/features/sidebar/index.d.ts +0 -4
  139. package/dist/features/sidebar/index.d.ts.map +0 -1
  140. package/dist/features/traverse-schema/helpers/get-tag.d.ts +0 -6
  141. package/dist/features/traverse-schema/helpers/get-tag.d.ts.map +0 -1
  142. package/dist/features/traverse-schema/helpers/get-tag.js +0 -7
  143. package/dist/features/traverse-schema/helpers/traverse-description.d.ts +0 -11
  144. package/dist/features/traverse-schema/helpers/traverse-description.d.ts.map +0 -1
  145. package/dist/features/traverse-schema/helpers/traverse-description.js +0 -32
  146. package/dist/features/traverse-schema/helpers/traverse-document.d.ts +0 -16
  147. package/dist/features/traverse-schema/helpers/traverse-document.d.ts.map +0 -1
  148. package/dist/features/traverse-schema/helpers/traverse-document.js +0 -33
  149. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +0 -18
  150. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +0 -1
  151. package/dist/features/traverse-schema/helpers/traverse-paths.js +0 -30
  152. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts +0 -8
  153. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +0 -1
  154. package/dist/features/traverse-schema/helpers/traverse-schemas.js +0 -21
  155. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts +0 -11
  156. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +0 -1
  157. package/dist/features/traverse-schema/helpers/traverse-tags.js +0 -43
  158. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts +0 -10
  159. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +0 -1
  160. package/dist/features/traverse-schema/helpers/traverse-webhooks.js +0 -24
  161. package/dist/features/traverse-schema/index.d.ts +0 -5
  162. package/dist/features/traverse-schema/index.d.ts.map +0 -1
  163. package/dist/features/traverse-schema/types.d.ts +0 -55
  164. package/dist/features/traverse-schema/types.d.ts.map +0 -1
  165. package/dist/libs/markdown.js +0 -18
  166. /package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/components/SidebarGroup.vue.d.ts +0 -0
  167. /package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/components/SidebarGroup.vue2.js +0 -0
  168. /package/dist/{features/sidebar → v2/blocks/scalar-sidebar-block}/components/SidebarHttpBadge.vue.d.ts +0 -0
@@ -1,6 +1,8 @@
1
+ import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
2
  type __VLS_Props = {
2
3
  searchHotKey?: string;
3
4
  hideModels?: boolean;
5
+ document?: OpenApiDocument;
4
6
  };
5
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
8
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/components/SearchButton.vue"],"names":[],"mappings":"AA0FA,KAAK,WAAW,GAAG;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC;;AA8IF,wBAMG"}
1
+ {"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/components/SearchButton.vue"],"names":[],"mappings":"AA4FA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAOnG,KAAK,WAAW,GAAG;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,CAAC;;AAqJF,wBAMG"}
@@ -1,17 +1,18 @@
1
- import { defineComponent as h, ref as S, watch as k, nextTick as w, onMounted as C, onBeforeUnmount as M, createElementBlock as a, openBlock as r, Fragment as s, createVNode as p, unref as l, normalizeClass as v, withCtx as u, createElementVNode as n, createTextVNode as B, toDisplayString as K } from "vue";
1
+ import { defineComponent as h, ref as S, watch as k, nextTick as w, onMounted as C, onBeforeUnmount as M, createElementBlock as a, openBlock as r, Fragment as s, createVNode as u, unref as l, normalizeClass as v, withCtx as m, createElementVNode as n, createTextVNode as B, toDisplayString as K } from "vue";
2
2
  import { useModal as b, ScalarSidebarSearchButton as E } from "@scalar/components";
3
- import { isMacOS as m } from "@scalar/helpers/general/is-mac-os";
3
+ import { isMacOS as p } from "@scalar/helpers/general/is-mac-os";
4
4
  import H from "./SearchModal.vue.js";
5
5
  import { useApiClient as g } from "../../api-client-modal/useApiClient.js";
6
- const D = /* @__PURE__ */ h({
6
+ const O = /* @__PURE__ */ h({
7
7
  __name: "SearchButton",
8
8
  props: {
9
9
  searchHotKey: { default: "k" },
10
- hideModels: { type: Boolean, default: !1 }
10
+ hideModels: { type: Boolean, default: !1 },
11
+ document: {}
11
12
  },
12
13
  setup(f) {
13
- const d = S(), t = b(), { client: y } = g(), i = (o) => {
14
- (m() ? o.metaKey : o.ctrlKey) && o.key === f.searchHotKey && !y.value?.modalState.open && (o.preventDefault(), o.stopPropagation(), t.open ? t.hide() : t.show());
14
+ const d = S(), t = b(), { client: c } = g(), i = (o) => {
15
+ (p() ? o.metaKey : o.ctrlKey) && o.key === f.searchHotKey && !c.value?.modalState.open && (o.preventDefault(), o.stopPropagation(), t.open ? t.hide() : t.show());
15
16
  };
16
17
  k(
17
18
  () => t.open,
@@ -21,18 +22,18 @@ const D = /* @__PURE__ */ h({
21
22
  });
22
23
  }
23
24
  ), C(() => window.addEventListener("keydown", i)), M(() => window.removeEventListener("keydown", i));
24
- function c() {
25
+ function y() {
25
26
  t.show();
26
27
  }
27
28
  return (o, e) => (r(), a(s, null, [
28
- p(l(E), {
29
+ u(l(E), {
29
30
  ref_key: "button",
30
31
  ref: d,
31
32
  class: v(["w-full", o.$attrs.class]),
32
- onClick: c
33
+ onClick: y
33
34
  }, {
34
- shortcut: u(() => [
35
- l(m)() ? (r(), a(s, { key: 0 }, [
35
+ shortcut: m(() => [
36
+ l(p)() ? (r(), a(s, { key: 0 }, [
36
37
  e[0] || (e[0] = n("span", { class: "sr-only" }, "Command", -1)),
37
38
  e[1] || (e[1] = n("span", { "aria-hidden": "true" }, "⌘", -1))
38
39
  ], 64)) : (r(), a(s, { key: 1 }, [
@@ -41,7 +42,7 @@ const D = /* @__PURE__ */ h({
41
42
  ], 64)),
42
43
  B(" " + K(o.searchHotKey), 1)
43
44
  ]),
44
- default: u(() => [
45
+ default: m(() => [
45
46
  e[4] || (e[4] = n("span", { class: "sr-only" }, "Open Search", -1)),
46
47
  e[5] || (e[5] = n("span", {
47
48
  "aria-hidden": "true",
@@ -51,13 +52,14 @@ const D = /* @__PURE__ */ h({
51
52
  _: 1,
52
53
  __: [4, 5]
53
54
  }, 8, ["class"]),
54
- p(H, {
55
- modalState: l(t),
56
- hideModels: o.hideModels
57
- }, null, 8, ["modalState", "hideModels"])
55
+ u(H, {
56
+ document: o.document,
57
+ hideModels: o.hideModels,
58
+ modalState: l(t)
59
+ }, null, 8, ["document", "hideModels", "modalState"])
58
60
  ], 64));
59
61
  }
60
62
  });
61
63
  export {
62
- D as default
64
+ O as default
63
65
  };
@@ -1,7 +1,8 @@
1
1
  import { type ModalState } from '@scalar/components';
2
+ import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
3
  type __VLS_Props = {
3
4
  modalState: ModalState;
4
- hideModels: boolean;
5
+ document?: OpenApiDocument;
5
6
  };
6
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
8
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchModal.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/components/SearchModal.vue"],"names":[],"mappings":"AAmTA,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAsB3B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC;;AAiaF,wBAMG"}
1
+ {"version":3,"file":"SearchModal.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/components/SearchModal.vue"],"names":[],"mappings":"AAkTA,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAU3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAWnG,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,CAAC;;AAiaF,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./SearchModal.vue2.js";
2
2
  /* empty css */
3
- import e from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ e(o, [["__scopeId", "data-v-d38e7ee7"]]);
3
+ import a from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-1b57abdc"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,57 +1,56 @@
1
- import { defineComponent as A, ref as Y, watch as C, createBlock as T, openBlock as m, unref as n, withCtx as i, createElementVNode as a, createVNode as S, withKeys as g, withModifiers as v, isRef as _, createElementBlock as w, Fragment as I, renderList as j, createSlots as G, normalizeClass as J, createTextVNode as l, createCommentVNode as M, toDisplayString as c } from "vue";
2
- import { ScalarModal as Q, ScalarSearchInput as X, ScalarSearchResultList as Z, ScalarSearchResultItem as ee } from "@scalar/components";
3
- import { isDefined as te } from "@scalar/helpers/array/is-defined";
4
- import { scrollToId as $ } from "@scalar/helpers/dom/scroll-to-id";
5
- import { ScalarIconTerminalWindow as E, ScalarIconTag as oe, ScalarIconBracketsCurly as ne, ScalarIconTextAlignLeft as ae } from "@scalar/icons";
6
- import { isOperationDeprecated as N } from "@scalar/oas-utils/helpers";
7
- import { nanoid as re } from "nanoid";
8
- import se from "../../sidebar/components/SidebarHttpBadge.vue.js";
9
- import { useSearchIndex as ie } from "../hooks/useSearchIndex.js";
10
- import { useSidebar as V } from "../../sidebar/hooks/useSidebar.js";
11
- import { lazyBus as le } from "../../../components/Lazy/lazyBus.js";
12
- const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1" }, me = { class: "sr-only" }, be = /* @__PURE__ */ A({
1
+ import { defineComponent as z, ref as A, watch as C, createBlock as T, openBlock as m, unref as a, withCtx as i, createElementVNode as n, createVNode as S, withKeys as g, withModifiers as v, isRef as Y, createElementBlock as w, Fragment as I, renderList as _, createSlots as j, normalizeClass as G, createTextVNode as l, createCommentVNode as $, toDisplayString as c } from "vue";
2
+ import { ScalarModal as J, ScalarSearchInput as Q, ScalarSearchResultList as X, ScalarSearchResultItem as Z } from "@scalar/components";
3
+ import { isDefined as ee } from "@scalar/helpers/array/is-defined";
4
+ import { scrollToId as E } from "@scalar/helpers/dom/scroll-to-id";
5
+ import { ScalarIconTerminalWindow as M, ScalarIconTag as te, ScalarIconBracketsCurly as oe, ScalarIconTextAlignLeft as ne } from "@scalar/icons";
6
+ import { nanoid as ae } from "nanoid";
7
+ import { useSearchIndex as re } from "../hooks/useSearchIndex.js";
8
+ import { useSidebar as N } from "../../../v2/blocks/scalar-sidebar-block/hooks/useSidebar.js";
9
+ import se from "../../../v2/blocks/scalar-sidebar-block/components/SidebarHttpBadge.vue.js";
10
+ import { lazyBus as ie } from "../../../components/Lazy/lazyBus.js";
11
+ const le = { class: "sr-only" }, ce = { class: "inline-flex items-center gap-1" }, de = { class: "sr-only" }, Ie = /* @__PURE__ */ z({
13
12
  __name: "SearchModal",
14
13
  props: {
15
14
  modalState: {},
16
- hideModels: { type: Boolean }
15
+ document: {}
17
16
  },
18
- setup(L) {
19
- const u = L, f = re(), R = `${f}-search-result`, b = `${f}-search-instructions`, h = (o) => `${f}${o}`, { items: D } = V(), {
20
- resetSearch: F,
17
+ setup(V) {
18
+ const p = V, f = ae(), R = `${f}-search-result`, b = `${f}-search-instructions`, h = (o) => `${f}${o}`, { items: D } = N(), {
19
+ resetSearch: L,
21
20
  selectedIndex: r,
22
21
  selectedSearchResult: k,
23
22
  searchResultsWithPlaceholderResults: d,
24
- query: p
25
- } = ie(D), H = {
26
- heading: ae,
27
- model: ne,
28
- operation: E,
29
- tag: oe,
30
- webhook: E
31
- }, O = {
23
+ query: u
24
+ } = re(D, p.document), F = {
25
+ heading: ne,
26
+ model: oe,
27
+ operation: M,
28
+ tag: te,
29
+ webhook: M
30
+ }, H = {
32
31
  heading: "Heading",
33
32
  operation: "Operation",
34
33
  tag: "Tag",
35
34
  model: "Model",
36
35
  webhook: "Webhook"
37
- }, P = Y(null);
36
+ }, P = A(null);
38
37
  C(
39
- () => u.modalState.open,
38
+ () => p.modalState.open,
40
39
  (o) => {
41
- o && F();
40
+ o && L();
42
41
  }
43
42
  );
44
- const { setCollapsedSidebarItem: U } = V(), K = /#(tag\/[^/]*)/;
45
- function B(o) {
43
+ const { setCollapsedSidebarItem: U } = N(), K = /#(tag\/[^/]*)/;
44
+ function x(o) {
46
45
  let t = "models";
47
46
  const e = o.item.href.match(K);
48
47
  e?.length && e.length > 1 && (t = e[1]), U(t, !0);
49
48
  const s = o.item.href.replace("#", "");
50
49
  if (document.getElementById(s))
51
- $(s), u.modalState.hide();
50
+ E(s), p.modalState.hide();
52
51
  else {
53
- const y = le.on((z) => {
54
- z.loaded === s && ($(s), y(), u.modalState.hide());
52
+ const y = ie.on((q) => {
53
+ q.loaded === s && (E(s), y(), p.modalState.hide());
55
54
  });
56
55
  }
57
56
  }
@@ -64,7 +63,7 @@ const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1"
64
63
  block: "nearest"
65
64
  });
66
65
  });
67
- const x = (o) => {
66
+ const B = (o) => {
68
67
  const t = o === "up" ? -1 : 1, e = d.value.length;
69
68
  if (typeof r.value == "number") {
70
69
  const s = (r.value + t + e) % e;
@@ -72,77 +71,77 @@ const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1"
72
71
  } else
73
72
  r.value = t === -1 ? e - 1 : 0;
74
73
  };
75
- function W(o) {
74
+ function O(o) {
76
75
  const t = new URL(window.location.href);
77
76
  return t.hash = o, t.toString();
78
77
  }
79
- function q() {
80
- if (!te(r.value))
78
+ function W() {
79
+ if (!ee(r.value))
81
80
  return;
82
81
  const o = d.value;
83
- o.length !== 0 && B(o[r.value]);
82
+ o.length !== 0 && x(o[r.value]);
84
83
  }
85
- return (o, t) => (m(), T(n(Q), {
84
+ return (o, t) => (m(), T(a(J), {
86
85
  "aria-label": "Reference Search",
87
86
  state: o.modalState,
88
87
  variant: "search"
89
88
  }, {
90
89
  default: i(() => [
91
- a("div", {
90
+ n("div", {
92
91
  ref_key: "searchModalRef",
93
92
  ref: P,
94
93
  class: "ref-search-container",
95
94
  role: "search"
96
95
  }, [
97
- S(n(X), {
98
- modelValue: n(p),
99
- "onUpdate:modelValue": t[0] || (t[0] = (e) => _(p) ? p.value = e : null),
100
- "aria-activedescendant": n(k) ? h(n(k).item.href) : void 0,
96
+ S(a(Q), {
97
+ modelValue: a(u),
98
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => Y(u) ? u.value = e : null),
99
+ "aria-activedescendant": a(k) ? h(a(k).item.href) : void 0,
101
100
  "aria-autocomplete": "list",
102
101
  "aria-controls": R,
103
102
  "aria-describedby": b,
104
103
  role: "combobox",
105
104
  onBlur: t[1] || (t[1] = (e) => r.value = void 0),
106
105
  onKeydown: [
107
- t[2] || (t[2] = g(v((e) => x("down"), ["stop", "prevent"]), ["down"])),
108
- g(v(q, ["stop", "prevent"]), ["enter"]),
109
- t[3] || (t[3] = g(v((e) => x("up"), ["stop", "prevent"]), ["up"]))
106
+ t[2] || (t[2] = g(v((e) => B("down"), ["stop", "prevent"]), ["down"])),
107
+ g(v(W, ["stop", "prevent"]), ["enter"]),
108
+ t[3] || (t[3] = g(v((e) => B("up"), ["stop", "prevent"]), ["up"]))
110
109
  ]
111
110
  }, null, 8, ["modelValue", "aria-activedescendant", "onKeydown"])
112
111
  ], 512),
113
- S(n(Z), {
112
+ S(a(X), {
114
113
  id: R,
115
114
  "aria-label": "Reference Search Results",
116
115
  class: "ref-search-results custom-scroll",
117
- noResults: !n(d).length
116
+ noResults: !a(d).length
118
117
  }, {
119
118
  query: i(() => [
120
- l(c(n(p)), 1)
119
+ l(c(a(u)), 1)
121
120
  ]),
122
121
  default: i(() => [
123
- (m(!0), w(I, null, j(n(d), (e, s) => (m(), T(n(ee), {
122
+ (m(!0), w(I, null, _(a(d), (e, s) => (m(), T(a(Z), {
124
123
  id: h(e.item.href),
125
124
  key: e.refIndex,
126
- href: W(e.item.href),
127
- icon: H[e.item.type],
128
- selected: n(r) === s,
129
- onClick: (y) => B(e),
125
+ href: O(e.item.href),
126
+ icon: F[e.item.type],
127
+ selected: a(r) === s,
128
+ onClick: (y) => x(e),
130
129
  onFocus: (y) => r.value = s
131
- }, G({
130
+ }, j({
132
131
  default: i(() => [
133
- a("span", {
134
- class: J({
135
- deprecated: "operation" in e.item.entry && n(N)(e.item.entry.operation)
132
+ n("span", {
133
+ class: G({
134
+ deprecated: e.item.entry.type === "operation" && e.item.entry.isDeprecated
136
135
  })
137
136
  }, [
138
- a("span", ce, [
139
- l(c(O[e.item.type]) + ":  ", 1),
140
- "operation" in e.item.entry && n(N)(e.item.entry.operation) ? (m(), w(I, { key: 0 }, [
137
+ n("span", le, [
138
+ l(c(H[e.item.type]) + ":  ", 1),
139
+ e.item.entry.type === "operation" && e.item.entry.isDeprecated ? (m(), w(I, { key: 0 }, [
141
140
  l(" (Deprecated)  ")
142
- ], 64)) : M("", !0)
141
+ ], 64)) : $("", !0)
143
142
  ]),
144
143
  l(" " + c(e.item.title) + " ", 1),
145
- t[4] || (t[4] = a("span", { class: "sr-only" }, ",", -1))
144
+ t[4] || (t[4] = n("span", { class: "sr-only" }, ",", -1))
146
145
  ], 2)
147
146
  ]),
148
147
  _: 2
@@ -150,15 +149,15 @@ const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1"
150
149
  e.item.type !== "webhook" && (e.item.method || e.item.path) && e.item.path !== e.item.title ? {
151
150
  name: "description",
152
151
  fn: i(() => [
153
- a("span", de, [
152
+ n("span", ce, [
154
153
  e.item.type === "operation" ? (m(), w(I, { key: 0 }, [
155
- S(se, {
154
+ S(a(se), {
156
155
  "aria-hidden": "true",
157
156
  method: e.item.method ?? "get"
158
157
  }, null, 8, ["method"]),
159
- a("span", me, " HTTP Method: " + c(e.item.method ?? "get"), 1)
160
- ], 64)) : M("", !0),
161
- t[5] || (t[5] = a("span", { class: "sr-only" }, "Path: ", -1)),
158
+ n("span", de, " HTTP Method: " + c(e.item.method ?? "get"), 1)
159
+ ], 64)) : $("", !0),
160
+ t[5] || (t[5] = n("span", { class: "sr-only" }, "Path: ", -1)),
162
161
  l(" " + c(e.item.path), 1)
163
162
  ])
164
163
  ]),
@@ -166,7 +165,7 @@ const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1"
166
165
  } : e.item.description ? {
167
166
  name: "description",
168
167
  fn: i(() => [
169
- t[6] || (t[6] = a("span", { class: "sr-only" }, "Description: ", -1)),
168
+ t[6] || (t[6] = n("span", { class: "sr-only" }, "Description: ", -1)),
170
169
  l(" " + c(e.item.description), 1)
171
170
  ]),
172
171
  key: "1"
@@ -175,18 +174,18 @@ const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1"
175
174
  ]),
176
175
  _: 1
177
176
  }, 8, ["noResults"]),
178
- a("div", {
177
+ n("div", {
179
178
  id: b,
180
179
  class: "ref-search-meta"
181
180
  }, t[7] || (t[7] = [
182
- a("span", {
181
+ n("span", {
183
182
  "aria-hidden": "true",
184
183
  class: "contents"
185
184
  }, [
186
- a("span", null, "↑↓ Navigate"),
187
- a("span", null, "⏎ Select")
185
+ n("span", null, "↑↓ Navigate"),
186
+ n("span", null, "⏎ Select")
188
187
  ], -1),
189
- a("span", { class: "sr-only" }, " Press up arrow / down arrow to navigate, enter to select, type to filter results ", -1)
188
+ n("span", { class: "sr-only" }, " Press up arrow / down arrow to navigate, enter to select, type to filter results ", -1)
190
189
  ]))
191
190
  ]),
192
191
  _: 1
@@ -194,5 +193,5 @@ const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1"
194
193
  }
195
194
  });
196
195
  export {
197
- be as default
196
+ Ie as default
198
197
  };
@@ -1,7 +1,7 @@
1
+ import type { OpenApiDocument, TraversedEntry } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
2
  import type { FuseData } from '../../../features/Search/types';
2
- import type { TraversedEntry } from '../../../features/traverse-schema';
3
3
  /**
4
4
  * Create a search index from a list of entries.
5
5
  */
6
- export declare function createSearchIndex(entries: TraversedEntry[]): FuseData[];
6
+ export declare function createSearchIndex(entries: TraversedEntry[], document?: OpenApiDocument): FuseData[];
7
7
  //# sourceMappingURL=create-search-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGhE;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE,CAoBvE"}
1
+ {"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAA;AAEnH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGvD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,QAAQ,EAAE,CAoBnG"}
@@ -1,109 +1,111 @@
1
- import { extractRequestBody as p, createParameterMap as s } from "../../../libs/openapi.js";
2
- function c(i) {
3
- const o = [];
4
- function e(d) {
5
- d.forEach((t) => {
6
- h(t, o), "children" in t && t.children && e(t.children);
1
+ import { getResolvedRef as s } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
+ import { extractRequestBody as h, createParameterMap as a } from "../../../libs/openapi.js";
3
+ function f(o, i) {
4
+ const t = [];
5
+ function e(p) {
6
+ p.forEach((d) => {
7
+ c(d, t, i), "children" in d && d.children && e(d.children);
7
8
  });
8
9
  }
9
- return e(i), o;
10
+ return e(o), t;
10
11
  }
11
- function h(i, o) {
12
- if ("operation" in i) {
13
- const e = p(i.operation) || s(i.operation), d = typeof e != "boolean" ? e : null;
14
- o.push({
12
+ function c(o, i, t) {
13
+ if (o.type === "operation") {
14
+ const e = s(t?.paths?.[o.path]?.[o.method]) ?? {}, p = h(e) || a(e), d = typeof p != "boolean" ? p : null;
15
+ i.push({
15
16
  type: "operation",
16
- title: i.title,
17
- href: `#${i.id}`,
18
- id: i.operation.operationId,
19
- description: i.operation.description || "",
20
- method: i.method,
21
- path: i.path,
17
+ title: o.title,
18
+ href: `#${o.id}`,
19
+ id: e.operationId,
20
+ description: e.description || "",
21
+ method: o.method,
22
+ path: o.path,
22
23
  body: d || "",
23
- entry: i
24
+ entry: o
24
25
  });
25
26
  return;
26
27
  }
27
- if ("webhook" in i) {
28
- o.push({
28
+ if (o.type === "webhook") {
29
+ const e = s(t?.webhooks?.[o.name]?.[o.method]) ?? {};
30
+ i.push({
29
31
  type: "webhook",
30
- title: i.title,
31
- href: `#${i.id}`,
32
+ title: o.title,
33
+ href: `#${o.id}`,
32
34
  description: "Webhook",
33
- method: i.method,
34
- body: i.webhook.description || "",
35
- entry: i
35
+ method: o.method,
36
+ body: e.description || "",
37
+ entry: o
36
38
  });
37
39
  return;
38
40
  }
39
- if ("schema" in i) {
40
- const e = "description" in i.schema && typeof i.schema.description == "string" ? i.schema.description : "";
41
- o.push({
41
+ if (o.type === "model") {
42
+ const p = s(t?.components?.schemas?.[o.name])?.description ?? "";
43
+ i.push({
42
44
  type: "model",
43
- title: i.title,
44
- href: `#${i.id}`,
45
+ title: o.title,
46
+ href: `#${o.id}`,
45
47
  description: "Model",
46
- body: e,
47
- entry: i
48
+ body: p,
49
+ entry: o
48
50
  });
49
51
  return;
50
52
  }
51
- if ("tag" in i) {
52
- o.push({
53
- title: i.title,
54
- href: `#${i.id}`,
55
- description: i.tag.description || "",
56
- type: "tag",
53
+ if (o.title === "Models") {
54
+ i.push({
55
+ type: "heading",
56
+ title: "Models",
57
+ href: `#${o.id}`,
58
+ description: "Heading",
57
59
  body: "",
58
- entry: i
60
+ entry: o
59
61
  });
60
62
  return;
61
63
  }
62
- if ("isGroup" in i) {
63
- o.push({
64
- title: i.title,
65
- href: `#${i.id}`,
66
- description: "Tag Group",
67
- type: "tag",
64
+ if (o.type === "tag" && o.isWebhooks === !0) {
65
+ i.push({
66
+ type: "heading",
67
+ title: "Webhooks",
68
+ href: `#${o.id}`,
69
+ description: "Heading",
68
70
  body: "",
69
- entry: i
71
+ entry: o
70
72
  });
71
73
  return;
72
74
  }
73
- if ("isWebhooks" in i) {
74
- o.push({
75
- type: "heading",
76
- title: "Webhooks",
77
- href: `#${i.id}`,
78
- description: "Heading",
75
+ if (o.type === "tag" && o.isGroup === !1) {
76
+ i.push({
77
+ title: o.title,
78
+ href: `#${o.id}`,
79
+ description: o.description || "",
80
+ type: "tag",
79
81
  body: "",
80
- entry: i
82
+ entry: o
81
83
  });
82
84
  return;
83
85
  }
84
- if (i.title === "Models") {
85
- o.push({
86
- type: "heading",
87
- title: "Models",
88
- href: `#${i.id}`,
89
- description: "Heading",
86
+ if (o.type === "tag" && o.isGroup === !0) {
87
+ i.push({
88
+ title: o.title,
89
+ href: `#${o.id}`,
90
+ description: "Tag Group",
91
+ type: "tag",
90
92
  body: "",
91
- entry: i
93
+ entry: o
92
94
  });
93
95
  return;
94
96
  }
95
- if (i.title) {
96
- o.push({
97
+ if (o.title) {
98
+ i.push({
97
99
  type: "heading",
98
- title: i.title ?? "",
100
+ title: o.title ?? "",
99
101
  description: "Description",
100
- href: `#${i.id}`,
102
+ href: `#${o.id}`,
101
103
  body: "",
102
- entry: i
104
+ entry: o
103
105
  });
104
106
  return;
105
107
  }
106
108
  }
107
109
  export {
108
- c as createSearchIndex
110
+ f as createSearchIndex
109
111
  };
@@ -1,10 +1,11 @@
1
- import type { createSidebar } from '../../../features/sidebar';
1
+ import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  import type { FuseResult } from 'fuse.js';
3
+ import type { useSidebar } from '../../../v2/blocks/scalar-sidebar-block';
3
4
  import type { FuseData } from '../types';
4
5
  /**
5
6
  * Creates the search index from an OpenAPI document.
6
7
  */
7
- export declare function useSearchIndex(items: ReturnType<typeof createSidebar>['items']): {
8
+ export declare function useSearchIndex(items: ReturnType<typeof useSidebar>['items'], document?: OpenApiDocument): {
8
9
  resetSearch: () => void;
9
10
  selectedIndex: import("vue").Ref<number | undefined, number | undefined>;
10
11
  selectedSearchResult: import("vue").ComputedRef<FuseResult<FuseData> | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,OAAO,CAAC;uBAgCrD,IAAI;;;;;EA0D7B"}
1
+ {"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAIlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe;uBAgC9E,IAAI;;;;;EA0D7B"}