blecsd 0.6.0 → 0.6.2

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.
Files changed (78) hide show
  1. package/README.md +50 -28
  2. package/dist/blend-BZDmQFAm.d.ts +1215 -0
  3. package/dist/chunk-3PGACJB6.js +1 -0
  4. package/dist/chunk-4XW4WIPH.js +1 -0
  5. package/dist/chunk-7CLV3LTZ.js +4 -0
  6. package/dist/chunk-APPZ3YHO.js +0 -0
  7. package/dist/chunk-EKE2BXPS.js +1 -0
  8. package/dist/chunk-ESMSDY3P.js +1 -0
  9. package/dist/chunk-FJLSHFCF.js +1 -0
  10. package/dist/chunk-GIMWA5WA.js +1 -0
  11. package/dist/chunk-IXUFU6TE.js +3 -0
  12. package/dist/chunk-JB5KFQPD.js +1 -0
  13. package/dist/chunk-JCLNGU3K.js +1 -0
  14. package/dist/chunk-JRRJCATR.js +1 -0
  15. package/dist/{chunk-UKVY43V3.js → chunk-JWIVZCKW.js} +1 -1
  16. package/dist/chunk-K5UMVDQX.js +1 -0
  17. package/dist/chunk-L4FIDOS6.js +1 -0
  18. package/dist/chunk-LIVVHEOU.js +1 -0
  19. package/dist/chunk-M5FXA5FL.js +1 -0
  20. package/dist/{chunk-XH5GTWCV.js → chunk-MEJJLDEQ.js} +1 -1
  21. package/dist/chunk-NYIMY4UV.js +1 -0
  22. package/dist/chunk-PQZTNWLA.js +1 -0
  23. package/dist/chunk-SXOBHRXF.js +2 -0
  24. package/dist/chunk-T2EQLWMN.js +1 -0
  25. package/dist/chunk-T62UPG63.js +4 -0
  26. package/dist/chunk-TPBILYDM.js +10 -0
  27. package/dist/chunk-UWS6FIU5.js +1 -0
  28. package/dist/{chunk-4N7IFBRQ.js → chunk-W64J7C25.js} +1 -1
  29. package/dist/chunk-W6RELN6A.js +1 -0
  30. package/dist/chunk-ZAJI53SZ.js +1 -0
  31. package/dist/components/index.d.ts +3 -318
  32. package/dist/components/index.js +5 -5
  33. package/dist/core/index.d.ts +6 -251
  34. package/dist/core/index.js +1 -1
  35. package/dist/debug/index.js +7 -7
  36. package/dist/{dirtyTracking-kCS9-NVF.d.ts → dirtyTracking-D0SQrEeo.d.ts} +1 -1
  37. package/dist/{doubleBuffer-CWASihKh.d.ts → doubleBuffer-d9yVNtj1.d.ts} +21 -1
  38. package/dist/{mouseParser-CCqSEUVN.d.ts → events-CGqK6LGt.d.ts} +1 -176
  39. package/dist/index.d.ts +10 -9
  40. package/dist/index.js +1 -1
  41. package/dist/{inputStream-COARA4CP.d.ts → inputStream-BoFAEJ7g.d.ts} +205 -2
  42. package/dist/{interactiveSystem-h92W9W4n.d.ts → interactiveSystem-Dtv3xERg.d.ts} +316 -1
  43. package/dist/mouseParser-CTNGolIA.d.ts +177 -0
  44. package/dist/{panelMovement-DGzIQ8Ll.d.ts → panelMovement-DSLYdNOL.d.ts} +5 -4
  45. package/dist/style/index.d.ts +851 -0
  46. package/dist/style/index.js +1 -0
  47. package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
  48. package/dist/systems/index.d.ts +6 -5
  49. package/dist/systems/index.js +1 -1
  50. package/dist/terminal/index.d.ts +201 -1295
  51. package/dist/terminal/index.js +1 -1
  52. package/dist/testing/index.d.ts +923 -0
  53. package/dist/testing/index.js +7 -0
  54. package/dist/text/index.js +1 -1
  55. package/dist/{textWrap-Ct2J8gO6.d.ts → textWrap-sY-PZzE7.d.ts} +1 -1
  56. package/dist/utils/index.d.ts +2 -2
  57. package/dist/widgets/bigText.js +1 -1
  58. package/dist/widgets/fonts/index.js +1 -1
  59. package/dist/widgets/index.js +18 -18
  60. package/package.json +16 -2
  61. package/dist/chunk-5YWRP2KG.js +0 -3
  62. package/dist/chunk-73Y45MLV.js +0 -12
  63. package/dist/chunk-A3GSH6MV.js +0 -1
  64. package/dist/chunk-A5B2BGUM.js +0 -1
  65. package/dist/chunk-EMZA6G2M.js +0 -4
  66. package/dist/chunk-ETFDYZVJ.js +0 -1
  67. package/dist/chunk-IANAVH2A.js +0 -1
  68. package/dist/chunk-JVMNMAHX.js +0 -1
  69. package/dist/chunk-K2QWNDXV.js +0 -1
  70. package/dist/chunk-LI3ZYXUT.js +0 -1
  71. package/dist/chunk-QABNK7IA.js +0 -1
  72. package/dist/chunk-QTDRFJG2.js +0 -1
  73. package/dist/chunk-SVHITP3F.js +0 -2
  74. package/dist/chunk-VIT4KE6Q.js +0 -1
  75. package/dist/chunk-XG5PVDOP.js +0 -1
  76. package/dist/chunk-YRSSCEAS.js +0 -1
  77. package/dist/chunk-ZL46COQF.js +0 -1
  78. /package/dist/{chunk-4XCFTNGN.js → chunk-4EV3YS7F.js} +0 -0
