@lvce-editor/renderer-process 30.76.1 → 30.78.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 +90 -9
- 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$
|
|
632
|
+
const register$3 = commandMap => {
|
|
633
633
|
Object.assign(commands, commandMap);
|
|
634
634
|
};
|
|
635
635
|
const getCommand = key => {
|
|
@@ -1164,7 +1164,7 @@ const create$E = async ({
|
|
|
1164
1164
|
window
|
|
1165
1165
|
}) => {
|
|
1166
1166
|
// TODO create a commandMap per rpc instance
|
|
1167
|
-
register$
|
|
1167
|
+
register$3(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$D = async ({
|
|
|
1177
1177
|
messagePort
|
|
1178
1178
|
}) => {
|
|
1179
1179
|
// TODO create a commandMap per rpc instance
|
|
1180
|
-
register$
|
|
1180
|
+
register$3(commandMap);
|
|
1181
1181
|
const rawIpc = await IpcParentWithMessagePort$1$1.create({
|
|
1182
1182
|
isMessagePortOpen,
|
|
1183
1183
|
messagePort
|
|
@@ -1199,7 +1199,7 @@ const create$C = async ({
|
|
|
1199
1199
|
url
|
|
1200
1200
|
}) => {
|
|
1201
1201
|
// TODO create a commandMap per rpc instance
|
|
1202
|
-
register$
|
|
1202
|
+
register$3(commandMap);
|
|
1203
1203
|
const worker = await IpcParentWithModuleWorker$1$1.create({
|
|
1204
1204
|
name,
|
|
1205
1205
|
url
|
|
@@ -1220,7 +1220,7 @@ const create$B = async ({
|
|
|
1220
1220
|
url
|
|
1221
1221
|
}) => {
|
|
1222
1222
|
// TODO create a commandMap per rpc instance
|
|
1223
|
-
register$
|
|
1223
|
+
register$3(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$p = async () => {
|
|
1787
1787
|
const rpc = state$m.rpc;
|
|
1788
1788
|
state$m.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$o = async () => {
|
|
1969
1969
|
state$l.stopObserving?.();
|
|
1970
1970
|
state$l.stopObserving = undefined;
|
|
1971
1971
|
const client = state$l.client;
|
|
@@ -2012,6 +2012,76 @@ const initialize = () => {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
};
|
|
2014
2014
|
|
|
2015
|
+
const views = new Map();
|
|
2016
|
+
const normalize = value => typeof value === 'number' && Number.isFinite(value) && value >= 1 && value <= 3 ? value : 1;
|
|
2017
|
+
const register$2 = (uid, listeners, speed = 1) => {
|
|
2018
|
+
const commands = new Map();
|
|
2019
|
+
for (const {
|
|
2020
|
+
params = []
|
|
2021
|
+
} of listeners) {
|
|
2022
|
+
const indices = [];
|
|
2023
|
+
for (let i = 1; i < params.length; i++) {
|
|
2024
|
+
if (params[i] === 'event.deltaX' || params[i] === 'event.deltaY') indices.push(i);
|
|
2025
|
+
}
|
|
2026
|
+
if (indices.length > 0) commands.set(params[0], indices);
|
|
2027
|
+
}
|
|
2028
|
+
views.delete(uid);
|
|
2029
|
+
if (commands.size > 0) views.set(uid, {
|
|
2030
|
+
commands,
|
|
2031
|
+
speed: normalize(speed)
|
|
2032
|
+
});
|
|
2033
|
+
};
|
|
2034
|
+
const set$d = (uid, speed) => {
|
|
2035
|
+
const view = views.get(uid);
|
|
2036
|
+
if (view) view.speed = normalize(speed);
|
|
2037
|
+
};
|
|
2038
|
+
const apply = (uid, args) => {
|
|
2039
|
+
const view = views.get(uid);
|
|
2040
|
+
const indices = view?.commands.get(args[0]);
|
|
2041
|
+
if (!view || view.speed === 1 || !indices) return args;
|
|
2042
|
+
const scaled = [...args];
|
|
2043
|
+
for (const index of indices) scaled[index] *= view.speed;
|
|
2044
|
+
return scaled;
|
|
2045
|
+
};
|
|
2046
|
+
const dispose$n = uid => {
|
|
2047
|
+
views.delete(uid);
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
// Measuring a prefix in isolation changes Arabic joining and ligatures. Use a
|
|
2051
|
+
// native Range within the full directional run to retain the shaping context.
|
|
2052
|
+
const measurePrefix = (text, offset, fontWeight, fontSize, fontFamily, letterSpacing, direction) => {
|
|
2053
|
+
string(text);
|
|
2054
|
+
number(offset);
|
|
2055
|
+
number(fontWeight);
|
|
2056
|
+
number(fontSize);
|
|
2057
|
+
string(fontFamily);
|
|
2058
|
+
number(letterSpacing);
|
|
2059
|
+
const element = document.createElement('span');
|
|
2060
|
+
element.style.position = 'fixed';
|
|
2061
|
+
element.style.visibility = 'hidden';
|
|
2062
|
+
element.style.whiteSpace = 'pre';
|
|
2063
|
+
element.style.fontWeight = String(fontWeight);
|
|
2064
|
+
element.style.fontSize = `${fontSize}px`;
|
|
2065
|
+
element.style.fontFamily = fontFamily;
|
|
2066
|
+
element.style.letterSpacing = `${letterSpacing}px`;
|
|
2067
|
+
element.style.direction = direction;
|
|
2068
|
+
element.style.unicodeBidi = 'bidi-override';
|
|
2069
|
+
element.textContent = text;
|
|
2070
|
+
document.body.append(element);
|
|
2071
|
+
try {
|
|
2072
|
+
if (!element.firstChild) {
|
|
2073
|
+
return 0;
|
|
2074
|
+
}
|
|
2075
|
+
const range = document.createRange();
|
|
2076
|
+
range.setStart(element.firstChild, 0);
|
|
2077
|
+
const end = Math.max(0, Math.min(text.length, Math.trunc(offset)));
|
|
2078
|
+
range.setEnd(element.firstChild, end);
|
|
2079
|
+
return range.getBoundingClientRect().width;
|
|
2080
|
+
} finally {
|
|
2081
|
+
element.remove();
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
|
|
2015
2085
|
const pendingInputs = new Set();
|
|
2016
2086
|
const state$k = {
|
|
2017
2087
|
shortcut: undefined
|
|
@@ -2915,7 +2985,7 @@ const createFn = (info, map) => {
|
|
|
2915
2985
|
};
|
|
2916
2986
|
|
|
2917
2987
|
const listeners = Object.create(null);
|
|
2918
|
-
const registerEventListeners = (id, eventListeners) => {
|
|
2988
|
+
const registerEventListeners$1 = (id, eventListeners) => {
|
|
2919
2989
|
const map = Object.create(null);
|
|
2920
2990
|
for (const info of eventListeners) {
|
|
2921
2991
|
const fn = createFn(info, map);
|
|
@@ -5388,6 +5458,7 @@ const sendKeyBinding = identifier => {
|
|
|
5388
5458
|
};
|
|
5389
5459
|
const send = (method, uid, ...args) => {
|
|
5390
5460
|
if (method === executeViewletCommand$1) {
|
|
5461
|
+
args = apply(uid, args);
|
|
5391
5462
|
const rpc = get$8(uid);
|
|
5392
5463
|
if (rpc) {
|
|
5393
5464
|
if (getRpcId(uid) === 'Editor' && args[0] !== 'handleBlur' && args[0] !== 'handleFocus') {
|
|
@@ -5525,6 +5596,11 @@ const dispose$i = uid => {
|
|
|
5525
5596
|
}
|
|
5526
5597
|
};
|
|
5527
5598
|
|
|
5599
|
+
const registerEventListeners = (uid, listeners, scrollSpeed = 1) => {
|
|
5600
|
+
register$2(uid, listeners, scrollSpeed);
|
|
5601
|
+
registerEventListeners$1(uid, listeners);
|
|
5602
|
+
};
|
|
5603
|
+
|
|
5528
5604
|
const rememberFocus = rememberFocus$1;
|
|
5529
5605
|
|
|
5530
5606
|
const getColor = ($Parent, className) => {
|
|
@@ -10295,6 +10371,7 @@ const dispose$4 = id => {
|
|
|
10295
10371
|
number(id);
|
|
10296
10372
|
restoreComponentDom(id);
|
|
10297
10373
|
dispose$j(id);
|
|
10374
|
+
dispose$n(id);
|
|
10298
10375
|
unregisterView(id);
|
|
10299
10376
|
dispose$i(id);
|
|
10300
10377
|
const instance = get$b(id);
|
|
@@ -10601,6 +10678,7 @@ const commandHandlers = {
|
|
|
10601
10678
|
'Viewlet.setInputValues': setInputValues,
|
|
10602
10679
|
'Viewlet.setPatches': setPatches,
|
|
10603
10680
|
'Viewlet.setProperty': setProperty,
|
|
10681
|
+
'Viewlet.setScrollSpeed': set$d,
|
|
10604
10682
|
'Viewlet.setSelectionByName': setSelectionByName,
|
|
10605
10683
|
'Viewlet.setTreePatches': setTreePatches,
|
|
10606
10684
|
'Viewlet.setUid': setUid,
|
|
@@ -10641,8 +10719,8 @@ const restart = async () => {
|
|
|
10641
10719
|
const snapshot = await invoke$1('Reload.prepareHotReload');
|
|
10642
10720
|
set$9(snapshot);
|
|
10643
10721
|
await invoke$1('Reload.retire');
|
|
10644
|
-
await dispose$n();
|
|
10645
10722
|
await dispose$o();
|
|
10723
|
+
await dispose$p();
|
|
10646
10724
|
await dispose$m();
|
|
10647
10725
|
terminateAll();
|
|
10648
10726
|
clear$2();
|
|
@@ -12339,6 +12417,7 @@ const forwardRendererWorkerCommand = (method, ...params) => {
|
|
|
12339
12417
|
const handleMessagePort = async (port, rpcId) => {
|
|
12340
12418
|
const rpc = await create$A({
|
|
12341
12419
|
commandMap: {
|
|
12420
|
+
'MeasureBidi.measurePrefix': measurePrefix,
|
|
12342
12421
|
'Viewlet.forwardRendererWorkerCommand': forwardRendererWorkerCommand,
|
|
12343
12422
|
'Viewlet.queueCommands': queueCommands
|
|
12344
12423
|
},
|
|
@@ -12716,6 +12795,7 @@ const commandMap = {
|
|
|
12716
12795
|
'Location.setPathName': setPathName,
|
|
12717
12796
|
'Location.setWorkspaceUri': setWorkspaceUri,
|
|
12718
12797
|
'Main.openUri': openUri,
|
|
12798
|
+
'MeasureBidi.measurePrefix': measurePrefix,
|
|
12719
12799
|
'MeasureTextBlockHeight.measureTextBlockHeight': measureTextBlockHeight,
|
|
12720
12800
|
'MeasureTextHeight.measureTextHeight': measureTextHeight,
|
|
12721
12801
|
'Menu.focusIndex': focusIndex,
|
|
@@ -12789,6 +12869,7 @@ const commandMap = {
|
|
|
12789
12869
|
'Viewlet.sendMultiple': sendMultiple,
|
|
12790
12870
|
'Viewlet.setBounds': setBounds$1,
|
|
12791
12871
|
'Viewlet.setComponentDom': setComponentDom,
|
|
12872
|
+
'Viewlet.setScrollSpeed': set$d,
|
|
12792
12873
|
'Viewlet.show': show,
|
|
12793
12874
|
'VirtualDom.configure': configure,
|
|
12794
12875
|
'WebRtc.readMicLevels': readMicLevels,
|