@scalar/api-client 2.0.24 → 2.0.25

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 (166) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBar.vue.js +2 -2
  4. package/dist/components/AddressBar/AddressBar.vue2.js +79 -83
  5. package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
  6. package/dist/components/CodeInput/CodeInput.vue.d.ts +10 -0
  7. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  8. package/dist/components/CodeInput/CodeInput.vue.js +3 -2
  9. package/dist/components/CodeInput/CodeInput.vue2.js +42 -37
  10. package/dist/components/CodeInput/codeDropdownWidget.d.ts +24 -0
  11. package/dist/components/CodeInput/codeDropdownWidget.d.ts.map +1 -0
  12. package/dist/components/CodeInput/codeDropdownWidget.js +110 -0
  13. package/dist/components/CodeInput/codeVariableWidget.d.ts +8 -0
  14. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -0
  15. package/dist/components/CodeInput/codeVariableWidget.js +124 -0
  16. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts +2 -15
  17. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  18. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +51 -54
  19. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts +4 -2
  20. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  21. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +106 -92
  22. package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts +2 -15
  23. package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
  24. package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +68 -74
  25. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts +2 -15
  26. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  27. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +56 -62
  28. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts +2 -15
  29. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  30. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +106 -99
  31. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts +7 -0
  32. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -0
  33. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +57 -0
  34. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue2.js +4 -0
  35. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +50 -0
  36. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -0
  37. package/dist/components/CommandPalette/TheCommandPalette.vue.js +9 -0
  38. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +198 -0
  39. package/dist/components/CommandPalette/index.d.ts +2 -0
  40. package/dist/components/CommandPalette/index.d.ts.map +1 -0
  41. package/dist/components/CommandPalette/index.js +4 -0
  42. package/dist/components/ContextBar.vue.js +4 -4
  43. package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
  44. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  45. package/dist/components/DataTable/DataTableInput.vue.js +3 -3
  46. package/dist/components/DataTable/DataTableInput.vue2.js +36 -49
  47. package/dist/components/SideNav/SideNav.vue.d.ts.map +1 -1
  48. package/dist/components/SideNav/SideNav.vue.js +26 -23
  49. package/dist/components/SideNav/SideNavLink.vue.d.ts +3 -2
  50. package/dist/components/SideNav/SideNavLink.vue.d.ts.map +1 -1
  51. package/dist/components/SideNav/SideNavLink.vue.js +5 -5
  52. package/dist/components/Sidebar/Sidebar.vue.d.ts +15 -2
  53. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  54. package/dist/components/Sidebar/Sidebar.vue.js +14 -12
  55. package/dist/components/Sidebar/SidebarButton.vue.d.ts.map +1 -1
  56. package/dist/components/Sidebar/SidebarButton.vue.js +5 -5
  57. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  58. package/dist/components/TopNav/TopNav.vue.js +2 -2
  59. package/dist/components/TopNav/TopNav.vue2.js +31 -28
  60. package/dist/components/TopNav/TopNavItem.vue.d.ts +7 -3
  61. package/dist/components/TopNav/TopNavItem.vue.d.ts.map +1 -1
  62. package/dist/components/TopNav/TopNavItem.vue.js +2 -2
  63. package/dist/components/TopNav/TopNavItem.vue2.js +16 -15
  64. package/dist/components/ViewLayout/ViewLayout.vue.d.ts.map +1 -1
  65. package/dist/components/ViewLayout/ViewLayout.vue.js +1 -1
  66. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
  67. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +2 -1
  68. package/dist/constants.d.ts +13 -7
  69. package/dist/constants.d.ts.map +1 -1
  70. package/dist/constants.js +4 -4
  71. package/dist/index.d.ts +2 -4
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +11 -16
  74. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -0
  75. package/dist/layouts/App/ApiClientApp.vue.js +72 -0
  76. package/dist/{App → layouts/App}/createApiClientApp.d.ts +1 -1
  77. package/dist/layouts/App/createApiClientApp.d.ts.map +1 -0
  78. package/dist/{App → layouts/App}/createApiClientApp.js +2 -2
  79. package/dist/layouts/App/index.d.ts.map +1 -0
  80. package/dist/{Modal → layouts/Modal}/ApiClientModal.vue.d.ts +1 -0
  81. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -0
  82. package/dist/{Modal → layouts/Modal}/ApiClientModal.vue.js +2 -2
  83. package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -0
  84. package/dist/{Modal → layouts/Modal}/api-client-modal.js +2 -2
  85. package/dist/layouts/Modal/index.d.ts.map +1 -0
  86. package/dist/libs/eventBusses/command-palette.d.ts +14 -0
  87. package/dist/libs/eventBusses/command-palette.d.ts.map +1 -0
  88. package/dist/libs/eventBusses/command-palette.js +5 -0
  89. package/dist/libs/local-storage.d.ts +1 -1
  90. package/dist/libs/local-storage.d.ts.map +1 -1
  91. package/dist/libs/local-storage.js +19 -19
  92. package/dist/router.d.ts +5 -10
  93. package/dist/router.d.ts.map +1 -1
  94. package/dist/router.js +23 -19
  95. package/dist/store/topNav.d.ts +94 -82
  96. package/dist/store/topNav.d.ts.map +1 -1
  97. package/dist/store/topNav.js +21 -20
  98. package/dist/store/workspace.d.ts +314 -84
  99. package/dist/store/workspace.d.ts.map +1 -1
  100. package/dist/store/workspace.js +299 -220
  101. package/dist/style.css +1 -1
  102. package/dist/views/Collection/Collection.vue.d.ts.map +1 -1
  103. package/dist/views/Components/Schemas/Schemas.vue.d.ts.map +1 -1
  104. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  105. package/dist/views/Cookies/Cookies.vue2.js +9 -12
  106. package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
  107. package/dist/views/Environment/Environment.vue2.js +22 -25
  108. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  109. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -47
  110. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  111. package/dist/views/Request/Request.vue.js +1 -1
  112. package/dist/views/Request/Request.vue2.js +122 -105
  113. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts +1 -1
  114. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  115. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  116. package/dist/views/Request/RequestSection/RequestSection.vue.js +5 -4
  117. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
  118. package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
  119. package/dist/views/Request/RequestSection/RequestTable.vue2.js +19 -19
  120. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.d.ts.map +1 -1
  121. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +6 -5
  122. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  123. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  124. package/dist/views/Request/RequestSidebarItem.vue2.js +78 -81
  125. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  126. package/dist/views/Request/RequestSidebarItemMenu.vue.js +53 -33
  127. package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
  128. package/dist/views/Request/ResponseSection/ResponseSection.vue.js +6 -5
  129. package/dist/views/Request/components/OAuth2.vue.d.ts.map +1 -1
  130. package/dist/views/Request/components/OAuth2.vue.js +2 -0
  131. package/dist/{App.vue.d.ts → views/Request/components/WorkspaceDropdown.vue.d.ts} +1 -2
  132. package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -0
  133. package/dist/views/Request/components/WorkspaceDropdown.vue.js +80 -0
  134. package/dist/views/Request/components/WorkspaceDropdown.vue2.js +4 -0
  135. package/dist/views/Request/components/index.d.ts +1 -0
  136. package/dist/views/Request/components/index.d.ts.map +1 -1
  137. package/dist/views/Request/components/index.js +4 -2
  138. package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
  139. package/dist/views/Servers/Servers.vue2.js +12 -15
  140. package/package.json +20 -16
  141. package/dist/App/ApiClientApp.vue.d.ts.map +0 -1
  142. package/dist/App/ApiClientApp.vue.js +0 -56
  143. package/dist/App/createApiClientApp.d.ts.map +0 -1
  144. package/dist/App/index.d.ts.map +0 -1
  145. package/dist/App.vue.d.ts.map +0 -1
  146. package/dist/App.vue.js +0 -77
  147. package/dist/App.vue3.js +0 -5
  148. package/dist/Modal/ApiClientModal.vue.d.ts.map +0 -1
  149. package/dist/Modal/api-client-modal.d.ts.map +0 -1
  150. package/dist/Modal/index.d.ts.map +0 -1
  151. package/dist/components/AddressBar/AddressBarServer.vue.js +0 -113
  152. package/dist/components/AddressBar/AddressBarServer.vue2.js +0 -4
  153. package/dist/components/CommandPalette/CommandPalette.vue.d.ts +0 -17
  154. package/dist/components/CommandPalette/CommandPalette.vue.d.ts.map +0 -1
  155. package/dist/components/CommandPalette/CommandPalette.vue.js +0 -7
  156. package/dist/components/CommandPalette/CommandPalette.vue2.js +0 -185
  157. package/dist/main.d.ts +0 -2
  158. package/dist/main.d.ts.map +0 -1
  159. /package/dist/{App → layouts/App}/ApiClientApp.vue.d.ts +0 -0
  160. /package/dist/{App → layouts/App}/ApiClientApp.vue3.js +0 -0
  161. /package/dist/{App → layouts/App}/index.d.ts +0 -0
  162. /package/dist/{App → layouts/App}/index.js +0 -0
  163. /package/dist/{Modal → layouts/Modal}/ApiClientModal.vue2.js +0 -0
  164. /package/dist/{Modal → layouts/Modal}/api-client-modal.d.ts +0 -0
  165. /package/dist/{Modal → layouts/Modal}/index.d.ts +0 -0
  166. /package/dist/{Modal → layouts/Modal}/index.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.0.25