@@ -0,0 +1,177 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Mouse event parser for terminal mouse protocols.
5
+ * Supports X10, SGR, URXVT, DEC, and VT300 protocols.
6
+ * @module terminal/mouseParser
7
+ */
8
+
9
+ /**
10
+ * Mouse button identifiers.
11
+ */
12
+ type MouseButton = 'left' | 'middle' | 'right' | 'wheelUp' | 'wheelDown' | 'unknown';
13
+ /**
14
+ * Mouse action types.
15
+ */
16
+ type MouseAction = 'press' | 'release' | 'move' | 'wheel';
17
+ /**
18
+ * Mouse protocol types.
19
+ */
20
+ type MouseProtocol = 'x10' | 'sgr' | 'urxvt' | 'dec' | 'vt300';
21
+ /**
22
+ * Parsed mouse event with position and modifiers.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { parseMouseSequence, MouseEvent } from 'blecsd';
27
+ *
28
+ * const event = parseMouseSequence(Buffer.from('\x1b[<0;10;20M'));
29
+ * if (event) {
30
+ * console.log(event.x); // 10
31
+ * console.log(event.y); // 20
32
+ * console.log(event.button); // 'left'
33
+ * console.log(event.action); // 'press'
34
+ * }
35
+ * ```
36
+ */
37
+ interface MouseEvent {
38
+ /** X coordinate (0-indexed) */
39
+ readonly x: number;
40
+ /** Y coordinate (0-indexed) */
41
+ readonly y: number;
42
+ /** Mouse button */
43
+ readonly button: MouseButton;
44
+ /** Action type */
45
+ readonly action: MouseAction;
46
+ /** Ctrl modifier was pressed */
47
+ readonly ctrl: boolean;
48
+ /** Alt/Meta modifier was pressed */
49
+ readonly meta: boolean;
50
+ /** Shift modifier was pressed */
51
+ readonly shift: boolean;
52
+ /** Protocol used to encode this event */
53
+ readonly protocol: MouseProtocol;
54
+ /** Raw buffer data */
55
+ readonly raw: Uint8Array;
56
+ }
57
+ /**
58
+ * Zod schema for MouseEvent validation.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * import { MouseEventSchema } from 'blecsd';
63
+ *
64
+ * const result = MouseEventSchema.safeParse(event);
65
+ * if (result.success) {
66
+ * console.log('Valid mouse event');
67
+ * }
68
+ * ```
69
+ */
70
+ declare const MouseEventSchema: z.ZodObject<{
71
+ x: z.ZodNumber;
72
+ y: z.ZodNumber;
73
+ button: z.ZodEnum<{
74
+ unknown: "unknown";
75
+ left: "left";
76
+ right: "right";
77
+ middle: "middle";
78
+ wheelUp: "wheelUp";
79
+ wheelDown: "wheelDown";
80
+ }>;
81
+ action: z.ZodEnum<{
82
+ press: "press";
83
+ release: "release";
84
+ move: "move";
85
+ wheel: "wheel";
86
+ }>;
87
+ ctrl: z.ZodBoolean;
88
+ meta: z.ZodBoolean;
89
+ shift: z.ZodBoolean;
90
+ protocol: z.ZodEnum<{
91
+ x10: "x10";
92
+ sgr: "sgr";
93
+ urxvt: "urxvt";
94
+ dec: "dec";
95
+ vt300: "vt300";
96
+ }>;
97
+ raw: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
98
+ }, z.core.$strip>;
99
+ /**
100
+ * Focus event result (not a full mouse event).
101
+ */
102
+ interface FocusEvent {
103
+ /** Whether the terminal gained or lost focus */
104
+ readonly focused: boolean;
105
+ /** Raw buffer data */
106
+ readonly raw: Uint8Array;
107
+ }
108
+ /**
109
+ * Zod schema for FocusEvent validation.
110
+ */
111
+ declare const FocusEventSchema: z.ZodObject<{
112
+ focused: z.ZodBoolean;
113
+ raw: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
114
+ }, z.core.$strip>;
115
+ /**
116
+ * Result of parsing a mouse/focus sequence.
117
+ */
118
+ type ParseMouseResult = {
119
+ type: 'mouse';
120
+ event: MouseEvent;
121
+ } | {
122
+ type: 'focus';
123
+ event: FocusEvent;
124
+ } | null;
125
+ /**
126
+ * Parse a mouse or focus sequence from a buffer.
127
+ *
128
+ * Supports multiple mouse protocols:
129
+ * - X10/X11: Basic mouse reporting (ESC [ M ...)
130
+ * - SGR: Extended mouse reporting with release info (ESC [ < ...)
131
+ * - URXVT: rxvt-unicode mouse format (ESC [ ... M)
132
+ * - DEC: DEC locator format (ESC [ < ... & w)
133
+ * - VT300: VT300 locator format (ESC [ 24X ~ ...)
134
+ *
135
+ * Also handles terminal focus events (ESC [ I/O).
136
+ *
137
+ * @param buffer - Raw input buffer to parse
138
+ * @returns Parsed result or null if not a mouse sequence
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * import { parseMouseSequence } from 'blecsd';
143
+ *
144
+ * // Parse SGR mouse press at (10, 20)
145
+ * const result = parseMouseSequence(Buffer.from('\x1b[<0;10;20M'));
146
+ * if (result?.type === 'mouse') {
147
+ * console.log(result.event.x); // 9 (0-indexed)
148
+ * console.log(result.event.y); // 19 (0-indexed)
149
+ * console.log(result.event.button); // 'left'
150
+ * console.log(result.event.action); // 'press'
151
+ * }
152
+ *
153
+ * // Parse focus event
154
+ * const focus = parseMouseSequence(Buffer.from('\x1b[I'));
155
+ * if (focus?.type === 'focus') {
156
+ * console.log(focus.event.focused); // true
157
+ * }
158
+ * ```
159
+ */
160
+ declare function parseMouseSequence(buffer: Uint8Array): ParseMouseResult;
161
+ /**
162
+ * Check if a buffer contains a mouse sequence.
163
+ *
164
+ * @param buffer - Input buffer to check
165
+ * @returns true if buffer contains a mouse sequence
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * import { isMouseBuffer } from 'blecsd';
170
+ *
171
+ * const buffer = Buffer.from('\x1b[<0;10;20M');
172
+ * console.log(isMouseBuffer(buffer)); // true
173
+ * ```
174
+ */
175
+ declare function isMouseBuffer(buffer: Uint8Array): boolean;
176
+
177
+ export { type FocusEvent as F, type MouseEvent as M, type ParseMouseResult as P, type MouseButton as a, type MouseAction as b, FocusEventSchema as c, MouseEventSchema as d, type MouseProtocol as e, isMouseBuffer as i, parseMouseSequence as p };
@@ -1,11 +1,12 @@
1
1
  import { S as Scheduler } from './scheduler-NbHT3-D2.js';
