@scalar/api-client 2.12.0 → 2.13.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 (178) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
  3. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  4. package/dist/components/CommandPalette/CommandActionForm.vue.d.ts +2 -2
  5. package/dist/components/CommandPalette/CommandActionForm.vue.d.ts.map +1 -1
  6. package/dist/components/CommandPalette/CommandActionForm.vue.js +14 -14
  7. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +38 -38
  8. package/dist/components/EmptyState.vue.d.ts.map +1 -1
  9. package/dist/components/EmptyState.vue.js +2 -2
  10. package/dist/components/EmptyState.vue2.js +27 -16
  11. package/dist/components/TopNav/TopNav.vue.js +33 -33
  12. package/dist/layouts/App/create-api-client-app.d.ts +28 -28
  13. package/dist/layouts/Web/create-api-client-web.d.ts +28 -28
  14. package/dist/libs/create-client.d.ts +28 -28
  15. package/dist/libs/hot-keys.d.ts +2 -2
  16. package/dist/libs/send-request/create-fetch-body.d.ts +2 -2
  17. package/dist/store/active-entities.d.ts +2 -2
  18. package/dist/store/collections.d.ts +4 -4
  19. package/dist/store/index.d.ts +1 -1
  20. package/dist/store/index.d.ts.map +1 -1
  21. package/dist/store/index.js +8 -8
  22. package/dist/store/request-example.d.ts +12 -12
  23. package/dist/store/store.d.ts +28 -28
  24. package/dist/store/workspace.d.ts +12 -12
  25. package/dist/style.css +1 -1
  26. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -2
  27. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  28. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +9 -8
  29. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -1
  30. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  31. package/dist/v2/blocks/operation-block/components/Header.vue.js +3 -3
  32. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  33. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  34. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  35. package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +14 -11
  36. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +22 -22
  37. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
  38. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
  39. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +2 -2
  40. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +18 -15
  41. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +2 -2
  42. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +17 -17
  43. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  45. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +17 -12
  46. package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -1
  47. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +205 -0
  48. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +52 -52
  50. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +1 -1
  51. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  52. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +205 -0
  53. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -0
  54. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  55. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -2
  56. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  57. package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
  58. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  59. package/dist/v2/features/app/App.vue.js +126 -103
  60. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +0 -2
  61. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  62. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  63. package/dist/v2/features/app/components/AppSidebar.vue2.js +56 -53
  64. package/dist/v2/features/app/components/DesktopTab.vue.d.ts +26 -0
  65. package/dist/v2/features/app/components/DesktopTab.vue.d.ts.map +1 -0
  66. package/dist/v2/features/app/components/DesktopTab.vue.js +7 -0
  67. package/dist/v2/features/app/components/DesktopTab.vue2.js +134 -0
  68. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +9 -4
  69. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  70. package/dist/v2/features/app/components/DesktopTabs.vue.js +47 -13
  71. package/dist/v2/features/app/components/DesktopTabs.vue2.js +2 -4
  72. package/dist/v2/features/app/components/SplashScreen.vue.js +2 -2
  73. package/dist/v2/features/app/components/SplashScreen.vue2.js +2 -2
  74. package/dist/v2/features/app/helpers/routes.js +1 -1
  75. package/dist/v2/features/collection/components/Settings.vue2.js +3 -3
  76. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +61 -0
  77. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -0
  78. package/dist/v2/features/command-palette/components/CommandActionForm.vue.js +48 -0
  79. package/dist/v2/features/command-palette/components/CommandActionForm.vue2.js +4 -0
  80. package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +39 -0
  81. package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts.map +1 -0
  82. package/dist/v2/features/command-palette/components/CommandActionInput.vue.js +52 -0
  83. package/dist/v2/features/command-palette/components/CommandActionInput.vue2.js +4 -0
  84. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts +36 -0
  85. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +1 -0
  86. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.js +78 -0
  87. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +4 -0
  88. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +30 -0
  89. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -0
  90. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +169 -0
  91. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue2.js +4 -0
  92. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +34 -0
  93. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -0
  94. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +175 -0
  95. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue2.js +4 -0
  96. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts +43 -0
  97. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts.map +1 -0
  98. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +7 -0
  99. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +115 -0
  100. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +39 -0
  101. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -0
  102. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +213 -0
  103. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue2.js +4 -0
  104. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +38 -0
  105. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -0
  106. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +89 -0
  107. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue2.js +4 -0
  108. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts +41 -0
  109. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +1 -0
  110. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.js +7 -0
  111. package/dist/v2/features/command-palette/components/TheCommandPalette.vue2.js +172 -0
  112. package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts +33 -0
  113. package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts.map +1 -0
  114. package/dist/v2/features/command-palette/components/WatchModeToggle.vue.js +40 -0
  115. package/dist/v2/features/command-palette/components/WatchModeToggle.vue2.js +4 -0
  116. package/dist/v2/features/command-palette/components/index.d.ts +2 -0
  117. package/dist/v2/features/command-palette/components/index.d.ts.map +1 -0
  118. package/dist/v2/features/command-palette/components/index.js +4 -0
  119. package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts +23 -0
  120. package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts.map +1 -0
  121. package/dist/v2/features/command-palette/helpers/get-openapi-document-details.js +31 -0
  122. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +13 -0
  123. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -0
  124. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +12 -0
  125. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts +26 -0
  126. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts.map +1 -0
  127. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +70 -0
  128. package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts +23 -0
  129. package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts.map +1 -0
  130. package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +18 -0
  131. package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +11 -0
  132. package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +1 -0
  133. package/dist/v2/features/command-palette/helpers/is-postman-collection.js +11 -0
  134. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +202 -0
  135. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -0
  136. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +109 -0
  137. package/dist/v2/features/command-palette/types.d.ts +82 -0
  138. package/dist/v2/features/command-palette/types.d.ts.map +1 -0
  139. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  140. package/dist/v2/features/operation/Operation.vue.js +24 -20
  141. package/dist/v2/helpers/drag-handle-factory.d.ts +1 -2
  142. package/dist/v2/helpers/drag-handle-factory.d.ts.map +1 -1
  143. package/dist/v2/helpers/drag-handle-factory.js +74 -90
  144. package/dist/v2/helpers/get-tab-details.d.ts +43 -0
  145. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -0
  146. package/dist/v2/helpers/get-tab-details.js +34 -0
  147. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  148. package/dist/v2/helpers/is-url.d.ts +2 -0
  149. package/dist/v2/helpers/is-url.d.ts.map +1 -0
  150. package/dist/v2/helpers/is-url.js +5 -0
  151. package/dist/v2/helpers/remove-circular.d.ts +15 -0
  152. package/dist/v2/helpers/remove-circular.d.ts.map +1 -0
  153. package/dist/v2/helpers/remove-circular.js +18 -0
  154. package/dist/v2/helpers/storage.d.ts +4 -6
  155. package/dist/v2/helpers/storage.d.ts.map +1 -1
  156. package/dist/v2/helpers/storage.js +8 -12
  157. package/dist/v2/hooks/use-sidebar-state.d.ts +12 -19
  158. package/dist/v2/hooks/use-sidebar-state.d.ts.map +1 -1
  159. package/dist/v2/hooks/use-sidebar-state.js +20 -18
  160. package/dist/v2/hooks/use-sync-path.d.ts +11 -0
  161. package/dist/v2/hooks/use-sync-path.d.ts.map +1 -0
  162. package/dist/v2/hooks/use-sync-path.js +51 -0
  163. package/dist/v2/hooks/use-tabs.d.ts +31 -0
  164. package/dist/v2/hooks/use-tabs.d.ts.map +1 -0
  165. package/dist/v2/hooks/use-tabs.js +44 -0
  166. package/dist/v2/hooks/use-workspace-client-events.d.ts +5 -2
  167. package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
  168. package/dist/v2/hooks/use-workspace-client-events.js +91 -36
  169. package/dist/v2/hooks/use-workspace-selector.d.ts +16 -6
  170. package/dist/v2/hooks/use-workspace-selector.d.ts.map +1 -1
  171. package/dist/v2/hooks/use-workspace-selector.js +58 -64
  172. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  173. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +78 -78
  174. package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue.js +29 -29
  175. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  176. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +2 -2
  177. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +19 -19
  178. package/package.json +136 -46
