ink 5.0.0 → 5.1.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/apply-styles.js +175 -0
- package/build/build-layout.js +77 -0
- package/build/calculate-wrapped-text.js +53 -0
- package/build/components/App.d.ts +0 -2
- package/build/components/App.js +2 -2
- package/build/components/App.js.map +1 -1
- package/build/components/AppContext.d.ts +0 -1
- package/build/components/Box.d.ts +22 -22
- package/build/components/Color.js +62 -0
- package/build/components/FocusContext.d.ts +0 -1
- package/build/components/StderrContext.d.ts +0 -2
- package/build/components/StdinContext.d.ts +0 -3
- package/build/components/StdoutContext.d.ts +0 -2
- package/build/devtools-window-polyfill.js +3 -9
- package/build/devtools-window-polyfill.js.map +1 -1
- package/build/experimental/apply-style.js +140 -0
- package/build/experimental/dom.js +123 -0
- package/build/experimental/output.js +91 -0
- package/build/experimental/reconciler.js +141 -0
- package/build/experimental/renderer.js +81 -0
- package/build/hooks/useInput.js +38 -0
- package/build/ink.d.ts +0 -1
- package/build/ink.js +5 -7
- package/build/ink.js.map +1 -1
- package/build/instance.js +205 -0
- package/build/instances.d.ts +0 -1
- package/build/log-update.d.ts +0 -1
- package/build/parse-keypress.d.ts +0 -1
- package/build/reconciler.js +2 -2
- package/build/reconciler.js.map +1 -1
- package/build/render.d.ts +0 -5
- package/build/styles.d.ts +1 -1
- package/build/styles.js +3 -0
- package/build/styles.js.map +1 -1
- package/build/wrap-text.d.ts +1 -1
- package/package.json +21 -22
- package/readme.md +13 -5
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _yogaLayoutPrebuilt = _interopRequireDefault(require("yoga-layout-prebuilt"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const applyPositionStyles = (node, style) => {
|
|
13
|
+
if (!style.position) {
|
|
14
|
+
node.setPositionType(NaN);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (style.position === 'absolute') {
|
|
18
|
+
node.setPositionType(_yogaLayoutPrebuilt.default.POSITION_TYPE_ABSOLUTE);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const applyMarginStyles = (node, style) => {
|
|
23
|
+
node.setMargin(_yogaLayoutPrebuilt.default.EDGE_START, style.marginLeft || style.marginX || style.margin || 0);
|
|
24
|
+
node.setMargin(_yogaLayoutPrebuilt.default.EDGE_END, style.marginRight || style.marginX || style.margin || 0);
|
|
25
|
+
node.setMargin(_yogaLayoutPrebuilt.default.EDGE_TOP, style.marginTop || style.marginY || style.margin || 0);
|
|
26
|
+
node.setMargin(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.marginBottom || style.marginY || style.margin || 0);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const applyPaddingStyles = (node, style) => {
|
|
30
|
+
node.setPadding(_yogaLayoutPrebuilt.default.EDGE_LEFT, style.paddingLeft || style.paddingX || style.padding || 0);
|
|
31
|
+
node.setPadding(_yogaLayoutPrebuilt.default.EDGE_RIGHT, style.paddingRight || style.paddingX || style.padding || 0);
|
|
32
|
+
node.setPadding(_yogaLayoutPrebuilt.default.EDGE_TOP, style.paddingTop || style.paddingY || style.padding || 0);
|
|
33
|
+
node.setPadding(_yogaLayoutPrebuilt.default.EDGE_BOTTOM, style.paddingBottom || style.paddingY || style.padding || 0);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const applyFlexStyles = (node, style) => {
|
|
37
|
+
node.setFlexGrow(style.flexGrow || 0);
|
|
38
|
+
node.setFlexShrink(typeof style.flexShrink === 'number' ? style.flexShrink : 1);
|
|
39
|
+
|
|
40
|
+
if (style.flexDirection === 'row') {
|
|
41
|
+
node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_ROW);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (style.flexDirection === 'row-reverse') {
|
|
45
|
+
node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_ROW_REVERSE);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (style.flexDirection === 'column') {
|
|
49
|
+
node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_COLUMN);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (style.flexDirection === 'column-reverse') {
|
|
53
|
+
node.setFlexDirection(_yogaLayoutPrebuilt.default.FLEX_DIRECTION_COLUMN_REVERSE);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (typeof style.flexBasis === 'number') {
|
|
57
|
+
node.setFlexBasis(style.flexBasis);
|
|
58
|
+
} else if (typeof style.flexBasis === 'string') {
|
|
59
|
+
node.setFlexBasisPercent(parseInt(style.flexBasis, 10));
|
|
60
|
+
} else {
|
|
61
|
+
// This should be replaced with node.setFlexBasisAuto() when new Yoga release is out
|
|
62
|
+
node.setFlexBasis(NaN);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (style.alignItems === 'stretch' || !style.alignItems) {
|
|
66
|
+
node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_STRETCH);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (style.alignItems === 'flex-start') {
|
|
70
|
+
node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_FLEX_START);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (style.alignItems === 'center') {
|
|
74
|
+
node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_CENTER);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (style.alignItems === 'flex-end') {
|
|
78
|
+
node.setAlignItems(_yogaLayoutPrebuilt.default.ALIGN_FLEX_END);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (style.justifyContent === 'flex-start' || !style.justifyContent) {
|
|
82
|
+
node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_FLEX_START);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (style.justifyContent === 'center') {
|
|
86
|
+
node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_CENTER);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (style.justifyContent === 'flex-end') {
|
|
90
|
+
node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_FLEX_END);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (style.justifyContent === 'space-between') {
|
|
94
|
+
node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_SPACE_BETWEEN);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (style.justifyContent === 'space-around') {
|
|
98
|
+
node.setJustifyContent(_yogaLayoutPrebuilt.default.JUSTIFY_SPACE_AROUND);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const applyDimensionStyles = (node, style) => {
|
|
103
|
+
if (typeof style.width === 'number') {
|
|
104
|
+
node.setWidth(style.width);
|
|
105
|
+
} else if (typeof style.width === 'string') {
|
|
106
|
+
node.setWidthPercent(parseInt(style.width, 10));
|
|
107
|
+
} else {
|
|
108
|
+
node.setWidthAuto();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (typeof style.height === 'number') {
|
|
112
|
+
node.setHeight(style.height);
|
|
113
|
+
} else if (typeof style.height === 'string') {
|
|
114
|
+
node.setHeightPercent(parseInt(style.height, 10));
|
|
115
|
+
} else {
|
|
116
|
+
node.setHeightAuto();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (typeof style.minWidth === 'string') {
|
|
120
|
+
node.setMinWidthPercent(parseInt(style.minWidth, 10));
|
|
121
|
+
} else {
|
|
122
|
+
node.setMinWidth(style.minWidth || 0);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (typeof style.minHeight === 'string') {
|
|
126
|
+
node.setMinHeightPercent(parseInt(style.minHeight, 10));
|
|
127
|
+
} else {
|
|
128
|
+
node.setMinHeight(style.minHeight || 0);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var _default = (node, style = {}) => {
|
|
133
|
+
applyPositionStyles(node, style);
|
|
134
|
+
applyMarginStyles(node, style);
|
|
135
|
+
applyPaddingStyles(node, style);
|
|
136
|
+
applyFlexStyles(node, style);
|
|
137
|
+
applyDimensionStyles(node, style);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
exports.default = _default;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setTextContent = exports.createTextNode = exports.setAttribute = exports.setStyle = exports.removeChildNode = exports.insertBeforeNode = exports.appendChildNode = exports.createNode = void 0;
|
|
7
|
+
|
|
8
|
+
var _yogaLayoutPrebuilt = _interopRequireDefault(require("yoga-layout-prebuilt"));
|
|
9
|
+
|
|
10
|
+
var _measureText = _interopRequireDefault(require("../measure-text"));
|
|
11
|
+
|
|
12
|
+
var _applyStyle = _interopRequireDefault(require("./apply-style"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
// Helper utilities implementing some common DOM methods to simplify reconciliation code
|
|
17
|
+
const createNode = tagName => ({
|
|
18
|
+
nodeName: tagName.toUpperCase(),
|
|
19
|
+
style: {},
|
|
20
|
+
attributes: {},
|
|
21
|
+
childNodes: [],
|
|
22
|
+
parentNode: null,
|
|
23
|
+
textContent: null,
|
|
24
|
+
yogaNode: _yogaLayoutPrebuilt.default.Node.create()
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
exports.createNode = createNode;
|
|
28
|
+
|
|
29
|
+
const appendChildNode = (node, childNode) => {
|
|
30
|
+
if (childNode.parentNode) {
|
|
31
|
+
removeChildNode(childNode.parentNode, childNode);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
childNode.parentNode = node;
|
|
35
|
+
node.childNodes.push(childNode);
|
|
36
|
+
node.yogaNode.insertChild(childNode.yogaNode, node.yogaNode.getChildCount());
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.appendChildNode = appendChildNode;
|
|
40
|
+
|
|
41
|
+
const insertBeforeNode = (node, newChildNode, beforeChildNode) => {
|
|
42
|
+
if (newChildNode.parentNode) {
|
|
43
|
+
removeChildNode(newChildNode.parentNode, newChildNode);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
newChildNode.parentNode = node;
|
|
47
|
+
const index = node.childNodes.indexOf(beforeChildNode);
|
|
48
|
+
|
|
49
|
+
if (index >= 0) {
|
|
50
|
+
node.childNodes.splice(index, 0, newChildNode);
|
|
51
|
+
node.yogaNode.insertChild(newChildNode.yogaNode, index);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
node.childNodes.push(newChildNode);
|
|
56
|
+
node.yogaNode.insertChild(newChildNode.yogaNode, node.yogaNode.getChildCount());
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.insertBeforeNode = insertBeforeNode;
|
|
60
|
+
|
|
61
|
+
const removeChildNode = (node, removeNode) => {
|
|
62
|
+
removeNode.parentNode.yogaNode.removeChild(removeNode.yogaNode);
|
|
63
|
+
removeNode.parentNode = null;
|
|
64
|
+
const index = node.childNodes.indexOf(removeNode);
|
|
65
|
+
|
|
66
|
+
if (index >= 0) {
|
|
67
|
+
node.childNodes.splice(index, 1);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.removeChildNode = removeChildNode;
|
|
72
|
+
|
|
73
|
+
const setStyle = (node, style) => {
|
|
74
|
+
node.style = style;
|
|
75
|
+
(0, _applyStyle.default)(node.yogaNode, style);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.setStyle = setStyle;
|
|
79
|
+
|
|
80
|
+
const setAttribute = (node, key, value) => {
|
|
81
|
+
node.attributes[key] = value;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
exports.setAttribute = setAttribute;
|
|
85
|
+
|
|
86
|
+
const createTextNode = text => {
|
|
87
|
+
const node = {
|
|
88
|
+
nodeName: '#text',
|
|
89
|
+
nodeValue: text,
|
|
90
|
+
yogaNode: _yogaLayoutPrebuilt.default.Node.create()
|
|
91
|
+
};
|
|
92
|
+
setTextContent(node, text);
|
|
93
|
+
return node;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.createTextNode = createTextNode;
|
|
97
|
+
|
|
98
|
+
const setTextContent = (node, text) => {
|
|
99
|
+
if (typeof text !== 'string') {
|
|
100
|
+
text = String(text);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let width = 0;
|
|
104
|
+
let height = 0;
|
|
105
|
+
|
|
106
|
+
if (text.length > 0) {
|
|
107
|
+
const dimensions = (0, _measureText.default)(text);
|
|
108
|
+
width = dimensions.width;
|
|
109
|
+
height = dimensions.height;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (node.nodeName === '#text') {
|
|
113
|
+
node.nodeValue = text;
|
|
114
|
+
node.yogaNode.setWidth(width);
|
|
115
|
+
node.yogaNode.setHeight(height);
|
|
116
|
+
} else {
|
|
117
|
+
node.textContent = text;
|
|
118
|
+
node.yogaNode.setWidth(node.style.width || width);
|
|
119
|
+
node.yogaNode.setHeight(node.style.height || height);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
exports.setTextContent = setTextContent;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _stringLength = _interopRequireDefault(require("string-length"));
|
|
9
|
+
|
|
10
|
+
var _sliceAnsi = _interopRequireDefault(require("slice-ansi"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* "Virtual" output class
|
|
16
|
+
*
|
|
17
|
+
* Handles the positioning and saving of the output of each node in the tree.
|
|
18
|
+
* Also responsible for applying transformations to each character of the output.
|
|
19
|
+
*
|
|
20
|
+
* Used to generate the final output of all nodes before writing it to actual output stream (e.g. stdout)
|
|
21
|
+
*/
|
|
22
|
+
class Output {
|
|
23
|
+
constructor({
|
|
24
|
+
width,
|
|
25
|
+
height
|
|
26
|
+
}) {
|
|
27
|
+
this.width = width;
|
|
28
|
+
this.height = height;
|
|
29
|
+
this.writes = []; // Initialize output array with a specific set of rows, so that margin/padding at the bottom is preserved
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
write(x, y, text, {
|
|
33
|
+
transformers
|
|
34
|
+
}) {
|
|
35
|
+
if (!text) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
this.writes.push({
|
|
40
|
+
x,
|
|
41
|
+
y,
|
|
42
|
+
text,
|
|
43
|
+
transformers
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get() {
|
|
48
|
+
const output = [];
|
|
49
|
+
|
|
50
|
+
for (let y = 0; y < this.height; y++) {
|
|
51
|
+
output.push(' '.repeat(this.width));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const write of this.writes) {
|
|
55
|
+
const {
|
|
56
|
+
x,
|
|
57
|
+
y,
|
|
58
|
+
text,
|
|
59
|
+
transformers
|
|
60
|
+
} = write;
|
|
61
|
+
const lines = text.split('\n');
|
|
62
|
+
let offsetY = 0;
|
|
63
|
+
|
|
64
|
+
for (let line of lines) {
|
|
65
|
+
const currentLine = output[y + offsetY]; // Line can be missing if `text` is taller than height of pre-initialized `this.output`
|
|
66
|
+
|
|
67
|
+
if (!currentLine) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const length = (0, _stringLength.default)(line);
|
|
72
|
+
|
|
73
|
+
for (const transformer of transformers) {
|
|
74
|
+
line = transformer(line);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
output[y + offsetY] = (0, _sliceAnsi.default)(currentLine, 0, x) + line + (0, _sliceAnsi.default)(currentLine, x + length);
|
|
78
|
+
offsetY++;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const generatedOutput = output.map(line => line.trimRight()).join('\n');
|
|
83
|
+
return {
|
|
84
|
+
output: generatedOutput,
|
|
85
|
+
height: output.length
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.default = Output;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _scheduler = require("scheduler");
|
|
9
|
+
|
|
10
|
+
var _reactReconciler = _interopRequireDefault(require("react-reconciler"));
|
|
11
|
+
|
|
12
|
+
var _dom = require("./dom");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const NO_CONTEXT = true;
|
|
17
|
+
const hostConfig = {
|
|
18
|
+
schedulePassiveEffects: _scheduler.unstable_scheduleCallback,
|
|
19
|
+
cancelPassiveEffects: _scheduler.unstable_cancelCallback,
|
|
20
|
+
now: Date.now,
|
|
21
|
+
getRootHostContext: () => NO_CONTEXT,
|
|
22
|
+
prepareForCommit: () => {},
|
|
23
|
+
resetAfterCommit: rootNode => {
|
|
24
|
+
// Since renders are throttled at the instance level and <Static> component children
|
|
25
|
+
// are rendered only once and then get deleted, we need an escape hatch to
|
|
26
|
+
// trigger an immediate render to ensure <Static> children are written to output before they get erased
|
|
27
|
+
if (rootNode.isStaticDirty) {
|
|
28
|
+
rootNode.isStaticDirty = false;
|
|
29
|
+
rootNode.onImmediateRender();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
rootNode.onRender();
|
|
34
|
+
},
|
|
35
|
+
getChildHostContext: () => NO_CONTEXT,
|
|
36
|
+
shouldSetTextContent: (type, props) => {
|
|
37
|
+
return typeof props.children === 'string' || typeof props.children === 'number';
|
|
38
|
+
},
|
|
39
|
+
createInstance: (type, newProps) => {
|
|
40
|
+
const node = (0, _dom.createNode)(type);
|
|
41
|
+
|
|
42
|
+
for (const [key, value] of Object.entries(newProps)) {
|
|
43
|
+
if (key === 'children') {
|
|
44
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
45
|
+
if (type === 'div') {
|
|
46
|
+
// Text node must be wrapped in another node, so that text can be aligned within container
|
|
47
|
+
const textNode = (0, _dom.createNode)('div');
|
|
48
|
+
(0, _dom.setTextContent)(textNode, value);
|
|
49
|
+
(0, _dom.appendChildNode)(node, textNode);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (type === 'span') {
|
|
53
|
+
(0, _dom.setTextContent)(node, value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} else if (key === 'style') {
|
|
57
|
+
(0, _dom.setStyle)(node, value);
|
|
58
|
+
} else if (key === 'unstable__transformChildren') {
|
|
59
|
+
node.unstable__transformChildren = value; // eslint-disable-line camelcase
|
|
60
|
+
} else if (key === 'unstable__static') {
|
|
61
|
+
node.unstable__static = true; // eslint-disable-line camelcase
|
|
62
|
+
} else {
|
|
63
|
+
(0, _dom.setAttribute)(node, key, value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return node;
|
|
68
|
+
},
|
|
69
|
+
createTextInstance: _dom.createTextNode,
|
|
70
|
+
resetTextContent: node => {
|
|
71
|
+
if (node.textContent) {
|
|
72
|
+
node.textContent = '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (node.childNodes.length > 0) {
|
|
76
|
+
for (const childNode of node.childNodes) {
|
|
77
|
+
(0, _dom.removeChildNode)(node, childNode);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
getPublicInstance: instance => instance,
|
|
82
|
+
appendInitialChild: _dom.appendChildNode,
|
|
83
|
+
appendChild: _dom.appendChildNode,
|
|
84
|
+
insertBefore: _dom.insertBeforeNode,
|
|
85
|
+
finalizeInitialChildren: (node, type, props, rootNode) => {
|
|
86
|
+
if (node.unstable__static) {
|
|
87
|
+
rootNode.isStaticDirty = true;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
supportsMutation: true,
|
|
91
|
+
appendChildToContainer: _dom.appendChildNode,
|
|
92
|
+
insertInContainerBefore: _dom.insertBeforeNode,
|
|
93
|
+
removeChildFromContainer: _dom.removeChildNode,
|
|
94
|
+
prepareUpdate: (node, type, oldProps, newProps, rootNode) => {
|
|
95
|
+
if (node.unstable__static) {
|
|
96
|
+
rootNode.isStaticDirty = true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return true;
|
|
100
|
+
},
|
|
101
|
+
commitUpdate: (node, updatePayload, type, oldProps, newProps) => {
|
|
102
|
+
for (const [key, value] of Object.entries(newProps)) {
|
|
103
|
+
if (key === 'children') {
|
|
104
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
105
|
+
if (type === 'div') {
|
|
106
|
+
// Text node must be wrapped in another node, so that text can be aligned within container
|
|
107
|
+
// If there's no such node, a new one must be created
|
|
108
|
+
if (node.childNodes.length === 0) {
|
|
109
|
+
const textNode = (0, _dom.createNode)('div');
|
|
110
|
+
(0, _dom.setTextContent)(textNode, value);
|
|
111
|
+
(0, _dom.appendChildNode)(node, textNode);
|
|
112
|
+
} else {
|
|
113
|
+
(0, _dom.setTextContent)(node.childNodes[0], value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (type === 'span') {
|
|
118
|
+
(0, _dom.setTextContent)(node, value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else if (key === 'style') {
|
|
122
|
+
(0, _dom.setStyle)(node, value);
|
|
123
|
+
} else if (key === 'unstable__transformChildren') {
|
|
124
|
+
node.unstable__transformChildren = value; // eslint-disable-line camelcase
|
|
125
|
+
} else if (key === 'unstable__static') {
|
|
126
|
+
node.unstable__static = true; // eslint-disable-line camelcase
|
|
127
|
+
} else {
|
|
128
|
+
(0, _dom.setAttribute)(node, key, value);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
commitTextUpdate: (node, oldText, newText) => {
|
|
133
|
+
(0, _dom.setTextContent)(node, newText);
|
|
134
|
+
},
|
|
135
|
+
removeChild: _dom.removeChildNode
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
var _default = (0, _reactReconciler.default)(hostConfig); // eslint-disable-line new-cap
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
exports.default = _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _yogaLayoutPrebuilt = _interopRequireDefault(require("yoga-layout-prebuilt"));
|
|
9
|
+
|
|
10
|
+
var _renderNodeToOutput = _interopRequireDefault(require("../render-node-to-output"));
|
|
11
|
+
|
|
12
|
+
var _calculateWrappedText = _interopRequireDefault(require("../calculate-wrapped-text"));
|
|
13
|
+
|
|
14
|
+
var _output = _interopRequireDefault(require("./output"));
|
|
15
|
+
|
|
16
|
+
var _dom = require("./dom");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
// Since <Static> components can be placed anywhere in the tree, this helper finds and returns them
|
|
21
|
+
const findStaticNode = node => {
|
|
22
|
+
if (node.unstable__static) {
|
|
23
|
+
return node;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const childNode of node.childNodes) {
|
|
27
|
+
if (childNode.unstable__static) {
|
|
28
|
+
return childNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (Array.isArray(childNode.childNodes) && childNode.childNodes.length > 0) {
|
|
32
|
+
return findStaticNode(childNode);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var _default = ({
|
|
38
|
+
terminalWidth = 100
|
|
39
|
+
}) => {
|
|
40
|
+
return node => {
|
|
41
|
+
(0, _dom.setStyle)(node, {
|
|
42
|
+
width: terminalWidth
|
|
43
|
+
});
|
|
44
|
+
node.yogaNode.calculateLayout(_yogaLayoutPrebuilt.default.UNDEFINED, _yogaLayoutPrebuilt.default.UNDEFINED, _yogaLayoutPrebuilt.default.DIRECTION_LTR);
|
|
45
|
+
(0, _calculateWrappedText.default)(node);
|
|
46
|
+
node.yogaNode.calculateLayout(_yogaLayoutPrebuilt.default.UNDEFINED, _yogaLayoutPrebuilt.default.UNDEFINED, _yogaLayoutPrebuilt.default.DIRECTION_LTR);
|
|
47
|
+
const output = new _output.default({
|
|
48
|
+
width: node.yogaNode.getComputedWidth(),
|
|
49
|
+
height: node.yogaNode.getComputedHeight()
|
|
50
|
+
});
|
|
51
|
+
(0, _renderNodeToOutput.default)(node, output, {
|
|
52
|
+
skipStaticElements: true
|
|
53
|
+
});
|
|
54
|
+
const staticNode = findStaticNode(node);
|
|
55
|
+
let staticOutput;
|
|
56
|
+
|
|
57
|
+
if (staticNode) {
|
|
58
|
+
staticOutput = new _output.default({
|
|
59
|
+
width: staticNode.yogaNode.getComputedWidth(),
|
|
60
|
+
height: staticNode.yogaNode.getComputedHeight()
|
|
61
|
+
});
|
|
62
|
+
(0, _renderNodeToOutput.default)(staticNode, staticOutput, {
|
|
63
|
+
skipStaticElements: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const {
|
|
68
|
+
output: generatedOutput,
|
|
69
|
+
height: outputHeight
|
|
70
|
+
} = output.get();
|
|
71
|
+
return {
|
|
72
|
+
output: generatedOutput,
|
|
73
|
+
outputHeight,
|
|
74
|
+
// Newline at the end is needed, because static output doesn't have one, so
|
|
75
|
+
// interactive output will override last line of static output
|
|
76
|
+
staticOutput: staticOutput ? `${staticOutput.get().output}\n` : undefined
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.default = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _ = require("..");
|
|
11
|
+
|
|
12
|
+
var _default = inputHandler => {
|
|
13
|
+
const {
|
|
14
|
+
stdin,
|
|
15
|
+
setRawMode
|
|
16
|
+
} = (0, _react.useContext)(_.StdinContext);
|
|
17
|
+
(0, _react.useLayoutEffect)(() => {
|
|
18
|
+
setRawMode(true);
|
|
19
|
+
return () => setRawMode(false);
|
|
20
|
+
}, [setRawMode]);
|
|
21
|
+
(0, _react.useLayoutEffect)(() => {
|
|
22
|
+
const handleData = data => {
|
|
23
|
+
const input = String(data);
|
|
24
|
+
const meta = {
|
|
25
|
+
up: input === '\u001B[A',
|
|
26
|
+
down: input === '\u001B[B',
|
|
27
|
+
left: input === '\u001B[D',
|
|
28
|
+
right: input === '\u001B[C'
|
|
29
|
+
};
|
|
30
|
+
inputHandler(input, meta);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
stdin.on('data', handleData);
|
|
34
|
+
return () => stdin.off('data', handleData);
|
|
35
|
+
}, [stdin, inputHandler]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.default = _default;
|
package/build/ink.d.ts
CHANGED
package/build/ink.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import throttle from '
|
|
3
|
+
import { throttle } from 'es-toolkit/compat';
|
|
4
4
|
import ansiEscapes from 'ansi-escapes';
|
|
5
5
|
import isInCi from 'is-in-ci';
|
|
6
6
|
import autoBind from 'auto-bind';
|
|
@@ -204,12 +204,10 @@ export default class Ink {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
async waitUntilExit() {
|
|
207
|
-
|
|
208
|
-
this.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
});
|
|
212
|
-
}
|
|
207
|
+
this.exitPromise ||= new Promise((resolve, reject) => {
|
|
208
|
+
this.resolveExitPromise = resolve;
|
|
209
|
+
this.rejectExitPromise = reject;
|
|
210
|
+
});
|
|
213
211
|
return this.exitPromise;
|
|
214
212
|
}
|
|
215
213
|
clear() {
|
package/build/ink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../src/ink.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../src/ink.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,MAA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