@lvce-editor/process-explorer-worker 3.8.0 → 3.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.
- package/index.js +39 -17
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -192,6 +192,8 @@ const {
|
|
|
192
192
|
wrapLoadContent
|
|
193
193
|
} = create$e();
|
|
194
194
|
|
|
195
|
+
const processExplorerUpdateInterval = 1000;
|
|
196
|
+
|
|
195
197
|
const getIncludeFrontendMemoryUsage = args => {
|
|
196
198
|
if (!args || typeof args !== 'object') {
|
|
197
199
|
return false;
|
|
@@ -199,6 +201,16 @@ const getIncludeFrontendMemoryUsage = args => {
|
|
|
199
201
|
const createArgs = args;
|
|
200
202
|
return createArgs.includeFrontendMemoryUsage === true;
|
|
201
203
|
};
|
|
204
|
+
const getUpdateInterval = args => {
|
|
205
|
+
if (!args || typeof args !== 'object') {
|
|
206
|
+
return processExplorerUpdateInterval;
|
|
207
|
+
}
|
|
208
|
+
const createArgs = args;
|
|
209
|
+
if (typeof createArgs.updateInterval !== 'number') {
|
|
210
|
+
return processExplorerUpdateInterval;
|
|
211
|
+
}
|
|
212
|
+
return createArgs.updateInterval;
|
|
213
|
+
};
|
|
202
214
|
const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0, assetDir = '') => {
|
|
203
215
|
const state = {
|
|
204
216
|
assetDir,
|
|
@@ -217,6 +229,7 @@ const create$d = (id, _uri, x, y, width, height, args, parentUid, platform = 0,
|
|
|
217
229
|
processes: [],
|
|
218
230
|
rootPid: -1,
|
|
219
231
|
uid: id,
|
|
232
|
+
updateInterval: getUpdateInterval(args),
|
|
220
233
|
visibleProcesses: [],
|
|
221
234
|
width,
|
|
222
235
|
x,
|
|
@@ -1507,7 +1520,6 @@ const Reference = 100;
|
|
|
1507
1520
|
|
|
1508
1521
|
const ClientX = 'event.clientX';
|
|
1509
1522
|
const ClientY = 'event.clientY';
|
|
1510
|
-
const TargetName = 'event.target.name';
|
|
1511
1523
|
|
|
1512
1524
|
const Enter = 3;
|
|
1513
1525
|
const Space = 9;
|
|
@@ -1625,8 +1637,6 @@ const diff2 = uid => {
|
|
|
1625
1637
|
return diff(oldState, scheduledState);
|
|
1626
1638
|
};
|
|
1627
1639
|
|
|
1628
|
-
const processExplorerUpdateInterval = 1000;
|
|
1629
|
-
|
|
1630
1640
|
const intervals = new Map();
|
|
1631
1641
|
const pending = new Set();
|
|
1632
1642
|
const dispose$3 = uid => {
|
|
@@ -1655,7 +1665,7 @@ const update = async uid => {
|
|
|
1655
1665
|
}
|
|
1656
1666
|
};
|
|
1657
1667
|
const start = (uid, interval = processExplorerUpdateInterval) => {
|
|
1658
|
-
if (interval
|
|
1668
|
+
if (interval <= 0 || intervals.has(uid)) {
|
|
1659
1669
|
return;
|
|
1660
1670
|
}
|
|
1661
1671
|
const intervalId = setInterval(() => {
|
|
@@ -1663,6 +1673,10 @@ const start = (uid, interval = processExplorerUpdateInterval) => {
|
|
|
1663
1673
|
}, interval);
|
|
1664
1674
|
intervals.set(uid, intervalId);
|
|
1665
1675
|
};
|
|
1676
|
+
const restart = (uid, interval) => {
|
|
1677
|
+
dispose$3(uid);
|
|
1678
|
+
start(uid, interval);
|
|
1679
|
+
};
|
|
1666
1680
|
|
|
1667
1681
|
const sendMessagePortToProcessExplorer = async port => {
|
|
1668
1682
|
await sendMessagePortToProcessExplorer$1(port);
|
|
@@ -1965,7 +1979,7 @@ const handleBlur = state => {
|
|
|
1965
1979
|
};
|
|
1966
1980
|
|
|
1967
1981
|
const handleClickAt = (state, index) => {
|
|
1968
|
-
return focusIndex(state, index);
|
|
1982
|
+
return focusIndex(state, Number(index));
|
|
1969
1983
|
};
|
|
1970
1984
|
|
|
1971
1985
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
@@ -1973,25 +1987,26 @@ const show2 = async (uid, menuId, x, y, args) => {
|
|
|
1973
1987
|
};
|
|
1974
1988
|
|
|
1975
1989
|
const handleContextMenu = async (state, index = state.focusedIndex, x = 0, y = 0) => {
|
|
1976
|
-
const
|
|
1990
|
+
const numericIndex = Number(index);
|
|
1991
|
+
const process = state.visibleProcesses[numericIndex];
|
|
1977
1992
|
if (!process) {
|
|
1978
1993
|
return state;
|
|
1979
1994
|
}
|
|
1980
1995
|
const newState = {
|
|
1981
1996
|
...state,
|
|
1982
1997
|
focused: false,
|
|
1983
|
-
focusedIndex:
|
|
1998
|
+
focusedIndex: numericIndex
|
|
1984
1999
|
};
|
|
1985
2000
|
set$6(state.uid, state, newState);
|
|
1986
2001
|
await show2(state.uid, ProcessExplorer$1, x, y, {
|
|
1987
|
-
index,
|
|
2002
|
+
index: numericIndex,
|
|
1988
2003
|
menuId: ProcessExplorer$1
|
|
1989
2004
|
});
|
|
1990
2005
|
return newState;
|
|
1991
2006
|
};
|
|
1992
2007
|
|
|
1993
2008
|
const handleDoubleClick = (state, index = state.focusedIndex) => {
|
|
1994
|
-
return toggleIndex(state, index);
|
|
2009
|
+
return toggleIndex(state, Number(index));
|
|
1995
2010
|
};
|
|
1996
2011
|
|
|
1997
2012
|
const handleFocus = state => {
|
|
@@ -2165,7 +2180,7 @@ const hasError$1 = state => {
|
|
|
2165
2180
|
const loadContent = async state => {
|
|
2166
2181
|
const newState = await refresh(state);
|
|
2167
2182
|
if (!hasError$1(newState)) {
|
|
2168
|
-
start(newState.uid);
|
|
2183
|
+
start(newState.uid, newState.updateInterval);
|
|
2169
2184
|
}
|
|
2170
2185
|
return {
|
|
2171
2186
|
error: undefined,
|
|
@@ -2511,9 +2526,6 @@ const getPaddingLeft = process => {
|
|
|
2511
2526
|
return '0';
|
|
2512
2527
|
}
|
|
2513
2528
|
const depthCh = (process.depth - 1) * 1.5;
|
|
2514
|
-
if (process.flags === None$2) {
|
|
2515
|
-
return `calc(${depthCh}ch + 17px)`;
|
|
2516
|
-
}
|
|
2517
2529
|
return `${depthCh}ch`;
|
|
2518
2530
|
};
|
|
2519
2531
|
const getAriaExpanded = process => {
|
|
@@ -2530,6 +2542,7 @@ const getCellDom = (className, value, index, paddingLeft) => {
|
|
|
2530
2542
|
return [{
|
|
2531
2543
|
childCount: 1,
|
|
2532
2544
|
className,
|
|
2545
|
+
'data-index': index,
|
|
2533
2546
|
name: String(index),
|
|
2534
2547
|
paddingLeft,
|
|
2535
2548
|
role: GridCell,
|
|
@@ -2696,19 +2709,19 @@ const renderEventListeners = () => {
|
|
|
2696
2709
|
params: ['handleBlur']
|
|
2697
2710
|
}, {
|
|
2698
2711
|
name: HandleClick,
|
|
2699
|
-
params: ['handleClickAt',
|
|
2712
|
+
params: ['handleClickAt', 'event.target.dataset.index'],
|
|
2700
2713
|
preventDefault: true
|
|
2701
2714
|
}, {
|
|
2702
2715
|
name: HandleDoubleClick,
|
|
2703
|
-
params: ['handleDoubleClick',
|
|
2716
|
+
params: ['handleDoubleClick', 'event.target.dataset.index'],
|
|
2704
2717
|
preventDefault: true
|
|
2705
2718
|
}, {
|
|
2706
2719
|
name: HandleContextMenu,
|
|
2707
|
-
params: ['handleContextMenu',
|
|
2720
|
+
params: ['handleContextMenu', 'event.target.dataset.index', ClientX, ClientY],
|
|
2708
2721
|
preventDefault: true
|
|
2709
2722
|
}, {
|
|
2710
2723
|
name: HandlePointerDown,
|
|
2711
|
-
params: ['handleClickAt',
|
|
2724
|
+
params: ['handleClickAt', 'event.target.dataset.index']
|
|
2712
2725
|
}];
|
|
2713
2726
|
};
|
|
2714
2727
|
|
|
@@ -2762,6 +2775,14 @@ const setRootProcessId = (state, rootPid) => {
|
|
|
2762
2775
|
};
|
|
2763
2776
|
};
|
|
2764
2777
|
|
|
2778
|
+
const setUpdateInterval = (state, updateInterval) => {
|
|
2779
|
+
restart(state.uid, updateInterval);
|
|
2780
|
+
return {
|
|
2781
|
+
...state,
|
|
2782
|
+
updateInterval
|
|
2783
|
+
};
|
|
2784
|
+
};
|
|
2785
|
+
|
|
2765
2786
|
const commandMap = {
|
|
2766
2787
|
'ProcessExplorer.collapseAll': wrapCommand(collapseAll),
|
|
2767
2788
|
'ProcessExplorer.create': create$d,
|
|
@@ -2793,6 +2814,7 @@ const commandMap = {
|
|
|
2793
2814
|
'ProcessExplorer.renderEventListeners': renderEventListeners,
|
|
2794
2815
|
'ProcessExplorer.setError': wrapCommand(setError),
|
|
2795
2816
|
'ProcessExplorer.setRootProcessId': wrapCommand(setRootProcessId),
|
|
2817
|
+
'ProcessExplorer.setUpdateInterval': wrapCommand(setUpdateInterval),
|
|
2796
2818
|
'ProcessExplorer.terminate': terminate,
|
|
2797
2819
|
'ProcessExplorer.update': wrapCommand(refresh)
|
|
2798
2820
|
};
|