blecsd 0.4.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +169 -147
  2. package/dist/blend-BZDmQFAm.d.ts +1215 -0
  3. package/dist/{border-DGNDfT6T.d.ts → border-Br-Jc027.d.ts} +2 -2
  4. package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
  5. package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
  6. package/dist/chunk-3PGACJB6.js +1 -0
  7. package/dist/{chunk-DNRXW56C.js → chunk-4EV3YS7F.js} +1 -1
  8. package/dist/chunk-4XW4WIPH.js +1 -0
  9. package/dist/chunk-7CLV3LTZ.js +4 -0
  10. package/dist/chunk-7ZFQO3OQ.js +1 -0
  11. package/dist/chunk-AM6IDSXI.js +1 -0
  12. package/dist/chunk-APPZ3YHO.js +0 -0
  13. package/dist/chunk-EHYOVHRL.js +2 -0
  14. package/dist/chunk-EKE2BXPS.js +1 -0
  15. package/dist/chunk-EOFT3PNU.js +1 -0
  16. package/dist/chunk-ESMSDY3P.js +1 -0
  17. package/dist/chunk-FJLSHFCF.js +1 -0
  18. package/dist/chunk-FUW7OD3H.js +1 -0
  19. package/dist/chunk-GIMWA5WA.js +1 -0
  20. package/dist/chunk-GRMSEMU7.js +1 -0
  21. package/dist/chunk-I7AUKTXE.js +1 -0
  22. package/dist/chunk-IXUFU6TE.js +3 -0
  23. package/dist/chunk-JB5KFQPD.js +1 -0
  24. package/dist/chunk-JCLNGU3K.js +1 -0
  25. package/dist/chunk-JN2OGNK3.js +1 -0
  26. package/dist/chunk-JRRJCATR.js +1 -0
  27. package/dist/chunk-JWIVZCKW.js +1 -0
  28. package/dist/chunk-K5UMVDQX.js +1 -0
  29. package/dist/chunk-KYNS3GBJ.js +2 -0
  30. package/dist/chunk-L4FIDOS6.js +1 -0
  31. package/dist/chunk-LIVVHEOU.js +1 -0
  32. package/dist/chunk-LNEISTXM.js +1 -0
  33. package/dist/chunk-M5FXA5FL.js +1 -0
  34. package/dist/chunk-MEJJLDEQ.js +1 -0
  35. package/dist/chunk-NYIMY4UV.js +1 -0
  36. package/dist/chunk-PQZTNWLA.js +1 -0
  37. package/dist/chunk-QS5QXZNJ.js +1 -0
  38. package/dist/chunk-SXOBHRXF.js +2 -0
  39. package/dist/chunk-T2EQLWMN.js +1 -0
  40. package/dist/chunk-T62UPG63.js +4 -0
  41. package/dist/chunk-TPBILYDM.js +10 -0
  42. package/dist/chunk-UWS6FIU5.js +1 -0
  43. package/dist/chunk-W64J7C25.js +4 -0
  44. package/dist/chunk-W6RELN6A.js +1 -0
  45. package/dist/chunk-XYMPBCYW.js +1 -0
  46. package/dist/chunk-ZAJI53SZ.js +1 -0
  47. package/dist/cli/init.js +1 -1
  48. package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
  49. package/dist/components/index.d.ts +7762 -7682
  50. package/dist/components/index.js +5 -1
  51. package/dist/core/index.d.ts +4851 -4261
  52. package/dist/core/index.js +1 -1
  53. package/dist/debug/index.d.ts +310 -84
  54. package/dist/debug/index.js +8 -1
  55. package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-D0SQrEeo.d.ts} +2 -2
  56. package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-d9yVNtj1.d.ts} +22 -2
  57. package/dist/errors/index.js +1 -1
  58. package/dist/{events-9ForpTfM.d.ts → events-CGqK6LGt.d.ts} +2 -2
  59. package/dist/{inputActions-Fyw14_Gm.d.ts → factories-vW7bn_He.d.ts} +21 -786
  60. package/dist/{gameLoop-CSTb7e0L.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
  61. package/dist/index.d.ts +25 -1217
  62. package/dist/index.js +1 -3
  63. package/dist/input/index.d.ts +1 -1
  64. package/dist/input/index.js +1 -1
  65. package/dist/inputStream-BoFAEJ7g.d.ts +1385 -0
  66. package/dist/interactiveSystem-Dtv3xERg.d.ts +2292 -0
  67. package/dist/{keyParser-m7fWto6g.d.ts → keyParser-DReXe2j-.d.ts} +28 -28
  68. package/dist/{mouseParser-B7p5ow7K.d.ts → mouseParser-CTNGolIA.d.ts} +1 -1
  69. package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
  70. package/dist/panelMovement-DSLYdNOL.d.ts +1909 -0
  71. package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
  72. package/dist/positioning-DiUivJXa.d.ts +917 -0
  73. package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
  74. package/dist/{scheduler-DeeZleia.d.ts → scheduler-NbHT3-D2.d.ts} +1 -1
  75. package/dist/schemas/index.d.ts +6 -6
  76. package/dist/schemas/index.js +1 -1
  77. package/dist/style/index.d.ts +851 -0
  78. package/dist/style/index.js +1 -0
  79. package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
  80. package/dist/systems/index.d.ts +786 -1882
  81. package/dist/systems/index.js +1 -1
  82. package/dist/terminal/index.d.ts +5542 -2460
  83. package/dist/terminal/index.js +1 -1
  84. package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
  85. package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
  86. package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
  87. package/dist/testing/index.d.ts +923 -0
  88. package/dist/testing/index.js +7 -0
  89. package/dist/text/index.d.ts +263 -0
  90. package/dist/text/index.js +3 -0
  91. package/dist/textWrap-sY-PZzE7.d.ts +761 -0
  92. package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
  93. package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
  94. package/dist/utils/index.d.ts +829 -782
  95. package/dist/utils/index.js +32 -1
  96. package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
  97. package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
  98. package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
  99. package/dist/widgets/bigText.d.ts +13 -13
  100. package/dist/widgets/bigText.js +1 -1
  101. package/dist/widgets/fonts/index.d.ts +1 -1
  102. package/dist/widgets/fonts/index.js +1 -1
  103. package/dist/widgets/index.d.ts +1620 -910
  104. package/dist/widgets/index.js +24 -1
  105. package/package.json +23 -22
  106. package/dist/3d/index.d.ts +0 -5
  107. package/dist/3d/index.js +0 -1
  108. package/dist/audio/index.d.ts +0 -177
  109. package/dist/audio/index.js +0 -1
  110. package/dist/chunk-25OEBENM.js +0 -3
  111. package/dist/chunk-26STV7ZS.js +0 -1
  112. package/dist/chunk-2NMGUEFC.js +0 -4
  113. package/dist/chunk-35LCBY6P.js +0 -1
  114. package/dist/chunk-4PRDJTCM.js +0 -1
  115. package/dist/chunk-5PELJRUQ.js +0 -1
  116. package/dist/chunk-5VEKHA3B.js +0 -5
  117. package/dist/chunk-6KEM3OS2.js +0 -11
  118. package/dist/chunk-6XWY6GB7.js +0 -1
  119. package/dist/chunk-735KKTP3.js +0 -1
  120. package/dist/chunk-7SWJNDOL.js +0 -26
  121. package/dist/chunk-APKUNIMB.js +0 -1
  122. package/dist/chunk-CJCSZRV6.js +0 -1
  123. package/dist/chunk-DMBMCCLN.js +0 -1
  124. package/dist/chunk-DQTVJITR.js +0 -1
  125. package/dist/chunk-DSKQ5J4R.js +0 -1
  126. package/dist/chunk-E4CJRSND.js +0 -1
  127. package/dist/chunk-EF4DC6IN.js +0 -1
  128. package/dist/chunk-EJAKECSN.js +0 -1
  129. package/dist/chunk-FNQRUMFD.js +0 -1
  130. package/dist/chunk-GJ3RS2VG.js +0 -1
  131. package/dist/chunk-KTVEMB2I.js +0 -1
  132. package/dist/chunk-KYAPE44E.js +0 -8
  133. package/dist/chunk-LI4Y7TBZ.js +0 -1
  134. package/dist/chunk-NHOL4BN6.js +0 -1
  135. package/dist/chunk-NPNUUSIB.js +0 -1
  136. package/dist/chunk-NZ55KBM6.js +0 -1
  137. package/dist/chunk-OFRWGW2G.js +0 -1
  138. package/dist/chunk-OMMJ7B5P.js +0 -1
  139. package/dist/chunk-OMU5BSAS.js +0 -2
  140. package/dist/chunk-P3ZLIQJP.js +0 -1
  141. package/dist/chunk-PWI36BQJ.js +0 -1
  142. package/dist/chunk-QQMUDJ32.js +0 -2
  143. package/dist/chunk-R3ICZOE4.js +0 -1
  144. package/dist/chunk-RZ7FGVI6.js +0 -1
  145. package/dist/chunk-S6WS46FE.js +0 -1
  146. package/dist/chunk-TSARUU56.js +0 -1
  147. package/dist/chunk-WJRVUAZR.js +0 -33
  148. package/dist/chunk-WY5EZOOL.js +0 -1
  149. package/dist/chunk-YY6RZCZH.js +0 -4
  150. package/dist/chunk-ZPGJCHXH.js +0 -1
  151. package/dist/chunk-ZPL2J25N.js +0 -1
  152. package/dist/game/index.d.ts +0 -486
  153. package/dist/game/index.js +0 -1
  154. package/dist/index-DBS5Uefn.d.ts +0 -3156
  155. package/dist/viewport3d-xI33-_wq.d.ts +0 -182
  156. package/dist/virtualViewport-DTSN6jFk.d.ts +0 -1856
@@ -0,0 +1,2292 @@
1
+ import { W as World, E as Entity } from './types-B8LmNkzG.js';
2
+
3
+ /**
4
+ * Content component for text content storage.
5
+ * @module components/content
6
+ */
7
+
8
+ /**
9
+ * Text alignment enumeration.
10
+ */
11
+ declare enum TextAlign {
12
+ Left = 0,
13
+ Center = 1,
14
+ Right = 2
15
+ }
16
+ /**
17
+ * Vertical alignment enumeration.
18
+ */
19
+ declare enum TextVAlign {
20
+ Top = 0,
21
+ Middle = 1,
22
+ Bottom = 2
23
+ }
24
+ /**
25
+ * Content store: functional interface for managing string content.
26
+ * Since bitecs uses typed arrays, strings must be stored separately.
27
+ */
28
+ declare const contentStore: {
29
+ /** Sets content for an entity and returns the content ID. */
30
+ set(_eid: Entity, text: string): number;
31
+ /** Gets content by ID. */
32
+ get(id: number): string;
33
+ /** Deletes content by ID. */
34
+ delete(id: number): void;
35
+ /** Clears all content. */
36
+ clear(): void;
37
+ };
38
+ /**
39
+ * Content component store using SoA (Structure of Arrays) for performance.
40
+ *
41
+ * - `contentId`: Reference to content in ContentStore
42
+ * - `length`: Content length in characters
43
+ * - `hash`: Content hash for change detection
44
+ * - `wrap`: Whether to wrap text (0=no, 1=yes)
45
+ * - `align`: Horizontal text alignment
46
+ * - `valign`: Vertical text alignment
47
+ * - `parseTags`: Whether to parse markup tags (0=no, 1=yes)
48
+ * - `tabSize`: Tab character width in spaces (default: 8)
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * import { Content, setContent, getContent, TextAlign } from 'blecsd';
53
+ *
54
+ * setContent(world, entity, 'Hello, World!', { align: TextAlign.Center });
55
+ * const text = getContent(world, entity);
56
+ * console.log(text); // 'Hello, World!'
57
+ * ```
58
+ */
59
+ declare const Content: {
60
+ /** Reference to content store */
61
+ contentId: Uint32Array<ArrayBuffer>;
62
+ /** Content length in characters */
63
+ length: Uint32Array<ArrayBuffer>;
64
+ /** Content hash for change detection */
65
+ hash: Uint32Array<ArrayBuffer>;
66
+ /** Text wrap (0=no, 1=yes) */
67
+ wrap: Uint8Array<ArrayBuffer>;
68
+ /** Horizontal alignment (0=left, 1=center, 2=right) */
69
+ align: Uint8Array<ArrayBuffer>;
70
+ /** Vertical alignment (0=top, 1=middle, 2=bottom) */
71
+ valign: Uint8Array<ArrayBuffer>;
72
+ /** Parse markup tags (0=no, 1=yes) */
73
+ parseTags: Uint8Array<ArrayBuffer>;
74
+ /** Tab character width in spaces (default: 8) */
75
+ tabSize: Uint8Array<ArrayBuffer>;
76
+ };
77
+ /**
78
+ * Content configuration options.
79
+ */
80
+ interface ContentOptions {
81
+ /** Whether to wrap text */
82
+ wrap?: boolean;
83
+ /** Horizontal text alignment */
84
+ align?: TextAlign;
85
+ /** Vertical text alignment */
86
+ valign?: TextVAlign;
87
+ /** Whether to parse markup tags */
88
+ parseTags?: boolean;
89
+ /** Tab character width in spaces (1-16, default: 8) */
90
+ tabSize?: number;
91
+ }
92
+ /**
93
+ * Content data returned by getContentData.
94
+ */
95
+ interface ContentData {
96
+ readonly text: string;
97
+ readonly length: number;
98
+ readonly hash: number;
99
+ readonly wrap: boolean;
100
+ readonly align: TextAlign;
101
+ readonly valign: TextVAlign;
102
+ readonly parseTags: boolean;
103
+ readonly tabSize: number;
104
+ }
105
+ /**
106
+ * Sets the text content of an entity.
107
+ * Adds the Content component if not already present.
108
+ *
109
+ * @param world - The ECS world
110
+ * @param eid - The entity ID
111
+ * @param text - The text content
112
+ * @param options - Optional content configuration
113
+ * @returns The entity ID for chaining
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * import { createWorld, addEntity } from '../core/ecs';
118
+ * import { setContent, TextAlign } from 'blecsd';
119
+ *
120
+ * const world = createWorld();
121
+ * const entity = addEntity(world);
122
+ *
123
+ * // Set content with options
124
+ * setContent(world, entity, 'Hello, World!', {
125
+ * align: TextAlign.Center,
126
+ * wrap: true,
127
+ * });
128
+ *
129
+ * // Simple text content
130
+ * setContent(world, entity, 'Plain text');
131
+ * ```
132
+ */
133
+ declare function setContent(world: World, eid: Entity, text: string, options?: ContentOptions): Entity;
134
+ /**
135
+ * Gets the text content of an entity.
136
+ * Returns empty string if no Content component.
137
+ *
138
+ * @param world - The ECS world
139
+ * @param eid - The entity ID
140
+ * @returns The text content or empty string
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * import { getContent } from 'blecsd';
145
+ *
146
+ * const text = getContent(world, entity);
147
+ * console.log(text);
148
+ * ```
149
+ */
150
+ declare function getContent(world: World, eid: Entity): string;
151
+ /**
152
+ * Gets the full content data of an entity.
153
+ * Returns undefined if no Content component.
154
+ *
155
+ * @param world - The ECS world
156
+ * @param eid - The entity ID
157
+ * @returns Content data or undefined
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * import { getContentData, TextAlign } from 'blecsd';
162
+ *
163
+ * const data = getContentData(world, entity);
164
+ * if (data) {
165
+ * console.log(`Text: ${data.text}, Align: ${data.align}`);
166
+ * }
167
+ * ```
168
+ */
169
+ declare function getContentData(world: World, eid: Entity): ContentData | undefined;
170
+ /**
171
+ * Sets the text content of an entity, stripping any ANSI escape codes.
172
+ * Use this when you want to set plain text without formatting codes.
173
+ *
174
+ * @param world - The ECS world
175
+ * @param eid - The entity ID
176
+ * @param text - The text to set (ANSI codes will be stripped)
177
+ * @param options - Optional content options
178
+ * @returns The entity ID for chaining
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * import { setText, getText } from 'blecsd';
183
+ *
184
+ * // ANSI codes are stripped
185
+ * setText(world, entity, '\x1b[31mRed Text\x1b[0m');
186
+ * console.log(getText(world, entity)); // 'Red Text'
187
+ * ```
188
+ */
189
+ declare function setText(world: World, eid: Entity, text: string, options?: ContentOptions): Entity;
190
+ /**
191
+ * Gets the text content of an entity with ANSI codes stripped.
192
+ * Returns empty string if no Content component.
193
+ *
194
+ * @param world - The ECS world
195
+ * @param eid - The entity ID
196
+ * @returns The plain text content without ANSI codes
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * import { setContent, getText } from 'blecsd';
201
+ *
202
+ * // Content may contain ANSI codes
203
+ * setContent(world, entity, '\x1b[31mRed\x1b[0m');
204
+ * console.log(getText(world, entity)); // 'Red'
205
+ * ```
206
+ */
207
+ declare function getText(world: World, eid: Entity): string;
208
+ /**
209
+ * Appends text to an entity's content.
210
+ * Adds the Content component if not already present.
211
+ *
212
+ * @param world - The ECS world
213
+ * @param eid - The entity ID
214
+ * @param text - The text to append
215
+ * @returns The entity ID for chaining
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * import { setContent, appendContent } from 'blecsd';
220
+ *
221
+ * setContent(world, entity, 'Hello');
222
+ * appendContent(world, entity, ', World!');
223
+ * // Content is now 'Hello, World!'
224
+ * ```
225
+ */
226
+ declare function appendContent(world: World, eid: Entity, text: string): Entity;
227
+ /**
228
+ * Clears the content of an entity.
229
+ * Removes the content from the store but keeps the component.
230
+ *
231
+ * @param world - The ECS world
232
+ * @param eid - The entity ID
233
+ * @returns The entity ID for chaining
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * import { clearContent } from 'blecsd';
238
+ *
239
+ * clearContent(world, entity);
240
+ * ```
241
+ */
242
+ declare function clearContent(world: World, eid: Entity): Entity;
243
+ /**
244
+ * Checks if an entity has a Content component.
245
+ *
246
+ * @param world - The ECS world
247
+ * @param eid - The entity ID
248
+ * @returns true if entity has Content component
249
+ */
250
+ declare function hasContent(world: World, eid: Entity): boolean;
251
+ /**
252
+ * Gets the content length of an entity.
253
+ *
254
+ * @param world - The ECS world
255
+ * @param eid - The entity ID
256
+ * @returns Content length or 0 if no Content component
257
+ */
258
+ declare function getContentLength(world: World, eid: Entity): number;
259
+ /**
260
+ * Gets the content hash of an entity.
261
+ * Useful for change detection.
262
+ *
263
+ * @param world - The ECS world
264
+ * @param eid - The entity ID
265
+ * @returns Content hash or 0 if no Content component
266
+ */
267
+ declare function getContentHash(world: World, eid: Entity): number;
268
+ /**
269
+ * Sets the text alignment of an entity.
270
+ *
271
+ * @param world - The ECS world
272
+ * @param eid - The entity ID
273
+ * @param align - Horizontal alignment
274
+ * @returns The entity ID for chaining
275
+ */
276
+ declare function setTextAlign(world: World, eid: Entity, align: TextAlign): Entity;
277
+ /**
278
+ * Sets the vertical alignment of an entity.
279
+ *
280
+ * @param world - The ECS world
281
+ * @param eid - The entity ID
282
+ * @param valign - Vertical alignment
283
+ * @returns The entity ID for chaining
284
+ */
285
+ declare function setTextVAlign(world: World, eid: Entity, valign: TextVAlign): Entity;
286
+ /**
287
+ * Sets the text wrap setting of an entity.
288
+ *
289
+ * @param world - The ECS world
290
+ * @param eid - The entity ID
291
+ * @param wrap - Whether to wrap text
292
+ * @returns The entity ID for chaining
293
+ */
294
+ declare function setTextWrap(world: World, eid: Entity, wrap: boolean): Entity;
295
+ /**
296
+ * Checks if text wrapping is enabled for an entity.
297
+ *
298
+ * @param world - The ECS world
299
+ * @param eid - The entity ID
300
+ * @returns true if text wrapping is enabled
301
+ */
302
+ declare function isTextWrapped(world: World, eid: Entity): boolean;
303
+ /**
304
+ * Sets whether to parse markup tags in content.
305
+ *
306
+ * @param world - The ECS world
307
+ * @param eid - The entity ID
308
+ * @param parse - Whether to parse tags
309
+ * @returns The entity ID for chaining
310
+ */
311
+ declare function setParseTags(world: World, eid: Entity, parse: boolean): Entity;
312
+ /**
313
+ * Checks if tag parsing is enabled for an entity.
314
+ *
315
+ * @param world - The ECS world
316
+ * @param eid - The entity ID
317
+ * @returns true if tag parsing is enabled
318
+ */
319
+ declare function isParsingTags(world: World, eid: Entity): boolean;
320
+ /**
321
+ * Resets the content store. Useful for testing.
322
+ * @internal
323
+ */
324
+ declare function resetContentStore(): void;
325
+
326
+ /**
327
+ * Focusable component for focus management.
328
+ * @module components/focusable
329
+ */
330
+
331
+ /** Default focus effect foreground color (white) */
332
+ declare const DEFAULT_FOCUS_FG = 4294967295;
333
+ /** Default focus effect background color (transparent) */
334
+ declare const DEFAULT_FOCUS_BG = 0;
335
+ /**
336
+ * Focusable component store using SoA (Structure of Arrays) for performance.
337
+ *
338
+ * - `focusable`: Whether entity can receive focus (0=no, 1=yes)
339
+ * - `focused`: Whether entity currently has focus (0=no, 1=yes)
340
+ * - `tabIndex`: Tab order (-1 = not in tab order, 0+ = order)
341
+ * - `focusEffectFg`, `focusEffectBg`: Colors for focus effect
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * import { Focusable, setFocusable, focus, blur, isFocused } from 'blecsd';
346
+ *
347
+ * setFocusable(world, entity, true);
348
+ * focus(world, entity);
349
+ *
350
+ * if (isFocused(world, entity)) {
351
+ * console.log('Entity has focus');
352
+ * }
353
+ * ```
354
+ */
355
+ declare const Focusable: {
356
+ /** Whether entity can receive focus (0=no, 1=yes) */
357
+ focusable: Uint8Array<ArrayBuffer>;
358
+ /** Whether entity currently has focus (0=no, 1=yes) */
359
+ focused: Uint8Array<ArrayBuffer>;
360
+ /** Tab order (-1 = not in tab order) */
361
+ tabIndex: Int16Array<ArrayBuffer>;
362
+ /** Focus effect foreground color */
363
+ focusEffectFg: Uint32Array<ArrayBuffer>;
364
+ /** Focus effect background color */
365
+ focusEffectBg: Uint32Array<ArrayBuffer>;
366
+ };
367
+ /**
368
+ * Focusable configuration options.
369
+ */
370
+ interface FocusableOptions {
371
+ /** Whether entity can receive focus */
372
+ focusable?: boolean;
373
+ /** Tab order (-1 = not in tab order) */
374
+ tabIndex?: number;
375
+ /** Focus effect foreground color */
376
+ focusEffectFg?: number;
377
+ /** Focus effect background color */
378
+ focusEffectBg?: number;
379
+ }
380
+ /**
381
+ * Focus data returned by getFocusable.
382
+ */
383
+ interface FocusableData {
384
+ readonly focusable: boolean;
385
+ readonly focused: boolean;
386
+ readonly tabIndex: number;
387
+ readonly focusEffectFg: number;
388
+ readonly focusEffectBg: number;
389
+ }
390
+ /**
391
+ * Makes an entity focusable with the given options.
392
+ * Adds the Focusable component if not already present.
393
+ *
394
+ * @param world - The ECS world
395
+ * @param eid - The entity ID
396
+ * @param options - Focusable configuration options
397
+ * @returns The entity ID for chaining
398
+ *
399
+ * @example
400
+ * ```typescript
401
+ * import { createWorld, addEntity } from '../core/ecs';
402
+ * import { setFocusable } from 'blecsd';
403
+ *
404
+ * const world = createWorld();
405
+ * const entity = addEntity(world);
406
+ *
407
+ * setFocusable(world, entity, { focusable: true, tabIndex: 1 });
408
+ * ```
409
+ */
410
+ declare function setFocusable(world: World, eid: Entity, options: FocusableOptions): Entity;
411
+ /**
412
+ * Makes an entity focusable (simple boolean setter).
413
+ * Adds the Focusable component if not already present.
414
+ *
415
+ * @param world - The ECS world
416
+ * @param eid - The entity ID
417
+ * @param focusable - Whether entity can receive focus
418
+ * @returns The entity ID for chaining
419
+ */
420
+ declare function makeFocusable(world: World, eid: Entity, focusable: boolean): Entity;
421
+ /**
422
+ * Checks if an entity is currently focused.
423
+ *
424
+ * @param world - The ECS world
425
+ * @param eid - The entity ID
426
+ * @returns true if entity has focus
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * import { isFocused } from 'blecsd';
431
+ *
432
+ * if (isFocused(world, entity)) {
433
+ * // Handle focused state
434
+ * }
435
+ * ```
436
+ */
437
+ declare function isFocused(world: World, eid: Entity): boolean;
438
+ /**
439
+ * Checks if an entity can receive focus.
440
+ *
441
+ * @param world - The ECS world
442
+ * @param eid - The entity ID
443
+ * @returns true if entity can receive focus
444
+ */
445
+ declare function isFocusable(world: World, eid: Entity): boolean;
446
+ /**
447
+ * Focuses an entity, unfocusing any previously focused entity.
448
+ * Only works if the entity is focusable.
449
+ *
450
+ * @param world - The ECS world
451
+ * @param eid - The entity ID
452
+ * @returns The entity ID for chaining
453
+ *
454
+ * @example
455
+ * ```typescript
456
+ * import { focus } from 'blecsd';
457
+ *
458
+ * focus(world, entity); // Entity now has focus
459
+ * ```
460
+ */
461
+ declare function focus(world: World, eid: Entity): Entity;
462
+ /**
463
+ * Removes focus from an entity.
464
+ *
465
+ * @param world - The ECS world
466
+ * @param eid - The entity ID
467
+ * @returns The entity ID for chaining
468
+ *
469
+ * @example
470
+ * ```typescript
471
+ * import { blur } from 'blecsd';
472
+ *
473
+ * blur(world, entity); // Entity loses focus
474
+ * ```
475
+ */
476
+ declare function blur(world: World, eid: Entity): Entity;
477
+ /**
478
+ * Gets the focus data of an entity.
479
+ * Returns undefined if no Focusable component.
480
+ *
481
+ * @param world - The ECS world
482
+ * @param eid - The entity ID
483
+ * @returns Focusable data or undefined
484
+ */
485
+ declare function getFocusable(world: World, eid: Entity): FocusableData | undefined;
486
+ /**
487
+ * Checks if an entity has a Focusable component.
488
+ *
489
+ * @param world - The ECS world
490
+ * @param eid - The entity ID
491
+ * @returns true if entity has Focusable component
492
+ */
493
+ declare function hasFocusable(world: World, eid: Entity): boolean;
494
+ /**
495
+ * Gets the currently focused entity.
496
+ *
497
+ * @returns The focused entity or null if none
498
+ */
499
+ declare function getFocusedEntity(): Entity | null;
500
+ /**
501
+ * Sets the tab index of an entity.
502
+ *
503
+ * @param world - The ECS world
504
+ * @param eid - The entity ID
505
+ * @param index - Tab index (-1 = not in tab order)
506
+ * @returns The entity ID for chaining
507
+ */
508
+ declare function setTabIndex(world: World, eid: Entity, index: number): Entity;
509
+ /**
510
+ * Gets the tab index of an entity.
511
+ *
512
+ * @param world - The ECS world
513
+ * @param eid - The entity ID
514
+ * @returns Tab index or -1 if not in tab order
515
+ */
516
+ declare function getTabIndex(world: World, eid: Entity): number;
517
+ /**
518
+ * Checks if an entity is in the tab order.
519
+ *
520
+ * @param world - The ECS world
521
+ * @param eid - The entity ID
522
+ * @returns true if entity is in tab order
523
+ */
524
+ declare function isInTabOrder(world: World, eid: Entity): boolean;
525
+ /**
526
+ * Gets entities in tab order.
527
+ * Returns entities sorted by tabIndex (ascending).
528
+ *
529
+ * @param world - The ECS world
530
+ * @param entities - Array of entities to consider
531
+ * @returns Sorted array of entities in tab order
532
+ *
533
+ * @example
534
+ * ```typescript
535
+ * import { getTabOrder } from 'blecsd';
536
+ *
537
+ * const orderedEntities = getTabOrder(world, allEntities);
538
+ * for (const eid of orderedEntities) {
539
+ * // Process in tab order
540
+ * }
541
+ * ```
542
+ */
543
+ declare function getTabOrder(world: World, entities: Entity[]): Entity[];
544
+ /**
545
+ * Focuses the next entity in tab order.
546
+ *
547
+ * @param world - The ECS world
548
+ * @param entities - Array of entities in the focusable set
549
+ * @returns The newly focused entity or null if none
550
+ */
551
+ declare function focusNext(world: World, entities: Entity[]): Entity | null;
552
+ /**
553
+ * Focuses the previous entity in tab order.
554
+ *
555
+ * @param world - The ECS world
556
+ * @param entities - Array of entities in the focusable set
557
+ * @returns The newly focused entity or null if none
558
+ */
559
+ declare function focusPrev(world: World, entities: Entity[]): Entity | null;
560
+ /**
561
+ * Resets the focus state. Useful for testing.
562
+ * @internal
563
+ */
564
+ declare function resetFocusState(): void;
565
+
566
+ /**
567
+ * Hierarchy component for parent/child entity relationships.
568
+ * Uses a linked list structure for efficient traversal.
569
+ * @module components/hierarchy
570
+ */
571
+
572
+ /** Null entity value (no parent/child/sibling) */
573
+ declare const NULL_ENTITY = 0;
574
+ /**
575
+ * Hierarchy component store using SoA (Structure of Arrays) for performance.
576
+ *
577
+ * Uses a doubly-linked list for siblings and parent pointers for tree structure:
578
+ * - `parent`: Parent entity ID (0 = no parent, root level)
579
+ * - `firstChild`: First child entity in the children list
580
+ * - `nextSibling`: Next sibling in the parent's children list
581
+ * - `prevSibling`: Previous sibling in the parent's children list
582
+ * - `childCount`: Number of direct children
583
+ * - `depth`: Tree depth (0 = root level)
584
+ *
585
+ * @example
586
+ * ```typescript
587
+ * import { Hierarchy, appendChild, getChildren } from 'blecsd';
588
+ *
589
+ * appendChild(world, parent, child1);
590
+ * appendChild(world, parent, child2);
591
+ *
592
+ * const children = getChildren(world, parent);
593
+ * console.log(children); // [child1, child2]
594
+ * ```
595
+ */
596
+ declare const Hierarchy: {
597
+ /** Parent entity ID (0 = no parent) */
598
+ parent: Uint32Array<ArrayBuffer>;
599
+ /** First child entity */
600
+ firstChild: Uint32Array<ArrayBuffer>;
601
+ /** Next sibling entity */
602
+ nextSibling: Uint32Array<ArrayBuffer>;
603
+ /** Previous sibling entity */
604
+ prevSibling: Uint32Array<ArrayBuffer>;
605
+ /** Number of children */
606
+ childCount: Uint16Array<ArrayBuffer>;
607
+ /** Tree depth (0 = root) */
608
+ depth: Uint16Array<ArrayBuffer>;
609
+ };
610
+ /**
611
+ * Hierarchy data returned by getHierarchy.
612
+ */
613
+ interface HierarchyData {
614
+ readonly parent: Entity;
615
+ readonly firstChild: Entity;
616
+ readonly nextSibling: Entity;
617
+ readonly prevSibling: Entity;
618
+ readonly childCount: number;
619
+ readonly depth: number;
620
+ }
621
+ /**
622
+ * Sets the parent of an entity, removing it from any current parent.
623
+ *
624
+ * @param world - The ECS world
625
+ * @param child - The child entity
626
+ * @param parent - The new parent entity (0 or NULL_ENTITY for no parent)
627
+ * @returns The child entity for chaining
628
+ *
629
+ * @example
630
+ * ```typescript
631
+ * import { setParent } from 'blecsd';
632
+ *
633
+ * setParent(world, child, parent);
634
+ * setParent(world, child, 0); // Make orphan
635
+ * ```
636
+ */
637
+ declare function setParent(world: World, child: Entity, parent: Entity): Entity;
638
+ /**
639
+ * Appends a child to a parent entity.
640
+ *
641
+ * @param world - The ECS world
642
+ * @param parent - The parent entity
643
+ * @param child - The child entity to append
644
+ * @returns The parent entity for chaining
645
+ *
646
+ * @example
647
+ * ```typescript
648
+ * import { appendChild } from 'blecsd';
649
+ *
650
+ * appendChild(world, parent, child1);
651
+ * appendChild(world, parent, child2);
652
+ * ```
653
+ */
654
+ declare function appendChild(world: World, parent: Entity, child: Entity): Entity;
655
+ /**
656
+ * Removes a child from a parent entity.
657
+ *
658
+ * @param world - The ECS world
659
+ * @param parent - The parent entity
660
+ * @param child - The child entity to remove
661
+ * @returns The parent entity for chaining
662
+ *
663
+ * @example
664
+ * ```typescript
665
+ * import { removeChild } from 'blecsd';
666
+ *
667
+ * removeChild(world, parent, child);
668
+ * ```
669
+ */
670
+ declare function removeChild(world: World, parent: Entity, child: Entity): Entity;
671
+ /**
672
+ * Gets all direct children of an entity.
673
+ *
674
+ * @param world - The ECS world
675
+ * @param parent - The parent entity
676
+ * @returns Array of child entities
677
+ *
678
+ * @example
679
+ * ```typescript
680
+ * import { getChildren } from 'blecsd';
681
+ *
682
+ * const children = getChildren(world, parent);
683
+ * for (const child of children) {
684
+ * // Process child
685
+ * }
686
+ * ```
687
+ */
688
+ declare function getChildren(world: World, parent: Entity): Entity[];
689
+ /**
690
+ * Gets all ancestors of an entity (parent, grandparent, etc.).
691
+ *
692
+ * @param world - The ECS world
693
+ * @param eid - The entity
694
+ * @returns Array of ancestor entities (immediate parent first)
695
+ *
696
+ * @example
697
+ * ```typescript
698
+ * import { getAncestors } from 'blecsd';
699
+ *
700
+ * const ancestors = getAncestors(world, entity);
701
+ * const parent = ancestors[0];
702
+ * const grandparent = ancestors[1];
703
+ * ```
704
+ */
705
+ declare function getAncestors(world: World, eid: Entity): Entity[];
706
+ /**
707
+ * Gets all descendants of an entity (children, grandchildren, etc.).
708
+ *
709
+ * @param world - The ECS world
710
+ * @param eid - The entity
711
+ * @returns Array of descendant entities (depth-first order)
712
+ *
713
+ * @example
714
+ * ```typescript
715
+ * import { getDescendants } from 'blecsd';
716
+ *
717
+ * const descendants = getDescendants(world, entity);
718
+ * for (const desc of descendants) {
719
+ * // Process descendant
720
+ * }
721
+ * ```
722
+ */
723
+ declare function getDescendants(world: World, eid: Entity): Entity[];
724
+ /**
725
+ * Gets the parent of an entity.
726
+ *
727
+ * @param world - The ECS world
728
+ * @param eid - The entity
729
+ * @returns Parent entity or NULL_ENTITY if no parent
730
+ *
731
+ * @example
732
+ * ```typescript
733
+ * import { getParent, NULL_ENTITY } from 'blecsd';
734
+ *
735
+ * const parent = getParent(world, entity);
736
+ * if (parent !== NULL_ENTITY) {
737
+ * // Has a parent
738
+ * }
739
+ * ```
740
+ */
741
+ declare function getParent(world: World, eid: Entity): Entity;
742
+ /**
743
+ * Gets the hierarchy data of an entity.
744
+ *
745
+ * @param world - The ECS world
746
+ * @param eid - The entity
747
+ * @returns Hierarchy data or undefined if no Hierarchy component
748
+ */
749
+ declare function getHierarchy(world: World, eid: Entity): HierarchyData | undefined;
750
+ /**
751
+ * Checks if an entity has a Hierarchy component.
752
+ *
753
+ * @param world - The ECS world
754
+ * @param eid - The entity
755
+ * @returns true if entity has Hierarchy component
756
+ */
757
+ declare function hasHierarchy(world: World, eid: Entity): boolean;
758
+ /**
759
+ * Checks if an entity is a root (has no parent).
760
+ *
761
+ * @param world - The ECS world
762
+ * @param eid - The entity
763
+ * @returns true if entity has no parent
764
+ */
765
+ declare function isRoot(world: World, eid: Entity): boolean;
766
+ /**
767
+ * Checks if an entity is a leaf (has no children).
768
+ *
769
+ * @param world - The ECS world
770
+ * @param eid - The entity
771
+ * @returns true if entity has no children
772
+ */
773
+ declare function isLeaf(world: World, eid: Entity): boolean;
774
+ /**
775
+ * Gets the depth of an entity in the tree.
776
+ *
777
+ * @param world - The ECS world
778
+ * @param eid - The entity
779
+ * @returns Tree depth (0 = root level)
780
+ */
781
+ declare function getDepth(world: World, eid: Entity): number;
782
+ /**
783
+ * Gets the next sibling of an entity.
784
+ *
785
+ * @param world - The ECS world
786
+ * @param eid - The entity
787
+ * @returns Next sibling entity or NULL_ENTITY
788
+ */
789
+ declare function getNextSibling(world: World, eid: Entity): Entity;
790
+ /**
791
+ * Gets the previous sibling of an entity.
792
+ *
793
+ * @param world - The ECS world
794
+ * @param eid - The entity
795
+ * @returns Previous sibling entity or NULL_ENTITY
796
+ */
797
+ declare function getPrevSibling(world: World, eid: Entity): Entity;
798
+ /**
799
+ * Prepends a child to a parent entity (inserts at the beginning).
800
+ *
801
+ * @param world - The ECS world
802
+ * @param parent - The parent entity
803
+ * @param child - The child entity to prepend
804
+ * @returns The parent entity for chaining
805
+ *
806
+ * @example
807
+ * ```typescript
808
+ * import { prepend, getChildren } from 'blecsd';
809
+ *
810
+ * appendChild(world, parent, child2);
811
+ * prepend(world, parent, child1);
812
+ * getChildren(world, parent); // [child1, child2]
813
+ * ```
814
+ */
815
+ declare function prepend(world: World, parent: Entity, child: Entity): Entity;
816
+ /**
817
+ * Inserts a child at a specific index in the parent's children list.
818
+ *
819
+ * @param world - The ECS world
820
+ * @param parent - The parent entity
821
+ * @param child - The child entity to insert
822
+ * @param index - The index to insert at (0 = first, negative counts from end)
823
+ * @returns The parent entity for chaining
824
+ *
825
+ * @example
826
+ * ```typescript
827
+ * import { insertAt, getChildren } from 'blecsd';
828
+ *
829
+ * appendChild(world, parent, child1);
830
+ * appendChild(world, parent, child3);
831
+ * insertAt(world, parent, child2, 1);
832
+ * getChildren(world, parent); // [child1, child2, child3]
833
+ * ```
834
+ */
835
+ declare function insertAt(world: World, parent: Entity, child: Entity, index: number): Entity;
836
+ /**
837
+ * Inserts a child before a sibling entity.
838
+ *
839
+ * @param world - The ECS world
840
+ * @param child - The child entity to insert
841
+ * @param sibling - The sibling to insert before
842
+ * @returns The child entity for chaining
843
+ *
844
+ * @example
845
+ * ```typescript
846
+ * import { insertBefore, getChildren } from 'blecsd';
847
+ *
848
+ * appendChild(world, parent, child1);
849
+ * appendChild(world, parent, child3);
850
+ * insertBefore(world, child2, child3);
851
+ * getChildren(world, parent); // [child1, child2, child3]
852
+ * ```
853
+ */
854
+ declare function insertBefore(world: World, child: Entity, sibling: Entity): Entity;
855
+ /**
856
+ * Inserts a child after a sibling entity.
857
+ *
858
+ * @param world - The ECS world
859
+ * @param child - The child entity to insert
860
+ * @param sibling - The sibling to insert after
861
+ * @returns The child entity for chaining
862
+ *
863
+ * @example
864
+ * ```typescript
865
+ * import { insertAfter, getChildren } from 'blecsd';
866
+ *
867
+ * appendChild(world, parent, child1);
868
+ * appendChild(world, parent, child3);
869
+ * insertAfter(world, child2, child1);
870
+ * getChildren(world, parent); // [child1, child2, child3]
871
+ * ```
872
+ */
873
+ declare function insertAfter(world: World, child: Entity, sibling: Entity): Entity;
874
+ /**
875
+ * Detaches an entity from its parent.
876
+ * Convenience method equivalent to setParent(world, eid, NULL_ENTITY).
877
+ *
878
+ * @param world - The ECS world
879
+ * @param eid - The entity to detach
880
+ * @returns The entity for chaining
881
+ *
882
+ * @example
883
+ * ```typescript
884
+ * import { detach, getParent, NULL_ENTITY } from 'blecsd';
885
+ *
886
+ * appendChild(world, parent, child);
887
+ * detach(world, child);
888
+ * getParent(world, child); // NULL_ENTITY
889
+ * ```
890
+ */
891
+ declare function detach(world: World, eid: Entity): Entity;
892
+ /**
893
+ * Gets the last child of an entity.
894
+ *
895
+ * @param world - The ECS world
896
+ * @param parent - The parent entity
897
+ * @returns Last child entity or NULL_ENTITY
898
+ *
899
+ * @example
900
+ * ```typescript
901
+ * import { getLastChild, NULL_ENTITY } from 'blecsd';
902
+ *
903
+ * const lastChild = getLastChild(world, parent);
904
+ * if (lastChild !== NULL_ENTITY) {
905
+ * // Process last child
906
+ * }
907
+ * ```
908
+ */
909
+ declare function getLastChild(world: World, parent: Entity): Entity;
910
+ /**
911
+ * Gets the first child of an entity.
912
+ *
913
+ * @param world - The ECS world
914
+ * @param parent - The parent entity
915
+ * @returns First child entity or NULL_ENTITY
916
+ *
917
+ * @example
918
+ * ```typescript
919
+ * import { getFirstChild, NULL_ENTITY } from 'blecsd';
920
+ *
921
+ * const firstChild = getFirstChild(world, parent);
922
+ * if (firstChild !== NULL_ENTITY) {
923
+ * // Process first child
924
+ * }
925
+ * ```
926
+ */
927
+ declare function getFirstChild(world: World, parent: Entity): Entity;
928
+ /**
929
+ * Gets the index of a child within its parent's children list.
930
+ *
931
+ * @param world - The ECS world
932
+ * @param child - The child entity
933
+ * @returns Index (0-based) or -1 if not a child
934
+ *
935
+ * @example
936
+ * ```typescript
937
+ * import { getChildIndex } from 'blecsd';
938
+ *
939
+ * appendChild(world, parent, child1);
940
+ * appendChild(world, parent, child2);
941
+ * getChildIndex(world, child1); // 0
942
+ * getChildIndex(world, child2); // 1
943
+ * ```
944
+ */
945
+ declare function getChildIndex(world: World, child: Entity): number;
946
+ /**
947
+ * Gets a child at a specific index.
948
+ *
949
+ * @param world - The ECS world
950
+ * @param parent - The parent entity
951
+ * @param index - The index (0-based)
952
+ * @returns Child entity or NULL_ENTITY if out of bounds
953
+ *
954
+ * @example
955
+ * ```typescript
956
+ * import { getChildAt, NULL_ENTITY } from 'blecsd';
957
+ *
958
+ * appendChild(world, parent, child1);
959
+ * appendChild(world, parent, child2);
960
+ * getChildAt(world, parent, 0); // child1
961
+ * getChildAt(world, parent, 1); // child2
962
+ * getChildAt(world, parent, 5); // NULL_ENTITY
963
+ * ```
964
+ */
965
+ declare function getChildAt(world: World, parent: Entity, index: number): Entity;
966
+ /**
967
+ * Callback function for tree traversal.
968
+ * Return `false` to stop traversal early.
969
+ */
970
+ type TraversalCallback = (entity: Entity, depth: number) => boolean | undefined;
971
+ /**
972
+ * Iterates over all descendants of an entity, calling a callback for each.
973
+ * Uses depth-first traversal order.
974
+ *
975
+ * @param world - The ECS world
976
+ * @param eid - The root entity (not included in iteration)
977
+ * @param callback - Function called for each descendant. Return false to stop.
978
+ * @returns true if traversal completed, false if stopped early
979
+ *
980
+ * @example
981
+ * ```typescript
982
+ * import { forDescendants } from 'blecsd';
983
+ *
984
+ * // Process all descendants
985
+ * forDescendants(world, root, (entity, depth) => {
986
+ * console.log(`Entity ${entity} at depth ${depth}`);
987
+ * });
988
+ *
989
+ * // Stop early when condition met
990
+ * forDescendants(world, root, (entity) => {
991
+ * if (entity === target) return false; // stop
992
+ * });
993
+ * ```
994
+ */
995
+ declare function forDescendants(world: World, eid: Entity, callback: TraversalCallback): boolean;
996
+ /**
997
+ * Iterates over all ancestors of an entity, calling a callback for each.
998
+ * Starts with the immediate parent and works up to the root.
999
+ *
1000
+ * @param world - The ECS world
1001
+ * @param eid - The starting entity (not included in iteration)
1002
+ * @param callback - Function called for each ancestor. Return false to stop.
1003
+ * @returns true if traversal completed, false if stopped early
1004
+ *
1005
+ * @example
1006
+ * ```typescript
1007
+ * import { forAncestors } from 'blecsd';
1008
+ *
1009
+ * // Process all ancestors
1010
+ * forAncestors(world, entity, (ancestor, level) => {
1011
+ * console.log(`Ancestor ${ancestor} at level ${level}`);
1012
+ * });
1013
+ *
1014
+ * // Find first ancestor matching condition
1015
+ * let found: Entity | null = null;
1016
+ * forAncestors(world, entity, (ancestor) => {
1017
+ * if (hasComponent(world, ancestor, SomeComponent)) {
1018
+ * found = ancestor;
1019
+ * return false; // stop
1020
+ * }
1021
+ * });
1022
+ * ```
1023
+ */
1024
+ declare function forAncestors(world: World, eid: Entity, callback: TraversalCallback): boolean;
1025
+ /**
1026
+ * Checks if an entity is a descendant of another.
1027
+ *
1028
+ * @param world - The ECS world
1029
+ * @param ancestor - The potential ancestor entity
1030
+ * @param descendant - The potential descendant entity
1031
+ * @returns true if descendant is a descendant of ancestor
1032
+ *
1033
+ * @example
1034
+ * ```typescript
1035
+ * import { hasDescendant } from 'blecsd';
1036
+ *
1037
+ * if (hasDescendant(world, container, widget)) {
1038
+ * console.log('widget is inside container');
1039
+ * }
1040
+ * ```
1041
+ */
1042
+ declare function hasDescendant(world: World, ancestor: Entity, descendant: Entity): boolean;
1043
+ /**
1044
+ * Checks if an entity is an ancestor of another.
1045
+ *
1046
+ * @param world - The ECS world
1047
+ * @param descendant - The potential descendant entity
1048
+ * @param ancestor - The potential ancestor entity
1049
+ * @returns true if ancestor is an ancestor of descendant
1050
+ *
1051
+ * @example
1052
+ * ```typescript
1053
+ * import { hasAncestor } from 'blecsd';
1054
+ *
1055
+ * if (hasAncestor(world, widget, container)) {
1056
+ * console.log('widget is inside container');
1057
+ * }
1058
+ * ```
1059
+ */
1060
+ declare function hasAncestor(world: World, descendant: Entity, ancestor: Entity): boolean;
1061
+ /**
1062
+ * Gets the root ancestor of an entity.
1063
+ *
1064
+ * @param world - The ECS world
1065
+ * @param eid - The entity
1066
+ * @returns The root ancestor, or the entity itself if it has no parent
1067
+ *
1068
+ * @example
1069
+ * ```typescript
1070
+ * import { getRoot } from 'blecsd';
1071
+ *
1072
+ * const root = getRoot(world, deeplyNestedEntity);
1073
+ * // root is the topmost ancestor
1074
+ * ```
1075
+ */
1076
+ declare function getRoot(world: World, eid: Entity): Entity;
1077
+ /**
1078
+ * Gets the common ancestor of two entities.
1079
+ *
1080
+ * @param world - The ECS world
1081
+ * @param a - First entity
1082
+ * @param b - Second entity
1083
+ * @returns The common ancestor, or NULL_ENTITY if none exists
1084
+ *
1085
+ * @example
1086
+ * ```typescript
1087
+ * import { getCommonAncestor, NULL_ENTITY } from 'blecsd';
1088
+ *
1089
+ * const common = getCommonAncestor(world, entityA, entityB);
1090
+ * if (common !== NULL_ENTITY) {
1091
+ * console.log('Found common ancestor:', common);
1092
+ * }
1093
+ * ```
1094
+ */
1095
+ declare function getCommonAncestor(world: World, a: Entity, b: Entity): Entity;
1096
+ /**
1097
+ * Gets all siblings of an entity (excluding itself).
1098
+ *
1099
+ * @param world - The ECS world
1100
+ * @param eid - The entity
1101
+ * @returns Array of sibling entities
1102
+ *
1103
+ * @example
1104
+ * ```typescript
1105
+ * import { getSiblings } from 'blecsd';
1106
+ *
1107
+ * const siblings = getSiblings(world, entity);
1108
+ * console.log(`Entity has ${siblings.length} siblings`);
1109
+ * ```
1110
+ */
1111
+ declare function getSiblings(world: World, eid: Entity): Entity[];
1112
+
1113
+ /**
1114
+ * Position component for entity positioning in the terminal grid.
1115
+ * @module components/position
1116
+ */
1117
+
1118
+ /**
1119
+ * Position component store using SoA (Structure of Arrays) for performance.
1120
+ *
1121
+ * - `x`, `y`: Coordinates in the terminal grid (floats for smooth movement)
1122
+ * - `z`: Z-index for layering (higher values render on top)
1123
+ * - `absolute`: 0 = position relative to parent, 1 = absolute screen position
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * import { Position, setPosition, getPosition } from 'blecsd';
1128
+ *
1129
+ * // Position is automatically added when using setPosition
1130
+ * setPosition(world, entity, 10, 5);
1131
+ *
1132
+ * // Get current position
1133
+ * const pos = getPosition(world, entity);
1134
+ * console.log(pos.x, pos.y); // 10, 5
1135
+ * ```
1136
+ */
1137
+ declare const Position: {
1138
+ /** X coordinate in terminal cells */
1139
+ x: Float32Array<ArrayBuffer>;
1140
+ /** Y coordinate in terminal cells */
1141
+ y: Float32Array<ArrayBuffer>;
1142
+ /** Z-index for layering (0-65535) */
1143
+ z: Uint16Array<ArrayBuffer>;
1144
+ /** 0 = relative to parent, 1 = absolute screen position */
1145
+ absolute: Uint8Array<ArrayBuffer>;
1146
+ };
1147
+ /**
1148
+ * Position data returned by getPosition.
1149
+ */
1150
+ interface PositionData {
1151
+ readonly x: number;
1152
+ readonly y: number;
1153
+ readonly z: number;
1154
+ readonly absolute: boolean;
1155
+ }
1156
+ /**
1157
+ * Sets the position of an entity.
1158
+ * Adds the Position component if not already present.
1159
+ *
1160
+ * @param world - The ECS world
1161
+ * @param eid - The entity ID
1162
+ * @param x - X coordinate
1163
+ * @param y - Y coordinate
1164
+ * @param z - Z-index for layering (default: 0)
1165
+ * @returns The entity ID for chaining
1166
+ *
1167
+ * @example
1168
+ * ```typescript
1169
+ * import { createWorld, addEntity } from '../core/ecs';
1170
+ * import { setPosition } from 'blecsd';
1171
+ *
1172
+ * const world = createWorld();
1173
+ * const entity = addEntity(world);
1174
+ *
1175
+ * // Set position
1176
+ * setPosition(world, entity, 10, 5);
1177
+ *
1178
+ * // With z-index
1179
+ * setPosition(world, entity, 10, 5, 100);
1180
+ * ```
1181
+ */
1182
+ declare function setPosition(world: World, eid: Entity, x: number, y: number, z?: number): Entity;
1183
+ /**
1184
+ * Gets the position data of an entity.
1185
+ * Returns undefined if the entity doesn't have a Position component.
1186
+ *
1187
+ * @param world - The ECS world
1188
+ * @param eid - The entity ID
1189
+ * @returns Position data or undefined
1190
+ *
1191
+ * @example
1192
+ * ```typescript
1193
+ * import { getPosition } from 'blecsd';
1194
+ *
1195
+ * const pos = getPosition(world, entity);
1196
+ * if (pos) {
1197
+ * console.log(`Entity at (${pos.x}, ${pos.y}) z=${pos.z}`);
1198
+ * }
1199
+ * ```
1200
+ */
1201
+ declare function getPosition(world: World, eid: Entity): PositionData | undefined;
1202
+ /**
1203
+ * Sets whether the entity uses absolute positioning.
1204
+ *
1205
+ * @param world - The ECS world
1206
+ * @param eid - The entity ID
1207
+ * @param absolute - true for absolute, false for relative to parent
1208
+ * @returns The entity ID for chaining
1209
+ *
1210
+ * @example
1211
+ * ```typescript
1212
+ * import { setAbsolute } from 'blecsd';
1213
+ *
1214
+ * // Make entity use absolute screen coordinates
1215
+ * setAbsolute(world, entity, true);
1216
+ * ```
1217
+ */
1218
+ declare function setAbsolute(world: World, eid: Entity, absolute: boolean): Entity;
1219
+ /**
1220
+ * Checks if an entity uses absolute positioning.
1221
+ *
1222
+ * @param world - The ECS world
1223
+ * @param eid - The entity ID
1224
+ * @returns true if absolute, false if relative or no Position component
1225
+ *
1226
+ * @example
1227
+ * ```typescript
1228
+ * import { isAbsolute } from 'blecsd';
1229
+ *
1230
+ * if (isAbsolute(world, entity)) {
1231
+ * // Use screen coordinates directly
1232
+ * }
1233
+ * ```
1234
+ */
1235
+ declare function isAbsolute(world: World, eid: Entity): boolean;
1236
+ /**
1237
+ * Checks if an entity has a Position component.
1238
+ *
1239
+ * @param world - The ECS world
1240
+ * @param eid - The entity ID
1241
+ * @returns true if entity has Position component
1242
+ *
1243
+ * @example
1244
+ * ```typescript
1245
+ * import { hasPosition } from 'blecsd';
1246
+ *
1247
+ * if (hasPosition(world, entity)) {
1248
+ * // Safe to call getPosition
1249
+ * }
1250
+ * ```
1251
+ */
1252
+ declare function hasPosition(world: World, eid: Entity): boolean;
1253
+ /**
1254
+ * Moves an entity by a delta amount.
1255
+ *
1256
+ * @param world - The ECS world
1257
+ * @param eid - The entity ID
1258
+ * @param dx - Delta X (added to current x)
1259
+ * @param dy - Delta Y (added to current y)
1260
+ * @returns The entity ID for chaining
1261
+ *
1262
+ * @example
1263
+ * ```typescript
1264
+ * import { moveBy } from 'blecsd';
1265
+ *
1266
+ * // Move entity 1 cell right, 2 cells down
1267
+ * moveBy(world, entity, 1, 2);
1268
+ * ```
1269
+ */
1270
+ declare function moveBy(world: World, eid: Entity, dx: number, dy: number): Entity;
1271
+ /**
1272
+ * Sets the z-index of an entity for layering.
1273
+ *
1274
+ * @param world - The ECS world
1275
+ * @param eid - The entity ID
1276
+ * @param z - Z-index (0-65535, higher = on top)
1277
+ * @returns The entity ID for chaining
1278
+ *
1279
+ * @example
1280
+ * ```typescript
1281
+ * import { setZIndex } from 'blecsd';
1282
+ *
1283
+ * // Bring entity to front
1284
+ * setZIndex(world, entity, 1000);
1285
+ * ```
1286
+ */
1287
+ declare function setZIndex(world: World, eid: Entity, z: number): Entity;
1288
+ /**
1289
+ * Gets the z-index of an entity.
1290
+ *
1291
+ * @param world - The ECS world
1292
+ * @param eid - The entity ID
1293
+ * @returns Z-index value, or 0 if no Position component
1294
+ *
1295
+ * @example
1296
+ * ```typescript
1297
+ * import { getZIndex } from 'blecsd';
1298
+ *
1299
+ * const z = getZIndex(world, entity);
1300
+ * console.log(`Entity z-index: ${z}`);
1301
+ * ```
1302
+ */
1303
+ declare function getZIndex(world: World, eid: Entity): number;
1304
+ /**
1305
+ * Brings an entity to the front of a set of entities.
1306
+ * Sets the z-index to one more than the maximum in the provided array.
1307
+ *
1308
+ * @param world - The ECS world
1309
+ * @param eid - The entity to bring to front
1310
+ * @param siblings - Array of sibling entities to compare against
1311
+ * @returns The entity ID for chaining
1312
+ *
1313
+ * @example
1314
+ * ```typescript
1315
+ * import { bringToFront, getSiblings } from 'blecsd';
1316
+ *
1317
+ * // Bring entity to front of its siblings
1318
+ * const siblings = getSiblings(world, entity);
1319
+ * bringToFront(world, entity, siblings);
1320
+ * ```
1321
+ */
1322
+ declare function bringToFront(world: World, eid: Entity, siblings: readonly Entity[]): Entity;
1323
+ /**
1324
+ * Sends an entity to the back of a set of entities.
1325
+ * Sets the z-index to one less than the minimum in the provided array.
1326
+ *
1327
+ * @param world - The ECS world
1328
+ * @param eid - The entity to send to back
1329
+ * @param siblings - Array of sibling entities to compare against
1330
+ * @returns The entity ID for chaining
1331
+ *
1332
+ * @example
1333
+ * ```typescript
1334
+ * import { sendToBack, getSiblings } from 'blecsd';
1335
+ *
1336
+ * // Send entity to back of its siblings
1337
+ * const siblings = getSiblings(world, entity);
1338
+ * sendToBack(world, entity, siblings);
1339
+ * ```
1340
+ */
1341
+ declare function sendToBack(world: World, eid: Entity, siblings: readonly Entity[]): Entity;
1342
+ /**
1343
+ * Moves an entity one step forward in z-order among siblings.
1344
+ * Finds the next higher z-index and sets this entity above it.
1345
+ *
1346
+ * @param world - The ECS world
1347
+ * @param eid - The entity to move forward
1348
+ * @param siblings - Array of sibling entities
1349
+ * @returns The entity ID for chaining
1350
+ *
1351
+ * @example
1352
+ * ```typescript
1353
+ * import { moveForward, getSiblings } from 'blecsd';
1354
+ *
1355
+ * const siblings = getSiblings(world, entity);
1356
+ * moveForward(world, entity, siblings);
1357
+ * ```
1358
+ */
1359
+ declare function moveForward(world: World, eid: Entity, siblings: readonly Entity[]): Entity;
1360
+ /**
1361
+ * Moves an entity one step backward in z-order among siblings.
1362
+ * Finds the next lower z-index and sets this entity below it.
1363
+ *
1364
+ * @param world - The ECS world
1365
+ * @param eid - The entity to move backward
1366
+ * @param siblings - Array of sibling entities
1367
+ * @returns The entity ID for chaining
1368
+ *
1369
+ * @example
1370
+ * ```typescript
1371
+ * import { moveBackward, getSiblings } from 'blecsd';
1372
+ *
1373
+ * const siblings = getSiblings(world, entity);
1374
+ * moveBackward(world, entity, siblings);
1375
+ * ```
1376
+ */
1377
+ declare function moveBackward(world: World, eid: Entity, siblings: readonly Entity[]): Entity;
1378
+ /**
1379
+ * Normalizes z-indices of a set of entities.
1380
+ * Reassigns z-indices to sequential values starting from 0.
1381
+ * Useful after many front/back operations to prevent z-index overflow.
1382
+ *
1383
+ * @param world - The ECS world
1384
+ * @param entities - Entities to normalize
1385
+ *
1386
+ * @example
1387
+ * ```typescript
1388
+ * import { normalizeZIndices, getSiblings } from 'blecsd';
1389
+ *
1390
+ * // After many z-order changes, normalize indices
1391
+ * const siblings = getSiblings(world, parent);
1392
+ * normalizeZIndices(world, siblings);
1393
+ * ```
1394
+ */
1395
+ declare function normalizeZIndices(world: World, entities: readonly Entity[]): void;
1396
+ /**
1397
+ * Swaps the z-indices of two entities.
1398
+ *
1399
+ * @param world - The ECS world
1400
+ * @param a - First entity
1401
+ * @param b - Second entity
1402
+ *
1403
+ * @example
1404
+ * ```typescript
1405
+ * import { swapZIndex } from 'blecsd';
1406
+ *
1407
+ * // Swap z-order of two entities
1408
+ * swapZIndex(world, entityA, entityB);
1409
+ * ```
1410
+ */
1411
+ declare function swapZIndex(world: World, a: Entity, b: Entity): void;
1412
+ /**
1413
+ * Position keyword type for alignment shortcuts.
1414
+ */
1415
+ type PositionKeyword = 'center' | 'top-left' | 'tl' | 'top-right' | 'tr' | 'bottom-left' | 'bl' | 'bottom-right' | 'br';
1416
+ /**
1417
+ * Sets entity position using a keyword for quick alignment.
1418
+ * Requires parent with Dimensions component.
1419
+ *
1420
+ * @param world - The ECS world
1421
+ * @param eid - The entity ID
1422
+ * @param keyword - Position keyword
1423
+ * @returns The entity ID for chaining
1424
+ *
1425
+ * @example
1426
+ * ```typescript
1427
+ * import { setPositionKeyword } from 'blecsd';
1428
+ *
1429
+ * // Center within parent
1430
+ * setPositionKeyword(world, dialog, 'center');
1431
+ *
1432
+ * // Top-left corner
1433
+ * setPositionKeyword(world, logo, 'top-left');
1434
+ *
1435
+ * // Bottom-right corner
1436
+ * setPositionKeyword(world, statusBar, 'bottom-right');
1437
+ * ```
1438
+ */
1439
+ declare function setPositionKeyword(world: World, eid: Entity, keyword: PositionKeyword): Entity;
1440
+ /**
1441
+ * Sets entity position using percentage of parent size.
1442
+ * Requires parent with Dimensions component.
1443
+ *
1444
+ * @param world - The ECS world
1445
+ * @param eid - The entity ID
1446
+ * @param xPercent - X position as percentage (0-100)
1447
+ * @param yPercent - Y position as percentage (0-100)
1448
+ * @returns The entity ID for chaining
1449
+ *
1450
+ * @example
1451
+ * ```typescript
1452
+ * import { setPositionPercent } from 'blecsd';
1453
+ *
1454
+ * // Center horizontally, 25% from top
1455
+ * setPositionPercent(world, header, 50, 25);
1456
+ *
1457
+ * // Bottom-right quadrant
1458
+ * setPositionPercent(world, footer, 75, 75);
1459
+ * ```
1460
+ */
1461
+ declare function setPositionPercent(world: World, eid: Entity, xPercent: number, yPercent: number): Entity;
1462
+
1463
+ /**
1464
+ * Velocity and Acceleration components for entity movement.
1465
+ * @module components/velocity
1466
+ */
1467
+
1468
+ /**
1469
+ * Velocity component store using SoA (Structure of Arrays) for performance.
1470
+ *
1471
+ * - `x`, `y`: Velocity in cells per second
1472
+ * - `maxSpeed`: Maximum speed (0 = unlimited)
1473
+ * - `friction`: Friction factor 0-1 (0 = no friction, 1 = instant stop)
1474
+ *
1475
+ * @example
1476
+ * ```typescript
1477
+ * import { Velocity, setVelocity, getVelocity } from 'blecsd';
1478
+ *
1479
+ * // Set entity velocity
1480
+ * setVelocity(world, entity, 5, 0); // Move right at 5 cells/sec
1481
+ *
1482
+ * // Get current velocity
1483
+ * const vel = getVelocity(world, entity);
1484
+ * console.log(`Speed: ${Math.sqrt(vel.x*vel.x + vel.y*vel.y)}`);
1485
+ * ```
1486
+ */
1487
+ declare const Velocity: {
1488
+ /** X velocity in cells per second */
1489
+ x: Float32Array<ArrayBuffer>;
1490
+ /** Y velocity in cells per second */
1491
+ y: Float32Array<ArrayBuffer>;
1492
+ /** Maximum speed (0 = unlimited) */
1493
+ maxSpeed: Float32Array<ArrayBuffer>;
1494
+ /** Friction factor (0-1, 0 = no friction) */
1495
+ friction: Float32Array<ArrayBuffer>;
1496
+ };
1497
+ /**
1498
+ * Velocity data returned by getVelocity.
1499
+ */
1500
+ interface VelocityData {
1501
+ readonly x: number;
1502
+ readonly y: number;
1503
+ readonly maxSpeed: number;
1504
+ readonly friction: number;
1505
+ }
1506
+ /**
1507
+ * Options for setting velocity.
1508
+ */
1509
+ interface VelocityOptions {
1510
+ /** X velocity in cells per second */
1511
+ x?: number;
1512
+ /** Y velocity in cells per second */
1513
+ y?: number;
1514
+ /** Maximum speed (0 = unlimited) */
1515
+ maxSpeed?: number;
1516
+ /** Friction factor (0-1) */
1517
+ friction?: number;
1518
+ }
1519
+ /**
1520
+ * Sets the velocity of an entity.
1521
+ * Adds the Velocity component if not already present.
1522
+ *
1523
+ * @param world - The ECS world
1524
+ * @param eid - The entity ID
1525
+ * @param x - X velocity in cells per second
1526
+ * @param y - Y velocity in cells per second
1527
+ * @returns The entity ID for chaining
1528
+ *
1529
+ * @example
1530
+ * ```typescript
1531
+ * import { createWorld, addEntity } from '../core/ecs';
1532
+ * import { setVelocity, setPosition } from 'blecsd';
1533
+ *
1534
+ * const world = createWorld();
1535
+ * const entity = addEntity(world);
1536
+ *
1537
+ * setPosition(world, entity, 10, 10);
1538
+ * setVelocity(world, entity, 5, -2); // Right 5, up 2 cells/sec
1539
+ * ```
1540
+ */
1541
+ declare function setVelocity(world: World, eid: Entity, x: number, y: number): Entity;
1542
+ /**
1543
+ * Sets velocity with options.
1544
+ *
1545
+ * @param world - The ECS world
1546
+ * @param eid - The entity ID
1547
+ * @param options - Velocity options
1548
+ * @returns The entity ID for chaining
1549
+ *
1550
+ * @example
1551
+ * ```typescript
1552
+ * import { setVelocityOptions } from 'blecsd';
1553
+ *
1554
+ * setVelocityOptions(world, entity, {
1555
+ * x: 5,
1556
+ * y: 0,
1557
+ * maxSpeed: 10,
1558
+ * friction: 0.1,
1559
+ * });
1560
+ * ```
1561
+ */
1562
+ declare function setVelocityOptions(world: World, eid: Entity, options: VelocityOptions): Entity;
1563
+ /**
1564
+ * Gets the velocity data of an entity.
1565
+ *
1566
+ * @param world - The ECS world
1567
+ * @param eid - The entity ID
1568
+ * @returns Velocity data or undefined
1569
+ *
1570
+ * @example
1571
+ * ```typescript
1572
+ * import { getVelocity } from 'blecsd';
1573
+ *
1574
+ * const vel = getVelocity(world, entity);
1575
+ * if (vel) {
1576
+ * const speed = Math.sqrt(vel.x * vel.x + vel.y * vel.y);
1577
+ * console.log(`Moving at ${speed} cells/sec`);
1578
+ * }
1579
+ * ```
1580
+ */
1581
+ declare function getVelocity(world: World, eid: Entity): VelocityData | undefined;
1582
+ /**
1583
+ * Checks if an entity has a Velocity component.
1584
+ *
1585
+ * @param world - The ECS world
1586
+ * @param eid - The entity ID
1587
+ * @returns true if entity has Velocity component
1588
+ */
1589
+ declare function hasVelocity(world: World, eid: Entity): boolean;
1590
+ /**
1591
+ * Sets the maximum speed for an entity.
1592
+ *
1593
+ * @param world - The ECS world
1594
+ * @param eid - The entity ID
1595
+ * @param maxSpeed - Maximum speed (0 = unlimited)
1596
+ * @returns The entity ID for chaining
1597
+ */
1598
+ declare function setMaxSpeed(world: World, eid: Entity, maxSpeed: number): Entity;
1599
+ /**
1600
+ * Sets the friction for an entity.
1601
+ *
1602
+ * @param world - The ECS world
1603
+ * @param eid - The entity ID
1604
+ * @param friction - Friction factor (0-1)
1605
+ * @returns The entity ID for chaining
1606
+ */
1607
+ declare function setFriction(world: World, eid: Entity, friction: number): Entity;
1608
+ /**
1609
+ * Adds to current velocity.
1610
+ *
1611
+ * @param world - The ECS world
1612
+ * @param eid - The entity ID
1613
+ * @param dx - Delta X velocity
1614
+ * @param dy - Delta Y velocity
1615
+ * @returns The entity ID for chaining
1616
+ *
1617
+ * @example
1618
+ * ```typescript
1619
+ * import { addVelocity } from 'blecsd';
1620
+ *
1621
+ * // Apply impulse
1622
+ * addVelocity(world, entity, 0, -10); // Jump impulse
1623
+ * ```
1624
+ */
1625
+ declare function addVelocity(world: World, eid: Entity, dx: number, dy: number): Entity;
1626
+ /**
1627
+ * Gets the current speed (magnitude of velocity).
1628
+ *
1629
+ * @param world - The ECS world
1630
+ * @param eid - The entity ID
1631
+ * @returns Current speed or 0 if no velocity component
1632
+ */
1633
+ declare function getSpeed(world: World, eid: Entity): number;
1634
+ /**
1635
+ * Stops an entity (sets velocity to zero).
1636
+ *
1637
+ * @param world - The ECS world
1638
+ * @param eid - The entity ID
1639
+ * @returns The entity ID for chaining
1640
+ */
1641
+ declare function stopEntity(world: World, eid: Entity): Entity;
1642
+ /**
1643
+ * Removes velocity from an entity.
1644
+ *
1645
+ * @param world - The ECS world
1646
+ * @param eid - The entity ID
1647
+ * @returns The entity ID for chaining
1648
+ */
1649
+ declare function removeVelocity(world: World, eid: Entity): Entity;
1650
+ /**
1651
+ * Acceleration component store using SoA (Structure of Arrays) for performance.
1652
+ *
1653
+ * Acceleration is applied to velocity each frame.
1654
+ *
1655
+ * @example
1656
+ * ```typescript
1657
+ * import { Acceleration, setAcceleration, getAcceleration } from 'blecsd';
1658
+ *
1659
+ * // Set gravity
1660
+ * setAcceleration(world, entity, 0, 9.8); // Gravity down
1661
+ *
1662
+ * // Get current acceleration
1663
+ * const accel = getAcceleration(world, entity);
1664
+ * ```
1665
+ */
1666
+ declare const Acceleration: {
1667
+ /** X acceleration in cells per second squared */
1668
+ x: Float32Array<ArrayBuffer>;
1669
+ /** Y acceleration in cells per second squared */
1670
+ y: Float32Array<ArrayBuffer>;
1671
+ };
1672
+ /**
1673
+ * Acceleration data returned by getAcceleration.
1674
+ */
1675
+ interface AccelerationData {
1676
+ readonly x: number;
1677
+ readonly y: number;
1678
+ }
1679
+ /**
1680
+ * Sets the acceleration of an entity.
1681
+ * Adds the Acceleration component if not already present.
1682
+ *
1683
+ * @param world - The ECS world
1684
+ * @param eid - The entity ID
1685
+ * @param x - X acceleration in cells per second squared
1686
+ * @param y - Y acceleration in cells per second squared
1687
+ * @returns The entity ID for chaining
1688
+ *
1689
+ * @example
1690
+ * ```typescript
1691
+ * import { setAcceleration } from 'blecsd';
1692
+ *
1693
+ * // Apply gravity
1694
+ * setAcceleration(world, entity, 0, 20);
1695
+ *
1696
+ * // Apply thrust
1697
+ * setAcceleration(world, player, thrustX, thrustY);
1698
+ * ```
1699
+ */
1700
+ declare function setAcceleration(world: World, eid: Entity, x: number, y: number): Entity;
1701
+ /**
1702
+ * Gets the acceleration data of an entity.
1703
+ *
1704
+ * @param world - The ECS world
1705
+ * @param eid - The entity ID
1706
+ * @returns Acceleration data or undefined
1707
+ */
1708
+ declare function getAcceleration(world: World, eid: Entity): AccelerationData | undefined;
1709
+ /**
1710
+ * Checks if an entity has an Acceleration component.
1711
+ *
1712
+ * @param world - The ECS world
1713
+ * @param eid - The entity ID
1714
+ * @returns true if entity has Acceleration component
1715
+ */
1716
+ declare function hasAcceleration(world: World, eid: Entity): boolean;
1717
+ /**
1718
+ * Clears acceleration (sets to zero).
1719
+ *
1720
+ * @param world - The ECS world
1721
+ * @param eid - The entity ID
1722
+ * @returns The entity ID for chaining
1723
+ */
1724
+ declare function clearAcceleration(world: World, eid: Entity): Entity;
1725
+ /**
1726
+ * Removes acceleration from an entity.
1727
+ *
1728
+ * @param world - The ECS world
1729
+ * @param eid - The entity ID
1730
+ * @returns The entity ID for chaining
1731
+ */
1732
+ declare function removeAcceleration(world: World, eid: Entity): Entity;
1733
+ /**
1734
+ * Applies acceleration to velocity for a single entity.
1735
+ *
1736
+ * @param eid - The entity ID
1737
+ * @param deltaTime - Time elapsed in seconds
1738
+ */
1739
+ declare function applyAccelerationToEntity(eid: Entity, deltaTime: number): void;
1740
+ /**
1741
+ * Applies friction to velocity for a single entity.
1742
+ *
1743
+ * @param eid - The entity ID
1744
+ * @param deltaTime - Time elapsed in seconds
1745
+ */
1746
+ declare function applyFrictionToEntity(eid: Entity, deltaTime: number): void;
1747
+ /**
1748
+ * Clamps velocity to max speed for a single entity.
1749
+ *
1750
+ * @param eid - The entity ID
1751
+ */
1752
+ declare function clampSpeedForEntity(eid: Entity): void;
1753
+ /**
1754
+ * Applies velocity to position for a single entity.
1755
+ *
1756
+ * @param eid - The entity ID
1757
+ * @param deltaTime - Time elapsed in seconds
1758
+ */
1759
+ declare function applyVelocityToEntity(eid: Entity, deltaTime: number): void;
1760
+ /**
1761
+ * Updates movement for a single entity (full update cycle).
1762
+ * Applies: acceleration -> velocity -> friction -> clamp -> position.
1763
+ *
1764
+ * @param world - The ECS world
1765
+ * @param eid - The entity ID
1766
+ * @param deltaTime - Time elapsed in seconds
1767
+ *
1768
+ * @example
1769
+ * ```typescript
1770
+ * import { updateEntityMovement } from 'blecsd';
1771
+ *
1772
+ * // Manual movement update
1773
+ * updateEntityMovement(world, entity, 0.016);
1774
+ * ```
1775
+ */
1776
+ declare function updateEntityMovement(world: World, eid: Entity, deltaTime: number): void;
1777
+
1778
+ /**
1779
+ * Interactive component for mouse/keyboard interaction.
1780
+ * @module components/interactive
1781
+ */
1782
+ /** Default hover effect foreground color (white) */
1783
+ declare const DEFAULT_HOVER_FG = 4294967295;
1784
+ /** Default hover effect background color (transparent) */
1785
+ declare const DEFAULT_HOVER_BG = 0;
1786
+ /**
1787
+ * Interactive component store using SoA (Structure of Arrays) for performance.
1788
+ *
1789
+ * - `clickable`: Whether entity responds to clicks (0=no, 1=yes)
1790
+ * - `draggable`: Whether entity can be dragged (0=no, 1=yes)
1791
+ * - `hoverable`: Whether entity responds to hover (0=no, 1=yes)
1792
+ * - `hovered`: Current hover state (0=no, 1=yes)
1793
+ * - `pressed`: Current pressed state (0=no, 1=yes)
1794
+ * - `keyable`: Whether entity receives key events (0=no, 1=yes)
1795
+ * - `hoverEffectFg`, `hoverEffectBg`: Colors for hover effect
1796
+ *
1797
+ * @example
1798
+ * ```typescript
1799
+ * import { Interactive, setClickable, isHovered, isPressed } from 'blecsd';
1800
+ *
1801
+ * setInteractive(world, entity, { clickable: true, hoverable: true });
1802
+ *
1803
+ * if (isHovered(world, entity)) {
1804
+ * console.log('Mouse over entity');
1805
+ * }
1806
+ * ```
1807
+ */
1808
+ declare const Interactive: {
1809
+ /** Whether entity responds to clicks (0=no, 1=yes) */
1810
+ clickable: Uint8Array<ArrayBuffer>;
1811
+ /** Whether entity can be dragged (0=no, 1=yes) */
1812
+ draggable: Uint8Array<ArrayBuffer>;
1813
+ /** Whether entity responds to hover (0=no, 1=yes) */
1814
+ hoverable: Uint8Array<ArrayBuffer>;
1815
+ /** Current hover state (0=no, 1=yes) */
1816
+ hovered: Uint8Array<ArrayBuffer>;
1817
+ /** Current pressed state (0=no, 1=yes) */
1818
+ pressed: Uint8Array<ArrayBuffer>;
1819
+ /** Whether entity receives key events (0=no, 1=yes) */
1820
+ keyable: Uint8Array<ArrayBuffer>;
1821
+ /** Whether entity can receive focus (0=no, 1=yes) */
1822
+ focusable: Uint8Array<ArrayBuffer>;
1823
+ /** Current focus state (0=no, 1=yes) */
1824
+ focused: Uint8Array<ArrayBuffer>;
1825
+ /** Tab index for focus order (-1=skip, 0+=order) */
1826
+ tabIndex: Int16Array<ArrayBuffer>;
1827
+ /** Whether entity is enabled (0=disabled, 1=enabled) */
1828
+ enabled: Uint8Array<ArrayBuffer>;
1829
+ /** Hover effect foreground color */
1830
+ hoverEffectFg: Uint32Array<ArrayBuffer>;
1831
+ /** Hover effect background color */
1832
+ hoverEffectBg: Uint32Array<ArrayBuffer>;
1833
+ /** Focus effect foreground color */
1834
+ focusEffectFg: Uint32Array<ArrayBuffer>;
1835
+ /** Focus effect background color */
1836
+ focusEffectBg: Uint32Array<ArrayBuffer>;
1837
+ };
1838
+ /**
1839
+ * Interactive configuration options.
1840
+ */
1841
+ interface InteractiveOptions {
1842
+ /** Whether entity responds to clicks */
1843
+ clickable?: boolean;
1844
+ /** Whether entity can be dragged */
1845
+ draggable?: boolean;
1846
+ /** Whether entity responds to hover */
1847
+ hoverable?: boolean;
1848
+ /** Whether entity receives key events */
1849
+ keyable?: boolean;
1850
+ /** Whether entity can receive focus */
1851
+ focusable?: boolean;
1852
+ /** Tab index for focus order (-1=skip, 0+=order) */
1853
+ tabIndex?: number;
1854
+ /** Whether entity is enabled (can receive input/focus) */
1855
+ enabled?: boolean;
1856
+ /** Hover effect foreground color */
1857
+ hoverEffectFg?: number;
1858
+ /** Hover effect background color */
1859
+ hoverEffectBg?: number;
1860
+ /** Focus effect foreground color */
1861
+ focusEffectFg?: number;
1862
+ /** Focus effect background color */
1863
+ focusEffectBg?: number;
1864
+ }
1865
+ /**
1866
+ * Interactive data returned by getInteractive.
1867
+ */
1868
+ interface InteractiveData {
1869
+ readonly clickable: boolean;
1870
+ readonly draggable: boolean;
1871
+ readonly hoverable: boolean;
1872
+ readonly hovered: boolean;
1873
+ readonly pressed: boolean;
1874
+ readonly enabled: boolean;
1875
+ readonly keyable: boolean;
1876
+ readonly focusable: boolean;
1877
+ readonly focused: boolean;
1878
+ readonly tabIndex: number;
1879
+ readonly hoverEffectFg: number;
1880
+ readonly hoverEffectBg: number;
1881
+ readonly focusEffectFg: number;
1882
+ readonly focusEffectBg: number;
1883
+ }
1884
+
1885
+ /**
1886
+ * Interactive system for managing mouse/keyboard interaction state.
1887
+ * @module systems/interactiveSystem
1888
+ */
1889
+
1890
+ /**
1891
+ * Makes an entity interactive with the given options.
1892
+ * Adds the Interactive component if not already present.
1893
+ *
1894
+ * @param world - The ECS world
1895
+ * @param eid - The entity ID
1896
+ * @param options - Interactive configuration options
1897
+ * @returns The entity ID for chaining
1898
+ *
1899
+ * @example
1900
+ * ```typescript
1901
+ * import { createWorld, addEntity } from '../core/ecs';
1902
+ * import { setInteractive } from 'blecsd';
1903
+ *
1904
+ * const world = createWorld();
1905
+ * const entity = addEntity(world);
1906
+ *
1907
+ * setInteractive(world, entity, {
1908
+ * clickable: true,
1909
+ * hoverable: true,
1910
+ * hoverEffectBg: 0x333333ff,
1911
+ * });
1912
+ * ```
1913
+ */
1914
+ declare function setInteractive(world: World, eid: Entity, options: InteractiveOptions): Entity;
1915
+ /**
1916
+ * Sets whether an entity is clickable.
1917
+ *
1918
+ * @param world - The ECS world
1919
+ * @param eid - The entity ID
1920
+ * @param clickable - Whether entity responds to clicks
1921
+ * @returns The entity ID for chaining
1922
+ */
1923
+ declare function setClickable(world: World, eid: Entity, clickable: boolean): Entity;
1924
+ /**
1925
+ * Sets whether an entity is draggable.
1926
+ *
1927
+ * @param world - The ECS world
1928
+ * @param eid - The entity ID
1929
+ * @param draggable - Whether entity can be dragged
1930
+ * @returns The entity ID for chaining
1931
+ */
1932
+ declare function setDraggable(world: World, eid: Entity, draggable: boolean): Entity;
1933
+ /**
1934
+ * Sets whether an entity is hoverable.
1935
+ *
1936
+ * @param world - The ECS world
1937
+ * @param eid - The entity ID
1938
+ * @param hoverable - Whether entity responds to hover
1939
+ * @returns The entity ID for chaining
1940
+ */
1941
+ declare function setHoverable(world: World, eid: Entity, hoverable: boolean): Entity;
1942
+ /**
1943
+ * Sets whether an entity receives key events.
1944
+ *
1945
+ * @param world - The ECS world
1946
+ * @param eid - The entity ID
1947
+ * @param keyable - Whether entity receives key events
1948
+ * @returns The entity ID for chaining
1949
+ */
1950
+ declare function setKeyable(world: World, eid: Entity, keyable: boolean): Entity;
1951
+ /**
1952
+ * Checks if an entity is currently hovered.
1953
+ *
1954
+ * @param world - The ECS world
1955
+ * @param eid - The entity ID
1956
+ * @returns true if entity is hovered
1957
+ *
1958
+ * @example
1959
+ * ```typescript
1960
+ * import { isHovered } from 'blecsd';
1961
+ *
1962
+ * if (isHovered(world, entity)) {
1963
+ * // Apply hover styling
1964
+ * }
1965
+ * ```
1966
+ */
1967
+ declare function isHovered(world: World, eid: Entity): boolean;
1968
+ /**
1969
+ * Checks if an entity is currently pressed.
1970
+ *
1971
+ * @param world - The ECS world
1972
+ * @param eid - The entity ID
1973
+ * @returns true if entity is pressed
1974
+ *
1975
+ * @example
1976
+ * ```typescript
1977
+ * import { isPressed } from 'blecsd';
1978
+ *
1979
+ * if (isPressed(world, entity)) {
1980
+ * // Apply pressed styling
1981
+ * }
1982
+ * ```
1983
+ */
1984
+ declare function isPressed(world: World, eid: Entity): boolean;
1985
+ /**
1986
+ * Checks if an entity is clickable.
1987
+ *
1988
+ * @param world - The ECS world
1989
+ * @param eid - The entity ID
1990
+ * @returns true if entity is clickable
1991
+ */
1992
+ declare function isClickable(world: World, eid: Entity): boolean;
1993
+ /**
1994
+ * Checks if an entity is draggable.
1995
+ *
1996
+ * @param world - The ECS world
1997
+ * @param eid - The entity ID
1998
+ * @returns true if entity is draggable
1999
+ */
2000
+ declare function isDraggable(world: World, eid: Entity): boolean;
2001
+ /**
2002
+ * Checks if an entity is hoverable.
2003
+ *
2004
+ * @param world - The ECS world
2005
+ * @param eid - The entity ID
2006
+ * @returns true if entity is hoverable
2007
+ */
2008
+ declare function isHoverable(world: World, eid: Entity): boolean;
2009
+ /**
2010
+ * Checks if an entity receives key events.
2011
+ *
2012
+ * @param world - The ECS world
2013
+ * @param eid - The entity ID
2014
+ * @returns true if entity receives key events
2015
+ */
2016
+ declare function isKeyable(world: World, eid: Entity): boolean;
2017
+ /**
2018
+ * Sets the hover state of an entity.
2019
+ *
2020
+ * @param world - The ECS world
2021
+ * @param eid - The entity ID
2022
+ * @param hovered - Whether entity is hovered
2023
+ * @returns The entity ID for chaining
2024
+ */
2025
+ declare function setHovered(world: World, eid: Entity, hovered: boolean): Entity;
2026
+ /**
2027
+ * Sets the pressed state of an entity.
2028
+ *
2029
+ * @param world - The ECS world
2030
+ * @param eid - The entity ID
2031
+ * @param pressed - Whether entity is pressed
2032
+ * @returns The entity ID for chaining
2033
+ */
2034
+ declare function setPressed(world: World, eid: Entity, pressed: boolean): Entity;
2035
+ /**
2036
+ * Sets the focus state of an entity.
2037
+ * Note: This only sets the component state. Use the focus system for
2038
+ * proper focus management with events.
2039
+ *
2040
+ * @param world - The ECS world
2041
+ * @param eid - The entity ID
2042
+ * @param focused - Whether entity is focused
2043
+ * @returns The entity ID for chaining
2044
+ */
2045
+ declare function setFocusedState(world: World, eid: Entity, focused: boolean): Entity;
2046
+ /**
2047
+ * Gets the focus effect colors.
2048
+ *
2049
+ * @param world - The ECS world
2050
+ * @param eid - The entity ID
2051
+ * @returns Focus effect colors or undefined
2052
+ */
2053
+ declare function getFocusEffect(world: World, eid: Entity): {
2054
+ fg: number;
2055
+ bg: number;
2056
+ } | undefined;
2057
+ /**
2058
+ * Sets the focus effect colors.
2059
+ *
2060
+ * @param world - The ECS world
2061
+ * @param eid - The entity ID
2062
+ * @param fg - Focus effect foreground color
2063
+ * @param bg - Focus effect background color
2064
+ * @returns The entity ID for chaining
2065
+ */
2066
+ declare function setFocusEffect(world: World, eid: Entity, fg: number, bg: number): Entity;
2067
+ /**
2068
+ * Gets the interactive data of an entity.
2069
+ * Returns undefined if no Interactive component.
2070
+ *
2071
+ * @param world - The ECS world
2072
+ * @param eid - The entity ID
2073
+ * @returns Interactive data or undefined
2074
+ */
2075
+ declare function getInteractive(world: World, eid: Entity): InteractiveData | undefined;
2076
+ /**
2077
+ * Checks if an entity has an Interactive component.
2078
+ *
2079
+ * @param world - The ECS world
2080
+ * @param eid - The entity ID
2081
+ * @returns true if entity has Interactive component
2082
+ */
2083
+ declare function hasInteractive(world: World, eid: Entity): boolean;
2084
+ /**
2085
+ * Clears the hover and pressed states of an entity.
2086
+ *
2087
+ * @param world - The ECS world
2088
+ * @param eid - The entity ID
2089
+ * @returns The entity ID for chaining
2090
+ */
2091
+ declare function clearInteractionState(world: World, eid: Entity): Entity;
2092
+ /**
2093
+ * Enables mouse events on an entity.
2094
+ * Sets clickable and hoverable to true.
2095
+ *
2096
+ * @param world - The ECS world
2097
+ * @param eid - The entity ID
2098
+ * @returns The entity ID for chaining
2099
+ *
2100
+ * @example
2101
+ * ```typescript
2102
+ * import { enableMouse, isClickable, isHoverable } from 'blecsd';
2103
+ *
2104
+ * enableMouse(world, button);
2105
+ *
2106
+ * isClickable(world, button); // true
2107
+ * isHoverable(world, button); // true
2108
+ * ```
2109
+ */
2110
+ declare function enableMouse(world: World, eid: Entity): Entity;
2111
+ /**
2112
+ * Disables mouse events on an entity.
2113
+ * Sets clickable and hoverable to false.
2114
+ *
2115
+ * @param world - The ECS world
2116
+ * @param eid - The entity ID
2117
+ * @returns The entity ID for chaining
2118
+ *
2119
+ * @example
2120
+ * ```typescript
2121
+ * import { enableMouse, disableMouse, isClickable } from 'blecsd';
2122
+ *
2123
+ * enableMouse(world, button);
2124
+ * disableMouse(world, button);
2125
+ *
2126
+ * isClickable(world, button); // false
2127
+ * ```
2128
+ */
2129
+ declare function disableMouse(world: World, eid: Entity): Entity;
2130
+ /**
2131
+ * Enables key events on an entity.
2132
+ * Sets keyable to true.
2133
+ *
2134
+ * @param world - The ECS world
2135
+ * @param eid - The entity ID
2136
+ * @returns The entity ID for chaining
2137
+ *
2138
+ * @example
2139
+ * ```typescript
2140
+ * import { enableKeys, isKeyable } from 'blecsd';
2141
+ *
2142
+ * enableKeys(world, textInput);
2143
+ *
2144
+ * isKeyable(world, textInput); // true
2145
+ * ```
2146
+ */
2147
+ declare function enableKeys(world: World, eid: Entity): Entity;
2148
+ /**
2149
+ * Disables key events on an entity.
2150
+ * Sets keyable to false.
2151
+ *
2152
+ * @param world - The ECS world
2153
+ * @param eid - The entity ID
2154
+ * @returns The entity ID for chaining
2155
+ *
2156
+ * @example
2157
+ * ```typescript
2158
+ * import { enableKeys, disableKeys, isKeyable } from 'blecsd';
2159
+ *
2160
+ * enableKeys(world, textInput);
2161
+ * disableKeys(world, textInput);
2162
+ *
2163
+ * isKeyable(world, textInput); // false
2164
+ * ```
2165
+ */
2166
+ declare function disableKeys(world: World, eid: Entity): Entity;
2167
+ /**
2168
+ * Enables all input (mouse and keys) on an entity.
2169
+ * Sets clickable, hoverable, and keyable to true.
2170
+ *
2171
+ * @param world - The ECS world
2172
+ * @param eid - The entity ID
2173
+ * @returns The entity ID for chaining
2174
+ *
2175
+ * @example
2176
+ * ```typescript
2177
+ * import { enableInput, isClickable, isHoverable, isKeyable } from 'blecsd';
2178
+ *
2179
+ * enableInput(world, widget);
2180
+ *
2181
+ * isClickable(world, widget); // true
2182
+ * isHoverable(world, widget); // true
2183
+ * isKeyable(world, widget); // true
2184
+ * ```
2185
+ */
2186
+ declare function enableInput(world: World, eid: Entity): Entity;
2187
+ /**
2188
+ * Disables all input (mouse and keys) on an entity.
2189
+ * Sets clickable, hoverable, and keyable to false.
2190
+ *
2191
+ * @param world - The ECS world
2192
+ * @param eid - The entity ID
2193
+ * @returns The entity ID for chaining
2194
+ *
2195
+ * @example
2196
+ * ```typescript
2197
+ * import { enableInput, disableInput, isClickable } from 'blecsd';
2198
+ *
2199
+ * enableInput(world, widget);
2200
+ * disableInput(world, widget);
2201
+ *
2202
+ * isClickable(world, widget); // false
2203
+ * ```
2204
+ */
2205
+ declare function disableInput(world: World, eid: Entity): Entity;
2206
+ /**
2207
+ * Checks if an entity has mouse input enabled.
2208
+ * Returns true if either clickable or hoverable is enabled.
2209
+ *
2210
+ * @param world - The ECS world
2211
+ * @param eid - The entity ID
2212
+ * @returns true if mouse input is enabled
2213
+ */
2214
+ declare function hasMouseEnabled(world: World, eid: Entity): boolean;
2215
+ /**
2216
+ * Checks if an entity has key input enabled.
2217
+ *
2218
+ * @param world - The ECS world
2219
+ * @param eid - The entity ID
2220
+ * @returns true if key input is enabled
2221
+ */
2222
+ declare function hasKeysEnabled(world: World, eid: Entity): boolean;
2223
+ /**
2224
+ * Checks if an entity has any input enabled (mouse or keys).
2225
+ *
2226
+ * @param world - The ECS world
2227
+ * @param eid - The entity ID
2228
+ * @returns true if any input is enabled
2229
+ */
2230
+ declare function hasInputEnabled(world: World, eid: Entity): boolean;
2231
+ /**
2232
+ * Enables an entity, allowing it to receive input and focus.
2233
+ * Disabled entities are skipped in focus traversal and ignore input.
2234
+ *
2235
+ * @param world - The ECS world
2236
+ * @param eid - The entity ID
2237
+ * @returns The entity ID for chaining
2238
+ *
2239
+ * @example
2240
+ * ```typescript
2241
+ * import { enable, disable, isEnabled } from 'blecsd';
2242
+ *
2243
+ * // Disable a button temporarily
2244
+ * disable(world, button);
2245
+ *
2246
+ * // Re-enable it later
2247
+ * enable(world, button);
2248
+ * ```
2249
+ */
2250
+ declare function enable(world: World, eid: Entity): Entity;
2251
+ /**
2252
+ * Disables an entity, preventing it from receiving input and focus.
2253
+ * Disabled entities are skipped in focus traversal and ignore input.
2254
+ *
2255
+ * @param world - The ECS world
2256
+ * @param eid - The entity ID
2257
+ * @returns The entity ID for chaining
2258
+ *
2259
+ * @example
2260
+ * ```typescript
2261
+ * import { enable, disable, isEnabled } from 'blecsd';
2262
+ *
2263
+ * // Disable a form field while loading
2264
+ * disable(world, formField);
2265
+ *
2266
+ * // Re-enable when ready
2267
+ * enable(world, formField);
2268
+ * ```
2269
+ */
2270
+ declare function disable(world: World, eid: Entity): Entity;
2271
+ /**
2272
+ * Checks if an entity is enabled.
2273
+ * Disabled entities cannot receive input or focus.
2274
+ *
2275
+ * @param world - The ECS world
2276
+ * @param eid - The entity ID
2277
+ * @returns true if entity is enabled (default: true)
2278
+ *
2279
+ * @example
2280
+ * ```typescript
2281
+ * import { isEnabled, disable } from 'blecsd';
2282
+ *
2283
+ * if (isEnabled(world, button)) {
2284
+ * // Process click
2285
+ * } else {
2286
+ * // Show disabled styling
2287
+ * }
2288
+ * ```
2289
+ */
2290
+ declare function isEnabled(world: World, eid: Entity): boolean;
2291
+
2292
+ export { detach as $, setTextAlign as A, setTextVAlign as B, setTextWrap as C, setParseTags as D, isParsingTags as E, isTextWrapped as F, getFocusable as G, hasFocusable as H, setFocusable as I, focus as J, blur as K, isFocusable as L, isFocused as M, makeFocusable as N, getFocusedEntity as O, Position as P, getTabIndex as Q, setTabIndex as R, getTabOrder as S, TextAlign as T, isInTabOrder as U, Velocity as V, resetFocusState as W, getHierarchy as X, hasHierarchy as Y, appendChild as Z, removeChild as _, disableKeys as a, setVelocityOptions as a$, setParent as a0, insertAt as a1, insertBefore as a2, insertAfter as a3, getParent as a4, getChildren as a5, getFirstChild as a6, getLastChild as a7, getChildAt as a8, getChildIndex as a9, setDraggable as aA, isHoverable as aB, setHoverable as aC, isKeyable as aD, setKeyable as aE, isHovered as aF, setHovered as aG, isPressed as aH, setPressed as aI, getFocusEffect as aJ, setFocusEffect as aK, setFocusedState as aL, clearInteractionState as aM, hasPosition as aN, moveBy as aO, setPositionKeyword as aP, setPositionPercent as aQ, setAbsolute as aR, isAbsolute as aS, bringToFront as aT, sendToBack as aU, moveForward as aV, moveBackward as aW, swapZIndex as aX, hasVelocity as aY, addVelocity as aZ, removeVelocity as a_, getSiblings as aa, getNextSibling as ab, getPrevSibling as ac, getRoot as ad, getDepth as ae, getAncestors as af, getDescendants as ag, getCommonAncestor as ah, hasAncestor as ai, hasDescendant as aj, forAncestors as ak, forDescendants as al, isRoot as am, isLeaf as an, getInteractive as ao, hasInteractive as ap, setInteractive as aq, enable as ar, disable as as, isEnabled as at, hasInputEnabled as au, hasKeysEnabled as av, hasMouseEnabled as aw, isClickable as ax, setClickable as ay, isDraggable as az, disableMouse as b, getSpeed as b0, setMaxSpeed as b1, setFriction as b2, stopEntity as b3, applyVelocityToEntity as b4, clampSpeedForEntity as b5, applyFrictionToEntity as b6, updateEntityMovement as b7, getAcceleration as b8, hasAcceleration as b9, type VelocityData as bA, type VelocityOptions as bB, contentStore as bC, resetContentStore as bD, setAcceleration as ba, clearAcceleration as bb, removeAcceleration as bc, applyAccelerationToEntity as bd, Acceleration as be, type AccelerationData as bf, Content as bg, type ContentData as bh, type ContentOptions as bi, DEFAULT_FOCUS_BG as bj, DEFAULT_FOCUS_FG as bk, DEFAULT_HOVER_BG as bl, DEFAULT_HOVER_FG as bm, Focusable as bn, type FocusableData as bo, type FocusableOptions as bp, Hierarchy as bq, type HierarchyData as br, Interactive as bs, type InteractiveData as bt, type InteractiveOptions as bu, NULL_ENTITY as bv, type PositionData as bw, type PositionKeyword as bx, TextVAlign as by, type TraversalCallback as bz, enableKeys as c, disableInput as d, enableInput as e, enableMouse as f, focusNext as g, focusPrev as h, getPosition as i, getText as j, getVelocity as k, getZIndex as l, setText as m, normalizeZIndices as n, setVelocity as o, prepend as p, setZIndex as q, setContent as r, setPosition as s, getContent as t, hasContent as u, getContentData as v, getContentHash as w, getContentLength as x, appendContent as y, clearContent as z };