@cocoar/vue-script-editor 1.10.0-overlay-parent-injection.2 → 1.11.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMonacoEditor.d.ts","sourceRoot":"","sources":["../../src/composables/useMonacoEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAsC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AACnE,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAmBlB,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"useMonacoEditor.d.ts","sourceRoot":"","sources":["../../src/composables/useMonacoEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAsC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AACnE,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAmBlB,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAyI1D,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,wBAAwB,CAAC;IACzC,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,qBAAqB,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,uBAAuB,CAAC;IACxC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAClD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC;IAClE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;IACtD;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;OAIG;IACH,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CAC7C;AAsDD,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAwQtF"}
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,19 @@ var x = {
|
|
|
80
80
|
7027,
|
|
81
81
|
2304,
|
|
82
82
|
1208
|
|
83
|
-
], C = "
|
|
83
|
+
], C = ["es2024"], w = !1;
|
|
84
|
+
function T() {
|
|
85
|
+
if (w) return;
|
|
86
|
+
w = !0;
|
|
87
|
+
let e = f.languages.typescript.ScriptTarget.ES2020, t = f.languages.typescript.typescriptDefaults, n = f.languages.typescript.javascriptDefaults, r = f.languages.typescript.ScriptTarget, i = {
|
|
88
|
+
target: r.ES2024 ?? r.ES2023 ?? r.ES2022 ?? r.ES2021 ?? r.ES2020 ?? e,
|
|
89
|
+
lib: [...C],
|
|
90
|
+
allowNonTsExtensions: !0,
|
|
91
|
+
noResolve: !0
|
|
92
|
+
};
|
|
93
|
+
t.setCompilerOptions(i), n.setCompilerOptions(i);
|
|
94
|
+
}
|
|
95
|
+
var E = "'Cascadia Code', 'Consolas', 'Monaco', 'Courier New', monospace", D = 13, ee = 1.5, O = !0, k = {
|
|
84
96
|
editor: {
|
|
85
97
|
glyphMargin: !0,
|
|
86
98
|
folding: !0,
|
|
@@ -119,7 +131,7 @@ var x = {
|
|
|
119
131
|
wordWrap: "on"
|
|
120
132
|
}
|
|
121
133
|
};
|
|
122
|
-
function
|
|
134
|
+
function A(e, t) {
|
|
123
135
|
return t ?? e === "editor" ? {
|
|
124
136
|
lineNumbers: "on",
|
|
125
137
|
lineNumbersMinChars: 3,
|
|
@@ -130,25 +142,25 @@ function O(e, t) {
|
|
|
130
142
|
lineDecorationsWidth: 12
|
|
131
143
|
};
|
|
132
144
|
}
|
|
133
|
-
function
|
|
145
|
+
function j(e) {
|
|
134
146
|
return e ? `${e}\n` : "";
|
|
135
147
|
}
|
|
136
|
-
function
|
|
148
|
+
function M(e) {
|
|
137
149
|
return e ? e.split("\n").length : 0;
|
|
138
150
|
}
|
|
139
|
-
function
|
|
140
|
-
return t ?
|
|
151
|
+
function N(e, t) {
|
|
152
|
+
return t ? j(t) + e : e;
|
|
141
153
|
}
|
|
142
|
-
function
|
|
154
|
+
function P(e, t) {
|
|
143
155
|
if (!t) return e;
|
|
144
|
-
let n =
|
|
156
|
+
let n = j(t);
|
|
145
157
|
return e.startsWith(n) ? e.slice(n.length) : e;
|
|
146
158
|
}
|
|
147
|
-
function
|
|
148
|
-
let n =
|
|
159
|
+
function F(e, t) {
|
|
160
|
+
let n = M(t), r = n === 0 ? [] : [new f.Range(1, 1, n, 2 ** 53 - 1)];
|
|
149
161
|
e.setHiddenAreas(r);
|
|
150
162
|
}
|
|
151
|
-
function
|
|
163
|
+
function I(e, t) {
|
|
152
164
|
if (!t || e !== "typescript" && e !== "javascript") return;
|
|
153
165
|
let n = e === "javascript" ? f.languages.typescript.javascriptDefaults : f.languages.typescript.typescriptDefaults, r = typeof n.getDiagnosticsOptions == "function" ? n.getDiagnosticsOptions() : {}, i = new Set(r.diagnosticCodesToIgnore ?? []);
|
|
154
166
|
for (let e of S) i.add(e);
|
|
@@ -157,7 +169,8 @@ function P(e, t) {
|
|
|
157
169
|
diagnosticCodesToIgnore: Array.from(i)
|
|
158
170
|
});
|
|
159
171
|
}
|
|
160
|
-
function
|
|
172
|
+
function te(e) {
|
|
173
|
+
T();
|
|
161
174
|
let t = l(null), n = l(null), r = !1, i = null, a = null, s = null, c = null, u = !1;
|
|
162
175
|
function p() {
|
|
163
176
|
return e.variant?.() ?? "editor";
|
|
@@ -171,8 +184,8 @@ function F(e) {
|
|
|
171
184
|
if (u || !e.host.value) return;
|
|
172
185
|
u = !0, g(f);
|
|
173
186
|
let o = e.language(), c = e.preamble?.() ?? "";
|
|
174
|
-
|
|
175
|
-
let l = f.editor.createModel(
|
|
187
|
+
I(o, e.scriptMode?.() ?? !1);
|
|
188
|
+
let l = f.editor.createModel(N(e.initialValue(), c), o, f.Uri.parse(`file:///coar-script-editor/${b()}.${x[o]}`));
|
|
176
189
|
n.value = l;
|
|
177
190
|
let d = e.overflowWidgetsDomNode?.() ?? null, h = f.editor.create(e.host.value, {
|
|
178
191
|
model: l,
|
|
@@ -181,22 +194,22 @@ function F(e) {
|
|
|
181
194
|
minimap: { enabled: e.minimap() },
|
|
182
195
|
automaticLayout: !0,
|
|
183
196
|
scrollBeyondLastLine: !1,
|
|
184
|
-
fontFamily:
|
|
185
|
-
fontSize:
|
|
186
|
-
lineHeight:
|
|
187
|
-
fontLigatures:
|
|
197
|
+
fontFamily: E,
|
|
198
|
+
fontSize: D,
|
|
199
|
+
lineHeight: ee,
|
|
200
|
+
fontLigatures: O,
|
|
188
201
|
tabSize: 2,
|
|
189
202
|
fixedOverflowWidgets: !0,
|
|
190
|
-
...
|
|
191
|
-
...
|
|
203
|
+
...k[p()],
|
|
204
|
+
...A(p(), e.lineNumbers?.()),
|
|
192
205
|
...d ? { overflowWidgetsDomNode: d } : {}
|
|
193
206
|
});
|
|
194
|
-
t.value = h,
|
|
207
|
+
t.value = h, F(h, c), m();
|
|
195
208
|
let _ = !1;
|
|
196
209
|
i = h.onDidChangeModelContent((n) => {
|
|
197
210
|
let i = e.preamble?.() ?? "";
|
|
198
211
|
if (i && !n.isFlush && !n.isUndoing) {
|
|
199
|
-
let e =
|
|
212
|
+
let e = j(i).length;
|
|
200
213
|
if (n.changes.some((t) => t.rangeOffset < e)) {
|
|
201
214
|
h.trigger("coar-script-editor-preamble", "undo", null);
|
|
202
215
|
return;
|
|
@@ -205,7 +218,7 @@ function F(e) {
|
|
|
205
218
|
r || _ || (_ = !0, queueMicrotask(() => {
|
|
206
219
|
if (_ = !1, !t.value) return;
|
|
207
220
|
let n = h.getValue();
|
|
208
|
-
e.onContentChange(
|
|
221
|
+
e.onContentChange(P(n, e.preamble?.() ?? ""));
|
|
209
222
|
}));
|
|
210
223
|
}), e.onFocused && (a = h.onDidFocusEditorWidget(() => e.onFocused?.())), e.onBlurred && (s = h.onDidBlurEditorWidget(() => e.onBlurred?.())), e.autofocus?.() && queueMicrotask(() => t.value?.focus()), e.onEditorReady?.(h);
|
|
211
224
|
}
|
|
@@ -220,11 +233,11 @@ function F(e) {
|
|
|
220
233
|
function _(n) {
|
|
221
234
|
let i = t.value;
|
|
222
235
|
if (!i) return;
|
|
223
|
-
let a = e.preamble?.() ?? "", o =
|
|
236
|
+
let a = e.preamble?.() ?? "", o = N(n, a);
|
|
224
237
|
if (i.getValue() !== o) {
|
|
225
238
|
r = !0;
|
|
226
239
|
try {
|
|
227
|
-
i.setValue(o),
|
|
240
|
+
i.setValue(o), F(i, a);
|
|
228
241
|
} finally {
|
|
229
242
|
r = !1;
|
|
230
243
|
}
|
|
@@ -241,17 +254,17 @@ function F(e) {
|
|
|
241
254
|
}
|
|
242
255
|
return d(() => e.language(), (t) => {
|
|
243
256
|
let r = n.value;
|
|
244
|
-
r && f.editor.setModelLanguage(r, t),
|
|
257
|
+
r && f.editor.setModelLanguage(r, t), I(t, e.scriptMode?.() ?? !1);
|
|
245
258
|
}), d(() => e.readonly(), (e) => t.value?.updateOptions({ readOnly: e })), d(() => e.minimap(), (e) => t.value?.updateOptions({ minimap: { enabled: e } })), e.variant && d(() => p(), (n) => t.value?.updateOptions({
|
|
246
|
-
...
|
|
247
|
-
...
|
|
248
|
-
})), e.lineNumbers && d(() => e.lineNumbers(), (e) => t.value?.updateOptions(
|
|
259
|
+
...k[n],
|
|
260
|
+
...A(n, e.lineNumbers?.())
|
|
261
|
+
})), e.lineNumbers && d(() => e.lineNumbers(), (e) => t.value?.updateOptions(A(p(), e))), e.scriptMode && d(() => e.scriptMode(), (t) => I(e.language(), t)), e.preamble && d(() => e.preamble(), (e, n) => {
|
|
249
262
|
let i = t.value;
|
|
250
263
|
if (!i) return;
|
|
251
|
-
let a =
|
|
264
|
+
let a = N(P(i.getValue(), n ?? ""), e);
|
|
252
265
|
r = !0;
|
|
253
266
|
try {
|
|
254
|
-
i.setValue(a),
|
|
267
|
+
i.setValue(a), F(i, e);
|
|
255
268
|
} finally {
|
|
256
269
|
r = !1;
|
|
257
270
|
}
|
|
@@ -266,7 +279,7 @@ function F(e) {
|
|
|
266
279
|
}
|
|
267
280
|
//#endregion
|
|
268
281
|
//#region src/composables/useExtraLibs.ts
|
|
269
|
-
function
|
|
282
|
+
function L(e) {
|
|
270
283
|
let t = [], n = /* @__PURE__ */ new Set(), r = !1;
|
|
271
284
|
function i() {
|
|
272
285
|
for (; t.length;) t.pop()?.dispose();
|
|
@@ -284,16 +297,16 @@ function I(e) {
|
|
|
284
297
|
}
|
|
285
298
|
//#endregion
|
|
286
299
|
//#region src/constrained/LockedLineScanner.ts
|
|
287
|
-
var
|
|
288
|
-
function B(e) {
|
|
289
|
-
return L.test(e);
|
|
290
|
-
}
|
|
300
|
+
var R = /\/\/\s*@locked\b/, z = /\/\/\s*@locked\b[^\n]*?@slot:([A-Za-z_][A-Za-z0-9_-]*)/, B = "// @locked", ne = z.source;
|
|
291
301
|
function V(e) {
|
|
302
|
+
return R.test(e);
|
|
303
|
+
}
|
|
304
|
+
function H(e) {
|
|
292
305
|
let t = [], n = e.length, r = 0, i = 0;
|
|
293
306
|
for (let a = 0; a <= n; a++) if (a === n || e[a] === "\n") {
|
|
294
307
|
let o = a, s = o > i && e[o - 1] === "\r" ? o - 1 : o, c = e.slice(i, s);
|
|
295
|
-
if (
|
|
296
|
-
let e = c.match(
|
|
308
|
+
if (R.test(c)) {
|
|
309
|
+
let e = c.match(z);
|
|
297
310
|
t.push({
|
|
298
311
|
lineIndex: r,
|
|
299
312
|
lineStart: i,
|
|
@@ -309,7 +322,7 @@ function V(e) {
|
|
|
309
322
|
}
|
|
310
323
|
return t;
|
|
311
324
|
}
|
|
312
|
-
function
|
|
325
|
+
function U(e) {
|
|
313
326
|
if (e.length === 0) return [];
|
|
314
327
|
let t = [...e].sort((e, t) => e.protectedStart - t.protectedStart), n = [], r = {
|
|
315
328
|
start: t[0].protectedStart,
|
|
@@ -328,27 +341,27 @@ function H(e) {
|
|
|
328
341
|
}
|
|
329
342
|
return n.push(r), n;
|
|
330
343
|
}
|
|
331
|
-
function U(e, t) {
|
|
332
|
-
return e.rangeStart <= t.end && e.rangeEnd >= t.start;
|
|
333
|
-
}
|
|
334
344
|
function W(e, t) {
|
|
335
|
-
return t.
|
|
345
|
+
return e.rangeStart <= t.end && e.rangeEnd >= t.start;
|
|
336
346
|
}
|
|
337
347
|
function G(e, t) {
|
|
348
|
+
return t.some((t) => W(e, t));
|
|
349
|
+
}
|
|
350
|
+
function K(e, t) {
|
|
338
351
|
for (let n of t) if (e >= n.start && e <= n.end) {
|
|
339
352
|
let t = n.snapBefore, r = n.snapAfter;
|
|
340
353
|
return t == null && r == null ? 0 : t == null ? r : r == null || e - t < r - e ? t : r;
|
|
341
354
|
}
|
|
342
355
|
return e;
|
|
343
356
|
}
|
|
344
|
-
function K(e) {
|
|
345
|
-
return V(e).length;
|
|
346
|
-
}
|
|
347
357
|
function q(e) {
|
|
348
|
-
return
|
|
358
|
+
return H(e).length;
|
|
349
359
|
}
|
|
350
360
|
function J(e) {
|
|
351
|
-
|
|
361
|
+
return Q(e).every((e) => e.trim().length > 0);
|
|
362
|
+
}
|
|
363
|
+
function Y(e) {
|
|
364
|
+
let t = H(e), n = Q(e), r = [];
|
|
352
365
|
return t.length > 0 && t[0].lineIndex === 0 && r.push("Source starts with a locked line — there is no space above for auto-import or helpers."), t.length > 0 && n.every((e) => e.length === 0) && r.push("Source has locked lines but no editable space between or around them."), {
|
|
353
366
|
ok: r.length === 0,
|
|
354
367
|
lockedLineCount: t.length,
|
|
@@ -356,30 +369,30 @@ function J(e) {
|
|
|
356
369
|
warnings: r
|
|
357
370
|
};
|
|
358
371
|
}
|
|
359
|
-
function
|
|
372
|
+
function X(e) {
|
|
360
373
|
let t = e.split("\n"), n = 0, r = t.length;
|
|
361
374
|
for (; n < r && t[n].trim() === "";) n++;
|
|
362
375
|
for (; r > n && t[r - 1].trim() === "";) r--;
|
|
363
376
|
return t.slice(n, r).join("\n");
|
|
364
377
|
}
|
|
365
|
-
function
|
|
366
|
-
let t =
|
|
378
|
+
function Z(e) {
|
|
379
|
+
let t = H(e);
|
|
367
380
|
if (t.length === 0) return {};
|
|
368
381
|
let n = e.split("\n"), r = {};
|
|
369
382
|
for (let e = 0; e < t.length; e++) {
|
|
370
383
|
let i = t[e];
|
|
371
384
|
if (!i.slotName || Object.prototype.hasOwnProperty.call(r, i.slotName)) continue;
|
|
372
385
|
let a = i.lineIndex + 1, o = t[e + 1], s = o ? o.lineIndex : n.length, c = n.slice(a, s).join("\n");
|
|
373
|
-
r[i.slotName] =
|
|
386
|
+
r[i.slotName] = X(c);
|
|
374
387
|
}
|
|
375
388
|
return r;
|
|
376
389
|
}
|
|
377
|
-
function
|
|
378
|
-
let n =
|
|
390
|
+
function re(e, t) {
|
|
391
|
+
let n = Z(e);
|
|
379
392
|
return Object.prototype.hasOwnProperty.call(n, t) ? n[t] : void 0;
|
|
380
393
|
}
|
|
381
394
|
function Q(e) {
|
|
382
|
-
let t =
|
|
395
|
+
let t = H(e);
|
|
383
396
|
if (t.length === 0) return [e];
|
|
384
397
|
let n = new Set(t.map((e) => e.lineIndex)), r = e.split("\n"), i = [], a = [];
|
|
385
398
|
for (let e = 0; e < r.length; e++) n.has(e) ? a.length > 0 || i.length === 0 ? (i.push(a.join("\n")), a = []) : i.push("") : a.push(r[e]);
|
|
@@ -387,7 +400,7 @@ function Q(e) {
|
|
|
387
400
|
}
|
|
388
401
|
//#endregion
|
|
389
402
|
//#region src/constrained/ChangeGuard.ts
|
|
390
|
-
var
|
|
403
|
+
var ie = class {
|
|
391
404
|
disposables = [];
|
|
392
405
|
lockedLines;
|
|
393
406
|
protectedRanges;
|
|
@@ -395,7 +408,7 @@ var te = class {
|
|
|
395
408
|
this.editor = e, this.authoring = t, this.callbacks = n;
|
|
396
409
|
let r = e.getModel();
|
|
397
410
|
if (!r) throw Error("ChangeGuard requires the editor to have an attached model");
|
|
398
|
-
this.lockedLines =
|
|
411
|
+
this.lockedLines = H(r.getValue()), this.protectedRanges = U(this.lockedLines), this.disposables.push(r.onDidChangeContent((e) => this.handleChange(e)));
|
|
399
412
|
}
|
|
400
413
|
dispose() {
|
|
401
414
|
for (; this.disposables.length;) this.disposables.pop()?.dispose();
|
|
@@ -408,14 +421,14 @@ var te = class {
|
|
|
408
421
|
}
|
|
409
422
|
refresh() {
|
|
410
423
|
let e = this.editor.getModel();
|
|
411
|
-
e && (this.lockedLines =
|
|
424
|
+
e && (this.lockedLines = H(e.getValue()), this.protectedRanges = U(this.lockedLines), this.callbacks.onLinesUpdated?.(this.lockedLines));
|
|
412
425
|
}
|
|
413
426
|
handleChange(e) {
|
|
414
427
|
let t = this.editor.getModel();
|
|
415
428
|
if (!t) return;
|
|
416
429
|
let n = e.isFlush || e.isUndoing || this.authoring();
|
|
417
430
|
if (e.isFlush && t.pushStackElement(), !n) {
|
|
418
|
-
let t = e.changes.find((e) =>
|
|
431
|
+
let t = e.changes.find((e) => G({
|
|
419
432
|
rangeStart: e.rangeOffset,
|
|
420
433
|
rangeEnd: e.rangeOffset + e.rangeLength
|
|
421
434
|
}, this.protectedRanges));
|
|
@@ -430,9 +443,9 @@ var te = class {
|
|
|
430
443
|
return;
|
|
431
444
|
}
|
|
432
445
|
}
|
|
433
|
-
this.lockedLines =
|
|
446
|
+
this.lockedLines = H(t.getValue()), this.protectedRanges = U(this.lockedLines), this.callbacks.onLinesUpdated?.(this.lockedLines), this.callbacks.onContentChanged?.(t.getValue());
|
|
434
447
|
}
|
|
435
|
-
},
|
|
448
|
+
}, ae = class {
|
|
436
449
|
disposables = [];
|
|
437
450
|
correcting = !1;
|
|
438
451
|
constructor(e, t, n) {
|
|
@@ -454,7 +467,7 @@ var te = class {
|
|
|
454
467
|
if (n.length === 0) return;
|
|
455
468
|
let r = t[0].constructor, i = [], a = !1;
|
|
456
469
|
for (let o of t) {
|
|
457
|
-
let t = e.getOffsetAt(o.getStartPosition()), s = e.getOffsetAt(o.getEndPosition()), c =
|
|
470
|
+
let t = e.getOffsetAt(o.getStartPosition()), s = e.getOffsetAt(o.getEndPosition()), c = K(t, n), l = K(s, n);
|
|
458
471
|
if (c === t && l === s) {
|
|
459
472
|
i.push(o);
|
|
460
473
|
continue;
|
|
@@ -471,7 +484,7 @@ var te = class {
|
|
|
471
484
|
}
|
|
472
485
|
}
|
|
473
486
|
}
|
|
474
|
-
},
|
|
487
|
+
}, oe = class {
|
|
475
488
|
disposables = [];
|
|
476
489
|
filtering = !1;
|
|
477
490
|
constructor(e, t) {
|
|
@@ -492,7 +505,7 @@ var te = class {
|
|
|
492
505
|
if (this.authoring()) return;
|
|
493
506
|
let e = this.editor.getModel();
|
|
494
507
|
if (!e) return;
|
|
495
|
-
let t = e.getValue(), n = new Set(
|
|
508
|
+
let t = e.getValue(), n = new Set(H(t).map((e) => e.lineIndex + 1));
|
|
496
509
|
if (n.size === 0) return;
|
|
497
510
|
let r = f.editor.getModelMarkers({ resource: e.uri });
|
|
498
511
|
if (r.length === 0) return;
|
|
@@ -526,7 +539,7 @@ var te = class {
|
|
|
526
539
|
this.filtering = !1;
|
|
527
540
|
}
|
|
528
541
|
}
|
|
529
|
-
},
|
|
542
|
+
}, se = "coar-script-editor-locked-line", ce = "coar-script-editor-locked-marker", le = /\/\/\s*@locked\b/g;
|
|
530
543
|
function $(e) {
|
|
531
544
|
let t = null, n = null, r = null, i = null;
|
|
532
545
|
function a() {
|
|
@@ -546,12 +559,12 @@ function $(e) {
|
|
|
546
559
|
endColumn: i + 1
|
|
547
560
|
},
|
|
548
561
|
options: {
|
|
549
|
-
className:
|
|
562
|
+
className: se,
|
|
550
563
|
isWholeLine: !0,
|
|
551
564
|
stickiness: 1
|
|
552
565
|
}
|
|
553
566
|
});
|
|
554
|
-
let a = n.getLineContent(t), o = new RegExp(
|
|
567
|
+
let a = n.getLineContent(t), o = new RegExp(le.source, "g"), s;
|
|
555
568
|
for (; (s = o.exec(a)) !== null;) r.push({
|
|
556
569
|
range: {
|
|
557
570
|
startLineNumber: t,
|
|
@@ -560,7 +573,7 @@ function $(e) {
|
|
|
560
573
|
endColumn: s.index + s[0].length + 1
|
|
561
574
|
},
|
|
562
575
|
options: {
|
|
563
|
-
inlineClassName:
|
|
576
|
+
inlineClassName: ce,
|
|
564
577
|
stickiness: 1,
|
|
565
578
|
hoverMessage: { value: "Locked line marker" }
|
|
566
579
|
}
|
|
@@ -573,14 +586,14 @@ function $(e) {
|
|
|
573
586
|
formatOnType: !1,
|
|
574
587
|
formatOnPaste: !1,
|
|
575
588
|
linkedEditing: !1
|
|
576
|
-
}), t = new
|
|
589
|
+
}), t = new ie(i, e.authoring, {
|
|
577
590
|
onReject: e.onReject,
|
|
578
591
|
onLinesUpdated: (e) => {
|
|
579
592
|
s(i, e), r?.refresh();
|
|
580
593
|
}
|
|
581
|
-
}), n = new
|
|
594
|
+
}), n = new ae(i, () => t?.getProtectedRanges() ?? [], e.authoring), r = new oe(i, e.authoring), s(i, t.getLockedLines()), n.snapCurrent();
|
|
582
595
|
}
|
|
583
|
-
d([e.editor, () =>
|
|
596
|
+
d([e.editor, () => V(e.value())], ([e, n]) => {
|
|
584
597
|
if (!e) {
|
|
585
598
|
a();
|
|
586
599
|
return;
|
|
@@ -599,13 +612,13 @@ function $(e) {
|
|
|
599
612
|
}
|
|
600
613
|
//#endregion
|
|
601
614
|
//#region src/composables/useFormFieldContext.ts
|
|
602
|
-
var
|
|
603
|
-
function
|
|
604
|
-
return r(
|
|
615
|
+
var ue = Symbol.for("coar:form-field");
|
|
616
|
+
function de() {
|
|
617
|
+
return r(ue, void 0);
|
|
605
618
|
}
|
|
606
619
|
//#endregion
|
|
607
620
|
//#region src/CoarScriptEditor.vue?vue&type=script&setup=true&lang.ts
|
|
608
|
-
var
|
|
621
|
+
var fe = [
|
|
609
622
|
"id",
|
|
610
623
|
"aria-invalid",
|
|
611
624
|
"aria-describedby",
|
|
@@ -613,7 +626,7 @@ var le = [
|
|
|
613
626
|
"aria-required",
|
|
614
627
|
"data-placeholder",
|
|
615
628
|
"data-name"
|
|
616
|
-
],
|
|
629
|
+
], pe = /* @__PURE__ */ n({
|
|
617
630
|
__name: "CoarScriptEditor",
|
|
618
631
|
props: {
|
|
619
632
|
modelValue: { default: "" },
|
|
@@ -671,7 +684,7 @@ var le = [
|
|
|
671
684
|
"blurred"
|
|
672
685
|
],
|
|
673
686
|
setup(n, { expose: r, emit: o }) {
|
|
674
|
-
let l = n, f = o, p = c(null), m = l.modelValue, h =
|
|
687
|
+
let l = n, f = o, p = c(null), m = l.modelValue, h = de(), g = `coar-script-editor-${u()}`, _ = e(() => l.id || h?.inputId.value || g), v = e(() => l.error || (h?.hasError.value ?? !1)), y = e(() => h?.messageId.value), b = e(() => l.disabled || (h?.disabled.value ?? !1)), x = c(!1), S = c(l.modelValue.length === 0), C = e(() => ({
|
|
675
688
|
"coar-script-editor": !0,
|
|
676
689
|
"coar-script-editor--authoring": l.authoring,
|
|
677
690
|
"coar-script-editor--inline": l.variant === "inline",
|
|
@@ -681,7 +694,7 @@ var le = [
|
|
|
681
694
|
})), w = e(() => l.height === void 0 || l.height === "" ? {} : {
|
|
682
695
|
height: typeof l.height == "number" ? `${l.height}px` : l.height,
|
|
683
696
|
minHeight: "0"
|
|
684
|
-
}), { editor: T, model: E, setValue: D } =
|
|
697
|
+
}), { editor: T, model: E, setValue: D } = te({
|
|
685
698
|
host: p,
|
|
686
699
|
initialValue: () => l.modelValue,
|
|
687
700
|
language: () => l.language,
|
|
@@ -704,7 +717,7 @@ var le = [
|
|
|
704
717
|
x.value = !1, f("blurred");
|
|
705
718
|
}
|
|
706
719
|
});
|
|
707
|
-
return
|
|
720
|
+
return L({
|
|
708
721
|
language: () => l.language,
|
|
709
722
|
libs: () => l.extraLibs
|
|
710
723
|
}), $({
|
|
@@ -730,8 +743,8 @@ var le = [
|
|
|
730
743
|
"aria-required": n.required ? "true" : void 0,
|
|
731
744
|
"data-placeholder": n.placeholder || void 0,
|
|
732
745
|
"data-name": n.name || void 0
|
|
733
|
-
}, null, 14,
|
|
746
|
+
}, null, 14, fe));
|
|
734
747
|
}
|
|
735
748
|
});
|
|
736
749
|
//#endregion
|
|
737
|
-
export { m as COAR_THEME_DARK, p as COAR_THEME_LIGHT,
|
|
750
|
+
export { m as COAR_THEME_DARK, p as COAR_THEME_LIGHT, pe as CoarScriptEditor, B as LOCKED_MARKER_TEXT, ne as SLOT_MARKER_PATTERN, U as computeProtectedRanges, q as countLockedLines, _ as detectAutoTheme, G as editIsProtected, g as ensureCoarThemes, Q as getEditableSegments, re as getSlot, Z as getSlots, V as hasLockedMarkers, J as isEverySegmentNonEmpty, W as overlapsProtectedRange, H as scanLockedLines, K as snapOffsetAwayFromLocked, Y as validateSource, y as watchAutoTheme };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocoar/vue-script-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Monaco-based script editor component for Vue 3 with Cocoar Design System styling",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"lint": "eslint src/"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"monaco-editor": "^0.
|
|
43
|
+
"monaco-editor": "^0.54.0",
|
|
44
44
|
"vue": "^3.5.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"monaco-editor": "^0.
|
|
47
|
+
"monaco-editor": "^0.54.0",
|
|
48
48
|
"vue": "^3.5.32"
|
|
49
49
|
}
|
|
50
50
|
}
|