@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 @@
1
+ {"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteExample.vue"],"names":[],"mappings":"AAoRA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAcpE;;;;;;;;;;;;;GAaG;;IAGD,iEAAiE;oBACjD,cAAc;;;;;IAD9B,iEAAiE;oBACjD,cAAc;;;;;AAHhC,wBAubC"}
@@ -0,0 +1,169 @@
1
+ import { defineComponent as O, ref as v, computed as m, watch as j, createBlock as f, openBlock as u, withCtx as n, createVNode as s, createTextVNode as z, createElementVNode as i, unref as c, normalizeClass as U, toDisplayString as h, createElementBlock as x, createCommentVNode as I, Fragment as L, renderList as R } from "vue";
2
+ import { ScalarListbox as T, ScalarButton as C, ScalarIcon as y, ScalarDropdown as A, ScalarDropdownItem as F } from "@scalar/components";
3
+ import { useRouter as P } from "vue-router";
4
+ import D from "../../../blocks/operation-code-sample/components/HttpMethod.vue.js";
5
+ import q from "./CommandActionForm.vue.js";
6
+ import G from "./CommandActionInput.vue.js";
7
+ const H = { class: "flex flex-1 gap-1" }, J = {
8
+ key: 0,
9
+ class: "text-c-1 truncate"
10
+ }, K = {
11
+ key: 1,
12
+ class: "text-c-3"
13
+ }, M = { class: "flex items-center gap-2" }, Q = { class: "custom-scroll max-h-40" }, W = { class: "truncate" }, X = {
14
+ name: "CommandPaletteExample"
15
+ }, oe = /* @__PURE__ */ O({
16
+ ...X,
17
+ props: {
18
+ workspaceStore: {}
19
+ },
20
+ emits: ["close", "back"],
21
+ setup(b, { emit: V }) {
22
+ const _ = V, N = P(), d = v(""), w = m(() => d.value.trim()), k = m(
23
+ () => Object.entries(b.workspaceStore.workspace.documents).map(
24
+ ([t, a]) => ({
25
+ id: t,
26
+ label: a.info.title || t
27
+ })
28
+ )
29
+ ), l = v(
30
+ k.value[0] ?? void 0
31
+ ), o = v(void 0), g = (t) => {
32
+ const a = [];
33
+ for (const e of t)
34
+ e.type === "operation" && a.push(e), "children" in e && e.children && a.push(...g(e.children));
35
+ return a;
36
+ }, p = m(() => {
37
+ if (!l.value)
38
+ return [];
39
+ const t = b.workspaceStore.workspace.documents[l.value.id];
40
+ if (!t || !t["x-scalar-navigation"])
41
+ return [];
42
+ const a = t["x-scalar-navigation"];
43
+ return g(a.children ?? []).map((r) => ({
44
+ id: r.id,
45
+ label: `${r.method.toUpperCase()} ${r.path}`,
46
+ path: r.path,
47
+ method: r.method
48
+ }));
49
+ });
50
+ j(
51
+ l,
52
+ () => {
53
+ o.value = p.value[0] ?? void 0;
54
+ },
55
+ { immediate: !0 }
56
+ );
57
+ const E = (t) => {
58
+ t && (o.value = t);
59
+ }, S = m(() => !w.value || !l.value || !o.value), $ = () => {
60
+ S.value || !l.value || !o.value || (N.push({
61
+ name: "example",
62
+ params: {
63
+ documentSlug: l.value.id,
64
+ pathEncoded: encodeURIComponent(o.value.path),
65
+ method: o.value.method,
66
+ exampleName: w.value
67
+ }
68
+ }), _("close"));
69
+ }, B = (t) => {
70
+ _("back", t);
71
+ };
72
+ return (t, a) => (u(), f(q, {
73
+ disabled: S.value,
74
+ onSubmit: $
75
+ }, {
76
+ options: n(() => [
77
+ i("div", H, [
78
+ s(c(T), {
79
+ modelValue: l.value,
80
+ "onUpdate:modelValue": a[1] || (a[1] = (e) => l.value = e),
81
+ options: k.value
82
+ }, {
83
+ default: n(() => [
84
+ s(c(C), {
85
+ class: "hover:bg-b-2 max-h-8 w-[150px] min-w-[150px] justify-between gap-1 p-2 text-xs",
86
+ variant: "outlined"
87
+ }, {
88
+ default: n(() => [
89
+ i("span", {
90
+ class: U(l.value ? "text-c-1 truncate" : "text-c-3")
91
+ }, h(l.value ? l.value.label : "Select Document"), 3),
92
+ s(c(y), {
93
+ class: "text-c-3",
94
+ icon: "ChevronDown",
95
+ size: "md"
96
+ })
97
+ ]),
98
+ _: 1
99
+ })
100
+ ]),
101
+ _: 1
102
+ }, 8, ["modelValue", "options"]),
103
+ s(c(A), {
104
+ placement: "bottom",
105
+ resize: ""
106
+ }, {
107
+ items: n(() => [
108
+ i("div", Q, [
109
+ (u(!0), x(L, null, R(p.value, (e) => (u(), f(c(F), {
110
+ key: e.id,
111
+ class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
112
+ onClick: (r) => E(e)
113
+ }, {
114
+ default: n(() => [
115
+ i("span", W, h(e.path), 1),
116
+ s(D, {
117
+ method: e.method
118
+ }, null, 8, ["method"])
119
+ ]),
120
+ _: 2
121
+ }, 1032, ["onClick"]))), 128))
122
+ ])
123
+ ]),
124
+ default: n(() => [
125
+ s(c(C), {
126
+ class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
127
+ disabled: !p.value.length,
128
+ variant: "outlined"
129
+ }, {
130
+ default: n(() => [
131
+ o.value ? (u(), x("span", J, h(o.value.path), 1)) : (u(), x("span", K, " Select Operation ")),
132
+ i("div", M, [
133
+ o.value ? (u(), f(D, {
134
+ key: 0,
135
+ method: o.value.method
136
+ }, null, 8, ["method"])) : I("", !0),
137
+ s(c(y), {
138
+ class: "text-c-3",
139
+ icon: "ChevronDown",
140
+ size: "md"
141
+ })
142
+ ])
143
+ ]),
144
+ _: 1
145
+ }, 8, ["disabled"])
146
+ ]),
147
+ _: 1
148
+ })
149
+ ])
150
+ ]),
151
+ submit: n(() => [...a[2] || (a[2] = [
152
+ z("Create Example", -1)
153
+ ])]),
154
+ default: n(() => [
155
+ s(G, {
156
+ modelValue: d.value,
157
+ "onUpdate:modelValue": a[0] || (a[0] = (e) => d.value = e),
158
+ label: "Example Name",
159
+ placeholder: "Example Name",
160
+ onDelete: B
161
+ }, null, 8, ["modelValue"])
162
+ ]),
163
+ _: 1
164
+ }, 8, ["disabled"]));
165
+ }
166
+ });
167
+ export {
168
+ oe as default
169
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./CommandPaletteExample.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,34 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ /**
3
+ * Command Palette Import Component
4
+ *
5
+ * Provides a form for importing API specifications from various sources:
6
+ * - OpenAPI/Swagger documents (URL, file, or pasted JSON/YAML)
7
+ * - Postman collections (URL, file, or pasted JSON)
8
+ * - cURL commands (automatically redirects to cURL import command)
9
+ *
10
+ * Supports watch mode for URL imports to automatically update when content changes.
11
+ *
12
+ * @example
13
+ * <CommandPaletteImport
14
+ * :workspaceStore="workspaceStore"
15
+ * @close="handleClose"
16
+ * @back="handleBack"
17
+ * @open-command="handleOpenCommand"
18
+ * />
19
+ */
20
+ declare const _default: import("vue").DefineComponent<{
21
+ /** The workspace store for adding documents */
22
+ workspaceStore: WorkspaceStore;
23
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ [x: string]: any;
25
+ } & {
26
+ [x: string]: any;
27
+ }, string, import("vue").PublicProps, Readonly<{
28
+ /** The workspace store for adding documents */
29
+ workspaceStore: WorkspaceStore;
30
+ }> & Readonly<{
31
+ [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ export default _default;
34
+ //# sourceMappingURL=CommandPaletteImport.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImport.vue"],"names":[],"mappings":"AAmYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAmBpE;;;;;;;;;;;;;;;;;GAiBG;;IAMD,+CAA+C;oBAC/B,cAAc;;;;;;IAD9B,+CAA+C;oBAC/B,cAAc;;;;AANhC,wBAogBC"}
@@ -0,0 +1,175 @@
1
+ import { defineComponent as z, ref as L, computed as k, watch as J, createBlock as S, openBlock as a, unref as l, withCtx as m, createElementBlock as d, Fragment as p, createElementVNode as C, createCommentVNode as X, createVNode as v, createTextVNode as r, toDisplayString as P } from "vue";
2
+ import { useLoadingState as Y, ScalarButton as R, ScalarCodeBlock as G, ScalarIcon as H, ScalarTooltip as K } from "@scalar/components";
3
+ import { normalize as Q } from "@scalar/openapi-parser";
4
+ import { generateUniqueValue as Z } from "@scalar/workspace-store/helpers/generate-unique-value";
5
+ import { useRouter as ee } from "vue-router";
6
+ import { getOpenApiDocumentDetails as te } from "../helpers/get-openapi-document-details.js";
7
+ import { getOpenApiFromPostman as oe } from "../helpers/get-openapi-from-postman.js";
8
+ import { getPostmanDocumentDetails as ae } from "../helpers/get-postman-document-details.js";
9
+ import { isPostmanCollection as V } from "../helpers/is-postman-collection.js";
10
+ import { isUrl as F } from "../../../helpers/is-url.js";
11
+ import { slugify as ne } from "../../../helpers/slugify.js";
12
+ import se from "./CommandActionForm.vue.js";
13
+ import le from "./CommandActionInput.vue.js";
14
+ import re from "./WatchModeToggle.vue.js";
15
+ import { useFileDialog as ie } from "../../../../hooks/useFileDialog.js";
16
+ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-row items-center justify-between gap-3" }, me = {
17
+ name: "CommandPaletteImport"
18
+ }, Ie = /* @__PURE__ */ z({
19
+ ...me,
20
+ props: {
21
+ workspaceStore: {}
22
+ },
23
+ emits: ["close", "back", "open-command"],
24
+ setup(g, { emit: T }) {
25
+ const w = T, E = 100, b = "document", O = ee(), y = Y(), o = L(""), x = L(!0), i = k(() => F(o.value)), n = k(() => V(o.value) ? ae(o.value) : te(o.value)), U = k(
26
+ () => n.value ? n.value.type : "json"
27
+ ), _ = k(() => !o.value.trim());
28
+ J(i, (e) => {
29
+ x.value = e;
30
+ });
31
+ const j = (e) => !Object.keys(g.workspaceStore.workspace.documents).includes(e), h = async (e) => await Z({
32
+ defaultValue: e,
33
+ validation: j,
34
+ maxRetries: E,
35
+ transformation: ne
36
+ }), q = (e) => typeof e.info == "object" && e.info !== null && "title" in e.info && typeof e.info.title == "string" ? e.info.title : b, A = async (e) => {
37
+ if (F(e)) {
38
+ const s = await h(b);
39
+ return s ? { success: await g.workspaceStore.addDocument({
40
+ name: s,
41
+ url: e,
42
+ meta: {
43
+ "x-scalar-watch-mode": x.value
44
+ }
45
+ }), name: s } : (console.error("Failed to generate a unique name"), { success: !1 });
46
+ }
47
+ if (V(e)) {
48
+ const s = oe(e), f = s.info?.title ?? b, D = await h(f);
49
+ return D ? { success: await g.workspaceStore.addDocument({
50
+ name: D,
51
+ document: s
52
+ }), name: D } : (console.error("Failed to generate a unique name"), { success: !1 });
53
+ }
54
+ const t = Q(e), c = q(t), u = await h(c);
55
+ return u ? { success: await g.workspaceStore.addDocument({
56
+ name: u,
57
+ document: t
58
+ }), name: u } : (console.error("Failed to generate a unique name"), { success: !1 });
59
+ }, I = (e) => {
60
+ O.push({
61
+ name: "document.overview",
62
+ params: { documentSlug: e }
63
+ });
64
+ }, { open: B } = ie({
65
+ onChange: (e) => {
66
+ const [t] = e ?? [];
67
+ if (!t)
68
+ return;
69
+ const c = async (N) => {
70
+ const s = N.target?.result, f = await A(s);
71
+ f.success && I(f.name), w("close");
72
+ }, u = new FileReader();
73
+ u.onload = c, u.readAsText(t);
74
+ },
75
+ multiple: !1,
76
+ accept: ".json,.yaml,.yml"
77
+ }), M = async () => {
78
+ y.start();
79
+ const e = await A(o.value);
80
+ e.success ? (await y.clear(), I(e.name)) : await y.invalidate(), w("close");
81
+ }, W = (e) => {
82
+ if (e.trim().toLowerCase().startsWith("curl"))
83
+ return w("open-command", "import-curl-command", { curl: e });
84
+ o.value = e;
85
+ }, $ = (e) => {
86
+ w("back", e);
87
+ };
88
+ return (e, t) => (a(), S(se, {
89
+ disabled: _.value,
90
+ loader: l(y),
91
+ onSubmit: M
92
+ }, {
93
+ options: m(() => [
94
+ C("div", ue, [
95
+ v(l(R), {
96
+ class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
97
+ variant: "outlined",
98
+ onClick: l(B)
99
+ }, {
100
+ default: m(() => [
101
+ t[4] || (t[4] = r(" JSON, or YAML File ", -1)),
102
+ v(l(H), {
103
+ class: "text-c-3",
104
+ icon: "Upload",
105
+ size: "md"
106
+ })
107
+ ]),
108
+ _: 1
109
+ }, 8, ["onClick"]),
110
+ v(l(K), {
111
+ content: i.value ? "Watch mode automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date." : "Watch mode is only available for URL imports. When enabled it automatically updates the API client when the OpenAPI URL content changes.",
112
+ placement: "bottom"
113
+ }, {
114
+ default: m(() => [
115
+ v(re, {
116
+ modelValue: x.value,
117
+ "onUpdate:modelValue": t[1] || (t[1] = (c) => x.value = c),
118
+ disabled: !i.value
119
+ }, null, 8, ["modelValue", "disabled"])
120
+ ]),
121
+ _: 1
122
+ }, 8, ["content"])
123
+ ])
124
+ ]),
125
+ submit: m(() => [
126
+ t[5] || (t[5] = r(" Import ", -1)),
127
+ i.value ? (a(), d(p, { key: 0 }, [
128
+ r("from URL")
129
+ ], 64)) : n.value && U.value ? (a(), d(p, { key: 1 }, [
130
+ n.value.title ? (a(), d(p, { key: 0 }, [
131
+ r(' "' + P(n.value.title) + '" ', 1)
132
+ ], 64)) : (a(), d(p, { key: 1 }, [
133
+ r(P(n.value.version), 1)
134
+ ], 64))
135
+ ], 64)) : (a(), d(p, { key: 2 }, [
136
+ r("Collection")
137
+ ], 64))
138
+ ]),
139
+ default: m(() => [
140
+ !n.value || i.value ? (a(), S(le, {
141
+ key: 0,
142
+ modelValue: o.value,
143
+ placeholder: "OpenAPI/Swagger/Postman URL or cURL",
144
+ onDelete: $,
145
+ "onUpdate:modelValue": W
146
+ }, null, 8, ["modelValue"])) : (a(), d(p, { key: 1 }, [
147
+ C("div", ce, [
148
+ t[3] || (t[3] = C("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
149
+ v(l(R), {
150
+ class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
151
+ variant: "ghost",
152
+ onClick: t[0] || (t[0] = (c) => o.value = "")
153
+ }, {
154
+ default: m(() => [...t[2] || (t[2] = [
155
+ r(" Clear ", -1)
156
+ ])]),
157
+ _: 1
158
+ })
159
+ ]),
160
+ n.value && !i.value ? (a(), S(l(G), {
161
+ key: 0,
162
+ class: "bg-b-2 mt-1 max-h-[40dvh] rounded border px-2 py-1 text-sm",
163
+ content: o.value,
164
+ copy: !1,
165
+ lang: U.value
166
+ }, null, 8, ["content", "lang"])) : X("", !0)
167
+ ], 64))
168
+ ]),
169
+ _: 1
170
+ }, 8, ["disabled", "loader"]));
171
+ }
172
+ });
173
+ export {
174
+ Ie as default
175
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./CommandPaletteImport.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,43 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
+ /**
4
+ * Command Palette Import cURL Component
5
+ *
6
+ * Provides a form for importing API requests from cURL commands.
7
+ * Parses the cURL command to extract the HTTP method, URL, path, headers,
8
+ * and body, then creates a new operation in the selected document.
9
+ *
10
+ * Validates that no conflicting operation exists at the same path/method.
11
+ *
12
+ * @example
13
+ * <CommandPaletteImportCurl
14
+ * :workspaceStore="workspaceStore"
15
+ * :eventBus="eventBus"
16
+ * :curl="curlCommand"
17
+ * @close="handleClose"
18
+ * @back="handleBack"
19
+ * />
20
+ */
21
+ declare const _default: import("vue").DefineComponent<{
22
+ /** The workspace store for accessing documents and operations */
23
+ workspaceStore: WorkspaceStore;
24
+ /** Event bus for emitting operation creation events */
25
+ eventBus: WorkspaceEventBus;
26
+ /** The cURL command string to parse and import */
27
+ curl: string;
28
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
29
+ close: () => any;
30
+ back: (keyboardEvent: KeyboardEvent) => any;
31
+ }, string, import("vue").PublicProps, Readonly<{
32
+ /** The workspace store for accessing documents and operations */
33
+ workspaceStore: WorkspaceStore;
34
+ /** Event bus for emitting operation creation events */
35
+ eventBus: WorkspaceEventBus;
36
+ /** The cURL command string to parse and import */
37
+ curl: string;
38
+ }> & Readonly<{
39
+ onClose?: (() => any) | undefined;
40
+ onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
41
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ export default _default;
43
+ //# sourceMappingURL=CommandPaletteImportCurl.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPaletteImportCurl.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImportCurl.vue"],"names":[],"mappings":"AAuOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE;;;;;;;;;;;;;;;;;GAiBG;;IAGD,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;IAC3B,kDAAkD;UAC5C,MAAM;;;;;IALZ,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;IAC3B,kDAAkD;UAC5C,MAAM;;;;;AAPd,wBA2TC"}
@@ -0,0 +1,7 @@
1
+ import o from "./CommandPaletteImportCurl.vue2.js";
2
+ /* empty css */
3
+ import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-981120f2"]]);
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,115 @@
1
+ import { defineComponent as y, ref as b, computed as i, createBlock as B, openBlock as N, withCtx as r, createVNode as n, createElementVNode as m, unref as l, toDisplayString as d, createTextVNode as D, normalizeClass as I } from "vue";
2
+ import { ScalarListbox as $, ScalarButton as K, ScalarIcon as R } from "@scalar/components";
3
+ import { useRouter as U } from "vue-router";
4
+ import j from "../../../blocks/operation-code-sample/components/HttpMethod.vue.js";
5
+ import z from "./CommandActionForm.vue.js";
6
+ import E from "./CommandActionInput.vue.js";
7
+ import { getOperationFromCurl as k } from "../helpers/get-operation-from-curl.js";
8
+ const O = { class: "flex flex-1 flex-col gap-2" }, T = { class: "flex h-9 flex-row items-center gap-2 rounded border p-[3px] text-sm" }, q = { class: "scroll-timeline-x whitespace-nowrap" }, F = { class: "flex items-center gap-2" }, L = {
9
+ name: "CommandPaletteImportCurl"
10
+ }, Q = /* @__PURE__ */ y({
11
+ ...L,
12
+ props: {
13
+ workspaceStore: {},
14
+ eventBus: {},
15
+ curl: {}
16
+ },
17
+ emits: ["close", "back"],
18
+ setup(a, { emit: w }) {
19
+ const p = w, S = U(), u = b(""), c = i(() => u.value.trim()), { path: f, method: v, operation: C } = k(a.curl), x = i(
20
+ () => Object.keys(a.workspaceStore.workspace.documents).map((t) => ({
21
+ id: t,
22
+ label: t
23
+ }))
24
+ ), o = b(
25
+ x.value[0]
26
+ ), h = i(() => !!(!c.value || !o.value || a.workspaceStore.workspace.documents[o.value.id]?.paths?.[f]?.[v])), g = () => {
27
+ const t = o.value;
28
+ if (h.value || !t)
29
+ return;
30
+ const e = k(a.curl, c.value);
31
+ a.eventBus.emit("operation:create:operation", {
32
+ documentName: t.id,
33
+ path: e.path,
34
+ method: e.method,
35
+ operation: e.operation,
36
+ exampleKey: c.value,
37
+ callback: (s) => {
38
+ if (s) {
39
+ a.workspaceStore.buildSidebar(t.id);
40
+ const _ = e.path.startsWith("/") ? e.path : `/${e.path}`;
41
+ S.push({
42
+ name: "example",
43
+ params: {
44
+ documentSlug: t.id,
45
+ pathEncoded: encodeURIComponent(_),
46
+ method: e.method,
47
+ exampleName: c.value
48
+ }
49
+ });
50
+ }
51
+ }
52
+ }), p("close");
53
+ }, V = (t) => {
54
+ p("back", t);
55
+ };
56
+ return (t, e) => (N(), B(z, {
57
+ disabled: h.value,
58
+ onSubmit: g
59
+ }, {
60
+ options: r(() => [
61
+ m("div", F, [
62
+ n(l($), {
63
+ modelValue: o.value,
64
+ "onUpdate:modelValue": e[1] || (e[1] = (s) => o.value = s),
65
+ options: x.value
66
+ }, {
67
+ default: r(() => [
68
+ n(l(K), {
69
+ class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
70
+ variant: "outlined"
71
+ }, {
72
+ default: r(() => [
73
+ m("span", {
74
+ class: I(["whitespace-nowrap", o.value ? "text-c-1" : "text-c-3"])
75
+ }, d(o.value ? o.value.label : "Select Collection"), 3),
76
+ n(l(R), {
77
+ class: "text-c-3",
78
+ icon: "ChevronDown",
79
+ size: "md"
80
+ })
81
+ ]),
82
+ _: 1
83
+ })
84
+ ]),
85
+ _: 1
86
+ }, 8, ["modelValue", "options"])
87
+ ])
88
+ ]),
89
+ submit: r(() => [...e[2] || (e[2] = [
90
+ D("Import Request", -1)
91
+ ])]),
92
+ default: r(() => [
93
+ n(E, {
94
+ modelValue: u.value,
95
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => u.value = s),
96
+ placeholder: "Curl example key (e.g., example-1)",
97
+ onDelete: V
98
+ }, null, 8, ["modelValue"]),
99
+ m("div", O, [
100
+ m("div", T, [
101
+ n(j, {
102
+ class: "border-r-1 px-1",
103
+ method: l(v)
104
+ }, null, 8, ["method"]),
105
+ m("span", q, d(l(C).servers?.[0]?.url || "") + d(l(f)), 1)
106
+ ])
107
+ ])
108
+ ]),
109
+ _: 1
110
+ }, 8, ["disabled"]));
111
+ }
112
+ });
113
+ export {
114
+ Q as default
115
+ };
@@ -0,0 +1,39 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
+ /**
4
+ * Command Palette Request Component
5
+ *
6
+ * Provides a form for creating a new API request (operation) in a document.
7
+ * Users can specify the request path, HTTP method, document (collection),
8
+ * and optionally assign it to a tag.
9
+ *
10
+ * Validates that no operation with the same path and method already exists
11
+ * in the selected document to prevent duplicates.
12
+ *
13
+ * @example
14
+ * <CommandPaletteRequest
15
+ * :workspaceStore="workspaceStore"
16
+ * :eventBus="eventBus"
17
+ * @close="handleClose"
18
+ * @back="handleBack"
19
+ * />
20
+ */
21
+ declare const _default: import("vue").DefineComponent<{
22
+ /** The workspace store for accessing documents and operations */
23
+ workspaceStore: WorkspaceStore;
24
+ /** Event bus for emitting operation creation events */
25
+ eventBus: WorkspaceEventBus;
26
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
27
+ close: () => any;
28
+ back: (keyboardEvent: KeyboardEvent) => any;
29
+ }, string, import("vue").PublicProps, Readonly<{
30
+ /** The workspace store for accessing documents and operations */
31
+ workspaceStore: WorkspaceStore;
32
+ /** Event bus for emitting operation creation events */
33
+ eventBus: WorkspaceEventBus;
34
+ }> & Readonly<{
35
+ onClose?: (() => any) | undefined;
36
+ onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
37
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ export default _default;
39
+ //# sourceMappingURL=CommandPaletteRequest.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPaletteRequest.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteRequest.vue"],"names":[],"mappings":"AAiWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE;;;;;;;;;;;;;;;;;GAiBG;;IAGD,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;IAH3B,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;AAL7B,wBAsjBC"}