ink 6.7.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/build/ansi-tokenizer.d.ts +38 -0
  2. package/build/ansi-tokenizer.js +316 -0
  3. package/build/ansi-tokenizer.js.map +1 -0
  4. package/build/components/AnimationContext.d.ts +9 -0
  5. package/build/components/AnimationContext.js +13 -0
  6. package/build/components/AnimationContext.js.map +1 -0
  7. package/build/components/App.d.ts +5 -2
  8. package/build/components/App.js +192 -41
  9. package/build/components/App.js.map +1 -1
  10. package/build/components/AppContext.d.ts +33 -3
  11. package/build/components/AppContext.js +2 -1
  12. package/build/components/AppContext.js.map +1 -1
  13. package/build/components/Box.d.ts +16 -3
  14. package/build/components/ErrorBoundary.d.ts +2 -2
  15. package/build/components/ErrorOverview.js +6 -6
  16. package/build/components/ErrorOverview.js.map +1 -1
  17. package/build/components/Static.js.map +1 -1
  18. package/build/components/StdinContext.d.ts +7 -1
  19. package/build/components/StdinContext.js +1 -0
  20. package/build/components/StdinContext.js.map +1 -1
  21. package/build/components/Text.d.ts +1 -1
  22. package/build/components/Text.js +1 -1
  23. package/build/components/Text.js.map +1 -1
  24. package/build/components/Transform.d.ts +1 -1
  25. package/build/devtools-window-polyfill.js +7 -4
  26. package/build/devtools-window-polyfill.js.map +1 -1
  27. package/build/devtools.js +31 -6
  28. package/build/devtools.js.map +1 -1
  29. package/build/dom.d.ts +5 -1
  30. package/build/dom.js +25 -5
  31. package/build/dom.js.map +1 -1
  32. package/build/hooks/use-animation.d.ts +49 -0
  33. package/build/hooks/use-animation.js +87 -0
  34. package/build/hooks/use-animation.js.map +1 -0
  35. package/build/hooks/use-app.d.ts +5 -2
  36. package/build/hooks/use-app.js +1 -1
  37. package/build/hooks/use-box-metrics.d.ts +59 -0
  38. package/build/hooks/use-box-metrics.js +88 -0
  39. package/build/hooks/use-box-metrics.js.map +1 -0
  40. package/build/hooks/use-cursor.d.ts +1 -1
  41. package/build/hooks/use-cursor.js +1 -1
  42. package/build/hooks/use-focus-manager.d.ts +17 -2
  43. package/build/hooks/use-focus-manager.js +2 -1
  44. package/build/hooks/use-focus-manager.js.map +1 -1
  45. package/build/hooks/use-focus.d.ts +2 -1
  46. package/build/hooks/use-focus.js +5 -4
  47. package/build/hooks/use-focus.js.map +1 -1
  48. package/build/hooks/use-input.d.ts +2 -1
  49. package/build/hooks/use-input.js +82 -80
  50. package/build/hooks/use-input.js.map +1 -1
  51. package/build/hooks/use-is-screen-reader-enabled.d.ts +2 -1
  52. package/build/hooks/use-is-screen-reader-enabled.js +2 -1
  53. package/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
  54. package/build/hooks/use-paste.d.ts +35 -0
  55. package/build/hooks/use-paste.js +62 -0
  56. package/build/hooks/use-paste.js.map +1 -0
  57. package/build/hooks/use-stderr.d.ts +1 -1
  58. package/build/hooks/use-stderr.js +1 -1
  59. package/build/hooks/use-stdin.d.ts +4 -2
  60. package/build/hooks/use-stdin.js +2 -1
  61. package/build/hooks/use-stdin.js.map +1 -1
  62. package/build/hooks/use-stdout.d.ts +1 -1
  63. package/build/hooks/use-stdout.js +1 -1
  64. package/build/hooks/use-window-size.d.ts +18 -0
  65. package/build/hooks/use-window-size.js +22 -0
  66. package/build/hooks/use-window-size.js.map +1 -0
  67. package/build/index.d.ts +10 -1
  68. package/build/index.js +5 -0
  69. package/build/index.js.map +1 -1
  70. package/build/ink.d.ts +55 -6
  71. package/build/ink.js +433 -162
  72. package/build/ink.js.map +1 -1
  73. package/build/input-parser.d.ts +10 -0
  74. package/build/input-parser.js +194 -0
  75. package/build/input-parser.js.map +1 -0
  76. package/build/log-update.d.ts +1 -0
  77. package/build/log-update.js +13 -1
  78. package/build/log-update.js.map +1 -1
  79. package/build/measure-element.d.ts +4 -0
  80. package/build/measure-element.js +4 -0
  81. package/build/measure-element.js.map +1 -1
  82. package/build/output.d.ts +1 -0
  83. package/build/output.js +63 -5
  84. package/build/output.js.map +1 -1
  85. package/build/parse-keypress.d.ts +1 -3
  86. package/build/parse-keypress.js +19 -17
  87. package/build/parse-keypress.js.map +1 -1
  88. package/build/reconciler.js +48 -19
  89. package/build/reconciler.js.map +1 -1
  90. package/build/render-border.js +29 -18
  91. package/build/render-border.js.map +1 -1
  92. package/build/render-to-string.d.ts +38 -0
  93. package/build/render-to-string.js +116 -0
  94. package/build/render-to-string.js.map +1 -0
  95. package/build/render.d.ts +69 -3
  96. package/build/render.js +18 -11
  97. package/build/render.js.map +1 -1
  98. package/build/sanitize-ansi.d.ts +2 -0
  99. package/build/sanitize-ansi.js +27 -0
  100. package/build/sanitize-ansi.js.map +1 -0
  101. package/build/squash-text-nodes.js +2 -1
  102. package/build/squash-text-nodes.js.map +1 -1
  103. package/build/styles.d.ts +78 -16
  104. package/build/styles.js +102 -31
  105. package/build/styles.js.map +1 -1
  106. package/build/utils.d.ts +9 -0
  107. package/build/utils.js +19 -0
  108. package/build/utils.js.map +1 -0
  109. package/build/wrap-text.js +7 -0
  110. package/build/wrap-text.js.map +1 -1
  111. package/build/write-synchronized.d.ts +1 -1
  112. package/build/write-synchronized.js +4 -2
  113. package/build/write-synchronized.js.map +1 -1
  114. package/package.json +40 -101
  115. package/readme.md +674 -56
  116. package/build/apply-styles.js +0 -175
  117. package/build/build-layout.js +0 -77
  118. package/build/calculate-wrapped-text.js +0 -53
  119. package/build/components/Color.js +0 -62
  120. package/build/experimental/apply-style.js +0 -140
  121. package/build/experimental/dom.js +0 -123
  122. package/build/experimental/output.js +0 -91
  123. package/build/experimental/reconciler.js +0 -141
  124. package/build/experimental/renderer.js +0 -81
  125. package/build/hooks/useInput.js +0 -38
  126. package/build/instance.js +0 -205
  127. package/build/options.d.ts +0 -52
  128. package/build/options.js +0 -2
  129. package/build/options.js.map +0 -1
  130. package/build/screen-reader-update.d.ts +0 -13
  131. package/build/screen-reader-update.js +0 -38
  132. package/build/screen-reader-update.js.map +0 -1
