blecsd 0.4.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 (156) hide show
  1. package/README.md +169 -147
  2. package/dist/blend-BZDmQFAm.d.ts +1215 -0
  3. package/dist/{border-DGNDfT6T.d.ts → border-Br-Jc027.d.ts} +2 -2
  4. package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
  5. package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
  6. package/dist/chunk-3PGACJB6.js +1 -0
  7. package/dist/{chunk-DNRXW56C.js → chunk-4EV3YS7F.js} +1 -1
  8. package/dist/chunk-4XW4WIPH.js +1 -0
  9. package/dist/chunk-7CLV3LTZ.js +4 -0
  10. package/dist/chunk-7ZFQO3OQ.js +1 -0
  11. package/dist/chunk-AM6IDSXI.js +1 -0
  12. package/dist/chunk-APPZ3YHO.js +0 -0
  13. package/dist/chunk-EHYOVHRL.js +2 -0
  14. package/dist/chunk-EKE2BXPS.js +1 -0
  15. package/dist/chunk-EOFT3PNU.js +1 -0
  16. package/dist/chunk-ESMSDY3P.js +1 -0
  17. package/dist/chunk-FJLSHFCF.js +1 -0
  18. package/dist/chunk-FUW7OD3H.js +1 -0
  19. package/dist/chunk-GIMWA5WA.js +1 -0
  20. package/dist/chunk-GRMSEMU7.js +1 -0
  21. package/dist/chunk-I7AUKTXE.js +1 -0
  22. package/dist/chunk-IXUFU6TE.js +3 -0
  23. package/dist/chunk-JB5KFQPD.js +1 -0
  24. package/dist/chunk-JCLNGU3K.js +1 -0
  25. package/dist/chunk-JN2OGNK3.js +1 -0
  26. package/dist/chunk-JRRJCATR.js +1 -0
  27. package/dist/chunk-JWIVZCKW.js +1 -0
  28. package/dist/chunk-K5UMVDQX.js +1 -0
  29. package/dist/chunk-KYNS3GBJ.js +2 -0
  30. package/dist/chunk-L4FIDOS6.js +1 -0
  31. package/dist/chunk-LIVVHEOU.js +1 -0
  32. package/dist/chunk-LNEISTXM.js +1 -0
  33. package/dist/chunk-M5FXA5FL.js +1 -0
  34. package/dist/chunk-MEJJLDEQ.js +1 -0
  35. package/dist/chunk-NYIMY4UV.js +1 -0
  36. package/dist/chunk-PQZTNWLA.js +1 -0
  37. package/dist/chunk-QS5QXZNJ.js +1 -0
  38. package/dist/chunk-SXOBHRXF.js +2 -0
  39. package/dist/chunk-T2EQLWMN.js +1 -0
  40. package/dist/chunk-T62UPG63.js +4 -0
  41. package/dist/chunk-TPBILYDM.js +10 -0
  42. package/dist/chunk-UWS6FIU5.js +1 -0
  43. package/dist/chunk-W64J7C25.js +4 -0
  44. package/dist/chunk-W6RELN6A.js +1 -0
  45. package/dist/chunk-XYMPBCYW.js +1 -0
  46. package/dist/chunk-ZAJI53SZ.js +1 -0
  47. package/dist/cli/init.js +1 -1
  48. package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
  49. package/dist/components/index.d.ts +7762 -7682
  50. package/dist/components/index.js +5 -1
  51. package/dist/core/index.d.ts +4851 -4261
  52. package/dist/core/index.js +1 -1
  53. package/dist/debug/index.d.ts +310 -84
  54. package/dist/debug/index.js +8 -1
  55. package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-D0SQrEeo.d.ts} +2 -2
  56. package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-d9yVNtj1.d.ts} +22 -2
  57. package/dist/errors/index.js +1 -1
  58. package/dist/{events-9ForpTfM.d.ts → events-CGqK6LGt.d.ts} +2 -2
  59. package/dist/{inputActions-Fyw14_Gm.d.ts → factories-vW7bn_He.d.ts} +21 -786
  60. package/dist/{gameLoop-CSTb7e0L.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
  61. package/dist/index.d.ts +25 -1217
  62. package/dist/index.js +1 -3
  63. package/dist/input/index.d.ts +1 -1
  64. package/dist/input/index.js +1 -1
  65. package/dist/inputStream-BoFAEJ7g.d.ts +1385 -0
  66. package/dist/interactiveSystem-Dtv3xERg.d.ts +2292 -0
  67. package/dist/{keyParser-m7fWto6g.d.ts → keyParser-DReXe2j-.d.ts} +28 -28
  68. package/dist/{mouseParser-B7p5ow7K.d.ts → mouseParser-CTNGolIA.d.ts} +1 -1
  69. package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
  70. package/dist/panelMovement-DSLYdNOL.d.ts +1909 -0
  71. package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
  72. package/dist/positioning-DiUivJXa.d.ts +917 -0
  73. package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
  74. package/dist/{scheduler-DeeZleia.d.ts → scheduler-NbHT3-D2.d.ts} +1 -1
  75. package/dist/schemas/index.d.ts +6 -6
  76. package/dist/schemas/index.js +1 -1
  77. package/dist/style/index.d.ts +851 -0
  78. package/dist/style/index.js +1 -0
  79. package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
  80. package/dist/systems/index.d.ts +786 -1882
  81. package/dist/systems/index.js +1 -1
  82. package/dist/terminal/index.d.ts +5542 -2460
  83. package/dist/terminal/index.js +1 -1
  84. package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
  85. package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
  86. package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
  87. package/dist/testing/index.d.ts +923 -0
  88. package/dist/testing/index.js +7 -0
  89. package/dist/text/index.d.ts +263 -0
  90. package/dist/text/index.js +3 -0
  91. package/dist/textWrap-sY-PZzE7.d.ts +761 -0
  92. package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
  93. package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
  94. package/dist/utils/index.d.ts +829 -782
  95. package/dist/utils/index.js +32 -1
  96. package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
  97. package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
  98. package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
  99. package/dist/widgets/bigText.d.ts +13 -13
  100. package/dist/widgets/bigText.js +1 -1
  101. package/dist/widgets/fonts/index.d.ts +1 -1
  102. package/dist/widgets/fonts/index.js +1 -1
  103. package/dist/widgets/index.d.ts +1620 -910
  104. package/dist/widgets/index.js +24 -1
  105. package/package.json +23 -22
  106. package/dist/3d/index.d.ts +0 -5
  107. package/dist/3d/index.js +0 -1
  108. package/dist/audio/index.d.ts +0 -177
  109. package/dist/audio/index.js +0 -1
  110. package/dist/chunk-25OEBENM.js +0 -3
  111. package/dist/chunk-26STV7ZS.js +0 -1
  112. package/dist/chunk-2NMGUEFC.js +0 -4
  113. package/dist/chunk-35LCBY6P.js +0 -1
  114. package/dist/chunk-4PRDJTCM.js +0 -1
  115. package/dist/chunk-5PELJRUQ.js +0 -1
  116. package/dist/chunk-5VEKHA3B.js +0 -5
  117. package/dist/chunk-6KEM3OS2.js +0 -11
  118. package/dist/chunk-6XWY6GB7.js +0 -1
  119. package/dist/chunk-735KKTP3.js +0 -1
  120. package/dist/chunk-7SWJNDOL.js +0 -26
  121. package/dist/chunk-APKUNIMB.js +0 -1
  122. package/dist/chunk-CJCSZRV6.js +0 -1
  123. package/dist/chunk-DMBMCCLN.js +0 -1
  124. package/dist/chunk-DQTVJITR.js +0 -1
  125. package/dist/chunk-DSKQ5J4R.js +0 -1
  126. package/dist/chunk-E4CJRSND.js +0 -1
  127. package/dist/chunk-EF4DC6IN.js +0 -1
  128. package/dist/chunk-EJAKECSN.js +0 -1
  129. package/dist/chunk-FNQRUMFD.js +0 -1
  130. package/dist/chunk-GJ3RS2VG.js +0 -1
  131. package/dist/chunk-KTVEMB2I.js +0 -1
  132. package/dist/chunk-KYAPE44E.js +0 -8
  133. package/dist/chunk-LI4Y7TBZ.js +0 -1
  134. package/dist/chunk-NHOL4BN6.js +0 -1
  135. package/dist/chunk-NPNUUSIB.js +0 -1
  136. package/dist/chunk-NZ55KBM6.js +0 -1
  137. package/dist/chunk-OFRWGW2G.js +0 -1
  138. package/dist/chunk-OMMJ7B5P.js +0 -1
  139. package/dist/chunk-OMU5BSAS.js +0 -2
  140. package/dist/chunk-P3ZLIQJP.js +0 -1
  141. package/dist/chunk-PWI36BQJ.js +0 -1
  142. package/dist/chunk-QQMUDJ32.js +0 -2
  143. package/dist/chunk-R3ICZOE4.js +0 -1
  144. package/dist/chunk-RZ7FGVI6.js +0 -1
  145. package/dist/chunk-S6WS46FE.js +0 -1
  146. package/dist/chunk-TSARUU56.js +0 -1
  147. package/dist/chunk-WJRVUAZR.js +0 -33
  148. package/dist/chunk-WY5EZOOL.js +0 -1
  149. package/dist/chunk-YY6RZCZH.js +0 -4
  150. package/dist/chunk-ZPGJCHXH.js +0 -1
  151. package/dist/chunk-ZPL2J25N.js +0 -1
  152. package/dist/game/index.d.ts +0 -486
  153. package/dist/game/index.js +0 -1
  154. package/dist/index-DBS5Uefn.d.ts +0 -3156
  155. package/dist/viewport3d-xI33-_wq.d.ts +0 -182
  156. package/dist/virtualViewport-DTSN6jFk.d.ts +0 -1856
@@ -0,0 +1,691 @@
1
+ import { z } from 'zod';
2
+ import { W as World, E as Entity } from './types-B8LmNkzG.js';
3
+ import { A as Attribute } from './parser-Q1YLXYpF.js';
4
+ import { S as ScreenBufferData, C as Cell } from './cell-5Ty_3yMs.js';
5
+ import { S as ScrollbackBuffer } from './virtualScrollback-CiooIebp.js';
6
+
7
+ /**
8
+ * List Component Types
9
+ *
10
+ * @module components/list/types
11
+ */
12
+ /**
13
+ * List state type.
14
+ */
15
+ type ListState = 'idle' | 'focused' | 'selecting' | 'searching' | 'disabled';
16
+ /**
17
+ * List event type.
18
+ */
19
+ type ListEvent = 'focus' | 'blur' | 'startSelect' | 'endSelect' | 'startSearch' | 'endSearch' | 'disable' | 'enable';
20
+ /**
21
+ * List item data.
22
+ */
23
+ interface ListItem {
24
+ /** Display text */
25
+ readonly text: string;
26
+ /** Optional value associated with the item */
27
+ readonly value?: string;
28
+ /** Whether the item is disabled */
29
+ readonly disabled?: boolean;
30
+ }
31
+ /**
32
+ * List store for managing list-specific data.
33
+ */
34
+ interface ListStore {
35
+ /** Whether entity is a list */
36
+ isList: Uint8Array;
37
+ /** Currently selected index (-1 if none) */
38
+ selectedIndex: Int32Array;
39
+ /** Number of items in the list */
40
+ itemCount: Uint32Array;
41
+ /** First visible item index (for virtualization) */
42
+ firstVisible: Uint32Array;
43
+ /** Number of visible items */
44
+ visibleCount: Uint32Array;
45
+ /** Whether list is interactive */
46
+ interactive: Uint8Array;
47
+ /** Whether list responds to mouse */
48
+ mouse: Uint8Array;
49
+ /** Whether list responds to keyboard */
50
+ keys: Uint8Array;
51
+ /** Whether search mode is enabled */
52
+ searchEnabled: Uint8Array;
53
+ /** Total item count for virtualized lists (may be > itemCount) */
54
+ totalCount: Uint32Array;
55
+ /** Whether items are currently loading */
56
+ isLoading: Uint8Array;
57
+ }
58
+ /**
59
+ * Lazy load callback for virtualized lists.
60
+ * Called when items need to be loaded for a range.
61
+ *
62
+ * @param startIndex - First item index to load
63
+ * @param count - Number of items to load
64
+ * @returns Promise that resolves when items are loaded
65
+ */
66
+ type ListLazyLoadCallback = (startIndex: number, count: number) => Promise<ListItem[]>;
67
+ /**
68
+ * Scroll event callback for infinite scroll detection.
69
+ *
70
+ * @param scrollInfo - Information about current scroll state
71
+ */
72
+ type ListScrollCallback = (scrollInfo: ListScrollInfo) => void;
73
+ /**
74
+ * Scroll information for infinite scroll.
75
+ */
76
+ interface ListScrollInfo {
77
+ /** First visible item index */
78
+ readonly firstVisible: number;
79
+ /** Number of visible items */
80
+ readonly visibleCount: number;
81
+ /** Total loaded items */
82
+ readonly loadedCount: number;
83
+ /** Total items (may be larger than loaded for infinite scroll) */
84
+ readonly totalCount: number;
85
+ /** Whether we're near the end (within threshold) */
86
+ readonly nearEnd: boolean;
87
+ /** Whether we're near the start (within threshold) */
88
+ readonly nearStart: boolean;
89
+ }
90
+ /**
91
+ * List display configuration.
92
+ */
93
+ interface ListDisplay {
94
+ /** Character shown before selected item */
95
+ readonly selectedPrefix: string;
96
+ /** Character shown before unselected items */
97
+ readonly unselectedPrefix: string;
98
+ /** Selected item foreground color */
99
+ readonly selectedFg: number;
100
+ /** Selected item background color */
101
+ readonly selectedBg: number;
102
+ /** Item foreground color */
103
+ readonly itemFg: number;
104
+ /** Item background color */
105
+ readonly itemBg: number;
106
+ /** Disabled item foreground color */
107
+ readonly disabledFg: number;
108
+ }
109
+ /**
110
+ * List display options for configuration.
111
+ */
112
+ interface ListDisplayOptions {
113
+ selectedPrefix?: string;
114
+ unselectedPrefix?: string;
115
+ selectedFg?: number;
116
+ selectedBg?: number;
117
+ itemFg?: number;
118
+ itemBg?: number;
119
+ disabledFg?: number;
120
+ }
121
+ /**
122
+ * List selection callback function type.
123
+ */
124
+ type ListSelectCallback = (index: number, item: ListItem) => void;
125
+ /**
126
+ * List action returned from key press handling.
127
+ */
128
+ type ListAction = {
129
+ type: 'selectPrev';
130
+ } | {
131
+ type: 'selectNext';
132
+ } | {
133
+ type: 'selectFirst';
134
+ } | {
135
+ type: 'selectLast';
136
+ } | {
137
+ type: 'pageUp';
138
+ } | {
139
+ type: 'pageDown';
140
+ } | {
141
+ type: 'confirm';
142
+ } | {
143
+ type: 'cancel';
144
+ } | {
145
+ type: 'toggleSelect';
146
+ } | {
147
+ type: 'startSearch';
148
+ } | {
149
+ type: 'endSearch';
150
+ } | {
151
+ type: 'searchChar';
152
+ char: string;
153
+ } | {
154
+ type: 'searchBackspace';
155
+ } | {
156
+ type: 'searchNextMatch';
157
+ };
158
+
159
+ /**
160
+ * Scrollable component for scrolling support.
161
+ * @module components/scrollable
162
+ */
163
+ /**
164
+ * Scrollbar visibility mode.
165
+ */
166
+ declare enum ScrollbarVisibility {
167
+ /** Always hidden */
168
+ Hidden = 0,
169
+ /** Always visible */
170
+ Visible = 1,
171
+ /** Visible only when content overflows */
172
+ Auto = 2
173
+ }
174
+ /**
175
+ * Scrollable component store using SoA (Structure of Arrays) for performance.
176
+ *
177
+ * - `scrollX`, `scrollY`: Current scroll offset
178
+ * - `scrollWidth`, `scrollHeight`: Total scrollable content size
179
+ * - `scrollbarVisible`: Scrollbar visibility mode
180
+ * - `trackVisible`: Whether scroll track is visible
181
+ * - `alwaysScroll`: Always show scrollbar even when not needed
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * import { Scrollable, setScroll, getScroll, scrollBy } from 'blecsd';
186
+ *
187
+ * setScroll(world, entity, 0, 100);
188
+ * scrollBy(world, entity, 0, 50);
189
+ *
190
+ * const scroll = getScroll(world, entity);
191
+ * console.log(scroll.y); // 150
192
+ * ```
193
+ */
194
+ declare const Scrollable: {
195
+ /** Horizontal scroll offset */
196
+ scrollX: Float32Array<ArrayBuffer>;
197
+ /** Vertical scroll offset */
198
+ scrollY: Float32Array<ArrayBuffer>;
199
+ /** Total scrollable width */
200
+ scrollWidth: Float32Array<ArrayBuffer>;
201
+ /** Total scrollable height */
202
+ scrollHeight: Float32Array<ArrayBuffer>;
203
+ /** Viewport width (visible area) - used for clamping */
204
+ viewportWidth: Float32Array<ArrayBuffer>;
205
+ /** Viewport height (visible area) - used for clamping */
206
+ viewportHeight: Float32Array<ArrayBuffer>;
207
+ /** Scrollbar visibility mode (0=hidden, 1=visible, 2=auto) */
208
+ scrollbarVisible: Uint8Array<ArrayBuffer>;
209
+ /** Whether scroll track is visible */
210
+ trackVisible: Uint8Array<ArrayBuffer>;
211
+ /** Always show scrollbar (0=no, 1=yes) */
212
+ alwaysScroll: Uint8Array<ArrayBuffer>;
213
+ /** Whether clamping is enabled (0=no, 1=yes) - default yes */
214
+ clampEnabled: Uint8Array<ArrayBuffer>;
215
+ };
216
+ /**
217
+ * Scrollable configuration options.
218
+ */
219
+ interface ScrollableOptions {
220
+ /** Initial horizontal scroll offset */
221
+ scrollX?: number;
222
+ /** Initial vertical scroll offset */
223
+ scrollY?: number;
224
+ /** Total scrollable width */
225
+ scrollWidth?: number;
226
+ /** Total scrollable height */
227
+ scrollHeight?: number;
228
+ /** Viewport width (visible area) */
229
+ viewportWidth?: number;
230
+ /** Viewport height (visible area) */
231
+ viewportHeight?: number;
232
+ /** Scrollbar visibility mode */
233
+ scrollbarVisible?: ScrollbarVisibility;
234
+ /** Whether scroll track is visible */
235
+ trackVisible?: boolean;
236
+ /** Always show scrollbar */
237
+ alwaysScroll?: boolean;
238
+ /** Whether scroll clamping is enabled (default: true) */
239
+ clampEnabled?: boolean;
240
+ }
241
+ /**
242
+ * Scroll position data.
243
+ */
244
+ interface ScrollPosition {
245
+ readonly x: number;
246
+ readonly y: number;
247
+ }
248
+ /**
249
+ * Scroll percentage data.
250
+ */
251
+ interface ScrollPercentage {
252
+ readonly x: number;
253
+ readonly y: number;
254
+ }
255
+ /**
256
+ * Full scrollable data returned by getScrollable.
257
+ */
258
+ interface ScrollableData {
259
+ readonly scrollX: number;
260
+ readonly scrollY: number;
261
+ readonly scrollWidth: number;
262
+ readonly scrollHeight: number;
263
+ readonly viewportWidth: number;
264
+ readonly viewportHeight: number;
265
+ readonly scrollbarVisible: ScrollbarVisibility;
266
+ readonly trackVisible: boolean;
267
+ readonly alwaysScroll: boolean;
268
+ readonly clampEnabled: boolean;
269
+ }
270
+
271
+ /**
272
+ * Table Component
273
+ *
274
+ * Pure data container for table/grid functionality.
275
+ * All business logic is in tableSystem.ts.
276
+ *
277
+ * @module components/table
278
+ */
279
+ /**
280
+ * Table cell alignment.
281
+ */
282
+ type CellAlign = 'left' | 'center' | 'right';
283
+ /**
284
+ * Table cell data.
285
+ */
286
+ interface TableCell {
287
+ /** Cell text value */
288
+ readonly value: string;
289
+ /** Cell foreground color (optional) */
290
+ readonly fg?: number;
291
+ /** Cell background color (optional) */
292
+ readonly bg?: number;
293
+ /** Cell alignment (optional, defaults to left) */
294
+ readonly align?: CellAlign;
295
+ }
296
+ /**
297
+ * Table row data.
298
+ */
299
+ type TableRow = readonly TableCell[];
300
+ /**
301
+ * Table data (array of rows).
302
+ */
303
+ type TableData = readonly TableRow[];
304
+ /**
305
+ * Table column configuration.
306
+ */
307
+ interface TableColumn {
308
+ /** Column header text */
309
+ readonly header: string;
310
+ /** Column width (characters) */
311
+ readonly width?: number | undefined;
312
+ /** Column minimum width */
313
+ readonly minWidth?: number | undefined;
314
+ /** Column maximum width */
315
+ readonly maxWidth?: number | undefined;
316
+ /** Column alignment */
317
+ readonly align?: CellAlign | undefined;
318
+ }
319
+ /**
320
+ * Table store for managing table-specific data.
321
+ */
322
+ interface TableStore {
323
+ /** Whether entity is a table */
324
+ isTable: Uint8Array;
325
+ /** Number of rows in table */
326
+ rowCount: Uint32Array;
327
+ /** Number of columns in table */
328
+ colCount: Uint16Array;
329
+ /** Number of header rows */
330
+ headerRows: Uint8Array;
331
+ /** Cell padding */
332
+ pad: Uint8Array;
333
+ /** Whether to show cell borders */
334
+ cellBorders: Uint8Array;
335
+ }
336
+ /**
337
+ * Table display configuration.
338
+ */
339
+ interface TableDisplay {
340
+ /** Header foreground color */
341
+ readonly headerFg: number;
342
+ /** Header background color */
343
+ readonly headerBg: number;
344
+ /** Cell foreground color */
345
+ readonly cellFg: number;
346
+ /** Cell background color */
347
+ readonly cellBg: number;
348
+ /** Alternate row background color (for striping) */
349
+ readonly altRowBg?: number;
350
+ /** Border foreground color */
351
+ readonly borderFg: number;
352
+ /** Border background color */
353
+ readonly borderBg: number;
354
+ /** Selected row foreground color */
355
+ readonly selectedFg?: number;
356
+ /** Selected row background color */
357
+ readonly selectedBg?: number;
358
+ }
359
+ /**
360
+ * Table display options for configuration.
361
+ */
362
+ interface TableDisplayOptions {
363
+ headerFg?: number;
364
+ headerBg?: number;
365
+ cellFg?: number;
366
+ cellBg?: number;
367
+ altRowBg?: number;
368
+ borderFg?: number;
369
+ borderBg?: number;
370
+ selectedFg?: number;
371
+ selectedBg?: number;
372
+ }
373
+ /** Default header foreground color */
374
+ declare const DEFAULT_HEADER_FG = 4294967295;
375
+ /** Default header background color */
376
+ declare const DEFAULT_HEADER_BG = 858993663;
377
+ /** Default cell foreground color */
378
+ declare const DEFAULT_CELL_FG = 3435973887;
379
+ /** Default cell background color */
380
+ declare const DEFAULT_CELL_BG = 255;
381
+ /** Default border foreground color */
382
+ declare const DEFAULT_BORDER_FG = 1717987071;
383
+ /** Default border background color */
384
+ declare const DEFAULT_BORDER_BG = 255;
385
+ /**
386
+ * Table component store using SoA (Structure of Arrays) for performance.
387
+ *
388
+ * Stores table grid metadata.
389
+ *
390
+ * @deprecated Use tableStore instead
391
+ *
392
+ * @example
393
+ * ```typescript
394
+ * import { Table, attachTableBehavior, setData } from 'blecsd';
395
+ *
396
+ * attachTableBehavior(world, eid);
397
+ * setData(world, eid, [
398
+ * ['Name', 'Age'],
399
+ * ['Alice', '30'],
400
+ * ]);
401
+ * ```
402
+ */
403
+ declare const Table: {
404
+ /** Number of data rows (excluding headers) */
405
+ rowCount: Uint32Array<ArrayBuffer>;
406
+ /** Number of columns */
407
+ colCount: Uint16Array<ArrayBuffer>;
408
+ /** Number of header rows */
409
+ headerRows: Uint8Array<ArrayBuffer>;
410
+ /** Cell padding (spaces) */
411
+ pad: Uint8Array<ArrayBuffer>;
412
+ /** Whether to render cell borders (0 = no, 1 = yes) */
413
+ cellBorders: Uint8Array<ArrayBuffer>;
414
+ };
415
+ /**
416
+ * Store for table component data.
417
+ */
418
+ declare const tableStore: TableStore;
419
+
420
+ /**
421
+ * TerminalBuffer Component
422
+ *
423
+ * ECS component for terminal emulator buffers. Stores a 2D grid of cells
424
+ * with per-cell styling, cursor state, and scrollback history.
425
+ *
426
+ * @module components/terminalBuffer
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * import { createWorld, addEntity } from 'blecsd';
431
+ * import {
432
+ * setTerminalBuffer,
433
+ * writeToTerminal,
434
+ * getTerminalState,
435
+ * clearTerminal,
436
+ * } from 'blecsd/components';
437
+ *
438
+ * const world = createWorld();
439
+ * const eid = addEntity(world);
440
+ *
441
+ * // Initialize a terminal buffer
442
+ * setTerminalBuffer(world, eid, { width: 80, height: 24 });
443
+ *
444
+ * // Write ANSI content
445
+ * writeToTerminal(world, eid, '\x1b[31mHello\x1b[0m World');
446
+ *
447
+ * // Get current state
448
+ * const state = getTerminalState(eid);
449
+ * console.log(state?.cursorX, state?.cursorY);
450
+ *
451
+ * // Clear the terminal
452
+ * clearTerminal(world, eid);
453
+ * ```
454
+ */
455
+
456
+ /** Default terminal width in columns */
457
+ declare const DEFAULT_TERMINAL_WIDTH = 80;
458
+ /** Default terminal height in rows */
459
+ declare const DEFAULT_TERMINAL_HEIGHT = 24;
460
+ /** Default scrollback lines */
461
+ declare const DEFAULT_SCROLLBACK_LINES = 1000;
462
+ /**
463
+ * TerminalBuffer component for scalar state.
464
+ * Complex state (cells, scrollback, parser state) is stored in a Map.
465
+ */
466
+ declare const TerminalBuffer: {
467
+ /** Tag indicating this is a terminal buffer (1 = yes) */
468
+ isTerminal: Uint8Array<ArrayBuffer>;
469
+ /** Terminal width in columns */
470
+ width: Uint16Array<ArrayBuffer>;
471
+ /** Terminal height in rows */
472
+ height: Uint16Array<ArrayBuffer>;
473
+ /** Cursor X position (column) */
474
+ cursorX: Uint16Array<ArrayBuffer>;
475
+ /** Cursor Y position (row) */
476
+ cursorY: Uint16Array<ArrayBuffer>;
477
+ /** Cursor visible flag (1 = visible) */
478
+ cursorVisible: Uint8Array<ArrayBuffer>;
479
+ /** Scroll offset from top (for viewing history) */
480
+ scrollOffset: Uint32Array<ArrayBuffer>;
481
+ /** Alternate screen buffer active (1 = yes) */
482
+ altScreenActive: Uint8Array<ArrayBuffer>;
483
+ };
484
+ /**
485
+ * Terminal state stored in a Map for complex data.
486
+ */
487
+ interface TerminalState {
488
+ /** Cell buffer (2D grid in row-major order) */
489
+ readonly buffer: ScreenBufferData;
490
+ /** Scrollback history */
491
+ readonly scrollback: ScrollbackBuffer;
492
+ /** Current text attributes for new characters */
493
+ currentAttr: Attribute;
494
+ /** Partial escape sequence buffer */
495
+ escapeBuffer: string;
496
+ /** Whether we're in the middle of parsing an escape sequence */
497
+ inEscape: boolean;
498
+ /** Saved cursor position X */
499
+ savedCursorX: number;
500
+ /** Saved cursor position Y */
501
+ savedCursorY: number;
502
+ /** Saved attributes */
503
+ savedAttr: Attribute;
504
+ /** Alternate screen buffer (for full-screen apps) */
505
+ altBuffer: ScreenBufferData | null;
506
+ /** Cursor shape: 'block' | 'underline' | 'bar' */
507
+ cursorShape: CursorShape;
508
+ /** Cursor blink enabled */
509
+ cursorBlink: boolean;
510
+ }
511
+ /**
512
+ * Cursor shape types.
513
+ */
514
+ type CursorShape = 'block' | 'underline' | 'bar';
515
+ /**
516
+ * Terminal buffer configuration schema.
517
+ */
518
+ declare const TerminalBufferConfigSchema: z.ZodObject<{
519
+ width: z.ZodDefault<z.ZodNumber>;
520
+ height: z.ZodDefault<z.ZodNumber>;
521
+ scrollbackLines: z.ZodDefault<z.ZodNumber>;
522
+ cursorVisible: z.ZodDefault<z.ZodBoolean>;
523
+ cursorShape: z.ZodDefault<z.ZodEnum<{
524
+ underline: "underline";
525
+ block: "block";
526
+ bar: "bar";
527
+ }>>;
528
+ cursorBlink: z.ZodDefault<z.ZodBoolean>;
529
+ }, z.core.$strip>;
530
+ /**
531
+ * Terminal buffer configuration type.
532
+ */
533
+ type TerminalBufferConfig = z.input<typeof TerminalBufferConfigSchema>;
534
+ /**
535
+ * Sets up a terminal buffer on an entity.
536
+ *
537
+ * @param world - The ECS world
538
+ * @param eid - Entity ID
539
+ * @param config - Terminal buffer configuration
540
+ *
541
+ * @example
542
+ * ```typescript
543
+ * setTerminalBuffer(world, eid, {
544
+ * width: 80,
545
+ * height: 24,
546
+ * scrollbackLines: 1000,
547
+ * });
548
+ * ```
549
+ */
550
+ declare function setTerminalBuffer(world: World, eid: Entity, config?: TerminalBufferConfig): void;
551
+ /**
552
+ * Checks if an entity has a terminal buffer.
553
+ *
554
+ * @param eid - Entity ID
555
+ * @returns true if the entity has a terminal buffer
556
+ */
557
+ declare function hasTerminalBuffer(eid: Entity): boolean;
558
+ /**
559
+ * Gets the terminal state for an entity.
560
+ *
561
+ * @param eid - Entity ID
562
+ * @returns Terminal state or undefined
563
+ */
564
+ declare function getTerminalState(eid: Entity): TerminalState | undefined;
565
+ /**
566
+ * Gets terminal buffer data (scalar values).
567
+ *
568
+ * @param eid - Entity ID
569
+ * @returns Terminal buffer data
570
+ */
571
+ declare function getTerminalBuffer(eid: Entity): {
572
+ width: number;
573
+ height: number;
574
+ cursorX: number;
575
+ cursorY: number;
576
+ cursorVisible: boolean;
577
+ scrollOffset: number;
578
+ } | undefined;
579
+ /**
580
+ * Writes a character to the terminal at the current cursor position.
581
+ *
582
+ * @param world - The ECS world
583
+ * @param eid - Entity ID
584
+ * @param char - Character to write
585
+ */
586
+ declare function writeChar(world: World, eid: Entity, char: string): void;
587
+ /**
588
+ * Writes a string to the terminal (processes escape sequences).
589
+ *
590
+ * @param world - The ECS world
591
+ * @param eid - Entity ID
592
+ * @param data - String to write
593
+ */
594
+ declare function writeToTerminal(world: World, eid: Entity, data: string): void;
595
+ /**
596
+ * Clears the terminal buffer.
597
+ *
598
+ * @param world - The ECS world
599
+ * @param eid - Entity ID
600
+ */
601
+ declare function clearTerminal(world: World, eid: Entity): void;
602
+ /**
603
+ * Resets the terminal to initial state.
604
+ *
605
+ * @param world - The ECS world
606
+ * @param eid - Entity ID
607
+ */
608
+ declare function resetTerminal(world: World, eid: Entity): void;
609
+ /**
610
+ * Sets cursor position.
611
+ *
612
+ * @param world - The ECS world
613
+ * @param eid - Entity ID
614
+ * @param x - Column (0-indexed)
615
+ * @param y - Row (0-indexed)
616
+ */
617
+ declare function setCursorPosition(world: World, eid: Entity, x: number, y: number): void;
618
+ /**
619
+ * Sets cursor visibility.
620
+ *
621
+ * @param world - The ECS world
622
+ * @param eid - Entity ID
623
+ * @param visible - Cursor visibility
624
+ */
625
+ declare function setCursorVisible(world: World, eid: Entity, visible: boolean): void;
626
+ /**
627
+ * Scrolls the terminal view up.
628
+ *
629
+ * @param world - The ECS world
630
+ * @param eid - Entity ID
631
+ * @param lines - Number of lines to scroll
632
+ */
633
+ declare function scrollTerminalUp(world: World, eid: Entity, lines: number): void;
634
+ /**
635
+ * Scrolls the terminal view down.
636
+ *
637
+ * @param world - The ECS world
638
+ * @param eid - Entity ID
639
+ * @param lines - Number of lines to scroll
640
+ */
641
+ declare function scrollTerminalDown(world: World, eid: Entity, lines: number): void;
642
+ /**
643
+ * Scrolls to the top of history.
644
+ *
645
+ * @param world - The ECS world
646
+ * @param eid - Entity ID
647
+ */
648
+ declare function scrollTerminalToTop(world: World, eid: Entity): void;
649
+ /**
650
+ * Scrolls to the bottom (current view).
651
+ *
652
+ * @param world - The ECS world
653
+ * @param eid - Entity ID
654
+ */
655
+ declare function scrollTerminalToBottom(world: World, eid: Entity): void;
656
+ /**
657
+ * Resizes the terminal buffer.
658
+ *
659
+ * @param world - The ECS world
660
+ * @param eid - Entity ID
661
+ * @param width - New width in columns
662
+ * @param height - New height in rows
663
+ */
664
+ declare function resizeTerminalBuffer(world: World, eid: Entity, width: number, height: number): void;
665
+ /**
666
+ * Removes a terminal buffer from an entity.
667
+ *
668
+ * @param eid - Entity ID
669
+ */
670
+ declare function removeTerminalBuffer(eid: Entity): void;
671
+ /**
672
+ * Renders terminal buffer to an ANSI string (for display).
673
+ *
674
+ * @param eid - Entity ID
675
+ * @returns ANSI string representation of the terminal
676
+ */
677
+ declare function renderTerminalToAnsi(eid: Entity): string;
678
+ /**
679
+ * Gets the cells for rendering.
680
+ *
681
+ * @param eid - Entity ID
682
+ * @returns Readonly array of cells
683
+ */
684
+ declare function getTerminalCells(eid: Entity): readonly Cell[] | undefined;
685
+ /**
686
+ * Resets the terminal buffer store (for testing).
687
+ * @internal
688
+ */
689
+ declare function resetTerminalBufferStore(): void;
690
+
691
+ export { scrollTerminalUp as $, type ListScrollCallback as A, Scrollable as B, type CellAlign as C, DEFAULT_CELL_BG as D, Table as E, type TableStore as F, TerminalBuffer as G, type TerminalBufferConfig as H, TerminalBufferConfigSchema as I, type CursorShape as J, type TerminalState as K, type ListSelectCallback as L, clearTerminal as M, getTerminalBuffer as N, getTerminalCells as O, getTerminalState as P, hasTerminalBuffer as Q, removeTerminalBuffer as R, type ScrollableData as S, type TableData as T, renderTerminalToAnsi as U, resetTerminal as V, resetTerminalBufferStore as W, resizeTerminalBuffer as X, scrollTerminalDown as Y, scrollTerminalToBottom as Z, scrollTerminalToTop as _, type ListItem as a, setCursorPosition as a0, setCursorVisible as a1, setTerminalBuffer as a2, tableStore as a3, writeChar as a4, writeToTerminal as a5, type ListState as b, type ListEvent as c, type ListDisplay as d, type ListDisplayOptions as e, type ListAction as f, type ListStore as g, type ListScrollInfo as h, type ScrollableOptions as i, type ScrollPosition as j, type ScrollPercentage as k, ScrollbarVisibility as l, type TableCell as m, type TableRow as n, type TableColumn as o, type TableDisplay as p, type TableDisplayOptions as q, DEFAULT_CELL_FG as r, DEFAULT_HEADER_BG as s, DEFAULT_HEADER_FG as t, DEFAULT_SCROLLBACK_LINES as u, DEFAULT_BORDER_BG as v, DEFAULT_BORDER_FG as w, DEFAULT_TERMINAL_HEIGHT as x, DEFAULT_TERMINAL_WIDTH as y, type ListLazyLoadCallback as z };