@lvce-editor/panel-worker 1.1.0 → 1.3.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/panelWorkerMain.js +278 -81
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -54,6 +54,55 @@ class VError extends Error {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
class AssertionError extends Error {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'AssertionError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String = 4;
|
|
67
|
+
const Boolean = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown = 8;
|
|
71
|
+
const getType = value => {
|
|
72
|
+
switch (typeof value) {
|
|
73
|
+
case 'number':
|
|
74
|
+
return Number$1;
|
|
75
|
+
case 'function':
|
|
76
|
+
return Function;
|
|
77
|
+
case 'string':
|
|
78
|
+
return String;
|
|
79
|
+
case 'object':
|
|
80
|
+
if (value === null) {
|
|
81
|
+
return Null;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
return Array$1;
|
|
85
|
+
}
|
|
86
|
+
return Object$1;
|
|
87
|
+
case 'boolean':
|
|
88
|
+
return Boolean;
|
|
89
|
+
default:
|
|
90
|
+
return Unknown;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const object = value => {
|
|
94
|
+
const type = getType(value);
|
|
95
|
+
if (type !== Object$1) {
|
|
96
|
+
throw new AssertionError('expected value to be of type object');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const string = value => {
|
|
100
|
+
const type = getType(value);
|
|
101
|
+
if (type !== String) {
|
|
102
|
+
throw new AssertionError('expected value to be of type string');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
57
106
|
const isMessagePort = value => {
|
|
58
107
|
return value && value instanceof MessagePort;
|
|
59
108
|
};
|
|
@@ -604,7 +653,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
604
653
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
605
654
|
return create$1$1(id, errorProperty);
|
|
606
655
|
};
|
|
607
|
-
const create$
|
|
656
|
+
const create$7 = (message, result) => {
|
|
608
657
|
return {
|
|
609
658
|
jsonrpc: Two$1,
|
|
610
659
|
id: message.id,
|
|
@@ -613,7 +662,7 @@ const create$8 = (message, result) => {
|
|
|
613
662
|
};
|
|
614
663
|
const getSuccessResponse = (message, result) => {
|
|
615
664
|
const resultProperty = result ?? null;
|
|
616
|
-
return create$
|
|
665
|
+
return create$7(message, resultProperty);
|
|
617
666
|
};
|
|
618
667
|
const getErrorResponseSimple = (id, error) => {
|
|
619
668
|
return {
|
|
@@ -707,7 +756,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
707
756
|
|
|
708
757
|
const Two = '2.0';
|
|
709
758
|
|
|
710
|
-
const create$
|
|
759
|
+
const create$6 = (method, params) => {
|
|
711
760
|
return {
|
|
712
761
|
jsonrpc: Two,
|
|
713
762
|
method,
|
|
@@ -715,7 +764,7 @@ const create$7 = (method, params) => {
|
|
|
715
764
|
};
|
|
716
765
|
};
|
|
717
766
|
|
|
718
|
-
const create$
|
|
767
|
+
const create$5 = (id, method, params) => {
|
|
719
768
|
const message = {
|
|
720
769
|
id,
|
|
721
770
|
jsonrpc: Two,
|
|
@@ -726,12 +775,12 @@ const create$6 = (id, method, params) => {
|
|
|
726
775
|
};
|
|
727
776
|
|
|
728
777
|
let id = 0;
|
|
729
|
-
const create$
|
|
778
|
+
const create$4 = () => {
|
|
730
779
|
return ++id;
|
|
731
780
|
};
|
|
732
781
|
|
|
733
782
|
const registerPromise = map => {
|
|
734
|
-
const id = create$
|
|
783
|
+
const id = create$4();
|
|
735
784
|
const {
|
|
736
785
|
promise,
|
|
737
786
|
resolve
|
|
@@ -749,7 +798,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
749
798
|
id,
|
|
750
799
|
promise
|
|
751
800
|
} = registerPromise(callbacks);
|
|
752
|
-
const message = create$
|
|
801
|
+
const message = create$5(id, method, params);
|
|
753
802
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
754
803
|
ipc.sendAndTransfer(message);
|
|
755
804
|
} else {
|
|
@@ -785,7 +834,7 @@ const createRpc = ipc => {
|
|
|
785
834
|
* @deprecated
|
|
786
835
|
*/
|
|
787
836
|
send(method, ...params) {
|
|
788
|
-
const message = create$
|
|
837
|
+
const message = create$6(method, params);
|
|
789
838
|
ipc.send(message);
|
|
790
839
|
}
|
|
791
840
|
};
|
|
@@ -825,7 +874,7 @@ const listen$1 = async (module, options) => {
|
|
|
825
874
|
return ipc;
|
|
826
875
|
};
|
|
827
876
|
|
|
828
|
-
const create$
|
|
877
|
+
const create$3 = async ({
|
|
829
878
|
commandMap
|
|
830
879
|
}) => {
|
|
831
880
|
// TODO create a commandMap per rpc instance
|
|
@@ -836,6 +885,9 @@ const create$4 = async ({
|
|
|
836
885
|
return rpc;
|
|
837
886
|
};
|
|
838
887
|
|
|
888
|
+
const Tab = 'tab';
|
|
889
|
+
|
|
890
|
+
const Button = 1;
|
|
839
891
|
const Div = 4;
|
|
840
892
|
const Text = 12;
|
|
841
893
|
const Reference = 100;
|
|
@@ -877,7 +929,7 @@ const remove = id => {
|
|
|
877
929
|
};
|
|
878
930
|
|
|
879
931
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
880
|
-
const create$
|
|
932
|
+
const create$2 = rpcId => {
|
|
881
933
|
return {
|
|
882
934
|
async dispose() {
|
|
883
935
|
const rpc = get$1(rpcId);
|
|
@@ -916,13 +968,13 @@ const create$3 = rpcId => {
|
|
|
916
968
|
const {
|
|
917
969
|
invoke,
|
|
918
970
|
set: set$1
|
|
919
|
-
} = create$
|
|
971
|
+
} = create$2(RendererWorker);
|
|
920
972
|
|
|
921
973
|
const toCommandId = key => {
|
|
922
974
|
const dotIndex = key.indexOf('.');
|
|
923
975
|
return key.slice(dotIndex + 1);
|
|
924
976
|
};
|
|
925
|
-
const create$
|
|
977
|
+
const create$1 = () => {
|
|
926
978
|
const states = Object.create(null);
|
|
927
979
|
const commandMapRef = {};
|
|
928
980
|
return {
|
|
@@ -1014,9 +1066,9 @@ const {
|
|
|
1014
1066
|
set,
|
|
1015
1067
|
wrapCommand,
|
|
1016
1068
|
wrapGetter
|
|
1017
|
-
} = create$
|
|
1069
|
+
} = create$1();
|
|
1018
1070
|
|
|
1019
|
-
const create
|
|
1071
|
+
const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
1020
1072
|
const state = {
|
|
1021
1073
|
actionsUid: 0,
|
|
1022
1074
|
assetDir,
|
|
@@ -1068,6 +1120,10 @@ const diff2 = uid => {
|
|
|
1068
1120
|
return result;
|
|
1069
1121
|
};
|
|
1070
1122
|
|
|
1123
|
+
const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri) => {
|
|
1124
|
+
await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1071
1127
|
const DebugConsole = 'Debug Console';
|
|
1072
1128
|
const Output = 'Output';
|
|
1073
1129
|
const Problems = 'Problems';
|
|
@@ -1078,12 +1134,6 @@ const getPanelViews = () => {
|
|
|
1078
1134
|
return views;
|
|
1079
1135
|
};
|
|
1080
1136
|
|
|
1081
|
-
let idCounter = 0;
|
|
1082
|
-
const create = () => {
|
|
1083
|
-
idCounter++;
|
|
1084
|
-
return idCounter;
|
|
1085
|
-
};
|
|
1086
|
-
|
|
1087
1137
|
const getSavedViewletId = savedState => {
|
|
1088
1138
|
if (savedState && savedState.currentViewletId) {
|
|
1089
1139
|
return savedState.currentViewletId || Problems;
|
|
@@ -1100,6 +1150,18 @@ const loadContent = (state, savedState) => {
|
|
|
1100
1150
|
};
|
|
1101
1151
|
return openViewlet(loaded, savedViewletId);
|
|
1102
1152
|
};
|
|
1153
|
+
const setBadgeCount = (state, id, count) => {
|
|
1154
|
+
const {
|
|
1155
|
+
badgeCounts
|
|
1156
|
+
} = state;
|
|
1157
|
+
return {
|
|
1158
|
+
...state,
|
|
1159
|
+
badgeCounts: {
|
|
1160
|
+
...badgeCounts,
|
|
1161
|
+
[id]: count
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
};
|
|
1103
1165
|
|
|
1104
1166
|
// export const contentLoaded = (state) => {
|
|
1105
1167
|
// const commands = []
|
|
@@ -1114,48 +1176,25 @@ const getContentDimensions = dimensions => {
|
|
|
1114
1176
|
y: dimensions.y + 35
|
|
1115
1177
|
};
|
|
1116
1178
|
};
|
|
1179
|
+
|
|
1180
|
+
// TODO
|
|
1181
|
+
// export const getChildren = (state) => {
|
|
1182
|
+
// const { currentViewletId } = state
|
|
1183
|
+
// return [
|
|
1184
|
+
// {
|
|
1185
|
+
// id: currentViewletId,
|
|
1186
|
+
// ...getContentDimensions(state),
|
|
1187
|
+
// },
|
|
1188
|
+
// ]
|
|
1189
|
+
// }
|
|
1190
|
+
|
|
1117
1191
|
const openViewlet = async (state, id, focus = false) => {
|
|
1118
1192
|
const childDimensions = getContentDimensions(state);
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
append: false,
|
|
1125
|
-
args: [],
|
|
1126
|
-
focus,
|
|
1127
|
-
getModule: ViewletModule.load,
|
|
1128
|
-
height: childDimensions.height,
|
|
1129
|
-
id,
|
|
1130
|
-
parentUid: uid,
|
|
1131
|
-
setBounds: false,
|
|
1132
|
-
shouldRenderEvents: false,
|
|
1133
|
-
show: false,
|
|
1134
|
-
type: 0,
|
|
1135
|
-
uid: childUid,
|
|
1136
|
-
// @ts-ignore
|
|
1137
|
-
uri: '',
|
|
1138
|
-
width: childDimensions.width,
|
|
1139
|
-
x: childDimensions.x,
|
|
1140
|
-
y: childDimensions.y
|
|
1141
|
-
}, false, true);
|
|
1142
|
-
let actionsDom = [];
|
|
1143
|
-
let actionsUid = -1;
|
|
1144
|
-
if (commands) {
|
|
1145
|
-
const actionsDomIndex = commands.findIndex(command => command[2] === 'setActionsDom');
|
|
1146
|
-
if (actionsDomIndex !== -1) {
|
|
1147
|
-
const actionDomEntry = commands[actionsDomIndex]?.[3];
|
|
1148
|
-
if (Array.isArray(actionDomEntry)) {
|
|
1149
|
-
actionsDom = actionDomEntry;
|
|
1150
|
-
}
|
|
1151
|
-
commands.splice(actionsDomIndex, 1);
|
|
1152
|
-
}
|
|
1153
|
-
const eventsIndex = commands.findIndex(command => command[0] === 'Viewlet.registerEventListeners');
|
|
1154
|
-
const events = eventsIndex === -1 ? [] : commands[eventsIndex]?.[2];
|
|
1155
|
-
actionsUid = create();
|
|
1156
|
-
commands.push(['Viewlet.createFunctionalRoot', id, actionsUid, true], ['Viewlet.registerEventListeners', actionsUid, events], ['Viewlet.setDom2', actionsUid, actionsDom], ['Viewlet.setUid', actionsUid, childUid]);
|
|
1157
|
-
await RendererProcess.invoke('Viewlet.sendMultiple', commands);
|
|
1158
|
-
}
|
|
1193
|
+
const childUid = Math.random();
|
|
1194
|
+
const tabId = 1234;
|
|
1195
|
+
// TODO get the actions uid somehow
|
|
1196
|
+
const actionsUid = Math.random();
|
|
1197
|
+
await createViewlet(id, childUid, tabId, childDimensions, '');
|
|
1159
1198
|
return {
|
|
1160
1199
|
...state,
|
|
1161
1200
|
actionsUid,
|
|
@@ -1163,6 +1202,53 @@ const openViewlet = async (state, id, focus = false) => {
|
|
|
1163
1202
|
currentViewletId: id
|
|
1164
1203
|
};
|
|
1165
1204
|
};
|
|
1205
|
+
const handleClickClose = async state => {
|
|
1206
|
+
await invoke('Layout.hidePanel');
|
|
1207
|
+
return state;
|
|
1208
|
+
};
|
|
1209
|
+
const handleClickMaximize = async state => {
|
|
1210
|
+
// TODO
|
|
1211
|
+
return state;
|
|
1212
|
+
};
|
|
1213
|
+
const selectIndex = async (state, index) => {
|
|
1214
|
+
await openViewlet(state, state.views[index]);
|
|
1215
|
+
return {
|
|
1216
|
+
...state,
|
|
1217
|
+
selectedIndex: index
|
|
1218
|
+
};
|
|
1219
|
+
};
|
|
1220
|
+
const selectRaw = async (state, rawIndex) => {
|
|
1221
|
+
return selectIndex(state, Number.parseInt(rawIndex, 10));
|
|
1222
|
+
};
|
|
1223
|
+
const toggleView = async (state, name) => {
|
|
1224
|
+
const index = state.views.indexOf(name);
|
|
1225
|
+
if (index === -1) {
|
|
1226
|
+
return state;
|
|
1227
|
+
}
|
|
1228
|
+
if (name === state.currentViewletId) {
|
|
1229
|
+
// await Command.execute('Layout.hidePanel') // TODO
|
|
1230
|
+
return state;
|
|
1231
|
+
}
|
|
1232
|
+
return selectIndex(state, index);
|
|
1233
|
+
};
|
|
1234
|
+
const handleFilterInput = async (state, value) => {
|
|
1235
|
+
object(state);
|
|
1236
|
+
string(value);
|
|
1237
|
+
const {
|
|
1238
|
+
currentViewletId
|
|
1239
|
+
} = state;
|
|
1240
|
+
const fullCommand = `${currentViewletId}.handleFilterInput`;
|
|
1241
|
+
await invoke(fullCommand, value);
|
|
1242
|
+
return state;
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
const text = data => {
|
|
1246
|
+
return {
|
|
1247
|
+
childCount: 0,
|
|
1248
|
+
text: data,
|
|
1249
|
+
type: Text
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1166
1252
|
|
|
1167
1253
|
const SetText = 1;
|
|
1168
1254
|
const Replace = 2;
|
|
@@ -1452,15 +1538,121 @@ const diffTree = (oldNodes, newNodes) => {
|
|
|
1452
1538
|
return removeTrailingNavigationPatches(patches);
|
|
1453
1539
|
};
|
|
1454
1540
|
|
|
1455
|
-
const
|
|
1456
|
-
const
|
|
1541
|
+
const getActionsDom = newState => {
|
|
1542
|
+
const actions = newState.actionsUid || -1;
|
|
1543
|
+
if (actions === -1) {
|
|
1544
|
+
return [{
|
|
1545
|
+
childCount: 0,
|
|
1546
|
+
className: 'Actions',
|
|
1547
|
+
role: 'toolbar',
|
|
1548
|
+
type: Div
|
|
1549
|
+
}];
|
|
1550
|
+
}
|
|
1551
|
+
return [{
|
|
1552
|
+
type: Reference,
|
|
1553
|
+
uid: actions
|
|
1554
|
+
}];
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
const HandleClickClose = 'handleClickClose';
|
|
1558
|
+
const HandleClickMaximize = 'handleClickMaximize';
|
|
1559
|
+
const HandleClickSelectTab = 'HandleClickSelectTab';
|
|
1560
|
+
|
|
1561
|
+
const getGlobalActionsDom = () => {
|
|
1562
|
+
return [{
|
|
1563
|
+
childCount: 2,
|
|
1564
|
+
className: 'PanelToolBar',
|
|
1565
|
+
role: 'toolbar',
|
|
1566
|
+
type: Div
|
|
1567
|
+
}, {
|
|
1568
|
+
ariaLabel: 'Maximize',
|
|
1569
|
+
childCount: 1,
|
|
1570
|
+
className: 'IconButton',
|
|
1571
|
+
onClick: HandleClickMaximize,
|
|
1572
|
+
titleM: 'Maximize',
|
|
1573
|
+
type: Button
|
|
1574
|
+
}, {
|
|
1457
1575
|
childCount: 0,
|
|
1458
|
-
className: '
|
|
1576
|
+
className: 'MaskIcon MaskIconChevronUp',
|
|
1577
|
+
type: Div
|
|
1578
|
+
}, {
|
|
1579
|
+
ariaLabel: 'Close',
|
|
1580
|
+
childCount: 1,
|
|
1581
|
+
className: 'IconButton',
|
|
1582
|
+
onClick: HandleClickClose,
|
|
1583
|
+
titleM: 'Close',
|
|
1584
|
+
type: Button
|
|
1585
|
+
}, {
|
|
1586
|
+
childCount: 0,
|
|
1587
|
+
className: 'MaskIcon MaskIconClose',
|
|
1459
1588
|
type: Div
|
|
1460
1589
|
}];
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
const Badge = 'Badge';
|
|
1593
|
+
const PanelTab = 'PanelTab';
|
|
1594
|
+
const PanelTabSelected = 'PanelTabSelected';
|
|
1595
|
+
|
|
1596
|
+
const createPanelTab = (tab, badgeCount, isSelected, index) => {
|
|
1597
|
+
const label = tab;
|
|
1598
|
+
let className = PanelTab;
|
|
1599
|
+
if (isSelected) {
|
|
1600
|
+
className += ' ' + PanelTabSelected;
|
|
1601
|
+
}
|
|
1602
|
+
const childCount = badgeCount ? 2 : 1;
|
|
1603
|
+
const tabDom = {
|
|
1604
|
+
ariaSelected: isSelected,
|
|
1605
|
+
childCount,
|
|
1606
|
+
className,
|
|
1607
|
+
'data-index': index,
|
|
1608
|
+
onClick: HandleClickSelectTab,
|
|
1609
|
+
role: Tab,
|
|
1610
|
+
type: Div
|
|
1611
|
+
};
|
|
1612
|
+
const dom = [tabDom, text(label)];
|
|
1613
|
+
if (badgeCount) {
|
|
1614
|
+
dom.push({
|
|
1615
|
+
childCount: 1,
|
|
1616
|
+
className: Badge,
|
|
1617
|
+
type: Div
|
|
1618
|
+
}, text(' ' + badgeCount));
|
|
1619
|
+
}
|
|
1620
|
+
return dom;
|
|
1621
|
+
};
|
|
1622
|
+
const getPanelTabsVirtualDom = (tabs, selectedIndex, badgeCounts) => {
|
|
1623
|
+
const dom = [];
|
|
1624
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
1625
|
+
const isSelected = i === selectedIndex;
|
|
1626
|
+
const tab = tabs[i];
|
|
1627
|
+
const badgeCount = badgeCounts[tab] || 0;
|
|
1628
|
+
dom.push(...createPanelTab(tab, badgeCount, isSelected, i));
|
|
1629
|
+
}
|
|
1461
1630
|
return dom;
|
|
1462
1631
|
};
|
|
1463
1632
|
|
|
1633
|
+
const getPanelDom = newState => {
|
|
1634
|
+
const {
|
|
1635
|
+
childUid
|
|
1636
|
+
} = newState;
|
|
1637
|
+
const tabsDom = getPanelTabsVirtualDom(newState.views, newState.selectedIndex, newState.badgeCounts);
|
|
1638
|
+
return [{
|
|
1639
|
+
childCount: 2,
|
|
1640
|
+
className: 'Panel',
|
|
1641
|
+
type: Div
|
|
1642
|
+
}, {
|
|
1643
|
+
childCount: 3,
|
|
1644
|
+
className: 'PanelHeader',
|
|
1645
|
+
type: Div
|
|
1646
|
+
}, {
|
|
1647
|
+
childCount: newState.views.length,
|
|
1648
|
+
className: 'PanelTabs',
|
|
1649
|
+
type: Div
|
|
1650
|
+
}, ...tabsDom, ...getActionsDom(newState), ...getGlobalActionsDom(), {
|
|
1651
|
+
type: Reference,
|
|
1652
|
+
uid: childUid
|
|
1653
|
+
}];
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1464
1656
|
const renderItems = (oldState, newState) => {
|
|
1465
1657
|
const {
|
|
1466
1658
|
initial,
|
|
@@ -1469,7 +1661,7 @@ const renderItems = (oldState, newState) => {
|
|
|
1469
1661
|
if (initial) {
|
|
1470
1662
|
return [SetDom2, uid, []];
|
|
1471
1663
|
}
|
|
1472
|
-
const dom =
|
|
1664
|
+
const dom = getPanelDom(newState);
|
|
1473
1665
|
return [SetDom2, uid, dom];
|
|
1474
1666
|
};
|
|
1475
1667
|
|
|
@@ -1513,10 +1705,6 @@ const render2 = (uid, diffResult) => {
|
|
|
1513
1705
|
return commands;
|
|
1514
1706
|
};
|
|
1515
1707
|
|
|
1516
|
-
const HandleClickClose = 'handleClickClose';
|
|
1517
|
-
const HandleClickMaximize = 'handleClickMaximize';
|
|
1518
|
-
const HandleClickSelectTab = 'HandleClickSelectTab';
|
|
1519
|
-
|
|
1520
1708
|
const renderEventListeners = () => {
|
|
1521
1709
|
return [{
|
|
1522
1710
|
name: HandleClickMaximize,
|
|
@@ -1531,6 +1719,9 @@ const renderEventListeners = () => {
|
|
|
1531
1719
|
};
|
|
1532
1720
|
|
|
1533
1721
|
const resize = async (state, dimensions) => {
|
|
1722
|
+
const {
|
|
1723
|
+
childUid
|
|
1724
|
+
} = state;
|
|
1534
1725
|
// TODO
|
|
1535
1726
|
const currentViewletInstance = {};
|
|
1536
1727
|
const newState = {
|
|
@@ -1543,9 +1734,7 @@ const resize = async (state, dimensions) => {
|
|
|
1543
1734
|
};
|
|
1544
1735
|
}
|
|
1545
1736
|
// @ts-ignore
|
|
1546
|
-
|
|
1547
|
-
// @ts-ignore
|
|
1548
|
-
await invoke('Viewlet.resize', currentViewletUid, dimensions);
|
|
1737
|
+
await invoke('Viewlet.resize', childUid, dimensions);
|
|
1549
1738
|
return {
|
|
1550
1739
|
...newState
|
|
1551
1740
|
};
|
|
@@ -1561,20 +1750,28 @@ const saveState = state => {
|
|
|
1561
1750
|
};
|
|
1562
1751
|
|
|
1563
1752
|
const commandMap = {
|
|
1564
|
-
'
|
|
1565
|
-
'
|
|
1566
|
-
'
|
|
1567
|
-
'
|
|
1568
|
-
'
|
|
1569
|
-
'
|
|
1570
|
-
'
|
|
1571
|
-
'
|
|
1572
|
-
'
|
|
1753
|
+
'Panel.create': create,
|
|
1754
|
+
'Panel.diff2': diff2,
|
|
1755
|
+
'Panel.getCommandIds': getCommandIds,
|
|
1756
|
+
'Panel.handleClickClose': wrapCommand(handleClickClose),
|
|
1757
|
+
'Panel.handleClickMaximize': wrapCommand(handleClickMaximize),
|
|
1758
|
+
'Panel.handleFilterInput': wrapCommand(handleFilterInput),
|
|
1759
|
+
'Panel.loadContent': wrapCommand(loadContent),
|
|
1760
|
+
'Panel.openViewlet': wrapCommand(openViewlet),
|
|
1761
|
+
'Panel.render2': render2,
|
|
1762
|
+
'Panel.renderEventListeners': renderEventListeners,
|
|
1763
|
+
'Panel.resize': wrapCommand(resize),
|
|
1764
|
+
'Panel.saveState': wrapGetter(saveState),
|
|
1765
|
+
'Panel.selectIndex': wrapCommand(selectIndex),
|
|
1766
|
+
'Panel.selectIndexRaw': wrapCommand(selectRaw),
|
|
1767
|
+
'Panel.setBadgeCount': wrapCommand(setBadgeCount),
|
|
1768
|
+
'Panel.terminate': terminate,
|
|
1769
|
+
'Panel.toggleView': wrapCommand(toggleView)
|
|
1573
1770
|
};
|
|
1574
1771
|
|
|
1575
1772
|
const listen = async () => {
|
|
1576
1773
|
registerCommands(commandMap);
|
|
1577
|
-
const rpc = await create$
|
|
1774
|
+
const rpc = await create$3({
|
|
1578
1775
|
commandMap: commandMap
|
|
1579
1776
|
});
|
|
1580
1777
|
set$1(rpc);
|