@scalar/api-client 2.32.0 → 2.33.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 (102) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/assets/yaml.worker-CcQnAKCg.js +490 -0
  3. package/dist/style.css +1 -1
  4. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  5. package/dist/v2/features/app/App.vue.d.ts +0 -5
  6. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  7. package/dist/v2/features/app/App.vue.js +57 -60
  8. package/dist/v2/features/app/app-state.d.ts +17 -2
  9. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  10. package/dist/v2/features/app/app-state.js +117 -105
  11. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  12. package/dist/v2/features/app/helpers/create-api-client-app.js +1 -3
  13. package/dist/v2/features/app/helpers/routes.d.ts +17 -0
  14. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  15. package/dist/v2/features/app/helpers/routes.js +8 -2
  16. package/dist/v2/features/app/hooks/use-theme.d.ts +14 -0
  17. package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -1
  18. package/dist/v2/features/app/hooks/use-theme.js +42 -28
  19. package/dist/v2/features/collection/DocumentCollection.vue.js +8 -6
  20. package/dist/v2/features/collection/OperationCollection.vue.js +14 -12
  21. package/dist/v2/features/collection/WorkspaceCollection.vue.js +9 -7
  22. package/dist/v2/features/collection/components/Authentication.vue2.js +19 -17
  23. package/dist/v2/features/collection/components/Cookies.vue.js +10 -8
  24. package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts +16 -0
  25. package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts.map +1 -0
  26. package/dist/v2/features/collection/components/Editor/Editor.vue.js +7 -0
  27. package/dist/v2/features/collection/components/Editor/Editor.vue2.js +333 -0
  28. package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.d.ts +19 -0
  29. package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.d.ts.map +1 -0
  30. package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.js +78 -0
  31. package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue2.js +4 -0
  32. package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.d.ts +16 -0
  33. package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.d.ts.map +1 -0
  34. package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.js +83 -0
  35. package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue2.js +4 -0
  36. package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts +16 -0
  37. package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts.map +1 -0
  38. package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.js +56 -0
  39. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts +7 -0
  40. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts.map +1 -0
  41. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.js +40 -0
  42. package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts +6 -0
  43. package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts.map +1 -0
  44. package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.js +23 -0
  45. package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.d.ts +12 -0
  46. package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.d.ts.map +1 -0
  47. package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.js +10 -0
  48. package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts +14 -0
  49. package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts.map +1 -0
  50. package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.js +9 -0
  51. package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.d.ts +11 -0
  52. package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.d.ts.map +1 -0
  53. package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.js +5 -0
  54. package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.d.ts +7 -0
  55. package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.d.ts.map +1 -0
  56. package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.js +5 -0
  57. package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts +19 -0
  58. package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts.map +1 -0
  59. package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.js +50 -0
  60. package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts +12 -0
  61. package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts.map +1 -0
  62. package/dist/v2/features/collection/components/Editor/helpers/json-ast.js +24 -0
  63. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts +15 -0
  64. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts.map +1 -0
  65. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.js +72 -0
  66. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts +7 -0
  67. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts.map +1 -0
  68. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.js +20 -0
  69. package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts +14 -0
  70. package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts.map +1 -0
  71. package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.js +21 -0
  72. package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.d.ts +10 -0
  73. package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.d.ts.map +1 -0
  74. package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.js +21 -0
  75. package/dist/v2/features/collection/components/Editor/helpers/stringify-document.d.ts +10 -0
  76. package/dist/v2/features/collection/components/Editor/helpers/stringify-document.d.ts.map +1 -0
  77. package/dist/v2/features/collection/components/Editor/helpers/stringify-document.js +5 -0
  78. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts +2 -0
  79. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts.map +1 -0
  80. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.js +11 -0
  81. package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts +152 -0
  82. package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts.map +1 -0
  83. package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.js +34 -0
  84. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +14 -0
  85. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts.map +1 -0
  86. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.js +25 -0
  87. package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts +39 -0
  88. package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts.map +1 -0
  89. package/dist/v2/features/collection/components/Editor/hooks/use-editor.js +153 -0
  90. package/dist/v2/features/collection/components/Editor/index.d.ts +2 -0
  91. package/dist/v2/features/collection/components/Editor/index.d.ts.map +1 -0
  92. package/dist/v2/features/collection/components/Editor/index.js +4 -0
  93. package/dist/v2/features/collection/components/Editor/schemas/openapi-3.1-schema.json.js +25 -0
  94. package/dist/v2/features/collection/components/Environment.vue.js +8 -6
  95. package/dist/v2/features/collection/components/Overview.vue2.js +16 -14
  96. package/dist/v2/features/collection/components/Servers.vue.js +18 -16
  97. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  98. package/dist/v2/features/collection/components/Settings.vue.js +6 -4
  99. package/dist/v2/features/collection/components/Tabs.vue.js +4 -4
  100. package/dist/v2/features/operation/Operation.vue.js +9 -7
  101. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  102. package/package.json +18 -11
