@lvce-editor/output-view 1.4.0 → 1.5.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/outputViewWorkerMain.js +97 -38
- package/package.json +1 -1
|
@@ -934,7 +934,8 @@ const Script = 2;
|
|
|
934
934
|
const {
|
|
935
935
|
get: get$1,
|
|
936
936
|
set: set$1,
|
|
937
|
-
wrapCommand
|
|
937
|
+
wrapCommand,
|
|
938
|
+
wrapGetter
|
|
938
939
|
} = create$2();
|
|
939
940
|
|
|
940
941
|
const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
@@ -1047,9 +1048,13 @@ const mergeClassNames = (...classNames) => {
|
|
|
1047
1048
|
};
|
|
1048
1049
|
const Div = 4;
|
|
1049
1050
|
const Text = 12;
|
|
1051
|
+
const Select$2 = 63;
|
|
1052
|
+
const Option$1 = 64;
|
|
1050
1053
|
const VirtualDomElements = {
|
|
1051
1054
|
__proto__: null,
|
|
1052
|
-
Div
|
|
1055
|
+
Div,
|
|
1056
|
+
Option: Option$1,
|
|
1057
|
+
Select: Select$2};
|
|
1053
1058
|
const text = data => {
|
|
1054
1059
|
return {
|
|
1055
1060
|
type: Text,
|
|
@@ -1122,12 +1127,6 @@ const handleError = async state => {
|
|
|
1122
1127
|
};
|
|
1123
1128
|
};
|
|
1124
1129
|
|
|
1125
|
-
const initialize = async () => {};
|
|
1126
|
-
|
|
1127
|
-
const getSelectedItem = platform => {
|
|
1128
|
-
return 'file:///tmp/log-main-process.txt';
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
1130
|
const rpcs = Object.create(null);
|
|
1132
1131
|
const set$g = (id, rpc) => {
|
|
1133
1132
|
rpcs[id] = rpc;
|
|
@@ -1522,6 +1521,49 @@ const loadLines = async uri => {
|
|
|
1522
1521
|
}
|
|
1523
1522
|
};
|
|
1524
1523
|
|
|
1524
|
+
const handleSelect = async (state, id) => {
|
|
1525
|
+
const {
|
|
1526
|
+
options
|
|
1527
|
+
} = state;
|
|
1528
|
+
const matchingOption = options.find(option => option.id === id);
|
|
1529
|
+
if (!matchingOption) {
|
|
1530
|
+
return state;
|
|
1531
|
+
}
|
|
1532
|
+
// TODO potential race condtion when switching output channels fast
|
|
1533
|
+
const {
|
|
1534
|
+
lines,
|
|
1535
|
+
error,
|
|
1536
|
+
code
|
|
1537
|
+
} = await loadLines(matchingOption.uri);
|
|
1538
|
+
return {
|
|
1539
|
+
...state,
|
|
1540
|
+
listItems: lines,
|
|
1541
|
+
error,
|
|
1542
|
+
errorCode: code
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1546
|
+
const initialize = async () => {};
|
|
1547
|
+
|
|
1548
|
+
const getSelectedItem = platform => {
|
|
1549
|
+
return 'file:///tmp/log-main-process.txt';
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
const Filter = 'filter';
|
|
1553
|
+
const Output$2 = 'output';
|
|
1554
|
+
const MainProcess = 'MainProcess';
|
|
1555
|
+
const SharedProcess = 'SharedProcess';
|
|
1556
|
+
|
|
1557
|
+
const loadOptions = async platform => {
|
|
1558
|
+
return [{
|
|
1559
|
+
id: MainProcess,
|
|
1560
|
+
uri: 'file:///tmp/log-main-process.txt'
|
|
1561
|
+
}, {
|
|
1562
|
+
id: SharedProcess,
|
|
1563
|
+
uri: 'File:///tmp/log-shared-process.txt'
|
|
1564
|
+
}];
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1525
1567
|
const isString = value => {
|
|
1526
1568
|
return typeof value === 'string';
|
|
1527
1569
|
};
|
|
@@ -1534,6 +1576,7 @@ const getSavedCollapsedUris = savedState => {
|
|
|
1534
1576
|
const loadContent = async (state, savedState) => {
|
|
1535
1577
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1536
1578
|
const selectedUri = getSelectedItem();
|
|
1579
|
+
const options = await loadOptions();
|
|
1537
1580
|
const {
|
|
1538
1581
|
lines,
|
|
1539
1582
|
error,
|
|
@@ -1546,7 +1589,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1546
1589
|
errorCode: code,
|
|
1547
1590
|
inputSource: Script,
|
|
1548
1591
|
listItems: lines,
|
|
1549
|
-
options
|
|
1592
|
+
options,
|
|
1550
1593
|
selectedOption: selectedUri
|
|
1551
1594
|
};
|
|
1552
1595
|
};
|
|
@@ -1559,7 +1602,7 @@ const openFindWidget = async state => {
|
|
|
1559
1602
|
};
|
|
1560
1603
|
|
|
1561
1604
|
const Button = 1;
|
|
1562
|
-
const Select = 2;
|
|
1605
|
+
const Select$1 = 2;
|
|
1563
1606
|
|
|
1564
1607
|
const Blank = 'Blank';
|
|
1565
1608
|
const ClearAll = 'ClearAll';
|
|
@@ -1609,7 +1652,7 @@ const getActions = state => {
|
|
|
1609
1652
|
options
|
|
1610
1653
|
} = state;
|
|
1611
1654
|
return [{
|
|
1612
|
-
type: Select,
|
|
1655
|
+
type: Select$1,
|
|
1613
1656
|
id: output(),
|
|
1614
1657
|
options: toSelectOptions(options)
|
|
1615
1658
|
}, {
|
|
@@ -1627,8 +1670,6 @@ const getActions = state => {
|
|
|
1627
1670
|
}];
|
|
1628
1671
|
};
|
|
1629
1672
|
|
|
1630
|
-
const Filter = 'filter';
|
|
1631
|
-
|
|
1632
1673
|
const renderFilterValue = (oldState, newState) => {
|
|
1633
1674
|
return ['Viewlet.setValueByName', Filter, newState.filterValue];
|
|
1634
1675
|
};
|
|
@@ -1636,6 +1677,8 @@ const renderFilterValue = (oldState, newState) => {
|
|
|
1636
1677
|
const Actions = 'Actions';
|
|
1637
1678
|
const Viewlet = 'Viewlet';
|
|
1638
1679
|
const Output = 'Output';
|
|
1680
|
+
const Option = 'Option';
|
|
1681
|
+
const Select = 'Select';
|
|
1639
1682
|
|
|
1640
1683
|
const parentNode = {
|
|
1641
1684
|
type: VirtualDomElements.Div,
|
|
@@ -1728,40 +1771,55 @@ const render2 = (uid, diffResult) => {
|
|
|
1728
1771
|
return commands;
|
|
1729
1772
|
};
|
|
1730
1773
|
|
|
1731
|
-
const
|
|
1774
|
+
const HandleBlur = 'handleBlur';
|
|
1775
|
+
const HandleClearFilterClick = 'handleClearFilterClick';
|
|
1776
|
+
const HandleContextMenu = 'handleContextMenu';
|
|
1777
|
+
const HandleFilterInput = 'handleFilterInput';
|
|
1778
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
1779
|
+
const HandleSelect = 'handleSelect';
|
|
1780
|
+
|
|
1781
|
+
const getOptionVirtualDom = option => {
|
|
1732
1782
|
return [{
|
|
1733
|
-
type: VirtualDomElements.
|
|
1783
|
+
type: VirtualDomElements.Option,
|
|
1784
|
+
className: Option,
|
|
1734
1785
|
childCount: 1
|
|
1735
|
-
}, text(
|
|
1786
|
+
}, text(option.id)];
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
const getSelectVirtualDom = options => {
|
|
1790
|
+
return [{
|
|
1791
|
+
type: VirtualDomElements.Select,
|
|
1792
|
+
className: Select,
|
|
1793
|
+
childCount: options.length,
|
|
1794
|
+
name: Output$2,
|
|
1795
|
+
onChange: HandleSelect
|
|
1796
|
+
}, ...options.flatMap(getOptionVirtualDom)];
|
|
1736
1797
|
};
|
|
1737
|
-
|
|
1798
|
+
|
|
1799
|
+
const getActionsVirtualDom = options => {
|
|
1738
1800
|
return [{
|
|
1739
1801
|
type: VirtualDomElements.Div,
|
|
1740
1802
|
className: Actions,
|
|
1741
1803
|
role: AriaRoles.ToolBar,
|
|
1742
|
-
childCount:
|
|
1743
|
-
}, ...
|
|
1804
|
+
childCount: 1
|
|
1805
|
+
}, ...getSelectVirtualDom(options)];
|
|
1744
1806
|
};
|
|
1745
1807
|
|
|
1746
|
-
const renderActions =
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
const dom = getActionsVirtualDom(actions);
|
|
1808
|
+
const renderActions = state => {
|
|
1809
|
+
const {
|
|
1810
|
+
options
|
|
1811
|
+
} = state;
|
|
1812
|
+
const dom = getActionsVirtualDom(options);
|
|
1752
1813
|
return dom;
|
|
1753
1814
|
};
|
|
1754
1815
|
|
|
1755
|
-
const HandleBlur = 'handleBlur';
|
|
1756
|
-
const HandleClearFilterClick = 'handleClearFilterClick';
|
|
1757
|
-
const HandleContextMenu = 'handleContextMenu';
|
|
1758
|
-
const HandleFilterInput = 'handleFilterInput';
|
|
1759
|
-
const HandlePointerDown = 'handlePointerDown';
|
|
1760
|
-
|
|
1761
1816
|
const renderEventListeners = () => {
|
|
1762
1817
|
return [{
|
|
1763
1818
|
name: HandleBlur,
|
|
1764
1819
|
params: ['handleBlur']
|
|
1820
|
+
}, {
|
|
1821
|
+
name: HandleSelect,
|
|
1822
|
+
params: ['handleSelect', 'event.target.value']
|
|
1765
1823
|
}, {
|
|
1766
1824
|
name: HandleContextMenu,
|
|
1767
1825
|
params: ['handleContextMenu', 'event.clientX', 'event.clientY'],
|
|
@@ -1805,25 +1863,26 @@ const setOutputChannel = async state => {
|
|
|
1805
1863
|
};
|
|
1806
1864
|
|
|
1807
1865
|
const commandMap = {
|
|
1808
|
-
'Output.closeFindWidget': closeFindWidget,
|
|
1866
|
+
'Output.closeFindWidget': wrapCommand(closeFindWidget),
|
|
1809
1867
|
'Output.create': create$1,
|
|
1810
1868
|
'Output.diff2': diff2,
|
|
1811
1869
|
'Output.focusIndex': wrapCommand(focusIndex),
|
|
1812
1870
|
'Output.getCommandIds': getCommandIds,
|
|
1813
1871
|
'Output.getKeyBindings': getKeyBindings$1,
|
|
1814
|
-
'Output.handleData': handleData,
|
|
1815
|
-
'Output.handleError': handleError,
|
|
1872
|
+
'Output.handleData': wrapCommand(handleData),
|
|
1873
|
+
'Output.handleError': wrapCommand(handleError),
|
|
1816
1874
|
'Output.initialize': initialize,
|
|
1817
1875
|
'Output.loadContent2': wrapCommand(loadContent),
|
|
1818
|
-
'Output.openFindWidget': openFindWidget,
|
|
1876
|
+
'Output.openFindWidget': wrapCommand(openFindWidget),
|
|
1819
1877
|
'Output.render2': render2,
|
|
1820
|
-
'Output.renderActions': renderActions,
|
|
1878
|
+
'Output.renderActions': wrapGetter(renderActions),
|
|
1821
1879
|
'Output.renderEventListeners': renderEventListeners,
|
|
1822
1880
|
'Output.resize': resize,
|
|
1823
1881
|
'Output.saveState': saveState,
|
|
1824
|
-
'Output.setOutputChannel': setOutputChannel,
|
|
1882
|
+
'Output.setOutputChannel': wrapCommand(setOutputChannel),
|
|
1825
1883
|
'Output.getActions': getActions,
|
|
1826
|
-
'Output.terminate': terminate
|
|
1884
|
+
'Output.terminate': terminate,
|
|
1885
|
+
'Output.handleSelect': wrapCommand(handleSelect)
|
|
1827
1886
|
};
|
|
1828
1887
|
|
|
1829
1888
|
const {
|