@alchemy.run/sigil 0.0.0-alpha.3 → 0.0.0-alpha.5

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 +23 -13
  2. package/THIRD_PARTY_NOTICES.md +70 -23
  3. package/dist/Text-D5HUf3Fj.d.ts +452 -0
  4. package/dist/ansi.d.ts +137 -143
  5. package/dist/ansi.js +87 -2
  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/{devtools-BhYGjb7h.js → devtools-DbthxoD1.js} +22 -23
  20. package/dist/env-YVw64yZS.js +9 -0
  21. package/dist/escapes-CB_6CWOE.d.ts +72 -0
  22. package/dist/geometry-BxXOzJgo.d.ts +11 -0
  23. package/dist/index-Bmc2tRPk.d.ts +21 -0
  24. package/dist/index.d.ts +235 -754
  25. package/dist/index.js +1362 -3001
  26. package/dist/osc-CCH7xDoS.js +71 -0
  27. package/dist/osc-Cn0fw77g.d.ts +23 -0
  28. package/dist/paint-C19minOS.d.ts +81 -0
  29. package/dist/query-vaIeGOkH.d.ts +152 -0
  30. package/dist/router.d.ts +392 -0
  31. package/dist/router.js +709 -0
  32. package/dist/sample-Cqw1bjUL.js +445 -0
  33. package/dist/screen-BOh__-65.js +324 -0
  34. package/dist/screen-BReKIheE.d.ts +40 -0
  35. package/dist/screen.d.ts +5 -0
  36. package/dist/screen.js +5 -0
  37. package/dist/semantic-text-style-DIMzC7xt.js +91 -0
  38. package/dist/serialize-BTkAZgw1.js +79 -0
  39. package/dist/session-BJmzX2NJ.js +664 -0
  40. package/dist/sgr-BhwaWAJB.js +246 -0
  41. package/dist/store-CgrG9K4y.d.ts +72 -0
  42. package/dist/string-width-CijQwpIk.js +69 -0
  43. package/dist/strip-BvU4toXG.js +6 -0
  44. package/dist/terminal.d.ts +118 -0
  45. package/dist/terminal.js +2 -0
  46. package/dist/tokenize-AjqbvtiT.js +1242 -0
  47. package/dist/tokenize-Dx1y_l5H.d.ts +57 -0
  48. package/dist/truncate-D31fhU6i.js +562 -0
  49. package/dist/use-focus-C2sciZOo.js +1335 -0
  50. package/package.json +43 -17
  51. package/src/ansi/chalk.ts +12 -53
  52. package/src/ansi/cursor.ts +2 -4
  53. package/src/ansi/east-asian-width.ts +44 -0
  54. package/src/ansi/escapes.ts +18 -26
  55. package/src/ansi/graphemes.ts +8 -0
  56. package/src/ansi/hyperlink.ts +44 -0
  57. package/src/ansi/index.ts +14 -14
  58. package/src/ansi/osc.ts +77 -0
  59. package/src/ansi/sgr.ts +2 -5
  60. package/src/ansi/slice.ts +1 -1
  61. package/src/ansi/string-width.ts +91 -206
  62. package/src/ansi/strip.ts +13 -33
  63. package/src/ansi/tokenize.ts +96 -169
  64. package/src/ansi/truncate.ts +5 -3
  65. package/src/ansi/wrap.ts +13 -14
  66. package/src/ansi-tokenizer.ts +1 -1
  67. package/src/capabilities/color-policy.ts +34 -0
  68. package/src/capabilities/detect.ts +594 -0
  69. package/src/capabilities/index.ts +37 -0
  70. package/src/capabilities/query.ts +657 -0
  71. package/src/capabilities/store.ts +379 -0
  72. package/src/color/index.ts +3 -0
  73. package/src/color/paint.ts +169 -0
  74. package/src/color/palette.ts +48 -0
  75. package/src/color/sample.ts +323 -0
  76. package/src/color.ts +1 -0
  77. package/src/components/AnsiText.tsx +42 -0
  78. package/src/components/App.tsx +109 -22
  79. package/src/components/BackgroundContext.ts +2 -3
  80. package/src/components/Box.tsx +43 -60
  81. package/src/components/CursorContext.ts +1 -1
  82. package/src/components/ErrorBoundary.tsx +1 -1
  83. package/src/components/ErrorOverview.tsx +8 -7
  84. package/src/components/Hyperlink.tsx +56 -0
  85. package/src/components/Spacer.tsx +1 -1
  86. package/src/components/Static.tsx +1 -1
  87. package/src/components/StderrContext.ts +0 -2
  88. package/src/components/StdinContext.ts +0 -1
  89. package/src/components/StdoutContext.ts +1 -3
  90. package/src/components/TerminalOscContext.ts +25 -0
  91. package/src/components/Text.tsx +23 -46
  92. package/src/components/Transform.tsx +2 -2
  93. package/src/cursor-position.ts +1 -1
  94. package/src/devtools.ts +84 -24
  95. package/src/dom.ts +11 -8
  96. package/src/env.ts +12 -0
  97. package/src/get-max-width.ts +1 -1
  98. package/src/global.d.ts +6 -4
  99. package/src/{boxes.ts → glyphs.ts} +17 -18
  100. package/src/hooks/use-animation.ts +1 -1
  101. package/src/hooks/use-app.ts +1 -1
  102. package/src/hooks/use-box-metrics.ts +1 -1
  103. package/src/hooks/use-capabilities.ts +73 -0
  104. package/src/hooks/use-cursor.ts +3 -3
  105. package/src/hooks/use-focus-manager.ts +1 -1
  106. package/src/hooks/use-focus.ts +5 -6
  107. package/src/hooks/use-input.ts +4 -4
  108. package/src/hooks/use-is-screen-reader-enabled.ts +1 -1
  109. package/src/hooks/use-paste.ts +2 -2
  110. package/src/hooks/use-stderr.ts +1 -1
  111. package/src/hooks/use-stdin.ts +1 -1
  112. package/src/hooks/use-stdout.ts +1 -1
  113. package/src/hooks/use-terminal-osc.ts +59 -0
  114. package/src/hooks/use-window-size.ts +2 -2
  115. package/src/index.ts +88 -44
  116. package/src/ink.tsx +620 -745
  117. package/src/input-parser.ts +1 -1
  118. package/src/instances.ts +1 -1
  119. package/src/kitty-keyboard.ts +128 -0
  120. package/src/measure-element.ts +1 -1
  121. package/src/measure-text.ts +2 -2
  122. package/src/{render-node-to-output.ts → paint-tree.ts} +78 -53
  123. package/src/parse-keypress.ts +4 -5
  124. package/src/parse-stack-line.ts +0 -1
  125. package/src/patch-console.ts +44 -0
  126. package/src/reconciler.ts +36 -62
  127. package/src/render-background.ts +37 -16
  128. package/src/render-border.ts +97 -64
  129. package/src/render-frame.ts +83 -0
  130. package/src/render-to-string.ts +24 -9
  131. package/src/render.ts +24 -16
  132. package/src/router/components.tsx +343 -0
  133. package/src/router/context.ts +41 -0
  134. package/src/router/history.ts +194 -0
  135. package/src/router/hooks.tsx +391 -0
  136. package/src/router/index.ts +34 -0
  137. package/src/router/matcher.ts +571 -0
  138. package/src/sanitize-ansi.ts +1 -1
  139. package/src/screen/ansi.ts +184 -0
  140. package/src/screen/canvas.ts +137 -0
  141. package/src/screen/cell.ts +138 -0
  142. package/src/screen/color-profile.ts +47 -0
  143. package/src/screen/geometry.ts +9 -0
  144. package/src/screen/index.ts +6 -0
  145. package/src/screen/screen.ts +272 -0
  146. package/src/screen/serialize.ts +129 -0
  147. package/src/screen.ts +1 -0
  148. package/src/semantic-text-style.ts +118 -0
  149. package/src/signal-exit.ts +4 -5
  150. package/src/squash-text-nodes.ts +4 -7
  151. package/src/stream.ts +2 -4
  152. package/src/structured-text.ts +321 -0
  153. package/src/styles.ts +16 -17
  154. package/src/terminal/index.ts +2 -0
  155. package/src/terminal/inline-presenter.ts +120 -0
  156. package/src/terminal/input.ts +86 -0
  157. package/src/terminal/render-scheduler.ts +37 -0
  158. package/src/terminal/screen-presenter.ts +188 -0
  159. package/src/terminal/session.ts +407 -0
  160. package/src/terminal-size.ts +9 -8
  161. package/src/terminal.ts +1 -0
  162. package/src/testing/browser.ts +588 -0
  163. package/src/testing/emulators.ts +205 -0
  164. package/src/testing/explorer-app/index.html +12 -0
  165. package/src/testing/explorer-app/main.ts +381 -0
  166. package/src/testing/explorer-app/style.css +194 -0
  167. package/src/testing/explorer-app/tsconfig.json +15 -0
  168. package/src/testing/explorer-app/vite-env.d.ts +1 -0
  169. package/src/testing/index.ts +26 -0
  170. package/src/testing/keys.ts +56 -0
  171. package/src/testing/live.ts +85 -0
  172. package/src/testing/matchers.ts +70 -0
  173. package/src/testing/public.ts +94 -0
  174. package/src/testing/terminal.ts +349 -0
  175. package/src/testing/vitest.ts +157 -0
  176. package/src/transform-adapter.ts +14 -0
  177. package/src/types.ts +1 -6
  178. package/src/utils.ts +2 -2
  179. package/src/wrap-text.ts +4 -4
  180. package/src/yoga/config.ts +2 -2
  181. package/src/yoga/core/absoluteLayout.ts +15 -15
  182. package/src/yoga/core/baseline.ts +3 -3
  183. package/src/yoga/core/cache.ts +4 -4
  184. package/src/yoga/core/calculateLayout.ts +33 -27
  185. package/src/yoga/core/config.ts +1 -1
  186. package/src/yoga/core/flexLine.ts +3 -3
  187. package/src/yoga/core/helpers.ts +3 -3
  188. package/src/yoga/core/layoutResults.ts +4 -4
  189. package/src/yoga/core/node.ts +16 -16
  190. package/src/yoga/core/pixelGrid.ts +4 -4
  191. package/src/yoga/core/style.ts +11 -11
  192. package/src/yoga/core/types.ts +2 -2
  193. package/src/yoga/index.ts +6 -6
  194. package/src/yoga/node.ts +8 -8
  195. package/dist/sgr-CMfEpjSk.d.ts +0 -91
  196. package/dist/truncate-CBiyyZzw.js +0 -2156
  197. package/src/ansi/supports-color.ts +0 -213
  198. package/src/ansi/widest-line.ts +0 -12
  199. package/src/auto-bind.ts +0 -41
  200. package/src/colorize.ts +0 -60
  201. package/src/devtools-window-polyfill.ts +0 -73
  202. package/src/indent-string.ts +0 -16
  203. package/src/is-in-ci.ts +0 -7
  204. package/src/log-update.ts +0 -370
  205. package/src/output.ts +0 -308
  206. package/src/renderer.ts +0 -73
  207. package/src/write-synchronized.ts +0 -9
