@vizejs/fresco 0.101.0 → 0.103.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/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/{components-B5VXjX9s.mjs → components-BFV7PBp6.mjs} +399 -66
- package/dist/components-BFV7PBp6.mjs.map +1 -0
- package/dist/composables/index.d.mts +2 -2
- package/dist/composables/index.mjs +3 -3
- package/dist/composables-BKj30tnc.mjs +318 -0
- package/dist/composables-BKj30tnc.mjs.map +1 -0
- package/dist/index-43FxHkwF.d.mts +316 -0
- package/dist/index-43FxHkwF.d.mts.map +1 -0
- package/dist/{index-COlY8bRB.d.mts → index-BPjzljOc.d.mts} +368 -70
- package/dist/index-BPjzljOc.d.mts.map +1 -0
- package/dist/index.d.mts +129 -26
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +31 -4
- package/dist/index.mjs.map +1 -0
- package/dist/useInput-DrlvpGkS.mjs +1463 -0
- package/dist/useInput-DrlvpGkS.mjs.map +1 -0
- package/package.json +5 -2
- package/dist/components-B5VXjX9s.mjs.map +0 -1
- package/dist/composables-ThPaZc16.mjs +0 -194
- package/dist/composables-ThPaZc16.mjs.map +0 -1
- package/dist/index-BeImxraZ.d.mts +0 -142
- package/dist/index-BeImxraZ.d.mts.map +0 -1
- package/dist/index-COlY8bRB.d.mts.map +0 -1
- package/dist/useInput-CbggNZUF.mjs +0 -351
- package/dist/useInput-CbggNZUF.mjs.map +0 -1
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Ref } from "@vue/runtime-core";
|
|
2
|
-
import * as _$_vue_reactivity0 from "@vue/reactivity";
|
|
3
|
-
|
|
4
|
-
//#region src/composables/useInput.d.ts
|
|
5
|
-
interface KeyHandler {
|
|
6
|
-
(key: string, modifiers: {
|
|
7
|
-
ctrl: boolean;
|
|
8
|
-
alt: boolean;
|
|
9
|
-
shift: boolean;
|
|
10
|
-
}): void;
|
|
11
|
-
}
|
|
12
|
-
interface UseInputOptions {
|
|
13
|
-
/** Whether to capture input (boolean or Ref<boolean>) */
|
|
14
|
-
active?: boolean | Ref<boolean>;
|
|
15
|
-
/** Whether to capture input (alias for active, boolean or Ref<boolean>) */
|
|
16
|
-
isActive?: boolean | Ref<boolean>;
|
|
17
|
-
/** Called on key press */
|
|
18
|
-
onKey?: KeyHandler;
|
|
19
|
-
/** Called on character input */
|
|
20
|
-
onChar?: (char: string) => void;
|
|
21
|
-
/** Called on Enter */
|
|
22
|
-
onSubmit?: () => void;
|
|
23
|
-
/** Called on Escape */
|
|
24
|
-
onEscape?: () => void;
|
|
25
|
-
/** Called on arrow keys */
|
|
26
|
-
onArrow?: (direction: "up" | "down" | "left" | "right") => void;
|
|
27
|
-
}
|
|
28
|
-
declare function useInput(options?: UseInputOptions): {
|
|
29
|
-
isActive: Ref<boolean, boolean>;
|
|
30
|
-
lastKey: Ref<string | null, string | null>;
|
|
31
|
-
enable: () => void;
|
|
32
|
-
disable: () => void;
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/composables/useFocus.d.ts
|
|
36
|
-
interface UseFocusOptions {
|
|
37
|
-
/** Whether this element starts focused */
|
|
38
|
-
autoFocus?: boolean;
|
|
39
|
-
/** Focus ID for this element */
|
|
40
|
-
id?: string;
|
|
41
|
-
}
|
|
42
|
-
interface FocusManager {
|
|
43
|
-
/** Currently focused element ID */
|
|
44
|
-
focusedId: Ref<string | null>;
|
|
45
|
-
/** All focusable element IDs */
|
|
46
|
-
focusableIds: Ref<string[]>;
|
|
47
|
-
/** Focus a specific element */
|
|
48
|
-
focus: (id: string) => void;
|
|
49
|
-
/** Focus next element */
|
|
50
|
-
focusNext: () => void;
|
|
51
|
-
/** Focus previous element */
|
|
52
|
-
focusPrevious: () => void;
|
|
53
|
-
/** Register a focusable element */
|
|
54
|
-
register: (id: string) => void;
|
|
55
|
-
/** Unregister a focusable element */
|
|
56
|
-
unregister: (id: string) => void;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Use focus management
|
|
60
|
-
*/
|
|
61
|
-
declare function useFocus(options?: UseFocusOptions): {
|
|
62
|
-
id: string;
|
|
63
|
-
isFocused: _$_vue_reactivity0.ComputedRef<boolean>;
|
|
64
|
-
focus: () => void;
|
|
65
|
-
blur: () => void;
|
|
66
|
-
};
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/composables/useApp.d.ts
|
|
69
|
-
interface UseAppReturn {
|
|
70
|
-
/** Terminal width */
|
|
71
|
-
width: Ref<number>;
|
|
72
|
-
/** Terminal height */
|
|
73
|
-
height: Ref<number>;
|
|
74
|
-
/** Whether app is running */
|
|
75
|
-
isRunning: Ref<boolean>;
|
|
76
|
-
/** Exit the app */
|
|
77
|
-
exit: (code?: number) => void;
|
|
78
|
-
/** Force re-render */
|
|
79
|
-
render: () => void;
|
|
80
|
-
/** Clear the screen */
|
|
81
|
-
clear: () => void;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Use app context
|
|
85
|
-
*/
|
|
86
|
-
declare function useApp(): UseAppReturn;
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/composables/useIme.d.ts
|
|
89
|
-
interface UseImeOptions {
|
|
90
|
-
/** Initial IME mode */
|
|
91
|
-
mode?: ImeMode;
|
|
92
|
-
/** Called when IME mode changes */
|
|
93
|
-
onModeChange?: (mode: ImeMode) => void;
|
|
94
|
-
/** Called when composition updates */
|
|
95
|
-
onCompositionUpdate?: (text: string, cursor: number) => void;
|
|
96
|
-
/** Called when text is committed */
|
|
97
|
-
onCommit?: (text: string) => void;
|
|
98
|
-
}
|
|
99
|
-
type ImeMode = "direct" | "hiragana" | "katakana" | "half-katakana" | "full-alpha" | "pinyin" | "hangul";
|
|
100
|
-
interface ImeManager {
|
|
101
|
-
/** Whether IME is active */
|
|
102
|
-
isActive: Ref<boolean>;
|
|
103
|
-
/** Current input mode */
|
|
104
|
-
mode: Ref<ImeMode>;
|
|
105
|
-
/** Whether currently composing */
|
|
106
|
-
isComposing: Ref<boolean>;
|
|
107
|
-
/** Preedit text */
|
|
108
|
-
preedit: Ref<string>;
|
|
109
|
-
/** Cursor position in preedit */
|
|
110
|
-
preeditCursor: Ref<number>;
|
|
111
|
-
/** Candidate list */
|
|
112
|
-
candidates: Ref<string[]>;
|
|
113
|
-
/** Selected candidate index */
|
|
114
|
-
selectedCandidate: Ref<number>;
|
|
115
|
-
/** Mode display name */
|
|
116
|
-
modeDisplay: Ref<string>;
|
|
117
|
-
/** Enable IME */
|
|
118
|
-
enable: () => void;
|
|
119
|
-
/** Disable IME */
|
|
120
|
-
disable: () => void;
|
|
121
|
-
/** Set input mode */
|
|
122
|
-
setMode: (mode: ImeMode) => void;
|
|
123
|
-
/** Handle key event for IME */
|
|
124
|
-
handleKey: (key: string, modifiers: {
|
|
125
|
-
ctrl: boolean;
|
|
126
|
-
alt: boolean;
|
|
127
|
-
}) => boolean;
|
|
128
|
-
/** Commit current composition */
|
|
129
|
-
commit: () => void;
|
|
130
|
-
/** Cancel current composition */
|
|
131
|
-
cancel: () => void;
|
|
132
|
-
/** Select next candidate */
|
|
133
|
-
nextCandidate: () => void;
|
|
134
|
-
/** Select previous candidate */
|
|
135
|
-
prevCandidate: () => void;
|
|
136
|
-
/** Select candidate by number (1-9) */
|
|
137
|
-
selectCandidate: (num: number) => void;
|
|
138
|
-
}
|
|
139
|
-
declare function useIme(options?: UseImeOptions): ImeManager;
|
|
140
|
-
//#endregion
|
|
141
|
-
export { useApp as a, useFocus as c, useInput as d, UseAppReturn as i, KeyHandler as l, UseImeOptions as n, FocusManager as o, useIme as r, UseFocusOptions as s, ImeManager as t, UseInputOptions as u };
|
|
142
|
-
//# sourceMappingURL=index-BeImxraZ.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BeImxraZ.d.mts","names":[],"sources":["../src/composables/useInput.ts","../src/composables/useFocus.ts","../src/composables/useApp.ts","../src/composables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,GAAA,CAAI,OAAA;EHbF;EGeR,WAAA,EAAa,GAAA;EHfK;EGiBlB,OAAA,EAAS,GAAA;EHrBU;EGuBnB,aAAA,EAAe,GAAA;EHrBM;EGuBrB,UAAA,EAAY,GAAA;EHrBJ;EGuBR,iBAAA,EAAmB,GAAA;EHrBT;EGuBV,WAAA,EAAa,GAAA;EHnBb;EGqBA,MAAA;EHnBW;EGqBX,OAAA;EHrBsD;EGuBtD,OAAA,GAAU,IAAA,EAAM,OAAA;EHpBM;EGsBtB,SAAA,GAAY,GAAA,UAAa,SAAA;IAAa,IAAA;IAAe,GAAA;EAAA;;EAErD,MAAA;EHxBgC;EG0BhC,MAAA;;EAEA,aAAA;;EAEA,aAAA;;EAEA,eAAA,GAAkB,GAAA;AAAA;AAAA,iBAaJ,MAAA,CAAO,OAAA,GAAS,aAAA,GAAqB,UAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-COlY8bRB.d.mts","names":[],"sources":["../src/components/Box.ts","../src/components/Divider.ts","../src/components/Stack.ts","../src/components/Grid.ts","../src/components/Card.ts","../src/components/Text.ts","../src/components/Code.ts","../src/components/Link.ts","../src/components/TextInput.ts","../src/components/TextArea.ts","../src/components/Select.ts","../src/components/Checkbox.ts","../src/components/RadioGroup.ts","../src/components/Confirm.ts","../src/components/Form.ts","../src/components/Spinner.ts","../src/components/ProgressBar.ts","../src/components/Alert.ts","../src/components/Badge.ts","../src/components/Timer.ts","../src/components/Tooltip.ts","../src/components/List.ts","../src/components/Table.ts","../src/components/Tree.ts","../src/components/Menu.ts","../src/components/Tabs.ts","../src/components/Breadcrumb.ts","../src/components/Stepper.ts","../src/components/Modal.ts","../src/components/StatusBar.ts","../src/components/Header.ts","../src/components/KeyHint.ts","../src/components/Avatar.ts"],"mappings":";;;;UAMiB,QAAA;EAAQ;EAEvB,aAAA;EAFuB;EAIvB,QAAA;EAAA;EAEA,cAAA;EAQA;EAAA,UAAA;EAIA;EAFA,SAAA;EAMA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A;;;;;;;;;;;;;;;;;;;;;gBAAA,oBAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCnBF,UAAA;EACf,IAAA;EACA,WAAA;AAAA;AAAA,UAGe,YAAA;E/BDf;E+BGA,QAAA,EAAU,UAAA;E/BOV;E+BLA,SAAA;E/BSA;E+BPA,KAAA;E/BWA;E+BTA,KAAA;E/BaA;E+BXA,MAAA;E/BeA;E+BbA,SAAA;AAAA;AAAA,cAGW,OAAA,uBAAO,eAAA,sBAAA,gBAAA;;UAIC,QAAA,CAAS,UAAA;;;;UAIR,QAAA;;;;;;;;;;;;;;;;;;;qCARF,oBAAA,CAAA,YAAA;;;;UAIC,QAAA,CAAS,UAAA;;;;UAIR,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC5BL,WAAA;EhCAQ;EgCEvB,IAAA;EhCFuB;EgCIvB,QAAA;EhCAA;EgCEA,IAAA;EhCQA;EgCNA,EAAA;EhCUA;EgCRA,EAAA;EhCYA;EgCVA,MAAA;EhCcA;EgCZA,MAAA;AAAA;AAAA,cAiBW,MAAA,uBAAM,eAAA,CAsBW,oBAAA,CAtBX,gBAAA;;;;UAMG,QAAA;;;;;;;;;;;;;;;;UAgBA,QAAA,CAAS,WAAA;EAAA;AAAA,qCAtBZ,oBAAA,CAAA,YAAA;;+JAsBW,oBAAA,CAAA,gBAAA;;;;UAhBR,QAAA;;;;;;;;;;;;;;;;UAgBA,QAAA,CAAS,WAAA;EAAA;AAAA"}
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import { createRenderer, isRef, ref, watch } from "@vue/runtime-core";
|
|
2
|
-
//#region src/renderer.ts
|
|
3
|
-
/**
|
|
4
|
-
* Fresco Vue Custom Renderer
|
|
5
|
-
*/
|
|
6
|
-
let nextId = 0;
|
|
7
|
-
function createNode(type) {
|
|
8
|
-
return {
|
|
9
|
-
id: nextId++,
|
|
10
|
-
type,
|
|
11
|
-
props: {},
|
|
12
|
-
children: [],
|
|
13
|
-
parent: null
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Renderer options for Fresco
|
|
18
|
-
*/
|
|
19
|
-
const rendererOptions = {
|
|
20
|
-
patchProp(el, key, prevValue, nextValue) {
|
|
21
|
-
el.props[key] = nextValue;
|
|
22
|
-
},
|
|
23
|
-
insert(child, parent, anchor) {
|
|
24
|
-
child.parent = parent;
|
|
25
|
-
if (anchor) {
|
|
26
|
-
const index = parent.children.indexOf(anchor);
|
|
27
|
-
if (index !== -1) {
|
|
28
|
-
parent.children.splice(index, 0, child);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
parent.children.push(child);
|
|
33
|
-
},
|
|
34
|
-
remove(child) {
|
|
35
|
-
if (child.parent) {
|
|
36
|
-
const index = child.parent.children.indexOf(child);
|
|
37
|
-
if (index !== -1) child.parent.children.splice(index, 1);
|
|
38
|
-
child.parent = null;
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
createElement(type) {
|
|
42
|
-
return createNode(mapElementType(type));
|
|
43
|
-
},
|
|
44
|
-
createText(text) {
|
|
45
|
-
const node = createNode("text");
|
|
46
|
-
node.text = text;
|
|
47
|
-
return node;
|
|
48
|
-
},
|
|
49
|
-
createComment() {
|
|
50
|
-
return createNode("text");
|
|
51
|
-
},
|
|
52
|
-
setText(node, text) {
|
|
53
|
-
node.text = text;
|
|
54
|
-
},
|
|
55
|
-
setElementText(el, text) {
|
|
56
|
-
el.text = text;
|
|
57
|
-
el.children = [];
|
|
58
|
-
},
|
|
59
|
-
parentNode(node) {
|
|
60
|
-
return node.parent;
|
|
61
|
-
},
|
|
62
|
-
nextSibling(node) {
|
|
63
|
-
if (!node.parent) return null;
|
|
64
|
-
const index = node.parent.children.indexOf(node);
|
|
65
|
-
return node.parent.children[index + 1] || null;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Map Vue element types to Fresco node types
|
|
70
|
-
*/
|
|
71
|
-
function mapElementType(type) {
|
|
72
|
-
switch (type.toLowerCase()) {
|
|
73
|
-
case "box":
|
|
74
|
-
case "div":
|
|
75
|
-
case "view": return "box";
|
|
76
|
-
case "text":
|
|
77
|
-
case "span": return "text";
|
|
78
|
-
case "input":
|
|
79
|
-
case "textinput": return "input";
|
|
80
|
-
default: return "box";
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Create the Fresco renderer
|
|
85
|
-
*/
|
|
86
|
-
function createRenderer$1() {
|
|
87
|
-
return createRenderer(rendererOptions);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Convert Fresco tree to render nodes for native
|
|
91
|
-
*/
|
|
92
|
-
function treeToRenderNodes(root) {
|
|
93
|
-
const nodes = [];
|
|
94
|
-
function visit(node) {
|
|
95
|
-
const renderNode = {
|
|
96
|
-
id: node.id,
|
|
97
|
-
nodeType: node.type
|
|
98
|
-
};
|
|
99
|
-
if (node.text) renderNode.text = node.text;
|
|
100
|
-
if (node.props.wrap !== void 0) renderNode.wrap = Boolean(node.props.wrap);
|
|
101
|
-
if (node.props.value !== void 0) {
|
|
102
|
-
const v = node.props.value;
|
|
103
|
-
renderNode.value = typeof v === "string" || typeof v === "number" ? String(v) : "";
|
|
104
|
-
}
|
|
105
|
-
if (node.props.placeholder !== void 0) {
|
|
106
|
-
const p = node.props.placeholder;
|
|
107
|
-
renderNode.placeholder = typeof p === "string" || typeof p === "number" ? String(p) : "";
|
|
108
|
-
}
|
|
109
|
-
if (node.props.focused !== void 0) renderNode.focused = Boolean(node.props.focused);
|
|
110
|
-
if (node.props.cursor !== void 0) renderNode.cursor = Number(node.props.cursor);
|
|
111
|
-
if (node.props.mask !== void 0) renderNode.mask = Boolean(node.props.mask);
|
|
112
|
-
if (node.props.border !== void 0) {
|
|
113
|
-
const b = node.props.border;
|
|
114
|
-
renderNode.border = typeof b === "string" ? b : "";
|
|
115
|
-
}
|
|
116
|
-
if (node.props.style) {
|
|
117
|
-
const s = node.props.style;
|
|
118
|
-
const style = {};
|
|
119
|
-
if (s.display !== void 0) style.display = s.display;
|
|
120
|
-
if (s.flexDirection !== void 0) style.flexDirection = s.flexDirection;
|
|
121
|
-
if (s.flexWrap !== void 0) style.flexWrap = s.flexWrap;
|
|
122
|
-
if (s.justifyContent !== void 0) style.justifyContent = s.justifyContent;
|
|
123
|
-
if (s.alignItems !== void 0) style.alignItems = s.alignItems;
|
|
124
|
-
if (s.alignSelf !== void 0) style.alignSelf = s.alignSelf;
|
|
125
|
-
if (s.alignContent !== void 0) style.alignContent = s.alignContent;
|
|
126
|
-
if (s.flexGrow !== void 0) style.flexGrow = s.flexGrow;
|
|
127
|
-
if (s.flexShrink !== void 0) style.flexShrink = s.flexShrink;
|
|
128
|
-
if (s.width !== void 0 && (typeof s.width === "string" || typeof s.width === "number")) style.width = String(s.width);
|
|
129
|
-
if (s.height !== void 0 && (typeof s.height === "string" || typeof s.height === "number")) style.height = String(s.height);
|
|
130
|
-
if (s.minWidth !== void 0 && (typeof s.minWidth === "string" || typeof s.minWidth === "number")) style.minWidth = String(s.minWidth);
|
|
131
|
-
if (s.minHeight !== void 0 && (typeof s.minHeight === "string" || typeof s.minHeight === "number")) style.minHeight = String(s.minHeight);
|
|
132
|
-
if (s.maxWidth !== void 0 && (typeof s.maxWidth === "string" || typeof s.maxWidth === "number")) style.maxWidth = String(s.maxWidth);
|
|
133
|
-
if (s.maxHeight !== void 0 && (typeof s.maxHeight === "string" || typeof s.maxHeight === "number")) style.maxHeight = String(s.maxHeight);
|
|
134
|
-
if (s.padding !== void 0) style.padding = s.padding;
|
|
135
|
-
if (s.paddingTop !== void 0) style.paddingTop = s.paddingTop;
|
|
136
|
-
if (s.paddingRight !== void 0) style.paddingRight = s.paddingRight;
|
|
137
|
-
if (s.paddingBottom !== void 0) style.paddingBottom = s.paddingBottom;
|
|
138
|
-
if (s.paddingLeft !== void 0) style.paddingLeft = s.paddingLeft;
|
|
139
|
-
if (s.margin !== void 0) style.margin = s.margin;
|
|
140
|
-
if (s.marginTop !== void 0) style.marginTop = s.marginTop;
|
|
141
|
-
if (s.marginRight !== void 0) style.marginRight = s.marginRight;
|
|
142
|
-
if (s.marginBottom !== void 0) style.marginBottom = s.marginBottom;
|
|
143
|
-
if (s.marginLeft !== void 0) style.marginLeft = s.marginLeft;
|
|
144
|
-
if (s.gap !== void 0) style.gap = s.gap;
|
|
145
|
-
renderNode.style = style;
|
|
146
|
-
}
|
|
147
|
-
const appearance = {};
|
|
148
|
-
if (node.props.fg) appearance.fg = node.props.fg;
|
|
149
|
-
if (node.props.bg) appearance.bg = node.props.bg;
|
|
150
|
-
if (node.props.bold) appearance.bold = node.props.bold;
|
|
151
|
-
if (node.props.dim) appearance.dim = node.props.dim;
|
|
152
|
-
if (node.props.italic) appearance.italic = node.props.italic;
|
|
153
|
-
if (node.props.underline) appearance.underline = node.props.underline;
|
|
154
|
-
if (Object.keys(appearance).length > 0) renderNode.appearance = appearance;
|
|
155
|
-
if (node.children.length > 0) renderNode.children = node.children.map((c) => c.id);
|
|
156
|
-
nodes.push(renderNode);
|
|
157
|
-
for (const child of node.children) visit(child);
|
|
158
|
-
}
|
|
159
|
-
visit(root);
|
|
160
|
-
return nodes;
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/app.ts
|
|
164
|
-
/**
|
|
165
|
-
* Fresco App - Application instance management
|
|
166
|
-
*/
|
|
167
|
-
const lastKeyEvent = ref(null);
|
|
168
|
-
let native = null;
|
|
169
|
-
async function loadNative() {
|
|
170
|
-
if (!native) native = await import("@vizejs/fresco-native");
|
|
171
|
-
return native;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Create a Fresco TUI app
|
|
175
|
-
*/
|
|
176
|
-
function createApp(rootComponent, options = {}) {
|
|
177
|
-
const { mouse = false, exitOnCtrlC = true, onError } = options;
|
|
178
|
-
let vueApp = null;
|
|
179
|
-
let rootElement = null;
|
|
180
|
-
let mounted = false;
|
|
181
|
-
let running = false;
|
|
182
|
-
let exitResolve = null;
|
|
183
|
-
let needsRender = true;
|
|
184
|
-
const { createApp: createVueApp } = createRenderer$1();
|
|
185
|
-
async function mount() {
|
|
186
|
-
if (mounted) return;
|
|
187
|
-
const n = await loadNative();
|
|
188
|
-
if (mouse) n.initTerminalWithMouse();
|
|
189
|
-
else n.initTerminal();
|
|
190
|
-
n.initLayout();
|
|
191
|
-
const app = createVueApp(rootComponent);
|
|
192
|
-
rootElement = {
|
|
193
|
-
id: -1,
|
|
194
|
-
type: "root",
|
|
195
|
-
props: { style: {
|
|
196
|
-
width: "100%",
|
|
197
|
-
height: "100%",
|
|
198
|
-
flexDirection: "column",
|
|
199
|
-
justifyContent: "flex-start",
|
|
200
|
-
alignItems: "flex-start",
|
|
201
|
-
alignContent: "flex-start"
|
|
202
|
-
} },
|
|
203
|
-
children: [],
|
|
204
|
-
parent: null
|
|
205
|
-
};
|
|
206
|
-
app.mount(rootElement);
|
|
207
|
-
vueApp = app;
|
|
208
|
-
mounted = true;
|
|
209
|
-
running = true;
|
|
210
|
-
needsRender = true;
|
|
211
|
-
eventLoop();
|
|
212
|
-
}
|
|
213
|
-
async function unmount() {
|
|
214
|
-
if (!mounted) return;
|
|
215
|
-
running = false;
|
|
216
|
-
(await loadNative()).restoreTerminal();
|
|
217
|
-
if (vueApp) {
|
|
218
|
-
vueApp.unmount();
|
|
219
|
-
vueApp = null;
|
|
220
|
-
}
|
|
221
|
-
rootElement = null;
|
|
222
|
-
mounted = false;
|
|
223
|
-
if (exitResolve) exitResolve();
|
|
224
|
-
}
|
|
225
|
-
async function waitUntilExit() {
|
|
226
|
-
return new Promise((resolve) => {
|
|
227
|
-
exitResolve = resolve;
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
function render() {
|
|
231
|
-
if (!native || !mounted || !rootElement) return;
|
|
232
|
-
try {
|
|
233
|
-
const renderNodes = treeToRenderNodes(rootElement);
|
|
234
|
-
if (renderNodes.length > 0) {
|
|
235
|
-
native.renderTree(renderNodes);
|
|
236
|
-
native.flushTerminal();
|
|
237
|
-
}
|
|
238
|
-
} catch (error) {
|
|
239
|
-
if (onError) onError(error);
|
|
240
|
-
else console.error("Render error:", error);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
async function getTerminalInfo() {
|
|
244
|
-
const info = (await loadNative()).getTerminalInfo();
|
|
245
|
-
return {
|
|
246
|
-
width: info.width,
|
|
247
|
-
height: info.height
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
async function eventLoop() {
|
|
251
|
-
const n = await loadNative();
|
|
252
|
-
while (running) {
|
|
253
|
-
try {
|
|
254
|
-
const event = n.pollEvent(16);
|
|
255
|
-
if (event) {
|
|
256
|
-
if (event.eventType === "resize") {
|
|
257
|
-
n.syncTerminalSize();
|
|
258
|
-
n.clearScreen();
|
|
259
|
-
needsRender = true;
|
|
260
|
-
}
|
|
261
|
-
if (exitOnCtrlC && event.eventType === "key" && event.char === "c" && event.modifiers?.ctrl) {
|
|
262
|
-
await unmount();
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
if (event.eventType === "key") lastKeyEvent.value = {
|
|
266
|
-
type: "key",
|
|
267
|
-
key: event.key ?? void 0,
|
|
268
|
-
char: event.char ?? void 0,
|
|
269
|
-
ctrl: event.modifiers?.ctrl ?? false,
|
|
270
|
-
alt: event.modifiers?.alt ?? false,
|
|
271
|
-
shift: event.modifiers?.shift ?? false
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
if (needsRender) {
|
|
275
|
-
render();
|
|
276
|
-
needsRender = false;
|
|
277
|
-
}
|
|
278
|
-
needsRender = true;
|
|
279
|
-
} catch (error) {
|
|
280
|
-
if (onError) onError(error);
|
|
281
|
-
}
|
|
282
|
-
await new Promise((resolve) => setTimeout(resolve, 16));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return {
|
|
286
|
-
mount,
|
|
287
|
-
unmount,
|
|
288
|
-
waitUntilExit,
|
|
289
|
-
render,
|
|
290
|
-
getTerminalInfo
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region src/composables/useInput.ts
|
|
295
|
-
/**
|
|
296
|
-
* useInput - Input handling composable
|
|
297
|
-
*/
|
|
298
|
-
function useInput(options = {}) {
|
|
299
|
-
const { active = true, isActive: isActiveOption, onKey, onChar, onSubmit, onEscape, onArrow } = options;
|
|
300
|
-
const activeSource = isActiveOption ?? active;
|
|
301
|
-
const isActive = isRef(activeSource) ? activeSource : ref(activeSource);
|
|
302
|
-
const lastKey = ref(null);
|
|
303
|
-
watch(lastKeyEvent, (event) => {
|
|
304
|
-
if (!event || !isActive.value) return;
|
|
305
|
-
const modifiers = {
|
|
306
|
-
ctrl: event.ctrl,
|
|
307
|
-
alt: event.alt,
|
|
308
|
-
shift: event.shift
|
|
309
|
-
};
|
|
310
|
-
if (event.char) {
|
|
311
|
-
lastKey.value = event.char;
|
|
312
|
-
onChar?.(event.char);
|
|
313
|
-
onKey?.(event.char, modifiers);
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
if (event.key) {
|
|
317
|
-
lastKey.value = event.key;
|
|
318
|
-
onKey?.(event.key, modifiers);
|
|
319
|
-
switch (event.key) {
|
|
320
|
-
case "enter":
|
|
321
|
-
onSubmit?.();
|
|
322
|
-
break;
|
|
323
|
-
case "escape":
|
|
324
|
-
onEscape?.();
|
|
325
|
-
break;
|
|
326
|
-
case "up":
|
|
327
|
-
case "down":
|
|
328
|
-
case "left":
|
|
329
|
-
case "right":
|
|
330
|
-
onArrow?.(event.key);
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
const enable = () => {
|
|
336
|
-
isActive.value = true;
|
|
337
|
-
};
|
|
338
|
-
const disable = () => {
|
|
339
|
-
isActive.value = false;
|
|
340
|
-
};
|
|
341
|
-
return {
|
|
342
|
-
isActive,
|
|
343
|
-
lastKey,
|
|
344
|
-
enable,
|
|
345
|
-
disable
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
//#endregion
|
|
349
|
-
export { createRenderer$1 as i, createApp as n, lastKeyEvent as r, useInput as t };
|
|
350
|
-
|
|
351
|
-
//# sourceMappingURL=useInput-CbggNZUF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInput-CbggNZUF.mjs","names":["createRenderer","createVueRenderer","createRenderer"],"sources":["../src/renderer.ts","../src/app.ts","../src/composables/useInput.ts"],"sourcesContent":["/**\n * Fresco Vue Custom Renderer\n */\n\nimport {\n createRenderer as createVueRenderer,\n type RendererOptions,\n type RendererNode,\n type RendererElement,\n} from \"@vue/runtime-core\";\n\n/**\n * Fresco node types\n */\nexport interface FrescoNode extends RendererNode {\n id: number;\n type: \"box\" | \"text\" | \"input\" | \"root\";\n props: Record<string, unknown>;\n children: FrescoNode[];\n parent: FrescoNode | null;\n text?: string;\n}\n\n/**\n * Fresco element (extends node)\n */\nexport interface FrescoElement extends FrescoNode, RendererElement {}\n\nlet nextId = 0;\n\nfunction createNode(type: FrescoNode[\"type\"]): FrescoNode {\n return {\n id: nextId++,\n type,\n props: {},\n children: [],\n parent: null,\n };\n}\n\n/**\n * Renderer options for Fresco\n */\nconst rendererOptions: RendererOptions<FrescoNode, FrescoElement> = {\n patchProp(el, key, prevValue, nextValue) {\n el.props[key] = nextValue;\n },\n\n insert(child, parent, anchor) {\n child.parent = parent;\n if (anchor) {\n const index = parent.children.indexOf(anchor);\n if (index !== -1) {\n parent.children.splice(index, 0, child);\n return;\n }\n }\n parent.children.push(child);\n },\n\n remove(child) {\n if (child.parent) {\n const index = child.parent.children.indexOf(child);\n if (index !== -1) {\n child.parent.children.splice(index, 1);\n }\n child.parent = null;\n }\n },\n\n createElement(type) {\n const nodeType = mapElementType(type);\n return createNode(nodeType) as FrescoElement;\n },\n\n createText(text) {\n const node = createNode(\"text\");\n node.text = text;\n return node;\n },\n\n createComment() {\n // Comments are ignored in TUI\n return createNode(\"text\");\n },\n\n setText(node, text) {\n node.text = text;\n },\n\n setElementText(el, text) {\n el.text = text;\n el.children = [];\n },\n\n parentNode(node) {\n return node.parent;\n },\n\n nextSibling(node) {\n if (!node.parent) return null;\n const index = node.parent.children.indexOf(node);\n return node.parent.children[index + 1] || null;\n },\n};\n\n/**\n * Map Vue element types to Fresco node types\n */\nfunction mapElementType(type: string): FrescoNode[\"type\"] {\n switch (type.toLowerCase()) {\n case \"box\":\n case \"div\":\n case \"view\":\n return \"box\";\n case \"text\":\n case \"span\":\n return \"text\";\n case \"input\":\n case \"textinput\":\n return \"input\";\n default:\n return \"box\";\n }\n}\n\n/**\n * Create the Fresco renderer\n */\nexport function createRenderer() {\n return createVueRenderer(rendererOptions);\n}\n\n/**\n * Convert Fresco tree to render nodes for native\n */\nexport function treeToRenderNodes(root: FrescoNode): Array<{\n id: number;\n nodeType: string;\n text?: string;\n wrap?: boolean;\n value?: string;\n placeholder?: string;\n focused?: boolean;\n mask?: boolean;\n style?: Record<string, unknown>;\n appearance?: Record<string, unknown>;\n border?: string;\n children?: number[];\n}> {\n const nodes: Array<{\n id: number;\n nodeType: string;\n text?: string;\n wrap?: boolean;\n value?: string;\n placeholder?: string;\n focused?: boolean;\n mask?: boolean;\n style?: Record<string, unknown>;\n appearance?: Record<string, unknown>;\n border?: string;\n children?: number[];\n }> = [];\n\n function visit(node: FrescoNode) {\n const renderNode: (typeof nodes)[0] = {\n id: node.id,\n nodeType: node.type,\n };\n\n // Extract props\n if (node.text) {\n renderNode.text = node.text;\n }\n if (node.props.wrap !== undefined) {\n renderNode.wrap = Boolean(node.props.wrap);\n }\n if (node.props.value !== undefined) {\n const v = node.props.value;\n renderNode.value = typeof v === \"string\" || typeof v === \"number\" ? String(v) : \"\";\n }\n if (node.props.placeholder !== undefined) {\n const p = node.props.placeholder;\n renderNode.placeholder = typeof p === \"string\" || typeof p === \"number\" ? String(p) : \"\";\n }\n if (node.props.focused !== undefined) {\n renderNode.focused = Boolean(node.props.focused);\n }\n if (node.props.cursor !== undefined) {\n (renderNode as any).cursor = Number(node.props.cursor);\n }\n if (node.props.mask !== undefined) {\n renderNode.mask = Boolean(node.props.mask);\n }\n if (node.props.border !== undefined) {\n const b = node.props.border;\n renderNode.border = typeof b === \"string\" ? b : \"\";\n }\n\n // Extract style - only include defined values\n if (node.props.style) {\n const s = node.props.style as Record<string, unknown>;\n const style: Record<string, unknown> = {};\n\n if (s.display !== undefined) style.display = s.display;\n if (s.flexDirection !== undefined) style.flexDirection = s.flexDirection;\n if (s.flexWrap !== undefined) style.flexWrap = s.flexWrap;\n if (s.justifyContent !== undefined) style.justifyContent = s.justifyContent;\n if (s.alignItems !== undefined) style.alignItems = s.alignItems;\n if (s.alignSelf !== undefined) style.alignSelf = s.alignSelf;\n if (s.alignContent !== undefined) style.alignContent = s.alignContent;\n if (s.flexGrow !== undefined) style.flexGrow = s.flexGrow;\n if (s.flexShrink !== undefined) style.flexShrink = s.flexShrink;\n if (s.width !== undefined && (typeof s.width === \"string\" || typeof s.width === \"number\"))\n style.width = String(s.width);\n if (s.height !== undefined && (typeof s.height === \"string\" || typeof s.height === \"number\"))\n style.height = String(s.height);\n if (\n s.minWidth !== undefined &&\n (typeof s.minWidth === \"string\" || typeof s.minWidth === \"number\")\n )\n style.minWidth = String(s.minWidth);\n if (\n s.minHeight !== undefined &&\n (typeof s.minHeight === \"string\" || typeof s.minHeight === \"number\")\n )\n style.minHeight = String(s.minHeight);\n if (\n s.maxWidth !== undefined &&\n (typeof s.maxWidth === \"string\" || typeof s.maxWidth === \"number\")\n )\n style.maxWidth = String(s.maxWidth);\n if (\n s.maxHeight !== undefined &&\n (typeof s.maxHeight === \"string\" || typeof s.maxHeight === \"number\")\n )\n style.maxHeight = String(s.maxHeight);\n if (s.padding !== undefined) style.padding = s.padding;\n if (s.paddingTop !== undefined) style.paddingTop = s.paddingTop;\n if (s.paddingRight !== undefined) style.paddingRight = s.paddingRight;\n if (s.paddingBottom !== undefined) style.paddingBottom = s.paddingBottom;\n if (s.paddingLeft !== undefined) style.paddingLeft = s.paddingLeft;\n if (s.margin !== undefined) style.margin = s.margin;\n if (s.marginTop !== undefined) style.marginTop = s.marginTop;\n if (s.marginRight !== undefined) style.marginRight = s.marginRight;\n if (s.marginBottom !== undefined) style.marginBottom = s.marginBottom;\n if (s.marginLeft !== undefined) style.marginLeft = s.marginLeft;\n if (s.gap !== undefined) style.gap = s.gap;\n\n renderNode.style = style as any;\n }\n\n // Extract appearance (fg, bg, bold, etc.)\n const appearance: Record<string, unknown> = {};\n if (node.props.fg) appearance.fg = node.props.fg;\n if (node.props.bg) appearance.bg = node.props.bg;\n if (node.props.bold) appearance.bold = node.props.bold;\n if (node.props.dim) appearance.dim = node.props.dim;\n if (node.props.italic) appearance.italic = node.props.italic;\n if (node.props.underline) appearance.underline = node.props.underline;\n if (Object.keys(appearance).length > 0) {\n renderNode.appearance = appearance;\n }\n\n // Children\n if (node.children.length > 0) {\n renderNode.children = node.children.map((c) => c.id);\n }\n\n nodes.push(renderNode);\n\n // Visit children\n for (const child of node.children) {\n visit(child);\n }\n }\n\n visit(root);\n return nodes;\n}\n","/**\n * Fresco App - Application instance management\n */\n\nimport { type Component, type App as VueApp, ref, type Ref } from \"@vue/runtime-core\";\nimport { createRenderer, treeToRenderNodes, type FrescoElement } from \"./renderer.js\";\n\n// Event types\nexport interface KeyEvent {\n type: \"key\";\n key?: string;\n char?: string;\n ctrl: boolean;\n alt: boolean;\n shift: boolean;\n}\n\nexport interface ResizeEvent {\n type: \"resize\";\n width: number;\n height: number;\n}\n\nexport type InputEvent = KeyEvent | ResizeEvent;\n\n// Global event state\nexport const lastKeyEvent: Ref<KeyEvent | null> = ref(null);\n\n// Import native bindings\n// eslint-disable-next-line typescript-eslint/no-redundant-type-constituents -- index.d.ts is not yet generated\nlet native: typeof import(\"@vizejs/fresco-native\") | null = null;\n\nasync function loadNative() {\n if (!native) {\n native = await import(\"@vizejs/fresco-native\");\n }\n return native;\n}\n\n/**\n * App options\n */\nexport interface AppOptions {\n /** Enable mouse support */\n mouse?: boolean;\n /** Exit on Ctrl+C */\n exitOnCtrlC?: boolean;\n /** Custom error handler */\n onError?: (error: Error) => void;\n /** Debug mode - logs render tree */\n debug?: boolean;\n}\n\n/**\n * Fresco App instance\n */\nexport interface App {\n /** Mount the app */\n mount(): Promise<void>;\n /** Unmount the app */\n unmount(): Promise<void>;\n /** Wait for exit */\n waitUntilExit(): Promise<void>;\n /** Render the app */\n render(): void;\n /** Get terminal info */\n getTerminalInfo(): Promise<{ width: number; height: number }>;\n}\n\n/**\n * Create a Fresco TUI app\n */\nexport function createApp(rootComponent: Component, options: AppOptions = {}): App {\n const { mouse = false, exitOnCtrlC = true, onError } = options;\n\n let vueApp: VueApp | null = null;\n let rootElement: FrescoElement | null = null;\n let mounted = false;\n let running = false;\n let exitResolve: (() => void) | null = null;\n let needsRender = true;\n\n const { createApp: createVueApp } = createRenderer();\n\n async function mount() {\n if (mounted) return;\n\n const n = await loadNative();\n\n // Initialize terminal\n if (mouse) {\n n.initTerminalWithMouse();\n } else {\n n.initTerminal();\n }\n\n // Initialize layout engine\n n.initLayout();\n\n // Create Vue app with custom renderer\n const app = createVueApp(rootComponent);\n\n // Create a root element for mounting\n rootElement = {\n id: -1,\n type: \"root\",\n props: {\n style: {\n width: \"100%\",\n height: \"100%\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n alignItems: \"flex-start\",\n alignContent: \"flex-start\",\n },\n },\n children: [],\n parent: null,\n };\n\n app.mount(rootElement);\n vueApp = app;\n\n mounted = true;\n running = true;\n needsRender = true;\n\n // Start event loop\n void eventLoop();\n }\n\n async function unmount() {\n if (!mounted) return;\n\n running = false;\n\n const n = await loadNative();\n n.restoreTerminal();\n\n if (vueApp) {\n vueApp.unmount();\n vueApp = null;\n }\n\n rootElement = null;\n mounted = false;\n\n if (exitResolve) {\n exitResolve();\n }\n }\n\n async function waitUntilExit(): Promise<void> {\n return new Promise((resolve) => {\n exitResolve = resolve;\n });\n }\n\n function render() {\n if (!native || !mounted || !rootElement) {\n return;\n }\n\n try {\n // Convert Vue tree to render nodes\n const renderNodes = treeToRenderNodes(rootElement);\n\n // Send to native for rendering\n if (renderNodes.length > 0) {\n // Use renderTree which handles layout and painting\n native.renderTree(renderNodes as any);\n\n // Flush to display\n native.flushTerminal();\n }\n } catch (error) {\n if (onError) {\n onError(error as Error);\n } else {\n console.error(\"Render error:\", error);\n }\n }\n }\n\n async function getTerminalInfo() {\n const n = await loadNative();\n const info = n.getTerminalInfo();\n return { width: info.width, height: info.height };\n }\n\n async function eventLoop() {\n const n = await loadNative();\n\n while (running) {\n try {\n const event = n.pollEvent(16); // ~60fps\n\n if (event) {\n // Handle resize\n if (event.eventType === \"resize\") {\n n.syncTerminalSize();\n n.clearScreen();\n needsRender = true;\n }\n\n // Handle Ctrl+C\n if (\n exitOnCtrlC &&\n event.eventType === \"key\" &&\n event.char === \"c\" &&\n event.modifiers?.ctrl\n ) {\n await unmount();\n break;\n }\n\n // Dispatch key events\n if (event.eventType === \"key\") {\n lastKeyEvent.value = {\n type: \"key\",\n key: event.key ?? undefined,\n char: event.char ?? undefined,\n ctrl: event.modifiers?.ctrl ?? false,\n alt: event.modifiers?.alt ?? false,\n shift: event.modifiers?.shift ?? false,\n };\n }\n }\n\n // Render frame if needed\n if (needsRender) {\n render();\n needsRender = false;\n }\n\n // Schedule re-render (Vue reactivity will trigger updates)\n needsRender = true;\n } catch (error) {\n if (onError) {\n onError(error as Error);\n }\n }\n\n // Small delay to prevent busy loop\n await new Promise((resolve) => setTimeout(resolve, 16));\n }\n }\n\n return {\n mount,\n unmount,\n waitUntilExit,\n render,\n getTerminalInfo,\n };\n}\n","/**\n * useInput - Input handling composable\n */\n\nimport { ref, watch, isRef, type Ref } from \"@vue/runtime-core\";\nimport { lastKeyEvent } from \"../app.js\";\n\nexport interface KeyHandler {\n (key: string, modifiers: { ctrl: boolean; alt: boolean; shift: boolean }): void;\n}\n\nexport interface UseInputOptions {\n /** Whether to capture input (boolean or Ref<boolean>) */\n active?: boolean | Ref<boolean>;\n /** Whether to capture input (alias for active, boolean or Ref<boolean>) */\n isActive?: boolean | Ref<boolean>;\n /** Called on key press */\n onKey?: KeyHandler;\n /** Called on character input */\n onChar?: (char: string) => void;\n /** Called on Enter */\n onSubmit?: () => void;\n /** Called on Escape */\n onEscape?: () => void;\n /** Called on arrow keys */\n onArrow?: (direction: \"up\" | \"down\" | \"left\" | \"right\") => void;\n}\n\nexport function useInput(options: UseInputOptions = {}) {\n const {\n active = true,\n isActive: isActiveOption,\n onKey,\n onChar,\n onSubmit,\n onEscape,\n onArrow,\n } = options;\n\n // Support both active and isActive, prefer isActive if both provided\n const activeSource = isActiveOption ?? active;\n const isActive = isRef(activeSource) ? activeSource : ref(activeSource);\n const lastKey = ref<string | null>(null);\n\n // Watch for key events from the app\n watch(lastKeyEvent, (event) => {\n if (!event || !isActive.value) return;\n\n const modifiers = {\n ctrl: event.ctrl,\n alt: event.alt,\n shift: event.shift,\n };\n\n // Character input\n if (event.char) {\n lastKey.value = event.char;\n onChar?.(event.char);\n onKey?.(event.char, modifiers);\n return;\n }\n\n // Special keys\n if (event.key) {\n lastKey.value = event.key;\n onKey?.(event.key, modifiers);\n\n switch (event.key) {\n case \"enter\":\n onSubmit?.();\n break;\n case \"escape\":\n onEscape?.();\n break;\n case \"up\":\n case \"down\":\n case \"left\":\n case \"right\":\n onArrow?.(event.key as \"up\" | \"down\" | \"left\" | \"right\");\n break;\n }\n }\n });\n\n const enable = () => {\n isActive.value = true;\n };\n\n const disable = () => {\n isActive.value = false;\n };\n\n return {\n isActive,\n lastKey,\n enable,\n disable,\n };\n}\n\n/**\n * Shorthand for handling specific key combinations\n */\nexport function useKeyPress(\n key: string,\n handler: () => void,\n options: { ctrl?: boolean; alt?: boolean; shift?: boolean } = {},\n) {\n const { ctrl = false, alt = false, shift = false } = options;\n\n useInput({\n onKey: (pressedKey, modifiers) => {\n const matches =\n pressedKey.toLowerCase() === key.toLowerCase() &&\n modifiers.ctrl === ctrl &&\n modifiers.alt === alt &&\n modifiers.shift === shift;\n\n if (matches) {\n handler();\n }\n },\n });\n}\n"],"mappings":";;;;;AA4BA,IAAI,SAAS;AAEb,SAAS,WAAW,MAAsC;CACxD,OAAO;EACL,IAAI;EACJ;EACA,OAAO,EAAE;EACT,UAAU,EAAE;EACZ,QAAQ;EACT;;;;;AAMH,MAAM,kBAA8D;CAClE,UAAU,IAAI,KAAK,WAAW,WAAW;EACvC,GAAG,MAAM,OAAO;;CAGlB,OAAO,OAAO,QAAQ,QAAQ;EAC5B,MAAM,SAAS;EACf,IAAI,QAAQ;GACV,MAAM,QAAQ,OAAO,SAAS,QAAQ,OAAO;GAC7C,IAAI,UAAU,IAAI;IAChB,OAAO,SAAS,OAAO,OAAO,GAAG,MAAM;IACvC;;;EAGJ,OAAO,SAAS,KAAK,MAAM;;CAG7B,OAAO,OAAO;EACZ,IAAI,MAAM,QAAQ;GAChB,MAAM,QAAQ,MAAM,OAAO,SAAS,QAAQ,MAAM;GAClD,IAAI,UAAU,IACZ,MAAM,OAAO,SAAS,OAAO,OAAO,EAAE;GAExC,MAAM,SAAS;;;CAInB,cAAc,MAAM;EAElB,OAAO,WADU,eAAe,KACN,CAAC;;CAG7B,WAAW,MAAM;EACf,MAAM,OAAO,WAAW,OAAO;EAC/B,KAAK,OAAO;EACZ,OAAO;;CAGT,gBAAgB;EAEd,OAAO,WAAW,OAAO;;CAG3B,QAAQ,MAAM,MAAM;EAClB,KAAK,OAAO;;CAGd,eAAe,IAAI,MAAM;EACvB,GAAG,OAAO;EACV,GAAG,WAAW,EAAE;;CAGlB,WAAW,MAAM;EACf,OAAO,KAAK;;CAGd,YAAY,MAAM;EAChB,IAAI,CAAC,KAAK,QAAQ,OAAO;EACzB,MAAM,QAAQ,KAAK,OAAO,SAAS,QAAQ,KAAK;EAChD,OAAO,KAAK,OAAO,SAAS,QAAQ,MAAM;;CAE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