@scalar/api-client 2.26.1 → 2.27.1

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 (158) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/dist/components/Server/ServerSelector.vue.js +6 -6
  3. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +6 -6
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -1
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +48 -43
  8. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  9. package/dist/v2/blocks/operation-block/components/Header.vue2.js +10 -10
  10. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +29 -25
  12. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/get-example.js +15 -15
  14. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +10 -0
  15. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +1 -0
  16. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +4 -0
  17. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -1
  18. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  19. package/dist/v2/blocks/operation-block/helpers/send-request.js +1 -1
  20. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +1 -1
  21. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  23. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +101 -100
  24. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  26. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +62 -69
  27. package/dist/v2/blocks/request-block/components/RequestParams.vue.js +6 -6
  28. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +36 -2
  29. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  31. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +38 -3
  32. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  33. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  34. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +1 -1
  35. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  36. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  37. package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +68 -69
  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 +1 -1
  40. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -40
  41. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
  42. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +35 -41
  43. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +37 -41
  45. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +3 -2
  46. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  47. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +107 -87
  48. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +21 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -0
  50. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js +91 -0
  51. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue2.js +4 -0
  52. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  53. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +107 -93
  54. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  55. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +87 -65
  56. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +36 -0
  57. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -0
  58. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +35 -0
  59. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +1 -1
  60. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +1 -1
  61. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +18 -10
  62. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts +5 -0
  63. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -0
  64. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +27 -0
  65. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +3 -1
  66. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
  67. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -2
  68. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  69. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +29 -37
  70. package/dist/v2/components/layout/CollapsibleSection.vue.js +1 -1
  71. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts +2 -2
  72. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
  73. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  74. package/dist/v2/components/modals/ModalClientContainer.vue2.js +45 -42
  75. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +2 -0
  76. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  77. package/dist/v2/components/sidebar/Sidebar.vue.js +25 -24
  78. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +2 -0
  79. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  80. package/dist/v2/components/sidebar/SidebarMenu.vue.js +30 -30
  81. package/dist/v2/features/app/App.vue.d.ts +6 -1
  82. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  83. package/dist/v2/features/app/App.vue.js +48 -46
  84. package/dist/v2/features/app/app-events.d.ts +1 -1
  85. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  86. package/dist/v2/features/app/app-events.js +95 -56
  87. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  88. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  89. package/dist/v2/features/app/components/AppSidebar.vue2.js +111 -105
  90. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +12 -2
  91. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  92. package/dist/v2/features/app/helpers/create-api-client-app.js +12 -10
  93. package/dist/v2/features/app/helpers/routes.d.ts +3 -1
  94. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  95. package/dist/v2/features/app/hooks/use-theme.d.ts +42 -0
  96. package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -0
  97. package/dist/v2/features/app/hooks/use-theme.js +34 -0
  98. package/dist/v2/features/app/index.d.ts +0 -1
  99. package/dist/v2/features/app/index.d.ts.map +1 -1
  100. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  101. package/dist/v2/features/collection/DocumentCollection.vue.js +27 -26
  102. package/dist/v2/features/collection/WorkspaceCollection.vue.js +13 -12
  103. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  104. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  105. package/dist/v2/features/collection/components/Authentication.vue2.js +49 -40
  106. package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
  107. package/dist/v2/features/collection/components/Cookies.vue.js +26 -13
  108. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  109. package/dist/v2/features/collection/components/Environment.vue.js +27 -15
  110. package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
  111. package/dist/v2/features/collection/components/Overview.vue.js +2 -2
  112. package/dist/v2/features/collection/components/Overview.vue2.js +68 -61
  113. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  114. package/dist/v2/features/collection/components/Servers.vue.js +93 -88
  115. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  116. package/dist/v2/features/collection/components/Settings.vue.js +19 -17
  117. package/dist/v2/features/environments/EnvironmentsList.vue.js +1 -1
  118. package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
  119. package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +2 -2
  120. package/dist/v2/features/global-cookies/components/CookiesTable.vue2.js +8 -8
  121. package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
  122. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  123. package/dist/v2/features/modal/Modal.vue.js +15 -15
  124. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +1 -1
  125. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  126. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  127. package/dist/v2/features/operation/Operation.vue.js +31 -34
  128. package/dist/v2/features/settings/CollectionSettings.vue.d.ts +10 -7
  129. package/dist/v2/features/settings/CollectionSettings.vue.d.ts.map +1 -1
  130. package/dist/v2/features/settings/CollectionSettings.vue.js +183 -149
  131. package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
  132. package/dist/v2/features/settings/DocumentSettings.vue.js +88 -79
  133. package/dist/v2/features/settings/components/Section.vue.d.ts +2 -1
  134. package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
  135. package/dist/v2/features/settings/components/Section.vue.js +26 -15
  136. package/dist/v2/features/settings/helpers/get-theme-colors.d.ts +4 -3
  137. package/dist/v2/features/settings/helpers/get-theme-colors.d.ts.map +1 -1
  138. package/dist/v2/features/settings/helpers/get-theme-colors.js +6 -7
  139. package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
  140. package/dist/v2/helpers/handle-hotkeys.js +2 -2
  141. package/dist/v2/helpers/index.d.ts +0 -1
  142. package/dist/v2/helpers/index.d.ts.map +1 -1
  143. package/dist/v2/hooks/use-global-hot-keys.d.ts +3 -1
  144. package/dist/v2/hooks/use-global-hot-keys.d.ts.map +1 -1
  145. package/dist/v2/hooks/use-global-hot-keys.js +8 -6
  146. package/dist/v2/workspace-events.d.ts.map +1 -1
  147. package/dist/v2/workspace-events.js +10 -0
  148. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  149. package/dist/views/Request/RequestSidebar.vue.js +2 -2
  150. package/dist/views/Request/RequestSidebar.vue2.js +139 -155
  151. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  152. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  153. package/dist/views/Request/RequestSidebarItem.vue2.js +104 -101
  154. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  155. package/package.json +20 -18
  156. package/dist/v2/helpers/plugins.d.ts +0 -65
  157. package/dist/v2/helpers/plugins.d.ts.map +0 -1
  158. package/dist/v2/helpers/plugins.js +0 -11
