@lvce-editor/renderer-process 11.4.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 +95 -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) {
|
|
@@ -1551,6 +1560,12 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
|
|
|
1551
1560
|
case 'onClick':
|
|
1552
1561
|
case 'onContextMenu':
|
|
1553
1562
|
case 'onDblClick':
|
|
1563
|
+
case 'onDragEnd':
|
|
1564
|
+
case 'onDragEnter':
|
|
1565
|
+
case 'onDragLeave':
|
|
1566
|
+
case 'onDragOver':
|
|
1567
|
+
case 'onDragStart':
|
|
1568
|
+
case 'onDrop':
|
|
1554
1569
|
case 'onFocus':
|
|
1555
1570
|
case 'onFocusIn':
|
|
1556
1571
|
case 'onFocusOut':
|
|
@@ -1632,7 +1647,7 @@ const removeChild = ($Element, index) => {
|
|
|
1632
1647
|
const $Child = $Element.children[index];
|
|
1633
1648
|
$Child.remove();
|
|
1634
1649
|
};
|
|
1635
|
-
const add = ($Element, nodes) => {
|
|
1650
|
+
const add$1 = ($Element, nodes) => {
|
|
1636
1651
|
renderInternal($Element, nodes, {}, {});
|
|
1637
1652
|
};
|
|
1638
1653
|
const SetText = 1;
|
|
@@ -1660,7 +1675,7 @@ const applyPatch = ($Element, patches) => {
|
|
|
1660
1675
|
removeChild($Current, patch.index);
|
|
1661
1676
|
break;
|
|
1662
1677
|
case Add:
|
|
1663
|
-
add($Current, patch.nodes);
|
|
1678
|
+
add$1($Current, patch.nodes);
|
|
1664
1679
|
break;
|
|
1665
1680
|
case NavigateSibling:
|
|
1666
1681
|
$Current = $Current.parentNode.childNodes[patch.index];
|
|
@@ -1674,8 +1689,34 @@ const applyPatch = ($Element, patches) => {
|
|
|
1674
1689
|
}
|
|
1675
1690
|
}
|
|
1676
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
|
+
};
|
|
1677
1716
|
const getEventListenerArg = (param, event) => {
|
|
1678
1717
|
switch (param) {
|
|
1718
|
+
case 'event.dataTransfer.files2':
|
|
1719
|
+
return handleDataTransferFiles(event);
|
|
1679
1720
|
case 'event.clientX':
|
|
1680
1721
|
return event.clientX;
|
|
1681
1722
|
case 'event.x':
|
|
@@ -1690,6 +1731,8 @@ const getEventListenerArg = (param, event) => {
|
|
|
1690
1731
|
return event.target.value;
|
|
1691
1732
|
case 'event.isTrusted':
|
|
1692
1733
|
return event.isTrusted;
|
|
1734
|
+
case 'event.dataTransfer.files':
|
|
1735
|
+
return event.dataTransfer.files;
|
|
1693
1736
|
case 'event.target.className':
|
|
1694
1737
|
return event.target.className;
|
|
1695
1738
|
case 'event.data':
|
|
@@ -1851,7 +1894,7 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
|
|
|
1851
1894
|
};
|
|
1852
1895
|
|
|
1853
1896
|
const set$6 = setComponentUid;
|
|
1854
|
-
const get$
|
|
1897
|
+
const get$7 = getComponentUid;
|
|
1855
1898
|
const fromEvent = getComponentUidFromEvent;
|
|
1856
1899
|
|
|
1857
1900
|
const applyUidWorkaround = element => {
|
|
@@ -1861,7 +1904,7 @@ const applyUidWorkaround = element => {
|
|
|
1861
1904
|
if (!editor) {
|
|
1862
1905
|
throw new Error('no editor found');
|
|
1863
1906
|
}
|
|
1864
|
-
const editorUid = get$
|
|
1907
|
+
const editorUid = get$7(editor);
|
|
1865
1908
|
set$6(element, editorUid);
|
|
1866
1909
|
};
|
|
1867
1910
|
|
|
@@ -4144,15 +4187,15 @@ const play = async src => {
|
|
|
4144
4187
|
await audio.play();
|
|
4145
4188
|
};
|
|
4146
4189
|
|
|
4147
|
-
const name$
|
|
4148
|
-
const Commands$
|
|
4190
|
+
const name$z = 'Audio';
|
|
4191
|
+
const Commands$A = {
|
|
4149
4192
|
play: play
|
|
4150
4193
|
};
|
|
4151
4194
|
|
|
4152
4195
|
const Audio_ipc = {
|
|
4153
4196
|
__proto__: null,
|
|
4154
|
-
Commands: Commands$
|
|
4155
|
-
name: name$
|
|
4197
|
+
Commands: Commands$A,
|
|
4198
|
+
name: name$z
|
|
4156
4199
|
};
|
|
4157
4200
|
|
|
4158
4201
|
const readText = async () => {
|
|
@@ -4173,8 +4216,8 @@ const execCopy = async () => {
|
|
|
4173
4216
|
await writeText(text);
|
|
4174
4217
|
};
|
|
4175
4218
|
|
|
4176
|
-
const name$
|
|
4177
|
-
const Commands$
|
|
4219
|
+
const name$y = 'ClipBoard';
|
|
4220
|
+
const Commands$z = {
|
|
4178
4221
|
execCopy: execCopy,
|
|
4179
4222
|
readText: readText,
|
|
4180
4223
|
writeImage: writeImage,
|
|
@@ -4183,20 +4226,36 @@ const Commands$y = {
|
|
|
4183
4226
|
|
|
4184
4227
|
const ClipBoard_ipc = {
|
|
4185
4228
|
__proto__: null,
|
|
4186
|
-
Commands: Commands$
|
|
4187
|
-
name: name$
|
|
4229
|
+
Commands: Commands$z,
|
|
4230
|
+
name: name$y
|
|
4188
4231
|
};
|
|
4189
4232
|
|
|
4190
4233
|
const prompt$1 = message => {
|
|
4191
4234
|
return confirm(message);
|
|
4192
4235
|
};
|
|
4193
4236
|
|
|
4194
|
-
const name$
|
|
4195
|
-
const Commands$
|
|
4237
|
+
const name$x = 'ConfirmPrompt';
|
|
4238
|
+
const Commands$y = {
|
|
4196
4239
|
prompt: prompt$1
|
|
4197
4240
|
};
|
|
4198
4241
|
|
|
4199
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 = {
|
|
4200
4259
|
__proto__: null,
|
|
4201
4260
|
Commands: Commands$x,
|
|
4202
4261
|
name: name$w
|
|
@@ -4582,7 +4641,7 @@ const InitData_ipc = {
|
|
|
4582
4641
|
|
|
4583
4642
|
const name$n = 'IpcParent';
|
|
4584
4643
|
const Commands$o = {
|
|
4585
|
-
create: create$
|
|
4644
|
+
create: create$I
|
|
4586
4645
|
};
|
|
4587
4646
|
|
|
4588
4647
|
const IpcParent_ipc = {
|
|
@@ -8540,7 +8599,7 @@ const getUid = () => {
|
|
|
8540
8599
|
if (!$Main) {
|
|
8541
8600
|
return 0;
|
|
8542
8601
|
}
|
|
8543
|
-
return get$
|
|
8602
|
+
return get$7($Main);
|
|
8544
8603
|
};
|
|
8545
8604
|
const handleTabsWheel = event => {
|
|
8546
8605
|
const uid = getUid();
|
|
@@ -10385,7 +10444,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
10385
10444
|
let uid;
|
|
10386
10445
|
if ($Viewlet) {
|
|
10387
10446
|
try {
|
|
10388
|
-
uid = get$
|
|
10447
|
+
uid = get$7($Viewlet);
|
|
10389
10448
|
} catch {}
|
|
10390
10449
|
}
|
|
10391
10450
|
// TODO optimize rendering with virtual dom diffing
|