@alchemy.run/sigil 0.0.0-alpha.4 → 0.0.0-alpha.6

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 (138) hide show
  1. package/README.md +21 -9
  2. package/THIRD_PARTY_NOTICES.md +39 -1
  3. package/dist/Text-BobFKi74.d.ts +452 -0
  4. package/dist/ansi.d.ts +122 -131
  5. package/dist/ansi.js +86 -6
  6. package/dist/capabilities.d.ts +5 -0
  7. package/dist/capabilities.js +3 -0
  8. package/dist/cell-_ZVhbfl0.js +44 -0
  9. package/dist/color-CkbalRqK.js +2 -0
  10. package/dist/color-policy-BMzMwV7Q.d.ts +22 -0
  11. package/dist/color-policy-SVj1pYTA.js +560 -0
  12. package/dist/color-profile-DHhQHY55.js +36 -0
  13. package/dist/color-profile-u0Nhe9Nv.d.ts +97 -0
  14. package/dist/color.d.ts +21 -0
  15. package/dist/color.js +3 -0
  16. package/dist/cursor-position-D2LAkRG0.d.ts +7 -0
  17. package/dist/detect-Bh4yGP6w.d.ts +186 -0
  18. package/dist/detect-BuTXtY6e.js +373 -0
  19. package/dist/env-YVw64yZS.js +9 -0
  20. package/dist/escapes-CB_6CWOE.d.ts +72 -0
  21. package/dist/geometry-BxXOzJgo.d.ts +11 -0
  22. package/dist/index-DZ88EXJv.d.ts +21 -0
  23. package/dist/index.d.ts +143 -498
  24. package/dist/index.js +1026 -2244
  25. package/dist/osc-CCH7xDoS.js +71 -0
  26. package/dist/osc-Cn0fw77g.d.ts +23 -0
  27. package/dist/paint-C19minOS.d.ts +81 -0
  28. package/dist/query-vaIeGOkH.d.ts +152 -0
  29. package/dist/router.d.ts +392 -0
  30. package/dist/router.js +709 -0
  31. package/dist/sample-Cqw1bjUL.js +445 -0
  32. package/dist/screen-BOSLQ8fF.d.ts +49 -0
  33. package/dist/screen-CiPytswf.js +342 -0
  34. package/dist/screen.d.ts +5 -0
  35. package/dist/screen.js +5 -0
  36. package/dist/semantic-text-style-DIMzC7xt.js +91 -0
  37. package/dist/serialize-BTkAZgw1.js +79 -0
  38. package/dist/session-aZr9O8h3.js +665 -0
  39. package/dist/sgr-BhwaWAJB.js +246 -0
  40. package/dist/store-CgrG9K4y.d.ts +72 -0
  41. package/dist/string-width-CijQwpIk.js +69 -0
  42. package/dist/strip-BvU4toXG.js +6 -0
  43. package/dist/terminal.d.ts +118 -0
  44. package/dist/terminal.js +2 -0
  45. package/dist/tokenize-AjqbvtiT.js +1242 -0
  46. package/dist/tokenize-Dx1y_l5H.d.ts +57 -0
  47. package/dist/truncate-D31fhU6i.js +562 -0
  48. package/dist/use-focus-BzqAJi0n.js +1337 -0
  49. package/package.json +41 -9
  50. package/src/ansi/chalk.ts +5 -3
  51. package/src/ansi/escapes.ts +14 -0
  52. package/src/ansi/graphemes.ts +8 -0
  53. package/src/ansi/hyperlink.ts +44 -0
  54. package/src/ansi/index.ts +3 -1
  55. package/src/ansi/osc.ts +77 -0
  56. package/src/ansi/tokenize.ts +3 -4
  57. package/src/capabilities/color-policy.ts +34 -0
  58. package/src/capabilities/detect.ts +594 -0
  59. package/src/capabilities/index.ts +37 -0
  60. package/src/capabilities/query.ts +657 -0
  61. package/src/capabilities/store.ts +379 -0
  62. package/src/color/index.ts +3 -0
  63. package/src/color/paint.ts +169 -0
  64. package/src/color/palette.ts +48 -0
  65. package/src/color/sample.ts +323 -0
  66. package/src/color.ts +1 -0
  67. package/src/components/AnsiText.tsx +42 -0
  68. package/src/components/App.tsx +98 -10
  69. package/src/components/BackgroundContext.ts +2 -3
  70. package/src/components/Box.tsx +0 -8
  71. package/src/components/CursorContext.ts +1 -1
  72. package/src/components/Hyperlink.tsx +56 -0
  73. package/src/components/TerminalOscContext.ts +25 -0
  74. package/src/components/Text.tsx +22 -45
  75. package/src/components/Transform.tsx +1 -1
  76. package/src/dom.ts +11 -2
  77. package/src/global.d.ts +3 -0
  78. package/src/hooks/use-capabilities.ts +73 -0
  79. package/src/hooks/use-cursor.ts +2 -2
  80. package/src/hooks/use-terminal-osc.ts +59 -0
  81. package/src/index.ts +45 -1
  82. package/src/ink.tsx +213 -153
  83. package/src/{render-node-to-output.ts → paint-tree.ts} +75 -48
  84. package/src/reconciler.ts +24 -3
  85. package/src/render-background.ts +36 -15
  86. package/src/render-border.ts +94 -61
  87. package/src/render-frame.ts +83 -0
  88. package/src/render-to-string.ts +21 -6
  89. package/src/render.ts +15 -6
  90. package/src/router/components.tsx +343 -0
  91. package/src/router/context.ts +41 -0
  92. package/src/router/history.ts +194 -0
  93. package/src/router/hooks.tsx +391 -0
  94. package/src/router/index.ts +34 -0
  95. package/src/router/matcher.ts +571 -0
  96. package/src/screen/ansi.ts +184 -0
  97. package/src/screen/canvas.ts +160 -0
  98. package/src/screen/cell.ts +138 -0
  99. package/src/screen/color-profile.ts +47 -0
  100. package/src/screen/geometry.ts +9 -0
  101. package/src/screen/index.ts +6 -0
  102. package/src/screen/screen.ts +305 -0
  103. package/src/screen/serialize.ts +129 -0
  104. package/src/screen.ts +1 -0
  105. package/src/semantic-text-style.ts +118 -0
  106. package/src/squash-text-nodes.ts +2 -5
  107. package/src/structured-text.ts +325 -0
  108. package/src/styles.ts +19 -14
  109. package/src/terminal/index.ts +2 -0
  110. package/src/terminal/inline-presenter.ts +120 -0
  111. package/src/terminal/input.ts +86 -0
  112. package/src/terminal/render-scheduler.ts +37 -0
  113. package/src/terminal/screen-presenter.ts +188 -0
  114. package/src/terminal/session.ts +407 -0
  115. package/src/terminal.ts +1 -0
  116. package/src/testing/browser.ts +588 -0
  117. package/src/testing/emulators.ts +205 -0
  118. package/src/testing/explorer-app/index.html +12 -0
  119. package/src/testing/explorer-app/main.ts +381 -0
  120. package/src/testing/explorer-app/style.css +194 -0
  121. package/src/testing/explorer-app/tsconfig.json +15 -0
  122. package/src/testing/explorer-app/vite-env.d.ts +1 -0
  123. package/src/testing/index.ts +26 -0
  124. package/src/testing/keys.ts +56 -0
  125. package/src/testing/live.ts +85 -0
  126. package/src/testing/matchers.ts +70 -0
  127. package/src/testing/public.ts +94 -0
  128. package/src/testing/terminal.ts +349 -0
  129. package/src/testing/vitest.ts +157 -0
  130. package/src/transform-adapter.ts +14 -0
  131. package/src/wrap-text.ts +4 -0
  132. package/dist/sgr-CMfEpjSk.d.ts +0 -91
  133. package/dist/truncate-Cr6xVFMa.js +0 -2330
  134. package/src/ansi/supports-color.ts +0 -207
  135. package/src/colorize.ts +0 -60
  136. package/src/log-update.ts +0 -370
  137. package/src/output.ts +0 -308
  138. package/src/renderer.ts +0 -73
