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
@@ -0,0 +1,657 @@
1
+ import { W as World, E as Entity } from './types-B8LmNkzG.js';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Dimensions component for entity sizing in the terminal grid.
6
+ * @module components/dimensions
7
+ */
8
+
9
+ /**
10
+ * Special value indicating "auto" (content-based) dimension.
11
+ * When used, the dimension is calculated based on content.
12
+ */
13
+ declare const AUTO_DIMENSION = -1;
14
+ /**
15
+ * Encodes a percentage value for storage in typed arrays.
16
+ * Percentages are stored as negative values: -2 = 0%, -102 = 100%
17
+ *
18
+ * @param percent - Percentage value (0-100)
19
+ * @returns Encoded value for storage
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const encoded = encodePercentage(50); // Returns -52
24
+ * ```
25
+ */
26
+ declare function encodePercentage(percent: number): number;
27
+ /**
28
+ * Decodes a percentage value from typed array storage.
29
+ *
30
+ * @param value - Encoded value from storage
31
+ * @returns Percentage value (0-100) or null if not a percentage
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const percent = decodePercentage(-52); // Returns 50
36
+ * const notPercent = decodePercentage(100); // Returns null
37
+ * ```
38
+ */
39
+ declare function decodePercentage(value: number): number | null;
40
+ /**
41
+ * Checks if a value represents a percentage.
42
+ *
43
+ * @param value - Value to check
44
+ * @returns true if the value is an encoded percentage
45
+ */
46
+ declare function isPercentage(value: number): boolean;
47
+ /**
48
+ * Dimensions component store using SoA (Structure of Arrays) for performance.
49
+ *
50
+ * - `width`, `height`: Size in terminal cells (floats), or encoded percentages
51
+ * - `minWidth`, `minHeight`: Minimum size constraints
52
+ * - `maxWidth`, `maxHeight`: Maximum size constraints
53
+ * - `shrink`: Whether to shrink to content (0=no, 1=yes)
54
+ *
55
+ * Percentage values are encoded as negative numbers: -2 = 0%, -102 = 100%
56
+ * Use `encodePercentage()` and `decodePercentage()` for conversion.
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * import { Dimensions, setDimensions, getDimensions } from 'blecsd';
61
+ *
62
+ * setDimensions(world, entity, 80, 24);
63
+ *
64
+ * const dims = getDimensions(world, entity);
65
+ * console.log(dims.width, dims.height); // 80, 24
66
+ * ```
67
+ */
68
+ declare const Dimensions: {
69
+ /** Width in terminal cells (or encoded percentage) */
70
+ width: Float32Array<ArrayBuffer>;
71
+ /** Height in terminal cells (or encoded percentage) */
72
+ height: Float32Array<ArrayBuffer>;
73
+ /** Minimum width constraint */
74
+ minWidth: Float32Array<ArrayBuffer>;
75
+ /** Minimum height constraint */
76
+ minHeight: Float32Array<ArrayBuffer>;
77
+ /** Maximum width constraint */
78
+ maxWidth: Float32Array<ArrayBuffer>;
79
+ /** Maximum height constraint */
80
+ maxHeight: Float32Array<ArrayBuffer>;
81
+ /** 0 = fixed size, 1 = shrink to content */
82
+ shrink: Uint8Array<ArrayBuffer>;
83
+ };
84
+ /**
85
+ * Dimension value that can be a number, percentage string, or 'auto'.
86
+ */
87
+ type DimensionValue = number | `${number}%` | 'auto';
88
+ /**
89
+ * Dimensions data returned by getDimensions.
90
+ */
91
+ interface DimensionsData {
92
+ readonly width: number;
93
+ readonly height: number;
94
+ readonly minWidth: number;
95
+ readonly minHeight: number;
96
+ readonly maxWidth: number;
97
+ readonly maxHeight: number;
98
+ readonly shrink: boolean;
99
+ }
100
+ /**
101
+ * Constraints data for min/max dimensions.
102
+ */
103
+ interface DimensionConstraints {
104
+ readonly minWidth?: number;
105
+ readonly minHeight?: number;
106
+ readonly maxWidth?: number;
107
+ readonly maxHeight?: number;
108
+ }
109
+ /**
110
+ * Sets the dimensions of an entity.
111
+ * Adds the Dimensions component if not already present.
112
+ *
113
+ * @param world - The ECS world
114
+ * @param eid - The entity ID
115
+ * @param width - Width value (number, percentage string like "50%", or "auto")
116
+ * @param height - Height value (number, percentage string like "50%", or "auto")
117
+ * @returns The entity ID for chaining
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * import { createWorld, addEntity } from '../core/ecs';
122
+ * import { setDimensions } from 'blecsd';
123
+ *
124
+ * const world = createWorld();
125
+ * const entity = addEntity(world);
126
+ *
127
+ * // Fixed size
128
+ * setDimensions(world, entity, 80, 24);
129
+ *
130
+ * // Percentage width
131
+ * setDimensions(world, entity, '50%', 24);
132
+ *
133
+ * // Auto height
134
+ * setDimensions(world, entity, 80, 'auto');
135
+ * ```
136
+ */
137
+ declare function setDimensions(world: World, eid: Entity, width: DimensionValue, height: DimensionValue): Entity;
138
+ /**
139
+ * Gets the dimensions data of an entity.
140
+ * Returns undefined if the entity doesn't have a Dimensions component.
141
+ *
142
+ * @param world - The ECS world
143
+ * @param eid - The entity ID
144
+ * @returns Dimensions data or undefined
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * import { getDimensions } from 'blecsd';
149
+ *
150
+ * const dims = getDimensions(world, entity);
151
+ * if (dims) {
152
+ * console.log(`Size: ${dims.width}x${dims.height}`);
153
+ * }
154
+ * ```
155
+ */
156
+ declare function getDimensions(world: World, eid: Entity): DimensionsData | undefined;
157
+ /**
158
+ * Sets dimension constraints (min/max) for an entity.
159
+ *
160
+ * @param world - The ECS world
161
+ * @param eid - The entity ID
162
+ * @param constraints - Constraint values to set
163
+ * @returns The entity ID for chaining
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * import { setConstraints } from 'blecsd';
168
+ *
169
+ * setConstraints(world, entity, {
170
+ * minWidth: 10,
171
+ * maxWidth: 100,
172
+ * minHeight: 5,
173
+ * });
174
+ * ```
175
+ */
176
+ declare function setConstraints(world: World, eid: Entity, constraints: DimensionConstraints): Entity;
177
+ /**
178
+ * Sets the shrink-to-content flag for an entity.
179
+ *
180
+ * @param world - The ECS world
181
+ * @param eid - The entity ID
182
+ * @param shrink - true to shrink to content, false for fixed size
183
+ * @returns The entity ID for chaining
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * import { setShrink } from 'blecsd';
188
+ *
189
+ * // Enable shrink-to-content
190
+ * setShrink(world, entity, true);
191
+ * ```
192
+ */
193
+ declare function setShrink(world: World, eid: Entity, shrink: boolean): Entity;
194
+ /**
195
+ * Checks if an entity should shrink to content.
196
+ *
197
+ * @param world - The ECS world
198
+ * @param eid - The entity ID
199
+ * @returns true if shrink is enabled, false otherwise
200
+ */
201
+ declare function shouldShrink(world: World, eid: Entity): boolean;
202
+ /**
203
+ * Checks if an entity has a Dimensions component.
204
+ *
205
+ * @param world - The ECS world
206
+ * @param eid - The entity ID
207
+ * @returns true if entity has Dimensions component
208
+ */
209
+ declare function hasDimensions(world: World, eid: Entity): boolean;
210
+ /**
211
+ * Gets the width of an entity, resolving percentages against a container width.
212
+ *
213
+ * @param world - The ECS world
214
+ * @param eid - The entity ID
215
+ * @param containerWidth - Container width to resolve percentages against
216
+ * @returns Resolved width value, or undefined if no Dimensions component
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * import { getResolvedWidth, setDimensions } from 'blecsd';
221
+ *
222
+ * setDimensions(world, entity, '50%', 24);
223
+ * const width = getResolvedWidth(world, entity, 100); // Returns 50
224
+ * ```
225
+ */
226
+ declare function getResolvedWidth(world: World, eid: Entity, containerWidth: number): number | undefined;
227
+ /**
228
+ * Gets the height of an entity, resolving percentages against a container height.
229
+ *
230
+ * @param world - The ECS world
231
+ * @param eid - The entity ID
232
+ * @param containerHeight - Container height to resolve percentages against
233
+ * @returns Resolved height value, or undefined if no Dimensions component
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * import { getResolvedHeight, setDimensions } from 'blecsd';
238
+ *
239
+ * setDimensions(world, entity, 80, '25%');
240
+ * const height = getResolvedHeight(world, entity, 80); // Returns 20
241
+ * ```
242
+ */
243
+ declare function getResolvedHeight(world: World, eid: Entity, containerHeight: number): number | undefined;
244
+
245
+ /**
246
+ * VirtualViewport Component for Viewport Windowing
247
+ *
248
+ * ECS component that tracks which portion of a large dataset is currently visible.
249
+ * Works with VirtualizedLineStore for text, or any other indexed content.
250
+ *
251
+ * @module components/virtualViewport
252
+ *
253
+ * @example
254
+ * ```typescript
255
+ * import { createWorld, addEntity } from '../core/ecs';
256
+ * import { setVirtualViewport, scrollToLine, getVisibleRange } from 'blecsd';
257
+ *
258
+ * const world = createWorld();
259
+ * const entity = addEntity(world);
260
+ *
261
+ * // Configure viewport for a list with 1000 items
262
+ * setVirtualViewport(world, entity, {
263
+ * totalLineCount: 1000,
264
+ * visibleLineCount: 25,
265
+ * overscanBefore: 5,
266
+ * overscanAfter: 5,
267
+ * });
268
+ *
269
+ * // Scroll to line 500
270
+ * scrollToLine(world, entity, 500);
271
+ *
272
+ * // Get visible range (includes overscan)
273
+ * const range = getVisibleRange(world, entity);
274
+ * // range = { start: 495, end: 530 }
275
+ * ```
276
+ */
277
+
278
+ /**
279
+ * Schema for VirtualViewport configuration options.
280
+ *
281
+ * @example
282
+ * ```typescript
283
+ * import { VirtualViewportOptionsSchema } from 'blecsd';
284
+ *
285
+ * const options = VirtualViewportOptionsSchema.parse({
286
+ * totalLineCount: 10000,
287
+ * visibleLineCount: 25,
288
+ * overscanBefore: 5,
289
+ * });
290
+ * ```
291
+ */
292
+ declare const VirtualViewportOptionsSchema: z.ZodObject<{
293
+ firstVisibleLine: z.ZodOptional<z.ZodNumber>;
294
+ visibleLineCount: z.ZodOptional<z.ZodNumber>;
295
+ totalLineCount: z.ZodOptional<z.ZodNumber>;
296
+ overscanBefore: z.ZodOptional<z.ZodNumber>;
297
+ overscanAfter: z.ZodOptional<z.ZodNumber>;
298
+ estimatedLineHeight: z.ZodOptional<z.ZodNumber>;
299
+ isVariableHeight: z.ZodOptional<z.ZodBoolean>;
300
+ selectedLine: z.ZodOptional<z.ZodNumber>;
301
+ cursorLine: z.ZodOptional<z.ZodNumber>;
302
+ }, z.core.$strip>;
303
+ /**
304
+ * Schema for visible range output.
305
+ */
306
+ declare const VisibleRangeSchema: z.ZodObject<{
307
+ start: z.ZodNumber;
308
+ end: z.ZodNumber;
309
+ visibleStart: z.ZodNumber;
310
+ visibleEnd: z.ZodNumber;
311
+ count: z.ZodNumber;
312
+ }, z.core.$strip>;
313
+ /**
314
+ * Schema for scroll info output.
315
+ */
316
+ declare const ScrollInfoSchema: z.ZodObject<{
317
+ currentLine: z.ZodNumber;
318
+ totalLines: z.ZodNumber;
319
+ viewportSize: z.ZodNumber;
320
+ maxScrollLine: z.ZodNumber;
321
+ scrollPercent: z.ZodNumber;
322
+ atTop: z.ZodBoolean;
323
+ atBottom: z.ZodBoolean;
324
+ }, z.core.$strip>;
325
+ /**
326
+ * VirtualViewport component store using SoA (Structure of Arrays).
327
+ *
328
+ * Tracks viewport windowing for virtualized content rendering.
329
+ * Only the visible portion (plus overscan) should be rendered.
330
+ */
331
+ declare const VirtualViewport: {
332
+ /** First visible line index in the viewport */
333
+ firstVisibleLine: Uint32Array<ArrayBuffer>;
334
+ /** Number of lines visible in the viewport */
335
+ visibleLineCount: Uint32Array<ArrayBuffer>;
336
+ /** Total number of lines in the content */
337
+ totalLineCount: Uint32Array<ArrayBuffer>;
338
+ /** Extra lines to render above viewport for smooth scrolling */
339
+ overscanBefore: Uint8Array<ArrayBuffer>;
340
+ /** Extra lines to render below viewport for smooth scrolling */
341
+ overscanAfter: Uint8Array<ArrayBuffer>;
342
+ /** Estimated height of each line in rows (for variable height estimation) */
343
+ estimatedLineHeight: Uint8Array<ArrayBuffer>;
344
+ /** Whether lines have variable height (0=fixed, 1=variable) */
345
+ isVariableHeight: Uint8Array<ArrayBuffer>;
346
+ /** Whether viewport needs re-render (dirty flag) */
347
+ isDirty: Uint8Array<ArrayBuffer>;
348
+ /** Selected line index (-1 = none) using Int32 to allow -1 */
349
+ selectedLine: Int32Array<ArrayBuffer>;
350
+ /** Cursor line for interactive lists (-1 = none) */
351
+ cursorLine: Int32Array<ArrayBuffer>;
352
+ };
353
+ /**
354
+ * Configuration options for VirtualViewport.
355
+ */
356
+ interface VirtualViewportOptions {
357
+ /** First visible line index */
358
+ firstVisibleLine?: number;
359
+ /** Number of visible lines */
360
+ visibleLineCount?: number;
361
+ /** Total line count in content */
362
+ totalLineCount?: number;
363
+ /** Overscan lines before viewport */
364
+ overscanBefore?: number;
365
+ /** Overscan lines after viewport */
366
+ overscanAfter?: number;
367
+ /** Estimated line height (for variable height) */
368
+ estimatedLineHeight?: number;
369
+ /** Whether lines have variable height */
370
+ isVariableHeight?: boolean;
371
+ /** Selected line index */
372
+ selectedLine?: number;
373
+ /** Cursor line index */
374
+ cursorLine?: number;
375
+ }
376
+ /**
377
+ * Visible range including overscan.
378
+ */
379
+ interface VisibleRange {
380
+ /** Start line index (with overscan) */
381
+ readonly start: number;
382
+ /** End line index (exclusive, with overscan) */
383
+ readonly end: number;
384
+ /** First actually visible line (without overscan) */
385
+ readonly visibleStart: number;
386
+ /** Last actually visible line (exclusive, without overscan) */
387
+ readonly visibleEnd: number;
388
+ /** Total lines in range */
389
+ readonly count: number;
390
+ }
391
+ /**
392
+ * Full viewport data.
393
+ */
394
+ interface VirtualViewportData {
395
+ readonly firstVisibleLine: number;
396
+ readonly visibleLineCount: number;
397
+ readonly totalLineCount: number;
398
+ readonly overscanBefore: number;
399
+ readonly overscanAfter: number;
400
+ readonly estimatedLineHeight: number;
401
+ readonly isVariableHeight: boolean;
402
+ readonly isDirty: boolean;
403
+ readonly selectedLine: number;
404
+ readonly cursorLine: number;
405
+ }
406
+ /**
407
+ * Scroll position info.
408
+ */
409
+ interface ScrollInfo {
410
+ /** Current line */
411
+ readonly currentLine: number;
412
+ /** Total lines */
413
+ readonly totalLines: number;
414
+ /** Viewport size */
415
+ readonly viewportSize: number;
416
+ /** Maximum scrollable line */
417
+ readonly maxScrollLine: number;
418
+ /** Scroll percentage (0-100) */
419
+ readonly scrollPercent: number;
420
+ /** Whether at top */
421
+ readonly atTop: boolean;
422
+ /** Whether at bottom */
423
+ readonly atBottom: boolean;
424
+ }
425
+ /**
426
+ * Sets up a VirtualViewport on an entity.
427
+ * Input is validated against VirtualViewportOptionsSchema.
428
+ *
429
+ * @param world - The ECS world
430
+ * @param eid - The entity ID
431
+ * @param options - Viewport configuration
432
+ * @returns The entity ID for chaining
433
+ * @throws {z.ZodError} If options are invalid
434
+ *
435
+ * @example
436
+ * ```typescript
437
+ * setVirtualViewport(world, entity, {
438
+ * totalLineCount: 10000,
439
+ * visibleLineCount: 25,
440
+ * });
441
+ * ```
442
+ */
443
+ declare function setVirtualViewport(world: World, eid: Entity, options: VirtualViewportOptions): Entity;
444
+ /**
445
+ * Gets VirtualViewport data for an entity.
446
+ *
447
+ * @param world - The ECS world
448
+ * @param eid - The entity ID
449
+ * @returns Viewport data or undefined if no component
450
+ */
451
+ declare function getVirtualViewport(world: World, eid: Entity): VirtualViewportData | undefined;
452
+ /**
453
+ * Checks if entity has VirtualViewport.
454
+ *
455
+ * @param world - The ECS world
456
+ * @param eid - The entity ID
457
+ * @returns true if has component
458
+ */
459
+ declare function hasVirtualViewport(world: World, eid: Entity): boolean;
460
+ /**
461
+ * Sets the first visible line (viewport start).
462
+ *
463
+ * @param world - The ECS world
464
+ * @param eid - The entity ID
465
+ * @param lineIndex - Line index to scroll to
466
+ * @returns The entity ID for chaining
467
+ */
468
+ declare function setViewportStart(world: World, eid: Entity, lineIndex: number): Entity;
469
+ /**
470
+ * Gets the visible range including overscan.
471
+ *
472
+ * @param world - The ECS world
473
+ * @param eid - The entity ID
474
+ * @returns Visible range or undefined if no component
475
+ *
476
+ * @example
477
+ * ```typescript
478
+ * const range = getVisibleRange(world, entity);
479
+ * // Render lines from range.start to range.end
480
+ * const lines = getLineRange(store, range.start, range.end);
481
+ * ```
482
+ */
483
+ declare function getVisibleRange(world: World, eid: Entity): VisibleRange | undefined;
484
+ /**
485
+ * Checks if a line is currently visible (in viewport, not just overscan).
486
+ *
487
+ * @param world - The ECS world
488
+ * @param eid - The entity ID
489
+ * @param lineIndex - Line index to check
490
+ * @returns true if line is visible
491
+ */
492
+ declare function isLineVisible(world: World, eid: Entity, lineIndex: number): boolean;
493
+ /**
494
+ * Checks if a line is in the render range (visible + overscan).
495
+ *
496
+ * @param world - The ECS world
497
+ * @param eid - The entity ID
498
+ * @param lineIndex - Line index to check
499
+ * @returns true if line should be rendered
500
+ */
501
+ declare function isLineInRenderRange(world: World, eid: Entity, lineIndex: number): boolean;
502
+ /**
503
+ * Scrolls to a specific line, centering it if possible.
504
+ *
505
+ * @param world - The ECS world
506
+ * @param eid - The entity ID
507
+ * @param lineIndex - Target line index
508
+ * @returns The entity ID for chaining
509
+ */
510
+ declare function scrollToLine(world: World, eid: Entity, lineIndex: number): Entity;
511
+ /**
512
+ * Scrolls by a number of lines.
513
+ *
514
+ * @param world - The ECS world
515
+ * @param eid - The entity ID
516
+ * @param delta - Lines to scroll (positive = down, negative = up)
517
+ * @returns The entity ID for chaining
518
+ */
519
+ declare function scrollByLines(world: World, eid: Entity, delta: number): Entity;
520
+ /**
521
+ * Scrolls by pages.
522
+ *
523
+ * @param world - The ECS world
524
+ * @param eid - The entity ID
525
+ * @param pages - Pages to scroll (positive = down, negative = up)
526
+ * @returns The entity ID for chaining
527
+ */
528
+ declare function scrollByPages(world: World, eid: Entity, pages: number): Entity;
529
+ /**
530
+ * Scrolls to the top.
531
+ *
532
+ * @param world - The ECS world
533
+ * @param eid - The entity ID
534
+ * @returns The entity ID for chaining
535
+ */
536
+ declare function scrollToTop(world: World, eid: Entity): Entity;
537
+ /**
538
+ * Scrolls to the bottom.
539
+ *
540
+ * @param world - The ECS world
541
+ * @param eid - The entity ID
542
+ * @returns The entity ID for chaining
543
+ */
544
+ declare function scrollToBottom(world: World, eid: Entity): Entity;
545
+ /**
546
+ * Gets scroll information.
547
+ *
548
+ * @param world - The ECS world
549
+ * @param eid - The entity ID
550
+ * @returns Scroll info or undefined if no component
551
+ */
552
+ declare function getScrollInfo(world: World, eid: Entity): ScrollInfo | undefined;
553
+ /**
554
+ * Updates the total line count (when content changes).
555
+ *
556
+ * @param world - The ECS world
557
+ * @param eid - The entity ID
558
+ * @param totalLines - New total line count
559
+ * @returns The entity ID for chaining
560
+ */
561
+ declare function setTotalLineCount(world: World, eid: Entity, totalLines: number): Entity;
562
+ /**
563
+ * Updates the viewport size (when container resizes).
564
+ *
565
+ * @param world - The ECS world
566
+ * @param eid - The entity ID
567
+ * @param visibleLines - New visible line count
568
+ * @returns The entity ID for chaining
569
+ */
570
+ declare function setVisibleLineCount(world: World, eid: Entity, visibleLines: number): Entity;
571
+ /**
572
+ * Sets overscan values.
573
+ *
574
+ * @param world - The ECS world
575
+ * @param eid - The entity ID
576
+ * @param before - Lines to render before viewport
577
+ * @param after - Lines to render after viewport
578
+ * @returns The entity ID for chaining
579
+ */
580
+ declare function setOverscan(world: World, eid: Entity, before: number, after: number): Entity;
581
+ /**
582
+ * Sets the selected line.
583
+ *
584
+ * @param world - The ECS world
585
+ * @param eid - The entity ID
586
+ * @param lineIndex - Selected line (-1 for none)
587
+ * @returns The entity ID for chaining
588
+ */
589
+ declare function setSelectedLine(world: World, eid: Entity, lineIndex: number): Entity;
590
+ /**
591
+ * Gets the selected line.
592
+ *
593
+ * @param world - The ECS world
594
+ * @param eid - The entity ID
595
+ * @returns Selected line index or -1 if none
596
+ */
597
+ declare function getSelectedLine(world: World, eid: Entity): number;
598
+ /**
599
+ * Sets the cursor line (for keyboard navigation).
600
+ *
601
+ * @param world - The ECS world
602
+ * @param eid - The entity ID
603
+ * @param lineIndex - Cursor line (-1 for none)
604
+ * @returns The entity ID for chaining
605
+ */
606
+ declare function setCursorLine(world: World, eid: Entity, lineIndex: number): Entity;
607
+ /**
608
+ * Gets the cursor line.
609
+ *
610
+ * @param world - The ECS world
611
+ * @param eid - The entity ID
612
+ * @returns Cursor line index or -1 if none
613
+ */
614
+ declare function getCursorLine(world: World, eid: Entity): number;
615
+ /**
616
+ * Moves cursor up/down and auto-scrolls to keep it visible.
617
+ *
618
+ * @param world - The ECS world
619
+ * @param eid - The entity ID
620
+ * @param delta - Lines to move (negative = up, positive = down)
621
+ * @returns The entity ID for chaining
622
+ */
623
+ declare function moveCursor(world: World, eid: Entity, delta: number): Entity;
624
+ /**
625
+ * Ensures the cursor is visible, scrolling if needed.
626
+ *
627
+ * @param world - The ECS world
628
+ * @param eid - The entity ID
629
+ * @returns The entity ID for chaining
630
+ */
631
+ declare function ensureCursorVisible(world: World, eid: Entity): Entity;
632
+ /**
633
+ * Checks if viewport needs re-render.
634
+ *
635
+ * @param world - The ECS world
636
+ * @param eid - The entity ID
637
+ * @returns true if dirty
638
+ */
639
+ declare function isViewportDirty(world: World, eid: Entity): boolean;
640
+ /**
641
+ * Clears the dirty flag after rendering.
642
+ *
643
+ * @param world - The ECS world
644
+ * @param eid - The entity ID
645
+ * @returns The entity ID for chaining
646
+ */
647
+ declare function clearViewportDirty(world: World, eid: Entity): Entity;
648
+ /**
649
+ * Forces viewport to be dirty (triggers re-render).
650
+ *
651
+ * @param world - The ECS world
652
+ * @param eid - The entity ID
653
+ * @returns The entity ID for chaining
654
+ */
655
+ declare function invalidateViewport(world: World, eid: Entity): Entity;
656
+
657
+ export { isLineInRenderRange as A, getCursorLine as B, setCursorLine as C, type DimensionValue as D, moveCursor as E, getSelectedLine as F, setSelectedLine as G, setViewportStart as H, setTotalLineCount as I, setVisibleLineCount as J, setOverscan as K, AUTO_DIMENSION as L, type DimensionConstraints as M, Dimensions as N, type DimensionsData as O, type VirtualViewportData as P, type VirtualViewportOptions as Q, VirtualViewportOptionsSchema as R, ScrollInfoSchema as S, type ScrollInfo as T, type VisibleRange as U, VirtualViewport as V, VisibleRangeSchema as W, scrollToBottom as a, scrollToLine as b, scrollToTop as c, setDimensions as d, ensureCursorVisible as e, getResolvedWidth as f, getDimensions as g, hasDimensions as h, getResolvedHeight as i, setConstraints as j, setShrink as k, shouldShrink as l, encodePercentage as m, decodePercentage as n, isPercentage as o, getVirtualViewport as p, hasVirtualViewport as q, setVirtualViewport as r, scrollByLines as s, getScrollInfo as t, getVisibleRange as u, isViewportDirty as v, clearViewportDirty as w, invalidateViewport as x, scrollByPages as y, isLineVisible as z };
@@ -294,4 +294,4 @@ declare function exportLineRange(store: VirtualizedLineStore, startLine: number,
294
294
  */
295
295
  declare function trimToLineCount(store: VirtualizedLineStore, maxLines: number): VirtualizedLineStore;
296
296
 
297
- export { CHUNKED_THRESHOLD as C, LineIndexSchema as L, TrimParamsSchema as T, type VirtualizedLineStore as V, LineRangeParamsSchema as a, type LineStoreStats as b, type LineInfo as c, type LineRange as d, VisibleLinesParamsSchema as e, appendLines as f, appendToStore as g, createEmptyLineStore as h, createLineStore as i, createLineStoreFromLines as j, exportContent as k, exportLineRange as l, getByteSize as m, getLineAtIndex as n, getLineForOffset as o, getLineInfo as p, getLineCount as q, getLineRange as r, getVisibleLines as s, getOffsetForLine as t, getStoreStats as u, isStoreEmpty as v, trimToLineCount as w };
297
+ export { CHUNKED_THRESHOLD as C, LineIndexSchema as L, TrimParamsSchema as T, type VirtualizedLineStore as V, createLineStoreFromLines as a, createEmptyLineStore as b, createLineStore as c, appendToStore as d, appendLines as e, getLineRange as f, getLineAtIndex as g, getLineCount as h, getLineForOffset as i, getOffsetForLine as j, getLineInfo as k, getVisibleLines as l, exportContent as m, exportLineRange as n, getStoreStats as o, getByteSize as p, isStoreEmpty as q, LineRangeParamsSchema as r, type LineStoreStats as s, trimToLineCount as t, type LineInfo as u, type LineRange as v, VisibleLinesParamsSchema as w };