@lvce-editor/renderer-process 30.38.1 → 30.40.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.
|
@@ -2619,6 +2619,18 @@ const focusSelectorAfterRender = (uid, selector) => {
|
|
|
2619
2619
|
});
|
|
2620
2620
|
});
|
|
2621
2621
|
};
|
|
2622
|
+
const scrollSelectorBy = (uid, selector, delta) => {
|
|
2623
|
+
const element = getElement(uid).querySelector(selector);
|
|
2624
|
+
if (element) {
|
|
2625
|
+
element.scrollLeft += delta;
|
|
2626
|
+
}
|
|
2627
|
+
};
|
|
2628
|
+
const scrollSelectorIntoView = (uid, selector) => {
|
|
2629
|
+
getElement(uid).querySelector(selector)?.scrollIntoView({
|
|
2630
|
+
block: 'nearest',
|
|
2631
|
+
inline: 'nearest'
|
|
2632
|
+
});
|
|
2633
|
+
};
|
|
2622
2634
|
const setBounds = (uid, left, top, width, height) => {
|
|
2623
2635
|
const element = getElement(uid);
|
|
2624
2636
|
element.style.left = `${left}px`;
|
|
@@ -2664,6 +2676,8 @@ const commandHandlers = {
|
|
|
2664
2676
|
'Viewlet.dispose': dispose,
|
|
2665
2677
|
'Viewlet.focusSelector': focusSelector,
|
|
2666
2678
|
'Viewlet.focusSelectorAfterRender': focusSelectorAfterRender,
|
|
2679
|
+
'Viewlet.scrollSelectorBy': scrollSelectorBy,
|
|
2680
|
+
'Viewlet.scrollSelectorIntoView': scrollSelectorIntoView,
|
|
2667
2681
|
'Viewlet.setAdditionalFocus': ignoreCommand,
|
|
2668
2682
|
'Viewlet.setBounds': setBounds,
|
|
2669
2683
|
'Viewlet.setCss': addCssStyleSheet,
|
|
@@ -3659,14 +3659,23 @@ const create$w = async ({
|
|
|
3659
3659
|
name,
|
|
3660
3660
|
port,
|
|
3661
3661
|
raw,
|
|
3662
|
+
rpcId,
|
|
3662
3663
|
url
|
|
3663
|
-
},
|
|
3664
|
-
const rpc = await
|
|
3664
|
+
}, createTransferredRpc = create$y, createNativeRpc = create$z) => {
|
|
3665
|
+
const rpc = await (rpcId === undefined ? createTransferredRpc({
|
|
3665
3666
|
commandMap: {},
|
|
3666
3667
|
name,
|
|
3667
3668
|
port,
|
|
3668
3669
|
url
|
|
3669
|
-
})
|
|
3670
|
+
}) : createNativeRpc({
|
|
3671
|
+
commandMap: {},
|
|
3672
|
+
name,
|
|
3673
|
+
url
|
|
3674
|
+
}));
|
|
3675
|
+
if (rpcId !== undefined) {
|
|
3676
|
+
await rpc.invokeAndTransfer('initialize', 'message-port', port);
|
|
3677
|
+
registerRpc(rpcId, rpc);
|
|
3678
|
+
}
|
|
3670
3679
|
const worker = rpc.ipc?._rawIpc;
|
|
3671
3680
|
if (typeof id === 'number' && raw && worker) {
|
|
3672
3681
|
set$7(id, worker);
|
|
@@ -3969,6 +3978,11 @@ const send$1 = (method, ...params) => {
|
|
|
3969
3978
|
// @ts-ignore
|
|
3970
3979
|
state$9.rpc.send(method, ...params);
|
|
3971
3980
|
};
|
|
3981
|
+
const invoke$1 = (method, ...params) => {
|
|
3982
|
+
record('sent', method, params);
|
|
3983
|
+
// @ts-ignore
|
|
3984
|
+
return state$9.rpc.invoke(method, ...params);
|
|
3985
|
+
};
|
|
3972
3986
|
const invokeAndTransfer = (method, ...params) => {
|
|
3973
3987
|
record('sent', method, params);
|
|
3974
3988
|
// @ts-ignore
|
|
@@ -9676,6 +9690,37 @@ const setProperty = (id, selector, property, value) => {
|
|
|
9676
9690
|
}
|
|
9677
9691
|
$Element[property] = value;
|
|
9678
9692
|
};
|
|
9693
|
+
const scrollSelectorBy = (id, selector, delta) => {
|
|
9694
|
+
const instance = get$a(id);
|
|
9695
|
+
if (!instance) {
|
|
9696
|
+
return;
|
|
9697
|
+
}
|
|
9698
|
+
const {
|
|
9699
|
+
$Viewlet
|
|
9700
|
+
} = instance.state;
|
|
9701
|
+
const $Element = $Viewlet.matches(selector) ? $Viewlet : $Viewlet.querySelector(selector);
|
|
9702
|
+
if (!($Element instanceof HTMLElement)) {
|
|
9703
|
+
return;
|
|
9704
|
+
}
|
|
9705
|
+
$Element.scrollLeft += delta;
|
|
9706
|
+
};
|
|
9707
|
+
const scrollSelectorIntoView = (id, selector) => {
|
|
9708
|
+
const instance = get$a(id);
|
|
9709
|
+
if (!instance) {
|
|
9710
|
+
return;
|
|
9711
|
+
}
|
|
9712
|
+
const {
|
|
9713
|
+
$Viewlet
|
|
9714
|
+
} = instance.state;
|
|
9715
|
+
const $Element = $Viewlet.matches(selector) ? $Viewlet : $Viewlet.querySelector(selector);
|
|
9716
|
+
if (!($Element instanceof HTMLElement)) {
|
|
9717
|
+
return;
|
|
9718
|
+
}
|
|
9719
|
+
$Element.scrollIntoView({
|
|
9720
|
+
block: 'nearest',
|
|
9721
|
+
inline: 'nearest'
|
|
9722
|
+
});
|
|
9723
|
+
};
|
|
9679
9724
|
const renderCanvas = (id, selector, canvasClassName, width, height, rectangles, revision) => {
|
|
9680
9725
|
const instance = get$a(id);
|
|
9681
9726
|
if (!instance) {
|
|
@@ -9708,6 +9753,8 @@ const commandHandlers = {
|
|
|
9708
9753
|
'Viewlet.removeKeyBindings': removeKeyBindings,
|
|
9709
9754
|
'Viewlet.renderCanvas': renderCanvas,
|
|
9710
9755
|
'Viewlet.replaceChildren': replaceChildren,
|
|
9756
|
+
'Viewlet.scrollSelectorBy': scrollSelectorBy,
|
|
9757
|
+
'Viewlet.scrollSelectorIntoView': scrollSelectorIntoView,
|
|
9711
9758
|
'Viewlet.send': invoke,
|
|
9712
9759
|
'Viewlet.setBounds': setBounds$1,
|
|
9713
9760
|
'Viewlet.setCheckBoxValue': setCheckboxValue,
|
|
@@ -9774,6 +9821,9 @@ const unmaximize = () => {};
|
|
|
9774
9821
|
const close = () => {
|
|
9775
9822
|
// window.close()
|
|
9776
9823
|
};
|
|
9824
|
+
const prepareClose = async () => {
|
|
9825
|
+
await invoke$1('SaveState.handleVisibilityChange', 'hidden');
|
|
9826
|
+
};
|
|
9777
9827
|
const toggleFullScreen = () => {
|
|
9778
9828
|
if (document.fullscreenElement) {
|
|
9779
9829
|
return document.exitFullscreen();
|
|
@@ -10173,6 +10223,8 @@ const commandMap = {
|
|
|
10173
10223
|
'Viewlet.refresh': refresh,
|
|
10174
10224
|
'Viewlet.registerEventListeners': registerEventListeners,
|
|
10175
10225
|
'Viewlet.removeKeyBindings': removeKeyBindings,
|
|
10226
|
+
'Viewlet.scrollSelectorBy': scrollSelectorBy,
|
|
10227
|
+
'Viewlet.scrollSelectorIntoView': scrollSelectorIntoView,
|
|
10176
10228
|
'Viewlet.send': invoke,
|
|
10177
10229
|
'Viewlet.sendMultiple': sendMultiple,
|
|
10178
10230
|
'Viewlet.setBounds': setBounds$1,
|
|
@@ -10196,6 +10248,7 @@ const commandMap = {
|
|
|
10196
10248
|
'Window.maximize': maximize,
|
|
10197
10249
|
'Window.minimize': minimize,
|
|
10198
10250
|
'Window.onVisibilityChange': onVisibilityChange,
|
|
10251
|
+
'Window.prepareClose': prepareClose,
|
|
10199
10252
|
'Window.reload': reload,
|
|
10200
10253
|
'Window.toggleFullScreen': toggleFullScreen,
|
|
10201
10254
|
'Window.unmaximize': unmaximize,
|