@lvce-editor/ports-view 0.5.0 → 0.6.1

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.
@@ -1632,6 +1632,10 @@ const focusLast = state => {
1632
1632
  return focusIndex(state, ports.length - 1);
1633
1633
  };
1634
1634
 
1635
+ const getComponentState = uid => {
1636
+ return get(uid).newState;
1637
+ };
1638
+
1635
1639
  const mergeClassNames = (...classNames) => {
1636
1640
  return classNames.filter(Boolean).join(' ');
1637
1641
  };
@@ -2188,11 +2192,19 @@ const getCss = state => {
2188
2192
  } = state;
2189
2193
  const relativeY = -(deltaY % itemHeight);
2190
2194
  return `.Ports {
2191
- grid-template-rows: minmax(0, 1fr) ${footerHeight}px;
2195
+ flex: 1 1 auto;
2192
2196
  }
2193
2197
 
2194
2198
  .PortsTable {
2195
- grid-template-rows: ${headerHeight}px minmax(0, 1fr);
2199
+ flex: 1 1 auto;
2200
+ }
2201
+
2202
+ .PortsTableHeader {
2203
+ flex: 0 0 ${headerHeight}px;
2204
+ }
2205
+
2206
+ .PortsFooter {
2207
+ flex: 0 0 ${footerHeight}px;
2196
2208
  }
2197
2209
 
2198
2210
  .PortsTableBody > .PortsTableRow:first-child {
@@ -2569,6 +2581,23 @@ const resize = (state, dimensions) => {
2569
2581
  });
2570
2582
  };
2571
2583
 
2584
+ const applyComponentState = (currentState, state) => {
2585
+ if (!state || typeof state !== 'object' || Array.isArray(state)) {
2586
+ throw new TypeError('Ports state must be an object');
2587
+ }
2588
+ const {
2589
+ uid
2590
+ } = state;
2591
+ const {
2592
+ uid: currentUid
2593
+ } = currentState;
2594
+ if (uid !== currentUid) {
2595
+ throw new Error(`Ports state uid must remain ${currentUid}`);
2596
+ }
2597
+ return state;
2598
+ };
2599
+ const setComponentState = wrapCommand(applyComponentState);
2600
+
2572
2601
  const toggleFocusedPort = state => {
2573
2602
  const {
2574
2603
  editing,
@@ -2594,6 +2623,7 @@ const commandMap = {
2594
2623
  'Ports.focusNext': wrapCommand(focusNext),
2595
2624
  'Ports.focusPrevious': wrapCommand(focusPrevious),
2596
2625
  'Ports.getCommandIds': getCommandIds,
2626
+ 'Ports.getComponentState': getComponentState,
2597
2627
  'Ports.getKeyBindings': getKeyBindings,
2598
2628
  'Ports.handleAddPortInput': wrapCommand(handleAddPortInput),
2599
2629
  'Ports.handleAddPortKeyDown': wrapCommand(handleAddPortKeyDown),
@@ -2610,6 +2640,7 @@ const commandMap = {
2610
2640
  'Ports.render2': render2,
2611
2641
  'Ports.renderEventListeners': renderEventListeners,
2612
2642
  'Ports.resize': wrapCommand(resize),
2643
+ 'Ports.setComponentState': setComponentState,
2613
2644
  'Ports.setDeltaY': wrapCommand(setDeltaY),
2614
2645
  'Ports.setPorts': wrapCommand(setPorts),
2615
2646
  'Ports.startAddPort': wrapCommand(startAddPort),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ports-view",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Ports View Worker",
5
5
  "repository": {
6
6
  "type": "git",