@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,4 +0,0 @@
1
- import f from "./DocumentCollection.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1 +0,0 @@
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"}
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-pointer-path.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/json-pointer-path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AA+B1C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,QAAQ,GAAG,IAOjE,CAAA"}
@@ -1,20 +0,0 @@
1
- const i = (e) => e.replace(/~1/g, "/").replace(/~0/g, "~"), c = (e) => {
2
- const t = e.trim();
3
- if (t.startsWith("/"))
4
- return t;
5
- if (t.startsWith("#")) {
6
- const s = t.slice(1);
7
- return s.startsWith("/") ? s : null;
8
- }
9
- const r = t.indexOf("#");
10
- if (r === -1)
11
- return null;
12
- const n = t.slice(r + 1);
13
- return n.startsWith("/") ? n : null;
14
- }, o = (e) => {
15
- const t = c(e);
16
- return t ? t.split("/").slice(1).map(i) : null;
17
- };
18
- export {
19
- o as parseJsonPointerPath
20
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-css-variables.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/load-css-variables.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAU,KAAK,MAAM;WAIU,GAAG;UAAQ,GAAG;EA2CzE,CAAA"}
@@ -1,2 +0,0 @@
1
- import 'monaco-yaml/yaml.worker.js';
2
- //# sourceMappingURL=yaml.worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"yaml.worker.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/helpers/yaml.worker.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA"}
@@ -1,11 +0,0 @@
1
- function r(e) {
2
- return new Worker(
3
- "/assets/yaml.worker-CcQnAKCg.js",
4
- {
5
- name: e?.name
6
- }
7
- );
8
- }
9
- export {
10
- r as default
11
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-editor-markers.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/hooks/use-editor-markers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2CAA2C,CAAA;AACnE,OAAO,EAAE,KAAK,gBAAgB,EAAmD,MAAM,KAAK,CAAA;AAE5F,eAAO,MAAM,gBAAgB,GAAI,WAAW,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,GAAG,SAAS,CAAC;;;;;;;;;;;sBAkD0iJ,CAAC;yBAA2B,CAAC;oBAA6B,CAAC;qBAA8B,CAAC;wBAAiC,CAAC;;;;;;;;;;;;;;;;0BAA5H,CAAC;6BAA2B,CAAC;wBAA6B,CAAC;yBAA8B,CAAC;4BAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;0BAA5H,CAAC;6BAA2B,CAAC;wBAA6B,CAAC;yBAA8B,CAAC;4BAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;sBAA5H,CAAC;yBAA2B,CAAC;oBAA6B,CAAC;qBAA8B,CAAC;wBAAiC,CAAC;;;;;;;;;;;;;;;;0BAA5H,CAAC;6BAA2B,CAAC;wBAA6B,CAAC;yBAA8B,CAAC;4BAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;0BAA5H,CAAC;6BAA2B,CAAC;wBAA6B,CAAC;yBAA8B,CAAC;4BAAiC,CAAC;;;;;;;;;;;;;;CADlxJ,CAAA"}
@@ -1,39 +0,0 @@
1
- import * as monaco from 'monaco-editor';
2
- import 'monaco-editor/esm/vs/language/json/monaco.contribution';
3
- import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution';
4
- import 'monaco-editor/esm/vs/editor/contrib/folding/browser/folding';
5
- import 'monaco-editor/esm/vs/editor/contrib/folding/browser/folding.css';
6
- import 'monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css';
7
- import { type MaybeRefOrGetter } from 'vue';
8
- import type { JsonPath } from '../../../../../../v2/features/collection/components/Editor/helpers/json-ast.js';
9
- type MonacoEditorAction = {
10
- id: string;
11
- label: string;
12
- keybindings?: number[];
13
- run: () => void | Promise<void>;
14
- };
15
- export type MonacoEditorLanguage = 'json' | 'yaml';
16
- export declare const useEditor: ({ element, value, onChange, actions, readOnly, isDarkMode, theme, language, }: {
17
- element: HTMLElement;
18
- value?: MaybeRefOrGetter<string>;
19
- readOnly?: MaybeRefOrGetter<boolean>;
20
- onChange?: (e: string) => void;
21
- actions?: MonacoEditorAction[];
22
- isDarkMode?: MaybeRefOrGetter<boolean>;
23
- theme?: MaybeRefOrGetter<string>;
24
- language?: MonacoEditorLanguage;
25
- }) => {
26
- editor: monaco.editor.IStandaloneCodeEditor;
27
- model: monaco.editor.ITextModel;
28
- highlightPath: (path: JsonPath) => Promise<void>;
29
- focusPath: (path: JsonPath) => Promise<void>;
30
- formatDocument: () => Promise<void>;
31
- getValue: () => string;
32
- setValue: (nextValue: string, isProgrammaticUpdate?: boolean) => void;
33
- hasTextFocus: () => boolean;
34
- setLanguage: (nextLanguage: MonacoEditorLanguage) => void;
35
- setCursorToMarker: (marker: monaco.editor.IMarker) => void;
36
- dispose: () => void;
37
- };
38
- export {};
39
- //# sourceMappingURL=use-editor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-editor.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/hooks/use-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,wDAAwD,CAAA;AAC/D,OAAO,6DAA6D,CAAA;AACpE,OAAO,6DAA6D,CAAA;AACpE,OAAO,iEAAiE,CAAA;AACxE,OAAO,mEAAmE,CAAA;AAG1E,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,KAAK,CAAA;AAO3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6DAA6D,CAAA;AAI3F,KAAK,kBAAkB,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,GAAG,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAA;AAMlD,eAAO,MAAM,SAAS,GAAI,+EASvB;IACD,OAAO,EAAE,WAAW,CAAA;IACpB,KAAK,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACpC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAC9B,UAAU,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACtC,KAAK,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;;;0BA2FoC,QAAQ;sBASZ,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC;0BAoFtB,OAAO,CAAC,IAAI,CAAC;oBAIzB,MAAM;0BAEE,MAAM,qCAAiC,IAAI;wBAQ/C,OAAO;gCAEG,oBAAoB,KAAG,IAAI;gCAI3B,MAAM,CAAC,MAAM,CAAC,OAAO,KAAG,IAAI;mBAO3C,IAAI;CAmBzB,CAAA"}
@@ -1,153 +0,0 @@
1
- import * as r from "monaco-editor";
2
- import "monaco-editor/esm/vs/editor/contrib/folding/browser/folding.css";
3
- import "monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css";
4
- import { presets as E } from "@scalar/themes";
5
- import { toValue as a, watch as c } from "vue";
6
- import { applyScalarTheme as J } from "../helpers/apply-scalar-theme.js";
7
- import { configureLanguageSupport as R } from "../helpers/configure-language-support.js";
8
- import { ensureMonacoEnvironment as k } from "../helpers/ensure-monaco-environment.js";
9
- import { getJsonAstNodeFromPath as D } from "../helpers/get-json-ast-node-from-path.js";
10
- import { getYamlNodeRangeFromPath as j } from "../helpers/get-yaml-node-range-from-path.js";
11
- import { ensureJsonPointerLinkSupport as z } from "../helpers/json-pointer-links.js";
12
- import { parseJsonPointerPath as B } from "../helpers/json-pointer-path.js";
13
- const ot = ({
14
- element: w,
15
- value: f,
16
- onChange: b,
17
- actions: O,
18
- readOnly: m = !1,
19
- isDarkMode: x = !1,
20
- theme: S = E.default.theme,
21
- language: C = "json"
22
- }) => {
23
- k();
24
- const n = r.editor.createModel(a(f) ?? "", C);
25
- R(n.uri.toString());
26
- const o = r.editor.create(w, {
27
- model: n,
28
- automaticLayout: !0,
29
- folding: !0,
30
- showFoldingControls: "always",
31
- glyphMargin: !0,
32
- lineNumbers: "on",
33
- minimap: { enabled: !1 },
34
- overviewRulerLanes: 0,
35
- readOnly: a(m),
36
- scrollbar: {
37
- useShadows: !1,
38
- verticalScrollbarSize: 5
39
- },
40
- scrollBeyondLastLine: !1,
41
- guides: {
42
- indentation: !0
43
- },
44
- formatOnPaste: !0,
45
- renderValidationDecorations: "on",
46
- formatOnType: !0,
47
- lineHeight: 20,
48
- renderLineHighlight: "none",
49
- fontFamily: "'JetBrains Mono', monospace"
50
- });
51
- o.updateOptions({ insertSpaces: !0, tabSize: 2 });
52
- let d = [], u = 0;
53
- O?.forEach((t) => {
54
- o.addAction({
55
- id: t.id,
56
- label: t.label,
57
- keybindings: t.keybindings,
58
- run: async () => {
59
- await t.run();
60
- }
61
- });
62
- });
63
- const g = (t, e) => {
64
- const s = n.getPositionAt(t), i = Math.max(t, e - 1), F = n.getPositionAt(i), P = Math.max(1, s.lineNumber), M = Math.max(P, F.lineNumber);
65
- return new r.Range(P, 1, M, n.getLineMaxColumn(M));
66
- }, p = async (t) => {
67
- if (n.getLanguageId() === "yaml")
68
- return j(n.getValue(), t);
69
- const e = await D(n, t);
70
- return e ? { startOffset: e.offset, endOffset: e.offset + e.length } : null;
71
- }, l = async (t) => {
72
- await o.getAction(t)?.run();
73
- }, h = ({ startOffset: t, endOffset: e }) => {
74
- const s = g(t, e);
75
- d = o.deltaDecorations(d, [
76
- {
77
- range: s,
78
- options: {
79
- isWholeLine: !0,
80
- className: "json-focus-highlight"
81
- }
82
- }
83
- ]);
84
- }, T = async (t) => {
85
- const e = await p(t);
86
- e && h(e);
87
- }, y = async (t) => {
88
- const e = await p(t);
89
- if (!e)
90
- return;
91
- const s = g(e.startOffset, e.endOffset);
92
- await l("editor.foldAll"), o.setSelection(s), await l("editor.unfoldRecursively");
93
- const i = n.getPositionAt(e.startOffset);
94
- o.setPosition(i), o.revealPositionNearTop(i), h(e);
95
- }, N = async (t) => {
96
- const e = B(t);
97
- e && await y(e);
98
- }, { dispose: v } = z(N);
99
- o.onDidChangeModelContent(() => {
100
- if (u > 0) {
101
- u -= 1;
102
- return;
103
- }
104
- const t = o.getValue();
105
- typeof t == "string" && b?.(t ?? "");
106
- }), c(
107
- () => a(f),
108
- (t) => {
109
- t && o.getValue() !== t && L(t, !0);
110
- }
111
- ), c(
112
- [() => a(S), () => a(x)],
113
- async ([t, e]) => {
114
- await J(t, e);
115
- },
116
- {
117
- immediate: !0
118
- }
119
- ), c(
120
- () => a(m),
121
- (t) => {
122
- o?.updateOptions({ readOnly: t });
123
- }
124
- );
125
- const A = async () => {
126
- await l("editor.action.formatDocument");
127
- }, V = () => o.getValue(), L = (t, e = !1) => {
128
- e && (u += 1), o.setValue(t);
129
- };
130
- return {
131
- editor: o,
132
- model: n,
133
- highlightPath: T,
134
- focusPath: y,
135
- formatDocument: A,
136
- getValue: V,
137
- setValue: L,
138
- hasTextFocus: () => o.hasTextFocus(),
139
- setLanguage: (t) => {
140
- r.editor.setModelLanguage(n, t);
141
- },
142
- setCursorToMarker: (t) => {
143
- const e = Math.min(Math.max(t.startLineNumber || 1, 1), n.getLineCount()), s = Math.min(Math.max(t.startColumn || 1, 1), n.getLineMaxColumn(e));
144
- o.setPosition({ lineNumber: e, column: s });
145
- },
146
- dispose: () => {
147
- o.dispose(), n.dispose(), v();
148
- }
149
- };
150
- };
151
- export {
152
- ot as useEditor
153
- };