@scalar/api-client 2.36.1 → 2.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/monacoeditorwork/editor.worker.bundle.js +14463 -0
  3. package/dist/monacoeditorwork/json.worker.bundle.js +22211 -0
  4. package/dist/monacoeditorwork/yaml.worker.bundle.js +46771 -0
  5. package/dist/style.css +1 -1
  6. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +12 -11
  8. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  9. package/dist/v2/components/resize/index.d.ts +1 -0
  10. package/dist/v2/components/resize/index.d.ts.map +1 -1
  11. package/dist/v2/components/resize/index.js +4 -2
  12. package/dist/v2/components/resize/use-split-resize.d.ts +27 -0
  13. package/dist/v2/components/resize/use-split-resize.d.ts.map +1 -0
  14. package/dist/v2/components/resize/use-split-resize.js +57 -0
  15. package/dist/v2/features/app/App.vue.d.ts +5 -0
  16. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  17. package/dist/v2/features/app/App.vue.js +71 -63
  18. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +7 -1
  19. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  20. package/dist/v2/features/app/helpers/create-api-client-app.js +15 -10
  21. package/dist/v2/features/app/helpers/routes.d.ts +6 -0
  22. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  23. package/dist/v2/features/app/helpers/routes.js +3 -2
  24. package/dist/v2/features/app/hooks/use-document-watcher.js +13 -13
  25. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  26. package/dist/v2/features/collection/DocumentCollection.vue.js +292 -100
  27. package/dist/v2/features/collection/DocumentCollection.vue3.js +5 -0
  28. package/dist/v2/features/collection/OperationCollection.vue.js +20 -19
  29. package/dist/v2/features/collection/WorkspaceCollection.vue.js +6 -5
  30. package/dist/v2/features/collection/components/Authentication.vue2.js +16 -15
  31. package/dist/v2/features/collection/components/Cookies.vue.js +7 -6
  32. package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts.map +1 -1
  33. package/dist/v2/features/collection/components/Editor/Editor.vue.js +3 -3
  34. package/dist/v2/features/collection/components/Editor/Editor.vue2.js +182 -171
  35. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +2 -1
  36. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts.map +1 -1
  37. package/dist/v2/features/collection/components/Environment.vue.js +13 -12
  38. package/dist/v2/features/collection/components/Overview.vue2.js +7 -6
  39. package/dist/v2/features/collection/components/Servers.vue.js +64 -63
  40. package/dist/v2/features/collection/components/Settings.vue.js +8 -7
  41. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts +18 -0
  42. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts.map +1 -0
  43. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.js +7 -0
  44. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue2.js +136 -0
  45. package/dist/v2/features/editor/config.d.ts +16 -0
  46. package/dist/v2/features/editor/config.d.ts.map +1 -0
  47. package/dist/v2/features/editor/config.js +16 -0
  48. package/dist/v2/features/editor/helpers/configure-language-support.d.ts +13 -0
  49. package/dist/v2/features/editor/helpers/configure-language-support.d.ts.map +1 -0
  50. package/dist/v2/features/{collection/components/Editor → editor}/helpers/configure-language-support.js +6 -7
  51. package/dist/v2/features/editor/helpers/ensure-monaco-environment.d.ts.map +1 -0
  52. package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.js +9 -12
  53. package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +12 -0
  54. package/dist/v2/features/editor/helpers/json/create-json-model.d.ts.map +1 -0
  55. package/dist/v2/features/editor/helpers/json/create-json-model.js +19 -0
  56. package/dist/v2/features/editor/helpers/json/get-json-ast-node-from-path.d.ts.map +1 -0
  57. package/dist/v2/features/editor/helpers/json/json-ast.d.ts.map +1 -0
  58. package/dist/v2/features/editor/helpers/json/json-pointer-links.d.ts.map +1 -0
  59. package/dist/v2/features/editor/helpers/json/json-pointer-path.d.ts.map +1 -0
  60. package/dist/v2/features/editor/helpers/json/json-pointer-path.js +21 -0
  61. package/dist/v2/features/editor/helpers/model.d.ts +9 -0
  62. package/dist/v2/features/editor/helpers/model.d.ts.map +1 -0
  63. package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts +14 -0
  64. package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts.map +1 -0
  65. package/dist/v2/features/editor/helpers/range-to-whole-line.js +8 -0
  66. package/dist/v2/features/editor/helpers/theme/apply-scalar-theme.d.ts.map +1 -0
  67. package/dist/v2/features/editor/helpers/theme/load-css-variables.d.ts.map +1 -0
  68. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +13 -0
  69. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts.map +1 -0
  70. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.js +19 -0
  71. package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.d.ts +2 -2
  72. package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts.map +1 -0
  73. package/dist/v2/features/editor/hooks/use-editor-markers.d.ts.map +1 -0
  74. package/dist/v2/features/editor/hooks/use-editor.d.ts +39 -0
  75. package/dist/v2/features/editor/hooks/use-editor.d.ts.map +1 -0
  76. package/dist/v2/features/editor/hooks/use-editor.js +107 -0
  77. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +16 -0
  78. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts.map +1 -0
  79. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.js +27 -0
  80. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts +77 -0
  81. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts.map +1 -0
  82. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +316 -0
  83. package/dist/v2/features/editor/index.d.ts +5 -0
  84. package/dist/v2/features/editor/index.d.ts.map +1 -0
  85. package/dist/v2/features/editor/index.js +10 -0
  86. package/dist/v2/features/operation/Operation.vue.js +18 -17
  87. package/dist/v2/types/configuration.d.ts +11 -0
  88. package/dist/v2/types/configuration.d.ts.map +1 -0
  89. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  90. package/package.json +23 -17
  91. package/dist/assets/yaml.worker-CcQnAKCg.js +0 -490
  92. package/dist/v2/features/collection/DocumentCollection.vue2.js +0 -4
  93. package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts.map +0 -1
  94. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts +0 -7
  95. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts.map +0 -1
  96. package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts.map +0 -1
  97. package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts.map +0 -1
  98. package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts.map +0 -1
  99. package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts.map +0 -1
  100. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts.map +0 -1
  101. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts.map +0 -1
  102. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.js +0 -20
  103. package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts.map +0 -1
  104. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts +0 -2
  105. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts.map +0 -1
  106. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.js +0 -11
  107. package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts.map +0 -1
  108. package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts +0 -39
  109. package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts.map +0 -1
  110. package/dist/v2/features/collection/components/Editor/hooks/use-editor.js +0 -153
  111. /package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.d.ts +0 -0
  112. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.d.ts +0 -0
  113. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.js +0 -0
  114. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.d.ts +0 -0
  115. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.js +0 -0
  116. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.d.ts +0 -0
  117. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.js +0 -0
  118. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-path.d.ts +0 -0
  119. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.d.ts +0 -0
  120. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.js +0 -0
  121. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.d.ts +0 -0
  122. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.js +0 -0
  123. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.js +0 -0
  124. /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.d.ts +0 -0
  125. /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.js +0 -0
  126. /package/dist/v2/features/{collection/components/Editor → editor}/schemas/openapi-3.1-schema.json.js +0 -0