@@ -1,24 +1,25 @@
1
- import { defineComponent as R, mergeModels as W, computed as k, capitalize as V, useModel as I, ref as F, createElementBlock as c, openBlock as u, createVNode as d, createBlock as M, createCommentVNode as p, unref as s, createSlots as G, withCtx as r, createTextVNode as b, createElementVNode as l, withKeys as w, withModifiers as v, toDisplayString as L, renderSlot as j, normalizeClass as H, Fragment as h, nextTick as U } from "vue";
2
- import { useModal as J, ScalarSidebarItem as O, ScalarIconButton as Y, ScalarButton as $, ScalarModal as Q } from "@scalar/components";
1
+ import { defineComponent as L, mergeModels as I, computed as k, capitalize as R, useModel as W, ref as V, createElementBlock as c, openBlock as u, createVNode as d, createBlock as x, createCommentVNode as p, unref as i, createSlots as j, withCtx as r, createTextVNode as b, createElementVNode as l, withKeys as w, withModifiers as v, toDisplayString as F, renderSlot as G, normalizeClass as H, Fragment as h, nextTick as U } from "vue";
2
+ import { useModal as J, ScalarSidebarItem as $, ScalarIconButton as Y, ScalarButton as O, ScalarModal as Q } from "@scalar/components";
3
3
  import { isMacOS as X } from "@scalar/helpers/general/is-mac-os";
4
4
  import { ScalarIconPlus as Z, ScalarIconDotsThree as _, ScalarIconGlobe as ee } from "@scalar/icons";
5
- import { getParentEntry as S } from "@scalar/workspace-store/navigation";
6
- import te from "../../../../assets/rabbit.ascii.js";
7
- import ae from "../../../../assets/rabbitjump.ascii.js";
5
+ import { LibraryIcon as te } from "@scalar/icons/library";
6
+ import { getParentEntry as g } from "@scalar/workspace-store/navigation";
7
+ import ae from "../../../../assets/rabbit.ascii.js";
8
+ import oe from "../../../../assets/rabbitjump.ascii.js";
8
9
  import E from "../../../../components/ScalarAsciiArt.vue.js";
9
- import oe from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
10
- import ne from "./SidebarItemMenu.vue.js";
10
+ import ne from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
11
+ import ie from "./SidebarItemMenu.vue.js";
11
12
  import { dragHandleFactory as se } from "../../../helpers/drag-handle-factory.js";
