@scalar/use-codemirror 0.11.53 → 0.11.54

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @scalar/use-codemirror
2
2
 
3
+ ## 0.11.54
4
+
5
+ ### Patch Changes
6
+
7
+ - ec44fe1: refactor: make useCodeMirror testable
8
+ - ec44fe1: chore: remove CodeMirror component
9
+ - Updated dependencies [46ebb44]
10
+ - @scalar/components@0.13.10
11
+
3
12
  ## 0.11.53
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Scalar useCodeMirror()
1
+ # CodeMirror Hook for Vue
2
2
 
3
3
  [![Version](https://img.shields.io/npm/v/%40scalar/use-codemirror)](https://www.npmjs.com/package/@scalar/use-codemirror)
4
4
  [![Downloads](https://img.shields.io/npm/dm/%40scalar/use-codemirror)](https://www.npmjs.com/package/@scalar/use-codemirror)
@@ -15,12 +15,31 @@ npm install @scalar/use-codemirror
15
15
 
16
16
  ```vue
17
17
  <script setup>
18
- import { CodeMirror } from '@scalar/use-codemirror'
18
+ import { useCodeMirror } from '@scalar/use-codemirror'
19
+ import { ref } from 'vue'
20
+
21
+ const editor = ref(null)
22
+
23
+ const { codeMirror, setCodeMirrorContent } = useCodeMirror({
24
+ codeMirrorRef: editor,
25
+ content: '{ "foo": "bar" }',
26
+ language: 'json',
27
+ lineNumbers: true,
28
+ onChange: (value) => {
29
+ console.log('Content changed:', value)
30
+ },
31
+ })
19
32
  </script>
20
33
 
21
- <CodeMirror
22
- class="my-custom-class"
23
- content="const foobar = true"
24
- readOnly
25
- @change="(value) => …" />
34
+ <template>
35
+ <div ref="editor" />
36
+ </template>
26
37
  ```
38
+
39
+ ## Community
40
+
41
+ We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/scalar>
42
+
43
+ ## License
44
+
45
+ The source code in this repository is licensed under [MIT](https://github.com/scalar/scalar/blob/main/LICENSE).
@@ -1,2 +1,3 @@
1
1
  export * from './useCodeMirror.js';
2
+ export * from './useDropdown.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { useCodeMirror } from './useCodeMirror.js';
2
+ export { useDropdown } from './useDropdown.js';
@@ -1,272 +1,319 @@
1
- import { autocompletion as B, completionKeymap as D, closeBrackets as z, closeBracketsKeymap as A } from "@codemirror/autocomplete";
2
- import { indentWithTab as K, insertNewline as V } from "@codemirror/commands";
3
- import { css as G } from "@codemirror/lang-css";
4
- import { html as P } from "@codemirror/lang-html";
5
- import { json as q } from "@codemirror/lang-json";
6
- import { xml as F } from "@codemirror/lang-xml";
7
- import { yaml as J } from "@codemirror/lang-yaml";
8
- import { syntaxHighlighting as U, defaultHighlightStyle as W, indentOnInput as Q, bracketMatching as x, foldGutter as E } from "@codemirror/language";
9
- import { linter as X } from "@codemirror/lint";
10
- import { StateEffect as Y } from "@codemirror/state";
11
- import { EditorView as h, highlightSpecialChars as Z, keymap as u, placeholder as _, lineNumbers as $ } from "@codemirror/view";
12
- import { ScalarIcon as C } from "@scalar/components";
13
- import { ref as ee, watch as p, onBeforeUnmount as te, toValue as t, computed as oe, h as M, render as S } from "vue";
14
- import { customTheme as re } from "../themes/index.js";
15
- import { variables as ne } from "./variables.js";
16
- const a = (e) => "provider" in e && !!t(e.provider), ie = {
17
- key: "Mod-a",
18
- run: (e) => (e.dispatch({
19
- selection: { anchor: 0, head: e.state.doc.length },
20
- scrollIntoView: !1
21
- }), !0)
22
- }, xe = (e) => {
23
- const n = ee(null);
24
- p(
25
- e.codeMirrorRef,
26
- () => {
27
- var o;
28
- (o = n.value) == null || o.destroy(), c();
29
- },
30
- { immediate: !0 }
31
- ), te(() => {
32
- var o;
33
- return (o = n.value) == null ? void 0 : o.destroy();
34
- });
35
- function c() {
36
- if (e.codeMirrorRef.value) {
37
- const o = a(e) ? t(e.provider) : null, m = T({
38
- ...f.value,
39
- provider: o
40
- });
41
- n.value = new h({
42
- parent: e.codeMirrorRef.value,
43
- extensions: m
44
- }), a(e) || l(t(e.content));
45
- }
46
- }
47
- const f = oe(() => ({
48
- onChange: e.onChange,
49
- onBlur: e.onBlur,
50
- onFocus: e.onFocus,
51
- disableTabIndent: t(e.disableTabIndent),
52
- language: t(e.language),
53
- classes: t(e.classes),
54
- readOnly: t(e.readOnly),
55
- lineNumbers: t(e.lineNumbers),
56
- withVariables: t(e.withVariables),
57
- forceFoldGutter: t(e.forceFoldGutter),
58
- disableEnter: t(e.disableEnter),
59
- disableCloseBrackets: t(e.disableCloseBrackets),
60
- withoutTheme: t(e.withoutTheme),
61
- lint: t(e.lint),
62
- additionalExtensions: t(e.extensions),
63
- placeholder: t(e.placeholder)
64
- }));
65
- p(
66
- () => a(e) ? t(e.provider) : null,
67
- () => {
68
- var o;
69
- a(e) && ((o = n.value) == null || o.destroy(), c());
70
- }
71
- ), p(
72
- f,
73
- () => {
74
- if (n.value) {
75
- const o = a(e) ? t(e.provider) : null, m = T({
76
- ...f.value,
77
- provider: o
78
- });
79
- requestAnimationFrame(() => {
80
- var g;
81
- (g = n.value) == null || g.dispatch({
82
- effects: Y.reconfigure.of(m)
83
- });
1
+ import { autocompletion, completionKeymap, closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete';
2
+ import { indentWithTab, insertNewline } from '@codemirror/commands';
3
+ import { css } from '@codemirror/lang-css';
4
+ import { html } from '@codemirror/lang-html';
5
+ import { json } from '@codemirror/lang-json';
6
+ import { xml } from '@codemirror/lang-xml';
7
+ import { yaml } from '@codemirror/lang-yaml';
8
+ import { syntaxHighlighting, defaultHighlightStyle, indentOnInput, bracketMatching, foldGutter } from '@codemirror/language';
9
+ import { linter } from '@codemirror/lint';
10
+ import { StateEffect } from '@codemirror/state';
11
+ import { EditorView, highlightSpecialChars, keymap, placeholder, lineNumbers } from '@codemirror/view';
12
+ import { ScalarIcon } from '@scalar/components';
13
+ import { ref, computed, toValue, watch, onBeforeUnmount, h, render } from 'vue';
14
+ import { customTheme } from '../themes/index.js';
15
+ import { variables } from './variables.js';
16
+
17
+ /** Check if the hook has a provider. In provider mode we ignore the content variable */
18
+ const hasProvider = (params) => 'provider' in params && !!toValue(params.provider);
19
+ const selectAllKeyBinding = {
20
+ key: 'Mod-a',
21
+ run: (view) => {
22
+ // Select the entire content
23
+ view.dispatch({
24
+ selection: { anchor: 0, head: view.state.doc.length },
25
+ scrollIntoView: false,
84
26
  });
85
- } else
86
- return;
27
+ return true;
87
28
  },
88
- { immediate: !0 }
89
- );
90
- const l = (o = "") => {
91
- n.value && n.value.state.doc.toString() !== o && n.value.dispatch({
92
- changes: {
93
- from: 0,
94
- to: n.value.state.doc.length,
95
- insert: o
96
- },
97
- selection: {
98
- anchor: Math.min(
99
- n.value.state.selection.main.anchor,
100
- o.length
101
- )
102
- }
103
- });
104
- };
105
- return p(
106
- () => t(e.content),
107
- () => {
108
- a(e) || l(t(e.content));
109
- },
110
- { immediate: !0 }
111
- ), {
112
- /** Replaces the current content with the given value. */
113
- setCodeMirrorContent: l,
114
- /** Codemirror instance */
115
- codeMirror: n
116
- };
117
- }, w = {
118
- html: P,
119
- json: q,
120
- yaml: J,
121
- css: G,
122
- xml: F
123
29
  };
124
- function T({
125
- onChange: e,
126
- onBlur: n,
127
- onFocus: c,
128
- provider: f,
129
- language: l,
130
- classes: o = [],
131
- readOnly: m = !1,
132
- lineNumbers: g = !1,
133
- withVariables: N = !1,
134
- forceFoldGutter: v = !1,
135
- disableEnter: O = !1,
136
- disableCloseBrackets: H = !1,
137
- disableTabIndent: I = !1,
138
- withoutTheme: L = !1,
139
- lint: R = !1,
140
- additionalExtensions: j = [],
141
- placeholder: b
142
- }) {
143
- const r = [
144
- Z(),
145
- U(W, { fallback: !0 }),
146
- h.theme({
147
- ".cm-line": {
148
- lineHeight: "20px",
149
- padding: "0 2px 0 4px"
150
- },
151
- ".cm-gutterElement": {
152
- lineHeight: "20px"
153
- },
154
- ".cm-tooltip": {
155
- border: "1px solid #f5c6cb",
156
- fontSize: "12px"
157
- },
158
- ".cm-tooltip-lint": {
159
- backgroundColor: "#ffffff"
160
- },
161
- ".cm-diagnostic-error": {
162
- borderLeft: "0",
163
- color: "#dc1b19"
164
- },
165
- ".cm-foldPlaceholder": {
166
- background: "var(--scalar-background-1)",
167
- border: "none",
168
- fontFamily: "var(--scalar-font)"
169
- }
170
- }),
171
- // Listen to updates
172
- h.updateListener.of((s) => {
173
- s.docChanged && (e == null || e(s.state.doc.toString()));
174
- }),
175
- h.domEventHandlers({
176
- blur: (s, i) => {
177
- n == null || n(i.state.doc.toString());
178
- },
179
- focus: (s, i) => {
180
- c == null || c(i.state.doc.toString());
181
- }
182
- }),
183
- // Add Classes
184
- h.editorAttributes.of({ class: o.join(" ") }),
185
- ...j
186
- ];
187
- if (f && r.push(f), L || r.push(re), m ? r.push(h.editable.of(!1)) : (r.push(
188
- Q(),
189
- x(),
190
- B(),
191
- u.of([...D, ie]),
192
- x()
193
- ), H || r.push(z(), u.of([...A])), I ? r.push(
194
- u.of([
195
- {
196
- key: "Tab",
197
- run: () => !1,
198
- // Prevent default Tab behavior
199
- shift: () => !1
200
- // Prevent default Shift+Tab behavior
201
- }
202
- ])
203
- ) : r.push(u.of([K]))), b && r.push(_(b)), g && r.push($()), v && r.push(
204
- E({
205
- markerDOM: (s) => {
206
- const i = document.createElement("div");
207
- i.classList.add("cm-foldMarker");
208
- const d = M(C, {
209
- icon: s ? "ChevronDown" : "ChevronRight",
210
- size: "xs"
211
- });
212
- return S(d, i), i;
213
- }
214
- })
215
- ), l && w[l] && (r.push(w[l]()), v || r.push(
216
- E({
217
- markerDOM: (s) => {
218
- const i = document.createElement("div");
219
- i.classList.add("cm-foldMarker");
220
- const d = M(C, {
221
- icon: s ? "ChevronDown" : "ChevronRight",
222
- size: "xs"
30
+ /** Reactive CodeMirror Integration */
31
+ const useCodeMirror = (params) => {
32
+ const codeMirror = ref(null);
33
+ /** Set the codemirror content value */
34
+ const setCodeMirrorContent = (newValue = '') => {
35
+ if (!codeMirror.value)
36
+ return;
37
+ // No need to set the CodeMirror content if nothing has changed
38
+ if (codeMirror.value.state.doc.toString() === newValue)
39
+ return;
40
+ codeMirror.value.dispatch({
41
+ changes: {
42
+ from: 0,
43
+ to: codeMirror.value.state.doc.length,
44
+ insert: newValue,
45
+ },
46
+ selection: {
47
+ anchor: Math.min(codeMirror.value.state.selection.main.anchor, newValue.length),
48
+ },
223
49
  });
224
- return S(d, i), i;
225
- }
226
- })
227
- )), R && l === "json") {
228
- const s = X((i) => {
229
- const d = [], y = i.state.doc.toString();
230
- if (y.trim())
231
- try {
232
- JSON.parse(y);
233
- } catch (k) {
234
- k instanceof Error && d.push({
235
- from: 0,
236
- to: i.state.doc.length,
237
- severity: "error",
238
- message: k.message
239
- });
50
+ };
51
+ // All options except provider
52
+ const extensionConfig = computed(() => ({
53
+ onChange: params.onChange,
54
+ onBlur: params.onBlur,
55
+ onFocus: params.onFocus,
56
+ disableTabIndent: toValue(params.disableTabIndent),
57
+ language: toValue(params.language),
58
+ classes: toValue(params.classes),
59
+ readOnly: toValue(params.readOnly),
60
+ lineNumbers: toValue(params.lineNumbers),
61
+ withVariables: toValue(params.withVariables),
62
+ forceFoldGutter: toValue(params.forceFoldGutter),
63
+ disableEnter: toValue(params.disableEnter),
64
+ disableCloseBrackets: toValue(params.disableCloseBrackets),
65
+ withoutTheme: toValue(params.withoutTheme),
66
+ lint: toValue(params.lint),
67
+ additionalExtensions: toValue(params.extensions),
68
+ placeholder: toValue(params.placeholder),
69
+ }));
70
+ // Unmounts CodeMirror if it’s mounted already, and mounts CodeMirror, if the given ref exists.
71
+ watch(params.codeMirrorRef, () => {
72
+ codeMirror.value?.destroy();
73
+ mountCodeMirror();
74
+ }, { immediate: true });
75
+ // Cleanup codemirror
76
+ onBeforeUnmount(() => codeMirror.value?.destroy());
77
+ // Initializes CodeMirror.
78
+ function mountCodeMirror() {
79
+ if (params.codeMirrorRef.value) {
80
+ const provider = hasProvider(params) ? toValue(params.provider) : null;
81
+ const extensions = getCodeMirrorExtensions({
82
+ ...extensionConfig.value,
83
+ provider,
84
+ });
85
+ codeMirror.value = new EditorView({
86
+ parent: params.codeMirrorRef.value,
87
+ extensions,
88
+ });
89
+ // Set the initial content if a provider is not in use
90
+ if (!hasProvider(params))
91
+ setCodeMirrorContent(toValue(params.content));
92
+ }
93
+ }
94
+ // ---------------------------------------------------------------------------
95
+ // Provider must be watched separately because we need to restart codemirror if the provider changes
96
+ watch(() => (hasProvider(params) ? toValue(params.provider) : null), () => {
97
+ if (hasProvider(params)) {
98
+ codeMirror.value?.destroy();
99
+ mountCodeMirror();
240
100
  }
241
- return d;
242
101
  });
243
- r.push(s);
244
- }
245
- return N && r.push(ne()), O ? r.push(
246
- u.of([
247
- {
248
- key: "Enter",
249
- run: () => !0
250
- },
251
- {
252
- key: "Ctrl-Enter",
253
- mac: "Cmd-Enter",
254
- run: () => !0
255
- },
256
- {
257
- key: "Shift-Enter",
258
- run: () => !0
259
- }
260
- ])
261
- ) : r.push(
262
- u.of([
263
- {
264
- key: "Enter",
265
- run: V
266
- }
267
- ])
268
- ), r;
269
- }
270
- export {
271
- xe as useCodeMirror
102
+ // Update the extensions whenever parameters changes
103
+ watch(extensionConfig, () => {
104
+ if (!codeMirror.value)
105
+ return;
106
+ // If a provider is
107
+ else {
108
+ const provider = hasProvider(params) ? toValue(params.provider) : null;
109
+ const extensions = getCodeMirrorExtensions({
110
+ ...extensionConfig.value,
111
+ provider,
112
+ });
113
+ requestAnimationFrame(() => {
114
+ codeMirror.value?.dispatch({
115
+ effects: StateEffect.reconfigure.of(extensions),
116
+ });
117
+ });
118
+ }
119
+ }, { immediate: true });
120
+ // ---------------------------------------------------------------------------
121
+ // Keep the content in sync when the content is managed externally
122
+ watch(() => toValue(params.content), () => {
123
+ // When a provider is in use we do not map the content value back to the codemirror instance
124
+ if (hasProvider(params))
125
+ return;
126
+ setCodeMirrorContent(toValue(params.content));
127
+ }, { immediate: true });
128
+ return {
129
+ /** Replaces the current content with the given value. */
130
+ setCodeMirrorContent,
131
+ /** Codemirror instance */
132
+ codeMirror,
133
+ };
134
+ };
135
+ // ---------------------------------------------------------------------------
136
+ const languageExtensions = {
137
+ html: html,
138
+ json: json,
139
+ yaml: yaml,
140
+ css: css,
141
+ xml: xml,
272
142
  };
143
+ /** Generate the list of extension from parameters */
144
+ function getCodeMirrorExtensions({ onChange, onBlur, onFocus, provider, language, classes = [], readOnly = false, lineNumbers: lineNumbers$1 = false, withVariables = false, forceFoldGutter = false, disableEnter = false, disableCloseBrackets = false, disableTabIndent = false, withoutTheme = false, lint = false, additionalExtensions = [], placeholder: placeholder$1, }) {
145
+ const extensions = [
146
+ highlightSpecialChars(),
147
+ syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
148
+ EditorView.theme({
149
+ '.cm-line': {
150
+ lineHeight: '20px',
151
+ padding: '0 2px 0 4px',
152
+ },
153
+ '.cm-gutterElement': {
154
+ lineHeight: '20px',
155
+ },
156
+ '.cm-tooltip': {
157
+ border: '1px solid #f5c6cb',
158
+ fontSize: '12px',
159
+ },
160
+ '.cm-tooltip-lint': {
161
+ backgroundColor: '#ffffff',
162
+ },
163
+ '.cm-diagnostic-error': {
164
+ borderLeft: '0',
165
+ color: '#dc1b19',
166
+ },
167
+ '.cm-foldPlaceholder': {
168
+ background: 'var(--scalar-background-1)',
169
+ border: 'none',
170
+ fontFamily: 'var(--scalar-font)',
171
+ },
172
+ }),
173
+ // Listen to updates
174
+ EditorView.updateListener.of((v) => {
175
+ if (!v.docChanged)
176
+ return;
177
+ onChange?.(v.state.doc.toString());
178
+ }),
179
+ EditorView.domEventHandlers({
180
+ blur: (event, view) => {
181
+ onBlur?.(view.state.doc.toString());
182
+ },
183
+ focus: (event, view) => {
184
+ onFocus?.(view.state.doc.toString());
185
+ },
186
+ }),
187
+ // Add Classes
188
+ EditorView.editorAttributes.of({ class: classes.join(' ') }),
189
+ ...additionalExtensions,
190
+ ];
191
+ // Enable the provider
192
+ if (provider)
193
+ extensions.push(provider);
194
+ // Add the theme as needed
195
+ if (!withoutTheme)
196
+ extensions.push(customTheme);
197
+ // Read only
198
+ if (readOnly) {
199
+ extensions.push(EditorView.editable.of(false));
200
+ }
201
+ else {
202
+ extensions.push(indentOnInput(), bracketMatching(), autocompletion(), keymap.of([...completionKeymap, selectAllKeyBinding]), bracketMatching());
203
+ if (!disableCloseBrackets)
204
+ extensions.push(closeBrackets(), keymap.of([...closeBracketsKeymap]));
205
+ if (disableTabIndent) {
206
+ extensions.push(keymap.of([
207
+ {
208
+ key: 'Tab',
209
+ run: () => false, // Prevent default Tab behavior
210
+ shift: () => false, // Prevent default Shift+Tab behavior
211
+ },
212
+ ]));
213
+ }
214
+ else {
215
+ extensions.push(keymap.of([indentWithTab]));
216
+ }
217
+ }
218
+ // Add placeholder extension if placeholder is provided
219
+ if (placeholder$1) {
220
+ extensions.push(placeholder(placeholder$1));
221
+ }
222
+ // Line numbers
223
+ if (lineNumbers$1) {
224
+ extensions.push(lineNumbers());
225
+ }
226
+ if (forceFoldGutter) {
227
+ extensions.push(foldGutter({
228
+ markerDOM: (open) => {
229
+ const icon = document.createElement('div');
230
+ icon.classList.add('cm-foldMarker');
231
+ const vnode = h(ScalarIcon, {
232
+ icon: open ? 'ChevronDown' : 'ChevronRight',
233
+ size: 'xs',
234
+ });
235
+ render(vnode, icon);
236
+ return icon;
237
+ },
238
+ }));
239
+ }
240
+ // Syntax highlighting
241
+ if (language && languageExtensions[language]) {
242
+ extensions.push(languageExtensions[language]());
243
+ if (!forceFoldGutter) {
244
+ extensions.push(foldGutter({
245
+ markerDOM: (open) => {
246
+ const icon = document.createElement('div');
247
+ icon.classList.add('cm-foldMarker');
248
+ const vnode = h(ScalarIcon, {
249
+ icon: open ? 'ChevronDown' : 'ChevronRight',
250
+ size: 'xs',
251
+ });
252
+ render(vnode, icon);
253
+ return icon;
254
+ },
255
+ }));
256
+ }
257
+ }
258
+ // JSON Linter
259
+ if (lint && language === 'json') {
260
+ const jsonLinter = linter((view) => {
261
+ const diagnostics = [];
262
+ const content = view.state.doc.toString();
263
+ if (content.trim()) {
264
+ try {
265
+ JSON.parse(content);
266
+ }
267
+ catch (e) {
268
+ if (e instanceof Error) {
269
+ diagnostics.push({
270
+ from: 0,
271
+ to: view.state.doc.length,
272
+ severity: 'error',
273
+ message: e.message,
274
+ });
275
+ }
276
+ }
277
+ }
278
+ return diagnostics;
279
+ });
280
+ extensions.push(jsonLinter);
281
+ }
282
+ // Highlight variables
283
+ if (withVariables)
284
+ extensions.push(variables());
285
+ if (disableEnter) {
286
+ extensions.push(keymap.of([
287
+ {
288
+ key: 'Enter',
289
+ run: () => {
290
+ return true;
291
+ },
292
+ },
293
+ {
294
+ key: 'Ctrl-Enter',
295
+ mac: 'Cmd-Enter',
296
+ run: () => {
297
+ return true;
298
+ },
299
+ },
300
+ {
301
+ key: 'Shift-Enter',
302
+ run: () => {
303
+ return true;
304
+ },
305
+ },
306
+ ]));
307
+ }
308
+ else {
309
+ extensions.push(keymap.of([
310
+ {
311
+ key: 'Enter',
312
+ run: insertNewline,
313
+ },
314
+ ]));
315
+ }
316
+ return extensions;
317
+ }
318
+
319
+ export { useCodeMirror };
@@ -1,45 +1,65 @@
1
- import { watch as v } from "vue";
2
- function x(m) {
3
- const { codeMirror: e, query: n, showDropdown: r, dropdownPosition: u } = m;
4
- function c() {
5
- var t;
6
- return ((t = e.value) == null ? void 0 : t.state.selection.main.head) || 0;
7
- }
8
- function i(t) {
9
- var o;
10
- return (o = e.value) == null ? void 0 : o.coordsAtPos(t);
11
- }
12
- function d() {
13
- const t = c();
14
- requestAnimationFrame(() => {
15
- const o = i(t - n.value.length - 2);
16
- o && (u.value = {
17
- left: o.left,
18
- top: Math.max(o.bottom)
19
- });
20
- });
21
- }
22
- v(n, d);
23
- function h(t) {
24
- var p;
25
- const o = `{{${t}}}`, s = c(), l = Math.max(0, s - n.value.length - 2), a = s;
26
- (p = e.value) == null || p.dispatch({
27
- changes: { from: l, to: a, insert: o }
28
- }), r.value = !1;
29
- }
30
- function f() {
31
- var a;
32
- const t = c(), o = ((a = e.value) == null ? void 0 : a.state.doc.sliceString(0, t)) || "", s = o.lastIndexOf("{{"), l = o.lastIndexOf("}}");
33
- s > l ? (n.value = o.slice(s + 2), r.value = !0, u.value = i(t) || { left: 0, top: 0 }, n.value === "" && d()) : r.value = !1;
34
- }
35
- return v(() => {
36
- var t;
37
- return (t = e.value) == null ? void 0 : t.state.doc.toString();
38
- }, f), {
39
- handleDropdownSelect: h,
40
- updateDropdownVisibility: f
41
- };
1
+ import { watch } from 'vue';
2
+
3
+ /** Custom hook to manage a dropdown in a CodeMirror editor */
4
+ function useDropdown(params) {
5
+ const { codeMirror, query, showDropdown, dropdownPosition } = params;
6
+ function getCursorPos() {
7
+ return codeMirror.value?.state.selection.main.head || 0;
8
+ }
9
+ function getCoordsAtPos(pos) {
10
+ return codeMirror.value?.coordsAtPos(pos);
11
+ }
12
+ /** Updates position of the dropdown based on the current cursor position */
13
+ function updateDropdownPosition() {
14
+ const cursorPos = getCursorPos();
15
+ requestAnimationFrame(() => {
16
+ const coords = getCoordsAtPos(cursorPos - query.value.length - 2);
17
+ if (coords) {
18
+ dropdownPosition.value = {
19
+ left: coords.left,
20
+ top: Math.max(coords.bottom),
21
+ };
22
+ }
23
+ });
24
+ }
25
+ // Watch for changes in the query and update the dropdown position
26
+ watch(query, updateDropdownPosition);
27
+ /** Inserts selected item at the current cursor position */
28
+ function handleDropdownSelect(item) {
29
+ const formattedItem = `{{${item}}}`;
30
+ const cursor = getCursorPos();
31
+ const from = Math.max(0, cursor - query.value.length - 2);
32
+ const to = cursor;
33
+ codeMirror.value?.dispatch({
34
+ changes: { from, to, insert: formattedItem },
35
+ });
36
+ showDropdown.value = false;
37
+ }
38
+ /** Updates dropdown visibility based on current cursor position */
39
+ function updateDropdownVisibility() {
40
+ const cursor = getCursorPos();
41
+ const text = codeMirror.value?.state.doc.sliceString(0, cursor) || '';
42
+ const lastOpenBraceIndex = text.lastIndexOf('{{');
43
+ const lastCloseBraceIndex = text.lastIndexOf('}}');
44
+ if (lastOpenBraceIndex > lastCloseBraceIndex) {
45
+ query.value = text.slice(lastOpenBraceIndex + 2);
46
+ showDropdown.value = true;
47
+ dropdownPosition.value = getCoordsAtPos(cursor) || { left: 0, top: 0 };
48
+ // Ensures dropdown position even if the query is empty
49
+ if (query.value === '') {
50
+ updateDropdownPosition();
51
+ }
52
+ }
53
+ else {
54
+ showDropdown.value = false;
55
+ }
56
+ }
57
+ // Watch for changes in the content and update the dropdown visibility
58
+ watch(() => codeMirror.value?.state.doc.toString(), updateDropdownVisibility);
59
+ return {
60
+ handleDropdownSelect,
61
+ updateDropdownVisibility,
62
+ };
42
63
  }
43
- export {
44
- x as useDropdown
45
- };
64
+
65
+ export { useDropdown };
@@ -1,37 +1,24 @@
1
- var s = Object.defineProperty;
2
- var c = (a, e, i) => e in a ? s(a, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[e] = i;
3
- var r = (a, e, i) => c(a, typeof e != "symbol" ? e + "" : e, i);
4
- import { MatchDecorator as l, Decoration as t, ViewPlugin as n, EditorView as b } from "@codemirror/view";
5
- const o = new l({
6
- regexp: /(\{[^}]+\})/g,
7
- decoration: () => t.mark({
8
- attributes: {
9
- class: "api-client-url-variable"
1
+ import { MatchDecorator, Decoration, ViewPlugin, EditorView } from '@codemirror/view';
2
+
3
+ const variableHighlighterDecoration = new MatchDecorator({
4
+ regexp: /(\{[^}]+\})/g,
5
+ decoration: () => Decoration.mark({
6
+ attributes: {
7
+ class: 'api-client-url-variable',
8
+ },
9
+ }),
10
+ });
11
+ const variables = () => ViewPlugin.fromClass(class {
12
+ variables;
13
+ constructor(view) {
14
+ this.variables = variableHighlighterDecoration.createDeco(view);
10
15
  }
11
- })
12
- }), g = () => n.fromClass(
13
- class {
14
- constructor(a) {
15
- r(this, "variables");
16
- this.variables = o.createDeco(a);
16
+ update(update) {
17
+ this.variables = variableHighlighterDecoration.updateDeco(update, this.variables);
17
18
  }
18
- update(a) {
19
- this.variables = o.updateDeco(
20
- a,
21
- this.variables
22
- );
23
- }
24
- },
25
- {
26
- decorations: (a) => a.variables,
27
- provide: (a) => b.atomicRanges.of(
28
- (e) => {
29
- var i;
30
- return ((i = e.plugin(a)) == null ? void 0 : i.variables) || t.none;
31
- }
32
- )
33
- }
34
- );
35
- export {
36
- g as variables
37
- };
19
+ }, {
20
+ decorations: (instance) => instance.variables,
21
+ provide: (plugin) => EditorView.atomicRanges.of((view) => view.plugin(plugin)?.variables || Decoration.none),
22
+ });
23
+
24
+ export { variables };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,6 @@ export { type Extension, RangeSetBuilder, StateEffect } from '@codemirror/state'
2
2
  export { yCollab } from 'y-codemirror.next';
3
3
  export { colorPicker } from '@replit/codemirror-css-color-picker';
4
4
  export { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate, WidgetType, } from '@codemirror/view';
5
- export { CodeMirror } from './components/CodeMirror';
6
- export { useDropdown } from './hooks/useDropdown.js';
7
- export * from './hooks';
5
+ export * from './hooks/index.js';
8
6
  export * from './types';
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAEjE,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,UAAU,EACV,UAAU,EACV,KAAK,UAAU,EACf,UAAU,GACX,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AAEjE,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,UAAU,EACV,UAAU,EACV,KAAK,UAAU,EACf,UAAU,GACX,MAAM,kBAAkB,CAAA;AAEzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -1,20 +1,6 @@
1
- import { RangeSetBuilder as e, StateEffect as t } from "@codemirror/state";
2
- import { yCollab as i } from "y-codemirror.next";
3
- import { colorPicker as d } from "@replit/codemirror-css-color-picker";
4
- import { Decoration as x, EditorView as a, ViewPlugin as l, WidgetType as u } from "@codemirror/view";
5
- import { useDropdown as n } from "./hooks/useDropdown.js";
6
- import { default as s } from "./components/CodeMirror/CodeMirror.vue.js";
7
- import { useCodeMirror as C } from "./hooks/useCodeMirror.js";
8
- export {
9
- s as CodeMirror,
10
- x as Decoration,
11
- a as EditorView,
12
- e as RangeSetBuilder,
13
- t as StateEffect,
14
- l as ViewPlugin,
15
- u as WidgetType,
16
- d as colorPicker,
17
- C as useCodeMirror,
18
- n as useDropdown,
19
- i as yCollab
20
- };
1
+ export { RangeSetBuilder, StateEffect } from '@codemirror/state';
2
+ export { yCollab } from 'y-codemirror.next';
3
+ export { colorPicker } from '@replit/codemirror-css-color-picker';
4
+ export { Decoration, EditorView, ViewPlugin, WidgetType } from '@codemirror/view';
5
+ export { useCodeMirror } from './hooks/useCodeMirror.js';
6
+ export { useDropdown } from './hooks/useDropdown.js';
@@ -1,91 +1,91 @@
1
- import { tags as a } from "@lezer/highlight";
2
- import { createTheme as r } from "@uiw/codemirror-themes";
3
- const c = r({
4
- theme: "light",
5
- settings: {
6
- background: "var(--scalar-background-2)",
7
- foreground: "var(--scalar-color-1)",
8
- caret: "var(--scalar-color-1)",
9
- // Selection likely needs a hardcoded color due to it not accepting variables
10
- selectionMatch: "#e3dcce",
11
- gutterBackground: "var(--scalar-background-2)",
12
- gutterForeground: "var(--scalar-color-3)",
13
- gutterBorder: "transparent",
14
- lineHighlight: "var(--scalar-background-3)",
15
- fontFamily: "var(--scalar-font-code)"
16
- },
17
- styles: [
18
- {
19
- tag: [a.standard(a.tagName), a.tagName],
20
- color: "var(--scalar-color-purple)"
1
+ import { tags } from '@lezer/highlight';
2
+ import { createTheme } from '@uiw/codemirror-themes';
3
+
4
+ const customTheme = createTheme({
5
+ theme: 'light',
6
+ settings: {
7
+ background: 'var(--scalar-background-2)',
8
+ foreground: 'var(--scalar-color-1)',
9
+ caret: 'var(--scalar-color-1)',
10
+ // Selection likely needs a hardcoded color due to it not accepting variables
11
+ selectionMatch: '#e3dcce',
12
+ gutterBackground: 'var(--scalar-background-2)',
13
+ gutterForeground: 'var(--scalar-color-3)',
14
+ gutterBorder: 'transparent',
15
+ lineHighlight: 'var(--scalar-background-3)',
16
+ fontFamily: 'var(--scalar-font-code)',
21
17
  },
22
- {
23
- tag: [a.comment],
24
- color: "var(--scalar-color-3)"
25
- },
26
- {
27
- tag: [a.className],
28
- color: "var(--scalar-color-orange)"
29
- },
30
- {
31
- tag: [a.variableName, a.propertyName, a.attributeName],
32
- color: "var(--scalar-color-1)"
33
- },
34
- {
35
- tag: [a.operator],
36
- color: "var(--scalar-color-2)"
37
- },
38
- {
39
- tag: [a.keyword, a.typeName, a.typeOperator],
40
- color: "var(--scalar-color-green)"
41
- },
42
- {
43
- tag: [a.string],
44
- color: "var(--scalar-color-blue)"
45
- },
46
- {
47
- tag: [a.bracket, a.regexp, a.meta],
48
- color: "var(--scalar-color-3)"
49
- },
50
- {
51
- tag: [a.number],
52
- color: "var(--scalar-color-orange)"
53
- },
54
- {
55
- tag: [a.name, a.quote],
56
- color: "var(--scalar-color-3)"
57
- },
58
- {
59
- tag: [a.heading],
60
- color: "var(--scalar-color-3)",
61
- fontWeight: "bold"
62
- },
63
- {
64
- tag: [a.emphasis],
65
- color: "var(--scalar-color-3)",
66
- fontStyle: "italic"
67
- },
68
- {
69
- tag: [a.deleted],
70
- color: "var(--scalar-color-3)",
71
- backgroundColor: "transparent"
72
- },
73
- {
74
- tag: [a.atom, a.bool, a.special(a.variableName)],
75
- color: "var(--scalar-color-3)"
76
- },
77
- {
78
- tag: [a.url, a.escape, a.regexp, a.link],
79
- color: "var(--scalar-color-1)"
80
- },
81
- { tag: a.link, textDecoration: "underline" },
82
- { tag: a.strikethrough, textDecoration: "line-through" },
83
- {
84
- tag: a.invalid,
85
- color: "var(--scalar-color-3)"
86
- }
87
- ]
18
+ styles: [
19
+ {
20
+ tag: [tags.standard(tags.tagName), tags.tagName],
21
+ color: 'var(--scalar-color-purple)',
22
+ },
23
+ {
24
+ tag: [tags.comment],
25
+ color: 'var(--scalar-color-3)',
26
+ },
27
+ {
28
+ tag: [tags.className],
29
+ color: 'var(--scalar-color-orange)',
30
+ },
31
+ {
32
+ tag: [tags.variableName, tags.propertyName, tags.attributeName],
33
+ color: 'var(--scalar-color-1)',
34
+ },
35
+ {
36
+ tag: [tags.operator],
37
+ color: 'var(--scalar-color-2)',
38
+ },
39
+ {
40
+ tag: [tags.keyword, tags.typeName, tags.typeOperator],
41
+ color: 'var(--scalar-color-green)',
42
+ },
43
+ {
44
+ tag: [tags.string],
45
+ color: 'var(--scalar-color-blue)',
46
+ },
47
+ {
48
+ tag: [tags.bracket, tags.regexp, tags.meta],
49
+ color: 'var(--scalar-color-3)',
50
+ },
51
+ {
52
+ tag: [tags.number],
53
+ color: 'var(--scalar-color-orange)',
54
+ },
55
+ {
56
+ tag: [tags.name, tags.quote],
57
+ color: 'var(--scalar-color-3)',
58
+ },
59
+ {
60
+ tag: [tags.heading],
61
+ color: 'var(--scalar-color-3)',
62
+ fontWeight: 'bold',
63
+ },
64
+ {
65
+ tag: [tags.emphasis],
66
+ color: 'var(--scalar-color-3)',
67
+ fontStyle: 'italic',
68
+ },
69
+ {
70
+ tag: [tags.deleted],
71
+ color: 'var(--scalar-color-3)',
72
+ backgroundColor: 'transparent',
73
+ },
74
+ {
75
+ tag: [tags.atom, tags.bool, tags.special(tags.variableName)],
76
+ color: 'var(--scalar-color-3)',
77
+ },
78
+ {
79
+ tag: [tags.url, tags.escape, tags.regexp, tags.link],
80
+ color: 'var(--scalar-color-1)',
81
+ },
82
+ { tag: tags.link, textDecoration: 'underline' },
83
+ { tag: tags.strikethrough, textDecoration: 'line-through' },
84
+ {
85
+ tag: tags.invalid,
86
+ color: 'var(--scalar-color-3)',
87
+ },
88
+ ],
88
89
  });
89
- export {
90
- c as customTheme
91
- };
90
+
91
+ export { customTheme };
package/package.json CHANGED
@@ -16,14 +16,28 @@
16
16
  "vue",
17
17
  "vue3"
18
18
  ],
19
- "version": "0.11.53",
19
+ "version": "0.11.54",
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
23
23
  "type": "module",
24
24
  "main": "dist/index.js",
25
25
  "exports": {
26
- "import": "./dist/index.js"
26
+ ".": {
27
+ "import": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./themes": {
32
+ "import": "./dist/themes/index.js",
33
+ "types": "./dist/themes/index.d.ts",
34
+ "default": "./dist/themes/index.js"
35
+ },
36
+ "./hooks": {
37
+ "import": "./dist/hooks/index.js",
38
+ "types": "./dist/hooks/index.d.ts",
39
+ "default": "./dist/hooks/index.js"
40
+ }
27
41
  },
28
42
  "files": [
29
43
  "dist",
@@ -35,25 +49,25 @@
35
49
  "yjs": "^13.6.0"
36
50
  },
37
51
  "dependencies": {
38
- "@codemirror/autocomplete": "^6.12.0",
39
- "@codemirror/commands": "^6.3.3",
40
- "@codemirror/lang-css": "^6.2.1",
52
+ "@codemirror/autocomplete": "^6.18.3",
53
+ "@codemirror/commands": "^6.7.1",
54
+ "@codemirror/lang-css": "^6.3.1",
41
55
  "@codemirror/lang-html": "^6.4.8",
42
56
  "@codemirror/lang-json": "^6.0.0",
43
57
  "@codemirror/lang-xml": "^6.0.0",
44
- "@codemirror/lang-yaml": "^6.0.0",
45
- "@codemirror/language": "^6.10.1",
46
- "@codemirror/lint": "^6.8.1",
47
- "@codemirror/state": "^6.4.0",
48
- "@codemirror/view": "^6.23.1",
49
- "@lezer/common": "^1.2.1",
50
- "@lezer/highlight": "^1.2.0",
51
- "@lezer/lr": "^1.4.0",
52
- "@replit/codemirror-css-color-picker": "^6.1.0",
53
- "@uiw/codemirror-themes": "^4.21.21",
58
+ "@codemirror/lang-yaml": "^6.1.2",
59
+ "@codemirror/language": "^6.10.7",
60
+ "@codemirror/lint": "^6.8.4",
61
+ "@codemirror/state": "^6.5.0",
62
+ "@codemirror/view": "^6.35.3",
63
+ "@lezer/common": "^1.2.3",
64
+ "@lezer/highlight": "^1.2.1",
65
+ "@lezer/lr": "^1.4.2",
66
+ "@replit/codemirror-css-color-picker": "^6.3.0",
67
+ "@uiw/codemirror-themes": "^4.23.7",
54
68
  "codemirror": "^6.0.0",
55
69
  "vue": "^3.5.12",
56
- "@scalar/components": "0.13.9"
70
+ "@scalar/components": "0.13.10"
57
71
  },
58
72
  "devDependencies": {
59
73
  "@vitejs/plugin-vue": "^5.0.4",
@@ -66,13 +80,13 @@
66
80
  "@scalar/build-tooling": "0.1.12"
67
81
  },
68
82
  "scripts": {
69
- "build": "vite build && pnpm types:build && tsc-alias -p tsconfig.build.json",
70
- "dev": "vite",
83
+ "build": "scalar-build-rollup",
84
+ "dev": "vite .",
71
85
  "lint:check": "eslint .",
72
86
  "lint:fix": "eslint . --fix",
73
87
  "preview": "vite preview",
74
88
  "test": "vitest",
75
- "types:build": "vue-tsc -p tsconfig.build.json",
76
- "types:check": "vue-tsc --noEmit --skipLibCheck --composite false"
89
+ "types:build": "scalar-types-build",
90
+ "types:check": "scalar-types-check-vue"
77
91
  }
78
92
  }
@@ -1,9 +0,0 @@
1
- const s = (t, e) => {
2
- const o = t.__vccOpts || t;
3
- for (const [r, c] of e)
4
- o[r] = c;
5
- return o;
6
- };
7
- export {
8
- s as default
9
- };
@@ -1,19 +0,0 @@
1
- import type { CodeMirrorLanguage } from '../../types';
2
- type __VLS_Props = {
3
- content: string | undefined;
4
- readOnly?: boolean;
5
- language?: CodeMirrorLanguage;
6
- withVariables?: boolean;
7
- lineNumbers?: boolean;
8
- withoutTheme?: boolean;
9
- disableEnter?: boolean;
10
- };
11
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
12
- change: (value: string) => any;
13
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
- onChange?: ((value: string) => any) | undefined;
15
- }>, {
16
- disableEnter: boolean;
17
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
18
- export default _default;
19
- //# sourceMappingURL=CodeMirror.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeMirror.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeMirror/CodeMirror.vue"],"names":[],"mappings":"AAkFA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAC;;;;;;kBADe,OAAO;;AA+F1B,wBASG"}
@@ -1,8 +0,0 @@
1
- import o from "./CodeMirror.vue2.js";
2
- /* empty css */
3
- /* empty css */
4
- import r from "../../_virtual/_plugin-vue_export-helper.js";
5
- const i = /* @__PURE__ */ r(o, [["__scopeId", "data-v-f74951d5"]]);
6
- export {
7
- i as default
8
- };
@@ -1,37 +0,0 @@
1
- import { defineComponent as i, ref as s, toRef as o, openBlock as c, createElementBlock as m } from "vue";
2
- import { useCodeMirror as u } from "../../hooks/useCodeMirror.js";
3
- const h = /* @__PURE__ */ i({
4
- __name: "CodeMirror",
5
- props: {
6
- content: {},
7
- readOnly: { type: Boolean },
8
- language: {},
9
- withVariables: { type: Boolean },
10
- lineNumbers: { type: Boolean },
11
- withoutTheme: { type: Boolean },
12
- disableEnter: { type: Boolean, default: !1 }
13
- },
14
- emits: ["change"],
15
- setup(t, { emit: a }) {
16
- const e = t, l = a, r = s(null);
17
- return u({
18
- content: o(() => e.content),
19
- readOnly: o(() => e.readOnly),
20
- language: o(() => e.language),
21
- withVariables: o(() => e.withVariables),
22
- lineNumbers: o(() => e.lineNumbers),
23
- withoutTheme: o(() => e.withoutTheme),
24
- disableEnter: o(() => e.disableEnter),
25
- onChange: (n) => l("change", n || ""),
26
- codeMirrorRef: r,
27
- classes: ["codemirror"]
28
- }), (n, d) => (c(), m("div", {
29
- ref_key: "codeMirrorRef",
30
- ref: r,
31
- class: "codemirror-container"
32
- }, null, 512));
33
- }
34
- });
35
- export {
36
- h as default
37
- };
@@ -1,2 +0,0 @@
1
- export { default as CodeMirror } from './CodeMirror.vue.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CodeMirror/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- .codemirror-container[data-v-f74951d5]{width:100%;height:100%;min-height:76px;color:var(--scalar-color-1);display:flex;align-items:stretch}.copy-to-clipboard-button[data-v-f74951d5]{background:red}.codemirror{flex-grow:1;max-width:100%;cursor:text;font-size:var(--scalar-small);-webkit-text-size-adjust:100%;background:transparent}.cm-focused{outline:none!important}