@simon_he/vue-tui 0.0.7 → 1.0.0-rc.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 (207) hide show
  1. package/README.md +222 -444
  2. package/dist/TSelect-BmSkar0D.js +8697 -0
  3. package/dist/ansi-palette-Bv5Vqr4k.js +1499 -0
  4. package/dist/ansi-styles.d.ts +200 -0
  5. package/dist/cli/headless-renderer.d.ts +29 -0
  6. package/dist/cli/input.d.ts +49 -0
  7. package/dist/cli/node-file-writers.d.ts +12 -0
  8. package/dist/cli/node-module.d.ts +2 -0
  9. package/dist/cli/parse-kitty.d.ts +2 -0
  10. package/dist/cli/parse-mouse.d.ts +2 -0
  11. package/dist/cli/parse-utils.d.ts +14 -0
  12. package/dist/cli/parse-xterm.d.ts +2 -0
  13. package/dist/cli/path-provider-types.d.ts +1 -0
  14. package/dist/cli/path-provider.d.ts +4 -0
  15. package/dist/cli/path-suggest-core.d.ts +1 -0
  16. package/dist/cli/path-suggest.d.ts +15 -0
  17. package/dist/cli/recording.d.ts +4 -0
  18. package/dist/cli/stdin-buffer.d.ts +33 -0
  19. package/dist/cli.cjs +10664 -0
  20. package/dist/cli.d.cts +22 -0
  21. package/dist/cli.d.ts +22 -0
  22. package/dist/cli.js +9521 -0
  23. package/dist/core/ansi/capability.d.ts +20 -0
  24. package/dist/core/ansi/colors.d.ts +41 -0
  25. package/dist/core/ansi/sgr.d.ts +7 -0
  26. package/dist/core/ansi/theme.d.ts +6 -0
  27. package/dist/core/ansi-palette.d.ts +14 -0
  28. package/dist/core/buffer/buffer.d.ts +54 -0
  29. package/dist/core/buffer/width.d.ts +4 -0
  30. package/dist/core/debug-logger.d.ts +18 -0
  31. package/dist/core/hyperlink.d.ts +9 -0
  32. package/dist/core/index.d.ts +4 -0
  33. package/dist/core/path-provider-types.d.ts +24 -0
  34. package/dist/core/path-suggest.d.ts +35 -0
  35. package/dist/core/render-plane.d.ts +3 -0
  36. package/dist/core/terminal/create-terminal.d.ts +7 -0
  37. package/dist/core/terminal/emitter.d.ts +7 -0
  38. package/dist/core/types.d.ts +107 -0
  39. package/dist/core.cjs +3072 -0
  40. package/dist/core.d.cts +14 -0
  41. package/dist/core.d.ts +14 -0
  42. package/dist/core.js +422 -0
  43. package/dist/create-terminal-app.d.ts +34 -0
  44. package/dist/dom-renderer-CDVQIcIL.js +1172 -0
  45. package/dist/events/index.d.ts +6 -0
  46. package/dist/events/manager/cli-event-manager.d.ts +22 -0
  47. package/dist/events/manager/event-manager.d.ts +30 -0
  48. package/dist/events/manager/selection-suppression.d.ts +3 -0
  49. package/dist/events/manager/types.d.ts +108 -0
  50. package/dist/events/recording.d.ts +44 -0
  51. package/dist/experimental.cjs +9380 -0
  52. package/dist/experimental.d.cts +39 -0
  53. package/dist/experimental.d.ts +39 -0
  54. package/dist/experimental.js +7624 -0
  55. package/dist/frame-perf-C-w8mjJL.js +98 -0
  56. package/dist/hyperlink-B5PD7a3Q.js +331 -0
  57. package/dist/index.cjs +12037 -16507
  58. package/dist/index.d.cts +13 -0
  59. package/dist/index.d.ts +13 -1353
  60. package/dist/index.js +13 -18738
  61. package/dist/markdown.cjs +21929 -0
  62. package/dist/markdown.d.cts +10 -0
  63. package/dist/markdown.d.ts +10 -0
  64. package/dist/markdown.js +1649 -0
  65. package/dist/observability/cli-latency-node.d.ts +3 -0
  66. package/dist/observability/cli-latency-types.d.ts +41 -0
  67. package/dist/observability/cli-latency.d.ts +3 -0
  68. package/dist/observability/frame-perf-store.d.ts +13 -0
  69. package/dist/observability/frame-perf.d.ts +40 -0
  70. package/dist/observability/trace.d.ts +40 -0
  71. package/dist/observability/tui-profiler.d.ts +33 -0
  72. package/dist/observability.cjs +99 -0
  73. package/dist/observability.d.cts +6 -0
  74. package/dist/observability.d.ts +6 -0
  75. package/dist/observability.js +3 -0
  76. package/dist/path-DDiSCXrQ.js +99 -0
  77. package/dist/path-suggest-0Q2BDsuj.js +274 -0
  78. package/dist/path-suggest-Dk9TRLh5.js +3 -0
  79. package/dist/{path-suggest-CZQYJIIg.js → path-suggest-bvR9SY6Q.js} +86 -18
  80. package/dist/renderer/capabilities.d.ts +13 -0
  81. package/dist/renderer/cli/index.d.ts +2 -0
  82. package/dist/renderer/cli/stdout-metrics.d.ts +18 -0
  83. package/dist/renderer/cli/stdout-renderer.d.ts +48 -0
  84. package/dist/renderer/dom/dom-renderer.d.ts +157 -0
  85. package/dist/renderer/dom/index.d.ts +2 -0
  86. package/dist/renderer/index.d.ts +2 -0
  87. package/dist/renderer-dom.cjs +1511 -0
  88. package/dist/renderer-dom.d.cts +4 -0
  89. package/dist/renderer-dom.d.ts +4 -0
  90. package/dist/renderer-dom.js +6 -0
  91. package/dist/runtime/index.d.ts +36 -0
  92. package/dist/runtime/osc52.d.ts +9 -0
  93. package/dist/runtime-DtrcQidD.js +1197 -0
  94. package/dist/runtime.cjs +1697 -0
  95. package/dist/runtime.d.cts +9 -0
  96. package/dist/runtime.d.ts +9 -0
  97. package/dist/runtime.js +4 -0
  98. package/dist/selection/terminal-selection.d.ts +122 -0
  99. package/dist/sgr-DMK2AvuT.js +304 -0
  100. package/dist/style-cache-i0ZABZRq.js +178 -0
  101. package/dist/terminal-selection-BCOh9jsL.js +329 -0
  102. package/dist/utils/env.d.ts +3 -0
  103. package/dist/utils/newlines.d.ts +1 -0
  104. package/dist/utils/path.d.ts +7 -0
  105. package/dist/utils/url-safety.d.ts +2 -0
  106. package/dist/vue/components/TAnchor.d.ts +108 -0
  107. package/dist/vue/components/TBox.d.ts +144 -0
  108. package/dist/vue/components/TDebugOverlay.d.ts +43 -0
  109. package/dist/vue/components/TDialog.d.ts +256 -0
  110. package/dist/vue/components/TFlow.d.ts +85 -0
  111. package/dist/vue/components/TInput.d.ts +554 -0
  112. package/dist/vue/components/TInputBox.d.ts +158 -0
  113. package/dist/vue/components/TJsonEditor.d.ts +165 -0
  114. package/dist/vue/components/TList.d.ts +119 -0
  115. package/dist/vue/components/TLogLinksPanel.d.ts +238 -0
  116. package/dist/vue/components/TLogMinimap.d.ts +263 -0
  117. package/dist/vue/components/TLogScrollbar.d.ts +236 -0
  118. package/dist/vue/components/TLogSearchBar.d.ts +267 -0
  119. package/dist/vue/components/TLogSearchPager.d.ts +162 -0
  120. package/dist/vue/components/TLogSearchResults.d.ts +200 -0
  121. package/dist/vue/components/TLogView.d.ts +502 -0
  122. package/dist/vue/components/TLogVirtualLinksPanel.d.ts +141 -0
  123. package/dist/vue/components/TLogVirtualSearchResults.d.ts +146 -0
  124. package/dist/vue/components/TMarkdownText.d.ts +134 -0
  125. package/dist/vue/components/TMultilineModal.d.ts +62 -0
  126. package/dist/vue/components/TPathPicker.d.ts +213 -0
  127. package/dist/vue/components/TRenderLayer.d.ts +16 -0
  128. package/dist/vue/components/TRenderPlane.d.ts +17 -0
  129. package/dist/vue/components/TSelect.d.ts +215 -0
  130. package/dist/vue/components/TText.d.ts +116 -0
  131. package/dist/vue/components/TTransition.d.ts +83 -0
  132. package/dist/vue/components/TView.d.ts +127 -0
  133. package/dist/vue/components/TVirtualList.d.ts +182 -0
  134. package/dist/vue/components/TVirtualMarkdown.d.ts +168 -0
  135. package/dist/vue/components/TerminalProvider.d.ts +195 -0
  136. package/dist/vue/components/input/host.d.ts +17 -0
  137. package/dist/vue/components/input/plugins/hostPlugin.d.ts +7 -0
  138. package/dist/vue/components/input/plugins/hostPlugin.node.d.ts +15 -0
  139. package/dist/vue/components/input/plugins/mentionUtils.d.ts +17 -0
  140. package/dist/vue/components/input/plugins/nodeMentionPathProvider.d.ts +2 -0
  141. package/dist/vue/components/input/plugins/promptMentionPlugin.d.ts +8 -0
  142. package/dist/vue/components/input/plugins/promptMentionState.d.ts +98 -0
  143. package/dist/vue/components/input/plugins/restrictText.d.ts +27 -0
  144. package/dist/vue/components/input/plugins/types.d.ts +90 -0
  145. package/dist/vue/components/input/utils/inlineText.d.ts +57 -0
  146. package/dist/vue/components/input/utils/inlineTextTokens.d.ts +34 -0
  147. package/dist/vue/components/input/utils/primitives.d.ts +3 -0
  148. package/dist/vue/components/input/utils/wordNavigation.d.ts +6 -0
  149. package/dist/vue/components/list/list-geometry.d.ts +16 -0
  150. package/dist/vue/components/list/list-paint.d.ts +1 -0
  151. package/dist/vue/components/list/scroll-state.d.ts +25 -0
  152. package/dist/vue/components/list/selection-state.d.ts +6 -0
  153. package/dist/vue/components/terminal-provider/copy-toast.d.ts +6 -0
  154. package/dist/vue/components/terminal-provider/portals.d.ts +17 -0
  155. package/dist/vue/components/terminal-provider/scheduler.d.ts +29 -0
  156. package/dist/vue/components/terminal-provider/selection-config.d.ts +15 -0
  157. package/dist/vue/components/terminal-provider/utils.d.ts +5 -0
  158. package/dist/vue/composables/use-layout.d.ts +2 -0
  159. package/dist/vue/composables/use-render-node.d.ts +19 -0
  160. package/dist/vue/composables/use-render-stack.d.ts +3 -0
  161. package/dist/vue/composables/use-runtime.d.ts +5 -0
  162. package/dist/vue/composables/use-terminal-node.d.ts +14 -0
  163. package/dist/vue/composables/use-terminal.d.ts +2 -0
  164. package/dist/vue/composables/use-visibility.d.ts +12 -0
  165. package/dist/vue/context.d.ts +153 -0
  166. package/dist/vue/index.d.ts +39 -0
  167. package/dist/vue/injection-key.d.ts +2 -0
  168. package/dist/vue/log/append-only-log-store.d.ts +2 -0
  169. package/dist/vue/log/tlog-keymap.d.ts +28 -0
  170. package/dist/vue/log/tlog-plugins.d.ts +144 -0
  171. package/dist/vue/log/tlog-session.d.ts +81 -0
  172. package/dist/vue/log/tlog-theme.d.ts +68 -0
  173. package/dist/vue/log/types.d.ts +43 -0
  174. package/dist/vue/log/use-tlog-link-controller.d.ts +31 -0
  175. package/dist/vue/log/use-tlog-retained-index.d.ts +26 -0
  176. package/dist/vue/log/use-tlog-search-controller.d.ts +51 -0
  177. package/dist/vue/log/use-tlog-search-results-page.d.ts +31 -0
  178. package/dist/vue/log/use-tlog-virtual-search-results.d.ts +22 -0
  179. package/dist/vue/markdown/ast.d.ts +3 -0
  180. package/dist/vue/markdown/block-source.d.ts +22 -0
  181. package/dist/vue/markdown/document.d.ts +18 -0
  182. package/dist/vue/markdown/layout.d.ts +16 -0
  183. package/dist/vue/markdown/parser.d.ts +11 -0
  184. package/dist/vue/markdown/render.d.ts +10 -0
  185. package/dist/vue/markdown/theme.d.ts +186 -0
  186. package/dist/vue/markdown/types.d.ts +47 -0
  187. package/dist/vue/render/context.d.ts +3 -0
  188. package/dist/vue/render/render-manager.d.ts +94 -0
  189. package/dist/vue/router/RouterView.d.ts +25 -0
  190. package/dist/vue/router/composables.d.ts +4 -0
  191. package/dist/vue/router/context.d.ts +4 -0
  192. package/dist/vue/router/router.d.ts +7 -0
  193. package/dist/vue/router/types.d.ts +29 -0
  194. package/dist/vue/scheduler/frame-mailbox.d.ts +55 -0
  195. package/dist/vue/scheduler/frame-scheduler.d.ts +51 -0
  196. package/dist/vue/utils/frame-task.d.ts +6 -0
  197. package/dist/vue/utils/rect.d.ts +4 -0
  198. package/dist/vue/utils/style-cache.d.ts +3 -0
  199. package/dist/vue/utils/text.d.ts +26 -0
  200. package/dist/vue/utils/wheel-scroll.d.ts +18 -0
  201. package/dist/vue.cjs +18882 -0
  202. package/dist/vue.d.cts +3 -0
  203. package/dist/vue.d.ts +3 -0
  204. package/dist/vue.js +3066 -0
  205. package/dist/wheel-scroll-B-WlFuNB.js +819 -0
  206. package/package.json +226 -58
  207. package/dist/path-suggest-DIMby3r0.js +0 -3
