@elench/testkit 0.1.113 → 0.1.115

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 (196) hide show
  1. package/lib/cli/assistant/app.mjs +4 -2
  2. package/lib/cli/assistant/session.mjs +5 -1
  3. package/lib/cli/assistant/state.mjs +1 -2
  4. package/lib/cli/components/blocks/run-tree.mjs +7 -2
  5. package/lib/cli/components/hooks/use-element-layout.mjs +63 -0
  6. package/lib/cli/components/hooks/use-spinner-frame.mjs +26 -0
  7. package/lib/playwright/index.d.ts +1 -0
  8. package/lib/playwright/index.mjs +1 -0
  9. package/lib/runner/default-runtime-runner.mjs +5 -28
  10. package/lib/runner/lifecycle.mjs +2 -51
  11. package/lib/runner/managed-processes.mjs +2 -1
  12. package/lib/runner/playwright-config.mjs +13 -1
  13. package/lib/runner/playwright-runner.mjs +85 -15
  14. package/lib/runner/processes.mjs +59 -3
  15. package/lib/runner/subprocess.mjs +155 -0
  16. package/lib/shared/file-timeout.mjs +1 -1
  17. package/lib/ui/index.d.ts +2 -0
  18. package/lib/ui/index.mjs +1 -0
  19. package/node_modules/@alcalzone/ansi-tokenize/README.md +0 -5
  20. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.d.ts +8 -0
  21. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js +10 -8
  22. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js.map +1 -1
  23. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.d.ts +1 -5
  24. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js +9 -45
  25. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js.map +1 -1
  26. package/node_modules/@alcalzone/ansi-tokenize/package.json +1 -1
  27. package/node_modules/@elench/next-analysis/package.json +1 -1
  28. package/node_modules/@elench/testkit-bridge/package.json +2 -2
  29. package/node_modules/@elench/testkit-protocol/package.json +1 -1
  30. package/node_modules/@elench/ts-analysis/package.json +1 -1
  31. package/node_modules/cli-boxes/index.d.ts +95 -90
  32. package/node_modules/cli-boxes/index.js +5 -2
  33. package/node_modules/cli-boxes/package.json +6 -13
  34. package/node_modules/cli-boxes/readme.md +15 -3
  35. package/node_modules/cli-truncate/index.d.ts +1 -1
  36. package/node_modules/cli-truncate/package.json +4 -4
  37. package/node_modules/cli-truncate/readme.md +1 -0
  38. package/node_modules/ink/build/apply-styles.js +175 -0
  39. package/node_modules/ink/build/build-layout.js +77 -0
  40. package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
  41. package/node_modules/ink/build/components/App.d.ts +1 -4
  42. package/node_modules/ink/build/components/App.js +22 -142
  43. package/node_modules/ink/build/components/App.js.map +1 -1
  44. package/node_modules/ink/build/components/AppContext.d.ts +3 -23
  45. package/node_modules/ink/build/components/AppContext.js +4 -7
  46. package/node_modules/ink/build/components/AppContext.js.map +1 -1
  47. package/node_modules/ink/build/components/Box.d.ts +3 -16
  48. package/node_modules/ink/build/components/Color.js +62 -0
  49. package/node_modules/ink/build/components/Cursor.d.ts +83 -0
  50. package/node_modules/ink/build/components/Cursor.js +53 -0
  51. package/node_modules/ink/build/components/Cursor.js.map +1 -0
  52. package/node_modules/ink/build/components/ErrorBoundary.d.ts +2 -2
  53. package/node_modules/ink/build/components/ErrorOverview.js +6 -6
  54. package/node_modules/ink/build/components/ErrorOverview.js.map +1 -1
  55. package/node_modules/ink/build/components/Static.js.map +1 -1
  56. package/node_modules/ink/build/components/StdinContext.d.ts +1 -7
  57. package/node_modules/ink/build/components/StdinContext.js +0 -1
  58. package/node_modules/ink/build/components/StdinContext.js.map +1 -1
  59. package/node_modules/ink/build/components/Text.d.ts +1 -1
  60. package/node_modules/ink/build/components/Text.js +1 -1
  61. package/node_modules/ink/build/components/Text.js.map +1 -1
  62. package/node_modules/ink/build/components/Transform.d.ts +1 -1
  63. package/node_modules/ink/build/devtools-window-polyfill.js +4 -7
  64. package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -1
  65. package/node_modules/ink/build/devtools.js +6 -31
  66. package/node_modules/ink/build/devtools.js.map +1 -1
  67. package/node_modules/ink/build/dom.d.ts +1 -5
  68. package/node_modules/ink/build/dom.js +1 -20
  69. package/node_modules/ink/build/dom.js.map +1 -1
  70. package/node_modules/ink/build/experimental/apply-style.js +140 -0
  71. package/node_modules/ink/build/experimental/dom.js +123 -0
  72. package/node_modules/ink/build/experimental/output.js +91 -0
  73. package/node_modules/ink/build/experimental/reconciler.js +141 -0
  74. package/node_modules/ink/build/experimental/renderer.js +81 -0
  75. package/node_modules/ink/build/hooks/use-app.d.ts +1 -1
  76. package/node_modules/ink/build/hooks/use-app.js +1 -1
  77. package/node_modules/ink/build/hooks/use-cursor.d.ts +1 -1
  78. package/node_modules/ink/build/hooks/use-cursor.js +1 -1
  79. package/node_modules/ink/build/hooks/use-focus-manager.d.ts +2 -17
  80. package/node_modules/ink/build/hooks/use-focus-manager.js +1 -2
  81. package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -1
  82. package/node_modules/ink/build/hooks/use-focus.d.ts +1 -2
  83. package/node_modules/ink/build/hooks/use-focus.js +4 -5
  84. package/node_modules/ink/build/hooks/use-focus.js.map +1 -1
  85. package/node_modules/ink/build/hooks/use-input.d.ts +1 -2
  86. package/node_modules/ink/build/hooks/use-input.js +80 -82
  87. package/node_modules/ink/build/hooks/use-input.js.map +1 -1
  88. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +1 -2
  89. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +1 -2
  90. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
  91. package/node_modules/ink/build/hooks/use-stderr.d.ts +1 -1
  92. package/node_modules/ink/build/hooks/use-stderr.js +1 -1
  93. package/node_modules/ink/build/hooks/use-stdin.d.ts +2 -4
  94. package/node_modules/ink/build/hooks/use-stdin.js +1 -2
  95. package/node_modules/ink/build/hooks/use-stdin.js.map +1 -1
  96. package/node_modules/ink/build/hooks/use-stdout.d.ts +1 -1
  97. package/node_modules/ink/build/hooks/use-stdout.js +1 -1
  98. package/node_modules/ink/build/hooks/useInput.js +38 -0
  99. package/node_modules/ink/build/index.d.ts +1 -8
  100. package/node_modules/ink/build/index.js +0 -4
  101. package/node_modules/ink/build/index.js.map +1 -1
  102. package/node_modules/ink/build/ink.d.ts +3 -48
  103. package/node_modules/ink/build/ink.js +155 -325
  104. package/node_modules/ink/build/ink.js.map +1 -1
  105. package/node_modules/ink/build/input-parser.d.ts +1 -4
  106. package/node_modules/ink/build/input-parser.js +30 -70
  107. package/node_modules/ink/build/input-parser.js.map +1 -1
  108. package/node_modules/ink/build/instance.js +205 -0
  109. package/node_modules/ink/build/layout.d.ts +7 -0
  110. package/node_modules/ink/build/layout.js +33 -0
  111. package/node_modules/ink/build/layout.js.map +1 -0
  112. package/node_modules/ink/build/log-update.d.ts +0 -1
  113. package/node_modules/ink/build/log-update.js +1 -13
  114. package/node_modules/ink/build/log-update.js.map +1 -1
  115. package/node_modules/ink/build/measure-element.d.ts +0 -4
  116. package/node_modules/ink/build/measure-element.js +0 -4
  117. package/node_modules/ink/build/measure-element.js.map +1 -1
  118. package/node_modules/ink/build/options.d.ts +52 -0
  119. package/node_modules/ink/build/options.js +2 -0
  120. package/node_modules/ink/build/options.js.map +1 -0
  121. package/node_modules/ink/build/output.js +0 -25
  122. package/node_modules/ink/build/output.js.map +1 -1
  123. package/node_modules/ink/build/parse-keypress.d.ts +3 -1
  124. package/node_modules/ink/build/parse-keypress.js +17 -19
  125. package/node_modules/ink/build/parse-keypress.js.map +1 -1
  126. package/node_modules/ink/build/reconciler.js +27 -46
  127. package/node_modules/ink/build/reconciler.js.map +1 -1
  128. package/node_modules/ink/build/render-border.js +18 -29
  129. package/node_modules/ink/build/render-border.js.map +1 -1
  130. package/node_modules/ink/build/render-to-string.js +1 -2
  131. package/node_modules/ink/build/render-to-string.js.map +1 -1
  132. package/node_modules/ink/build/render.d.ts +2 -57
  133. package/node_modules/ink/build/render.js +11 -18
  134. package/node_modules/ink/build/render.js.map +1 -1
  135. package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
  136. package/node_modules/ink/build/screen-reader-update.js +38 -0
  137. package/node_modules/ink/build/screen-reader-update.js.map +1 -0
  138. package/node_modules/ink/build/styles.d.ts +16 -78
  139. package/node_modules/ink/build/styles.js +31 -102
  140. package/node_modules/ink/build/styles.js.map +1 -1
  141. package/node_modules/ink/build/utils.d.ts +2 -9
  142. package/node_modules/ink/build/utils.js +3 -18
  143. package/node_modules/ink/build/utils.js.map +1 -1
  144. package/node_modules/ink/build/wrap-text.js +0 -7
  145. package/node_modules/ink/build/wrap-text.js.map +1 -1
  146. package/node_modules/ink/build/write-synchronized.d.ts +1 -1
  147. package/node_modules/ink/build/write-synchronized.js +2 -4
  148. package/node_modules/ink/build/write-synchronized.js.map +1 -1
  149. package/node_modules/ink/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  150. package/node_modules/ink/node_modules/emoji-regex/README.md +107 -0
  151. package/node_modules/ink/node_modules/emoji-regex/index.d.ts +3 -0
  152. package/node_modules/ink/node_modules/emoji-regex/index.js +4 -0
  153. package/node_modules/ink/node_modules/emoji-regex/index.mjs +4 -0
  154. package/node_modules/ink/node_modules/emoji-regex/package.json +45 -0
  155. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/index.d.ts +1 -1
  156. package/node_modules/ink/node_modules/wrap-ansi/index.js +222 -0
  157. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +39 -0
  158. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.js +82 -0
  159. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
  160. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/package.json +64 -0
  161. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/readme.md +66 -0
  162. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/package.json +11 -11
  163. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/readme.md +0 -2
  164. package/node_modules/ink/package.json +98 -34
  165. package/node_modules/ink/readme.md +48 -554
  166. package/node_modules/slice-ansi/index.d.ts +1 -1
  167. package/node_modules/slice-ansi/index.js +89 -146
  168. package/node_modules/slice-ansi/package.json +5 -5
  169. package/node_modules/slice-ansi/readme.md +0 -1
  170. package/node_modules/slice-ansi/tokenize-ansi.js +1 -1
  171. package/package.json +11 -10
  172. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
  173. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
  174. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
  175. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
  176. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
  177. package/node_modules/@alcalzone/ansi-tokenize/build/consts.d.ts +0 -17
  178. package/node_modules/@alcalzone/ansi-tokenize/build/consts.js +0 -28
  179. package/node_modules/@alcalzone/ansi-tokenize/build/consts.js.map +0 -1
  180. package/node_modules/ink/build/components/AnimationContext.d.ts +0 -9
  181. package/node_modules/ink/build/components/AnimationContext.js +0 -13
  182. package/node_modules/ink/build/components/AnimationContext.js.map +0 -1
  183. package/node_modules/ink/build/hooks/use-animation.d.ts +0 -49
  184. package/node_modules/ink/build/hooks/use-animation.js +0 -87
  185. package/node_modules/ink/build/hooks/use-animation.js.map +0 -1
  186. package/node_modules/ink/build/hooks/use-box-metrics.d.ts +0 -59
  187. package/node_modules/ink/build/hooks/use-box-metrics.js +0 -88
  188. package/node_modules/ink/build/hooks/use-box-metrics.js.map +0 -1
  189. package/node_modules/ink/build/hooks/use-paste.d.ts +0 -35
  190. package/node_modules/ink/build/hooks/use-paste.js +0 -62
  191. package/node_modules/ink/build/hooks/use-paste.js.map +0 -1
  192. package/node_modules/ink/build/hooks/use-window-size.d.ts +0 -18
  193. package/node_modules/ink/build/hooks/use-window-size.js +0 -22
  194. package/node_modules/ink/build/hooks/use-window-size.js.map +0 -1
  195. package/node_modules/wrap-ansi/index.js +0 -468
  196. /package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/license +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-boxes",
