@lvce-editor/status-bar-worker 3.0.0 → 3.1.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/statusBarWorkerMain.js +68 -6
- package/package.json +1 -1
|
@@ -240,6 +240,49 @@ class VError extends Error {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
class AssertionError extends Error {
|
|
244
|
+
constructor(message) {
|
|
245
|
+
super(message);
|
|
246
|
+
this.name = 'AssertionError';
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const Object$1 = 1;
|
|
250
|
+
const Number$1 = 2;
|
|
251
|
+
const Array$1 = 3;
|
|
252
|
+
const String = 4;
|
|
253
|
+
const Boolean$1 = 5;
|
|
254
|
+
const Function = 6;
|
|
255
|
+
const Null = 7;
|
|
256
|
+
const Unknown = 8;
|
|
257
|
+
const getType = value => {
|
|
258
|
+
switch (typeof value) {
|
|
259
|
+
case 'number':
|
|
260
|
+
return Number$1;
|
|
261
|
+
case 'function':
|
|
262
|
+
return Function;
|
|
263
|
+
case 'string':
|
|
264
|
+
return String;
|
|
265
|
+
case 'object':
|
|
266
|
+
if (value === null) {
|
|
267
|
+
return Null;
|
|
268
|
+
}
|
|
269
|
+
if (Array.isArray(value)) {
|
|
270
|
+
return Array$1;
|
|
271
|
+
}
|
|
272
|
+
return Object$1;
|
|
273
|
+
case 'boolean':
|
|
274
|
+
return Boolean$1;
|
|
275
|
+
default:
|
|
276
|
+
return Unknown;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const number = value => {
|
|
280
|
+
const type = getType(value);
|
|
281
|
+
if (type !== Number$1) {
|
|
282
|
+
throw new AssertionError('expected value to be of type number');
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
243
286
|
const isMessagePort = value => {
|
|
244
287
|
return value && value instanceof MessagePort;
|
|
245
288
|
};
|
|
@@ -1260,17 +1303,20 @@ const create = rpcId => {
|
|
|
1260
1303
|
};
|
|
1261
1304
|
};
|
|
1262
1305
|
|
|
1263
|
-
const Button$
|
|
1306
|
+
const Button$2 = 'button';
|
|
1264
1307
|
const Status = 'status';
|
|
1265
1308
|
|
|
1266
1309
|
const MaskIcon = 'MaskIcon';
|
|
1267
1310
|
|
|
1268
|
-
const Button = 1;
|
|
1311
|
+
const Button$1 = 1;
|
|
1269
1312
|
const Div = 4;
|
|
1270
1313
|
const Span = 8;
|
|
1271
1314
|
const Text = 12;
|
|
1272
1315
|
const Reference = 100;
|
|
1273
1316
|
|
|
1317
|
+
const Button = 'event.button';
|
|
1318
|
+
const ClientX = 'event.clientX';
|
|
1319
|
+
const ClientY = 'event.clientY';
|
|
1274
1320
|
const TargetName = 'event.target.name';
|
|
1275
1321
|
|
|
1276
1322
|
const ExtensionHostWorker = 44;
|
|
@@ -1295,6 +1341,13 @@ const {
|
|
|
1295
1341
|
invokeAndTransfer,
|
|
1296
1342
|
set
|
|
1297
1343
|
} = create(RendererWorker);
|
|
1344
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1345
|
+
number(uid);
|
|
1346
|
+
number(menuId);
|
|
1347
|
+
number(x);
|
|
1348
|
+
number(y);
|
|
1349
|
+
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1350
|
+
};
|
|
1298
1351
|
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
1299
1352
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1300
1353
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
@@ -1353,7 +1406,16 @@ const handleClick = async (state, name) => {
|
|
|
1353
1406
|
return state;
|
|
1354
1407
|
};
|
|
1355
1408
|
|
|
1356
|
-
const
|
|
1409
|
+
const show2 = async (uid, menuId, x, y, args) => {
|
|
1410
|
+
await showContextMenu2(uid, menuId, x, y, args);
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
const StatusBar = 31;
|
|
1414
|
+
|
|
1415
|
+
const handleContextMenu = async (state, button, x, y) => {
|
|
1416
|
+
await show2(state.uid, StatusBar, x, y, {
|
|
1417
|
+
menuId: StatusBar
|
|
1418
|
+
});
|
|
1357
1419
|
return state;
|
|
1358
1420
|
};
|
|
1359
1421
|
|
|
@@ -2027,10 +2089,10 @@ const getStatusBarItemVirtualDom = statusBarItem => {
|
|
|
2027
2089
|
childCount: elements.length,
|
|
2028
2090
|
className: StatusBarItem,
|
|
2029
2091
|
name,
|
|
2030
|
-
role: Button$
|
|
2092
|
+
role: Button$2,
|
|
2031
2093
|
tabIndex: -1,
|
|
2032
2094
|
title: tooltip,
|
|
2033
|
-
type: Button
|
|
2095
|
+
type: Button$1
|
|
2034
2096
|
};
|
|
2035
2097
|
return [buttonNode, ...elementNodes];
|
|
2036
2098
|
};
|
|
@@ -2133,7 +2195,7 @@ const render2 = (uid, diffResult) => {
|
|
|
2133
2195
|
const renderEventListeners = () => {
|
|
2134
2196
|
return [{
|
|
2135
2197
|
name: HandleContextMenu,
|
|
2136
|
-
params: ['handleContextMenu'],
|
|
2198
|
+
params: ['handleContextMenu', Button, ClientX, ClientY],
|
|
2137
2199
|
preventDefault: true
|
|
2138
2200
|
}, {
|
|
2139
2201
|
name: HandleClick,
|