@lvce-editor/title-bar-worker 3.11.0 → 3.12.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/titleBarWorkerMain.js +21 -44
- package/package.json +1 -1
|
@@ -1342,6 +1342,7 @@ const RendererWorker = 1;
|
|
|
1342
1342
|
|
|
1343
1343
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
1344
1344
|
const SetDom2 = 'Viewlet.setDom2';
|
|
1345
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1345
1346
|
|
|
1346
1347
|
const FocusTitleBarMenuBar = 26;
|
|
1347
1348
|
|
|
@@ -1754,55 +1755,29 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
|
|
|
1754
1755
|
set(id, state, state);
|
|
1755
1756
|
};
|
|
1756
1757
|
|
|
1757
|
-
const RenderEntries = 1;
|
|
1758
|
-
const RenderFocusedIndex = 2;
|
|
1759
|
-
const RenderMenus = 3;
|
|
1760
|
-
const RenderFocusContext = 4;
|
|
1761
|
-
|
|
1762
|
-
const isEqual$4 = (oldState, newState) => {
|
|
1763
|
-
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
1764
|
-
};
|
|
1765
|
-
|
|
1766
1758
|
const isEqual$3 = (oldState, newState) => {
|
|
1767
|
-
return oldState.
|
|
1759
|
+
return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
1768
1760
|
};
|
|
1769
1761
|
|
|
1770
1762
|
const isEqual$2 = (oldState, newState) => {
|
|
1771
|
-
return oldState.
|
|
1763
|
+
return oldState.focused || !newState.focused;
|
|
1772
1764
|
};
|
|
1773
1765
|
|
|
1774
1766
|
const isEqual$1 = (oldState, newState) => {
|
|
1775
|
-
return oldState.
|
|
1776
|
-
};
|
|
1777
|
-
|
|
1778
|
-
const modules$1 = [isEqual$4, isEqual$2, isEqual$1, isEqual$3];
|
|
1779
|
-
const numbers$1 = [RenderEntries, RenderFocusedIndex, RenderMenus, RenderFocusContext];
|
|
1780
|
-
|
|
1781
|
-
const diff = (oldState, newState) => {
|
|
1782
|
-
const diffResult = [];
|
|
1783
|
-
for (let i = 0; i < modules$1.length; i++) {
|
|
1784
|
-
const fn = modules$1[i];
|
|
1785
|
-
if (!fn(oldState, newState)) {
|
|
1786
|
-
diffResult.push(numbers$1[i]);
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
return diffResult;
|
|
1790
|
-
};
|
|
1791
|
-
|
|
1792
|
-
const diff2 = uid => {
|
|
1793
|
-
const {
|
|
1794
|
-
newState,
|
|
1795
|
-
oldState
|
|
1796
|
-
} = get(uid);
|
|
1797
|
-
return diff(oldState, newState);
|
|
1767
|
+
return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
1798
1768
|
};
|
|
1799
1769
|
|
|
1800
1770
|
const isEqual = (oldState, newState) => {
|
|
1801
|
-
return oldState.
|
|
1771
|
+
return oldState.menus === newState.menus;
|
|
1802
1772
|
};
|
|
1803
1773
|
|
|
1804
|
-
const
|
|
1805
|
-
const
|
|
1774
|
+
const RenderEntries = 1;
|
|
1775
|
+
const RenderFocusedIndex = 2;
|
|
1776
|
+
const RenderMenus = 3;
|
|
1777
|
+
const RenderFocusContext = 4;
|
|
1778
|
+
|
|
1779
|
+
const modules = [isEqual$3, isEqual$1, isEqual, isEqual$2];
|
|
1780
|
+
const numbers = [RenderEntries, RenderFocusedIndex, RenderMenus, RenderFocusContext];
|
|
1806
1781
|
|
|
1807
1782
|
const diff3 = uid => {
|
|
1808
1783
|
const {
|
|
@@ -2985,7 +2960,6 @@ const measureTextWidths2 = async (texts, fontWeight, fontSize, fontFamily, lette
|
|
|
2985
2960
|
await using rpc = await launchTextMeasurementWorker();
|
|
2986
2961
|
const isMonospaceFont = false;
|
|
2987
2962
|
const charWidth = 0;
|
|
2988
|
-
// @ts-ignore
|
|
2989
2963
|
const result = await rpc.invoke('TextMeasurement.measureTextWidths', texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
|
|
2990
2964
|
return result;
|
|
2991
2965
|
};
|
|
@@ -3079,6 +3053,13 @@ const loadContent2 = async state => {
|
|
|
3079
3053
|
};
|
|
3080
3054
|
};
|
|
3081
3055
|
|
|
3056
|
+
const renderFocusContext = (oldState, newState) => {
|
|
3057
|
+
const {
|
|
3058
|
+
uid
|
|
3059
|
+
} = newState;
|
|
3060
|
+
return [SetFocusContext, uid, FocusTitleBarMenuBar];
|
|
3061
|
+
};
|
|
3062
|
+
|
|
3082
3063
|
const renderFocusedIndex = (oldState, newState) => {
|
|
3083
3064
|
if (newState.focusedIndex === -1) {
|
|
3084
3065
|
return [];
|
|
@@ -3554,6 +3535,8 @@ const getRenderer3 = diffType => {
|
|
|
3554
3535
|
switch (diffType) {
|
|
3555
3536
|
case RenderEntries:
|
|
3556
3537
|
return renderTitleBar;
|
|
3538
|
+
case RenderFocusContext:
|
|
3539
|
+
return renderFocusContext;
|
|
3557
3540
|
case RenderFocusedIndex:
|
|
3558
3541
|
return renderFocusedIndex;
|
|
3559
3542
|
case RenderMenus:
|
|
@@ -3794,12 +3777,7 @@ const handleClickAt = async (state, button, eventX, eventY) => {
|
|
|
3794
3777
|
return handleClick(state, button, index);
|
|
3795
3778
|
};
|
|
3796
3779
|
|
|
3797
|
-
const setFocus = async focusKey => {
|
|
3798
|
-
await invoke('Focus.setFocus', focusKey);
|
|
3799
|
-
};
|
|
3800
|
-
|
|
3801
3780
|
const handleFocus = async state => {
|
|
3802
|
-
await setFocus(FocusTitleBarMenuBar);
|
|
3803
3781
|
return {
|
|
3804
3782
|
...state,
|
|
3805
3783
|
focused: true
|
|
@@ -4248,7 +4226,6 @@ const commandMap = {
|
|
|
4248
4226
|
'TitleBar.closeMenu': closeMenu,
|
|
4249
4227
|
'TitleBar.create': create,
|
|
4250
4228
|
'TitleBar.create3': create3,
|
|
4251
|
-
'TitleBar.diff2': diff2,
|
|
4252
4229
|
'TitleBar.diff3': diff3,
|
|
4253
4230
|
'TitleBar.focus': wrapCommand(focus),
|
|
4254
4231
|
'TitleBar.focusFirst': wrapCommand(focusFirst),
|