@scalar/api-client 2.1.39 → 2.1.40

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 (53) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/CodeInput/CodeInput.vue.d.ts +3 -0
  3. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  4. package/dist/components/CodeInput/CodeInput.vue.js +1 -1
  5. package/dist/components/CodeInput/CodeInput.vue2.js +105 -84
  6. package/dist/components/CodeInput/codeVariableWidget.d.ts +3 -0
  7. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  8. package/dist/components/CodeInput/codeVariableWidget.js +51 -47
  9. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  10. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +102 -129
  11. package/dist/components/ImportCollection/PrefetchError.vue.d.ts +2 -3
  12. package/dist/components/ImportCollection/PrefetchError.vue.d.ts.map +1 -1
  13. package/dist/components/ImportCollection/PrefetchError.vue.js +27 -0
  14. package/dist/components/ImportCollection/PrefetchError.vue2.js +4 -0
  15. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.d.ts +11 -17
  16. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.d.ts.map +1 -1
  17. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.js +72 -29
  18. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  19. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
  20. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +20 -28
  21. package/dist/components/Sidebar/SidebarButton.vue.d.ts +5 -3
  22. package/dist/components/Sidebar/SidebarButton.vue.d.ts.map +1 -1
  23. package/dist/components/Sidebar/SidebarButton.vue.js +16 -16
  24. package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
  25. package/dist/components/Sidebar/SidebarList.vue.js +5 -5
  26. package/dist/components/Sidebar/SidebarListElement.vue.d.ts +1 -1
  27. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  28. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  29. package/dist/layouts/App/ApiClientApp.vue.js +37 -37
  30. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  31. package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
  32. package/dist/layouts/Modal/ApiClientModal.vue2.js +23 -21
  33. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  34. package/dist/layouts/Web/ApiClientWeb.vue.js +30 -30
  35. package/dist/store/environment.js +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/views/Cookies/Cookies.vue.d.ts +1 -5
  38. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  39. package/dist/views/Cookies/Cookies.vue2.js +58 -61
  40. package/dist/views/Environment/Environment.vue.d.ts +1 -5
  41. package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
  42. package/dist/views/Environment/Environment.vue2.js +142 -96
  43. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  44. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +17 -18
  45. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  46. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +36 -34
  47. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
  48. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +3 -3
  49. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +25 -25
  50. package/dist/views/Request/libs/oauth2.d.ts +2 -2
  51. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  52. package/dist/views/Request/libs/oauth2.js +45 -34
  53. package/package.json +8 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.1.40
4
+
5
+ ### Patch Changes
6
+
7
+ - db4a4b7: fix: favors provide for web layout hotkey display
8
+ - c63ab07: fix: sidebar list action button danger
9
+ - c929284: fix: add default redirectURI and prefix relative redirectURIs with activeServer
10
+ - 2275977: feat: import from way more sources, leverage the proxy more
11
+ - e044d78: feat: adds copy capability to environment code input
12
+ - e461e5b: feat: adds environment variables synchronization
13
+ - Updated dependencies [c929284]
14
+ - Updated dependencies [2275977]
15
+ - Updated dependencies [3a0c367]
16
+ - Updated dependencies [89a2cc7]
17
+ - Updated dependencies [f2361b3]
18
+ - @scalar/oas-utils@0.2.66
19
+ - @scalar/import@0.0.4
20
+
3
21
  ## 2.1.39
4
22
 
5
23
  ### Patch Changes
@@ -19,6 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
19
19
  nullable?: boolean;
20
20
  withVariables?: boolean;
21
21
  importCurl?: boolean;
