@lvce-editor/status-bar-worker 3.26.2 → 3.27.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.
@@ -315,6 +315,10 @@ const diff2 = uid => {
315
315
  return result;
316
316
  };
317
317
 
318
+ const getComponentState = uid => {
319
+ return get$5(uid).newState;
320
+ };
321
+
318
322
  const getMatchingItemInternal = (items, name) => {
319
323
  for (const item of items) {
320
324
  if (item.name === name) {
@@ -2489,6 +2493,23 @@ const saveState = state => {
2489
2493
  };
2490
2494
  };
2491
2495
 
2496
+ const applyComponentState = (currentState, state) => {
2497
+ if (!state || typeof state !== 'object' || Array.isArray(state)) {
2498
+ throw new TypeError('Status Bar state must be an object');
2499
+ }
2500
+ const {
2501
+ uid
2502
+ } = state;
2503
+ const {
2504
+ uid: currentUid
2505
+ } = currentState;
2506
+ if (uid !== currentUid) {
2507
+ throw new Error(`Status Bar state uid must remain ${currentUid}`);
2508
+ }
2509
+ return state;
2510
+ };
2511
+ const setComponentState = wrapCommand(applyComponentState);
2512
+
2492
2513
  const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
2493
2514
  const activateOnWorkspaceChange = wrapCommand(handleWorkspaceChange);
2494
2515
  const refreshExtensionItems = wrapSerialCommand(handleItemsChanged);
@@ -2500,6 +2521,7 @@ const commandMap = {
2500
2521
  'StatusBar.create': create$7,
2501
2522
  'StatusBar.diff2': diff2,
2502
2523
  'StatusBar.getCommandIds': getCommandIds,
2524
+ 'StatusBar.getComponentState': getComponentState,
2503
2525
  'StatusBar.handleChange': wrapSerialCommand(handleItemsChanged),
2504
2526
  'StatusBar.handleClick': wrapCommand(handleClick),
2505
2527
  'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
@@ -2519,6 +2541,7 @@ const commandMap = {
2519
2541
  'StatusBar.renderEventListeners': renderEventListeners,
2520
2542
  'StatusBar.resize': wrapCommand(resize),
2521
2543
  'StatusBar.saveState': wrapGetter(saveState),
2544
+ 'StatusBar.setComponentState': setComponentState,
2522
2545
  'StatusBar.terminate': terminate
2523
2546
  };
2524
2547
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "3.26.2",
3
+ "version": "3.27.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",