@alchemy.run/sigil 0.0.0-alpha.1 → 0.0.0-alpha.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 (121) hide show
  1. package/README.md +299 -299
  2. package/dist/ansi.d.ts +223 -0
  3. package/dist/ansi.js +2 -0
  4. package/dist/{devtools-QpCMm9JH.mjs → devtools-BhYGjb7h.js} +1 -1
  5. package/dist/index-DDVME65c.d.ts +919 -0
  6. package/dist/index.d.ts +1657 -0
  7. package/dist/index.js +4643 -0
  8. package/dist/sgr-CMfEpjSk.d.ts +91 -0
  9. package/dist/truncate-CBiyyZzw.js +2156 -0
  10. package/dist/yoga-5jKhYCJC.js +3465 -0
  11. package/dist/yoga.d.ts +2 -0
  12. package/dist/yoga.js +2 -0
  13. package/package.json +37 -17
  14. package/src/ansi/chalk.ts +179 -0
  15. package/src/ansi/cursor.ts +48 -0
  16. package/src/ansi/east-asian-width.ts +215 -0
  17. package/src/ansi/escapes.ts +128 -0
  18. package/src/ansi/index.ts +27 -0
  19. package/src/ansi/sgr.ts +237 -0
  20. package/src/ansi/slice.ts +43 -0
  21. package/src/ansi/string-width.ts +236 -0
  22. package/src/ansi/strip.ts +33 -0
  23. package/src/ansi/supports-color.ts +213 -0
  24. package/src/ansi/tokenize.ts +453 -0
  25. package/src/ansi/truncate.ts +194 -0
  26. package/src/ansi/widest-line.ts +12 -0
  27. package/src/ansi/wrap.ts +766 -0
  28. package/src/ansi-tokenizer.ts +510 -0
  29. package/src/auto-bind.ts +41 -0
  30. package/src/boxes.ts +100 -0
  31. package/src/code-excerpt.ts +39 -0
  32. package/src/colorize.ts +60 -0
  33. package/src/components/AccessibilityContext.ts +5 -0
  34. package/src/components/AnimationContext.ts +24 -0
  35. package/src/components/App.tsx +781 -0
  36. package/src/components/AppContext.ts +111 -0
  37. package/src/components/BackgroundContext.ts +8 -0
  38. package/src/components/Box.tsx +116 -0
  39. package/src/components/CursorContext.ts +19 -0
  40. package/src/components/ErrorBoundary.tsx +38 -0
  41. package/src/components/ErrorOverview.tsx +133 -0
  42. package/src/components/FocusContext.ts +30 -0
  43. package/src/components/Newline.tsx +15 -0
  44. package/src/components/Spacer.tsx +10 -0
  45. package/src/components/Static.tsx +59 -0
  46. package/src/components/StderrContext.ts +26 -0
  47. package/src/components/StdinContext.ts +49 -0
  48. package/src/components/StdoutContext.ts +28 -0
  49. package/src/components/Text.tsx +144 -0
  50. package/src/components/Transform.tsx +37 -0
  51. package/src/cursor-position.ts +103 -0
  52. package/src/devtools-window-polyfill.ts +73 -0
  53. package/src/devtools.ts +43 -0
  54. package/src/dom.ts +292 -0
  55. package/src/get-max-width.ts +11 -0
  56. package/src/global.d.ts +36 -0
  57. package/src/hooks/use-animation.ts +142 -0
  58. package/src/hooks/use-app.ts +8 -0
  59. package/src/hooks/use-box-metrics.ts +134 -0
  60. package/src/hooks/use-cursor.ts +33 -0
  61. package/src/hooks/use-focus-manager.ts +62 -0
  62. package/src/hooks/use-focus.ts +83 -0
  63. package/src/hooks/use-input.ts +267 -0
  64. package/src/hooks/use-is-screen-reader-enabled.ts +12 -0
  65. package/src/hooks/use-paste.ts +78 -0
  66. package/src/hooks/use-stderr.ts +8 -0
  67. package/src/hooks/use-stdin.ts +10 -0
  68. package/src/hooks/use-stdout.ts +8 -0
  69. package/src/hooks/use-window-size.ts +41 -0
  70. package/src/indent-string.ts +16 -0
  71. package/src/index.ts +44 -0
  72. package/src/ink.tsx +1506 -0
  73. package/src/input-parser.ts +283 -0
  74. package/src/instances.ts +9 -0
  75. package/src/is-in-ci.ts +7 -0
  76. package/src/kitty-keyboard.ts +57 -0
  77. package/src/log-update.ts +370 -0
  78. package/src/measure-element.ts +62 -0
  79. package/src/measure-text.ts +31 -0
  80. package/src/output.ts +308 -0
  81. package/src/parse-keypress.ts +516 -0
  82. package/src/parse-stack-line.ts +139 -0
  83. package/src/patch-console.ts +62 -0
  84. package/src/quick-lru.ts +85 -0
  85. package/src/reconciler.ts +451 -0
  86. package/src/render-background.ts +38 -0
  87. package/src/render-border.ts +134 -0
  88. package/src/render-node-to-output.ts +191 -0
  89. package/src/render-to-string.ts +131 -0
  90. package/src/render.ts +276 -0
  91. package/src/renderer.ts +73 -0
  92. package/src/sanitize-ansi.ts +33 -0
  93. package/src/signal-exit.ts +107 -0
  94. package/src/squash-text-nodes.ts +40 -0
  95. package/src/stream.ts +30 -0
  96. package/src/styles.ts +748 -0
  97. package/src/terminal-size.ts +57 -0
  98. package/src/throttle.ts +73 -0
  99. package/src/types.ts +15 -0
  100. package/src/utils.ts +40 -0
  101. package/src/wrap-text.ts +50 -0
  102. package/src/write-synchronized.ts +9 -0
  103. package/src/yoga/config.ts +57 -0
  104. package/src/yoga/core/absoluteLayout.ts +626 -0
  105. package/src/yoga/core/baseline.ts +66 -0
  106. package/src/yoga/core/cache.ts +136 -0
  107. package/src/yoga/core/calculateLayout.ts +2920 -0
  108. package/src/yoga/core/config.ts +104 -0
  109. package/src/yoga/core/flexLine.ts +177 -0
  110. package/src/yoga/core/helpers.ts +293 -0
  111. package/src/yoga/core/layoutResults.ts +167 -0
  112. package/src/yoga/core/node.ts +611 -0
  113. package/src/yoga/core/numeric.ts +44 -0
  114. package/src/yoga/core/pixelGrid.ts +151 -0
  115. package/src/yoga/core/style.ts +887 -0
  116. package/src/yoga/core/types.ts +224 -0
  117. package/src/yoga/generated/YGEnums.ts +263 -0
  118. package/src/yoga/index.ts +19 -0
  119. package/src/yoga/node.ts +1140 -0
  120. package/dist/index.d.mts +0 -2379
  121. package/dist/index.mjs +0 -10072
