silvery 0.17.0 → 0.17.2

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 (171) hide show
  1. package/dist/UPNG-AVSMjiFE.mjs +5076 -0
  2. package/dist/UPNG-AVSMjiFE.mjs.map +1 -0
  3. package/dist/__vite-browser-external-2447137e-D3GdsvS_.mjs +6 -0
  4. package/dist/__vite-browser-external-2447137e-D3GdsvS_.mjs.map +1 -0
  5. package/dist/animation-C_PTO0uH.mjs +304 -0
  6. package/dist/animation-C_PTO0uH.mjs.map +1 -0
  7. package/dist/ansi-CXLE_pt1.mjs +71 -0
  8. package/dist/ansi-CXLE_pt1.mjs.map +1 -0
  9. package/dist/ansi-zmNzgkPB.d.mts +49 -0
  10. package/dist/ansi-zmNzgkPB.d.mts.map +1 -0
  11. package/dist/apng-DCWY913R.mjs +3 -0
  12. package/dist/apng-ENBAJk-H.mjs +70 -0
  13. package/dist/apng-ENBAJk-H.mjs.map +1 -0
  14. package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
  15. package/dist/backend-CkIkIHR-.mjs +13396 -0
  16. package/dist/backend-CkIkIHR-.mjs.map +1 -0
  17. package/dist/backends-CkvbG3js.mjs +1181 -0
  18. package/dist/backends-CkvbG3js.mjs.map +1 -0
  19. package/dist/backends-CyJqNLeK.mjs +3 -0
  20. package/dist/chunk-BSw8zbkd.mjs +37 -0
  21. package/dist/cli-B-k7Bm56.mjs +4 -0
  22. package/dist/context-QreF3UHr.mjs +64 -0
  23. package/dist/context-QreF3UHr.mjs.map +1 -0
  24. package/dist/derive-D7bFJdfU.d.mts +28 -0
  25. package/dist/derive-D7bFJdfU.d.mts.map +1 -0
  26. package/dist/devtools-CscuKaDK.mjs +89 -0
  27. package/dist/devtools-CscuKaDK.mjs.map +1 -0
  28. package/dist/devtools-D4oGc6LY.mjs +2 -0
  29. package/dist/eta-DLiVPaSD.mjs +110 -0
  30. package/dist/eta-DLiVPaSD.mjs.map +1 -0
  31. package/dist/flexily-zero-adapter-DmG4Ge8t.mjs +3376 -0
  32. package/dist/flexily-zero-adapter-DmG4Ge8t.mjs.map +1 -0
  33. package/dist/flexily-zero-adapter-GHwEW11s.mjs +2 -0
  34. package/dist/gif-BaJNREpP.mjs +3 -0
  35. package/dist/gif-Bp6fIyN3.mjs +73 -0
  36. package/dist/gif-Bp6fIyN3.mjs.map +1 -0
  37. package/dist/gifenc-GiVCZ9-3.mjs +730 -0
  38. package/dist/gifenc-GiVCZ9-3.mjs.map +1 -0
  39. package/dist/image-Dx7gYjkq.mjs +346 -0
  40. package/dist/image-Dx7gYjkq.mjs.map +1 -0
  41. package/dist/index-CBcSpGSM.d.mts +3416 -0
  42. package/dist/index-CBcSpGSM.d.mts.map +1 -0
  43. package/dist/index-DCVL3jHo.d.mts +634 -0
  44. package/dist/index-DCVL3jHo.d.mts.map +1 -0
  45. package/dist/index-p-wBs_wH.d.mts +175 -0
  46. package/dist/index-p-wBs_wH.d.mts.map +1 -0
  47. package/dist/index.d.mts +7296 -0
  48. package/dist/index.d.mts.map +1 -0
  49. package/dist/index.mjs +9399 -0
  50. package/dist/index.mjs.map +1 -0
  51. package/dist/key-mapping-BsUHe_nk.mjs +3 -0
  52. package/dist/key-mapping-DsyfLEdC.mjs +132 -0
  53. package/dist/key-mapping-DsyfLEdC.mjs.map +1 -0
  54. package/dist/layout-engine-B3dsnVLU.mjs +50 -0
  55. package/dist/layout-engine-B3dsnVLU.mjs.map +1 -0
  56. package/dist/layout-engine-D_lSR4i9.mjs +2 -0
  57. package/dist/multi-progress-C0-rkn86.d.mts +180 -0
  58. package/dist/multi-progress-C0-rkn86.d.mts.map +1 -0
  59. package/dist/multi-progress-CQVB9lES.mjs +219 -0
  60. package/dist/multi-progress-CQVB9lES.mjs.map +1 -0
  61. package/dist/node-Dedx-6xF.mjs +1085 -0
  62. package/dist/node-Dedx-6xF.mjs.map +1 -0
  63. package/dist/pipeline-DDOPrjuY.mjs +4387 -0
  64. package/dist/pipeline-DDOPrjuY.mjs.map +1 -0
  65. package/dist/progress-bar-COPSBlT9.mjs +155 -0
  66. package/dist/progress-bar-COPSBlT9.mjs.map +1 -0
  67. package/dist/reconciler-2lp5VXK7.mjs +16506 -0
  68. package/dist/reconciler-2lp5VXK7.mjs.map +1 -0
  69. package/dist/render-string-BXvxTg5P.mjs +201 -0
  70. package/dist/render-string-BXvxTg5P.mjs.map +1 -0
  71. package/dist/render-string-hvfpVtoP.mjs +2 -0
  72. package/dist/resvg-js-V6oMi8CY.mjs +203 -0
  73. package/dist/resvg-js-V6oMi8CY.mjs.map +1 -0
  74. package/dist/runtime-BjDHNTxJ.mjs +8723 -0
  75. package/dist/runtime-BjDHNTxJ.mjs.map +1 -0
  76. package/dist/runtime.d.mts +2 -0
  77. package/dist/runtime.mjs +3 -0
  78. package/dist/spinner-Cgej6Vnb.d.mts +127 -0
  79. package/dist/spinner-Cgej6Vnb.d.mts.map +1 -0
  80. package/dist/spinner-DSByknyx.mjs +298 -0
  81. package/dist/spinner-DSByknyx.mjs.map +1 -0
  82. package/dist/src-9B5k0JmY.mjs +1629 -0
  83. package/dist/src-9B5k0JmY.mjs.map +1 -0
  84. package/dist/src-C9f3hiVG.mjs +3620 -0
  85. package/dist/src-C9f3hiVG.mjs.map +1 -0
  86. package/dist/src-fJVbhdn-.mjs +816 -0
  87. package/dist/src-fJVbhdn-.mjs.map +1 -0
  88. package/dist/theme.d.mts +115 -0
  89. package/dist/theme.d.mts.map +1 -0
  90. package/dist/theme.mjs +8 -0
  91. package/dist/theme.mjs.map +1 -0
  92. package/dist/types-Bhj5QkIQ.mjs +13 -0
  93. package/dist/types-Bhj5QkIQ.mjs.map +1 -0
  94. package/dist/types-CDgkE-Rw.d.mts +241 -0
  95. package/dist/types-CDgkE-Rw.d.mts.map +1 -0
  96. package/dist/ui/animation.d.mts +2 -0
  97. package/dist/ui/animation.mjs +2 -0
  98. package/dist/ui/ansi.d.mts +2 -0
  99. package/dist/ui/ansi.mjs +2 -0
  100. package/dist/ui/cli.d.mts +5 -0
  101. package/dist/ui/cli.mjs +7 -0
  102. package/dist/ui/display.d.mts +35 -0
  103. package/dist/ui/display.d.mts.map +1 -0
  104. package/dist/ui/display.mjs +123 -0
  105. package/dist/ui/display.mjs.map +1 -0
  106. package/dist/ui/image.d.mts +2 -0
  107. package/dist/ui/image.mjs +2 -0
  108. package/dist/ui/input.d.mts +184 -0
  109. package/dist/ui/input.d.mts.map +1 -0
  110. package/dist/ui/input.mjs +285 -0
  111. package/dist/ui/input.mjs.map +1 -0
  112. package/dist/ui/progress.d.mts +249 -0
  113. package/dist/ui/progress.d.mts.map +1 -0
  114. package/dist/ui/progress.mjs +858 -0
  115. package/dist/ui/progress.mjs.map +1 -0
  116. package/dist/ui/react.d.mts +280 -0
  117. package/dist/ui/react.d.mts.map +1 -0
  118. package/dist/ui/react.mjs +413 -0
  119. package/dist/ui/react.mjs.map +1 -0
  120. package/dist/ui/utils.d.mts +86 -0
  121. package/dist/ui/utils.d.mts.map +1 -0
  122. package/dist/ui/utils.mjs +2 -0
  123. package/dist/ui/wrappers.d.mts +3 -0
  124. package/dist/ui/wrappers.mjs +2 -0
  125. package/dist/ui.d.mts +6 -0
  126. package/dist/ui.mjs +7 -0
  127. package/dist/useLatest-BMIYXd6e.d.mts +154 -0
  128. package/dist/useLatest-BMIYXd6e.d.mts.map +1 -0
  129. package/dist/useLayout-BG2cGl15.mjs +139 -0
  130. package/dist/useLayout-BG2cGl15.mjs.map +1 -0
  131. package/dist/with-text-input-CmHf_9d6.d.mts +284 -0
  132. package/dist/with-text-input-CmHf_9d6.d.mts.map +1 -0
  133. package/dist/wrapper-Dqh0zi2W.mjs +3527 -0
  134. package/dist/wrapper-Dqh0zi2W.mjs.map +1 -0
  135. package/dist/wrappers-hhL8EQ_n.mjs +810 -0
  136. package/dist/wrappers-hhL8EQ_n.mjs.map +1 -0
  137. package/dist/yoga-adapter-BJ9SOhTY.mjs +245 -0
  138. package/dist/yoga-adapter-BJ9SOhTY.mjs.map +1 -0
  139. package/dist/yoga-adapter-Daq6-dw1.mjs +2 -0
  140. package/package.json +48 -75
  141. package/CHANGELOG.md +0 -319
  142. package/dist/chalk.js +0 -4
  143. package/dist/index.js +0 -270
  144. package/dist/ink.js +0 -142
  145. package/dist/runtime.js +0 -135
  146. package/dist/theme.js +0 -7
  147. package/dist/ui/animation.js +0 -3
  148. package/dist/ui/ansi.js +0 -3
  149. package/dist/ui/cli.js +0 -9
  150. package/dist/ui/display.js +0 -4
  151. package/dist/ui/image.js +0 -4
  152. package/dist/ui/input.js +0 -3
  153. package/dist/ui/progress.js +0 -9
  154. package/dist/ui/react.js +0 -4
  155. package/dist/ui/utils.js +0 -3
  156. package/dist/ui/wrappers.js +0 -15
  157. package/dist/ui.js +0 -18
  158. package/src/index.ts +0 -73
  159. package/src/runtime.ts +0 -4
  160. package/src/theme.ts +0 -4
  161. package/src/ui/animation.ts +0 -2
  162. package/src/ui/ansi.ts +0 -2
  163. package/src/ui/cli.ts +0 -3
  164. package/src/ui/display.ts +0 -2
  165. package/src/ui/image.ts +0 -2
  166. package/src/ui/input.ts +0 -2
  167. package/src/ui/progress.ts +0 -2
  168. package/src/ui/react.ts +0 -2
  169. package/src/ui/utils.ts +0 -2
  170. package/src/ui/wrappers.ts +0 -2
  171. package/src/ui.ts +0 -4