3
- "version": "4.0.1",
3
+ "version": "3.0.0",
4
4
  "description": "Boxes for use in the terminal",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/cli-boxes",
@@ -10,18 +10,11 @@
10
10
  "email": "sindresorhus@gmail.com",
11
11
  "url": "https://sindresorhus.com"
12
12
  },
13
- "type": "module",
14
- "exports": {
15
- "types": "./index.d.ts",
16
- "default": "./index.js"
17
- },
18
- "sideEffects": false,
19
13
  "engines": {
20
- "node": ">=18.20 <19 || >=20.10"
14
+ "node": ">=10"
21
15
  },
22
16
  "scripts": {
23
- "//test": "xo && ava && tsc --noEmit index.d.ts",
24
- "test": "ava && tsc --noEmit index.d.ts"
17
+ "test": "xo && ava && tsd"
25
18
  },
26
19
  "files": [
27
20
  "index.js",
@@ -42,8 +35,8 @@
42
35
  "json"
43
36
  ],
44
37
  "devDependencies": {
45
- "ava": "^6.1.2",
46
- "typescript": "^5.4.5",
47
- "xo": "^0.58.0"
38
+ "ava": "^2.4.0",
39
+ "tsd": "^0.14.0",
40
+ "xo": "^0.37.1"
48
41
  }