22
+ isCopyable?: boolean;
22
23
  }, {
23
24
  focus: () => void;
24
25
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -45,6 +46,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
45
46
  nullable?: boolean;
46
47
  withVariables?: boolean;
47
48
  importCurl?: boolean;
49
+ isCopyable?: boolean;
48
50
  }> & Readonly<{
49
51
  onSubmit?: ((v: string) => any) | undefined;
50
52
  "onUpdate:modelValue"?: ((v: string) => any) | undefined;
@@ -57,6 +59,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
57
59
  disableCloseBrackets: boolean;
58
60
  nullable: boolean;
59
61
  withVariables: boolean;
62
+ isCopyable: boolean;
60
63
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
61
64
  warning?(_: {}): any;
62
65
  icon?(_: {}): any;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OAmYO,EAGL,KAAK,kBAAkB,EAGxB,MAAM,wBAAwB,CAAA;;kBAcb,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;iBACV,OAAO;;;;;;;;kBAlBN,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;iBACV,OAAO;;;;;;gBAfP,OAAO;iBAHN,OAAO;sBAMF,OAAO;kBAMX,OAAO;0BACC,OAAO;cAGnB,OAAO;mBACF,OAAO;;qBA8WG,GAAG;kBACN,GAAG;;AAnY9B,wBA6bC;AAcD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OAkcO,EAGL,KAAK,kBAAkB,EAGxB,MAAM,wBAAwB,CAAA;;kBAiBb,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;iBACV,OAAO;iBACP,OAAO;;;;;;;;kBAnBN,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;iBACV,OAAO;iBACP,OAAO;;;;;;gBAhBP,OAAO;iBAHN,OAAO;sBAMF,OAAO;kBAMX,OAAO;0BACC,OAAO;cAGnB,OAAO;mBACF,OAAO;gBAEV,OAAO;;qBAoZM,GAAG;kBACN,GAAG;;AA3a9B,wBAweC;AAcD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -2,7 +2,7 @@ import o from "./CodeInput.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
5
- const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9645481b"]]);
5
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-77713050"]]);
6
6
  export {
7
7
  a as default
8
8
  };
@@ -1,20 +1,26 @@
1
- import { defineComponent as j, useAttrs as L, ref as u, toRef as r, watch as Q, computed as y, openBlock as a, createElementBlock as c, Fragment as z, createBlock as v, mergeProps as G, unref as i, withKeys as h, withModifiers as _, renderSlot as D, createCommentVNode as w } from "vue";
2
- import { useCodeMirror as H, useDropdown as J, colorPicker as X } from "@scalar/use-codemirror";
3
- import { nanoid as Y } from "nanoid";
4
- import q from "../DataTable/DataTableInputSelect.vue.js";
5
- import { pillPlugin as Z, backspaceCommand as ee } from "./codeVariableWidget.js";
6
- import oe from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
7
- import { useWorkspace as le } from "../../store/store.js";
8
- const te = ["id"], ne = {
1
+ import { defineComponent as J, useAttrs as L, ref as s, toRef as a, watch as Q, computed as v, openBlock as i, createElementBlock as p, Fragment as G, createBlock as h, mergeProps as H, unref as n, withKeys as w, withModifiers as D, createElementVNode as $, createVNode as X, createCommentVNode as m, renderSlot as q } from "vue";
2
+ import { useCodeMirror as Y, useDropdown as Z, colorPicker as ee } from "@scalar/use-codemirror";
3
+ import { nanoid as oe } from "nanoid";
4
+ import R from "../DataTable/DataTableInputSelect.vue.js";
5
+ import { pillPlugin as te, backspaceCommand as le } from "./codeVariableWidget.js";
6
+ import ne from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
7
+ import { useClipboard as re } from "../../hooks/useClipboard.js";
8
+ import { ScalarIcon as ae } from "@scalar/components";
9
+ import { prettyPrintJson as ie } from "@scalar/oas-utils/helpers";
10
+ import { useWorkspace as se } from "../../store/store.js";
11
+ const ue = ["id"], de = {
12
+ key: 0,
13
+ class: "scalar-code-copy z-context"
14
+ }, pe = {
9
15
  key: 3,
10
16
  class: "absolute centered-y right-7 text-orange text-xs"
11
- }, re = {
17
+ }, ce = {
12
18
  key: 4,
13
19
  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 pointer-events-none"
14
- }, ae = {
20
+ }, me = {
15
21
  inheritAttrs: !1
16
- }, fe = /* @__PURE__ */ j({
17
- ...ae,
22
+ }, ke = /* @__PURE__ */ J({
23
+ ...me,
18
24
  __name: "CodeInput",
19
25
  props: {
20
26
  colorPicker: { type: Boolean, default: !1 },
@@ -35,126 +41,141 @@ const te = ["id"], ne = {
35
41
  type: {},
36
42
  nullable: { type: Boolean, default: !1 },
37
43
  withVariables: { type: Boolean, default: !0 },
38
- importCurl: { type: Boolean }
44
+ importCurl: { type: Boolean },
45
+ isCopyable: { type: Boolean, default: !1 }
39
46
  },
40
47
  emits: ["submit", "update:modelValue", "curl"],
41
- setup(R, { expose: $, emit: O }) {
42
- var F;
43
- const o = R, s = O, g = L(), K = g.id || `id-${Y()}`, V = u(!1), m = u(!1), B = u(""), k = u({ left: 0, top: 0 }), p = u(null), { activeEnvVariables: C, isReadOnly: S, activeEnvironment: x, router: M } = le();
48
+ setup(N, { expose: O, emit: _ }) {
49
+ var P;
50
+ const o = N, u = _, V = L(), I = V.id || `id-${oe()}`, g = s(!1), f = s(!1), B = s(""), C = s({ left: 0, top: 0 }), c = s(null), { activeEnvVariables: k, isReadOnly: S, activeEnvironment: E, router: K } = se(), { copyToClipboard: M } = re();
44
51
  function A(e) {
45
- var l;
46
- return e === o.modelValue ? null : o.importCurl && e.trim().toLowerCase().startsWith("curl") ? (s("curl", e), (l = n.value) == null || l.dispatch({
52
+ var t;
53
+ return e === o.modelValue ? null : o.importCurl && e.trim().toLowerCase().startsWith("curl") ? (u("curl", e), (t = r.value) == null || t.dispatch({
47
54
  changes: {
48
55
  from: 0,
49
- to: n.value.state.doc.length,
56
+ to: r.value.state.doc.length,
50
57
  insert: String(o.modelValue)
51
58
  }
52
- }), null) : o.handleFieldChange ? o.handleFieldChange(e) : s("update:modelValue", e);
59
+ }), null) : o.handleFieldChange ? o.handleFieldChange(e) : u("update:modelValue", e);
53
60
  }
54
- function I(e) {
55
- return o.handleFieldSubmit ? o.handleFieldSubmit(e) : s("submit", e);
61
+ function T(e) {
62
+ return o.handleFieldSubmit ? o.handleFieldSubmit(e) : u("submit", e);
56
63
  }
57
- function N(e) {
58
- V.value = !1, o.emitOnBlur && o.modelValue && I(e);
64
+ function z(e) {
65
+ g.value = !1, o.emitOnBlur && o.modelValue && T(e);
59
66
  }
60
- const f = [];
61
- o.colorPicker && f.push(X), f.push(
62
- Z({
63
- activeEnvironment: x,
64
- activeEnvVariables: C,
67
+ const y = [];
68
+ o.colorPicker && y.push(ee), y.push(
69
+ te({
70
+ activeEnvironment: E,
71
+ activeEnvVariables: k,
65
72
  isReadOnly: S
66
73
  }),
67
- ee
74
+ le
68
75
  );
69
- const E = u(null), { codeMirror: n } = H({
70
- content: r(
76
+ const x = s(null), { codeMirror: r } = Y({
77
+ content: a(
71
78
  () => o.modelValue !== void 0 ? String(o.modelValue) : ""
72
79
  ),
73
80
  onChange: (e) => {
74
- A(e), U();
81
+ A(e), W();
75
82
  },
76
- onFocus: () => V.value = !0,
77
- onBlur: (e) => N(e),
78
- codeMirrorRef: E,
79
- disableTabIndent: r(() => o.disableTabIndent),
80
- disableEnter: r(() => o.disableEnter),
81
- disableCloseBrackets: r(() => o.disableCloseBrackets),
82
- lineNumbers: r(() => o.lineNumbers),
83
- language: r(() => o.language),
84
- lint: r(() => o.lint),
85
- extensions: f,
86
- placeholder: r(() => o.placeholder)
83
+ onFocus: () => g.value = !0,
84
+ onBlur: (e) => z(e),
85
+ codeMirrorRef: x,
86
+ disableTabIndent: a(() => o.disableTabIndent),
87
+ disableEnter: a(() => o.disableEnter),
88
+ disableCloseBrackets: a(() => o.disableCloseBrackets),
89
+ lineNumbers: a(() => o.lineNumbers),
90
+ language: a(() => o.language),
91
+ lint: a(() => o.lint),
92
+ extensions: y,
93
+ placeholder: a(() => o.placeholder)
87
94
  });
88
- (F = n.value) == null || F.focus(), Q(n, () => {
89
- n.value && Object.prototype.hasOwnProperty.call(g, "autofocus") && n.value.focus();
95
+ (P = r.value) == null || P.focus(), Q(r, () => {
96
+ r.value && Object.prototype.hasOwnProperty.call(V, "autofocus") && r.value.focus();
90
97
  });
91
- const { handleDropdownSelect: T, updateDropdownVisibility: U } = J({
92
- codeMirror: n,
98
+ const { handleDropdownSelect: U, updateDropdownVisibility: W } = Z({
99
+ codeMirror: r,
93
100
  query: B,
94
- showDropdown: m,
95
- dropdownPosition: k
96
- }), W = y(() => {
101
+ showDropdown: f,
102
+ dropdownPosition: C
103
+ }), j = v(() => {
97
104
  var e;
98
105
  return o.type === "boolean" || (e = o.type) != null && e.includes("boolean") || o.nullable ? ["true", "false", "null"] : ["true", "false"];
99
106
  });
100
- $({
107
+ O({
101
108
  focus: () => {
102
109
  var e;
103
- (e = n.value) == null || e.focus();
110
+ (e = r.value) == null || e.focus();
104
111
  }
105
112
  });
106
- const b = (e, l) => {
107
- var d, t, P;
108
- m.value && (e === "down" ? (l.preventDefault(), (d = p.value) == null || d.handleArrowKey("down")) : e === "up" ? (l.preventDefault(), (t = p.value) == null || t.handleArrowKey("up")) : e === "enter" && (l.preventDefault(), (P = p.value) == null || P.handleSelect()));
113
+ const b = (e, t) => {
114
+ var d, l, F;
115
+ f.value && (e === "down" ? (t.preventDefault(), (d = c.value) == null || d.handleArrowKey("down")) : e === "up" ? (t.preventDefault(), (l = c.value) == null || l.handleArrowKey("up")) : e === "enter" && (t.preventDefault(), (F = c.value) == null || F.handleSelect()));
109
116
  };
110
- return (e, l) => {
117
+ return (e, t) => {
111
118
  var d;
112
- return a(), c(z, null, [
113
- o.enum && o.enum.length ? (a(), v(q, {
119
+ return i(), p(G, null, [
120
+ o.enum && o.enum.length ? (i(), h(R, {
114
121
  key: 0,
115
122
  modelValue: o.modelValue,
116
123
  value: o.enum,
117
- "onUpdate:modelValue": l[0] || (l[0] = (t) => s("update:modelValue", t))
118
- }, null, 8, ["modelValue", "value"])) : o.type === "boolean" || (d = o.type) != null && d.includes("boolean") ? (a(), v(q, {
124
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => u("update:modelValue", l))
125
+ }, null, 8, ["modelValue", "value"])) : o.type === "boolean" || (d = o.type) != null && d.includes("boolean") ? (i(), h(R, {
119
126
  key: 1,
120
127
  modelValue: o.modelValue,
121
- value: W.value,
122
- "onUpdate:modelValue": l[1] || (l[1] = (t) => s("update:modelValue", t))
123
- }, null, 8, ["modelValue", "value"])) : (a(), c("div", G({
128
+ value: j.value,
129
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => u("update:modelValue", l))
130
+ }, null, 8, ["modelValue", "value"])) : (i(), p("div", H({
124
131
  key: 2,
125
- id: i(K)
132
+ id: n(I)
126
133
  }, e.$attrs, {
127
134
  ref_key: "codeMirrorRef",
128
- ref: E,
135
+ ref: x,
129
136
  class: ["peer font-code w-full whitespace-nowrap overflow-hidden text-xs leading-[1.44] relative", {
130
137
  "flow-code-input--error": e.error
131
138
  }],
132
139
  onKeydown: [
133
- l[2] || (l[2] = h(_((t) => b("down", t), ["stop"]), ["down"])),
134
- l[3] || (l[3] = h((t) => b("enter", t), ["enter"])),
135
- l[4] || (l[4] = h(_((t) => b("up", t), ["stop"]), ["up"]))
140
+ t[3] || (t[3] = w(D((l) => b("down", l), ["stop"]), ["down"])),
141
+ t[4] || (t[4] = w((l) => b("enter", l), ["enter"])),
142
+ t[5] || (t[5] = w(D((l) => b("up", l), ["stop"]), ["up"]))
136
143
  ]
137
- }), null, 16, te)),
138
- e.$slots.warning ? (a(), c("div", ne, [
139
- D(e.$slots, "warning", {}, void 0, !0)
140
- ])) : w("", !0),
141
- D(e.$slots, "icon", {}, void 0, !0),
142
- e.required ? (a(), c("div", re, " Required ")) : w("", !0),
143
- m.value && o.withVariables && !i(S) ? (a(), v(oe, {
144
+ }), [
145
+ e.isCopyable ? (i(), p("div", de, [
146
+ $("button", {
147
+ class: "copy-button",
148
+ type: "button",
149
+ onClick: t[2] || (t[2] = (l) => n(M)(n(ie)(o.modelValue)))
150
+ }, [
151
+ t[6] || (t[6] = $("span", { class: "sr-only" }, "Copy content", -1)),
152
+ X(n(ae), {
153
+ icon: "Clipboard",
154
+ size: "md"
155
+ })
156
+ ])
157
+ ])) : m("", !0)
158
+ ], 16, ue)),
159
+ e.$slots.warning ? (i(), p("div", pe, [
160
+ q(e.$slots, "warning", {}, void 0, !0)
161
+ ])) : m("", !0),
162
+ q(e.$slots, "icon", {}, void 0, !0),
163
+ e.required ? (i(), p("div", ce, " Required ")) : m("", !0),
164
+ f.value && o.withVariables && !n(S) ? (i(), h(ne, {
144
165
  key: 5,
145
166
  ref_key: "dropdownRef",
146
- ref: p,
147
- activeEnvVariables: y(() => i(C)),
148
- activeEnvironment: y(() => i(x)),
149
- dropdownPosition: k.value,
167
+ ref: c,
168
+ activeEnvVariables: v(() => n(k)),
169
+ activeEnvironment: v(() => n(E)),
170
+ dropdownPosition: C.value,
150
171
  query: B.value,
151
- router: i(M),
152
- onSelect: i(T)
153
- }, null, 8, ["activeEnvVariables", "activeEnvironment", "dropdownPosition", "query", "router", "onSelect"])) : w("", !0)
172
+ router: n(K),
173
+ onSelect: n(U)
174
+ }, null, 8, ["activeEnvVariables", "activeEnvironment", "dropdownPosition", "query", "router", "onSelect"])) : m("", !0)
154
175
  ], 64);
155
176
  };
156
177
  }
157
178
  });
158
179
  export {
159
- fe as default
180
+ ke as default
160
181
  };
@@ -2,6 +2,9 @@ import type { WorkspaceStore } from '../../store/index.js';
2
2
  import { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate } from '@scalar/use-codemirror';
3
3
  type ActiveParsedEnvironments = WorkspaceStore['activeEnvVariables'];
4
4
  type IsReadOnly = WorkspaceStore['isReadOnly'];
5
+ /**
6
+ * Styles the active environment variable pill
7
+ */
5
8
  export declare const pillPlugin: (props: {
6
9
  activeEnvironment: WorkspaceStore["activeEnvironment"];
7
10
  activeEnvVariables: ActiveParsedEnvironments;
@@ -1 +1 @@
1
- {"version":3,"file":"codeVariableWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeVariableWidget.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,UAAU,EAEV,UAAU,EACV,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAA;AAI/B,KAAK,wBAAwB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAA;AACpE,KAAK,UAAU,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;AAqH9C,eAAO,MAAM,UAAU,UAAW;IAChC,iBAAiB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAA;IACtD,kBAAkB,EAAE,wBAAwB,CAAA;IAC5C,UAAU,EAAE,UAAU,CAAA;CACvB;iBAGkB,aAAa;mBAMX,UAAU;2BAMF,UAAU;EAiCpC,CAAA;AAEH,eAAO,MAAM,gBAAgB,uCA8B3B,CAAA"}
1
+ {"version":3,"file":"codeVariableWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeVariableWidget.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG7C,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,UAAU,EAEV,UAAU,EACV,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAA;AAI/B,KAAK,wBAAwB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAA;AACpE,KAAK,UAAU,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;AAqI9C;;GAEG;AACH,eAAO,MAAM,UAAU,UAAW;IAChC,iBAAiB,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAA;IACtD,kBAAkB,EAAE,wBAAwB,CAAA;IAC5C,UAAU,EAAE,UAAU,CAAA;CACvB;iBAGkB,aAAa;mBAMX,UAAU;2BAMF,UAAU;EAiCpC,CAAA;AAEH,eAAO,MAAM,gBAAgB,uCA8B3B,CAAA"}
@@ -1,36 +1,33 @@
1
- var v = Object.defineProperty;
2
- var u = (a, t, e) => t in a ? v(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var l = (a, t, e) => u(a, typeof t != "symbol" ? t + "" : t, e);
1
+ var m = Object.defineProperty;
2
+ var v = (n, t, e) => t in n ? m(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var l = (n, t, e) => v(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { ScalarButton as h, ScalarIcon as f, ScalarTooltip as b } from "@scalar/components";
5
5
  import { variableRegex as g } from "@scalar/oas-utils/helpers";
6
- import { ViewPlugin as x, RangeSetBuilder as y, Decoration as E, EditorView as w, WidgetType as N } from "@scalar/use-codemirror";
7
- import { defineComponent as C, h as o, createApp as V } from "vue";
8
- import { parseEnvVariables as D } from "../../libs/environment-parser.js";
9
- const R = (a) => a.value ? a.value.color : "#8E8E8E";
10
- class c extends N {
11
- constructor(e, i, n, s) {
6
+ import { ViewPlugin as E, RangeSetBuilder as y, Decoration as x, EditorView as w, WidgetType as N } from "@scalar/use-codemirror";
7
+ import { defineComponent as C, h as o, createApp as D } from "vue";
8
+ import { parseEnvVariables as R } from "../../libs/environment-parser.js";
9
+ const S = (n) => n.value ? n.value.color : "#8E8E8E";
10
+ class d extends N {
11
+ constructor(e, a, i, s) {
12
12
  super();
13
13
  l(this, "app");
14
14
  l(this, "activeEnvironment");
15
15
  l(this, "activeEnvVariables");
16
16
  l(this, "isReadOnly");
17
- this.variableName = e, this.variableName = e, this.activeEnvironment = i, this.activeEnvVariables = n, this.isReadOnly = s;
17
+ this.variableName = e, this.variableName = e, this.activeEnvironment = a, this.activeEnvVariables = i, this.isReadOnly = s;
18
18
  }
19
19
  toDOM() {
20
20
  const e = document.createElement("span");
21
21
  e.className = "cm-pill", e.textContent = `${this.variableName}`;
22
- const i = C({
22
+ const a = C({
23
23
  props: { variableName: { type: String, default: null } },
24
24
  render: () => {
25
- const n = D(this.activeEnvVariables.value).find(
26
- (r) => r.key === this.variableName
27
- );
28
- n && e.style.setProperty(
29
- "--tw-bg-base",
30
- R(this.activeEnvironment)
31
- );
32
- const s = n ? o("div", { class: "p-2" }, n.value) : o("div", { class: "divide-y divide-1/2 grid" }, [
33
- o("span", { class: "p-2" }, "Variable not found"),
25
+ const i = R(this.activeEnvVariables.value).find(
26
+ (c) => c.key === this.variableName
27
+ ), s = i && this.activeEnvironment.value ? S(this.activeEnvironment) : "#8E8E8E";
28
+ e.style.setProperty("--tw-bg-base", s), e.style.opacity = i != null && i.value ? "1" : "0.5";
29
+ const r = i != null && i.value ? o("div", { class: "p-2" }, i.value) : o("div", { class: "divide-y divide-1/2 grid" }, [
30
+ o("span", { class: "p-2 opacity-25" }, "No value"),
34
31
  !this.isReadOnly && o("div", { class: "p-1" }, [
35
32
  o(
36
33
  h,
@@ -42,7 +39,11 @@ class c extends N {
42
39
  }
43
40
  },
44
41
  [
45
- o(f, { class: "w-2", icon: "Add", size: "xs" }),
42
+ o(f, {
43
+ class: "w-2",
44
+ icon: "Add",
45
+ size: "xs"
46
+ }),
46
47
  "Add variable"
47
48
  ]
48
49
  )
@@ -52,7 +53,7 @@ class c extends N {
52
53
  b,
53
54
  {
54
55
  align: "center",
55
- class: "bg-b-2 w-full",
56
+ class: "w-full",
56
57
  delay: 0,
57
58
  side: "bottom",
58
59
  sideOffset: 6
@@ -62,27 +63,30 @@ class c extends N {
62
63
  content: () => o(
63
64
  "div",
64
65
  {
65
- class: "w-content shadow-lg rounded bg-b-1 brightness-lifted text-xxs leading-5 text-c-1"
66
+ class: [
67
+ "border w-content rounded bg-b-1 brightness-lifted text-xxs leading-5 text-c-1",
68
+ i != null && i.value ? "border-solid" : "border-dashed"
69
+ ]
66
70
  },
67
- s
71
+ r
68
72
  )
69
73
  }
70
74
  );
71
75
  }
72
76
  });
73
- return this.app = V(i, { variableName: this.variableName }), this.app.mount(e), e;
77
+ return this.app = D(a, { variableName: this.variableName }), this.app.mount(e), e;
74
78
  }
75
79
  destroy() {
76
80
  this.app && this.app.unmount();
77
81
  }
78
82
  eq(e) {
79
- return e instanceof c && e.variableName === this.variableName;
83
+ return e instanceof d && e.variableName === this.variableName;
80
84
  }
81
85
  ignoreEvent() {
82
86
  return !1;
83
87
  }
84
88
  }
85
- const T = (a) => x.fromClass(
89
+ const T = (n) => E.fromClass(
86
90
  class {
87
91
  constructor(t) {
88
92
  l(this, "decorations");
@@ -93,20 +97,20 @@ const T = (a) => x.fromClass(
93
97
  }
94
98
  buildDecorations(t) {
95
99
  const e = new y();
96
- for (const { from: i, to: n } of t.visibleRanges) {
97
- const s = t.state.doc.sliceString(i, n);
100
+ for (const { from: a, to: i } of t.visibleRanges) {
101
+ const s = t.state.doc.sliceString(a, i);
98
102
  let r;
99
103
  for (; (r = g.exec(s)) !== null; ) {
100
- const d = i + r.index, m = d + r[0].length, p = r[1];
104
+ const c = a + r.index, p = c + r[0].length, u = r[1];
101
105
  e.add(
102
- d,
103
- m,
104
- E.widget({
105
- widget: new c(
106
- p,
107
- a.activeEnvironment,
108
- a.activeEnvVariables,
109
- a.isReadOnly
106
+ c,
107
+ p,
108
+ x.widget({
109
+ widget: new d(
110
+ u,
111
+ n.activeEnvironment,
112
+ n.activeEnvVariables,
113
+ n.isReadOnly
110
114
  ),
111
115
  side: 1
112
116
  })
@@ -120,19 +124,19 @@ const T = (a) => x.fromClass(
120
124
  decorations: (t) => t.decorations
121
125
  }
122
126
  ), $ = w.domEventHandlers({
123
- keydown(a, t) {
124
- if (a.key === "Backspace") {
125
- const { state: e } = t, { from: i, to: n } = e.selection.main;
126
- if (i === 0 && n === e.doc.length)
127
+ keydown(n, t) {
128
+ if (n.key === "Backspace") {
129
+ const { state: e } = t, { from: a, to: i } = e.selection.main;
130
+ if (a === 0 && i === e.doc.length)
127
131
  return t.dispatch({
128
132
  changes: { from: 0, to: e.doc.length },
129
133
  selection: { anchor: 0 }
130
- }), a.preventDefault(), !0;
131
- if (i === n && i > 0 && e.doc.sliceString(i - 2, i) === "}}")
134
+ }), n.preventDefault(), !0;
135
+ if (a === i && a > 0 && e.doc.sliceString(a - 2, a) === "}}")
132
136
  return t.dispatch({
133
- changes: { from: i - 2, to: n },
134
- selection: { anchor: i - 2 }
135
- }), a.preventDefault(), !0;
137
+ changes: { from: a - 2, to: i },
138
+ selection: { anchor: a - 2 }
139
+ }), n.preventDefault(), !0;
136
140
  }
137
141
  return !1;
138
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ImportCollectionModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/ImportCollectionModal.vue"],"names":[],"mappings":";YAkVU,MAAM,GAAG,IAAI;iBACR,MAAM,GAAG,IAAI;;;;YADlB,MAAM,GAAG,IAAI;iBACR,MAAM,GAAG,IAAI;;;;AAic5B,wBASG"}
1
+ {"version":3,"file":"ImportCollectionModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/ImportCollectionModal.vue"],"names":[],"mappings":";YAgTU,MAAM,GAAG,IAAI;iBACR,MAAM,GAAG,IAAI;;;;YADlB,MAAM,GAAG,IAAI;iBACR,MAAM,GAAG,IAAI;;;;AAuX5B,wBASG"}