@scalar/api-client 2.22.2 → 2.23.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 (62) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
  4. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +9 -9
  5. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  6. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  7. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +100 -91
  8. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +2 -0
  9. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  10. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +2 -2
  11. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +43 -37
  12. package/dist/v2/components/layout/ValueEmitter.vue.d.ts +6 -2
  13. package/dist/v2/components/layout/ValueEmitter.vue.d.ts.map +1 -1
  14. package/dist/v2/components/layout/ValueEmitter.vue.js +10 -10
  15. package/dist/v2/components/server/ServerDropdown.vue.d.ts +2 -0
  16. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  17. package/dist/v2/components/server/ServerDropdown.vue.js +48 -42
  18. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  19. package/dist/v2/features/app/App.vue.js +117 -89
  20. package/dist/v2/features/app/app-state.d.ts +23 -12
  21. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  22. package/dist/v2/features/app/app-state.js +228 -196
  23. package/dist/v2/features/app/helpers/routes.d.ts +1 -1
  24. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  25. package/dist/v2/features/app/helpers/routes.js +33 -27
  26. package/dist/v2/features/import-listener/ImportListener.vue.d.ts +52 -0
  27. package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +1 -0
  28. package/dist/v2/features/import-listener/ImportListener.vue.js +91 -0
  29. package/dist/v2/features/import-listener/ImportListener.vue2.js +4 -0
  30. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +7 -0
  31. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +1 -0
  32. package/dist/v2/features/import-listener/components/DropEventListener.vue.js +81 -0
  33. package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +4 -0
  34. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +40 -0
  35. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +1 -0
  36. package/dist/v2/features/import-listener/components/ImportModal.vue.js +170 -0
  37. package/dist/v2/features/import-listener/components/ImportModal.vue3.js +5 -0
  38. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +29 -0
  39. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +1 -0
  40. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +83 -0
  41. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +4 -0
  42. package/dist/v2/features/import-listener/helpers/generate-unique-slug.d.ts +16 -0
  43. package/dist/v2/features/import-listener/helpers/generate-unique-slug.d.ts.map +1 -0
  44. package/dist/v2/features/import-listener/helpers/generate-unique-slug.js +11 -0
  45. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +8 -0
  46. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +1 -0
  47. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +4 -0
  48. package/dist/v2/features/import-listener/helpers/import-document-to-workspace.d.ts +30 -0
  49. package/dist/v2/features/import-listener/helpers/import-document-to-workspace.d.ts.map +1 -0
  50. package/dist/v2/features/import-listener/helpers/import-document-to-workspace.js +31 -0
  51. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +15 -0
  52. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +1 -0
  53. package/dist/v2/features/import-listener/helpers/load-document-from-source.js +28 -0
  54. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +15 -0
  55. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +1 -0
  56. package/dist/v2/features/import-listener/helpers/wait-for-condition.js +16 -0
  57. package/dist/v2/features/import-listener/index.d.ts +2 -0
  58. package/dist/v2/features/import-listener/index.d.ts.map +1 -0
  59. package/dist/v2/features/import-listener/index.js +4 -0
  60. package/dist/v2/features/operation/Operation.vue.js +1 -1
  61. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  62. package/package.json +16 -11
@@ -1,8 +1,9 @@
1
- import { defineComponent as y, computed as p, createBlock as m, openBlock as t, unref as a, withCtx as o, createVNode as n, createElementBlock as d, Fragment as c, createElementVNode as s, createTextVNode as h, toDisplayString as U, createCommentVNode as w, renderList as C } from "vue";
2
- import { ScalarPopover as B, ScalarButton as z, ScalarFloatingBackdrop as N } from "@scalar/components";
3
- import { ScalarIconPlus as V, ScalarIconPencilSimple as D } from "@scalar/icons";
1
+ import { defineComponent as y, computed as m, createBlock as f, openBlock as o, unref as n, withCtx as u, createVNode as l, createElementBlock as d, Fragment as v, createElementVNode as s, createTextVNode as U, toDisplayString as C, createCommentVNode as w, renderList as h } from "vue";
2
+ import { ScalarPopover as B, ScalarButton as $, ScalarFloatingBackdrop as N } from "@scalar/components";
3
+ import { ScalarIconPlus as V, ScalarIconPencilSimple as z } from "@scalar/icons";
4
+ import D from "../layout/ValueEmitter.vue.js";
4
5
  import I from "./ServerDropdownItem.vue.js";
