@scalar/api-client 2.23.3 → 2.24.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 (97) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  3. package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +8 -0
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +33 -29
  8. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
  9. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  10. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  11. package/dist/v2/blocks/operation-block/components/Header.vue2.js +46 -29
  12. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  13. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts +15 -0
  14. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -0
  15. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +125 -0
  16. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue2.js +4 -0
  17. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +5 -1
  18. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  19. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +61 -61
  20. package/dist/v2/components/sidebar/SidebarMenu.vue.js +6 -6
  21. package/dist/v2/features/app/App.vue.d.ts +5 -0
  22. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  23. package/dist/v2/features/app/App.vue.js +89 -108
  24. package/dist/v2/features/app/app-state.d.ts +5 -7
  25. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  26. package/dist/v2/features/app/app-state.js +210 -205
  27. package/dist/v2/features/app/hooks/use-document-watcher.js +8 -8
  28. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  29. package/dist/v2/features/collection/components/Environment.vue.js +12 -11
  30. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  31. package/dist/v2/features/collection/components/Settings.vue.js +17 -25
  32. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +1 -1
  33. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
  34. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +115 -118
  35. package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts.map +1 -1
  36. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +14 -4
  37. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -1
  38. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +5 -6
  39. package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts.map +1 -1
  40. package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts +16 -0
  41. package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -0
  42. package/dist/v2/features/command-palette/helpers/load-document-from-source.js +34 -0
  43. package/dist/v2/features/command-palette/index.d.ts +4 -0
  44. package/dist/v2/features/command-palette/index.d.ts.map +1 -0
  45. package/dist/v2/features/command-palette/index.js +8 -0
  46. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts +4 -0
  47. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  48. package/dist/v2/features/environments/EnvironmentsList.vue.js +29 -27
  49. package/dist/v2/features/environments/components/Environment.vue.d.ts +1 -0
  50. package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
  51. package/dist/v2/features/environments/components/Environment.vue.js +37 -24
  52. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  53. package/dist/v2/features/modal/Modal.vue.js +1 -1
  54. package/dist/v2/features/modal/Modal.vue2.js +35 -36
  55. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  56. package/dist/v2/features/modal/helpers/create-api-client-modal.js +58 -41
  57. package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts +18 -0
  58. package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts.map +1 -0
  59. package/dist/v2/features/modal/helpers/restore-workspace-state.js +36 -0
  60. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  61. package/dist/v2/features/operation/Operation.vue.js +35 -26
  62. package/dist/v2/workspace-events.d.ts.map +1 -1
  63. package/dist/v2/workspace-events.js +7 -0
  64. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  65. package/package.json +20 -20
  66. package/dist/v2/features/import-listener/ImportListener.vue.d.ts +0 -52
  67. package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +0 -1
  68. package/dist/v2/features/import-listener/ImportListener.vue.js +0 -91
  69. package/dist/v2/features/import-listener/ImportListener.vue2.js +0 -4
  70. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +0 -7
  71. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +0 -1
  72. package/dist/v2/features/import-listener/components/DropEventListener.vue.js +0 -81
  73. package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +0 -4
  74. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +0 -40
  75. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +0 -1
  76. package/dist/v2/features/import-listener/components/ImportModal.vue.js +0 -170
  77. package/dist/v2/features/import-listener/components/ImportModal.vue3.js +0 -5
  78. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +0 -29
  79. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +0 -1
  80. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +0 -83
  81. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +0 -4
  82. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +0 -8
  83. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +0 -1
  84. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +0 -4
  85. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +0 -15
  86. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +0 -1
  87. package/dist/v2/features/import-listener/helpers/load-document-from-source.js +0 -28
  88. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +0 -15
  89. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +0 -1
  90. package/dist/v2/features/import-listener/helpers/wait-for-condition.js +0 -16
  91. package/dist/v2/features/import-listener/index.d.ts +0 -2
  92. package/dist/v2/features/import-listener/index.d.ts.map +0 -1
  93. package/dist/v2/features/import-listener/index.js +0 -4
  94. /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts +0 -0
  95. /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.js +0 -0
  96. /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts +0 -0
  97. /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.js +0 -0
