ink 4.4.1 → 5.0.1

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 (72) hide show
  1. package/build/apply-styles.js +175 -0
  2. package/build/build-layout.js +77 -0
  3. package/build/calculate-wrapped-text.js +53 -0
  4. package/build/colorize.js.map +1 -1
  5. package/build/components/App.d.ts +1 -1
  6. package/build/components/App.js +198 -296
  7. package/build/components/App.js.map +1 -1
  8. package/build/components/AppContext.js +1 -1
  9. package/build/components/Box.d.ts +51 -1
  10. package/build/components/Box.js +2 -2
  11. package/build/components/Color.js +62 -0
  12. package/build/components/ErrorOverview.js +1 -1
  13. package/build/components/ErrorOverview.js.map +1 -1
  14. package/build/components/FocusContext.js +1 -1
  15. package/build/components/Static.js +1 -1
  16. package/build/components/StderrContext.js +1 -1
  17. package/build/components/StdinContext.js +1 -1
  18. package/build/components/StdoutContext.js +1 -1
  19. package/build/components/Text.d.ts +1 -1
  20. package/build/components/Text.js +1 -1
  21. package/build/components/Text.js.map +1 -1
  22. package/build/components/Transform.js.map +1 -1
  23. package/build/devtools-window-polyfill.js +11 -17
  24. package/build/devtools-window-polyfill.js.map +1 -1
  25. package/build/dom.js +2 -3
  26. package/build/dom.js.map +1 -1
  27. package/build/experimental/apply-style.js +140 -0
  28. package/build/experimental/dom.js +123 -0
  29. package/build/experimental/output.js +91 -0
  30. package/build/experimental/reconciler.js +141 -0
  31. package/build/experimental/renderer.js +81 -0
  32. package/build/get-max-width.js +0 -1
  33. package/build/get-max-width.js.map +1 -1
  34. package/build/hooks/use-focus-manager.js +1 -1
  35. package/build/hooks/use-focus.d.ts +1 -1
  36. package/build/hooks/use-focus.js +2 -2
  37. package/build/hooks/use-focus.js.map +1 -1
  38. package/build/hooks/use-input.js +2 -3
  39. package/build/hooks/use-input.js.map +1 -1
  40. package/build/hooks/useInput.js +38 -0
  41. package/build/ink.js +81 -170
  42. package/build/ink.js.map +1 -1
  43. package/build/instance.js +205 -0
  44. package/build/log-update.d.ts +1 -0
  45. package/build/log-update.js.map +1 -1
  46. package/build/measure-element.js +1 -1
  47. package/build/measure-text.js +1 -1
  48. package/build/measure-text.js.map +1 -1
  49. package/build/output.js +11 -26
  50. package/build/output.js.map +1 -1
  51. package/build/parse-keypress.d.ts +1 -0
  52. package/build/parse-keypress.js +4 -4
  53. package/build/parse-keypress.js.map +1 -1
  54. package/build/reconciler.js +9 -7
  55. package/build/reconciler.js.map +1 -1
  56. package/build/render-border.js +1 -1
  57. package/build/render-border.js.map +1 -1
  58. package/build/render-node-to-output.js +2 -3
  59. package/build/render-node-to-output.js.map +1 -1
  60. package/build/render.d.ts +4 -0
  61. package/build/render.js +3 -3
  62. package/build/render.js.map +1 -1
  63. package/build/renderer.js +5 -5
  64. package/build/renderer.js.map +1 -1
  65. package/build/squash-text-nodes.js.map +1 -1
  66. package/build/styles.d.ts +1 -1
  67. package/build/styles.js +0 -1
  68. package/build/styles.js.map +1 -1
  69. package/build/wrap-text.js +1 -1
  70. package/build/wrap-text.js.map +1 -1
  71. package/package.json +35 -39
  72. package/readme.md +5 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ink",
3
- "version": "4.4.1",
3
+ "version": "5.0.1",
4
4
  "description": "React for CLI",
5
5
  "license": "MIT",
6
6
  "repository": "vadimdemedes/ink",
@@ -15,7 +15,7 @@
15
15
  "default": "./build/index.js"
16
16
  },
17
17
  "engines": {
18
- "node": ">=14.16"
18
+ "node": ">=18"
19
19
  },
