@simon_he/vue-tui 1.0.2 → 1.1.1
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 +44 -26
- package/dist/TMermaidText-CXm_L969.js +885 -0
- package/dist/{TSelect-DR0FomSu.js → TSelect-CiyMvwl-.js} +60 -81
- package/dist/{TTree-kzhlB5P0.js → TTree-DKGiuIcM.js} +140 -103
- package/dist/agent/mermaid.cjs +2 -0
- package/dist/agent/mermaid.d.cts +2 -0
- package/dist/agent/mermaid.d.ts +2 -0
- package/dist/agent/mermaid.js +1 -0
- package/dist/agent.cjs +31184 -24907
- package/dist/agent.d.cts +11 -1
- package/dist/agent.d.ts +11 -1
- package/dist/agent.js +1700 -13
- package/dist/block-source-5CQp4tF8.js +3230 -0
- package/dist/cli/stdin-buffer.d.ts +1 -1
- package/dist/cli.cjs +5037 -6767
- package/dist/cli.d.cts +4 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +2733 -148
- package/dist/core/buffer/eaw-ranges-unicode-17.d.ts +14 -0
- package/dist/core/perf/instrumentation-noop.d.ts +48 -0
- package/dist/core/perf/instrumentation.d.ts +136 -0
- package/dist/core/terminal/create-terminal.d.ts +1 -0
- package/dist/core.cjs +843 -1469
- package/dist/core.js +6 -6
- package/dist/{create-terminal-DBFNYr8f.js → create-terminal-DXuZ2fci.js} +39 -13
- package/dist/debug-logger-ChY_PXVk.js +74 -0
- package/dist/{dom-renderer-BniJSQyX.js → dom-renderer-DNzmg2As.js} +2 -2
- package/dist/experimental.cjs +4115 -5928
- package/dist/experimental.d.cts +2 -0
- package/dist/experimental.d.ts +2 -0
- package/dist/experimental.js +1490 -9
- package/dist/frame-perf-BBhE-iuS.js +111 -0
- package/dist/{sgr-BmzxEjAO.js → hyperlink-B35-O-cW.js} +100 -1
- package/dist/index.cjs +5017 -10339
- package/dist/index.js +16 -14
- package/dist/{linkify-D_gzn9Xq.js → linkify-CuuquMQT.js} +32 -3
- package/dist/markdown.cjs +21295 -12691
- package/dist/markdown.d.cts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js +211 -51
- package/dist/mermaid-CWto52Wk.js +123 -0
- package/dist/mermaid.cjs +1707 -0
- package/dist/mermaid.d.cts +3 -0
- package/dist/mermaid.d.ts +3 -0
- package/dist/mermaid.js +6 -0
- package/dist/observability/frame-perf-store.d.ts +2 -1
- package/dist/observability/frame-perf.d.ts +33 -0
- package/dist/observability.cjs +106 -107
- package/dist/observability.d.cts +2 -2
- package/dist/observability.d.ts +2 -2
- package/dist/observability.js +3 -3
- package/dist/{path-suggest-BNqcuE3-.js → path-suggest-fPzRsgPv.js} +1 -1
- package/dist/{wheel-scroll-vBRaQ7p-.js → rect-Ng-3eKzF.js} +253 -117
- package/dist/renderer/cli/stdout-metrics.d.ts +10 -0
- package/dist/renderer/cli/stdout-renderer.d.ts +3 -0
- package/dist/renderer/terminal-graphic-render-queue.d.ts +50 -0
- package/dist/renderer/terminal-graphics-trace.d.ts +53 -0
- package/dist/renderer/terminal-graphics.d.ts +146 -0
- package/dist/renderer-dom.cjs +364 -903
- package/dist/renderer-dom.js +4 -4
- package/dist/runtime/index.d.ts +2 -0
- package/dist/{runtime-rfcZCyJq.js → runtime-D77C03RM.js} +28 -15
- package/dist/runtime.cjs +427 -889
- package/dist/runtime.js +2 -2
- package/dist/{terminal-selection-DBinO6p5.js → terminal-selection-CQYr--26.js} +4 -1
- package/dist/{tlog-theme-CvLFNMwk.js → tlog-theme-CopRt9SC.js} +37 -6
- package/dist/{trace-CjzYeIxN.js → trace-CYHDKM1m.js} +5 -0
- package/dist/vue/agent/create-png-terminal-graphic-renderer.d.ts +19 -0
- package/dist/vue/components/TAgentTerminalGraphic.d.ts +481 -0
- package/dist/vue/components/TCharts.d.ts +1121 -0
- package/dist/vue/components/TFeedback.d.ts +1 -1
- package/dist/vue/components/TFlex.d.ts +389 -0
- package/dist/vue/components/TForm.d.ts +4 -4
- package/dist/vue/components/TLogSearchBar.d.ts +3 -3
- package/dist/vue/components/TLogSearchPager.d.ts +2 -2
- package/dist/vue/components/TMarkdownText.d.ts +162 -4
- package/dist/vue/components/TMermaidText.d.ts +900 -0
- package/dist/vue/components/TVirtualList.d.ts +9 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +170 -9
- package/dist/vue/components/TVirtualRows.d.ts +9 -0
- package/dist/vue/components/TerminalProvider.d.ts +2 -0
- package/dist/vue/context.d.ts +24 -0
- package/dist/vue/index.d.ts +5 -0
- package/dist/vue/layout/flex.d.ts +67 -0
- package/dist/vue/markdown/ast.d.ts +5 -2
- package/dist/vue/markdown/document.d.ts +5 -0
- package/dist/vue/markdown/image-actions.d.ts +14 -0
- package/dist/vue/markdown/image.d.ts +11 -0
- package/dist/vue/markdown/link-actions.d.ts +14 -0
- package/dist/vue/markdown/math-actions.d.ts +14 -0
- package/dist/vue/markdown/math.d.ts +6 -0
- package/dist/vue/markdown/render.d.ts +28 -0
- package/dist/vue/markdown/types.d.ts +78 -0
- package/dist/vue/mermaid/beautiful-mermaid.d.ts +1436 -0
- package/dist/vue/render/render-manager.d.ts +7 -0
- package/dist/vue.cjs +7207 -12437
- package/dist/vue.js +706 -39
- package/dist/wheel-scroll-CQ22Hcyj.js +106 -0
- package/dist/{hyperlink-Bn02UXJb.js → width-GqllnV8C.js} +166 -111
- package/package.json +85 -14
- package/dist/block-source-CKUOnkgT.js +0 -1663
- package/dist/frame-perf-C6Xfg85O.js +0 -24
- /package/dist/{env-Cl8qmNFN.js → env-DNCzvX8b.js} +0 -0
- /package/dist/{path-mnSgEpCm.js → path-BI9W15Zt.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { TMermaidAsciiOptions, TMermaidAsciiTheme, TMermaidCopyPayload, TMermaidRenderer, TMermaidRenderEligibility, TMermaidRenderEligibilityContext, TMermaidResolvedAsciiOptions, TMermaidTextProps, TMermaidTransientErrorClassifier, TMermaidTransientErrorContext, } from "./vue/components/TMermaidText.js";
|
|
2
|
+
export { isSimpleMermaidFlowchartSource, markMermaidRenderErrorFatal, } from "./vue/components/TMermaidText.js";
|
|
3
|
+
export { beautifulMermaidRenderer, createBeautifulMermaidRenderer, TBeautifulMermaid, TBeautifulMermaidText, TMermaid, TMermaidText, } from "./vue/mermaid/beautiful-mermaid.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { TMermaidAsciiOptions, TMermaidAsciiTheme, TMermaidCopyPayload, TMermaidRenderer, TMermaidRenderEligibility, TMermaidRenderEligibilityContext, TMermaidResolvedAsciiOptions, TMermaidTextProps, TMermaidTransientErrorClassifier, TMermaidTransientErrorContext, } from "./vue/components/TMermaidText.js";
|
|
2
|
+
export { isSimpleMermaidFlowchartSource, markMermaidRenderErrorFatal, } from "./vue/components/TMermaidText.js";
|
|
3
|
+
export { beautifulMermaidRenderer, createBeautifulMermaidRenderer, TBeautifulMermaid, TBeautifulMermaidText, TMermaid, TMermaidText, } from "./vue/mermaid/beautiful-mermaid.js";
|
package/dist/mermaid.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./width-GqllnV8C.js";
|
|
2
|
+
import "./rect-Ng-3eKzF.js";
|
|
3
|
+
import { isSimpleMermaidFlowchartSource, markMermaidRenderErrorFatal } from "./TMermaidText-CXm_L969.js";
|
|
4
|
+
import { TBeautifulMermaid, TBeautifulMermaidText, TMermaid, TMermaidText, beautifulMermaidRenderer, createBeautifulMermaidRenderer } from "./mermaid-CWto52Wk.js";
|
|
5
|
+
|
|
6
|
+
export { TBeautifulMermaid, TBeautifulMermaidText, TMermaid, TMermaidText, beautifulMermaidRenderer, createBeautifulMermaidRenderer, isSimpleMermaidFlowchartSource, markMermaidRenderErrorFatal };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Ref } from "vue";
|
|
2
|
-
import type { FramePerfSample } from "./frame-perf.js";
|
|
2
|
+
import type { FramePerfSample, FramePerfSummary } from "./frame-perf.js";
|
|
3
3
|
import type { ComponentPerf, TuiPerfEvent, TuiPerfSink } from "./perf-sink.js";
|
|
4
4
|
export type FramePerfStore = Readonly<{
|
|
5
5
|
enabled: Ref<boolean>;
|
|
@@ -10,6 +10,7 @@ export type FramePerfStore = Readonly<{
|
|
|
10
10
|
addSink: (sink: TuiPerfSink) => () => void;
|
|
11
11
|
latest: () => FramePerfSample | null;
|
|
12
12
|
list: () => FramePerfSample[];
|
|
13
|
+
summary: () => FramePerfSummary;
|
|
13
14
|
clear: () => void;
|
|
14
15
|
}>;
|
|
15
16
|
export declare function createFramePerfStore(limit?: number, opts?: Readonly<{
|
|
@@ -36,5 +36,38 @@ export type FramePerfSample = Readonly<{
|
|
|
36
36
|
queueDepth: number;
|
|
37
37
|
liveReasons?: readonly string[];
|
|
38
38
|
}>;
|
|
39
|
+
export type FramePerfMetricStats = Readonly<{
|
|
40
|
+
avg: number;
|
|
41
|
+
max: number;
|
|
42
|
+
min: number;
|
|
43
|
+
}>;
|
|
44
|
+
export type FramePerfDirtyRowsStats = Readonly<{
|
|
45
|
+
avg: number;
|
|
46
|
+
max: number;
|
|
47
|
+
sampledFrames: number;
|
|
48
|
+
fullFrames: number;
|
|
49
|
+
}>;
|
|
50
|
+
export type FramePerfSummary = Readonly<{
|
|
51
|
+
frames: number;
|
|
52
|
+
firstFrameId: number | null;
|
|
53
|
+
latestFrameId: number | null;
|
|
54
|
+
windowMs: number;
|
|
55
|
+
durationMs: FramePerfMetricStats;
|
|
56
|
+
renderManagerMs: FramePerfMetricStats;
|
|
57
|
+
commitMs: FramePerfMetricStats;
|
|
58
|
+
domFlushMs: FramePerfMetricStats;
|
|
59
|
+
stdoutFlushMs: FramePerfMetricStats;
|
|
60
|
+
dirtyRows: FramePerfDirtyRowsStats;
|
|
61
|
+
scannedNodes: FramePerfMetricStats;
|
|
62
|
+
paintedNodes: FramePerfMetricStats;
|
|
63
|
+
coalescedInvalidates: number;
|
|
64
|
+
coalescedFrameTasks: number;
|
|
65
|
+
droppedUpdates: number;
|
|
66
|
+
maxQueueDepth: number;
|
|
67
|
+
rowBucketFallbacks: number;
|
|
68
|
+
reasons: Partial<Record<FramePerfReason, number>>;
|
|
69
|
+
activePlanes: Record<string, number>;
|
|
70
|
+
}>;
|
|
71
|
+
export declare function summarizeFramePerf(samples: readonly FramePerfSample[]): FramePerfSummary;
|
|
39
72
|
export declare function framePerfNow(): number;
|
|
40
73
|
export declare function mergeFramePerfReason(prev: FramePerfReason | undefined, next: FramePerfReason | undefined): FramePerfReason;
|
package/dist/observability.cjs
CHANGED
|
@@ -5,17 +5,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
11
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
13
|
return to;
|
|
17
14
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
16
|
|
|
20
17
|
// src/observability.ts
|
|
21
18
|
var observability_exports = {};
|
|
@@ -24,63 +21,94 @@ __export(observability_exports, {
|
|
|
24
21
|
createJsonlPerfSink: () => createJsonlPerfSink,
|
|
25
22
|
createTraceStore: () => createTraceStore,
|
|
26
23
|
framePerfNow: () => framePerfNow,
|
|
27
|
-
installTuiPerf: () => installTuiPerf
|
|
24
|
+
installTuiPerf: () => installTuiPerf,
|
|
25
|
+
summarizeFramePerf: () => summarizeFramePerf
|
|
28
26
|
});
|
|
29
27
|
module.exports = __toCommonJS(observability_exports);
|
|
30
28
|
|
|
31
29
|
// src/observability/frame-perf.ts
|
|
30
|
+
var EMPTY_METRIC_STATS = Object.freeze({ avg: 0, max: 0, min: 0 });
|
|
31
|
+
function metricStats(values) {
|
|
32
|
+
if (!values.length)
|
|
33
|
+
return EMPTY_METRIC_STATS;
|
|
34
|
+
let sum = 0, max = Number.NEGATIVE_INFINITY, min = Number.POSITIVE_INFINITY;
|
|
35
|
+
for (let value of values)
|
|
36
|
+
sum += value, value > max && (max = value), value < min && (min = value);
|
|
37
|
+
return { avg: sum / values.length, max, min };
|
|
38
|
+
}
|
|
39
|
+
function summarizeFramePerf(samples) {
|
|
40
|
+
let durationMs = [], renderManagerMs = [], commitMs = [], domFlushMs = [], stdoutFlushMs = [], dirtyRows = [], scannedNodes = [], paintedNodes = [], reasons = {}, activePlanes = {}, fullDirtyFrames = 0, coalescedInvalidates = 0, coalescedFrameTasks = 0, droppedUpdates = 0, maxQueueDepth = 0, rowBucketFallbacks = 0;
|
|
41
|
+
for (let sample of samples) {
|
|
42
|
+
durationMs.push(sample.durationMs), renderManagerMs.push(sample.renderManagerMs), commitMs.push(sample.commitMs), scannedNodes.push(sample.scannedNodes), paintedNodes.push(sample.paintedNodes), sample.domFlushMs != null && domFlushMs.push(sample.domFlushMs), sample.stdoutFlushMs != null && stdoutFlushMs.push(sample.stdoutFlushMs), sample.dirtyRows == null ? fullDirtyFrames++ : dirtyRows.push(sample.dirtyRows), reasons[sample.reason] = (reasons[sample.reason] ?? 0) + 1;
|
|
43
|
+
let planes = sample.activePlanes;
|
|
44
|
+
if (!planes)
|
|
45
|
+
activePlanes.all = (activePlanes.all ?? 0) + 1;
|
|
46
|
+
else
|
|
47
|
+
for (let plane of planes)
|
|
48
|
+
activePlanes[plane] = (activePlanes[plane] ?? 0) + 1;
|
|
49
|
+
coalescedInvalidates += sample.coalescedInvalidates, coalescedFrameTasks += sample.coalescedFrameTasks, droppedUpdates += sample.droppedUpdates, sample.queueDepth > maxQueueDepth && (maxQueueDepth = sample.queueDepth), rowBucketFallbacks += sample.rowBucketFallbacks?.length ?? 0;
|
|
50
|
+
}
|
|
51
|
+
let first = samples[0] ?? null, latest = samples[samples.length - 1] ?? null;
|
|
52
|
+
return {
|
|
53
|
+
frames: samples.length,
|
|
54
|
+
firstFrameId: first?.frameId ?? null,
|
|
55
|
+
latestFrameId: latest?.frameId ?? null,
|
|
56
|
+
windowMs: first && latest ? Math.max(0, latest.startedAt - first.startedAt) : 0,
|
|
57
|
+
durationMs: metricStats(durationMs),
|
|
58
|
+
renderManagerMs: metricStats(renderManagerMs),
|
|
59
|
+
commitMs: metricStats(commitMs),
|
|
60
|
+
domFlushMs: metricStats(domFlushMs),
|
|
61
|
+
stdoutFlushMs: metricStats(stdoutFlushMs),
|
|
62
|
+
dirtyRows: {
|
|
63
|
+
avg: dirtyRows.length ? dirtyRows.reduce((sum, value) => sum + value, 0) / dirtyRows.length : 0,
|
|
64
|
+
max: dirtyRows.length ? Math.max(...dirtyRows) : 0,
|
|
65
|
+
sampledFrames: dirtyRows.length,
|
|
66
|
+
fullFrames: fullDirtyFrames
|
|
67
|
+
},
|
|
68
|
+
scannedNodes: metricStats(scannedNodes),
|
|
69
|
+
paintedNodes: metricStats(paintedNodes),
|
|
70
|
+
coalescedInvalidates,
|
|
71
|
+
coalescedFrameTasks,
|
|
72
|
+
droppedUpdates,
|
|
73
|
+
maxQueueDepth,
|
|
74
|
+
rowBucketFallbacks,
|
|
75
|
+
reasons,
|
|
76
|
+
activePlanes
|
|
77
|
+
};
|
|
78
|
+
}
|
|
32
79
|
function framePerfNow() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return p.now();
|
|
36
|
-
return Date.now();
|
|
80
|
+
let p = globalThis.performance;
|
|
81
|
+
return p && typeof p.now == "function" ? p.now() : Date.now();
|
|
37
82
|
}
|
|
38
83
|
|
|
39
84
|
// src/observability/frame-perf-store.ts
|
|
40
85
|
var import_vue = require("vue");
|
|
41
86
|
|
|
42
87
|
// src/observability/perf-sink.ts
|
|
43
|
-
var installedTuiPerf = { enabled:
|
|
88
|
+
var installedTuiPerf = { enabled: !1, sink: null };
|
|
44
89
|
function shouldSample(rate) {
|
|
45
|
-
|
|
46
|
-
return false;
|
|
47
|
-
if (rate >= 1)
|
|
48
|
-
return true;
|
|
49
|
-
return Math.random() < rate;
|
|
90
|
+
return rate <= 0 ? !1 : rate >= 1 ? !0 : Math.random() < rate;
|
|
50
91
|
}
|
|
51
92
|
function normalizeSampleRate(value) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return 1;
|
|
55
|
-
return Math.max(0, Math.min(1, n));
|
|
93
|
+
let n = Number(value);
|
|
94
|
+
return Number.isFinite(n) ? Math.max(0, Math.min(1, n)) : 1;
|
|
56
95
|
}
|
|
57
96
|
function createJsonlPerfSink(options = {}) {
|
|
58
|
-
|
|
59
|
-
const includeComponents = options.includeComponents ?? true;
|
|
60
|
-
const includeEvents = options.includeEvents ?? false;
|
|
97
|
+
let sampleRate = normalizeSampleRate(options.sampleRate), includeComponents = options.includeComponents ?? !0, includeEvents = options.includeEvents ?? !1;
|
|
61
98
|
function emit(value) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`);
|
|
66
|
-
}
|
|
67
|
-
options.write?.(line);
|
|
99
|
+
let line = JSON.stringify(value);
|
|
100
|
+
options.file && options.fileWriter?.appendFileSync && options.fileWriter.appendFileSync(options.file, `${line}
|
|
101
|
+
`), options.write?.(line);
|
|
68
102
|
}
|
|
69
103
|
return {
|
|
70
104
|
onFramePerf(sample) {
|
|
71
|
-
|
|
72
|
-
return;
|
|
73
|
-
emit({ type: "frame", ...sample });
|
|
105
|
+
shouldSample(sampleRate) && emit({ type: "frame", ...sample });
|
|
74
106
|
},
|
|
75
107
|
onComponentPerf(sample) {
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
emit({ type: "component", ...sample });
|
|
108
|
+
!includeComponents || !shouldSample(sampleRate) || emit({ type: "component", ...sample });
|
|
79
109
|
},
|
|
80
110
|
onEvent(event) {
|
|
81
|
-
|
|
82
|
-
return;
|
|
83
|
-
emit({
|
|
111
|
+
!includeEvents || !shouldSample(sampleRate) || emit({
|
|
84
112
|
type: "event",
|
|
85
113
|
eventType: event.type,
|
|
86
114
|
ts: event.ts ?? Date.now(),
|
|
@@ -92,24 +120,12 @@ function createJsonlPerfSink(options = {}) {
|
|
|
92
120
|
};
|
|
93
121
|
}
|
|
94
122
|
function installTuiPerf(options = {}) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const current = {
|
|
98
|
-
enabled: options.enabled ?? Boolean(options.sink),
|
|
123
|
+
let previous = installedTuiPerf, previousDebugPerf = globalThis.__VT_DEBUG_PERF__, current = {
|
|
124
|
+
enabled: options.enabled ?? !!options.sink,
|
|
99
125
|
sink: options.sink ?? null
|
|
100
126
|
};
|
|
101
|
-
installedTuiPerf = current
|
|
102
|
-
|
|
103
|
-
globalThis.__VT_DEBUG_PERF__ = Boolean(options.debugOverlay);
|
|
104
|
-
}
|
|
105
|
-
return () => {
|
|
106
|
-
current.sink?.dispose?.();
|
|
107
|
-
if (installedTuiPerf === current)
|
|
108
|
-
installedTuiPerf = previous;
|
|
109
|
-
if (previousDebugPerf === void 0)
|
|
110
|
-
delete globalThis.__VT_DEBUG_PERF__;
|
|
111
|
-
else
|
|
112
|
-
globalThis.__VT_DEBUG_PERF__ = previousDebugPerf;
|
|
127
|
+
return installedTuiPerf = current, options.debugOverlay != null && (globalThis.__VT_DEBUG_PERF__ = !!options.debugOverlay), () => {
|
|
128
|
+
current.sink?.dispose?.(), installedTuiPerf === current && (installedTuiPerf = previous), previousDebugPerf === void 0 ? delete globalThis.__VT_DEBUG_PERF__ : globalThis.__VT_DEBUG_PERF__ = previousDebugPerf;
|
|
113
129
|
};
|
|
114
130
|
}
|
|
115
131
|
function getInstalledTuiPerf() {
|
|
@@ -118,72 +134,47 @@ function getInstalledTuiPerf() {
|
|
|
118
134
|
|
|
119
135
|
// src/observability/frame-perf-store.ts
|
|
120
136
|
function createFramePerfStore(limit = 120, opts) {
|
|
121
|
-
|
|
122
|
-
const installed = getInstalledTuiPerf();
|
|
123
|
-
const manualEnabled = (0, import_vue.ref)(Boolean(opts?.enabled ?? installed.enabled));
|
|
124
|
-
const leaseCount = (0, import_vue.ref)(0);
|
|
125
|
-
const enabled = (0, import_vue.computed)({
|
|
137
|
+
let max = Math.max(1, Math.floor(limit)), installed = getInstalledTuiPerf(), manualEnabled = (0, import_vue.ref)(!!(opts?.enabled ?? installed.enabled)), leaseCount = (0, import_vue.ref)(0), enabled = (0, import_vue.computed)({
|
|
126
138
|
get: () => manualEnabled.value || leaseCount.value > 0,
|
|
127
139
|
set: (next) => {
|
|
128
|
-
manualEnabled.value =
|
|
140
|
+
manualEnabled.value = !!next;
|
|
129
141
|
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
sinks.push(installed.sink);
|
|
135
|
-
const configuredSink = opts?.sink;
|
|
136
|
-
if (Array.isArray(configuredSink))
|
|
137
|
-
sinks.push(...configuredSink);
|
|
138
|
-
else if (configuredSink)
|
|
139
|
-
sinks.push(configuredSink);
|
|
142
|
+
}), samples = [], sinks = [];
|
|
143
|
+
installed.sink && sinks.push(installed.sink);
|
|
144
|
+
let configuredSink = opts?.sink;
|
|
145
|
+
Array.isArray(configuredSink) ? sinks.push(...configuredSink) : configuredSink && sinks.push(configuredSink);
|
|
140
146
|
function emitToSinks(fn) {
|
|
141
|
-
for (
|
|
147
|
+
for (let sink of sinks)
|
|
142
148
|
try {
|
|
143
149
|
fn(sink);
|
|
144
150
|
} catch {
|
|
145
151
|
}
|
|
146
|
-
}
|
|
147
152
|
}
|
|
148
153
|
function acquire(_reason) {
|
|
149
154
|
leaseCount.value++;
|
|
150
|
-
let released =
|
|
155
|
+
let released = !1;
|
|
151
156
|
return () => {
|
|
152
|
-
|
|
153
|
-
return;
|
|
154
|
-
released = true;
|
|
155
|
-
leaseCount.value = Math.max(0, leaseCount.value - 1);
|
|
157
|
+
released || (released = !0, leaseCount.value = Math.max(0, leaseCount.value - 1));
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
160
|
function push(sample) {
|
|
159
|
-
|
|
160
|
-
return;
|
|
161
|
-
samples.push(sample);
|
|
162
|
-
if (samples.length > max)
|
|
163
|
-
samples.splice(0, samples.length - max);
|
|
164
|
-
emitToSinks((sink) => sink.onFramePerf(sample));
|
|
161
|
+
enabled.value && (samples.push(sample), samples.length > max && samples.splice(0, samples.length - max), emitToSinks((sink) => sink.onFramePerf(sample)));
|
|
165
162
|
}
|
|
166
163
|
function recordComponent(sample) {
|
|
167
|
-
|
|
168
|
-
return;
|
|
169
|
-
emitToSinks((sink) => sink.onComponentPerf?.(sample));
|
|
164
|
+
enabled.value && emitToSinks((sink) => sink.onComponentPerf?.(sample));
|
|
170
165
|
}
|
|
171
166
|
function recordEvent(event) {
|
|
172
|
-
|
|
173
|
-
return;
|
|
174
|
-
emitToSinks((sink) => sink.onEvent?.(event));
|
|
167
|
+
enabled.value && emitToSinks((sink) => sink.onEvent?.(event));
|
|
175
168
|
}
|
|
176
169
|
function addSink(sink) {
|
|
177
170
|
sinks.push(sink);
|
|
178
|
-
let disposed =
|
|
171
|
+
let disposed = !1;
|
|
179
172
|
return () => {
|
|
180
173
|
if (disposed)
|
|
181
174
|
return;
|
|
182
|
-
disposed =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
sinks.splice(index, 1);
|
|
186
|
-
sink.dispose?.();
|
|
175
|
+
disposed = !0;
|
|
176
|
+
let index = sinks.indexOf(sink);
|
|
177
|
+
index >= 0 && sinks.splice(index, 1), sink.dispose?.();
|
|
187
178
|
};
|
|
188
179
|
}
|
|
189
180
|
function latest() {
|
|
@@ -192,24 +183,32 @@ function createFramePerfStore(limit = 120, opts) {
|
|
|
192
183
|
function list() {
|
|
193
184
|
return samples.slice();
|
|
194
185
|
}
|
|
186
|
+
function summary() {
|
|
187
|
+
return summarizeFramePerf(samples);
|
|
188
|
+
}
|
|
195
189
|
function clear() {
|
|
196
190
|
samples.length = 0;
|
|
197
191
|
}
|
|
198
|
-
return {
|
|
192
|
+
return {
|
|
193
|
+
enabled,
|
|
194
|
+
acquire,
|
|
195
|
+
push,
|
|
196
|
+
recordComponent,
|
|
197
|
+
recordEvent,
|
|
198
|
+
addSink,
|
|
199
|
+
latest,
|
|
200
|
+
list,
|
|
201
|
+
summary,
|
|
202
|
+
clear
|
|
203
|
+
};
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
// src/observability/trace.ts
|
|
202
207
|
var import_vue2 = require("vue");
|
|
203
208
|
function createTraceStore(opts) {
|
|
204
|
-
|
|
205
|
-
const records = (0, import_vue2.shallowReactive)([]);
|
|
206
|
-
const max = Math.max(10, Math.floor(opts?.max ?? 400));
|
|
209
|
+
let enabled = (0, import_vue2.ref)(!!opts?.enabled), records = (0, import_vue2.shallowReactive)([]), max = Math.max(10, Math.floor(opts?.max ?? 400));
|
|
207
210
|
function push(record) {
|
|
208
|
-
|
|
209
|
-
return;
|
|
210
|
-
records.push(record);
|
|
211
|
-
if (records.length > max)
|
|
212
|
-
records.splice(0, records.length - max);
|
|
211
|
+
enabled.value && (records.push(record), records.length > max && records.splice(0, records.length - max));
|
|
213
212
|
}
|
|
214
213
|
function clear() {
|
|
215
214
|
records.splice(0, records.length);
|
package/dist/observability.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { FramePerfReason, FramePerfRowBucketFallback, FramePerfSample, } from "./observability/frame-perf.js";
|
|
2
|
-
export { framePerfNow } from "./observability/frame-perf.js";
|
|
1
|
+
export type { FramePerfDirtyRowsStats, FramePerfMetricStats, FramePerfReason, FramePerfRowBucketFallback, FramePerfSample, FramePerfSummary, } from "./observability/frame-perf.js";
|
|
2
|
+
export { framePerfNow, summarizeFramePerf } from "./observability/frame-perf.js";
|
|
3
3
|
export type { FramePerfStore } from "./observability/frame-perf-store.js";
|
|
4
4
|
export { createFramePerfStore } from "./observability/frame-perf-store.js";
|
|
5
5
|
export type { ComponentPerf, CreateJsonlPerfSinkOptions, FramePerf, InstallTuiPerfOptions, TuiPerfEvent, TuiPerfSink, } from "./observability/perf-sink.js";
|
package/dist/observability.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { FramePerfReason, FramePerfRowBucketFallback, FramePerfSample, } from "./observability/frame-perf.js";
|
|
2
|
-
export { framePerfNow } from "./observability/frame-perf.js";
|
|
1
|
+
export type { FramePerfDirtyRowsStats, FramePerfMetricStats, FramePerfReason, FramePerfRowBucketFallback, FramePerfSample, FramePerfSummary, } from "./observability/frame-perf.js";
|
|
2
|
+
export { framePerfNow, summarizeFramePerf } from "./observability/frame-perf.js";
|
|
3
3
|
export type { FramePerfStore } from "./observability/frame-perf-store.js";
|
|
4
4
|
export { createFramePerfStore } from "./observability/frame-perf-store.js";
|
|
5
5
|
export type { ComponentPerf, CreateJsonlPerfSinkOptions, FramePerf, InstallTuiPerfOptions, TuiPerfEvent, TuiPerfSink, } from "./observability/perf-sink.js";
|
package/dist/observability.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { framePerfNow, summarizeFramePerf } from "./frame-perf-BBhE-iuS.js";
|
|
2
|
+
import { createFramePerfStore, createJsonlPerfSink, createTraceStore, installTuiPerf } from "./trace-CYHDKM1m.js";
|
|
3
3
|
|
|
4
|
-
export { createFramePerfStore, createJsonlPerfSink, createTraceStore, framePerfNow, installTuiPerf };
|
|
4
|
+
export { createFramePerfStore, createJsonlPerfSink, createTraceStore, framePerfNow, installTuiPerf, summarizeFramePerf };
|