@@ -1,15 +1,15 @@
1
- import { defineComponent as y, computed as n, toValue as r, onMounted as f, createBlock as g, createElementBlock as k, openBlock as l, unref as i, createElementVNode as x } from "vue";
1
+ import { defineComponent as f, computed as n, toValue as r, onMounted as k, createBlock as x, createElementBlock as g, openBlock as l, unref as i, createElementVNode as w } from "vue";
2
2
  import { getResolvedRef as m } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
3
  import { mapHiddenClientsConfig as C } from "../modal/helpers/map-hidden-clients-config.js";
4
- import { combineParams as w } from "./helpers/combine-params.js";
5
- import { getSelectedServer as B } from "./helpers/get-selected-server.js";
6
- import { getServers as U } from "../../helpers/get-servers.js";
4
+ import { combineParams as B } from "./helpers/combine-params.js";
5
+ import { getSelectedServer as U } from "./helpers/get-selected-server.js";
6
+ import { getServers as b } from "../../helpers/get-servers.js";
7
7
  import N from "../../blocks/operation-block/OperationBlock.vue.js";
8
- const b = {
8
+ const E = {
9
9
  key: 1,
10
10
  class: "flex h-full w-full items-center justify-center"
11
- }, V = {}, K = /* @__PURE__ */ y({
12
- ...V,
11
+ }, O = {}, K = /* @__PURE__ */ f({
12
+ ...O,
13
13
  __name: "Operation",
14
14
  props: {
15
15
  documentSlug: {},
@@ -27,16 +27,16 @@ const b = {
27
27
  options: {}
28
28
  },
29
29
  setup(e) {
30
- const u = n(() => e.path ? m(e.document?.paths?.[e.path]) : null), c = n(() => {
30
+ const c = n(() => e.path ? m(e.document?.paths?.[e.path]) : null), u = n(() => {
31
31
  if (!e.path || !e.method)
32
32
  return null;
33
33
  const t = m(e.document?.paths?.[e.path]?.[e.method]);
34
34
  if (!t)
35
35
  return null;
36
- if (!u.value)
36
+ if (!c.value)
37
37
  return t;
38
- const a = w(
39
- u.value.parameters,
38
+ const a = B(
39
+ c.value.parameters,
40
40
  t.parameters
41
41
  );
42
42
  return { ...t, parameters: a };
@@ -50,30 +50,38 @@ const b = {
50
50
  location: "document"
51
51
  }))
52
52
  ]), o = n(() => {
53
- const t = r(e.options)?.servers ?? c.value?.servers ?? u.value?.servers ?? e.document?.servers;
54
- return U(t, {
53
+ const t = r(e.options)?.servers ?? u.value?.servers ?? c.value?.servers ?? e.document?.servers;
54
+ return b(t, {
55
55
  baseServerUrl: r(e.options)?.baseServerURL,
56
56
  documentUrl: e.document?.["x-scalar-original-source-url"]
57
57
  });
58
58
  }), d = n(
59
- () => B(e.document, o.value)
59
+ () => U(e.document, o.value)
60
60
  );
61
- f(() => {
61
+ k(() => {
62
62
  typeof e.document?.["x-scalar-selected-server"] > "u" && o.value?.[0]?.url && e.eventBus.emit("server:update:selected", { url: o.value[0].url });
63
63
  });
64
- const h = n(() => e.document?.["x-scalar-set-operation-security"] ? {
64
+ const v = n(() => e.document?.["x-scalar-set-operation-security"] ? {
65
65
  type: "operation",
66
66
  path: e.path ?? "",
67
67
  method: e.method ?? "get"
68
68
  } : {
69
69
  type: "document"
70
- }), v = n(
70
+ }), h = n(() => Array.from(
71
+ new Set(
72
+ Object.keys({
73
+ ...e.document?.["x-scalar-environments"],
74
+ ...e.workspaceStore.workspace["x-scalar-environments"]
75
+ })
76
+ )
77
+ )), S = n(
71
78
  () => C(r(e.options)?.hiddenClients)
72
- ), S = "2.23.3";
73
- return (t, a) => e.path && e.method && e.exampleName && c.value ? (l(), g(i(N), {
79
+ ), y = "2.24.0";
80
+ return (t, a) => e.path && e.method && e.exampleName && u.value ? (l(), x(i(N), {
74
81
  key: 0,
75
- appVersion: i(S),
76
- authMeta: h.value,
82
+ activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
83
+ appVersion: i(y),
84
+ authMeta: v.value,
77
85
  documentSecurity: e.document?.security ?? [],
78
86
  documentSelectedSecurity: e.workspaceStore.auth.getAuthSelectedSchemas({
79
87
  type: "document",
@@ -81,15 +89,16 @@ const b = {
81
89
  }),
82
90
  documentUrl: e.document?.["x-scalar-original-source-url"],
83
91
  environment: e.environment,
92
+ environments: h.value,
84
93
  eventBus: e.eventBus,
85
94
  exampleKey: e.exampleName,
86
95
  globalCookies: s.value,
87
96
  hideClientButton: r(e.options)?.hideClientButton ?? !1,
88
97
  history: e.workspaceStore.history.getHistory(e.documentSlug, e.path, e.method),
89
- httpClients: v.value,
98
+ httpClients: S.value,
90
99
  layout: e.layout,
91
100
  method: e.method,
92
- operation: c.value,
101
+ operation: u.value,
93
102
  operationSelectedSecurity: e.workspaceStore.auth.getAuthSelectedSchemas({
94
103
  type: "operation",
95
104
  documentName: e.documentSlug,
@@ -104,9 +113,9 @@ const b = {
104
113
  server: d.value,
105
114
  servers: o.value,
106
115
  setOperationSecurity: e.document?.["x-scalar-set-operation-security"] ?? !1,
107
- "onUpdate:servers": a[0] || (a[0] = (M) => e.eventBus.emit("ui:route:page", { name: "document.servers" }))
108
- }, null, 8, ["appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "servers", "setOperationSecurity"])) : (l(), k("div", b, [...a[1] || (a[1] = [
109
- x("span", { class: "text-c-3" }, "Select an operation to view details", -1)
116
+ "onUpdate:servers": a[0] || (a[0] = (V) => e.eventBus.emit("ui:route:page", { name: "document.servers" }))
117
+ }, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "servers", "setOperationSecurity"])) : (l(), g("div", E, [...a[1] || (a[1] = [
118
+ w("span", { class: "text-c-3" }, "Select an operation to view details", -1)
110
119
  ])]));
111
120
  }
112
121
  });
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-events.d.ts","sourceRoot":"","sources":["../../src/v2/workspace-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAkB,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAE3G,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,KAAK,CAAA;AAExC,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,OAAO,CAAC;IACtD,eAAe,EAAE,CACf,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAC3B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IAClF,cAAc,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACzE,CAAC,CAAA;AAEF,KAAK,KAAK,GAAG;KACV,GAAG,IAAI,MAAM,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC;CAC9C,CAAA;AA6BD;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,KAAK,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACjC,KAAK,EAAE,KAAK,CAAA;CACb,QAgQA"}
1
+ {"version":3,"file":"workspace-events.d.ts","sourceRoot":"","sources":["../../src/v2/workspace-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAkB,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAE3G,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,KAAK,CAAA;AAExC,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,OAAO,CAAC;IACtD,eAAe,EAAE,CACf,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAC3B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IAClF,cAAc,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACzE,CAAC,CAAA;AAEF,KAAK,KAAK,GAAG;KACV,GAAG,IAAI,MAAM,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC;CAC9C,CAAA;AA6BD;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,KAAK,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACjC,KAAK,EAAE,KAAK,CAAA;CACb,QAuQA"}
@@ -26,6 +26,13 @@ function l({
26
26
  o.value.workspace().workspace.updateSelectedClient,
27
27
  a
28
28
  )(e)
29
+ ), t.on(
30
+ "workspace:update:active-environment",
31
+ (e) => r(
32
+ "workspace:update:active-environment",
33
+ o.value.workspace().workspace.updateActiveEnvironment,
34
+ a
35
+ )(e)
29
36
  ), t.on(
30
37
  "document:update:icon",
31
38
  (e) => r("document:update:icon", o.value.active().document.updateDocumentIcon, a)(e)
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
33
33
  }));
34
34
  }, f = (u) => {
35
35
  u?.createNew && g.name === "request" && p();
36
- }, v = "2.23.3";
36
+ }, v = "2.24.0";
37
37
  return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
38
38
  s("div", {
39
39
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.23.3",
21
+ "version": "2.24.0",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -221,6 +221,11 @@
221
221
  "types": "./dist/v2/features/app/components/index.d.ts",
222
222
  "default": "./dist/v2/features/app/components/index.js"
223
223
  },
224
+ "./v2/features/command-palette": {
225
+ "import": "./dist/v2/features/command-palette/index.js",
226
+ "types": "./dist/v2/features/command-palette/index.d.ts",
227
+ "default": "./dist/v2/features/command-palette/index.js"
228
+ },
224
229
  "./v2/features/environments": {
225
230
  "import": "./dist/v2/features/environments/index.js",
226
231
  "types": "./dist/v2/features/environments/index.d.ts",
@@ -231,11 +236,6 @@
231
236
  "types": "./dist/v2/features/global-cookies/index.d.ts",
232
237
  "default": "./dist/v2/features/global-cookies/index.js"
233
238
  },
234
- "./v2/features/import-listener": {
235
- "import": "./dist/v2/features/import-listener/index.js",
236
- "types": "./dist/v2/features/import-listener/index.d.ts",
237
- "default": "./dist/v2/features/import-listener/index.js"
238
- },
239
239
  "./v2/features/modal": {
240
240
  "import": "./dist/v2/features/modal/index.js",
241
241
  "types": "./dist/v2/features/modal/index.d.ts",
@@ -326,26 +326,26 @@
326
326
  "whatwg-mimetype": "4.0.0",
327
327
  "yaml": "^2.8.0",
328
328
  "zod": "^4.3.5",
329
- "@scalar/draggable": "0.3.0",
330
- "@scalar/components": "0.17.4",
331
329
  "@scalar/analytics-client": "1.0.1",
332
- "@scalar/icons": "0.5.2",
333
- "@scalar/import": "0.4.48",
334
- "@scalar/json-magic": "0.9.6",
330
+ "@scalar/components": "0.17.6",
331
+ "@scalar/draggable": "0.3.0",
332
+ "@scalar/json-magic": "0.10.0",
335
333
  "@scalar/helpers": "0.2.11",
336
- "@scalar/oas-utils": "0.6.34",
334
+ "@scalar/import": "0.4.48",
335
+ "@scalar/icons": "0.5.2",
337
336
  "@scalar/object-utils": "1.2.25",
338
- "@scalar/openapi-parser": "0.24.7",
339
- "@scalar/sidebar": "0.7.27",
337
+ "@scalar/openapi-parser": "0.24.8",
338
+ "@scalar/oas-utils": "0.6.36",
340
339
  "@scalar/openapi-types": "0.5.3",
341
- "@scalar/snippetz": "0.6.11",
342
340
  "@scalar/postman-to-openapi": "0.4.3",
341
+ "@scalar/sidebar": "0.7.29",
342
+ "@scalar/snippetz": "0.6.11",
343
343
  "@scalar/themes": "0.14.0",
344
344
  "@scalar/types": "0.6.2",
345
- "@scalar/use-hooks": "0.3.7",
346
- "@scalar/use-codemirror": "0.13.31",
345
+ "@scalar/use-codemirror": "0.13.33",
347
346
  "@scalar/use-toasts": "0.9.1",
348
- "@scalar/workspace-store": "0.28.3"
347
+ "@scalar/workspace-store": "0.29.0",
348
+ "@scalar/use-hooks": "0.3.7"
349
349
  },
350
350
  "devDependencies": {
351
351
  "@tailwindcss/vite": "^4.1.18",
@@ -360,8 +360,8 @@
360
360
  "vite": "^7.3.1",
361
361
  "vite-svg-loader": "5.1.0",
362
362
  "vitest": "4.0.16",
363
- "@scalar/galaxy": "0.5.12",
364
- "@scalar/build-tooling": "0.4.1"
363
+ "@scalar/build-tooling": "0.4.1",
364
+ "@scalar/galaxy": "0.5.12"
365
365
  },
366
366
  "scripts": {
367
367
  "build": "scalar-build-vite",
@@ -1,52 +0,0 @@
1
- import { type ScalarListboxOption } from '@scalar/components';
2
- import { type WorkspaceStore } from '@scalar/workspace-store/client';
3
- type __VLS_Props = {
4
- /**
5
- * The workspace store instance.
6
- * This is null during initialization until the store is ready.
7
- */
8
- workspaceStore: WorkspaceStore | null;
9
- /**
10
- * The currently active workspace.
11
- * This represents the workspace that the user is currently working in.
12
- */
13
- activeWorkspace: {
14
- id: string;
15
- label: string;
16
- } | null;
17
- /**
18
- * The list of all available workspaces.
19
- * Used to render options for workspace switching and selection.
20
- */
21
- workspaces: ScalarListboxOption[];
22
- /**
23
- * The dark mode setting.
24
- * This is used to determine the color mode of the import modal.
25
- */
26
- darkMode: boolean;
27
- };
28
- declare var __VLS_17: {};
29
- type __VLS_Slots = {} & {
30
- default?: (props: typeof __VLS_17) => any;
31
- };
32
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
33
- "create:workspace": (payload: {
34
- name: string;
35
- }) => any;
36
- "select:workspace": (id?: string | undefined) => any;
37
- "navigateTo:document": (slug: string) => any;
38
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
39
- "onCreate:workspace"?: ((payload: {
40
- name: string;
41
- }) => any) | undefined;
42
- "onSelect:workspace"?: ((id?: string | undefined) => any) | undefined;
43
- "onNavigateTo:document"?: ((slug: string) => any) | undefined;
44
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
46
- export default _default;
47
- type __VLS_WithSlots<T, S> = T & {
48
- new (): {
49
- $slots: S;
50
- };
51
- };
52
- //# sourceMappingURL=ImportListener.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImportListener.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/import-listener/ImportListener.vue"],"names":[],"mappings":"AA4MA,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEvE,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAA;AAYvC,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC;;;OAGG;IACH,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACrD;;;OAGG;IACH,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAC;AA4MF,QAAA,IAAI,QAAQ,IAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AA0BhD,QAAA,MAAM,eAAe;;cA/NsB,MAAM;;;;;;cAAN,MAAM;;;;kFAsO/C,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,91 +0,0 @@
1
- import { defineComponent as h, ref as v, onMounted as I, createElementBlock as W, openBlock as D, Fragment as L, createVNode as d, renderSlot as F, unref as M } from "vue";
2
- import { useModal as T } from "@scalar/components";
3
- import { useToasts as B } from "@scalar/use-toasts";
4
- import { createWorkspaceStore as C } from "@scalar/workspace-store/client";
5
- import { getUrlQueryParameter as i } from "./helpers/get-url-query-parameter.js";
6
- import { importDocumentToWorkspace as E } from "./helpers/import-document-to-workspace.js";
7
- import { loadDocumentFromSource as $ } from "./helpers/load-document-from-source.js";
8
- import { waitForCondition as b } from "./helpers/wait-for-condition.js";
9
- import x from "./components/DropEventListener.vue.js";
10
- import z from "./components/ImportModal.vue.js";
11
- /* empty css */
12
- const J = /* @__PURE__ */ h({
13
- __name: "ImportListener",
14
- props: {
15
- workspaceStore: {},
16
- activeWorkspace: {},
17
- workspaces: {},
18
- darkMode: { type: Boolean }
19
- },
20
- emits: ["navigateTo:document", "select:workspace", "create:workspace"],
21
- setup(r, { emit: k }) {
22
- const s = k, c = v(null), a = T(), { toast: l } = B(), n = (o) => {
23
- console.error(o), l("Failed to import document", "error"), a.hide();
24
- }, f = async (o) => {
25
- if (l("Importing document to the workspace...", "info"), !r.workspaceStore) {
26
- n("Workspace store is not available");
27
- return;
28
- }
29
- const e = C();
30
- if (!await $(
31
- e,
32
- o,
33
- "drafts",
34
- !1
35
- )) {
36
- n("Failed to import document");
37
- return;
38
- }
39
- await p(e.exportWorkspace(), "drafts");
40
- }, u = async (o, e) => {
41
- const t = await b(
42
- () => r.workspaceStore !== null
43
- ), w = new Set(
44
- Object.keys(r.workspaceStore?.workspace.documents ?? {})
45
- ), g = () => {
46
- const m = w, S = m.size === 0, y = m.size === 1 && m.has("drafts");
47
- return S || y;
48
- };
49
- if (r.workspaces.length === 1 && g() && t) {
50
- await f(o);
51
- return;
52
- }
53
- c.value = {
54
- source: o,
55
- companyLogo: e ?? null
56
- }, a.show();
57
- }, p = async (o, e) => {
58
- const t = await E({
59
- workspaceStore: r.workspaceStore,
60
- workspaceState: o,
61
- name: e
62
- });
63
- if (!t.ok) {
64
- n(t.error);
65
- return;
66
- }
67
- s("navigateTo:document", t.slug), a.hide();
68
- };
69
- return I(() => {
70
- const o = i("url"), e = r.darkMode ? i("dark_logo") : i("light_logo");
71
- o && u(o, e);
72
- }), (o, e) => (D(), W(L, null, [
73
- d(z, {
74
- activeWorkspace: r.activeWorkspace,
75
- companyLogo: c.value?.companyLogo || null,
76
- isLoading: r.workspaceStore === null,
77
- modalState: M(a),
78
- source: c.value?.source || null,
79
- workspaces: r.workspaces,
80
- "onCreate:workspace": e[0] || (e[0] = (t) => s("create:workspace", t)),
81
- "onImport:document": p,
82
- "onSelect:workspace": e[1] || (e[1] = (t) => s("select:workspace", t))
83
- }, null, 8, ["activeWorkspace", "companyLogo", "isLoading", "modalState", "source", "workspaces"]),
84
- d(x, { onInput: u }),
85
- F(o.$slots, "default")
86
- ], 64));
87
- }
88
- });
89
- export {
90
- J as default
91
- };
@@ -1,4 +0,0 @@
1
- import f from "./ImportListener.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,7 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
- input: (value: string) => any;
3
- }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
- onInput?: ((value: string) => any) | undefined;
5
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
- export default _default;
7
- //# sourceMappingURL=DropEventListener.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DropEventListener.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/import-listener/components/DropEventListener.vue"],"names":[],"mappings":";;;;;AAqVA,wBAMG"}
@@ -1,81 +0,0 @@
1
- import { defineComponent as g, ref as y, onMounted as x, onBeforeUnmount as h, createBlock as D, openBlock as p, Transition as E, withCtx as T, createElementBlock as _, createCommentVNode as L, createElementVNode as i, createVNode as C, unref as b } from "vue";
2
- import { ScalarIcon as k } from "@scalar/components";
3
- const A = {
4
- key: 0,
5
- class: "bg-b-2 fixed right-1/2 bottom-1/2 z-50 h-64 w-64 translate-x-1/2 translate-y-1/2 rounded-xl border transition-opacity duration-200 md:right-10 md:bottom-10 md:translate-x-0 md:translate-y-0"
6
- }, w = { class: "flex h-full flex-col items-center justify-center" }, V = /* @__PURE__ */ g({
7
- __name: "DropEventListener",
8
- emits: ["input"],
9
- setup(B, { emit: v }) {
10
- const s = v, n = y(!1);
11
- let a = 0;
12
- x(() => {
13
- document.addEventListener("dragenter", f), document.addEventListener("dragleave", u), document.addEventListener("dragover", c), document.addEventListener("drop", l);
14
- }), h(() => {
15
- document.removeEventListener("dragenter", f), document.removeEventListener("dragover", c), document.removeEventListener("dragleave", u), document.removeEventListener("drop", l);
16
- });
17
- function d(e) {
18
- return e.dataTransfer?.types.includes("text/html") ?? !1;
19
- }
20
- function l(e) {
21
- if (e.preventDefault(), n.value = !1, a = 0, !d(e) && e.dataTransfer) {
22
- const t = e.dataTransfer.getData("text").replace(/^blob:/, "");
23
- if (t)
24
- s("input", t);
25
- else if (e.dataTransfer.files.length > 0) {
26
- const r = e.dataTransfer.files[0];
27
- if (!r)
28
- return;
29
- const m = new FileReader();
30
- m.onload = (o) => {
31
- o.target && typeof o.target.result == "string" && s("input", o.target.result);
32
- }, m.readAsText(r);
33
- }
34
- }
35
- }
36
- function c(e) {
37
- e.preventDefault();
38
- }
39
- function u(e) {
40
- e.preventDefault(), a--, a === 0 && (n.value = !1);
41
- }
42
- function f(e) {
43
- if (e.preventDefault(), a++, !d(e)) {
44
- if (e.dataTransfer) {
45
- const t = e.dataTransfer.items;
46
- for (const r of t)
47
- if (r?.kind === "string" || r?.type?.includes("json") || r?.type?.includes("yml") || r?.type?.includes("yaml")) {
48
- n.value = !0;
49
- return;
50
- }
51
- }
52
- n.value = !1;
53
- }
54
- }
55
- return (e, t) => (p(), D(E, {
56
- enterActiveClass: "transition-opacity duration-200",
57
- enterFromClass: "opacity-0",
58
- leaveActiveClass: "transition-opacity duration-200",
59
- leaveToClass: "opacity-0"
60
- }, {
61
- default: T(() => [
62
- n.value ? (p(), _("div", A, [
63
- i("div", w, [
64
- i("div", null, [
65
- C(b(k), {
66
- icon: "Download",
67
- size: "xl",
68
- thickness: "2"
69
- })
70
- ]),
71
- t[0] || (t[0] = i("div", { class: "text-c-1 m-4 text-center" }, " Drop your OpenAPI document here ", -1))
72
- ])
73
- ])) : L("", !0)
74
- ]),
75
- _: 1
76
- }));
77
- }
78
- });
79
- export {
80
- V as default
81
- };
@@ -1,4 +0,0 @@
1
- import f from "./DropEventListener.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,40 +0,0 @@
1
- import { type ModalState, type ScalarListboxOption } from '@scalar/components';
2
- import type { InMemoryWorkspace } from '@scalar/workspace-store/schemas/inmemory-workspace';
3
- type __VLS_Props = {
4
- /** The source URL or content to import from (URL, file path, or raw content) */
5
- source: string | null;
6
- /** Controls the visibility and state of the modal */
7
- modalState: ModalState;
8
- /** Optional company logo URL to display in the import UI */
9
- companyLogo?: string | null;
10
- /** Whether the workspace data is currently being loaded */
11
- isLoading?: boolean;
12
- /**
13
- * The currently active workspace.
14
- * This represents the workspace that the user is currently working in.
15
- */
16
- activeWorkspace: {
17
- id: string;
18
- label: string;
19
- } | null;
20
- /**
21
- * The list of all available workspaces.
22
- * Used to render options for workspace switching and selection.
23
- */
24
- workspaces: ScalarListboxOption[];
25
- };
26
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
27
- "create:workspace": (payload: {
28
- name: string;
29
- }) => any;
30
- "select:workspace": (id?: string | undefined) => any;
31
- "import:document": (workspaceState: InMemoryWorkspace, name: string) => any;
32
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
33
- "onCreate:workspace"?: ((payload: {
34
- name: string;
35
- }) => any) | undefined;
36
- "onSelect:workspace"?: ((id?: string | undefined) => any) | undefined;
37
- "onImport:document"?: ((workspaceState: InMemoryWorkspace, name: string) => any) | undefined;
38
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
- export default _default;
40
- //# sourceMappingURL=ImportModal.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImportModal.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/import-listener/components/ImportModal.vue"],"names":[],"mappings":"AAgVA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAQ3F,KAAK,WAAW,GAAG;IACjB,gFAAgF;IAChF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,qDAAqD;IACrD,UAAU,EAAE,UAAU,CAAA;IACtB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACrD;;;OAGG;IACH,UAAU,EAAE,mBAAmB,EAAE,CAAA;CAClC,CAAC;;;cAayC,MAAM;;;;;;cAAN,MAAM;;;;;AA4cjD,wBAOG"}