package/dist/ansi.d.ts CHANGED
@@ -1,17 +1,96 @@
1
- import { _ as rgbToAnsi256, a as StylePair, c as backgroundColorNames, d as foregroundColorNames, f as hexToAnsi, g as rgbToAnsi, h as modifierNames, i as StyleName, l as codes, m as hexToRgb, n as ForegroundColorName, o as ansi256ToAnsi, p as hexToAnsi256, r as ModifierName, s as background, t as BackgroundColorName, u as foreground, v as styles } from "./sgr-CMfEpjSk.js";
2
- //#region src/ansi/supports-color.d.ts
3
- type ColorSupportLevel = 0 | 1 | 2 | 3;
4
- type ColorSupport = {
5
- readonly level: ColorSupportLevel;
6
- readonly hasBasic: boolean;
7
- readonly has256: boolean;
8
- readonly has16m: boolean;
1
+ import { i as ColorSupportLevel, n as ColorInfo } from "./detect-Bh4yGP6w.js";
2
+ import { A as exitAlternativeScreen, C as enableBracketedPaste, D as eraseLines, E as eraseLine, F as popKittyKeyboard, I as pushKittyKeyboard, L as resetCursorColor, M as link, N as pasteEnd, O as eraseScreen, P as pasteStart, S as disableBracketedPaste, T as eraseEndLine, _ as cursorNextLine, a as CursorShape, b as cursorTo, c as OSC, d as bsu, f as clearTerminal, g as cursorLeft, h as cursorHide, i as CSI, j as kittyQuery, k as esu, l as ST, m as cursorDown, n as C1_CSI, o as DEL, p as cursorColor, r as C1_ST, s as ESC, t as BEL, u as ansiEscapes, v as cursorShape, w as enterAlternativeScreen, x as cursorUp, y as cursorShow } from "./escapes-CB_6CWOE.js";
3
+ import { a as queryClipboard, c as setTerminalProgress, d as tmuxPassthrough, i as notify, l as setWindowTitle, n as TerminalProgressState, o as setClipboard, r as clearClipboard, s as setPointerShape, t as ClipboardSelection, u as setWorkingDirectory } from "./osc-Cn0fw77g.js";
4
+ import { _ as tokenize, a as StyledChar, c as diffAnsiCodes, d as getLinkStartCode, f as isIntensityCode, g as styledCharsToString, h as styledCharsFromTokens, i as ControlToken, l as endCodesSet, m as reduceAnsiCodesIncremental, n as AnsiToken, o as Token, p as reduceAnsiCodes, r as CharToken, s as ansiCodesToString, t as AnsiCode, u as getEndCode, v as undoAnsiCodes } from "./tokenize-Dx1y_l5H.js";
5
+ //#region src/ansi/sgr.d.ts
6
+ type StylePair = {
7
+ readonly open: string;
8
+ readonly close: string;
9
9
  };
10
- type ColorInfo = ColorSupport | false;
11
- declare const supportsColor: {
12
- stdout: ColorInfo;
13
- stderr: ColorInfo;
10
+ declare const modifierCodes: {
11
+ readonly reset: readonly [0, 0];
12
+ readonly bold: readonly [1, 22];
13
+ readonly dim: readonly [2, 22];
14
+ readonly italic: readonly [3, 23];
15
+ readonly underline: readonly [4, 24];
16
+ readonly overline: readonly [53, 55];
17
+ readonly inverse: readonly [7, 27];
18
+ readonly hidden: readonly [8, 28];
19
+ readonly strikethrough: readonly [9, 29];
14
20
  };
21
+ declare const colorCodes: {
22
+ readonly black: readonly [30, 39];
23
+ readonly red: readonly [31, 39];
24
+ readonly green: readonly [32, 39];
25
+ readonly yellow: readonly [33, 39];
26
+ readonly blue: readonly [34, 39];
27
+ readonly magenta: readonly [35, 39];
28
+ readonly cyan: readonly [36, 39];
29
+ readonly white: readonly [37, 39];
30
+ readonly blackBright: readonly [90, 39];
31
+ readonly gray: readonly [90, 39];
32
+ readonly grey: readonly [90, 39];
33
+ readonly redBright: readonly [91, 39];
34
+ readonly greenBright: readonly [92, 39];
35
+ readonly yellowBright: readonly [93, 39];
36
+ readonly blueBright: readonly [94, 39];
37
+ readonly magentaBright: readonly [95, 39];
38
+ readonly cyanBright: readonly [96, 39];
39
+ readonly whiteBright: readonly [97, 39];
40
+ };
41
+ declare const bgColorCodes: {
42
+ readonly bgBlack: readonly [40, 49];
43
+ readonly bgRed: readonly [41, 49];
44
+ readonly bgGreen: readonly [42, 49];
45
+ readonly bgYellow: readonly [43, 49];
46
+ readonly bgBlue: readonly [44, 49];
47
+ readonly bgMagenta: readonly [45, 49];
48
+ readonly bgCyan: readonly [46, 49];
49
+ readonly bgWhite: readonly [47, 49];
50
+ readonly bgBlackBright: readonly [100, 49];
51
+ readonly bgGray: readonly [100, 49];
52
+ readonly bgGrey: readonly [100, 49];
53
+ readonly bgRedBright: readonly [101, 49];
54
+ readonly bgGreenBright: readonly [102, 49];
55
+ readonly bgYellowBright: readonly [103, 49];
56
+ readonly bgBlueBright: readonly [104, 49];
57
+ readonly bgMagentaBright: readonly [105, 49];
58
+ readonly bgCyanBright: readonly [106, 49];
59
+ readonly bgWhiteBright: readonly [107, 49];
60
+ };
61
+ type ModifierName = keyof typeof modifierCodes;
62
+ type ForegroundColorName = keyof typeof colorCodes;
63
+ type BackgroundColorName = keyof typeof bgColorCodes;
64
+ type StyleName = ModifierName | ForegroundColorName | BackgroundColorName;
65
+ declare const modifierNames: ModifierName[];
66
+ declare const foregroundColorNames: ForegroundColorName[];
67
+ declare const backgroundColorNames: BackgroundColorName[];
68
+ /**
69
+ Named SGR styles as `{open, close}` escape sequence pairs.
70
+ */
71
+ declare const styles: Record<StyleName, StylePair>;
72
+ /**
73
+ Raw SGR code numbers: open code → close code.
74
+ */
75
+ declare const codes: ReadonlyMap<number, number>;
76
+ declare const foreground: {
77
+ close: string;
78
+ ansi: (code: number) => string;
79
+ ansi256: (code: number) => string;
80
+ ansi16m: (red: number, green: number, blue: number) => string;
81
+ };
82
+ declare const background: {
83
+ close: string;
84
+ ansi: (code: number) => string;
85
+ ansi256: (code: number) => string;
86
+ ansi16m: (red: number, green: number, blue: number) => string;
87
+ };
88
+ declare const rgbToAnsi256: (red: number, green: number, blue: number) => number;
89
+ declare const hexToRgb: (hex: string) => [number, number, number];
90
+ declare const hexToAnsi256: (hex: string) => number;
91
+ declare const ansi256ToAnsi: (code: number) => number;
92
+ declare const rgbToAnsi: (red: number, green: number, blue: number) => number;
93
+ declare const hexToAnsi: (hex: string) => number;
15
94
  //#endregion
16
95
  //#region src/ansi/chalk.d.ts
17
96
  type StyleFunction = (text: string) => string;
@@ -26,70 +105,38 @@ type Chalk = NamedStyles & {
26
105
  bgAnsi256: (code: number) => StyleFunction;
27
106
  };
28
107
  declare const chalk: Chalk;
108
+ declare const supportsColor: ColorInfo;
29
109
  //#endregion
30
- //#region src/ansi/escapes.d.ts
31
- declare const ESC = "";
32
- declare const BEL = "";
33
- declare const DEL = "";
34
- /** Control Sequence Introducer. */
35
- declare const CSI = "[";
36
- /** Operating System Command. */
37
- declare const OSC = "]";
38
- /** String Terminator. */
39
- declare const ST = "\\";
40
- /** Single-byte C1 forms of CSI and ST. */
41
- declare const C1_CSI = "›";
42
- declare const C1_ST = "œ";
43
- declare const cursorTo: (x: number, y?: number) => string;
44
- declare const cursorUp: (count?: number) => string;
45
- declare const cursorDown: (count?: number) => string;
46
- declare const cursorLeft: string;
47
- declare const cursorNextLine: string;
48
- declare const eraseEndLine: string;
49
- declare const eraseLine: string;
50
- declare const eraseScreen: string;
51
- declare const eraseLines: (count: number) => string;
52
- declare const clearTerminal: string;
53
- declare const enterAlternativeScreen: string;
54
- declare const exitAlternativeScreen: string;
55
- declare const cursorShow: string;
56
- declare const cursorHide: string;
57
- declare const enableBracketedPaste: string;
58
- declare const disableBracketedPaste: string;
59
- declare const pasteStart: string;
60
- declare const pasteEnd: string;
61
- declare const bsu: string;
62
- declare const esu: string;
63
- declare const kittyQuery: string;
64
- declare const pushKittyKeyboard: (flags: number) => string;
65
- declare const popKittyKeyboard: string;
66
- declare const link: (text: string, url: string) => string;
67
- declare const ansiEscapes: {
68
- cursorTo: typeof cursorTo;
69
- cursorUp: typeof cursorUp;
70
- cursorDown: typeof cursorDown;
71
- cursorLeft: string;
72
- cursorNextLine: string;
73
- eraseEndLine: string;
74
- eraseLine: string;
75
- eraseScreen: string;
76
- eraseLines: typeof eraseLines;
77
- clearTerminal: string;
78
- enterAlternativeScreen: string;
79
- exitAlternativeScreen: string;
80
- cursorShow: string;
81
- cursorHide: string;
82
- enableBracketedPaste: string;
83
- disableBracketedPaste: string;
84
- pasteStart: string;
85
- pasteEnd: string;
86
- bsu: string;
87
- esu: string;
88
- kittyQuery: string;
89
- pushKittyKeyboard: typeof pushKittyKeyboard;
90
- popKittyKeyboard: string;
91
- link: typeof link;
110
+ //#region src/ansi/hyperlink.d.ts
111
+ type HyperlinkOptions = {
112
+ /**
113
+ When the terminal does not support OSC 8 hyperlinks, append the URL in
114
+ parentheses after the text so it stays reachable. Set to `false` to
115
+ return the text alone.
116
+
117
+ @default true
118
+ */
119
+ fallback?: boolean;
120
+ /**
121
+ The stream the text will be written to, for support detection.
122
+
123
+ @default process.stdout
124
+ */
125
+ stream?: {
126
+ isTTY?: boolean;
127
+ };
92
128
  };
129
+ /**
130
+ Wraps text in a clickable OSC 8 hyperlink when the terminal supports it,
131
+ falling back to `text (url)`.
132
+
133
+ ```ts
134
+ import { hyperlink } from "@alchemy.run/sigil/ansi";
135
+
136
+ console.log(hyperlink("Documentation", "https://example.com"));
137
+ ```
138
+ */
139
+ declare const hyperlink: (text: string, url: string, { fallback, stream }?: HyperlinkOptions) => string;
93
140
  //#endregion
94
141
  //#region src/ansi/cursor.d.ts
95
142
  type CursorStream = {
@@ -102,14 +149,8 @@ declare const cliCursor: {
102
149
  };
103
150
  //#endregion
104
151
  //#region src/ansi/string-width.d.ts
105
- type StringWidthOptions = {
106
- readonly ambiguousIsNarrow?: boolean;
107
- readonly countAnsiEscapeCodes?: boolean;
108
- };
109
- declare function stringWidth(input: string, options?: StringWidthOptions): number;
110
- //#endregion
111
- //#region src/ansi/widest-line.d.ts
112
- declare const widestLine: (string: string) => number;
152
+ declare const stringWidth: (input: string) => number;
153
+ declare const widestLine: (text: string) => number;
113
154
  //#endregion
114
155
  //#region src/ansi/east-asian-width.d.ts
115
156
  type EastAsianWidthType = "ambiguous" | "fullwidth" | "halfwidth" | "narrow" | "neutral" | "wide";
@@ -136,13 +177,22 @@ declare function eastAsianWidthType(codePoint: number): EastAsianWidthType;
136
177
  declare function eastAsianWidth(codePoint: number, { ambiguousAsWide }?: {
137
178
  ambiguousAsWide?: boolean;
138
179
  }): 1 | 2;
180
+ /**
181
+ Grapheme-cluster width test shared by the tokenizer (slice/clip path): the
182
+ base code point's East Asian Width, plus emoji presentation rules.
183
+ */
184
+ declare function isFullwidthGrapheme(grapheme: string, baseCodePoint: number): boolean;
185
+ /**
186
+ Wide code points not covered by string-width's CJKT script regex or emoji
187
+ regex — the fallback bucket of its block parser. A disjoint decomposition of
188
+ the `wide` table above, kept alongside it so the width data lives in one
189
+ module.
190
+ */
191
+ declare const isWideNotCJKTNotEmoji: (x: number) => boolean;
139
192
  declare function isFullwidthCodePoint(codePoint: number): boolean;
140
193
  //#endregion
141
194
  //#region src/ansi/strip.d.ts
142
- declare function ansiRegex({ onlyFirst }?: {
143
- onlyFirst?: boolean;
144
- }): RegExp;
145
- declare function stripAnsi(string: string): string;
195
+ declare const stripAnsi: (input: string) => string;
146
196
  //#endregion
147
197
  //#region src/ansi/slice.d.ts
148
198
  declare function sliceAnsi(string: string, start: number, end?: number): string;
@@ -164,60 +214,4 @@ type WrapOptions = {
164
214
  };
165
215
  declare function wrapAnsi(string: string, columns: number, options?: WrapOptions): string;
166
216
  //#endregion
167
- //#region src/ansi/tokenize.d.ts
168
- /**
169
- An ANSI code paired with the code that ends its effect.
170
- */
171
- type AnsiCode = {
172
- readonly code: string;
173
- readonly endCode: string;
174
- };
175
- type AnsiToken = AnsiCode & {
176
- readonly type: "ansi";
177
- };
178
- type ControlToken = {
179
- readonly type: "control";
180
- readonly code: string;
181
- };
182
- type CharToken = {
183
- readonly type: "char";
184
- readonly value: string;
185
- readonly fullWidth: boolean;
186
- };
187
- type Token = AnsiToken | ControlToken | CharToken;
188
- type StyledChar = CharToken & {
189
- readonly styles: AnsiCode[];
190
- };
191
- declare const endCodesSet: Set<string>;
192
- declare function getLinkStartCode(url: string, params?: Record<string, string>): string;
193
- declare function getEndCode(code: string): string;
194
- declare function ansiCodesToString(codes: readonly AnsiCode[]): string;
195
- /**
196
- Check if a code is an intensity code (bold or dim) — these share the end code
197
- `22m` but can coexist.
198
- */
199
- declare function isIntensityCode(code: AnsiCode): boolean;
200
- declare function tokenize(string: string, endChar?: number): Token[];
201
- /**
202
- Reduces the given array of ANSI codes to the minimum necessary to render with
203
- the same style.
204
- */
205
- declare function reduceAnsiCodes(codes: readonly AnsiCode[]): AnsiCode[];
206
- /**
207
- Like {@link reduceAnsiCodes}, but assumes that `codes` is already reduced.
208
- Further reductions are only done for the items in `newCodes`.
209
- */
210
- declare function reduceAnsiCodesIncremental(codes: readonly AnsiCode[], newCodes: readonly AnsiCode[]): AnsiCode[];
211
- /**
212
- Returns the combination of ANSI codes needed to undo the given ANSI codes.
213
- */
214
- declare function undoAnsiCodes(codes: readonly AnsiCode[]): AnsiCode[];
215
- /**
216
- Returns the minimum amount of ANSI codes necessary to get from the compound
217
- style `from` to `to`. Both are expected to be reduced.
218
- */
219
- declare function diffAnsiCodes(from: readonly AnsiCode[], to: readonly AnsiCode[]): AnsiCode[];
220
- declare function styledCharsFromTokens(tokens: readonly Token[]): StyledChar[];
221
- declare function styledCharsToString(chars: readonly StyledChar[]): string;
222
- //#endregion
223
- export { AnsiCode, AnsiToken, BEL, BackgroundColorName, C1_CSI, C1_ST, CSI, CharToken, ControlToken, DEL, ESC, EastAsianWidthType, ForegroundColorName, ModifierName, OSC, ST, StyleName, StylePair, StyledChar, Token, ambiguousMaximumCodePoint, ambiguousMinimalCodePoint, ambiguousRanges, ansi256ToAnsi, ansiCodesToString, ansiEscapes, ansiRegex, background, backgroundColorNames, bsu, chalk, clearTerminal, cliCursor, codes, cursorDown, cursorHide, cursorLeft, cursorNextLine, cursorShow, cursorTo, cursorUp, diffAnsiCodes, disableBracketedPaste, eastAsianWidth, eastAsianWidthType, enableBracketedPaste, endCodesSet, enterAlternativeScreen, eraseEndLine, eraseLine, eraseLines, eraseScreen, esu, exitAlternativeScreen, foreground, foregroundColorNames, fullwidthMaximumCodePoint, fullwidthMinimalCodePoint, fullwidthRanges, getCategory, getEndCode, getLinkStartCode, halfwidthMaximumCodePoint, halfwidthMinimalCodePoint, halfwidthRanges, hexToAnsi, hexToAnsi256, hexToRgb, isAmbiguous, isFullWidth, isFullwidthCodePoint, isIntensityCode, isWide, kittyQuery, link, modifierNames, narrowMaximumCodePoint, narrowMinimalCodePoint, narrowRanges, pasteEnd, pasteStart, popKittyKeyboard, pushKittyKeyboard, reduceAnsiCodes, reduceAnsiCodesIncremental, rgbToAnsi, rgbToAnsi256, sliceAnsi, stringWidth, stripAnsi, styledCharsFromTokens, styledCharsToString, styles, supportsColor, tokenize, cliTruncate as truncateAnsi, undoAnsiCodes, wideMaximumCodePoint, wideMinimalCodePoint, wideRanges, widestLine, wrapAnsi };
217
+ export { AnsiCode, AnsiToken, BEL, BackgroundColorName, C1_CSI, C1_ST, CSI, CharToken, ClipboardSelection, ControlToken, CursorShape, DEL, ESC, EastAsianWidthType, ForegroundColorName, ModifierName, OSC, ST, StyleName, StylePair, StyledChar, TerminalProgressState, Token, ambiguousMaximumCodePoint, ambiguousMinimalCodePoint, ambiguousRanges, ansi256ToAnsi, ansiCodesToString, ansiEscapes, background, backgroundColorNames, bsu, chalk, clearClipboard, clearTerminal, cliCursor, codes, cursorColor, cursorDown, cursorHide, cursorLeft, cursorNextLine, cursorShape, cursorShow, cursorTo, cursorUp, diffAnsiCodes, disableBracketedPaste, eastAsianWidth, eastAsianWidthType, enableBracketedPaste, endCodesSet, enterAlternativeScreen, eraseEndLine, eraseLine, eraseLines, eraseScreen, esu, exitAlternativeScreen, foreground, foregroundColorNames, fullwidthMaximumCodePoint, fullwidthMinimalCodePoint, fullwidthRanges, getCategory, getEndCode, getLinkStartCode, halfwidthMaximumCodePoint, halfwidthMinimalCodePoint, halfwidthRanges, hexToAnsi, hexToAnsi256, hexToRgb, hyperlink, isAmbiguous, isFullWidth, isFullwidthCodePoint, isFullwidthGrapheme, isIntensityCode, isWide, isWideNotCJKTNotEmoji, kittyQuery, link, modifierNames, narrowMaximumCodePoint, narrowMinimalCodePoint, narrowRanges, notify, pasteEnd, pasteStart, popKittyKeyboard, pushKittyKeyboard, queryClipboard, reduceAnsiCodes, reduceAnsiCodesIncremental, resetCursorColor, rgbToAnsi, rgbToAnsi256, setClipboard, setPointerShape, setTerminalProgress, setWindowTitle, setWorkingDirectory, sliceAnsi, stringWidth, stripAnsi, styledCharsFromTokens, styledCharsToString, styles, supportsColor, tmuxPassthrough, tokenize, cliTruncate as truncateAnsi, undoAnsiCodes, wideMaximumCodePoint, wideMinimalCodePoint, wideRanges, widestLine, wrapAnsi };
package/dist/ansi.js CHANGED
@@ -1,2 +1,87 @@
1
- import { $ as hexToAnsi256, A as fullwidthMinimalCodePoint, At as esu, B as narrowMaximumCodePoint, C as stripAnsi, Ct as disableBracketedPaste, D as eastAsianWidth, Dt as eraseLine, E as ambiguousRanges, Et as eraseEndLine, F as halfwidthRanges, Ft as pasteStart, G as wideRanges, H as narrowRanges, I as isAmbiguous, It as popKittyKeyboard, J as backgroundColorNames, K as ansi256ToAnsi, L as isFullWidth, Lt as pushKittyKeyboard, M as getCategory, Mt as kittyQuery, N as halfwidthMaximumCodePoint, Nt as link, O as eastAsianWidthType, Ot as eraseLines, P as halfwidthMinimalCodePoint, Pt as pasteEnd, Q as hexToAnsi, R as isFullwidthCodePoint, S as ansiRegex, St as cursorUp, T as ambiguousMinimalCodePoint, Tt as enterAlternativeScreen, U as wideMaximumCodePoint, V as narrowMinimalCodePoint, W as wideMinimalCodePoint, X as foreground, Y as codes, Z as foregroundColorNames, _ as supportsColor, _t as cursorHide, a as endCodesSet, at as BEL, b as wrapAnsi, bt as cursorShow, c as isIntensityCode, ct as CSI, d as styledCharsFromTokens, dt as OSC, et as hexToRgb, f as styledCharsToString, ft as ST, g as chalk, gt as cursorDown, h as widestLine, ht as clearTerminal, i as diffAnsiCodes, it as styles, j as fullwidthRanges, jt as exitAlternativeScreen, k as fullwidthMaximumCodePoint, kt as eraseScreen, l as reduceAnsiCodes, lt as DEL, m as undoAnsiCodes, mt as bsu, n as sliceAnsi, nt as rgbToAnsi, o as getEndCode, ot as C1_CSI, p as tokenize, pt as ansiEscapes, q as background, r as ansiCodesToString, rt as rgbToAnsi256, s as getLinkStartCode, st as C1_ST, t as cliTruncate, tt as modifierNames, u as reduceAnsiCodesIncremental, ut as ESC, v as cliCursor, vt as cursorLeft, w as ambiguousMaximumCodePoint, wt as enableBracketedPaste, x as stringWidth, xt as cursorTo, yt as cursorNextLine, z as isWide } from "./truncate-CBiyyZzw.js";
2
- export { BEL, C1_CSI, C1_ST, CSI, DEL, ESC, OSC, ST, ambiguousMaximumCodePoint, ambiguousMinimalCodePoint, ambiguousRanges, ansi256ToAnsi, ansiCodesToString, ansiEscapes, ansiRegex, background, backgroundColorNames, bsu, chalk, clearTerminal, cliCursor, codes, cursorDown, cursorHide, cursorLeft, cursorNextLine, cursorShow, cursorTo, cursorUp, diffAnsiCodes, disableBracketedPaste, eastAsianWidth, eastAsianWidthType, enableBracketedPaste, endCodesSet, enterAlternativeScreen, eraseEndLine, eraseLine, eraseLines, eraseScreen, esu, exitAlternativeScreen, foreground, foregroundColorNames, fullwidthMaximumCodePoint, fullwidthMinimalCodePoint, fullwidthRanges, getCategory, getEndCode, getLinkStartCode, halfwidthMaximumCodePoint, halfwidthMinimalCodePoint, halfwidthRanges, hexToAnsi, hexToAnsi256, hexToRgb, isAmbiguous, isFullWidth, isFullwidthCodePoint, isIntensityCode, isWide, kittyQuery, link, modifierNames, narrowMaximumCodePoint, narrowMinimalCodePoint, narrowRanges, pasteEnd, pasteStart, popKittyKeyboard, pushKittyKeyboard, reduceAnsiCodes, reduceAnsiCodesIncremental, rgbToAnsi, rgbToAnsi256, sliceAnsi, stringWidth, stripAnsi, styledCharsFromTokens, styledCharsToString, styles, supportsColor, tokenize, cliTruncate as truncateAnsi, undoAnsiCodes, wideMaximumCodePoint, wideMinimalCodePoint, wideRanges, widestLine, wrapAnsi };
1
+ import { A as cursorShape, B as eraseScreen, C as bsu, D as cursorHide, E as cursorDown, F as enableBracketedPaste, G as pasteEnd, H as exitAlternativeScreen, I as enterAlternativeScreen, J as pushKittyKeyboard, K as pasteStart, L as eraseEndLine, M as cursorTo, N as cursorUp, O as cursorLeft, P as disableBracketedPaste, R as eraseLine, S as ansiEscapes, T as cursorColor, U as kittyQuery, V as esu, W as link, Y as resetCursorColor, _ as CSI, a as foreground, b as OSC, c as hexToAnsi256, d as rgbToAnsi, f as rgbToAnsi256, g as C1_ST, h as C1_CSI, i as codes, j as cursorShow, k as cursorNextLine, l as hexToRgb, m as BEL, n as background, o as foregroundColorNames, p as styles, q as popKittyKeyboard, r as backgroundColorNames, s as hexToAnsi, t as ansi256ToAnsi, u as modifierNames, v as DEL, w as clearTerminal, x as ST, y as ESC, z as eraseLines } from "./sgr-BhwaWAJB.js";
2
+ import { A as isFullwidthCodePoint, C as fullwidthRanges, D as halfwidthRanges, E as halfwidthMinimalCodePoint, F as narrowMinimalCodePoint, I as narrowRanges, L as wideMaximumCodePoint, M as isWide, N as isWideNotCJKTNotEmoji, O as isAmbiguous, P as narrowMaximumCodePoint, R as wideMinimalCodePoint, S as fullwidthMinimalCodePoint, T as halfwidthMaximumCodePoint, _ as ambiguousMinimalCodePoint, a as getLinkStartCode, b as eastAsianWidthType, c as reduceAnsiCodesIncremental, d as tokenize, f as undoAnsiCodes, g as ambiguousMaximumCodePoint, i as getEndCode, j as isFullwidthGrapheme, k as isFullWidth, l as styledCharsFromTokens, n as diffAnsiCodes, o as isIntensityCode, r as endCodesSet, s as reduceAnsiCodes, t as ansiCodesToString, u as styledCharsToString, v as ambiguousRanges, w as getCategory, x as fullwidthMaximumCodePoint, y as eastAsianWidth, z as wideRanges } from "./tokenize-AjqbvtiT.js";
3
+ import { n as widestLine, t as stringWidth } from "./string-width-CijQwpIk.js";
4
+ import { n as sliceAnsi, r as wrapAnsi, t as cliTruncate } from "./truncate-D31fhU6i.js";
5
+ import { i as detectHyperlinkSupport, t as createSupportsColor } from "./detect-BuTXtY6e.js";
6
+ import { a as setPointerShape, c as setWorkingDirectory, i as setClipboard, l as tmuxPassthrough, n as notify, o as setTerminalProgress, r as queryClipboard, s as setWindowTitle, t as clearClipboard, u as cliCursor } from "./osc-CCH7xDoS.js";
7
+ import { t as stripAnsi } from "./strip-BvU4toXG.js";
8
+ import { isatty } from "node:tty";
9
+ //#region src/ansi/chalk.ts
10
+ const stdoutColor = createSupportsColor({ isTTY: isatty(1) });
11
+ const levelMapping = [
12
+ "ansi",
13
+ "ansi",
14
+ "ansi256",
15
+ "ansi16m"
16
+ ];
17
+ const state = { level: stdoutColor ? stdoutColor.level : 0 };
18
+ const applyStyle = (open, close, text) => {
19
+ if (state.level <= 0 || !text) return text;
20
+ let string = text;
21
+ if (string.includes("\x1B")) string = string.replaceAll(close, close + open);
22
+ if (string.includes("\n")) string = string.replaceAll(/\r?\n/g, `${close}$&${open}`);
23
+ return open + string + close;
24
+ };
25
+ const styleFunction = (open, close) => {
26
+ return (text) => applyStyle(open, close, text);
27
+ };
28
+ const foregroundOpen = (model, args) => {
29
+ return colorOpen(model, args, foreground, rgbToAnsi256, rgbToAnsi);
30
+ };
31
+ const backgroundOpen = (model, args) => {
32
+ return colorOpen(model, args, background, rgbToAnsi256, rgbToAnsi);
33
+ };
34
+ const colorOpen = (model, args, space, toAnsi256, toAnsi) => {
35
+ const rgb = typeof args[0] === "string" ? hexToRgb(args[0]) : args;
36
+ if (model === "ansi16m") return space.ansi16m(...rgb);
37
+ if (model === "ansi256") return space.ansi256(toAnsi256(...rgb));
38
+ return space.ansi(toAnsi(...rgb));
39
+ };
40
+ const named = {};
41
+ for (const name of [
42
+ ...modifierNames,
43
+ ...foregroundColorNames,
44
+ ...backgroundColorNames
45
+ ]) named[name] = styleFunction(styles[name].open, styles[name].close);
46
+ const chalk = {
47
+ ...named,
48
+ get level() {
49
+ return state.level;
50
+ },
51
+ set level(level) {
52
+ state.level = level;
53
+ },
54
+ hex: (color) => styleFunction(foregroundOpen(levelMapping[state.level], [color]), foreground.close),
55
+ bgHex: (color) => styleFunction(backgroundOpen(levelMapping[state.level], [color]), background.close),
56
+ rgb: (red, green, blue) => styleFunction(foregroundOpen(levelMapping[state.level], [
57
+ red,
58
+ green,
59
+ blue
60
+ ]), foreground.close),
61
+ bgRgb: (red, green, blue) => styleFunction(backgroundOpen(levelMapping[state.level], [
62
+ red,
63
+ green,
64
+ blue
65
+ ]), background.close),
66
+ ansi256: (code) => styleFunction(foreground.ansi256(code), foreground.close),
67
+ bgAnsi256: (code) => styleFunction(background.ansi256(code), background.close)
68
+ };
69
+ const supportsColor = stdoutColor;
70
+ //#endregion
71
+ //#region src/ansi/hyperlink.ts
72
+ /**
73
+ Wraps text in a clickable OSC 8 hyperlink when the terminal supports it,
74
+ falling back to `text (url)`.
75
+
76
+ ```ts
77
+ import { hyperlink } from "@alchemy.run/sigil/ansi";
78
+
79
+ console.log(hyperlink("Documentation", "https://example.com"));
80
+ ```
81
+ */
82
+ const hyperlink = (text, url, { fallback = true, stream = process.stdout } = {}) => {
83
+ if (detectHyperlinkSupport(stream)) return link(text, url);
84
+ return fallback ? `${text} (${url})` : text;
85
+ };
86
+ //#endregion
87
+ export { BEL, C1_CSI, C1_ST, CSI, DEL, ESC, OSC, ST, ambiguousMaximumCodePoint, ambiguousMinimalCodePoint, ambiguousRanges, ansi256ToAnsi, ansiCodesToString, ansiEscapes, background, backgroundColorNames, bsu, chalk, clearClipboard, clearTerminal, cliCursor, codes, cursorColor, cursorDown, cursorHide, cursorLeft, cursorNextLine, cursorShape, cursorShow, cursorTo, cursorUp, diffAnsiCodes, disableBracketedPaste, eastAsianWidth, eastAsianWidthType, enableBracketedPaste, endCodesSet, enterAlternativeScreen, eraseEndLine, eraseLine, eraseLines, eraseScreen, esu, exitAlternativeScreen, foreground, foregroundColorNames, fullwidthMaximumCodePoint, fullwidthMinimalCodePoint, fullwidthRanges, getCategory, getEndCode, getLinkStartCode, halfwidthMaximumCodePoint, halfwidthMinimalCodePoint, halfwidthRanges, hexToAnsi, hexToAnsi256, hexToRgb, hyperlink, isAmbiguous, isFullWidth, isFullwidthCodePoint, isFullwidthGrapheme, isIntensityCode, isWide, isWideNotCJKTNotEmoji, kittyQuery, link, modifierNames, narrowMaximumCodePoint, narrowMinimalCodePoint, narrowRanges, notify, pasteEnd, pasteStart, popKittyKeyboard, pushKittyKeyboard, queryClipboard, reduceAnsiCodes, reduceAnsiCodesIncremental, resetCursorColor, rgbToAnsi, rgbToAnsi256, setClipboard, setPointerShape, setTerminalProgress, setWindowTitle, setWorkingDirectory, sliceAnsi, stringWidth, stripAnsi, styledCharsFromTokens, styledCharsToString, styles, supportsColor, tmuxPassthrough, tokenize, cliTruncate as truncateAnsi, undoAnsiCodes, wideMaximumCodePoint, wideMinimalCodePoint, wideRanges, widestLine, wrapAnsi };
@@ -0,0 +1,5 @@
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 { 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";
3
+ import { n as capabilities, r as getCapabilities, t as CapabilitiesStore } from "./store-CgrG9K4y.js";
4
+ import { i as resolveColorProfile, n as ColorState, r as colorState, t as ColorPolicy } from "./color-policy-BMzMwV7Q.js";
5
+ export { type Capabilities, type CapabilitiesStore, type ColorInfo, type ColorPolicy, type ColorState, type ColorSupport, type ColorSupportLevel, type Multiplexer, type PixelGeometry, type PixelSize, type RgbColor, type TerminalAppearance, type TerminalIdentity, type TerminalQueryOptions, type TerminalQueryResult, applyTerminalQuery, capabilities, colorState, createSupportsColor, detectCapabilities, detectColorLevel, detectHyperlinkSupport, detectTerminal, detectUnicodeSupport, getCapabilities, getTerminalQuery, queryTerminal, refreshTerminalQuery, resolveColorProfile };
@@ -0,0 +1,3 @@
1
+ import { a as detectTerminal, i as detectHyperlinkSupport, n as detectCapabilities, o as detectUnicodeSupport, r as detectColorLevel, t as createSupportsColor } from "./detect-BuTXtY6e.js";
2
+ import { d as queryTerminal, f as refreshTerminalQuery, i as getCapabilities, l as getTerminalQuery, n as resolveColorProfile, r as capabilities, s as applyTerminalQuery, t as colorState } from "./color-policy-SVj1pYTA.js";
3
+ export { applyTerminalQuery, capabilities, colorState, createSupportsColor, detectCapabilities, detectColorLevel, detectHyperlinkSupport, detectTerminal, detectUnicodeSupport, getCapabilities, getTerminalQuery, queryTerminal, refreshTerminalQuery, resolveColorProfile };
@@ -0,0 +1,44 @@
1
+ //#region src/screen/cell.ts
2
+ /**
3
+ Bit flags for terminal text attributes. Multiple attributes may be combined.
4
+ */
5
+ const cellAttributes = {
6
+ none: 0,
7
+ bold: 1,
8
+ faint: 2,
9
+ italic: 4,
10
+ blink: 8,
11
+ rapidBlink: 16,
12
+ inverse: 32,
13
+ hidden: 64,
14
+ strikethrough: 128
15
+ };
16
+ const emptyCellStyle = {
17
+ underline: "none",
18
+ attributes: cellAttributes.none
19
+ };
20
+ const emptyCell = {
21
+ grapheme: " ",
22
+ width: 1,
23
+ style: emptyCellStyle
24
+ };
25
+ const createCell = (grapheme, width, style = emptyCellStyle, hyperlink, reset) => {
26
+ if (grapheme.length === 0) throw new Error("A cell must contain one grapheme cluster");
27
+ if (!Number.isInteger(width) || width < 1) throw new Error("A cell width must be a positive integer");
28
+ return {
29
+ grapheme,
30
+ width,
31
+ style,
32
+ ...hyperlink ? { hyperlink } : {},
33
+ ...reset ? { reset } : {}
34
+ };
35
+ };
36
+ const cellsEqual = (left, right) => {
37
+ if (left === right) return true;
38
+ if (!left || !right || left.grapheme !== right.grapheme || left.width !== right.width) return false;
39
+ const leftStyle = left.style;
40
+ const rightStyle = right.style;
41
+ return leftStyle.attributes === rightStyle.attributes && leftStyle.underline === rightStyle.underline && JSON.stringify(leftStyle.foreground) === JSON.stringify(rightStyle.foreground) && JSON.stringify(leftStyle.background) === JSON.stringify(rightStyle.background) && JSON.stringify(leftStyle.underlineColor) === JSON.stringify(rightStyle.underlineColor) && JSON.stringify(left.hyperlink) === JSON.stringify(right.hyperlink);
42
+ };
43
+ //#endregion
44
+ export { emptyCellStyle as a, emptyCell as i, cellsEqual as n, createCell as r, cellAttributes as t };
@@ -0,0 +1,2 @@
1
+ import "./sample-Cqw1bjUL.js";
2
+ export {};
@@ -0,0 +1,22 @@
1
+ import { i as ColorSupportLevel } from "./detect-Bh4yGP6w.js";
2
+ import { t as ColorProfile } from "./color-profile-u0Nhe9Nv.js";
3
+ //#region src/capabilities/color-policy.d.ts
4
+ /** A user-selected output policy. `auto` follows the target stream. */
5
+ type ColorPolicy = "auto" | ColorProfile;
6
+ /** The three distinct inputs and result of terminal color negotiation. */
7
+ type ColorState = {
8
+ /** The stream/terminal fact after environment and query detection. */
9
+ readonly detected: ColorProfile;
10
+ /** The application's policy for this render instance. */
11
+ readonly policy: ColorPolicy;
12
+ /** The profile the serializer must actually emit. */
13
+ readonly effective: ColorProfile;
14
+ };
15
+ declare function resolveColorProfile(detectedLevel: ColorSupportLevel, policy?: ColorPolicy): ColorProfile;
16
+ declare function colorState(capabilities: {
17
+ readonly color: {
18
+ readonly level: ColorSupportLevel;
19
+ };
20
+ }, policy?: ColorPolicy): ColorState;
21
+ //#endregion
22
+ export { resolveColorProfile as i, ColorState as n, colorState as r, ColorPolicy as t };