@@ -1,9 +1,9 @@
1
- import { defineComponent as s, computed as r, createBlock as i, createCommentVNode as a, openBlock as u, withCtx as t, createVNode as m, unref as d, createTextVNode as n, createElementVNode as c } from "vue";
1
+ import { defineComponent as l, computed as r, createBlock as i, createCommentVNode as u, openBlock as a, withCtx as t, createVNode as m, unref as d, createTextVNode as n, createElementVNode as c } from "vue";
2
2
  import k from "../../settings/components/Section.vue.js";
3
3
  import p from "../../global-cookies/components/CookiesTable.vue.js";
4
4
  const y = {
5
5
  name: "Cookies"
6
- }, x = /* @__PURE__ */ s({
6
+ }, x = /* @__PURE__ */ l({
7
7
  ...y,
8
8
  props: {
9
9
  documentSlug: {},
@@ -21,11 +21,12 @@ const y = {
21
21
  customThemes: {},
22
22
  currentTheme: {},
23
23
  isDarkMode: { type: Boolean },
24
+ fetchRegistryDocument: { type: Function },
24
25
  collectionType: {}
25
26
  },
26
27
  setup(e) {
27
- const l = r(() => (e.collectionType === "document" ? e.document["x-scalar-cookies"] : e.workspaceStore.workspace["x-scalar-cookies"]) ?? []);
28
- return (f, o) => e.collectionType !== "operation" ? (u(), i(k, { key: 0 }, {
28
+ const s = r(() => (e.collectionType === "document" ? e.document["x-scalar-cookies"] : e.workspaceStore.workspace["x-scalar-cookies"]) ?? []);
29
+ return (f, o) => e.collectionType !== "operation" ? (a(), i(k, { key: 0 }, {
29
30
  title: t(() => [...o[0] || (o[0] = [
30
31
  n("Cookies", -1)
31
32
  ])]),
@@ -38,12 +39,12 @@ const y = {
38
39
  default: t(() => [
39
40
  m(d(p), {
40
41
  collectionType: e.collectionType,
41
- cookies: l.value,
42
+ cookies: s.value,
42
43
  eventBus: e.eventBus
43
44
  }, null, 8, ["collectionType", "cookies", "eventBus"])
44
45
  ]),
45
46
  _: 1
46
- })) : a("", !0);
47
+ })) : u("", !0);
47
48
  }
48
49
  });
49
50
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.vue.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/collection/components/Editor/Editor.vue"],"names":[],"mappings":"AA8sCA,QAAA,MAAM,YAAY;;;;;;;;;;;;kGAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"Editor.vue.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/collection/components/Editor/Editor.vue"],"names":[],"mappings":"AA0xCA,QAAA,MAAM,YAAY;;;;;;;;;;;;kGAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./Editor.vue2.js";
2
2
  /* empty css */
3
- import t from "../../../../../_virtual/_plugin-vue_export-helper.js";
4
- const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-de6c6373"]]);
3
+ import f from "../../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const p = /* @__PURE__ */ f(o, [["__scopeId", "data-v-850fff8f"]]);
5
5
  export {
6
- _ as default
6
+ p as default
7
7
  };
@@ -1,24 +1,27 @@
1
- import { defineComponent as se, ref as U, computed as M, onMounted as ie, onBeforeUnmount as ne, watch as x, createElementBlock as J, unref as e, openBlock as E, normalizeClass as D, createElementVNode as a, createVNode as r, withCtx as d, createTextVNode as W, toDisplayString as G, createBlock as H } from "vue";
2
- import { useLoadingState as re, ScalarButton as m, ScalarHotkey as A } from "@scalar/components";
3
- import { debounce as le } from "@scalar/helpers/general/debounce";
4
- import { isObject as z } from "@scalar/helpers/object/is-object";
5
- import { ScalarIconArrowsIn as ce, ScalarIconArrowsOut as ue } from "@scalar/icons";
6
- import * as u from "monaco-editor/esm/vs/editor/editor.api.js";
7
- import { useEditorMarkers as de } from "./hooks/use-editor-markers.js";
8
- import me from "./components/EditorDiagnosticsPanel.vue.js";
9
- import fe from "./components/EditorSavePanel.vue.js";
10
- import { getDiagnosticCounts as ve } from "./helpers/get-diagnostic-counts.js";
11
- import { getOperationContext as T } from "./helpers/get-operation-context.js";
12
- import { getVisibleDiagnostics as pe } from "./helpers/get-visible-diagnostics.js";
13
- import { parseEditorObject as I } from "./helpers/parse-editor-object.js";
1
+ import { defineComponent as ue, ref as G, shallowRef as de, computed as C, onMounted as me, onBeforeUnmount as fe, watch as x, nextTick as H, createElementBlock as X, unref as o, openBlock as k, normalizeClass as D, createElementVNode as a, createVNode as r, withCtx as m, createTextVNode as q, toDisplayString as Q, createBlock as Z } from "vue";
2
+ import { useLoadingState as pe, ScalarButton as f, ScalarHotkey as j } from "@scalar/components";
3
+ import { debounce as ve } from "@scalar/helpers/general/debounce";
4
+ import { isObject as I } from "@scalar/helpers/object/is-object";
5
+ import { ScalarIconArrowsIn as ge, ScalarIconArrowsOut as ye } from "@scalar/icons";
6
+ import * as c from "monaco-editor/esm/vs/editor/editor.api.js";
7
+ import { createJsonModel as he } from "../../../editor/helpers/json/create-json-model.js";
8
+ import { createYamlModel as xe } from "../../../editor/helpers/yaml/create-yaml-model.js";
9
+ import { useEditorMarkers as we } from "../../../editor/hooks/use-editor-markers.js";
10
+ import be from "./components/EditorDiagnosticsPanel.vue.js";
11
+ import Se from "./components/EditorSavePanel.vue.js";
12
+ import { getDiagnosticCounts as Ee } from "./helpers/get-diagnostic-counts.js";
13
+ import { getOperationContext as V } from "./helpers/get-operation-context.js";
14
+ import { getVisibleDiagnostics as Ce } from "./helpers/get-visible-diagnostics.js";
15
+ import { parseEditorObject as T } from "./helpers/parse-editor-object.js";
14
16
  import { stringifyDocument as B } from "./helpers/stringify-document.js";
15
- import { useEditor as ge } from "./hooks/use-editor.js";
16
- import { useEditorState as he } from "./hooks/use-editor-state.js";
17
- const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3" }, xe = { class: "flex min-w-0 items-center gap-1 overflow-x-auto whitespace-nowrap" }, we = { class: "text-c-3 ml-2 text-[11px]" }, Se = { class: "text-c-3 ml-2 text-[11px]" }, be = {
17
+ import { useEditorState as ke } from "./hooks/use-editor-state.js";
18
+ import { useJsonPointerLinkSupport as De } from "../../../editor/hooks/use-json-pointer-link-support.js";
19
+ import { useEditor as Me } from "../../../editor/hooks/use-editor.js";
20
+ const Oe = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3" }, Ae = { class: "flex min-w-0 items-center gap-1 overflow-x-auto whitespace-nowrap" }, Ne = { class: "text-c-3 ml-2 text-[11px]" }, ze = { class: "text-c-3 ml-2 text-[11px]" }, Le = {
18
21
  "aria-label": "Editor language",
19
22
  class: "bg-b-1 shadow-border flex items-center justify-self-center overflow-hidden rounded-lg p-0.5",
20
23
  role: "tablist"
21
- }, ke = { class: "flex min-w-0 shrink-0 items-center gap-2 justify-self-end" }, Ee = { class: "text-c-3 ml-2 text-[11px]" }, De = { class: "text-c-3 ml-2 text-[11px]" }, Ce = { class: "flex min-h-0 w-full min-w-0 flex-1 rounded-lg border" }, Oe = { class: "pointer-events-none absolute top-2 right-2 z-10" }, Me = { key: 1 }, Ae = 6, X = "editor:replace-document", Je = /* @__PURE__ */ se({
24
+ }, je = { class: "flex min-w-0 shrink-0 items-center gap-2 justify-self-end" }, Ie = { class: "text-c-3 ml-2 text-[11px]" }, Ve = { class: "text-c-3 ml-2 text-[11px]" }, Te = { class: "flex min-h-0 w-full min-w-0 flex-1 rounded-lg border" }, Be = { class: "pointer-events-none absolute top-2 right-2 z-10" }, Ke = { key: 1 }, Pe = 6, ee = "editor:replace-document", st = /* @__PURE__ */ ue({
22
25
  __name: "Editor",
23
26
  props: {
24
27
  documentSlug: {},
@@ -36,174 +39,182 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
36
39
  customThemes: {},
37
40
  currentTheme: {},
38
41
  isDarkMode: { type: Boolean },
42
+ fetchRegistryDocument: { type: Function },
39
43
  collectionType: {}
40
44
  },
41
45
  setup(s) {
42
- const K = U(), n = U(), w = re(), {
43
- isAutoSaveEnabled: f,
46
+ const K = G(), i = de(), w = pe(), {
47
+ isAutoSaveEnabled: p,
44
48
  isDirty: l,
45
- editorLanguage: c,
46
- isDiagnosticsPaneExpanded: S,
47
- isEditorMaximized: b,
49
+ editorLanguage: u,
50
+ isDiagnosticsPaneExpanded: b,
51
+ isEditorMaximized: S,
48
52
  isYamlMode: v,
49
- editorBottomPadding: q,
50
- editorRootClass: Q,
51
- getLanguageToggleClass: N,
52
- toggleEditorMaximized: Z
53
- } = he(), _ = M(() => n.value?.editor), { markers: C } = de(_), V = () => {
54
- n.value?.editor.updateOptions({
53
+ editorBottomPadding: te,
54
+ editorRootClass: oe,
55
+ getLanguageToggleClass: P,
56
+ toggleEditorMaximized: ae
57
+ } = ke(), M = he(), O = xe(), E = G("json"), A = C(() => E.value === "json" ? M : O), se = C(() => i.value?.editor), { markers: N } = we(se), F = () => {
58
+ i.value?.editor.updateOptions({
55
59
  padding: {
56
60
  top: 0,
57
- bottom: q.value
61
+ bottom: te.value
58
62
  }
59
63
  });
60
- }, ee = M(() => ve(C.value)), te = M(
61
- () => pe(C.value, Ae)
62
- ), L = (o) => {
63
- n.value?.setCursorToMarker(o);
64
- }, k = () => n.value?.getValue?.() ?? null, oe = async () => {
65
- const o = await s.workspaceStore.getEditableDocument(s.documentSlug);
66
- return B(o, c.value);
67
- }, p = le({ delay: 1500 }), P = (o) => {
68
- p.cleanup(), n.value?.setValue(o, !0);
69
- }, j = async () => {
70
- P(await oe()), l.value = !1, await g();
71
- }, F = async () => {
72
- await n.value?.formatDocument();
73
- }, g = async () => {
74
- const o = T(s.path, s.method);
75
- o && await n.value?.focusPath([
64
+ }, ne = C(() => Ee(N.value)), ie = C(
65
+ () => Ce(N.value, Pe)
66
+ ), R = (t) => {
67
+ const e = i.value?.editor;
68
+ e && (e.setSelection({
69
+ startLineNumber: t.startLineNumber,
70
+ startColumn: t.startColumn,
71
+ endLineNumber: t.endLineNumber,
72
+ endColumn: t.endColumn
73
+ }), e.revealPositionInCenter({
74
+ lineNumber: t.startLineNumber,
75
+ column: t.startColumn
76
+ }));
77
+ }, z = () => A.value.model.getValue(), re = (t) => (t === "json" ? M : O).model.getValue(), le = async (t) => {
78
+ const e = await s.workspaceStore.getEditableDocument(s.documentSlug);
79
+ return B(e, E.value);
80
+ }, g = ve({ delay: 1500 }), Y = (t) => {
81
+ g.cleanup(), i.value?.setValue(t, !0);
82
+ }, $ = async () => {
83
+ Y(await le()), l.value = !1, await d();
84
+ }, J = async () => {
85
+ await i.value?.formatDocument();
86
+ }, d = async () => {
87
+ const t = V(s.path, s.method);
88
+ t && await i.value?.focusPath([
76
89
  "paths",
77
- o.path,
78
- o.method
90
+ t.path,
91
+ t.method
79
92
  ]);
80
- }, O = async (o) => {
81
- const t = I(o, c.value);
82
- if (!t) {
83
- const i = C.value.find(
84
- (h) => h.severity === u.MarkerSeverity.Error
93
+ }, L = async (t) => {
94
+ const e = T(t, u.value);
95
+ if (!e) {
96
+ const n = N.value.find(
97
+ (y) => y.severity === c.MarkerSeverity.Error
85
98
  );
86
- i && L(i), await w.invalidate();
99
+ n && R(n), await w.invalidate();
87
100
  return;
88
101
  }
89
- w.start(), await s.workspaceStore.replaceDocument(s.documentSlug, t), l.value = !1, await w.validate({ duration: 900 });
90
- }, R = async () => {
91
- const o = k();
92
- o && await O(o);
93
- }, ae = (o) => {
94
- l.value = !0, f.value && p.execute(
95
- X,
96
- () => O(o)
102
+ w.start(), await s.workspaceStore.replaceDocument(s.documentSlug, e), l.value = !1, await w.validate({ duration: 900 });
103
+ }, U = async () => {
104
+ const t = z();
105
+ t && await L(t);
106
+ }, ce = (t) => {
107
+ l.value = !0, p.value && g.execute(
108
+ ee,
109
+ () => L(t)
97
110
  );
98
- }, $ = async () => {
99
- const o = T(s.path, s.method);
100
- if (!o)
101
- return;
102
- const t = k();
111
+ }, W = async () => {
112
+ const t = V(s.path, s.method);
103
113
  if (!t)
104
114
  return;
105
- const i = I(t, c.value);
106
- if (!i || !z(i.paths))
115
+ const e = z();
116
+ if (!e)
107
117
  return;
108
- const y = i.paths[o.path];
109
- if (!z(y))
118
+ const n = T(e, u.value);
119
+ if (!n || !I(n.paths))
110
120
  return;
111
- const Y = y[o.method];
112
- z(Y) && (Y.servers ??= [], n.value?.setValue(B(i, c.value)), await n.value?.focusPath([
121
+ const h = n.paths[t.path];
122
+ if (!I(h))
123
+ return;
124
+ const _ = h[t.method];
125
+ I(_) && (_.servers ??= [], i.value?.setValue(B(n, u.value)), await i.value?.focusPath([
113
126
  "paths",
114
- o.path,
115
- o.method,
127
+ t.path,
128
+ t.method,
116
129
  "servers"
117
130
  ]));
118
131
  };
119
- return ie(() => {
120
- n.value = ge({
132
+ return De(i, A), me(() => {
133
+ i.value = Me({
121
134
  element: K.value ?? document.createElement("div"),
122
- onChange: ae,
123
- isDarkMode: s.isDarkMode,
124
- theme: s.currentTheme,
125
- language: c.value,
135
+ onChange: ce,
136
+ model: A,
126
137
  actions: [
127
138
  {
128
139
  id: "scalar.editor.focusOperation",
129
140
  label: "Focus Operation",
130
- keybindings: [u.KeyMod.Alt | u.KeyCode.KeyO],
141
+ keybindings: [c.KeyMod.Alt | c.KeyCode.KeyO],
131
142
  run: async () => {
132
- await g();
143
+ await d();
133
144
  }
134
145
  },
135
146
  {
136
147
  id: "scalar.editor.focusOperationServers",
137
148
  label: "Focus Operation Servers",
138
- keybindings: [u.KeyMod.Alt | u.KeyCode.KeyS],
149
+ keybindings: [c.KeyMod.Alt | c.KeyCode.KeyS],
139
150
  run: async () => {
140
- await $();
151
+ await W();
141
152
  }
142
153
  },
143
154
  {
144
155
  id: "scalar.editor.formatDocument",
145
156
  label: "Format Document",
146
157
  keybindings: [
147
- u.KeyMod.Alt | u.KeyMod.Shift | u.KeyCode.KeyF
158
+ c.KeyMod.Alt | c.KeyMod.Shift | c.KeyCode.KeyF
148
159
  ],
149
160
  run: async () => {
150
- await F();
161
+ await J();
151
162
  }
152
163
  }
153
164
  ]
154
- }), V(), j();
155
- }), ne(() => {
156
- p.cleanup(), l.value && f.value && R(), n.value?.dispose?.();
157
- }), x(() => s.documentSlug, j), x(
165
+ }), F(), $();
166
+ }), fe(() => {
167
+ g.cleanup(), l.value && p.value && U(), i.value?.dispose?.(), M.model.dispose(), O.model.dispose();
168
+ }), x(() => s.documentSlug, $), x(
158
169
  () => [s.path, s.method],
159
170
  async () => {
160
- await g();
171
+ await d();
161
172
  }
162
- ), x(S, () => {
163
- V();
164
- }), x(c, async (o, t) => {
165
- const i = l.value;
166
- n.value?.setLanguage(o);
167
- const h = k();
168
- if (!h)
173
+ ), x(b, () => {
174
+ F();
175
+ }), x(u, async (t, e) => {
176
+ const n = l.value, y = re(e ?? "json");
177
+ if (!y) {
178
+ E.value = t, await H(), await d();
169
179
  return;
170
- const y = I(h, t);
171
- y && (P(B(y, o)), l.value = i), await g();
180
+ }
181
+ const h = T(y, e ?? "json");
182
+ E.value = t, await H(), h && (Y(B(h, t)), l.value = n), await d();
172
183
  }), x(
173
- f,
174
- (o) => {
175
- if (!o) {
176
- p.cleanup();
184
+ p,
185
+ (t) => {
186
+ if (!t) {
187
+ g.cleanup();
177
188
  return;
178
189
  }
179
190
  if (l.value) {
180
- const t = k();
181
- if (!t)
191
+ const e = z();
192
+ if (!e)
182
193
  return;
183
- p.execute(
184
- X,
185
- () => O(t)
194
+ g.execute(
195
+ ee,
196
+ () => L(e)
186
197
  );
187
198
  }
188
199
  },
189
200
  { flush: "post" }
190
- ), (o, t) => s.collectionType === "operation" && e(T)(s.path, s.method) !== null ? (E(), J("div", {
201
+ ), (t, e) => s.collectionType === "operation" && o(V)(s.path, s.method) !== null ? (k(), X("div", {
191
202
  key: 0,
192
- class: D(["flex w-full min-w-0 flex-1 flex-col gap-2", e(Q)])
203
+ class: D(["flex w-full min-w-0 flex-1 flex-col gap-2", o(oe)])
193
204
  }, [
194
- a("div", ye, [
195
- a("div", xe, [
196
- t[6] || (t[6] = a("span", { class: "text-c-2 text-xs font-medium whitespace-nowrap" }, " Shortcuts ", -1)),
197
- r(e(m), {
205
+ a("div", Oe, [
206
+ a("div", Ae, [
207
+ e[6] || (e[6] = a("span", { class: "text-c-2 text-xs font-medium whitespace-nowrap" }, " Shortcuts ", -1)),
208
+ r(o(f), {
198
209
  class: "whitespace-nowrap",
199
210
  size: "xs",
200
211
  variant: "ghost",
201
- onClick: g
212
+ onClick: d
202
213
  }, {
203
- default: d(() => [
204
- t[4] || (t[4] = a("span", null, "Operation", -1)),
205
- a("span", we, [
206
- r(e(A), {
214
+ default: m(() => [
215
+ e[4] || (e[4] = a("span", null, "Operation", -1)),
216
+ a("span", Ne, [
217
+ r(o(j), {
207
218
  hotkey: "O",
208
219
  modifier: ["Alt"]
209
220
  })
@@ -211,16 +222,16 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
211
222
  ]),
212
223
  _: 1
213
224
  }),
214
- r(e(m), {
225
+ r(o(f), {
215
226
  class: "whitespace-nowrap",
216
227
  size: "xs",
217
228
  variant: "ghost",
218
- onClick: $
229
+ onClick: W
219
230
  }, {
220
- default: d(() => [
221
- t[5] || (t[5] = a("span", null, "Servers", -1)),
222
- a("span", Se, [
223
- r(e(A), {
231
+ default: m(() => [
232
+ e[5] || (e[5] = a("span", null, "Servers", -1)),
233
+ a("span", ze, [
234
+ r(o(j), {
224
235
  hotkey: "S",
225
236
  modifier: ["Alt"]
226
237
  })
@@ -229,46 +240,46 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
229
240
  _: 1
230
241
  })
231
242
  ]),
232
- a("div", be, [
233
- r(e(m), {
234
- "aria-selected": !e(v),
235
- class: D(e(N)(!e(v))),
243
+ a("div", Le, [
244
+ r(o(f), {
245
+ "aria-selected": !o(v),
246
+ class: D(o(P)(!o(v))),
236
247
  role: "tab",
237
248
  size: "xs",
238
249
  type: "button",
239
250
  variant: "ghost",
240
- onClick: t[0] || (t[0] = (i) => c.value = "json")
251
+ onClick: e[0] || (e[0] = (n) => u.value = "json")
241
252
  }, {
242
- default: d(() => [...t[7] || (t[7] = [
243
- W(" JSON ", -1)
253
+ default: m(() => [...e[7] || (e[7] = [
254
+ q(" JSON ", -1)
244
255
  ])]),
245
256
  _: 1
246
257
  }, 8, ["aria-selected", "class"]),
247
- r(e(m), {
248
- "aria-selected": e(v),
249
- class: D(e(N)(e(v))),
258
+ r(o(f), {
259
+ "aria-selected": o(v),
260
+ class: D(o(P)(o(v))),
250
261
  role: "tab",
251
262
  size: "xs",
252
263
  type: "button",
253
264
  variant: "ghost",
254
- onClick: t[1] || (t[1] = (i) => c.value = "yaml")
265
+ onClick: e[1] || (e[1] = (n) => u.value = "yaml")
255
266
  }, {
256
- default: d(() => [...t[8] || (t[8] = [
257
- W(" YAML ", -1)
267
+ default: m(() => [...e[8] || (e[8] = [
268
+ q(" YAML ", -1)
258
269
  ])]),
259
270
  _: 1
260
271
  }, 8, ["aria-selected", "class"])
261
272
  ]),
262
- a("div", ke, [
263
- r(e(m), {
273
+ a("div", je, [
274
+ r(o(f), {
264
275
  size: "xs",
265
276
  variant: "ghost",
266
- onClick: F
277
+ onClick: J
267
278
  }, {
268
- default: d(() => [
269
- a("span", null, "Format " + G(e(v) ? "YAML" : "JSON"), 1),
270
- a("span", Ee, [
271
- r(e(A), {
279
+ default: m(() => [
280
+ a("span", null, "Format " + Q(o(v) ? "YAML" : "JSON"), 1),
281
+ a("span", Ie, [
282
+ r(o(j), {
272
283
  hotkey: "F",
273
284
  modifier: ["Alt", "Shift"]
274
285
  })
@@ -276,19 +287,19 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
276
287
  ]),
277
288
  _: 1
278
289
  }),
279
- r(e(m), {
280
- "aria-label": e(b) ? "Restore editor size" : "Maximize editor",
290
+ r(o(f), {
291
+ "aria-label": o(S) ? "Restore editor size" : "Maximize editor",
281
292
  size: "xs",
282
293
  variant: "ghost",
283
- onClick: e(Z)
294
+ onClick: o(ae)
284
295
  }, {
285
- default: d(() => [
286
- a("span", null, G(e(b) ? "Restore" : "Maximize"), 1),
287
- a("span", De, [
288
- e(b) ? (E(), H(e(ce), {
296
+ default: m(() => [
297
+ a("span", null, Q(o(S) ? "Restore" : "Maximize"), 1),
298
+ a("span", Ve, [
299
+ o(S) ? (k(), Z(o(ge), {
289
300
  key: 0,
290
301
  class: "size-3.5"
291
- })) : (E(), H(e(ue), {
302
+ })) : (k(), Z(o(ye), {
292
303
  key: 1,
293
304
  class: "size-3.5"
294
305
  }))
@@ -298,25 +309,25 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
298
309
  }, 8, ["aria-label", "onClick"])
299
310
  ])
300
311
  ]),
301
- a("div", Ce, [
312
+ a("div", Te, [
302
313
  a("div", {
303
- class: D(["relative w-full min-w-0 flex-1", e(b) ? "h-full min-h-0" : "h-[500px]"])
314
+ class: D(["relative w-full min-w-0 flex-1", o(S) ? "h-full min-h-0" : "h-[500px]"])
304
315
  }, [
305
- a("div", Oe, [
306
- r(fe, {
307
- isAutoSaveEnabled: e(f),
308
- isDirty: e(l),
309
- saveLoader: e(w),
310
- onSaveNow: R,
311
- "onUpdate:isAutoSaveEnabled": t[2] || (t[2] = (i) => f.value = i)
316
+ a("div", Be, [
317
+ r(Se, {
318
+ isAutoSaveEnabled: o(p),
319
+ isDirty: o(l),
320
+ saveLoader: o(w),
321
+ onSaveNow: U,
322
+ "onUpdate:isAutoSaveEnabled": e[2] || (e[2] = (n) => p.value = n)
312
323
  }, null, 8, ["isAutoSaveEnabled", "isDirty", "saveLoader"])
313
324
  ]),
314
- r(me, {
315
- diagnosticCounts: ee.value,
316
- expanded: e(S),
317
- visibleDiagnostics: te.value,
318
- onFocusDiagnostic: L,
319
- onToggle: t[3] || (t[3] = (i) => S.value = !e(S))
325
+ r(be, {
326
+ diagnosticCounts: ne.value,
327
+ expanded: o(b),
328
+ visibleDiagnostics: ie.value,
329
+ onFocusDiagnostic: R,
330
+ onToggle: e[3] || (e[3] = (n) => b.value = !o(b))
320
331
  }, null, 8, ["diagnosticCounts", "expanded", "visibleDiagnostics"]),
321
332
  a("div", {
322
333
  ref_key: "monacoEditorRef",
@@ -325,9 +336,9 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
325
336
  }, null, 512)
326
337
  ], 2)
327
338
  ])
328
- ], 2)) : (E(), J("div", Me, "No operation context found"));
339
+ ], 2)) : (k(), X("div", Ke, "No operation context found"));
329
340
  }
330
341
  });
331
342
  export {
332
- Je as default
343
+ st as default
333
344
  };
@@ -1,4 +1,4 @@
1
- import type { MonacoEditorLanguage } from '../../../../../../v2/features/collection/components/Editor/hooks/use-editor.js';
1
+ type MonacoEditorLanguage = 'json' | 'yaml';
2
2
  export declare const useEditorState: () => {
3
3
  isAutoSaveEnabled: import("vue").Ref<boolean, boolean>;
4
4
  isDirty: import("vue").Ref<boolean, boolean>;
@@ -11,4 +11,5 @@ export declare const useEditorState: () => {
11
11
  getLanguageToggleClass: (isActive: boolean) => string;
12
12
  toggleEditorMaximized: () => void;
13
13
  };
14
+ export {};
14
15
  //# sourceMappingURL=use-editor-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-editor-state.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/hooks/use-editor-state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AAKvG,eAAO,MAAM,cAAc;;;;;;;;;uCAeiB,OAAO,KAAG,MAAM;iCAQxB,IAAI;CAgBvC,CAAA"}
1
+ {"version":3,"file":"use-editor-state.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/hooks/use-editor-state.ts"],"names":[],"mappings":"AAEA,KAAK,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAA;AAK3C,eAAO,MAAM,cAAc;;;;;;;;;uCAeiB,OAAO,KAAG,MAAM;iCAQxB,IAAI;CAgBvC,CAAA"}
@@ -1,10 +1,10 @@
1
- import { defineComponent as i, computed as r, createBlock as l, createCommentVNode as m, openBlock as s, withCtx as n, createVNode as u, unref as v, createTextVNode as o, createElementVNode as d } from "vue";
1
+ import { defineComponent as i, computed as c, createBlock as m, createCommentVNode as l, openBlock as s, withCtx as n, createVNode as u, unref as v, createTextVNode as o, createElementVNode as d } from "vue";
2
2
  import p from "../../settings/components/Section.vue.js";
3
- import f from "../../environments/EnvironmentsList.vue.js";
4
- const y = {
3
+ import y from "../../environments/EnvironmentsList.vue.js";
4
+ const f = {
5
5
  name: "Environment"
6
- }, w = /* @__PURE__ */ i({
7
- ...y,
6
+ }, h = /* @__PURE__ */ i({
7
+ ...f,
8
8
  props: {
9
9
  documentSlug: {},
10
10
  document: {},
@@ -21,13 +21,14 @@ const y = {
21
21
  customThemes: {},
22
22
  currentTheme: {},
23
23
  isDarkMode: { type: Boolean },
24
+ fetchRegistryDocument: { type: Function },
24
25
  collectionType: {}
25
26
  },
26
27
  setup(e) {
27
- const c = r(
28
+ const r = c(
28
29
  () => (e.collectionType === "document" ? e.document["x-scalar-environments"] : e.workspaceStore.workspace["x-scalar-environments"]) ?? {}
29
- ), a = r(() => e.workspaceStore.workspace["x-scalar-active-environment"]);
30
- return (k, t) => e.collectionType !== "operation" ? (s(), l(p, { key: 0 }, {
30
+ ), a = c(() => e.workspaceStore.workspace["x-scalar-active-environment"]);
31
+ return (k, t) => e.collectionType !== "operation" ? (s(), m(p, { key: 0 }, {
31
32
  title: n(() => [...t[0] || (t[0] = [
32
33
  o("Environment Variables", -1)
33
34
  ])]),
@@ -37,17 +38,17 @@ const y = {
37
38
  o(" to add / search among the selected environment's variables in your request inputs. ", -1)
38
39
  ])]),
39
40
  default: n(() => [
40
- u(v(f), {
41
+ u(v(y), {
41
42
  activeEnvironment: a.value,
42
43
  collectionType: e.collectionType,
43
- environments: c.value,
44
+ environments: r.value,
44
45
  eventBus: e.eventBus
45
46
  }, null, 8, ["activeEnvironment", "collectionType", "environments", "eventBus"])
46
47
  ]),
47
48
  _: 1
48
- })) : m("", !0);
49
+ })) : l("", !0);
49
50
  }
50
51
  });
51
52
  export {
52
- w as default
53
+ h as default
53
54
  };