@scalar/api-client 2.12.0 → 2.14.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 (184) hide show
  1. package/CHANGELOG.md +66 -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/helpers/oauth.d.ts +2 -2
  55. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  56. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +90 -75
  57. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  58. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -2
  59. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  60. package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
  61. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  62. package/dist/v2/features/app/App.vue.js +126 -103
  63. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +0 -2
  64. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  65. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  66. package/dist/v2/features/app/components/AppSidebar.vue2.js +56 -53
  67. package/dist/v2/features/app/components/DesktopTab.vue.d.ts +26 -0
  68. package/dist/v2/features/app/components/DesktopTab.vue.d.ts.map +1 -0
  69. package/dist/v2/features/app/components/DesktopTab.vue.js +7 -0
  70. package/dist/v2/features/app/components/DesktopTab.vue2.js +134 -0
  71. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +9 -4
  72. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  73. package/dist/v2/features/app/components/DesktopTabs.vue.js +47 -13
  74. package/dist/v2/features/app/components/DesktopTabs.vue2.js +2 -4
  75. package/dist/v2/features/app/components/SplashScreen.vue.js +2 -2
  76. package/dist/v2/features/app/components/SplashScreen.vue2.js +2 -2
  77. package/dist/v2/features/app/helpers/routes.js +1 -1
  78. package/dist/v2/features/collection/components/Settings.vue2.js +3 -3
  79. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +61 -0
  80. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -0
  81. package/dist/v2/features/command-palette/components/CommandActionForm.vue.js +48 -0
  82. package/dist/v2/features/command-palette/components/CommandActionForm.vue2.js +4 -0
  83. package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +39 -0
  84. package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts.map +1 -0
  85. package/dist/v2/features/command-palette/components/CommandActionInput.vue.js +52 -0
  86. package/dist/v2/features/command-palette/components/CommandActionInput.vue2.js +4 -0
  87. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts +36 -0
  88. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +1 -0
  89. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.js +78 -0
  90. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +4 -0
  91. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +30 -0
  92. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -0
  93. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +169 -0
  94. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue2.js +4 -0
  95. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +34 -0
  96. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -0
  97. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +175 -0
  98. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue2.js +4 -0
  99. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts +43 -0
  100. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts.map +1 -0
  101. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +7 -0
  102. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +115 -0
  103. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +39 -0
  104. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -0
  105. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +213 -0
  106. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue2.js +4 -0
  107. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +38 -0
  108. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -0
  109. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +89 -0
  110. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue2.js +4 -0
  111. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts +41 -0
  112. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +1 -0
  113. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.js +7 -0
  114. package/dist/v2/features/command-palette/components/TheCommandPalette.vue2.js +172 -0
  115. package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts +33 -0
  116. package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts.map +1 -0
  117. package/dist/v2/features/command-palette/components/WatchModeToggle.vue.js +40 -0
  118. package/dist/v2/features/command-palette/components/WatchModeToggle.vue2.js +4 -0
  119. package/dist/v2/features/command-palette/components/index.d.ts +2 -0
  120. package/dist/v2/features/command-palette/components/index.d.ts.map +1 -0
  121. package/dist/v2/features/command-palette/components/index.js +4 -0
  122. package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts +23 -0
  123. package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts.map +1 -0
  124. package/dist/v2/features/command-palette/helpers/get-openapi-document-details.js +31 -0
  125. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +13 -0
  126. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -0
  127. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +12 -0
  128. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts +26 -0
  129. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts.map +1 -0
  130. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +70 -0
  131. package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts +23 -0
  132. package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts.map +1 -0
  133. package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +18 -0
  134. package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +11 -0
  135. package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +1 -0
  136. package/dist/v2/features/command-palette/helpers/is-postman-collection.js +11 -0
  137. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +202 -0
  138. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -0
  139. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +109 -0
  140. package/dist/v2/features/command-palette/types.d.ts +82 -0
  141. package/dist/v2/features/command-palette/types.d.ts.map +1 -0
  142. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  143. package/dist/v2/features/operation/Operation.vue.js +24 -20
  144. package/dist/v2/helpers/drag-handle-factory.d.ts +1 -2
  145. package/dist/v2/helpers/drag-handle-factory.d.ts.map +1 -1
  146. package/dist/v2/helpers/drag-handle-factory.js +84 -99
  147. package/dist/v2/helpers/get-tab-details.d.ts +43 -0
  148. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -0
  149. package/dist/v2/helpers/get-tab-details.js +34 -0
  150. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  151. package/dist/v2/helpers/is-url.d.ts +2 -0
  152. package/dist/v2/helpers/is-url.d.ts.map +1 -0
  153. package/dist/v2/helpers/is-url.js +5 -0
  154. package/dist/v2/helpers/remove-circular.d.ts +15 -0
  155. package/dist/v2/helpers/remove-circular.d.ts.map +1 -0
  156. package/dist/v2/helpers/remove-circular.js +18 -0
  157. package/dist/v2/helpers/storage.d.ts +4 -6
  158. package/dist/v2/helpers/storage.d.ts.map +1 -1
  159. package/dist/v2/helpers/storage.js +8 -12
  160. package/dist/v2/hooks/use-sidebar-state.d.ts +12 -19
  161. package/dist/v2/hooks/use-sidebar-state.d.ts.map +1 -1
  162. package/dist/v2/hooks/use-sidebar-state.js +36 -30
  163. package/dist/v2/hooks/use-sync-path.d.ts +11 -0
  164. package/dist/v2/hooks/use-sync-path.d.ts.map +1 -0
  165. package/dist/v2/hooks/use-sync-path.js +51 -0
  166. package/dist/v2/hooks/use-tabs.d.ts +31 -0
  167. package/dist/v2/hooks/use-tabs.d.ts.map +1 -0
  168. package/dist/v2/hooks/use-tabs.js +44 -0
  169. package/dist/v2/hooks/use-workspace-client-events.d.ts +5 -2
  170. package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
  171. package/dist/v2/hooks/use-workspace-client-events.js +91 -36
  172. package/dist/v2/hooks/use-workspace-selector.d.ts +16 -6
  173. package/dist/v2/hooks/use-workspace-selector.d.ts.map +1 -1
  174. package/dist/v2/hooks/use-workspace-selector.js +58 -64
  175. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  176. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +78 -78
  177. package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue.js +29 -29
  178. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  179. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +2 -2
  180. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +19 -19
  181. package/dist/views/Request/libs/oauth2.d.ts +2 -2
  182. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  183. package/dist/views/Request/libs/oauth2.js +66 -53
  184. package/package.json +134 -44