2
2
  import { S as System, W as World, E as Entity } from './types-B8LmNkzG.js';
3
- import { b as EventBus, M as MouseEvent, U as UIEventMap } from './mouseParser-CCqSEUVN.js';
3
+ import { a as EventBus, U as UIEventMap } from './events-CGqK6LGt.js';
4
4
  import { K as KeyEvent } from './keyParser-DReXe2j-.js';
5
+ import { M as MouseEvent } from './mouseParser-CTNGolIA.js';
5
6
  import { Writable } from 'node:stream';
6
7
  import { a as CellChange, S as ScreenBufferData, C as Cell } from './cell-5Ty_3yMs.js';
7
- import { D as DoubleBufferData } from './doubleBuffer-CWASihKh.js';
8
- import { a as DirtyTracker } from './dirtyTracking-kCS9-NVF.js';
8
+ import { D as DoubleBufferData } from './doubleBuffer-d9yVNtj1.js';
9
+ import { a as DirtyTracker } from './dirtyTracking-D0SQrEeo.js';
9
10
 
10
11
  /**
11
12
  * Animation system for updating sprite animations.
@@ -1905,4 +1906,4 @@ declare function detectResizeHandle(clickX: number, clickY: number, panelWidth:
1905
1906
  */
1906
1907
  declare function mergeDirtyRects(rects: readonly DirtyRect[]): DirtyRect | undefined;
