@lvce-editor/renderer-process 30.71.1 → 30.72.1
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 +104 -38
- package/package.json +1 -1
|
@@ -629,7 +629,7 @@ class CommandNotFoundError extends Error {
|
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
631
|
const commands = Object.create(null);
|
|
632
|
-
const register = commandMap => {
|
|
632
|
+
const register$1 = commandMap => {
|
|
633
633
|
Object.assign(commands, commandMap);
|
|
634
634
|
};
|
|
635
635
|
const getCommand = key => {
|
|
@@ -1164,7 +1164,7 @@ const create$F = async ({
|
|
|
1164
1164
|
window
|
|
1165
1165
|
}) => {
|
|
1166
1166
|
// TODO create a commandMap per rpc instance
|
|
1167
|
-
register(commandMap);
|
|
1167
|
+
register$1(commandMap);
|
|
1168
1168
|
const ipc = IpcChildWithElectronWindow$1.wrap(window);
|
|
1169
1169
|
handleIpc(ipc);
|
|
1170
1170
|
const rpc = createRpc(ipc);
|
|
@@ -1177,7 +1177,7 @@ const create$E = async ({
|
|
|
1177
1177
|
messagePort
|
|
1178
1178
|
}) => {
|
|
1179
1179
|
// TODO create a commandMap per rpc instance
|
|
1180
|
-
register(commandMap);
|
|
1180
|
+
register$1(commandMap);
|
|
1181
1181
|
const rawIpc = await IpcParentWithMessagePort$1$1.create({
|
|
1182
1182
|
isMessagePortOpen,
|
|
1183
1183
|
messagePort
|
|
@@ -1199,7 +1199,7 @@ const create$D = async ({
|
|
|
1199
1199
|
url
|
|
1200
1200
|
}) => {
|
|
1201
1201
|
// TODO create a commandMap per rpc instance
|
|
1202
|
-
register(commandMap);
|
|
1202
|
+
register$1(commandMap);
|
|
1203
1203
|
const worker = await IpcParentWithModuleWorker$1$1.create({
|
|
1204
1204
|
name,
|
|
1205
1205
|
url
|
|
@@ -1220,7 +1220,7 @@ const create$C = async ({
|
|
|
1220
1220
|
url
|
|
1221
1221
|
}) => {
|
|
1222
1222
|
// TODO create a commandMap per rpc instance
|
|
1223
|
-
register(commandMap);
|
|
1223
|
+
register$1(commandMap);
|
|
1224
1224
|
const worker = await IpcParentWithModuleWorker$1$1.create({
|
|
1225
1225
|
name,
|
|
1226
1226
|
url
|
|
@@ -1783,7 +1783,7 @@ const hydrate$4 = async () => {
|
|
|
1783
1783
|
};
|
|
1784
1784
|
|
|
1785
1785
|
// TODO needed?
|
|
1786
|
-
const dispose$
|
|
1786
|
+
const dispose$o = async () => {
|
|
1787
1787
|
const rpc = state$l.rpc;
|
|
1788
1788
|
state$l.rpc = undefined;
|
|
1789
1789
|
await rpc?.dispose();
|
|
@@ -1965,7 +1965,7 @@ const initializeLayout = async href => {
|
|
|
1965
1965
|
}
|
|
1966
1966
|
return true;
|
|
1967
1967
|
};
|
|
1968
|
-
const dispose$
|
|
1968
|
+
const dispose$n = async () => {
|
|
1969
1969
|
state$k.stopObserving?.();
|
|
1970
1970
|
state$k.stopObserving = undefined;
|
|
1971
1971
|
const client = state$k.client;
|
|
@@ -4160,7 +4160,7 @@ const handleMessagePort$1 = async port => {
|
|
|
4160
4160
|
}
|
|
4161
4161
|
await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
|
|
4162
4162
|
};
|
|
4163
|
-
const dispose$
|
|
4163
|
+
const dispose$m = async () => {
|
|
4164
4164
|
const rpc = state$g.rpc;
|
|
4165
4165
|
state$g.rpc = undefined;
|
|
4166
4166
|
await rpc?.dispose();
|
|
@@ -4179,6 +4179,7 @@ const clear$4 = () => {
|
|
|
4179
4179
|
rpcs.clear();
|
|
4180
4180
|
viewRpcIds.clear();
|
|
4181
4181
|
};
|
|
4182
|
+
const getRpcId = uid => viewRpcIds.get(uid);
|
|
4182
4183
|
const get$8 = uid => {
|
|
4183
4184
|
const rpcId = viewRpcIds.get(uid);
|
|
4184
4185
|
return rpcId === undefined ? undefined : rpcs.get(rpcId);
|
|
@@ -4659,7 +4660,7 @@ const create$u = async ({
|
|
|
4659
4660
|
// @ts-ignore
|
|
4660
4661
|
return module.create(options);
|
|
4661
4662
|
};
|
|
4662
|
-
const dispose$
|
|
4663
|
+
const dispose$l = id => {
|
|
4663
4664
|
const worker = remove$3(id);
|
|
4664
4665
|
if (worker) {
|
|
4665
4666
|
remove$5(worker);
|
|
@@ -4778,7 +4779,7 @@ const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
|
|
|
4778
4779
|
}
|
|
4779
4780
|
applyPatch$2(element, patches, eventMap, id);
|
|
4780
4781
|
};
|
|
4781
|
-
const dispose$
|
|
4782
|
+
const dispose$k = root => {
|
|
4782
4783
|
state$e.renderer?.dispose(root);
|
|
4783
4784
|
};
|
|
4784
4785
|
|
|
@@ -4931,6 +4932,89 @@ const info = (...args) => {
|
|
|
4931
4932
|
console.info(...args);
|
|
4932
4933
|
};
|
|
4933
4934
|
|
|
4935
|
+
const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
|
|
4936
|
+
const send = (method, uid, ...args) => {
|
|
4937
|
+
// Editor shortcuts still execute through renderer-worker. Keep their input
|
|
4938
|
+
// events on the same port so typing cannot overtake a preceding shortcut.
|
|
4939
|
+
if (method === executeViewletCommand$1 && getRpcId(uid) !== 'Editor') {
|
|
4940
|
+
const rpc = get$8(uid);
|
|
4941
|
+
if (rpc) {
|
|
4942
|
+
rpc.send(method, uid, ...args);
|
|
4943
|
+
return;
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
send$1(method, uid, ...args);
|
|
4947
|
+
};
|
|
4948
|
+
|
|
4949
|
+
const ViewletEventRouter = {
|
|
4950
|
+
__proto__: null,
|
|
4951
|
+
send
|
|
4952
|
+
};
|
|
4953
|
+
|
|
4954
|
+
const executeViewletCommand = (uid, command, ...args) => {
|
|
4955
|
+
number(uid);
|
|
4956
|
+
send('Viewlet.executeViewletCommand', uid, command, ...args);
|
|
4957
|
+
};
|
|
4958
|
+
|
|
4959
|
+
const cleanups = new Map();
|
|
4960
|
+
const dispose$j = uid => {
|
|
4961
|
+
cleanups.get(uid)?.();
|
|
4962
|
+
cleanups.delete(uid);
|
|
4963
|
+
};
|
|
4964
|
+
|
|
4965
|
+
// The owner controls the lifetime; events can target the component owning a widget.
|
|
4966
|
+
const register = (uid, targetUid, listeners) => {
|
|
4967
|
+
dispose$j(uid);
|
|
4968
|
+
const root = get$b(uid)?.state.$Viewlet;
|
|
4969
|
+
if (!root) {
|
|
4970
|
+
return;
|
|
4971
|
+
}
|
|
4972
|
+
let active = true;
|
|
4973
|
+
const removals = [];
|
|
4974
|
+
const isInside = (target, selectors) => {
|
|
4975
|
+
if (!(target instanceof Element)) {
|
|
4976
|
+
return false;
|
|
4977
|
+
}
|
|
4978
|
+
if (get$b(uid)?.state.$Viewlet.contains(target)) {
|
|
4979
|
+
return true;
|
|
4980
|
+
}
|
|
4981
|
+
const parentRoot = get$b(targetUid)?.state.$Viewlet;
|
|
4982
|
+
return selectors.some(selector => {
|
|
4983
|
+
const match = target.closest(selector);
|
|
4984
|
+
return match && parentRoot?.contains(match);
|
|
4985
|
+
});
|
|
4986
|
+
};
|
|
4987
|
+
for (const listener of listeners) {
|
|
4988
|
+
const {
|
|
4989
|
+
event,
|
|
4990
|
+
ignoreSelectors,
|
|
4991
|
+
params
|
|
4992
|
+
} = listener;
|
|
4993
|
+
const notify = target => {
|
|
4994
|
+
if (active && !isInside(target, ignoreSelectors)) {
|
|
4995
|
+
executeViewletCommand(targetUid, params[0], ...params.slice(1));
|
|
4996
|
+
}
|
|
4997
|
+
};
|
|
4998
|
+
const handleEvent = event => {
|
|
4999
|
+
if (event.type === 'focusout') {
|
|
5000
|
+
// DOM replacement can briefly clear focus before a following focus command.
|
|
5001
|
+
queueMicrotask(() => notify(document.activeElement));
|
|
5002
|
+
} else {
|
|
5003
|
+
notify(event.target);
|
|
5004
|
+
}
|
|
5005
|
+
};
|
|
5006
|
+
const target = event === 'focusout' ? root : document;
|
|
5007
|
+
target.addEventListener(event, handleEvent);
|
|
5008
|
+
removals.push(() => target.removeEventListener(event, handleEvent));
|
|
5009
|
+
}
|
|
5010
|
+
cleanups.set(uid, () => {
|
|
5011
|
+
active = false;
|
|
5012
|
+
for (const remove of removals) {
|
|
5013
|
+
remove();
|
|
5014
|
+
}
|
|
5015
|
+
});
|
|
5016
|
+
};
|
|
5017
|
+
|
|
4934
5018
|
const pendingBatches = new Map();
|
|
4935
5019
|
const state$a = {
|
|
4936
5020
|
nextTransactionId: 1
|
|
@@ -5326,28 +5410,6 @@ const ViewletActivityBar = {
|
|
|
5326
5410
|
Events: Events$6
|
|
5327
5411
|
};
|
|
5328
5412
|
|
|
5329
|
-
const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
|
|
5330
|
-
const send = (method, uid, ...args) => {
|
|
5331
|
-
if (method === executeViewletCommand$1) {
|
|
5332
|
-
const rpc = get$8(uid);
|
|
5333
|
-
if (rpc) {
|
|
5334
|
-
rpc.send(method, uid, ...args);
|
|
5335
|
-
return;
|
|
5336
|
-
}
|
|
5337
|
-
}
|
|
5338
|
-
send$1(method, uid, ...args);
|
|
5339
|
-
};
|
|
5340
|
-
|
|
5341
|
-
const ViewletEventRouter = {
|
|
5342
|
-
__proto__: null,
|
|
5343
|
-
send
|
|
5344
|
-
};
|
|
5345
|
-
|
|
5346
|
-
const executeViewletCommand = (uid, command, ...args) => {
|
|
5347
|
-
number(uid);
|
|
5348
|
-
send('Viewlet.executeViewletCommand', uid, command, ...args);
|
|
5349
|
-
};
|
|
5350
|
-
|
|
5351
5413
|
const nameAnonymousFunction = (fn, name) => {
|
|
5352
5414
|
Object.defineProperty(fn, 'name', {
|
|
5353
5415
|
value: name
|
|
@@ -9421,7 +9483,7 @@ const create$4 = (id, uid = id) => {
|
|
|
9421
9483
|
state: instanceState
|
|
9422
9484
|
});
|
|
9423
9485
|
};
|
|
9424
|
-
const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId) => {
|
|
9486
|
+
const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId, eventTargetUid = uid) => {
|
|
9425
9487
|
let module = state$5.modules[id];
|
|
9426
9488
|
if (hasFunctionalEvents) {
|
|
9427
9489
|
module ||= {};
|
|
@@ -9429,7 +9491,8 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
|
|
|
9429
9491
|
if (!module) {
|
|
9430
9492
|
throw new Error(`module not found: ${id}`);
|
|
9431
9493
|
}
|
|
9432
|
-
const existing = get$b(
|
|
9494
|
+
const existing = get$b(uid);
|
|
9495
|
+
dispose$j(uid);
|
|
9433
9496
|
if (existing?.state.$Viewlet.isConnected) {
|
|
9434
9497
|
existing.state.$Viewlet.remove();
|
|
9435
9498
|
}
|
|
@@ -9438,6 +9501,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
|
|
|
9438
9501
|
};
|
|
9439
9502
|
set$a(instanceState.$Viewlet, uid);
|
|
9440
9503
|
if (existing) dispose$i(uid);
|
|
9504
|
+
set$a(instanceState.$Viewlet, eventTargetUid);
|
|
9441
9505
|
registerView(uid, directEventRpcId);
|
|
9442
9506
|
set$c(uid, {
|
|
9443
9507
|
factory: module,
|
|
@@ -9931,6 +9995,7 @@ const dispose$4 = id => {
|
|
|
9931
9995
|
try {
|
|
9932
9996
|
number(id);
|
|
9933
9997
|
restoreComponentDom(id);
|
|
9998
|
+
dispose$j(id);
|
|
9934
9999
|
unregisterView(id);
|
|
9935
10000
|
dispose$i(id);
|
|
9936
10001
|
const instance = get$b(id);
|
|
@@ -9941,7 +10006,7 @@ const dispose$4 = id => {
|
|
|
9941
10006
|
if (instance.factory.dispose) {
|
|
9942
10007
|
instance.factory.dispose(instance.state);
|
|
9943
10008
|
}
|
|
9944
|
-
dispose$
|
|
10009
|
+
dispose$k(instance.state.$Viewlet);
|
|
9945
10010
|
if (instance.state.$Viewlet?.isConnected) {
|
|
9946
10011
|
instance.state.$Viewlet.remove();
|
|
9947
10012
|
}
|
|
@@ -10220,6 +10285,7 @@ const commandHandlers = {
|
|
|
10220
10285
|
'Viewlet.move': move,
|
|
10221
10286
|
'Viewlet.patchCss': patchCssStyleSheet,
|
|
10222
10287
|
'Viewlet.registerEventListeners': registerEventListeners,
|
|
10288
|
+
'Viewlet.registerOutsideEventListeners': register,
|
|
10223
10289
|
'Viewlet.removeKeyBindings': removeKeyBindings,
|
|
10224
10290
|
'Viewlet.renderCanvas': renderCanvas,
|
|
10225
10291
|
'Viewlet.replaceChildren': replaceChildren,
|
|
@@ -10276,9 +10342,9 @@ const restart = async () => {
|
|
|
10276
10342
|
const snapshot = await invoke$1('Reload.prepareHotReload');
|
|
10277
10343
|
set$9(snapshot);
|
|
10278
10344
|
await invoke$1('Reload.retire');
|
|
10279
|
-
await dispose$m();
|
|
10280
10345
|
await dispose$n();
|
|
10281
|
-
await dispose$
|
|
10346
|
+
await dispose$o();
|
|
10347
|
+
await dispose$m();
|
|
10282
10348
|
terminateAll();
|
|
10283
10349
|
clear$2();
|
|
10284
10350
|
clear$4();
|
|
@@ -12327,7 +12393,7 @@ const commandMap = {
|
|
|
12327
12393
|
'HotReload.request': request,
|
|
12328
12394
|
'InitData.getInitData': getInitData,
|
|
12329
12395
|
'IpcParent.create': create$u,
|
|
12330
|
-
'IpcParent.dispose': dispose$
|
|
12396
|
+
'IpcParent.dispose': dispose$l,
|
|
12331
12397
|
'KeyBindings.setIdentifiers': setIdentifiers,
|
|
12332
12398
|
'Layout.getBounds': getBounds,
|
|
12333
12399
|
'Location.getHref': getHref,
|