@@ -0,0 +1,213 @@
1
+ import { defineComponent as I, ref as p, computed as v, createBlock as f, openBlock as m, withCtx as o, createVNode as n, createTextVNode as O, createElementVNode as r, unref as s, normalizeClass as D, toDisplayString as b, createCommentVNode as H, createElementBlock as T, Fragment as V, renderList as y } from "vue";
2
+ import { ScalarListbox as L, ScalarButton as x, ScalarIcon as w, ScalarDropdown as z, ScalarDropdownItem as B } from "@scalar/components";
3
+ import { HTTP_METHODS as W } from "@scalar/helpers/http/http-methods";
4
+ import { useRouter as F } from "vue-router";
5
+ import N from "../../../blocks/operation-code-sample/components/HttpMethod.vue.js";
6
+ import A from "./CommandActionForm.vue.js";
7
+ import G from "./CommandActionInput.vue.js";
8
+ const J = { class: "flex flex-1 gap-1" }, K = { class: "flex items-center gap-2" }, Q = { class: "custom-scroll max-h-40" }, X = { class: "custom-scroll max-h-40" }, Y = { class: "truncate" }, Z = {
9
+ name: "CommandPaletteRequest"
10
+ }, ue = /* @__PURE__ */ I({
11
+ ...Z,
12
+ props: {
13
+ workspaceStore: {},
14
+ eventBus: {}
15
+ },
16
+ emits: ["close", "back"],
17
+ setup(i, { emit: $ }) {
18
+ const k = $, P = F(), h = p("/"), u = v(() => h.value.trim()), S = v(
19
+ () => Object.entries(i.workspaceStore.workspace.documents).map(
20
+ ([e, a]) => ({
21
+ id: e,
22
+ label: a.info.title || e
23
+ })
24
+ )
25
+ ), _ = W.map((e) => ({
26
+ id: e,
27
+ label: e.toUpperCase(),
28
+ method: e
29
+ })), t = p(
30
+ S.value[0] ?? void 0
31
+ ), c = p(
32
+ _.find((e) => e.method === "get")
33
+ ), d = p(void 0), g = v(() => {
34
+ if (!t.value)
35
+ return [];
36
+ const e = i.workspaceStore.workspace.documents[t.value.id];
37
+ return e ? [
38
+ { id: "", label: "No Tag" },
39
+ ...e.tags?.map((a) => ({
40
+ id: a.name,
41
+ label: a.name
42
+ })) ?? []
43
+ ] : [];
44
+ }), j = v(() => {
45
+ if (!t.value || !c.value || !u.value)
46
+ return !1;
47
+ const e = i.workspaceStore.workspace.documents[t.value.id], a = u.value.startsWith("/") ? u.value : `/${u.value}`;
48
+ return !!e?.paths?.[a]?.[c.value.method];
49
+ }), C = v(() => !!(!u.value || !t.value || !c.value || j.value)), q = (e) => {
50
+ e && (c.value = e);
51
+ }, E = (e) => {
52
+ e && (d.value = e);
53
+ }, R = () => {
54
+ C.value || !t.value || !c.value || !i.workspaceStore.workspace.documents[t.value.id] || (i.eventBus.emit("operation:create:operation", {
55
+ documentName: t.value.id,
56
+ path: u.value,
57
+ method: c.value.method,
58
+ operation: {
59
+ tags: d.value?.id ? [d.value.id] : void 0
60
+ },
61
+ callback: (a) => {
62
+ if (a) {
63
+ i.workspaceStore.buildSidebar(t.value?.id ?? "");
64
+ const l = u.value.startsWith("/") ? u.value : `/${u.value}`;
65
+ P.push({
66
+ name: "example",
67
+ params: {
68
+ documentSlug: t.value?.id,
69
+ pathEncoded: encodeURIComponent(l),
70
+ method: c.value?.method,
71
+ exampleName: "default"
72
+ }
73
+ });
74
+ }
75
+ }
76
+ }), k("close"));
77
+ }, M = (e) => {
78
+ k("back", e);
79
+ };
80
+ return (e, a) => (m(), f(A, {
81
+ disabled: C.value,
82
+ onSubmit: R
83
+ }, {
84
+ options: o(() => [
85
+ r("div", J, [
86
+ n(s(L), {
87
+ modelValue: t.value,
88
+ "onUpdate:modelValue": a[1] || (a[1] = (l) => t.value = l),
89
+ options: S.value
90
+ }, {
91
+ default: o(() => [
92
+ n(s(x), {
93
+ class: "hover:bg-b-2 max-h-8 w-[150px] min-w-[150px] justify-between gap-1 p-2 text-xs",
94
+ variant: "outlined"
95
+ }, {
96
+ default: o(() => [
97
+ r("span", {
98
+ class: D(t.value ? "text-c-1 truncate" : "text-c-3")
99
+ }, b(t.value ? t.value.label : "Select Document"), 3),
100
+ n(s(w), {
101
+ class: "text-c-3",
102
+ icon: "ChevronDown",
103
+ size: "md"
104
+ })
105
+ ]),
106
+ _: 1
107
+ })
108
+ ]),
109
+ _: 1
110
+ }, 8, ["modelValue", "options"]),
111
+ n(s(z), {
112
+ placement: "bottom",
113
+ resize: ""
114
+ }, {
115
+ items: o(() => [
116
+ r("div", Q, [
117
+ (m(!0), T(V, null, y(s(_), (l) => (m(), f(s(B), {
118
+ key: l.id,
119
+ class: "flex h-7 w-full items-center justify-center px-1",
120
+ onClick: (U) => q(l)
121
+ }, {
122
+ default: o(() => [
123
+ n(N, {
124
+ method: l.method
125
+ }, null, 8, ["method"])
126
+ ]),
127
+ _: 2
128
+ }, 1032, ["onClick"]))), 128))
129
+ ])
130
+ ]),
131
+ default: o(() => [
132
+ n(s(x), {
133
+ class: "hover:bg-b-2 max-h-8 w-[100px] min-w-[100px] justify-between gap-1 p-2 text-xs",
134
+ variant: "outlined"
135
+ }, {
136
+ default: o(() => [
137
+ r("div", K, [
138
+ c.value ? (m(), f(N, {
139
+ key: 0,
140
+ method: c.value.method
141
+ }, null, 8, ["method"])) : H("", !0),
142
+ n(s(w), {
143
+ class: "text-c-3",
144
+ icon: "ChevronDown",
145
+ size: "md"
146
+ })
147
+ ])
148
+ ]),
149
+ _: 1
150
+ })
151
+ ]),
152
+ _: 1
153
+ }),
154
+ n(s(z), {
155
+ placement: "bottom",
156
+ resize: ""
157
+ }, {
158
+ items: o(() => [
159
+ r("div", X, [
160
+ (m(!0), T(V, null, y(g.value, (l) => (m(), f(s(B), {
161
+ key: l.id,
162
+ class: "flex h-7 w-full items-center px-1",
163
+ onClick: (U) => E(l)
164
+ }, {
165
+ default: o(() => [
166
+ r("span", Y, b(l.label), 1)
167
+ ]),
168
+ _: 2
169
+ }, 1032, ["onClick"]))), 128))
170
+ ])
171
+ ]),
172
+ default: o(() => [
173
+ n(s(x), {
174
+ class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
175
+ disabled: !g.value.length,
176
+ variant: "outlined"
177
+ }, {
178
+ default: o(() => [
179
+ r("span", {
180
+ class: D(d.value ? "text-c-1 truncate" : "text-c-3")
181
+ }, b(d.value ? d.value.label : "Select Tag (Optional)"), 3),
182
+ n(s(w), {
183
+ class: "text-c-3",
184
+ icon: "ChevronDown",
185
+ size: "md"
186
+ })
187
+ ]),
188
+ _: 1
189
+ }, 8, ["disabled"])
190
+ ]),
191
+ _: 1
192
+ })
193
+ ])
194
+ ]),
195
+ submit: o(() => [...a[2] || (a[2] = [
196
+ O("Create Request", -1)
197
+ ])]),
198
+ default: o(() => [
199
+ n(G, {
200
+ modelValue: h.value,
201
+ "onUpdate:modelValue": a[0] || (a[0] = (l) => h.value = l),
202
+ label: "Request Path",
203
+ placeholder: "/users",
204
+ onDelete: M
205
+ }, null, 8, ["modelValue"])
206
+ ]),
207
+ _: 1
208
+ }, 8, ["disabled"]));
209
+ }
210
+ });
211
+ export {
212
+ ue as default
213
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./CommandPaletteRequest.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,38 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
+ /**
4
+ * Command Palette Tag Component
5
+ *
6
+ * Provides a form for creating a new tag in a document (collection).
7
+ * Tags are used to organize and group related API operations.
8
+ *
9
+ * Validates that the tag name does not already exist in the selected document
10
+ * to prevent duplicates.
11
+ *
12
+ * @example
13
+ * <CommandPaletteTag
14
+ * :workspaceStore="workspaceStore"
15
+ * :eventBus="eventBus"
16
+ * @close="handleClose"
17
+ * @back="handleBack"
18
+ * />
19
+ */
20
+ declare const _default: import("vue").DefineComponent<{
21
+ /** The workspace store for accessing documents and tags */
22
+ workspaceStore: WorkspaceStore;
23
+ /** Event bus for emitting tag creation events */
24
+ eventBus: WorkspaceEventBus;
25
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
26
+ close: () => any;
27
+ back: (keyboardEvent: KeyboardEvent) => any;
28
+ }, string, import("vue").PublicProps, Readonly<{
29
+ /** The workspace store for accessing documents and tags */
30
+ workspaceStore: WorkspaceStore;
31
+ /** Event bus for emitting tag creation events */
32
+ eventBus: WorkspaceEventBus;
33
+ }> & Readonly<{
34
+ onClose?: (() => any) | undefined;
35
+ onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
36
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ export default _default;
38
+ //# sourceMappingURL=CommandPaletteTag.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPaletteTag.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteTag.vue"],"names":[],"mappings":"AA4JA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAOvE;;;;;;;;;;;;;;;;GAgBG;;IAGD,2DAA2D;oBAC3C,cAAc;IAC9B,iDAAiD;cACvC,iBAAiB;;;;;IAH3B,2DAA2D;oBAC3C,cAAc;IAC9B,iDAAiD;cACvC,iBAAiB;;;;;AAL7B,wBA8OC"}
@@ -0,0 +1,89 @@
1
+ import { defineComponent as S, ref as f, computed as i, createBlock as x, openBlock as g, withCtx as l, createVNode as n, createTextVNode as w, unref as m, createElementVNode as V, normalizeClass as C, toDisplayString as B } from "vue";
2
+ import { ScalarListbox as D, ScalarButton as N, ScalarIcon as T } from "@scalar/components";
3
+ import _ from "./CommandActionForm.vue.js";
4
+ import h from "./CommandActionInput.vue.js";
5
+ const j = {
6
+ name: "CommandPaletteTag"
7
+ }, E = /* @__PURE__ */ S({
8
+ ...j,
9
+ props: {
10
+ workspaceStore: {},
11
+ eventBus: {}
12
+ },
13
+ emits: ["close", "back"],
14
+ setup(o, { emit: p }) {
15
+ const c = p, u = f(""), r = i(() => u.value.trim()), d = i(
16
+ () => Object.entries(o.workspaceStore.workspace.documents).map(
17
+ ([t, a]) => ({
18
+ id: t,
19
+ label: a.info.title || t
20
+ })
21
+ )
22
+ ), e = f(
23
+ d.value[0] ?? void 0
24
+ ), v = i(() => {
25
+ if (!r.value || !e.value)
26
+ return !0;
27
+ const t = o.workspaceStore.workspace.documents[e.value.id];
28
+ return !!(!t || t.tags?.some((a) => a.name === r.value));
29
+ }), b = () => {
30
+ v.value || !e.value || (o.eventBus.emit("tag:create:tag", {
31
+ name: r.value,
32
+ documentName: e.value.id,
33
+ callback: (t) => {
34
+ t && o.workspaceStore.buildSidebar(e.value?.id ?? "");
35
+ }
36
+ }), c("close"));
37
+ }, k = (t) => {
38
+ c("back", t);
39
+ };
40
+ return (t, a) => (g(), x(_, {
41
+ disabled: v.value,
42
+ onSubmit: b
43
+ }, {
44
+ options: l(() => [
45
+ n(m(D), {
46
+ modelValue: e.value,
47
+ "onUpdate:modelValue": a[1] || (a[1] = (s) => e.value = s),
48
+ options: d.value
49
+ }, {
50
+ default: l(() => [
51
+ n(m(N), {
52
+ class: "hover:bg-b-2 max-h-8 w-fit justify-between gap-1 p-2 text-xs",
53
+ variant: "outlined"
54
+ }, {
55
+ default: l(() => [
56
+ V("span", {
57
+ class: C(e.value ? "text-c-1" : "text-c-3")
58
+ }, B(e.value ? e.value.label : "Select Collection"), 3),
59
+ n(m(T), {
60
+ class: "text-c-3",
61
+ icon: "ChevronDown",
62
+ size: "md"
63
+ })
64
+ ]),
65
+ _: 1
66
+ })
67
+ ]),
68
+ _: 1
69
+ }, 8, ["modelValue", "options"])
70
+ ]),
71
+ submit: l(() => [...a[2] || (a[2] = [
72
+ w("Create Tag", -1)
73
+ ])]),
74
+ default: l(() => [
75
+ n(h, {
76
+ modelValue: u.value,
77
+ "onUpdate:modelValue": a[0] || (a[0] = (s) => u.value = s),
78
+ label: "Tag Name",
79
+ placeholder: "Tag Name",
80
+ onDelete: k
81
+ }, null, 8, ["modelValue"])
82
+ ]),
83
+ _: 1
84
+ }, 8, ["disabled"]));
85
+ }
86
+ });
87
+ export {
88
+ E as default
89
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./CommandPaletteTag.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,41 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
+ import type { UseCommandPaletteStateReturn } from '../../../../v2/features/command-palette/hooks/use-command-palette-state.js';
4
+ /**
5
+ * The Command Palette Component
6
+ *
7
+ * A keyboard-driven command menu for quick access to common actions like:
8
+ * - Creating documents, requests, tags, and examples
9
+ * - Importing from OpenAPI, Swagger, Postman, or cURL
10
+ * - Navigating to different routes
11
+ *
12
+ * Supports:
13
+ * - Fuzzy search filtering
14
+ * - Keyboard navigation (arrow keys, enter, escape)
15
+ * - Command grouping and organization
16
+ * - Dynamic command components with props
17
+ *
18
+ * @example
19
+ * <TheCommandPalette
20
+ * :paletteState="paletteState"
21
+ * :workspaceStore="workspaceStore"
22
+ * :eventBus="eventBus"
23
+ * />
24
+ */
25
+ declare const _default: import("vue").DefineComponent<{
26
+ /** The command palette state management hook */
27
+ paletteState: UseCommandPaletteStateReturn;
28
+ /** The workspace store for accessing documents and operations */
29
+ workspaceStore: WorkspaceStore;
30
+ /** Event bus for emitting workspace events */
31
+ eventBus: WorkspaceEventBus;
32
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
33
+ /** The command palette state management hook */
34
+ paletteState: UseCommandPaletteStateReturn;
35
+ /** The workspace store for accessing documents and operations */
36
+ workspaceStore: WorkspaceStore;
37
+ /** Event bus for emitting workspace events */
38
+ eventBus: WorkspaceEventBus;
39
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
+ export default _default;
41
+ //# sourceMappingURL=TheCommandPalette.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/TheCommandPalette.vue"],"names":[],"mappings":"AAoXA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE,OAAO,KAAK,EAKV,4BAA4B,EAC7B,MAAM,+DAA+D,CAAA;AAItE;;;;;;;;;;;;;;;;;;;;GAoBG;;IAGD,gDAAgD;kBAClC,4BAA4B;IAC1C,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;IAL3B,gDAAgD;kBAClC,4BAA4B;IAC1C,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;AAP7B,wBA8dC"}
@@ -0,0 +1,7 @@
1
+ import o from "./TheCommandPalette.vue2.js";
2
+ /* empty css */
3
+ import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7f3e459b"]]);
5
+ export {
6
+ r as default
7
+ };
@@ -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"}