@simon_he/vue-tui 0.0.8 → 1.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 +142 -30
- package/dist/TSelect-BwJJbuTt.js +6089 -0
- package/dist/TTree-DK_DQBYm.js +6480 -0
- package/dist/agent.cjs +39416 -0
- package/dist/agent.d.cts +44 -0
- package/dist/agent.d.ts +44 -0
- package/dist/agent.js +828 -0
- package/dist/ansi-palette-CNXqFciC.js +57 -0
- package/dist/ansi-styles.d.ts +200 -0
- package/dist/block-source-CKUOnkgT.js +1663 -0
- package/dist/cli/headless-renderer.d.ts +29 -0
- package/dist/cli/input.d.ts +49 -0
- package/dist/cli/node-file-writers.d.ts +13 -0
- package/dist/cli/node-module.d.ts +2 -0
- package/dist/cli/parse-kitty.d.ts +2 -0
- package/dist/cli/parse-mouse.d.ts +2 -0
- package/dist/cli/parse-utils.d.ts +14 -0
- package/dist/cli/parse-xterm.d.ts +2 -0
- package/dist/cli/path-provider-types.d.ts +1 -0
- package/dist/cli/path-provider.d.ts +4 -0
- package/dist/cli/path-suggest-core.d.ts +1 -0
- package/dist/cli/path-suggest.d.ts +15 -0
- package/dist/cli/recording.d.ts +4 -0
- package/dist/cli/stdin-buffer.d.ts +33 -0
- package/dist/cli.cjs +11061 -0
- package/dist/cli.d.cts +23 -0
- package/dist/cli.d.ts +23 -0
- package/dist/cli.js +9875 -0
- package/dist/core/ansi/capability.d.ts +20 -0
- package/dist/core/ansi/colors.d.ts +41 -0
- package/dist/core/ansi/sgr.d.ts +7 -0
- package/dist/core/ansi/theme.d.ts +6 -0
- package/dist/core/ansi-palette.d.ts +14 -0
- package/dist/core/buffer/buffer.d.ts +54 -0
- package/dist/core/buffer/width.d.ts +4 -0
- package/dist/core/debug-logger.d.ts +18 -0
- package/dist/core/hyperlink.d.ts +9 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/path-provider-types.d.ts +24 -0
- package/dist/core/path-suggest.d.ts +35 -0
- package/dist/core/render-plane.d.ts +3 -0
- package/dist/core/terminal/create-terminal.d.ts +8 -0
- package/dist/core/terminal/emitter.d.ts +7 -0
- package/dist/core/types.d.ts +107 -0
- package/dist/core.cjs +3153 -0
- package/dist/core.d.cts +14 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.js +424 -0
- package/dist/create-terminal-C2oiWFJU.js +1434 -0
- package/dist/create-terminal-app.d.ts +36 -0
- package/dist/dom-renderer-BqGijQID.js +1173 -0
- package/dist/env-Cl8qmNFN.js +19 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/manager/cli-event-manager.d.ts +22 -0
- package/dist/events/manager/event-manager.d.ts +30 -0
- package/dist/events/manager/selection-suppression.d.ts +3 -0
- package/dist/events/manager/types.d.ts +108 -0
- package/dist/events/recording.d.ts +44 -0
- package/dist/experimental.cjs +4412 -1641
- package/dist/experimental.d.cts +42 -0
- package/dist/experimental.d.ts +42 -825
- package/dist/experimental.js +31 -7392
- package/dist/frame-perf-C6Xfg85O.js +24 -0
- package/dist/hyperlink-Bn02UXJb.js +419 -0
- package/dist/index.cjs +14765 -17582
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -1528
- package/dist/index.js +17 -20026
- package/dist/linkify-D_gzn9Xq.js +562 -0
- package/dist/markdown.cjs +9321 -7623
- package/dist/markdown.d.cts +11 -0
- package/dist/markdown.d.ts +11 -112
- package/dist/markdown.js +36 -1427
- package/dist/observability/cli-latency-node.d.ts +3 -0
- package/dist/observability/cli-latency-types.d.ts +41 -0
- package/dist/observability/cli-latency.d.ts +3 -0
- package/dist/observability/frame-perf-store.d.ts +18 -0
- package/dist/observability/frame-perf.d.ts +40 -0
- package/dist/observability/perf-sink.d.ts +56 -0
- package/dist/observability/trace.d.ts +40 -0
- package/dist/observability/tui-profiler.d.ts +33 -0
- package/dist/observability.cjs +221 -0
- package/dist/observability.d.cts +8 -0
- package/dist/observability.d.ts +8 -0
- package/dist/observability.js +4 -0
- package/dist/path-mnSgEpCm.js +81 -0
- package/dist/path-suggest-BNqcuE3-.js +274 -0
- package/dist/path-suggest-Dk9TRLh5.js +3 -0
- package/dist/{path-suggest-DmrmeueH.js → path-suggest-bvR9SY6Q.js} +86 -18
- package/dist/renderer/capabilities.d.ts +13 -0
- package/dist/renderer/cli/index.d.ts +2 -0
- package/dist/renderer/cli/stdout-metrics.d.ts +18 -0
- package/dist/renderer/cli/stdout-renderer.d.ts +48 -0
- package/dist/renderer/dom/dom-renderer.d.ts +157 -0
- package/dist/renderer/dom/index.d.ts +2 -0
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer-dom.cjs +1505 -0
- package/dist/renderer-dom.d.cts +4 -0
- package/dist/renderer-dom.d.ts +4 -0
- package/dist/renderer-dom.js +7 -0
- package/dist/runtime/index.d.ts +36 -0
- package/dist/runtime/osc52.d.ts +9 -0
- package/dist/runtime-rfcZCyJq.js +1197 -0
- package/dist/runtime.cjs +1698 -0
- package/dist/runtime.d.cts +9 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.js +4 -0
- package/dist/selection/terminal-selection.d.ts +123 -0
- package/dist/sgr-BmzxEjAO.js +304 -0
- package/dist/terminal-selection-DBinO6p5.js +330 -0
- package/dist/tlog-theme-qPBt5rge.js +9254 -0
- package/dist/trace-CjzYeIxN.js +182 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/grapheme.d.ts +5 -0
- package/dist/utils/newlines.d.ts +1 -0
- package/dist/utils/path.d.ts +7 -0
- package/dist/utils/url-safety.d.ts +2 -0
- package/dist/vue/agent/view-models.d.ts +98 -0
- package/dist/vue/components/TAnchor.d.ts +108 -0
- package/dist/vue/components/TBox.d.ts +144 -0
- package/dist/vue/components/TCommandPalette.d.ts +587 -0
- package/dist/vue/components/TDataTable.d.ts +367 -0
- package/dist/vue/components/TDebugOverlay.d.ts +43 -0
- package/dist/vue/components/TDialog.d.ts +255 -0
- package/dist/vue/components/TFeedback.d.ts +635 -0
- package/dist/vue/components/TFlow.d.ts +85 -0
- package/dist/vue/components/TForm.d.ts +1230 -0
- package/dist/vue/components/TInput.d.ts +545 -0
- package/dist/vue/components/TInputBox.d.ts +158 -0
- package/dist/vue/components/TJsonEditor.d.ts +165 -0
- package/dist/vue/components/TLink.d.ts +239 -0
- package/dist/vue/components/TLinkifyText.d.ts +141 -0
- package/dist/vue/components/TList.d.ts +119 -0
- package/dist/vue/components/TLogLinksPanel.d.ts +238 -0
- package/dist/vue/components/TLogMinimap.d.ts +263 -0
- package/dist/vue/components/TLogScrollbar.d.ts +236 -0
- package/dist/vue/components/TLogSearchBar.d.ts +267 -0
- package/dist/vue/components/TLogSearchPager.d.ts +162 -0
- package/dist/vue/components/TLogSearchResults.d.ts +200 -0
- package/dist/vue/components/TLogView.d.ts +536 -0
- package/dist/vue/components/TLogVirtualLinksPanel.d.ts +141 -0
- package/dist/vue/components/TLogVirtualSearchResults.d.ts +146 -0
- package/dist/vue/components/TMarkdownText.d.ts +134 -0
- package/dist/vue/components/TMultilineModal.d.ts +62 -0
- package/dist/vue/components/TNavigation.d.ts +324 -0
- package/dist/vue/components/TOverlay.d.ts +366 -0
- package/dist/vue/components/TPanels.d.ts +244 -0
- package/dist/vue/components/TPathPicker.d.ts +213 -0
- package/dist/vue/components/TRenderLayer.d.ts +16 -0
- package/dist/vue/components/TRenderPlane.d.ts +17 -0
- package/dist/vue/components/TSelect.d.ts +335 -0
- package/dist/vue/components/TTable.d.ts +317 -0
- package/dist/vue/components/TText.d.ts +116 -0
- package/dist/vue/components/TThinkingView.d.ts +233 -0
- package/dist/vue/components/TToolCallView.d.ts +384 -0
- package/dist/vue/components/TTranscriptView.d.ts +221 -0
- package/dist/vue/components/TTransition.d.ts +83 -0
- package/dist/vue/components/TTree.d.ts +200 -0
- package/dist/vue/components/TUserMessageView.d.ts +344 -0
- package/dist/vue/components/TView.d.ts +127 -0
- package/dist/vue/components/TVirtualList.d.ts +182 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +168 -0
- package/dist/vue/components/TVirtualRows.d.ts +247 -0
- package/dist/vue/components/TerminalProvider.d.ts +218 -0
- package/dist/vue/components/input/host.d.ts +17 -0
- package/dist/vue/components/input/plugins/hostPlugin.d.ts +7 -0
- package/dist/vue/components/input/plugins/hostPlugin.node.d.ts +15 -0
- package/dist/vue/components/input/plugins/mentionUtils.d.ts +17 -0
- package/dist/vue/components/input/plugins/nodeMentionPathProvider.d.ts +2 -0
- package/dist/vue/components/input/plugins/promptMentionPlugin.d.ts +8 -0
- package/dist/vue/components/input/plugins/promptMentionState.d.ts +98 -0
- package/dist/vue/components/input/plugins/restrictText.d.ts +27 -0
- package/dist/vue/components/input/plugins/types.d.ts +90 -0
- package/dist/vue/components/input/utils/inlineText.d.ts +57 -0
- package/dist/vue/components/input/utils/inlineTextTokens.d.ts +34 -0
- package/dist/vue/components/input/utils/primitives.d.ts +3 -0
- package/dist/vue/components/input/utils/wordNavigation.d.ts +6 -0
- package/dist/vue/components/link/host.d.ts +15 -0
- package/dist/vue/components/list/list-geometry.d.ts +16 -0
- package/dist/vue/components/list/list-paint.d.ts +1 -0
- package/dist/vue/components/list/scroll-state.d.ts +25 -0
- package/dist/vue/components/list/selection-state.d.ts +6 -0
- package/dist/vue/components/simple-utils.d.ts +5 -0
- package/dist/vue/components/terminal-provider/copy-toast.d.ts +6 -0
- package/dist/vue/components/terminal-provider/portals.d.ts +17 -0
- package/dist/vue/components/terminal-provider/scheduler.d.ts +29 -0
- package/dist/vue/components/terminal-provider/selection-config.d.ts +15 -0
- package/dist/vue/components/terminal-provider/utils.d.ts +5 -0
- package/dist/vue/composables/use-layout.d.ts +2 -0
- package/dist/vue/composables/use-render-node.d.ts +19 -0
- package/dist/vue/composables/use-render-stack.d.ts +3 -0
- package/dist/vue/composables/use-runtime.d.ts +5 -0
- package/dist/vue/composables/use-terminal-node.d.ts +14 -0
- package/dist/vue/composables/use-terminal.d.ts +2 -0
- package/dist/vue/composables/use-visibility.d.ts +12 -0
- package/dist/vue/context.d.ts +153 -0
- package/dist/vue/index.d.ts +69 -0
- package/dist/vue/injection-key.d.ts +2 -0
- package/dist/vue/linkify.d.ts +11 -0
- package/dist/vue/log/append-only-log-store.d.ts +2 -0
- package/dist/vue/log/tlog-keymap.d.ts +28 -0
- package/dist/vue/log/tlog-plugins.d.ts +144 -0
- package/dist/vue/log/tlog-session.d.ts +81 -0
- package/dist/vue/log/tlog-theme.d.ts +68 -0
- package/dist/vue/log/types.d.ts +43 -0
- package/dist/vue/log/use-tlog-link-controller.d.ts +31 -0
- package/dist/vue/log/use-tlog-retained-index.d.ts +26 -0
- package/dist/vue/log/use-tlog-search-controller.d.ts +51 -0
- package/dist/vue/log/use-tlog-search-results-page.d.ts +31 -0
- package/dist/vue/log/use-tlog-virtual-search-results.d.ts +22 -0
- package/dist/vue/markdown/ast.d.ts +3 -0
- package/dist/vue/markdown/block-source.d.ts +22 -0
- package/dist/vue/markdown/document.d.ts +20 -0
- package/dist/vue/markdown/layout.d.ts +21 -0
- package/dist/vue/markdown/parser.d.ts +11 -0
- package/dist/vue/markdown/render.d.ts +10 -0
- package/dist/vue/markdown/theme.d.ts +186 -0
- package/dist/vue/markdown/types.d.ts +59 -0
- package/dist/vue/overlay.d.ts +27 -0
- package/dist/vue/render/context.d.ts +3 -0
- package/dist/vue/render/render-manager.d.ts +94 -0
- package/dist/vue/router/RouterView.d.ts +25 -0
- package/dist/vue/router/composables.d.ts +4 -0
- package/dist/vue/router/context.d.ts +4 -0
- package/dist/vue/router/router.d.ts +7 -0
- package/dist/vue/router/types.d.ts +29 -0
- package/dist/vue/scheduler/frame-mailbox.d.ts +55 -0
- package/dist/vue/scheduler/frame-scheduler.d.ts +51 -0
- package/dist/vue/theme.d.ts +48 -0
- package/dist/vue/transcript/hit-regions.d.ts +2 -0
- package/dist/vue/transcript/layout.d.ts +20 -0
- package/dist/vue/transcript/plain-text.d.ts +2 -0
- package/dist/vue/transcript/types.d.ts +122 -0
- package/dist/vue/utils/frame-task.d.ts +6 -0
- package/dist/vue/utils/rect.d.ts +4 -0
- package/dist/vue/utils/row-scroll.d.ts +25 -0
- package/dist/vue/utils/style-cache.d.ts +3 -0
- package/dist/vue/utils/text.d.ts +27 -0
- package/dist/vue/utils/wheel-scroll.d.ts +18 -0
- package/dist/vue.cjs +23668 -0
- package/dist/vue.d.cts +1 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +3957 -0
- package/dist/{wheel-scroll-CiNsasLf.js → wheel-scroll-vBRaQ7p-.js} +404 -405
- package/package.json +185 -35
- package/dist/path-suggest-BeV6n7m-.js +0 -3
- package/dist/sgr-Tko2EQ0U.js +0 -484
- package/dist/theme-Bsm65g8k.d.ts +0 -32
- package/dist/types-ClIV2h1o.d.ts +0 -103
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type CliLatencyStageEvent = Readonly<Record<string, unknown>> & {
|
|
2
|
+
type?: unknown;
|
|
3
|
+
key?: unknown;
|
|
4
|
+
code?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export type CliLatencyProfiler = Readonly<{
|
|
7
|
+
enabled: true;
|
|
8
|
+
recordRawInput: (info?: Readonly<{
|
|
9
|
+
bytes?: number;
|
|
10
|
+
}>) => void;
|
|
11
|
+
recordStdinDispatch: (event: CliLatencyStageEvent, info?: Readonly<{
|
|
12
|
+
parser?: string | null;
|
|
13
|
+
}>) => void;
|
|
14
|
+
recordEventDispatchStart: (event: CliLatencyStageEvent) => void;
|
|
15
|
+
recordEventDispatchEnd: (event: CliLatencyStageEvent, info: Readonly<{
|
|
16
|
+
defaultPrevented: boolean;
|
|
17
|
+
}>) => void;
|
|
18
|
+
recordSchedulerInvalidate: (info?: Readonly<{
|
|
19
|
+
priority?: string | null;
|
|
20
|
+
plane?: string | null;
|
|
21
|
+
}>) => void;
|
|
22
|
+
recordFlushStart: (info?: Readonly<{
|
|
23
|
+
sync?: boolean;
|
|
24
|
+
activePlanes?: readonly string[] | null;
|
|
25
|
+
}>) => void;
|
|
26
|
+
recordFlushEnd: () => void;
|
|
27
|
+
recordCommit: (info?: Readonly<{
|
|
28
|
+
sync?: boolean;
|
|
29
|
+
dirtyRows?: readonly number[] | null;
|
|
30
|
+
planes?: readonly string[] | null;
|
|
31
|
+
}>) => void;
|
|
32
|
+
recordStdoutQueued: (delayMs: number) => void;
|
|
33
|
+
recordStdoutRenderStart: () => void;
|
|
34
|
+
recordStdoutNoOutput: () => void;
|
|
35
|
+
recordStdoutWrite: (info: Readonly<{
|
|
36
|
+
durationMs: number;
|
|
37
|
+
bytes: number;
|
|
38
|
+
mode: string;
|
|
39
|
+
}>) => void;
|
|
40
|
+
markOperation: (operation: string) => void;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { FramePerfSample } from "./frame-perf.js";
|
|
3
|
+
import type { ComponentPerf, TuiPerfEvent, TuiPerfSink } from "./perf-sink.js";
|
|
4
|
+
export type FramePerfStore = Readonly<{
|
|
5
|
+
enabled: Ref<boolean>;
|
|
6
|
+
acquire: (reason?: string) => () => void;
|
|
7
|
+
push: (sample: FramePerfSample) => void;
|
|
8
|
+
recordComponent: (sample: ComponentPerf) => void;
|
|
9
|
+
recordEvent: (event: TuiPerfEvent) => void;
|
|
10
|
+
addSink: (sink: TuiPerfSink) => () => void;
|
|
11
|
+
latest: () => FramePerfSample | null;
|
|
12
|
+
list: () => FramePerfSample[];
|
|
13
|
+
clear: () => void;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function createFramePerfStore(limit?: number, opts?: Readonly<{
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
sink?: TuiPerfSink | readonly TuiPerfSink[] | null;
|
|
18
|
+
}>): FramePerfStore;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type FramePerfReason = "scroll" | "input" | "stream" | "resize" | "data" | "selection" | "manual" | "unknown";
|
|
2
|
+
export type FramePerfRowBucketFallback = Readonly<{
|
|
3
|
+
plane: string;
|
|
4
|
+
reason: "dirty-ratio" | "candidate-ratio";
|
|
5
|
+
dirtyRows: number;
|
|
6
|
+
planeNodes: number;
|
|
7
|
+
candidates?: number;
|
|
8
|
+
}>;
|
|
9
|
+
export type FramePerfMailboxFailure = Readonly<{
|
|
10
|
+
id: string;
|
|
11
|
+
queued: number;
|
|
12
|
+
dropped: number;
|
|
13
|
+
}>;
|
|
14
|
+
export type FramePerfSample = Readonly<{
|
|
15
|
+
frameId: number;
|
|
16
|
+
reason: FramePerfReason;
|
|
17
|
+
startedAt: number;
|
|
18
|
+
durationMs: number;
|
|
19
|
+
renderManagerMs: number;
|
|
20
|
+
commitMs: number;
|
|
21
|
+
domFlushMs?: number;
|
|
22
|
+
stdoutFlushMs?: number;
|
|
23
|
+
dirtyRows: number | null;
|
|
24
|
+
activePlanes: readonly string[] | null;
|
|
25
|
+
scannedNodes: number;
|
|
26
|
+
paintedNodes: number;
|
|
27
|
+
rowBucketFallbacks?: readonly FramePerfRowBucketFallback[];
|
|
28
|
+
coalescedInvalidates: number;
|
|
29
|
+
frameTaskCount: number;
|
|
30
|
+
coalescedFrameTasks: number;
|
|
31
|
+
frameTaskQueueDepthBeforeRun: number;
|
|
32
|
+
frameTaskQueueDepthAfterRun: number;
|
|
33
|
+
remainingFrameTasks: number;
|
|
34
|
+
droppedUpdates: number;
|
|
35
|
+
mailboxFailure?: FramePerfMailboxFailure;
|
|
36
|
+
queueDepth: number;
|
|
37
|
+
liveReasons?: readonly string[];
|
|
38
|
+
}>;
|
|
39
|
+
export declare function framePerfNow(): number;
|
|
40
|
+
export declare function mergeFramePerfReason(prev: FramePerfReason | undefined, next: FramePerfReason | undefined): FramePerfReason;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { FramePerfSample } from "./frame-perf.js";
|
|
2
|
+
export type FramePerf = FramePerfSample;
|
|
3
|
+
export type ComponentPerf = Readonly<{
|
|
4
|
+
name: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
phase: "source-read" | "measure" | "layout" | "render" | "cache-hit" | "cache-miss" | "scroll" | "parse";
|
|
7
|
+
durationMs: number;
|
|
8
|
+
visibleStart?: number;
|
|
9
|
+
visibleEnd?: number;
|
|
10
|
+
overscanStart?: number;
|
|
11
|
+
overscanEnd?: number;
|
|
12
|
+
itemCount?: number;
|
|
13
|
+
renderedCount?: number;
|
|
14
|
+
cacheHit?: number;
|
|
15
|
+
cacheMiss?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
version?: string | number;
|
|
18
|
+
reason?: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type TuiPerfEvent = Readonly<{
|
|
21
|
+
type: string;
|
|
22
|
+
ts?: number;
|
|
23
|
+
component?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
data?: Record<string, unknown>;
|
|
26
|
+
}>;
|
|
27
|
+
export type TuiPerfSink = Readonly<{
|
|
28
|
+
onFramePerf: (sample: FramePerfSample) => void;
|
|
29
|
+
onComponentPerf?: (sample: ComponentPerf) => void;
|
|
30
|
+
onEvent?: (event: TuiPerfEvent) => void;
|
|
31
|
+
dispose?: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
export type TuiPerfJsonlWriter = Readonly<{
|
|
34
|
+
appendFileSync?: (path: string, data: string) => void;
|
|
35
|
+
}>;
|
|
36
|
+
export type CreateJsonlPerfSinkOptions = Readonly<{
|
|
37
|
+
file?: string;
|
|
38
|
+
fileWriter?: TuiPerfJsonlWriter | null;
|
|
39
|
+
write?: (line: string) => void;
|
|
40
|
+
sampleRate?: number;
|
|
41
|
+
includeComponents?: boolean;
|
|
42
|
+
includeEvents?: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
export type InstallTuiPerfOptions = Readonly<{
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
sink?: TuiPerfSink | null;
|
|
47
|
+
debugOverlay?: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
type InstalledTuiPerf = Readonly<{
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
sink: TuiPerfSink | null;
|
|
52
|
+
}>;
|
|
53
|
+
export declare function createJsonlPerfSink(options?: CreateJsonlPerfSinkOptions): TuiPerfSink;
|
|
54
|
+
export declare function installTuiPerf(options?: InstallTuiPerfOptions): () => void;
|
|
55
|
+
export declare function getInstalledTuiPerf(): InstalledTuiPerf;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { TerminalRenderPlanes } from "../core/render-plane.js";
|
|
3
|
+
import type { TerminalEventRecord } from "../events/recording.js";
|
|
4
|
+
import type { DomRendererSyncFlushDecision } from "../renderer/dom/dom-renderer.js";
|
|
5
|
+
export type TraceRecord = Readonly<{
|
|
6
|
+
type: "event";
|
|
7
|
+
at: number;
|
|
8
|
+
event: TerminalEventRecord;
|
|
9
|
+
}> | Readonly<{
|
|
10
|
+
type: "focus";
|
|
11
|
+
at: number;
|
|
12
|
+
prev: string | null;
|
|
13
|
+
next: string | null;
|
|
14
|
+
}> | Readonly<{
|
|
15
|
+
type: "commit";
|
|
16
|
+
at: number;
|
|
17
|
+
dirtyRows: readonly number[] | null;
|
|
18
|
+
planes: TerminalRenderPlanes | null;
|
|
19
|
+
sync?: boolean;
|
|
20
|
+
rendererSyncFlush?: DomRendererSyncFlushDecision | null;
|
|
21
|
+
focusedId: string | null;
|
|
22
|
+
}> | Readonly<{
|
|
23
|
+
type: "selection-copy";
|
|
24
|
+
at: number;
|
|
25
|
+
rows: number;
|
|
26
|
+
chars: number;
|
|
27
|
+
ok: boolean;
|
|
28
|
+
error?: string;
|
|
29
|
+
}>;
|
|
30
|
+
export type TraceStore = Readonly<{
|
|
31
|
+
enabled: Ref<boolean>;
|
|
32
|
+
records: TraceRecord[];
|
|
33
|
+
push: (record: TraceRecord) => void;
|
|
34
|
+
clear: () => void;
|
|
35
|
+
snapshot: () => TraceRecord[];
|
|
36
|
+
}>;
|
|
37
|
+
export declare function createTraceStore(opts?: Readonly<{
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
max?: number;
|
|
40
|
+
}>): TraceStore;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TerminalRenderPlane, TerminalRenderPlanes } from "../core/render-plane.js";
|
|
2
|
+
type NowFn = () => number;
|
|
3
|
+
type TuiProfilerFileWriter = Readonly<{
|
|
4
|
+
appendFileSync?: (path: string, data: string) => void;
|
|
5
|
+
}>;
|
|
6
|
+
export type CreateTuiProfilerOptions = Readonly<{
|
|
7
|
+
fileWriter?: TuiProfilerFileWriter;
|
|
8
|
+
defaultLogDest?: "stdout" | "file" | "both";
|
|
9
|
+
defaultLogPath?: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function setTuiProfilerFileWriter(writer: TuiProfilerFileWriter | null): void;
|
|
12
|
+
export type TuiProfiler = Readonly<{
|
|
13
|
+
now: NowFn;
|
|
14
|
+
recordInvalidate: (info?: {
|
|
15
|
+
plane?: TerminalRenderPlane | null;
|
|
16
|
+
}) => void;
|
|
17
|
+
recordRender: (info: {
|
|
18
|
+
durationMs: number;
|
|
19
|
+
rows: number;
|
|
20
|
+
nodes: number;
|
|
21
|
+
fullRepaint: boolean;
|
|
22
|
+
sorted: boolean;
|
|
23
|
+
activePlanes?: TerminalRenderPlanes | null;
|
|
24
|
+
}) => void;
|
|
25
|
+
recordWrite: (info: {
|
|
26
|
+
durationMs: number;
|
|
27
|
+
bytes: number;
|
|
28
|
+
mode: "stream" | "sync" | "chunked";
|
|
29
|
+
}) => void;
|
|
30
|
+
dispose: () => void;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function createTuiProfiler(name: string, options?: CreateTuiProfilerOptions): TuiProfiler | null;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/observability.ts
|
|
21
|
+
var observability_exports = {};
|
|
22
|
+
__export(observability_exports, {
|
|
23
|
+
createFramePerfStore: () => createFramePerfStore,
|
|
24
|
+
createJsonlPerfSink: () => createJsonlPerfSink,
|
|
25
|
+
createTraceStore: () => createTraceStore,
|
|
26
|
+
framePerfNow: () => framePerfNow,
|
|
27
|
+
installTuiPerf: () => installTuiPerf
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(observability_exports);
|
|
30
|
+
|
|
31
|
+
// src/observability/frame-perf.ts
|
|
32
|
+
function framePerfNow() {
|
|
33
|
+
const p = globalThis.performance;
|
|
34
|
+
if (p && typeof p.now === "function")
|
|
35
|
+
return p.now();
|
|
36
|
+
return Date.now();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/observability/frame-perf-store.ts
|
|
40
|
+
var import_vue = require("vue");
|
|
41
|
+
|
|
42
|
+
// src/observability/perf-sink.ts
|
|
43
|
+
var installedTuiPerf = { enabled: false, sink: null };
|
|
44
|
+
function shouldSample(rate) {
|
|
45
|
+
if (rate <= 0)
|
|
46
|
+
return false;
|
|
47
|
+
if (rate >= 1)
|
|
48
|
+
return true;
|
|
49
|
+
return Math.random() < rate;
|
|
50
|
+
}
|
|
51
|
+
function normalizeSampleRate(value) {
|
|
52
|
+
const n = Number(value);
|
|
53
|
+
if (!Number.isFinite(n))
|
|
54
|
+
return 1;
|
|
55
|
+
return Math.max(0, Math.min(1, n));
|
|
56
|
+
}
|
|
57
|
+
function createJsonlPerfSink(options = {}) {
|
|
58
|
+
const sampleRate = normalizeSampleRate(options.sampleRate);
|
|
59
|
+
const includeComponents = options.includeComponents ?? true;
|
|
60
|
+
const includeEvents = options.includeEvents ?? false;
|
|
61
|
+
function emit(value) {
|
|
62
|
+
const line = JSON.stringify(value);
|
|
63
|
+
if (options.file && options.fileWriter?.appendFileSync) {
|
|
64
|
+
options.fileWriter.appendFileSync(options.file, `${line}
|
|
65
|
+
`);
|
|
66
|
+
}
|
|
67
|
+
options.write?.(line);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
onFramePerf(sample) {
|
|
71
|
+
if (!shouldSample(sampleRate))
|
|
72
|
+
return;
|
|
73
|
+
emit({ type: "frame", ...sample });
|
|
74
|
+
},
|
|
75
|
+
onComponentPerf(sample) {
|
|
76
|
+
if (!includeComponents || !shouldSample(sampleRate))
|
|
77
|
+
return;
|
|
78
|
+
emit({ type: "component", ...sample });
|
|
79
|
+
},
|
|
80
|
+
onEvent(event) {
|
|
81
|
+
if (!includeEvents || !shouldSample(sampleRate))
|
|
82
|
+
return;
|
|
83
|
+
emit({
|
|
84
|
+
type: "event",
|
|
85
|
+
eventType: event.type,
|
|
86
|
+
ts: event.ts ?? Date.now(),
|
|
87
|
+
component: event.component,
|
|
88
|
+
id: event.id,
|
|
89
|
+
data: event.data
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function installTuiPerf(options = {}) {
|
|
95
|
+
const previous = installedTuiPerf;
|
|
96
|
+
const previousDebugPerf = globalThis.__VT_DEBUG_PERF__;
|
|
97
|
+
const current = {
|
|
98
|
+
enabled: options.enabled ?? Boolean(options.sink),
|
|
99
|
+
sink: options.sink ?? null
|
|
100
|
+
};
|
|
101
|
+
installedTuiPerf = current;
|
|
102
|
+
if (options.debugOverlay != null) {
|
|
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;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function getInstalledTuiPerf() {
|
|
116
|
+
return installedTuiPerf;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/observability/frame-perf-store.ts
|
|
120
|
+
function createFramePerfStore(limit = 120, opts) {
|
|
121
|
+
const max = Math.max(1, Math.floor(limit));
|
|
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)({
|
|
126
|
+
get: () => manualEnabled.value || leaseCount.value > 0,
|
|
127
|
+
set: (next) => {
|
|
128
|
+
manualEnabled.value = Boolean(next);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const samples = [];
|
|
132
|
+
const sinks = [];
|
|
133
|
+
if (installed.sink)
|
|
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);
|
|
140
|
+
function emitToSinks(fn) {
|
|
141
|
+
for (const sink of sinks) {
|
|
142
|
+
try {
|
|
143
|
+
fn(sink);
|
|
144
|
+
} catch {
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function acquire(_reason) {
|
|
149
|
+
leaseCount.value++;
|
|
150
|
+
let released = false;
|
|
151
|
+
return () => {
|
|
152
|
+
if (released)
|
|
153
|
+
return;
|
|
154
|
+
released = true;
|
|
155
|
+
leaseCount.value = Math.max(0, leaseCount.value - 1);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function push(sample) {
|
|
159
|
+
if (!enabled.value)
|
|
160
|
+
return;
|
|
161
|
+
samples.push(sample);
|
|
162
|
+
if (samples.length > max)
|
|
163
|
+
samples.splice(0, samples.length - max);
|
|
164
|
+
emitToSinks((sink) => sink.onFramePerf(sample));
|
|
165
|
+
}
|
|
166
|
+
function recordComponent(sample) {
|
|
167
|
+
if (!enabled.value)
|
|
168
|
+
return;
|
|
169
|
+
emitToSinks((sink) => sink.onComponentPerf?.(sample));
|
|
170
|
+
}
|
|
171
|
+
function recordEvent(event) {
|
|
172
|
+
if (!enabled.value)
|
|
173
|
+
return;
|
|
174
|
+
emitToSinks((sink) => sink.onEvent?.(event));
|
|
175
|
+
}
|
|
176
|
+
function addSink(sink) {
|
|
177
|
+
sinks.push(sink);
|
|
178
|
+
let disposed = false;
|
|
179
|
+
return () => {
|
|
180
|
+
if (disposed)
|
|
181
|
+
return;
|
|
182
|
+
disposed = true;
|
|
183
|
+
const index = sinks.indexOf(sink);
|
|
184
|
+
if (index >= 0)
|
|
185
|
+
sinks.splice(index, 1);
|
|
186
|
+
sink.dispose?.();
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function latest() {
|
|
190
|
+
return samples.length > 0 ? samples[samples.length - 1] : null;
|
|
191
|
+
}
|
|
192
|
+
function list() {
|
|
193
|
+
return samples.slice();
|
|
194
|
+
}
|
|
195
|
+
function clear() {
|
|
196
|
+
samples.length = 0;
|
|
197
|
+
}
|
|
198
|
+
return { enabled, acquire, push, recordComponent, recordEvent, addSink, latest, list, clear };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/observability/trace.ts
|
|
202
|
+
var import_vue2 = require("vue");
|
|
203
|
+
function createTraceStore(opts) {
|
|
204
|
+
const enabled = (0, import_vue2.ref)(Boolean(opts?.enabled));
|
|
205
|
+
const records = (0, import_vue2.shallowReactive)([]);
|
|
206
|
+
const max = Math.max(10, Math.floor(opts?.max ?? 400));
|
|
207
|
+
function push(record) {
|
|
208
|
+
if (!enabled.value)
|
|
209
|
+
return;
|
|
210
|
+
records.push(record);
|
|
211
|
+
if (records.length > max)
|
|
212
|
+
records.splice(0, records.length - max);
|
|
213
|
+
}
|
|
214
|
+
function clear() {
|
|
215
|
+
records.splice(0, records.length);
|
|
216
|
+
}
|
|
217
|
+
function snapshot() {
|
|
218
|
+
return records.slice();
|
|
219
|
+
}
|
|
220
|
+
return { enabled, records, push, clear, snapshot };
|
|
221
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { FramePerfReason, FramePerfRowBucketFallback, FramePerfSample, } from "./observability/frame-perf.js";
|
|
2
|
+
export { framePerfNow } from "./observability/frame-perf.js";
|
|
3
|
+
export type { FramePerfStore } from "./observability/frame-perf-store.js";
|
|
4
|
+
export { createFramePerfStore } from "./observability/frame-perf-store.js";
|
|
5
|
+
export type { ComponentPerf, CreateJsonlPerfSinkOptions, FramePerf, InstallTuiPerfOptions, TuiPerfEvent, TuiPerfSink, } from "./observability/perf-sink.js";
|
|
6
|
+
export { createJsonlPerfSink, installTuiPerf } from "./observability/perf-sink.js";
|
|
7
|
+
export type { TraceRecord, TraceStore } from "./observability/trace.js";
|
|
8
|
+
export { createTraceStore } from "./observability/trace.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { FramePerfReason, FramePerfRowBucketFallback, FramePerfSample, } from "./observability/frame-perf.js";
|
|
2
|
+
export { framePerfNow } from "./observability/frame-perf.js";
|
|
3
|
+
export type { FramePerfStore } from "./observability/frame-perf-store.js";
|
|
4
|
+
export { createFramePerfStore } from "./observability/frame-perf-store.js";
|
|
5
|
+
export type { ComponentPerf, CreateJsonlPerfSinkOptions, FramePerf, InstallTuiPerfOptions, TuiPerfEvent, TuiPerfSink, } from "./observability/perf-sink.js";
|
|
6
|
+
export { createJsonlPerfSink, installTuiPerf } from "./observability/perf-sink.js";
|
|
7
|
+
export type { TraceRecord, TraceStore } from "./observability/trace.js";
|
|
8
|
+
export { createTraceStore } from "./observability/trace.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createFramePerfStore, createJsonlPerfSink, createTraceStore, installTuiPerf } from "./trace-CjzYeIxN.js";
|
|
2
|
+
import { framePerfNow } from "./frame-perf-C6Xfg85O.js";
|
|
3
|
+
|
|
4
|
+
export { createFramePerfStore, createJsonlPerfSink, createTraceStore, framePerfNow, installTuiPerf };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//#region src/utils/newlines.ts
|
|
2
|
+
function normalizeNewlines(text) {
|
|
3
|
+
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/utils/path.ts
|
|
8
|
+
function normalizeSeparators(input) {
|
|
9
|
+
let out = "";
|
|
10
|
+
for (let i = 0; i < input.length; i++) {
|
|
11
|
+
const ch = input[i];
|
|
12
|
+
out += ch === "\\" ? "/" : ch;
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
function isAbsolutePath(path) {
|
|
17
|
+
const p = normalizeSeparators(path);
|
|
18
|
+
if (p.startsWith("/")) return true;
|
|
19
|
+
return /^[A-Z]:\//i.test(p);
|
|
20
|
+
}
|
|
21
|
+
function stripTrailingSlash(path) {
|
|
22
|
+
const p = normalizeSeparators(path);
|
|
23
|
+
if (p === "/") return p;
|
|
24
|
+
let end = p.length;
|
|
25
|
+
while (end > 0 && p.charCodeAt(end - 1) === 47) end--;
|
|
26
|
+
return end === p.length ? p : p.slice(0, end);
|
|
27
|
+
}
|
|
28
|
+
function joinPath(base, next) {
|
|
29
|
+
const a = normalizeSeparators(base);
|
|
30
|
+
const b = normalizeSeparators(next);
|
|
31
|
+
if (!a) return b;
|
|
32
|
+
if (!b) return a;
|
|
33
|
+
if (a.endsWith("/")) return `${a}${b.startsWith("/") ? b.slice(1) : b}`;
|
|
34
|
+
return `${a}/${b.startsWith("/") ? b.slice(1) : b}`;
|
|
35
|
+
}
|
|
36
|
+
function dirname(path) {
|
|
37
|
+
const p = stripTrailingSlash(path);
|
|
38
|
+
const normalized = normalizeSeparators(p);
|
|
39
|
+
if (normalized === "/") return "/";
|
|
40
|
+
const drive = normalized.match(/^([A-Z]:)\//i)?.[1] ?? null;
|
|
41
|
+
const start = drive ? drive.length + 1 : 0;
|
|
42
|
+
const idx = normalized.lastIndexOf("/");
|
|
43
|
+
if (idx < start) return drive ? `${drive}/` : "";
|
|
44
|
+
const out = normalized.slice(0, idx) || (drive ? `${drive}/` : "/");
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
function normalizePath(path) {
|
|
48
|
+
const raw = normalizeSeparators(path);
|
|
49
|
+
if (!raw) return "";
|
|
50
|
+
const drive = raw.match(/^([A-Z]:)(\/|$)/i)?.[1] ?? null;
|
|
51
|
+
const rest = drive ? raw.slice(drive.length) : raw;
|
|
52
|
+
const absolute = rest.startsWith("/");
|
|
53
|
+
const parts = rest.split("/").filter(Boolean);
|
|
54
|
+
const stack = [];
|
|
55
|
+
for (const part of parts) {
|
|
56
|
+
if (part === ".") continue;
|
|
57
|
+
if (part === "..") {
|
|
58
|
+
if (stack.length > 0 && stack[stack.length - 1] !== "..") {
|
|
59
|
+
stack.pop();
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (!absolute) stack.push("..");
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
stack.push(part);
|
|
66
|
+
}
|
|
67
|
+
const prefix = drive ? `${drive}${absolute ? "/" : ""}` : absolute ? "/" : "";
|
|
68
|
+
const joined = stack.join("/");
|
|
69
|
+
const out = `${prefix}${joined}`;
|
|
70
|
+
return out || (absolute ? drive ? `${drive}/` : "/" : "");
|
|
71
|
+
}
|
|
72
|
+
function resolvePath(baseAbs, input) {
|
|
73
|
+
const b = normalizePath(baseAbs);
|
|
74
|
+
const i = normalizePath(input);
|
|
75
|
+
if (!b) return i;
|
|
76
|
+
if (isAbsolutePath(i)) return i;
|
|
77
|
+
return normalizePath(joinPath(b, i));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { dirname, isAbsolutePath, joinPath, normalizeNewlines, normalizePath, resolvePath, stripTrailingSlash };
|