@vizejs/fresco 0.347.7 → 0.351.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/app-DJImCkSW.d.mts +135 -0
- package/dist/app-DJImCkSW.d.mts.map +1 -0
- package/dist/{useInput-iUuaOefz.mjs → app-D_Ke7C8w.mjs} +2 -216
- package/dist/{useInput-iUuaOefz.mjs.map → app-D_Ke7C8w.mjs.map} +1 -1
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/{components-rzllq5gt.mjs → components-3-vKPu1z.mjs} +2 -2
- package/dist/{components-rzllq5gt.mjs.map → components-3-vKPu1z.mjs.map} +1 -1
- package/dist/composables/index.d.mts +3 -2
- package/dist/composables/index.mjs +3 -2
- package/dist/{composables-Dh8YqmVY.mjs → composables-Da3c5pxz.mjs} +3 -2
- package/dist/{composables-Dh8YqmVY.mjs.map → composables-Da3c5pxz.mjs.map} +1 -1
- package/dist/{index-Dwx6lKP0.d.mts → index-DqGcW9sz.d.mts} +2 -85
- package/dist/index-DqGcW9sz.d.mts.map +1 -0
- package/dist/{index-CQHg8OjC.d.mts → index-xYdAuAvd.d.mts} +190 -384
- package/dist/index-xYdAuAvd.d.mts.map +1 -0
- package/dist/index.d.mts +7 -136
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/renderer-DWG0G3g8.d.mts +198 -0
- package/dist/renderer-DWG0G3g8.d.mts.map +1 -0
- package/dist/testing/index.d.mts +124 -0
- package/dist/testing/index.d.mts.map +1 -0
- package/dist/testing/index.mjs +282 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/useApp-CNjer3hJ.d.mts +86 -0
- package/dist/useApp-CNjer3hJ.d.mts.map +1 -0
- package/dist/useInput-BpH-JIU3.mjs +219 -0
- package/dist/useInput-BpH-JIU3.mjs.map +1 -0
- package/package.json +8 -4
- package/dist/index-CQHg8OjC.d.mts.map +0 -1
- package/dist/index-Dwx6lKP0.d.mts.map +0 -1
- package/dist/index.d.mts.map +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { F as PasteEvent, I as ResizeEvent, M as KeyEvent, P as MouseEvent, a as FocusEvent, i as CompositionEvent } from "./renderer-DWG0G3g8.mjs";
|
|
2
|
+
import { Component, Ref, VNode } from "@vue/runtime-core";
|
|
3
|
+
import { TerminalInfoNapi } from "@vizejs/fresco-native";
|
|
4
|
+
|
|
5
|
+
//#region src/kittyKeyboard.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Kitty keyboard protocol constants compatible with Ink.
|
|
8
|
+
*/
|
|
9
|
+
declare const kittyFlags: {
|
|
10
|
+
readonly disambiguateEscapeCodes: 1;
|
|
11
|
+
readonly reportEventTypes: 2;
|
|
12
|
+
readonly reportAlternateKeys: 4;
|
|
13
|
+
readonly reportAllKeysAsEscapeCodes: 8;
|
|
14
|
+
readonly reportAssociatedText: 16;
|
|
15
|
+
};
|
|
16
|
+
type KittyFlagName = keyof typeof kittyFlags;
|
|
17
|
+
interface KittyKeyboardOptions {
|
|
18
|
+
mode?: "auto" | "enabled" | "disabled";
|
|
19
|
+
flags?: KittyFlagName[];
|
|
20
|
+
}
|
|
21
|
+
declare function resolveKittyFlags(flags: KittyFlagName[]): number;
|
|
22
|
+
declare const kittyModifiers: {
|
|
23
|
+
readonly shift: 1;
|
|
24
|
+
readonly alt: 2;
|
|
25
|
+
readonly ctrl: 4;
|
|
26
|
+
readonly super: 8;
|
|
27
|
+
readonly hyper: 16;
|
|
28
|
+
readonly meta: 32;
|
|
29
|
+
readonly capsLock: 64;
|
|
30
|
+
readonly numLock: 128;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/app.d.ts
|
|
34
|
+
declare const lastKeyEvent: Ref<KeyEvent | null>;
|
|
35
|
+
declare const lastPasteEvent: Ref<PasteEvent | null>;
|
|
36
|
+
declare const lastResizeEvent: Ref<ResizeEvent | null>;
|
|
37
|
+
declare const lastMouseEvent: Ref<MouseEvent | null>;
|
|
38
|
+
declare const lastFocusEvent: Ref<FocusEvent | null>;
|
|
39
|
+
declare const lastCompositionEvent: Ref<CompositionEvent | null>;
|
|
40
|
+
/**
|
|
41
|
+
* App options
|
|
42
|
+
*/
|
|
43
|
+
interface AppOptions {
|
|
44
|
+
/** Enable mouse support */
|
|
45
|
+
mouse?: boolean;
|
|
46
|
+
/** Exit on Ctrl+C */
|
|
47
|
+
exitOnCtrlC?: boolean;
|
|
48
|
+
/** Custom error handler */
|
|
49
|
+
onError?: (error: Error) => void;
|
|
50
|
+
/** Debug mode - logs render tree */
|
|
51
|
+
debug?: boolean;
|
|
52
|
+
/** Ink-compatible option, accepted for API parity */
|
|
53
|
+
stdout?: NodeJS.WriteStream;
|
|
54
|
+
/** Ink-compatible option, accepted for API parity */
|
|
55
|
+
stdin?: NodeJS.ReadStream;
|
|
56
|
+
/** Ink-compatible option, accepted for API parity */
|
|
57
|
+
stderr?: NodeJS.WriteStream;
|
|
58
|
+
/** Ink-compatible option, accepted for API parity */
|
|
59
|
+
patchConsole?: boolean;
|
|
60
|
+
/** Called after a frame is rendered */
|
|
61
|
+
onRender?: (metrics: RenderMetrics) => void;
|
|
62
|
+
/** Enable screen reader rendering hints */
|
|
63
|
+
isScreenReaderEnabled?: boolean;
|
|
64
|
+
/** Maximum render frames per second */
|
|
65
|
+
maxFps?: number;
|
|
66
|
+
/** Use alternate screen buffer */
|
|
67
|
+
alternateScreen?: boolean;
|
|
68
|
+
/** Ink-compatible option, accepted for API parity */
|
|
69
|
+
incrementalRendering?: boolean;
|
|
70
|
+
/** Ink-compatible option, accepted for API parity */
|
|
71
|
+
concurrent?: boolean;
|
|
72
|
+
/** Override interactive mode detection */
|
|
73
|
+
interactive?: boolean;
|
|
74
|
+
/** Configure Kitty keyboard protocol support */
|
|
75
|
+
kittyKeyboard?: KittyKeyboardOptions;
|
|
76
|
+
}
|
|
77
|
+
type RenderOptions = AppOptions;
|
|
78
|
+
type AppRoot = Component | VNode;
|
|
79
|
+
/**
|
|
80
|
+
* Performance metrics for a render operation.
|
|
81
|
+
*/
|
|
82
|
+
interface RenderMetrics {
|
|
83
|
+
/** Time spent rendering in milliseconds */
|
|
84
|
+
renderTime: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Fresco App instance
|
|
88
|
+
*/
|
|
89
|
+
interface App$1 {
|
|
90
|
+
/** Mount the app */
|
|
91
|
+
mount(): Promise<void>;
|
|
92
|
+
/** Unmount the app */
|
|
93
|
+
unmount(errorOrResult?: unknown): Promise<void>;
|
|
94
|
+
/** Wait for exit */
|
|
95
|
+
waitUntilExit(): Promise<unknown>;
|
|
96
|
+
/** Wait for pending render output */
|
|
97
|
+
waitUntilRenderFlush(): Promise<void>;
|
|
98
|
+
/** Render the app */
|
|
99
|
+
render(): void;
|
|
100
|
+
/** Clear the screen */
|
|
101
|
+
clear(): void;
|
|
102
|
+
/** Get terminal info */
|
|
103
|
+
getTerminalInfo(): Promise<TerminalInfoNapi>;
|
|
104
|
+
}
|
|
105
|
+
interface RenderInstance {
|
|
106
|
+
rerender(root: AppRoot): void;
|
|
107
|
+
unmount(errorOrResult?: unknown): Promise<void>;
|
|
108
|
+
waitUntilExit(): Promise<unknown>;
|
|
109
|
+
waitUntilRenderFlush(): Promise<void>;
|
|
110
|
+
cleanup(): Promise<void>;
|
|
111
|
+
clear(): void;
|
|
112
|
+
}
|
|
113
|
+
type Instance = RenderInstance;
|
|
114
|
+
interface RenderToStringOptions {
|
|
115
|
+
/** Width of the virtual terminal in columns */
|
|
116
|
+
columns?: number;
|
|
117
|
+
}
|
|
118
|
+
interface WritableStreamLike {
|
|
119
|
+
write(...args: unknown[]): unknown;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a Fresco TUI app
|
|
123
|
+
*/
|
|
124
|
+
declare function createApp(rootComponent: AppRoot, options?: AppOptions): App$1;
|
|
125
|
+
/**
|
|
126
|
+
* Ink-compatible helper that mounts immediately.
|
|
127
|
+
*/
|
|
128
|
+
declare function render(root: AppRoot, options?: AppOptions | WritableStreamLike): RenderInstance;
|
|
129
|
+
/**
|
|
130
|
+
* Render a Fresco component to a plain string without starting a terminal app.
|
|
131
|
+
*/
|
|
132
|
+
declare function renderToString(root: AppRoot, options?: RenderToStringOptions): string;
|
|
133
|
+
//#endregion
|
|
134
|
+
export { KittyFlagName as _, RenderMetrics as a, kittyModifiers as b, createApp as c, lastKeyEvent as d, lastMouseEvent as f, renderToString as g, render as h, RenderInstance as i, lastCompositionEvent as l, lastResizeEvent as m, AppOptions as n, RenderOptions as o, lastPasteEvent as p, Instance as r, RenderToStringOptions as s, App$1 as t, lastFocusEvent as u, KittyKeyboardOptions as v, resolveKittyFlags as x, kittyFlags as y };
|
|
135
|
+
//# sourceMappingURL=app-DJImCkSW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-DJImCkSW.d.mts","names":[],"sources":["../src/kittyKeyboard.ts","../src/app.ts"],"mappings":";;;;;;;;cAIa,UAAA;EAAA;;;;;;KAQD,aAAA,gBAA6B,UAAU;AAAA,UAElC,oBAAA;EACf,IAAA;EACA,KAAA,GAAQ,aAAa;AAAA;AAAA,iBAGP,iBAAA,CAAkB,KAAsB,EAAf,aAAa;AAAA,cAIzC,cAAA;EAAA;;;;;;;;;;;cCoCA,YAAA,EAAc,GAAG,CAAC,QAAA;AAAA,cAClB,cAAA,EAAgB,GAAG,CAAC,UAAA;AAAA,cACpB,eAAA,EAAiB,GAAG,CAAC,WAAA;AAAA,cACrB,cAAA,EAAgB,GAAG,CAAC,UAAA;AAAA,cACpB,cAAA,EAAgB,GAAG,CAAC,UAAA;AAAA,cACpB,oBAAA,EAAsB,GAAG,CAAC,gBAAA;;;ADpDvC;UCuEiB,UAAA;;EAEf,KAAA;EDzEiD;EC2EjD,WAAA;EDzEmC;EC2EnC,OAAA,IAAW,KAAA,EAAO,KAAA;EDzEG;EC2ErB,KAAA;ED3EA;EC6EA,MAAA,GAAS,MAAA,CAAO,WAAA;ED7EK;EC+ErB,KAAA,GAAQ,MAAA,CAAO,UAAA;ED5ED;EC8Ed,MAAA,GAAS,MAAA,CAAO,WAAA;;EAEhB,YAAA;EDhFsD;ECkFtD,QAAA,IAAY,OAAA,EAAS,aAAA;EDrEb;ECuER,qBAAA;EDvEQ;ECyER,MAAA;;EAEA,eAAA;;EAEA,oBAAA;;EAEA,UAAA;;EAEA,WAAA;;EAEA,aAAA,GAAgB,oBAAA;AAAA;AAAA,KAGN,aAAA,GAAgB,UAAU;AAAA,KAE1B,OAAA,GAAU,SAAA,GAAY,KAAK;;;;UAKtB,aAAA;EAjEJ;EAmEX,UAAU;AAAA;;AAnE+B;AAC3C;UAwEiB,KAAA;;EAEf,KAAA,IAAS,OAAA;EA1EkC;EA4E3C,OAAA,CAAQ,aAAA,aAA0B,OAAA;EA3E2B;EA6E7D,aAAA,IAAiB,OAAA;EA7EU;EA+E3B,oBAAA,IAAwB,OAAA;EA9Eb;EAgFX,MAAA;;EAEA,KAAA;EAlFyC;EAoFzC,eAAA,IAAmB,OAAA,CAAQ,gBAAA;AAAA;AAAA,UAGZ,cAAA;EACf,QAAA,CAAS,IAAA,EAAM,OAAA;EACf,OAAA,CAAQ,aAAA,aAA0B,OAAA;EAClC,aAAA,IAAiB,OAAA;EACjB,oBAAA,IAAwB,OAAA;EACxB,OAAA,IAAW,OAAA;EACX,KAAA;AAAA;AAAA,KAGU,QAAA,GAAW,cAAc;AAAA,UAEpB,qBAAA;EA5DM;EA8DrB,OAAO;AAAA;AAAA,UAGQ,kBAAA;EACf,KAAA,IAAS,IAAI;AAAA;;;;iBA2PC,SAAA,CAAU,aAAA,EAAe,OAAA,EAAS,OAAA,GAAS,UAAA,GAAkB,KAAA;;;;iBA6c7D,MAAA,CACd,IAAA,EAAM,OAAA,EACN,OAAA,GAAS,UAAA,GAAa,kBAAA,GACrB,cAAA;;;;iBAgCa,cAAA,CAAe,IAAA,EAAM,OAAA,EAAS,OAAA,GAAS,qBAA0B"}
|
|
@@ -1366,220 +1366,6 @@ function renderToString(root, options = {}) {
|
|
|
1366
1366
|
return output;
|
|
1367
1367
|
}
|
|
1368
1368
|
//#endregion
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* useIsScreenReaderEnabled - screen reader mode flag.
|
|
1372
|
-
*/
|
|
1373
|
-
function useIsScreenReaderEnabled() {
|
|
1374
|
-
return inject(SCREEN_READER_KEY, null)?.value ?? isScreenReaderEnabledByDefault();
|
|
1375
|
-
}
|
|
1376
|
-
//#endregion
|
|
1377
|
-
//#region src/composables/usePaste.ts
|
|
1378
|
-
/**
|
|
1379
|
-
* usePaste - bracketed paste handling.
|
|
1380
|
-
*/
|
|
1381
|
-
let activePasteHandlerCount = 0;
|
|
1382
|
-
function hasActivePasteHandlers() {
|
|
1383
|
-
return activePasteHandlerCount > 0;
|
|
1384
|
-
}
|
|
1385
|
-
function toRef$1(value) {
|
|
1386
|
-
return isRef(value) ? value : ref(value);
|
|
1387
|
-
}
|
|
1388
|
-
function usePaste(handler, options = {}) {
|
|
1389
|
-
const isActive = toRef$1(options.isActive ?? true);
|
|
1390
|
-
const streams = useStreamsContext();
|
|
1391
|
-
let rawModeEnabled = false;
|
|
1392
|
-
let bracketedPasteEnabled = false;
|
|
1393
|
-
let pasteHandlerRegistered = false;
|
|
1394
|
-
const syncRawMode = (isEnabled) => {
|
|
1395
|
-
if (rawModeEnabled === isEnabled) return;
|
|
1396
|
-
streams.setRawMode(isEnabled);
|
|
1397
|
-
rawModeEnabled = isEnabled;
|
|
1398
|
-
};
|
|
1399
|
-
const syncBracketedPasteMode = (isEnabled) => {
|
|
1400
|
-
if (bracketedPasteEnabled === isEnabled) return;
|
|
1401
|
-
streams.setBracketedPasteMode(isEnabled);
|
|
1402
|
-
bracketedPasteEnabled = isEnabled;
|
|
1403
|
-
};
|
|
1404
|
-
const syncPasteRegistration = (isEnabled) => {
|
|
1405
|
-
if (pasteHandlerRegistered === isEnabled) return;
|
|
1406
|
-
activePasteHandlerCount += isEnabled ? 1 : -1;
|
|
1407
|
-
pasteHandlerRegistered = isEnabled;
|
|
1408
|
-
};
|
|
1409
|
-
const syncActiveState = (isEnabled) => {
|
|
1410
|
-
syncRawMode(isEnabled);
|
|
1411
|
-
syncBracketedPasteMode(isEnabled);
|
|
1412
|
-
syncPasteRegistration(isEnabled);
|
|
1413
|
-
};
|
|
1414
|
-
watch(lastPasteEvent, (event) => {
|
|
1415
|
-
if (!event || !isActive.value) return;
|
|
1416
|
-
handler(event.text);
|
|
1417
|
-
});
|
|
1418
|
-
watch(isActive, syncActiveState, { immediate: true });
|
|
1419
|
-
onUnmounted(() => syncActiveState(false));
|
|
1420
|
-
return {
|
|
1421
|
-
isActive,
|
|
1422
|
-
enable: () => {
|
|
1423
|
-
isActive.value = true;
|
|
1424
|
-
},
|
|
1425
|
-
disable: () => {
|
|
1426
|
-
isActive.value = false;
|
|
1427
|
-
}
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
//#endregion
|
|
1431
|
-
//#region src/composables/useInput.ts
|
|
1432
|
-
/**
|
|
1433
|
-
* useInput - Input handling composable
|
|
1434
|
-
*/
|
|
1435
|
-
function toRef(value) {
|
|
1436
|
-
return isRef(value) ? value : ref(value);
|
|
1437
|
-
}
|
|
1438
|
-
function keyName(event) {
|
|
1439
|
-
return event.char ?? event.key ?? "";
|
|
1440
|
-
}
|
|
1441
|
-
function toInkKey(event) {
|
|
1442
|
-
const key = event.key;
|
|
1443
|
-
return {
|
|
1444
|
-
upArrow: key === "up",
|
|
1445
|
-
downArrow: key === "down",
|
|
1446
|
-
leftArrow: key === "left",
|
|
1447
|
-
rightArrow: key === "right",
|
|
1448
|
-
pageDown: key === "pagedown" || key === "pageDown",
|
|
1449
|
-
pageUp: key === "pageup" || key === "pageUp",
|
|
1450
|
-
home: key === "home",
|
|
1451
|
-
end: key === "end",
|
|
1452
|
-
return: key === "enter" || key === "return",
|
|
1453
|
-
escape: key === "escape" || key === "esc",
|
|
1454
|
-
ctrl: event.ctrl,
|
|
1455
|
-
shift: event.shift,
|
|
1456
|
-
tab: key === "tab" || key === "backtab",
|
|
1457
|
-
backspace: key === "backspace",
|
|
1458
|
-
delete: key === "delete",
|
|
1459
|
-
meta: event.meta,
|
|
1460
|
-
super: event.super,
|
|
1461
|
-
hyper: event.hyper,
|
|
1462
|
-
capsLock: event.capsLock,
|
|
1463
|
-
numLock: event.numLock,
|
|
1464
|
-
eventType: event.eventType
|
|
1465
|
-
};
|
|
1466
|
-
}
|
|
1467
|
-
function emptyKey() {
|
|
1468
|
-
return {
|
|
1469
|
-
upArrow: false,
|
|
1470
|
-
downArrow: false,
|
|
1471
|
-
leftArrow: false,
|
|
1472
|
-
rightArrow: false,
|
|
1473
|
-
pageDown: false,
|
|
1474
|
-
pageUp: false,
|
|
1475
|
-
home: false,
|
|
1476
|
-
end: false,
|
|
1477
|
-
return: false,
|
|
1478
|
-
escape: false,
|
|
1479
|
-
ctrl: false,
|
|
1480
|
-
shift: false,
|
|
1481
|
-
tab: false,
|
|
1482
|
-
backspace: false,
|
|
1483
|
-
delete: false,
|
|
1484
|
-
meta: false,
|
|
1485
|
-
super: false,
|
|
1486
|
-
hyper: false,
|
|
1487
|
-
capsLock: false,
|
|
1488
|
-
numLock: false
|
|
1489
|
-
};
|
|
1490
|
-
}
|
|
1491
|
-
function inputValue(event, key) {
|
|
1492
|
-
if (event.char) return event.char;
|
|
1493
|
-
if (key.return) return "\r";
|
|
1494
|
-
return "";
|
|
1495
|
-
}
|
|
1496
|
-
function handleStructuredOptions(event, options, lastKey) {
|
|
1497
|
-
const modifiers = {
|
|
1498
|
-
ctrl: event.ctrl,
|
|
1499
|
-
alt: event.alt,
|
|
1500
|
-
shift: event.shift,
|
|
1501
|
-
meta: event.meta
|
|
1502
|
-
};
|
|
1503
|
-
const pressedKey = keyName(event);
|
|
1504
|
-
const inkKey = toInkKey(event);
|
|
1505
|
-
if (event.char) {
|
|
1506
|
-
lastKey.value = event.char;
|
|
1507
|
-
options.onChar?.(event.char);
|
|
1508
|
-
options.onKey?.(event.char, modifiers);
|
|
1509
|
-
return;
|
|
1510
|
-
}
|
|
1511
|
-
if (pressedKey) {
|
|
1512
|
-
lastKey.value = pressedKey;
|
|
1513
|
-
options.onKey?.(pressedKey, modifiers);
|
|
1514
|
-
}
|
|
1515
|
-
if (inkKey.return) options.onSubmit?.();
|
|
1516
|
-
if (inkKey.escape) options.onEscape?.();
|
|
1517
|
-
if (inkKey.upArrow) options.onArrow?.("up");
|
|
1518
|
-
if (inkKey.downArrow) options.onArrow?.("down");
|
|
1519
|
-
if (inkKey.leftArrow) options.onArrow?.("left");
|
|
1520
|
-
if (inkKey.rightArrow) options.onArrow?.("right");
|
|
1521
|
-
}
|
|
1522
|
-
function useInput(handlerOrOptions = {}, handlerOptions = {}) {
|
|
1523
|
-
const options = typeof handlerOrOptions === "function" ? {
|
|
1524
|
-
handler: handlerOrOptions,
|
|
1525
|
-
isActive: handlerOptions.isActive
|
|
1526
|
-
} : handlerOrOptions;
|
|
1527
|
-
const isActive = toRef(options.isActive ?? options.active ?? true);
|
|
1528
|
-
const lastKey = ref(null);
|
|
1529
|
-
const streams = useStreamsContext();
|
|
1530
|
-
let rawModeEnabled = false;
|
|
1531
|
-
const syncRawMode = (isEnabled) => {
|
|
1532
|
-
if (rawModeEnabled === isEnabled) return;
|
|
1533
|
-
streams.setRawMode(isEnabled);
|
|
1534
|
-
rawModeEnabled = isEnabled;
|
|
1535
|
-
};
|
|
1536
|
-
watch(lastKeyEvent, (event) => {
|
|
1537
|
-
if (!event || !isActive.value) return;
|
|
1538
|
-
const inkKey = toInkKey(event);
|
|
1539
|
-
const input = inputValue(event, inkKey);
|
|
1540
|
-
const pressedKey = keyName(event);
|
|
1541
|
-
if (input === "c" && inkKey.ctrl && streams.internal_exitOnCtrlC) return;
|
|
1542
|
-
lastKey.value = pressedKey || null;
|
|
1543
|
-
options.handler?.(input, inkKey);
|
|
1544
|
-
handleStructuredOptions(event, options, lastKey);
|
|
1545
|
-
});
|
|
1546
|
-
watch(lastPasteEvent, (event) => {
|
|
1547
|
-
if (!event || !isActive.value || hasActivePasteHandlers()) return;
|
|
1548
|
-
lastKey.value = event.text;
|
|
1549
|
-
options.handler?.(event.text, emptyKey());
|
|
1550
|
-
options.onChar?.(event.text);
|
|
1551
|
-
});
|
|
1552
|
-
watch(lastCompositionEvent, (event) => {
|
|
1553
|
-
if (!event || !isActive.value) return;
|
|
1554
|
-
if (event.type === "compositionstart") options.onCompositionStart?.();
|
|
1555
|
-
else if (event.type === "compositionupdate") options.onCompositionUpdate?.(event.text, event.cursor);
|
|
1556
|
-
else options.onCompositionEnd?.(event.text);
|
|
1557
|
-
});
|
|
1558
|
-
watch(isActive, syncRawMode, { immediate: true });
|
|
1559
|
-
onUnmounted(() => syncRawMode(false));
|
|
1560
|
-
const enable = () => {
|
|
1561
|
-
isActive.value = true;
|
|
1562
|
-
};
|
|
1563
|
-
const disable = () => {
|
|
1564
|
-
isActive.value = false;
|
|
1565
|
-
};
|
|
1566
|
-
return {
|
|
1567
|
-
isActive,
|
|
1568
|
-
lastKey,
|
|
1569
|
-
enable,
|
|
1570
|
-
disable
|
|
1571
|
-
};
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* Shorthand for handling specific key combinations
|
|
1575
|
-
*/
|
|
1576
|
-
function useKeyPress(key, handler, options = {}) {
|
|
1577
|
-
const { ctrl = false, alt = false, shift = false, meta = false } = options;
|
|
1578
|
-
useInput({ onKey: (pressedKey, modifiers) => {
|
|
1579
|
-
if (pressedKey.toLowerCase() === key.toLowerCase() && modifiers.ctrl === ctrl && modifiers.alt === alt && modifiers.shift === shift && modifiers.meta === meta) handler();
|
|
1580
|
-
} });
|
|
1581
|
-
}
|
|
1582
|
-
//#endregion
|
|
1583
|
-
export { useFocusManager as C, useFocus as S, updateLastRenderLayouts as _, createApp as a, useStdin as b, lastKeyEvent as c, lastResizeEvent as d, render as f, measureElement as g, getLastRenderLayout as h, useIsScreenReaderEnabled as i, lastMouseEvent as l, createRenderer$1 as m, useKeyPress as n, lastCompositionEvent as o, renderToString as p, usePaste as r, lastFocusEvent as s, useInput as t, lastPasteEvent as u, useCursor as v, useApp as w, useStdout as x, useStderr as y };
|
|
1369
|
+
export { SCREEN_READER_KEY as A, FOCUS_KEY as C, APP_KEY as D, useFocusManager as E, createAppContext as O, useStreamsContext as S, useFocus as T, STREAMS_KEY as _, lastMouseEvent as a, useStdin as b, render as c, getLastRenderLayout as d, measureElement as f, useCursor as g, createCursorContext as h, lastKeyEvent as i, isScreenReaderEnabledByDefault as j, useApp as k, renderToString as l, CURSOR_KEY as m, lastCompositionEvent as n, lastPasteEvent as o, updateLastRenderLayouts as p, lastFocusEvent as r, lastResizeEvent as s, createApp as t, createRenderer$1 as u, createStreamsContext as v, createFocusManager as w, useStdout as x, useStderr as y };
|
|
1584
1370
|
|
|
1585
|
-
//# sourceMappingURL=
|
|
1371
|
+
//# sourceMappingURL=app-D_Ke7C8w.mjs.map
|