package/dist/index.d.ts CHANGED
@@ -1,5 +1,12 @@
1
- import { n as ForegroundColorName } from "./sgr-CMfEpjSk.js";
1
+ import { a as Multiplexer, c as TerminalAppearance, d as detectCapabilities, f as detectColorLevel, h as detectUnicodeSupport, i as ColorSupportLevel, l as TerminalIdentity, m as detectTerminal, n as ColorInfo, o as PixelGeometry, p as detectHyperlinkSupport, r as ColorSupport, s as RgbColor, t as Capabilities, u as createSupportsColor } from "./detect-Bh4yGP6w.js";
2
+ import { n as TerminalProgressState, t as ClipboardSelection } from "./osc-Cn0fw77g.js";
3
+ import { a as getTerminalQuery, i as applyTerminalQuery, n as TerminalQueryOptions, o as queryTerminal, r as TerminalQueryResult, s as refreshTerminalQuery, t as PixelSize } from "./query-vaIeGOkH.js";
4
+ import { i as OutputStream, n as capabilities, r as getCapabilities, t as CapabilitiesStore } from "./store-CgrG9K4y.js";
5
+ import { s as CellStyle, t as ColorProfile } from "./color-profile-u0Nhe9Nv.js";
6
+ import { s as Paint } from "./paint-C19minOS.js";
7
+ import { n as Text, r as Styles, t as Props$8 } from "./Text-BobFKi74.js";
2
8
  import { i as Node } from "./index-DDVME65c.js";
9
+ import { t as CursorPosition } from "./cursor-position-D2LAkRG0.js";
3
10
  import { Writable } from "node:stream";
4
11
  import { PropsWithChildren, ReactNode, Ref, RefObject } from "react";
5
12
  import { EventEmitter } from "node:events";
@@ -27,15 +34,6 @@ type KittyKeyboardOptions = {
27
34
  flags?: KittyFlagName[];
28
35
  };
29
36
  //#endregion
30
- //#region src/stream.d.ts
31
- type OutputStream = NodeJS.WritableStream & {
32
- isTTY?: boolean;
33
- columns?: number;
34
- rows?: number;
35
- destroyed?: boolean;
36
- writableEnded?: boolean;
37
- };
38
- //#endregion
39
37
  //#region src/ink.d.ts
40
38
  /**
41
39
  The origin of a chunk captured by `patchConsole`: a patched `console.*`
@@ -52,7 +50,7 @@ type RenderMetrics = {
52
50
  renderTime: number;
53
51
  };
54
52
  /**
55
- A live Ink renderer for one stdout stream, created by `createInk`.
53
+ A live React terminal runtime for one stdout stream, created by `createInk`.
56
54
  */
57
55
  type Ink = {
58
56
  /**
@@ -75,6 +73,10 @@ type Ink = {
75
73
  Clear output.
76
74
  */
77
75
  clear: () => void;
76
+ /** Copy text through the renderer-owned terminal session. */
77
+ copyToClipboard: (text: string, selection?: ClipboardSelection) => boolean;
78
+ /** Update terminal-native progress through the renderer-owned session. */
79
+ setProgress: (state: TerminalProgressState, value?: number) => boolean;
78
80
  };
79
81
  //#endregion
80
82
  //#region src/render.d.ts
