ink 4.1.0 → 4.2.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/readme.md CHANGED
@@ -168,7 +168,7 @@ Alternatively, create a TypeScript project:
168
168
  npx create-ink-app --typescript my-ink-cli
169
169
  ```
170
170
 
171
- <details><summary>Manual setup</summary>
171
+ <details><summary>Manual JavaScript setup</summary>
172
172
  <p>
173
173
  Ink requires the same Babel setup as you would do for regular React-based apps in the browser.
174
174
 
@@ -181,17 +181,7 @@ npm install --save-dev @babel/preset-react
181
181
 
182
182
  ```json
183
183
  {
184
- "presets": [
185
- "@babel/preset-react",
186
- [
187
- "@babel/preset-env",
188
- {
189
- "targets": {
190
- "node": true
191
- }
192
- }
193
- ]
194
- ]
184
+ "presets": ["@babel/preset-react"]
195
185
  }
196
186
  ```
197
187
 
@@ -609,7 +599,7 @@ Default: `0`
609
599
  Size of the gap between an element's columns.
610
600
 
611
601
  ```jsx
612
- <Box gap={1}>
602
+ <Box columnGap={1}>
613
603
  <Text>A</Text>
614
604
  <Text>B</Text>
615
605
  </Box>
@@ -624,7 +614,7 @@ Default: `0`
624
614
  Size of the gap between element's rows.
625
615
 
626
616
  ```jsx
627
- <Box flexDirection="column" gap={1}>
617
+ <Box flexDirection="column" rowGap={1}>
628
618
  <Text>A</Text>
629
619
  <Text>B</Text>
630
620
  </Box>
@@ -929,7 +919,7 @@ Shortcut for setting `overflowX` and `overflowY` at the same time.
929
919
  ##### borderStyle
930
920
 
931
921
  Type: `string`\
932
- Allowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic`
922
+ Allowed values: `single` `double` `round` `bold` `singleDouble` `doubleSingle` `classic` | `BoxStyle`
933
923
 
934
924
  Add a border with a specified style.
935
925
  If `borderStyle` is `undefined` (which it is by default), no border will be added.
@@ -973,14 +963,33 @@ Ink uses border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-bo
973
963
 
974
964
  <img src="media/box-borderStyle.jpg" width="521">
975
965
 
976
- See example in [examples/borders](examples/borders/borders.js).
966
+ Alternatively, pass a custom border style like so:
967
+
968
+ ```jsx
969
+ <Box
970
+ borderStyle={{
971
+ topLeft: '↘',
972
+ top: '↓',
973
+ topRight: '↙',
974
+ left: '→',
975
+ bottomLeft: '↗',
976
+ bottom: '↑',
977
+ bottomRight: '↖',
978
+ right: '←'
979
+ }}
980
+ >
981
+ <Text>Custom</Text>
982
+ </Box>
983
+ ```
984
+
985
+ See example in [examples/borders](examples/borders/borders.tsx).
977
986
 
978
987
  ##### borderColor
979
988
 
980
989
  Type: `string`
981
990
 
982
991
  Change border color.
983
- Accepts the same values as [`color`](#color) in `<Text>` component.
992
+ Shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor` and `borderLeftColor`.
984
993
 
985
994
  ```jsx
986
995
  <Box borderStyle="round" borderColor="green">
@@ -990,6 +999,99 @@ Accepts the same values as [`color`](#color) in `<Text>` component.
990
999
 
991
1000
  <img src="media/box-borderColor.jpg" width="228">
992
1001
 
1002
+ ##### borderTopColor
1003
+
1004
+ Type: `string`
1005
+
1006
+ Change top border color.
1007
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1008
+
1009
+ ```jsx
1010
+ <Box borderStyle="round" borderTopColor="green">
1011
+ <Text>Hello world</Text>
1012
+ </Box>
1013
+ ```
1014
+
1015
+ ##### borderRightColor
1016
+
1017
+ Type: `string`
1018
+
1019
+ Change right border color.
1020
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1021
+
1022
+ ```jsx
1023
+ <Box borderStyle="round" borderRightColor="green">
1024
+ <Text>Hello world</Text>
1025
+ </Box>
1026
+ ```
1027
+
1028
+ ##### borderRightColor
1029
+
1030
+ Type: `string`
1031
+
1032
+ Change right border color.
1033
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1034
+
1035
+ ```jsx
1036
+ <Box borderStyle="round" borderRightColor="green">
1037
+ <Text>Hello world</Text>
1038
+ </Box>
1039
+ ```
1040
+
1041
+ ##### borderBottomColor
1042
+
1043
+ Type: `string`
1044
+
1045
+ Change bottom border color.
1046
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1047
+
1048
+ ```jsx
1049
+ <Box borderStyle="round" borderBottomColor="green">
1050
+ <Text>Hello world</Text>
1051
+ </Box>
1052
+ ```
1053
+
1054
+ ##### borderLeftColor
1055
+
1056
+ Type: `string`
1057
+
1058
+ Change left border color.
1059
+ Accepts the same values as [`color`](#color) in `<Text>` component.
1060
+
1061
+ ```jsx
1062
+ <Box borderStyle="round" borderLeftColor="green">
1063
+ <Text>Hello world</Text>
1064
+ </Box>
1065
+ ```
1066
+
1067
+ ##### borderTop
1068
+
1069
+ Type: `boolean`\
1070
+ Default: `true`
1071
+
1072
+ Determines whether top border is visible.
1073
+
1074
+ ##### borderRight
1075
+
1076
+ Type: `boolean`\
1077
+ Default: `true`
1078
+
1079
+ Determines whether right border is visible.
1080
+
1081
+ ##### borderBottom
1082
+
1083
+ Type: `boolean`\
1084
+ Default: `true`
1085
+
1086
+ Determines whether bottom border is visible.
1087
+
1088
+ ##### borderLeft
1089
+
1090
+ Type: `boolean`\
1091
+ Default: `true`
1092
+
1093
+ Determines whether left border is visible.
1094
+
993
1095
  ### `<Newline>`
994
1096
 
995
1097
  Adds one or more newline (`\n`) characters.
@@ -1133,7 +1235,7 @@ render(<Example />);
1133
1235
  that were previously rendered. This means that when you add new items to `items`
1134
1236
  array, changes you make to previous items will not trigger a rerender.
1135
1237
 
1136
- See [examples/static](examples/static/static.js) for an example usage of `<Static>` component.
1238
+ See [examples/static](examples/static/static.tsx) for an example usage of `<Static>` component.
1137
1239
 
1138
1240
  #### items
1139
1241
 
@@ -1223,7 +1325,7 @@ This hook is used for handling user input.
1223
1325
  It's a more convenient alternative to using `useStdin` and listening to `data` events.
1224
1326
  The callback you pass to `useInput` is called for each character when user enters any input.
1225
1327
  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).
1328
+ You can find a full example of using `useInput` at [examples/use-input](examples/use-input/use-input.tsx).
1227
1329
 
1228
1330
  ```jsx
1229
1331
  import {useInput} from 'ink';
@@ -1506,7 +1608,7 @@ const Example = () => {
1506
1608
  };
1507
1609
  ```
1508
1610
 
1509
- See additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.js).
1611
+ See additional usage example in [examples/use-stdout](examples/use-stdout/use-stdout.tsx).
1510
1612
 
1511
1613
  ### useStderr()
1512
1614
 
@@ -1599,7 +1701,7 @@ const Example = () => {
1599
1701
  render(<Example />);
1600
1702
  ```
1601
1703
 
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).
1704
+ 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
1705
 
1604
1706
  ### useFocusManager()
1605
1707