4
+
5
+ ### Patch Changes
6
+
7
+ - 591fe24: fix: clipped border radius in requests items
8
+ - 7f17fe4: feat: move command palette into the client app base
9
+ - 1dab515: feat: revamp address bar
10
+ - 4d76ff5: feat: add support for multiple workspaces
11
+ - e8cd161: feat: store workspace in local storage
12
+ - a431eb0: fix: table checkbox for required params on import
13
+ - ff59399: fix: api client spacing issues, and icon thickness
14
+ - ec47287: feat: made request examples functional in client
15
+ - 747e80e: fix: only flex addressbar codemirror
16
+ - 9d561b7: fix: make app topbar draggable
17
+ - Updated dependencies [1dab515]
18
+ - Updated dependencies [5e060b1]
19
+ - Updated dependencies [ff59399]
20
+ - Updated dependencies [694c1d8]
21
+ - @scalar/oas-utils@0.2.15
22
+ - @scalar/themes@0.9.15
23
+ - @scalar/components@0.12.16
24
+ - @scalar/use-codemirror@0.11.7
25
+ - @scalar/object-utils@1.1.4
26
+ - @scalar/use-toasts@0.7.4
27
+ - @scalar/use-tooltip@1.0.2
28
+
3
29
  ## 2.0.24