@@ -0,0 +1,3 @@
1
+ import type { CliLatencyProfiler } from "./cli-latency-types.js";
2
+ export declare function defaultCliLatencyLogPath(): string;
3
+ export declare function getCliLatencyProfiler(): CliLatencyProfiler | null;
@@ -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,3 @@
1
+ import type { CliLatencyProfiler } from "./cli-latency-types.js";
2
+ export type { CliLatencyProfiler } from "./cli-latency-types.js";
3
+ export declare function getCliLatencyProfiler(): CliLatencyProfiler | null;
@@ -0,0 +1,13 @@
1
+ import type { Ref } from "vue";
2
+ import type { FramePerfSample } from "./frame-perf.js";
3
+ export type FramePerfStore = Readonly<{
4
+ enabled: Ref<boolean>;
5
+ acquire: (reason?: string) => () => void;
6
+ push: (sample: FramePerfSample) => void;
7
+ latest: () => FramePerfSample | null;
8
+ list: () => FramePerfSample[];
9
+ clear: () => void;
10
+ }>;
11
+ export declare function createFramePerfStore(limit?: number, opts?: Readonly<{
12
+ enabled?: boolean;
13
+ }>): 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,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,99 @@
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
+ createTraceStore: () => createTraceStore,
25
+ framePerfNow: () => framePerfNow
26
+ });
27
+ module.exports = __toCommonJS(observability_exports);
28
+
29
+ // src/observability/frame-perf.ts
30
+ function framePerfNow() {
31
+ const p = globalThis.performance;
32
+ if (p && typeof p.now === "function")
33
+ return p.now();
34
+ return Date.now();
35
+ }
36
+
37
+ // src/observability/frame-perf-store.ts
38
+ var import_vue = require("vue");
39
+ function createFramePerfStore(limit = 120, opts) {
40
+ const max = Math.max(1, Math.floor(limit));
41
+ const manualEnabled = (0, import_vue.ref)(Boolean(opts?.enabled));
42
+ const leaseCount = (0, import_vue.ref)(0);
43
+ const enabled = (0, import_vue.computed)({
44
+ get: () => manualEnabled.value || leaseCount.value > 0,
45
+ set: (next) => {
46
+ manualEnabled.value = Boolean(next);
47
+ }
48
+ });
49
+ const samples = [];
50
+ function acquire(_reason) {
51
+ leaseCount.value++;
52
+ let released = false;
53
+ return () => {
54
+ if (released)
55
+ return;
56
+ released = true;
57
+ leaseCount.value = Math.max(0, leaseCount.value - 1);
58
+ };
59
+ }
60
+ function push(sample) {
61
+ if (!enabled.value)
62
+ return;
63
+ samples.push(sample);
64
+ if (samples.length > max)
65
+ samples.splice(0, samples.length - max);
66
+ }
67
+ function latest() {
68
+ return samples.length > 0 ? samples[samples.length - 1] : null;
69
+ }
70
+ function list() {
71
+ return samples.slice();
72
+ }
73
+ function clear() {
74
+ samples.length = 0;
75
+ }
76
+ return { enabled, acquire, push, latest, list, clear };
77
+ }
78
+
79
+ // src/observability/trace.ts
80
+ var import_vue2 = require("vue");
81
+ function createTraceStore(opts) {
82
+ const enabled = (0, import_vue2.ref)(Boolean(opts?.enabled));
83
+ const records = (0, import_vue2.shallowReactive)([]);
84
+ const max = Math.max(10, Math.floor(opts?.max ?? 400));
85
+ function push(record) {
86
+ if (!enabled.value)
87
+ return;
88
+ records.push(record);
89
+ if (records.length > max)
90
+ records.splice(0, records.length - max);
91
+ }
92
+ function clear() {
93
+ records.splice(0, records.length);
94
+ }
95
+ function snapshot() {
96
+ return records.slice();
97
+ }
98
+ return { enabled, records, push, clear, snapshot };
99
+ }
@@ -0,0 +1,6 @@
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 { TraceRecord, TraceStore } from "./observability/trace.js";
6
+ export { createTraceStore } from "./observability/trace.js";
@@ -0,0 +1,6 @@
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 { TraceRecord, TraceStore } from "./observability/trace.js";
6
+ export { createTraceStore } from "./observability/trace.js";
@@ -0,0 +1,3 @@
1
+ import { createFramePerfStore, createTraceStore, framePerfNow } from "./frame-perf-C-w8mjJL.js";
2
+
3
+ export { createFramePerfStore, createTraceStore, framePerfNow };
@@ -0,0 +1,99 @@
1
+ //#region src/utils/env.ts
2
+ function firstNonEmptyEnv(env, primary, legacy) {
3
+ const primaryValue = env?.[primary];
4
+ if (String(primaryValue ?? "").trim() !== "") return primaryValue;
5
+ if (!legacy) return void 0;
6
+ const legacyValue = env?.[legacy];
7
+ if (String(legacyValue ?? "").trim() !== "") return legacyValue;
8
+ return void 0;
9
+ }
10
+ function envFlag(env, primary, legacy) {
11
+ const raw = String(firstNonEmptyEnv(env, primary, legacy) ?? "").trim().toLowerCase();
12
+ return raw === "1" || raw === "true" || raw === "yes" || raw === "on";
13
+ }
14
+ function envString(env, primary, legacy, fallback = "") {
15
+ return String(firstNonEmptyEnv(env, primary, legacy) ?? fallback).trim() || fallback;
16
+ }
17
+
18
+ //#endregion
19
+ //#region src/utils/newlines.ts
20
+ function normalizeNewlines(text) {
21
+ return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
22
+ }
23
+
24
+ //#endregion
25
+ //#region src/utils/path.ts
26
+ function normalizeSeparators(input) {
27
+ let out = "";
28
+ for (let i = 0; i < input.length; i++) {
29
+ const ch = input[i];
30
+ out += ch === "\\" ? "/" : ch;
31
+ }
32
+ return out;
33
+ }
34
+ function isAbsolutePath(path) {
35
+ const p = normalizeSeparators(path);
36
+ if (p.startsWith("/")) return true;
37
+ return /^[A-Z]:\//i.test(p);
38
+ }
39
+ function stripTrailingSlash(path) {
40
+ const p = normalizeSeparators(path);
41
+ if (p === "/") return p;
42
+ let end = p.length;
43
+ while (end > 0 && p.charCodeAt(end - 1) === 47) end--;
44
+ return end === p.length ? p : p.slice(0, end);
45
+ }
46
+ function joinPath(base, next) {
47
+ const a = normalizeSeparators(base);
48
+ const b = normalizeSeparators(next);
49
+ if (!a) return b;
50
+ if (!b) return a;
51
+ if (a.endsWith("/")) return `${a}${b.startsWith("/") ? b.slice(1) : b}`;
52
+ return `${a}/${b.startsWith("/") ? b.slice(1) : b}`;
53
+ }
54
+ function dirname(path) {
55
+ const p = stripTrailingSlash(path);
56
+ const normalized = normalizeSeparators(p);
57
+ if (normalized === "/") return "/";
58
+ const drive = normalized.match(/^([A-Z]:)\//i)?.[1] ?? null;
59
+ const start = drive ? drive.length + 1 : 0;
60
+ const idx = normalized.lastIndexOf("/");
61
+ if (idx < start) return drive ? `${drive}/` : "";
62
+ const out = normalized.slice(0, idx) || (drive ? `${drive}/` : "/");
63
+ return out;
64
+ }
65
+ function normalizePath(path) {
66
+ const raw = normalizeSeparators(path);
67
+ if (!raw) return "";
68
+ const drive = raw.match(/^([A-Z]:)(\/|$)/i)?.[1] ?? null;
69
+ const rest = drive ? raw.slice(drive.length) : raw;
70
+ const absolute = rest.startsWith("/");
71
+ const parts = rest.split("/").filter(Boolean);
72
+ const stack = [];
73
+ for (const part of parts) {
74
+ if (part === ".") continue;
75
+ if (part === "..") {
76
+ if (stack.length > 0 && stack[stack.length - 1] !== "..") {
77
+ stack.pop();
78
+ continue;
79
+ }
80
+ if (!absolute) stack.push("..");
81
+ continue;
82
+ }
83
+ stack.push(part);
84
+ }
85
+ const prefix = drive ? `${drive}${absolute ? "/" : ""}` : absolute ? "/" : "";
86
+ const joined = stack.join("/");
87
+ const out = `${prefix}${joined}`;
88
+ return out || (absolute ? drive ? `${drive}/` : "/" : "");
89
+ }
90
+ function resolvePath(baseAbs, input) {
91
+ const b = normalizePath(baseAbs);
92
+ const i = normalizePath(input);
93
+ if (!b) return i;
94
+ if (isAbsolutePath(i)) return i;
95
+ return normalizePath(joinPath(b, i));
96
+ }
97
+
98
+ //#endregion
99
+ export { dirname, envFlag, envString, firstNonEmptyEnv, isAbsolutePath, joinPath, normalizeNewlines, normalizePath, resolvePath, stripTrailingSlash };
@@ -0,0 +1,274 @@
1
+ import { dirname, isAbsolutePath, joinPath, normalizePath, resolvePath } from "./path-DDiSCXrQ.js";
2
+
3
+ //#region src/core/path-suggest.ts
4
+ function lower(s) {
5
+ return s.toLowerCase();
6
+ }
7
+ function normalizePathInputSeparators(input) {
8
+ let out = "";
9
+ for (let i = 0; i < input.length; i++) {
10
+ const ch = input[i];
11
+ if (ch === "\r") continue;
12
+ out += ch === "\\" ? "/" : ch;
13
+ }
14
+ return out;
15
+ }
16
+ function stripCarriageReturns(input) {
17
+ let out = "";
18
+ for (let i = 0; i < input.length; i++) {
19
+ const ch = input[i];
20
+ if (ch !== "\r") out += ch;
21
+ }
22
+ return out;
23
+ }
24
+ function stripLeadingDotSlash(input) {
25
+ let i = 0;
26
+ while (i + 1 < input.length && input.charCodeAt(i) === 46 && input.charCodeAt(i + 1) === 47) i += 2;
27
+ return i === 0 ? input : input.slice(i);
28
+ }
29
+ function stripLeadingSlashes(input) {
30
+ let i = 0;
31
+ while (i < input.length && input.charCodeAt(i) === 47) i++;
32
+ return i === 0 ? input : input.slice(i);
33
+ }
34
+ function stripTrailingSlashes(input) {
35
+ let end = input.length;
36
+ while (end > 0 && input.charCodeAt(end - 1) === 47) end--;
37
+ return end === input.length ? input : input.slice(0, end);
38
+ }
39
+ function collapseSlashes(input) {
40
+ let out = "";
41
+ let previousWasSlash = false;
42
+ for (let i = 0; i < input.length; i++) {
43
+ const ch = input[i];
44
+ const isSlash = ch === "/";
45
+ if (isSlash) {
46
+ if (!previousWasSlash) out += "/";
47
+ previousWasSlash = true;
48
+ continue;
49
+ }
50
+ out += ch;
51
+ previousWasSlash = false;
52
+ }
53
+ return out;
54
+ }
55
+ function normalizeRelativePathForIgnore(input) {
56
+ return stripTrailingSlashes(collapseSlashes(stripLeadingSlashes(stripLeadingDotSlash(normalizePathInputSeparators(input)))));
57
+ }
58
+ function fuzzyScore(name, query) {
59
+ const n = lower(name);
60
+ const q = lower(query);
61
+ if (!q) return 0;
62
+ if (n === q) return 2e3;
63
+ if (n.startsWith(q)) return 1500 - (n.length - q.length);
64
+ const idx = n.indexOf(q);
65
+ if (idx >= 0) return 1200 - idx;
66
+ let ni = 0;
67
+ let qi = 0;
68
+ let gaps = 0;
69
+ let lastMatch = -1;
70
+ while (ni < n.length && qi < q.length) {
71
+ if (n[ni] === q[qi]) {
72
+ if (lastMatch >= 0) gaps += ni - lastMatch - 1;
73
+ lastMatch = ni;
74
+ qi++;
75
+ }
76
+ ni++;
77
+ }
78
+ if (qi !== q.length) return null;
79
+ const maxGaps = Math.max(4, q.length * 2);
80
+ if (gaps > maxGaps) return null;
81
+ return 800 - gaps;
82
+ }
83
+ function parsePathQuery(rawInput) {
84
+ const input = normalizePathInputSeparators(rawInput);
85
+ const lastSlash = input.lastIndexOf("/");
86
+ if (lastSlash < 0) return {
87
+ dirPrefix: "",
88
+ query: input
89
+ };
90
+ return {
91
+ dirPrefix: input.slice(0, lastSlash + 1),
92
+ query: input.slice(lastSlash + 1)
93
+ };
94
+ }
95
+ async function suggestPaths(options) {
96
+ const rawWorkspace = String(options.workspaceAbs ?? "");
97
+ const rawInput = String(options.input ?? "");
98
+ if (!rawWorkspace || rawWorkspace.includes("\0") || rawInput.includes("\0")) {
99
+ const safeWorkspaceAbs = normalizePath(rawWorkspace || ".");
100
+ return {
101
+ baseDirAbs: resolvePath(safeWorkspaceAbs, "."),
102
+ dirPrefix: "",
103
+ query: "",
104
+ suggestions: []
105
+ };
106
+ }
107
+ const workspaceAbs = normalizePath(rawWorkspace);
108
+ const input = normalizePathInputSeparators(rawInput);
109
+ const parsed = parsePathQuery(input);
110
+ let dirPrefix = parsed.dirPrefix;
111
+ let query = parsed.query;
112
+ let baseDirAbs = resolvePath(workspaceAbs, dirPrefix || ".");
113
+ let maxDepth = options.maxDepth ?? 0;
114
+ if (!query) maxDepth = 0;
115
+ const allowHidden = Boolean(options.showHidden);
116
+ const allowDir = options.mode === "directory" || options.mode === "any" || options.mode === "file";
117
+ const allowFile = options.mode === "file" || options.mode === "any";
118
+ const max = Math.max(0, Math.floor(options.max));
119
+ if (max <= 0) return {
120
+ baseDirAbs,
121
+ dirPrefix,
122
+ query,
123
+ suggestions: []
124
+ };
125
+ const maxDepthClamped = Math.max(0, Math.floor(maxDepth || 0));
126
+ const keepCapacity = Math.max(500, Math.min(8e3, max * 40));
127
+ const maxScannedDirs = Math.max(200, Math.min(6e3, 800 + maxDepthClamped * 600));
128
+ const maxScannedEntries = Math.max(2e3, Math.min(8e4, max * 2e3));
129
+ const scored = [];
130
+ let scannedDirs = 0;
131
+ let scannedEntries = 0;
132
+ let scanAborted = false;
133
+ function cmpScored(a, b) {
134
+ if (a.score !== b.score) return b.score - a.score;
135
+ if (a.depth !== b.depth) return a.depth - b.depth;
136
+ return a.name.localeCompare(b.name);
137
+ }
138
+ function pruneScored() {
139
+ if (scored.length <= keepCapacity) return;
140
+ scored.sort(cmpScored);
141
+ scored.length = keepCapacity;
142
+ }
143
+ function scoreItem(name, relPath, q) {
144
+ const byName = fuzzyScore(name, q);
145
+ const byPath = fuzzyScore(relPath, q);
146
+ if (byName == null && byPath == null) return null;
147
+ if (byName != null && byPath != null) return Math.max(byName + 50, byPath);
148
+ return byName ?? byPath;
149
+ }
150
+ async function searchDir(dirAbs, currentDepth, currentRelPath, preloadedEntries) {
151
+ if (scanAborted) return;
152
+ if (currentDepth > maxDepth) return;
153
+ if (dirAbs.includes("\0")) {
154
+ scanAborted = true;
155
+ return;
156
+ }
157
+ scannedDirs++;
158
+ if (scannedDirs > maxScannedDirs) {
159
+ scanAborted = true;
160
+ return;
161
+ }
162
+ let entries = [];
163
+ try {
164
+ entries = preloadedEntries ?? await options.listDir(dirAbs);
165
+ } catch {
166
+ return;
167
+ }
168
+ for (const e of entries) {
169
+ if (scanAborted) return;
170
+ scannedEntries++;
171
+ if (scannedEntries > maxScannedEntries) {
172
+ scanAborted = true;
173
+ return;
174
+ }
175
+ if (!allowHidden && !query && e.name.startsWith(".")) continue;
176
+ const itemRelPath = currentRelPath ? `${currentRelPath}/${e.name}` : e.name;
177
+ const normalizedRelPath = normalizeRelativePathForIgnore(`${dirPrefix}${itemRelPath}`);
178
+ const isDir = e.kind === "directory";
179
+ if (options.shouldIgnore?.({
180
+ normalizedRelPath,
181
+ isDir
182
+ })) continue;
183
+ if (e.kind === "directory") {
184
+ if (!allowDir) continue;
185
+ const score = scoreItem(e.name, itemRelPath, query);
186
+ if (score != null) {
187
+ scored.push({
188
+ score,
189
+ name: e.name,
190
+ kind: "directory",
191
+ depth: currentDepth,
192
+ relPath: itemRelPath
193
+ });
194
+ if (scored.length > keepCapacity * 2) pruneScored();
195
+ }
196
+ await searchDir(`${dirAbs}/${e.name}`, currentDepth + 1, itemRelPath);
197
+ continue;
198
+ }
199
+ if (e.kind === "file") {
200
+ if (!allowFile) continue;
201
+ const score = scoreItem(e.name, itemRelPath, query);
202
+ if (score != null) {
203
+ scored.push({
204
+ score,
205
+ name: e.name,
206
+ kind: "file",
207
+ depth: currentDepth,
208
+ relPath: itemRelPath
209
+ });
210
+ if (scored.length > keepCapacity * 2) pruneScored();
211
+ }
212
+ }
213
+ }
214
+ }
215
+ let ok = true;
216
+ let baseEntries = null;
217
+ try {
218
+ baseEntries = await options.listDir(baseDirAbs);
219
+ } catch {
220
+ ok = false;
221
+ }
222
+ if (!ok && dirPrefix) {
223
+ const fallbackQuery = stripTrailingSlashes(input);
224
+ dirPrefix = "";
225
+ query = fallbackQuery;
226
+ baseDirAbs = workspaceAbs;
227
+ maxDepth = options.maxDepth ?? 0;
228
+ if (!query) maxDepth = 0;
229
+ baseEntries = null;
230
+ }
231
+ await searchDir(baseDirAbs, 0, "", baseEntries ?? void 0);
232
+ pruneScored();
233
+ scored.sort(cmpScored);
234
+ const list = max ? scored.slice(0, max) : [];
235
+ const suggestions = list.map((s) => {
236
+ const suffix = s.kind === "directory" ? "/" : "";
237
+ const completion = `${dirPrefix}${s.relPath}${suffix}`;
238
+ const absPath = resolvePath(workspaceAbs, `${dirPrefix}${s.relPath}`);
239
+ return {
240
+ kind: s.kind,
241
+ display: completion,
242
+ completion,
243
+ absPath
244
+ };
245
+ });
246
+ return {
247
+ baseDirAbs,
248
+ dirPrefix,
249
+ query,
250
+ suggestions
251
+ };
252
+ }
253
+ function resolveUserPath(workspaceAbs, input, options) {
254
+ const raw = stripCarriageReturns(input ?? "").trim();
255
+ if (!raw) return resolvePath(normalizePath(workspaceAbs), ".");
256
+ if (raw === "~" || raw.startsWith("~/")) {
257
+ const home = String(options?.homeDir ?? "").trim();
258
+ if (home) {
259
+ const rest = raw === "~" ? "" : raw.slice(2);
260
+ return resolvePath(normalizePath(home), rest);
261
+ }
262
+ }
263
+ const normalized = normalizePathInputSeparators(raw);
264
+ if (isAbsolutePath(normalized)) return normalizePath(normalized);
265
+ return resolvePath(normalizePath(workspaceAbs), normalized);
266
+ }
267
+ function suggestParentHint(path) {
268
+ const p = normalizePath(path);
269
+ const d = dirname(p);
270
+ return d ? joinPath(d, "..") : "..";
271
+ }
272
+
273
+ //#endregion
274
+ export { parsePathQuery, resolveUserPath, suggestParentHint, suggestPaths };
@@ -0,0 +1,3 @@
1
+ import { parsePathQuery, resolveUserPath, suggestPaths } from "./path-suggest-bvR9SY6Q.js";
2
+
3
+ export { resolveUserPath, suggestPaths };