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.
Files changed (99) hide show
  1. package/README.md +11 -11
  2. package/dist/esm/Addon/EventEmiter.d.ts +1 -1
  3. package/dist/esm/Addon/HighlightAddon.d.ts +1 -1
  4. package/dist/esm/Addon/SearchAddon.d.ts +1 -1
  5. package/dist/esm/Addon/WorkerLog/LogWorker.js +1 -1
  6. package/dist/esm/Addon/WorkerLog/Logs.js +0 -2
  7. package/dist/esm/Addon/useAddon.d.ts +5 -5
  8. package/dist/esm/Addon/useAddon.js +1 -1
  9. package/dist/esm/Hooks/useDebounceInput.js +1 -1
  10. package/dist/esm/Hooks/useLocalStore.js +1 -1
  11. package/dist/esm/TerminalViewer/index.d.ts +4 -4
  12. package/dist/esm/TerminalViewer/index.js +4 -4
  13. package/dist/esm/TerminalViewerBody/index.d.ts +8 -8
  14. package/dist/esm/TerminalViewerBody/index.js +7 -7
  15. package/dist/esm/TerminalViewerVirtualDom/ReactVirtualized.d.ts +71 -0
  16. package/dist/esm/TerminalViewerVirtualDom/ReactVirtualized.js +309 -0
  17. package/dist/esm/TerminalViewerVirtualDom/ReactVirtuoso.d.ts +67 -0
  18. package/dist/esm/TerminalViewerVirtualDom/ReactVirtuoso.js +259 -0
  19. package/dist/esm/TerminalViewerVirtualDom/index.d.ts +1 -70
  20. package/dist/esm/TerminalViewerVirtualDom/index.js +2 -308
  21. package/dist/esm/TerminalViewerVirtualDom/{index.less → virtualized.less} +1 -1
  22. package/dist/esm/TerminalViewerVirtualDom/virtuoso.less +67 -0
  23. package/dist/esm/__mocks__/react-virtualized.js +14 -0
  24. package/dist/esm/__mocks__/styleMock.js +1 -0
  25. package/dist/esm/index.d.ts +4 -5
  26. package/dist/esm/index.js +4 -5
  27. package/dist/esm/mock/index.d.ts +3 -0
  28. package/dist/esm/mock/index.js +3 -0
  29. package/dist/esm/types.d.ts +4 -4
  30. package/dist/worker/.dumi/tmp/core/defineApp.d.ts +22 -0
  31. package/dist/worker/.dumi/tmp/core/exportStaticRuntimePlugin.d.ts +1 -0
  32. package/dist/worker/.dumi/tmp/core/helmet.d.ts +3 -0
  33. package/dist/worker/.dumi/tmp/core/helmetContext.d.ts +1 -0
  34. package/dist/worker/.dumi/tmp/core/history.d.ts +5 -0
  35. package/dist/worker/.dumi/tmp/core/historyIntelli.d.ts +50 -0
  36. package/dist/worker/.dumi/tmp/core/plugin.d.ts +8 -0
  37. package/dist/worker/.dumi/tmp/core/pluginConfig.d.ts +341 -0
  38. package/dist/worker/.dumi/tmp/core/route.d.ts +83 -0
  39. package/dist/worker/.dumi/tmp/core/terminal.d.ts +14 -0
  40. package/dist/worker/.dumi/tmp/dumi/exports.d.ts +3 -0
  41. package/dist/worker/.dumi/tmp/dumi/locales/config.d.ts +106 -0
  42. package/dist/worker/.dumi/tmp/dumi/locales/runtime.d.ts +2 -0
  43. package/dist/worker/.dumi/tmp/dumi/meta/atoms.d.ts +1 -0
  44. package/dist/worker/.dumi/tmp/dumi/meta/exports.d.ts +31 -0
  45. package/dist/worker/.dumi/tmp/dumi/meta/index.d.ts +39 -0
  46. package/dist/worker/.dumi/tmp/dumi/meta/runtime.d.ts +3 -0
  47. package/dist/worker/.dumi/tmp/dumi/meta/tabs.d.ts +1 -0
  48. package/dist/worker/.dumi/tmp/dumi/theme/ContextWrapper.d.ts +2 -0
  49. package/dist/worker/.dumi/tmp/exports.d.ts +10 -0
  50. package/dist/worker/.dumi/tmp/plugin-html2sketch/index.d.ts +1 -0
  51. package/dist/worker/.dumi/tmp/testBrowser.d.ts +8 -0
  52. package/dist/worker/.dumirc.d.ts +2 -0
  53. package/dist/worker/Addon/EventEmiter.d.ts +1 -1
  54. package/dist/worker/Addon/HighlightAddon.d.ts +1 -1
  55. package/dist/worker/Addon/SearchAddon.d.ts +1 -1
  56. package/dist/worker/Addon/useAddon.d.ts +4 -4
  57. package/dist/worker/TerminalViewer/index.d.ts +1 -1
  58. package/dist/worker/TerminalViewerBody/index.d.ts +5 -5
  59. package/dist/worker/index.d.ts +1 -1
  60. package/dist/worker/log.worker.js +1 -1
  61. package/dist/worker/log.worker.js.map +1 -1
  62. package/dist/worker/mock/index.d.ts +3 -0
  63. package/dist/worker/src/Addon/EventEmiter.d.ts +18 -0
  64. package/dist/worker/src/Addon/HighlightAddon.d.ts +26 -0
  65. package/dist/worker/src/Addon/LineNumberAddon.d.ts +39 -0
  66. package/dist/worker/src/Addon/SearchAddon.d.ts +140 -0
  67. package/dist/worker/src/Addon/WorkerLog/GlobalContext.d.ts +10 -0
  68. package/dist/worker/src/Addon/WorkerLog/LimitMap.d.ts +14 -0
  69. package/dist/worker/src/Addon/WorkerLog/LogWorker.d.ts +2 -0
  70. package/dist/worker/src/Addon/WorkerLog/Logs.d.ts +21 -0
  71. package/dist/worker/src/Addon/WorkerLog/Mark.d.ts +36 -0
  72. package/dist/worker/src/Addon/WorkerLog/Searcher.d.ts +16 -0
  73. package/dist/worker/src/Addon/WorkerLog/WebWokerServer.d.ts +10 -0
  74. package/dist/worker/src/Addon/WorkerLog/WebWorkerClient.d.ts +13 -0
  75. package/dist/worker/src/Addon/WorkerLog/log.worker.d.ts +1 -0
  76. package/dist/worker/src/Addon/WorkerLog/types.d.ts +18 -0
  77. package/dist/worker/src/Addon/useAddon.d.ts +9 -0
  78. package/dist/worker/src/Hooks/useBatchProcess.d.ts +2 -0
  79. package/dist/worker/src/Hooks/useCache.d.ts +31 -0
  80. package/dist/worker/src/Hooks/useDebounceInput.d.ts +3 -0
  81. package/dist/worker/src/Hooks/useLocalStore.d.ts +2 -0
  82. package/dist/worker/src/Hooks/useRemote.d.ts +30 -0
  83. package/dist/worker/src/Hooks/useRemote.test.d.ts +1 -0
  84. package/dist/worker/src/Hooks/useThrottle.d.ts +2 -0
  85. package/dist/worker/src/Hooks/useWorkerLogs.d.ts +9 -0
  86. package/dist/worker/src/TerminalViewer/index.d.ts +185 -0
  87. package/dist/worker/src/TerminalViewer/index.test.d.ts +1 -0
  88. package/dist/worker/src/TerminalViewerBody/index.d.ts +87 -0
  89. package/dist/worker/src/TerminalViewerBody/index.test.d.ts +1 -0
  90. package/dist/worker/src/TerminalViewerHeader/index.d.ts +88 -0
  91. package/dist/worker/src/TerminalViewerToolBar/index.d.ts +46 -0
  92. package/dist/worker/src/TerminalViewerVirtualDom/ReactVirtualized.d.ts +71 -0
  93. package/dist/worker/src/TerminalViewerVirtualDom/ReactVirtuoso.d.ts +67 -0
  94. package/dist/worker/src/TerminalViewerVirtualDom/index.d.ts +2 -0
  95. package/dist/worker/src/index.d.ts +8 -0
  96. package/dist/worker/src/mock/index.d.ts +15 -0
  97. package/dist/worker/src/types.d.ts +30 -0
  98. package/dist/worker/types.d.ts +4 -4
  99. package/package.json +27 -17