@@ -0,0 +1,19 @@
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
2
+ type __VLS_Props = {
3
+ expanded: boolean;
4
+ diagnosticCounts: {
5
+ errors: number;
6
+ warnings: number;
7
+ };
8
+ visibleDiagnostics: monaco.editor.IMarker[];
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
11
+ toggle: () => any;
12
+ focusDiagnostic: (marker: monaco.editor.IMarker) => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ onToggle?: (() => any) | undefined;
15
+ onFocusDiagnostic?: ((marker: monaco.editor.IMarker) => any) | undefined;
16
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
19
+ //# sourceMappingURL=EditorDiagnosticsPanel.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorDiagnosticsPanel.vue.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue"],"names":[],"mappings":"AAmGA,OAAO,KAAK,MAAM,MAAM,2CAA2C,CAAA;AAEnE,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACtD,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;CAC5C,CAAC;AA0OF,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,78 @@
1
+ import { defineComponent as x, createElementBlock as o, openBlock as s, createElementVNode as e, createCommentVNode as f, createVNode as d, unref as l, toDisplayString as a, createBlock as g, Fragment as u, renderList as h, normalizeClass as v } from "vue";
2
+ import { ScalarIconXCircle as y, ScalarIconWarning as C, ScalarIconCaretDown as _, ScalarIconCaretRight as w } from "@scalar/icons";
3
+ import * as k from "monaco-editor/esm/vs/editor/editor.api.js";
4
+ const D = { class: "pointer-events-none absolute right-2 bottom-2 left-2 z-10" }, z = { class: "bg-b-1 shadow-border pointer-events-auto flex flex-col overflow-hidden rounded-lg text-[11px]" }, S = { class: "flex items-center gap-3" }, E = {
5
+ class: "text-c-danger flex items-center gap-1",
6
+ title: "Errors"
7
+ }, N = {
8
+ class: "text-c-alert flex items-center gap-1",
9
+ title: "Warnings"
10
+ }, $ = { class: "text-c-3" }, L = {
11
+ key: 0,
12
+ class: "max-h-28 overflow-auto border-t"
13
+ }, B = ["onClick"], I = { class: "min-w-0 flex-1" }, M = { class: "text-c-1 block truncate" }, V = { class: "text-c-3 block whitespace-nowrap" }, P = {
14
+ key: 1,
15
+ class: "text-c-3 border-t px-2.5 py-2"
16
+ }, F = /* @__PURE__ */ x({
17
+ __name: "EditorDiagnosticsPanel",
18
+ props: {
19
+ expanded: { type: Boolean },
20
+ diagnosticCounts: {},
21
+ visibleDiagnostics: {}
22
+ },
23
+ emits: ["toggle", "focusDiagnostic"],
24
+ setup(n, { emit: p }) {
25
+ const c = p, m = (r) => r === k.MarkerSeverity.Error ? "bg-c-danger" : "bg-c-alert";
26
+ return (r, i) => (s(), o("div", D, [
27
+ e("div", z, [
28
+ e("button", {
29
+ class: "bg-b-2/30 hover:bg-b-2/50 flex items-center justify-between px-2.5 py-2 text-left",
30
+ type: "button",
31
+ onClick: i[0] || (i[0] = (t) => c("toggle"))
32
+ }, [
33
+ e("span", S, [
34
+ i[1] || (i[1] = e("span", { class: "text-c-2 font-medium" }, "Problems", -1)),
35
+ e("span", E, [
36
+ d(l(y), { class: "size-3" }),
37
+ e("span", null, a(n.diagnosticCounts.errors), 1)
38
+ ]),
39
+ e("span", N, [
40
+ d(l(C), { class: "size-3" }),
41
+ e("span", null, a(n.diagnosticCounts.warnings), 1)
42
+ ])
43
+ ]),
44
+ e("span", $, [
45
+ n.expanded ? (s(), g(l(_), {
46
+ key: 0,
47
+ class: "size-3"
48
+ })) : (s(), g(l(w), {
49
+ key: 1,
50
+ class: "size-3"
51
+ }))
52
+ ])
53
+ ]),
54
+ n.expanded ? (s(), o(u, { key: 0 }, [
55
+ n.visibleDiagnostics.length ? (s(), o("div", L, [
56
+ (s(!0), o(u, null, h(n.visibleDiagnostics, (t, b) => (s(), o("button", {
57
+ key: `${t.owner}-${t.startLineNumber}-${t.startColumn}-${b}`,
58
+ class: "hover:bg-b-2/40 flex w-full items-start gap-2 px-2.5 py-2 text-left",
59
+ type: "button",
60
+ onClick: (W) => c("focusDiagnostic", t)
61
+ }, [
62
+ e("span", {
63
+ class: v(["mt-0.5 size-1.5 shrink-0 rounded-full", m(t.severity)])
64
+ }, null, 2),
65
+ e("span", I, [
66
+ e("span", M, a(t.message), 1),
67
+ e("span", V, " Ln " + a(t.startLineNumber) + ", Col " + a(t.startColumn), 1)
68
+ ])
69
+ ], 8, B))), 128))
70
+ ])) : (s(), o("div", P, " Errors and warnings from the JSON/YAML language workers will show up here. "))
71
+ ], 64)) : f("", !0)
72
+ ])
73
+ ]));
74
+ }
75
+ });
76
+ export {
77
+ F as default
78
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./EditorDiagnosticsPanel.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,16 @@
1
+ import { type LoadingState } from '@scalar/components';
2
+ type __VLS_Props = {
3
+ isAutoSaveEnabled: boolean;
4
+ isDirty: boolean;
5
+ saveLoader: LoadingState;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
+ "update:isAutoSaveEnabled": (value: boolean) => any;
9
+ saveNow: () => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ "onUpdate:isAutoSaveEnabled"?: ((value: boolean) => any) | undefined;
12
+ onSaveNow?: (() => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ //# sourceMappingURL=EditorSavePanel.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorSavePanel.vue.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/components/EditorSavePanel.vue"],"names":[],"mappings":"AAmJA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAA;AAG3B,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,YAAY,CAAA;CACzB,CAAC;AAsQF,QAAA,MAAM,YAAY;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,83 @@
1
+ import { defineComponent as b, computed as s, createElementBlock as i, openBlock as a, createElementVNode as n, createCommentVNode as S, createVNode as w, unref as r, createBlock as v, withCtx as y, createTextVNode as L, normalizeClass as f, toDisplayString as A } from "vue";
2
+ import { ScalarToggle as E, ScalarButton as h, ScalarLoading as k } from "@scalar/components";
3
+ const V = { class: "bg-b-1 pointer-events-auto flex flex-col items-stretch overflow-hidden rounded-lg border shadow-sm" }, C = { class: "flex items-center gap-2 px-2 py-1.5" }, B = { class: "min-w-[48px]" }, D = {
4
+ key: 1,
5
+ class: "text-c-3 flex h-6 items-center justify-center rounded px-2 text-[11px] whitespace-nowrap"
6
+ }, N = {
7
+ key: 0,
8
+ class: "bg-b-2/40 flex items-center gap-2 border-t px-2 py-1 text-[11px]"
9
+ }, I = /* @__PURE__ */ b({
10
+ __name: "EditorSavePanel",
11
+ props: {
12
+ isAutoSaveEnabled: { type: Boolean },
13
+ isDirty: { type: Boolean },
14
+ saveLoader: {}
15
+ },
16
+ emits: ["update:isAutoSaveEnabled", "saveNow"],
17
+ setup(e, { emit: x }) {
18
+ const l = x, d = s(() => !e.isAutoSaveEnabled && e.isDirty ? "Unsaved" : e.saveLoader.isActive ? e.saveLoader.isLoading ? "Saving…" : e.saveLoader.isInvalid ? "Save failed" : e.saveLoader.isValid ? "Saved" : null : null), o = s(() => d.value !== null), u = s(() => o.value ? !e.isAutoSaveEnabled && e.isDirty ? "warning" : e.saveLoader.isLoading ? "loading" : e.saveLoader.isInvalid ? "danger" : e.saveLoader.isValid ? "success" : null : null), m = s(() => {
19
+ switch (u.value) {
20
+ case "warning":
21
+ return "bg-c-alert";
22
+ case "success":
23
+ return "bg-c-accent";
24
+ case "danger":
25
+ return "bg-c-danger";
26
+ default:
27
+ return "bg-b-3";
28
+ }
29
+ }), g = s(() => {
30
+ switch (u.value) {
31
+ case "warning":
32
+ return "text-c-alert";
33
+ case "success":
34
+ return "text-c-accent";
35
+ case "danger":
36
+ return "text-c-danger";
37
+ default:
38
+ return "text-c-2";
39
+ }
40
+ });
41
+ return (p, t) => (a(), i("div", V, [
42
+ n("div", C, [
43
+ t[3] || (t[3] = n("span", { class: "text-c-2 text-[11px] font-medium whitespace-nowrap" }, " Auto-save ", -1)),
44
+ w(r(E), {
45
+ modelValue: e.isAutoSaveEnabled,
46
+ "onUpdate:modelValue": t[0] || (t[0] = (c) => l("update:isAutoSaveEnabled", c))
47
+ }, null, 8, ["modelValue"]),
48
+ t[4] || (t[4] = n("div", { class: "bg-b-3 mx-1 h-4 w-px" }, null, -1)),
49
+ n("div", B, [
50
+ e.isAutoSaveEnabled ? (a(), i("div", D, " Auto ")) : (a(), v(r(h), {
51
+ key: 0,
52
+ disabled: !e.isDirty || e.saveLoader.isLoading,
53
+ size: "xs",
54
+ variant: "outlined",
55
+ onClick: t[1] || (t[1] = (c) => l("saveNow"))
56
+ }, {
57
+ default: y(() => [...t[2] || (t[2] = [
58
+ L(" Save ", -1)
59
+ ])]),
60
+ _: 1
61
+ }, 8, ["disabled"]))
62
+ ])
63
+ ]),
64
+ o.value ? (a(), i("div", N, [
65
+ e.saveLoader.isActive ? (a(), v(r(k), {
66
+ key: 0,
67
+ class: "self-center",
68
+ loader: e.saveLoader,
69
+ size: "sm"
70
+ }, null, 8, ["loader"])) : (a(), i("span", {
71
+ key: 1,
72
+ class: f(["size-1.5 rounded-full", m.value])
73
+ }, null, 2)),
74
+ n("span", {
75
+ class: f(["whitespace-nowrap", g.value])
76
+ }, A(d.value), 3)
77
+ ])) : S("", !0)
78
+ ]));
79
+ }
80
+ });
81
+ export {
82
+ I as default
83
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./EditorSavePanel.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Applies a custom Scalar theme to the Monaco editor.
3
+ *
4
+ * This function loads CSS variables for either dark or light mode, maps the colors to Monaco's editor theme keys,
5
+ * and then applies the new theme. Theme color tokens are resolved from CSS custom properties.
6
+ *
7
+ * Example usage:
8
+ *
9
+ * await applyScalarTheme('scalar', true); // Apply dark mode
10
+ * await applyScalarTheme('scalar', false); // Apply light mode
11
+ *
12
+ * @param theme - The theme string key to load variables for (e.g. 'scalar').
13
+ * @param isDarkMode - Whether to use dark or light variables.
14
+ */
15
+ export declare const applyScalarTheme: (theme: string, isDarkMode: boolean) => Promise<void>;
16
+ //# sourceMappingURL=apply-scalar-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-scalar-theme.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/apply-scalar-theme.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAAU,OAAO,MAAM,EAAE,YAAY,OAAO,kBAwExE,CAAA"}
@@ -0,0 +1,56 @@
1
+ import * as t from "monaco-editor";
2
+ import { loadCssVariables as i } from "./load-css-variables.js";
3
+ const n = "scalar-theme", g = async (d, a) => {
4
+ const e = await i(d), r = a ? e.dark : e.light, l = Object.fromEntries(
5
+ Object.entries({
6
+ "editor.background": "--scalar-background-1",
7
+ "editor.foreground": "--scalar-color-1",
8
+ "editorLineNumber.foreground": "--scalar-color-3",
9
+ "editorLineNumber.activeForeground": "--scalar-color-1",
10
+ "editorLineHighlight.background": "--scalar-background-2",
11
+ "editorCursor.foreground": "--scalar-color-1",
12
+ "editorCursor.background": "--scalar-background-1",
13
+ "editor.selectionBackground": "--scalar-background-3",
14
+ "editor.inactiveSelectionBackground": "--scalar-background-3",
15
+ "editorIndentGuide.background": "--scalar-background-3",
16
+ "editorIndentGuide.activeBackground": "--scalar-background-2",
17
+ "editorWhitespace.foreground": "--scalar-border-color",
18
+ "editorBracketMatch.background": "--scalar-background-3",
19
+ "editorBracketMatch.border": "--scalar-color-accent",
20
+ "editor.selectionHighlightBackground": "--scalar-background-3",
21
+ "editor.hoverHighlightBackground": "--scalar-background-3",
22
+ "editorLink.activeForeground": "--scalar-color-3",
23
+ "editorOverviewRuler.border": "--scalar-border-color"
24
+ }).filter(([c, o]) => !!r[o]).map(([c, o]) => [c, r[o]])
25
+ );
26
+ t.editor.defineTheme(n, {
27
+ base: a ? "vs-dark" : "vs",
28
+ inherit: !0,
29
+ rules: [
30
+ // Default text
31
+ { token: "", foreground: r["--scalar-color-3"] },
32
+ // Comments
33
+ {
34
+ token: "comment",
35
+ foreground: r["--scalar-color-2"],
36
+ fontStyle: "italic"
37
+ },
38
+ // Keywords
39
+ {
40
+ token: "keyword",
41
+ foreground: r["--scalar-color-accent"],
42
+ fontStyle: "bold"
43
+ },
44
+ // Numbers
45
+ { token: "number", foreground: r["--scalar-color-purple"] },
46
+ // Strings
47
+ { token: "string", foreground: r["--scalar-color-2"] },
48
+ // Delimiters (punctuation)
49
+ { token: "delimiter", foreground: r["--scalar-color-3"] }
50
+ ],
51
+ colors: l
52
+ }), t.editor.setTheme(n);
53
+ };
54
+ export {
55
+ g as applyScalarTheme
56
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Configures both JSON and YAML language support for the given model URI
3
+ *
4
+ * @param modelUri - The URI of the model to configure language support for
5
+ */
6
+ export declare const configureLanguageSupport: (modelUri: string) => void;
7
+ //# sourceMappingURL=configure-language-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-language-support.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/configure-language-support.ts"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,KAAG,IAG3D,CAAA"}
@@ -0,0 +1,40 @@
1
+ import * as t from "monaco-editor/esm/vs/editor/editor.api.js";
2
+ import { configureMonacoYaml as r } from "monaco-yaml";
3
+ import n from "../schemas/openapi-3.1-schema.json.js";
4
+ const s = "inmemory://model/scalar/openapi-json-schema", m = (e) => {
5
+ const o = t.languages.json.jsonDefaults, a = o.diagnosticsOptions, c = [
6
+ ...(a.schemas ?? []).filter((i) => i.uri !== s),
7
+ {
8
+ uri: s,
9
+ fileMatch: [e],
10
+ schema: n
11
+ }
12
+ ];
13
+ o.setDiagnosticsOptions({
14
+ ...a,
15
+ validate: !0,
16
+ enableSchemaRequest: !1,
17
+ schemas: c
18
+ });
19
+ }, u = (e) => {
20
+ r(t, {
21
+ enableSchemaRequest: !1,
22
+ validate: !0,
23
+ format: !0,
24
+ completion: !0,
25
+ hover: !0,
26
+ schemas: [
27
+ {
28
+ // If YAML file is opened matching this glob
29
+ fileMatch: [e],
30
+ schema: n,
31
+ uri: s
32
+ }
33
+ ]
34
+ });
35
+ }, p = (e) => {
36
+ m(e), u(e);
37
+ };
38
+ export {
39
+ p as configureLanguageSupport
40
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This function ensures that the Monaco Editor's global environment is configured
3
+ * to provide the correct web worker for each language (json, yaml, or the default editor).
4
+ */
5
+ export declare const ensureMonacoEnvironment: () => void;
6
+ //# sourceMappingURL=ensure-monaco-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-monaco-environment.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAO,IAkB1C,CAAA"}
@@ -0,0 +1,23 @@
1
+ import o from "monaco-editor/esm/vs/editor/editor.worker.js?worker";
2
+ import n from "monaco-editor/esm/vs/language/json/json.worker.js?worker";
3
+ import t from "./yaml.worker.js";
4
+ const c = () => {
5
+ const r = {
6
+ getWorker(m, e) {
7
+ switch (e) {
8
+ case "json":
9
+ return new n();
10
+ case "yaml":
11
+ return new t();
12
+ default:
13
+ return new o();
14
+ }
15
+ }
16
+ };
17
+ globalThis.MonacoEnvironment ??= {
18
+ getWorker: r.getWorker
19
+ };
20
+ };
21
+ export {
22
+ c as ensureMonacoEnvironment
23
+ };
@@ -0,0 +1,12 @@
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
2
+ /**
3
+ * This function counts the number of error and warning markers in the provided array of Monaco editor markers.
4
+ *
5
+ * @param markers - The array of Monaco editor markers to count the errors and warnings for
6
+ * @returns An object with the number of errors and warnings
7
+ */
8
+ export declare const getDiagnosticCounts: (markers: monaco.editor.IMarker[]) => {
9
+ errors: number;
10
+ warnings: number;
11
+ };
12
+ //# sourceMappingURL=get-diagnostic-counts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-diagnostic-counts.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2CAA2C,CAAA;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAaxG,CAAA"}
@@ -0,0 +1,10 @@
1
+ import * as o from "monaco-editor/esm/vs/editor/editor.api.js";
2
+ const n = (i) => {
3
+ let r = 0, e = 0;
4
+ for (const t of i)
5
+ t.severity === o.MarkerSeverity.Error ? r += 1 : t.severity === o.MarkerSeverity.Warning && (e += 1);
6
+ return { errors: r, warnings: e };
7
+ };
8
+ export {
9
+ n as getDiagnosticCounts
10
+ };
@@ -0,0 +1,14 @@
1
+ import * as monaco from 'monaco-editor';
2
+ import type { JsonPath } from './json-ast.js';
3
+ /**
4
+ * Retrieves a JSON AST node from a Monaco editor model at the specified JSON path.
5
+ *
6
+ * Utilizes Monaco's JSON worker to parse the document and returns the AST node
7
+ * located at the given path, or null if not found.
8
+ *
9
+ * @param model - The Monaco editor text model representing the JSON document.
10
+ * @param path - The JSON path to locate the AST node.
11
+ * @returns A promise resolving to the AST node at the path, or null if not found.
12
+ */
13
+ export declare const getJsonAstNodeFromPath: (model: monaco.editor.ITextModel, path: JsonPath) => Promise<monaco.languages.json.ASTNode | null>;
14
+ //# sourceMappingURL=get-json-ast-node-from-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-json-ast-node-from-path.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAG1C;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,EAC/B,MAAM,QAAQ,KACb,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAW9C,CAAA"}
@@ -0,0 +1,9 @@
1
+ import * as n from "monaco-editor";
2
+ import { getJsonAstNodeAtPath as e } from "./json-ast.js";
3
+ const u = async (o, t) => {
4
+ const r = await (await (await n.languages.json.getWorker())(o.uri)).parseJSONDocument(o.uri.toString());
5
+ return r?.root ? e(r.root, t) ?? null : null;
6
+ };
7
+ export {
8
+ u as getJsonAstNodeFromPath
9
+ };
@@ -0,0 +1,11 @@
1
+ type OperationContext = {
2
+ path: string;
3
+ method: string;
4
+ };
5
+ /**
6
+ * Returns an OperationContext if both path is provided and method is a valid HTTP method.
7
+ * Returns null otherwise.
8
+ */
9
+ export declare const getOperationContext: (path?: string, method?: string) => OperationContext | null;
10
+ export {};
11
+ //# sourceMappingURL=get-operation-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-operation-context.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/get-operation-context.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,EAAE,SAAS,MAAM,KAAG,gBAAgB,GAAG,IAMvF,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { isHttpMethod as e } from "@scalar/helpers/http/is-http-method";
2
+ const o = (t, r) => !t || !e(r) ? null : { path: t, method: r };
3
+ export {
4
+ o as getOperationContext
5
+ };
@@ -0,0 +1,7 @@
1
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
2
+ /**
3
+ * Returns up to `maxVisible` diagnostics from the provided markers array,
4
+ * filtering to only errors and warnings, sorted by severity and position in the document.
5
+ */
6
+ export declare const getVisibleDiagnostics: (markers: monaco.editor.IMarker[], maxVisible: number) => monaco.editor.IMarker[];
7
+ //# sourceMappingURL=get-visible-diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-visible-diagnostics.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2CAA2C,CAAA;AAenE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAC1B,CAAA"}
@@ -0,0 +1,5 @@
1
+ import * as t from "monaco-editor/esm/vs/editor/editor.api.js";
2
+ const i = (r) => r.severity === t.MarkerSeverity.Error || r.severity === t.MarkerSeverity.Warning, s = (r, e) => r.severity !== e.severity ? e.severity - r.severity : r.startLineNumber !== e.startLineNumber ? r.startLineNumber - e.startLineNumber : r.startColumn - e.startColumn, n = (r, e) => [...r].filter(i).sort(s).slice(0, e);
3
+ export {
4
+ n as getVisibleDiagnostics
5
+ };
@@ -0,0 +1,19 @@
1
+ import type { JsonPath } from './json-ast.js';
2
+ type YamlNodeRange = {
3
+ startOffset: number;
4
+ endOffset: number;
5
+ };
6
+ /**
7
+ * Finds the byte range (offset) in the YAML text corresponding to a JSON path.
8
+ * Given a YAML string and a path (array of segments), parses the document and walks
9
+ * down the tree to find the target node or key, returning its start and end offsets.
10
+ * Will prefer to highlight the "key" part for map entries, to avoid highlighting the value which
11
+ * might be offset due to block structure.
12
+ *
13
+ * @param yamlText The YAML string
14
+ * @param path An array representing the path to traverse
15
+ * @returns The byte offsets in the YAML string of the node (or null if not found)
16
+ */
17
+ export declare const getYamlNodeRangeFromPath: (yamlText: string, path: JsonPath) => YamlNodeRange | null;
18
+ export {};
19
+ //# sourceMappingURL=get-yaml-node-range-from-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-yaml-node-range-from-path.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,KAAK,aAAa,GAAG;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAaD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,MAAM,QAAQ,KAAG,aAAa,GAAG,IA0E3F,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { isMap as d, isPair as l, isScalar as p, isSeq as h, parseDocument as x } from "yaml";
2
+ const f = (a) => Array.isArray(a) && typeof a[0] == "number" && typeof a[1] == "number", M = (a) => {
3
+ try {
4
+ return x(a);
5
+ } catch {
6
+ return null;
7
+ }
8
+ }, S = (a, g) => {
9
+ const c = M(a);
10
+ if (!c)
11
+ return null;
12
+ let e = c.contents, s = null;
13
+ for (const n of g) {
14
+ if (d(e)) {
15
+ const t = String(n), r = e.items.find((i) => {
16
+ if (!l(i))
17
+ return !1;
18
+ const o = i.key;
19
+ return p(o) ? String(o.value) === t : String(o) === t;
20
+ });
21
+ if (!r || !l(r))
22
+ return null;
23
+ s = r, e = r.value;
24
+ continue;
25
+ }
26
+ if (h(e)) {
27
+ const t = typeof n == "number" ? n : Number.parseInt(String(n), 10);
28
+ if (!Number.isFinite(t) || t < 0 || t >= e.items.length)
29
+ return null;
30
+ s = null, e = e.items[t];
31
+ continue;
32
+ }
33
+ return null;
34
+ }
35
+ if (s && l(s)) {
36
+ const n = s.key?.range, t = s.value?.range;
37
+ if (!f(n))
38
+ return null;
39
+ const r = Math.max(0, n[0]), i = f(t) ? Math.max(r, t[1]) : Math.max(r, n[1]);
40
+ return { startOffset: r, endOffset: i };
41
+ }
42
+ const u = e?.range;
43
+ if (!f(u))
44
+ return null;
45
+ const m = Math.max(0, u[0]), y = Math.max(m, u[1]);
46
+ return { startOffset: m, endOffset: y };
47
+ };
48
+ export {
49
+ S as getYamlNodeRangeFromPath
50
+ };
@@ -0,0 +1,12 @@
1
+ import type * as monaco from 'monaco-editor';
2
+ export type JsonPath = readonly (string | number)[];
3
+ /**
4
+ * Traverses the AST of a JSON document to find the node at the provided JsonPath.
5
+ * Returns undefined if the path does not exist in the AST.
6
+ *
7
+ * @param node - The root AST node to begin traversal from.
8
+ * @param path - The path to traverse within the AST, as an array of keys/indices.
9
+ * @returns The AST node at the specified path, or undefined if not found.
10
+ */
11
+ export declare const getJsonAstNodeAtPath: (node: monaco.languages.json.ASTNode | undefined, path: JsonPath) => monaco.languages.json.ASTNode | undefined;
12
+ //# sourceMappingURL=json-ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-ast.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/json-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,GAAG,SAAS,EAC/C,MAAM,QAAQ,KACb,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,GAAG,SAkClC,CAAA"}
@@ -0,0 +1,24 @@
1
+ const u = (r, o) => {
2
+ let e = r;
3
+ for (const n of o) {
4
+ if (!e)
5
+ return;
6
+ if (e.type === "object") {
7
+ const t = String(n);
8
+ e = e.properties.find((i) => i.keyNode.value === t)?.valueNode;
9
+ continue;
10
+ }
11
+ if (e.type === "array") {
12
+ const t = typeof n == "number" ? n : Number.parseInt(String(n), 10);
13
+ if (!Number.isFinite(t) || t < 0 || t >= e.items.length)
14
+ return;
15
+ e = e.items[t];
16
+ continue;
17
+ }
18
+ return;
19
+ }
20
+ return e;
21
+ };
22
+ export {
23
+ u as getJsonAstNodeAtPath
24
+ };
@@ -0,0 +1,15 @@
1
+ import * as monaco from 'monaco-editor';
2
+ /**
3
+ * Enables clickable JSON Pointer links in Monaco JSON editor.
4
+ *
5
+ * - Scans for "#/" inside JSON string values, but only within properly quoted, unescaped strings.
6
+ * - When a valid JSON Pointer is found, highlights it (excluding quotes) as a clickable link.
7
+ * - Clicking the link invokes the provided `navigate` function with the decoded pointer.
8
+ *
9
+ * @param navigate Callback to execute on pointer link click.
10
+ */
11
+ export declare const ensureJsonPointerLinkSupport: (navigate: (pointer: string) => Promise<void> | void) => {
12
+ linkOpener: monaco.IDisposable;
13
+ dispose: () => void;
14
+ };
15
+ //# sourceMappingURL=json-pointer-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-pointer-links.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/json-pointer-links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAmEvC;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GAAI,UAAU,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;;;CA2E/F,CAAA"}