Comparing version 3.0.0 to 3.0.1
import type { FC, ReactNode } from 'react'; | ||
import type { Styles } from '../styles'; | ||
import type { LiteralUnion } from 'type-fest'; | ||
import type { ForegroundColor, BackgroundColor } from 'chalk'; | ||
export interface Props { | ||
@@ -7,7 +9,7 @@ /** | ||
*/ | ||
readonly color?: string; | ||
readonly color?: LiteralUnion<typeof ForegroundColor, string>; | ||
/** | ||
* Same as `color`, but for background. | ||
*/ | ||
readonly backgroundColor?: string; | ||
readonly backgroundColor?: LiteralUnion<typeof BackgroundColor, string>; | ||
/** | ||
@@ -14,0 +16,0 @@ * Dim the color (emit a small amount of light). |
@@ -22,2 +22,10 @@ /** | ||
/** | ||
* Page Down key was pressed. | ||
*/ | ||
pageDown: boolean; | ||
/** | ||
* Page Up key was pressed. | ||
*/ | ||
pageUp: boolean; | ||
/** | ||
* Return (Enter) key was pressed. | ||
@@ -24,0 +32,0 @@ */ |
@@ -54,2 +54,4 @@ "use strict"; | ||
rightArrow: input === '\u001B[C', | ||
pageDown: input === '\u001B[6~', | ||
pageUp: input === '\u001B[5~', | ||
return: input === '\r', | ||
@@ -56,0 +58,0 @@ escape: input === '\u001B', |
@@ -50,2 +50,5 @@ "use strict"; | ||
createInstance: (originalType, newProps, _root, hostContext) => { | ||
if (hostContext.isInsideText && originalType === 'ink-box') { | ||
throw new Error(`<Box> can’t be nested inside <Text> component`); | ||
} | ||
const type = originalType === 'ink-text' && hostContext.isInsideText | ||
@@ -131,2 +134,14 @@ ? 'ink-virtual-text' | ||
for (const styleKey of styleKeys) { | ||
// Always include `borderColor` and `borderStyle` to ensure border is rendered, | ||
// otherwise resulting `updatePayload` may not contain them | ||
// if they weren't changed during this update | ||
if (styleKey === 'borderStyle' || styleKey === 'borderColor') { | ||
if (typeof updatePayload.style !== 'object') { | ||
// Linter didn't like `= {} as Style` | ||
const style = {}; | ||
updatePayload.style = style; | ||
} | ||
updatePayload.style.borderStyle = newStyle.borderStyle; | ||
updatePayload.style.borderColor = newStyle.borderColor; | ||
} | ||
if (newStyle[styleKey] !== oldStyle[styleKey]) { | ||
@@ -133,0 +148,0 @@ if (typeof updatePayload.style !== 'object') { |
{ | ||
"name": "ink", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "React for CLI", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -23,3 +23,3 @@ <h1 align="center"> | ||
**Note:** This is documentation for Ink 3, which is unreleased yet. If you're looking for docs on Ink 2, check out [this release](https://github.com/vadimdemedes/ink/tree/v2.7.1). There's also a [migration guide](migrate.md) from Ink 2 available. | ||
**Note:** This is documentation for Ink 3. If you're looking for docs on Ink 2, check out [this release](https://github.com/vadimdemedes/ink/tree/v2.7.1). There's also a [migration guide](migrate.md) from Ink 2 available. | ||
@@ -215,2 +215,4 @@ ## Install | ||
**Note:** `<Text>` allows only text nodes and nested `<Text>` components inside of it. For example, `<Box>` component can't be used inside `<Text>`. | ||
#### color | ||
@@ -1165,2 +1167,12 @@ | ||
###### key.pageDown | ||
###### key.pageUp | ||
Type: `boolean`\ | ||
Default: `false` | ||
If Page Up or Page Down key was pressed, the corresponding property will be `true`. | ||
For example, if user presses Page Down, `key.pageDown` equals `true`. | ||
###### key.meta | ||
@@ -1167,0 +1179,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
285079
3914
1750