1907
1908
 
1908
- export { computeLayoutNow as $, focusPop as A, peekFocusStack as B, getFocusStackDepth as C, type DirtyRect as D, clearFocusStack as E, saveFocus as F, restoreFocus as G, rewindFocus as H, createInputSystem as I, registerInputSystem as J, type InputSystemState as K, queryInputReceivers as L, hitTest as M, pointInEntity as N, getInteractiveEntityAt as O, queueKeyEvent as P, queueMouseEvent as Q, getEventQueue as R, clearEventQueue as S, clearEntityInput as T, getInputEventBus as U, resetInputState as V, captureMouseTo as W, releaseMouse as X, isMouseCaptured as Y, getMouseCaptureEntity as Z, createLayoutSystem as _, animationSystem as a, isOcclusionCullingEnabled as a$, getComputedLayout as a0, getComputedBounds as a1, hasComputedLayout as a2, invalidateLayout as a3, invalidateAllLayouts as a4, createOutputSystem as a5, createOutputState as a6, clearOutputBuffer as a7, clearOutputStream as a8, generateOutput as a9, endSyncOutput as aA, createPanelMoveState as aB, createPanelMoveConfig as aC, createPanelConstraints as aD, beginMove as aE, beginResize as aF, updateMove as aG, updateResize as aH, endMoveOrResize as aI, cancelMoveOrResize as aJ, detectResizeHandle as aK, mergeDirtyRects as aL, keyboardMove as aM, keyboardResize as aN, createRenderSystem as aO, getRenderBuffer as aP, setRenderBuffer as aQ, clearRenderBuffer as aR, markAllDirty as aS, renderContent as aT, renderBackground as aU, renderBorder as aV, renderScrollbar as aW, renderText as aX, renderRect as aY, getViewportBounds as aZ, setViewportBounds as a_, getOutputBuffer as aa, setOutputBuffer as ab, getOutputStream as ac, setOutputStream as ad, getOutputState as ae, resetOutputState as af, writeRaw as ag, hideCursor as ah, showCursor as ai, cursorHome as aj, moveTo as ak, saveCursorPosition as al, restoreCursorPosition as am, setTerminalCursorShape as an, enterAlternateScreen as ao, leaveAlternateScreen as ap, setWindowTitle as aq, resetAttributes as ar, bell as as, enableMouseTracking as at, disableMouseTracking as au, enableBracketedPasteMode as av, disableBracketedPasteMode as aw, enableFocusReporting as ax, disableFocusReporting as ay, beginSyncOutput as az, clearScreen as b, setOcclusionCulling as b0, ComputedLayout as b1, type ComputedLayoutData as b2, type FocusEventData as b3, type FocusEventMap as b4, type FocusEventType as b5, type HitTestResult as b6, type InputEventType as b7, type MoveResult as b8, type OutputState as b9, type PanelConstraints as ba, type PanelMoveConfig as bb, type PanelMoveState as bc, type QueuedInputEvent as bd, type QueuedKeyEvent as be, type QueuedMouseEvent as bf, type RenderContext as bg, type ResizeHandle as bh, inputState as bi, cleanup as c, createAnimationSystem as d, registerAnimationSystem as e, focusSystem as f, createFocusSystem as g, hasAnimationSystem as h, inputSystem as i, focusEntity as j, focusNext as k, layoutSystem as l, focusPrev as m, focusFirst as n, outputSystem as o, focusLast as p, queryAnimation as q, renderSystem as r, focusOffset as s, blurAll as t, updateAnimations as u, getFocused as v, getFocusableEntities as w, getFocusEventBus as x, resetFocusEventBus as y, focusPush as z };
1909
+ export { clearEventQueue as $, focusFirst as A, focusLast as B, focusOffset as C, type DirtyRect as D, blurAll as E, getFocused as F, getFocusableEntities as G, getFocusEventBus as H, resetFocusEventBus as I, focusPush as J, focusPop as K, peekFocusStack as L, getFocusStackDepth as M, clearFocusStack as N, saveFocus as O, restoreFocus as P, rewindFocus as Q, createInputSystem as R, registerInputSystem as S, type InputSystemState as T, queryInputReceivers as U, hitTest as V, pointInEntity as W, getInteractiveEntityAt as X, queueKeyEvent as Y, queueMouseEvent as Z, getEventQueue as _, animationSystem as a, isOcclusionCullingEnabled as a$, clearEntityInput as a0, getInputEventBus as a1, resetInputState as a2, captureMouseTo as a3, releaseMouse as a4, isMouseCaptured as a5, getMouseCaptureEntity as a6, createLayoutSystem as a7, computeLayoutNow as a8, getComputedLayout as a9, beginSyncOutput as aA, endSyncOutput as aB, createPanelMoveState as aC, createPanelMoveConfig as aD, createPanelConstraints as aE, beginMove as aF, beginResize as aG, updateMove as aH, updateResize as aI, endMoveOrResize as aJ, cancelMoveOrResize as aK, detectResizeHandle as aL, mergeDirtyRects as aM, keyboardMove as aN, keyboardResize as aO, createRenderSystem as aP, getRenderBuffer as aQ, clearRenderBuffer as aR, markAllDirty as aS, renderContent as aT, renderBackground as aU, renderBorder as aV, renderScrollbar as aW, renderText as aX, renderRect as aY, getViewportBounds as aZ, setViewportBounds as a_, getComputedBounds as aa, hasComputedLayout as ab, invalidateLayout as ac, invalidateAllLayouts as ad, createOutputSystem as ae, createOutputState as af, clearOutputBuffer as ag, clearOutputStream as ah, generateOutput as ai, getOutputBuffer as aj, getOutputStream as ak, getOutputState as al, resetOutputState as am, moveTo as an, saveCursorPosition as ao, restoreCursorPosition as ap, setTerminalCursorShape as aq, setWindowTitle as ar, resetAttributes as as, bell as at, enableMouseTracking as au, disableMouseTracking as av, enableBracketedPasteMode as aw, disableBracketedPasteMode as ax, enableFocusReporting as ay, disableFocusReporting as az, clearScreen as b, setOcclusionCulling as b0, ComputedLayout as b1, type ComputedLayoutData as b2, type FocusEventData as b3, type FocusEventMap as b4, type FocusEventType as b5, type HitTestResult as b6, type InputEventType as b7, type MoveResult as b8, type OutputState as b9, type PanelConstraints as ba, type PanelMoveConfig as bb, type PanelMoveState as bc, type QueuedInputEvent as bd, type QueuedKeyEvent as be, type QueuedMouseEvent as bf, type RenderContext as bg, type ResizeHandle as bh, inputState as bi, cleanup as c, cursorHome as d, enterAlternateScreen as e, focusSystem as f, leaveAlternateScreen as g, hideCursor as h, inputSystem as i, setOutputStream as j, setRenderBuffer as k, layoutSystem as l, showCursor as m, createAnimationSystem as n, outputSystem as o, registerAnimationSystem as p, hasAnimationSystem as q, renderSystem as r, setOutputBuffer as s, queryAnimation as t, updateAnimations as u, createFocusSystem as v, writeRaw as w, focusEntity as x, focusNext as y, focusPrev as z };