@lvce-editor/editor-worker 19.56.2 → 19.58.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.
- package/dist/editorWorkerMain.js +64 -32
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -2309,7 +2309,7 @@ const getInitialLineState = initialLineState => {
|
|
|
2309
2309
|
return deepCopy(initialLineState);
|
|
2310
2310
|
};
|
|
2311
2311
|
|
|
2312
|
-
const state$
|
|
2312
|
+
const state$e = {
|
|
2313
2313
|
warned: []
|
|
2314
2314
|
};
|
|
2315
2315
|
const flattenTokensArray = tokens => {
|
|
@@ -2321,10 +2321,10 @@ const flattenTokensArray = tokens => {
|
|
|
2321
2321
|
return flattened;
|
|
2322
2322
|
};
|
|
2323
2323
|
const warnDeprecatedArrayReturn = (languageId, fn) => {
|
|
2324
|
-
if (state$
|
|
2324
|
+
if (state$e.warned.includes(fn)) {
|
|
2325
2325
|
return;
|
|
2326
2326
|
}
|
|
2327
|
-
state$
|
|
2327
|
+
state$e.warned.push(fn);
|
|
2328
2328
|
console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${languageId})`);
|
|
2329
2329
|
};
|
|
2330
2330
|
const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasArrayReturn) => {
|
|
@@ -2385,14 +2385,14 @@ const TokenizePlainText = {
|
|
|
2385
2385
|
tokenizeLine
|
|
2386
2386
|
};
|
|
2387
2387
|
|
|
2388
|
-
const state$
|
|
2388
|
+
const state$d = {
|
|
2389
2389
|
enabled: false
|
|
2390
2390
|
};
|
|
2391
2391
|
const setEnabled$1 = value => {
|
|
2392
|
-
state$
|
|
2392
|
+
state$d.enabled = value;
|
|
2393
2393
|
};
|
|
2394
2394
|
const getEnabled$1 = () => {
|
|
2395
|
-
return state$
|
|
2395
|
+
return state$d.enabled;
|
|
2396
2396
|
};
|
|
2397
2397
|
|
|
2398
2398
|
const {
|
|
@@ -2400,25 +2400,25 @@ const {
|
|
|
2400
2400
|
set: set$6
|
|
2401
2401
|
} = SyntaxHighlightingWorker;
|
|
2402
2402
|
|
|
2403
|
-
const state$
|
|
2403
|
+
const state$c = {
|
|
2404
2404
|
pending: Object.create(null),
|
|
2405
2405
|
tokenizePaths: Object.create(null),
|
|
2406
2406
|
tokenizers: Object.create(null)
|
|
2407
2407
|
};
|
|
2408
2408
|
const has = languageId => {
|
|
2409
|
-
return Object.hasOwn(state$
|
|
2409
|
+
return Object.hasOwn(state$c.tokenizers, languageId);
|
|
2410
2410
|
};
|
|
2411
2411
|
const set$5 = (languageId, tokenizer) => {
|
|
2412
|
-
state$
|
|
2412
|
+
state$c.tokenizers[languageId] = tokenizer;
|
|
2413
2413
|
};
|
|
2414
2414
|
const get$6 = languageId => {
|
|
2415
|
-
return state$
|
|
2415
|
+
return state$c.tokenizers[languageId];
|
|
2416
2416
|
};
|
|
2417
2417
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
2418
|
-
state$
|
|
2418
|
+
state$c.tokenizePaths[languageId] = tokenizePath;
|
|
2419
2419
|
};
|
|
2420
2420
|
const getTokenizePath$1 = languageId => {
|
|
2421
|
-
return state$
|
|
2421
|
+
return state$c.tokenizePaths[languageId] || '';
|
|
2422
2422
|
};
|
|
2423
2423
|
const setTokenizePaths = languages => {
|
|
2424
2424
|
for (const language of languages) {
|
|
@@ -2428,7 +2428,7 @@ const setTokenizePaths = languages => {
|
|
|
2428
2428
|
}
|
|
2429
2429
|
};
|
|
2430
2430
|
const isPending = languageId => {
|
|
2431
|
-
return Object.hasOwn(state$
|
|
2431
|
+
return Object.hasOwn(state$c.pending, languageId);
|
|
2432
2432
|
};
|
|
2433
2433
|
|
|
2434
2434
|
const tokenMaps = Object.create(null);
|
|
@@ -3256,14 +3256,14 @@ const getVisible$1 = async (editor, syncIncremental) => {
|
|
|
3256
3256
|
};
|
|
3257
3257
|
};
|
|
3258
3258
|
|
|
3259
|
-
const state$
|
|
3259
|
+
const state$b = {
|
|
3260
3260
|
enabled: false
|
|
3261
3261
|
};
|
|
3262
3262
|
const setEnabled = value => {
|
|
3263
|
-
state$
|
|
3263
|
+
state$b.enabled = value;
|
|
3264
3264
|
};
|
|
3265
3265
|
const getEnabled = () => {
|
|
3266
|
-
return state$
|
|
3266
|
+
return state$b.enabled;
|
|
3267
3267
|
};
|
|
3268
3268
|
|
|
3269
3269
|
// TODO this should be in a separate scrolling module
|
|
@@ -3490,7 +3490,7 @@ const getUrlAtOffset = (editor, offset) => {
|
|
|
3490
3490
|
const EditorChange = 1;
|
|
3491
3491
|
const EditorSelection$1 = 2;
|
|
3492
3492
|
|
|
3493
|
-
const state$
|
|
3493
|
+
const state$a = Object.create(null);
|
|
3494
3494
|
|
|
3495
3495
|
/**
|
|
3496
3496
|
* Register a listener for a specific event type
|
|
@@ -3500,13 +3500,13 @@ const state$9 = Object.create(null);
|
|
|
3500
3500
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
3501
3501
|
number(listenerType);
|
|
3502
3502
|
number(rpcId);
|
|
3503
|
-
if (!Object.hasOwn(state$
|
|
3504
|
-
state$
|
|
3503
|
+
if (!Object.hasOwn(state$a, listenerType)) {
|
|
3504
|
+
state$a[listenerType] = [];
|
|
3505
3505
|
}
|
|
3506
3506
|
|
|
3507
3507
|
// Avoid duplicate registrations
|
|
3508
|
-
if (!state$
|
|
3509
|
-
state$
|
|
3508
|
+
if (!state$a[listenerType].includes(rpcId)) {
|
|
3509
|
+
state$a[listenerType].push(rpcId);
|
|
3510
3510
|
}
|
|
3511
3511
|
};
|
|
3512
3512
|
|
|
@@ -3518,10 +3518,10 @@ const registerListener$1 = (listenerType, rpcId) => {
|
|
|
3518
3518
|
const unregisterListener$1 = (listenerType, rpcId) => {
|
|
3519
3519
|
number(listenerType);
|
|
3520
3520
|
number(rpcId);
|
|
3521
|
-
if (Object.hasOwn(state$
|
|
3522
|
-
const index = state$
|
|
3521
|
+
if (Object.hasOwn(state$a, listenerType)) {
|
|
3522
|
+
const index = state$a[listenerType].indexOf(rpcId);
|
|
3523
3523
|
if (index !== -1) {
|
|
3524
|
-
state$
|
|
3524
|
+
state$a[listenerType].splice(index, 1);
|
|
3525
3525
|
}
|
|
3526
3526
|
}
|
|
3527
3527
|
};
|
|
@@ -3533,7 +3533,7 @@ const unregisterListener$1 = (listenerType, rpcId) => {
|
|
|
3533
3533
|
*/
|
|
3534
3534
|
const getListeners = listenerType => {
|
|
3535
3535
|
number(listenerType);
|
|
3536
|
-
return state$
|
|
3536
|
+
return state$a[listenerType] || [];
|
|
3537
3537
|
};
|
|
3538
3538
|
|
|
3539
3539
|
/**
|
|
@@ -4962,12 +4962,12 @@ const launchColorPickerWorker = async () => {
|
|
|
4962
4962
|
return launchWorker(name, url, undefined, getColorPickerWorkerCommandMap());
|
|
4963
4963
|
};
|
|
4964
4964
|
|
|
4965
|
-
const state$
|
|
4965
|
+
const state$9 = {};
|
|
4966
4966
|
const getOrCreate$3 = () => {
|
|
4967
|
-
if (!state$
|
|
4968
|
-
state$
|
|
4967
|
+
if (!state$9.workerPromise) {
|
|
4968
|
+
state$9.workerPromise = launchColorPickerWorker();
|
|
4969
4969
|
}
|
|
4970
|
-
return state$
|
|
4970
|
+
return state$9.workerPromise;
|
|
4971
4971
|
};
|
|
4972
4972
|
const invoke$6 = async (method, ...params) => {
|
|
4973
4973
|
const worker = await getOrCreate$3();
|
|
@@ -5614,7 +5614,7 @@ const diff2 = uid => {
|
|
|
5614
5614
|
|
|
5615
5615
|
const autoSaveDelay = 1000;
|
|
5616
5616
|
const pendingSaves = new Map();
|
|
5617
|
-
const state$
|
|
5617
|
+
const state$8 = {
|
|
5618
5618
|
nextToken: 0
|
|
5619
5619
|
};
|
|
5620
5620
|
const run = async (uid, token, save) => {
|
|
@@ -5625,7 +5625,7 @@ const run = async (uid, token, save) => {
|
|
|
5625
5625
|
};
|
|
5626
5626
|
const schedule = (uid, save) => {
|
|
5627
5627
|
dispose$2(uid);
|
|
5628
|
-
const token = ++state$
|
|
5628
|
+
const token = ++state$8.nextToken;
|
|
5629
5629
|
const timeout = setTimeout(run, autoSaveDelay, uid, token, save);
|
|
5630
5630
|
pendingSaves.set(uid, {
|
|
5631
5631
|
timeout,
|
|
@@ -6048,8 +6048,39 @@ const isFormattingError = error => {
|
|
|
6048
6048
|
return error && error instanceof Error && error.message.startsWith(expectedErrorMessage$1);
|
|
6049
6049
|
};
|
|
6050
6050
|
|
|
6051
|
+
const state$7 = {
|
|
6052
|
+
configured: false,
|
|
6053
|
+
lastId: -1,
|
|
6054
|
+
nextId: 0
|
|
6055
|
+
};
|
|
6056
|
+
const configure = (start, end) => {
|
|
6057
|
+
const {
|
|
6058
|
+
configured
|
|
6059
|
+
} = state$7;
|
|
6060
|
+
if (configured) {
|
|
6061
|
+
throw new Error('Component id range is already configured');
|
|
6062
|
+
}
|
|
6063
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start <= 0 || end < start) {
|
|
6064
|
+
throw new Error('Invalid component id range');
|
|
6065
|
+
}
|
|
6066
|
+
state$7.nextId = start;
|
|
6067
|
+
state$7.lastId = end;
|
|
6068
|
+
state$7.configured = true;
|
|
6069
|
+
};
|
|
6051
6070
|
const create$8 = () => {
|
|
6052
|
-
|
|
6071
|
+
const {
|
|
6072
|
+
configured,
|
|
6073
|
+
lastId,
|
|
6074
|
+
nextId
|
|
6075
|
+
} = state$7;
|
|
6076
|
+
if (!configured) {
|
|
6077
|
+
// Compatibility with renderer versions that do not assign worker id ranges.
|
|
6078
|
+
return Math.random();
|
|
6079
|
+
}
|
|
6080
|
+
if (nextId > lastId) {
|
|
6081
|
+
throw new Error('Component id range exhausted');
|
|
6082
|
+
}
|
|
6083
|
+
return state$7.nextId++;
|
|
6053
6084
|
};
|
|
6054
6085
|
|
|
6055
6086
|
const Message = 9;
|
|
@@ -16511,6 +16542,7 @@ const commandMap = {
|
|
|
16511
16542
|
'Hover.handleSashPointerUp': handleSashPointerUp,
|
|
16512
16543
|
'Hover.loadContent': loadContent$1,
|
|
16513
16544
|
'Hover.render': renderHover,
|
|
16545
|
+
'Id.configure': configure,
|
|
16514
16546
|
'Initialize.initialize': intialize,
|
|
16515
16547
|
'Listener.register': registerListener,
|
|
16516
16548
|
'Listener.registerListener': registerListener$1,
|