20
20
  "scripts": {
21
21
  "dev": "tsc --watch",
@@ -44,66 +44,62 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@alcalzone/ansi-tokenize": "^0.1.3",
47
- "ansi-escapes": "^6.0.0",
47
+ "ansi-escapes": "^7.0.0",
48
+ "ansi-styles": "^6.2.1",
48
49
  "auto-bind": "^5.0.1",
49
- "chalk": "^5.2.0",
50
+ "chalk": "^5.3.0",
50
51
  "cli-boxes": "^3.0.0",
51
52
  "cli-cursor": "^4.0.0",
52
- "cli-truncate": "^3.1.0",
53
+ "cli-truncate": "^4.0.0",
53
54
  "code-excerpt": "^4.0.0",
54
55
  "indent-string": "^5.0.0",
55
- "is-ci": "^3.0.1",
56
- "is-lower-case": "^2.0.2",
57
- "is-upper-case": "^2.0.2",
56
+ "is-in-ci": "^0.1.0",
58
57
  "lodash": "^4.17.21",
59
58
  "patch-console": "^2.0.0",
60
59
  "react-reconciler": "^0.29.0",
61
60
  "scheduler": "^0.23.0",
62
61
  "signal-exit": "^3.0.7",
63
- "slice-ansi": "^6.0.0",
62
+ "slice-ansi": "^7.1.0",
64
63
  "stack-utils": "^2.0.6",
65
- "string-width": "^5.1.2",
66
- "type-fest": "^0.12.0",
67
- "widest-line": "^4.0.1",
68
- "wrap-ansi": "^8.1.0",
69
- "ws": "^8.12.0",
64
+ "string-width": "^7.0.0",
65
+ "type-fest": "^4.8.3",
66
+ "widest-line": "^5.0.0",
67
+ "wrap-ansi": "^9.0.0",
68
+ "ws": "^8.15.0",
70
69
  "yoga-wasm-web": "~0.3.3"
71
70
  },
72
71
  "devDependencies": {
73
- "@faker-js/faker": "^7.6.0",
74
- "@sindresorhus/tsconfig": "3.0.1",
72
+ "@faker-js/faker": "^8.3.1",
73
+ "@sindresorhus/tsconfig": "^5.0.0",
75
74
  "@types/benchmark": "^2.1.2",
76
- "@types/is-ci": "^2.0.0",
77
- "@types/lodash": "^4.14.191",
75
+ "@types/lodash": "^4.14.202",
78
76
  "@types/ms": "^0.7.31",
79
- "@types/node": "*",
80
- "@types/react": "^18.0.0",
77
+ "@types/node": "^20.10.4",
78
+ "@types/react": "^18.2.43",
81
79
  "@types/react-reconciler": "^0.28.2",
82
- "@types/scheduler": "^0.16.2",
80
+ "@types/scheduler": "^0.23.0",
83
81
  "@types/signal-exit": "^3.0.0",
84
- "@types/sinon": "^9.0.4",
85
- "@types/slice-ansi": "^4.0.0",
86
- "@types/stack-utils": "^1.0.1",
87
- "@types/wrap-ansi": "^3.0.0",
88
- "@types/ws": "^8.5.4",
89
- "@vdemedes/prettier-config": "^1.0.1",
82
+ "@types/sinon": "^17.0.3",
83
+ "@types/stack-utils": "^2.0.2",
84
+ "@types/ws": "^8.5.10",
85
+ "@vdemedes/prettier-config": "^2.0.1",
90
86
  "ava": "^5.1.1",
91
87
  "boxen": "^7.0.1",
92
- "delay": "^5.0.0",
88
+ "delay": "^6.0.0",
93
89
  "eslint-config-xo-react": "0.27.0",
94
- "eslint-plugin-react": "7.32.2",
95
- "eslint-plugin-react-hooks": "4.6.0",
90
+ "eslint-plugin-react": "^7.33.2",
91
+ "eslint-plugin-react-hooks": "^4.6.2",
96
92
  "ms": "^2.1.3",
97
- "node-pty": "0.10.1",
98
- "p-queue": "^7.3.4",
99
- "prettier": "^2.0.4",
93
+ "node-pty": "^1.0.0",
94
+ "p-queue": "^8.0.0",
95
+ "prettier": "^3.1.1",
100
96
  "react": "^18.0.0",
101
- "react-devtools-core": "^4.19.1",
102
- "sinon": "^12.0.1",
103
- "strip-ansi": "^6.0.0",
104
- "ts-node": "10.9.1",
105
- "typescript": "^4.9.4",
106
- "xo": "0.54.2"
97
+ "react-devtools-core": "^5.0.0",
98
+ "sinon": "^18.0.0",
99
+ "strip-ansi": "^7.1.0",
100
+ "ts-node": "^10.9.2",
101
+ "typescript": "^5.3.3",
102
+ "xo": "^0.58.0"
107
103
  },
