@lvce-editor/settings-view 2.22.0 → 2.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.
@@ -3358,12 +3358,24 @@ const set$1 = rpc => {
3358
3358
  state.connected = true;
3359
3359
  };
3360
3360
 
3361
- const handleMessagePort = async port => {
3361
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
3362
+ const executeViewletCommand = async (uid, command, ...args) => {
3363
+ const fn = viewletCommandMap[`Settings.${command}`];
3364
+ if (typeof fn !== 'function') {
3365
+ throw new TypeError(`Viewlet command not found: ${command}`);
3366
+ }
3367
+ await fn(uid, ...args);
3368
+ await invoke$1('Viewlet.requestRender', uid);
3369
+ };
3362
3370
  const rpc = await PlainMessagePortRpc.create({
3363
- commandMap: {},
3371
+ commandMap: {
3372
+ 'Viewlet.executeViewletCommand': executeViewletCommand
3373
+ },
3364
3374
  messagePort: port
3365
3375
  });
3366
- set$1(rpc);
3376
+ if (setAsRendererProcess) {
3377
+ set$1(rpc);
3378
+ }
3367
3379
  };
3368
3380
 
3369
3381
  const handleResizerPointerDown = (state, eventX, eventY) => {
@@ -5558,6 +5570,7 @@ const usePreviousSearchValue = state => {
5558
5570
  };
5559
5571
  };
5560
5572
 
5573
+ const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
5561
5574
  const commandMap = {
5562
5575
  'Initialize.initialize': initialize,
5563
5576
  'Settings.clear': wrapCommand(clear$1),
@@ -5574,7 +5587,7 @@ const commandMap = {
5574
5587
  'Settings.handleInput': wrapCommand(handleInput),
5575
5588
  'Settings.handleInputBlur': wrapCommand(handleInputBlur),
5576
5589
  'Settings.handleInputFocus': wrapCommand(handleInputFocus),
5577
- 'Settings.handleMessagePort': handleMessagePort,
5590
+ 'Settings.handleMessagePort': handleDirectMessagePort,
5578
5591
  'Settings.handleResizerPointerDown': wrapCommand(handleResizerPointerDown),
5579
5592
  'Settings.handleResizerPointerMove': wrapCommand(handleResizerPointerMove),
5580
5593
  'Settings.handleResizerPointerUp': wrapCommand(handleResizerPointerUp),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/settings-view",
3
- "version": "2.22.0",
3
+ "version": "2.24.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",