@lvce-editor/output-view 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.
@@ -960,7 +960,8 @@ const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
960
960
  workspaceUri,
961
961
  options: [],
962
962
  error: '',
963
- errorCode: 0
963
+ errorCode: 0,
964
+ buttons: []
964
965
  };
965
966
  set$1(id, state, state);
966
967
  };
@@ -1048,6 +1049,7 @@ const mergeClassNames = (...classNames) => {
1048
1049
  };
1049
1050
  const Button$1 = 1;
1050
1051
  const Div = 4;
1052
+ const Input = 6;
1051
1053
  const Text = 12;
1052
1054
  const Select$2 = 63;
1053
1055
  const Option$1 = 64;
@@ -1055,6 +1057,7 @@ const VirtualDomElements = {
1055
1057
  __proto__: null,
1056
1058
  Button: Button$1,
1057
1059
  Div,
1060
+ Input,
1058
1061
  Option: Option$1,
1059
1062
  Select: Select$2};
1060
1063
  const text = data => {
@@ -1115,6 +1118,13 @@ const getKeyBindings$1 = () => {
1115
1118
  }];
1116
1119
  };
1117
1120
 
1121
+ const handleButtonClick = async (state, name) => {
1122
+ // TODO
1123
+ return {
1124
+ ...state
1125
+ };
1126
+ };
1127
+
1118
1128
  const handleData = async state => {
1119
1129
  // TODO
1120
1130
  return {
@@ -1129,6 +1139,13 @@ const handleError = async state => {
1129
1139
  };
1130
1140
  };
1131
1141
 
1142
+ const handleFilterInput = async (state, value) => {
1143
+ return {
1144
+ ...state,
1145
+ filterValue: value
1146
+ };
1147
+ };
1148
+
1132
1149
  const rpcs = Object.create(null);
1133
1150
  const set$g = (id, rpc) => {
1134
1151
  rpcs[id] = rpc;
@@ -1551,6 +1568,22 @@ const getSelectedItem = platform => {
1551
1568
  return 'file:///tmp/log-main-process.txt';
1552
1569
  };
1553
1570
 
1571
+ const loadButtons = () => {
1572
+ return [{
1573
+ id: 'Clear',
1574
+ label: 'Clear',
1575
+ icon: 'MaskIconClearAll'
1576
+ }, {
1577
+ id: 'Scroll Lock',
1578
+ label: 'Scroll Lock',
1579
+ icon: 'MaskIconListFlat'
1580
+ }, {
1581
+ id: 'Settings',
1582
+ label: 'Settings',
1583
+ icon: 'MaskIconListFlat'
1584
+ }];
1585
+ };
1586
+
1554
1587
  const Filter = 'filter';
1555
1588
  const Output$2 = 'output';
1556
1589
  const MainProcess = 'MainProcess';
@@ -1586,6 +1619,7 @@ const loadContent = async (state, savedState) => {
1586
1619
  error,
1587
1620
  code
1588
1621
  } = await loadLines(selectedUri);
1622
+ const buttons = loadButtons();
1589
1623
  return {
1590
1624
  ...state,
1591
1625
  collapsedUris,
@@ -1594,7 +1628,8 @@ const loadContent = async (state, savedState) => {
1594
1628
  inputSource: Script,
1595
1629
  listItems: lines,
1596
1630
  options,
1597
- selectedOption: selectedUri
1631
+ selectedOption: selectedUri,
1632
+ buttons
1598
1633
  };
1599
1634
  };
1600
1635
 
@@ -1777,6 +1812,14 @@ const render2 = (uid, diffResult) => {
1777
1812
  return commands;
1778
1813
  };
1779
1814
 
1815
+ const HandleBlur = 'handleBlur';
1816
+ const HandleClearFilterClick = 'handleClearFilterClick';
1817
+ const HandleContextMenu = 'handleContextMenu';
1818
+ const HandleFilterInput = 'handleFilterInput';
1819
+ const HandlePointerDown = 'handlePointerDown';
1820
+ const HandleSelect = 'handleSelect';
1821
+ const HandleButtonClick = 'handleButtonClick';
1822
+
1780
1823
  const getActionButtonVirtualDom = button => {
1781
1824
  const {
1782
1825
  id,
@@ -1788,7 +1831,8 @@ const getActionButtonVirtualDom = button => {
1788
1831
  className: IconButton,
1789
1832
  name: id,
1790
1833
  title: label,
1791
- childCount: 1
1834
+ childCount: 1,
1835
+ onClick: HandleButtonClick
1792
1836
  }, {
1793
1837
  type: VirtualDomElements.Div,
1794
1838
  className: mergeClassNames(MaskIcon, icon)
@@ -1799,12 +1843,20 @@ const getActionButtonsVirtualDom = buttons => {
1799
1843
  return buttons.flatMap(getActionButtonVirtualDom);
1800
1844
  };
1801
1845
 
1802
- const HandleBlur = 'handleBlur';
1803
- const HandleClearFilterClick = 'handleClearFilterClick';
1804
- const HandleContextMenu = 'handleContextMenu';
1805
- const HandleFilterInput = 'handleFilterInput';
1806
- const HandlePointerDown = 'handlePointerDown';
1807
- const HandleSelect = 'handleSelect';
1846
+ const getFilterVirtualDom = () => {
1847
+ const placeholder = 'Filter';
1848
+ return [{
1849
+ type: VirtualDomElements.Div,
1850
+ className: 'Filter',
1851
+ childCount: 1
1852
+ }, {
1853
+ type: VirtualDomElements.Input,
1854
+ className: 'InputBox FilterInput',
1855
+ childCount: 0,
1856
+ placeholder,
1857
+ onInput: HandleFilterInput
1858
+ }];
1859
+ };
1808
1860
 
1809
1861
  const getOptionVirtualDom = option => {
1810
1862
  const {
@@ -1831,36 +1883,25 @@ const getSelectVirtualDom = options => {
1831
1883
 
1832
1884
  const getChildCount = buttonsLength => {
1833
1885
  const selectLength = 1;
1834
- return buttonsLength + selectLength;
1886
+ const filterCount = 1;
1887
+ return buttonsLength + filterCount + selectLength;
1835
1888
  };
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
- }];
1889
+ const getActionsVirtualDom = (options, buttons) => {
1850
1890
  const childCount = getChildCount(buttons.length);
1851
1891
  return [{
1852
1892
  type: VirtualDomElements.Div,
1853
1893
  className: Actions,
1854
1894
  role: AriaRoles.ToolBar,
1855
1895
  childCount
1856
- }, ...getSelectVirtualDom(options), ...getActionButtonsVirtualDom(buttons)];
1896
+ }, ...getFilterVirtualDom(), ...getSelectVirtualDom(options), ...getActionButtonsVirtualDom(buttons)];
1857
1897
  };
1858
1898
 
1859
1899
  const renderActions = state => {
1860
1900
  const {
1861
- options
1901
+ options,
1902
+ buttons
1862
1903
  } = state;
1863
- const dom = getActionsVirtualDom(options);
1904
+ const dom = getActionsVirtualDom(options, buttons);
1864
1905
  return dom;
1865
1906
  };
1866
1907
 
@@ -1868,6 +1909,9 @@ const renderEventListeners = () => {
1868
1909
  return [{
1869
1910
  name: HandleBlur,
1870
1911
  params: ['handleBlur']
1912
+ }, {
1913
+ name: HandleButtonClick,
1914
+ params: ['handleButtonClick', 'event.target.name']
1871
1915
  }, {
1872
1916
  name: HandleSelect,
1873
1917
  params: ['handleSelect', 'event.target.value']
@@ -1933,7 +1977,9 @@ const commandMap = {
1933
1977
  'Output.setOutputChannel': wrapCommand(setOutputChannel),
1934
1978
  'Output.getActions': getActions,
1935
1979
  'Output.terminate': terminate,
1936
- 'Output.handleSelect': wrapCommand(handleSelect)
1980
+ 'Output.handleSelect': wrapCommand(handleSelect),
1981
+ 'Output.handleFilterInput': wrapCommand(handleFilterInput),
1982
+ 'Output.handleButtonClick': wrapCommand(handleButtonClick)
1937
1983
  };
1938
1984
 
1939
1985
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/output-view",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Output View Worker",
5
5
  "repository": {
6
6
  "type": "git",