@silvery/term 0.3.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/package.json +54 -0
- package/src/adapters/canvas-adapter.ts +356 -0
- package/src/adapters/dom-adapter.ts +452 -0
- package/src/adapters/flexily-zero-adapter.ts +368 -0
- package/src/adapters/terminal-adapter.ts +305 -0
- package/src/adapters/yoga-adapter.ts +370 -0
- package/src/ansi/ansi.ts +251 -0
- package/src/ansi/constants.ts +76 -0
- package/src/ansi/detection.ts +441 -0
- package/src/ansi/hyperlink.ts +38 -0
- package/src/ansi/index.ts +201 -0
- package/src/ansi/patch-console.ts +159 -0
- package/src/ansi/sgr-codes.ts +34 -0
- package/src/ansi/storybook.ts +209 -0
- package/src/ansi/term.ts +724 -0
- package/src/ansi/types.ts +202 -0
- package/src/ansi/underline.ts +156 -0
- package/src/ansi/utils.ts +65 -0
- package/src/ansi-sanitize.ts +509 -0
- package/src/app.ts +571 -0
- package/src/bound-term.ts +94 -0
- package/src/bracketed-paste.ts +75 -0
- package/src/browser-renderer.ts +174 -0
- package/src/buffer.ts +1984 -0
- package/src/clipboard.ts +74 -0
- package/src/cursor-query.ts +85 -0
- package/src/device-attrs.ts +228 -0
- package/src/devtools.ts +123 -0
- package/src/dom/index.ts +194 -0
- package/src/errors.ts +39 -0
- package/src/focus-reporting.ts +48 -0
- package/src/hit-registry-core.ts +228 -0
- package/src/hit-registry.ts +176 -0
- package/src/index.ts +458 -0
- package/src/input.ts +119 -0
- package/src/inspector.ts +155 -0
- package/src/kitty-detect.ts +95 -0
- package/src/kitty-manager.ts +160 -0
- package/src/layout-engine.ts +296 -0
- package/src/layout.ts +26 -0
- package/src/measurer.ts +74 -0
- package/src/mode-query.ts +106 -0
- package/src/mouse-events.ts +419 -0
- package/src/mouse.ts +83 -0
- package/src/non-tty.ts +223 -0
- package/src/osc-markers.ts +32 -0
- package/src/osc-palette.ts +169 -0
- package/src/output.ts +406 -0
- package/src/pane-manager.ts +248 -0
- package/src/pipeline/CLAUDE.md +587 -0
- package/src/pipeline/content-phase-adapter.ts +976 -0
- package/src/pipeline/content-phase.ts +1765 -0
- package/src/pipeline/helpers.ts +42 -0
- package/src/pipeline/index.ts +416 -0
- package/src/pipeline/layout-phase.ts +686 -0
- package/src/pipeline/measure-phase.ts +198 -0
- package/src/pipeline/measure-stats.ts +21 -0
- package/src/pipeline/output-phase.ts +2593 -0
- package/src/pipeline/render-box.ts +343 -0
- package/src/pipeline/render-helpers.ts +243 -0
- package/src/pipeline/render-text.ts +1255 -0
- package/src/pipeline/types.ts +161 -0
- package/src/pipeline.ts +29 -0
- package/src/pixel-size.ts +119 -0
- package/src/render-adapter.ts +179 -0
- package/src/renderer.ts +1330 -0
- package/src/runtime/create-app.tsx +1845 -0
- package/src/runtime/create-buffer.ts +18 -0
- package/src/runtime/create-runtime.ts +325 -0
- package/src/runtime/diff.ts +56 -0
- package/src/runtime/event-handlers.ts +254 -0
- package/src/runtime/index.ts +119 -0
- package/src/runtime/keys.ts +8 -0
- package/src/runtime/layout.ts +164 -0
- package/src/runtime/run.tsx +318 -0
- package/src/runtime/term-provider.ts +399 -0
- package/src/runtime/terminal-lifecycle.ts +246 -0
- package/src/runtime/tick.ts +219 -0
- package/src/runtime/types.ts +210 -0
- package/src/scheduler.ts +723 -0
- package/src/screenshot.ts +57 -0
- package/src/scroll-region.ts +69 -0
- package/src/scroll-utils.ts +97 -0
- package/src/term-def.ts +267 -0
- package/src/terminal-caps.ts +5 -0
- package/src/terminal-colors.ts +216 -0
- package/src/termtest.ts +224 -0
- package/src/text-sizing.ts +109 -0
- package/src/toolbelt/index.ts +72 -0
- package/src/unicode.ts +1763 -0
- package/src/xterm/index.ts +491 -0
- package/src/xterm/xterm-provider.ts +204 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @silvery/term — Terminal rendering target for silvery.
|
|
3
|
+
*
|
|
4
|
+
* Provides terminal buffer, pipeline, output, input protocols,
|
|
5
|
+
* layout engine, render adapters, and Unicode text utilities.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Buffer
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
export type { TerminalBuffer, Color } from "./buffer"
|
|
15
|
+
export { colorEquals, DEFAULT_BG, isDefaultBg } from "./buffer"
|
|
16
|
+
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// Pipeline
|
|
19
|
+
// =============================================================================
|
|
20
|
+
|
|
21
|
+
export { executeRender, type PipelineConfig, type ExecuteRenderOptions } from "./pipeline"
|
|
22
|
+
export {
|
|
23
|
+
outputPhase,
|
|
24
|
+
setOutputCaps,
|
|
25
|
+
createOutputPhase,
|
|
26
|
+
type OutputPhaseFn,
|
|
27
|
+
type OutputCaps,
|
|
28
|
+
} from "./pipeline/output-phase"
|
|
29
|
+
export type { PipelineContext } from "./pipeline/types"
|
|
30
|
+
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// App Types
|
|
33
|
+
// =============================================================================
|
|
34
|
+
|
|
35
|
+
export type { App } from "./app"
|
|
36
|
+
export type { BoundTerm } from "./bound-term"
|
|
37
|
+
|
|
38
|
+
// =============================================================================
|
|
39
|
+
// Layout Engine
|
|
40
|
+
// =============================================================================
|
|
41
|
+
|
|
42
|
+
export type { LayoutEngine, LayoutNode, LayoutConstants, MeasureFunc, MeasureMode } from "./layout-engine"
|
|
43
|
+
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// Render Adapter
|
|
46
|
+
// =============================================================================
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
setRenderAdapter,
|
|
50
|
+
getRenderAdapter,
|
|
51
|
+
hasRenderAdapter,
|
|
52
|
+
getTextMeasurer,
|
|
53
|
+
ensureRenderAdapterInitialized,
|
|
54
|
+
} from "./render-adapter"
|
|
55
|
+
export type {
|
|
56
|
+
RenderAdapter,
|
|
57
|
+
RenderBuffer,
|
|
58
|
+
RenderStyle,
|
|
59
|
+
TextMeasurer,
|
|
60
|
+
TextMeasureResult,
|
|
61
|
+
TextMeasureStyle,
|
|
62
|
+
BorderChars,
|
|
63
|
+
} from "./render-adapter"
|
|
64
|
+
|
|
65
|
+
// Canvas adapter
|
|
66
|
+
export { createCanvasAdapter, CanvasRenderBuffer } from "./adapters/canvas-adapter"
|
|
67
|
+
export type { CanvasAdapterConfig } from "./adapters/canvas-adapter"
|
|
68
|
+
|
|
69
|
+
// DOM adapter
|
|
70
|
+
export { createDOMAdapter, DOMRenderBuffer, injectDOMStyles } from "./adapters/dom-adapter"
|
|
71
|
+
export type { DOMAdapterConfig } from "./adapters/dom-adapter"
|
|
72
|
+
|
|
73
|
+
// =============================================================================
|
|
74
|
+
// ANSI Sanitizer
|
|
75
|
+
// =============================================================================
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
sanitizeAnsi,
|
|
79
|
+
tokenizeAnsi,
|
|
80
|
+
isCSISGR,
|
|
81
|
+
extractColonSGRReplacements,
|
|
82
|
+
createColonSGRTracker,
|
|
83
|
+
} from "./ansi-sanitize"
|
|
84
|
+
export type { AnsiToken, ColonSGRReplacement } from "./ansi-sanitize"
|
|
85
|
+
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// ANSI Escape Sequences / Output
|
|
88
|
+
// =============================================================================
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
ANSI,
|
|
92
|
+
BEL,
|
|
93
|
+
enableMouse,
|
|
94
|
+
disableMouse,
|
|
95
|
+
KittyFlags,
|
|
96
|
+
enableKittyKeyboard,
|
|
97
|
+
disableKittyKeyboard,
|
|
98
|
+
queryKittyKeyboard,
|
|
99
|
+
notify,
|
|
100
|
+
notifyITerm2,
|
|
101
|
+
notifyKitty,
|
|
102
|
+
reportDirectory,
|
|
103
|
+
setWindowTitle,
|
|
104
|
+
setWindowAndIconTitle,
|
|
105
|
+
resetWindowTitle,
|
|
106
|
+
setCursorStyle,
|
|
107
|
+
resetCursorStyle,
|
|
108
|
+
setMouseCursorShape,
|
|
109
|
+
resetMouseCursorShape,
|
|
110
|
+
} from "./output"
|
|
111
|
+
export type { CursorShape, MouseCursorShape } from "./output"
|
|
112
|
+
|
|
113
|
+
// =============================================================================
|
|
114
|
+
// Bracketed Paste
|
|
115
|
+
// =============================================================================
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
enableBracketedPaste,
|
|
119
|
+
disableBracketedPaste,
|
|
120
|
+
parseBracketedPaste,
|
|
121
|
+
PASTE_START,
|
|
122
|
+
PASTE_END,
|
|
123
|
+
} from "./bracketed-paste"
|
|
124
|
+
export type { BracketedPasteResult } from "./bracketed-paste"
|
|
125
|
+
|
|
126
|
+
// =============================================================================
|
|
127
|
+
// OSC 52 Clipboard
|
|
128
|
+
// =============================================================================
|
|
129
|
+
|
|
130
|
+
export { copyToClipboard, requestClipboard, parseClipboardResponse } from "./clipboard"
|
|
131
|
+
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// OSC 4 Palette Color Query/Set
|
|
134
|
+
// =============================================================================
|
|
135
|
+
|
|
136
|
+
export { queryPaletteColor, setPaletteColor, parsePaletteResponse, queryMultiplePaletteColors } from "./osc-palette"
|
|
137
|
+
|
|
138
|
+
// =============================================================================
|
|
139
|
+
// OSC 133 Semantic Prompt Markers
|
|
140
|
+
// =============================================================================
|
|
141
|
+
|
|
142
|
+
export { OSC133 } from "./osc-markers"
|
|
143
|
+
|
|
144
|
+
// =============================================================================
|
|
145
|
+
// Kitty Protocol Detection
|
|
146
|
+
// =============================================================================
|
|
147
|
+
|
|
148
|
+
export { detectKittySupport, detectKittyFromStdio, type KittyDetectResult } from "./kitty-detect"
|
|
149
|
+
|
|
150
|
+
// =============================================================================
|
|
151
|
+
// Kitty Protocol Manager
|
|
152
|
+
// =============================================================================
|
|
153
|
+
|
|
154
|
+
export { createKittyManager, type KittyManager, type KittyManagerOptions } from "./kitty-manager"
|
|
155
|
+
|
|
156
|
+
// =============================================================================
|
|
157
|
+
// Terminal Capability Detection
|
|
158
|
+
// =============================================================================
|
|
159
|
+
|
|
160
|
+
export { detectTerminalCaps, defaultCaps, type TerminalCaps } from "./terminal-caps"
|
|
161
|
+
|
|
162
|
+
// =============================================================================
|
|
163
|
+
// Terminal Capability Visual Test
|
|
164
|
+
// =============================================================================
|
|
165
|
+
|
|
166
|
+
export { runTermtest, TERMTEST_SECTIONS, type TermtestSection, type TermtestOptions } from "./termtest"
|
|
167
|
+
|
|
168
|
+
// =============================================================================
|
|
169
|
+
// Text Sizing (OSC 66)
|
|
170
|
+
// =============================================================================
|
|
171
|
+
|
|
172
|
+
export { textSized, isPrivateUseArea, isTextSizingLikelySupported, detectTextSizingSupport } from "./text-sizing"
|
|
173
|
+
|
|
174
|
+
// =============================================================================
|
|
175
|
+
// CSI 6n Cursor Position Query
|
|
176
|
+
// =============================================================================
|
|
177
|
+
|
|
178
|
+
export { queryCursorPosition, queryCursorFromStdio } from "./cursor-query"
|
|
179
|
+
|
|
180
|
+
// =============================================================================
|
|
181
|
+
// OSC 10/11/12 Terminal Color Queries
|
|
182
|
+
// =============================================================================
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
queryForegroundColor,
|
|
186
|
+
queryBackgroundColor,
|
|
187
|
+
queryCursorColor,
|
|
188
|
+
setForegroundColor,
|
|
189
|
+
setBackgroundColor,
|
|
190
|
+
setCursorColor,
|
|
191
|
+
resetForegroundColor,
|
|
192
|
+
resetBackgroundColor,
|
|
193
|
+
resetCursorColor,
|
|
194
|
+
detectColorScheme,
|
|
195
|
+
} from "./terminal-colors"
|
|
196
|
+
|
|
197
|
+
// =============================================================================
|
|
198
|
+
// DA1/DA2/DA3 + XTVERSION Device Attribute Queries
|
|
199
|
+
// =============================================================================
|
|
200
|
+
|
|
201
|
+
export {
|
|
202
|
+
queryPrimaryDA,
|
|
203
|
+
querySecondaryDA,
|
|
204
|
+
queryTertiaryDA,
|
|
205
|
+
queryTerminalVersion,
|
|
206
|
+
queryDeviceAttributes,
|
|
207
|
+
type DeviceAttributes,
|
|
208
|
+
} from "./device-attrs"
|
|
209
|
+
|
|
210
|
+
// =============================================================================
|
|
211
|
+
// Focus Reporting
|
|
212
|
+
// =============================================================================
|
|
213
|
+
|
|
214
|
+
export { enableFocusReporting, disableFocusReporting, parseFocusEvent } from "./focus-reporting"
|
|
215
|
+
|
|
216
|
+
// =============================================================================
|
|
217
|
+
// DECRQM Mode Query
|
|
218
|
+
// =============================================================================
|
|
219
|
+
|
|
220
|
+
export { queryMode, queryModes, DecMode } from "./mode-query"
|
|
221
|
+
|
|
222
|
+
// =============================================================================
|
|
223
|
+
// CSI 14t/18t Pixel and Text Area Size
|
|
224
|
+
// =============================================================================
|
|
225
|
+
|
|
226
|
+
export { queryTextAreaPixels, queryTextAreaSize, queryCellSize } from "./pixel-size"
|
|
227
|
+
|
|
228
|
+
// =============================================================================
|
|
229
|
+
// TermDef Resolution
|
|
230
|
+
// =============================================================================
|
|
231
|
+
|
|
232
|
+
export { resolveTermDef, resolveFromTerm, isTerm, isTermDef, createInputEvents, type ResolvedTermDef } from "./term-def"
|
|
233
|
+
|
|
234
|
+
// =============================================================================
|
|
235
|
+
// Hit Registry (Mouse Support) — React-free core only
|
|
236
|
+
// =============================================================================
|
|
237
|
+
//
|
|
238
|
+
// The barrel exports only the pure core (class, types, constants).
|
|
239
|
+
// React hooks and context are available via @silvery/term/hit-registry.
|
|
240
|
+
//
|
|
241
|
+
|
|
242
|
+
export { HitRegistry, resetHitRegionIdCounter, Z_INDEX } from "./hit-registry-core"
|
|
243
|
+
export type { HitTarget, HitRegion } from "./hit-registry-core"
|
|
244
|
+
|
|
245
|
+
// =============================================================================
|
|
246
|
+
// Mouse Parsing (SGR mode 1006)
|
|
247
|
+
// =============================================================================
|
|
248
|
+
|
|
249
|
+
export { parseMouseSequence, isMouseSequence, type ParsedMouse } from "./mouse"
|
|
250
|
+
|
|
251
|
+
// =============================================================================
|
|
252
|
+
// Mouse Events (DOM-level)
|
|
253
|
+
// =============================================================================
|
|
254
|
+
|
|
255
|
+
export {
|
|
256
|
+
hitTest,
|
|
257
|
+
createMouseEvent,
|
|
258
|
+
createWheelEvent,
|
|
259
|
+
dispatchMouseEvent,
|
|
260
|
+
processMouseEvent,
|
|
261
|
+
createMouseEventProcessor,
|
|
262
|
+
checkDoubleClick,
|
|
263
|
+
createDoubleClickState,
|
|
264
|
+
computeEnterLeave,
|
|
265
|
+
type SilveryMouseEvent,
|
|
266
|
+
type SilveryWheelEvent,
|
|
267
|
+
type MouseEventProps,
|
|
268
|
+
type MouseEventProcessorOptions,
|
|
269
|
+
type MouseEventProcessorState,
|
|
270
|
+
} from "./mouse-events"
|
|
271
|
+
|
|
272
|
+
// =============================================================================
|
|
273
|
+
// Non-TTY Utilities
|
|
274
|
+
// =============================================================================
|
|
275
|
+
|
|
276
|
+
export { isTTY, resolveNonTTYMode, stripAnsi } from "./non-tty"
|
|
277
|
+
export type { NonTTYOptions, ResolvedNonTTYMode } from "./non-tty"
|
|
278
|
+
|
|
279
|
+
// =============================================================================
|
|
280
|
+
// DevTools — available via @silvery/term/devtools (not re-exported here to
|
|
281
|
+
// keep this barrel React-free; devtools imports the React reconciler)
|
|
282
|
+
// =============================================================================
|
|
283
|
+
|
|
284
|
+
// =============================================================================
|
|
285
|
+
// Inspector
|
|
286
|
+
// =============================================================================
|
|
287
|
+
|
|
288
|
+
export {
|
|
289
|
+
enableInspector,
|
|
290
|
+
disableInspector,
|
|
291
|
+
isInspectorEnabled,
|
|
292
|
+
inspectTree,
|
|
293
|
+
inspectFrame,
|
|
294
|
+
autoEnableInspector,
|
|
295
|
+
} from "./inspector"
|
|
296
|
+
export type { InspectorOptions } from "./inspector"
|
|
297
|
+
|
|
298
|
+
// =============================================================================
|
|
299
|
+
// Unicode Text Utilities
|
|
300
|
+
// =============================================================================
|
|
301
|
+
|
|
302
|
+
export {
|
|
303
|
+
// Measurement
|
|
304
|
+
displayWidth,
|
|
305
|
+
displayWidthAnsi,
|
|
306
|
+
measureText,
|
|
307
|
+
// Manipulation
|
|
308
|
+
wrapText,
|
|
309
|
+
truncateText,
|
|
310
|
+
padText,
|
|
311
|
+
constrainText,
|
|
312
|
+
sliceByWidth,
|
|
313
|
+
sliceByWidthRange,
|
|
314
|
+
sliceByWidthFromEnd,
|
|
315
|
+
// ANSI handling
|
|
316
|
+
hasAnsi,
|
|
317
|
+
parseAnsiText,
|
|
318
|
+
stripAnsi as stripAnsiUnicode,
|
|
319
|
+
truncateAnsi,
|
|
320
|
+
// Grapheme operations
|
|
321
|
+
splitGraphemes,
|
|
322
|
+
graphemeCount,
|
|
323
|
+
graphemeWidth,
|
|
324
|
+
// Character detection
|
|
325
|
+
isWideGrapheme,
|
|
326
|
+
isZeroWidthGrapheme,
|
|
327
|
+
isCJK,
|
|
328
|
+
isLikelyEmoji,
|
|
329
|
+
hasWideCharacters,
|
|
330
|
+
hasZeroWidthCharacters,
|
|
331
|
+
// Emoji presentation
|
|
332
|
+
ensureEmojiPresentation,
|
|
333
|
+
// Text sizing state
|
|
334
|
+
setTextSizingEnabled,
|
|
335
|
+
isTextSizingEnabled,
|
|
336
|
+
// Text-presentation emoji width
|
|
337
|
+
setTextEmojiWide,
|
|
338
|
+
// Buffer writing
|
|
339
|
+
writeTextToBuffer,
|
|
340
|
+
writeTextTruncated,
|
|
341
|
+
writeLinesToBuffer,
|
|
342
|
+
// Utilities
|
|
343
|
+
normalizeText,
|
|
344
|
+
getFirstCodePoint,
|
|
345
|
+
} from "./unicode"
|
|
346
|
+
export type { StyledSegment } from "./unicode"
|
|
347
|
+
|
|
348
|
+
// Width measurer factory
|
|
349
|
+
export { createWidthMeasurer, createMeasurer, runWithMeasurer, type Measurer, type WidthMeasurer } from "./unicode"
|
|
350
|
+
|
|
351
|
+
// Measurer composition (term + measurement)
|
|
352
|
+
export { withMeasurer, createPipeline, type MeasuredTerm } from "./measurer"
|
|
353
|
+
|
|
354
|
+
// withRender plugin — available via @silvery/tea/with-render (not re-exported
|
|
355
|
+
// here to keep this barrel React-free; withRender's renderStatic() pulls React)
|
|
356
|
+
|
|
357
|
+
// =============================================================================
|
|
358
|
+
// Scroll Utilities
|
|
359
|
+
// =============================================================================
|
|
360
|
+
|
|
361
|
+
export { calcEdgeBasedScrollOffset } from "./scroll-utils"
|
|
362
|
+
|
|
363
|
+
// Scroll Region Optimization (DECSTBM)
|
|
364
|
+
export {
|
|
365
|
+
setScrollRegion,
|
|
366
|
+
resetScrollRegion,
|
|
367
|
+
scrollUp,
|
|
368
|
+
scrollDown,
|
|
369
|
+
moveCursor,
|
|
370
|
+
supportsScrollRegions,
|
|
371
|
+
} from "./scroll-region"
|
|
372
|
+
export type { ScrollRegionConfig } from "./scroll-region"
|
|
373
|
+
|
|
374
|
+
// =============================================================================
|
|
375
|
+
// Pane Manager
|
|
376
|
+
// =============================================================================
|
|
377
|
+
|
|
378
|
+
export type { LayoutNode as SplitLayoutNode } from "./pane-manager"
|
|
379
|
+
export {
|
|
380
|
+
createLeaf,
|
|
381
|
+
splitPane,
|
|
382
|
+
removePane,
|
|
383
|
+
getPaneIds,
|
|
384
|
+
findAdjacentPane,
|
|
385
|
+
resizeSplit,
|
|
386
|
+
swapPanes,
|
|
387
|
+
getTabOrder as getSplitTabOrder,
|
|
388
|
+
} from "./pane-manager"
|
|
389
|
+
|
|
390
|
+
// =============================================================================
|
|
391
|
+
// Scheduler
|
|
392
|
+
// =============================================================================
|
|
393
|
+
|
|
394
|
+
export { IncrementalRenderMismatchError } from "./errors"
|
|
395
|
+
|
|
396
|
+
// =============================================================================
|
|
397
|
+
// ANSI Primitives (merged from @silvery/ansi)
|
|
398
|
+
// =============================================================================
|
|
399
|
+
|
|
400
|
+
// Term factory and lazy instance
|
|
401
|
+
export { createTerm, term } from "./ansi/index"
|
|
402
|
+
export type { Term, StyleChain } from "./ansi/index"
|
|
403
|
+
|
|
404
|
+
// Console patching
|
|
405
|
+
export { patchConsole } from "./ansi/index"
|
|
406
|
+
export type { PatchedConsole, PatchConsoleOptions, ConsoleStats } from "./ansi/index"
|
|
407
|
+
|
|
408
|
+
// Types
|
|
409
|
+
export type {
|
|
410
|
+
UnderlineStyle,
|
|
411
|
+
RGB,
|
|
412
|
+
ColorLevel,
|
|
413
|
+
Color as AnsiColor,
|
|
414
|
+
AnsiColorName,
|
|
415
|
+
StyleOptions,
|
|
416
|
+
ConsoleMethod,
|
|
417
|
+
ConsoleEntry,
|
|
418
|
+
CreateTermOptions,
|
|
419
|
+
} from "./ansi/index"
|
|
420
|
+
|
|
421
|
+
// Detection
|
|
422
|
+
export { detectCursor, detectInput, detectColor, detectUnicode, detectExtendedUnderline } from "./ansi/index"
|
|
423
|
+
|
|
424
|
+
// Utilities
|
|
425
|
+
export { ANSI_REGEX, displayLength } from "./ansi/index"
|
|
426
|
+
|
|
427
|
+
// Underline functions
|
|
428
|
+
export {
|
|
429
|
+
underline as ansiUnderline,
|
|
430
|
+
curlyUnderline,
|
|
431
|
+
dottedUnderline,
|
|
432
|
+
dashedUnderline,
|
|
433
|
+
doubleUnderline,
|
|
434
|
+
underlineColor,
|
|
435
|
+
styledUnderline,
|
|
436
|
+
} from "./ansi/index"
|
|
437
|
+
|
|
438
|
+
// Hyperlinks
|
|
439
|
+
export { hyperlink } from "./ansi/index"
|
|
440
|
+
|
|
441
|
+
// ANSI control helpers (re-exported as ansi* to avoid conflicts with term's own)
|
|
442
|
+
export {
|
|
443
|
+
enterAltScreen,
|
|
444
|
+
leaveAltScreen,
|
|
445
|
+
clearScreen,
|
|
446
|
+
clearLine,
|
|
447
|
+
cursorTo,
|
|
448
|
+
cursorHome,
|
|
449
|
+
cursorHide,
|
|
450
|
+
cursorShow,
|
|
451
|
+
cursorStyle as ansiCursorStyle,
|
|
452
|
+
setTitle,
|
|
453
|
+
enableSyncUpdate,
|
|
454
|
+
disableSyncUpdate,
|
|
455
|
+
} from "./ansi/index"
|
|
456
|
+
|
|
457
|
+
// Background override
|
|
458
|
+
export { BG_OVERRIDE_CODE, bgOverride } from "./ansi/index"
|
package/src/input.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* silvery/input -- Terminal input protocols and low-level input handling.
|
|
3
|
+
*
|
|
4
|
+
* Mouse events (SGR), Kitty keyboard protocol, bracketed paste,
|
|
5
|
+
* OSC 52 clipboard, and key parsing utilities.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { parseMouseSequence, enableKittyKeyboard, copyToClipboard } from '@silvery/react/input'
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// Mouse Parsing (SGR mode 1006)
|
|
16
|
+
// =============================================================================
|
|
17
|
+
|
|
18
|
+
export { parseMouseSequence, isMouseSequence, type ParsedMouse } from "./mouse"
|
|
19
|
+
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// Mouse Events (DOM-level)
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
hitTest,
|
|
26
|
+
createMouseEvent,
|
|
27
|
+
createWheelEvent,
|
|
28
|
+
dispatchMouseEvent,
|
|
29
|
+
processMouseEvent,
|
|
30
|
+
createMouseEventProcessor,
|
|
31
|
+
checkDoubleClick,
|
|
32
|
+
createDoubleClickState,
|
|
33
|
+
computeEnterLeave,
|
|
34
|
+
type SilveryMouseEvent,
|
|
35
|
+
type SilveryWheelEvent,
|
|
36
|
+
type MouseEventProps,
|
|
37
|
+
type MouseEventProcessorOptions,
|
|
38
|
+
type MouseEventProcessorState,
|
|
39
|
+
} from "./mouse-events"
|
|
40
|
+
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// Hit Registry (mouse target resolution)
|
|
43
|
+
// =============================================================================
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
HitRegistry,
|
|
47
|
+
HitRegistryContext,
|
|
48
|
+
useHitRegistry,
|
|
49
|
+
useHitRegion,
|
|
50
|
+
useHitRegionCallback,
|
|
51
|
+
resetHitRegionIdCounter,
|
|
52
|
+
Z_INDEX,
|
|
53
|
+
} from "./hit-registry"
|
|
54
|
+
export type { HitTarget, HitRegion } from "./hit-registry"
|
|
55
|
+
|
|
56
|
+
// =============================================================================
|
|
57
|
+
// ANSI Escape Sequences
|
|
58
|
+
// =============================================================================
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
ANSI,
|
|
62
|
+
BEL,
|
|
63
|
+
enableMouse,
|
|
64
|
+
disableMouse,
|
|
65
|
+
KittyFlags,
|
|
66
|
+
enableKittyKeyboard,
|
|
67
|
+
disableKittyKeyboard,
|
|
68
|
+
queryKittyKeyboard,
|
|
69
|
+
notify,
|
|
70
|
+
notifyITerm2,
|
|
71
|
+
notifyKitty,
|
|
72
|
+
reportDirectory,
|
|
73
|
+
} from "./output"
|
|
74
|
+
|
|
75
|
+
// =============================================================================
|
|
76
|
+
// Kitty Protocol Detection
|
|
77
|
+
// =============================================================================
|
|
78
|
+
|
|
79
|
+
export { detectKittySupport, detectKittyFromStdio, type KittyDetectResult } from "./kitty-detect"
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// Terminal Capability Detection
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
export { detectTerminalCaps, type TerminalCaps } from "./terminal-caps"
|
|
86
|
+
|
|
87
|
+
// =============================================================================
|
|
88
|
+
// Bracketed Paste
|
|
89
|
+
// =============================================================================
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
enableBracketedPaste,
|
|
93
|
+
disableBracketedPaste,
|
|
94
|
+
parseBracketedPaste,
|
|
95
|
+
PASTE_START,
|
|
96
|
+
PASTE_END,
|
|
97
|
+
} from "./bracketed-paste"
|
|
98
|
+
export type { BracketedPasteResult } from "./bracketed-paste"
|
|
99
|
+
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// OSC 52 Clipboard
|
|
102
|
+
// =============================================================================
|
|
103
|
+
|
|
104
|
+
export { copyToClipboard, requestClipboard, parseClipboardResponse } from "./clipboard"
|
|
105
|
+
|
|
106
|
+
// =============================================================================
|
|
107
|
+
// Key Parsing
|
|
108
|
+
// =============================================================================
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
keyToName,
|
|
112
|
+
keyToModifiers,
|
|
113
|
+
parseHotkey,
|
|
114
|
+
matchHotkey,
|
|
115
|
+
parseKeypress,
|
|
116
|
+
parseKey,
|
|
117
|
+
emptyKey,
|
|
118
|
+
} from "@silvery/tea/keys"
|
|
119
|
+
export type { ParsedKeypress, ParsedHotkey } from "@silvery/tea/keys"
|