@lvce-editor/panel-worker 1.8.0 → 1.10.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.
@@ -1181,15 +1181,17 @@ const getContentDimensions = dimensions => {
1181
1181
  const openViewlet = async (state, id, focus = false) => {
1182
1182
  const childDimensions = getContentDimensions(state);
1183
1183
  const childUid = Math.random();
1184
- const tabId = 1234;
1184
+ const tabId = Math.random();
1185
1185
  const actionsUid = Math.random();
1186
+ const index = state.views.indexOf(id);
1186
1187
  await createViewlet(id, childUid, tabId, childDimensions, '');
1187
1188
  return {
1188
1189
  ...state,
1189
1190
  actionsUid,
1190
1191
  childUid,
1191
1192
  currentViewletId: id,
1192
- initial: false
1193
+ initial: false,
1194
+ selectedIndex: index
1193
1195
  };
1194
1196
  };
1195
1197
 
@@ -1208,11 +1210,7 @@ const selectIndex = async (state, index) => {
1208
1210
  const {
1209
1211
  views
1210
1212
  } = state;
1211
- await openViewlet(state, views[index]);
1212
- return {
1213
- ...state,
1214
- selectedIndex: index
1215
- };
1213
+ return openViewlet(state, views[index]);
1216
1214
  };
1217
1215
 
1218
1216
  const selectRaw = async (state, rawIndex) => {
@@ -1243,17 +1241,6 @@ const toggleView = async (state, name) => {
1243
1241
  return selectIndex(state, index);
1244
1242
  };
1245
1243
 
1246
- const selectName = async (state, name) => {
1247
- if (!name) {
1248
- return state;
1249
- }
1250
- const index = state.views.indexOf(name);
1251
- if (index === -1) {
1252
- return state;
1253
- }
1254
- return selectIndex(state, index);
1255
- };
1256
-
1257
1244
  const mergeClassNames = (...classNames) => {
1258
1245
  return classNames.filter(Boolean).join(' ');
1259
1246
  };
@@ -1569,7 +1556,7 @@ const Actions = 'Actions';
1569
1556
 
1570
1557
  const getActionsDom = newState => {
1571
1558
  const actions = newState.actionsUid || -1;
1572
- if (actions === -1) {
1559
+ if (actions === -1 || Map) {
1573
1560
  return [{
1574
1561
  childCount: 0,
1575
1562
  className: Actions,
@@ -1811,6 +1798,17 @@ const saveState = state => {
1811
1798
  };
1812
1799
  };
1813
1800
 
1801
+ const selectName = async (state, name) => {
1802
+ if (!name) {
1803
+ return state;
1804
+ }
1805
+ const index = state.views.indexOf(name);
1806
+ if (index === -1) {
1807
+ return state;
1808
+ }
1809
+ return selectIndex(state, index);
1810
+ };
1811
+
1814
1812
  const commandMap = {
1815
1813
  'Panel.create': create,
1816
1814
  'Panel.diff2': diff2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/panel-worker",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Panel Worker",
5
5
  "repository": {
6
6
  "type": "git",