49
42
  }
@@ -6,14 +6,14 @@ The list of boxes is just a [JSON file](boxes.json) and can be used anywhere.
6
6
 
7
7
  ## Install
8
8
 
9
- ```sh
10
- npm install cli-boxes
9
+ ```
10
+ $ npm install cli-boxes
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ```js
16
- import cliBoxes from 'cli-boxes';
16
+ const cliBoxes = require('cli-boxes');
17
17
 
18
18
  console.log(cliBoxes.single);
19
19
  /*
@@ -101,3 +101,15 @@ console.log(cliBoxes.single);
101
101
  ## Related
102
102
 
103
103
  - [boxen](https://github.com/sindresorhus/boxen) - Create boxes in the terminal
104
+
105
+ ---
106
+
107
+ <div align="center">
108
+ <b>
109
+ <a href="https://tidelift.com/subscription/pkg/npm-cli-boxes?utm_source=npm-cli-boxes&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
110
+ </b>
111
+ <br>
112
+ <sub>
113
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
114
+ </sub>
115
+ </div>
@@ -114,5 +114,5 @@ cliTruncate(paragraph, process.stdout.columns);
114
114
  export default function cliTruncate(
115
115
  text: string,
116
116
  columns: number,
117
- options?: Options,
117
+ options?: Options
118
118
  ): string;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-truncate",
3
- "version": "6.0.0",
3
+ "version": "5.2.0",
4
4
  "description": "Truncate a string to a specific width in the terminal",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/cli-truncate",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "sideEffects": false,
19
19
  "engines": {
20
- "node": ">=22"
20
+ "node": ">=20"
21
21
  },
22
22
  "scripts": {
23
23
  "test": "xo && ava && tsd"
@@ -41,12 +41,12 @@
41
41
  "string"
42
42
  ],
43
43
  "dependencies": {
44
- "slice-ansi": "^9.0.0",
44
+ "slice-ansi": "^8.0.0",
45
45
  "string-width": "^8.2.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "ava": "^7.0.0",
49
49
  "tsd": "^0.33.0",
50
- "xo": "^2.0.2"
50
+ "xo": "^1.2.2"
51
51
  }
52
52
  }
@@ -145,6 +145,7 @@ cliTruncate('unicorns', 5, {position: 'end', truncationCharacter: '.'});
145
145
 
146
146
  cliTruncate('unicorns', 5, {position: 'end', truncationCharacter: ''});
147
147
  //=> 'unico'
148
+
148
149
  ```