@@ -0,0 +1,175 @@
1
+ import { JSX } from "react";
2
+
3
+ //#region packages/ag-react/src/ui/image/kitty-graphics.d.ts
4
+ /**
5
+ * Kitty Graphics Protocol
6
+ *
7
+ * Encodes and manages images using the Kitty terminal graphics protocol.
8
+ * Images are transmitted as base64-encoded PNG data via APC (Application
9
+ * Program Command) escape sequences.
10
+ *
11
+ * Protocol reference: https://sw.kovidgoyal.net/kitty/graphics-protocol/
12
+ *
13
+ * Key concepts:
14
+ * - `a=T` — transmit and display the image
15
+ * - `f=100` — format is PNG (raw PNG data, terminal decodes it)
16
+ * - `m=0|1` — 0 = last/only chunk, 1 = more chunks follow
17
+ * - Chunks should be <= 4096 bytes of base64 to avoid overwhelming the terminal
18
+ * - Images can be assigned an `i=<id>` for later deletion
19
+ */
20
+ interface KittyImageOptions {
21
+ /** Image width in terminal columns */
22
+ width?: number;
23
+ /** Image height in terminal rows */
24
+ height?: number;
25
+ /** Image ID for later reference/deletion (positive integer) */
26
+ id?: number;
27
+ }
28
+ /**
29
+ * Encode a PNG image into Kitty graphics protocol escape sequences.
30
+ *
31
+ * The image data is base64-encoded and split into chunks of <= 4096 bytes.
32
+ * Each chunk is wrapped in an APC escape sequence. The first chunk carries
33
+ * the image metadata (action, format, dimensions, ID). Subsequent chunks
34
+ * only carry `m=1` or `m=0` to indicate continuation.
35
+ *
36
+ * @param pngData - Raw PNG image data
37
+ * @param opts - Optional dimensions and ID
38
+ * @returns A string containing the complete escape sequence(s)
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * import { readFileSync } from "fs"
43
+ * import { encodeKittyImage } from "@silvery/ag-react"
44
+ *
45
+ * const png = readFileSync("photo.png")
46
+ * const seq = encodeKittyImage(png, { width: 40, height: 20 })
47
+ * process.stdout.write(seq)
48
+ * ```
49
+ */
50
+ declare function encodeKittyImage(pngData: Buffer, opts?: KittyImageOptions): string;
51
+ /**
52
+ * Generate an escape sequence to delete a Kitty image by ID.
53
+ *
54
+ * Uses `a=d` (delete) with `d=i` (delete by image ID).
55
+ *
56
+ * @param id - The image ID to delete
57
+ * @returns The delete escape sequence
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * process.stdout.write(deleteKittyImage(42))
62
+ * ```
63
+ */
64
+ declare function deleteKittyImage(id: number): string;
65
+ /**
66
+ * Check if the current terminal likely supports the Kitty graphics protocol.
67
+ *
68
+ * This is a heuristic based on `TERM` and `TERM_PROGRAM` environment variables.
69
+ * For definitive detection, use a terminal query (send the graphics protocol
70
+ * query and check for a response), but that requires async I/O.
71
+ *
72
+ * Known supporting terminals: Kitty, WezTerm, Ghostty (partial), Konsole (partial).
73
+ *
74
+ * @returns `true` if the terminal likely supports Kitty graphics
75
+ */
76
+ declare function isKittyGraphicsSupported(): boolean;
77
+ //#endregion
78
+ //#region packages/ag-react/src/ui/image/sixel-encoder.d.ts
79
+ /**
80
+ * Sixel Encoder (Minimal Implementation)
81
+ *
82
+ * Sixel is an older image protocol supported by terminals like xterm, mlterm,
83
+ * foot, and some others. Images are encoded as DCS (Device Control String)
84
+ * sequences where each character encodes 6 vertical pixels.
85
+ *
86
+ * DCS format: `ESC P <params> q <sixel-data> ESC \`
87
+ *
88
+ * This is a minimal implementation that produces valid Sixel output for
89
+ * simple images. For production use with complex images, consider using
90
+ * a dedicated Sixel library that handles color quantization and dithering.
91
+ *
92
+ * Protocol reference: https://en.wikipedia.org/wiki/Sixel
93
+ *
94
+ * TODO: Full Sixel encoding with proper color quantization, dithering,
95
+ * and compression. The current implementation handles basic RGBA image data
96
+ * with a simple nearest-color palette approach.
97
+ */
98
+ interface SixelImageData {
99
+ /** Image width in pixels */
100
+ width: number;
101
+ /** Image height in pixels */
102
+ height: number;
103
+ /** RGBA pixel data (4 bytes per pixel: R, G, B, A), row-major order */
104
+ data: Uint8Array;
105
+ }
106
+ /**
107
+ * Encode RGBA image data as a Sixel escape sequence.
108
+ *
109
+ * This is a basic implementation that:
110
+ * 1. Quantizes colors to a small palette (up to 256 colors)
111
+ * 2. Encodes 6-row bands as Sixel characters
112
+ * 3. Wraps in a DCS escape sequence
113
+ *
114
+ * For transparent pixels (alpha < 128), the background shows through.
115
+ *
116
+ * @param imageData - Image dimensions and RGBA pixel data
117
+ * @returns A DCS escape sequence containing the Sixel-encoded image
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const img = { width: 10, height: 12, data: new Uint8Array(10 * 12 * 4) }
122
+ * const seq = encodeSixel(img)
123
+ * process.stdout.write(seq)
124
+ * ```
125
+ */
126
+ declare function encodeSixel(imageData: SixelImageData): string;
127
+ /**
128
+ * Check if the current terminal likely supports the Sixel protocol.
129
+ *
130
+ * This is a heuristic based on environment variables. For definitive
131
+ * detection, send a DA1 (Device Attributes) query and check for "4"
132
+ * in the response, but that requires async I/O.
133
+ *
134
+ * Known supporting terminals: xterm (with +sixel), mlterm, foot, mintty,
135
+ * WezTerm, Contour, Sixel-enabled builds of various terminals.
136
+ *
137
+ * @returns `true` if the terminal likely supports Sixel
138
+ */
139
+ declare function isSixelSupported(): boolean;
140
+ //#endregion
141
+ //#region packages/ag-react/src/ui/image/Image.d.ts
142
+ type ImageProtocol = "kitty" | "sixel" | "auto";
143
+ interface ImageProps {
144
+ /** PNG image data (Buffer) or file path (string) to a PNG file */
145
+ src: Buffer | string;
146
+ /** Width in terminal columns. If omitted, uses available width from layout. */
147
+ width?: number;
148
+ /** Height in terminal rows. If omitted, defaults to half the width (rough aspect ratio). */
149
+ height?: number;
150
+ /** Text to display when image rendering is not supported. Default: "[image]" */
151
+ fallback?: string;
152
+ /** Which protocol to use. Default: "auto" (tries Kitty, then Sixel, then fallback) */
153
+ protocol?: ImageProtocol;
154
+ }
155
+ /**
156
+ * Renders a bitmap image in the terminal.
157
+ *
158
+ * The component operates in two phases:
159
+ * 1. **Layout phase**: Renders a Box that reserves the visual space
160
+ * (filled with spaces so the cell buffer has the right dimensions).
161
+ * 2. **Effect phase**: After render, writes the image escape sequence
162
+ * directly to stdout, positioned over the reserved space.
163
+ *
164
+ * When image protocols are not available, the fallback text is shown instead.
165
+ */
166
+ declare function Image({
167
+ src,
168
+ width: requestedWidth,
169
+ height: requestedHeight,
170
+ fallback,
171
+ protocol: preferredProtocol
172
+ }: ImageProps): JSX.Element;
173
+ //#endregion
174
+ export { isSixelSupported as a, encodeKittyImage as c, encodeSixel as i, isKittyGraphicsSupported as l, ImageProps as n, KittyImageOptions as o, SixelImageData as r, deleteKittyImage as s, Image as t };
175
+ //# sourceMappingURL=index-p-wBs_wH.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-p-wBs_wH.d.mts","names":[],"sources":["../packages/ag-react/src/ui/image/kitty-graphics.ts","../packages/ag-react/src/ui/image/sixel-encoder.ts","../packages/ag-react/src/ui/image/Image.tsx"],"mappings":";;;;;;AAuBA;;;;;;;;;AA+BA;;;;UA/BiB,iBAAA;EA+BgB;EA7B/B,KAAA;EA6BgD;EA3BhD,MAAA;EA2BwE;EAzBxE,EAAA;AAAA;;;;AAoFF;;;;;;;;ACvFA;;;;;;;;;;AA6BA;iBDDgB,gBAAA,CAAiB,OAAA,EAAS,MAAA,EAAQ,IAAA,GAAO,iBAAA;;;;ACsHzD;;;;;;;;ACrIA;;iBF2DgB,gBAAA,CAAiB,EAAA;;;AEzDjC;;;;;;;;;iBFwEgB,wBAAA,CAAA;;;;;;AA1FhB;;;;;;;;;AA+BA;;;;;;;UC5BiB,cAAA;ED4ByD;EC1BxE,KAAA;EDsEc;ECpEd,MAAA;;EAEA,IAAA,EAAM,UAAA;AAAA;ADiFR;;;;;;;;ACvFA;;;;;;;;;;AA6BA;;AD0DA,iBC1DgB,WAAA,CAAY,SAAA,EAAW,cAAA;;;AAqHvC;;;;;;;;ACrIA;;iBDqIgB,gBAAA,CAAA;;;KCrIJ,aAAA;AAAA,UAEK,UAAA;EFwEuB;EEtEtC,GAAA,EAAK,MAAA;;EAEL,KAAA;;EAEA,MAAA;EDrB6B;ECuB7B,QAAA;EDjBgB;ECmBhB,QAAA,GAAW,aAAA;AAAA;;;;;ADIb;;;;;AAqHA;;iBC9EgB,KAAA,CAAA;EACd,GAAA;EACA,KAAA,EAAO,cAAA;EACP,MAAA,EAAQ,eAAA;EACR,QAAA;EACA,QAAA,EAAU;AAAA,GACT,UAAA,GAAa,GAAA,CAAI,OAAA"}