@lvce-editor/output-view 1.5.0 → 1.6.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.
@@ -1046,12 +1046,14 @@ const KeyCode = {
1046
1046
  const mergeClassNames = (...classNames) => {
1047
1047
  return classNames.filter(Boolean).join(' ');
1048
1048
  };
1049
+ const Button$1 = 1;
1049
1050
  const Div = 4;
1050
1051
  const Text = 12;
1051
1052
  const Select$2 = 63;
1052
1053
  const Option$1 = 64;
1053
1054
  const VirtualDomElements = {
1054
1055
  __proto__: null,
1056
+ Button: Button$1,
1055
1057
  Div,
1056
1058
  Option: Option$1,
1057
1059
  Select: Select$2};
@@ -1557,10 +1559,12 @@ const SharedProcess = 'SharedProcess';
1557
1559
  const loadOptions = async platform => {
1558
1560
  return [{
1559
1561
  id: MainProcess,
1562
+ label: 'Main Process',
1560
1563
  uri: 'file:///tmp/log-main-process.txt'
1561
1564
  }, {
1562
1565
  id: SharedProcess,
1563
- uri: 'File:///tmp/log-shared-process.txt'
1566
+ label: 'Shared Process',
1567
+ uri: 'file:///tmp/log-shared-process.txt'
1564
1568
  }];
1565
1569
  };
1566
1570
 
@@ -1674,6 +1678,8 @@ const renderFilterValue = (oldState, newState) => {
1674
1678
  return ['Viewlet.setValueByName', Filter, newState.filterValue];
1675
1679
  };
1676
1680
 
1681
+ const IconButton = 'IconButton';
1682
+ const MaskIcon = 'MaskIcon';
1677
1683
  const Actions = 'Actions';
1678
1684
  const Viewlet = 'Viewlet';
1679
1685
  const Output = 'Output';
@@ -1771,6 +1777,28 @@ const render2 = (uid, diffResult) => {
1771
1777
  return commands;
1772
1778
  };
1773
1779
 
1780
+ const getActionButtonVirtualDom = button => {
1781
+ const {
1782
+ id,
1783
+ label,
1784
+ icon
1785
+ } = button;
1786
+ return [{
1787
+ type: VirtualDomElements.Button,
1788
+ className: IconButton,
1789
+ name: id,
1790
+ title: label,
1791
+ childCount: 1
1792
+ }, {
1793
+ type: VirtualDomElements.Div,
1794
+ className: mergeClassNames(MaskIcon, icon)
1795
+ }];
1796
+ };
1797
+
1798
+ const getActionButtonsVirtualDom = buttons => {
1799
+ return buttons.flatMap(getActionButtonVirtualDom);
1800
+ };
1801
+
1774
1802
  const HandleBlur = 'handleBlur';
1775
1803
  const HandleClearFilterClick = 'handleClearFilterClick';
1776
1804
  const HandleContextMenu = 'handleContextMenu';
@@ -1779,11 +1807,16 @@ const HandlePointerDown = 'handlePointerDown';
1779
1807
  const HandleSelect = 'handleSelect';
1780
1808
 
1781
1809
  const getOptionVirtualDom = option => {
1810
+ const {
1811
+ id,
1812
+ label
1813
+ } = option;
1782
1814
  return [{
1783
1815
  type: VirtualDomElements.Option,
1784
1816
  className: Option,
1785
- childCount: 1
1786
- }, text(option.id)];
1817
+ childCount: 1,
1818
+ value: id
1819
+ }, text(label)];
1787
1820
  };
1788
1821
 
1789
1822
  const getSelectVirtualDom = options => {
@@ -1796,13 +1829,31 @@ const getSelectVirtualDom = options => {
1796
1829
  }, ...options.flatMap(getOptionVirtualDom)];
1797
1830
  };
1798
1831
 
1832
+ const getChildCount = buttonsLength => {
1833
+ const selectLength = 1;
1834
+ return buttonsLength + selectLength;
1835
+ };
1799
1836
  const getActionsVirtualDom = options => {
1837
+ const buttons = [{
1838
+ id: 'Clear',
1839
+ label: 'Clear',
1840
+ icon: 'MaskIconClearAll'
1841
+ }, {
1842
+ id: 'Scroll Lock',
1843
+ label: 'Scroll Lock',
1844
+ icon: 'MaskIconListFlat'
1845
+ }, {
1846
+ id: 'Settings',
1847
+ label: 'Settings',
1848
+ icon: 'MaskIconListFlat'
1849
+ }];
1850
+ const childCount = getChildCount(buttons.length);
1800
1851
  return [{
1801
1852
  type: VirtualDomElements.Div,
1802
1853
  className: Actions,
1803
1854
  role: AriaRoles.ToolBar,
1804
- childCount: 1
1805
- }, ...getSelectVirtualDom(options)];
1855
+ childCount
1856
+ }, ...getSelectVirtualDom(options), ...getActionButtonsVirtualDom(buttons)];
1806
1857
  };
1807
1858
 
1808
1859
  const renderActions = state => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/output-view",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Output View Worker",
5
5
  "repository": {
6
6
  "type": "git",