package/build/render.d.ts CHANGED
@@ -34,11 +34,16 @@ export type RenderOptions = {
34
34
  /**
35
35
  Patch console methods to ensure console output doesn't mix with Ink's output.
36
36
 
37
+ Note: Once unmount starts, Ink restores the native console before React cleanup runs. Teardown-time `console.*` output then follows the normal console behavior instead of being rerouted through Ink.
38
+
37
39
  @default true
38
40
  */
39
41
  patchConsole?: boolean;
40
42
  /**
41
- Runs the given callback after each render and re-render.
43
+ Runs the given callback after each render and re-render with render metrics.
44
+
45
+ Note: this callback runs after Ink commits a frame, but it does not wait for `stdout`/`stderr` stream callbacks.
46
+ To run code after output is flushed, use `waitUntilRenderFlush()`.
42
47
  */
43
48
  onRender?: (metrics: RenderMetrics) => void;
44
49
  /**
@@ -70,7 +75,7 @@ export type RenderOptions = {
70
75
  - `useTransition` and `useDeferredValue` are fully functional
71
76
  - Updates can be interrupted for higher priority work
72
77
 
73
- Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `concurrent` option only takes effect on the first render for a given stdout. If you need to change the rendering mode, call `unmount()` first.
78
+ Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
74
79
 
75
80
  @default false
76
81
  */
@@ -83,6 +88,34 @@ export type RenderOptions = {
83
88
  @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
84
89
  */
85
90
  kittyKeyboard?: KittyKeyboardOptions;
91
+ /**
92
+ Override automatic interactive mode detection.
93
+
94
+ By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
95
+
96
+ When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
97
+
98
+ Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
99
+
100
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
101
+
102
+ @default true (false if in CI or `stdout.isTTY` is falsy)
103
+ */
104
+ interactive?: boolean;
105
+ /**
106
+ Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
107
+
108
+ Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
109
+
110
+ Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
111
+
112
+ Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
113
+
114
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
115
+
116
+ @default false
117
+ */
118
+ alternateScreen?: boolean;
86
119
  };
87
120
  export type Instance = {
88
121
  /**
@@ -94,9 +127,42 @@ export type Instance = {
94
127
  */
95
128
  unmount: Ink['unmount'];
96
129
  /**
97
- Returns a promise that resolves when the app is unmounted.
130
+ Returns a promise that settles when the app is unmounted.
131
+
132
+ It resolves with the value passed to `exit(value)` and rejects with the error passed to `exit(error)`.
133
+ When `unmount()` is called manually, it settles after unmount-related stdout writes complete.
134
+
135
+ @example
136
+ ```jsx
137
+ const {unmount, waitUntilExit} = render(<MyApp />);
138
+
139
+ setTimeout(unmount, 1000);
140
+
141
+ await waitUntilExit(); // resolves after `unmount()` is called
142
+ ```
98
143
  */
99
144
  waitUntilExit: Ink['waitUntilExit'];
145
+ /**
146
+ Returns a promise that settles after pending render output is flushed to stdout.
147
+
148
+ This can be used after `rerender()` when you need to run code only after the frame is written.
149
+
150
+ @example
151
+ ```jsx
152
+ const {rerender, waitUntilRenderFlush} = render(<MyApp step="loading" />);
153
+
154
+ rerender(<MyApp step="ready" />);
155
+ await waitUntilRenderFlush(); // output for "ready" is flushed
156
+
157
+ runNextCommand();
158
+ ```
159
+ */
160
+ waitUntilRenderFlush: Ink['waitUntilRenderFlush'];
161
+ /**
162
+ Unmount the current app and remove the internal Ink instance for this stdout.
163
+
164
+ This is mostly useful for advanced cases where you need `render()` to create a fresh instance for the same stream without leaving terminal state such as the alternate screen behind.
165
+ */
100
166
  cleanup: () => void;
101
167
  /**
102
168
  Clear output.
package/build/render.js CHANGED
@@ -16,9 +16,10 @@ const render = (node, options) => {
16
16
  maxFps: 30,
17
17
  incrementalRendering: false,
18
18
  concurrent: false,
19
+ alternateScreen: false,
19
20
  ...getOptions(options),
20
21
  };
21
- const instance = getInstance(inkOptions.stdout, () => new Ink(inkOptions), inkOptions.concurrent ?? false);
22
+ const instance = getInstance(inkOptions.stdout, () => new Ink(inkOptions));
22
23
  instance.render(node);
23
24
  return {
24
25
  rerender: instance.render,
@@ -26,7 +27,10 @@ const render = (node, options) => {
26
27
  instance.unmount();
27
28
  },
28
29
  waitUntilExit: instance.waitUntilExit,
29
- cleanup: () => instances.delete(inkOptions.stdout),
30
+ waitUntilRenderFlush: instance.waitUntilRenderFlush,
31
+ cleanup() {
32
+ instance.unmount();
33
+ },
30
34
  clear: instance.clear,
31
35
  };
32
36
  };
@@ -40,16 +44,19 @@ const getOptions = (stdout = {}) => {
40
44
  }
41
45
  return stdout;
42
46
  };
43
- const getInstance = (stdout, createInstance, concurrent) => {
44
- let instance = instances.get(stdout);
45
- if (!instance) {
46
- instance = createInstance();
47
- instances.set(stdout, instance);
48
- }
49
- else if (instance.isConcurrent !== concurrent) {
50
- console.warn(`Warning: render() was called with concurrent: ${concurrent}, but the existing instance for this stdout uses concurrent: ${instance.isConcurrent}. ` +
51
- `The concurrent option only takes effect on the first render. Call unmount() first if you need to change the rendering mode.`);
47
+ const getInstance = (stdout, createInstance) => {
48
+ const instance = instances.get(stdout);
49
+ if (instance === undefined) {
50
+ const newInstance = createInstance();
51
+ instances.set(stdout, newInstance);
52
+ return newInstance;
52
53
  }
54
+ // Ink keeps one live renderer per stdout. Reusing the same stream without
55
+ // unmounting is unsupported, but return the existing instance so we don't
56
+ // create two renderers that compete for the same output. Write the warning
57
+ // directly to native stderr so an existing alternate-screen renderer cannot
58
+ // swallow it via patchConsole.
59
+ process.stderr.write('Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.\n');
53
60
  return instance;
54
61
  };
55
62
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,GAAqD,MAAM,UAAU,CAAC;AAC7E,OAAO,SAAS,MAAM,gBAAgB,CAAC;AA0HvC;;EAEE;AACF,MAAM,MAAM,GAAG,CACd,IAAe,EACf,OAA4C,EACjC,EAAE;IACb,MAAM,UAAU,GAAe;QAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,EAAE;QACV,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE,KAAK;QACjB,GAAG,UAAU,CAAC,OAAO,CAAC;KACtB,CAAC;IAEF,MAAM,QAAQ,GAAQ,WAAW,CAChC,UAAU,CAAC,MAAM,EACjB,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,EACzB,UAAU,CAAC,UAAU,IAAI,KAAK,CAC9B,CAAC;IAEF,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEtB,OAAO;QACN,QAAQ,EAAE,QAAQ,CAAC,MAAM;QACzB,OAAO;YACN,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,aAA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,SAAS,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QACrC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACnC,OAAO,WAAW,CAAC;IACpB,CAAC;IAED,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,4EAA4E;IAC5E,+BAA+B;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CACnB,8LAA8L,CAC9L,CAAC;IAEF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const sanitizeAnsi: (text: string) => string;
2
+ export default sanitizeAnsi;
@@ -0,0 +1,27 @@
1
+ import { hasAnsiControlCharacters, tokenizeAnsi } from './ansi-tokenizer.js';
2
+ const sgrParametersRegex = /^[\d:;]*$/;
3
+ // Strip ANSI escape sequences that would conflict with Ink's layout.
4
+ // Preserved: SGR sequences (colors, bold, etc. - end with 'm') and
5
+ // OSC sequences (hyperlinks, etc. - ESC ] or C1 OSC).
6
+ // Stripped: cursor movement, screen clearing, and other control sequences.
7
+ const sanitizeAnsi = (text) => {
8
+ if (!hasAnsiControlCharacters(text)) {
9
+ return text;
10
+ }
11
+ let output = '';
12
+ for (const token of tokenizeAnsi(text)) {
13
+ if (token.type === 'text' || token.type === 'osc') {
14
+ output += token.value;
15
+ continue;
16
+ }
17
+ if (token.type === 'csi' &&
18
+ token.finalCharacter === 'm' &&
19
+ token.intermediateString === '' &&
20
+ sgrParametersRegex.test(token.parameterString)) {
21
+ output += token.value;
22
+ }
23
+ }
24
+ return output;
25
+ };
26
+ export default sanitizeAnsi;
27
+ //# sourceMappingURL=sanitize-ansi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-ansi.js","sourceRoot":"","sources":["../src/sanitize-ansi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAE3E,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,qEAAqE;AACrE,mEAAmE;AACnE,sDAAsD;AACtD,2EAA2E;AAC3E,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE;IAC7C,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC;YACtB,SAAS;QACV,CAAC;QAED,IACC,KAAK,CAAC,IAAI,KAAK,KAAK;YACpB,KAAK,CAAC,cAAc,KAAK,GAAG;YAC5B,KAAK,CAAC,kBAAkB,KAAK,EAAE;YAC/B,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,EAC7C,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC;QACvB,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,3 +1,4 @@
1
+ import sanitizeAnsi from './sanitize-ansi.js';
1
2
  // Squashing text nodes allows to combine multiple text nodes into one and write
2
3
  // to `Output` instance only once. For example, <Text>hello{' '}world</Text>
3
4
  // is actually 3 text nodes, which would result 3 writes to `Output`.
@@ -29,7 +30,7 @@ const squashTextNodes = (node) => {
29
30
  }
30
31
  text += nodeText;
31
32
  }
32
- return text;
33
+ return sanitizeAnsi(text);
33
34
  };
34
35
  export default squashTextNodes;
35
36
  //# sourceMappingURL=squash-text-nodes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"squash-text-nodes.js","sourceRoot":"","sources":["../src/squash-text-nodes.ts"],"names":[],"mappings":"AAEA,gFAAg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ACF,kGAAkG;AAClG,wFAAwF;AACxF,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAU,EAAE;IACpD,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7D,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAEzC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC7B,SAAS;QACV,CAAC;QAED,IAAI,QAAQ,GAAG,EAAE,CAAC;QAElB,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACpC,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC;QAChC,CAAC;aAAM,CAAC;YACP,IACC,SAAS,CAAC,QAAQ,KAAK,UAAU;gBACjC,SAAS,CAAC,QAAQ,KAAK,kBAAkB,EACxC,CAAC;gBACF,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;YACvC,CAAC;YAED,oFAAoF;YACpF,iFAAiF;YACjF,IACC,QAAQ,CAAC,MAAM,GAAG,CAAC;gBACnB,OAAO,SAAS,CAAC,kBAAkB,KAAK,UAAU,EACjD,CAAC;gBACF,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC1D,CAAC;QACF,CAAC;QAED,IAAI,IAAI,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/build/styles.d.ts CHANGED
@@ -3,8 +3,29 @@ import { type LiteralUnion } from 'type-fest';
3
3
  import { type ForegroundColorName } from 'ansi-styles';
4
4
  import { type Node as YogaNode } from 'yoga-layout';
5
5
  export type Styles = {
6
- readonly textWrap?: 'wrap' | 'end' | 'middle' | 'truncate-end' | 'truncate' | 'truncate-middle' | 'truncate-start';
7
- readonly position?: 'absolute' | 'relative';
6
+ readonly textWrap?: 'wrap' | 'hard' | 'truncate-end' | 'truncate' | 'truncate-middle' | 'truncate-start';
7
+ /**
8
+ Controls how the element is positioned.
9
+
10
+ When `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.
11
+ */
12
+ readonly position?: 'absolute' | 'relative' | 'static';
13
+ /**
14
+ Top offset for positioned elements.
15
+ */
16
+ readonly top?: number | string;
17
+ /**
18
+ Right offset for positioned elements.
19
+ */
20
+ readonly right?: number | string;
21
+ /**
22
+ Bottom offset for positioned elements.
23
+ */
24
+ readonly bottom?: number | string;
25
+ /**
26
+ Left offset for positioned elements.
27
+ */
28
+ readonly left?: number | string;
8
29
  /**
9
30
  Size of the gap between an element's columns.
10
31
  */
@@ -102,12 +123,17 @@ export type Styles = {
102
123
  The align-items property defines the default behavior for how items are laid out along the cross axis (perpendicular to the main axis).
103
124
  See [align-items](https://css-tricks.com/almanac/properties/a/align-items/).
104
125
  */
105
- readonly alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch';
126
+ readonly alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
106
127
  /**
107
128
  It makes possible to override the align-items value for specific flex items.
108
129
  See [align-self](https://css-tricks.com/almanac/properties/a/align-self/).
109
130
  */
110
- readonly alignSelf?: 'flex-start' | 'center' | 'flex-end' | 'auto';
131
+ readonly alignSelf?: 'flex-start' | 'center' | 'flex-end' | 'auto' | 'stretch' | 'baseline';
132
+ /**
133
+ It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
134
+ See [align-content](https://css-tricks.com/almanac/properties/a/align-content/).
135
+ */
136
+ readonly alignContent?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around' | 'space-evenly';
111
137
  /**
112
138
  It defines the alignment along the main axis.
113
139
  See [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).
@@ -123,13 +149,29 @@ export type Styles = {
123
149
  readonly height?: number | string;
124
150
  /**
125
151
  Sets a minimum width of the element.
152
+ Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
126
153
  */
127
154
  readonly minWidth?: number | string;
128
155
  /**
129
- Sets a minimum height of the element.
156
+ 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.
130
157
  */
131
158
  readonly minHeight?: number | string;
132
159
  /**
160
+ Sets a maximum width of the element.
161
+ Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
162
+ */
163
+ readonly maxWidth?: number | string;
164
+ /**
165
+ 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.
166
+ */
167
+ readonly maxHeight?: number | string;
168
+ /**
169
+ Defines the aspect ratio (width/height) for the element.
170
+
171
+ Use it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.
172
+ */
173
+ readonly aspectRatio?: number;
174
+ /**
133
175
  Set this property to `none` to hide the element.
134
176
  */
135
177
  readonly display?: 'flex' | 'none';
@@ -139,25 +181,25 @@ export type Styles = {
139
181
  readonly borderStyle?: keyof Boxes | BoxStyle;
140
182
  /**
141
183
  Determines whether the top border is visible.
142
-
184
+
143
185
  @default true
144
186
  */
145
187
  readonly borderTop?: boolean;
146
188
  /**
147
189
  Determines whether the bottom border is visible.
148
-
190
+
149
191
  @default true
150
192
  */
151
193
  readonly borderBottom?: boolean;
152
194
  /**
153
195
  Determines whether the left border is visible.
154
-
196
+
155
197
  @default true
156
198
  */
157
199
  readonly borderLeft?: boolean;
158
200
  /**
159
201
  Determines whether the right border is visible.
160
-
202
+
161
203
  @default true
162
204
  */
163
205
  readonly borderRight?: boolean;
@@ -189,31 +231,51 @@ export type Styles = {
189
231
  readonly borderDimColor?: boolean;
190
232
  /**
191
233
  Dim the top border color.
192
-
234
+
193
235
  @default false
194
236
  */
195
237
  readonly borderTopDimColor?: boolean;
196
238
  /**
197
239
  Dim the bottom border color.
198
-
240
+
199
241
  @default false
200
242
  */
201
243
  readonly borderBottomDimColor?: boolean;
202
244
  /**
203
245
  Dim the left border color.
204
-
246
+
205
247
  @default false
206
248
  */
207
249
  readonly borderLeftDimColor?: boolean;
208
250
  /**
209
251
  Dim the right border color.
210
-
252
+
211
253
  @default false
212
254
  */
213
255
  readonly borderRightDimColor?: boolean;
214
256
  /**
257
+ Change border background color. A shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.
258
+ */
259
+ readonly borderBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
260
+ /**
261
+ Change top border background color. Accepts the same values as `backgroundColor` in `Text` component.
262
+ */
263
+ readonly borderTopBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
264
+ /**
265
+ Change bottom border background color. Accepts the same values as `backgroundColor` in `Text` component.
266
+ */
267
+ readonly borderBottomBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
268
+ /**
269
+ Change left border background color. Accepts the same values as `backgroundColor` in `Text` component.
270
+ */
271
+ readonly borderLeftBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
272
+ /**
273
+ Change right border background color. Accepts the same values as `backgroundColor` in `Text` component.
274
+ */
275
+ readonly borderRightBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
276
+ /**
215
277
  Behavior for an element's overflow in both directions.
216
-
278
+
217
279
  @default 'visible'
218
280
  */
219
281
  readonly overflow?: 'visible' | 'hidden';
@@ -231,10 +293,10 @@ export type Styles = {
231
293
  readonly overflowY?: 'visible' | 'hidden';
232
294
  /**
233
295
  Background color for the element.
234
-
296
+
235
297
  Accepts the same values as `color` in the `<Text>` component.
236
298
  */
237
299
  readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
238
300
  };
239
- declare const styles: (node: YogaNode, style?: Styles) => void;
301
+ declare const styles: (node: YogaNode, style?: Styles, currentStyle?: Styles) => void;
240
302
  export default styles;
package/build/styles.js CHANGED
@@ -1,9 +1,31 @@
1
1
  import Yoga from 'yoga-layout';
2
+ const positionEdges = [
3
+ ['top', Yoga.EDGE_TOP],
4
+ ['right', Yoga.EDGE_RIGHT],
5
+ ['bottom', Yoga.EDGE_BOTTOM],
6
+ ['left', Yoga.EDGE_LEFT],
7
+ ];
2
8
  const applyPositionStyles = (node, style) => {
3
9
  if ('position' in style) {
4
- node.setPositionType(style.position === 'absolute'
5
- ? Yoga.POSITION_TYPE_ABSOLUTE
6
- : Yoga.POSITION_TYPE_RELATIVE);
10
+ let positionType = Yoga.POSITION_TYPE_RELATIVE;
11
+ if (style.position === 'absolute') {
12
+ positionType = Yoga.POSITION_TYPE_ABSOLUTE;
13
+ }
14
+ else if (style.position === 'static') {
15
+ positionType = Yoga.POSITION_TYPE_STATIC;
16
+ }
17
+ node.setPositionType(positionType);
18
+ }
19
+ for (const [property, edge] of positionEdges) {
20
+ if (!(property in style)) {
21
+ continue;
22
+ }
23
+ const value = style[property];
24
+ if (typeof value === 'string') {
25
+ node.setPositionPercent(edge, Number.parseFloat(value));
26
+ continue;
27
+ }
28
+ node.setPosition(edge, value);
7
29
  }
8
30
  };
9
31
  const applyMarginStyles = (node, style) => {
@@ -17,16 +39,16 @@ const applyMarginStyles = (node, style) => {
17
39
  node.setMargin(Yoga.EDGE_VERTICAL, style.marginY ?? 0);
18
40
  }
19
41
  if ('marginLeft' in style) {
20
- node.setMargin(Yoga.EDGE_START, style.marginLeft || 0);
42
+ node.setMargin(Yoga.EDGE_START, style.marginLeft ?? 0);
21
43
  }
22
44
  if ('marginRight' in style) {
23
- node.setMargin(Yoga.EDGE_END, style.marginRight || 0);
45
+ node.setMargin(Yoga.EDGE_END, style.marginRight ?? 0);
24
46
  }
25
47
  if ('marginTop' in style) {
26
- node.setMargin(Yoga.EDGE_TOP, style.marginTop || 0);
48
+ node.setMargin(Yoga.EDGE_TOP, style.marginTop ?? 0);
27
49
  }
28
50
  if ('marginBottom' in style) {
29
- node.setMargin(Yoga.EDGE_BOTTOM, style.marginBottom || 0);
51
+ node.setMargin(Yoga.EDGE_BOTTOM, style.marginBottom ?? 0);
30
52
  }
31
53
  };
32
54
  const applyPaddingStyles = (node, style) => {
@@ -40,16 +62,16 @@ const applyPaddingStyles = (node, style) => {
40
62
  node.setPadding(Yoga.EDGE_VERTICAL, style.paddingY ?? 0);
41
63
  }
42
64
  if ('paddingLeft' in style) {
43
- node.setPadding(Yoga.EDGE_LEFT, style.paddingLeft || 0);
65
+ node.setPadding(Yoga.EDGE_LEFT, style.paddingLeft ?? 0);
44
66
  }
45
67
  if ('paddingRight' in style) {
46
- node.setPadding(Yoga.EDGE_RIGHT, style.paddingRight || 0);
68
+ node.setPadding(Yoga.EDGE_RIGHT, style.paddingRight ?? 0);
47
69
  }
48
70
  if ('paddingTop' in style) {
49
- node.setPadding(Yoga.EDGE_TOP, style.paddingTop || 0);
71
+ node.setPadding(Yoga.EDGE_TOP, style.paddingTop ?? 0);
50
72
  }
51
73
  if ('paddingBottom' in style) {
52
- node.setPadding(Yoga.EDGE_BOTTOM, style.paddingBottom || 0);
74
+ node.setPadding(Yoga.EDGE_BOTTOM, style.paddingBottom ?? 0);
53
75
  }
54
76
  };
55
77
  const applyFlexStyles = (node, style) => {
@@ -92,8 +114,7 @@ const applyFlexStyles = (node, style) => {
92
114
  node.setFlexBasisPercent(Number.parseInt(style.flexBasis, 10));
93
115
  }
94
116
  else {
95
- // This should be replaced with node.setFlexBasisAuto() when new Yoga release is out
96
- node.setFlexBasis(Number.NaN);
117
+ node.setFlexBasisAuto();
97
118
  }
98
119
  }
99
120
  if ('alignItems' in style) {
@@ -109,6 +130,9 @@ const applyFlexStyles = (node, style) => {
109
130
  if (style.alignItems === 'flex-end') {
110
131
  node.setAlignItems(Yoga.ALIGN_FLEX_END);
111
132
  }
133
+ if (style.alignItems === 'baseline') {
134
+ node.setAlignItems(Yoga.ALIGN_BASELINE);
135
+ }
112
136
  }
113
137
  if ('alignSelf' in style) {
114
138
  if (style.alignSelf === 'auto' || !style.alignSelf) {
@@ -123,6 +147,36 @@ const applyFlexStyles = (node, style) => {
123
147
  if (style.alignSelf === 'flex-end') {
124
148
  node.setAlignSelf(Yoga.ALIGN_FLEX_END);
125
149
  }
150
+ if (style.alignSelf === 'stretch') {
151
+ node.setAlignSelf(Yoga.ALIGN_STRETCH);
152
+ }
153
+ if (style.alignSelf === 'baseline') {
154
+ node.setAlignSelf(Yoga.ALIGN_BASELINE);
155
+ }
156
+ }
157
+ if ('alignContent' in style) {
158
+ // Keep wrapped lines top-packed by default; stretch can add surprising empty rows in fixed-height boxes.
159
+ if (style.alignContent === 'flex-start' || !style.alignContent) {
160
+ node.setAlignContent(Yoga.ALIGN_FLEX_START);
161
+ }
162
+ if (style.alignContent === 'center') {
163
+ node.setAlignContent(Yoga.ALIGN_CENTER);
164
+ }
165
+ if (style.alignContent === 'flex-end') {
166
+ node.setAlignContent(Yoga.ALIGN_FLEX_END);
167
+ }
168
+ if (style.alignContent === 'space-between') {
169
+ node.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN);
170
+ }
171
+ if (style.alignContent === 'space-around') {
172
+ node.setAlignContent(Yoga.ALIGN_SPACE_AROUND);
173
+ }
174
+ if (style.alignContent === 'space-evenly') {
175
+ node.setAlignContent(Yoga.ALIGN_SPACE_EVENLY);
176
+ }
177
+ if (style.alignContent === 'stretch') {
178
+ node.setAlignContent(Yoga.ALIGN_STRETCH);
179
+ }
126
180
  }
127
181
  if ('justifyContent' in style) {
128
182
  if (style.justifyContent === 'flex-start' || !style.justifyContent) {
@@ -184,28 +238,45 @@ const applyDimensionStyles = (node, style) => {
184
238
  node.setMinHeight(style.minHeight ?? 0);
185
239
  }
186
240
  }
241
+ if ('maxWidth' in style) {
242
+ if (typeof style.maxWidth === 'string') {
243
+ node.setMaxWidthPercent(Number.parseInt(style.maxWidth, 10));
244
+ }
245
+ else {
246
+ node.setMaxWidth(style.maxWidth);
247
+ }
248
+ }
249
+ if ('maxHeight' in style) {
250
+ if (typeof style.maxHeight === 'string') {
251
+ node.setMaxHeightPercent(Number.parseInt(style.maxHeight, 10));
252
+ }
253
+ else {
254
+ node.setMaxHeight(style.maxHeight);
255
+ }
256
+ }
257
+ if ('aspectRatio' in style) {
258
+ node.setAspectRatio(style.aspectRatio);
259
+ }
187
260
  };
188
261
  const applyDisplayStyles = (node, style) => {
189
262
  if ('display' in style) {
190
263
  node.setDisplay(style.display === 'flex' ? Yoga.DISPLAY_FLEX : Yoga.DISPLAY_NONE);
191
264
  }
192
265
  };
193
- const applyBorderStyles = (node, style) => {
194
- if ('borderStyle' in style) {
195
- const borderWidth = style.borderStyle ? 1 : 0;
196
- if (style.borderTop !== false) {
197
- node.setBorder(Yoga.EDGE_TOP, borderWidth);
198
- }
199
- if (style.borderBottom !== false) {
200
- node.setBorder(Yoga.EDGE_BOTTOM, borderWidth);
201
- }
202
- if (style.borderLeft !== false) {
203
- node.setBorder(Yoga.EDGE_LEFT, borderWidth);
204
- }
205
- if (style.borderRight !== false) {
206
- node.setBorder(Yoga.EDGE_RIGHT, borderWidth);
207
- }
208
- }
266
+ const applyBorderStyles = (node, style, currentStyle) => {
267
+ const hasBorderChanges = 'borderStyle' in style ||
268
+ 'borderTop' in style ||
269
+ 'borderBottom' in style ||
270
+ 'borderLeft' in style ||
271
+ 'borderRight' in style;
272
+ if (!hasBorderChanges) {
273
+ return;
274
+ }
275
+ const borderWidth = currentStyle.borderStyle ? 1 : 0;
276
+ node.setBorder(Yoga.EDGE_TOP, currentStyle.borderTop === false ? 0 : borderWidth);
277
+ node.setBorder(Yoga.EDGE_BOTTOM, currentStyle.borderBottom === false ? 0 : borderWidth);
278
+ node.setBorder(Yoga.EDGE_LEFT, currentStyle.borderLeft === false ? 0 : borderWidth);
279
+ node.setBorder(Yoga.EDGE_RIGHT, currentStyle.borderRight === false ? 0 : borderWidth);
209
280
  };
210
281
  const applyGapStyles = (node, style) => {
211
282
  if ('gap' in style) {
@@ -218,14 +289,14 @@ const applyGapStyles = (node, style) => {
218
289
  node.setGap(Yoga.GUTTER_ROW, style.rowGap ?? 0);
219
290
  }
220
291
  };
221
- const styles = (node, style = {}) => {
292
+ const styles = (node, style = {}, currentStyle = style) => {
222
293
  applyPositionStyles(node, style);
223
294
  applyMarginStyles(node, style);
224
295
  applyPaddingStyles(node, style);
225
296
  applyFlexStyles(node, style);
226
297
  applyDimensionStyles(node, style);
227
298
  applyDisplayStyles(node, style);
228
- applyBorderStyles(node, style);
299
+ applyBorderStyles(node, style, currentStyle);
229
300
  applyGapStyles(node, style);
230
301
  };
231
302
  export default styles;