ink 4.1.0 → 4.3.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.
package/build/styles.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Boxes } from 'cli-boxes';
1
+ import { type Boxes, type BoxStyle } from 'cli-boxes';
2
2
  import { type LiteralUnion } from 'type-fest';
3
3
  import { type ForegroundColorName } from 'chalk';
4
4
  import { type Node as YogaNode } from 'yoga-wasm-web/auto';
@@ -6,13 +6,29 @@ export type Styles = {
6
6
  readonly textWrap?: 'wrap' | 'end' | 'middle' | 'truncate-end' | 'truncate' | 'truncate-middle' | 'truncate-start';
7
7
  readonly position?: 'absolute' | 'relative';
8
8
  /**
9
- * Gap between element's columns.
9
+ * Size of the gap between an element's columns.
10
10
  */
11
11
  readonly columnGap?: number;
12
12
  /**
13
- * Gap between element's rows.
13
+ * Size of the gap between element's rows.
14
14
  */
15
15
  readonly rowGap?: number;
16
+ /**
17
+ * Size of the gap between an element's columns and rows. Shorthand for `columnGap` and `rowGap`.
18
+ */
19
+ readonly gap?: number;
20
+ /**
21
+ * Margin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft` and `marginRight`.
22
+ */
23
+ readonly margin?: number;
24
+ /**
25
+ * Horizontal margin. Equivalent to setting `marginLeft` and `marginRight`.
26
+ */
27
+ readonly marginX?: number;
28
+ /**
29
+ * Vertical margin. Equivalent to setting `marginTop` and `marginBottom`.
30
+ */
31
+ readonly marginY?: number;
16
32
  /**
17
33
  * Top margin.
18
34
  */
@@ -29,6 +45,18 @@ export type Styles = {
29
45
  * Right margin.
30
46
  */
31
47
  readonly marginRight?: number;
48
+ /**
49
+ * Padding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft` and `paddingRight`.
50
+ */
51
+ readonly padding?: number;
52
+ /**
53
+ * Horizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.
54
+ */
55
+ readonly paddingX?: number;
56
+ /**
57
+ * Vertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.
58
+ */
59
+ readonly paddingY?: number;
32
60
  /**
33
61
  * Top padding.
34
62
  */
@@ -111,18 +139,103 @@ export type Styles = {
111
139
  * Add a border with a specified style.
112
140
  * If `borderStyle` is `undefined` (which it is by default), no border will be added.
113
141
  */
114
- readonly borderStyle?: keyof Boxes;
142
+ readonly borderStyle?: keyof Boxes | BoxStyle;
143
+ /**
144
+ * Determines whether top border is visible.
145
+ *
146
+ * @default true
147
+ */
148
+ readonly borderTop?: boolean;
149
+ /**
150
+ * Determines whether bottom border is visible.
151
+ *
152
+ * @default true
153
+ */
154
+ readonly borderBottom?: boolean;
155
+ /**
156
+ * Determines whether left border is visible.
157
+ *
158
+ * @default true
159
+ */
160
+ readonly borderLeft?: boolean;
161
+ /**
162
+ * Determines whether right border is visible.
163
+ *
164
+ * @default true
165
+ */
166
+ readonly borderRight?: boolean;
115
167
  /**
116
168
  * Change border color.
117
- * Accepts the same values as `color` in <Text> component.
169
+ * Shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor` and `borderLeftColor`.
118
170
  */
119
171
  readonly borderColor?: LiteralUnion<ForegroundColorName, string>;
172
+ /**
173
+ * Change top border color.
174
+ * Accepts the same values as `color` in `Text` component.
175
+ */
176
+ readonly borderTopColor?: LiteralUnion<ForegroundColorName, string>;
177
+ /**
178
+ * Change bottom border color.
179
+ * Accepts the same values as `color` in `Text` component.
180
+ */
181
+ readonly borderBottomColor?: LiteralUnion<ForegroundColorName, string>;
182
+ /**
183
+ * Change left border color.
184
+ * Accepts the same values as `color` in `Text` component.
185
+ */
186
+ readonly borderLeftColor?: LiteralUnion<ForegroundColorName, string>;
187
+ /**
188
+ * Change right border color.
189
+ * Accepts the same values as `color` in `Text` component.
190
+ */
191
+ readonly borderRightColor?: LiteralUnion<ForegroundColorName, string>;
192
+ /**
193
+ * Dim the border color.
194
+ * Shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor` and `borderRightDimColor`.
195
+ *
196
+ * @default false
197
+ */
198
+ readonly borderDimColor?: boolean;
199
+ /**
200
+ * Dim the top border color.
201
+ *
202
+ * @default false
203
+ */
204
+ readonly borderTopDimColor?: boolean;
205
+ /**
206
+ * Dim the bottom border color.
207
+ *
208
+ * @default false
209
+ */
210
+ readonly borderBottomDimColor?: boolean;
211
+ /**
212
+ * Dim the left border color.
213
+ *
214
+ * @default false
215
+ */
216
+ readonly borderLeftDimColor?: boolean;
217
+ /**
218
+ * Dim the right border color.
219
+ *
220
+ * @default false
221
+ */
222
+ readonly borderRightDimColor?: boolean;
223
+ /**
224
+ * Behavior for an element's overflow in both directions.
225
+ *
226
+ * @default 'visible'
227
+ */
228
+ readonly overflow?: 'visible' | 'hidden';
120
229
  /**
121
230
  * Behavior for an element's overflow in horizontal direction.
231
+ *
232
+ * @default 'visible'
122
233
  */
123
234
  readonly overflowX?: 'visible' | 'hidden';
124
235
  /**
125
236
  * Behavior for an element's overflow in vertical direction.
237
+ *
238
+ * @default 'visible'
126
239
  */
127
240
  readonly overflowY?: 'visible' | 'hidden';
128
241
  };
package/build/styles.js CHANGED
@@ -8,6 +8,15 @@ const applyPositionStyles = (node, style) => {
8
8
  }
9
9
  };
10
10
  const applyMarginStyles = (node, style) => {
11
+ if ('margin' in style) {
12
+ node.setMargin(Yoga.EDGE_ALL, style.margin ?? 0);
13
+ }
14
+ if ('marginX' in style) {
15
+ node.setMargin(Yoga.EDGE_HORIZONTAL, style.marginX ?? 0);
16
+ }
17
+ if ('marginY' in style) {
18
+ node.setMargin(Yoga.EDGE_VERTICAL, style.marginY ?? 0);
19
+ }
11
20
  if ('marginLeft' in style) {
12
21
  node.setMargin(Yoga.EDGE_START, style.marginLeft || 0);
13
22
  }
@@ -22,6 +31,15 @@ const applyMarginStyles = (node, style) => {
22
31
  }
23
32
  };
24
33
  const applyPaddingStyles = (node, style) => {
34
+ if ('padding' in style) {
35
+ node.setPadding(Yoga.EDGE_ALL, style.padding ?? 0);
36
+ }
37
+ if ('paddingX' in style) {
38
+ node.setPadding(Yoga.EDGE_HORIZONTAL, style.paddingX ?? 0);
39
+ }
40
+ if ('paddingY' in style) {
41
+ node.setPadding(Yoga.EDGE_VERTICAL, style.paddingY ?? 0);
42
+ }
25
43
  if ('paddingLeft' in style) {
26
44
  node.setPadding(Yoga.EDGE_LEFT, style.paddingLeft || 0);
27
45
  }
@@ -172,14 +190,25 @@ const applyDisplayStyles = (node, style) => {
172
190
  };
173
191
  const applyBorderStyles = (node, style) => {
174
192
  if ('borderStyle' in style) {
175
- const borderWidth = typeof style.borderStyle === 'string' ? 1 : 0;
176
- node.setBorder(Yoga.EDGE_TOP, borderWidth);
177
- node.setBorder(Yoga.EDGE_BOTTOM, borderWidth);
178
- node.setBorder(Yoga.EDGE_LEFT, borderWidth);
179
- node.setBorder(Yoga.EDGE_RIGHT, borderWidth);
193
+ const borderWidth = style.borderStyle ? 1 : 0;
194
+ if (style.borderTop !== false) {
195
+ node.setBorder(Yoga.EDGE_TOP, borderWidth);
196
+ }
197
+ if (style.borderBottom !== false) {
198
+ node.setBorder(Yoga.EDGE_BOTTOM, borderWidth);
199
+ }
200
+ if (style.borderLeft !== false) {
201
+ node.setBorder(Yoga.EDGE_LEFT, borderWidth);
202
+ }
203
+ if (style.borderRight !== false) {
204
+ node.setBorder(Yoga.EDGE_RIGHT, borderWidth);
205
+ }
180
206
  }
181
207
  };
182
208
  const applyGapStyles = (node, style) => {
209
+ if ('gap' in style) {
210
+ node.setGap(Yoga.GUTTER_ALL, style.gap ?? 0);
211
+ }
183
212
  if ('columnGap' in style) {
184
213
  node.setGap(Yoga.GUTTER_COLUMN, style.columnGap ?? 0);
185
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAIA,sDAAsD;AACtD,OAAO,IAA6B,MAAM,oBAAoB,CAAC;AAuK/D,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,KAAa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ChC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ink",
3
- "version": "4.1.0",
3
+ "version": "4.3.0",
4
4
  "description": "React for CLI",
5
5
  "license": "MIT",
6
6
  "repository": "vadimdemedes/ink",
@@ -18,6 +18,7 @@
18
18
  "node": ">=14.16"
19
19
  },
20
20
  "scripts": {
21
+ "dev": "tsc --watch",
21
22
  "build": "tsc",
22
23
  "prepare": "npm run build",
23
24
  "test": "tsc --noEmit && xo && FORCE_COLOR=true ava",
@@ -42,6 +43,7 @@
42
43
  "text"
43
44
  ],
44
45
  "dependencies": {
46
+ "@alcalzone/ansi-tokenize": "^0.1.1",
45
47
  "ansi-escapes": "^6.0.0",
46
48
  "auto-bind": "^5.0.1",
47
49
  "chalk": "^5.2.0",
@@ -51,6 +53,8 @@
51
53
  "code-excerpt": "^4.0.0",
52
54
  "indent-string": "^5.0.0",
53
55
  "is-ci": "^3.0.1",
56
+ "is-lower-case": "^2.0.2",
57
+ "is-upper-case": "^2.0.2",
54
58
  "lodash": "^4.17.21",
55
59
  "patch-console": "^2.0.0",
56
60
  "react-reconciler": "^0.29.0",
@@ -99,7 +103,7 @@
99
103
  "strip-ansi": "^6.0.0",
100
104
  "ts-node": "10.9.1",
101
105
  "typescript": "^4.9.4",
102
- "xo": "^0.53.0"
106
+ "xo": "^0.54.2"
103
107
  },
104
108
  "peerDependencies": {
105
109
  "@types/react": ">=18.0.0",
@@ -147,6 +151,9 @@
147
151
  "react-hooks/exhaustive-deps": "off",
148
152
  "complexity": "off"
149
153
  },
154
+ "ignores": [
155
+ "src/parse-keypress.ts"
156
+ ],
150
157
  "overrides": [
151
158
  {
152
159
  "files": [
@@ -174,7 +181,9 @@
174
181
  "@typescript-eslint/explicit-function-return": "off",
175
182
  "@typescript-eslint/explicit-function-return-type": "off",
176
183
  "dot-notation": "off",
177
- "react/boolean-prop-naming": "off"
184
+ "react/boolean-prop-naming": "off",
185
+ "unicorn/prefer-dom-node-remove": "off",
186
+ "unicorn/prefer-event-target": "off"
178
187
  }
179
188
  },
180
189
  {
package/readme.md CHANGED
@@ -91,6 +91,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
91
91
 
92
92
  ## Who's Using Ink?
93
93
 
94
+ - [GitHub Copilot for CLI](https://githubnext.com/projects/copilot-cli) - Just say what you want the shell to do.
94
95
  - [Cloudflare's Wrangler](https://github.com/cloudflare/wrangler2) - The CLI for Cloudflare Workers.
95
96
  - [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.
96
97
  - [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.
@@ -128,6 +129,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
128
129
  - [turdle](https://github.com/mynameisankit/turdle) - Wordle game.
129
130
  - [Shopify CLI](https://github.com/Shopify/cli) - Build apps, themes, and storefronts for Shopify.
130
131
  - [ToDesktop CLI](https://www.todesktop.com/electron) - An all-in-one platform for building Electron apps.
132
+ - [Walle](https://github.com/Pobepto/walle) - Full-featured crypto wallet for EVM networks.
131
133
 
132
134
  ## Contents
133
135
 
@@ -168,7 +170,7 @@ Alternatively, create a TypeScript project:
168
170
  npx create-ink-app --typescript my-ink-cli
169
171
  ```
170
172
 
171
- <details><summary>Manual setup</summary>
173
+ <details><summary>Manual JavaScript setup</summary>
172
174
  <p>
173
175
  Ink requires the same Babel setup as you would do for regular React-based apps in the browser.
174
176
 
@@ -181,17 +183,7 @@ npm install --save-dev @babel/preset-react
181
183
 
182
184
  ```json
183
185
  {
184
- "presets": [
185
- "@babel/preset-react",
186
- [
187
- "@babel/preset-env",
188
- {
189
- "targets": {
190
- "node": true
191
- }
192
- }
193
- ]
194
- ]
186
+ "presets": ["@babel/preset-react"]
195
187
  }
196
188
  ```
197
189
 
@@ -609,7 +601,7 @@ Default: `0`
609
601
  Size of the gap between an element's columns.
610
602
 
611
603
  ```jsx
612
- <Box gap={1}>
604
+ <Box columnGap={1}>
613
605
  <Text>A</Text>
614
606
  <Text>B</Text>
615
607
  </Box>
@@ -624,7 +616,7 @@ Default: `0`
624
616
  Size of the gap between element's rows.
625
617
 
626
618
  ```jsx
627
- <Box flexDirection="column" gap={1}>
619
+ <Box flexDirection="column" rowGap={1}>
628
620
  <Text>A</Text>
629
621
  <Text>B</Text>
630
622
  </Box>
@@ -929,7 +921,7 @@ Shortcut for setting `overflowX` and `overflowY` at the same time.
929
921
  ##### borderStyle
930
922
 
931
923
  Type: `string`\
932
- Allowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`
924
+ Allowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic` | `BoxStyle`
933
925
 
934
926
  Add a border with a specified style.
935
927
  If `borderStyle` is `undefined` (which it is by default), no border will be added.
@@ -973,14 +965,33 @@ Ink uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-bo
973
965
 
974
966
  <img src="media/box-borderStyle.jpg" width="521">
975
967
 
976
- See example in [examples/borders](examples/borders/borders.js).
968
+ Alternatively, pass a custom border style like so:
969
+
970
+ ```jsx
971
+ <Box
972
+ borderStyle={{
973
+ topLeft: '↘',
974
+ top: '↓',
975
+ topRight: '↙',
976
+ left: '→',
977
+ bottomLeft: '↗',
978
+ bottom: '↑',
979
+ bottomRight: '↖',
980
+ right: '←'
981
+ }}
982
+ >
983
+ <Text>Custom</Text>
984
+ </Box>
985
+ ```
986
+
987
+ See example in [examples/borders](examples/borders/borders.tsx).
977
988
 
978
989
  ##### borderColor
979
990
 
980
991
  Type: `string`
981
992
 
982
993
  Change border color.
983
- Accepts the same values as [`color`](#color) in `<Text>` component.
994
+ Shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor` and `borderLeftColor`.
984
995
 
985
996
  ```jsx
986
997
  <Box borderStyle="round" borderColor="green">
@@ -990,6 +1001,165 @@ Accepts the same values as [`color`](#color) in `<Text>` component.
990
1001
 
991
1002
  <img src="media/box-borderColor.jpg" width="228">
992
1003
 
1004
+ ##### borderTopColor
1005
+
1006
+ Type: `string`
1007
+
1008
+ Change top border color.
1009
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1010
+
1011
+ ```jsx
1012
+ <Box borderStyle="round" borderTopColor="green">
1013
+ <Text>Hello world</Text>
1014
+ </Box>
1015
+ ```
1016
+
1017
+ ##### borderRightColor
1018
+
1019
+ Type: `string`
1020
+
1021
+ Change right border color.
1022
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1023
+
1024
+ ```jsx
1025
+ <Box borderStyle="round" borderRightColor="green">
1026
+ <Text>Hello world</Text>
1027
+ </Box>
1028
+ ```
1029
+
1030
+ ##### borderRightColor
1031
+
1032
+ Type: `string`
1033
+
1034
+ Change right border color.
1035
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1036
+
1037
+ ```jsx
1038
+ <Box borderStyle="round" borderRightColor="green">
1039
+ <Text>Hello world</Text>
1040
+ </Box>
1041
+ ```
1042
+
1043
+ ##### borderBottomColor
1044
+
1045
+ Type: `string`
1046
+
1047
+ Change bottom border color.
1048
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1049
+
1050
+ ```jsx
1051
+ <Box borderStyle="round" borderBottomColor="green">
1052
+ <Text>Hello world</Text>
1053
+ </Box>
1054
+ ```
1055
+
1056
+ ##### borderLeftColor
1057
+
1058
+ Type: `string`
1059
+
1060
+ Change left border color.
1061
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1062
+
1063
+ ```jsx
1064
+ <Box borderStyle="round" borderLeftColor="green">
1065
+ <Text>Hello world</Text>
1066
+ </Box>
1067
+ ```
1068
+
1069
+ ##### borderDimColor
1070
+
1071
+ Type: `boolean`\
1072
+ Default: `false`
1073
+
1074
+ Dim the border color.
1075
+ Shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor` and `borderRightDimColor`.
1076
+
1077
+ ```jsx
1078
+ <Box borderStyle="round" borderDimColor>
1079
+ <Text>Hello world</Text>
1080
+ </Box>
1081
+ ```
1082
+
1083
+ ##### borderTopDimColor
1084
+
1085
+ Type: `boolean`\
1086
+ Default: `false`
1087
+
1088
+ Dim the top border color.
1089
+
1090
+ ```jsx
1091
+ <Box borderStyle="round" borderTopDimColor>
1092
+ <Text>Hello world</Text>
1093
+ </Box>
1094
+ ```
1095
+
1096
+ ##### borderBottomDimColor
1097
+
1098
+ Type: `boolean`\
1099
+ Default: `false`
1100
+
1101
+ Dim the bottom border color.
1102
+
1103
+ ```jsx
1104
+ <Box borderStyle="round" borderBottomDimColor>
1105
+ <Text>Hello world</Text>
1106
+ </Box>
1107
+ ```
1108
+
1109
+ ##### borderLeftDimColor
1110
+
1111
+ Type: `boolean`\
1112
+ Default: `false`
1113
+
1114
+ Dim the left border color.
1115
+
1116
+ ```jsx
1117
+ <Box borderStyle="round" borderLeftDimColor>
1118
+ <Text>Hello world</Text>
1119
+ </Box>
1120
+ ```
1121
+
1122
+ ##### borderRightDimColor
1123
+
1124
+ Type: `boolean`\
1125
+ Default: `false`
1126
+
1127
+ Dim the right border color.
1128
+
1129
+ ```jsx
1130
+ <Box borderStyle="round" borderRightDimColor>
1131
+ <Text>Hello world</Text>
1132
+ </Box>
1133
+ ```
1134
+
1135
+ ##### borderTop
1136
+
1137
+ Type: `boolean`\
1138
+ Default: `true`
1139
+
1140
+ Determines whether top border is visible.
1141
+
1142
+ ##### borderRight
1143
+
1144
+ Type: `boolean`\
1145
+ Default: `true`
1146
+
1147
+ Determines whether right border is visible.
1148
+
1149
+ ##### borderBottom
1150
+
1151
+ Type: `boolean`\
1152
+ Default: `true`
1153
+
1154
+ Determines whether bottom border is visible.
1155
+
1156
+ ##### borderLeft
1157
+
1158
+ Type: `boolean`\
1159
+ Default: `true`
1160
+
1161
+ Determines whether left border is visible.
1162
+
993
1163
  ### `<Newline>`
994
1164
 
995
1165
  Adds one or more newline (`\n`) characters.
@@ -1133,7 +1303,7 @@ render(<Example />);
1133
1303
  that were previously rendered. This means that when you add new items to `items`
1134
1304
  array, changes you make to previous items will not trigger a rerender.
1135
1305
 
1136
- See [examples/static](examples/static/static.js) for an example usage of `<Static>` component.
1306
+ See [examples/static](examples/static/static.tsx) for an example usage of `<Static>` component.
1137
1307
 
1138
1308
  #### items
1139
1309
 
@@ -1223,7 +1393,7 @@ This hook is used for handling user input.
1223
1393
  It's a more convenient alternative to using `useStdin` and listening to `data` events.
1224
1394
  The callback you pass to `useInput` is called for each character when user enters any input.
1225
1395
  However, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.
1226
- You can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.js).
1396
+ You can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.tsx).
1227
1397
 
1228
1398
  ```jsx
1229
1399
  import {useInput} from 'ink';
@@ -1506,7 +1676,7 @@ const Example = () => {
1506
1676
  };
1507
1677
  ```
1508
1678
 
1509
- See additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).
1679
+ See additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.tsx).
1510
1680
 
1511
1681
  ### useStderr()
1512
1682
 
@@ -1599,7 +1769,7 @@ const Example = () => {
1599
1769
  render(<Example />);
1600
1770
  ```
1601
1771
 
1602
- See example in [examples/use-focus](examples/use-focus/use-focus.js) and [examples/use-focus-with-id](examples/use-focus-with-id/use-focus-with-id.js).
1772
+ See example in [examples/use-focus](examples/use-focus/use-focus.tsx) and [examples/use-focus-with-id](examples/use-focus-with-id/use-focus-with-id.tsx).
1603
1773
 
1604
1774
  ### useFocusManager()
1605
1775