108
104
  "peerDependencies": {
109
105
  "@types/react": ">=18.0.0",
package/readme.md CHANGED
@@ -24,7 +24,7 @@ Since Ink is a React renderer, it means that all features of React are supported
24
24
  Head over to [React](https://reactjs.org) website for documentation on how to use it.
25
25
  Only Ink's methods will be documented in this readme.
26
26
 
27
- **Note:** This is documentation for Ink 4. If you're looking for docs on Ink 3, check out [this release](https://github.com/vadimdemedes/ink/tree/v3.2.0).
27
+ **Note:** This is documentation for Ink 4 and 5. If you're looking for docs on Ink 3, check out [this release](https://github.com/vadimdemedes/ink/tree/v3.2.0).
28
28
 
29
29
  ---
30
30
 
@@ -35,22 +35,7 @@ Only Ink's methods will be documented in this readme.
35
35
  <a href="https://opencollective.com/vadimdemedes">My open source work is supported by the community ❤️</a>
36
36
  </sup>
37
37
  </p>
38
- <sup>Special thanks to:</sup>
39
- <br>
40
- <a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=ink&utm_source=github">
41
- <div>
42
- <img src="https://vadimdemedes.com/github/workos.svg" width="200" alt="WorkOS">
43
- </div>
44
- <b>Your app, enterprise-ready.</b>
45
- <div>
46
- <sub>Start selling to enterprise customers with just a few lines of code.</sub>
47
- <br>
48
- <sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
49
- </div>
50
- </a>
51
38
  </p>
52
- <br>
53
- <br>
54
39
  </div>
55
40
 
56
41
  ## Install
@@ -97,10 +82,10 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
97
82
  - [Gatsby](https://www.gatsbyjs.org) - Gatsby is a modern web framework for blazing fast websites.
98
83
  - [tap](https://node-tap.org) - A Test-Anything-Protocol library for JavaScript.
99
84
  - [Terraform CDK](https://github.com/hashicorp/terraform-cdk) - CDK (Cloud Development Kit) for HashiCorp Terraform.
85
+ - [Specify CLI](https://specifyapp.com) - Automate the distribution of your design tokens.
100
86
  - [Twilio's SIGNAL](https://github.com/twilio-labs/plugin-signal2020) - CLI for Twilio's SIGNAL conference. [Blog post](https://www.twilio.com/blog/building-conference-cli-in-react).
101
87
  - [Typewriter](https://github.com/segmentio/typewriter) - Generates strongly-typed [Segment](https://segment.com) analytics clients from arbitrary JSON Schema.
102
88
  - [Prisma](https://www.prisma.io) - The unified data layer for modern applications.
103
- - [Wallace](https://www.projectwallace.com) - Pretty CSS analytics.
104
89
  - [Blitz](https://blitzjs.com) - The Fullstack React Framework.
105
90
  - [New York Times](https://github.com/nytimes/kyt) - NYT uses Ink `kyt` - a toolkit that encapsulates and manages the configuration for web apps.
106
91
  - [tink](https://github.com/npm/tink) - Next-generation runtime and package manager.
@@ -112,6 +97,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
112
97
  - [Splash](https://github.com/Shopify/polaris-react/tree/master/scripts/splash) - Observe the splash zone of a change across the Shopify's [Polaris](https://polaris.shopify.com) component library.
113
98
  - [emoj](https://github.com/sindresorhus/emoj) - Find relevant emojis.
114
99
  - [emma](https://github.com/maticzav/emma-cli) - Find and install npm packages.
100
+ - [npm-check-extras](https://github.com/akgondber/npm-check-extras) - Check for outdated and unused dependencies, and run update/delete action over selected ones.
115
101
  - [swiff](https://github.com/simple-integrated-marketing/swiff) - Multi-environment command line tools for time-saving web developers.
116
102
  - [share](https://github.com/marionebl/share-cli) - Quickly share files.
117
103
  - [Kubelive](https://github.com/ameerthehacker/kubelive) - CLI for Kubernetes to provide live data about the cluster and its resources.
@@ -131,6 +117,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
131
117
  - [Shopify CLI](https://github.com/Shopify/cli) - Build apps, themes, and storefronts for Shopify.
132
118
  - [ToDesktop CLI](https://www.todesktop.com/electron) - An all-in-one platform for building Electron apps.
133
119
  - [Walle](https://github.com/Pobepto/walle) - Full-featured crypto wallet for EVM networks.
120
+ - [Sudoku](https://github.com/mrozio13pl/sudoku-in-terminal) - Sudoku game.
134
121
 
135
122
  ## Contents
136
123
 
@@ -1859,7 +1846,7 @@ const Example = () => {
1859
1846
 
1860
1847
  Switch focus to the next focusable component.
1861
1848
  If there's no active component right now, focus will be given to the first focusable component.
1862
- If active component is the last in the list of focusable components, focus will be switched to the first component.
1849
+ If active component is the last in the list of focusable components, focus will be switched to the first active component.
1863
1850
 
1864
1851
  **Note:** Ink calls this method when user presses <kbd>Tab</kbd>.
1865
1852