5
- const P = ["onClick"], $ = { class: "flex items-center justify-center" }, W = /* @__PURE__ */ y({
6
+ const P = ["onClick"], q = { class: "flex items-center justify-center" }, A = /* @__PURE__ */ y({
6
7
  __name: "ServerDropdown",
7
8
  props: {
8
9
  servers: {},
@@ -10,64 +11,69 @@ const P = ["onClick"], $ = { class: "flex items-center justify-center" }, W = /*
10
11
  target: {},
11
12
  layout: {}
12
13
  },
13
- emits: ["update:selectedServer", "update:variable", "update:servers"],
14
- setup(e, { emit: f }) {
15
- const i = f, b = p(
16
- () => e.servers.map((u) => ({
17
- id: u.url,
18
- label: u.url ?? "Unknown server"
14
+ emits: ["update:selectedServer", "update:variable", "update:servers", "update:open"],
15
+ setup(t, { emit: x }) {
16
+ const a = x, S = m(
17
+ () => t.servers.map((i) => ({
18
+ id: i.url,
19
+ label: i.url ?? "Unknown server"
19
20
  }))
20
- ), x = p(() => e.server?.url?.endsWith("/") ? e.server.url.slice(0, -1) : e.server?.url || "");
21
- return (u, r) => (t(), m(a(B), {
21
+ ), b = m(() => t.server?.url?.endsWith("/") ? t.server.url.slice(0, -1) : t.server?.url || "");
22
+ return (i, e) => (o(), f(n(B), {
22
23
  class: "max-h-[inherit] p-0 text-base",
23
24
  focus: "",
24
25
  offset: 0,
25
- placement: "bottom-start",
26
+ placement: "bottom",
26
27
  resize: "",
27
- target: e.target,
28
- teleport: `#${e.target}`
28
+ target: t.target,
29
+ teleport: `#${t.target}`
29
30
  }, {
30
- popover: o(({ close: S }) => [
31
+ popover: u(({ close: p }) => [
31
32
  s("div", {
32
- class: "custom-scroll flex max-h-[inherit] flex-col gap-1 border-t p-1",
33
- onClick: S
33
+ class: "custom-scroll flex max-h-[inherit] flex-col gap-1 p-1",
34
+ onClick: p
34
35
  }, [
35
- (t(!0), d(c, null, C(b.value, (l, g) => (t(), m(I, {
36
- key: l.id,
37
- server: e.server,
38
- serverOption: l,
36
+ (o(!0), d(v, null, h(S.value, (r, g) => (o(), f(I, {
37
+ key: r.id,
38
+ server: t.server,
39
+ serverOption: r,
39
40
  type: "request",
40
- "onUpdate:selectedServer": (v) => i("update:selectedServer", { url: l.id }),
41
- "onUpdate:variable": (v, k) => i("update:variable", { index: g, key: v, value: k })
41
+ "onUpdate:selectedServer": (c) => a("update:selectedServer", { url: r.id }),
42
+ "onUpdate:variable": (c, k) => a("update:variable", { index: g, key: c, value: k })
42
43
  }, null, 8, ["server", "serverOption", "onUpdate:selectedServer", "onUpdate:variable"]))), 128)),
43
- e.layout !== "modal" ? (t(), d("button", {
44
+ t.layout !== "modal" ? (o(), d("button", {
44
45
  key: 0,
45
46
  class: "text-xxs hover:bg-b-2 flex cursor-pointer items-center gap-1.5 rounded p-1.75",
46
47
  type: "button",
47
- onClick: r[0] || (r[0] = (l) => i("update:servers"))
48
+ onClick: e[0] || (e[0] = (r) => a("update:servers"))
48
49
  }, [
49
- s("div", $, [
50
- n(a(D), { class: "size-4" })
50
+ s("div", q, [
51
+ l(n(z), { class: "size-4" })
51
52
  ]),
52
- r[3] || (r[3] = s("span", null, "Update Servers", -1))
53
+ e[5] || (e[5] = s("span", null, "Update Servers", -1))
53
54
  ])) : w("", !0)
54
55
  ], 8, P)
55
56
  ]),
56
- backdrop: o(() => [
57
- n(a(N), { class: "-top-(--scalar-address-bar-height) rounded-lg" })
57
+ backdrop: u(({ open: p }) => [
58
+ l(D, {
59
+ value: p,
60
+ onChange: e[1] || (e[1] = (r) => a("update:open", r)),
61
+ onUnmount: e[2] || (e[2] = (r) => a("update:open", !1))
62
+ }, null, 8, ["value"]),
63
+ l(n(N), { class: "inset-x-px rounded-none rounded-b-lg" })
58
64
  ]),
59
- default: o(() => [
60
- n(a(z), {
61
- class: "z-context-plus hover:bg-b-2 font-code text-c-2 ml-0.75 h-auto gap-0.75 rounded border px-1.5 text-base whitespace-nowrap",
65
+ default: u(() => [
66
+ l(n($), {
67
+ class: "hover:bg-b-2 font-code text-c-2 ml-0.75 h-auto gap-0.75 rounded border px-1.5 text-base whitespace-nowrap",
62
68
  variant: "ghost"
63
69
  }, {
64
- default: o(() => [
65
- e.server ? (t(), d(c, { key: 0 }, [
66
- r[1] || (r[1] = s("span", { class: "sr-only" }, "Server:", -1)),
67
- h(" " + U(x.value), 1)
68
- ], 64)) : (t(), d(c, { key: 1 }, [
69
- r[2] || (r[2] = s("span", { class: "sr-only" }, "Add Server", -1)),
70
- n(a(V), { class: "size-3" })
70
+ default: u(() => [
71
+ t.server ? (o(), d(v, { key: 0 }, [
72
+ e[3] || (e[3] = s("span", { class: "sr-only" }, "Server:", -1)),
73
+ U(" " + C(b.value), 1)
74
+ ], 64)) : (o(), d(v, { key: 1 }, [
75
+ e[4] || (e[4] = s("span", { class: "sr-only" }, "Add Server", -1)),
76
+ l(n(V), { class: "size-3" })
71
77
  ], 64))
72
78
  ]),
73
79
  _: 1
@@ -78,5 +84,5 @@ const P = ["onClick"], $ = { class: "flex items-center justify-center" }, W = /*
78
84
  }
79
85
  });
80
86
  export {
81
- W as default
87
+ A as default
82
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/App.vue"],"names":[],"mappings":"AAmOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAM3C;;;;GAIG;;YAGO,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;cAC5B,YAAY,EAAE;iBACX,MAAM,QAAQ;4BACH,MAAM,mBAAmB;;;;YAHzC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;cAC5B,YAAY,EAAE;iBACX,MAAM,QAAQ;4BACH,MAAM,mBAAmB;;IAUjD;;;OAGG;4BACqB,EAAE;;AAnB5B,wBAiVC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/App.vue"],"names":[],"mappings":"AA6PA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AAC7F,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAM3C;;;;GAIG;;YAGO,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;cAC5B,YAAY,EAAE;iBACX,MAAM,QAAQ;4BACH,MAAM,mBAAmB;;;;YAHzC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;cAC5B,YAAY,EAAE;iBACX,MAAM,QAAQ;4BACH,MAAM,mBAAmB;;IAUjD;;;OAGG;4BACqB,EAAE;;AAnB5B,wBAsYC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,20 +1,24 @@
1
- import { defineComponent as f, computed as u, createElementBlock as b, createBlock as c, unref as t, openBlock as l, Fragment as h, createElementVNode as p, createVNode as s, withCtx as m, renderSlot as W, normalizeProps as y, guardReactiveProps as T } from "vue";
1
+ import { defineComponent as W, computed as d, createBlock as p, openBlock as i, unref as t, withCtx as u, createElementVNode as m, createVNode as n, createElementBlock as v, renderSlot as T, normalizeProps as y, guardReactiveProps as h } from "vue";
2
2
  import { useModal as g, ScalarTeleportRoot as C } from "@scalar/components";
3
- import { getThemeStyles as B } from "@scalar/themes";
4
- import { ScalarToasts as x } from "@scalar/use-toasts";
5
- import { extensions as E } from "@scalar/workspace-store/schemas/extensions";
6
- import { RouterView as O } from "vue-router";
7
- import I from "./components/CreateWorkspaceModal.vue.js";
8
- import A from "./components/SplashScreen.vue.js";
9
- import { useDocumentWatcher as M } from "./hooks/use-document-watcher.js";
3
+ import { getThemeStyles as x } from "@scalar/themes";
4
+ import { ScalarToasts as B } from "@scalar/use-toasts";
5
+ import { extensions as M } from "@scalar/workspace-store/schemas/extensions";
6
+ import { RouterView as E } from "vue-router";
7
+ import O from "./components/CreateWorkspaceModal.vue.js";
8
+ import _ from "./components/SplashScreen.vue.js";
9
+ import { useDocumentWatcher as A } from "./hooks/use-document-watcher.js";
10
10
  import U from "../command-palette/TheCommandPalette.vue.js";
11
- import { useColorMode as _ } from "../../hooks/use-color-mode.js";
12
- import { useGlobalHotKeys as D } from "../../hooks/use-global-hot-keys.js";
13
- import N from "./components/AppSidebar.vue.js";
14
- import $ from "./components/DesktopTabs.vue.js";
15
- import L from "./components/WebTopNav.vue.js";
16
- const P = ["innerHTML"], F = { class: "flex min-h-0 flex-1" }, H = { class: "bg-b-1 flex-1" }, V = {}, re = /* @__PURE__ */ f({
17
- ...V,
11
+ import { useColorMode as D } from "../../hooks/use-color-mode.js";
12
+ import { useGlobalHotKeys as I } from "../../hooks/use-global-hot-keys.js";
13
+ import L from "./components/AppSidebar.vue.js";
14
+ import N from "./components/DesktopTabs.vue.js";
15
+ import $ from "./components/WebTopNav.vue.js";
16
+ import P from "../import-listener/ImportListener.vue.js";
17
+ const H = ["innerHTML"], F = {
18
+ key: 0,
19
+ class: "flex flex-1 flex-col"
20
+ }, V = { class: "flex min-h-0 flex-1" }, R = { class: "bg-b-1 flex-1" }, z = { key: 1 }, G = {}, le = /* @__PURE__ */ W({
21
+ ...G,
18
22
  __name: "App",
19
23
  props: {
20
24
  layout: {},
@@ -22,99 +26,123 @@ const P = ["innerHTML"], F = { class: "flex min-h-0 flex-1" }, H = { class: "bg-
22
26
  getAppState: { type: Function },
23
27
  getCommandPaletteState: { type: Function }
24
28
  },
25
- setup(o, { expose: d }) {
26
- d({
27
- openCreateWorkspace: () => n.show()
29
+ setup(s, { expose: k }) {
30
+ k({
31
+ openCreateWorkspace: () => c.show()
28
32
  });
29
- const e = o.getAppState(), v = o.getCommandPaletteState();
30
- typeof window < "u" && (window.dataDumpWorkspace = () => e.store.value, window.dumpAppState = () => e), _({ workspaceStore: e.store }), D(e.eventBus, o.layout), M({
31
- documentName: () => e.store.value?.workspace[E.workspace.activeDocument],
33
+ const e = s.getAppState(), w = s.getCommandPaletteState();
34
+ typeof window < "u" && (window.dataDumpWorkspace = () => e.store.value, window.dumpAppState = () => e);
35
+ const { isDarkMode: f } = D({ workspaceStore: e.store });
36
+ I(e.eventBus, s.layout), A({
37
+ documentName: () => e.store.value?.workspace[M.workspace.activeDocument],
32
38
  store: e.store,
33
39
  initialTimeout: 5e3
34
40
  });
35
- const k = u(() => {
41
+ const S = d(() => {
36
42
  if (e.store.value === null)
37
43
  return "";
38
- const i = e.store.value.workspace["x-scalar-theme"];
39
- return i ? `<style>${B(i)}</style>` : "";
40
- }), w = () => e.router.value?.push({
41
- name: "workspace.environment",
42
- params: {
43
- workspaceSlug: e.activeEntities.workspaceSlug.value
44
- }
45
- }), n = g(), S = u(() => ({
44
+ const r = e.store.value.workspace["x-scalar-theme"];
45
+ return r ? `<style>${x(r)}</style>` : "";
46
+ }), l = (r) => {
47
+ if (!r)
48
+ return;
49
+ const a = e.workspace.workspaceList.value?.find(
50
+ (o) => o.id === r
51
+ );
52
+ a && e.workspace.navigateToWorkspace(a.namespace, a.slug);
53
+ }, c = g(), b = d(() => ({
46
54
  documentSlug: e.activeEntities.documentSlug.value ?? "",
47
55
  document: e.store.value?.workspace.activeDocument ?? null,
48
56
  environment: e.environment.value,
49
57
  eventBus: e.eventBus,
50
58
  exampleName: e.activeEntities.exampleName.value,
51
- layout: o.layout,
59
+ layout: s.layout,
52
60
  method: e.activeEntities.method.value,
53
61
  path: e.activeEntities.path.value,
54
62
  workspaceStore: e.store.value,
55
63
  activeWorkspace: e.workspace.activeWorkspace.value,
56
- plugins: o.plugins,
64
+ plugins: s.plugins,
57
65
  securitySchemes: e.document.value?.components?.securitySchemes ?? {}
58
66
  }));
59
- return (i, a) => t(e).store.value !== null && t(e).workspace.activeWorkspace.value !== null && !t(e).loading.value ? (l(), b(h, { key: 0 }, [
60
- p("div", { innerHTML: k.value }, null, 8, P),
61
- s(t(C), null, {
62
- default: m(() => [
63
- s(t(x)),
64
- o.layout === "desktop" ? (l(), c($, {
65
- key: 0,
66
- activeTabIndex: t(e).tabs.activeTabIndex.value,
67
- eventBus: t(e).eventBus,
68
- tabs: t(e).tabs.state.value
69
- }, null, 8, ["activeTabIndex", "eventBus", "tabs"])) : (l(), c(L, {
70
- key: 1,
71
- activeWorkspace: t(e).workspace.activeWorkspace.value,
72
- workspaces: t(e).workspace.workspaceList.value,
73
- "onCreate:workspace": a[0] || (a[0] = (r) => t(n).show()),
74
- "onSelect:workspace": t(e).workspace.setId
75
- }, null, 8, ["activeWorkspace", "workspaces", "onSelect:workspace"])),
76
- p("main", F, [
77
- s(N, {
78
- isSidebarOpen: t(e).sidebar.isOpen.value,
79
- "onUpdate:isSidebarOpen": a[1] || (a[1] = (r) => t(e).sidebar.isOpen.value = r),
80
- activeWorkspace: t(e).workspace.activeWorkspace.value,
81
- eventBus: t(e).eventBus,
82
- isWorkspaceOpen: t(e).workspace.isOpen.value,
83
- layout: o.layout,
84
- sidebarState: t(e).sidebar.state,
85
- sidebarWidth: t(e).sidebar.width.value,
86
- store: t(e).store.value,
87
- workspaces: t(e).workspace.workspaceList.value,
88
- "onClick:workspace": w,
89
- "onCreate:workspace": a[2] || (a[2] = (r) => t(n).show()),
90
- "onSelect:workspace": t(e).workspace.setId,
91
- onSelectItem: t(e).sidebar.handleSelectItem,
92
- "onUpdate:sidebarWidth": t(e).sidebar.handleSidebarWidthUpdate
93
- }, {
94
- sidebarMenuActions: m(() => [
95
- W(i.$slots, "sidebar-menu-actions")
67
+ return (r, a) => (i(), p(t(C), null, {
68
+ default: u(() => [
69
+ m("div", { innerHTML: S.value }, null, 8, H),
70
+ n(t(B)),
71
+ n(t(P), {
72
+ activeWorkspace: t(e).workspace.activeWorkspace.value,
73
+ darkMode: t(f),
74
+ workspaceStore: t(e).store.value,
75
+ workspaces: t(e).workspace.workspaceList.value,
76
+ "onCreate:workspace": a[4] || (a[4] = (o) => t(e).workspace.create(o)),
77
+ "onNavigateTo:document": a[5] || (a[5] = (o) => t(e).router.value?.push({
78
+ name: "document.overview",
79
+ params: {
80
+ documentSlug: o
81
+ }
82
+ })),
83
+ "onSelect:workspace": l
84
+ }, {
85
+ default: u(() => [
86
+ t(e).store.value !== null && t(e).workspace.activeWorkspace.value !== null && !t(e).loading.value ? (i(), v("main", F, [
87
+ s.layout === "desktop" ? (i(), p(N, {
88
+ key: 0,
89
+ activeTabIndex: t(e).tabs.activeTabIndex.value,
90
+ eventBus: t(e).eventBus,
91
+ tabs: t(e).tabs.state.value
92
+ }, null, 8, ["activeTabIndex", "eventBus", "tabs"])) : (i(), p($, {
93
+ key: 1,
94
+ activeWorkspace: t(e).workspace.activeWorkspace.value,
95
+ workspaces: t(e).workspace.workspaceList.value,
96
+ "onCreate:workspace": a[0] || (a[0] = (o) => t(c).show()),
97
+ "onSelect:workspace": l
98
+ }, null, 8, ["activeWorkspace", "workspaces"])),
99
+ m("div", V, [
100
+ n(L, {
101
+ isSidebarOpen: t(e).sidebar.isOpen.value,
102
+ "onUpdate:isSidebarOpen": a[1] || (a[1] = (o) => t(e).sidebar.isOpen.value = o),
103
+ activeWorkspace: t(e).workspace.activeWorkspace.value,
104
+ eventBus: t(e).eventBus,
105
+ isWorkspaceOpen: t(e).workspace.isOpen.value,
106
+ layout: s.layout,
107
+ sidebarState: t(e).sidebar.state,
108
+ sidebarWidth: t(e).sidebar.width.value,
109
+ store: t(e).store.value,
110
+ workspaces: t(e).workspace.workspaceList.value,
111
+ "onClick:workspace": t(e).workspace.navigateToWorkspace,
112
+ "onCreate:workspace": a[2] || (a[2] = (o) => t(c).show()),
113
+ "onSelect:workspace": l,
114
+ onSelectItem: t(e).sidebar.handleSelectItem,
115
+ "onUpdate:sidebarWidth": t(e).sidebar.handleSidebarWidthUpdate
116
+ }, {
117
+ sidebarMenuActions: u(() => [
118
+ T(r.$slots, "sidebar-menu-actions")
119
+ ]),
120
+ _: 3
121
+ }, 8, ["isSidebarOpen", "activeWorkspace", "eventBus", "isWorkspaceOpen", "layout", "sidebarState", "sidebarWidth", "store", "workspaces", "onClick:workspace", "onSelectItem", "onUpdate:sidebarWidth"]),
122
+ m("div", R, [
123
+ n(t(E), y(h(b.value)), null, 16)
124
+ ])
96
125
  ]),
97
- _: 3
98
- }, 8, ["isSidebarOpen", "activeWorkspace", "eventBus", "isWorkspaceOpen", "layout", "sidebarState", "sidebarWidth", "store", "workspaces", "onSelect:workspace", "onSelectItem", "onUpdate:sidebarWidth"]),
99
- s(I, {
100
- state: t(n),
101
- "onCreate:workspace": a[3] || (a[3] = (r) => t(e).workspace.create(r))
102
- }, null, 8, ["state"]),
103
- s(U, {
104
- eventBus: t(e).eventBus,
105
- paletteState: t(v),
106
- workspaceStore: t(e).store.value
107
- }, null, 8, ["eventBus", "paletteState", "workspaceStore"]),
108
- p("div", H, [
109
- s(t(O), y(T(S.value)), null, 16)
110
- ])
111
- ])
112
- ]),
113
- _: 3
114
- })
115
- ], 64)) : (l(), c(A, { key: 1 }));
126
+ n(O, {
127
+ state: t(c),
128
+ "onCreate:workspace": a[3] || (a[3] = (o) => t(e).workspace.create(o))
129
+ }, null, 8, ["state"]),
130
+ n(U, {
131
+ eventBus: t(e).eventBus,
132
+ paletteState: t(w),
133
+ workspaceStore: t(e).store.value
134
+ }, null, 8, ["eventBus", "paletteState", "workspaceStore"])
135
+ ])) : (i(), v("main", z, [
136
+ n(_)
137
+ ]))
138
+ ]),
139
+ _: 3
140
+ }, 8, ["activeWorkspace", "darkMode", "workspaceStore", "workspaces"])
141
+ ]),
142
+ _: 3
143
+ }));
116
144
  }
117
145
  });
118
146
  export {
119
- re as default
147
+ le as default
120
148
  };
@@ -8,18 +8,22 @@ import type { Tab } from '@scalar/workspace-store/schemas/extensions/workspace/x
8
8
  import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
9
9
  import { type ComputedRef, type Ref, type ShallowRef } from 'vue';
10
10
  import type { RouteLocationNormalizedGeneric, Router } from 'vue-router';
11
+ type WorkspaceOption = ScalarListboxOption & {
12
+ teamUid: string;
13
+ namespace: string;
14
+ slug: string;
15
+ };
11
16
  /**
12
- * Updates the route to reflect the currently selected workspace.
13
- * Navigates to the workspace's main environment view, with an option to control
14
- * whether the previous route path should be loaded via a query parameter.
17
+ * Navigates to the overview page of the specified workspace.
18
+ * Updates the route based on the given namespace and slug.
15
19
  *
16
- * @param id - The workspace slug (unique identifier) to navigate to.
17
- * @param loadFromSession - If true, includes "loadFromSession=true" in the query to indicate state/session should be restored.
20
+ * @param namespace - The workspace namespace.
21
+ * @param slug - The unique workspace slug (identifier).
18
22
  */
19
- declare const setWorkspaceId: (id?: string) => Promise<void>;
23
+ declare const navigateToWorkspace: (namespace?: string, slug?: string) => Promise<void>;
20
24
  /**
21
25
  * Creates a new workspace with the provided name.
22
- * - Generates a unique ID for the workspace (sluggified from the name and guaranteed unique).
26
+ * - Generates a unique slug for the workspace (sluggified from the name and guaranteed unique).
23
27
  * - Adds a default blank document ("drafts") to the workspace.
24
28
  * - Persists the workspace and navigates to it.
25
29
  *
@@ -27,12 +31,18 @@ declare const setWorkspaceId: (id?: string) => Promise<void>;
27
31
  * await createWorkspace({ name: 'My Awesome API' })
28
32
  * // -> Navigates to /workspace/my-awesome-api (if available)
29
33
  */
30
- declare const createWorkspace: ({ id, name, }: {
31
- id?: string;
34
+ declare const createWorkspace: ({ key, name, }: {
35
+ key?: {
36
+ teamUid?: string;
37
+ namespace?: string;
38
+ slug: string;
39
+ };
32
40
  name: string;
33
41
  }) => Promise<{
34
- id: string;
42
+ slug: string;
35
43
  name: string;
44
+ namespace: string;
45
+ teamUid: string;
36
46
  } | undefined>;
37
47
  declare const sidebarState: {
38
48
  items: ComputedRef<TraversedEntry[]>;
@@ -110,9 +120,9 @@ export type AppState = {
110
120
  };
111
121
  workspace: {
112
122
  create: typeof createWorkspace;
113
- workspaceList: Ref<ScalarListboxOption[]>;
123
+ workspaceList: Ref<WorkspaceOption[]>;
114
124
  activeWorkspace: ShallowRef<ScalarListboxOption | null>;
115
- setId: typeof setWorkspaceId;
125
+ navigateToWorkspace: typeof navigateToWorkspace;
116
126
  isOpen: ComputedRef<boolean>;
117
127
  };
118
128
  eventBus: WorkspaceEventBus;
@@ -120,6 +130,7 @@ export type AppState = {
120
130
  currentRoute: Ref<RouteLocationNormalizedGeneric | null>;
121
131
  loading: Ref<boolean>;
122
132
  activeEntities: {
133
+ namespace: Ref<string | undefined>;
123
134
  workspaceSlug: Ref<string | undefined>;
124
135
  documentSlug: Ref<string | undefined>;
125
136
  path: Ref<string | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"app-state.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/app-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGnE,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,gCAAgC,CAAA;AAC1F,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,gCAAgC,CAAA;AAKvC,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oEAAoE,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,KAAK,UAAU,EAAoC,MAAM,KAAK,CAAA;AACnG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAyJxE;;;;;;;GAOG;AACH,QAAA,MAAM,cAAc,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,CASvD,CAAA;AAED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