12
- import ie from "../../../components/sidebar/Sidebar.vue.js";
13
- const re = { class: "flex" }, le = {
13
+ import re from "../../../components/sidebar/Sidebar.vue.js";
14
+ const le = { class: "flex" }, de = {
14
15
  key: 0,
15
- class: "flex items-center"
16
- }, de = {
16
+ class: "relative flex items-center"
17
+ }, ue = {
17
18
  key: 0,
18
19
  class: "empty-sidebar-item-content overflow-hidden px-2.5 py-2.5"
19
- }, ue = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, me = { class: "gap-1.5 p-2" }, ce = { class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase" }, Ce = /* @__PURE__ */ R({
20
+ }, me = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, ce = { class: "gap-1.5 p-2" }, pe = { class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase" }, We = /* @__PURE__ */ L({
20
21
  __name: "AppSidebar",
21
- props: /* @__PURE__ */ W({
22
+ props: /* @__PURE__ */ I({
22
23
  layout: {},
23
24
  sidebarState: {},
24
25
  isWorkspaceOpen: { type: Boolean },
@@ -35,65 +36,65 @@ const re = { class: "flex" }, le = {
35
36
  },
36
37
  sidebarWidthModifiers: {}
37
38
  }),
38
- emits: /* @__PURE__ */ W(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
39
- setup(o, { emit: A }) {
40
- const f = A, D = k(() => V(o.activeWorkspace.label)), x = I(o, "isSidebarOpen"), B = I(o, "sidebarWidth"), g = k(() => o.sidebarState.items.value.length <= 1), C = k(
39
+ emits: /* @__PURE__ */ I(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
40
+ setup(a, { emit: A }) {
41
+ const f = A, D = k(() => R(a.activeWorkspace.label)), M = W(a, "isSidebarOpen"), B = W(a, "sidebarWidth"), S = k(() => a.sidebarState.items.value.length <= 1), C = k(
41
42
  () => se({
42
- store: o.store,
43
- sidebarState: o.sidebarState
43
+ store: a.store,
44
+ sidebarState: a.sidebarState
44
45
  })
45
- ), N = (a, e) => C.value.handleDragEnd(a, e), T = (a, e) => C.value.isDroppable(a, e), i = F(null), y = J(), K = k(() => {
46
- const a = i.value?.item;
47
- return a?.type === "document" ? "This cannot be undone. You're about to delete the document and all tags and operations inside it." : `Are you sure you want to delete this ${a?.type ?? "item"}? This action cannot be undone.`;
46
+ ), N = (o, e) => C.value.handleDragEnd(o, e), T = (o, e) => C.value.isDroppable(o, e), s = V(null), y = J(), K = k(() => {
47
+ const o = s.value?.item;
48
+ return o?.type === "document" ? "This cannot be undone. You're about to delete the document and all tags and operations inside it." : `Are you sure you want to delete this ${o?.type ?? "item"}? This action cannot be undone.`;
48
49
  }), z = () => {
49
- const a = i.value?.item;
50
- if (!a)
50
+ const o = s.value?.item;
51
+ if (!o)
51
52
  return;
52
- const e = o.sidebarState.getEntryById(a.id), t = S("document", e), n = S("operation", e);
53
+ const e = a.sidebarState.getEntryById(o.id), t = g("document", e), n = g("operation", e);
53
54
  if (t) {
54
- if (a.type === "document")
55
- o.eventBus.emit("document:delete:document", { name: t.name });
56
- else if (a.type === "tag")
57
- o.eventBus.emit("tag:delete:tag", {
55
+ if (o.type === "document")
56
+ a.eventBus.emit("document:delete:document", { name: t.name });
57
+ else if (o.type === "tag")
58
+ a.eventBus.emit("tag:delete:tag", {
58
59
  documentName: t.name,
59
- name: a.name
60
+ name: o.name
60
61
  });
61
- else if (a.type === "operation") {
62
+ else if (o.type === "operation") {
62
63
  if (!n)
63
64
  return;
64
- o.eventBus.emit("operation:delete:operation", {
65
+ a.eventBus.emit("operation:delete:operation", {
65
66
  meta: {
66
67
  method: n.method,
67
68
  path: n.path
68
69
  },
69
70
  documentName: t.name
70
71
  });
71
- } else if (a.type === "example") {
72
+ } else if (o.type === "example") {
72
73
  if (!n)
73
74
  return;
74
- o.eventBus.emit("operation:delete:example", {
75
+ a.eventBus.emit("operation:delete:example", {
75
76
  meta: {
76
77
  method: n.method,
77
78
  path: n.path,
78
- exampleKey: a.name
79
+ exampleKey: o.name
79
80
  },
80
81
  documentName: t.name
81
82
  });
82
83
  }
83
- y.hide(), i.value = null;
84
+ y.hide(), s.value = null;
84
85
  }
85
- }, m = async (a, e) => {
86
- if (i.value?.showMenu)
86
+ }, m = async (o, e) => {
87
+ if (s.value?.showMenu)
87
88
  return;
88
- const t = a.currentTarget;
89
- i.value = { item: e, el: t, showMenu: !0 }, await U();
90
- const n = a instanceof MouseEvent ? new MouseEvent(a.type, a) : new KeyboardEvent(a.type, a);
91
- i.value?.el.dispatchEvent(n);
89
+ const t = o.currentTarget;
90
+ s.value = { item: e, el: t, showMenu: !0 }, await U();
91
+ const n = o instanceof MouseEvent ? new MouseEvent(o.type, o) : new KeyboardEvent(o.type, o);
92
+ s.value?.el.dispatchEvent(n);
92
93
  }, P = () => {
93
- i.value && (i.value.showMenu = !1);
94
- }, q = (a) => {
95
- const e = o.sidebarState.getEntryById(a.id), t = S("document", e), n = S("tag", e);
96
- o.eventBus.emit("ui:open:command-palette", {
94
+ s.value && (s.value.showMenu = !1);
95
+ }, q = (o) => {
96
+ const e = a.sidebarState.getEntryById(o.id), t = g("document", e), n = g("tag", e);
97
+ a.eventBus.emit("ui:open:command-palette", {
97
98
  action: "create-request",
98
99
  payload: {
99
100
  documentId: t?.id,
@@ -101,44 +102,45 @@ const re = { class: "flex" }, le = {
101
102
  }
102
103
  });
103
104
  };
104
- return (a, e) => (u(), c("div", re, [
105
- d(s(ie), {
106
- isSidebarOpen: x.value,
107
- "onUpdate:isSidebarOpen": e[3] || (e[3] = (t) => x.value = t),
105
+ return (o, e) => (u(), c("div", le, [
106
+ d(i(re), {
107
+ isSidebarOpen: M.value,
108
+ "onUpdate:isSidebarOpen": e[3] || (e[3] = (t) => M.value = t),
108
109
  sidebarWidth: B.value,
109
110
  "onUpdate:sidebarWidth": e[4] || (e[4] = (t) => B.value = t),
110
- activeWorkspace: o.activeWorkspace,
111
- documents: Object.values(o.store.workspace.documents),
111
+ activeWorkspace: a.activeWorkspace,
112
+ documents: Object.values(a.store.workspace.documents),
112
113
  isDroppable: T,
113
- layout: o.layout,
114
- sidebarState: o.sidebarState,
115
- workspaces: o.workspaces,
114
+ layout: a.layout,
115
+ sidebarState: a.sidebarState,
116
+ workspaces: a.workspaces,
116
117
  "onCreate:workspace": e[5] || (e[5] = (t) => f("create:workspace")),
117
- onReorder: e[6] || (e[6] = (t, n) => N(t, n)),
118
- "onSelect:workspace": e[7] || (e[7] = (t) => f("select:workspace", t)),
119
- onSelectItem: e[8] || (e[8] = (t) => f("selectItem", t))
120
- }, G({
118
+ "onNavigate:to:settings": e[6] || (e[6] = (t) => a.eventBus.emit("ui:navigate", { page: "workspace", path: "settings" })),
119
+ onReorder: e[7] || (e[7] = (t, n) => N(t, n)),
120
+ "onSelect:workspace": e[8] || (e[8] = (t) => f("select:workspace", t)),
121
+ onSelectItem: e[9] || (e[9] = (t) => f("selectItem", t))
122
+ }, j({
121
123
  sidebarMenuActions: r(() => [
122
- j(a.$slots, "sidebarMenuActions", {}, void 0, !0)
124
+ G(o.$slots, "sidebarMenuActions", {}, void 0, !0)
123
125
  ]),
124
126
  workspaceButton: r(() => [
125
- d(s(O), {
127
+ d(i($), {
126
128
  is: "button",
127
- active: o.isWorkspaceOpen,
128
- icon: s(ee),
129
+ active: a.isWorkspaceOpen,
130
+ icon: i(ee),
129
131
  onClick: e[0] || (e[0] = (t) => f("click:workspace"))
130
132
  }, {
131
133
  default: r(() => [
132
- b(L(D.value), 1)
134
+ b(F(D.value), 1)
133
135
  ]),
134
136
  _: 1
135
137
  }, 8, ["active", "icon"])
136
138
  ]),
137
139
  decorator: r(({ item: t }) => [
138
- d(s(Y), {
140
+ d(i(Y), {
139
141
  "aria-expanded": "false",
140
142
  "aria-haspopup": "menu",
141
- icon: s(_),
143
+ icon: i(_),
142
144
  label: "More options",
143
145
  size: "sm",
144
146
  weight: "bold",
@@ -152,19 +154,23 @@ const re = { class: "flex" }, le = {
152
154
  }, null, 8, ["icon", "onClick", "onKeydown"])
153
155
  ]),
154
156
  icon: r(({ item: t }) => [
155
- t.type === "document" && o.store.workspace.documents[t.name]?.["x-scalar-is-dirty"] === !0 ? (u(), c("div", le, [...e[11] || (e[11] = [
156
- l("div", { class: "h-2 w-2 rounded-full bg-white" }, null, -1)
157
- ])])) : p("", !0)
157
+ t.type === "document" && a.store.workspace.documents[t.name]?.["x-scalar-is-dirty"] === !0 ? (u(), c("div", de, [
158
+ d(i(te), {
159
+ class: "block",
160
+ src: "icon" in t && t.icon || "interface-content-folder"
161
+ }, null, 8, ["src"]),
162
+ e[12] || (e[12] = l("div", { class: "bg-orange absolute -top-1.25 -right-1.25 flex h-2.5 w-2.5 items-center justify-center rounded-full text-[9px] font-bold text-white" }, " ! ", -1))
163
+ ])) : p("", !0)
158
164
  ]),
159
165
  empty: r(({ item: t }) => [
160
- d(s(O), {
166
+ d(i($), {
161
167
  is: "button",
162
168
  onClick: (n) => q(t)
163
169
  }, {
164
170
  icon: r(() => [
165
- d(s(Z))
171
+ d(i(Z))
166
172
  ]),
167
- default: r(() => [...e[12] || (e[12] = [
173
+ default: r(() => [...e[13] || (e[13] = [
168
174
  b("Add operation", -1)
169
175
  ])]),
170
176
  _: 1
@@ -172,63 +178,63 @@ const re = { class: "flex" }, le = {
172
178
  ]),
173
179
  _: 2
174
180
  }, [
175
- o.layout !== "modal" ? {
181
+ a.layout !== "modal" ? {
176
182
  name: "footer",
177
183
  fn: r(() => [
178
184
  l("div", {
179
185
  class: H({
180
- "empty-sidebar-item border-t": g.value
186
+ "empty-sidebar-item border-t": S.value
181
187
  })
182
188
  }, [
183
- g.value ? (u(), c("div", de, [
184
- l("div", ue, [
189
+ S.value ? (u(), c("div", ue, [
190
+ l("div", me, [
185
191
  d(E, {
186
- art: s(te),
192
+ art: i(ae),
187
193
  class: "rabbitsit font-bold"
188
194
  }, null, 8, ["art"]),
189
195
  d(E, {
190
- art: s(ae),
196
+ art: i(oe),
191
197
  class: "rabbitjump absolute top-0 left-0 font-bold"
192
198
  }, null, 8, ["art"])
193
199
  ]),
194
- e[13] || (e[13] = l("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
200
+ e[14] || (e[14] = l("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
195
201
  l("b", { class: "font-medium" }, "Let's Get Started"),
196
202
  l("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
197
203
  ], -1))
198
204
  ])) : p("", !0),
199
- l("div", me, [
200
- g.value ? (u(), M(s($), {
205
+ l("div", ce, [
206
+ S.value ? (u(), x(i(O), {
201
207
  key: 0,
202
208
  class: "w-full",
203
209
  size: "sm",
204
- onClick: e[1] || (e[1] = (t) => o.eventBus.emit("ui:open:command-palette", {
210
+ onClick: e[1] || (e[1] = (t) => a.eventBus.emit("ui:open:command-palette", {
205
211
  action: "import-from-openapi-swagger-postman-curl",
206
212
  payload: void 0
207
213
  }))
208
214
  }, {
209
- default: r(() => [...e[14] || (e[14] = [
215
+ default: r(() => [...e[15] || (e[15] = [
210
216
  b(" Import Collection ", -1)
211
217
  ])]),
212
218
  _: 1
213
219
  })) : p("", !0),
214
- d(s($), {
220
+ d(i(O), {
215
221
  class: "w-full",
216
222
  hotkey: "K",
217
223
  size: "sm",
218
224
  variant: "outlined",
219
- onClick: e[2] || (e[2] = (t) => o.eventBus.emit("ui:open:command-palette"))
225
+ onClick: e[2] || (e[2] = (t) => a.eventBus.emit("ui:open:command-palette"))
220
226
  }, {
221
227
  default: r(() => [
222
- e[20] || (e[20] = b(" Add Item   ", -1)),
223
- l("span", ce, [
224
- s(X)() ? (u(), c(h, { key: 0 }, [
225
- e[15] || (e[15] = l("span", { class: "sr-only" }, "Command", -1)),
226
- e[16] || (e[16] = l("span", { "aria-hidden": "true" }, "⌘", -1))
228
+ e[21] || (e[21] = b(" Add Item   ", -1)),
229
+ l("span", pe, [
230
+ i(X)() ? (u(), c(h, { key: 0 }, [
231
+ e[16] || (e[16] = l("span", { class: "sr-only" }, "Command", -1)),
232
+ e[17] || (e[17] = l("span", { "aria-hidden": "true" }, "⌘", -1))
227
233
  ], 64)) : (u(), c(h, { key: 1 }, [
228
- e[17] || (e[17] = l("span", { class: "sr-only" }, "CTRL", -1)),
229
- e[18] || (e[18] = l("span", { "aria-hidden": "true" }, "⌃", -1))
234
+ e[18] || (e[18] = l("span", { class: "sr-only" }, "CTRL", -1)),
235
+ e[19] || (e[19] = l("span", { "aria-hidden": "true" }, "⌃", -1))
230
236
  ], 64)),
231
- e[19] || (e[19] = b(" K ", -1))
237
+ e[20] || (e[20] = b(" K ", -1))
232
238
  ])
233
239
  ]),
234
240
  _: 1
@@ -239,26 +245,26 @@ const re = { class: "flex" }, le = {
239
245
  key: "0"
240
246
  } : void 0
241
247
  ]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "layout", "sidebarState", "workspaces"]),
242
- i.value?.showMenu ? (u(), M(ne, {
248
+ s.value?.showMenu ? (u(), x(ie, {
243
249
  key: 0,
244
- eventBus: o.eventBus,
245
- item: i.value.item,
246
- sidebarState: o.sidebarState,
247
- target: i.value.el,
250
+ eventBus: a.eventBus,
251
+ item: s.value.item,
252
+ sidebarState: a.sidebarState,
253
+ target: s.value.el,
248
254
  onCloseMenu: P,
249
- onShowDeleteModal: e[9] || (e[9] = (t) => s(y).show())
255
+ onShowDeleteModal: e[10] || (e[10] = (t) => i(y).show())
250
256
  }, null, 8, ["eventBus", "item", "sidebarState", "target"])) : p("", !0),
251
- i.value ? (u(), M(s(Q), {
257
+ s.value ? (u(), x(i(Q), {
252
258
  key: 1,
253
259
  size: "xxs",
254
- state: s(y),
255
- title: `Delete ${i.value.item.title}`
260
+ state: i(y),
261
+ title: `Delete ${s.value.item.title}`
256
262
  }, {
257
263
  default: r(() => [
258
- d(oe, {
259
- variableName: i.value.item.title,
264
+ d(ne, {
265
+ variableName: s.value.item.title,
260
266
  warningMessage: K.value,
261
- onClose: e[10] || (e[10] = (t) => s(y).hide()),
267
+ onClose: e[11] || (e[11] = (t) => i(y).hide()),
262
268
  onDelete: z
263
269
  }, null, 8, ["variableName", "warningMessage"])
264
270
  ]),
@@ -268,5 +274,5 @@ const re = { class: "flex" }, le = {
268
274
  }
269
275
  });
270
276
  export {
271
- Ce as default
277
+ We as default
272
278
  };
@@ -1,4 +1,5 @@
1
- import type { ClientPlugin } from '../../../../v2/helpers/plugins.js';
1
+ import type { ClientPlugin } from '@scalar/oas-utils/helpers';
2
+ import type { Theme } from '@scalar/themes';
2
3
  import type { ClientLayout } from '../../../../v2/types/layout';
3
4
  type CreateApiClientOptions = {
4
5
  /**
@@ -12,6 +13,15 @@ type CreateApiClientOptions = {
12
13
  * Api client plugins to include in the app
13
14
  */
14
15
  plugins?: ClientPlugin[];
16
+ /**
17
+ * Custom themes to include in the app
18
+ */
19
+ customThemes?: Theme[];
20
+ /**
21
+ * Fallback theme slug to use if no theme is selected for the workspace
22
+ * @default 'default'
23
+ */
24
+ fallbackThemeSlug?: string;
15
25
  };
16
26
  /**
17
27
  * Creates the appropriate router with the appropriate routes based on the layout
@@ -20,7 +30,7 @@ export declare const createAppRouter: (layout: CreateApiClientOptions["layout"])
20
30
  /**
21
31
  * Create the API Client with router and passes in the workspace store as a prop
22
32
  */
23
- export declare const createApiClientApp: (el: HTMLElement | null, { layout, plugins }: CreateApiClientOptions) => Promise<{
33
+ export declare const createApiClientApp: (el: HTMLElement | null, { layout, plugins, customThemes, fallbackThemeSlug }: CreateApiClientOptions) => Promise<{
24
34
  app: import("vue").App<Element>;
25
35
  state: import("../../../../v2/features/app/app-state.js").AppState;
26
36
  } | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"create-api-client-app.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/create-api-client-app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrD,KAAK,sBAAsB,GAAG;IAC5B;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,sBAAsB,CAAC,QAAQ,CAAC,gCAQvE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,IAAI,WAAW,GAAG,IAAI,EACtB,qBAAiC,sBAAsB;;;cAgCxD,CAAA"}
1
+ {"version":3,"file":"create-api-client-app.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/create-api-client-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAO3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrD,KAAK,sBAAsB,GAAG;IAC5B;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,sBAAsB,CAAC,QAAQ,CAAC,gCAQvE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,IAAI,WAAW,GAAG,IAAI,EACtB,sDAA8E,sBAAsB;;;cAkCrG,CAAA"}
@@ -1,16 +1,18 @@
1
- import { createApp as n } from "vue";
2
- import { createRouter as p, createWebHistory as s, createWebHashHistory as l } from "vue-router";
3
- import u from "../App.vue.js";
1
+ import { createApp as l } from "vue";
2
+ import { createRouter as p, createWebHistory as u, createWebHashHistory as d } from "vue-router";
3
+ import f from "../App.vue.js";
4
4
  /* empty css */
5
- import { createAppState as d } from "../app-state.js";
5
+ import { createAppState as A } from "../app-state.js";
6
6
  import { ROUTES as c } from "./routes.js";
7
- import { useCommandPaletteState as f } from "../../command-palette/hooks/use-command-palette-state.js";
8
- const A = (t) => t === "web" ? p({ history: s(), routes: c }) : p({ history: l(), routes: c }), P = async (t, { layout: r = "desktop", plugins: i }) => {
9
- const o = A(r), a = await d({ router: o }), m = f(), e = n(u, {
7
+ import { useCommandPaletteState as h } from "../../command-palette/hooks/use-command-palette-state.js";
8
+ const S = (t) => t === "web" ? p({ history: u(), routes: c }) : p({ history: d(), routes: c }), k = async (t, { layout: r = "desktop", plugins: i, customThemes: m, fallbackThemeSlug: n = "default" }) => {
9
+ const o = S(r), a = await A({ router: o }), s = h(), e = l(f, {
10
10
  layout: r,
11
11
  plugins: i,
12
+ customThemes: m,
13
+ fallbackThemeSlug: n,
12
14
  getAppState: () => a,
13
- getCommandPaletteState: () => m
15
+ getCommandPaletteState: () => s
14
16
  });
15
17
  if (e.use(o), !t) {
16
18
  console.error(
@@ -26,6 +28,6 @@ const A = (t) => t === "web" ? p({ history: s(), routes: c }) : p({ history: l()
26
28
  };
27
29
  };
28
30
  export {
29
- P as createApiClientApp,
30
- A as createAppRouter
31
+ k as createApiClientApp,
32
+ S as createAppRouter
31
33
  };
@@ -1,10 +1,11 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { ClientPlugin } from '@scalar/oas-utils/helpers';
3
+ import type { Theme } from '@scalar/themes';
2
4
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
5
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
4
6
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
5
7
  import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
6
8
  import type { MergedSecuritySchemes } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/merge-security.js';
7
- import type { ClientPlugin } from '../../../../v2/helpers/plugins.js';
8
9
  import type { ClientLayout } from '../../../../v2/types/layout';
9
10
  /** These props are provided at the route level */
10
11
  export type RouteProps = {
@@ -23,6 +24,7 @@ export type RouteProps = {
23
24
  label: string;
24
25
  };
25
26
  plugins: ClientPlugin[];
27
+ customThemes?: Theme[];
26
28
  };
27
29
  /** When in the collections pages */
28
30
  export type CollectionProps = RouteProps & ({
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAGlF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAA;AAU1G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,OAAO,EAAE,YAAY,EAAE,CAAA;CAGxB,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG,UAAU,GACtC,CACI;IACE,cAAc,EAAE,UAAU,CAAA;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,GACD;IACE,cAAc,EAAE,WAAW,CAAA;IAC3B,QAAQ,EAAE,IAAI,CAAA;CACf,CACJ,CAAA;AAEH,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,CAAA;AAEjB,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAlBK,UAAU;8BAChB,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;oCALE,UAAU;8BAChB,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;;;;;;;;;;;;;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;;;;;;;;IAgIM,CAAA"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAGlF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAA;AAW1G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;CAGvB,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG,UAAU,GACtC,CACI;IACE,cAAc,EAAE,UAAU,CAAA;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,GACD;IACE,cAAc,EAAE,WAAW,CAAA;IAC3B,QAAQ,EAAE,IAAI,CAAA;CACf,CACJ,CAAA;AAEH,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,CAAA;AAEjB,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAlBK,UAAU;8BAChB,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;oCALE,UAAU;8BAChB,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;;;;;;;;;;;;;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;;;;;;;;IAgIM,CAAA"}
@@ -0,0 +1,42 @@
1
+ import { type Theme } from '@scalar/themes';
2
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
+ import { type MaybeRefOrGetter } from 'vue';
4
+ /**
5
+ * useTheme
6
+ *
7
+ * Reactive Vue.js hook to resolve and generate a <style> tag string based on the current theme.
8
+ * Automatically selects the appropriate theme styles in the following priority order:
9
+ * 1. Workspace theme (from the provided store, e.g. store.workspace['x-scalar-theme'])
10
+ * 2. Fallback theme (from the fallbackThemeSlug prop)
11
+ * 3. Default built-in theme (with slug "default")
12
+ *
13
+ * The returned `themeStyleTag` can be injected into your page to dynamically apply theming.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // In a Vue component setup() function
18
+ * import { ref } from 'vue'
19
+ * import { useTheme } from './use-theme.js'
20
+ *
21
+ * const myThemes = ref([...])
22
+ * const workspaceStore = ref(...)
23
+ * const fallbackThemeSlug = ref('dark')
24
+ *
25
+ * const { themeStyleTag } = useTheme({
26
+ * customThemes: myThemes,
27
+ * fallbackThemeSlug,
28
+ * store: workspaceStore
29
+ * })
30
+ *
31
+ * // To inject in template:
32
+ * // <div v-html="themeStyleTag"></div>
33
+ * ```
34
+ */
35
+ export declare const useTheme: ({ fallbackThemeSlug, store, customThemes, }: {
36
+ customThemes: MaybeRefOrGetter<Theme[]>;
37
+ fallbackThemeSlug: MaybeRefOrGetter<string>;
38
+ store: MaybeRefOrGetter<WorkspaceStore | null>;
39
+ }) => {
40
+ themeStyleTag: import("vue").ComputedRef<string>;
41
+ };
42
+ //# sourceMappingURL=use-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAA8B,MAAM,gBAAgB,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,KAAK,CAAA;AAkC9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,QAAQ,GAAI,6CAItB;IACD,YAAY,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAA;IACvC,iBAAiB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC3C,KAAK,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;CAC/C;;CA2CA,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { themePresets as y, defaultFonts as S } from "@scalar/themes";
2
+ import { computed as T, toValue as a } from "vue";
3
+ const p = new Map(y.map((e) => [e.slug, e])), l = (e, s = "scalar-theme") => `<style id="scalar-theme" data-testid="${s}">${e}</style>`, o = (e, s) => {
4
+ const r = (t) => `${t}
5
+ ${S}`;
6
+ if (p.has(e))
7
+ return r(p.get(e)?.theme ?? "");
8
+ const c = s.find((t) => t.slug === e);
9
+ if (c)
10
+ return r(c.theme);
11
+ }, w = ({
12
+ fallbackThemeSlug: e,
13
+ store: s,
14
+ customThemes: r
15
+ }) => ({
16
+ themeStyleTag: T(() => {
17
+ const t = l(o("default", []), "default"), m = a(s), n = a(e);
18
+ if (m === null)
19
+ return t;
20
+ const f = m.workspace["x-scalar-theme"], u = f === "none" ? n : f;
21
+ if (!u) {
22
+ const i = o(n, a(r));
23
+ return i ? l(i, n) : t;
24
+ }
25
+ const h = o(u, a(r));
26
+ if (h)
27
+ return l(h, u);
28
+ const d = o(n, a(r));
29
+ return d ? l(d, n) : t;
30
+ })
31
+ });
32
+ export {
33
+ w as useTheme
34
+ };
@@ -2,7 +2,6 @@ export { type AppState, createAppState } from '../../../v2/features/app/app-stat
2
2
  export { default as CreateWorkspaceModal } from '../../../v2/features/app/components/CreateWorkspaceModal.vue.js';
3
3
  export { default as CommandActionForm } from '../../../v2/features/command-palette/components/CommandActionForm.vue.js';
4
4
  export { default as CommandActionInput } from '../../../v2/features/command-palette/components/CommandActionInput.vue.js';
5
- export type { ClientPlugin } from '../../../v2/helpers/plugins.js';
6
5
  export type { ClientLayout } from '../../../v2/types/layout';
7
6
  export { type CommandPaletteAction, type CommandPaletteRoute, baseClientActions, baseRoutes, useCommandPaletteState, } from '../command-palette/hooks/use-command-palette-state.js';
8
7
  export { default as ClientApp } from './App.vue.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,uDAAuD,CAAA;AACvG,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gEAAgE,CAAA;AAC7G,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,iEAAiE,CAAA;AAC/G,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,UAAU,EACV,sBAAsB,GACvB,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,uDAAuD,CAAA;AACvG,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gEAAgE,CAAA;AAC7G,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,iEAAiE,CAAA;AAC/G,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,UAAU,EACV,sBAAsB,GACvB,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentCollection.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/collection/DocumentCollection.vue"],"names":[],"mappings":"AAyJA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY,gSA6Vd,CAAC"}
1
+ {"version":3,"file":"DocumentCollection.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/collection/DocumentCollection.vue"],"names":[],"mappings":"AAyJA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY,gSA4Vd,CAAC"}