@@ -146,12 +148,12 @@ type RenderOptions = {
146
148
  */
147
149
  maxFps?: number;
148
150
  /**
149
- Enable incremental rendering mode which only updates changed lines instead of redrawing the entire output.
150
- This can reduce flickering and improve performance for frequently updating UIs.
151
-
152
- @default false
151
+ Override the output color profile for this render instance. When omitted,
152
+ the profile follows the capabilities of `stdout` and capability upgrades
153
+ redraw the live frame. Static content already written to scrollback is not
154
+ replayed or recolored.
153
155
  */
154
- incrementalRendering?: boolean;
156
+ colorProfile?: ColorProfile;
155
157
  /**
156
158
  Enable React Concurrent Rendering mode.
157
159
 
@@ -253,6 +255,10 @@ type Instance = {
253
255
  Clear output.
254
256
  */
255
257
  clear: () => void;
258
+ /** Copy text through the renderer-owned terminal session. */
259
+ copyToClipboard: (text: string, selection?: ClipboardSelection) => boolean;
260
+ /** Update terminal-native progress through the renderer-owned session. */
261
+ setProgress: (state: TerminalProgressState, value?: number) => boolean;
256
262
  };
257
263
  /**
258
264
  Mount a component and render the output.
@@ -267,6 +273,11 @@ type RenderToStringOptions = {
267
273
  @default 80
268
274
  */
269
275
  columns?: number;
276
+ /**
277
+ Color profile used for deterministic serialization. By default this retains
278
+ the process color level for Ink compatibility.
279
+ */
280
+ colorProfile?: ColorProfile;
270
281
  };
271
282
  /**
272
283
  Render a React element to a string synchronously. Unlike `render()`, this function does not write to stdout, does not set up any terminal event listeners, and returns the rendered output as a string.
@@ -297,412 +308,18 @@ console.log(output);
297
308
  */
298
309
  declare const renderToString: (node: ReactNode, options?: RenderToStringOptions) => string;
299
310
  //#endregion