@@ -1,309 +1,3 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
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;
@@ -1,5 +1,5 @@
1
1
  .terminal-viewer-virtual-list {
2
- padding: 16px;
2
+ // padding: 16px;
3
3
  color: #b5bbc6;
4
4
  font-size: 13px;
5
5
  font-family: Roboto Mono, Andale Mono, Consolas, Courier New, monospace;
@@ -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 = {};
@@ -1,9 +1,8 @@
1
- import { Terminal, ITerminalOptions } from 'xterm';
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 TerminalViewerVirtualDom from './TerminalViewerVirtualDom';
4
+ import TerminalViewerHeader from './TerminalViewerHeader';
6
5
  import TerminalViewerToolBar from './TerminalViewerToolBar';
7
- export { Terminal, ITerminalOptions };
8
- export { TerminalViewerHeader, TerminalViewerBody, TerminalViewerVirtualDom, TerminalViewerToolBar, };
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 { Terminal, ITerminalOptions } from 'xterm';
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 TerminalViewerVirtualDom from "./TerminalViewerVirtualDom";
4
+ import TerminalViewerHeader from "./TerminalViewerHeader";
6
5
  import TerminalViewerToolBar from "./TerminalViewerToolBar";
7
- export { Terminal, ITerminalOptions };
8
- export { TerminalViewerHeader, TerminalViewerBody, TerminalViewerVirtualDom, TerminalViewerToolBar };
6
+ import TerminalViewerVirtualDom from "./TerminalViewerVirtualDom";
7
+ export { ITerminalOptions, Terminal, TerminalViewerBody, TerminalViewerHeader, TerminalViewerToolBar, TerminalViewerVirtualDom };
9
8
  export default TerminalViewer;
@@ -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
  };
@@ -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
  };
@@ -1,7 +1,7 @@
1
- import { Terminal } from 'xterm';
2
- import { FitAddon } from 'xterm-addon-fit';
3
- import { WebLinksAddon } from 'xterm-addon-web-links';
4
- import { CanvasAddon } from 'xterm-addon-canvas';
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,5 @@
1
+ import type { UmiHistory } from './historyIntelli';
2
+ declare let history: UmiHistory;
3
+ export declare function createHistory(opts: any): import("history").HashHistory;
4
+ export declare function setHistory(h: UmiHistory): void;
5
+ export { history };
@@ -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;