blecsd 0.3.0 → 0.6.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.
Files changed (147) hide show
  1. package/README.md +146 -147
  2. package/dist/{border-Jb7TrMob.d.ts → border-Br-Jc027.d.ts} +2 -2
  3. package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
  4. package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
  5. package/dist/chunk-4N7IFBRQ.js +4 -0
  6. package/dist/{chunk-DNRXW56C.js → chunk-4XCFTNGN.js} +1 -1
  7. package/dist/chunk-5YWRP2KG.js +3 -0
  8. package/dist/chunk-6PX5R326.js +1 -0
  9. package/dist/chunk-73Y45MLV.js +12 -0
  10. package/dist/chunk-7ZFQO3OQ.js +1 -0
  11. package/dist/chunk-A3GSH6MV.js +1 -0
  12. package/dist/chunk-A5B2BGUM.js +1 -0
  13. package/dist/chunk-AM6IDSXI.js +1 -0
  14. package/dist/chunk-EHYOVHRL.js +2 -0
  15. package/dist/chunk-EMZA6G2M.js +4 -0
  16. package/dist/chunk-EOFT3PNU.js +1 -0
  17. package/dist/chunk-ETFDYZVJ.js +1 -0
  18. package/dist/chunk-FUW7OD3H.js +1 -0
  19. package/dist/chunk-GRMSEMU7.js +1 -0
  20. package/dist/chunk-I7AUKTXE.js +1 -0
  21. package/dist/chunk-IANAVH2A.js +1 -0
  22. package/dist/chunk-JN2OGNK3.js +1 -0
  23. package/dist/chunk-JVMNMAHX.js +1 -0
  24. package/dist/chunk-K2QWNDXV.js +1 -0
  25. package/dist/chunk-KYNS3GBJ.js +2 -0
  26. package/dist/chunk-LI3ZYXUT.js +1 -0
  27. package/dist/chunk-LNEISTXM.js +1 -0
  28. package/dist/chunk-QABNK7IA.js +1 -0
  29. package/dist/chunk-QS5QXZNJ.js +1 -0
  30. package/dist/chunk-QTDRFJG2.js +1 -0
  31. package/dist/chunk-RJULLVTH.js +1 -0
  32. package/dist/chunk-SVHITP3F.js +2 -0
  33. package/dist/chunk-UKVY43V3.js +1 -0
  34. package/dist/chunk-VIT4KE6Q.js +1 -0
  35. package/dist/chunk-XG5PVDOP.js +1 -0
  36. package/dist/chunk-XH5GTWCV.js +1 -0
  37. package/dist/chunk-XYMPBCYW.js +1 -0
  38. package/dist/chunk-YRSSCEAS.js +1 -0
  39. package/dist/chunk-ZL46COQF.js +1 -0
  40. package/dist/cli/init.js +1 -1
  41. package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
  42. package/dist/components/index.d.ts +7209 -6691
  43. package/dist/components/index.js +5 -1
  44. package/dist/core/index.d.ts +2501 -1262
  45. package/dist/core/index.js +1 -1
  46. package/dist/debug/index.d.ts +310 -84
  47. package/dist/debug/index.js +8 -1
  48. package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-kCS9-NVF.d.ts} +2 -2
  49. package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-CWASihKh.d.ts} +1 -1
  50. package/dist/errors/index.js +1 -1
  51. package/dist/{inputActions-CRsUtTHM.d.ts → factories-vW7bn_He.d.ts} +21 -786
  52. package/dist/{gameLoop-C-Ez_i54.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
  53. package/dist/index.d.ts +25 -500
  54. package/dist/index.js +1 -3
  55. package/dist/input/index.d.ts +1 -1
  56. package/dist/input/index.js +1 -1
  57. package/dist/inputStream-COARA4CP.d.ts +1182 -0
  58. package/dist/interactiveSystem-h92W9W4n.d.ts +1977 -0
  59. package/dist/{keyParser-BnHbg2iD.d.ts → keyParser-DReXe2j-.d.ts} +41 -41
  60. package/dist/{events-9ForpTfM.d.ts → mouseParser-CCqSEUVN.d.ts} +177 -2
  61. package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
  62. package/dist/panelMovement-DGzIQ8Ll.d.ts +1908 -0
  63. package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
  64. package/dist/positioning-DiUivJXa.d.ts +917 -0
  65. package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
  66. package/dist/{scheduler-CMcYew9Z.d.ts → scheduler-NbHT3-D2.d.ts} +3 -1
  67. package/dist/schemas/index.d.ts +6 -6
  68. package/dist/schemas/index.js +1 -1
  69. package/dist/systems/index.d.ts +1057 -1807
  70. package/dist/systems/index.js +1 -1
  71. package/dist/terminal/index.d.ts +7207 -2709
  72. package/dist/terminal/index.js +1 -1
  73. package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
  74. package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
  75. package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
  76. package/dist/text/index.d.ts +263 -0
  77. package/dist/text/index.js +3 -0
  78. package/dist/textWrap-Ct2J8gO6.d.ts +761 -0
  79. package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
  80. package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
  81. package/dist/utils/index.d.ts +827 -780
  82. package/dist/utils/index.js +32 -1
  83. package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
  84. package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
  85. package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
  86. package/dist/widgets/bigText.d.ts +13 -13
  87. package/dist/widgets/bigText.js +1 -1
  88. package/dist/widgets/fonts/index.d.ts +1 -1
  89. package/dist/widgets/fonts/index.js +1 -1
  90. package/dist/widgets/index.d.ts +2933 -1102
  91. package/dist/widgets/index.js +24 -1
  92. package/package.json +9 -22
  93. package/dist/3d/index.d.ts +0 -5
  94. package/dist/3d/index.js +0 -1
  95. package/dist/audio/index.d.ts +0 -177
  96. package/dist/audio/index.js +0 -1
  97. package/dist/chunk-2IEMMRUO.js +0 -1
  98. package/dist/chunk-35LCBY6P.js +0 -1
  99. package/dist/chunk-3AV52GY5.js +0 -1
  100. package/dist/chunk-3LHLSY3Y.js +0 -1
  101. package/dist/chunk-3O4TQHGK.js +0 -4
  102. package/dist/chunk-3UJWZ5ZN.js +0 -1
  103. package/dist/chunk-5PELJRUQ.js +0 -1
  104. package/dist/chunk-6M2J5QUA.js +0 -1
  105. package/dist/chunk-7IQEUVGF.js +0 -1
  106. package/dist/chunk-A6M6TFBL.js +0 -1
  107. package/dist/chunk-CIK4AMUA.js +0 -1
  108. package/dist/chunk-CUEUJAHK.js +0 -3
  109. package/dist/chunk-D42Q2KKR.js +0 -1
  110. package/dist/chunk-DYEXOFUU.js +0 -2
  111. package/dist/chunk-DYU72XLL.js +0 -1
  112. package/dist/chunk-E4CJRSND.js +0 -1
  113. package/dist/chunk-EAY7B5GL.js +0 -1
  114. package/dist/chunk-FCMTWFSE.js +0 -1
  115. package/dist/chunk-FGHEFXLK.js +0 -1
  116. package/dist/chunk-FL56THSI.js +0 -25
  117. package/dist/chunk-G437VE43.js +0 -1
  118. package/dist/chunk-G7GIWWLE.js +0 -1
  119. package/dist/chunk-GGXNWT36.js +0 -8
  120. package/dist/chunk-HLFORKXS.js +0 -1
  121. package/dist/chunk-J7MBKEBY.js +0 -1
  122. package/dist/chunk-K3SX2LY5.js +0 -1
  123. package/dist/chunk-LDAFEXN5.js +0 -1
  124. package/dist/chunk-LYSK5S63.js +0 -1
  125. package/dist/chunk-MKMFUXLB.js +0 -33
  126. package/dist/chunk-MQWPHPUM.js +0 -1
  127. package/dist/chunk-MTI376CU.js +0 -5
  128. package/dist/chunk-MTV2RJZD.js +0 -1
  129. package/dist/chunk-NZ55KBM6.js +0 -1
  130. package/dist/chunk-OB66FB4F.js +0 -1
  131. package/dist/chunk-OMMJ7B5P.js +0 -1
  132. package/dist/chunk-OR3BZY7C.js +0 -1
  133. package/dist/chunk-PXXGH3BV.js +0 -1
  134. package/dist/chunk-R7AICVRN.js +0 -2
  135. package/dist/chunk-RZ7FGVI6.js +0 -1
  136. package/dist/chunk-SHUC6JWA.js +0 -1
  137. package/dist/chunk-TWSWTBYL.js +0 -1
  138. package/dist/chunk-UMGTXSQB.js +0 -11
  139. package/dist/chunk-X3Q3T2SS.js +0 -4
  140. package/dist/chunk-XZJRWFOS.js +0 -1
  141. package/dist/chunk-ZAHG7Y3X.js +0 -1
  142. package/dist/game/index.d.ts +0 -486
  143. package/dist/game/index.js +0 -1
  144. package/dist/index-DBS5Uefn.d.ts +0 -3156
  145. package/dist/mouseParser-Cfrbn3AX.d.ts +0 -177
  146. package/dist/viewport3d-xI33-_wq.d.ts +0 -182
  147. package/dist/virtualViewport-Bpv6jlKt.d.ts +0 -1856
@@ -58,72 +58,61 @@ declare const KeyEventSchema: z.ZodObject<{
58
58
  sequence: z.ZodString;
59
59
  name: z.ZodEnum<{
60
60
  undefined: "undefined";
61
+ 0: "0";
62
+ up: "up";
63
+ down: "down";
64
+ 1: "1";
61
65
  x: "x";
62
66
  y: "y";
67
+ z: "z";
68
+ 2: "2";
69
+ left: "left";
70
+ right: "right";
71
+ "#": "#";
63
72
  r: "r";
64
73
  g: "g";
65
74
  b: "b";
66
75
  a: "a";
67
- 0: "0";
68
- 1: "1";
69
- 2: "2";
70
- 3: "3";
71
- 4: "4";
72
- escape: "escape";
73
- 5: "5";
74
- 6: "6";
75
- 7: "7";
76
- "!": "!";
77
- "#": "#";
78
- ";": ";";
79
- $: "$";
80
- "-": "-";
81
- left: "left";
82
- z: "z";
83
- "/": "/";
84
- v: "v";
85
- f: "f";
86
- o: "o";
87
- right: "right";
88
- up: "up";
89
- down: "down";
90
76
  return: "return";
91
77
  enter: "enter";
92
78
  space: "space";
93
79
  "*": "*";
94
- end: "end";
95
80
  insert: "insert";
96
81
  delete: "delete";
97
82
  home: "home";
83
+ end: "end";
98
84
  backspace: "backspace";
85
+ escape: "escape";
99
86
  tab: "tab";
100
- k: "k";
101
- j: "j";
102
87
  pageup: "pageup";
103
88
  pagedown: "pagedown";
104
- s: "s";
105
- "|": "|";
106
- "\\": "\\";
107
- 8: "8";
108
- 9: "9";
109
- "[": "[";
110
- "]": "]";
111
- c: "c";
112
- m: "m";
113
- h: "h";
114
- l: "l";
115
- u: "u";
116
- "?": "?";
117
- ",": ",";
118
89
  "%": "%";
90
+ c: "c";
119
91
  d: "d";
120
92
  e: "e";
93
+ f: "f";
94
+ h: "h";
121
95
  i: "i";
96
+ j: "j";
97
+ k: "k";
98
+ l: "l";
99
+ m: "m";
122
100
  n: "n";
101
+ o: "o";
123
102
  p: "p";
124
103
  q: "q";
104
+ s: "s";
125
105
  t: "t";
106
+ u: "u";
107
+ v: "v";
126
108
  w: "w";
109
+ 3: "3";
110
+ 4: "4";
111
+ 5: "5";
112
+ 6: "6";
113
+ 7: "7";
114
+ 8: "8";
115
+ 9: "9";
127
116
  f1: "f1";
128
117
  f2: "f2";
129
118
  f3: "f3";
@@ -137,22 +126,33 @@ declare const KeyEventSchema: z.ZodObject<{
137
126
  f11: "f11";
138
127
  f12: "f12";
139
128
  clear: "clear";
129
+ "!": "!";
140
130
  "@": "@";
131
+ $: "$";
141
132
  "^": "^";
142
133
  "&": "&";
143
134
  "(": "(";
144
135
  ")": ")";
136
+ "-": "-";
145
137
  _: "_";
146
138
  "=": "=";
147
139
  "+": "+";
140
+ "[": "[";
141
+ "]": "]";
148
142
  "{": "{";
149
143
  "}": "}";
144
+ "\\": "\\";
145
+ "|": "|";
146
+ ";": ";";
150
147
  ":": ":";
151
148
  "'": "'";
152
149
  "\"": "\"";
150
+ ",": ",";
153
151
  ".": ".";
154
152
  "<": "<";
155
153
  ">": ">";
154
+ "/": "/";
155
+ "?": "?";
156
156
  "`": "`";
157
157
  "~": "~";
158
158
  }>;
@@ -226,4 +226,4 @@ declare function parseKeySequence(buffer: Uint8Array): KeyEvent | null;
226
226
  */
227
227
  declare function parseKeyBuffer(buffer: Uint8Array): readonly KeyEvent[];
228
228
 
229
- export { type KeyName as K, KeyEventSchema as a, type KeyEvent as b, parseKeySequence as c, isMouseSequence as i, parseKeyBuffer as p };
229
+ export { type KeyEvent as K, type KeyName as a, parseKeySequence as b, KeyEventSchema as c, isMouseSequence as i, parseKeyBuffer as p };
@@ -1,4 +1,5 @@
1
- import { U as Unsubscribe, W as World, E as Entity } from './types-CPB4CpbH.js';
1
+ import { W as World, E as Entity, U as Unsubscribe } from './types-B8LmNkzG.js';
2
+ import { z } from 'zod';
2
3
 
3
4
  /**
4
5
  * Typed EventEmitter implementation for type-safe event handling
@@ -195,4 +196,178 @@ interface EntityEventBusStore<T extends EventMap> {
195
196
  */
196
197
  declare function createEntityEventBusStore<T extends EventMap>(): EntityEventBusStore<T>;
197
198
 
198
- export { type EntityEventBusStore as E, type GetEntityEventBus as G, type ScreenEventMap as S, type UIEventMap as U, type EventBus as a, type EventHandler as b, type EventMap as c, createEntityEventBusStore as d, createEventBus as e };
199
+ /**
200
+ * Mouse event parser for terminal mouse protocols.
201
+ * Supports X10, SGR, URXVT, DEC, and VT300 protocols.
202
+ * @module terminal/mouseParser
203
+ */
204
+
205
+ /**
206
+ * Mouse button identifiers.
207
+ */
208
+ type MouseButton = 'left' | 'middle' | 'right' | 'wheelUp' | 'wheelDown' | 'unknown';
209
+ /**
210
+ * Mouse action types.
211
+ */
212
+ type MouseAction = 'press' | 'release' | 'move' | 'wheel';
213
+ /**
214
+ * Mouse protocol types.
215
+ */
216
+ type MouseProtocol = 'x10' | 'sgr' | 'urxvt' | 'dec' | 'vt300';
217
+ /**
218
+ * Parsed mouse event with position and modifiers.
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * import { parseMouseSequence, MouseEvent } from 'blecsd';
223
+ *
224
+ * const event = parseMouseSequence(Buffer.from('\x1b[<0;10;20M'));
225
+ * if (event) {
226
+ * console.log(event.x); // 10
227
+ * console.log(event.y); // 20
228
+ * console.log(event.button); // 'left'
229
+ * console.log(event.action); // 'press'
230
+ * }
231
+ * ```
232
+ */
233
+ interface MouseEvent {
234
+ /** X coordinate (0-indexed) */
235
+ readonly x: number;
236
+ /** Y coordinate (0-indexed) */
237
+ readonly y: number;
238
+ /** Mouse button */
239
+ readonly button: MouseButton;
240
+ /** Action type */
241
+ readonly action: MouseAction;
242
+ /** Ctrl modifier was pressed */
243
+ readonly ctrl: boolean;
244
+ /** Alt/Meta modifier was pressed */
245
+ readonly meta: boolean;
246
+ /** Shift modifier was pressed */
247
+ readonly shift: boolean;
248
+ /** Protocol used to encode this event */
249
+ readonly protocol: MouseProtocol;
250
+ /** Raw buffer data */
251
+ readonly raw: Uint8Array;
252
+ }
253
+ /**
254
+ * Zod schema for MouseEvent validation.
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * import { MouseEventSchema } from 'blecsd';
259
+ *
260
+ * const result = MouseEventSchema.safeParse(event);
261
+ * if (result.success) {
262
+ * console.log('Valid mouse event');
263
+ * }
264
+ * ```
265
+ */
266
+ declare const MouseEventSchema: z.ZodObject<{
267
+ x: z.ZodNumber;
268
+ y: z.ZodNumber;
269
+ button: z.ZodEnum<{
270
+ unknown: "unknown";
271
+ left: "left";
272
+ right: "right";
273
+ middle: "middle";
274
+ wheelUp: "wheelUp";
275
+ wheelDown: "wheelDown";
276
+ }>;
277
+ action: z.ZodEnum<{
278
+ press: "press";
279
+ release: "release";
280
+ move: "move";
281
+ wheel: "wheel";
282
+ }>;
283
+ ctrl: z.ZodBoolean;
284
+ meta: z.ZodBoolean;
285
+ shift: z.ZodBoolean;
286
+ protocol: z.ZodEnum<{
287
+ x10: "x10";
288
+ sgr: "sgr";
289
+ urxvt: "urxvt";
290
+ dec: "dec";
291
+ vt300: "vt300";
292
+ }>;
293
+ raw: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
294
+ }, z.core.$strip>;
295
+ /**
296
+ * Focus event result (not a full mouse event).
297
+ */
298
+ interface FocusEvent {
299
+ /** Whether the terminal gained or lost focus */
300
+ readonly focused: boolean;
301
+ /** Raw buffer data */
302
+ readonly raw: Uint8Array;
303
+ }
304
+ /**
305
+ * Zod schema for FocusEvent validation.
306
+ */
307
+ declare const FocusEventSchema: z.ZodObject<{
308
+ focused: z.ZodBoolean;
309
+ raw: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
310
+ }, z.core.$strip>;
311
+ /**
312
+ * Result of parsing a mouse/focus sequence.
313
+ */
314
+ type ParseMouseResult = {
315
+ type: 'mouse';
316
+ event: MouseEvent;
317
+ } | {
318
+ type: 'focus';
319
+ event: FocusEvent;
320
+ } | null;
321
+ /**
322
+ * Parse a mouse or focus sequence from a buffer.
323
+ *
324
+ * Supports multiple mouse protocols:
325
+ * - X10/X11: Basic mouse reporting (ESC [ M ...)
326
+ * - SGR: Extended mouse reporting with release info (ESC [ < ...)
327
+ * - URXVT: rxvt-unicode mouse format (ESC [ ... M)
328
+ * - DEC: DEC locator format (ESC [ < ... & w)
329
+ * - VT300: VT300 locator format (ESC [ 24X ~ ...)
330
+ *
331
+ * Also handles terminal focus events (ESC [ I/O).
332
+ *
333
+ * @param buffer - Raw input buffer to parse
334
+ * @returns Parsed result or null if not a mouse sequence
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * import { parseMouseSequence } from 'blecsd';
339
+ *
340
+ * // Parse SGR mouse press at (10, 20)
341
+ * const result = parseMouseSequence(Buffer.from('\x1b[<0;10;20M'));
342
+ * if (result?.type === 'mouse') {
343
+ * console.log(result.event.x); // 9 (0-indexed)
344
+ * console.log(result.event.y); // 19 (0-indexed)
345
+ * console.log(result.event.button); // 'left'
346
+ * console.log(result.event.action); // 'press'
347
+ * }
348
+ *
349
+ * // Parse focus event
350
+ * const focus = parseMouseSequence(Buffer.from('\x1b[I'));
351
+ * if (focus?.type === 'focus') {
352
+ * console.log(focus.event.focused); // true
353
+ * }
354
+ * ```
355
+ */
356
+ declare function parseMouseSequence(buffer: Uint8Array): ParseMouseResult;
357
+ /**
358
+ * Check if a buffer contains a mouse sequence.
359
+ *
360
+ * @param buffer - Input buffer to check
361
+ * @returns true if buffer contains a mouse sequence
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * import { isMouseBuffer } from 'blecsd';
366
+ *
367
+ * const buffer = Buffer.from('\x1b[<0;10;20M');
368
+ * console.log(isMouseBuffer(buffer)); // true
369
+ * ```
370
+ */
371
+ declare function isMouseBuffer(buffer: Uint8Array): boolean;
372
+
373
+ export { type EventMap as E, type FocusEvent as F, type GetEntityEventBus as G, type MouseEvent as M, type ParseMouseResult as P, type ScreenEventMap as S, type UIEventMap as U, type MouseButton as a, type EventBus as b, type EntityEventBusStore as c, type EventHandler as d, createEntityEventBusStore as e, createEventBus as f, type MouseAction as g, FocusEventSchema as h, isMouseBuffer as i, MouseEventSchema as j, type MouseProtocol as k, parseMouseSequence as p };
@@ -188,4 +188,4 @@ declare function getStoreSize<T>(store: PackedStore<T>): number;
188
188
  */
189
189
  declare function getStoreCapacity<T>(store: PackedStore<T>): number;
190
190
 
191
- export { type PackedStore as P, type PackedHandle as a, addToStore as b, clearStore as c, createPackedStore as d, getStoreCapacity as e, forEachInStore as f, getFromStore as g, getStoreData as h, getStoreSize as i, isValidHandle as j, mapStore as m, removeFromStore as r, setInStore as s };
191
+ export { type PackedHandle as P, type PackedStore as a, addToStore as b, clearStore as c, createPackedStore as d, getStoreCapacity as e, forEachInStore as f, getFromStore as g, getStoreData as h, getStoreSize as i, isValidHandle as j, mapStore as m, removeFromStore as r, setInStore as s };