@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,329 @@
1
+ import { shallowRef } from "vue";
2
+
3
+ //#region src/selection/terminal-selection.ts
4
+ const EMPTY_STATE = Object.freeze({
5
+ active: false,
6
+ anchor: null,
7
+ focus: null,
8
+ text: "",
9
+ hasRange: false
10
+ });
11
+ function clampPoint(point, cols, rows) {
12
+ return {
13
+ x: Math.max(0, Math.min(Math.max(0, cols - 1), Math.floor(point.x))),
14
+ y: Math.max(0, Math.min(Math.max(0, rows - 1), Math.floor(point.y)))
15
+ };
16
+ }
17
+ function comparePoints(a, b) {
18
+ return a.y - b.y || a.x - b.x;
19
+ }
20
+ function pointKey(point) {
21
+ return `${point.x}:${point.y}`;
22
+ }
23
+ function providerPointsDiffer(a, b) {
24
+ return Boolean(a && b && a.providerId === b.providerId && pointKey(a.point) !== pointKey(b.point));
25
+ }
26
+ function terminalSelectionRowSpans(range, cols, rows) {
27
+ if (cols <= 0 || rows <= 0) return [];
28
+ const anchor = clampPoint(range.anchor, cols, rows);
29
+ const focus = clampPoint(range.focus, cols, rows);
30
+ if (pointKey(anchor) === pointKey(focus)) return [];
31
+ const start = comparePoints(anchor, focus) <= 0 ? anchor : focus;
32
+ const end = start === anchor ? focus : anchor;
33
+ const spans = [];
34
+ for (let y = start.y; y <= end.y; y++) {
35
+ const x0 = y === start.y ? start.x : 0;
36
+ const x1 = y === end.y ? end.x + 1 : cols;
37
+ if (x1 > x0) spans.push({
38
+ y,
39
+ x0,
40
+ x1
41
+ });
42
+ }
43
+ return spans;
44
+ }
45
+ function terminalSelectionVisibleRowSpans(range, cols, rows, visibleStartY, visibleEndY) {
46
+ if (cols <= 0 || rows <= 0) return [];
47
+ const anchor = clampPoint(range.anchor, cols, rows);
48
+ const focus = clampPoint(range.focus, cols, rows);
49
+ if (pointKey(anchor) === pointKey(focus)) return [];
50
+ const start = comparePoints(anchor, focus) <= 0 ? anchor : focus;
51
+ const end = start === anchor ? focus : anchor;
52
+ const fromY = Math.max(start.y, Math.floor(visibleStartY), 0);
53
+ const toY = Math.min(end.y, Math.ceil(visibleEndY) - 1, rows - 1);
54
+ if (toY < fromY) return [];
55
+ const spans = [];
56
+ for (let y = fromY; y <= toY; y++) {
57
+ const x0 = y === start.y ? start.x : 0;
58
+ const x1 = y === end.y ? end.x + 1 : cols;
59
+ if (x1 > x0) spans.push({
60
+ y,
61
+ x0,
62
+ x1
63
+ });
64
+ }
65
+ return spans;
66
+ }
67
+ function selectedRowText(row, x0, x1, cols) {
68
+ let out = "";
69
+ for (let x = x0; x < x1; x++) {
70
+ const cell = row[x];
71
+ if (!cell || cell.continuation) continue;
72
+ out += cell.ch || " ";
73
+ }
74
+ return x1 >= cols ? out.trimEnd() : out;
75
+ }
76
+ function copyPayload(text, ok, error) {
77
+ return {
78
+ text,
79
+ rows: text ? text.split("\n").length : 0,
80
+ chars: text.length,
81
+ ok,
82
+ ...error === void 0 ? {} : { error }
83
+ };
84
+ }
85
+ function clampPointToRect(point, rect) {
86
+ return {
87
+ x: Math.max(rect.x, Math.min(rect.x + Math.max(0, rect.w - 1), Math.floor(point.x))),
88
+ y: Math.max(rect.y, Math.min(rect.y + Math.max(0, rect.h - 1), Math.floor(point.y)))
89
+ };
90
+ }
91
+ function createTerminalSelectionController(options) {
92
+ const state = shallowRef(EMPTY_STATE);
93
+ let range = null;
94
+ let providerAnchor = null;
95
+ let providerFocus = null;
96
+ let overlaySpans = new Map();
97
+ let dirtyRows = new Set();
98
+ const readOptions = () => ({
99
+ autoCopy: true,
100
+ copyOnMouseUp: true,
101
+ style: { inverse: true },
102
+ ...options.getOptions?.() ?? {}
103
+ });
104
+ const markDirty = (prev, next) => {
105
+ const rows = new Set();
106
+ for (const y of prev) rows.add(y);
107
+ for (const y of next) rows.add(y);
108
+ if (rows.size) options.onDirtyRows?.(Array.from(rows).sort((a, b) => a - b));
109
+ };
110
+ const providers = () => options.getTextProviders?.() ?? [];
111
+ const providerById = (id) => providers().find((provider) => provider.id === id) ?? null;
112
+ const providerForCell = (point) => {
113
+ let best = null;
114
+ let bestArea = Infinity;
115
+ for (const provider of providers()) {
116
+ const rect = provider.rect;
117
+ if (point.x < rect.x || point.y < rect.y || point.x >= rect.x + rect.w || point.y >= rect.y + rect.h) continue;
118
+ const area = Math.max(0, rect.w) * Math.max(0, rect.h);
119
+ if (area < bestArea) {
120
+ best = provider;
121
+ bestArea = area;
122
+ }
123
+ }
124
+ return best;
125
+ };
126
+ const providerPointForCell = (provider, point, options$1) => {
127
+ const inputPoint = options$1?.clampToRect ? clampPointToRect(point, provider.rect) : point;
128
+ const providerPoint = provider.pointForCell?.(inputPoint) ?? inputPoint;
129
+ return providerPoint ? {
130
+ providerId: provider.id,
131
+ point: providerPoint
132
+ } : null;
133
+ };
134
+ const textFromTerminalBuffer = (nextRange) => {
135
+ const size = options.terminal.size();
136
+ const spans = terminalSelectionRowSpans(nextRange, size.cols, size.rows);
137
+ const lines = [];
138
+ for (const span of spans) lines.push(selectedRowText(options.terminal.getRow(span.y), span.x0, span.x1, size.cols));
139
+ return lines.join("\n");
140
+ };
141
+ const providerRangeFor = (provider, screenRange, anchorOverride, focusOverride) => {
142
+ if (anchorOverride && focusOverride && anchorOverride.providerId === provider.id && focusOverride.providerId === provider.id) return {
143
+ anchor: anchorOverride.point,
144
+ focus: focusOverride.point,
145
+ mode: screenRange.mode
146
+ };
147
+ const anchor = providerPointForCell(provider, screenRange.anchor, { clampToRect: true });
148
+ const focus = providerPointForCell(provider, screenRange.focus, { clampToRect: true });
149
+ if (!anchor || !focus) return null;
150
+ if (anchor.providerId !== provider.id || focus.providerId !== provider.id) return null;
151
+ return {
152
+ anchor: anchor.point,
153
+ focus: focus.point,
154
+ mode: screenRange.mode
155
+ };
156
+ };
157
+ const selectedText = () => {
158
+ if (!range) return "";
159
+ const currentRange = range;
160
+ if (providerAnchor && providerFocus && providerAnchor.providerId === providerFocus.providerId) {
161
+ const provider$1 = providerById(providerAnchor.providerId);
162
+ if (provider$1) {
163
+ const providerRange = providerRangeFor(provider$1, currentRange, providerAnchor, providerFocus);
164
+ if (providerRange) return provider$1.getText(providerRange);
165
+ }
166
+ }
167
+ const provider = providers().find((candidate) => candidate.canHandle(currentRange));
168
+ if (provider) {
169
+ const providerRange = providerRangeFor(provider, currentRange);
170
+ if (providerRange) return provider.getText(providerRange);
171
+ }
172
+ return textFromTerminalBuffer(currentRange);
173
+ };
174
+ const setResolvedText = (text) => {
175
+ if (!range || !state.value.active || state.value.text === text) return;
176
+ state.value = {
177
+ ...state.value,
178
+ text
179
+ };
180
+ };
181
+ const resolveProvider = (nextRange, nextProviderAnchor) => {
182
+ if (!nextRange) return null;
183
+ if (nextProviderAnchor) {
184
+ const provider = providerById(nextProviderAnchor.providerId);
185
+ if (provider) return provider;
186
+ }
187
+ return providers().find((candidate) => candidate.canHandle(nextRange)) ?? null;
188
+ };
189
+ const rebuild = (nextRange, nextProviderAnchor, nextProviderFocus) => {
190
+ const previousRows = dirtyRows;
191
+ const size = options.terminal.size();
192
+ const nextOverlaySpans = new Map();
193
+ const nextDirtyRows = new Set();
194
+ let hasRange = false;
195
+ if (nextRange) {
196
+ const activeProvider = resolveProvider(nextRange, nextProviderAnchor);
197
+ let spans;
198
+ const providerRange = activeProvider != null ? providerRangeFor(activeProvider, nextRange, nextProviderAnchor, nextProviderFocus) : null;
199
+ if (activeProvider?.getVisibleSpans && providerRange) spans = activeProvider.getVisibleSpans(providerRange, nextRange);
200
+ else spans = terminalSelectionRowSpans(nextRange, size.cols, size.rows);
201
+ hasRange = spans.length > 0 || providerPointsDiffer(nextProviderAnchor, nextProviderFocus);
202
+ for (const span of spans) {
203
+ const x0 = Math.max(0, Math.min(size.cols, Math.floor(span.x0)));
204
+ const x1 = Math.max(0, Math.min(size.cols, Math.floor(span.x1)));
205
+ const y = Math.floor(span.y);
206
+ if (y < 0 || y >= size.rows || x1 <= x0) continue;
207
+ let list = nextOverlaySpans.get(y);
208
+ if (!list) {
209
+ list = [];
210
+ nextOverlaySpans.set(y, list);
211
+ }
212
+ list.push({
213
+ y,
214
+ x0,
215
+ x1
216
+ });
217
+ nextDirtyRows.add(y);
218
+ }
219
+ }
220
+ range = nextRange;
221
+ providerAnchor = nextProviderAnchor;
222
+ providerFocus = nextProviderFocus;
223
+ overlaySpans = nextOverlaySpans;
224
+ dirtyRows = nextDirtyRows;
225
+ state.value = nextRange ? {
226
+ active: true,
227
+ anchor: nextRange.anchor,
228
+ focus: nextRange.focus,
229
+ text: "",
230
+ hasRange
231
+ } : EMPTY_STATE;
232
+ markDirty(previousRows, nextDirtyRows);
233
+ };
234
+ const controller = {
235
+ state,
236
+ start(point, startOptions) {
237
+ const size = options.terminal.size();
238
+ const focus = clampPoint(point, size.cols, size.rows);
239
+ const anchor = startOptions?.extend && range?.anchor ? clampPoint(range.anchor, size.cols, size.rows) : focus;
240
+ const anchorProvider = providerForCell(anchor);
241
+ const focusProvider = providerForCell(focus);
242
+ const activeProvider = startOptions?.extend && providerAnchor ? providerById(providerAnchor.providerId) : null;
243
+ const nextProviderAnchor = startOptions?.extend && providerAnchor ? providerAnchor : anchorProvider ? providerPointForCell(anchorProvider, anchor) : null;
244
+ const nextProviderFocus = activeProvider ? providerPointForCell(activeProvider, focus, { clampToRect: true }) : nextProviderAnchor && focusProvider?.id === nextProviderAnchor.providerId ? providerPointForCell(focusProvider, focus) : null;
245
+ rebuild({
246
+ anchor,
247
+ focus,
248
+ mode: "linear"
249
+ }, nextProviderAnchor, nextProviderFocus);
250
+ },
251
+ update(point) {
252
+ if (!range) return;
253
+ const size = options.terminal.size();
254
+ const focus = clampPoint(point, size.cols, size.rows);
255
+ const activeProvider = providerAnchor ? providerById(providerAnchor.providerId) : null;
256
+ const nextProviderFocus = activeProvider ? providerPointForCell(activeProvider, focus, { clampToRect: true }) : null;
257
+ rebuild({
258
+ ...range,
259
+ focus
260
+ }, providerAnchor, nextProviderFocus);
261
+ },
262
+ async finish() {
263
+ if (!range) return;
264
+ if (!state.value.hasRange) {
265
+ controller.clear();
266
+ return;
267
+ }
268
+ const current = readOptions();
269
+ if (!current.autoCopy || !current.copyOnMouseUp) return;
270
+ await controller.copy();
271
+ },
272
+ clear() {
273
+ if (!range && !dirtyRows.size) return;
274
+ rebuild(null, null, null);
275
+ },
276
+ async copy() {
277
+ const text = state.value.text || selectedText();
278
+ if (!text) return false;
279
+ setResolvedText(text);
280
+ if (!options.clipboard.supported) {
281
+ options.onCopy?.(copyPayload(text, false, new Error("Clipboard unavailable")));
282
+ return false;
283
+ }
284
+ try {
285
+ await options.clipboard.writeText(text);
286
+ options.onCopy?.(copyPayload(text, true));
287
+ return true;
288
+ } catch (error) {
289
+ options.onCopy?.(copyPayload(text, false, error));
290
+ return false;
291
+ }
292
+ },
293
+ paint(dirtyRowsHint) {
294
+ const rows = dirtyRowsHint ?? Array.from(overlaySpans.keys());
295
+ const selectionStyle = readOptions().style;
296
+ for (const y of rows) {
297
+ const spans = overlaySpans.get(y);
298
+ if (!spans?.length) continue;
299
+ const row = options.terminal.getRow(y);
300
+ for (const span of spans) for (let x = span.x0; x < span.x1; x++) {
301
+ const cell = row[x];
302
+ if (!cell || cell.continuation) continue;
303
+ const { href: _href,...baseStyle } = cell.style;
304
+ options.overlayTerminal.put(x, y, cell.ch || " ", {
305
+ ...baseStyle,
306
+ ...selectionStyle
307
+ });
308
+ }
309
+ }
310
+ },
311
+ refresh(refreshOptions) {
312
+ if (!range) return;
313
+ if (refreshOptions?.remapFocus) {
314
+ const activeProvider = providerAnchor ? providerById(providerAnchor.providerId) : resolveProvider(range, null);
315
+ const nextProviderFocus = activeProvider ? providerPointForCell(activeProvider, range.focus, { clampToRect: true }) : providerFocus;
316
+ rebuild(range, providerAnchor, nextProviderFocus);
317
+ return;
318
+ }
319
+ rebuild(range, providerAnchor, providerFocus);
320
+ },
321
+ clearProvider(providerId) {
322
+ if (providerAnchor?.providerId === providerId || providerFocus?.providerId === providerId) controller.clear();
323
+ }
324
+ };
325
+ return controller;
326
+ }
327
+
328
+ //#endregion
329
+ export { createTerminalSelectionController, terminalSelectionRowSpans, terminalSelectionVisibleRowSpans };
@@ -0,0 +1,3 @@
1
+ export declare function firstNonEmptyEnv(env: Readonly<Record<string, unknown>> | undefined, primary: string, legacy?: string): unknown;
2
+ export declare function envFlag(env: Readonly<Record<string, unknown>> | undefined, primary: string, legacy?: string): boolean;
3
+ export declare function envString(env: Readonly<Record<string, unknown>> | undefined, primary: string, legacy: string | undefined, fallback?: string): string;
@@ -0,0 +1 @@
1
+ export declare function normalizeNewlines(text: string): string;
@@ -0,0 +1,7 @@
1
+ export type PathStyle = "posix";
2
+ export declare function isAbsolutePath(path: string): boolean;
3
+ export declare function stripTrailingSlash(path: string): string;
4
+ export declare function joinPath(base: string, next: string): string;
5
+ export declare function dirname(path: string): string;
6
+ export declare function normalizePath(path: string): string;
7
+ export declare function resolvePath(baseAbs: string, input: string): string;
@@ -0,0 +1,2 @@
1
+ export declare const ENCODED_ASCII_CONTROL_RE: RegExp;
2
+ export declare function hasEncodedControl(value: string): boolean;
@@ -0,0 +1,108 @@
1
+ export declare const TAnchor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ left: {
3
+ type: NumberConstructor;
4
+ default: undefined;
5
+ };
6
+ top: {
7
+ type: NumberConstructor;
8
+ default: undefined;
9
+ };
10
+ right: {
11
+ type: NumberConstructor;
12
+ default: undefined;
13
+ };
14
+ bottom: {
15
+ type: NumberConstructor;
16
+ default: undefined;
17
+ };
18
+ w: {
19
+ type: NumberConstructor;
20
+ default: undefined;
21
+ };
22
+ h: {
23
+ type: NumberConstructor;
24
+ default: undefined;
25
+ };
26
+ zIndex: {
27
+ type: NumberConstructor;
28
+ default: number;
29
+ };
30
+ focusable: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ selectable: {
35
+ type: BooleanConstructor;
36
+ default: undefined;
37
+ };
38
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
39
+ [key: string]: any;
40
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("keydown" | "keyup" | "pointerdown" | "pointerup" | "pointermove" | "click" | "dblclick" | "wheel" | "blur" | "focus" | "clickCapture" | "dblclickCapture" | "pointerdownCapture" | "pointerupCapture" | "pointermoveCapture" | "wheelCapture" | "keydownCapture" | "keyupCapture" | "focusCapture" | "blurCapture")[], "keydown" | "keyup" | "pointerdown" | "pointerup" | "pointermove" | "click" | "dblclick" | "wheel" | "blur" | "focus" | "clickCapture" | "dblclickCapture" | "pointerdownCapture" | "pointerupCapture" | "pointermoveCapture" | "wheelCapture" | "keydownCapture" | "keyupCapture" | "focusCapture" | "blurCapture", (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps), Readonly<import("vue").ExtractPropTypes<{
41
+ left: {
42
+ type: NumberConstructor;
43
+ default: undefined;
44
+ };
45
+ top: {
46
+ type: NumberConstructor;
47
+ default: undefined;
48
+ };
49
+ right: {
50
+ type: NumberConstructor;
51
+ default: undefined;
52
+ };
53
+ bottom: {
54
+ type: NumberConstructor;
55
+ default: undefined;
56
+ };
57
+ w: {
58
+ type: NumberConstructor;
59
+ default: undefined;
60
+ };
61
+ h: {
62
+ type: NumberConstructor;
63
+ default: undefined;
64
+ };
65
+ zIndex: {
66
+ type: NumberConstructor;
67
+ default: number;
68
+ };
69
+ focusable: {
70
+ type: BooleanConstructor;
71
+ default: boolean;
72
+ };
73
+ selectable: {
74
+ type: BooleanConstructor;
75
+ default: undefined;
76
+ };
77
+ }>> & Readonly<{
78
+ onKeydown?: ((...args: any[]) => any) | undefined;
79
+ onKeyup?: ((...args: any[]) => any) | undefined;
80
+ onPointerdown?: ((...args: any[]) => any) | undefined;
81
+ onPointerup?: ((...args: any[]) => any) | undefined;
82
+ onPointermove?: ((...args: any[]) => any) | undefined;
83
+ onClick?: ((...args: any[]) => any) | undefined;
84
+ onDblclick?: ((...args: any[]) => any) | undefined;
85
+ onWheel?: ((...args: any[]) => any) | undefined;
86
+ onBlur?: ((...args: any[]) => any) | undefined;
87
+ onFocus?: ((...args: any[]) => any) | undefined;
88
+ onClickCapture?: ((...args: any[]) => any) | undefined;
89
+ onDblclickCapture?: ((...args: any[]) => any) | undefined;
90
+ onPointerdownCapture?: ((...args: any[]) => any) | undefined;
91
+ onPointerupCapture?: ((...args: any[]) => any) | undefined;
92
+ onPointermoveCapture?: ((...args: any[]) => any) | undefined;
93
+ onWheelCapture?: ((...args: any[]) => any) | undefined;
94
+ onKeydownCapture?: ((...args: any[]) => any) | undefined;
95
+ onKeyupCapture?: ((...args: any[]) => any) | undefined;
96
+ onFocusCapture?: ((...args: any[]) => any) | undefined;
97
+ onBlurCapture?: ((...args: any[]) => any) | undefined;
98
+ }>, {
99
+ h: number;
100
+ w: number;
101
+ zIndex: number;
102
+ focusable: boolean;
103
+ selectable: boolean;
104
+ left: number;
105
+ top: number;
106
+ bottom: number;
107
+ right: number;
108
+ }, {}>;
@@ -0,0 +1,144 @@
1
+ import type { PropType } from "vue";
2
+ import type { Style } from "../../core/types.js";
3
+ export declare const TBox: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ x: {
5
+ type: NumberConstructor;
6
+ required: true;
7
+ };
8
+ y: {
9
+ type: NumberConstructor;
10
+ required: true;
11
+ };
12
+ w: {
13
+ type: NumberConstructor;
14
+ required: true;
15
+ };
16
+ h: {
17
+ type: NumberConstructor;
18
+ required: true;
19
+ };
20
+ zIndex: {
21
+ type: NumberConstructor;
22
+ default: number;
23
+ };
24
+ border: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ title: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ padding: {
33
+ type: NumberConstructor;
34
+ default: number;
35
+ };
36
+ scrollX: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ scrollY: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
44
+ style: {
45
+ type: PropType<Style>;
46
+ default: undefined;
47
+ };
48
+ titleStyle: {
49
+ type: PropType<Style>;
50
+ default: undefined;
51
+ };
52
+ clear: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
57
+ [key: string]: any;
58
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("pointerenter" | "pointerleave" | "pointerenterCapture" | "pointerleaveCapture")[], "pointerenter" | "pointerleave" | "pointerenterCapture" | "pointerleaveCapture", (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps), Readonly<import("vue").ExtractPropTypes<{
59
+ x: {
60
+ type: NumberConstructor;
61
+ required: true;
62
+ };
63
+ y: {
64
+ type: NumberConstructor;
65
+ required: true;
66
+ };
67
+ w: {
68
+ type: NumberConstructor;
69
+ required: true;
70
+ };
71
+ h: {
72
+ type: NumberConstructor;
73
+ required: true;
74
+ };
75
+ zIndex: {
76
+ type: NumberConstructor;
77
+ default: number;
78
+ };
79
+ border: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
83
+ title: {
84
+ type: StringConstructor;
85
+ default: string;
86
+ };
87
+ padding: {
88
+ type: NumberConstructor;
89
+ default: number;
90
+ };
91
+ scrollX: {
92
+ type: NumberConstructor;
93
+ default: number;
94
+ };
95
+ scrollY: {
96
+ type: NumberConstructor;
97
+ default: number;
98
+ };
99
+ style: {
100
+ type: PropType<Style>;
101
+ default: undefined;
102
+ };
103
+ titleStyle: {
104
+ type: PropType<Style>;
105
+ default: undefined;
106
+ };
107
+ clear: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ }>> & Readonly<{
112
+ onPointerenter?: ((...args: any[]) => any) | undefined;
113
+ onPointerleave?: ((...args: any[]) => any) | undefined;
114
+ onPointerenterCapture?: ((...args: any[]) => any) | undefined;
115
+ onPointerleaveCapture?: ((...args: any[]) => any) | undefined;
116
+ }>, {
117
+ style: Readonly<{
118
+ fg?: string;
119
+ bg?: string;
120
+ bold?: boolean;
121
+ dim?: boolean;
122
+ italic?: boolean;
123
+ underline?: boolean;
124
+ inverse?: boolean;
125
+ href?: string;
126
+ }>;
127
+ title: string;
128
+ zIndex: number;
129
+ clear: boolean;
130
+ border: boolean;
131
+ padding: number;
132
+ scrollX: number;
133
+ scrollY: number;
134
+ titleStyle: Readonly<{
135
+ fg?: string;
136
+ bg?: string;
137
+ bold?: boolean;
138
+ dim?: boolean;
139
+ italic?: boolean;
140
+ underline?: boolean;
141
+ inverse?: boolean;
142
+ href?: string;
143
+ }>;
144
+ }, {}>;
@@ -0,0 +1,43 @@
1
+ import type { PropType } from "vue";
2
+ export declare const TDebugOverlay: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ mode: {
4
+ type: PropType<"focus" | "all">;
5
+ default: string;
6
+ };
7
+ panel: {
8
+ type: BooleanConstructor;
9
+ default: boolean;
10
+ };
11
+ maxRects: {
12
+ type: NumberConstructor;
13
+ default: number;
14
+ };
15
+ zIndex: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ };
19
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
20
+ [key: string]: any;
21
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps), Readonly<import("vue").ExtractPropTypes<{
22
+ mode: {
23
+ type: PropType<"focus" | "all">;
24
+ default: string;
25
+ };
26
+ panel: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ maxRects: {
31
+ type: NumberConstructor;
32
+ default: number;
33
+ };
34
+ zIndex: {
35
+ type: NumberConstructor;
36
+ default: number;
37
+ };
38
+ }>> & Readonly<{}>, {
39
+ mode: "all" | "focus";
40
+ zIndex: number;
41
+ panel: boolean;
42
+ maxRects: number;
43
+ }, {}>;