ink 3.2.0 → 4.0.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/colorize.d.ts +3 -3
- package/build/colorize.js +30 -35
- package/build/colorize.js.map +1 -1
- package/build/components/App.d.ts +12 -12
- package/build/components/App.js +287 -208
- package/build/components/App.js.map +1 -1
- package/build/components/AppContext.d.ts +2 -2
- package/build/components/AppContext.js +5 -6
- package/build/components/AppContext.js.map +1 -1
- package/build/components/Box.d.ts +5 -5
- package/build/components/Box.js +15 -38
- package/build/components/Box.js.map +1 -1
- package/build/components/ErrorOverview.d.ts +5 -5
- package/build/components/ErrorOverview.js +40 -58
- package/build/components/ErrorOverview.js.map +1 -1
- package/build/components/FocusContext.d.ts +2 -2
- package/build/components/FocusContext.js +13 -14
- package/build/components/FocusContext.js.map +1 -1
- package/build/components/Newline.d.ts +4 -5
- package/build/components/Newline.js +4 -9
- package/build/components/Newline.js.map +1 -1
- package/build/components/Spacer.d.ts +2 -3
- package/build/components/Spacer.js +5 -10
- package/build/components/Spacer.js.map +1 -1
- package/build/components/Static.d.ts +5 -9
- package/build/components/Static.js +12 -33
- package/build/components/Static.js.map +1 -1
- package/build/components/StderrContext.d.ts +4 -4
- package/build/components/StderrContext.js +7 -7
- package/build/components/StderrContext.js.map +1 -1
- package/build/components/StdinContext.d.ts +4 -4
- package/build/components/StdinContext.js +8 -7
- package/build/components/StdinContext.js.map +1 -1
- package/build/components/StdoutContext.d.ts +4 -4
- package/build/components/StdoutContext.js +7 -7
- package/build/components/StdoutContext.js.map +1 -1
- package/build/components/Text.d.ts +9 -10
- package/build/components/Text.js +14 -29
- package/build/components/Text.js.map +1 -1
- package/build/components/Transform.d.ts +4 -5
- package/build/components/Transform.js +4 -11
- package/build/components/Transform.js.map +1 -1
- package/build/devtools-window-polyfill.js +3 -8
- package/build/devtools-window-polyfill.js.map +1 -1
- package/build/devtools.d.ts +1 -1
- package/build/devtools.js +6 -6
- package/build/devtools.js.map +1 -1
- package/build/dom.d.ts +14 -17
- package/build/dom.js +34 -47
- package/build/dom.js.map +1 -1
- package/build/get-max-width.d.ts +2 -2
- package/build/get-max-width.js +7 -11
- package/build/get-max-width.js.map +1 -1
- package/build/hooks/use-app.d.ts +1 -1
- package/build/hooks/use-app.js +4 -9
- package/build/hooks/use-app.js.map +1 -1
- package/build/hooks/use-focus-manager.d.ts +3 -3
- package/build/hooks/use-focus-manager.js +4 -9
- package/build/hooks/use-focus-manager.js.map +1 -1
- package/build/hooks/use-focus.d.ts +4 -4
- package/build/hooks/use-focus.js +11 -16
- package/build/hooks/use-focus.js.map +1 -1
- package/build/hooks/use-input.d.ts +5 -5
- package/build/hooks/use-input.js +13 -14
- package/build/hooks/use-input.js.map +1 -1
- package/build/hooks/use-stderr.d.ts +1 -1
- package/build/hooks/use-stderr.js +4 -9
- package/build/hooks/use-stderr.js.map +1 -1
- package/build/hooks/use-stdin.d.ts +1 -1
- package/build/hooks/use-stdin.js +4 -9
- package/build/hooks/use-stdin.js.map +1 -1
- package/build/hooks/use-stdout.d.ts +1 -1
- package/build/hooks/use-stdout.js +4 -9
- package/build/hooks/use-stdout.js.map +1 -1
- package/build/index.d.ts +27 -20
- package/build/index.js +15 -32
- package/build/index.js.map +1 -1
- package/build/ink.d.ts +4 -4
- package/build/ink.js +165 -98
- package/build/ink.js.map +1 -1
- package/build/instances.d.ts +4 -2
- package/build/instances.js +2 -3
- package/build/instances.js.map +1 -1
- package/build/log-update.d.ts +5 -6
- package/build/log-update.js +8 -12
- package/build/log-update.js.map +1 -1
- package/build/measure-element.d.ts +5 -5
- package/build/measure-element.js +5 -9
- package/build/measure-element.js.map +1 -1
- package/build/measure-text.d.ts +4 -4
- package/build/measure-text.js +7 -10
- package/build/measure-text.js.map +1 -1
- package/build/output.d.ts +3 -3
- package/build/output.js +25 -15
- package/build/output.js.map +1 -1
- package/build/reconciler.d.ts +1 -1
- package/build/reconciler.js +97 -76
- package/build/reconciler.js.map +1 -1
- package/build/render-border.d.ts +4 -4
- package/build/render-border.js +8 -12
- package/build/render-border.js.map +1 -1
- package/build/render-node-to-output.d.ts +3 -3
- package/build/render-node-to-output.js +17 -24
- package/build/render-node-to-output.js.map +1 -1
- package/build/render.d.ts +8 -8
- package/build/render.js +23 -20
- package/build/render.js.map +1 -1
- package/build/renderer.d.ts +5 -5
- package/build/renderer.js +11 -16
- package/build/renderer.js.map +1 -1
- package/build/squash-text-nodes.d.ts +1 -1
- package/build/squash-text-nodes.js +1 -3
- package/build/squash-text-nodes.js.map +1 -1
- package/build/styles.d.ts +9 -9
- package/build/styles.js +39 -45
- package/build/styles.js.map +1 -1
- package/build/wrap-text.d.ts +3 -3
- package/build/wrap-text.js +9 -12
- package/build/wrap-text.js.map +1 -1
- package/license +1 -1
- package/package.json +86 -66
- package/readme.md +91 -49
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="react" />
|
|
3
|
-
export
|
|
3
|
+
export type Props = {
|
|
4
4
|
/**
|
|
5
5
|
* Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
|
|
6
6
|
*/
|
|
7
|
-
readonly stdout
|
|
7
|
+
readonly stdout: NodeJS.WriteStream;
|
|
8
8
|
/**
|
|
9
9
|
* Write any string to stdout, while preserving Ink's output.
|
|
10
10
|
* It's useful when you want to display some external information outside of Ink's rendering and ensure there's no conflict between the two.
|
|
11
11
|
* It's similar to `<Static>`, except it can't accept components, it only works with strings.
|
|
12
12
|
*/
|
|
13
13
|
readonly write: (data: string) => void;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
/**
|
|
16
16
|
* `StdoutContext` is a React context, which exposes stdout stream, where Ink renders your app.
|
|
17
17
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const react_1 = require("react");
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { createContext } from 'react';
|
|
4
3
|
/**
|
|
5
4
|
* `StdoutContext` is a React context, which exposes stdout stream, where Ink renders your app.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
const StdoutContext = createContext({
|
|
8
|
+
stdout: process.stdout,
|
|
9
|
+
write() { }
|
|
10
10
|
});
|
|
11
11
|
StdoutContext.displayName = 'InternalStdoutContext';
|
|
12
|
-
|
|
12
|
+
export default StdoutContext;
|
|
13
13
|
//# sourceMappingURL=StdoutContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StdoutContext.js","sourceRoot":"","sources":["../../src/components/StdoutContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StdoutContext.js","sourceRoot":"","sources":["../../src/components/StdoutContext.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAgBpC;;GAEG;AACH,gEAAgE;AAChE,MAAM,aAAa,GAAG,aAAa,CAAQ;IAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,KAAK,KAAI,CAAC;CACV,CAAC,CAAC;AAEH,aAAa,CAAC,WAAW,GAAG,uBAAuB,CAAC;AAEpD,eAAe,aAAa,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ForegroundColorName } from 'chalk';
|
|
3
|
+
import { type LiteralUnion } from 'type-fest';
|
|
4
|
+
import { type Styles } from '../styles.js';
|
|
5
|
+
export type Props = {
|
|
6
6
|
/**
|
|
7
7
|
* Change text color. Ink uses chalk under the hood, so all its functionality is supported.
|
|
8
8
|
*/
|
|
9
|
-
readonly color?: LiteralUnion<
|
|
9
|
+
readonly color?: LiteralUnion<ForegroundColorName, string>;
|
|
10
10
|
/**
|
|
11
11
|
* Same as `color`, but for background.
|
|
12
12
|
*/
|
|
13
|
-
readonly backgroundColor?: LiteralUnion<
|
|
13
|
+
readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
14
14
|
/**
|
|
15
15
|
* Dim the color (emit a small amount of light).
|
|
16
16
|
*/
|
|
@@ -42,9 +42,8 @@ export interface Props {
|
|
|
42
42
|
*/
|
|
43
43
|
readonly wrap?: Styles['textWrap'];
|
|
44
44
|
readonly children?: ReactNode;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
/**
|
|
47
47
|
* This component can display text, and change its style to make it colorful, bold, underline, italic or strikethrough.
|
|
48
48
|
*/
|
|
49
|
-
|
|
50
|
-
export default Text;
|
|
49
|
+
export default function Text({ color, backgroundColor, dimColor, bold, italic, underline, strikethrough, inverse, wrap, children }: Props): JSX.Element | null;
|
package/build/components/Text.js
CHANGED
|
@@ -1,55 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const colorize_1 = __importDefault(require("../colorize"));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import colorize from '../colorize.js';
|
|
9
4
|
/**
|
|
10
5
|
* This component can display text, and change its style to make it colorful, bold, underline, italic or strikethrough.
|
|
11
6
|
*/
|
|
12
|
-
|
|
7
|
+
export default function Text({ color, backgroundColor, dimColor = false, bold = false, italic = false, underline = false, strikethrough = false, inverse = false, wrap = 'wrap', children }) {
|
|
13
8
|
if (children === undefined || children === null) {
|
|
14
9
|
return null;
|
|
15
10
|
}
|
|
16
11
|
const transform = (children) => {
|
|
17
12
|
if (dimColor) {
|
|
18
|
-
children =
|
|
13
|
+
children = chalk.dim(children);
|
|
19
14
|
}
|
|
20
15
|
if (color) {
|
|
21
|
-
children =
|
|
16
|
+
children = colorize(children, color, 'foreground');
|
|
22
17
|
}
|
|
23
18
|
if (backgroundColor) {
|
|
24
|
-
children =
|
|
19
|
+
children = colorize(children, backgroundColor, 'background');
|
|
25
20
|
}
|
|
26
21
|
if (bold) {
|
|
27
|
-
children =
|
|
22
|
+
children = chalk.bold(children);
|
|
28
23
|
}
|
|
29
24
|
if (italic) {
|
|
30
|
-
children =
|
|
25
|
+
children = chalk.italic(children);
|
|
31
26
|
}
|
|
32
27
|
if (underline) {
|
|
33
|
-
children =
|
|
28
|
+
children = chalk.underline(children);
|
|
34
29
|
}
|
|
35
30
|
if (strikethrough) {
|
|
36
|
-
children =
|
|
31
|
+
children = chalk.strikethrough(children);
|
|
37
32
|
}
|
|
38
33
|
if (inverse) {
|
|
39
|
-
children =
|
|
34
|
+
children = chalk.inverse(children);
|
|
40
35
|
}
|
|
41
36
|
return children;
|
|
42
37
|
};
|
|
43
|
-
return (
|
|
44
|
-
}
|
|
45
|
-
Text.displayName = 'Text';
|
|
46
|
-
Text.defaultProps = {
|
|
47
|
-
dimColor: false,
|
|
48
|
-
bold: false,
|
|
49
|
-
italic: false,
|
|
50
|
-
underline: false,
|
|
51
|
-
strikethrough: false,
|
|
52
|
-
wrap: 'wrap'
|
|
53
|
-
};
|
|
54
|
-
exports.default = Text;
|
|
38
|
+
return (React.createElement("ink-text", { style: { flexGrow: 0, flexShrink: 1, flexDirection: 'row', textWrap: wrap }, internal_transform: transform }, children));
|
|
39
|
+
}
|
|
55
40
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB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C,QAAQ,CAAC,CAAC;SACnC;QAED,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,CACN,kCACC,KAAK,EAAE,EAAC,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAC,EACzE,kBAAkB,EAAE,SAAS,IAE5B,QAAQ,CACC,CACX,CAAC;AACH,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type Props = {
|
|
3
3
|
/**
|
|
4
4
|
* Function which transforms children output. It accepts children and must return transformed children too.
|
|
5
5
|
*/
|
|
6
6
|
readonly transform: (children: string) => string;
|
|
7
7
|
readonly children?: ReactNode;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
/**
|
|
10
10
|
* Transform a string representation of React components before they are written to output.
|
|
11
11
|
* For example, you might want to apply a gradient to text, add a clickable link or create some text effects.
|
|
12
12
|
* These use cases can't accept React nodes as input, they are expecting a string.
|
|
13
13
|
* That's what <Transform> component does, it gives you an output string of its child components and lets you transform it in any way.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
export default Transform;
|
|
15
|
+
export default function Transform({ children, transform }: Props): JSX.Element | null;
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
1
|
+
import React from 'react';
|
|
7
2
|
/**
|
|
8
3
|
* Transform a string representation of React components before they are written to output.
|
|
9
4
|
* For example, you might want to apply a gradient to text, add a clickable link or create some text effects.
|
|
10
5
|
* These use cases can't accept React nodes as input, they are expecting a string.
|
|
11
6
|
* That's what <Transform> component does, it gives you an output string of its child components and lets you transform it in any way.
|
|
12
7
|
*/
|
|
13
|
-
|
|
8
|
+
export default function Transform({ children, transform }) {
|
|
14
9
|
if (children === undefined || children === null) {
|
|
15
10
|
return null;
|
|
16
11
|
}
|
|
17
|
-
return (
|
|
18
|
-
}
|
|
19
|
-
Transform.displayName = 'Transform';
|
|
20
|
-
exports.default = Transform;
|
|
12
|
+
return (React.createElement("ink-text", { style: { flexGrow: 0, flexShrink: 1, flexDirection: 'row' }, internal_transform: transform }, children));
|
|
13
|
+
}
|
|
21
14
|
//# sourceMappingURL=Transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../src/components/Transform.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../src/components/Transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAW5C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAQ;IAC7D,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE;QAChD,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,CACN,kCACC,KAAK,EAAE,EAAC,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAC,EACzD,kBAAkB,EAAE,SAAS,IAE5B,QAAQ,CACC,CACX,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
1
|
// Ignoring missing types error to avoid adding another dependency for this hack to work
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import ws from 'ws';
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
9
4
|
const customGlobal = global;
|
|
10
5
|
// These things must exist before importing `react-devtools-core`
|
|
11
6
|
if (!customGlobal.WebSocket) {
|
|
12
|
-
customGlobal.WebSocket =
|
|
7
|
+
customGlobal.WebSocket = ws;
|
|
13
8
|
}
|
|
14
9
|
if (!customGlobal.window) {
|
|
15
10
|
customGlobal.window = global;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-window-polyfill.js","sourceRoot":"","sources":["../src/devtools-window-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devtools-window-polyfill.js","sourceRoot":"","sources":["../src/devtools-window-polyfill.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,mEAAmE;AACnE,MAAM,YAAY,GAAG,MAAa,CAAC;AAEnC,iEAAiE;AACjE,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;IAC5B,YAAY,CAAC,SAAS,GAAG,EAAE,CAAC;CAC5B;AAED,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;IACzB,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED,yEAAyE;AACzE,8EAA8E;AAC9E,gFAAgF;AAChF,sIAAsI;AACtI,YAAY,CAAC,MAAM,CAAC,oCAAoC,GAAG;IAC1D;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,2BAA2B;QAC3B,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,IAAI;KACf;IACD;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,aAAa;QACpB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACb;IACD;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,oBAAoB;QAC3B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACb;IACD;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,uBAAuB;QAC9B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACb;IACD;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,uBAAuB;QAC9B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACb;IACD;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,sBAAsB;QAC7B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACb;IACD;QACC,6BAA6B;QAC7B,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,sBAAsB;QAC7B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KACb;CACD,CAAC"}
|
package/build/devtools.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import './devtools-window-polyfill';
|
|
1
|
+
import './devtools-window-polyfill.js';
|
package/build/devtools.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
// eslint-disable-next-line import/no-unassigned-import
|
|
4
|
-
|
|
5
|
-
// @ts-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import './devtools-window-polyfill.js';
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-expect-error
|
|
5
|
+
import devtools from 'react-devtools-core';
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
7
|
+
devtools.connectToDevTools();
|
|
8
8
|
//# sourceMappingURL=devtools.js.map
|
package/build/devtools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,+BAA+B,CAAC;AAEvC,6DAA6D;AAC7D,mBAAmB;AACnB,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAE3C,6DAA6D;AAC5D,QAAgB,CAAC,iBAAiB,EAAE,CAAC"}
|
package/build/dom.d.ts
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
/// <reference types="yoga-layout" />
|
|
2
2
|
import Yoga from 'yoga-layout-prebuilt';
|
|
3
|
-
import { Styles } from './styles';
|
|
4
|
-
import { OutputTransformer } from './render-node-to-output';
|
|
5
|
-
|
|
6
|
-
parentNode: DOMElement |
|
|
3
|
+
import { type Styles } from './styles.js';
|
|
4
|
+
import { type OutputTransformer } from './render-node-to-output.js';
|
|
5
|
+
type InkNode = {
|
|
6
|
+
parentNode: DOMElement | undefined;
|
|
7
7
|
yogaNode?: Yoga.YogaNode;
|
|
8
8
|
internal_static?: boolean;
|
|
9
9
|
style: Styles;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export declare type DOMElement = {
|
|
10
|
+
};
|
|
11
|
+
export type TextName = '#text';
|
|
12
|
+
export type ElementNames = 'ink-root' | 'ink-box' | 'ink-text' | 'ink-virtual-text';
|
|
13
|
+
export type NodeNames = ElementNames | TextName;
|
|
14
|
+
export type DOMElement = {
|
|
16
15
|
nodeName: ElementNames;
|
|
17
|
-
attributes:
|
|
18
|
-
[key: string]: DOMNodeAttribute;
|
|
19
|
-
};
|
|
16
|
+
attributes: Record<string, DOMNodeAttribute>;
|
|
20
17
|
childNodes: DOMNode[];
|
|
21
18
|
internal_transform?: OutputTransformer;
|
|
22
19
|
isStaticDirty?: boolean;
|
|
23
|
-
staticNode?:
|
|
20
|
+
staticNode?: DOMElement;
|
|
24
21
|
onRender?: () => void;
|
|
25
22
|
onImmediateRender?: () => void;
|
|
26
23
|
} & InkNode;
|
|
27
|
-
export
|
|
24
|
+
export type TextNode = {
|
|
28
25
|
nodeName: TextName;
|
|
29
26
|
nodeValue: string;
|
|
30
27
|
} & InkNode;
|
|
31
|
-
export
|
|
28
|
+
export type DOMNode<T = {
|
|
32
29
|
nodeName: NodeNames;
|
|
33
30
|
}> = T extends {
|
|
34
31
|
nodeName: infer U;
|
|
35
32
|
} ? U extends '#text' ? TextNode : DOMElement : never;
|
|
36
|
-
export
|
|
33
|
+
export type DOMNodeAttribute = boolean | string | number;
|
|
37
34
|
export declare const createNode: (nodeName: ElementNames) => DOMElement;
|
|
38
35
|
export declare const appendChildNode: (node: DOMElement, childNode: DOMElement) => void;
|
|
39
36
|
export declare const insertBeforeNode: (node: DOMElement, newChildNode: DOMNode, beforeChildNode: DOMNode) => void;
|
package/build/dom.js
CHANGED
|
@@ -1,72 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const yoga_layout_prebuilt_1 = __importDefault(require("yoga-layout-prebuilt"));
|
|
8
|
-
const measure_text_1 = __importDefault(require("./measure-text"));
|
|
9
|
-
const styles_1 = __importDefault(require("./styles"));
|
|
10
|
-
const wrap_text_1 = __importDefault(require("./wrap-text"));
|
|
11
|
-
const squash_text_nodes_1 = __importDefault(require("./squash-text-nodes"));
|
|
12
|
-
exports.TEXT_NAME = '#text';
|
|
13
|
-
exports.createNode = (nodeName) => {
|
|
14
|
-
var _a;
|
|
1
|
+
import Yoga from 'yoga-layout-prebuilt';
|
|
2
|
+
import measureText from './measure-text.js';
|
|
3
|
+
import applyStyles from './styles.js';
|
|
4
|
+
import wrapText from './wrap-text.js';
|
|
5
|
+
import squashTextNodes from './squash-text-nodes.js';
|
|
6
|
+
export const createNode = (nodeName) => {
|
|
15
7
|
const node = {
|
|
16
8
|
nodeName,
|
|
17
9
|
style: {},
|
|
18
10
|
attributes: {},
|
|
19
11
|
childNodes: [],
|
|
20
|
-
parentNode:
|
|
21
|
-
yogaNode: nodeName === 'ink-virtual-text' ? undefined :
|
|
12
|
+
parentNode: undefined,
|
|
13
|
+
yogaNode: nodeName === 'ink-virtual-text' ? undefined : Yoga.Node.create()
|
|
22
14
|
};
|
|
23
15
|
if (nodeName === 'ink-text') {
|
|
24
|
-
|
|
16
|
+
node.yogaNode?.setMeasureFunc(measureTextNode.bind(null, node));
|
|
25
17
|
}
|
|
26
18
|
return node;
|
|
27
19
|
};
|
|
28
|
-
|
|
29
|
-
var _a;
|
|
20
|
+
export const appendChildNode = (node, childNode) => {
|
|
30
21
|
if (childNode.parentNode) {
|
|
31
|
-
|
|
22
|
+
removeChildNode(childNode.parentNode, childNode);
|
|
32
23
|
}
|
|
33
24
|
childNode.parentNode = node;
|
|
34
25
|
node.childNodes.push(childNode);
|
|
35
26
|
if (childNode.yogaNode) {
|
|
36
|
-
|
|
27
|
+
node.yogaNode?.insertChild(childNode.yogaNode, node.yogaNode.getChildCount());
|
|
37
28
|
}
|
|
38
29
|
if (node.nodeName === 'ink-text' || node.nodeName === 'ink-virtual-text') {
|
|
39
30
|
markNodeAsDirty(node);
|
|
40
31
|
}
|
|
41
32
|
};
|
|
42
|
-
|
|
43
|
-
var _a, _b;
|
|
33
|
+
export const insertBeforeNode = (node, newChildNode, beforeChildNode) => {
|
|
44
34
|
if (newChildNode.parentNode) {
|
|
45
|
-
|
|
35
|
+
removeChildNode(newChildNode.parentNode, newChildNode);
|
|
46
36
|
}
|
|
47
37
|
newChildNode.parentNode = node;
|
|
48
38
|
const index = node.childNodes.indexOf(beforeChildNode);
|
|
49
39
|
if (index >= 0) {
|
|
50
40
|
node.childNodes.splice(index, 0, newChildNode);
|
|
51
41
|
if (newChildNode.yogaNode) {
|
|
52
|
-
|
|
42
|
+
node.yogaNode?.insertChild(newChildNode.yogaNode, index);
|
|
53
43
|
}
|
|
54
44
|
return;
|
|
55
45
|
}
|
|
56
46
|
node.childNodes.push(newChildNode);
|
|
57
47
|
if (newChildNode.yogaNode) {
|
|
58
|
-
|
|
48
|
+
node.yogaNode?.insertChild(newChildNode.yogaNode, node.yogaNode.getChildCount());
|
|
59
49
|
}
|
|
60
50
|
if (node.nodeName === 'ink-text' || node.nodeName === 'ink-virtual-text') {
|
|
61
51
|
markNodeAsDirty(node);
|
|
62
52
|
}
|
|
63
53
|
};
|
|
64
|
-
|
|
65
|
-
var _a, _b;
|
|
54
|
+
export const removeChildNode = (node, removeNode) => {
|
|
66
55
|
if (removeNode.yogaNode) {
|
|
67
|
-
|
|
56
|
+
removeNode.parentNode?.yogaNode?.removeChild(removeNode.yogaNode);
|
|
68
57
|
}
|
|
69
|
-
removeNode.parentNode =
|
|
58
|
+
removeNode.parentNode = undefined;
|
|
70
59
|
const index = node.childNodes.indexOf(removeNode);
|
|
71
60
|
if (index >= 0) {
|
|
72
61
|
node.childNodes.splice(index, 1);
|
|
@@ -75,30 +64,29 @@ exports.removeChildNode = (node, removeNode) => {
|
|
|
75
64
|
markNodeAsDirty(node);
|
|
76
65
|
}
|
|
77
66
|
};
|
|
78
|
-
|
|
67
|
+
export const setAttribute = (node, key, value) => {
|
|
79
68
|
node.attributes[key] = value;
|
|
80
69
|
};
|
|
81
|
-
|
|
70
|
+
export const setStyle = (node, style) => {
|
|
82
71
|
node.style = style;
|
|
83
72
|
if (node.yogaNode) {
|
|
84
|
-
|
|
73
|
+
applyStyles(node.yogaNode, style);
|
|
85
74
|
}
|
|
86
75
|
};
|
|
87
|
-
|
|
76
|
+
export const createTextNode = (text) => {
|
|
88
77
|
const node = {
|
|
89
78
|
nodeName: '#text',
|
|
90
79
|
nodeValue: text,
|
|
91
80
|
yogaNode: undefined,
|
|
92
|
-
parentNode:
|
|
81
|
+
parentNode: undefined,
|
|
93
82
|
style: {}
|
|
94
83
|
};
|
|
95
|
-
|
|
84
|
+
setTextNodeValue(node, text);
|
|
96
85
|
return node;
|
|
97
86
|
};
|
|
98
87
|
const measureTextNode = function (node, width) {
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
const dimensions = measure_text_1.default(text);
|
|
88
|
+
const text = node.nodeName === '#text' ? node.nodeValue : squashTextNodes(node);
|
|
89
|
+
const dimensions = measureText(text);
|
|
102
90
|
// Text fits into container, no need to wrap
|
|
103
91
|
if (dimensions.width <= width) {
|
|
104
92
|
return dimensions;
|
|
@@ -108,23 +96,22 @@ const measureTextNode = function (node, width) {
|
|
|
108
96
|
if (dimensions.width >= 1 && width > 0 && width < 1) {
|
|
109
97
|
return dimensions;
|
|
110
98
|
}
|
|
111
|
-
const textWrap =
|
|
112
|
-
const wrappedText =
|
|
113
|
-
return
|
|
99
|
+
const textWrap = node.style?.textWrap ?? 'wrap';
|
|
100
|
+
const wrappedText = wrapText(text, width, textWrap);
|
|
101
|
+
return measureText(wrappedText);
|
|
114
102
|
};
|
|
115
103
|
const findClosestYogaNode = (node) => {
|
|
116
|
-
|
|
117
|
-
if (!node || !node.parentNode) {
|
|
104
|
+
if (!node?.parentNode) {
|
|
118
105
|
return undefined;
|
|
119
106
|
}
|
|
120
|
-
return
|
|
107
|
+
return node.yogaNode ?? findClosestYogaNode(node.parentNode);
|
|
121
108
|
};
|
|
122
109
|
const markNodeAsDirty = (node) => {
|
|
123
110
|
// Mark closest Yoga node as dirty to measure text dimensions again
|
|
124
111
|
const yogaNode = findClosestYogaNode(node);
|
|
125
|
-
yogaNode
|
|
112
|
+
yogaNode?.markDirty();
|
|
126
113
|
};
|
|
127
|
-
|
|
114
|
+
export const setTextNodeValue = (node, text) => {
|
|
128
115
|
if (typeof text !== 'string') {
|
|
129
116
|
text = String(text);
|
|
130
117
|
}
|
package/build/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,OAAO,IAAqB,MAAM,sBAAsB,CAAC;AACzD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C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
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const getMaxWidth: (yogaNode: Yoga.YogaNode) => number;
|
|
3
|
+
export default getMaxWidth;
|
package/build/get-max-width.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const yoga_layout_prebuilt_1 = __importDefault(require("yoga-layout-prebuilt"));
|
|
7
|
-
exports.default = (yogaNode) => {
|
|
1
|
+
import Yoga from 'yoga-layout-prebuilt';
|
|
2
|
+
const getMaxWidth = (yogaNode) => {
|
|
8
3
|
return (yogaNode.getComputedWidth() -
|
|
9
|
-
yogaNode.getComputedPadding(
|
|
10
|
-
yogaNode.getComputedPadding(
|
|
11
|
-
yogaNode.getComputedBorder(
|
|
12
|
-
yogaNode.getComputedBorder(
|
|
4
|
+
yogaNode.getComputedPadding(Yoga.EDGE_LEFT) -
|
|
5
|
+
yogaNode.getComputedPadding(Yoga.EDGE_RIGHT) -
|
|
6
|
+
yogaNode.getComputedBorder(Yoga.EDGE_LEFT) -
|
|
7
|
+
yogaNode.getComputedBorder(Yoga.EDGE_RIGHT));
|
|
13
8
|
};
|
|
9
|
+
export default getMaxWidth;
|
|
14
10
|
//# sourceMappingURL=get-max-width.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-max-width.js","sourceRoot":"","sources":["../src/get-max-width.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-max-width.js","sourceRoot":"","sources":["../src/get-max-width.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,sBAAsB,CAAC;AAExC,MAAM,WAAW,GAAG,CAAC,QAAuB,EAAE,EAAE;IAC/C,OAAO,CACN,QAAQ,CAAC,gBAAgB,EAAE;QAC3B,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3C,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;QAC5C,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC;QAC1C,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAC3C,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/build/hooks/use-app.d.ts
CHANGED
package/build/hooks/use-app.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const AppContext_1 = __importDefault(require("../components/AppContext"));
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import AppContext from '../components/AppContext.js';
|
|
8
3
|
/**
|
|
9
4
|
* `useApp` is a React hook, which exposes a method to manually exit the app (unmount).
|
|
10
5
|
*/
|
|
11
|
-
const useApp = () =>
|
|
12
|
-
|
|
6
|
+
const useApp = () => useContext(AppContext);
|
|
7
|
+
export default useApp;
|
|
13
8
|
//# sourceMappingURL=use-app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-app.js","sourceRoot":"","sources":["../../src/hooks/use-app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-app.js","sourceRoot":"","sources":["../../src/hooks/use-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC5C,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Props } from '../components/FocusContext';
|
|
2
|
-
|
|
1
|
+
import { type Props } from '../components/FocusContext.js';
|
|
2
|
+
type Output = {
|
|
3
3
|
/**
|
|
4
4
|
* Enable focus management for all components.
|
|
5
5
|
*/
|
|
@@ -25,7 +25,7 @@ interface Output {
|
|
|
25
25
|
* If there's no element with that `id`, focus will be given to the first focusable component.
|
|
26
26
|
*/
|
|
27
27
|
focus: Props['focus'];
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
/**
|
|
30
30
|
* This hook exposes methods to enable or disable focus management for all
|
|
31
31
|
* components or manually switch focus to next or previous components.
|