@lvce-editor/renderer-process 11.5.0 → 11.6.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/rendererProcessMain.js +87 -36
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ const Developer = 4;
|
|
|
18
18
|
const Download = 5;
|
|
19
19
|
const EditorController = 6;
|
|
20
20
|
const EditorError$1 = 7;
|
|
21
|
+
const FileHandles = 423;
|
|
21
22
|
const EditorHover$1 = 8;
|
|
22
23
|
const ImagePreview$2 = 10;
|
|
23
24
|
const InitData = 11;
|
|
@@ -62,6 +63,8 @@ const getModuleId = commandId => {
|
|
|
62
63
|
case 'ClipBoard.writeImage':
|
|
63
64
|
case 'ClipBoard.writeText':
|
|
64
65
|
return ClipBoard;
|
|
66
|
+
case 'FileHandles.get':
|
|
67
|
+
return FileHandles;
|
|
65
68
|
case 'ConfirmPrompt.prompt':
|
|
66
69
|
return ConfirmPrompt;
|
|
67
70
|
case 'Css.addCssStyleSheet':
|
|
@@ -351,7 +354,7 @@ const ipcs = Object.create(null);
|
|
|
351
354
|
const set$9 = (name, ipc) => {
|
|
352
355
|
ipcs[name] = ipc;
|
|
353
356
|
};
|
|
354
|
-
const get$
|
|
357
|
+
const get$a = name => {
|
|
355
358
|
return ipcs[name];
|
|
356
359
|
};
|
|
357
360
|
const remove$4 = name => {
|
|
@@ -461,15 +464,15 @@ const callbacks = Object.create(null);
|
|
|
461
464
|
const set$8 = (id, fn) => {
|
|
462
465
|
callbacks[id] = fn;
|
|
463
466
|
};
|
|
464
|
-
const get$
|
|
467
|
+
const get$9 = id => {
|
|
465
468
|
return callbacks[id];
|
|
466
469
|
};
|
|
467
470
|
const remove$3 = id => {
|
|
468
471
|
delete callbacks[id];
|
|
469
472
|
};
|
|
470
|
-
let id = 0;
|
|
473
|
+
let id$1 = 0;
|
|
471
474
|
const create$3$1 = () => {
|
|
472
|
-
return ++id;
|
|
475
|
+
return ++id$1;
|
|
473
476
|
};
|
|
474
477
|
const registerPromise = () => {
|
|
475
478
|
const id = create$3$1();
|
|
@@ -634,7 +637,7 @@ const warn$1 = (...args) => {
|
|
|
634
637
|
console.warn(...args);
|
|
635
638
|
};
|
|
636
639
|
const resolve = (id, response) => {
|
|
637
|
-
const fn = get$
|
|
640
|
+
const fn = get$9(id);
|
|
638
641
|
if (!fn) {
|
|
639
642
|
console.log(response);
|
|
640
643
|
warn$1(`callback ${id} may already be disposed`);
|
|
@@ -686,7 +689,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
686
689
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
687
690
|
return create$1$1(message, errorProperty);
|
|
688
691
|
};
|
|
689
|
-
const create$
|
|
692
|
+
const create$J = (message, result) => {
|
|
690
693
|
return {
|
|
691
694
|
jsonrpc: Two,
|
|
692
695
|
id: message.id,
|
|
@@ -695,7 +698,7 @@ const create$I = (message, result) => {
|
|
|
695
698
|
};
|
|
696
699
|
const getSuccessResponse = (message, result) => {
|
|
697
700
|
const resultProperty = result ?? null;
|
|
698
|
-
return create$
|
|
701
|
+
return create$J(message, resultProperty);
|
|
699
702
|
};
|
|
700
703
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
701
704
|
try {
|
|
@@ -879,7 +882,7 @@ const launchWorker = async ({
|
|
|
879
882
|
name,
|
|
880
883
|
url
|
|
881
884
|
}) => {
|
|
882
|
-
const worker = await create$
|
|
885
|
+
const worker = await create$I({
|
|
883
886
|
method: Auto,
|
|
884
887
|
url,
|
|
885
888
|
name
|
|
@@ -986,7 +989,7 @@ const RendererWorker = {
|
|
|
986
989
|
state: state$9
|
|
987
990
|
};
|
|
988
991
|
|
|
989
|
-
const create$
|
|
992
|
+
const create$I = async ({
|
|
990
993
|
method,
|
|
991
994
|
...options
|
|
992
995
|
}) => {
|
|
@@ -996,7 +999,7 @@ const create$H = async ({
|
|
|
996
999
|
}
|
|
997
1000
|
// TODO rename method
|
|
998
1001
|
// TODO avoid cyclic dependency
|
|
999
|
-
const port = get$
|
|
1002
|
+
const port = get$a(options.name);
|
|
1000
1003
|
remove$4(options.name);
|
|
1001
1004
|
await invokeAndTransfer('Transferrable.transfer', options.id, port);
|
|
1002
1005
|
return;
|
|
@@ -1007,7 +1010,7 @@ const create$H = async ({
|
|
|
1007
1010
|
};
|
|
1008
1011
|
|
|
1009
1012
|
const launchEditorWorker = async port => {
|
|
1010
|
-
const ipc = await create$
|
|
1013
|
+
const ipc = await create$I({
|
|
1011
1014
|
name: 'Editor Worker',
|
|
1012
1015
|
url: editorWorkerUrl,
|
|
1013
1016
|
method: ModuleWorkerWithMessagePort,
|
|
@@ -1037,7 +1040,7 @@ const extensionHostWorkerUrl = getConfiguredExtensionHostWorkerUrl() || `${asset
|
|
|
1037
1040
|
|
|
1038
1041
|
const launchExtensionHostWorker = async port => {
|
|
1039
1042
|
const name = isElectron ? 'Extension Host (Electron)' : 'Extension Host';
|
|
1040
|
-
const ipc = await create$
|
|
1043
|
+
const ipc = await create$I({
|
|
1041
1044
|
name,
|
|
1042
1045
|
url: extensionHostWorkerUrl,
|
|
1043
1046
|
method: ModuleWorkerWithMessagePort,
|
|
@@ -1061,7 +1064,7 @@ const hydrate$2 = async () => {
|
|
|
1061
1064
|
const syntaxHighlightingWorkerUrl = `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
|
|
1062
1065
|
|
|
1063
1066
|
const launchSyntaxHighlightingWorker = async port => {
|
|
1064
|
-
const ipc = await create$
|
|
1067
|
+
const ipc = await create$I({
|
|
1065
1068
|
name: 'Syntax Highlighting Worker',
|
|
1066
1069
|
url: syntaxHighlightingWorkerUrl,
|
|
1067
1070
|
method: ModuleWorkerWithMessagePort,
|
|
@@ -1081,9 +1084,13 @@ const hydrate$1 = async () => {
|
|
|
1081
1084
|
await promise;
|
|
1082
1085
|
};
|
|
1083
1086
|
|
|
1087
|
+
const workerFns = [hydrate$4, hydrate$3, hydrate$1, hydrate$2];
|
|
1088
|
+
const call = fn => {
|
|
1089
|
+
return fn();
|
|
1090
|
+
};
|
|
1084
1091
|
const launchWorkers = () => {
|
|
1085
1092
|
{
|
|
1086
|
-
return Promise.all(
|
|
1093
|
+
return Promise.all(workerFns.map(call));
|
|
1087
1094
|
}
|
|
1088
1095
|
};
|
|
1089
1096
|
|
|
@@ -1095,6 +1102,8 @@ const load$2 = moduleId => {
|
|
|
1095
1102
|
return Promise.resolve().then(function () { return ClipBoard_ipc; });
|
|
1096
1103
|
case ConfirmPrompt:
|
|
1097
1104
|
return Promise.resolve().then(function () { return ConfirmPrompt_ipc; });
|
|
1105
|
+
case FileHandles:
|
|
1106
|
+
return Promise.resolve().then(function () { return FileHandles_ipc; });
|
|
1098
1107
|
case Css:
|
|
1099
1108
|
return Promise.resolve().then(function () { return Css_ipc; });
|
|
1100
1109
|
case Developer:
|
|
@@ -1421,14 +1430,14 @@ const getComponentUidFromEvent = event => {
|
|
|
1421
1430
|
} = event;
|
|
1422
1431
|
return getComponentUid(currentTarget || target);
|
|
1423
1432
|
};
|
|
1424
|
-
const state$
|
|
1433
|
+
const state$1$1 = {
|
|
1425
1434
|
ipc: undefined
|
|
1426
1435
|
};
|
|
1427
1436
|
const getIpc = () => {
|
|
1428
|
-
return state$
|
|
1437
|
+
return state$1$1.ipc;
|
|
1429
1438
|
};
|
|
1430
1439
|
const setIpc = value => {
|
|
1431
|
-
state$
|
|
1440
|
+
state$1$1.ipc = value;
|
|
1432
1441
|
};
|
|
1433
1442
|
const cache$1 = new Map();
|
|
1434
1443
|
const has = listener => {
|
|
@@ -1437,7 +1446,7 @@ const has = listener => {
|
|
|
1437
1446
|
const set$7 = (listener, value) => {
|
|
1438
1447
|
cache$1.set(listener, value);
|
|
1439
1448
|
};
|
|
1440
|
-
const get$
|
|
1449
|
+
const get$1$1 = listener => {
|
|
1441
1450
|
return cache$1.get(listener);
|
|
1442
1451
|
};
|
|
1443
1452
|
const nameAnonymousFunction$1 = (fn, name) => {
|
|
@@ -1463,7 +1472,7 @@ const getWrappedListener$1 = (listener, returnValue) => {
|
|
|
1463
1472
|
nameAnonymousFunction$1(wrapped, listener.name);
|
|
1464
1473
|
set$7(listener, wrapped);
|
|
1465
1474
|
}
|
|
1466
|
-
return get$
|
|
1475
|
+
return get$1$1(listener);
|
|
1467
1476
|
};
|
|
1468
1477
|
const getOptions = fn => {
|
|
1469
1478
|
if (fn.passive) {
|
|
@@ -1638,7 +1647,7 @@ const removeChild = ($Element, index) => {
|
|
|
1638
1647
|
const $Child = $Element.children[index];
|
|
1639
1648
|
$Child.remove();
|
|
1640
1649
|
};
|
|
1641
|
-
const add = ($Element, nodes) => {
|
|
1650
|
+
const add$1 = ($Element, nodes) => {
|
|
1642
1651
|
renderInternal($Element, nodes, {}, {});
|
|
1643
1652
|
};
|
|
1644
1653
|
const SetText = 1;
|
|
@@ -1666,7 +1675,7 @@ const applyPatch = ($Element, patches) => {
|
|
|
1666
1675
|
removeChild($Current, patch.index);
|
|
1667
1676
|
break;
|
|
1668
1677
|
case Add:
|
|
1669
|
-
add($Current, patch.nodes);
|
|
1678
|
+
add$1($Current, patch.nodes);
|
|
1670
1679
|
break;
|
|
1671
1680
|
case NavigateSibling:
|
|
1672
1681
|
$Current = $Current.parentNode.childNodes[patch.index];
|
|
@@ -1680,8 +1689,34 @@ const applyPatch = ($Element, patches) => {
|
|
|
1680
1689
|
}
|
|
1681
1690
|
}
|
|
1682
1691
|
};
|
|
1692
|
+
let id = 0;
|
|
1693
|
+
const create$H = () => {
|
|
1694
|
+
return ++id;
|
|
1695
|
+
};
|
|
1696
|
+
const state$8 = Object.create(null);
|
|
1697
|
+
const get$8 = id => {
|
|
1698
|
+
return state$8[id];
|
|
1699
|
+
};
|
|
1700
|
+
const getFileHandles = async ids => {
|
|
1701
|
+
const promises = ids.map(id => get$8(id));
|
|
1702
|
+
const handles = await Promise.all(promises);
|
|
1703
|
+
return handles;
|
|
1704
|
+
};
|
|
1705
|
+
const add = promise => {
|
|
1706
|
+
const id = create$H();
|
|
1707
|
+
state$8[id] = promise;
|
|
1708
|
+
return id;
|
|
1709
|
+
};
|
|
1710
|
+
const handleDataTransferFiles = async event => {
|
|
1711
|
+
const items = [...event.dataTransfer.items];
|
|
1712
|
+
const promises = items.map(item => item.getAsFileSystemHandle());
|
|
1713
|
+
const ids = promises.map(promise => add(promise));
|
|
1714
|
+
return ids;
|
|
1715
|
+
};
|
|
1683
1716
|
const getEventListenerArg = (param, event) => {
|
|
1684
1717
|
switch (param) {
|
|
1718
|
+
case 'event.dataTransfer.files2':
|
|
1719
|
+
return handleDataTransferFiles(event);
|
|
1685
1720
|
case 'event.clientX':
|
|
1686
1721
|
return event.clientX;
|
|
1687
1722
|
case 'event.x':
|
|
@@ -1859,7 +1894,7 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
|
|
|
1859
1894
|
};
|
|
1860
1895
|
|
|
1861
1896
|
const set$6 = setComponentUid;
|
|
1862
|
-
const get$
|
|
1897
|
+
const get$7 = getComponentUid;
|
|
1863
1898
|
const fromEvent = getComponentUidFromEvent;
|
|
1864
1899
|
|
|
1865
1900
|
const applyUidWorkaround = element => {
|
|
@@ -1869,7 +1904,7 @@ const applyUidWorkaround = element => {
|
|
|
1869
1904
|
if (!editor) {
|
|
1870
1905
|
throw new Error('no editor found');
|
|
1871
1906
|
}
|
|
1872
|
-
const editorUid = get$
|
|
1907
|
+
const editorUid = get$7(editor);
|
|
1873
1908
|
set$6(element, editorUid);
|
|
1874
1909
|
};
|
|
1875
1910
|
|
|
@@ -4152,15 +4187,15 @@ const play = async src => {
|
|
|
4152
4187
|
await audio.play();
|
|
4153
4188
|
};
|
|
4154
4189
|
|
|
4155
|
-
const name$
|
|
4156
|
-
const Commands$
|
|
4190
|
+
const name$z = 'Audio';
|
|
4191
|
+
const Commands$A = {
|
|
4157
4192
|
play: play
|
|
4158
4193
|
};
|
|
4159
4194
|
|
|
4160
4195
|
const Audio_ipc = {
|
|
4161
4196
|
__proto__: null,
|
|
4162
|
-
Commands: Commands$
|
|
4163
|
-
name: name$
|
|
4197
|
+
Commands: Commands$A,
|
|
4198
|
+
name: name$z
|
|
4164
4199
|
};
|
|
4165
4200
|
|
|
4166
4201
|
const readText = async () => {
|
|
@@ -4181,8 +4216,8 @@ const execCopy = async () => {
|
|
|
4181
4216
|
await writeText(text);
|
|
4182
4217
|
};
|
|
4183
4218
|
|
|
4184
|
-
const name$
|
|
4185
|
-
const Commands$
|
|
4219
|
+
const name$y = 'ClipBoard';
|
|
4220
|
+
const Commands$z = {
|
|
4186
4221
|
execCopy: execCopy,
|
|
4187
4222
|
readText: readText,
|
|
4188
4223
|
writeImage: writeImage,
|
|
@@ -4191,20 +4226,36 @@ const Commands$y = {
|
|
|
4191
4226
|
|
|
4192
4227
|
const ClipBoard_ipc = {
|
|
4193
4228
|
__proto__: null,
|
|
4194
|
-
Commands: Commands$
|
|
4195
|
-
name: name$
|
|
4229
|
+
Commands: Commands$z,
|
|
4230
|
+
name: name$y
|
|
4196
4231
|
};
|
|
4197
4232
|
|
|
4198
4233
|
const prompt$1 = message => {
|
|
4199
4234
|
return confirm(message);
|
|
4200
4235
|
};
|
|
4201
4236
|
|
|
4202
|
-
const name$
|
|
4203
|
-
const Commands$
|
|
4237
|
+
const name$x = 'ConfirmPrompt';
|
|
4238
|
+
const Commands$y = {
|
|
4204
4239
|
prompt: prompt$1
|
|
4205
4240
|
};
|
|
4206
4241
|
|
|
4207
4242
|
const ConfirmPrompt_ipc = {
|
|
4243
|
+
__proto__: null,
|
|
4244
|
+
Commands: Commands$y,
|
|
4245
|
+
name: name$x
|
|
4246
|
+
};
|
|
4247
|
+
|
|
4248
|
+
const get$6 = ids => {
|
|
4249
|
+
// @ts-ignore
|
|
4250
|
+
return getFileHandles(ids);
|
|
4251
|
+
};
|
|
4252
|
+
|
|
4253
|
+
const name$w = 'FileHandles';
|
|
4254
|
+
const Commands$x = {
|
|
4255
|
+
get: get$6
|
|
4256
|
+
};
|
|
4257
|
+
|
|
4258
|
+
const FileHandles_ipc = {
|
|
4208
4259
|
__proto__: null,
|
|
4209
4260
|
Commands: Commands$x,
|
|
4210
4261
|
name: name$w
|
|
@@ -4590,7 +4641,7 @@ const InitData_ipc = {
|
|
|
4590
4641
|
|
|
4591
4642
|
const name$n = 'IpcParent';
|
|
4592
4643
|
const Commands$o = {
|
|
4593
|
-
create: create$
|
|
4644
|
+
create: create$I
|
|
4594
4645
|
};
|
|
4595
4646
|
|
|
4596
4647
|
const IpcParent_ipc = {
|
|
@@ -8548,7 +8599,7 @@ const getUid = () => {
|
|
|
8548
8599
|
if (!$Main) {
|
|
8549
8600
|
return 0;
|
|
8550
8601
|
}
|
|
8551
|
-
return get$
|
|
8602
|
+
return get$7($Main);
|
|
8552
8603
|
};
|
|
8553
8604
|
const handleTabsWheel = event => {
|
|
8554
8605
|
const uid = getUid();
|
|
@@ -10393,7 +10444,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
10393
10444
|
let uid;
|
|
10394
10445
|
if ($Viewlet) {
|
|
10395
10446
|
try {
|
|
10396
|
-
uid = get$
|
|
10447
|
+
uid = get$7($Viewlet);
|
|
10397
10448
|
} catch {}
|
|
10398
10449
|
}
|
|
10399
10450
|
// TODO optimize rendering with virtual dom diffing
|