4
30
 
5
31
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":";AAwpBA,wBAKG"}
1
+ {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":";AAkkBA,wBAKG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./AddressBar.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const d = /* @__PURE__ */ r(o, [["__scopeId", "data-v-02983c4d"]]);
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-231a70ec"]]);
5
5
  export {
6
- d as default
6
+ e as default
7
7
  };
@@ -1,125 +1,121 @@
1
- import { defineComponent as I, ref as p, watch as B, unref as o, openBlock as D, createElementBlock as M, createElementVNode as l, createVNode as r, withCtx as S, normalizeClass as C, normalizeStyle as N, withKeys as V, withModifiers as $, toDisplayString as T, createCommentVNode as A, pushScopeId as K, popScopeId as O } from "vue";
2
- import { useWorkspace as U } from "../../store/workspace.js";
1
+ import { defineComponent as q, ref as m, watch as V, unref as l, openBlock as B, createElementBlock as I, createElementVNode as o, createVNode as r, withCtx as _, normalizeClass as b, normalizeStyle as R, createCommentVNode as z, pushScopeId as M, popScopeId as U } from "vue";
2
+ import $ from "../CodeInput/CodeInput.vue.js";
3
+ import { useWorkspace as O } from "../../store/workspace.js";
3
4
  import { Listbox as H } from "@headlessui/vue";
4
- import { ScalarButton as L, ScalarIcon as P } from "@scalar/components";
5
- import { REQUEST_METHODS as W } from "@scalar/oas-utils/helpers";
6
- import { isMacOS as Q } from "@scalar/use-tooltip";
7
- import { useMagicKeys as j, whenever as F } from "@vueuse/core";
8
- import G from "../HttpMethod/HttpMethod.vue.js";
9
- import J from "./AddressBarHistory.vue.js";
10
- import X from "./AddressBarServer.vue.js";
11
- import { executeRequestBus as m } from "../../libs/eventBusses/executeRequestBus.js";
12
- const v = (d) => (K("data-v-02983c4d"), d = d(), O(), d), Y = {
5
+ import { ScalarButton as N, ScalarIcon as T } from "@scalar/components";
6
+ import { REQUEST_METHODS as L } from "@scalar/oas-utils/helpers";
7
+ import { isMacOS as A } from "@scalar/use-tooltip";
8
+ import { useMagicKeys as D, whenever as K } from "@vueuse/core";
9
+ import Q from "../HttpMethod/HttpMethod.vue.js";
10
+ import W from "./AddressBarHistory.vue.js";
11
+ import { executeRequestBus as c } from "../../libs/eventBusses/executeRequestBus.js";
12
+ const f = (n) => (M("data-v-231a70ec"), n = n(), U(), n), j = {
13
13
  key: 0,
14
14
  class: "order-last lg:order-none lg:w-auto w-full"
15
- }, Z = { class: "m-auto flex basis-1/2 flex-row items-center" }, ee = { class: "pointer-events-none absolute left-0 top-0 z-10 block h-full w-full overflow-hidden" }, te = { class: "flex gap-1" }, oe = { class: "scroll-timeline-x scroll-timeline-x-hidden relative flex w-full" }, le = /* @__PURE__ */ v(() => /* @__PURE__ */ l("div", { class: "fade-left" }, null, -1)), ne = ["contenteditable"], se = /* @__PURE__ */ v(() => /* @__PURE__ */ l("div", { class: "fade-right" }, null, -1)), ae = /* @__PURE__ */ v(() => /* @__PURE__ */ l("span", { class: "text-xxs relative z-10 lg:flex hidden" }, "Send", -1)), _e = /* @__PURE__ */ I({
15
+ }, F = { class: "m-auto flex basis-1/2 flex-row items-center" }, G = { class: "pointer-events-none absolute left-0 top-0 z-10 block h-full w-full overflow-hidden" }, J = { class: "flex gap-1" }, P = { class: "scroll-timeline-x scroll-timeline-x-hidden relative flex w-full" }, X = /* @__PURE__ */ f(() => /* @__PURE__ */ o("div", { class: "fade-left" }, null, -1)), Y = /* @__PURE__ */ f(() => /* @__PURE__ */ o("div", { class: "fade-right" }, null, -1)), Z = /* @__PURE__ */ f(() => /* @__PURE__ */ o("span", { class: "text-xxs relative z-10 lg:flex hidden" }, "Send", -1)), me = /* @__PURE__ */ q({
16
16
  __name: "AddressBar",
17
- setup(d) {
17
+ setup(n) {
18
18
  const {
19
19
  activeRequest: t,
20
- activeExample: k,
21
- isReadOnly: x,
22
- requestMutators: h,
23
- requestsHistory: R
24
- } = U(), g = p(R.value[0]), _ = j();
25
- F(
26
- Q() ? _.meta_enter : _.ctrl_enter,
27
- () => m.emit()
20
+ activeExample: i,
21
+ isReadOnly: p,
22
+ requestMutators: v,
23
+ requestExampleMutators: g,
24
+ requestsHistory: w
25
+ } = O(), x = m(w.value[0]), h = D();
26
+ K(
27
+ A() ? h.meta_enter : h.ctrl_enter,
28
+ () => c.emit()
28
29
  );
29
- const w = (e) => {
30
- !t.value || t.value.path === e || h.edit(t.value.uid, "path", e);
30
+ const k = (e) => {
31
+ !t.value || t.value.path === e || v.edit(t.value.uid, "path", e);
31
32
  };
32
- B(
33
+ V(
33
34
  () => {
34
35
  var e;
35
36
  return (e = t.value) == null ? void 0 : e.path;
36
37
  },
37
38
  (e) => {
38
- t.value && w(e);
39
+ t.value && k(e);
39
40
  }
40
41
  );
41
- const u = p(100), c = p(!1);
42
- m.on(() => {
43
- if (c.value) return;
44
- c.value = !0;
42
+ const d = m(100), u = m(!1);
43
+ c.on(() => {
44
+ if (u.value) return;
45
+ u.value = !0;
45
46
  const e = setInterval(() => {
46
- u.value -= 5, u.value <= 0 && (clearInterval(e), u.value = 100, c.value = !1);
47
+ d.value -= 5, d.value <= 0 && (clearInterval(e), d.value = 100, u.value = !1);
47
48
  }, 20);
48
49
  });
49
50
  function E(e) {
50
- t.value && h.edit(t.value.uid, "method", e);
51
+ t.value && v.edit(t.value.uid, "method", e);
51
52
  }
52
- function q() {
53
+ function S() {
53
54
  if (!t.value) return;
54
55
  const { method: e } = t.value;
55
- return W[e].backgroundColor;
56
+ return L[e].backgroundColor;
56
57
  }
57
- const z = (e) => {
58
- var y;
59
- e.preventDefault();
60
- const a = (((y = e.clipboardData) == null ? void 0 : y.getData("text/plain")) || "").replace(/\n/g, ""), s = window.getSelection();
61
- if (!s || s.rangeCount === 0) return;
62
- const i = s.getRangeAt(0);
63
- i.deleteContents();
64
- const b = document.createTextNode(a);
65
- i.insertNode(b), i.setStartAfter(b), s.removeAllRanges(), s.addRange(i);
66
- const f = i.startContainer.parentElement;
67
- f && (f.scrollLeft = f.scrollWidth);
58
+ const y = (e) => {
59
+ i.value && g.edit(i.value.uid, "url", e);
68
60
  };
69
- return (e, n) => o(t) && o(k) ? (D(), M("div", Y, [
70
- l("div", Z, [
71
- r(o(H), {
72
- modelValue: g.value,
73
- "onUpdate:modelValue": n[3] || (n[3] = (a) => g.value = a)
61
+ return (e, a) => l(t) && l(i) ? (B(), I("div", j, [
62
+ o("div", F, [
63
+ r(l(H), {
64
+ modelValue: x.value,
65
+ "onUpdate:modelValue": a[2] || (a[2] = (s) => x.value = s)
74
66
  }, {
75
- default: S(({ open: a }) => [
76
- l("div", {
77
- class: C([
67
+ default: _(({ open: s }) => [
68
+ o("div", {
69
+ class: b([
78
70
  "text-xxs bg-b-1 relative flex w-full lg:min-w-[720px] lg:max-w-[720px] order-last lg:order-none flex-1 flex-row items-stretch rounded border p-[3px]",
79
- { "rounded-b-none": a },
80
- { "border-transparent": a }
71
+ { "rounded-b-none": s },
72
+ { "border-transparent": s }
81
73
  ])
82
74
  }, [
83
- l("div", ee, [
84
- l("div", {
85
- class: C(["bg-mix-transparent bg-mix-amount-95 absolute left-0 top-0 h-full w-full", q()]),
86
- style: N({ transform: `translate3d(-${u.value}%,0,0)` })
75
+ o("div", G, [
76
+ o("div", {
77
+ class: b(["bg-mix-transparent bg-mix-amount-95 absolute left-0 top-0 h-full w-full", S()]),
78
+ style: R({ transform: `translate3d(-${d.value}%,0,0)` })
87
79
  }, null, 6)
88
80
  ]),
89
- l("div", te, [
90
- r(G, {
81
+ o("div", J, [
82
+ r(Q, {
91
83
  class: "font-code text-xxs font-medium",
92
- isEditable: !o(x),
84
+ isEditable: !l(p),
93
85
  isSquare: "",
94
- method: o(t).method,
86
+ method: l(t).method,
95
87
  onChange: E
96
- }, null, 8, ["isEditable", "method"]),
97
- r(X)
88
+ }, null, 8, ["isEditable", "method"])
98
89
  ]),
99
- l("div", oe, [
100
- le,
101
- l("div", {
102
- class: "scroll-timeline-x-address font-code text-c-1 flex flex-1 items-center whitespace-nowrap lg:text-sm text-xs font-medium leading-[24.5px] outline-none",
103
- contenteditable: !o(x),
104
- onInput: n[0] || (n[0] = (s) => w(s.target.innerText)),
105
- onKeydown: n[1] || (n[1] = V($((s) => o(m).emit(), ["prevent"]), ["enter"])),
106
- onPaste: z
107
- }, T(o(t).path), 41, ne),
108
- se
90
+ o("div", P, [
91
+ X,
92
+ r($, {
93
+ disableCloseBrackets: "",
94
+ disabled: l(p),
95
+ disableEnter: "",
96
+ disableTabIndent: "",
97
+ emitOnBlur: !1,
98
+ modelValue: l(i).url,
99
+ placeholder: "Enter URL to get started",
100
+ server: "",
101
+ onSubmit: a[0] || (a[0] = (C) => l(c).emit()),
102
+ "onUpdate:modelValue": y
103
+ }, null, 8, ["disabled", "modelValue"]),
104
+ Y
109
105
  ]),
110
- r(J, { open: a }, null, 8, ["open"]),
111
- r(o(L), {
106
+ r(W, { open: s }, null, 8, ["open"]),
107
+ r(l(N), {
112
108
  class: "relative h-auto shrink-0 gap-1 overflow-hidden pl-2 pr-2.5 py-1 z-[1]",
113
- disabled: c.value,
114
- onClick: n[2] || (n[2] = (s) => o(m).emit())
109
+ disabled: u.value,
110
+ onClick: a[1] || (a[1] = (C) => l(c).emit())
115
111
  }, {
116
- default: S(() => [
117
- r(o(P), {
112
+ default: _(() => [
113
+ r(l(T), {
118
114
  class: "relative z-10 shrink-0 fill-current",
119
115
  icon: "Play",
120
116
  size: "xs"
121
117
  }),
122
- ae
118
+ Z
123
119
  ]),
124
120
  _: 1
125
121
  }, 8, ["disabled"])
@@ -128,9 +124,9 @@ const v = (d) => (K("data-v-02983c4d"), d = d(), O(), d), Y = {
128
124
  _: 1
129
125
  }, 8, ["modelValue"])
130
126
  ])
131
- ])) : A("", !0);
127
+ ])) : z("", !0);
132
128
  }
133
129
  });
134
130
  export {
135
- _e as default
131
+ me as default
136
132
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBarServer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBarServer.vue"],"names":[],"mappings":";AA0ZA,wBAKG"}
1
+ {"version":3,"file":"AddressBarServer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBarServer.vue"],"names":[],"mappings":";AA2ZA,wBAKG"}
@@ -17,6 +17,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
17
17
  enum?: string[];
18
18
  type?: string;
19
19
  nullable?: boolean;
20
+ withVariables?: boolean;
21
+ withServers?: boolean;
20
22
  }>, {
21
23
  disableCloseBrackets: boolean;
22
24
  disableEnter: boolean;
@@ -24,6 +26,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
24
26
  emitOnBlur: boolean;
25
27
  colorPicker: boolean;
26
28
  nullable: boolean;
29
+ withVariables: boolean;
30
+ withServers: boolean;
27
31
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
32
  submit: (v: string) => void;
29
33
  "update:modelValue": (v: string) => void;
@@ -45,6 +49,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
45
49
  enum?: string[];
46
50
  type?: string;
47
51
  nullable?: boolean;
52
+ withVariables?: boolean;
53
+ withServers?: boolean;
48
54
  }>, {
49
55
  disableCloseBrackets: boolean;
50
56
  disableEnter: boolean;
@@ -52,16 +58,20 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
52
58
  emitOnBlur: boolean;
53
59
  colorPicker: boolean;
54
60
  nullable: boolean;
61
+ withVariables: boolean;
62
+ withServers: boolean;
55
63
  }>>> & {
56
64
  onSubmit?: ((v: string) => any) | undefined;
57
65
  "onUpdate:modelValue"?: ((v: string) => any) | undefined;
58
66
  }, {
59
67
  nullable: boolean;
68
+ withServers: boolean;
60
69
  colorPicker: boolean;
61
70
  emitOnBlur: boolean;
62
71
  disableTabIndent: boolean;
63
72
  disableEnter: boolean;
64
73
  disableCloseBrackets: boolean;
74
+ withVariables: boolean;
65
75
  }, {}>, {
66
76
  warning?(_: {}): any;
67
77
  icon?(_: {}): any;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OA0PO,EAGL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;;kBAWb,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;;;;;;;;;;;;kBAhBJ,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;;;;;;;;;;;;cAAP,OAAO;iBAhBJ,OAAO;gBAGR,OAAO;sBAGD,OAAO;kBAMX,OAAO;0BACC,OAAO;;qBAmPJ,GAAG;kBACN,GAAG;;AApQ9B,wBAuSC;AAMD,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAC7C,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAC,CAAC,GACvC,CAAC,CAAC,CAAC,CAAC;CACP,CAAC;AAEN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AAExD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OAoRO,EAGL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;;kBAeb,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;oBACF,OAAO;kBACT,OAAO;;;;;;;;;;;;;;kBAlBP,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;oBACF,OAAO;kBACT,OAAO;;;;;;;;;;;;;;cAFV,OAAO;iBAEJ,OAAO;iBAlBP,OAAO;gBAGR,OAAO;sBAGD,OAAO;kBAMX,OAAO;0BACC,OAAO;mBAId,OAAO;;qBAwPG,GAAG;kBACN,GAAG;;AA7Q9B,wBAgTC;AAMD,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAC7C,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAC,CAAC,GACvC,CAAC,CAAC,CAAC,CAAC;CACP,CAAC;AAEN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AAExD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import o from "./CodeInput.vue2.js";
2
2
  /* empty css */
3
+ /* empty css */
3
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c8194af4"]]);
5
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-93d0e1be"]]);
5
6
  export {
6
- f as default
7
+ _ as default
7
8
  };
@@ -1,17 +1,20 @@
1
- import { defineComponent as F, useAttrs as S, ref as b, toRef as o, watch as $, computed as O, openBlock as t, createElementBlock as u, Fragment as P, createBlock as y, mergeProps as q, unref as E, renderSlot as h, createCommentVNode as g } from "vue";
1
+ import { defineComponent as S, useAttrs as P, ref as b, toRef as o, watch as O, computed as $, openBlock as t, createElementBlock as s, Fragment as R, createBlock as h, mergeProps as q, unref as E, renderSlot as y, createCommentVNode as g } from "vue";
2
2
  import { useCodeMirror as I, colorPicker as M } from "@scalar/use-codemirror";
3
3
  import { nanoid as N } from "nanoid";
4
4
  import B from "../DataTable/DataTableInputSelect.vue.js";
5
- const R = ["id"], T = {
5
+ import { dropdownPlugin as T } from "./codeDropdownWidget.js";
6
+ import { pillPlugin as A, backspaceCommand as U } from "./codeVariableWidget.js";
7
+ import { useWorkspace as W } from "../../store/workspace.js";
8
+ const j = ["id"], z = {
6
9
  key: 3,
7
10
  class: "absolute centered-y right-7 text-orange text-xs"
8
- }, A = {
11
+ }, D = {
9
12
  key: 4,
10
13
  class: "required absolute centered-y right-0 pt-px pr-2 text-xxs text-c-3 bg-b-1 shadow-[-8px_0_4px_var(--scalar-background-1)] opacity-100 duration-150 transition-opacity peer-has-[.cm-focused]:opacity-0"
11
- }, U = {
14
+ }, G = {
12
15
  inheritAttrs: !1
13
- }, H = /* @__PURE__ */ F({
14
- ...U,
16
+ }, Z = /* @__PURE__ */ S({
17
+ ...G,
15
18
  __name: "CodeInput",
16
19
  props: {
17
20
  colorPicker: { type: Boolean, default: !1 },
@@ -30,79 +33,81 @@ const R = ["id"], T = {
30
33
  disableCloseBrackets: { type: Boolean, default: !1 },
31
34
  enum: {},
32
35
  type: {},
33
- nullable: { type: Boolean, default: !1 }
36
+ nullable: { type: Boolean, default: !1 },
37
+ withVariables: { type: Boolean, default: !0 },
38
+ withServers: { type: Boolean, default: !1 }
34
39
  },
35
40
  emits: ["submit", "update:modelValue"],
36
- setup(V, { emit: k }) {
41
+ setup(v, { emit: k }) {
37
42
  var m;
38
- const e = V, a = k, s = S(), v = s.id || `id-${N()}`, i = b(!1);
43
+ const e = v, a = k, d = P(), V = d.id || `id-${N()}`, p = b(!1), { activeWorkspace: w } = W();
39
44
  function C(l) {
40
45
  return e.handleFieldChange ? e.handleFieldChange(l) : a("update:modelValue", l);
41
46
  }
42
47
  function _(l) {
43
48
  return e.handleFieldSubmit ? e.handleFieldSubmit(l) : a("submit", l);
44
49
  }
45
- function w(l) {
46
- i.value = !1, e.emitOnBlur && e.modelValue && _(l);
50
+ function x(l) {
51
+ p.value = !1, e.emitOnBlur && e.modelValue && _(l);
47
52
  }
48
- const c = [];
49
- e.colorPicker && c.push(M);
50
- const p = b(null), { codeMirror: n } = I({
53
+ const n = [];
54
+ e.colorPicker && n.push(M), e.withVariables && !w.value.isReadOnly && n.push(T({ withServers: e.withServers })), n.push(A, U);
55
+ const c = b(null), { codeMirror: r } = I({
51
56
  content: o(
52
57
  () => e.modelValue !== void 0 ? String(e.modelValue) : ""
53
58
  ),
54
59
  onChange: C,
55
- onFocus: () => i.value = !0,
56
- onBlur: (l) => w(l),
57
- codeMirrorRef: p,
60
+ onFocus: () => p.value = !0,
61
+ onBlur: (l) => x(l),
62
+ codeMirrorRef: c,
58
63
  disableTabIndent: o(() => e.disableTabIndent),
59
64
  disableEnter: o(() => e.disableEnter),
60
65
  disableCloseBrackets: o(() => e.disableCloseBrackets),
61
66
  lineNumbers: o(() => e.lineNumbers),
62
67
  language: o(() => e.language),
63
68
  lint: o(() => e.lint),
64
- extensions: c,
69
+ extensions: n,
65
70
  placeholder: o(() => e.placeholder)
66
71
  });
67
- (m = n.value) == null || m.focus(), $(n, () => {
68
- n.value && Object.prototype.hasOwnProperty.call(s, "autofocus") && n.value.focus();
72
+ (m = r.value) == null || m.focus(), O(r, () => {
73
+ r.value && Object.prototype.hasOwnProperty.call(d, "autofocus") && r.value.focus();
69
74
  });
70
- const x = O(() => {
75
+ const F = $(() => {
71
76
  var l;
72
77
  return e.type === "boolean" || (l = e.type) != null && l.includes("boolean") || e.nullable ? ["true", "false", "null"] : ["true", "false"];
73
78
  });
74
- return (l, r) => {
79
+ return (l, u) => {
75
80
  var f;
76
- return t(), u(P, null, [
77
- e.enum && e.enum.length ? (t(), y(B, {
81
+ return t(), s(R, null, [
82
+ e.enum && e.enum.length ? (t(), h(B, {
78
83
  key: 0,
79
84
  modelValue: e.modelValue,
80
85
  value: e.enum,
81
- "onUpdate:modelValue": r[0] || (r[0] = (d) => a("update:modelValue", d))
82
- }, null, 8, ["modelValue", "value"])) : e.type === "boolean" || (f = e.type) != null && f.includes("boolean") ? (t(), y(B, {
86
+ "onUpdate:modelValue": u[0] || (u[0] = (i) => a("update:modelValue", i))
87
+ }, null, 8, ["modelValue", "value"])) : e.type === "boolean" || (f = e.type) != null && f.includes("boolean") ? (t(), h(B, {
83
88
  key: 1,
84
89
  modelValue: e.modelValue,
85
- value: x.value,
86
- "onUpdate:modelValue": r[1] || (r[1] = (d) => a("update:modelValue", d))
87
- }, null, 8, ["modelValue", "value"])) : (t(), u("div", q({
90
+ value: F.value,
91
+ "onUpdate:modelValue": u[1] || (u[1] = (i) => a("update:modelValue", i))
92
+ }, null, 8, ["modelValue", "value"])) : (t(), s("div", q({
88
93
  key: 2,
89
- id: E(v)
94
+ id: E(V)
90
95
  }, l.$attrs, {
91
96
  ref_key: "codeMirrorRef",
92
- ref: p,
97
+ ref: c,
93
98
  class: ["peer font-code w-full whitespace-nowrap text-xs leading-[1.44] relative", {
94
99
  "flow-code-input--error": l.error
95
100
  }]
96
- }), null, 16, R)),
97
- l.$slots.warning ? (t(), u("div", T, [
98
- h(l.$slots, "warning", {}, void 0, !0)
101
+ }), null, 16, j)),
102
+ l.$slots.warning ? (t(), s("div", z, [
103
+ y(l.$slots, "warning", {}, void 0, !0)
99
104
  ])) : g("", !0),
100
- h(l.$slots, "icon", {}, void 0, !0),
101
- l.required ? (t(), u("div", A, " Required ")) : g("", !0)
105
+ y(l.$slots, "icon", {}, void 0, !0),
106
+ l.required ? (t(), s("div", D, " Required ")) : g("", !0)
102
107
  ], 64);
103
108
  };
104
109
  }
105
110
  });
106
111
  export {
107
- H as default
112
+ Z as default
108
113
  };
@@ -0,0 +1,24 @@
1
+ import { type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@scalar/use-codemirror';
2
+ declare class DropdownWidget extends WidgetType {
3
+ private queryTerm;
4
+ private onSelect;
5
+ private dropdown;
6
+ private withServers?;
7
+ constructor(queryTerm: string, onSelect: (item: string) => void, withServers?: boolean);
8
+ updateQueryTerm(newQueryTerm: string): void;
9
+ getQueryTerm(): string;
10
+ toDOM(view: EditorView): HTMLSpanElement;
11
+ destroy(): void;
12
+ eq(other: WidgetType): boolean;
13
+ }
14
+ export declare const dropdownPlugin: (props: {
15
+ withServers?: boolean;
16
+ }) => ViewPlugin<{
17
+ decorations: DecorationSet;
18
+ widget: DropdownWidget | null;
19
+ view: EditorView;
20
+ handleDropdownSelect(item: string): void;
21
+ update(update: ViewUpdate): void;
22
+ }>;
23
+ export {};
24
+ //# sourceMappingURL=codeDropdownWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeDropdownWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeDropdownWidget.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,UAAU,EACV,KAAK,UAAU,EACf,UAAU,EACX,MAAM,wBAAwB,CAAA;AAK/B,cAAM,cAAe,SAAQ,UAAU;IACrC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,WAAW,CAAC,CAAS;gBAG3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAChC,WAAW,CAAC,EAAE,OAAO;IAQvB,eAAe,CAAC,YAAY,EAAE,MAAM;IAMpC,YAAY;IAIZ,KAAK,CAAC,IAAI,EAAE,UAAU;IAoCtB,OAAO;IAOP,EAAE,CAAC,KAAK,EAAE,UAAU;CAGrB;AAED,eAAO,MAAM,cAAc,UAAW;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE;iBAG5C,aAAa;YAClB,cAAc,GAAG,IAAI;UACvB,UAAU;+BAQW,MAAM;mBAqClB,UAAU;EAsC5B,CAAA"}
@@ -0,0 +1,110 @@
1
+ var m = Object.defineProperty;
2
+ var g = (d, t, e) => t in d ? m(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
3
+ var n = (d, t, e) => g(d, typeof t != "symbol" ? t + "" : t, e);
4
+ import { router as f } from "../../router.js";
5
+ import { ViewPlugin as y, Decoration as h, StateEffect as T, WidgetType as S } from "@scalar/use-codemirror";
6
+ import { createApp as q, h as p, Teleport as x } from "vue";
7
+ import v from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
8
+ class u extends S {
9
+ constructor(e, s, o) {
10
+ super();
11
+ n(this, "queryTerm");
12
+ n(this, "onSelect");
13
+ n(this, "dropdown", null);
14
+ n(this, "withServers");
15
+ this.queryTerm = e, this.onSelect = s, this.withServers = o;
16
+ }
17
+ updateQueryTerm(e) {
18
+ this.queryTerm !== e && (this.queryTerm = e);
19
+ }
20
+ getQueryTerm() {
21
+ return this.queryTerm;
22
+ }
23
+ toDOM(e) {
24
+ const s = document.createElement("span");
25
+ return s.style.position = "fixed", setTimeout(() => {
26
+ var c;
27
+ const o = e.state.selection.main.head, i = e.coordsAtPos(o - this.queryTerm.length - 2);
28
+ if (i) {
29
+ const r = (c = document.querySelector(".scalar-client")) == null ? void 0 : c.getBoundingClientRect();
30
+ r && (this.dropdown = q({
31
+ render: () => p(x, { to: ".scalar-client" }, [
32
+ p(v, {
33
+ query: this.queryTerm,
34
+ onSelect: this.onSelect,
35
+ withServers: this.withServers,
36
+ style: {
37
+ position: "absolute",
38
+ left: `${i.left - r.left}px`,
39
+ top: `calc(${i.bottom - r.top}px + 6px)`
40
+ }
41
+ })
42
+ ])
43
+ })), this.dropdown.use(f), this.dropdown.mount(s);
44
+ }
45
+ }, 0), s;
46
+ }
47
+ destroy() {
48
+ this.dropdown && (this.dropdown.unmount(), this.dropdown = null);
49
+ }
50
+ eq(e) {
51
+ return e instanceof u && this.queryTerm === e.queryTerm;
52
+ }
53
+ }
54
+ const P = (d) => y.fromClass(
55
+ class {
56
+ constructor(t) {
57
+ n(this, "decorations");
58
+ n(this, "widget", null);
59
+ n(this, "view");
60
+ this.view = t, this.decorations = h.none, this.handleDropdownSelect = this.handleDropdownSelect.bind(this);
61
+ }
62
+ handleDropdownSelect(t) {
63
+ var w;
64
+ if (!this.widget) return;
65
+ const { state: e, dispatch: s } = this.view, o = e.selection.main.head, i = Math.max(0, o - this.widget.getQueryTerm().length - 2), c = o, r = `{{${t}}}`;
66
+ s({
67
+ changes: { from: i, to: c, insert: r }
68
+ }), (w = this.widget) == null || w.destroy(), this.widget = null, this.decorations = h.none, this.view.dispatch({
69
+ effects: T.appendConfig.of([])
70
+ });
71
+ const l = i + r.length, a = "";
72
+ this.widget = new u(
73
+ a,
74
+ this.handleDropdownSelect,
75
+ d.withServers
76
+ ), this.decorations = h.set([
77
+ h.widget({
78
+ widget: this.widget,
79
+ side: 1
80
+ }).range(l)
81
+ ]), this.view.dispatch({
82
+ selection: { anchor: l }
83
+ }), this.view.focus();
84
+ }
85
+ update(t) {
86
+ var r, l;
87
+ const e = t.state.selection.main.head, s = t.state.doc.sliceString(0, e), o = [], i = s.lastIndexOf("{{"), c = s.lastIndexOf("}}");
88
+ if (i > c) {
89
+ const a = s.slice(i + 2);
90
+ !this.widget || this.widget.getQueryTerm() !== a ? ((r = this.widget) == null || r.destroy(), this.widget = new u(
91
+ a,
92
+ this.handleDropdownSelect
93
+ )) : this.widget.updateQueryTerm(a), o.push(
94
+ h.widget({
95
+ widget: this.widget,
96
+ side: 1
97
+ }).range(e)
98
+ );
99
+ } else
100
+ (l = this.widget) == null || l.destroy(), this.widget = null;
101
+ this.decorations = h.set(o);
102
+ }
103
+ },
104
+ {
105
+ decorations: (t) => t.decorations
106
+ }
107
+ );
108
+ export {
109
+ P as dropdownPlugin
110
+ };
@@ -0,0 +1,8 @@
1
+ import { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate } from '@scalar/use-codemirror';
2
+ export declare const pillPlugin: ViewPlugin<{
3
+ decorations: DecorationSet;
4
+ update(update: ViewUpdate): void;
5
+ buildDecorations(view: EditorView): import("@codemirror/state").RangeSet<Decoration>;
6
+ }>;
7
+ export declare const backspaceCommand: import("@codemirror/state").Extension;
8
+ //# sourceMappingURL=codeVariableWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeVariableWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeVariableWidget.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,UAAU,EAEV,UAAU,EACV,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAA;AA+F/B,eAAO,MAAM,UAAU;iBAEN,aAAa;mBAMX,UAAU;2BAMF,UAAU;EA6BpC,CAAA;AAED,eAAO,MAAM,gBAAgB,uCAmB3B,CAAA"}