@lvce-editor/explorer-view 7.23.3 → 7.24.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.
@@ -6523,9 +6523,19 @@ const set = rpc => {
6523
6523
  state.connected = true;
6524
6524
  };
6525
6525
 
6526
- const handleMessagePort = async port => {
6526
+ const handleMessagePort = async (port, viewletCommandMap) => {
6527
+ const executeViewletCommand = async (uid, command, ...args) => {
6528
+ const fn = viewletCommandMap[`Explorer.${command}`];
6529
+ if (typeof fn !== 'function') {
6530
+ throw new TypeError(`Viewlet command not found: ${command}`);
6531
+ }
6532
+ await fn(uid, ...args);
6533
+ await invoke$3('Viewlet.requestRender', uid);
6534
+ };
6527
6535
  const rpc = await create$6({
6528
- commandMap: {},
6536
+ commandMap: {
6537
+ 'Viewlet.executeViewletCommand': executeViewletCommand
6538
+ },
6529
6539
  messagePort: port
6530
6540
  });
6531
6541
  set(rpc);
@@ -8320,6 +8330,7 @@ const updateEditingValue = async (state, value, inputSource = User) => {
8320
8330
  };
8321
8331
  };
8322
8332
 
8333
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
8323
8334
  const commandMap = {
8324
8335
  'Explorer.acceptEdit': wrapListItemCommand(acceptEdit),
8325
8336
  'Explorer.cancelEdit': wrapListItemCommand(cancelEdit),
@@ -8376,7 +8387,7 @@ const commandMap = {
8376
8387
  'Explorer.handleInputClick': wrapListItemCommand(handleInputClick),
8377
8388
  'Explorer.handleInputKeyDown': wrapListItemCommand(handleInputKeyDown),
8378
8389
  'Explorer.handleKeyDown': wrapListItemCommand(handleKeyDown),
8379
- 'Explorer.handleMessagePort': handleMessagePort,
8390
+ 'Explorer.handleMessagePort': handleDirectMessagePort,
8380
8391
  'Explorer.handleNativePaste': wrapListItemCommand(handleNativePaste),
8381
8392
  'Explorer.handlePaste': wrapListItemCommand(handlePaste),
8382
8393
  'Explorer.handlePointerDown': wrapListItemCommand(handlePointerDown),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "7.23.3",
3
+ "version": "7.24.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",