@@ -0,0 +1,172 @@
1
+ import { defineComponent as M, ref as N, computed as E, watch as $, createBlock as p, openBlock as l, unref as s, withCtx as f, createElementVNode as m, createVNode as u, createElementBlock as r, createTextVNode as I, createCommentVNode as v, withKeys as C, withModifiers as h, Fragment as S, renderList as O, withDirectives as K, toDisplayString as _, vShow as R, normalizeClass as V, resolveDynamicComponent as X, mergeProps as A, nextTick as Q } from "vue";
2
+ import { Dialog as F, DialogPanel as q, DialogTitle as H } from "@headlessui/vue";
3
+ import { ScalarIcon as y } from "@scalar/components";
4
+ import { useRouter as W } from "vue-router";
5
+ import j from "./CommandPaletteDocument.vue.js";
6
+ import G from "./CommandPaletteExample.vue.js";
7
+ import J from "./CommandPaletteImport.vue.js";
8
+ import U from "./CommandPaletteImportCurl.vue.js";
9
+ import Y from "./CommandPaletteRequest.vue.js";
10
+ import Z from "./CommandPaletteTag.vue.js";
11
+ const ee = {
12
+ key: 0,
13
+ class: "custom-scroll max-h-[50dvh] min-h-0 flex-1 rounded-lg p-1.5"
14
+ }, te = { class: "bg-b-2 focus-within:bg-b-1 sticky top-0 flex items-center rounded-md border border-transparent pl-2 shadow-[0_-8px_0_8px_var(--scalar-background-1),0_0_8px_8px_var(--scalar-background-1)] focus-within:border-(--scalar-background-3)" }, oe = { for: "commandmenu" }, ae = ["value", "onKeydown"], ne = ["id", "onClick"], le = {
15
+ key: 0,
16
+ class: "text-c-3 p-2 pt-3 text-center text-sm"
17
+ }, re = {
18
+ key: 1,
19
+ class: "flex-1 p-1.5"
20
+ }, se = {}, ke = /* @__PURE__ */ M({
21
+ ...se,
22
+ __name: "TheCommandPalette",
23
+ props: {
24
+ paletteState: {},
25
+ workspaceStore: {},
26
+ eventBus: {}
27
+ },
28
+ setup(a) {
29
+ const D = {
30
+ "import-from-openapi-swagger-postman-curl": J,
31
+ "create-document": j,
32
+ "create-request": Y,
33
+ "add-tag": Z,
34
+ "add-example": G,
35
+ "import-curl-command": U
36
+ }, T = W(), i = N(-1), k = N(null), c = E(
37
+ () => a.paletteState.filteredCommands.value.flatMap((e) => e.commands)
38
+ ), d = E(
39
+ () => c.value[i.value]
40
+ );
41
+ $(
42
+ () => a.paletteState.filterQuery.value,
43
+ (e) => {
44
+ i.value = e && c.value.length > 0 ? 0 : -1;
45
+ }
46
+ );
47
+ const B = (e) => {
48
+ a.paletteState.setFilterQuery(e), e.trim().toLowerCase().startsWith("curl") && a.paletteState.open("import-curl-command", { curl: e });
49
+ }, b = (e, t) => {
50
+ if (!a.paletteState.isOpen.value)
51
+ return;
52
+ t.preventDefault();
53
+ const o = e === "up" ? -1 : 1, n = c.value.length;
54
+ i.value = (i.value + o + n) % n;
55
+ }, P = (e) => {
56
+ !d.value || a.paletteState.activeCommand.value || (e.preventDefault(), e.stopPropagation(), x(d.value));
57
+ }, x = (e) => {
58
+ if (e.type === "route") {
59
+ T.push(e.to), w();
60
+ return;
61
+ }
62
+ e.type === "folder" && a.paletteState.open(e.id, void 0);
63
+ }, g = () => {
64
+ a.paletteState.reset(), Q(() => k.value?.focus());
65
+ }, z = () => {
66
+ a.paletteState.close();
67
+ }, L = (...e) => {
68
+ a.paletteState.open(...e);
69
+ }, w = () => {
70
+ a.paletteState.close(), i.value = -1;
71
+ };
72
+ return (e, t) => (l(), p(s(F), {
73
+ open: e.paletteState.isOpen.value,
74
+ onClose: w
75
+ }, {
76
+ default: f(() => [
77
+ t[4] || (t[4] = m("div", { class: "commandmenu-overlay z-overlay" }, null, -1)),
78
+ u(s(q), { class: "commandmenu z-overlay flex flex-col" }, {
79
+ default: f(() => [
80
+ u(s(H), { class: "sr-only" }, {
81
+ default: f(() => [...t[3] || (t[3] = [
82
+ I("API Client Command Menu", -1)
83
+ ])]),
84
+ _: 1
85
+ }),
86
+ e.paletteState.activeCommand.value ? (l(), r("div", re, [
87
+ m("button", {
88
+ class: "hover:bg-b-3 text-c-3 active:text-c-1 absolute z-1 mt-[0.5px] rounded p-1.5",
89
+ type: "button",
90
+ onClick: g
91
+ }, [
92
+ u(s(y), {
93
+ icon: "ChevronLeft",
94
+ size: "md",
95
+ thickness: "1.5"
96
+ })
97
+ ]),
98
+ e.paletteState.activeCommand.value ? (l(), p(X(D[e.paletteState.activeCommand.value]), A({ key: 0 }, {
99
+ workspaceStore: e.workspaceStore,
100
+ eventBus: e.eventBus,
101
+ ...e.paletteState.activeCommandProps.value
102
+ }, {
103
+ onBack: g,
104
+ onClose: z,
105
+ onOpenCommand: L
106
+ }), null, 16)) : v("", !0)
107
+ ])) : (l(), r("div", ee, [
108
+ m("div", te, [
109
+ m("label", oe, [
110
+ u(s(y), {
111
+ class: "text-c-2 mr-2.5",
112
+ icon: "Search",
113
+ size: "md",
114
+ thickness: "1.5"
115
+ })
116
+ ]),
117
+ m("input", {
118
+ id: "commandmenu",
119
+ ref_key: "commandInputRef",
120
+ ref: k,
121
+ autocomplete: "off",
122
+ autofocus: "",
123
+ class: "w-full rounded border-none bg-none py-1.5 text-sm focus:outline-none",
124
+ placeholder: "Search commands...",
125
+ type: "text",
126
+ value: e.paletteState.filterQuery.value,
127
+ onInput: t[0] || (t[0] = (o) => B(o.target.value)),
128
+ onKeydown: [
129
+ t[1] || (t[1] = C(h((o) => b("down", o), ["stop"]), ["down"])),
130
+ C(h(P, ["stop"]), ["enter"]),
131
+ t[2] || (t[2] = C(h((o) => b("up", o), ["stop"]), ["up"]))
132
+ ]
133
+ }, null, 40, ae)
134
+ ]),
135
+ (l(!0), r(S, null, O(e.paletteState.filteredCommands.value, (o) => (l(), r(S, {
136
+ key: o.label
137
+ }, [
138
+ K(m("div", { class: "text-c-3 mt-2 mb-1 px-2 text-xs font-medium" }, _(o.label), 513), [
139
+ [R, o.commands.length > 0]
140
+ ]),
141
+ (l(!0), r(S, null, O(o.commands, (n) => (l(), r("button", {
142
+ id: n.id,
143
+ key: n.id,
144
+ class: V(["commandmenu-item hover:bg-b-2 flex w-full cursor-pointer items-center rounded px-2 py-1.5 text-left text-sm", {
145
+ "bg-b-2": n.id === d.value?.id
146
+ }]),
147
+ type: "button",
148
+ onClick: (ie) => x(n)
149
+ }, [
150
+ "icon" in n ? (l(), p(s(y), {
151
+ key: 0,
152
+ class: "text-c-2 mr-2.5",
153
+ icon: n.icon,
154
+ size: "md",
155
+ thickness: "1.5"
156
+ }, null, 8, ["icon"])) : v("", !0),
157
+ I(" " + _(n.name), 1)
158
+ ], 10, ne))), 128))
159
+ ], 64))), 128)),
160
+ e.paletteState.filteredCommands.value.length ? v("", !0) : (l(), r("div", le, " No commands found "))
161
+ ]))
162
+ ]),
163
+ _: 1
164
+ })
165
+ ]),
166
+ _: 1
167
+ }, 8, ["open"]));
168
+ }
169
+ });
170
+ export {
171
+ ke as default
172
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Watch Mode Toggle Component
3
+ *
4
+ * A toggle switch for enabling/disabling watch mode on URL imports.
5
+ * When enabled, the API client automatically updates when the OpenAPI URL
6
+ * content changes, ensuring the client remains up-to-date.
7
+ *
8
+ * Supports v-model for two-way binding and can be disabled when needed
9
+ * (e.g., when importing from files instead of URLs).
10
+ *
11
+ * @example
12
+ * <WatchModeToggle
13
+ * v-model="watchMode"
14
+ * :disabled="!isUrlImport"
15
+ * />
16
+ */
17
+ declare const _default: import("vue").DefineComponent<{
18
+ /** Whether watch mode is currently enabled */
19
+ modelValue: boolean;
20
+ /** Whether the toggle is disabled (e.g., for non-URL imports) */
21
+ disabled?: boolean;
22
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
+ "update:modelValue": (value: boolean) => any;
24
+ }, string, import("vue").PublicProps, Readonly<{
25
+ /** Whether watch mode is currently enabled */
26
+ modelValue: boolean;
27
+ /** Whether the toggle is disabled (e.g., for non-URL imports) */
28
+ disabled?: boolean;
29
+ }> & Readonly<{
30
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
31
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
+ export default _default;
33
+ //# sourceMappingURL=WatchModeToggle.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchModeToggle.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/WatchModeToggle.vue"],"names":[],"mappings":"AAuEA;;;;;;;;;;;;;;;GAeG;;IAGD,8CAA8C;gBAClC,OAAO;IACnB,iEAAiE;eACtD,OAAO;;;;IAHlB,8CAA8C;gBAClC,OAAO;IACnB,iEAAiE;eACtD,OAAO;;;;AALpB,wBA8GC"}
@@ -0,0 +1,40 @@
1
+ import { defineComponent as u, computed as c, createElementBlock as i, openBlock as p, normalizeClass as o, createElementVNode as f, createVNode as a, createTextVNode as g, unref as d } from "vue";
2
+ import { ScalarIcon as V, ScalarToggle as x } from "@scalar/components";
3
+ const b = {}, N = /* @__PURE__ */ u({
4
+ ...b,
5
+ __name: "WatchModeToggle",
6
+ props: {
7
+ modelValue: { type: Boolean },
8
+ disabled: { type: Boolean, default: !1 }
9
+ },
10
+ emits: ["update:modelValue"],
11
+ setup(s, { emit: n }) {
12
+ const m = n, l = c({
13
+ get: () => s.modelValue,
14
+ set: (e) => m("update:modelValue", e)
15
+ });
16
+ return (e, t) => (p(), i("label", {
17
+ class: o(["text-c-2 flex items-center gap-2 rounded p-3 py-1.5 text-sm select-none", e.disabled ? "cursor-default" : "cursor-pointer"]),
18
+ for: "watch-toggle"
19
+ }, [
20
+ f("span", {
21
+ class: o(["text-c-1 flex items-center gap-1 text-xs font-medium", { "text-c-3": !e.modelValue }])
22
+ }, [
23
+ a(d(V), {
24
+ icon: "Watch",
25
+ size: "sm"
26
+ }),
27
+ t[1] || (t[1] = g(" Watch Mode ", -1))
28
+ ], 2),
29
+ a(d(x), {
30
+ id: "watch-toggle",
31
+ modelValue: l.value,
32
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => l.value = r),
33
+ disabled: e.disabled
34
+ }, null, 8, ["modelValue", "disabled"])
35
+ ], 2));
36
+ }
37
+ });
38
+ export {
39
+ N as default
40
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./WatchModeToggle.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,2 @@
1
+ export { default as TheCommandPalette } from './TheCommandPalette.vue.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { default as t } from "./TheCommandPalette.vue.js";
2
+ export {
3
+ t as TheCommandPalette
4
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Represents parsed details from an OpenAPI or Swagger specification.
3
+ * Used to display information about imported API descriptions in the command palette.
4
+ */
5
+ export type OpenApiDocumentDetails = {
6
+ /** The API specification version (e.g., "OpenAPI 3.1.0" or "Swagger 2.0"). */
7
+ version: string;
8
+ /** The format of the specification document. */
9
+ type: 'json' | 'yaml';
10
+ /** The API title extracted from the info object, if available. */
11
+ title: string | undefined;
12
+ };
13
+ /**
14
+ * Extracts OpenAPI or Swagger specification details from a string.
15
+ * Attempts to parse as JSON first, then YAML if JSON parsing fails.
16
+ *
17
+ * Returns undefined if:
18
+ * - Input is null, empty, or a URL
19
+ * - Input is not a valid JSON or YAML document
20
+ * - Document does not contain OpenAPI or Swagger version information
21
+ */
22
+ export declare const getOpenApiDocumentDetails: (input: string | null) => OpenApiDocumentDetails | undefined;
23
+ //# sourceMappingURL=get-openapi-document-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-openapi-document-details.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-openapi-document-details.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,kEAAkE;IAClE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA;AAmED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,GAAG,IAAI,KAAG,sBAAsB,GAAG,SAazF,CAAA"}
@@ -0,0 +1,31 @@
1
+ import { json as n, yaml as a } from "@scalar/oas-utils/helpers";
2
+ import { isUrl as l } from "../../../helpers/is-url.js";
3
+ const e = (r) => typeof r?.title == "string" ? r.title : void 0, p = (r, t) => {
4
+ if (typeof r.openapi == "string")
5
+ return {
6
+ version: `OpenAPI ${r.openapi}`,
7
+ type: t,
8
+ title: e(r.info)
9
+ };
10
+ if (typeof r.swagger == "string")
11
+ return {
12
+ version: `Swagger ${r.swagger}`,
13
+ type: t,
14
+ title: e(r.info)
15
+ };
16
+ }, s = (r, t, i) => {
17
+ try {
18
+ const o = t(r);
19
+ return p(o, i);
20
+ } catch {
21
+ return;
22
+ }
23
+ }, c = (r) => {
24
+ if (!r || l(r))
25
+ return;
26
+ const t = s(r, n.parse, "json");
27
+ return t || s(r, a.parse, "yaml");
28
+ };
29
+ export {
30
+ c as getOpenApiDocumentDetails
31
+ };
@@ -0,0 +1,13 @@
1
+ import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
+ /**
3
+ * Converts a Postman collection JSON string to an OpenAPI specification document.
4
+ *
5
+ * This function transforms a Postman collection into a valid OpenAPI 3.1 document
6
+ * that can be used throughout the application. The convert function handles parsing
7
+ * and transformation internally.
8
+ *
9
+ * @throws {Error} When the input is not valid JSON or when the conversion fails
10
+ * due to invalid Postman collection structure
11
+ */
12
+ export declare const getOpenApiFromPostman: (postmanJson: string) => OpenAPIV3_1.Document;
13
+ //# sourceMappingURL=get-openapi-from-postman.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-openapi-from-postman.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-openapi-from-postman.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGxD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,KAAG,WAAW,CAAC,QASvE,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { convert as t } from "@scalar/postman-to-openapi";
2
+ const c = (o) => {
3
+ try {
4
+ return t(o);
5
+ } catch (r) {
6
+ const e = r instanceof Error ? r.message : "Unknown error";
7
+ throw new Error(`Failed to convert Postman collection to OpenAPI: ${e}`);
8
+ }
9
+ };
10
+ export {
11
+ c as getOpenApiFromPostman
12
+ };
@@ -0,0 +1,26 @@
1
+ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ /**
4
+ * Represents the result of parsing a cURL command into an OpenAPI operation.
5
+ */
6
+ type CurlOperationResult = {
7
+ /** The URL path extracted from the cURL command. */
8
+ path: string;
9
+ /** The HTTP method (GET, POST, etc.). */
10
+ method: HttpMethod;
11
+ /** The OpenAPI operation object with parameters, body, and servers. */
12
+ operation: OperationObject;
13
+ };
14
+ /**
15
+ * Converts a cURL command string into an OpenAPI operation object.
16
+ *
17
+ * This function parses a cURL command and extracts all relevant information
18
+ * (path, method, headers, query parameters, request body) to create a complete
19
+ * OpenAPI operation that can be used to populate a request in the API client.
20
+ *
21
+ * The exampleKey is used to namespace the example values in the operation object,
22
+ * allowing multiple examples to coexist if needed.
23
+ */
24
+ export declare const getOperationFromCurl: (curl: string, exampleKey?: string) => CurlOperationResult;
25
+ export {};
26
+ //# sourceMappingURL=get-operation-from-curl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-operation-from-curl.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-operation-from-curl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,8DAA8D,CAAA;AAIrE;;GAEG;AACH,KAAK,mBAAmB,GAAG;IACzB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,yCAAyC;IACzC,MAAM,EAAE,UAAU,CAAA;IAClB,uEAAuE;IACvE,SAAS,EAAE,eAAe,CAAA;CAC3B,CAAA;AAuID;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,EAAE,mBAAmB,KAAG,mBAoCxE,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { parseCurlCommand as f } from "../../../../libs/parse-curl.js";
2
+ const b = (t) => {
3
+ try {
4
+ return JSON.parse(t);
5
+ } catch {
6
+ const e = {};
7
+ return t.split("&").forEach((r) => {
8
+ const [n, o] = r.split("=");
9
+ n && o && (e[decodeURIComponent(n)] = decodeURIComponent(o));
10
+ }), e;
11
+ }
12
+ }, j = (t, e) => {
13
+ if (e["Content-Type"])
14
+ return e["Content-Type"];
15
+ const r = t.trim();
16
+ return r.startsWith("{") || r.startsWith("[") ? "application/json" : t.includes("=") && !r.startsWith("{") ? "application/x-www-form-urlencoded" : "";
17
+ }, a = (t) => {
18
+ const e = typeof t;
19
+ return e === "string" ? "string" : e === "number" ? "number" : e === "boolean" ? "boolean" : t === null ? "null" : Array.isArray(t) ? "array" : e === "object" ? "object" : "string";
20
+ }, C = (t, e, r) => {
21
+ const n = Array.isArray(t) ? t.map(({ key: c, value: s }) => ({
22
+ name: c,
23
+ in: "query",
24
+ schema: { type: a(s) },
25
+ examples: {
26
+ [r]: { value: s }
27
+ }
28
+ })) : [], o = Object.entries(e || {}).map(([c, s]) => ({
29
+ name: c,
30
+ in: "header",
31
+ schema: { type: a(s) },
32
+ examples: {
33
+ [r]: { value: s }
34
+ }
35
+ }));
36
+ return [...n, ...o];
37
+ }, g = (t) => ({
38
+ type: "object",
39
+ properties: Object.fromEntries(
40
+ Object.entries(t).map(([r, n]) => [r, { type: a(n) }])
41
+ )
42
+ }), O = (t, e = "curl") => {
43
+ const r = f(t), { method: n = "get", url: o, body: c = "", headers: s = {}, servers: u = [], queryParameters: d = [] } = r, y = new URL(o).pathname, i = j(c, s), p = c ? b(c) : {}, l = C(d, s, e), m = u.map((h) => ({
44
+ url: h
45
+ }));
46
+ return {
47
+ path: y,
48
+ method: n,
49
+ operation: {
50
+ parameters: l,
51
+ requestBody: {
52
+ content: {
53
+ [i]: {
54
+ schema: g(p),
55
+ examples: {
56
+ [e]: { value: p }
57
+ }
58
+ }
59
+ },
60
+ "x-scalar-selected-content-type": {
61
+ [e]: i
62
+ }
63
+ },
64
+ servers: m.length ? m : void 0
65
+ }
66
+ };
67
+ };
68
+ export {
69
+ O as getOperationFromCurl
70
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Represents the extracted details from a Postman collection.
3
+ * Used to display collection metadata in the command palette import UI.
4
+ */
5
+ export type PostmanDocumentDetails = {
6
+ /** The document format type. */
7
+ type: string;
8
+ /** The name of the Postman collection. */
9
+ title: string;
10
+ /** The version of the Postman collection. */
11
+ version: string;
12
+ };
13
+ /**
14
+ * Extracts document details from a Postman collection JSON string.
15
+ *
16
+ * We parse and validate in a single pass to avoid the performance cost
17
+ * of parsing the JSON twice.
18
+ *
19
+ * @param content - The JSON string representing the Postman collection
20
+ * @returns The collection details if valid, null otherwise
21
+ */
22
+ export declare const getPostmanDocumentDetails: (content: string) => PostmanDocumentDetails | null;
23
+ //# sourceMappingURL=get-postman-document-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-postman-document-details.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-postman-document-details.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,MAAM,KAAG,sBAAsB,GAAG,IAgBpF,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { isPostmanCollection as o } from "./is-postman-collection.js";
2
+ const r = (t) => {
3
+ if (!o(t))
4
+ return null;
5
+ try {
6
+ const n = JSON.parse(t);
7
+ return {
8
+ type: "json",
9
+ title: n.info?.name || "Postman Collection",
10
+ version: n.info?.version || "1.0"
11
+ };
12
+ } catch {
13
+ return null;
14
+ }
15
+ };
16
+ export {
17
+ r as getPostmanDocumentDetails
18
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Checks if the given string content is a Postman collection.
3
+ *
4
+ * Validates by checking for the `_postman_id` in the info object
5
+ * and ensuring the schema URL's host matches 'schema.getpostman.com'.
6
+ *
7
+ * @param content - The JSON string which may be a Postman collection
8
+ * @returns True if the content is a valid Postman collection
9
+ */
10
+ export declare const isPostmanCollection: (content: string) => boolean;
11
+ //# sourceMappingURL=is-postman-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-postman-collection.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/is-postman-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,OAWrD,CAAA"}
@@ -0,0 +1,11 @@
1
+ const n = (o) => {
2
+ try {
3
+ const s = JSON.parse(o), t = s.info?._postman_id !== void 0, a = s.info?.schema && new URL(s.info.schema).host === "schema.getpostman.com";
4
+ return t && a;
5
+ } catch {
6
+ return !1;
7
+ }
8
+ };
9
+ export {
10
+ n as isPostmanCollection
11
+ };