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
@@ -1,1856 +0,0 @@
1
- import { W as World, E as Entity } from './types-CPB4CpbH.js';
2
- import { z } from 'zod';
3
- import { A as Attribute } from './parser-iMHmQuUh.js';
4
- import { S as ScreenBufferData, C as Cell } from './cell-DwIu2ryP.js';
5
- import { S as ScrollbackBuffer } from './virtualScrollback-D9uLFe8l.js';
6
-
7
- /**
8
- * Dimensions component for entity sizing in the terminal grid.
9
- * @module components/dimensions
10
- */
11
-
12
- /**
13
- * Special value indicating "auto" (content-based) dimension.
14
- * When used, the dimension is calculated based on content.
15
- */
16
- declare const AUTO_DIMENSION = -1;
17
- /**
18
- * Encodes a percentage value for storage in typed arrays.
19
- * Percentages are stored as negative values: -2 = 0%, -102 = 100%
20
- *
21
- * @param percent - Percentage value (0-100)
22
- * @returns Encoded value for storage
23
- *
24
- * @example
25
- * ```typescript
26
- * const encoded = encodePercentage(50); // Returns -52
27
- * ```
28
- */
29
- declare function encodePercentage(percent: number): number;
30
- /**
31
- * Decodes a percentage value from typed array storage.
32
- *
33
- * @param value - Encoded value from storage
34
- * @returns Percentage value (0-100) or null if not a percentage
35
- *
36
- * @example
37
- * ```typescript
38
- * const percent = decodePercentage(-52); // Returns 50
39
- * const notPercent = decodePercentage(100); // Returns null
40
- * ```
41
- */
42
- declare function decodePercentage(value: number): number | null;
43
- /**
44
- * Checks if a value represents a percentage.
45
- *
46
- * @param value - Value to check
47
- * @returns true if the value is an encoded percentage
48
- */
49
- declare function isPercentage(value: number): boolean;
50
- /**
51
- * Dimensions component store using SoA (Structure of Arrays) for performance.
52
- *
53
- * - `width`, `height`: Size in terminal cells (floats), or encoded percentages
54
- * - `minWidth`, `minHeight`: Minimum size constraints
55
- * - `maxWidth`, `maxHeight`: Maximum size constraints
56
- * - `shrink`: Whether to shrink to content (0=no, 1=yes)
57
- *
58
- * Percentage values are encoded as negative numbers: -2 = 0%, -102 = 100%
59
- * Use `encodePercentage()` and `decodePercentage()` for conversion.
60
- *
61
- * @example
62
- * ```typescript
63
- * import { Dimensions, setDimensions, getDimensions } from 'blecsd';
64
- *
65
- * setDimensions(world, entity, 80, 24);
66
- *
67
- * const dims = getDimensions(world, entity);
68
- * console.log(dims.width, dims.height); // 80, 24
69
- * ```
70
- */
71
- declare const Dimensions: {
72
- /** Width in terminal cells (or encoded percentage) */
73
- width: Float32Array<ArrayBuffer>;
74
- /** Height in terminal cells (or encoded percentage) */
75
- height: Float32Array<ArrayBuffer>;
76
- /** Minimum width constraint */
77
- minWidth: Float32Array<ArrayBuffer>;
78
- /** Minimum height constraint */
79
- minHeight: Float32Array<ArrayBuffer>;
80
- /** Maximum width constraint */
81
- maxWidth: Float32Array<ArrayBuffer>;
82
- /** Maximum height constraint */
83
- maxHeight: Float32Array<ArrayBuffer>;
84
- /** 0 = fixed size, 1 = shrink to content */
85
- shrink: Uint8Array<ArrayBuffer>;
86
- };
87
- /**
88
- * Dimension value that can be a number, percentage string, or 'auto'.
89
- */
90
- type DimensionValue = number | `${number}%` | 'auto';
91
- /**
92
- * Dimensions data returned by getDimensions.
93
- */
94
- interface DimensionsData {
95
- readonly width: number;
96
- readonly height: number;
97
- readonly minWidth: number;
98
- readonly minHeight: number;
99
- readonly maxWidth: number;
100
- readonly maxHeight: number;
101
- readonly shrink: boolean;
102
- }
103
- /**
104
- * Constraints data for min/max dimensions.
105
- */
106
- interface DimensionConstraints {
107
- readonly minWidth?: number;
108
- readonly minHeight?: number;
109
- readonly maxWidth?: number;
110
- readonly maxHeight?: number;
111
- }
112
- /**
113
- * Sets the dimensions of an entity.
114
- * Adds the Dimensions component if not already present.
115
- *
116
- * @param world - The ECS world
117
- * @param eid - The entity ID
118
- * @param width - Width value (number, percentage string like "50%", or "auto")
119
- * @param height - Height value (number, percentage string like "50%", or "auto")
120
- * @returns The entity ID for chaining
121
- *
122
- * @example
123
- * ```typescript
124
- * import { createWorld, addEntity } from '../core/ecs';
125
- * import { setDimensions } from 'blecsd';
126
- *
127
- * const world = createWorld();
128
- * const entity = addEntity(world);
129
- *
130
- * // Fixed size
131
- * setDimensions(world, entity, 80, 24);
132
- *
133
- * // Percentage width
134
- * setDimensions(world, entity, '50%', 24);
135
- *
136
- * // Auto height
137
- * setDimensions(world, entity, 80, 'auto');
138
- * ```
139
- */
140
- declare function setDimensions(world: World, eid: Entity, width: DimensionValue, height: DimensionValue): Entity;
141
- /**
142
- * Gets the dimensions data of an entity.
143
- * Returns undefined if the entity doesn't have a Dimensions component.
144
- *
145
- * @param world - The ECS world
146
- * @param eid - The entity ID
147
- * @returns Dimensions data or undefined
148
- *
149
- * @example
150
- * ```typescript
151
- * import { getDimensions } from 'blecsd';
152
- *
153
- * const dims = getDimensions(world, entity);
154
- * if (dims) {
155
- * console.log(`Size: ${dims.width}x${dims.height}`);
156
- * }
157
- * ```
158
- */
159
- declare function getDimensions(world: World, eid: Entity): DimensionsData | undefined;
160
- /**
161
- * Sets dimension constraints (min/max) for an entity.
162
- *
163
- * @param world - The ECS world
164
- * @param eid - The entity ID
165
- * @param constraints - Constraint values to set
166
- * @returns The entity ID for chaining
167
- *
168
- * @example
169
- * ```typescript
170
- * import { setConstraints } from 'blecsd';
171
- *
172
- * setConstraints(world, entity, {
173
- * minWidth: 10,
174
- * maxWidth: 100,
175
- * minHeight: 5,
176
- * });
177
- * ```
178
- */
179
- declare function setConstraints(world: World, eid: Entity, constraints: DimensionConstraints): Entity;
180
- /**
181
- * Sets the shrink-to-content flag for an entity.
182
- *
183
- * @param world - The ECS world
184
- * @param eid - The entity ID
185
- * @param shrink - true to shrink to content, false for fixed size
186
- * @returns The entity ID for chaining
187
- *
188
- * @example
189
- * ```typescript
190
- * import { setShrink } from 'blecsd';
191
- *
192
- * // Enable shrink-to-content
193
- * setShrink(world, entity, true);
194
- * ```
195
- */
196
- declare function setShrink(world: World, eid: Entity, shrink: boolean): Entity;
197
- /**
198
- * Checks if an entity should shrink to content.
199
- *
200
- * @param world - The ECS world
201
- * @param eid - The entity ID
202
- * @returns true if shrink is enabled, false otherwise
203
- */
204
- declare function shouldShrink(world: World, eid: Entity): boolean;
205
- /**
206
- * Checks if an entity has a Dimensions component.
207
- *
208
- * @param world - The ECS world
209
- * @param eid - The entity ID
210
- * @returns true if entity has Dimensions component
211
- */
212
- declare function hasDimensions(world: World, eid: Entity): boolean;
213
- /**
214
- * Gets the width of an entity, resolving percentages against a container width.
215
- *
216
- * @param world - The ECS world
217
- * @param eid - The entity ID
218
- * @param containerWidth - Container width to resolve percentages against
219
- * @returns Resolved width value, or undefined if no Dimensions component
220
- *
221
- * @example
222
- * ```typescript
223
- * import { getResolvedWidth, setDimensions } from 'blecsd';
224
- *
225
- * setDimensions(world, entity, '50%', 24);
226
- * const width = getResolvedWidth(world, entity, 100); // Returns 50
227
- * ```
228
- */
229
- declare function getResolvedWidth(world: World, eid: Entity, containerWidth: number): number | undefined;
230
- /**
231
- * Gets the height of an entity, resolving percentages against a container height.
232
- *
233
- * @param world - The ECS world
234
- * @param eid - The entity ID
235
- * @param containerHeight - Container height to resolve percentages against
236
- * @returns Resolved height value, or undefined if no Dimensions component
237
- *
238
- * @example
239
- * ```typescript
240
- * import { getResolvedHeight, setDimensions } from 'blecsd';
241
- *
242
- * setDimensions(world, entity, 80, '25%');
243
- * const height = getResolvedHeight(world, entity, 80); // Returns 20
244
- * ```
245
- */
246
- declare function getResolvedHeight(world: World, eid: Entity, containerHeight: number): number | undefined;
247
-
248
- /**
249
- * List Component Types
250
- *
251
- * @module components/list/types
252
- */
253
- /**
254
- * List state type.
255
- */
256
- type ListState = 'idle' | 'focused' | 'selecting' | 'searching' | 'disabled';
257
- /**
258
- * List event type.
259
- */
260
- type ListEvent = 'focus' | 'blur' | 'startSelect' | 'endSelect' | 'startSearch' | 'endSearch' | 'disable' | 'enable';
261
- /**
262
- * List item data.
263
- */
264
- interface ListItem {
265
- /** Display text */
266
- readonly text: string;
267
- /** Optional value associated with the item */
268
- readonly value?: string;
269
- /** Whether the item is disabled */
270
- readonly disabled?: boolean;
271
- }
272
- /**
273
- * List store for managing list-specific data.
274
- */
275
- interface ListStore {
276
- /** Whether entity is a list */
277
- isList: Uint8Array;
278
- /** Currently selected index (-1 if none) */
279
- selectedIndex: Int32Array;
280
- /** Number of items in the list */
281
- itemCount: Uint32Array;
282
- /** First visible item index (for virtualization) */
283
- firstVisible: Uint32Array;
284
- /** Number of visible items */
285
- visibleCount: Uint32Array;
286
- /** Whether list is interactive */
287
- interactive: Uint8Array;
288
- /** Whether list responds to mouse */
289
- mouse: Uint8Array;
290
- /** Whether list responds to keyboard */
291
- keys: Uint8Array;
292
- /** Whether search mode is enabled */
293
- searchEnabled: Uint8Array;
294
- /** Total item count for virtualized lists (may be > itemCount) */
295
- totalCount: Uint32Array;
296
- /** Whether items are currently loading */
297
- isLoading: Uint8Array;
298
- }
299
- /**
300
- * Lazy load callback for virtualized lists.
301
- * Called when items need to be loaded for a range.
302
- *
303
- * @param startIndex - First item index to load
304
- * @param count - Number of items to load
305
- * @returns Promise that resolves when items are loaded
306
- */
307
- type ListLazyLoadCallback = (startIndex: number, count: number) => Promise<ListItem[]>;
308
- /**
309
- * Scroll event callback for infinite scroll detection.
310
- *
311
- * @param scrollInfo - Information about current scroll state
312
- */
313
- type ListScrollCallback = (scrollInfo: ListScrollInfo) => void;
314
- /**
315
- * Scroll information for infinite scroll.
316
- */
317
- interface ListScrollInfo {
318
- /** First visible item index */
319
- readonly firstVisible: number;
320
- /** Number of visible items */
321
- readonly visibleCount: number;
322
- /** Total loaded items */
323
- readonly loadedCount: number;
324
- /** Total items (may be larger than loaded for infinite scroll) */
325
- readonly totalCount: number;
326
- /** Whether we're near the end (within threshold) */
327
- readonly nearEnd: boolean;
328
- /** Whether we're near the start (within threshold) */
329
- readonly nearStart: boolean;
330
- }
331
- /**
332
- * List display configuration.
333
- */
334
- interface ListDisplay {
335
- /** Character shown before selected item */
336
- readonly selectedPrefix: string;
337
- /** Character shown before unselected items */
338
- readonly unselectedPrefix: string;
339
- /** Selected item foreground color */
340
- readonly selectedFg: number;
341
- /** Selected item background color */
342
- readonly selectedBg: number;
343
- /** Item foreground color */
344
- readonly itemFg: number;
345
- /** Item background color */
346
- readonly itemBg: number;
347
- /** Disabled item foreground color */
348
- readonly disabledFg: number;
349
- }
350
- /**
351
- * List display options for configuration.
352
- */
353
- interface ListDisplayOptions {
354
- selectedPrefix?: string;
355
- unselectedPrefix?: string;
356
- selectedFg?: number;
357
- selectedBg?: number;
358
- itemFg?: number;
359
- itemBg?: number;
360
- disabledFg?: number;
361
- }
362
- /**
363
- * List selection callback function type.
364
- */
365
- type ListSelectCallback = (index: number, item: ListItem) => void;
366
- /**
367
- * List action returned from key press handling.
368
- */
369
- type ListAction = {
370
- type: 'selectPrev';
371
- } | {
372
- type: 'selectNext';
373
- } | {
374
- type: 'selectFirst';
375
- } | {
376
- type: 'selectLast';
377
- } | {
378
- type: 'pageUp';
379
- } | {
380
- type: 'pageDown';
381
- } | {
382
- type: 'confirm';
383
- } | {
384
- type: 'cancel';
385
- } | {
386
- type: 'toggleSelect';
387
- } | {
388
- type: 'startSearch';
389
- } | {
390
- type: 'endSearch';
391
- } | {
392
- type: 'searchChar';
393
- char: string;
394
- } | {
395
- type: 'searchBackspace';
396
- } | {
397
- type: 'searchNextMatch';
398
- };
399
-
400
- /**
401
- * Scrollable component for scrolling support.
402
- * @module components/scrollable
403
- */
404
-
405
- /**
406
- * Scrollbar visibility mode.
407
- */
408
- declare enum ScrollbarVisibility {
409
- /** Always hidden */
410
- Hidden = 0,
411
- /** Always visible */
412
- Visible = 1,
413
- /** Visible only when content overflows */
414
- Auto = 2
415
- }
416
- /**
417
- * Scrollable component store using SoA (Structure of Arrays) for performance.
418
- *
419
- * - `scrollX`, `scrollY`: Current scroll offset
420
- * - `scrollWidth`, `scrollHeight`: Total scrollable content size
421
- * - `scrollbarVisible`: Scrollbar visibility mode
422
- * - `trackVisible`: Whether scroll track is visible
423
- * - `alwaysScroll`: Always show scrollbar even when not needed
424
- *
425
- * @example
426
- * ```typescript
427
- * import { Scrollable, setScroll, getScroll, scrollBy } from 'blecsd';
428
- *
429
- * setScroll(world, entity, 0, 100);
430
- * scrollBy(world, entity, 0, 50);
431
- *
432
- * const scroll = getScroll(world, entity);
433
- * console.log(scroll.y); // 150
434
- * ```
435
- */
436
- declare const Scrollable: {
437
- /** Horizontal scroll offset */
438
- scrollX: Float32Array<ArrayBuffer>;
439
- /** Vertical scroll offset */
440
- scrollY: Float32Array<ArrayBuffer>;
441
- /** Total scrollable width */
442
- scrollWidth: Float32Array<ArrayBuffer>;
443
- /** Total scrollable height */
444
- scrollHeight: Float32Array<ArrayBuffer>;
445
- /** Viewport width (visible area) - used for clamping */
446
- viewportWidth: Float32Array<ArrayBuffer>;
447
- /** Viewport height (visible area) - used for clamping */
448
- viewportHeight: Float32Array<ArrayBuffer>;
449
- /** Scrollbar visibility mode (0=hidden, 1=visible, 2=auto) */
450
- scrollbarVisible: Uint8Array<ArrayBuffer>;
451
- /** Whether scroll track is visible */
452
- trackVisible: Uint8Array<ArrayBuffer>;
453
- /** Always show scrollbar (0=no, 1=yes) */
454
- alwaysScroll: Uint8Array<ArrayBuffer>;
455
- /** Whether clamping is enabled (0=no, 1=yes) - default yes */
456
- clampEnabled: Uint8Array<ArrayBuffer>;
457
- };
458
- /**
459
- * Scrollable configuration options.
460
- */
461
- interface ScrollableOptions {
462
- /** Initial horizontal scroll offset */
463
- scrollX?: number;
464
- /** Initial vertical scroll offset */
465
- scrollY?: number;
466
- /** Total scrollable width */
467
- scrollWidth?: number;
468
- /** Total scrollable height */
469
- scrollHeight?: number;
470
- /** Viewport width (visible area) */
471
- viewportWidth?: number;
472
- /** Viewport height (visible area) */
473
- viewportHeight?: number;
474
- /** Scrollbar visibility mode */
475
- scrollbarVisible?: ScrollbarVisibility;
476
- /** Whether scroll track is visible */
477
- trackVisible?: boolean;
478
- /** Always show scrollbar */
479
- alwaysScroll?: boolean;
480
- /** Whether scroll clamping is enabled (default: true) */
481
- clampEnabled?: boolean;
482
- }
483
- /**
484
- * Scroll position data.
485
- */
486
- interface ScrollPosition {
487
- readonly x: number;
488
- readonly y: number;
489
- }
490
- /**
491
- * Scroll percentage data.
492
- */
493
- interface ScrollPercentage {
494
- readonly x: number;
495
- readonly y: number;
496
- }
497
- /**
498
- * Full scrollable data returned by getScrollable.
499
- */
500
- interface ScrollableData {
501
- readonly scrollX: number;
502
- readonly scrollY: number;
503
- readonly scrollWidth: number;
504
- readonly scrollHeight: number;
505
- readonly viewportWidth: number;
506
- readonly viewportHeight: number;
507
- readonly scrollbarVisible: ScrollbarVisibility;
508
- readonly trackVisible: boolean;
509
- readonly alwaysScroll: boolean;
510
- readonly clampEnabled: boolean;
511
- }
512
- /**
513
- * Makes an entity scrollable with the given options.
514
- * Adds the Scrollable component if not already present.
515
- *
516
- * @param world - The ECS world
517
- * @param eid - The entity ID
518
- * @param options - Scrollable configuration options
519
- * @returns The entity ID for chaining
520
- *
521
- * @example
522
- * ```typescript
523
- * import { createWorld, addEntity } from '../core/ecs';
524
- * import { setScrollable, ScrollbarVisibility } from 'blecsd';
525
- *
526
- * const world = createWorld();
527
- * const entity = addEntity(world);
528
- *
529
- * setScrollable(world, entity, {
530
- * scrollHeight: 1000,
531
- * scrollbarVisible: ScrollbarVisibility.Auto,
532
- * });
533
- * ```
534
- */
535
- declare function setScrollable(world: World, eid: Entity, options: ScrollableOptions): Entity;
536
- /**
537
- * Sets the scroll position of an entity.
538
- * Adds the Scrollable component if not already present.
539
- *
540
- * @param world - The ECS world
541
- * @param eid - The entity ID
542
- * @param x - Horizontal scroll offset
543
- * @param y - Vertical scroll offset
544
- * @returns The entity ID for chaining
545
- *
546
- * @example
547
- * ```typescript
548
- * import { setScroll } from 'blecsd';
549
- *
550
- * setScroll(world, entity, 0, 100);
551
- * ```
552
- */
553
- declare function setScroll(world: World, eid: Entity, x: number, y: number): Entity;
554
- /**
555
- * Gets the scroll position of an entity.
556
- * Returns { x: 0, y: 0 } if no Scrollable component.
557
- *
558
- * @param world - The ECS world
559
- * @param eid - The entity ID
560
- * @returns Scroll position
561
- *
562
- * @example
563
- * ```typescript
564
- * import { getScroll } from 'blecsd';
565
- *
566
- * const scroll = getScroll(world, entity);
567
- * console.log(`Scroll: ${scroll.x}, ${scroll.y}`);
568
- * ```
569
- */
570
- declare function getScroll(world: World, eid: Entity): ScrollPosition;
571
- /**
572
- * Scrolls an entity by the given delta values.
573
- * Adds the Scrollable component if not already present.
574
- *
575
- * @param world - The ECS world
576
- * @param eid - The entity ID
577
- * @param dx - Horizontal scroll delta
578
- * @param dy - Vertical scroll delta
579
- * @returns The entity ID for chaining
580
- *
581
- * @example
582
- * ```typescript
583
- * import { scrollBy } from 'blecsd';
584
- *
585
- * // Scroll down by 50 pixels
586
- * scrollBy(world, entity, 0, 50);
587
- *
588
- * // Scroll right by 100 pixels
589
- * scrollBy(world, entity, 100, 0);
590
- * ```
591
- */
592
- declare function scrollBy(world: World, eid: Entity, dx: number, dy: number): Entity;
593
- /**
594
- * Scrolls an entity to the given position.
595
- * Alias for setScroll for semantic clarity.
596
- *
597
- * @param world - The ECS world
598
- * @param eid - The entity ID
599
- * @param x - Target horizontal scroll offset
600
- * @param y - Target vertical scroll offset
601
- * @returns The entity ID for chaining
602
- *
603
- * @example
604
- * ```typescript
605
- * import { scrollTo } from 'blecsd';
606
- *
607
- * scrollTo(world, entity, 0, 0); // Scroll to top
608
- * ```
609
- */
610
- declare function scrollTo(world: World, eid: Entity, x: number, y: number): Entity;
611
- /**
612
- * Gets the scroll percentage of an entity.
613
- * Takes viewport size into account: percentage is based on scrollable range
614
- * (scrollSize - viewportSize), not total content size.
615
- * Returns { x: 0, y: 0 } if no scrollable area or content fits in viewport.
616
- *
617
- * @param world - The ECS world
618
- * @param eid - The entity ID
619
- * @returns Scroll percentage (0-100 for each axis)
620
- *
621
- * @example
622
- * ```typescript
623
- * import { getScrollPercentage } from 'blecsd';
624
- *
625
- * const percent = getScrollPercentage(world, entity);
626
- * console.log(`Scrolled: ${percent.y}%`);
627
- * ```
628
- */
629
- declare function getScrollPercentage(world: World, eid: Entity): ScrollPercentage;
630
- /**
631
- * Gets the full scrollable data of an entity.
632
- * Returns undefined if no Scrollable component.
633
- *
634
- * @param world - The ECS world
635
- * @param eid - The entity ID
636
- * @returns Scrollable data or undefined
637
- */
638
- declare function getScrollable(world: World, eid: Entity): ScrollableData | undefined;
639
- /**
640
- * Checks if an entity has a Scrollable component.
641
- *
642
- * @param world - The ECS world
643
- * @param eid - The entity ID
644
- * @returns true if entity has Scrollable component
645
- */
646
- declare function hasScrollable(world: World, eid: Entity): boolean;
647
- /**
648
- * Sets the scrollable content size.
649
- *
650
- * @param world - The ECS world
651
- * @param eid - The entity ID
652
- * @param width - Total scrollable width
653
- * @param height - Total scrollable height
654
- * @returns The entity ID for chaining
655
- */
656
- declare function setScrollSize(world: World, eid: Entity, width: number, height: number): Entity;
657
- /**
658
- * Sets the scrollbar visibility mode.
659
- *
660
- * @param world - The ECS world
661
- * @param eid - The entity ID
662
- * @param visibility - Scrollbar visibility mode
663
- * @returns The entity ID for chaining
664
- */
665
- declare function setScrollbarVisibility(world: World, eid: Entity, visibility: ScrollbarVisibility): Entity;
666
- /**
667
- * Scrolls an entity to the top.
668
- *
669
- * @param world - The ECS world
670
- * @param eid - The entity ID
671
- * @returns The entity ID for chaining
672
- */
673
- declare function scrollToTop$1(world: World, eid: Entity): Entity;
674
- /**
675
- * Scrolls an entity to the bottom.
676
- * Takes viewport height into account: scrollY = scrollHeight - viewportHeight.
677
- *
678
- * @param world - The ECS world
679
- * @param eid - The entity ID
680
- * @returns The entity ID for chaining
681
- */
682
- declare function scrollToBottom$1(world: World, eid: Entity): Entity;
683
- /**
684
- * Checks if an entity can scroll (has content larger than visible area).
685
- * If viewport is set, checks if content exceeds viewport size.
686
- *
687
- * @param world - The ECS world
688
- * @param eid - The entity ID
689
- * @returns true if entity has scrollable content
690
- */
691
- declare function canScroll(world: World, eid: Entity): boolean;
692
- /**
693
- * Checks if an entity is scrolled to the top.
694
- *
695
- * @param world - The ECS world
696
- * @param eid - The entity ID
697
- * @returns true if scrolled to top
698
- */
699
- declare function isAtTop(world: World, eid: Entity): boolean;
700
- /**
701
- * Checks if an entity is scrolled to the bottom.
702
- * Takes viewport height into account: true when scrollY >= scrollHeight - viewportHeight.
703
- *
704
- * @param world - The ECS world
705
- * @param eid - The entity ID
706
- * @returns true if scrolled to bottom
707
- */
708
- declare function isAtBottom(world: World, eid: Entity): boolean;
709
-
710
- /**
711
- * Table Component
712
- *
713
- * Provides table/grid data management functionality with cell-based data storage.
714
- *
715
- * @module components/table
716
- */
717
-
718
- /**
719
- * Table cell alignment.
720
- */
721
- type CellAlign = 'left' | 'center' | 'right';
722
- /**
723
- * Table cell data.
724
- */
725
- interface TableCell {
726
- /** Cell text value */
727
- readonly value: string;
728
- /** Cell foreground color (optional) */
729
- readonly fg?: number;
730
- /** Cell background color (optional) */
731
- readonly bg?: number;
732
- /** Cell alignment (optional, defaults to left) */
733
- readonly align?: CellAlign;
734
- }
735
- /**
736
- * Table row data.
737
- */
738
- type TableRow = readonly TableCell[];
739
- /**
740
- * Table data (array of rows).
741
- */
742
- type TableData = readonly TableRow[];
743
- /**
744
- * Table column configuration.
745
- */
746
- interface TableColumn {
747
- /** Column header text */
748
- readonly header: string;
749
- /** Column width (characters) */
750
- readonly width?: number | undefined;
751
- /** Column minimum width */
752
- readonly minWidth?: number | undefined;
753
- /** Column maximum width */
754
- readonly maxWidth?: number | undefined;
755
- /** Column alignment */
756
- readonly align?: CellAlign | undefined;
757
- }
758
- /**
759
- * Table store for managing table-specific data.
760
- */
761
- interface TableStore {
762
- /** Whether entity is a table */
763
- isTable: Uint8Array;
764
- /** Number of rows in table */
765
- rowCount: Uint32Array;
766
- /** Number of columns in table */
767
- colCount: Uint16Array;
768
- /** Number of header rows */
769
- headerRows: Uint8Array;
770
- /** Cell padding */
771
- pad: Uint8Array;
772
- /** Whether to show cell borders */
773
- cellBorders: Uint8Array;
774
- }
775
- /**
776
- * Table display configuration.
777
- */
778
- interface TableDisplay {
779
- /** Header foreground color */
780
- readonly headerFg: number;
781
- /** Header background color */
782
- readonly headerBg: number;
783
- /** Cell foreground color */
784
- readonly cellFg: number;
785
- /** Cell background color */
786
- readonly cellBg: number;
787
- /** Alternate row background color (for striping) */
788
- readonly altRowBg?: number;
789
- /** Border foreground color */
790
- readonly borderFg: number;
791
- /** Border background color */
792
- readonly borderBg: number;
793
- /** Selected row foreground color */
794
- readonly selectedFg?: number;
795
- /** Selected row background color */
796
- readonly selectedBg?: number;
797
- }
798
- /**
799
- * Table display options for configuration.
800
- */
801
- interface TableDisplayOptions {
802
- headerFg?: number;
803
- headerBg?: number;
804
- cellFg?: number;
805
- cellBg?: number;
806
- altRowBg?: number;
807
- borderFg?: number;
808
- borderBg?: number;
809
- selectedFg?: number;
810
- selectedBg?: number;
811
- }
812
- /** Default header foreground color */
813
- declare const DEFAULT_HEADER_FG = 4294967295;
814
- /** Default header background color */
815
- declare const DEFAULT_HEADER_BG = 858993663;
816
- /** Default cell foreground color */
817
- declare const DEFAULT_CELL_FG = 3435973887;
818
- /** Default cell background color */
819
- declare const DEFAULT_CELL_BG = 255;
820
- /** Default border foreground color */
821
- declare const DEFAULT_BORDER_FG = 1717987071;
822
- /** Default border background color */
823
- declare const DEFAULT_BORDER_BG = 255;
824
- /**
825
- * Table component store using SoA (Structure of Arrays) for performance.
826
- *
827
- * Stores table grid metadata.
828
- *
829
- * @example
830
- * ```typescript
831
- * import { Table, attachTableBehavior, setData } from 'blecsd';
832
- *
833
- * attachTableBehavior(world, eid);
834
- * setData(world, eid, [
835
- * ['Name', 'Age'],
836
- * ['Alice', '30'],
837
- * ]);
838
- * ```
839
- */
840
- declare const Table: {
841
- /** Number of data rows (excluding headers) */
842
- rowCount: Uint32Array<ArrayBuffer>;
843
- /** Number of columns */
844
- colCount: Uint16Array<ArrayBuffer>;
845
- /** Number of header rows */
846
- headerRows: Uint8Array<ArrayBuffer>;
847
- /** Cell padding (spaces) */
848
- pad: Uint8Array<ArrayBuffer>;
849
- /** Whether to render cell borders (0 = no, 1 = yes) */
850
- cellBorders: Uint8Array<ArrayBuffer>;
851
- };
852
- /**
853
- * Store for table component data.
854
- */
855
- declare const tableStore: TableStore;
856
- /**
857
- * Attaches table behavior to an entity.
858
- *
859
- * @param world - The ECS world
860
- * @param eid - The entity ID
861
- * @param options - Table options
862
- *
863
- * @example
864
- * ```typescript
865
- * import { attachTableBehavior } from 'blecsd';
866
- *
867
- * attachTableBehavior(world, eid, {
868
- * headerRows: 1,
869
- * pad: 1,
870
- * cellBorders: true,
871
- * });
872
- * ```
873
- */
874
- declare function attachTableBehavior(_world: World, eid: Entity, options?: {
875
- headerRows?: number;
876
- pad?: number;
877
- cellBorders?: boolean;
878
- }): void;
879
- /**
880
- * Checks if an entity is a table.
881
- *
882
- * @param _world - The ECS world (unused, kept for API consistency)
883
- * @param eid - The entity ID
884
- * @returns true if entity is a table
885
- */
886
- declare function isTable(_world: World, eid: Entity): boolean;
887
- /**
888
- * Detaches table behavior from an entity.
889
- *
890
- * @param _world - The ECS world
891
- * @param eid - The entity ID
892
- */
893
- declare function detachTableBehavior(_world: World, eid: Entity): void;
894
- /**
895
- * Sets the table data.
896
- *
897
- * @param world - The ECS world
898
- * @param eid - The entity ID
899
- * @param rows - Array of row arrays (string[][] or TableCell[][])
900
- *
901
- * @example
902
- * ```typescript
903
- * // With string arrays
904
- * setData(world, eid, [
905
- * ['Name', 'Age', 'City'],
906
- * ['Alice', '30', 'NYC'],
907
- * ['Bob', '25', 'LA'],
908
- * ]);
909
- *
910
- * // With TableCell objects
911
- * setData(world, eid, [
912
- * [{ value: 'Name', fg: 0xffffffff }, { value: 'Age' }, { value: 'City' }],
913
- * [{ value: 'Alice' }, { value: '30' }, { value: 'NYC' }],
914
- * ]);
915
- * ```
916
- */
917
- declare function setData(world: World, eid: Entity, rows: ReadonlyArray<ReadonlyArray<string | TableCell>>): void;
918
- /**
919
- * Gets the table data.
920
- *
921
- * @param world - The ECS world (unused, kept for API consistency)
922
- * @param eid - The entity ID
923
- * @returns Table data as array of rows
924
- */
925
- declare function getData(_world: World, eid: Entity): TableData;
926
- /**
927
- * Gets the table data as a string array.
928
- *
929
- * @param world - The ECS world (unused, kept for API consistency)
930
- * @param eid - The entity ID
931
- * @returns Table data as string[][]
932
- */
933
- declare function getDataAsStrings(_world: World, eid: Entity): string[][];
934
- /**
935
- * Sets a single cell value.
936
- *
937
- * @param world - The ECS world
938
- * @param eid - The entity ID
939
- * @param row - Row index (0-based)
940
- * @param col - Column index (0-based)
941
- * @param value - Cell value (string or TableCell)
942
- * @returns true if cell was set successfully
943
- *
944
- * @example
945
- * ```typescript
946
- * setCell(world, eid, 1, 2, 'Updated value');
947
- * setCell(world, eid, 1, 2, { value: 'Styled', fg: 0xff0000ff });
948
- * ```
949
- */
950
- declare function setCell(world: World, eid: Entity, row: number, col: number, value: string | TableCell): boolean;
951
- /**
952
- * Gets a single cell value.
953
- *
954
- * @param world - The ECS world (unused, kept for API consistency)
955
- * @param eid - The entity ID
956
- * @param row - Row index (0-based)
957
- * @param col - Column index (0-based)
958
- * @returns Cell data or undefined if out of bounds
959
- */
960
- declare function getCell(_world: World, eid: Entity, row: number, col: number): TableCell | undefined;
961
- /**
962
- * Gets a cell's string value.
963
- *
964
- * @param world - The ECS world (unused, kept for API consistency)
965
- * @param eid - The entity ID
966
- * @param row - Row index (0-based)
967
- * @param col - Column index (0-based)
968
- * @returns Cell value string or undefined if out of bounds
969
- */
970
- declare function getCellValue(world: World, eid: Entity, row: number, col: number): string | undefined;
971
- /**
972
- * Gets a specific row.
973
- *
974
- * @param world - The ECS world (unused, kept for API consistency)
975
- * @param eid - The entity ID
976
- * @param row - Row index (0-based)
977
- * @returns Row data or undefined if out of bounds
978
- */
979
- declare function getRow(_world: World, eid: Entity, row: number): TableRow | undefined;
980
- /**
981
- * Gets a specific column.
982
- *
983
- * @param world - The ECS world (unused, kept for API consistency)
984
- * @param eid - The entity ID
985
- * @param col - Column index (0-based)
986
- * @returns Column data as array of cells
987
- */
988
- declare function getColumn(_world: World, eid: Entity, col: number): readonly TableCell[];
989
- /**
990
- * Gets the number of rows.
991
- *
992
- * @param world - The ECS world (unused, kept for API consistency)
993
- * @param eid - The entity ID
994
- * @returns Number of rows
995
- */
996
- declare function getRowCount(_world: World, eid: Entity): number;
997
- /**
998
- * Gets the number of columns.
999
- *
1000
- * @param world - The ECS world (unused, kept for API consistency)
1001
- * @param eid - The entity ID
1002
- * @returns Number of columns
1003
- */
1004
- declare function getColCount(_world: World, eid: Entity): number;
1005
- /**
1006
- * Appends a row to the table.
1007
- *
1008
- * @param world - The ECS world
1009
- * @param eid - The entity ID
1010
- * @param row - Row data
1011
- */
1012
- declare function appendRow(world: World, eid: Entity, row: ReadonlyArray<string | TableCell>): void;
1013
- /**
1014
- * Inserts a row at a specific index.
1015
- *
1016
- * @param world - The ECS world
1017
- * @param eid - The entity ID
1018
- * @param index - Row index to insert at
1019
- * @param row - Row data
1020
- */
1021
- declare function insertRow(world: World, eid: Entity, index: number, row: ReadonlyArray<string | TableCell>): void;
1022
- /**
1023
- * Removes a row from the table.
1024
- *
1025
- * @param world - The ECS world
1026
- * @param eid - The entity ID
1027
- * @param index - Row index to remove
1028
- * @returns The removed row or undefined
1029
- */
1030
- declare function removeRow(world: World, eid: Entity, index: number): TableRow | undefined;
1031
- /**
1032
- * Clears all table data.
1033
- *
1034
- * @param world - The ECS world
1035
- * @param eid - The entity ID
1036
- */
1037
- declare function clearData(world: World, eid: Entity): void;
1038
- /**
1039
- * Sets table headers using column configuration.
1040
- *
1041
- * @param world - The ECS world
1042
- * @param eid - The entity ID
1043
- * @param columns - Column configuration
1044
- *
1045
- * @example
1046
- * ```typescript
1047
- * setHeaders(world, eid, [
1048
- * { header: 'Name', width: 20, align: 'left' },
1049
- * { header: 'Age', width: 5, align: 'right' },
1050
- * { header: 'City', width: 15, align: 'left' },
1051
- * ]);
1052
- * ```
1053
- */
1054
- declare function setHeaders(world: World, eid: Entity, columns: readonly TableColumn[]): void;
1055
- /**
1056
- * Gets the column configuration.
1057
- *
1058
- * @param world - The ECS world (unused, kept for API consistency)
1059
- * @param eid - The entity ID
1060
- * @returns Column configuration
1061
- */
1062
- declare function getColumns(_world: World, eid: Entity): readonly TableColumn[];
1063
- /**
1064
- * Gets the header row(s).
1065
- *
1066
- * @param world - The ECS world (unused, kept for API consistency)
1067
- * @param eid - The entity ID
1068
- * @returns Header row data
1069
- */
1070
- declare function getHeaderRows(_world: World, eid: Entity): readonly TableRow[];
1071
- /**
1072
- * Gets the data rows (excluding headers).
1073
- *
1074
- * @param world - The ECS world (unused, kept for API consistency)
1075
- * @param eid - The entity ID
1076
- * @returns Data rows
1077
- */
1078
- declare function getDataRows(_world: World, eid: Entity): readonly TableRow[];
1079
- /**
1080
- * Sets the number of header rows.
1081
- *
1082
- * @param world - The ECS world
1083
- * @param eid - The entity ID
1084
- * @param count - Number of header rows (0-255)
1085
- */
1086
- declare function setHeaderRowCount(world: World, eid: Entity, count: number): void;
1087
- /**
1088
- * Gets the number of header rows.
1089
- *
1090
- * @param world - The ECS world (unused, kept for API consistency)
1091
- * @param eid - The entity ID
1092
- * @returns Number of header rows
1093
- */
1094
- declare function getHeaderRowCount(_world: World, eid: Entity): number;
1095
- /**
1096
- * Sets the table display configuration.
1097
- *
1098
- * @param world - The ECS world (unused, kept for API consistency)
1099
- * @param eid - The entity ID
1100
- * @param options - Display options
1101
- */
1102
- declare function setTableDisplay(_world: World, eid: Entity, options: TableDisplayOptions): void;
1103
- /**
1104
- * Gets the table display configuration.
1105
- *
1106
- * @param world - The ECS world (unused, kept for API consistency)
1107
- * @param eid - The entity ID
1108
- * @returns Display configuration
1109
- */
1110
- declare function getTableDisplay(_world: World, eid: Entity): TableDisplay;
1111
- /**
1112
- * Clears the table display configuration.
1113
- *
1114
- * @param world - The ECS world (unused, kept for API consistency)
1115
- * @param eid - The entity ID
1116
- */
1117
- declare function clearTableDisplay(_world: World, eid: Entity): void;
1118
- /**
1119
- * Gets the cell padding.
1120
- *
1121
- * @param world - The ECS world (unused, kept for API consistency)
1122
- * @param eid - The entity ID
1123
- * @returns Cell padding (spaces)
1124
- */
1125
- declare function getCellPadding(_world: World, eid: Entity): number;
1126
- /**
1127
- * Sets the cell padding.
1128
- *
1129
- * @param world - The ECS world
1130
- * @param eid - The entity ID
1131
- * @param padding - Cell padding (0-255)
1132
- */
1133
- declare function setCellPadding(world: World, eid: Entity, padding: number): void;
1134
- /**
1135
- * Checks if cell borders are enabled.
1136
- *
1137
- * @param world - The ECS world (unused, kept for API consistency)
1138
- * @param eid - The entity ID
1139
- * @returns true if cell borders are enabled
1140
- */
1141
- declare function hasCellBorders(_world: World, eid: Entity): boolean;
1142
- /**
1143
- * Sets whether cell borders are enabled.
1144
- *
1145
- * @param world - The ECS world
1146
- * @param eid - The entity ID
1147
- * @param enabled - Whether to show cell borders
1148
- */
1149
- declare function setCellBorders(world: World, eid: Entity, enabled: boolean): void;
1150
- /**
1151
- * Calculates column widths based on content.
1152
- *
1153
- * @param world - The ECS world (unused, kept for API consistency)
1154
- * @param eid - The entity ID
1155
- * @param maxTotalWidth - Maximum total width (optional)
1156
- * @returns Array of column widths
1157
- */
1158
- declare function calculateColumnWidths(_world: World, eid: Entity, maxTotalWidth?: number): number[];
1159
- /**
1160
- * Renders table as an array of strings (one per line).
1161
- *
1162
- * @param world - The ECS world (unused, kept for API consistency)
1163
- * @param eid - The entity ID
1164
- * @param width - Available width
1165
- * @returns Array of rendered line strings
1166
- */
1167
- declare function renderTableLines(world: World, eid: Entity, width: number): string[];
1168
- /**
1169
- * Resets the table store. Used for testing.
1170
- */
1171
- declare function resetTableStore(): void;
1172
-
1173
- /**
1174
- * TerminalBuffer Component
1175
- *
1176
- * ECS component for terminal emulator buffers. Stores a 2D grid of cells
1177
- * with per-cell styling, cursor state, and scrollback history.
1178
- *
1179
- * @module components/terminalBuffer
1180
- *
1181
- * @example
1182
- * ```typescript
1183
- * import { createWorld, addEntity } from 'blecsd';
1184
- * import {
1185
- * setTerminalBuffer,
1186
- * writeToTerminal,
1187
- * getTerminalState,
1188
- * clearTerminal,
1189
- * } from 'blecsd/components';
1190
- *
1191
- * const world = createWorld();
1192
- * const eid = addEntity(world);
1193
- *
1194
- * // Initialize a terminal buffer
1195
- * setTerminalBuffer(world, eid, { width: 80, height: 24 });
1196
- *
1197
- * // Write ANSI content
1198
- * writeToTerminal(world, eid, '\x1b[31mHello\x1b[0m World');
1199
- *
1200
- * // Get current state
1201
- * const state = getTerminalState(eid);
1202
- * console.log(state?.cursorX, state?.cursorY);
1203
- *
1204
- * // Clear the terminal
1205
- * clearTerminal(world, eid);
1206
- * ```
1207
- */
1208
-
1209
- /** Default terminal width in columns */
1210
- declare const DEFAULT_TERMINAL_WIDTH = 80;
1211
- /** Default terminal height in rows */
1212
- declare const DEFAULT_TERMINAL_HEIGHT = 24;
1213
- /** Default scrollback lines */
1214
- declare const DEFAULT_SCROLLBACK_LINES = 1000;
1215
- /**
1216
- * TerminalBuffer component for scalar state.
1217
- * Complex state (cells, scrollback, parser state) is stored in a Map.
1218
- */
1219
- declare const TerminalBuffer: {
1220
- /** Tag indicating this is a terminal buffer (1 = yes) */
1221
- isTerminal: Uint8Array<ArrayBuffer>;
1222
- /** Terminal width in columns */
1223
- width: Uint16Array<ArrayBuffer>;
1224
- /** Terminal height in rows */
1225
- height: Uint16Array<ArrayBuffer>;
1226
- /** Cursor X position (column) */
1227
- cursorX: Uint16Array<ArrayBuffer>;
1228
- /** Cursor Y position (row) */
1229
- cursorY: Uint16Array<ArrayBuffer>;
1230
- /** Cursor visible flag (1 = visible) */
1231
- cursorVisible: Uint8Array<ArrayBuffer>;
1232
- /** Scroll offset from top (for viewing history) */
1233
- scrollOffset: Uint32Array<ArrayBuffer>;
1234
- /** Alternate screen buffer active (1 = yes) */
1235
- altScreenActive: Uint8Array<ArrayBuffer>;
1236
- };
1237
- /**
1238
- * Terminal state stored in a Map for complex data.
1239
- */
1240
- interface TerminalState {
1241
- /** Cell buffer (2D grid in row-major order) */
1242
- readonly buffer: ScreenBufferData;
1243
- /** Scrollback history */
1244
- readonly scrollback: ScrollbackBuffer;
1245
- /** Current text attributes for new characters */
1246
- currentAttr: Attribute;
1247
- /** Partial escape sequence buffer */
1248
- escapeBuffer: string;
1249
- /** Whether we're in the middle of parsing an escape sequence */
1250
- inEscape: boolean;
1251
- /** Saved cursor position X */
1252
- savedCursorX: number;
1253
- /** Saved cursor position Y */
1254
- savedCursorY: number;
1255
- /** Saved attributes */
1256
- savedAttr: Attribute;
1257
- /** Alternate screen buffer (for full-screen apps) */
1258
- altBuffer: ScreenBufferData | null;
1259
- /** Cursor shape: 'block' | 'underline' | 'bar' */
1260
- cursorShape: CursorShape;
1261
- /** Cursor blink enabled */
1262
- cursorBlink: boolean;
1263
- }
1264
- /**
1265
- * Cursor shape types.
1266
- */
1267
- type CursorShape = 'block' | 'underline' | 'bar';
1268
- /**
1269
- * Terminal buffer configuration schema.
1270
- */
1271
- declare const TerminalBufferConfigSchema: z.ZodObject<{
1272
- width: z.ZodDefault<z.ZodNumber>;
1273
- height: z.ZodDefault<z.ZodNumber>;
1274
- scrollbackLines: z.ZodDefault<z.ZodNumber>;
1275
- cursorVisible: z.ZodDefault<z.ZodBoolean>;
1276
- cursorShape: z.ZodDefault<z.ZodEnum<{
1277
- underline: "underline";
1278
- block: "block";
1279
- bar: "bar";
1280
- }>>;
1281
- cursorBlink: z.ZodDefault<z.ZodBoolean>;
1282
- }, z.core.$strip>;
1283
- /**
1284
- * Terminal buffer configuration type.
1285
- */
1286
- type TerminalBufferConfig = z.input<typeof TerminalBufferConfigSchema>;
1287
- /**
1288
- * Sets up a terminal buffer on an entity.
1289
- *
1290
- * @param world - The ECS world
1291
- * @param eid - Entity ID
1292
- * @param config - Terminal buffer configuration
1293
- *
1294
- * @example
1295
- * ```typescript
1296
- * setTerminalBuffer(world, eid, {
1297
- * width: 80,
1298
- * height: 24,
1299
- * scrollbackLines: 1000,
1300
- * });
1301
- * ```
1302
- */
1303
- declare function setTerminalBuffer(world: World, eid: Entity, config?: TerminalBufferConfig): void;
1304
- /**
1305
- * Checks if an entity has a terminal buffer.
1306
- *
1307
- * @param eid - Entity ID
1308
- * @returns true if the entity has a terminal buffer
1309
- */
1310
- declare function hasTerminalBuffer(eid: Entity): boolean;
1311
- /**
1312
- * Gets the terminal state for an entity.
1313
- *
1314
- * @param eid - Entity ID
1315
- * @returns Terminal state or undefined
1316
- */
1317
- declare function getTerminalState(eid: Entity): TerminalState | undefined;
1318
- /**
1319
- * Gets terminal buffer data (scalar values).
1320
- *
1321
- * @param eid - Entity ID
1322
- * @returns Terminal buffer data
1323
- */
1324
- declare function getTerminalBuffer(eid: Entity): {
1325
- width: number;
1326
- height: number;
1327
- cursorX: number;
1328
- cursorY: number;
1329
- cursorVisible: boolean;
1330
- scrollOffset: number;
1331
- } | undefined;
1332
- /**
1333
- * Writes a character to the terminal at the current cursor position.
1334
- *
1335
- * @param world - The ECS world
1336
- * @param eid - Entity ID
1337
- * @param char - Character to write
1338
- */
1339
- declare function writeChar(world: World, eid: Entity, char: string): void;
1340
- /**
1341
- * Writes a string to the terminal (processes escape sequences).
1342
- *
1343
- * @param world - The ECS world
1344
- * @param eid - Entity ID
1345
- * @param data - String to write
1346
- */
1347
- declare function writeToTerminal(world: World, eid: Entity, data: string): void;
1348
- /**
1349
- * Clears the terminal buffer.
1350
- *
1351
- * @param world - The ECS world
1352
- * @param eid - Entity ID
1353
- */
1354
- declare function clearTerminal(world: World, eid: Entity): void;
1355
- /**
1356
- * Resets the terminal to initial state.
1357
- *
1358
- * @param world - The ECS world
1359
- * @param eid - Entity ID
1360
- */
1361
- declare function resetTerminal(world: World, eid: Entity): void;
1362
- /**
1363
- * Sets cursor position.
1364
- *
1365
- * @param world - The ECS world
1366
- * @param eid - Entity ID
1367
- * @param x - Column (0-indexed)
1368
- * @param y - Row (0-indexed)
1369
- */
1370
- declare function setCursorPosition(world: World, eid: Entity, x: number, y: number): void;
1371
- /**
1372
- * Sets cursor visibility.
1373
- *
1374
- * @param world - The ECS world
1375
- * @param eid - Entity ID
1376
- * @param visible - Cursor visibility
1377
- */
1378
- declare function setCursorVisible(world: World, eid: Entity, visible: boolean): void;
1379
- /**
1380
- * Scrolls the terminal view up.
1381
- *
1382
- * @param world - The ECS world
1383
- * @param eid - Entity ID
1384
- * @param lines - Number of lines to scroll
1385
- */
1386
- declare function scrollTerminalUp(world: World, eid: Entity, lines: number): void;
1387
- /**
1388
- * Scrolls the terminal view down.
1389
- *
1390
- * @param world - The ECS world
1391
- * @param eid - Entity ID
1392
- * @param lines - Number of lines to scroll
1393
- */
1394
- declare function scrollTerminalDown(world: World, eid: Entity, lines: number): void;
1395
- /**
1396
- * Scrolls to the top of history.
1397
- *
1398
- * @param world - The ECS world
1399
- * @param eid - Entity ID
1400
- */
1401
- declare function scrollTerminalToTop(world: World, eid: Entity): void;
1402
- /**
1403
- * Scrolls to the bottom (current view).
1404
- *
1405
- * @param world - The ECS world
1406
- * @param eid - Entity ID
1407
- */
1408
- declare function scrollTerminalToBottom(world: World, eid: Entity): void;
1409
- /**
1410
- * Resizes the terminal buffer.
1411
- *
1412
- * @param world - The ECS world
1413
- * @param eid - Entity ID
1414
- * @param width - New width in columns
1415
- * @param height - New height in rows
1416
- */
1417
- declare function resizeTerminalBuffer(world: World, eid: Entity, width: number, height: number): void;
1418
- /**
1419
- * Removes a terminal buffer from an entity.
1420
- *
1421
- * @param eid - Entity ID
1422
- */
1423
- declare function removeTerminalBuffer(eid: Entity): void;
1424
- /**
1425
- * Renders terminal buffer to an ANSI string (for display).
1426
- *
1427
- * @param eid - Entity ID
1428
- * @returns ANSI string representation of the terminal
1429
- */
1430
- declare function renderTerminalToAnsi(eid: Entity): string;
1431
- /**
1432
- * Gets the cells for rendering.
1433
- *
1434
- * @param eid - Entity ID
1435
- * @returns Readonly array of cells
1436
- */
1437
- declare function getTerminalCells(eid: Entity): readonly Cell[] | undefined;
1438
- /**
1439
- * Resets the terminal buffer store (for testing).
1440
- * @internal
1441
- */
1442
- declare function resetTerminalBufferStore(): void;
1443
-
1444
- /**
1445
- * VirtualViewport Component for Viewport Windowing
1446
- *
1447
- * ECS component that tracks which portion of a large dataset is currently visible.
1448
- * Works with VirtualizedLineStore for text, or any other indexed content.
1449
- *
1450
- * @module components/virtualViewport
1451
- *
1452
- * @example
1453
- * ```typescript
1454
- * import { createWorld, addEntity } from '../core/ecs';
1455
- * import { setVirtualViewport, scrollToLine, getVisibleRange } from 'blecsd';
1456
- *
1457
- * const world = createWorld();
1458
- * const entity = addEntity(world);
1459
- *
1460
- * // Configure viewport for a list with 1000 items
1461
- * setVirtualViewport(world, entity, {
1462
- * totalLineCount: 1000,
1463
- * visibleLineCount: 25,
1464
- * overscanBefore: 5,
1465
- * overscanAfter: 5,
1466
- * });
1467
- *
1468
- * // Scroll to line 500
1469
- * scrollToLine(world, entity, 500);
1470
- *
1471
- * // Get visible range (includes overscan)
1472
- * const range = getVisibleRange(world, entity);
1473
- * // range = { start: 495, end: 530 }
1474
- * ```
1475
- */
1476
-
1477
- /**
1478
- * Schema for VirtualViewport configuration options.
1479
- *
1480
- * @example
1481
- * ```typescript
1482
- * import { VirtualViewportOptionsSchema } from 'blecsd';
1483
- *
1484
- * const options = VirtualViewportOptionsSchema.parse({
1485
- * totalLineCount: 10000,
1486
- * visibleLineCount: 25,
1487
- * overscanBefore: 5,
1488
- * });
1489
- * ```
1490
- */
1491
- declare const VirtualViewportOptionsSchema: z.ZodObject<{
1492
- firstVisibleLine: z.ZodOptional<z.ZodNumber>;
1493
- visibleLineCount: z.ZodOptional<z.ZodNumber>;
1494
- totalLineCount: z.ZodOptional<z.ZodNumber>;
1495
- overscanBefore: z.ZodOptional<z.ZodNumber>;
1496
- overscanAfter: z.ZodOptional<z.ZodNumber>;
1497
- estimatedLineHeight: z.ZodOptional<z.ZodNumber>;
1498
- isVariableHeight: z.ZodOptional<z.ZodBoolean>;
1499
- selectedLine: z.ZodOptional<z.ZodNumber>;
1500
- cursorLine: z.ZodOptional<z.ZodNumber>;
1501
- }, z.core.$strip>;
1502
- /**
1503
- * Schema for visible range output.
1504
- */
1505
- declare const VisibleRangeSchema: z.ZodObject<{
1506
- start: z.ZodNumber;
1507
- end: z.ZodNumber;
1508
- visibleStart: z.ZodNumber;
1509
- visibleEnd: z.ZodNumber;
1510
- count: z.ZodNumber;
1511
- }, z.core.$strip>;
1512
- /**
1513
- * Schema for scroll info output.
1514
- */
1515
- declare const ScrollInfoSchema: z.ZodObject<{
1516
- currentLine: z.ZodNumber;
1517
- totalLines: z.ZodNumber;
1518
- viewportSize: z.ZodNumber;
1519
- maxScrollLine: z.ZodNumber;
1520
- scrollPercent: z.ZodNumber;
1521
- atTop: z.ZodBoolean;
1522
- atBottom: z.ZodBoolean;
1523
- }, z.core.$strip>;
1524
- /**
1525
- * VirtualViewport component store using SoA (Structure of Arrays).
1526
- *
1527
- * Tracks viewport windowing for virtualized content rendering.
1528
- * Only the visible portion (plus overscan) should be rendered.
1529
- */
1530
- declare const VirtualViewport: {
1531
- /** First visible line index in the viewport */
1532
- firstVisibleLine: Uint32Array<ArrayBuffer>;
1533
- /** Number of lines visible in the viewport */
1534
- visibleLineCount: Uint32Array<ArrayBuffer>;
1535
- /** Total number of lines in the content */
1536
- totalLineCount: Uint32Array<ArrayBuffer>;
1537
- /** Extra lines to render above viewport for smooth scrolling */
1538
- overscanBefore: Uint8Array<ArrayBuffer>;
1539
- /** Extra lines to render below viewport for smooth scrolling */
1540
- overscanAfter: Uint8Array<ArrayBuffer>;
1541
- /** Estimated height of each line in rows (for variable height estimation) */
1542
- estimatedLineHeight: Uint8Array<ArrayBuffer>;
1543
- /** Whether lines have variable height (0=fixed, 1=variable) */
1544
- isVariableHeight: Uint8Array<ArrayBuffer>;
1545
- /** Whether viewport needs re-render (dirty flag) */
1546
- isDirty: Uint8Array<ArrayBuffer>;
1547
- /** Selected line index (-1 = none) using Int32 to allow -1 */
1548
- selectedLine: Int32Array<ArrayBuffer>;
1549
- /** Cursor line for interactive lists (-1 = none) */
1550
- cursorLine: Int32Array<ArrayBuffer>;
1551
- };
1552
- /**
1553
- * Configuration options for VirtualViewport.
1554
- */
1555
- interface VirtualViewportOptions {
1556
- /** First visible line index */
1557
- firstVisibleLine?: number;
1558
- /** Number of visible lines */
1559
- visibleLineCount?: number;
1560
- /** Total line count in content */
1561
- totalLineCount?: number;
1562
- /** Overscan lines before viewport */
1563
- overscanBefore?: number;
1564
- /** Overscan lines after viewport */
1565
- overscanAfter?: number;
1566
- /** Estimated line height (for variable height) */
1567
- estimatedLineHeight?: number;
1568
- /** Whether lines have variable height */
1569
- isVariableHeight?: boolean;
1570
- /** Selected line index */
1571
- selectedLine?: number;
1572
- /** Cursor line index */
1573
- cursorLine?: number;
1574
- }
1575
- /**
1576
- * Visible range including overscan.
1577
- */
1578
- interface VisibleRange {
1579
- /** Start line index (with overscan) */
1580
- readonly start: number;
1581
- /** End line index (exclusive, with overscan) */
1582
- readonly end: number;
1583
- /** First actually visible line (without overscan) */
1584
- readonly visibleStart: number;
1585
- /** Last actually visible line (exclusive, without overscan) */
1586
- readonly visibleEnd: number;
1587
- /** Total lines in range */
1588
- readonly count: number;
1589
- }
1590
- /**
1591
- * Full viewport data.
1592
- */
1593
- interface VirtualViewportData {
1594
- readonly firstVisibleLine: number;
1595
- readonly visibleLineCount: number;
1596
- readonly totalLineCount: number;
1597
- readonly overscanBefore: number;
1598
- readonly overscanAfter: number;
1599
- readonly estimatedLineHeight: number;
1600
- readonly isVariableHeight: boolean;
1601
- readonly isDirty: boolean;
1602
- readonly selectedLine: number;
1603
- readonly cursorLine: number;
1604
- }
1605
- /**
1606
- * Scroll position info.
1607
- */
1608
- interface ScrollInfo {
1609
- /** Current line */
1610
- readonly currentLine: number;
1611
- /** Total lines */
1612
- readonly totalLines: number;
1613
- /** Viewport size */
1614
- readonly viewportSize: number;
1615
- /** Maximum scrollable line */
1616
- readonly maxScrollLine: number;
1617
- /** Scroll percentage (0-100) */
1618
- readonly scrollPercent: number;
1619
- /** Whether at top */
1620
- readonly atTop: boolean;
1621
- /** Whether at bottom */
1622
- readonly atBottom: boolean;
1623
- }
1624
- /**
1625
- * Sets up a VirtualViewport on an entity.
1626
- * Input is validated against VirtualViewportOptionsSchema.
1627
- *
1628
- * @param world - The ECS world
1629
- * @param eid - The entity ID
1630
- * @param options - Viewport configuration
1631
- * @returns The entity ID for chaining
1632
- * @throws {z.ZodError} If options are invalid
1633
- *
1634
- * @example
1635
- * ```typescript
1636
- * setVirtualViewport(world, entity, {
1637
- * totalLineCount: 10000,
1638
- * visibleLineCount: 25,
1639
- * });
1640
- * ```
1641
- */
1642
- declare function setVirtualViewport(world: World, eid: Entity, options: VirtualViewportOptions): Entity;
1643
- /**
1644
- * Gets VirtualViewport data for an entity.
1645
- *
1646
- * @param world - The ECS world
1647
- * @param eid - The entity ID
1648
- * @returns Viewport data or undefined if no component
1649
- */
1650
- declare function getVirtualViewport(world: World, eid: Entity): VirtualViewportData | undefined;
1651
- /**
1652
- * Checks if entity has VirtualViewport.
1653
- *
1654
- * @param world - The ECS world
1655
- * @param eid - The entity ID
1656
- * @returns true if has component
1657
- */
1658
- declare function hasVirtualViewport(world: World, eid: Entity): boolean;
1659
- /**
1660
- * Sets the first visible line (viewport start).
1661
- *
1662
- * @param world - The ECS world
1663
- * @param eid - The entity ID
1664
- * @param lineIndex - Line index to scroll to
1665
- * @returns The entity ID for chaining
1666
- */
1667
- declare function setViewportStart(world: World, eid: Entity, lineIndex: number): Entity;
1668
- /**
1669
- * Gets the visible range including overscan.
1670
- *
1671
- * @param world - The ECS world
1672
- * @param eid - The entity ID
1673
- * @returns Visible range or undefined if no component
1674
- *
1675
- * @example
1676
- * ```typescript
1677
- * const range = getVisibleRange(world, entity);
1678
- * // Render lines from range.start to range.end
1679
- * const lines = getLineRange(store, range.start, range.end);
1680
- * ```
1681
- */
1682
- declare function getVisibleRange(world: World, eid: Entity): VisibleRange | undefined;
1683
- /**
1684
- * Checks if a line is currently visible (in viewport, not just overscan).
1685
- *
1686
- * @param world - The ECS world
1687
- * @param eid - The entity ID
1688
- * @param lineIndex - Line index to check
1689
- * @returns true if line is visible
1690
- */
1691
- declare function isLineVisible(world: World, eid: Entity, lineIndex: number): boolean;
1692
- /**
1693
- * Checks if a line is in the render range (visible + overscan).
1694
- *
1695
- * @param world - The ECS world
1696
- * @param eid - The entity ID
1697
- * @param lineIndex - Line index to check
1698
- * @returns true if line should be rendered
1699
- */
1700
- declare function isLineInRenderRange(world: World, eid: Entity, lineIndex: number): boolean;
1701
- /**
1702
- * Scrolls to a specific line, centering it if possible.
1703
- *
1704
- * @param world - The ECS world
1705
- * @param eid - The entity ID
1706
- * @param lineIndex - Target line index
1707
- * @returns The entity ID for chaining
1708
- */
1709
- declare function scrollToLine(world: World, eid: Entity, lineIndex: number): Entity;
1710
- /**
1711
- * Scrolls by a number of lines.
1712
- *
1713
- * @param world - The ECS world
1714
- * @param eid - The entity ID
1715
- * @param delta - Lines to scroll (positive = down, negative = up)
1716
- * @returns The entity ID for chaining
1717
- */
1718
- declare function scrollByLines(world: World, eid: Entity, delta: number): Entity;
1719
- /**
1720
- * Scrolls by pages.
1721
- *
1722
- * @param world - The ECS world
1723
- * @param eid - The entity ID
1724
- * @param pages - Pages to scroll (positive = down, negative = up)
1725
- * @returns The entity ID for chaining
1726
- */
1727
- declare function scrollByPages(world: World, eid: Entity, pages: number): Entity;
1728
- /**
1729
- * Scrolls to the top.
1730
- *
1731
- * @param world - The ECS world
1732
- * @param eid - The entity ID
1733
- * @returns The entity ID for chaining
1734
- */
1735
- declare function scrollToTop(world: World, eid: Entity): Entity;
1736
- /**
1737
- * Scrolls to the bottom.
1738
- *
1739
- * @param world - The ECS world
1740
- * @param eid - The entity ID
1741
- * @returns The entity ID for chaining
1742
- */
1743
- declare function scrollToBottom(world: World, eid: Entity): Entity;
1744
- /**
1745
- * Gets scroll information.
1746
- *
1747
- * @param world - The ECS world
1748
- * @param eid - The entity ID
1749
- * @returns Scroll info or undefined if no component
1750
- */
1751
- declare function getScrollInfo(world: World, eid: Entity): ScrollInfo | undefined;
1752
- /**
1753
- * Updates the total line count (when content changes).
1754
- *
1755
- * @param world - The ECS world
1756
- * @param eid - The entity ID
1757
- * @param totalLines - New total line count
1758
- * @returns The entity ID for chaining
1759
- */
1760
- declare function setTotalLineCount(world: World, eid: Entity, totalLines: number): Entity;
1761
- /**
1762
- * Updates the viewport size (when container resizes).
1763
- *
1764
- * @param world - The ECS world
1765
- * @param eid - The entity ID
1766
- * @param visibleLines - New visible line count
1767
- * @returns The entity ID for chaining
1768
- */
1769
- declare function setVisibleLineCount(world: World, eid: Entity, visibleLines: number): Entity;
1770
- /**
1771
- * Sets overscan values.
1772
- *
1773
- * @param world - The ECS world
1774
- * @param eid - The entity ID
1775
- * @param before - Lines to render before viewport
1776
- * @param after - Lines to render after viewport
1777
- * @returns The entity ID for chaining
1778
- */
1779
- declare function setOverscan(world: World, eid: Entity, before: number, after: number): Entity;
1780
- /**
1781
- * Sets the selected line.
1782
- *
1783
- * @param world - The ECS world
1784
- * @param eid - The entity ID
1785
- * @param lineIndex - Selected line (-1 for none)
1786
- * @returns The entity ID for chaining
1787
- */
1788
- declare function setSelectedLine(world: World, eid: Entity, lineIndex: number): Entity;
1789
- /**
1790
- * Gets the selected line.
1791
- *
1792
- * @param world - The ECS world
1793
- * @param eid - The entity ID
1794
- * @returns Selected line index or -1 if none
1795
- */
1796
- declare function getSelectedLine(world: World, eid: Entity): number;
1797
- /**
1798
- * Sets the cursor line (for keyboard navigation).
1799
- *
1800
- * @param world - The ECS world
1801
- * @param eid - The entity ID
1802
- * @param lineIndex - Cursor line (-1 for none)
1803
- * @returns The entity ID for chaining
1804
- */
1805
- declare function setCursorLine(world: World, eid: Entity, lineIndex: number): Entity;
1806
- /**
1807
- * Gets the cursor line.
1808
- *
1809
- * @param world - The ECS world
1810
- * @param eid - The entity ID
1811
- * @returns Cursor line index or -1 if none
1812
- */
1813
- declare function getCursorLine(world: World, eid: Entity): number;
1814
- /**
1815
- * Moves cursor up/down and auto-scrolls to keep it visible.
1816
- *
1817
- * @param world - The ECS world
1818
- * @param eid - The entity ID
1819
- * @param delta - Lines to move (negative = up, positive = down)
1820
- * @returns The entity ID for chaining
1821
- */
1822
- declare function moveCursor(world: World, eid: Entity, delta: number): Entity;
1823
- /**
1824
- * Ensures the cursor is visible, scrolling if needed.
1825
- *
1826
- * @param world - The ECS world
1827
- * @param eid - The entity ID
1828
- * @returns The entity ID for chaining
1829
- */
1830
- declare function ensureCursorVisible(world: World, eid: Entity): Entity;
1831
- /**
1832
- * Checks if viewport needs re-render.
1833
- *
1834
- * @param world - The ECS world
1835
- * @param eid - The entity ID
1836
- * @returns true if dirty
1837
- */
1838
- declare function isViewportDirty(world: World, eid: Entity): boolean;
1839
- /**
1840
- * Clears the dirty flag after rendering.
1841
- *
1842
- * @param world - The ECS world
1843
- * @param eid - The entity ID
1844
- * @returns The entity ID for chaining
1845
- */
1846
- declare function clearViewportDirty(world: World, eid: Entity): Entity;
1847
- /**
1848
- * Forces viewport to be dirty (triggers re-render).
1849
- *
1850
- * @param world - The ECS world
1851
- * @param eid - The entity ID
1852
- * @returns The entity ID for chaining
1853
- */
1854
- declare function invalidateViewport(world: World, eid: Entity): Entity;
1855
-
1856
- export { appendRow as $, AUTO_DIMENSION as A, type ScrollableOptions as B, type CellAlign as C, DEFAULT_CELL_BG as D, ScrollbarVisibility as E, type TableCell as F, type TableColumn as G, type TableData as H, type TableDisplay as I, type TableDisplayOptions as J, type TableRow as K, type ListAction as L, type TableStore as M, TerminalBuffer as N, type TerminalBufferConfig as O, TerminalBufferConfigSchema as P, type CursorShape as Q, type TerminalState as R, ScrollInfoSchema as S, Table as T, type VirtualViewportData as U, VirtualViewport as V, type VirtualViewportOptions as W, VirtualViewportOptionsSchema as X, type ScrollInfo as Y, type VisibleRange as Z, VisibleRangeSchema as _, DEFAULT_CELL_FG as a, scrollByPages as a$, attachTableBehavior as a0, calculateColumnWidths as a1, canScroll as a2, clearData as a3, clearTableDisplay as a4, clearTerminal as a5, clearViewportDirty as a6, decodePercentage as a7, detachTableBehavior as a8, encodePercentage as a9, getVirtualViewport as aA, getVisibleRange as aB, hasCellBorders as aC, hasDimensions as aD, hasScrollable as aE, hasTerminalBuffer as aF, hasVirtualViewport as aG, insertRow as aH, invalidateViewport as aI, isAtBottom as aJ, isAtTop as aK, isLineInRenderRange as aL, isLineVisible as aM, isPercentage as aN, isTable as aO, isViewportDirty as aP, moveCursor as aQ, removeRow as aR, removeTerminalBuffer as aS, renderTableLines as aT, renderTerminalToAnsi as aU, resetTableStore as aV, resetTerminal as aW, resetTerminalBufferStore as aX, resizeTerminalBuffer as aY, scrollBy as aZ, scrollByLines as a_, ensureCursorVisible as aa, getCellPadding as ab, getCellValue as ac, getColCount as ad, getColumn as ae, getColumns as af, getCursorLine as ag, getData as ah, getDataAsStrings as ai, getDataRows as aj, getDimensions as ak, getHeaderRowCount as al, getHeaderRows as am, getResolvedHeight as an, getResolvedWidth as ao, getRow as ap, getRowCount as aq, getScroll as ar, getScrollPercentage as as, getScrollable as at, getSelectedLine as au, getTableDisplay as av, getTerminalBuffer as aw, getTerminalCells as ax, getTerminalState as ay, getScrollInfo as az, DEFAULT_HEADER_BG as b, scrollTerminalDown as b0, scrollTerminalToBottom as b1, scrollTerminalToTop as b2, scrollTerminalUp as b3, scrollTo as b4, scrollToBottom$1 as b5, scrollToLine as b6, scrollToTop$1 as b7, scrollToBottom as b8, scrollToTop as b9, getCell as bA, setCell as bB, setCursorVisible as bC, setCellBorders as ba, setCellPadding as bb, setConstraints as bc, setCursorLine as bd, setCursorPosition as be, setData as bf, setDimensions as bg, setHeaderRowCount as bh, setHeaders as bi, setOverscan as bj, setScroll as bk, setScrollSize as bl, setScrollable as bm, setScrollbarVisibility as bn, setSelectedLine as bo, setShrink as bp, setTableDisplay as bq, setTerminalBuffer as br, setTotalLineCount as bs, setViewportStart as bt, setVirtualViewport as bu, setVisibleLineCount as bv, shouldShrink as bw, tableStore as bx, writeChar as by, writeToTerminal as bz, DEFAULT_HEADER_FG as c, DEFAULT_SCROLLBACK_LINES as d, DEFAULT_BORDER_BG as e, DEFAULT_BORDER_FG as f, DEFAULT_TERMINAL_HEIGHT as g, DEFAULT_TERMINAL_WIDTH as h, type DimensionConstraints as i, type DimensionValue as j, Dimensions as k, type DimensionsData as l, type ListDisplay as m, type ListDisplayOptions as n, type ListEvent as o, type ListItem as p, type ListLazyLoadCallback as q, type ListScrollCallback as r, type ListScrollInfo as s, type ListSelectCallback as t, type ListState as u, type ListStore as v, type ScrollPercentage as w, type ScrollPosition as x, Scrollable as y, type ScrollableData as z };