149
150
 
150
151
  ## Related
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _yogaLayoutPrebuilt = _interopRequireDefault(require("yoga-layout-prebuilt"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const applyMarginStyles = (node, style) => {
13
+ if (style.margin) {
14
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_TOP, style.margin);
15
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.margin);
16
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_START, style.margin);
17
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_END, style.margin);
18
+ }
19
+
20
+ if (style.marginX) {
21
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_START, style.marginX);
22
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_END, style.marginX);
23
+ }
24
+
25
+ if (style.marginY) {
26
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_TOP, style.marginY);
27
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.marginY);
28
+ }
29
+
30
+ if (style.marginTop) {
31
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_TOP, style.marginTop);
32
+ }
33
+
34
+ if (style.marginBottom) {
35
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.marginBottom);
36
+ }
37
+
38
+ if (style.marginLeft) {
39
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_START, style.marginLeft);
40
+ }
41
+
42
+ if (style.marginRight) {
43
+ node.setMargin(_yogaLayoutPrebuilt.default.EDGE_END, style.marginRight);
44
+ }
45
+ };
46
+
47
+ const applyPaddingStyles = (node, style) => {
48
+ if (style.padding) {
49
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_TOP, style.padding);
50
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.padding);
51
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_LEFT, style.padding);
52
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_RIGHT, style.padding);
53
+ }
54
+
55
+ if (style.paddingX) {
56
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_LEFT, style.paddingX);
57
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_RIGHT, style.paddingX);
58
+ }
59
+
60
+ if (style.paddingY) {
61
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_TOP, style.paddingY);
62
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.paddingY);
63
+ }
64
+
65
+ if (style.paddingTop) {
66
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_TOP, style.paddingTop);
67
+ }
68
+
69
+ if (style.paddingBottom) {
70
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.paddingBottom);
71
+ }
72
+
73
+ if (style.paddingLeft) {
74
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_LEFT, style.paddingLeft);
75
+ }
76
+
77
+ if (style.paddingRight) {
78
+ node.setPadding(_yogaLayoutPrebuilt.default.EDGE_RIGHT, style.paddingRight);
79
+ }
80
+ };
81
+
82
+ const applyFlexStyles = (node, style) => {
83
+ if (style.flexGrow) {
84
+ node.setFlexGrow(style.flexGrow);
85
+ }
86
+
87
+ if (style.flexShrink) {
88
+ node.setFlexShrink(style.flexShrink);
89
+ }
90
+
91
+ if (style.flexDirection) {
92
+ if (style.flexDirection === 'row') {
93
+ node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_ROW);
94
+ }
95
+
96
+ if (style.flexDirection === 'row-reverse') {
97
+ node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_ROW_REVERSE);
98
+ }
99
+
100
+ if (style.flexDirection === 'column') {
101
+ node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_COLUMN);
102
+ }
103
+
104
+ if (style.flexDirection === 'column-reverse') {
105
+ node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_COLUMN_REVERSE);
106
+ }
107
+ }
108
+
109
+ if (style.flexBasis !== undefined) {
110
+ node.setFlexBasis(style.flexBasis);
111
+ }
112
+
113
+ if (style.alignItems) {
114
+ if (style.alignItems === 'flex-start') {
115
+ node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_FLEX_START);
116
+ }
117
+
118
+ if (style.alignItems === 'center') {
119
+ node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_CENTER);
120
+ }
121
+
122
+ if (style.alignItems === 'flex-end') {
123
+ node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_FLEX_END);
124
+ }
125
+ }
126
+
127
+ if (style.justifyContent) {
128
+ if (style.justifyContent === 'flex-start') {
129
+ node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_FLEX_START);
130
+ }
131
+
132
+ if (style.justifyContent === 'center') {
133
+ node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_CENTER);
134
+ }
135
+
136
+ if (style.justifyContent === 'flex-end') {
137
+ node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_FLEX_END);
138
+ }
139
+
140
+ if (style.justifyContent === 'space-between') {
141
+ node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_SPACE_BETWEEN);
142
+ }
143
+
144
+ if (style.justifyContent === 'space-around') {
145
+ node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_SPACE_AROUND);
146
+ }
147
+ }
148
+ };
149
+
150
+ const applyDimensionStyles = (node, style) => {
151
+ if (style.width !== undefined) {
152
+ node.setWidth(style.width);
153
+ }
154
+
155
+ if (style.height !== undefined) {
156
+ node.setHeight(style.height);
157
+ }
158
+
159
+ if (style.minWidth !== undefined) {
160
+ node.setMinWidth(style.minWidth);
161
+ }
162
+
163
+ if (style.minHeight !== undefined) {
164
+ node.setMinHeight(style.minHeight);
165
+ }
166
+ };
167
+
168
+ var _default = (node, style = {}) => {
169
+ applyMarginStyles(node, style);
170
+ applyPaddingStyles(node, style);
171
+ applyFlexStyles(node, style);
172
+ applyDimensionStyles(node, style);
173
+ };
174
+
175
+ exports.default = _default;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _yogaLayoutPrebuilt = _interopRequireDefault(require("yoga-layout-prebuilt"));
9
+
10
+ var _applyStyles = _interopRequireDefault(require("./apply-styles"));
11
+
12
+ var _measureText = _interopRequireDefault(require("./measure-text"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ // Traverse the node tree, create Yoga nodes and assign styles to each Yoga node
17
+ const buildLayout = (node, options) => {
18
+ const {
19
+ config,
20
+ terminalWidth,
21
+ skipStaticElements
22
+ } = options;
23
+
24
+ const yogaNode = _yogaLayoutPrebuilt.default.Node.create(config);
25
+
26
+ node.yogaNode = yogaNode;
27
+ const style = node.style || {}; // Root node of the tree
28
+
29
+ if (node.nodeName === 'ROOT') {
30
+ // `terminalWidth` can be `undefined` if env isn't a TTY
31
+ yogaNode.setWidth(terminalWidth || 100);
32
+
33
+ if (node.childNodes.length > 0) {
34
+ const childNodes = node.childNodes.filter(childNode => {
35
+ return skipStaticElements ? !childNode.unstable__static : true;
36
+ });
37
+
38
+ for (const [index, childNode] of Object.entries(childNodes)) {
39
+ const childYogaNode = buildLayout(childNode, options).yogaNode;
40
+ yogaNode.insertChild(childYogaNode, index);
41
+ }
42
+ }
43
+
44
+ return node;
45
+ } // Apply margin, padding, flex, etc styles
46
+
47
+
48
+ (0, _applyStyles.default)(yogaNode, style); // Nodes with only text have a child Yoga node dedicated for that text
49
+
50
+ if (node.textContent || node.nodeValue) {
51
+ const {
52
+ width,
53
+ height
54
+ } = (0, _measureText.default)(node.textContent || node.nodeValue);
55
+ yogaNode.setWidth(style.width || width);
56
+ yogaNode.setHeight(style.height || height);
57
+ return node;
58
+ }
59
+
60
+ if (Array.isArray(node.childNodes) && node.childNodes.length > 0) {
61
+ const childNodes = node.childNodes.filter(childNode => {
62
+ return skipStaticElements ? !childNode.unstable__static : true;
63
+ });
64
+
65
+ for (const [index, childNode] of Object.entries(childNodes)) {
66
+ const {
67
+ yogaNode: childYogaNode
68
+ } = buildLayout(childNode, options);
69
+ yogaNode.insertChild(childYogaNode, index);
70
+ }
71
+ }
72
+
73
+ return node;
74
+ };
75
+
76
+ var _default = buildLayout;
77
+ exports.default = _default;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _measureText = _interopRequireDefault(require("./measure-text"));
9
+
10
+ var _wrapText = _interopRequireDefault(require("./wrap-text"));
11
+
12
+ var _getMaxWidth = _interopRequireDefault(require("./get-max-width"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ // Since we need to know the width of text container to wrap text, we have to calculate layout twice
17
+ // This function is executed after first layout calculation to reassign width and height of text nodes
18
+ const calculateWrappedText = node => {
19
+ if (node.textContent && typeof node.parentNode.style.textWrap === 'string') {
20
+ const {
21
+ yogaNode
22
+ } = node;
23
+ const parentYogaNode = node.parentNode.yogaNode;
24
+ const maxWidth = (0, _getMaxWidth.default)(parentYogaNode);
25
+ const currentWidth = yogaNode.getComputedWidth();
26
+
27
+ if (currentWidth > maxWidth) {
28
+ const {
29
+ textWrap
30
+ } = node.parentNode.style;
31
+ const wrappedText = (0, _wrapText.default)(node.textContent, maxWidth, {
32
+ textWrap
33
+ });
34
+ const {
35
+ width,
36
+ height
37
+ } = (0, _measureText.default)(wrappedText);
38
+ yogaNode.setWidth(width);
39
+ yogaNode.setHeight(height);
40
+ }
41
+
42
+ return;
43
+ }
44
+
45
+ if (Array.isArray(node.childNodes) && node.childNodes.length > 0) {
46
+ for (const childNode of node.childNodes) {
47
+ calculateWrappedText(childNode);
48
+ }
49
+ }
50
+ };
51
+
52
+ var _default = calculateWrappedText;
53
+ exports.default = _default;
@@ -9,12 +9,9 @@ type Props = {
9
9
  readonly writeToStderr: (data: string) => void;
10
10
  readonly exitOnCtrlC: boolean;
11
11
  readonly onExit: (errorOrResult?: unknown) => void;
12
- readonly onWaitUntilRenderFlush: () => Promise<void>;
13
12
  readonly setCursorPosition: (position: CursorPosition | undefined) => void;
14
- readonly interactive: boolean;
15
- readonly renderThrottleMs: number;
16
13
  };
17
- declare function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, exitOnCtrlC, onExit, onWaitUntilRenderFlush, setCursorPosition, interactive, renderThrottleMs, }: Props): React.ReactNode;
14
+ declare function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, exitOnCtrlC, onExit, setCursorPosition, }: Props): React.ReactNode;
18
15
  declare namespace App {
19
16
  var displayName: string;
20
17
  }