package/dist/ansi.d.ts ADDED
@@ -0,0 +1,223 @@
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;
9
+ };
10
+ type ColorInfo = ColorSupport | false;
11
+ declare const supportsColor: {
12
+ stdout: ColorInfo;
13
+ stderr: ColorInfo;
14
+ };
15
+ //#endregion
16
+ //#region src/ansi/chalk.d.ts
17
+ type StyleFunction = (text: string) => string;
18
+ type NamedStyles = Record<ModifierName | ForegroundColorName | BackgroundColorName, StyleFunction>;
19
+ type Chalk = NamedStyles & {
20
+ level: ColorSupportLevel;
21
+ hex: (color: string) => StyleFunction;
22
+ bgHex: (color: string) => StyleFunction;
23
+ rgb: (red: number, green: number, blue: number) => StyleFunction;
24
+ bgRgb: (red: number, green: number, blue: number) => StyleFunction;
25
+ ansi256: (code: number) => StyleFunction;
26
+ bgAnsi256: (code: number) => StyleFunction;
27
+ };
28
+ declare const chalk: Chalk;
29
+ //#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;
92
+ };
93
+ //#endregion
94
+ //#region src/ansi/cursor.d.ts
95
+ type CursorStream = {
96
+ isTTY?: boolean;
97
+ write: (data: string) => unknown;
98
+ };
99
+ declare const cliCursor: {
100
+ show(writableStream?: CursorStream): void;
101
+ hide(writableStream?: CursorStream): void;
102
+ };
103
+ //#endregion
104
+ //#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;
113
+ //#endregion
114
+ //#region src/ansi/east-asian-width.d.ts
115
+ type EastAsianWidthType = "ambiguous" | "fullwidth" | "halfwidth" | "narrow" | "neutral" | "wide";
116
+ declare const ambiguousMinimalCodePoint = 161;
117
+ declare const ambiguousMaximumCodePoint = 1114109;
118
+ declare const ambiguousRanges: readonly number[];
119
+ declare const fullwidthMinimalCodePoint = 12288;
120
+ declare const fullwidthMaximumCodePoint = 65510;
121
+ declare const fullwidthRanges: readonly number[];
122
+ declare const halfwidthMinimalCodePoint = 8361;
123
+ declare const halfwidthMaximumCodePoint = 65518;
124
+ declare const halfwidthRanges: readonly number[];
125
+ declare const narrowMinimalCodePoint = 32;
126
+ declare const narrowMaximumCodePoint = 10630;
127
+ declare const narrowRanges: readonly number[];
128
+ declare const wideMinimalCodePoint = 4352;
129
+ declare const wideMaximumCodePoint = 262141;
130
+ declare const wideRanges: readonly number[];
131
+ declare const isAmbiguous: (codePoint: number) => boolean;
132
+ declare const isFullWidth: (codePoint: number) => boolean;
133
+ declare const isWide: (codePoint: number) => boolean;
134
+ declare function getCategory(codePoint: number): EastAsianWidthType;
135
+ declare function eastAsianWidthType(codePoint: number): EastAsianWidthType;
136
+ declare function eastAsianWidth(codePoint: number, { ambiguousAsWide }?: {
137
+ ambiguousAsWide?: boolean;
138
+ }): 1 | 2;
139
+ declare function isFullwidthCodePoint(codePoint: number): boolean;
140
+ //#endregion
141
+ //#region src/ansi/strip.d.ts
142
+ declare function ansiRegex({ onlyFirst }?: {
143
+ onlyFirst?: boolean;
144
+ }): RegExp;
145
+ declare function stripAnsi(string: string): string;
146
+ //#endregion
147
+ //#region src/ansi/slice.d.ts
148
+ declare function sliceAnsi(string: string, start: number, end?: number): string;
149
+ //#endregion
150
+ //#region src/ansi/truncate.d.ts
151
+ type TruncateOptions = {
152
+ readonly position?: "start" | "middle" | "end";
153
+ readonly space?: boolean;
154
+ readonly preferTruncationOnSpace?: boolean;
155
+ readonly truncationCharacter?: string;
156
+ };
157
+ declare function cliTruncate(text: string, columns: number, options?: TruncateOptions): string;
158
+ //#endregion
159
+ //#region src/ansi/wrap.d.ts
160
+ type WrapOptions = {
161
+ readonly trim?: boolean;
162
+ readonly hard?: boolean;
163
+ readonly wordWrap?: boolean;
164
+ };
165
+ declare function wrapAnsi(string: string, columns: number, options?: WrapOptions): string;
166
+ //#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 };
package/dist/ansi.js ADDED
@@ -0,0 +1,2 @@
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 };
@@ -71,6 +71,6 @@ const isDevToolsReachable = async () => new Promise((resolve) => {
71
71
  if (await isDevToolsReachable()) {
72
72
  devtools.initialize();
73
73
  devtools.connectToDevTools();
74
- } else console.warn("DEV is set to true, but the React DevTools server is not running. Start it with:\n\n$ npx react-devtools\n");
74
+ } else console.warn("SIGIL_DEV is set to true, but the React DevTools server is not running. Start it with:\n\n$ npx react-devtools\n");
75
75
  //#endregion
76
76
  export {};