@lvce-editor/panel-worker 1.6.0 → 1.7.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.
- package/dist/panelWorkerMain.js +39 -14
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -64,7 +64,7 @@ const Object$1 = 1;
|
|
|
64
64
|
const Number$1 = 2;
|
|
65
65
|
const Array$1 = 3;
|
|
66
66
|
const String = 4;
|
|
67
|
-
const Boolean = 5;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
68
|
const Function = 6;
|
|
69
69
|
const Null = 7;
|
|
70
70
|
const Unknown = 8;
|
|
@@ -85,7 +85,7 @@ const getType = value => {
|
|
|
85
85
|
}
|
|
86
86
|
return Object$1;
|
|
87
87
|
case 'boolean':
|
|
88
|
-
return Boolean;
|
|
88
|
+
return Boolean$1;
|
|
89
89
|
default:
|
|
90
90
|
return Unknown;
|
|
91
91
|
}
|
|
@@ -893,9 +893,10 @@ const Div = 4;
|
|
|
893
893
|
const Text = 12;
|
|
894
894
|
const Reference = 100;
|
|
895
895
|
|
|
896
|
+
const TargetName = 'event.target.name';
|
|
897
|
+
|
|
896
898
|
const RendererWorker = 1;
|
|
897
899
|
|
|
898
|
-
const SetDom2 = 'Viewlet.setDom2';
|
|
899
900
|
const SetPatches = 'Viewlet.setPatches';
|
|
900
901
|
|
|
901
902
|
const createMockRpc = ({
|
|
@@ -1093,7 +1094,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1093
1094
|
};
|
|
1094
1095
|
|
|
1095
1096
|
const isEqual = (oldState, newState) => {
|
|
1096
|
-
return oldState.assetDir === newState.assetDir && oldState.initial === newState.initial && oldState.currentViewletId === newState.currentViewletId && oldState.selectedIndex === newState.selectedIndex && oldState.views === newState.views;
|
|
1097
|
+
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;
|
|
1097
1098
|
};
|
|
1098
1099
|
|
|
1099
1100
|
const RenderItems = 4;
|
|
@@ -1204,7 +1205,10 @@ const loadContent = (state, savedState) => {
|
|
|
1204
1205
|
};
|
|
1205
1206
|
|
|
1206
1207
|
const selectIndex = async (state, index) => {
|
|
1207
|
-
|
|
1208
|
+
const {
|
|
1209
|
+
views
|
|
1210
|
+
} = state;
|
|
1211
|
+
await openViewlet(state, views[index]);
|
|
1208
1212
|
return {
|
|
1209
1213
|
...state,
|
|
1210
1214
|
selectedIndex: index
|
|
@@ -1239,6 +1243,21 @@ const toggleView = async (state, name) => {
|
|
|
1239
1243
|
return selectIndex(state, index);
|
|
1240
1244
|
};
|
|
1241
1245
|
|
|
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
|
+
const mergeClassNames = (...classNames) => {
|
|
1258
|
+
return classNames.filter(Boolean).join(' ');
|
|
1259
|
+
};
|
|
1260
|
+
|
|
1242
1261
|
const text = data => {
|
|
1243
1262
|
return {
|
|
1244
1263
|
childCount: 0,
|
|
@@ -1567,6 +1586,7 @@ const getActionsDom = newState => {
|
|
|
1567
1586
|
const HandleClickClose = 'handleClickClose';
|
|
1568
1587
|
const HandleClickMaximize = 'handleClickMaximize';
|
|
1569
1588
|
const HandleClickSelectTab = 'HandleClickSelectTab';
|
|
1589
|
+
const HandleClickTab = 'HandleClickTab';
|
|
1570
1590
|
|
|
1571
1591
|
const emptyObject = {};
|
|
1572
1592
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
@@ -1594,7 +1614,7 @@ const getGlobalActionsDom = () => {
|
|
|
1594
1614
|
return [{
|
|
1595
1615
|
childCount: 2,
|
|
1596
1616
|
className: PanelToolBar,
|
|
1597
|
-
role:
|
|
1617
|
+
role: ToolBar,
|
|
1598
1618
|
type: Div
|
|
1599
1619
|
}, {
|
|
1600
1620
|
ariaLabel: maximize(),
|
|
@@ -1605,7 +1625,7 @@ const getGlobalActionsDom = () => {
|
|
|
1605
1625
|
type: Button
|
|
1606
1626
|
}, {
|
|
1607
1627
|
childCount: 0,
|
|
1608
|
-
className:
|
|
1628
|
+
className: mergeClassNames(MaskIcon, MaskIconChevronUp),
|
|
1609
1629
|
type: Div
|
|
1610
1630
|
}, {
|
|
1611
1631
|
ariaLabel: close(),
|
|
@@ -1616,7 +1636,7 @@ const getGlobalActionsDom = () => {
|
|
|
1616
1636
|
type: Button
|
|
1617
1637
|
}, {
|
|
1618
1638
|
childCount: 0,
|
|
1619
|
-
className:
|
|
1639
|
+
className: mergeClassNames(MaskIcon, MaskIconClose),
|
|
1620
1640
|
type: Div
|
|
1621
1641
|
}];
|
|
1622
1642
|
};
|
|
@@ -1628,6 +1648,7 @@ const getTabClassName = isSelected => {
|
|
|
1628
1648
|
}
|
|
1629
1649
|
return className;
|
|
1630
1650
|
};
|
|
1651
|
+
|
|
1631
1652
|
const createPanelTab = (tab, badgeCount, isSelected, index) => {
|
|
1632
1653
|
const label = tab;
|
|
1633
1654
|
const className = getTabClassName(isSelected);
|
|
@@ -1673,6 +1694,7 @@ const getPanelHeaderDom = newState => {
|
|
|
1673
1694
|
}, {
|
|
1674
1695
|
childCount: newState.views.length,
|
|
1675
1696
|
className: PanelTabs,
|
|
1697
|
+
role: 'tablist',
|
|
1676
1698
|
type: Div
|
|
1677
1699
|
}, ...tabsDom, ...getActionsDom(newState), ...getGlobalActionsDom()];
|
|
1678
1700
|
};
|
|
@@ -1693,19 +1715,18 @@ const getPanelDom = newState => {
|
|
|
1693
1715
|
|
|
1694
1716
|
const renderItems = (oldState, newState) => {
|
|
1695
1717
|
const {
|
|
1696
|
-
initial
|
|
1697
|
-
uid
|
|
1718
|
+
initial
|
|
1698
1719
|
} = newState;
|
|
1699
1720
|
if (initial) {
|
|
1700
|
-
return [
|
|
1721
|
+
return [];
|
|
1701
1722
|
}
|
|
1702
1723
|
const dom = getPanelDom(newState);
|
|
1703
|
-
return
|
|
1724
|
+
return dom;
|
|
1704
1725
|
};
|
|
1705
1726
|
|
|
1706
1727
|
const renderIncremental = (oldState, newState) => {
|
|
1707
|
-
const oldDom = renderItems(oldState, oldState)
|
|
1708
|
-
const newDom = renderItems(newState, newState)
|
|
1728
|
+
const oldDom = renderItems(oldState, oldState);
|
|
1729
|
+
const newDom = renderItems(newState, newState);
|
|
1709
1730
|
const patches = diffTree(oldDom, newDom);
|
|
1710
1731
|
return [SetPatches, newState.uid, patches];
|
|
1711
1732
|
};
|
|
@@ -1753,6 +1774,9 @@ const renderEventListeners = () => {
|
|
|
1753
1774
|
}, {
|
|
1754
1775
|
name: HandleClickSelectTab,
|
|
1755
1776
|
params: ['selectIndexRaw', 'event.target.dataset.index']
|
|
1777
|
+
}, {
|
|
1778
|
+
name: HandleClickTab,
|
|
1779
|
+
params: ['selectName', TargetName]
|
|
1756
1780
|
}];
|
|
1757
1781
|
};
|
|
1758
1782
|
|
|
@@ -1803,6 +1827,7 @@ const commandMap = {
|
|
|
1803
1827
|
'Panel.saveState': wrapGetter(saveState),
|
|
1804
1828
|
'Panel.selectIndex': wrapCommand(selectIndex),
|
|
1805
1829
|
'Panel.selectIndexRaw': wrapCommand(selectRaw),
|
|
1830
|
+
'Panel.selectName': wrapCommand(selectName),
|
|
1806
1831
|
'Panel.setBadgeCount': wrapCommand(setBadgeCount),
|
|
1807
1832
|
'Panel.terminate': terminate,
|
|
1808
1833
|
'Panel.toggleView': wrapCommand(toggleView)
|