300
- //#region src/render-node-to-output.d.ts
301
- type OutputTransformer = (s: string, index: number) => string;
302
- //#endregion
303
- //#region src/glyphs.d.ts
304
- declare const BOXES: {
305
- readonly single: {
306
- readonly topLeft: "";
307
- readonly top: "─";
308
- readonly topRight: "┐";
309
- readonly right: "│";
310
- readonly bottomRight: "┘";
311
- readonly bottom: "─";
312
- readonly bottomLeft: "└";
313
- readonly left: "│";
314
- };
315
- readonly double: {
316
- readonly topLeft: "╔";
317
- readonly top: "═";
318
- readonly topRight: "╗";
319
- readonly right: "║";
320
- readonly bottomRight: "╝";
321
- readonly bottom: "═";
322
- readonly bottomLeft: "╚";
323
- readonly left: "║";
324
- };
325
- readonly round: {
326
- readonly topLeft: "╭";
327
- readonly top: "─";
328
- readonly topRight: "╮";
329
- readonly right: "│";
330
- readonly bottomRight: "╯";
331
- readonly bottom: "─";
332
- readonly bottomLeft: "╰";
333
- readonly left: "│";
334
- };
335
- readonly bold: {
336
- readonly topLeft: "┏";
337
- readonly top: "━";
338
- readonly topRight: "┓";
339
- readonly right: "┃";
340
- readonly bottomRight: "┛";
341
- readonly bottom: "━";
342
- readonly bottomLeft: "┗";
343
- readonly left: "┃";
344
- };
345
- readonly singleDouble: {
346
- readonly topLeft: "╓";
347
- readonly top: "─";
348
- readonly topRight: "╖";
349
- readonly right: "║";
350
- readonly bottomRight: "╜";
351
- readonly bottom: "─";
352
- readonly bottomLeft: "╙";
353
- readonly left: "║";
354
- };
355
- readonly doubleSingle: {
356
- readonly topLeft: "╒";
357
- readonly top: "═";
358
- readonly topRight: "╕";
359
- readonly right: "│";
360
- readonly bottomRight: "╛";
361
- readonly bottom: "═";
362
- readonly bottomLeft: "╘";
363
- readonly left: "│";
364
- };
365
- readonly classic: {
366
- readonly topLeft: "+";
367
- readonly top: "-";
368
- readonly topRight: "+";
369
- readonly right: "|";
370
- readonly bottomRight: "+";
371
- readonly bottom: "-";
372
- readonly bottomLeft: "+";
373
- readonly left: "|";
374
- };
375
- readonly arrow: {
376
- readonly topLeft: "↘";
377
- readonly top: "↓";
378
- readonly topRight: "↙";
379
- readonly right: "←";
380
- readonly bottomRight: "↖";
381
- readonly bottom: "↑";
382
- readonly bottomLeft: "↗";
383
- readonly left: "→";
384
- };
385
- };
386
- type BoxStyle = keyof typeof BOXES;
387
- /**
388
- The set of glyphs making up a box border, for custom `borderStyle` objects.
389
- */
390
- type BoxGlyphs = {
391
- readonly topLeft: string;
392
- readonly top: string;
393
- readonly topRight: string;
394
- readonly right: string;
395
- readonly bottomRight: string;
396
- readonly bottom: string;
397
- readonly bottomLeft: string;
398
- readonly left: string;
311
+ //#region src/semantic-text-style.d.ts
312
+ type SemanticTextStyle = {
313
+ readonly foreground?: Paint;
314
+ readonly background?: Paint;
315
+ readonly resetForeground?: boolean;
316
+ readonly resetBackground?: boolean;
317
+ readonly underline?: CellStyle["underline"];
318
+ readonly attributes: number;
399
319
  };
400
320
  //#endregion
401
- //#region src/types.d.ts
402
- /**
403
- Allows creating a union type by combining primitive types and literal types
404
- without sacrificing auto-completion in IDEs for the literal type part of the
405
- union.
406
- */
407
- type LiteralUnion<LiteralType, BaseType extends string | number> = LiteralType | (BaseType & Record<never, never>);
408
- //#endregion
409
- //#region src/styles.d.ts
410
- type Styles = {
411
- readonly textWrap?: "wrap" | "hard" | "truncate-end" | "truncate" | "truncate-middle" | "truncate-start";
412
- /**
413
- Controls how the element is positioned.
414
-
415
- When `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.
416
- */
417
- readonly position?: "absolute" | "relative" | "static";
418
- /**
419
- Top offset for positioned elements.
420
- */
421
- readonly top?: number | string;
422
- /**
423
- Right offset for positioned elements.
424
- */
425
- readonly right?: number | string;
426
- /**
427
- Bottom offset for positioned elements.
428
- */
429
- readonly bottom?: number | string;
430
- /**
431
- Left offset for positioned elements.
432
- */
433
- readonly left?: number | string;
434
- /**
435
- Size of the gap between an element's columns.
436
- */
437
- readonly columnGap?: number;
438
- /**
439
- Size of the gap between an element's rows.
440
- */
441
- readonly rowGap?: number;
442
- /**
443
- Size of the gap between an element's columns and rows. A shorthand for `columnGap` and `rowGap`.
444
- */
445
- readonly gap?: number;
446
- /**
447
- Margin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft`, and `marginRight`.
448
- */
449
- readonly margin?: number;
450
- /**
451
- Horizontal margin. Equivalent to setting `marginLeft` and `marginRight`.
452
- */
453
- readonly marginX?: number;
454
- /**
455
- Vertical margin. Equivalent to setting `marginTop` and `marginBottom`.
456
- */
457
- readonly marginY?: number;
458
- /**
459
- Top margin.
460
- */
461
- readonly marginTop?: number;
462
- /**
463
- Bottom margin.
464
- */
465
- readonly marginBottom?: number;
466
- /**
467
- Left margin.
468
- */
469
- readonly marginLeft?: number;
470
- /**
471
- Right margin.
472
- */
473
- readonly marginRight?: number;
474
- /**
475
- Padding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft`, and `paddingRight`.
476
- */
477
- readonly padding?: number;
478
- /**
479
- Horizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.
480
- */
481
- readonly paddingX?: number;
482
- /**
483
- Vertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.
484
- */
485
- readonly paddingY?: number;
486
- /**
487
- Top padding.
488
- */
489
- readonly paddingTop?: number;
490
- /**
491
- Bottom padding.
492
- */
493
- readonly paddingBottom?: number;
494
- /**
495
- Left padding.
496
- */
497
- readonly paddingLeft?: number;
498
- /**
499
- Right padding.
500
- */
501
- readonly paddingRight?: number;
502
- /**
503
- This property defines the ability for a flex item to grow if necessary.
504
- See [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).
505
- */
506
- readonly flexGrow?: number;
507
- /**
508
- It specifies the “flex shrink factor”, which determines how much the flex item will shrink relative to the rest of the flex items in the flex container when there isn't enough space on the row.
509
- See [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).
510
- */
511
- readonly flexShrink?: number;
512
- /**
513
- It establishes the main-axis, thus defining the direction flex items are placed in the flex container.
514
- See [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).
515
- */
516
- readonly flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
517
- /**
518
- It specifies the initial size of the flex item, before any available space is distributed according to the flex factors.
519
- See [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).
520
- */
521
- readonly flexBasis?: number | string;
522
- /**
523
- It defines whether the flex items are forced in a single line or can be flowed into multiple lines. If set to multiple lines, it also defines the cross-axis which determines the direction new lines are stacked in.
524
- See [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/).
525
- */
526
- readonly flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
527
- /**
528
- The align-items property defines the default behavior for how items are laid out along the cross axis (perpendicular to the main axis).
529
- See [align-items](https://css-tricks.com/almanac/properties/a/align-items/).
530
- */
531
- readonly alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
532
- /**
533
- It makes possible to override the align-items value for specific flex items.
534
- See [align-self](https://css-tricks.com/almanac/properties/a/align-self/).
535
- */
536
- readonly alignSelf?: "flex-start" | "center" | "flex-end" | "auto" | "stretch" | "baseline";
537
- /**
538
- It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
539
- See [align-content](https://css-tricks.com/almanac/properties/a/align-content/).
540
- */
541
- readonly alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly";
542
- /**
543
- It defines the alignment along the main axis.
544
- See [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).
545
- */
546
- readonly justifyContent?: "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "center";
547
- /**
548
- Width of the element in spaces. You can also set it as a percentage, which will calculate the width based on the width of the parent element.
549
- */
550
- readonly width?: number | string;
551
- /**
552
- Height of the element in lines (rows). You can also set it as a percentage, which will calculate the height based on the height of the parent element.
553
- */
554
- readonly height?: number | string;
555
- /**
556
- Sets a minimum width of the element.
557
- Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
558
- */
559
- readonly minWidth?: number | string;
560
- /**
561
- Sets a minimum height of the element in lines (rows). You can also set it as a percentage, which will calculate the minimum height based on the height of the parent element.
562
- */
563
- readonly minHeight?: number | string;
564
- /**
565
- Sets a maximum width of the element.
566
- Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
567
- */
568
- readonly maxWidth?: number | string;
569
- /**
570
- Sets a maximum height of the element in lines (rows). You can also set it as a percentage, which will calculate the maximum height based on the height of the parent element.
571
- */
572
- readonly maxHeight?: number | string;
573
- /**
574
- Defines the aspect ratio (width/height) for the element.
575
-
576
- Use it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.
577
- */
578
- readonly aspectRatio?: number;
579
- /**
580
- Set this property to `none` to hide the element.
581
- */
582
- readonly display?: "flex" | "none";
583
- /**
584
- Add a border with a specified style. If `borderStyle` is `undefined` (the default), no border will be added.
585
- */
586
- readonly borderStyle?: BoxStyle | BoxGlyphs;
587
- /**
588
- Determines whether the top border is visible.
589
-
590
- @default true
591
- */
592
- readonly borderTop?: boolean;
593
- /**
594
- Determines whether the bottom border is visible.
595
-
596
- @default true
597
- */
598
- readonly borderBottom?: boolean;
599
- /**
600
- Determines whether the left border is visible.
601
-
602
- @default true
603
- */
604
- readonly borderLeft?: boolean;
605
- /**
606
- Determines whether the right border is visible.
607
-
608
- @default true
609
- */
610
- readonly borderRight?: boolean;
611
- /**
612
- Change border color. A shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor`, and `borderLeftColor`.
613
- */
614
- readonly borderColor?: LiteralUnion<ForegroundColorName, string>;
615
- /**
616
- Change the top border color. Accepts the same values as `color` in `Text` component.
617
- */
618
- readonly borderTopColor?: LiteralUnion<ForegroundColorName, string>;
619
- /**
620
- Change the bottom border color. Accepts the same values as `color` in `Text` component.
621
- */
622
- readonly borderBottomColor?: LiteralUnion<ForegroundColorName, string>;
623
- /**
624
- Change the left border color. Accepts the same values as `color` in `Text` component.
625
- */
626
- readonly borderLeftColor?: LiteralUnion<ForegroundColorName, string>;
627
- /**
628
- Change the right border color. Accepts the same values as `color` in `Text` component.
629
- */
630
- readonly borderRightColor?: LiteralUnion<ForegroundColorName, string>;
631
- /**
632
- Dim the border color. A shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor`, and `borderRightDimColor`.
633
-
634
- @default false
635
- */
636
- readonly borderDimColor?: boolean;
637
- /**
638
- Dim the top border color.
639
-
640
- @default false
641
- */
642
- readonly borderTopDimColor?: boolean;
643
- /**
644
- Dim the bottom border color.
645
-
646
- @default false
647
- */
648
- readonly borderBottomDimColor?: boolean;
649
- /**
650
- Dim the left border color.
651
-
652
- @default false
653
- */
654
- readonly borderLeftDimColor?: boolean;
655
- /**
656
- Dim the right border color.
657
-
658
- @default false
659
- */
660
- readonly borderRightDimColor?: boolean;
661
- /**
662
- Change border background color. A shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.
663
- */
664
- readonly borderBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
665
- /**
666
- Change top border background color. Accepts the same values as `backgroundColor` in `Text` component.
667
- */
668
- readonly borderTopBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
669
- /**
670
- Change bottom border background color. Accepts the same values as `backgroundColor` in `Text` component.
671
- */
672
- readonly borderBottomBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
673
- /**
674
- Change left border background color. Accepts the same values as `backgroundColor` in `Text` component.
675
- */
676
- readonly borderLeftBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
677
- /**
678
- Change right border background color. Accepts the same values as `backgroundColor` in `Text` component.
679
- */
680
- readonly borderRightBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
681
- /**
682
- Behavior for an element's overflow in both directions.
683
-
684
- @default 'visible'
685
- */
686
- readonly overflow?: "visible" | "hidden";
687
- /**
688
- Behavior for an element's overflow in the horizontal direction.
689
-
690
- @default 'visible'
691
- */
692
- readonly overflowX?: "visible" | "hidden";
693
- /**
694
- Behavior for an element's overflow in the vertical direction.
695
-
696
- @default 'visible'
697
- */
698
- readonly overflowY?: "visible" | "hidden";
699
- /**
700
- Background color for the element.
701
-
702
- Accepts the same values as `color` in the `<Text>` component.
703
- */
704
- readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
705
- };
321
+ //#region src/transform-adapter.d.ts
322
+ type AnsiTransformer = (text: string, line: number) => string;
706
323
  //#endregion
707
324
  //#region src/dom.d.ts
708
325
  type InkNode = {
@@ -719,7 +336,9 @@ type DOMElement = {
719
336
  nodeName: ElementNames;
720
337
  attributes: Record<string, DOMNodeAttribute>;
721
338
  childNodes: DOMNode[];
722
- internal_transform?: OutputTransformer;
339
+ internal_ansi?: boolean;
340
+ internal_transform?: AnsiTransformer;
341
+ internal_textStyle?: SemanticTextStyle;
723
342
  internal_accessibility?: {
724
343
  role?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
725
344
  state?: {
@@ -755,7 +374,7 @@ type DOMNode<T = {
755
374
  type DOMNodeAttribute = boolean | string | number;
756
375
  //#endregion
757
376
  //#region src/components/Box.d.ts
758
- type Props$1 = Omit<Styles, "textWrap"> & {
377
+ type Props$2 = Omit<Styles, "textWrap"> & {
759
378
  /**
760
379
  A label for the element for screen readers.
761
380
  */
@@ -786,62 +405,23 @@ type Props$1 = Omit<Styles, "textWrap"> & {
786
405
  /**
787
406
  `<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
788
407
  */
789
- declare function Box({ children, ref, backgroundColor, "aria-label": ariaLabel, "aria-hidden": ariaHidden, "aria-role": role, "aria-state": ariaState, ...style }: PropsWithChildren<Props$1> & {
408
+ declare function Box({ children, ref, backgroundColor, "aria-label": ariaLabel, "aria-hidden": ariaHidden, "aria-role": role, "aria-state": ariaState, ...style }: PropsWithChildren<Props$2> & {
790
409
  readonly ref?: Ref<DOMElement>;
791
410
  }): import("react").JSX.Element | null;
792
411
  //#endregion
793
- //#region src/components/Text.d.ts
794
- type Props$6 = {
795
- /**
796
- A label for the element for screen readers.
797
- */
412
+ //#region src/components/AnsiText.d.ts
413
+ type Props = {
414
+ /** External text containing ANSI SGR styling or OSC 8 hyperlinks. */
415
+ readonly children: string;
416
+ readonly wrap?: Styles["textWrap"];
798
417
  readonly "aria-label"?: string;
799
- /**
800
- Hide the element from screen readers.
801
- */
802
418
  readonly "aria-hidden"?: boolean;
803
- /**
804
- Change text color. Ink uses Chalk under the hood, so all its functionality is supported.
805
- */
806
- readonly color?: LiteralUnion<ForegroundColorName, string>;
807
- /**
808
- Same as `color`, but for the background.
809
- */
810
- readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
811
- /**
812
- Dim the color (make it less bright).
813
- */
814
- readonly dimColor?: boolean;
815
- /**
816
- Make the text bold.
817
- */
818
- readonly bold?: boolean;
819
- /**
820
- Make the text italic.
821
- */
822
- readonly italic?: boolean;
823
- /**
824
- Make the text underlined.
825
- */
826
- readonly underline?: boolean;
827
- /**
828
- Make the text crossed out with a line.
829
- */
830
- readonly strikethrough?: boolean;
831
- /**
832
- Inverse background and foreground colors.
833
- */
834
- readonly inverse?: boolean;
835
- /**
836
- This property tells Ink to wrap or truncate text if its width is larger than the container. If `wrap` is passed (the default), Ink will wrap text and split it into multiple lines. If `hard` is passed, Ink will fill each line to the full column width, breaking words as necessary. If `truncate-*` is passed, Ink will truncate text instead, resulting in one line of text with the rest cut off.
837
- */
838
- readonly wrap?: Styles["textWrap"];
839
- readonly children?: ReactNode;
840
419
  };
841
420
  /**
842
- This component can display text and change its style to make it bold, underlined, italic, or strikethrough.
843
- */
844
- declare function Text({ color, backgroundColor, dimColor, bold, italic, underline, strikethrough, inverse, wrap, children, "aria-label": ariaLabel, "aria-hidden": ariaHidden }: Props$6): import("react").JSX.Element | null;
421
+ * Renders explicitly trusted ANSI-styled output as structured terminal cells.
422
+ * Ordinary `Text` continues to strip terminal control sequences.
423
+ */
424
+ declare function AnsiText({ children, wrap, "aria-label": ariaLabel, "aria-hidden": ariaHidden }: Props): import("react").JSX.Element | null;
845
425
  //#endregion
846
426
  //#region src/components/AppContext.d.ts
847
427
  /**
@@ -862,7 +442,7 @@ type SuspendTerminal = {
862
442
  (callback: () => void | Promise<void>): Promise<void>;
863
443
  (): Promise<TerminalSuspension>;
864
444
  };
865
- type Props = {
445
+ type Props$1 = {
866
446
  /**
867
447
  Exit (unmount) the whole Ink app.
868
448
 
@@ -940,7 +520,7 @@ type PublicProps = {
940
520
  };
941
521
  //#endregion
942
522
  //#region src/components/StdoutContext.d.ts
943
- type Props$5 = {
523
+ type Props$7 = {
944
524
  /**
945
525
  Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
946
526
  */
@@ -952,7 +532,7 @@ type Props$5 = {
952
532
  };
953
533
  //#endregion
954
534
  //#region src/components/StderrContext.d.ts
955
- type Props$4 = {
535
+ type Props$6 = {
956
536
  /**
957
537
  Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
958
538
  */
@@ -964,7 +544,7 @@ type Props$4 = {
964
544
  };
965
545
  //#endregion
966
546
  //#region src/components/Static.d.ts
967
- type Props$3<T> = {
547
+ type Props$5<T> = {
968
548
  /**
969
549
  Array of items of any type to render using the function you pass as a component child.
970
550
  */
@@ -985,16 +565,16 @@ It's preferred to use `<Static>` for use cases like these when you can't know or
985
565
 
986
566
  For example, [Tap](https://github.com/tapjs/node-tap) uses `<Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
987
567
  */
988
- declare function Static<T>(props: Props$3<T>): import("react").JSX.Element;
568
+ declare function Static<T>(props: Props$5<T>): import("react").JSX.Element;
989
569
  //#endregion
990
570
  //#region src/components/Transform.d.ts
991
- type Props$7 = {
571
+ type Props$9 = {
992
572
  /**
993
573
  Screen-reader-specific text to output. If this is set, all children will be ignored.
994
574
  */
995
575
  readonly accessibilityLabel?: string;
996
576
  /**
997
- Function that transforms children output. It accepts children and must return transformed children as well. Note that when children use `<Text>` styling props (e.g. `color`, `bold`), the string will contain ANSI escape codes.
577
+ Compatibility function that transforms the ANSI serialization of this subtree.
998
578
  */
999
579
  readonly transform: (children: string, index: number) => string;
1000
580
  readonly children?: ReactNode;
@@ -1002,11 +582,38 @@ type Props$7 = {
1002
582
  /**
1003
583
  Transform a string representation of React components before they're written to output. For example, you might want to apply a gradient to text, add a clickable link, or create some text effects. These use cases can't accept React nodes as input; they expect a string. That's what the <Transform> component does: it gives you an output string of its child components and lets you transform it in any way.
1004
584
  */
1005
- declare function Transform({ children, transform, accessibilityLabel }: Props$7): import("react").JSX.Element | null;
585
+ declare function Transform({ children, transform, accessibilityLabel }: Props$9): import("react").JSX.Element | null;
586
+ //#endregion
587
+ //#region src/components/Hyperlink.d.ts
588
+ type Props$3 = Omit<Props$8, "children"> & {
589
+ /**
590
+ The URL the hyperlink points to.
591
+ */
592
+ readonly url: string;
593
+ /**
594
+ When the terminal does not support OSC 8 hyperlinks, append the URL in
595
+ parentheses after the text so it stays reachable. Set to `false` to render
596
+ the text alone.
597
+
598
+ @default true
599
+ */
600
+ readonly fallback?: boolean;
601
+ readonly children?: ReactNode;
602
+ };
603
+ /**
604
+ A clickable OSC 8 hyperlink — the counterpart to the router's `<Link>`, which
605
+ navigates between screens. On terminals without hyperlink support it falls
606
+ back to `text (url)`.
607
+
608
+ ```tsx
609
+ <Hyperlink url="https://example.com">Documentation</Hyperlink>
610
+ ```
611
+ */
612
+ declare function Hyperlink({ url, fallback, children, ...textProps }: Props$3): import("react").JSX.Element;
1006
613
  //#endregion
1007
614
  //#region src/components/Newline.d.ts
1008
615
  /** @jsxImportSource react */
1009
- type Props$2 = {
616
+ type Props$4 = {
1010
617
  /**
1011
618
  Number of newlines to insert.
1012
619
 
@@ -1017,7 +624,7 @@ type Props$2 = {
1017
624
  /**
1018
625
  Adds one or more newline (`\n`) characters. Must be used within `<Text>` components.
1019
626
  */
1020
- declare function Newline({ count }: Props$2): import("react").JSX.Element;
627
+ declare function Newline({ count }: Props$4): import("react").JSX.Element;
1021
628
  //#endregion
1022
629
  //#region src/components/Spacer.d.ts
1023
630
  /**
@@ -1027,6 +634,38 @@ It's useful as a shortcut for filling all the available space between elements.
1027
634
  */
1028
635
  declare function Spacer(): import("react").JSX.Element;
1029
636
  //#endregion
637
+ //#region src/hooks/use-capabilities.d.ts
638
+ /**
639
+ Returns everything knowable about the terminal: size, identity, platform,
640
+ color depth, theme, and feature support.
641
+
642
+ A thin wrapper over the framework-free capabilities store (`getCapabilities`):
643
+ environment-derived facts are available immediately; facts only the terminal
644
+ itself can answer fill in after a lazy one-time query, and re-mounting
645
+ consumers refreshes the dynamic facts (theme colors, pixel geometry).
646
+ Re-renders on terminal resize and whenever query answers arrive.
647
+ */
648
+ declare const useCapabilities: () => Capabilities;
649
+ /**
650
+ Calls `onChange` whenever the terminal changes: resizes (including in-band
651
+ pixel geometry), color scheme switches, window focus, and query answers
652
+ arriving. The React wrapper over `capabilities.subscribe()` for side effects —
653
+ for rendering, use `useCapabilities` instead.
654
+
655
+ The callback always sees the latest render's closure and changing it does not
656
+ resubscribe. Both the new and previous snapshot are passed, so handlers can
657
+ react to the specific change:
658
+
659
+ ```tsx
660
+ useCapabilitiesChange((next, previous) => {
661
+ if (next.theme.appearance !== previous.theme.appearance) {
662
+ // re-theme
663
+ }
664
+ });
665
+ ```
666
+ */
667
+ declare const useCapabilitiesChange: (onChange: (capabilities: Capabilities, previous: Capabilities) => void) => void;
668
+ //#endregion
1030
669
  //#region src/hooks/use-input.d.ts
1031
670
  /**
1032
671
  Handy information about a key that was pressed.
@@ -1200,7 +839,7 @@ declare const usePaste: (handler: (text: string) => void, options?: Options$1) =
1200
839
  /**
1201
840
  A React hook that returns app lifecycle methods like `exit()` and `waitUntilRenderFlush()`.
1202
841
  */
1203
- declare const useApp: () => Props;
842
+ declare const useApp: () => Props$1;
1204
843
  //#endregion
1205
844
  //#region src/hooks/use-stdin.d.ts
1206
845
  /**
@@ -1212,13 +851,13 @@ declare const useStdin: () => PublicProps;
1212
851
  /**
1213
852
  A React hook that returns the stdout stream where Ink renders your app.
1214
853
  */
1215
- declare const useStdout: () => Props$5;
854
+ declare const useStdout: () => Props$7;
1216
855
  //#endregion
1217
856
  //#region src/hooks/use-stderr.d.ts
1218
857
  /**
1219
858
  A React hook that returns the stderr stream.
1220
859
  */
1221
- declare const useStderr: () => Props$4;
860
+ declare const useStderr: () => Props$6;
1222
861
  //#endregion
1223
862
  //#region src/hooks/use-focus.d.ts
1224
863
  type Input = {
@@ -1252,7 +891,7 @@ A component that uses the `useFocus` hook becomes "focusable" to Ink, so when th
1252
891
  declare const useFocus: ({ isActive, autoFocus, id: customId }?: Input) => Output$2;
1253
892
  //#endregion
1254
893
  //#region src/components/FocusContext.d.ts
1255
- type Props$8 = {
894
+ type Props$10 = {
1256
895
  readonly activeId?: string;
1257
896
  readonly add: (id: string, options: {
1258
897
  autoFocus: boolean;
@@ -1272,23 +911,23 @@ type Output$1 = {
1272
911
  /**
1273
912
  Enable focus management for all components.
1274
913
  */
1275
- enableFocus: Props$8["enableFocus"];
914
+ enableFocus: Props$10["enableFocus"];
1276
915
  /**
1277
916
  Disable focus management for all components. The currently active component (if there's one) will lose its focus.
1278
917
  */
1279
- disableFocus: Props$8["disableFocus"];
918
+ disableFocus: Props$10["disableFocus"];
1280
919
  /**
1281
920
  Switch focus to the next focusable component. If there's no active component right now, focus will be given to the first focusable component. If the active component is the last in the list of focusable components, focus will be switched to the first focusable component.
1282
921
  */
1283
- focusNext: Props$8["focusNext"];
922
+ focusNext: Props$10["focusNext"];
1284
923
  /**
1285
924
  Switch focus to the previous focusable component. If there's no active component right now, focus will be given to the first focusable component. If the active component is the first in the list of focusable components, focus will be switched to the last focusable component.
1286
925
  */
1287
- focusPrevious: Props$8["focusPrevious"];
926
+ focusPrevious: Props$10["focusPrevious"];
1288
927
  /**
1289
928
  Switch focus to the element with provided `id`. If there's no element with that `id`, focus is not changed.
1290
929
  */
1291
- focus: Props$8["focus"];
930
+ focus: Props$10["focus"];
1292
931
  /**
1293
932
  The ID of the currently focused component, or `undefined` if no component is focused.
1294
933
 
@@ -1303,7 +942,7 @@ type Output$1 = {
1303
942
  };
1304
943
  ```
1305
944
  */
1306
- activeId: Props$8["activeId"];
945
+ activeId: Props$10["activeId"];
1307
946
  };
1308
947
  /**
1309
948
  A React hook that returns methods to enable or disable focus management for all components or manually switch focus to the next or previous components.
@@ -1317,12 +956,6 @@ This is useful when you want to render different output for screen readers.
1317
956
  */
1318
957
  declare const useIsScreenReaderEnabled: () => boolean;
1319
958
  //#endregion
1320
- //#region src/cursor-position.d.ts
1321
- type CursorPosition = {
1322
- x: number;
1323
- y: number;
1324
- };
1325
- //#endregion
1326
959
  //#region src/hooks/use-cursor.d.ts
1327
960
  /**
1328
961
  A React hook that returns methods to control the terminal cursor position.
@@ -1385,6 +1018,18 @@ const Spinner = () => {
1385
1018
  */
1386
1019
  declare function useAnimation(options?: Options): AnimationResult;
1387
1020
  //#endregion
1021
+ //#region src/hooks/use-terminal-osc.d.ts
1022
+ type ProgressOptions = {
1023
+ readonly state: TerminalProgressState;
1024
+ readonly value?: number;
1025
+ };
1026
+ declare const useProgress: ({ state, value }: ProgressOptions) => void;
1027
+ declare const useClipboard: () => ((text: string, selection?: ClipboardSelection) => void);
1028
+ declare const useTitle: (title?: string) => void;
1029
+ declare const useWorkingDirectory: (directory: URL | string) => void;
1030
+ declare const useNotification: () => ((title: string) => void);
1031
+ declare const usePointerShape: (shape: string) => void;
1032
+ //#endregion
1388
1033
  //#region src/hooks/use-window-size.d.ts
1389
1034
  /**
1390
1035
  Dimensions of the terminal window.
@@ -1491,4 +1136,4 @@ Note: `measureElement()` returns `{x: 0, y: 0, width: 0, height: 0}` when called
1491
1136
  */
1492
1137
  declare const measureElement: (node: DOMElement) => Output;
1493
1138
  //#endregion
1494
- export { type AnimationResult, type Props as AppProps, Box, type BoxMetrics, type Props$1 as BoxProps, type CapturedOutputSource, type CursorPosition, type DOMElement, type Output as ElementMetrics, type Instance, type Key, type KittyFlagName, type KittyKeyboardOptions, Newline, type Props$2 as NewlineProps, type RenderOptions, type RenderToStringOptions, Spacer, Static, type Props$3 as StaticProps, type Props$4 as StderrProps, type PublicProps as StdinProps, type Props$5 as StdoutProps, type SuspendTerminal, type TerminalSuspension, Text, type Props$6 as TextProps, Transform, type Props$7 as TransformProps, type UseBoxMetricsResult, type WindowSize, kittyFlags, kittyModifiers, measureElement, render, renderToString, useAnimation, useApp, useBoxMetrics, useCursor, useFocus, useFocusManager, useInput, useIsScreenReaderEnabled, usePaste, useStderr, useStdin, useStdout, useWindowSize };
1139
+ export { type AnimationResult, AnsiText, type Props as AnsiTextProps, type Props$1 as AppProps, Box, type BoxMetrics, type Props$2 as BoxProps, type Capabilities, type CapabilitiesStore, type CapturedOutputSource, type ColorInfo, type ColorSupport, type ColorSupportLevel, type CursorPosition, type DOMElement, type Output as ElementMetrics, Hyperlink, type Props$3 as HyperlinkProps, type Instance, type Key, type KittyFlagName, type KittyKeyboardOptions, type Multiplexer, Newline, type Props$4 as NewlineProps, type PixelGeometry, type PixelSize, type ProgressOptions, type RenderOptions, type RenderToStringOptions, type RgbColor, Spacer, Static, type Props$5 as StaticProps, type Props$6 as StderrProps, type PublicProps as StdinProps, type Props$7 as StdoutProps, type SuspendTerminal, type TerminalAppearance, type TerminalIdentity, type TerminalQueryOptions, type TerminalQueryResult, type TerminalSuspension, Text, type Props$8 as TextProps, Transform, type Props$9 as TransformProps, type UseBoxMetricsResult, type WindowSize, applyTerminalQuery, capabilities, createSupportsColor, detectCapabilities, detectColorLevel, detectHyperlinkSupport, detectTerminal, detectUnicodeSupport, getCapabilities, getTerminalQuery, kittyFlags, kittyModifiers, measureElement, queryTerminal, refreshTerminalQuery, render, renderToString, useAnimation, useApp, useBoxMetrics, useCapabilities, useCapabilitiesChange, useClipboard, useCursor, useFocus, useFocusManager, useInput, useIsScreenReaderEnabled, useNotification, usePaste, usePointerShape, useProgress, useStderr, useStdin, useStdout, useTitle, useWindowSize, useWorkingDirectory };