react-terminal-viewer-cicd 2.1.0 → 3.0.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/README.md +11 -11
- package/dist/esm/Addon/EventEmiter.d.ts +1 -1
- package/dist/esm/Addon/HighlightAddon.d.ts +1 -1
- package/dist/esm/Addon/SearchAddon.d.ts +1 -1
- package/dist/esm/Addon/WorkerLog/LogWorker.js +1 -1
- package/dist/esm/Addon/WorkerLog/Logs.js +0 -2
- package/dist/esm/Addon/useAddon.d.ts +5 -5
- package/dist/esm/Addon/useAddon.js +1 -1
- package/dist/esm/Hooks/useDebounceInput.js +1 -1
- package/dist/esm/Hooks/useLocalStore.js +1 -1
- package/dist/esm/TerminalViewer/index.d.ts +4 -4
- package/dist/esm/TerminalViewer/index.js +4 -4
- package/dist/esm/TerminalViewerBody/index.d.ts +8 -8
- package/dist/esm/TerminalViewerBody/index.js +7 -7
- package/dist/esm/TerminalViewerVirtualDom/ReactVirtualized.d.ts +71 -0
- package/dist/esm/TerminalViewerVirtualDom/ReactVirtualized.js +309 -0
- package/dist/esm/TerminalViewerVirtualDom/ReactVirtuoso.d.ts +67 -0
- package/dist/esm/TerminalViewerVirtualDom/ReactVirtuoso.js +259 -0
- package/dist/esm/TerminalViewerVirtualDom/index.d.ts +1 -70
- package/dist/esm/TerminalViewerVirtualDom/index.js +2 -308
- package/dist/esm/TerminalViewerVirtualDom/{index.less → virtualized.less} +1 -1
- package/dist/esm/TerminalViewerVirtualDom/virtuoso.less +67 -0
- package/dist/esm/__mocks__/react-virtualized.js +14 -0
- package/dist/esm/__mocks__/styleMock.js +1 -0
- package/dist/esm/index.d.ts +4 -5
- package/dist/esm/index.js +4 -5
- package/dist/esm/mock/index.d.ts +3 -0
- package/dist/esm/mock/index.js +3 -0
- package/dist/esm/types.d.ts +4 -4
- package/dist/worker/.dumi/tmp/core/defineApp.d.ts +22 -0
- package/dist/worker/.dumi/tmp/core/exportStaticRuntimePlugin.d.ts +1 -0
- package/dist/worker/.dumi/tmp/core/helmet.d.ts +3 -0
- package/dist/worker/.dumi/tmp/core/helmetContext.d.ts +1 -0
- package/dist/worker/.dumi/tmp/core/history.d.ts +5 -0
- package/dist/worker/.dumi/tmp/core/historyIntelli.d.ts +50 -0
- package/dist/worker/.dumi/tmp/core/plugin.d.ts +8 -0
- package/dist/worker/.dumi/tmp/core/pluginConfig.d.ts +341 -0
- package/dist/worker/.dumi/tmp/core/route.d.ts +83 -0
- package/dist/worker/.dumi/tmp/core/terminal.d.ts +14 -0
- package/dist/worker/.dumi/tmp/dumi/exports.d.ts +3 -0
- package/dist/worker/.dumi/tmp/dumi/locales/config.d.ts +106 -0
- package/dist/worker/.dumi/tmp/dumi/locales/runtime.d.ts +2 -0
- package/dist/worker/.dumi/tmp/dumi/meta/atoms.d.ts +1 -0
- package/dist/worker/.dumi/tmp/dumi/meta/exports.d.ts +31 -0
- package/dist/worker/.dumi/tmp/dumi/meta/index.d.ts +39 -0
- package/dist/worker/.dumi/tmp/dumi/meta/runtime.d.ts +3 -0
- package/dist/worker/.dumi/tmp/dumi/meta/tabs.d.ts +1 -0
- package/dist/worker/.dumi/tmp/dumi/theme/ContextWrapper.d.ts +2 -0
- package/dist/worker/.dumi/tmp/exports.d.ts +10 -0
- package/dist/worker/.dumi/tmp/plugin-html2sketch/index.d.ts +1 -0
- package/dist/worker/.dumi/tmp/testBrowser.d.ts +8 -0
- package/dist/worker/.dumirc.d.ts +2 -0
- package/dist/worker/Addon/EventEmiter.d.ts +1 -1
- package/dist/worker/Addon/HighlightAddon.d.ts +1 -1
- package/dist/worker/Addon/SearchAddon.d.ts +1 -1
- package/dist/worker/Addon/useAddon.d.ts +4 -4
- package/dist/worker/TerminalViewer/index.d.ts +1 -1
- package/dist/worker/TerminalViewerBody/index.d.ts +5 -5
- package/dist/worker/index.d.ts +1 -1
- package/dist/worker/log.worker.js +1 -1
- package/dist/worker/log.worker.js.map +1 -1
- package/dist/worker/mock/index.d.ts +3 -0
- package/dist/worker/src/Addon/EventEmiter.d.ts +18 -0
- package/dist/worker/src/Addon/HighlightAddon.d.ts +26 -0
- package/dist/worker/src/Addon/LineNumberAddon.d.ts +39 -0
- package/dist/worker/src/Addon/SearchAddon.d.ts +140 -0
- package/dist/worker/src/Addon/WorkerLog/GlobalContext.d.ts +10 -0
- package/dist/worker/src/Addon/WorkerLog/LimitMap.d.ts +14 -0
- package/dist/worker/src/Addon/WorkerLog/LogWorker.d.ts +2 -0
- package/dist/worker/src/Addon/WorkerLog/Logs.d.ts +21 -0
- package/dist/worker/src/Addon/WorkerLog/Mark.d.ts +36 -0
- package/dist/worker/src/Addon/WorkerLog/Searcher.d.ts +16 -0
- package/dist/worker/src/Addon/WorkerLog/WebWokerServer.d.ts +10 -0
- package/dist/worker/src/Addon/WorkerLog/WebWorkerClient.d.ts +13 -0
- package/dist/worker/src/Addon/WorkerLog/log.worker.d.ts +1 -0
- package/dist/worker/src/Addon/WorkerLog/types.d.ts +18 -0
- package/dist/worker/src/Addon/useAddon.d.ts +9 -0
- package/dist/worker/src/Hooks/useBatchProcess.d.ts +2 -0
- package/dist/worker/src/Hooks/useCache.d.ts +31 -0
- package/dist/worker/src/Hooks/useDebounceInput.d.ts +3 -0
- package/dist/worker/src/Hooks/useLocalStore.d.ts +2 -0
- package/dist/worker/src/Hooks/useRemote.d.ts +30 -0
- package/dist/worker/src/Hooks/useRemote.test.d.ts +1 -0
- package/dist/worker/src/Hooks/useThrottle.d.ts +2 -0
- package/dist/worker/src/Hooks/useWorkerLogs.d.ts +9 -0
- package/dist/worker/src/TerminalViewer/index.d.ts +185 -0
- package/dist/worker/src/TerminalViewer/index.test.d.ts +1 -0
- package/dist/worker/src/TerminalViewerBody/index.d.ts +87 -0
- package/dist/worker/src/TerminalViewerBody/index.test.d.ts +1 -0
- package/dist/worker/src/TerminalViewerHeader/index.d.ts +88 -0
- package/dist/worker/src/TerminalViewerToolBar/index.d.ts +46 -0
- package/dist/worker/src/TerminalViewerVirtualDom/ReactVirtualized.d.ts +71 -0
- package/dist/worker/src/TerminalViewerVirtualDom/ReactVirtuoso.d.ts +67 -0
- package/dist/worker/src/TerminalViewerVirtualDom/index.d.ts +2 -0
- package/dist/worker/src/index.d.ts +8 -0
- package/dist/worker/src/mock/index.d.ts +15 -0
- package/dist/worker/src/types.d.ts +30 -0
- package/dist/worker/types.d.ts +4 -4
- package/package.json +27 -17
|
@@ -1,309 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
/* eslint-disable react/no-danger */
|
|
11
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
12
|
-
import React, { forwardRef, useRef, useEffect, useImperativeHandle, useCallback, useMemo, createElement } from 'react';
|
|
13
|
-
import { CellMeasurer, CellMeasurerCache, AutoSizer } from 'react-virtualized';
|
|
14
|
-
import List from 'react-virtualized/dist/es/List';
|
|
15
|
-
import useRemote from "../Hooks/useRemote";
|
|
16
|
-
import useThrottle from "../Hooks/useThrottle";
|
|
17
|
-
import useWorkerLogs from "../Hooks/useWorkerLogs";
|
|
18
|
-
import "./index.less";
|
|
19
|
-
// eslint-disable-next-line react/display-name, max-len
|
|
20
|
-
var TerminalViewerVirtualDom = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
|
-
var fitProp = _ref.fit,
|
|
22
|
-
className = _ref.className,
|
|
23
|
-
empty = _ref.empty,
|
|
24
|
-
_ref$autoScroll = _ref.autoScroll,
|
|
25
|
-
autoScroll = _ref$autoScroll === void 0 ? true : _ref$autoScroll,
|
|
26
|
-
scrollToRow = _ref.scrollToRow,
|
|
27
|
-
logAfter = _ref.logAfter,
|
|
28
|
-
_ref$defaultData = _ref.defaultData,
|
|
29
|
-
defaultData = _ref$defaultData === void 0 ? '' : _ref$defaultData,
|
|
30
|
-
remoteOptions = _ref.remoteOptions,
|
|
31
|
-
cacheOptions = _ref.cacheOptions,
|
|
32
|
-
highlightOptions = _ref.highlightOptions,
|
|
33
|
-
extraOptions = _ref.extraOptions,
|
|
34
|
-
onLoading = _ref.onLoading,
|
|
35
|
-
onAddonReady = _ref.onAddonReady;
|
|
36
|
-
var fit = fitProp !== null && fitProp !== void 0 ? fitProp : true;
|
|
37
|
-
var domRef = useRef(null);
|
|
38
|
-
var mountedRef = useRef(false);
|
|
39
|
-
var listRef = useRef(null);
|
|
40
|
-
var isScrollTopRef = useRef(false);
|
|
41
|
-
var isScrollToRowFinished = useRef(false);
|
|
42
|
-
var exposedRef = useRef({
|
|
43
|
-
refresh: function refresh() {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
var highlightOptionsRef = useRef(highlightOptions);
|
|
48
|
-
var extraOptionsRef = useRef(extraOptions);
|
|
49
|
-
var cacheRef = useRef(new CellMeasurerCache({
|
|
50
|
-
fixedWidth: true,
|
|
51
|
-
minHeight: 20,
|
|
52
|
-
defaultHeight: 20
|
|
53
|
-
}));
|
|
54
|
-
useEffect(function () {
|
|
55
|
-
highlightOptionsRef.current = highlightOptions;
|
|
56
|
-
extraOptionsRef.current = extraOptions;
|
|
57
|
-
});
|
|
58
|
-
var throttleFit = useThrottle(function () {
|
|
59
|
-
if (mountedRef.current && listRef.current) {
|
|
60
|
-
var _listRef$current;
|
|
61
|
-
cacheRef.current.clearAll();
|
|
62
|
-
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.recomputeRowHeights();
|
|
63
|
-
}
|
|
64
|
-
}, 3000);
|
|
65
|
-
var _useRemote = useRemote(defaultData,
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
67
|
-
function () {}, _objectSpread(_objectSpread({}, remoteOptions), {}, {
|
|
68
|
-
enableBatch: false
|
|
69
|
-
}), cacheOptions),
|
|
70
|
-
refresh = _useRemote.refresh,
|
|
71
|
-
data = _useRemote.data,
|
|
72
|
-
loading = _useRemote.loading,
|
|
73
|
-
cacheStore = _useRemote.cacheStore;
|
|
74
|
-
var _useWorkerLogs = useWorkerLogs(data, function (result) {
|
|
75
|
-
if (result.count > 0) {
|
|
76
|
-
setTimeout(function () {
|
|
77
|
-
var _listRef$current2;
|
|
78
|
-
(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 || _listRef$current2.scrollToRow(result.markedKey);
|
|
79
|
-
}, 0);
|
|
80
|
-
}
|
|
81
|
-
}),
|
|
82
|
-
logs = _useWorkerLogs.logs,
|
|
83
|
-
searcherRef = _useWorkerLogs.searcherRef,
|
|
84
|
-
working = _useWorkerLogs.working,
|
|
85
|
-
searcherResult = _useWorkerLogs.searcherResult;
|
|
86
|
-
var lineNumberWidth = useMemo(function () {
|
|
87
|
-
var _extraOptionsRef$curr, _domRef$current;
|
|
88
|
-
if (!((_extraOptionsRef$curr = extraOptionsRef.current) !== null && _extraOptionsRef$curr !== void 0 && _extraOptionsRef$curr.showLineNumber)) {
|
|
89
|
-
return 48;
|
|
90
|
-
}
|
|
91
|
-
var existSpan = (_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.querySelector('.terminal-viewer-text-placeholder');
|
|
92
|
-
var span = existSpan || document.createElement('span');
|
|
93
|
-
span.className = 'terminal-viewer-text-placeholder';
|
|
94
|
-
span.innerHTML = logs.length.toString();
|
|
95
|
-
if (!existSpan) {
|
|
96
|
-
var _domRef$current2;
|
|
97
|
-
(_domRef$current2 = domRef.current) === null || _domRef$current2 === void 0 || _domRef$current2.appendChild(span);
|
|
98
|
-
}
|
|
99
|
-
return span.clientWidth || 48;
|
|
100
|
-
}, [logs.length]);
|
|
101
|
-
var rowRender = useCallback(function (_ref2) {
|
|
102
|
-
var _matchOption$decorati, _matchOption$decorati2, _extraOptionsRef$curr2;
|
|
103
|
-
var key = _ref2.key,
|
|
104
|
-
index = _ref2.index,
|
|
105
|
-
style = _ref2.style,
|
|
106
|
-
parent = _ref2.parent;
|
|
107
|
-
var rowClassName = index === scrollToRow ? 'terminal-viewer-virtual-list-row terminal-viewer-virtual-list-row--active' : 'terminal-viewer-virtual-list-row';
|
|
108
|
-
var log = searcherResult.map[index] || logs[index];
|
|
109
|
-
var options = highlightOptionsRef.current || [];
|
|
110
|
-
var matchOption = options.find(function (option) {
|
|
111
|
-
var _logs$index2;
|
|
112
|
-
var keyword = option.keyword || '';
|
|
113
|
-
if (option.ignoreSensitive) {
|
|
114
|
-
var _logs$index$toLowerCa, _logs$index;
|
|
115
|
-
var lowerString = (_logs$index$toLowerCa = (_logs$index = logs[index]) === null || _logs$index === void 0 ? void 0 : _logs$index.toLowerCase()) !== null && _logs$index$toLowerCa !== void 0 ? _logs$index$toLowerCa : '';
|
|
116
|
-
return lowerString.includes(keyword.toLowerCase()) || lowerString.includes(keyword);
|
|
117
|
-
}
|
|
118
|
-
return (_logs$index2 = logs[index]) === null || _logs$index2 === void 0 ? void 0 : _logs$index2.includes(keyword);
|
|
119
|
-
});
|
|
120
|
-
var hlStyle = {
|
|
121
|
-
color: (matchOption === null || matchOption === void 0 || (_matchOption$decorati = matchOption.decorations) === null || _matchOption$decorati === void 0 ? void 0 : _matchOption$decorati.matchForegroundColor) || 'inherit',
|
|
122
|
-
background: (matchOption === null || matchOption === void 0 || (_matchOption$decorati2 = matchOption.decorations) === null || _matchOption$decorati2 === void 0 ? void 0 : _matchOption$decorati2.matchBackground) || 'inherit'
|
|
123
|
-
};
|
|
124
|
-
if (typeof log === 'undefined') {
|
|
125
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
126
|
-
style: _objectSpread(_objectSpread({}, style !== null && style !== void 0 ? style : {}), {}, {
|
|
127
|
-
height: '4px'
|
|
128
|
-
}),
|
|
129
|
-
className: rowClassName
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return (
|
|
133
|
-
/*#__PURE__*/
|
|
134
|
-
// @ts-ignore tsx-ignore
|
|
135
|
-
React.createElement(CellMeasurer, {
|
|
136
|
-
cache: cacheRef.current,
|
|
137
|
-
style: style,
|
|
138
|
-
columnIndex: 0,
|
|
139
|
-
key: key,
|
|
140
|
-
rowIndex: index,
|
|
141
|
-
parent: parent
|
|
142
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
style: style,
|
|
144
|
-
className: rowClassName
|
|
145
|
-
}, !!((_extraOptionsRef$curr2 = extraOptionsRef.current) !== null && _extraOptionsRef$curr2 !== void 0 && _extraOptionsRef$curr2.showLineNumber) && /*#__PURE__*/React.createElement("span", {
|
|
146
|
-
className: "terminal-viewer-line-number",
|
|
147
|
-
style: {
|
|
148
|
-
minWidth: "".concat(lineNumberWidth, "px")
|
|
149
|
-
}
|
|
150
|
-
}, index + 1), /*#__PURE__*/React.createElement("span", {
|
|
151
|
-
className: "terminal-viewer-pre",
|
|
152
|
-
style: hlStyle,
|
|
153
|
-
dangerouslySetInnerHTML: {
|
|
154
|
-
__html: log || ''
|
|
155
|
-
}
|
|
156
|
-
}), logAfter && /*#__PURE__*/createElement(logAfter, {
|
|
157
|
-
index: index,
|
|
158
|
-
content: log
|
|
159
|
-
})))
|
|
160
|
-
);
|
|
161
|
-
}, [logAfter, scrollToRow, lineNumberWidth, logs, searcherResult]);
|
|
162
|
-
useEffect(function () {
|
|
163
|
-
var dom;
|
|
164
|
-
var resizeObserver;
|
|
165
|
-
if (fit) {
|
|
166
|
-
resizeObserver = new ResizeObserver(throttleFit);
|
|
167
|
-
dom = domRef.current;
|
|
168
|
-
if (dom) {
|
|
169
|
-
resizeObserver.observe(dom);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return function () {
|
|
173
|
-
if (dom && resizeObserver) {
|
|
174
|
-
resizeObserver.unobserve(dom);
|
|
175
|
-
resizeObserver.disconnect();
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}, [fit, throttleFit]);
|
|
179
|
-
useEffect(function () {
|
|
180
|
-
var _listRef$current3;
|
|
181
|
-
cacheRef.current.clear(0, 0);
|
|
182
|
-
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 || _listRef$current3.recomputeRowHeights();
|
|
183
|
-
}, [lineNumberWidth, logs]);
|
|
184
|
-
useEffect(function () {
|
|
185
|
-
if (mountedRef.current && logs.length > 0) {
|
|
186
|
-
if (typeof scrollToRow !== 'undefined' && Number.isInteger(scrollToRow) && !isScrollToRowFinished.current) {
|
|
187
|
-
if (logs.length >= scrollToRow) {
|
|
188
|
-
setTimeout(function () {
|
|
189
|
-
var _listRef$current4;
|
|
190
|
-
isScrollToRowFinished.current = true;
|
|
191
|
-
(_listRef$current4 = listRef.current) === null || _listRef$current4 === void 0 || _listRef$current4.scrollToRow(scrollToRow);
|
|
192
|
-
}, 0);
|
|
193
|
-
} else {
|
|
194
|
-
setTimeout(function () {
|
|
195
|
-
var _listRef$current5;
|
|
196
|
-
(_listRef$current5 = listRef.current) === null || _listRef$current5 === void 0 || _listRef$current5.scrollToRow(logs.length);
|
|
197
|
-
}, 0);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (autoScroll && !isScrollTopRef.current && searcherResult.count <= 0 && typeof scrollToRow === 'undefined') {
|
|
201
|
-
setTimeout(function () {
|
|
202
|
-
var _listRef$current6;
|
|
203
|
-
(_listRef$current6 = listRef.current) === null || _listRef$current6 === void 0 || _listRef$current6.scrollToRow(logs.length);
|
|
204
|
-
}, 0);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
useEffect(function () {
|
|
209
|
-
if (typeof onLoading === 'function') {
|
|
210
|
-
onLoading(working || loading);
|
|
211
|
-
}
|
|
212
|
-
}, [working, loading, onLoading]);
|
|
213
|
-
useEffect(function () {
|
|
214
|
-
mountedRef.current = true;
|
|
215
|
-
return function () {
|
|
216
|
-
mountedRef.current = false;
|
|
217
|
-
isScrollTopRef.current = false;
|
|
218
|
-
};
|
|
219
|
-
}, []);
|
|
220
|
-
useEffect(function () {
|
|
221
|
-
exposedRef.current.refresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
222
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
223
|
-
while (1) switch (_context.prev = _context.next) {
|
|
224
|
-
case 0:
|
|
225
|
-
_context.next = 2;
|
|
226
|
-
return refresh();
|
|
227
|
-
case 2:
|
|
228
|
-
case "end":
|
|
229
|
-
return _context.stop();
|
|
230
|
-
}
|
|
231
|
-
}, _callee);
|
|
232
|
-
}));
|
|
233
|
-
});
|
|
234
|
-
useImperativeHandle(ref, function () {
|
|
235
|
-
return {
|
|
236
|
-
el: domRef.current,
|
|
237
|
-
refresh: function () {
|
|
238
|
-
var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
239
|
-
var _exposedRef$current;
|
|
240
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
241
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
242
|
-
case 0:
|
|
243
|
-
return _context2.abrupt("return", ((_exposedRef$current = exposedRef.current) === null || _exposedRef$current === void 0 ? void 0 : _exposedRef$current.refresh) && exposedRef.current.refresh());
|
|
244
|
-
case 1:
|
|
245
|
-
case "end":
|
|
246
|
-
return _context2.stop();
|
|
247
|
-
}
|
|
248
|
-
}, _callee2);
|
|
249
|
-
}));
|
|
250
|
-
function refresh() {
|
|
251
|
-
return _refresh.apply(this, arguments);
|
|
252
|
-
}
|
|
253
|
-
return refresh;
|
|
254
|
-
}(),
|
|
255
|
-
cacheStore: cacheStore,
|
|
256
|
-
addons: {
|
|
257
|
-
search: function search() {
|
|
258
|
-
return searcherRef.current;
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
terminal: function terminal() {
|
|
262
|
-
return {
|
|
263
|
-
scrollToTop: function scrollToTop() {
|
|
264
|
-
var _listRef$current7;
|
|
265
|
-
(_listRef$current7 = listRef.current) === null || _listRef$current7 === void 0 || _listRef$current7.scrollToRow(0);
|
|
266
|
-
isScrollTopRef.current = true;
|
|
267
|
-
},
|
|
268
|
-
scrollToBottom: function scrollToBottom() {
|
|
269
|
-
var _listRef$current8;
|
|
270
|
-
(_listRef$current8 = listRef.current) === null || _listRef$current8 === void 0 || _listRef$current8.scrollToRow(logs.length);
|
|
271
|
-
isScrollTopRef.current = false;
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
});
|
|
277
|
-
useEffect(function () {
|
|
278
|
-
if (typeof onAddonReady === 'function') {
|
|
279
|
-
onAddonReady(undefined, searcherRef.current);
|
|
280
|
-
}
|
|
281
|
-
}, [searcherRef, onAddonReady]);
|
|
282
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
283
|
-
className: ['terminal-viewer-body', className].filter(Boolean).join(' '),
|
|
284
|
-
ref: domRef
|
|
285
|
-
}, logs.length !== 0 &&
|
|
286
|
-
/*#__PURE__*/
|
|
287
|
-
// @ts-ignore jsx-element
|
|
288
|
-
React.createElement(AutoSizer, null, function (_ref4) {
|
|
289
|
-
var width = _ref4.width,
|
|
290
|
-
height = _ref4.height;
|
|
291
|
-
return (
|
|
292
|
-
/*#__PURE__*/
|
|
293
|
-
// @ts-ignore jsx-element
|
|
294
|
-
React.createElement(List, {
|
|
295
|
-
ref: listRef,
|
|
296
|
-
height: height,
|
|
297
|
-
width: width,
|
|
298
|
-
className: "terminal-viewer-virtual-list",
|
|
299
|
-
rowHeight: cacheRef.current.rowHeight,
|
|
300
|
-
rowRenderer: rowRender,
|
|
301
|
-
rowCount: logs.length + 1,
|
|
302
|
-
scrollToAlignment: "center"
|
|
303
|
-
})
|
|
304
|
-
);
|
|
305
|
-
}), (logs === null || logs === void 0 ? void 0 : logs.length) === 0 && (empty || /*#__PURE__*/React.createElement("div", {
|
|
306
|
-
className: "terminal-viewer-body-empty"
|
|
307
|
-
}, "\u6682\u65E0\u6570\u636E")));
|
|
308
|
-
});
|
|
1
|
+
import TerminalViewerVirtualDom from "./ReactVirtuoso";
|
|
2
|
+
TerminalViewerVirtualDom.displayName = 'TerminalViewerVirtualDom';
|
|
309
3
|
export default TerminalViewerVirtualDom;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.terminal-viewer-virtuoso-list {
|
|
2
|
+
color: #b5bbc6;
|
|
3
|
+
font-size: 13px;
|
|
4
|
+
font-family: Roboto Mono, Andale Mono, Consolas, Courier New, monospace;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.terminal-viewer-virtuoso-list-row {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
overflow: visible;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.terminal-viewer-virtuoso-list-row--active {
|
|
14
|
+
color: #dddddd;
|
|
15
|
+
background: #3c4655;
|
|
16
|
+
.terminal-viewer-line-number,
|
|
17
|
+
.terminal-viewer-pre {
|
|
18
|
+
color: #dddddd;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.terminal-viewer-line-number,
|
|
23
|
+
.terminal-viewer-text-placeholder {
|
|
24
|
+
margin-right: 8px;
|
|
25
|
+
padding-right: 8px;
|
|
26
|
+
color: #959da5bf;
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
font-family: Roboto Mono, Andale Mono, Consolas, Courier New, monospace;
|
|
29
|
+
line-height: 20px;
|
|
30
|
+
text-align: right;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.terminal-viewer-line-number {
|
|
34
|
+
display: inline-block;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
}
|
|
40
|
+
.terminal-viewer-text-placeholder {
|
|
41
|
+
position: absolute;
|
|
42
|
+
visibility: hidden;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.terminal-viewer-hl-mark {
|
|
46
|
+
color: #000000;
|
|
47
|
+
background: #ffff54;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.terminal-viewer-hl-marked {
|
|
51
|
+
background: #ff9540;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.terminal-viewer-pre {
|
|
55
|
+
display: inline-block;
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 0;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
line-height: 20px;
|
|
61
|
+
white-space: pre-wrap;
|
|
62
|
+
word-wrap: break-word;
|
|
63
|
+
word-break: break-all;
|
|
64
|
+
background-color: #f5f5f5;
|
|
65
|
+
border: none;
|
|
66
|
+
border-radius: 0;
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
List: function List() {
|
|
3
|
+
return null;
|
|
4
|
+
},
|
|
5
|
+
CellMeasurer: function CellMeasurer() {
|
|
6
|
+
return null;
|
|
7
|
+
},
|
|
8
|
+
CellMeasurerCache: function CellMeasurerCache() {
|
|
9
|
+
return null;
|
|
10
|
+
},
|
|
11
|
+
AutoSizer: function AutoSizer() {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITerminalOptions, Terminal } from '@xterm/xterm';
|
|
2
2
|
import TerminalViewer from './TerminalViewer';
|
|
3
|
-
import TerminalViewerHeader from './TerminalViewerHeader';
|
|
4
3
|
import TerminalViewerBody from './TerminalViewerBody';
|
|
5
|
-
import
|
|
4
|
+
import TerminalViewerHeader from './TerminalViewerHeader';
|
|
6
5
|
import TerminalViewerToolBar from './TerminalViewerToolBar';
|
|
7
|
-
|
|
8
|
-
export {
|
|
6
|
+
import TerminalViewerVirtualDom from './TerminalViewerVirtualDom';
|
|
7
|
+
export { ITerminalOptions, Terminal, TerminalViewerBody, TerminalViewerHeader, TerminalViewerToolBar, TerminalViewerVirtualDom, };
|
|
9
8
|
export default TerminalViewer;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITerminalOptions, Terminal } from '@xterm/xterm';
|
|
2
2
|
import TerminalViewer from "./TerminalViewer";
|
|
3
|
-
import TerminalViewerHeader from "./TerminalViewerHeader";
|
|
4
3
|
import TerminalViewerBody from "./TerminalViewerBody";
|
|
5
|
-
import
|
|
4
|
+
import TerminalViewerHeader from "./TerminalViewerHeader";
|
|
6
5
|
import TerminalViewerToolBar from "./TerminalViewerToolBar";
|
|
7
|
-
|
|
8
|
-
export {
|
|
6
|
+
import TerminalViewerVirtualDom from "./TerminalViewerVirtualDom";
|
|
7
|
+
export { ITerminalOptions, Terminal, TerminalViewerBody, TerminalViewerHeader, TerminalViewerToolBar, TerminalViewerVirtualDom };
|
|
9
8
|
export default TerminalViewer;
|
package/dist/esm/mock/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export declare function remoteFetch(key?: number): Promise<unknown>;
|
|
|
6
6
|
export declare function cacheFetch(key?: number): Promise<unknown>;
|
|
7
7
|
declare const _default: {
|
|
8
8
|
loadTest: typeof loadTest;
|
|
9
|
+
loadAdvancedTest: typeof loadAdvancedTest;
|
|
10
|
+
loadCustomHighLightTest: typeof loadCustomHighLightTest;
|
|
11
|
+
fetchCustomHighLightTest: typeof fetchCustomHighLightTest;
|
|
9
12
|
remoteFetch: typeof remoteFetch;
|
|
10
13
|
cacheFetch: typeof cacheFetch;
|
|
11
14
|
};
|
package/dist/esm/mock/index.js
CHANGED
|
@@ -93,6 +93,9 @@ export function cacheFetch() {
|
|
|
93
93
|
}
|
|
94
94
|
export default {
|
|
95
95
|
loadTest: loadTest,
|
|
96
|
+
loadAdvancedTest: loadAdvancedTest,
|
|
97
|
+
loadCustomHighLightTest: loadCustomHighLightTest,
|
|
98
|
+
fetchCustomHighLightTest: fetchCustomHighLightTest,
|
|
96
99
|
remoteFetch: remoteFetch,
|
|
97
100
|
cacheFetch: cacheFetch
|
|
98
101
|
};
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FitAddon } from 'xterm
|
|
3
|
-
import { WebLinksAddon } from 'xterm
|
|
4
|
-
import {
|
|
1
|
+
import { CanvasAddon } from '@xterm/addon-canvas';
|
|
2
|
+
import { FitAddon } from '@xterm/addon-fit';
|
|
3
|
+
import { WebLinksAddon } from '@xterm/addon-web-links';
|
|
4
|
+
import { Terminal } from '@xterm/xterm';
|
|
5
5
|
import { HighlightAddon } from './Addon/HighlightAddon';
|
|
6
6
|
import { SearchAddon } from './Addon/SearchAddon';
|
|
7
7
|
import type { SearcherRef } from './Addon/WorkerLog/types';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface IDefaultRuntimeConfig {
|
|
3
|
+
onRouteChange?: (props: {
|
|
4
|
+
routes: any;
|
|
5
|
+
clientRoutes: any;
|
|
6
|
+
location: any;
|
|
7
|
+
action: any;
|
|
8
|
+
isFirst: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
patchRoutes?: (props: {
|
|
11
|
+
routes: any;
|
|
12
|
+
}) => void;
|
|
13
|
+
patchClientRoutes?: (props: {
|
|
14
|
+
routes: any;
|
|
15
|
+
}) => void;
|
|
16
|
+
render?: (oldRender: () => void) => void;
|
|
17
|
+
rootContainer?: (lastRootContainer: JSX.Element, args?: any) => void;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export type RuntimeConfig = IDefaultRuntimeConfig;
|
|
21
|
+
export declare function defineApp(config: RuntimeConfig): RuntimeConfig;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function modifyClientRenderOpts(memo: any): any;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HelmetProvider } from 'D:/workspace/react-terminal-viewer/node_modules/@umijs/renderer-react';
|
|
3
|
+
export declare const innerProvider: (container: any) => React.CElement<React.PropsWithChildren<import("react-helmet-async").ProviderProps>, HelmetProvider>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const context: {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getRoutes } from './route';
|
|
2
|
+
import type { History } from 'D:/workspace/gitee-terminal-viewer/node_modules/@umijs/renderer-react';
|
|
3
|
+
type Routes = Awaited<ReturnType<typeof getRoutes>>['routes'];
|
|
4
|
+
type AllRoute = Routes[keyof Routes];
|
|
5
|
+
type IsRoot<T extends any> = 'parentId' extends keyof T ? false : true;
|
|
6
|
+
type GetAllRouteWithoutLayout<Item extends AllRoute> = Item extends any ? 'isWrapper' extends keyof Item ? never : 'isLayout' extends keyof Item ? never : Item : never;
|
|
7
|
+
type AllRouteWithoutLayout = GetAllRouteWithoutLayout<AllRoute>;
|
|
8
|
+
type IndexRoutePathname = '/' extends AllRouteWithoutLayout['path'] ? '/' : never;
|
|
9
|
+
type GetChildrens<T extends any> = T extends any ? IsRoot<T> extends true ? never : T : never;
|
|
10
|
+
type Childrens = GetChildrens<AllRoute>;
|
|
11
|
+
type Root = Exclude<AllRoute, Childrens>;
|
|
12
|
+
type AllIds = AllRoute['id'];
|
|
13
|
+
type GetChildrensByParentId<Id extends AllIds, Item = AllRoute> = Item extends any ? 'parentId' extends keyof Item ? Item['parentId'] extends Id ? Item : never : never : never;
|
|
14
|
+
type RouteObject<Id extends AllIds, Item = GetChildrensByParentId<Id>> = IsNever<Item> extends true ? '' : Item extends AllRoute ? {
|
|
15
|
+
[Key in Item['path'] as TrimSlash<Key>]: UnionMerge<RouteObject<Item['id']>>;
|
|
16
|
+
} : never;
|
|
17
|
+
type GetRootRouteObject<Item extends Root> = Item extends Root ? {
|
|
18
|
+
[K in Item['path'] as TrimSlash<K>]: UnionMerge<RouteObject<Item['id']>>;
|
|
19
|
+
} : never;
|
|
20
|
+
type MergedResult = UnionMerge<GetRootRouteObject<Root>>;
|
|
21
|
+
type HistoryTo = Parameters<History['push']>['0'];
|
|
22
|
+
type HistoryPath = Exclude<HistoryTo, string>;
|
|
23
|
+
type UmiPathname = Path<MergedResult> | (string & {});
|
|
24
|
+
interface UmiPath extends HistoryPath {
|
|
25
|
+
pathname: UmiPathname;
|
|
26
|
+
}
|
|
27
|
+
type UmiTo = UmiPathname | UmiPath;
|
|
28
|
+
type UmiPush = (to: UmiTo, state?: any) => void;
|
|
29
|
+
type UmiReplace = (to: UmiTo, state?: any) => void;
|
|
30
|
+
export interface UmiHistory extends History {
|
|
31
|
+
push: UmiPush;
|
|
32
|
+
replace: UmiReplace;
|
|
33
|
+
}
|
|
34
|
+
type TrimLeftSlash<T extends string> = T extends `/${infer R}` ? TrimLeftSlash<R> : T;
|
|
35
|
+
type TrimRightSlash<T extends string> = T extends `${infer R}/` ? TrimRightSlash<R> : T;
|
|
36
|
+
type TrimSlash<T extends string> = TrimLeftSlash<TrimRightSlash<T>>;
|
|
37
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
38
|
+
type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2 ? true : false;
|
|
39
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
40
|
+
type UnionMerge<U> = UnionToIntersection<U> extends infer O ? {
|
|
41
|
+
[K in keyof O]: O[K];
|
|
42
|
+
} : never;
|
|
43
|
+
type ExcludeEmptyKey<T> = IsEqual<T, ''> extends true ? never : T;
|
|
44
|
+
type PathConcat<TKey extends string, TValue, N = TrimSlash<TKey>> = TValue extends string ? ExcludeEmptyKey<N> : ExcludeEmptyKey<N> | `${N & string}${IsNever<ExcludeEmptyKey<N>> extends true ? '' : '/'}${UnionPath<TValue>}`;
|
|
45
|
+
type UnionPath<T> = {
|
|
46
|
+
[K in keyof T]-?: PathConcat<K & string, T[K]>;
|
|
47
|
+
}[keyof T];
|
|
48
|
+
type MakeSureLeftSlash<T> = T extends any ? `/${TrimRightSlash<T & string>}` : never;
|
|
49
|
+
type Path<T, K = UnionPath<T>> = Exclude<MakeSureLeftSlash<K>, '/*'> | IndexRoutePathname;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PluginManager } from 'umi';
|
|
2
|
+
export declare function getPlugins(): {
|
|
3
|
+
apply: any;
|
|
4
|
+
path: string | undefined;
|
|
5
|
+
}[];
|
|
6
|
+
export declare function getValidKeys(): string[];
|
|
7
|
+
export declare function createPluginManager(): PluginManager;
|
|
8
|
+
export declare function getPluginManager(): any;
|