@lvce-editor/panel-worker 1.9.0 → 1.11.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.
@@ -1093,15 +1093,20 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
1093
1093
  set(uid, state, state);
1094
1094
  };
1095
1095
 
1096
+ const isEqual$1 = (oldState, newState) => {
1097
+ return oldState.childUid === newState.childUid;
1098
+ };
1099
+
1096
1100
  const isEqual = (oldState, newState) => {
1097
1101
  return oldState.assetDir === newState.assetDir && oldState.initial === newState.initial && oldState.currentViewletId === newState.currentViewletId && oldState.selectedIndex === newState.selectedIndex && oldState.views === newState.views && oldState.childUid === newState.childUid && oldState.actionsUid === newState.actionsUid;
1098
1102
  };
1099
1103
 
1100
1104
  const RenderItems = 4;
1101
1105
  const RenderIncremental = 11;
1106
+ const RenderChildUid = 12;
1102
1107
 
1103
- const modules = [isEqual];
1104
- const numbers = [RenderIncremental];
1108
+ const modules = [isEqual, isEqual$1];
1109
+ const numbers = [RenderIncremental, RenderChildUid];
1105
1110
 
1106
1111
  const diff = (oldState, newState) => {
1107
1112
  const diffResult = [];
@@ -1241,15 +1246,13 @@ const toggleView = async (state, name) => {
1241
1246
  return selectIndex(state, index);
1242
1247
  };
1243
1248
 
1244
- const selectName = async (state, name) => {
1245
- if (!name) {
1246
- return state;
1247
- }
1248
- const index = state.views.indexOf(name);
1249
- if (index === -1) {
1250
- return state;
1249
+ // TODO also need to dispose child when panel becomes hidden
1250
+ const renderChildUid = (oldState, newState) => {
1251
+ const oldChildUid = oldState.childUid;
1252
+ if (oldChildUid <= 0 || oldChildUid === newState.childUid) {
1253
+ return [];
1251
1254
  }
1252
- return selectIndex(state, index);
1255
+ return ['Viewlet.dispose', oldChildUid];
1253
1256
  };
1254
1257
 
1255
1258
  const mergeClassNames = (...classNames) => {
@@ -1567,7 +1570,7 @@ const Actions = 'Actions';
1567
1570
 
1568
1571
  const getActionsDom = newState => {
1569
1572
  const actions = newState.actionsUid || -1;
1570
- if (actions === -1) {
1573
+ if (actions === -1 || Map) {
1571
1574
  return [{
1572
1575
  childCount: 0,
1573
1576
  className: Actions,
@@ -1731,6 +1734,8 @@ const renderIncremental = (oldState, newState) => {
1731
1734
 
1732
1735
  const getRenderer = diffType => {
1733
1736
  switch (diffType) {
1737
+ case RenderChildUid:
1738
+ return renderChildUid;
1734
1739
  case RenderIncremental:
1735
1740
  return renderIncremental;
1736
1741
  case RenderItems:
@@ -1809,6 +1814,17 @@ const saveState = state => {
1809
1814
  };
1810
1815
  };
1811
1816
 
1817
+ const selectName = async (state, name) => {
1818
+ if (!name) {
1819
+ return state;
1820
+ }
1821
+ const index = state.views.indexOf(name);
1822
+ if (index === -1) {
1823
+ return state;
1824
+ }
1825
+ return selectIndex(state, index);
1826
+ };
1827
+
1812
1828
  const commandMap = {
1813
1829
  'Panel.create': create,
1814
1830
  'Panel.diff2': diff2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/panel-worker",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Panel Worker",
5
5
  "repository": {
6
6
  "type": "git",