@nuvin/ink 6.6.6 → 7.0.0-alpha
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/ansi-tokenizer.d.ts +38 -0
- package/build/ansi-tokenizer.js +316 -0
- package/build/ansi-tokenizer.js.map +1 -0
- package/build/components/AnimationContext.d.ts +9 -0
- package/build/components/AnimationContext.js +13 -0
- package/build/components/AnimationContext.js.map +1 -0
- package/build/components/App.d.ts +11 -49
- package/build/components/App.js +412 -227
- package/build/components/App.js.map +1 -1
- package/build/components/AppContext.d.ts +33 -3
- package/build/components/AppContext.js +2 -1
- package/build/components/AppContext.js.map +1 -1
- package/build/components/Box.d.ts +15 -8
- package/build/components/Box.js +12 -10
- package/build/components/Box.js.map +1 -1
- package/build/components/CursorContext.d.ts +11 -0
- package/build/components/CursorContext.js +8 -0
- package/build/components/CursorContext.js.map +1 -0
- package/build/components/ErrorBoundary.d.ts +18 -0
- package/build/components/ErrorBoundary.js +23 -0
- package/build/components/ErrorBoundary.js.map +1 -0
- package/build/components/ErrorOverview.js +6 -6
- package/build/components/ErrorOverview.js.map +1 -1
- package/build/components/Static.js.map +1 -1
- package/build/components/StdinContext.d.ts +7 -1
- package/build/components/StdinContext.js +1 -0
- package/build/components/StdinContext.js.map +1 -1
- package/build/components/Text.d.ts +1 -1
- package/build/components/Text.js +1 -1
- package/build/components/Text.js.map +1 -1
- package/build/components/Transform.d.ts +1 -1
- package/build/cursor-helpers.d.ts +38 -0
- package/build/cursor-helpers.js +56 -0
- package/build/cursor-helpers.js.map +1 -0
- package/build/devtools-window-polyfill.js +7 -4
- package/build/devtools-window-polyfill.js.map +1 -1
- package/build/devtools.js +31 -6
- package/build/devtools.js.map +1 -1
- package/build/dom.d.ts +5 -1
- package/build/dom.js +20 -1
- package/build/dom.js.map +1 -1
- package/build/hooks/use-animation.d.ts +49 -0
- package/build/hooks/use-animation.js +87 -0
- package/build/hooks/use-animation.js.map +1 -0
- package/build/hooks/use-app.d.ts +5 -2
- package/build/hooks/use-app.js +1 -1
- package/build/hooks/use-box-metrics.d.ts +59 -0
- package/build/hooks/use-box-metrics.js +88 -0
- package/build/hooks/use-box-metrics.js.map +1 -0
- package/build/hooks/use-cursor.d.ts +12 -0
- package/build/hooks/use-cursor.js +29 -0
- package/build/hooks/use-cursor.js.map +1 -0
- package/build/hooks/use-focus-manager.d.ts +17 -2
- package/build/hooks/use-focus-manager.js +2 -1
- package/build/hooks/use-focus-manager.js.map +1 -1
- package/build/hooks/use-focus.d.ts +2 -1
- package/build/hooks/use-focus.js +5 -4
- package/build/hooks/use-focus.js.map +1 -1
- package/build/hooks/use-input.d.ts +40 -1
- package/build/hooks/use-input.js +84 -51
- package/build/hooks/use-input.js.map +1 -1
- package/build/hooks/use-is-screen-reader-enabled.d.ts +2 -1
- package/build/hooks/use-is-screen-reader-enabled.js +2 -1
- package/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/build/hooks/use-paste.d.ts +35 -0
- package/build/hooks/use-paste.js +62 -0
- package/build/hooks/use-paste.js.map +1 -0
- package/build/hooks/use-stderr.d.ts +1 -1
- package/build/hooks/use-stderr.js +1 -1
- package/build/hooks/use-stdin.d.ts +4 -2
- package/build/hooks/use-stdin.js +2 -1
- package/build/hooks/use-stdin.js.map +1 -1
- package/build/hooks/use-stdout.d.ts +1 -1
- package/build/hooks/use-stdout.js +1 -1
- package/build/hooks/use-window-size.d.ts +18 -0
- package/build/hooks/use-window-size.js +22 -0
- package/build/hooks/use-window-size.js.map +1 -0
- package/build/index.d.ts +14 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/ink.d.ts +86 -5
- package/build/ink.js +581 -80
- package/build/ink.js.map +1 -1
- package/build/input-parser.d.ts +10 -0
- package/build/input-parser.js +194 -0
- package/build/input-parser.js.map +1 -0
- package/build/kitty-keyboard.d.ts +23 -0
- package/build/kitty-keyboard.js +32 -0
- package/build/kitty-keyboard.js.map +1 -0
- package/build/log-update.d.ts +7 -1
- package/build/log-update.js +181 -56
- package/build/log-update.js.map +1 -1
- package/build/measure-element.d.ts +4 -0
- package/build/measure-element.js +4 -0
- package/build/measure-element.js.map +1 -1
- package/build/measure-text.js +3 -11
- package/build/measure-text.js.map +1 -1
- package/build/output.d.ts +2 -1
- package/build/output.js +62 -58
- package/build/output.js.map +1 -1
- package/build/parse-keypress.d.ts +9 -3
- package/build/parse-keypress.js +283 -13
- package/build/parse-keypress.js.map +1 -1
- package/build/reconciler.js +57 -37
- package/build/reconciler.js.map +1 -1
- package/build/render-background.js +2 -0
- package/build/render-background.js.map +1 -1
- package/build/render-border.d.ts +1 -1
- package/build/render-border.js +35 -24
- package/build/render-border.js.map +1 -1
- package/build/render-node-to-output.d.ts +1 -1
- package/build/render-node-to-output.js +35 -18
- package/build/render-node-to-output.js.map +1 -1
- package/build/render-to-string.d.ts +38 -0
- package/build/render-to-string.js +116 -0
- package/build/render-to-string.js.map +1 -0
- package/build/render.d.ts +91 -3
- package/build/render.js +17 -5
- package/build/render.js.map +1 -1
- package/build/sanitize-ansi.d.ts +2 -0
- package/build/sanitize-ansi.js +27 -0
- package/build/sanitize-ansi.js.map +1 -0
- package/build/squash-text-nodes.js +2 -1
- package/build/squash-text-nodes.js.map +1 -1
- package/build/styles.d.ts +75 -37
- package/build/styles.js +87 -44
- package/build/styles.js.map +1 -1
- package/build/utils.d.ts +9 -2
- package/build/utils.js +18 -3
- package/build/utils.js.map +1 -1
- package/build/wrap-text.js +7 -0
- package/build/wrap-text.js.map +1 -1
- package/build/write-synchronized.d.ts +4 -0
- package/build/write-synchronized.js +9 -0
- package/build/write-synchronized.js.map +1 -0
- package/package.json +45 -105
- package/readme.md +850 -64
- package/build/components/FixedLayout.d.ts +0 -12
- package/build/components/FixedLayout.js +0 -19
- package/build/components/FixedLayout.js.map +0 -1
- package/build/components/VirtualizedList.d.ts +0 -21
- package/build/components/VirtualizedList.js +0 -55
- package/build/components/VirtualizedList.js.map +0 -1
- package/build/hooks/use-mouse.d.ts +0 -15
- package/build/hooks/use-mouse.js +0 -121
- package/build/hooks/use-mouse.js.map +0 -1
- package/build/hooks/use-virtualization.d.ts +0 -19
- package/build/hooks/use-virtualization.js +0 -56
- package/build/hooks/use-virtualization.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,UAAiB,CAAC;AAEvC,iEAAiE;AACjE,uEAAuE;AAEvE,wEAAwE;AACxE,YAAY,CAAC,SAAS,KAAK,EAAE,CAAC;AAE9B,wEAAwE;AACxE,YAAY,CAAC,MAAM,KAAK,UAAU,CAAC;AAEnC,wEAAwE;AACxE,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC;AAEjC,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.js
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
/* eslint-disable import/order */
|
|
2
|
-
// eslint-disable-next-line import/no-unassigned-import
|
|
1
|
+
/* eslint-disable import-x/order */
|
|
2
|
+
// eslint-disable-next-line import-x/no-unassigned-import
|
|
3
3
|
import './devtools-window-polyfill.js';
|
|
4
|
+
import WebSocket from 'ws';
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
6
|
// @ts-expect-error
|
|
6
7
|
import devtools from 'react-devtools-core';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const isDevToolsReachable = async () => new Promise(resolve => {
|
|
9
|
+
const socket = new WebSocket('ws://localhost:8097');
|
|
10
|
+
const timeout = setTimeout(() => {
|
|
11
|
+
socket.terminate();
|
|
12
|
+
resolve(false);
|
|
13
|
+
}, 2000);
|
|
14
|
+
// Don't let the timeout keep the process alive on its own
|
|
15
|
+
timeout.unref();
|
|
16
|
+
socket.on('open', () => {
|
|
17
|
+
clearTimeout(timeout);
|
|
18
|
+
socket.terminate();
|
|
19
|
+
resolve(true);
|
|
20
|
+
});
|
|
21
|
+
socket.on('error', () => {
|
|
22
|
+
clearTimeout(timeout);
|
|
23
|
+
socket.terminate();
|
|
24
|
+
resolve(false);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
if (await isDevToolsReachable()) {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
29
|
+
devtools.initialize();
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
31
|
+
devtools.connectToDevTools();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.warn('DEV is set to true, but the React DevTools server is not running. Start it with:\n\n$ npx react-devtools\n');
|
|
35
|
+
}
|
|
11
36
|
//# 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":"AAAA,
|
|
1
|
+
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,yDAAyD;AACzD,OAAO,+BAA+B,CAAC;AAEvC,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,6DAA6D;AAC7D,mBAAmB;AACnB,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAE3C,MAAM,mBAAmB,GAAG,KAAK,IAAsB,EAAE,CACxD,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;IACrB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;QAC/B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC,EAAE,IAAI,CAAC,CAAC;IACT,0DAA0D;IAC1D,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACtB,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEJ,IAAI,MAAM,mBAAmB,EAAE,EAAE,CAAC;IACjC,6DAA6D;IAC5D,QAAgB,CAAC,UAAU,EAAE,CAAC;IAC/B,6DAA6D;IAC5D,QAAgB,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;KAAM,CAAC;IACP,OAAO,CAAC,IAAI,CACX,4GAA4G,CAC5G,CAAC;AACH,CAAC"}
|
package/build/dom.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ type InkNode = {
|
|
|
7
7
|
internal_static?: boolean;
|
|
8
8
|
style: Styles;
|
|
9
9
|
};
|
|
10
|
+
type LayoutListener = () => void;
|
|
10
11
|
export type TextName = '#text';
|
|
11
12
|
export type ElementNames = 'ink-root' | 'ink-box' | 'ink-text' | 'ink-virtual-text';
|
|
12
13
|
export type NodeNames = ElementNames | TextName;
|
|
@@ -34,6 +35,7 @@ export type DOMElement = {
|
|
|
34
35
|
onComputeLayout?: () => void;
|
|
35
36
|
onRender?: () => void;
|
|
36
37
|
onImmediateRender?: () => void;
|
|
38
|
+
internal_layoutListeners?: Set<LayoutListener>;
|
|
37
39
|
internal_scrollOffset?: {
|
|
38
40
|
x: number;
|
|
39
41
|
y: number;
|
|
@@ -55,7 +57,9 @@ export declare const appendChildNode: (node: DOMElement, childNode: DOMElement)
|
|
|
55
57
|
export declare const insertBeforeNode: (node: DOMElement, newChildNode: DOMNode, beforeChildNode: DOMNode) => void;
|
|
56
58
|
export declare const removeChildNode: (node: DOMElement, removeNode: DOMNode) => void;
|
|
57
59
|
export declare const setAttribute: (node: DOMElement, key: string, value: DOMNodeAttribute) => void;
|
|
58
|
-
export declare const setStyle: (node: DOMNode, style
|
|
60
|
+
export declare const setStyle: (node: DOMNode, style?: Styles) => void;
|
|
59
61
|
export declare const createTextNode: (text: string) => TextNode;
|
|
60
62
|
export declare const setTextNodeValue: (node: TextNode, text: string) => void;
|
|
63
|
+
export declare const addLayoutListener: (rootNode: DOMElement, listener: LayoutListener) => (() => void);
|
|
64
|
+
export declare const emitLayoutListeners: (rootNode: DOMElement) => void;
|
|
61
65
|
export {};
|
package/build/dom.js
CHANGED
|
@@ -74,7 +74,8 @@ export const setAttribute = (node, key, value) => {
|
|
|
74
74
|
node.attributes[key] = value;
|
|
75
75
|
};
|
|
76
76
|
export const setStyle = (node, style) => {
|
|
77
|
-
|
|
77
|
+
// Rendering code assumes style is always an object.
|
|
78
|
+
node.style = style ?? {};
|
|
78
79
|
};
|
|
79
80
|
export const createTextNode = (text) => {
|
|
80
81
|
const node = {
|
|
@@ -121,4 +122,22 @@ export const setTextNodeValue = (node, text) => {
|
|
|
121
122
|
node.nodeValue = text;
|
|
122
123
|
markNodeAsDirty(node);
|
|
123
124
|
};
|
|
125
|
+
export const addLayoutListener = (rootNode, listener) => {
|
|
126
|
+
if (rootNode.nodeName !== 'ink-root') {
|
|
127
|
+
return () => { };
|
|
128
|
+
}
|
|
129
|
+
rootNode.internal_layoutListeners ??= new Set();
|
|
130
|
+
rootNode.internal_layoutListeners.add(listener);
|
|
131
|
+
return () => {
|
|
132
|
+
rootNode.internal_layoutListeners?.delete(listener);
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
export const emitLayoutListeners = (rootNode) => {
|
|
136
|
+
if (rootNode.nodeName !== 'ink-root' || !rootNode.internal_layoutListeners) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
for (const listener of rootNode.internal_layoutListeners) {
|
|
140
|
+
listener();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
124
143
|
//# sourceMappingURL=dom.js.map
|
package/build/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,OAAO,IAA6B,MAAM,aAAa,CAAC;AACxD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,eAAe,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA,OAAO,IAA6B,MAAM,aAAa,CAAC;AACxD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,eAAe,MAAM,wBAAwB,CAAC;AAyFrD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAsB,EAAc,EAAE;IAChE,MAAM,IAAI,GAAe;QACxB,QAAQ;QACR,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,QAAQ,KAAK,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAC1E,gEAAgE;QAChE,sBAAsB,EAAE,EAAE;KAC1B,CAAC;IAEF,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC9B,IAAgB,EAChB,SAAqB,EACd,EAAE;IACT,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;QAC1B,eAAe,CA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C;IAED,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,wBAAwB,EAAE,CAAC;QAC1D,QAAQ,EAAE,CAAC;IACZ,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
type Options = {
|
|
2
|
+
/**
|
|
3
|
+
Time between ticks in milliseconds.
|
|
4
|
+
|
|
5
|
+
@default 100
|
|
6
|
+
*/
|
|
7
|
+
readonly interval?: number;
|
|
8
|
+
/**
|
|
9
|
+
Whether the animation is running. When set to `false`, the animation stops. When toggled back to `true`, all values reset to `0`.
|
|
10
|
+
|
|
11
|
+
@default true
|
|
12
|
+
*/
|
|
13
|
+
readonly isActive?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type AnimationResult = {
|
|
16
|
+
/**
|
|
17
|
+
Discrete counter that increments by 1 each interval. Useful for indexed sequences like spinner frames.
|
|
18
|
+
*/
|
|
19
|
+
readonly frame: number;
|
|
20
|
+
/**
|
|
21
|
+
Total elapsed time in milliseconds since the animation started or was last reset. Useful for continuous math-based animations like sine waves: `Math.sin(time / 1000 * Math.PI * 2)`.
|
|
22
|
+
*/
|
|
23
|
+
readonly time: number;
|
|
24
|
+
/**
|
|
25
|
+
Time in milliseconds since the previous rendered tick. Accounts for throttled renders. Useful for physics-based or velocity-driven motion: `position += speed * delta`.
|
|
26
|
+
*/
|
|
27
|
+
readonly delta: number;
|
|
28
|
+
/**
|
|
29
|
+
Resets `frame`, `time`, and `delta` to `0` and restarts timing from the current moment. Useful for one-shot animations triggered by events.
|
|
30
|
+
*/
|
|
31
|
+
readonly reset: () => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
A React hook that drives animations. Returns a frame counter, elapsed time, frame delta, and a reset function. All animations share a single timer internally, so multiple animated components consolidate into one render cycle.
|
|
35
|
+
|
|
36
|
+
@example
|
|
37
|
+
```
|
|
38
|
+
import {Text, useAnimation} from 'ink';
|
|
39
|
+
|
|
40
|
+
const Spinner = () => {
|
|
41
|
+
const {frame} = useAnimation({interval: 80});
|
|
42
|
+
const characters = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
43
|
+
|
|
44
|
+
return <Text>{characters[frame % characters.length]}</Text>;
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
*/
|
|
48
|
+
export default function useAnimation(options?: Options): AnimationResult;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useState, useLayoutEffect, useRef, useCallback, useContext, } from 'react';
|
|
2
|
+
import AnimationContext from '../components/AnimationContext.js';
|
|
3
|
+
const defaultAnimationInterval = 100;
|
|
4
|
+
const maximumTimerInterval = 2_147_483_647;
|
|
5
|
+
const zeroAnimState = { frame: 0, time: 0, delta: 0 };
|
|
6
|
+
/**
|
|
7
|
+
A React hook that drives animations. Returns a frame counter, elapsed time, frame delta, and a reset function. All animations share a single timer internally, so multiple animated components consolidate into one render cycle.
|
|
8
|
+
|
|
9
|
+
@example
|
|
10
|
+
```
|
|
11
|
+
import {Text, useAnimation} from 'ink';
|
|
12
|
+
|
|
13
|
+
const Spinner = () => {
|
|
14
|
+
const {frame} = useAnimation({interval: 80});
|
|
15
|
+
const characters = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
16
|
+
|
|
17
|
+
return <Text>{characters[frame % characters.length]}</Text>;
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
*/
|
|
21
|
+
export default function useAnimation(options) {
|
|
22
|
+
const { interval = defaultAnimationInterval, isActive = true } = options ?? {};
|
|
23
|
+
const safeInterval = normalizeAnimationInterval(interval);
|
|
24
|
+
const { subscribe, renderThrottleMs } = useContext(AnimationContext);
|
|
25
|
+
const [resetKey, setResetKey] = useState(0);
|
|
26
|
+
const [animState, setAnimState] = useState(zeroAnimState);
|
|
27
|
+
const nextRenderTimeRef = useRef(0);
|
|
28
|
+
const lastRenderTimeRef = useRef(0);
|
|
29
|
+
const previousOptionsRef = useRef({ isActive, safeInterval, resetKey });
|
|
30
|
+
const previousOptions = previousOptionsRef.current;
|
|
31
|
+
const shouldReset = isActive &&
|
|
32
|
+
(safeInterval !== previousOptions.safeInterval ||
|
|
33
|
+
!previousOptions.isActive ||
|
|
34
|
+
resetKey !== previousOptions.resetKey);
|
|
35
|
+
const reset = useCallback(() => {
|
|
36
|
+
setResetKey(k => k + 1);
|
|
37
|
+
}, []);
|
|
38
|
+
useLayoutEffect(() => {
|
|
39
|
+
if (!isActive) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Reset to zero immediately so any render that occurs between this
|
|
43
|
+
// effect commit and the first tick shows zeros, not stale values.
|
|
44
|
+
// On initial mount this is a no-op: Object.is bails out because the
|
|
45
|
+
// state was initialized with the same zeroAnimState reference.
|
|
46
|
+
setAnimState(zeroAnimState);
|
|
47
|
+
let startTime = 0;
|
|
48
|
+
const { startTime: subscriberStartTime, unsubscribe } = subscribe(currentTime => {
|
|
49
|
+
const isThrottled = renderThrottleMs > 0 && currentTime < nextRenderTimeRef.current;
|
|
50
|
+
if (isThrottled) {
|
|
51
|
+
// Coalesce intermediate ticks while Ink is inside the current
|
|
52
|
+
// render-throttle window; the next allowed render will jump
|
|
53
|
+
// straight to the latest elapsed values.
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const elapsed = currentTime - startTime;
|
|
57
|
+
const nextDelta = currentTime - lastRenderTimeRef.current;
|
|
58
|
+
lastRenderTimeRef.current = currentTime;
|
|
59
|
+
nextRenderTimeRef.current = currentTime + renderThrottleMs;
|
|
60
|
+
setAnimState({
|
|
61
|
+
frame: Math.floor(elapsed / safeInterval),
|
|
62
|
+
time: elapsed,
|
|
63
|
+
delta: nextDelta,
|
|
64
|
+
});
|
|
65
|
+
}, safeInterval);
|
|
66
|
+
// Use the scheduler's start time instead of sampling our own clock so the
|
|
67
|
+
// first delivered tick cannot start one frame late.
|
|
68
|
+
startTime = subscriberStartTime;
|
|
69
|
+
lastRenderTimeRef.current = subscriberStartTime;
|
|
70
|
+
nextRenderTimeRef.current = startTime + renderThrottleMs;
|
|
71
|
+
return unsubscribe;
|
|
72
|
+
}, [safeInterval, isActive, subscribe, renderThrottleMs, resetKey]);
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
previousOptionsRef.current = { isActive, safeInterval, resetKey };
|
|
75
|
+
}, [isActive, safeInterval, resetKey]);
|
|
76
|
+
if (shouldReset) {
|
|
77
|
+
return { ...zeroAnimState, reset };
|
|
78
|
+
}
|
|
79
|
+
return { ...animState, reset };
|
|
80
|
+
}
|
|
81
|
+
function normalizeAnimationInterval(interval) {
|
|
82
|
+
if (!Number.isFinite(interval)) {
|
|
83
|
+
return defaultAnimationInterval;
|
|
84
|
+
}
|
|
85
|
+
return Math.min(maximumTimerInterval, Math.max(1, interval));
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=use-animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-animation.js","sourceRoot":"","sources":["../../src/hooks/use-animation.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,eAAe,EACf,MAAM,EACN,WAAW,EACX,UAAU,GACV,MAAM,OAAO,CAAC;AACf,OAAO,gBAAgB,MAAM,mCAAmC,CAAC;AAEjE,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,aAAa,GAAG,EAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;AAwCpD;;;;;;;;;;;;;;EAcE;AACF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,OAAiB;IACrD,MAAM,EAAC,QAAQ,GAAG,wBAAwB,EAAE,QAAQ,GAAG,IAAI,EAAC,GAAG,OAAO,IAAI,EAAE,CAAC;IAC7E,MAAM,YAAY,GAAG,0BAA0B,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AAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,wBAAwB,CAAC;IACjC,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
package/build/hooks/use-app.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
A React hook that returns app lifecycle methods like `exit()` and `waitUntilRenderFlush()`.
|
|
3
3
|
*/
|
|
4
|
-
declare const useApp: () =>
|
|
4
|
+
declare const useApp: () => {
|
|
5
|
+
exit(): void;
|
|
6
|
+
waitUntilRenderFlush(): Promise<void>;
|
|
7
|
+
};
|
|
5
8
|
export default useApp;
|
package/build/hooks/use-app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import AppContext from '../components/AppContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
A React hook that returns app lifecycle methods like `exit()` and `waitUntilRenderFlush()`.
|
|
5
5
|
*/
|
|
6
6
|
const useApp = () => useContext(AppContext);
|
|
7
7
|
export default useApp;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type DOMElement } from '../dom.js';
|
|
3
|
+
/**
|
|
4
|
+
Metrics of a box element.
|
|
5
|
+
|
|
6
|
+
All positions are relative to the element's parent.
|
|
7
|
+
*/
|
|
8
|
+
export type BoxMetrics = {
|
|
9
|
+
/**
|
|
10
|
+
Element width.
|
|
11
|
+
*/
|
|
12
|
+
readonly width: number;
|
|
13
|
+
/**
|
|
14
|
+
Element height.
|
|
15
|
+
*/
|
|
16
|
+
readonly height: number;
|
|
17
|
+
/**
|
|
18
|
+
Distance from the left edge of the parent.
|
|
19
|
+
*/
|
|
20
|
+
readonly left: number;
|
|
21
|
+
/**
|
|
22
|
+
Distance from the top edge of the parent.
|
|
23
|
+
*/
|
|
24
|
+
readonly top: number;
|
|
25
|
+
};
|
|
26
|
+
export type UseBoxMetricsResult = BoxMetrics & {
|
|
27
|
+
/**
|
|
28
|
+
Whether the currently tracked element has been measured in the latest layout pass.
|
|
29
|
+
*/
|
|
30
|
+
readonly hasMeasured: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
A React hook that returns the current layout metrics for a tracked box element.
|
|
34
|
+
It updates when layout changes (for example terminal resize, sibling/content changes, or position changes).
|
|
35
|
+
|
|
36
|
+
The hook returns `{width: 0, height: 0, left: 0, top: 0}` until the first layout pass completes. It also returns zeros when the tracked ref is detached.
|
|
37
|
+
|
|
38
|
+
Use `hasMeasured` to detect when the currently tracked element has been measured.
|
|
39
|
+
|
|
40
|
+
@example
|
|
41
|
+
```tsx
|
|
42
|
+
import {useRef} from 'react';
|
|
43
|
+
import {Box, Text, useBoxMetrics} from 'ink';
|
|
44
|
+
|
|
45
|
+
const Example = () => {
|
|
46
|
+
const ref = useRef(null);
|
|
47
|
+
const {width, height, left, top, hasMeasured} = useBoxMetrics(ref);
|
|
48
|
+
return (
|
|
49
|
+
<Box ref={ref}>
|
|
50
|
+
<Text>
|
|
51
|
+
{hasMeasured ? `${width}x${height} at ${left},${top}` : 'Measuring...'}
|
|
52
|
+
</Text>
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
*/
|
|
58
|
+
declare const useBoxMetrics: (ref: RefObject<DOMElement>) => UseBoxMetricsResult;
|
|
59
|
+
export default useBoxMetrics;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { addLayoutListener } from '../dom.js';
|
|
3
|
+
import useStdout from './use-stdout.js';
|
|
4
|
+
const emptyMetrics = {
|
|
5
|
+
width: 0,
|
|
6
|
+
height: 0,
|
|
7
|
+
left: 0,
|
|
8
|
+
top: 0,
|
|
9
|
+
};
|
|
10
|
+
const findRootNode = (node) => {
|
|
11
|
+
if (!node) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (!node.parentNode) {
|
|
15
|
+
return node.nodeName === 'ink-root' ? node : undefined;
|
|
16
|
+
}
|
|
17
|
+
return findRootNode(node.parentNode);
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
A React hook that returns the current layout metrics for a tracked box element.
|
|
21
|
+
It updates when layout changes (for example terminal resize, sibling/content changes, or position changes).
|
|
22
|
+
|
|
23
|
+
The hook returns `{width: 0, height: 0, left: 0, top: 0}` until the first layout pass completes. It also returns zeros when the tracked ref is detached.
|
|
24
|
+
|
|
25
|
+
Use `hasMeasured` to detect when the currently tracked element has been measured.
|
|
26
|
+
|
|
27
|
+
@example
|
|
28
|
+
```tsx
|
|
29
|
+
import {useRef} from 'react';
|
|
30
|
+
import {Box, Text, useBoxMetrics} from 'ink';
|
|
31
|
+
|
|
32
|
+
const Example = () => {
|
|
33
|
+
const ref = useRef(null);
|
|
34
|
+
const {width, height, left, top, hasMeasured} = useBoxMetrics(ref);
|
|
35
|
+
return (
|
|
36
|
+
<Box ref={ref}>
|
|
37
|
+
<Text>
|
|
38
|
+
{hasMeasured ? `${width}x${height} at ${left},${top}` : 'Measuring...'}
|
|
39
|
+
</Text>
|
|
40
|
+
</Box>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
*/
|
|
45
|
+
const useBoxMetrics = (ref) => {
|
|
46
|
+
const [metrics, setMetrics] = useState(emptyMetrics);
|
|
47
|
+
const [hasMeasured, setHasMeasured] = useState(false);
|
|
48
|
+
const { stdout } = useStdout();
|
|
49
|
+
const updateMetrics = useCallback(() => {
|
|
50
|
+
const layout = ref.current?.yogaNode?.getComputedLayout() ?? emptyMetrics;
|
|
51
|
+
setMetrics(previousMetrics => {
|
|
52
|
+
const hasChanged = previousMetrics.width !== layout.width ||
|
|
53
|
+
previousMetrics.height !== layout.height ||
|
|
54
|
+
previousMetrics.left !== layout.left ||
|
|
55
|
+
previousMetrics.top !== layout.top;
|
|
56
|
+
return hasChanged ? layout : previousMetrics;
|
|
57
|
+
});
|
|
58
|
+
setHasMeasured(Boolean(ref.current));
|
|
59
|
+
}, [ref]);
|
|
60
|
+
// Runs after every render of this component.
|
|
61
|
+
// This keeps metrics fresh when local state/props in this subtree change.
|
|
62
|
+
useEffect(updateMetrics);
|
|
63
|
+
// Subscribe to root layout commits so memoized components still receive
|
|
64
|
+
// sibling-driven position/size updates, even when they skip re-rendering.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const rootNode = findRootNode(ref.current);
|
|
67
|
+
if (!rootNode) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
return addLayoutListener(rootNode, updateMetrics);
|
|
71
|
+
});
|
|
72
|
+
// Terminal resize events do not go through React's render cycle. Ink
|
|
73
|
+
// recalculates Yoga layout in its own resize handler — registered in the
|
|
74
|
+
// Ink constructor, before this hook mounts — so by the time the resize
|
|
75
|
+
// callback runs, Yoga has already computed the post-resize metrics.
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
stdout.on('resize', updateMetrics);
|
|
78
|
+
return () => {
|
|
79
|
+
stdout.off('resize', updateMetrics);
|
|
80
|
+
};
|
|
81
|
+
}, [stdout, updateMetrics]);
|
|
82
|
+
return useMemo(() => ({
|
|
83
|
+
...metrics,
|
|
84
|
+
hasMeasured,
|
|
85
|
+
}), [metrics, hasMeasured]);
|
|
86
|
+
};
|
|
87
|
+
export default useBoxMetrics;
|
|
88
|
+
//# sourceMappingURL=use-box-metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-box-metrics.js","sourceRoot":"","sources":["../../src/hooks/use-box-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAChF,OAAO,EAAk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K,MAAM,CAAC,GAAG,CAAC;YAEpC,OAAO,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACtC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,6CAA6C;IAC7C,0EAA0E;IAC1E,SAAS,CAAC,aAAa,CAAC,CAAC;IAEzB,wEAAwE;IACxE,0EAA0E;IAC1E,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO;QACR,CAAC;QAED,OAAO,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,oEAAoE;IACpE,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAEnC,OAAO,GAAG,EAAE;YACX,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACrC,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAE5B,OAAO,OAAO,CACb,GAAG,EAAE,CAAC,CAAC;QACN,GAAG,OAAO;QACV,WAAW;KACX,CAAC,EACF,CAAC,OAAO,EAAE,WAAW,CAAC,CACtB,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CursorPosition } from '../log-update.js';
|
|
2
|
+
/**
|
|
3
|
+
A React hook that returns methods to control the terminal cursor position.
|
|
4
|
+
|
|
5
|
+
Setting a cursor position makes the cursor visible at the specified coordinates (relative to the Ink output origin). This is useful for IME (Input Method Editor) support, where the composing character is displayed at the cursor location.
|
|
6
|
+
|
|
7
|
+
Pass `undefined` to hide the cursor.
|
|
8
|
+
*/
|
|
9
|
+
declare const useCursor: () => {
|
|
10
|
+
setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
11
|
+
};
|
|
12
|
+
export default useCursor;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useContext, useRef, useCallback, useInsertionEffect } from 'react';
|
|
2
|
+
import CursorContext from '../components/CursorContext.js';
|
|
3
|
+
/**
|
|
4
|
+
A React hook that returns methods to control the terminal cursor position.
|
|
5
|
+
|
|
6
|
+
Setting a cursor position makes the cursor visible at the specified coordinates (relative to the Ink output origin). This is useful for IME (Input Method Editor) support, where the composing character is displayed at the cursor location.
|
|
7
|
+
|
|
8
|
+
Pass `undefined` to hide the cursor.
|
|
9
|
+
*/
|
|
10
|
+
const useCursor = () => {
|
|
11
|
+
const context = useContext(CursorContext);
|
|
12
|
+
const positionRef = useRef(undefined);
|
|
13
|
+
const setCursorPosition = useCallback((position) => {
|
|
14
|
+
positionRef.current = position;
|
|
15
|
+
}, []);
|
|
16
|
+
// Propagate cursor position to log-update only during commit phase.
|
|
17
|
+
// useInsertionEffect runs before resetAfterCommit (which triggers onRender),
|
|
18
|
+
// and does NOT run for abandoned concurrent renders (e.g. suspended components).
|
|
19
|
+
// This prevents cursor state from leaking across render boundaries.
|
|
20
|
+
useInsertionEffect(() => {
|
|
21
|
+
context.setCursorPosition(positionRef.current);
|
|
22
|
+
return () => {
|
|
23
|
+
context.setCursorPosition(undefined);
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
return { setCursorPosition };
|
|
27
|
+
};
|
|
28
|
+
export default useCursor;
|
|
29
|
+
//# sourceMappingURL=use-cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cursor.js","sourceRoot":"","sources":["../../src/hooks/use-cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAG3D;;;;;;EAME;AACF,MAAM,SAAS,GAAG,GAAG,EAAE;IACtB,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,MAAM,CAA6B,SAAS,CAAC,CAAC;IAElE,MAAM,iBAAiB,GAAG,WAAW,CACpC,CAAC,QAAoC,EAAE,EAAE;QACxC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAChC,CAAC,EACD,EAAE,CACF,CAAC;IAEF,oEAAoE;IACpE,6EAA6E;IAC7E,iFAAiF;IACjF,oEAAoE;IACpE,kBAAkB,CAAC,GAAG,EAAE;QACvB,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE;YACX,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAC,iBAAiB,EAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -17,12 +17,27 @@ type Output = {
|
|
|
17
17
|
*/
|
|
18
18
|
focusPrevious: Props['focusPrevious'];
|
|
19
19
|
/**
|
|
20
|
-
Switch focus to the element with provided `id`. If there's no element with that `id`, focus
|
|
20
|
+
Switch focus to the element with provided `id`. If there's no element with that `id`, focus is not changed.
|
|
21
21
|
*/
|
|
22
22
|
focus: Props['focus'];
|
|
23
|
+
/**
|
|
24
|
+
The ID of the currently focused component, or `undefined` if no component is focused.
|
|
25
|
+
|
|
26
|
+
@example
|
|
27
|
+
```tsx
|
|
28
|
+
import {Text, useFocusManager} from 'ink';
|
|
29
|
+
|
|
30
|
+
const Example = () => {
|
|
31
|
+
const {activeId} = useFocusManager();
|
|
32
|
+
|
|
33
|
+
return <Text>Focused: {activeId ?? 'none'}</Text>;
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
*/
|
|
37
|
+
activeId: Props['activeId'];
|
|
23
38
|
};
|
|
24
39
|
/**
|
|
25
|
-
|
|
40
|
+
A React hook that returns methods to enable or disable focus management for all components or manually switch focus to the next or previous components.
|
|
26
41
|
*/
|
|
27
42
|
declare const useFocusManager: () => Output;
|
|
28
43
|
export default useFocusManager;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import FocusContext from '../components/FocusContext.js';
|
|
3
3
|
/**
|
|
4
|
-
|
|
4
|
+
A React hook that returns methods to enable or disable focus management for all components or manually switch focus to the next or previous components.
|
|
5
5
|
*/
|
|
6
6
|
const useFocusManager = () => {
|
|
7
7
|
const focusContext = useContext(FocusContext);
|
|
@@ -11,6 +11,7 @@ const useFocusManager = () => {
|
|
|
11
11
|
focusNext: focusContext.focusNext,
|
|
12
12
|
focusPrevious: focusContext.focusPrevious,
|
|
13
13
|
focus: focusContext.focus,
|
|
14
|
+
activeId: focusContext.activeId,
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
export default useFocusManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-manager.js","sourceRoot":"","sources":["../../src/hooks/use-focus-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAA0B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-focus-manager.js","sourceRoot":"","sources":["../../src/hooks/use-focus-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAA0B,MAAM,+BAA+B,CAAC;AA6CvE;;EAEE;AACF,MAAM,eAAe,GAAG,GAAW,EAAE;IACpC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAE9C,OAAO;QACN,WAAW,EAAE,YAAY,CAAC,WAAW;QACrC,YAAY,EAAE,YAAY,CAAC,YAAY;QACvC,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,aAAa,EAAE,YAAY,CAAC,aAAa;QACzC,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAC/B,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -23,7 +23,8 @@ type Output = {
|
|
|
23
23
|
focus: (id: string) => void;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
A
|
|
26
|
+
A React hook that returns focus state and focus controls for the current component.
|
|
27
|
+
A component that uses the `useFocus` hook becomes "focusable" to Ink, so when the user presses <kbd>Tab</kbd>, Ink will switch focus to this component. If there are multiple components that execute the `useFocus` hook, focus will be given to them in the order in which these components are rendered.
|
|
27
28
|
*/
|
|
28
29
|
declare const useFocus: ({ isActive, autoFocus, id: customId, }?: Input) => Output;
|
|
29
30
|
export default useFocus;
|
package/build/hooks/use-focus.js
CHANGED
|
@@ -2,7 +2,8 @@ import { useEffect, useContext, useMemo } from 'react';
|
|
|
2
2
|
import FocusContext from '../components/FocusContext.js';
|
|
3
3
|
import useStdin from './use-stdin.js';
|
|
4
4
|
/**
|
|
5
|
-
A
|
|
5
|
+
A React hook that returns focus state and focus controls for the current component.
|
|
6
|
+
A component that uses the `useFocus` hook becomes "focusable" to Ink, so when the user presses <kbd>Tab</kbd>, Ink will switch focus to this component. If there are multiple components that execute the `useFocus` hook, focus will be given to them in the order in which these components are rendered.
|
|
6
7
|
*/
|
|
7
8
|
const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) => {
|
|
8
9
|
const { isRawModeSupported, setRawMode } = useStdin();
|
|
@@ -15,7 +16,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) =>
|
|
|
15
16
|
return () => {
|
|
16
17
|
remove(id);
|
|
17
18
|
};
|
|
18
|
-
}, [id, autoFocus]);
|
|
19
|
+
}, [id, autoFocus, add, remove]);
|
|
19
20
|
useEffect(() => {
|
|
20
21
|
if (isActive) {
|
|
21
22
|
activate(id);
|
|
@@ -23,7 +24,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) =>
|
|
|
23
24
|
else {
|
|
24
25
|
deactivate(id);
|
|
25
26
|
}
|
|
26
|
-
}, [isActive, id]);
|
|
27
|
+
}, [isActive, id, activate, deactivate]);
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
if (!isRawModeSupported || !isActive) {
|
|
29
30
|
return;
|
|
@@ -32,7 +33,7 @@ const useFocus = ({ isActive = true, autoFocus = false, id: customId, } = {}) =>
|
|
|
32
33
|
return () => {
|
|
33
34
|
setRawMode(false);
|
|
34
35
|
};
|
|
35
|
-
}, [isActive]);
|
|
36
|
+
}, [isActive, isRawModeSupported, setRawMode]);
|
|
36
37
|
return {
|
|
37
38
|
isFocused: Boolean(id) && activeId === id,
|
|
38
39
|
focus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus.js","sourceRoot":"","sources":["../../src/hooks/use-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACrD,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AA+BtC
|
|
1
|
+
{"version":3,"file":"use-focus.js","sourceRoot":"","sources":["../../src/hooks/use-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AACrD,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AA+BtC;;;EAGE;AACF,MAAM,QAAQ,GAAG,CAAC,EACjB,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,KAAK,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