blecsd 0.1.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 (109) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +220 -0
  3. package/dist/3d/index.d.ts +5 -0
  4. package/dist/3d/index.js +1 -0
  5. package/dist/audio/index.d.ts +177 -0
  6. package/dist/audio/index.js +1 -0
  7. package/dist/border-D_Jb4ZJV.d.ts +257 -0
  8. package/dist/cell-DwIu2ryP.d.ts +505 -0
  9. package/dist/chunk-2UBBZFE4.js +1 -0
  10. package/dist/chunk-35LCBY6P.js +1 -0
  11. package/dist/chunk-3B7MIVW6.js +1 -0
  12. package/dist/chunk-3EGGGI5J.js +3 -0
  13. package/dist/chunk-4LWWONFK.js +1 -0
  14. package/dist/chunk-4X4N4HNQ.js +2 -0
  15. package/dist/chunk-5PELJRUQ.js +1 -0
  16. package/dist/chunk-AEJIX2MW.js +1 -0
  17. package/dist/chunk-AQ7LW75B.js +1 -0
  18. package/dist/chunk-AXZQAH4X.js +1 -0
  19. package/dist/chunk-B6Z2JFRY.js +1 -0
  20. package/dist/chunk-BCADUCOZ.js +1 -0
  21. package/dist/chunk-C5PCEQ6G.js +1 -0
  22. package/dist/chunk-CIK4AMUA.js +1 -0
  23. package/dist/chunk-DNRXW56C.js +1 -0
  24. package/dist/chunk-FC5FFAAC.js +12 -0
  25. package/dist/chunk-FGHEFXLK.js +1 -0
  26. package/dist/chunk-FYEBZAWN.js +1 -0
  27. package/dist/chunk-G7GIWWLE.js +1 -0
  28. package/dist/chunk-GYHI26UE.js +1 -0
  29. package/dist/chunk-H2YAOJDW.js +1 -0
  30. package/dist/chunk-J4JZ2NU2.js +1 -0
  31. package/dist/chunk-JKVHO4LH.js +1 -0
  32. package/dist/chunk-K2B2OXQ5.js +5 -0
  33. package/dist/chunk-K37L3G4Z.js +4 -0
  34. package/dist/chunk-KD55INV7.js +1 -0
  35. package/dist/chunk-KFAK4A3G.js +1 -0
  36. package/dist/chunk-LCN2ZITE.js +1 -0
  37. package/dist/chunk-LYSK5S63.js +1 -0
  38. package/dist/chunk-NZ55KBM6.js +1 -0
  39. package/dist/chunk-OMMJ7B5P.js +1 -0
  40. package/dist/chunk-OUXUPF3V.js +33 -0
  41. package/dist/chunk-OVT2PPGW.js +19 -0
  42. package/dist/chunk-P6CJO3BC.js +1 -0
  43. package/dist/chunk-PSXXMBVJ.js +1 -0
  44. package/dist/chunk-PXXGH3BV.js +1 -0
  45. package/dist/chunk-QIKIOVP2.js +1 -0
  46. package/dist/chunk-SHUC6JWA.js +1 -0
  47. package/dist/chunk-TDXJDLY6.js +6 -0
  48. package/dist/chunk-TWSWTBYL.js +1 -0
  49. package/dist/chunk-TYMY2TBR.js +3 -0
  50. package/dist/chunk-VNZ6CWJA.js +2 -0
  51. package/dist/chunk-VOCM5T2G.js +5 -0
  52. package/dist/chunk-W5OU7Z6J.js +1 -0
  53. package/dist/chunk-WNG4A3K7.js +4 -0
  54. package/dist/chunk-XQIGERNI.js +1 -0
  55. package/dist/chunk-XZA63ZPO.js +1 -0
  56. package/dist/chunk-YAMOSPWB.js +4 -0
  57. package/dist/chunk-YD6ULIUR.js +1 -0
  58. package/dist/chunk-Z4EZERNE.js +1 -0
  59. package/dist/cli/init.d.ts +86 -0
  60. package/dist/cli/init.js +179 -0
  61. package/dist/color-B78w3zH-.d.ts +79 -0
  62. package/dist/components/index.d.ts +10298 -0
  63. package/dist/components/index.js +1 -0
  64. package/dist/core/index.d.ts +6700 -0
  65. package/dist/core/index.js +1 -0
  66. package/dist/debug/index.d.ts +711 -0
  67. package/dist/debug/index.js +1 -0
  68. package/dist/doubleBuffer-CKQFmlPN.d.ts +95 -0
  69. package/dist/errors/index.d.ts +1110 -0
  70. package/dist/errors/index.js +1 -0
  71. package/dist/events-BbbxkgvX.d.ts +125 -0
  72. package/dist/game/index.d.ts +486 -0
  73. package/dist/game/index.js +1 -0
  74. package/dist/gameLoop-BIPW7-OY.d.ts +219 -0
  75. package/dist/index-zSGJ2eUk.d.ts +3156 -0
  76. package/dist/index.d.ts +246 -0
  77. package/dist/index.js +1 -0
  78. package/dist/input/index.d.ts +158 -0
  79. package/dist/input/index.js +1 -0
  80. package/dist/inputActions-CefRUBuT.d.ts +2637 -0
  81. package/dist/keyParser-Bwm8-l7v.d.ts +229 -0
  82. package/dist/mouseParser-Cfrbn3AX.d.ts +177 -0
  83. package/dist/parser-iMHmQuUh.d.ts +265 -0
  84. package/dist/program-BZaKqDKH.d.ts +141 -0
  85. package/dist/renderable-jTMOA-GK.d.ts +302 -0
  86. package/dist/scheduler-DcfoFuum.d.ts +86 -0
  87. package/dist/schemas/index.d.ts +936 -0
  88. package/dist/schemas/index.js +1 -0
  89. package/dist/systems/index.d.ts +4036 -0
  90. package/dist/systems/index.js +1 -0
  91. package/dist/terminal/index.d.ts +7357 -0
  92. package/dist/terminal/index.js +1 -0
  93. package/dist/terminus-14-bold-HWSPRLJD.js +1 -0
  94. package/dist/terminus-14-normal-T3SWMH4D.js +1 -0
  95. package/dist/tilemap-D1HJvKy3.d.ts +1211 -0
  96. package/dist/types-BcsvoKzf.d.ts +68 -0
  97. package/dist/utils/index.d.ts +6104 -0
  98. package/dist/utils/index.js +1 -0
  99. package/dist/viewport3d-xI33-_wq.d.ts +182 -0
  100. package/dist/virtualScrollback-DvZTRU8a.d.ts +274 -0
  101. package/dist/virtualViewport-Dx2iJliO.d.ts +2334 -0
  102. package/dist/virtualizedLineStore-DwPEvPkk.d.ts +297 -0
  103. package/dist/widgets/bigText.d.ts +230 -0
  104. package/dist/widgets/bigText.js +1 -0
  105. package/dist/widgets/fonts/index.d.ts +211 -0
  106. package/dist/widgets/fonts/index.js +1 -0
  107. package/dist/widgets/index.d.ts +8591 -0
  108. package/dist/widgets/index.js +1 -0
  109. package/package.json +213 -0
@@ -0,0 +1,2637 @@
1
+ import { z } from 'zod';
2
+ import { f as BorderCharset } from './border-D_Jb4ZJV.js';
3
+ import { W as World, E as Entity } from './types-BcsvoKzf.js';
4
+ import { M as MouseEvent, c as MouseButton } from './mouseParser-Cfrbn3AX.js';
5
+ import { b as KeyEvent, K as KeyName } from './keyParser-Bwm8-l7v.js';
6
+
7
+ /**
8
+ * Entity factory functions for creating common entity types.
9
+ * These are internal factories used by the Game class.
10
+ * @module core/entities
11
+ */
12
+
13
+ /**
14
+ * Zod schema for validating box entity configuration.
15
+ *
16
+ * Box entities are basic container elements with position, dimensions,
17
+ * optional border, padding, and styling. They serve as the foundation
18
+ * for layout and grouping other elements.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { BoxConfigSchema } from 'blecsd';
23
+ *
24
+ * const config = BoxConfigSchema.parse({
25
+ * x: 10,
26
+ * y: 5,
27
+ * width: 40,
28
+ * height: 10,
29
+ * fg: 0xffffffff,
30
+ * bg: 0x0000ffff,
31
+ * border: {
32
+ * type: 1,
33
+ * left: true,
34
+ * right: true,
35
+ * top: true,
36
+ * bottom: true,
37
+ * },
38
+ * });
39
+ * ```
40
+ */
41
+ declare const BoxConfigSchema: z.ZodObject<{
42
+ parent: z.ZodOptional<z.ZodNumber>;
43
+ border: z.ZodOptional<z.ZodObject<{
44
+ type: z.ZodOptional<z.ZodNumber>;
45
+ left: z.ZodOptional<z.ZodBoolean>;
46
+ right: z.ZodOptional<z.ZodBoolean>;
47
+ top: z.ZodOptional<z.ZodBoolean>;
48
+ bottom: z.ZodOptional<z.ZodBoolean>;
49
+ fg: z.ZodOptional<z.ZodNumber>;
50
+ bg: z.ZodOptional<z.ZodNumber>;
51
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
52
+ }, z.core.$strip>>;
53
+ padding: z.ZodOptional<z.ZodObject<{
54
+ left: z.ZodOptional<z.ZodNumber>;
55
+ right: z.ZodOptional<z.ZodNumber>;
56
+ top: z.ZodOptional<z.ZodNumber>;
57
+ bottom: z.ZodOptional<z.ZodNumber>;
58
+ }, z.core.$strip>>;
59
+ x: z.ZodOptional<z.ZodNumber>;
60
+ y: z.ZodOptional<z.ZodNumber>;
61
+ z: z.ZodOptional<z.ZodNumber>;
62
+ absolute: z.ZodOptional<z.ZodBoolean>;
63
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
64
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
65
+ minWidth: z.ZodOptional<z.ZodNumber>;
66
+ maxWidth: z.ZodOptional<z.ZodNumber>;
67
+ minHeight: z.ZodOptional<z.ZodNumber>;
68
+ maxHeight: z.ZodOptional<z.ZodNumber>;
69
+ shrink: z.ZodOptional<z.ZodBoolean>;
70
+ fg: z.ZodOptional<z.ZodNumber>;
71
+ bg: z.ZodOptional<z.ZodNumber>;
72
+ bold: z.ZodOptional<z.ZodBoolean>;
73
+ italic: z.ZodOptional<z.ZodBoolean>;
74
+ underline: z.ZodOptional<z.ZodBoolean>;
75
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
76
+ dim: z.ZodOptional<z.ZodBoolean>;
77
+ inverse: z.ZodOptional<z.ZodBoolean>;
78
+ blink: z.ZodOptional<z.ZodBoolean>;
79
+ visible: z.ZodOptional<z.ZodBoolean>;
80
+ }, z.core.$strip>;
81
+ /**
82
+ * Configuration options for creating a box entity.
83
+ *
84
+ * @see {@link BoxConfigSchema} for validation
85
+ * @see {@link createBoxEntity} for entity creation
86
+ */
87
+ type BoxConfig = z.infer<typeof BoxConfigSchema>;
88
+ /**
89
+ * Zod schema for validating text entity configuration.
90
+ *
91
+ * Text entities display content with optional styling, border, alignment,
92
+ * and text wrapping. They support both plain text and tag-parsed content.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * import { TextConfigSchema, TextAlign, TextVAlign } from 'blecsd';
97
+ *
98
+ * const config = TextConfigSchema.parse({
99
+ * x: 5,
100
+ * y: 2,
101
+ * text: 'Hello, World!',
102
+ * fg: 0x00ff00ff,
103
+ * align: TextAlign.Center,
104
+ * valign: TextVAlign.Middle,
105
+ * wrap: true,
106
+ * });
107
+ * ```
108
+ */
109
+ declare const TextConfigSchema: z.ZodObject<{
110
+ parent: z.ZodOptional<z.ZodNumber>;
111
+ border: z.ZodOptional<z.ZodObject<{
112
+ type: z.ZodOptional<z.ZodNumber>;
113
+ left: z.ZodOptional<z.ZodBoolean>;
114
+ right: z.ZodOptional<z.ZodBoolean>;
115
+ top: z.ZodOptional<z.ZodBoolean>;
116
+ bottom: z.ZodOptional<z.ZodBoolean>;
117
+ fg: z.ZodOptional<z.ZodNumber>;
118
+ bg: z.ZodOptional<z.ZodNumber>;
119
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
120
+ }, z.core.$strip>>;
121
+ padding: z.ZodOptional<z.ZodObject<{
122
+ left: z.ZodOptional<z.ZodNumber>;
123
+ right: z.ZodOptional<z.ZodNumber>;
124
+ top: z.ZodOptional<z.ZodNumber>;
125
+ bottom: z.ZodOptional<z.ZodNumber>;
126
+ }, z.core.$strip>>;
127
+ x: z.ZodOptional<z.ZodNumber>;
128
+ y: z.ZodOptional<z.ZodNumber>;
129
+ z: z.ZodOptional<z.ZodNumber>;
130
+ absolute: z.ZodOptional<z.ZodBoolean>;
131
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
132
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
133
+ minWidth: z.ZodOptional<z.ZodNumber>;
134
+ maxWidth: z.ZodOptional<z.ZodNumber>;
135
+ minHeight: z.ZodOptional<z.ZodNumber>;
136
+ maxHeight: z.ZodOptional<z.ZodNumber>;
137
+ shrink: z.ZodOptional<z.ZodBoolean>;
138
+ fg: z.ZodOptional<z.ZodNumber>;
139
+ bg: z.ZodOptional<z.ZodNumber>;
140
+ bold: z.ZodOptional<z.ZodBoolean>;
141
+ italic: z.ZodOptional<z.ZodBoolean>;
142
+ underline: z.ZodOptional<z.ZodBoolean>;
143
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
144
+ dim: z.ZodOptional<z.ZodBoolean>;
145
+ inverse: z.ZodOptional<z.ZodBoolean>;
146
+ blink: z.ZodOptional<z.ZodBoolean>;
147
+ visible: z.ZodOptional<z.ZodBoolean>;
148
+ text: z.ZodOptional<z.ZodString>;
149
+ align: z.ZodOptional<z.ZodNumber>;
150
+ valign: z.ZodOptional<z.ZodNumber>;
151
+ wrap: z.ZodOptional<z.ZodBoolean>;
152
+ parseTags: z.ZodOptional<z.ZodBoolean>;
153
+ }, z.core.$strip>;
154
+ /**
155
+ * Configuration options for creating a text entity.
156
+ *
157
+ * @see {@link TextConfigSchema} for validation
158
+ * @see {@link createTextEntity} for entity creation
159
+ */
160
+ type TextConfig = z.infer<typeof TextConfigSchema>;
161
+ /**
162
+ * Zod schema for validating button entity configuration.
163
+ *
164
+ * Button entities are interactive elements with focus support, hover effects,
165
+ * and click handling. They display a centered label and respond to keyboard
166
+ * and mouse input.
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * import { ButtonConfigSchema, BorderType } from 'blecsd';
171
+ *
172
+ * const config = ButtonConfigSchema.parse({
173
+ * x: 10,
174
+ * y: 5,
175
+ * width: 12,
176
+ * height: 3,
177
+ * label: 'Submit',
178
+ * clickable: true,
179
+ * hoverable: true,
180
+ * focusable: true,
181
+ * border: {
182
+ * type: BorderType.Line,
183
+ * left: true,
184
+ * right: true,
185
+ * top: true,
186
+ * bottom: true,
187
+ * },
188
+ * });
189
+ * ```
190
+ */
191
+ declare const ButtonConfigSchema: z.ZodObject<{
192
+ parent: z.ZodOptional<z.ZodNumber>;
193
+ label: z.ZodOptional<z.ZodString>;
194
+ border: z.ZodOptional<z.ZodObject<{
195
+ type: z.ZodOptional<z.ZodNumber>;
196
+ left: z.ZodOptional<z.ZodBoolean>;
197
+ right: z.ZodOptional<z.ZodBoolean>;
198
+ top: z.ZodOptional<z.ZodBoolean>;
199
+ bottom: z.ZodOptional<z.ZodBoolean>;
200
+ fg: z.ZodOptional<z.ZodNumber>;
201
+ bg: z.ZodOptional<z.ZodNumber>;
202
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
203
+ }, z.core.$strip>>;
204
+ padding: z.ZodOptional<z.ZodObject<{
205
+ left: z.ZodOptional<z.ZodNumber>;
206
+ right: z.ZodOptional<z.ZodNumber>;
207
+ top: z.ZodOptional<z.ZodNumber>;
208
+ bottom: z.ZodOptional<z.ZodNumber>;
209
+ }, z.core.$strip>>;
210
+ x: z.ZodOptional<z.ZodNumber>;
211
+ y: z.ZodOptional<z.ZodNumber>;
212
+ z: z.ZodOptional<z.ZodNumber>;
213
+ absolute: z.ZodOptional<z.ZodBoolean>;
214
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
215
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
216
+ minWidth: z.ZodOptional<z.ZodNumber>;
217
+ maxWidth: z.ZodOptional<z.ZodNumber>;
218
+ minHeight: z.ZodOptional<z.ZodNumber>;
219
+ maxHeight: z.ZodOptional<z.ZodNumber>;
220
+ shrink: z.ZodOptional<z.ZodBoolean>;
221
+ fg: z.ZodOptional<z.ZodNumber>;
222
+ bg: z.ZodOptional<z.ZodNumber>;
223
+ bold: z.ZodOptional<z.ZodBoolean>;
224
+ italic: z.ZodOptional<z.ZodBoolean>;
225
+ underline: z.ZodOptional<z.ZodBoolean>;
226
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
227
+ dim: z.ZodOptional<z.ZodBoolean>;
228
+ inverse: z.ZodOptional<z.ZodBoolean>;
229
+ blink: z.ZodOptional<z.ZodBoolean>;
230
+ visible: z.ZodOptional<z.ZodBoolean>;
231
+ clickable: z.ZodOptional<z.ZodBoolean>;
232
+ draggable: z.ZodOptional<z.ZodBoolean>;
233
+ hoverable: z.ZodOptional<z.ZodBoolean>;
234
+ keyable: z.ZodOptional<z.ZodBoolean>;
235
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
236
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
237
+ focusable: z.ZodOptional<z.ZodBoolean>;
238
+ tabIndex: z.ZodOptional<z.ZodNumber>;
239
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
240
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
241
+ }, z.core.$strip>;
242
+ /**
243
+ * Configuration options for creating a button entity.
244
+ *
245
+ * @see {@link ButtonConfigSchema} for validation
246
+ * @see {@link createButtonEntity} for entity creation
247
+ */
248
+ type ButtonConfig = z.infer<typeof ButtonConfigSchema>;
249
+ /**
250
+ * Zod schema for validating screen entity configuration.
251
+ *
252
+ * Screen entities are the root container for all other entities. They represent
253
+ * the terminal viewport and define the coordinate space for child elements.
254
+ * Width and height are required and must be positive integers.
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * import { ScreenConfigSchema } from 'blecsd';
259
+ *
260
+ * const config = ScreenConfigSchema.parse({
261
+ * width: 80,
262
+ * height: 24,
263
+ * title: 'My Terminal App',
264
+ * });
265
+ * ```
266
+ */
267
+ declare const ScreenConfigSchema: z.ZodObject<{
268
+ width: z.ZodNumber;
269
+ height: z.ZodNumber;
270
+ title: z.ZodOptional<z.ZodString>;
271
+ cursorVisible: z.ZodOptional<z.ZodBoolean>;
272
+ cursorShape: z.ZodOptional<z.ZodNumber>;
273
+ fullUnicode: z.ZodOptional<z.ZodBoolean>;
274
+ autoPadding: z.ZodOptional<z.ZodBoolean>;
275
+ }, z.core.$strip>;
276
+ /**
277
+ * Configuration options for creating a screen entity.
278
+ * Width and height are required.
279
+ *
280
+ * @see {@link ScreenConfigSchema} for validation
281
+ * @see {@link createScreenEntity} for entity creation
282
+ */
283
+ type ScreenConfig = z.infer<typeof ScreenConfigSchema>;
284
+ /**
285
+ * Zod schema for validating input entity configuration.
286
+ *
287
+ * Input entities are text input fields with focus and key handling.
288
+ * They support placeholder text, maximum length constraints, and
289
+ * visual feedback for focus and hover states.
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * import { InputConfigSchema } from 'blecsd';
294
+ *
295
+ * const config = InputConfigSchema.parse({
296
+ * x: 10,
297
+ * y: 5,
298
+ * width: 30,
299
+ * height: 1,
300
+ * value: '',
301
+ * placeholder: 'Enter your name...',
302
+ * maxLength: 100,
303
+ * focusable: true,
304
+ * focusEffectFg: 0x00ff00ff,
305
+ * focusEffectBg: 0x111111ff,
306
+ * });
307
+ * ```
308
+ */
309
+ declare const InputConfigSchema: z.ZodObject<{
310
+ parent: z.ZodOptional<z.ZodNumber>;
311
+ value: z.ZodOptional<z.ZodString>;
312
+ placeholder: z.ZodOptional<z.ZodString>;
313
+ maxLength: z.ZodOptional<z.ZodNumber>;
314
+ border: z.ZodOptional<z.ZodObject<{
315
+ type: z.ZodOptional<z.ZodNumber>;
316
+ left: z.ZodOptional<z.ZodBoolean>;
317
+ right: z.ZodOptional<z.ZodBoolean>;
318
+ top: z.ZodOptional<z.ZodBoolean>;
319
+ bottom: z.ZodOptional<z.ZodBoolean>;
320
+ fg: z.ZodOptional<z.ZodNumber>;
321
+ bg: z.ZodOptional<z.ZodNumber>;
322
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
323
+ }, z.core.$strip>>;
324
+ padding: z.ZodOptional<z.ZodObject<{
325
+ left: z.ZodOptional<z.ZodNumber>;
326
+ right: z.ZodOptional<z.ZodNumber>;
327
+ top: z.ZodOptional<z.ZodNumber>;
328
+ bottom: z.ZodOptional<z.ZodNumber>;
329
+ }, z.core.$strip>>;
330
+ x: z.ZodOptional<z.ZodNumber>;
331
+ y: z.ZodOptional<z.ZodNumber>;
332
+ z: z.ZodOptional<z.ZodNumber>;
333
+ absolute: z.ZodOptional<z.ZodBoolean>;
334
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
335
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
336
+ minWidth: z.ZodOptional<z.ZodNumber>;
337
+ maxWidth: z.ZodOptional<z.ZodNumber>;
338
+ minHeight: z.ZodOptional<z.ZodNumber>;
339
+ maxHeight: z.ZodOptional<z.ZodNumber>;
340
+ shrink: z.ZodOptional<z.ZodBoolean>;
341
+ fg: z.ZodOptional<z.ZodNumber>;
342
+ bg: z.ZodOptional<z.ZodNumber>;
343
+ bold: z.ZodOptional<z.ZodBoolean>;
344
+ italic: z.ZodOptional<z.ZodBoolean>;
345
+ underline: z.ZodOptional<z.ZodBoolean>;
346
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
347
+ dim: z.ZodOptional<z.ZodBoolean>;
348
+ inverse: z.ZodOptional<z.ZodBoolean>;
349
+ blink: z.ZodOptional<z.ZodBoolean>;
350
+ visible: z.ZodOptional<z.ZodBoolean>;
351
+ clickable: z.ZodOptional<z.ZodBoolean>;
352
+ draggable: z.ZodOptional<z.ZodBoolean>;
353
+ hoverable: z.ZodOptional<z.ZodBoolean>;
354
+ keyable: z.ZodOptional<z.ZodBoolean>;
355
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
356
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
357
+ focusable: z.ZodOptional<z.ZodBoolean>;
358
+ tabIndex: z.ZodOptional<z.ZodNumber>;
359
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
360
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
361
+ }, z.core.$strip>;
362
+ /**
363
+ * Configuration options for creating an input entity.
364
+ *
365
+ * @see {@link InputConfigSchema} for validation
366
+ * @see {@link createInputEntity} for entity creation
367
+ */
368
+ type InputConfig = z.infer<typeof InputConfigSchema>;
369
+ /**
370
+ * Zod schema for validating list entity configuration.
371
+ *
372
+ * List entities display a scrollable list of items with selection support.
373
+ * They are focusable, respond to keyboard navigation, and support
374
+ * configurable scrollbar visibility.
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * import { ListConfigSchema } from 'blecsd';
379
+ *
380
+ * const config = ListConfigSchema.parse({
381
+ * x: 5,
382
+ * y: 5,
383
+ * width: 30,
384
+ * height: 10,
385
+ * items: ['Option 1', 'Option 2', 'Option 3'],
386
+ * selectedIndex: 0,
387
+ * scrollable: true,
388
+ * focusable: true,
389
+ * border: {
390
+ * type: 1,
391
+ * left: true,
392
+ * right: true,
393
+ * top: true,
394
+ * bottom: true,
395
+ * },
396
+ * });
397
+ * ```
398
+ */
399
+ declare const ListConfigSchema: z.ZodObject<{
400
+ parent: z.ZodOptional<z.ZodNumber>;
401
+ items: z.ZodOptional<z.ZodArray<z.ZodString>>;
402
+ selectedIndex: z.ZodOptional<z.ZodNumber>;
403
+ border: z.ZodOptional<z.ZodObject<{
404
+ type: z.ZodOptional<z.ZodNumber>;
405
+ left: z.ZodOptional<z.ZodBoolean>;
406
+ right: z.ZodOptional<z.ZodBoolean>;
407
+ top: z.ZodOptional<z.ZodBoolean>;
408
+ bottom: z.ZodOptional<z.ZodBoolean>;
409
+ fg: z.ZodOptional<z.ZodNumber>;
410
+ bg: z.ZodOptional<z.ZodNumber>;
411
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
412
+ }, z.core.$strip>>;
413
+ padding: z.ZodOptional<z.ZodObject<{
414
+ left: z.ZodOptional<z.ZodNumber>;
415
+ right: z.ZodOptional<z.ZodNumber>;
416
+ top: z.ZodOptional<z.ZodNumber>;
417
+ bottom: z.ZodOptional<z.ZodNumber>;
418
+ }, z.core.$strip>>;
419
+ x: z.ZodOptional<z.ZodNumber>;
420
+ y: z.ZodOptional<z.ZodNumber>;
421
+ z: z.ZodOptional<z.ZodNumber>;
422
+ absolute: z.ZodOptional<z.ZodBoolean>;
423
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
424
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
425
+ minWidth: z.ZodOptional<z.ZodNumber>;
426
+ maxWidth: z.ZodOptional<z.ZodNumber>;
427
+ minHeight: z.ZodOptional<z.ZodNumber>;
428
+ maxHeight: z.ZodOptional<z.ZodNumber>;
429
+ shrink: z.ZodOptional<z.ZodBoolean>;
430
+ fg: z.ZodOptional<z.ZodNumber>;
431
+ bg: z.ZodOptional<z.ZodNumber>;
432
+ bold: z.ZodOptional<z.ZodBoolean>;
433
+ italic: z.ZodOptional<z.ZodBoolean>;
434
+ underline: z.ZodOptional<z.ZodBoolean>;
435
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
436
+ dim: z.ZodOptional<z.ZodBoolean>;
437
+ inverse: z.ZodOptional<z.ZodBoolean>;
438
+ blink: z.ZodOptional<z.ZodBoolean>;
439
+ visible: z.ZodOptional<z.ZodBoolean>;
440
+ scrollable: z.ZodOptional<z.ZodBoolean>;
441
+ scrollX: z.ZodOptional<z.ZodNumber>;
442
+ scrollY: z.ZodOptional<z.ZodNumber>;
443
+ scrollWidth: z.ZodOptional<z.ZodNumber>;
444
+ scrollHeight: z.ZodOptional<z.ZodNumber>;
445
+ scrollbarVisible: z.ZodOptional<z.ZodNumber>;
446
+ focusable: z.ZodOptional<z.ZodBoolean>;
447
+ tabIndex: z.ZodOptional<z.ZodNumber>;
448
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
449
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
450
+ }, z.core.$strip>;
451
+ /**
452
+ * Configuration options for creating a list entity.
453
+ *
454
+ * @see {@link ListConfigSchema} for validation
455
+ * @see {@link createListEntity} for entity creation
456
+ */
457
+ type ListConfig = z.infer<typeof ListConfigSchema>;
458
+ /**
459
+ * Zod schema for validating checkbox entity configuration.
460
+ *
461
+ * Checkbox entities are toggle controls with checked/unchecked states.
462
+ * They support keyboard interaction (Enter/Space to toggle), focus handling,
463
+ * and customizable display characters for both states.
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * import { CheckboxConfigSchema } from 'blecsd';
468
+ *
469
+ * const config = CheckboxConfigSchema.parse({
470
+ * x: 5,
471
+ * y: 10,
472
+ * label: 'Accept terms and conditions',
473
+ * checked: false,
474
+ * checkedChar: '☑',
475
+ * uncheckedChar: '☐',
476
+ * focusable: true,
477
+ * });
478
+ * ```
479
+ */
480
+ declare const CheckboxConfigSchema: z.ZodObject<{
481
+ parent: z.ZodOptional<z.ZodNumber>;
482
+ label: z.ZodOptional<z.ZodString>;
483
+ checked: z.ZodOptional<z.ZodBoolean>;
484
+ checkedChar: z.ZodOptional<z.ZodString>;
485
+ uncheckedChar: z.ZodOptional<z.ZodString>;
486
+ border: z.ZodOptional<z.ZodObject<{
487
+ type: z.ZodOptional<z.ZodNumber>;
488
+ left: z.ZodOptional<z.ZodBoolean>;
489
+ right: z.ZodOptional<z.ZodBoolean>;
490
+ top: z.ZodOptional<z.ZodBoolean>;
491
+ bottom: z.ZodOptional<z.ZodBoolean>;
492
+ fg: z.ZodOptional<z.ZodNumber>;
493
+ bg: z.ZodOptional<z.ZodNumber>;
494
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
495
+ }, z.core.$strip>>;
496
+ padding: z.ZodOptional<z.ZodObject<{
497
+ left: z.ZodOptional<z.ZodNumber>;
498
+ right: z.ZodOptional<z.ZodNumber>;
499
+ top: z.ZodOptional<z.ZodNumber>;
500
+ bottom: z.ZodOptional<z.ZodNumber>;
501
+ }, z.core.$strip>>;
502
+ x: z.ZodOptional<z.ZodNumber>;
503
+ y: z.ZodOptional<z.ZodNumber>;
504
+ z: z.ZodOptional<z.ZodNumber>;
505
+ absolute: z.ZodOptional<z.ZodBoolean>;
506
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
507
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
508
+ minWidth: z.ZodOptional<z.ZodNumber>;
509
+ maxWidth: z.ZodOptional<z.ZodNumber>;
510
+ minHeight: z.ZodOptional<z.ZodNumber>;
511
+ maxHeight: z.ZodOptional<z.ZodNumber>;
512
+ shrink: z.ZodOptional<z.ZodBoolean>;
513
+ fg: z.ZodOptional<z.ZodNumber>;
514
+ bg: z.ZodOptional<z.ZodNumber>;
515
+ bold: z.ZodOptional<z.ZodBoolean>;
516
+ italic: z.ZodOptional<z.ZodBoolean>;
517
+ underline: z.ZodOptional<z.ZodBoolean>;
518
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
519
+ dim: z.ZodOptional<z.ZodBoolean>;
520
+ inverse: z.ZodOptional<z.ZodBoolean>;
521
+ blink: z.ZodOptional<z.ZodBoolean>;
522
+ visible: z.ZodOptional<z.ZodBoolean>;
523
+ clickable: z.ZodOptional<z.ZodBoolean>;
524
+ draggable: z.ZodOptional<z.ZodBoolean>;
525
+ hoverable: z.ZodOptional<z.ZodBoolean>;
526
+ keyable: z.ZodOptional<z.ZodBoolean>;
527
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
528
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
529
+ focusable: z.ZodOptional<z.ZodBoolean>;
530
+ tabIndex: z.ZodOptional<z.ZodNumber>;
531
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
532
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
533
+ }, z.core.$strip>;
534
+ /**
535
+ * Configuration options for creating a checkbox entity.
536
+ *
537
+ * @see {@link CheckboxConfigSchema} for validation
538
+ * @see {@link createCheckboxEntity} for entity creation
539
+ */
540
+ type CheckboxConfig = z.infer<typeof CheckboxConfigSchema>;
541
+ /**
542
+ * Zod schema for validating textbox entity configuration.
543
+ *
544
+ * Textbox entities are single-line text input fields with cursor support,
545
+ * password masking, placeholder text, and keyboard navigation. They support
546
+ * Enter to submit, Escape to cancel, and standard text editing keys.
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * import { TextboxConfigSchema } from 'blecsd';
551
+ *
552
+ * const config = TextboxConfigSchema.parse({
553
+ * x: 10,
554
+ * y: 5,
555
+ * width: 30,
556
+ * value: '',
557
+ * placeholder: 'Enter your name...',
558
+ * maxLength: 50,
559
+ * focusable: true,
560
+ * });
561
+ *
562
+ * // Password field
563
+ * const passwordConfig = TextboxConfigSchema.parse({
564
+ * x: 10,
565
+ * y: 8,
566
+ * width: 30,
567
+ * secret: true,
568
+ * censor: '*',
569
+ * placeholder: 'Enter password...',
570
+ * });
571
+ * ```
572
+ */
573
+ declare const TextboxConfigSchema: z.ZodObject<{
574
+ parent: z.ZodOptional<z.ZodNumber>;
575
+ value: z.ZodOptional<z.ZodString>;
576
+ placeholder: z.ZodOptional<z.ZodString>;
577
+ secret: z.ZodOptional<z.ZodBoolean>;
578
+ censor: z.ZodOptional<z.ZodString>;
579
+ maxLength: z.ZodOptional<z.ZodNumber>;
580
+ border: z.ZodOptional<z.ZodObject<{
581
+ type: z.ZodOptional<z.ZodNumber>;
582
+ left: z.ZodOptional<z.ZodBoolean>;
583
+ right: z.ZodOptional<z.ZodBoolean>;
584
+ top: z.ZodOptional<z.ZodBoolean>;
585
+ bottom: z.ZodOptional<z.ZodBoolean>;
586
+ fg: z.ZodOptional<z.ZodNumber>;
587
+ bg: z.ZodOptional<z.ZodNumber>;
588
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
589
+ }, z.core.$strip>>;
590
+ padding: z.ZodOptional<z.ZodObject<{
591
+ left: z.ZodOptional<z.ZodNumber>;
592
+ right: z.ZodOptional<z.ZodNumber>;
593
+ top: z.ZodOptional<z.ZodNumber>;
594
+ bottom: z.ZodOptional<z.ZodNumber>;
595
+ }, z.core.$strip>>;
596
+ x: z.ZodOptional<z.ZodNumber>;
597
+ y: z.ZodOptional<z.ZodNumber>;
598
+ z: z.ZodOptional<z.ZodNumber>;
599
+ absolute: z.ZodOptional<z.ZodBoolean>;
600
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
601
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
602
+ minWidth: z.ZodOptional<z.ZodNumber>;
603
+ maxWidth: z.ZodOptional<z.ZodNumber>;
604
+ minHeight: z.ZodOptional<z.ZodNumber>;
605
+ maxHeight: z.ZodOptional<z.ZodNumber>;
606
+ shrink: z.ZodOptional<z.ZodBoolean>;
607
+ fg: z.ZodOptional<z.ZodNumber>;
608
+ bg: z.ZodOptional<z.ZodNumber>;
609
+ bold: z.ZodOptional<z.ZodBoolean>;
610
+ italic: z.ZodOptional<z.ZodBoolean>;
611
+ underline: z.ZodOptional<z.ZodBoolean>;
612
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
613
+ dim: z.ZodOptional<z.ZodBoolean>;
614
+ inverse: z.ZodOptional<z.ZodBoolean>;
615
+ blink: z.ZodOptional<z.ZodBoolean>;
616
+ visible: z.ZodOptional<z.ZodBoolean>;
617
+ clickable: z.ZodOptional<z.ZodBoolean>;
618
+ draggable: z.ZodOptional<z.ZodBoolean>;
619
+ hoverable: z.ZodOptional<z.ZodBoolean>;
620
+ keyable: z.ZodOptional<z.ZodBoolean>;
621
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
622
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
623
+ focusable: z.ZodOptional<z.ZodBoolean>;
624
+ tabIndex: z.ZodOptional<z.ZodNumber>;
625
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
626
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
627
+ }, z.core.$strip>;
628
+ /**
629
+ * Configuration options for creating a textbox entity.
630
+ *
631
+ * @see {@link TextboxConfigSchema} for validation
632
+ * @see {@link createTextboxEntity} for entity creation
633
+ */
634
+ type TextboxConfig = z.infer<typeof TextboxConfigSchema>;
635
+ /**
636
+ * Zod schema for validating textarea entity configuration.
637
+ *
638
+ * Textarea entities are multi-line text input fields. They support Enter for
639
+ * new lines, scrolling when content exceeds visible area, and submit via
640
+ * Escape or Ctrl+Enter.
641
+ *
642
+ * @example
643
+ * ```typescript
644
+ * import { TextareaConfigSchema } from 'blecsd';
645
+ *
646
+ * const config = TextareaConfigSchema.parse({
647
+ * x: 10,
648
+ * y: 5,
649
+ * width: 40,
650
+ * height: 5,
651
+ * placeholder: 'Enter your message...',
652
+ * scrollable: true,
653
+ * });
654
+ * ```
655
+ */
656
+ declare const TextareaConfigSchema: z.ZodObject<{
657
+ parent: z.ZodOptional<z.ZodNumber>;
658
+ value: z.ZodOptional<z.ZodString>;
659
+ placeholder: z.ZodOptional<z.ZodString>;
660
+ maxLength: z.ZodOptional<z.ZodNumber>;
661
+ border: z.ZodOptional<z.ZodObject<{
662
+ type: z.ZodOptional<z.ZodNumber>;
663
+ left: z.ZodOptional<z.ZodBoolean>;
664
+ right: z.ZodOptional<z.ZodBoolean>;
665
+ top: z.ZodOptional<z.ZodBoolean>;
666
+ bottom: z.ZodOptional<z.ZodBoolean>;
667
+ fg: z.ZodOptional<z.ZodNumber>;
668
+ bg: z.ZodOptional<z.ZodNumber>;
669
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
670
+ }, z.core.$strip>>;
671
+ padding: z.ZodOptional<z.ZodObject<{
672
+ left: z.ZodOptional<z.ZodNumber>;
673
+ right: z.ZodOptional<z.ZodNumber>;
674
+ top: z.ZodOptional<z.ZodNumber>;
675
+ bottom: z.ZodOptional<z.ZodNumber>;
676
+ }, z.core.$strip>>;
677
+ x: z.ZodOptional<z.ZodNumber>;
678
+ y: z.ZodOptional<z.ZodNumber>;
679
+ z: z.ZodOptional<z.ZodNumber>;
680
+ absolute: z.ZodOptional<z.ZodBoolean>;
681
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
682
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
683
+ minWidth: z.ZodOptional<z.ZodNumber>;
684
+ maxWidth: z.ZodOptional<z.ZodNumber>;
685
+ minHeight: z.ZodOptional<z.ZodNumber>;
686
+ maxHeight: z.ZodOptional<z.ZodNumber>;
687
+ shrink: z.ZodOptional<z.ZodBoolean>;
688
+ fg: z.ZodOptional<z.ZodNumber>;
689
+ bg: z.ZodOptional<z.ZodNumber>;
690
+ bold: z.ZodOptional<z.ZodBoolean>;
691
+ italic: z.ZodOptional<z.ZodBoolean>;
692
+ underline: z.ZodOptional<z.ZodBoolean>;
693
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
694
+ dim: z.ZodOptional<z.ZodBoolean>;
695
+ inverse: z.ZodOptional<z.ZodBoolean>;
696
+ blink: z.ZodOptional<z.ZodBoolean>;
697
+ visible: z.ZodOptional<z.ZodBoolean>;
698
+ clickable: z.ZodOptional<z.ZodBoolean>;
699
+ draggable: z.ZodOptional<z.ZodBoolean>;
700
+ hoverable: z.ZodOptional<z.ZodBoolean>;
701
+ keyable: z.ZodOptional<z.ZodBoolean>;
702
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
703
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
704
+ focusable: z.ZodOptional<z.ZodBoolean>;
705
+ tabIndex: z.ZodOptional<z.ZodNumber>;
706
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
707
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
708
+ scrollable: z.ZodOptional<z.ZodBoolean>;
709
+ scrollX: z.ZodOptional<z.ZodNumber>;
710
+ scrollY: z.ZodOptional<z.ZodNumber>;
711
+ scrollWidth: z.ZodOptional<z.ZodNumber>;
712
+ scrollHeight: z.ZodOptional<z.ZodNumber>;
713
+ scrollbarVisible: z.ZodOptional<z.ZodNumber>;
714
+ }, z.core.$strip>;
715
+ /**
716
+ * Configuration options for creating a textarea entity.
717
+ *
718
+ * @see {@link TextareaConfigSchema} for validation
719
+ * @see {@link createTextareaEntity} for entity creation
720
+ */
721
+ type TextareaConfig = z.infer<typeof TextareaConfigSchema>;
722
+ /**
723
+ * Zod schema for validating select/dropdown entity configuration.
724
+ *
725
+ * Select entities are dropdown controls with a list of options.
726
+ * They support click to open, keyboard navigation, and selection.
727
+ *
728
+ * @example
729
+ * ```typescript
730
+ * import { SelectConfigSchema } from 'blecsd';
731
+ *
732
+ * const config = SelectConfigSchema.parse({
733
+ * x: 10,
734
+ * y: 5,
735
+ * width: 30,
736
+ * options: [
737
+ * { label: 'Option 1', value: 'opt1' },
738
+ * { label: 'Option 2', value: 'opt2' },
739
+ * ],
740
+ * selectedIndex: 0,
741
+ * placeholder: 'Select an option...',
742
+ * });
743
+ * ```
744
+ */
745
+ declare const SelectConfigSchema: z.ZodObject<{
746
+ parent: z.ZodOptional<z.ZodNumber>;
747
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
748
+ label: z.ZodString;
749
+ value: z.ZodString;
750
+ }, z.core.$strip>>>;
751
+ selectedIndex: z.ZodOptional<z.ZodNumber>;
752
+ placeholder: z.ZodOptional<z.ZodString>;
753
+ closedIndicator: z.ZodOptional<z.ZodString>;
754
+ openIndicator: z.ZodOptional<z.ZodString>;
755
+ selectedMark: z.ZodOptional<z.ZodString>;
756
+ border: z.ZodOptional<z.ZodObject<{
757
+ type: z.ZodOptional<z.ZodNumber>;
758
+ left: z.ZodOptional<z.ZodBoolean>;
759
+ right: z.ZodOptional<z.ZodBoolean>;
760
+ top: z.ZodOptional<z.ZodBoolean>;
761
+ bottom: z.ZodOptional<z.ZodBoolean>;
762
+ fg: z.ZodOptional<z.ZodNumber>;
763
+ bg: z.ZodOptional<z.ZodNumber>;
764
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
765
+ }, z.core.$strip>>;
766
+ padding: z.ZodOptional<z.ZodObject<{
767
+ left: z.ZodOptional<z.ZodNumber>;
768
+ right: z.ZodOptional<z.ZodNumber>;
769
+ top: z.ZodOptional<z.ZodNumber>;
770
+ bottom: z.ZodOptional<z.ZodNumber>;
771
+ }, z.core.$strip>>;
772
+ x: z.ZodOptional<z.ZodNumber>;
773
+ y: z.ZodOptional<z.ZodNumber>;
774
+ z: z.ZodOptional<z.ZodNumber>;
775
+ absolute: z.ZodOptional<z.ZodBoolean>;
776
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
777
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
778
+ minWidth: z.ZodOptional<z.ZodNumber>;
779
+ maxWidth: z.ZodOptional<z.ZodNumber>;
780
+ minHeight: z.ZodOptional<z.ZodNumber>;
781
+ maxHeight: z.ZodOptional<z.ZodNumber>;
782
+ shrink: z.ZodOptional<z.ZodBoolean>;
783
+ fg: z.ZodOptional<z.ZodNumber>;
784
+ bg: z.ZodOptional<z.ZodNumber>;
785
+ bold: z.ZodOptional<z.ZodBoolean>;
786
+ italic: z.ZodOptional<z.ZodBoolean>;
787
+ underline: z.ZodOptional<z.ZodBoolean>;
788
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
789
+ dim: z.ZodOptional<z.ZodBoolean>;
790
+ inverse: z.ZodOptional<z.ZodBoolean>;
791
+ blink: z.ZodOptional<z.ZodBoolean>;
792
+ visible: z.ZodOptional<z.ZodBoolean>;
793
+ clickable: z.ZodOptional<z.ZodBoolean>;
794
+ draggable: z.ZodOptional<z.ZodBoolean>;
795
+ hoverable: z.ZodOptional<z.ZodBoolean>;
796
+ keyable: z.ZodOptional<z.ZodBoolean>;
797
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
798
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
799
+ focusable: z.ZodOptional<z.ZodBoolean>;
800
+ tabIndex: z.ZodOptional<z.ZodNumber>;
801
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
802
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
803
+ }, z.core.$strip>;
804
+ /**
805
+ * Configuration options for creating a select entity.
806
+ *
807
+ * @see {@link SelectConfigSchema} for validation
808
+ * @see {@link createSelectEntity} for entity creation
809
+ */
810
+ type SelectConfig = z.infer<typeof SelectConfigSchema>;
811
+ /**
812
+ * Zod schema for validating slider entity configuration.
813
+ *
814
+ * Slider entities are range input controls with a track and thumb.
815
+ * They support click/drag to change value, keyboard navigation,
816
+ * and customizable display.
817
+ *
818
+ * @example
819
+ * ```typescript
820
+ * import { SliderConfigSchema } from 'blecsd';
821
+ *
822
+ * const config = SliderConfigSchema.parse({
823
+ * x: 10,
824
+ * y: 5,
825
+ * width: 30,
826
+ * min: 0,
827
+ * max: 100,
828
+ * value: 50,
829
+ * step: 5,
830
+ * showValue: true,
831
+ * });
832
+ * ```
833
+ */
834
+ declare const SliderConfigSchema: z.ZodObject<{
835
+ parent: z.ZodOptional<z.ZodNumber>;
836
+ min: z.ZodOptional<z.ZodNumber>;
837
+ max: z.ZodOptional<z.ZodNumber>;
838
+ value: z.ZodOptional<z.ZodNumber>;
839
+ step: z.ZodOptional<z.ZodNumber>;
840
+ orientation: z.ZodOptional<z.ZodNumber>;
841
+ showValue: z.ZodOptional<z.ZodBoolean>;
842
+ trackChar: z.ZodOptional<z.ZodString>;
843
+ thumbChar: z.ZodOptional<z.ZodString>;
844
+ fillChar: z.ZodOptional<z.ZodString>;
845
+ trackFg: z.ZodOptional<z.ZodNumber>;
846
+ trackBg: z.ZodOptional<z.ZodNumber>;
847
+ thumbFg: z.ZodOptional<z.ZodNumber>;
848
+ thumbBg: z.ZodOptional<z.ZodNumber>;
849
+ fillFg: z.ZodOptional<z.ZodNumber>;
850
+ fillBg: z.ZodOptional<z.ZodNumber>;
851
+ border: z.ZodOptional<z.ZodObject<{
852
+ type: z.ZodOptional<z.ZodNumber>;
853
+ left: z.ZodOptional<z.ZodBoolean>;
854
+ right: z.ZodOptional<z.ZodBoolean>;
855
+ top: z.ZodOptional<z.ZodBoolean>;
856
+ bottom: z.ZodOptional<z.ZodBoolean>;
857
+ fg: z.ZodOptional<z.ZodNumber>;
858
+ bg: z.ZodOptional<z.ZodNumber>;
859
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
860
+ }, z.core.$strip>>;
861
+ padding: z.ZodOptional<z.ZodObject<{
862
+ left: z.ZodOptional<z.ZodNumber>;
863
+ right: z.ZodOptional<z.ZodNumber>;
864
+ top: z.ZodOptional<z.ZodNumber>;
865
+ bottom: z.ZodOptional<z.ZodNumber>;
866
+ }, z.core.$strip>>;
867
+ x: z.ZodOptional<z.ZodNumber>;
868
+ y: z.ZodOptional<z.ZodNumber>;
869
+ z: z.ZodOptional<z.ZodNumber>;
870
+ absolute: z.ZodOptional<z.ZodBoolean>;
871
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
872
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
873
+ minWidth: z.ZodOptional<z.ZodNumber>;
874
+ maxWidth: z.ZodOptional<z.ZodNumber>;
875
+ minHeight: z.ZodOptional<z.ZodNumber>;
876
+ maxHeight: z.ZodOptional<z.ZodNumber>;
877
+ shrink: z.ZodOptional<z.ZodBoolean>;
878
+ fg: z.ZodOptional<z.ZodNumber>;
879
+ bg: z.ZodOptional<z.ZodNumber>;
880
+ bold: z.ZodOptional<z.ZodBoolean>;
881
+ italic: z.ZodOptional<z.ZodBoolean>;
882
+ underline: z.ZodOptional<z.ZodBoolean>;
883
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
884
+ dim: z.ZodOptional<z.ZodBoolean>;
885
+ inverse: z.ZodOptional<z.ZodBoolean>;
886
+ blink: z.ZodOptional<z.ZodBoolean>;
887
+ visible: z.ZodOptional<z.ZodBoolean>;
888
+ clickable: z.ZodOptional<z.ZodBoolean>;
889
+ draggable: z.ZodOptional<z.ZodBoolean>;
890
+ hoverable: z.ZodOptional<z.ZodBoolean>;
891
+ keyable: z.ZodOptional<z.ZodBoolean>;
892
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
893
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
894
+ focusable: z.ZodOptional<z.ZodBoolean>;
895
+ tabIndex: z.ZodOptional<z.ZodNumber>;
896
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
897
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
898
+ }, z.core.$strip>;
899
+ /**
900
+ * Configuration options for creating a slider entity.
901
+ *
902
+ * @see {@link SliderConfigSchema} for validation
903
+ * @see {@link createSliderEntity} for entity creation
904
+ */
905
+ type SliderConfig = z.infer<typeof SliderConfigSchema>;
906
+ /**
907
+ * Schema for validating form configuration.
908
+ */
909
+ declare const FormConfigSchema: z.ZodObject<{
910
+ parent: z.ZodOptional<z.ZodNumber>;
911
+ keys: z.ZodOptional<z.ZodBoolean>;
912
+ submitOnEnter: z.ZodOptional<z.ZodBoolean>;
913
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
914
+ name: z.ZodString;
915
+ entity: z.ZodNumber;
916
+ initialValue: z.ZodOptional<z.ZodUnknown>;
917
+ }, z.core.$strip>>>;
918
+ border: z.ZodOptional<z.ZodObject<{
919
+ type: z.ZodOptional<z.ZodNumber>;
920
+ left: z.ZodOptional<z.ZodBoolean>;
921
+ right: z.ZodOptional<z.ZodBoolean>;
922
+ top: z.ZodOptional<z.ZodBoolean>;
923
+ bottom: z.ZodOptional<z.ZodBoolean>;
924
+ fg: z.ZodOptional<z.ZodNumber>;
925
+ bg: z.ZodOptional<z.ZodNumber>;
926
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
927
+ }, z.core.$strip>>;
928
+ padding: z.ZodOptional<z.ZodObject<{
929
+ left: z.ZodOptional<z.ZodNumber>;
930
+ right: z.ZodOptional<z.ZodNumber>;
931
+ top: z.ZodOptional<z.ZodNumber>;
932
+ bottom: z.ZodOptional<z.ZodNumber>;
933
+ }, z.core.$strip>>;
934
+ x: z.ZodOptional<z.ZodNumber>;
935
+ y: z.ZodOptional<z.ZodNumber>;
936
+ z: z.ZodOptional<z.ZodNumber>;
937
+ absolute: z.ZodOptional<z.ZodBoolean>;
938
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
939
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
940
+ minWidth: z.ZodOptional<z.ZodNumber>;
941
+ maxWidth: z.ZodOptional<z.ZodNumber>;
942
+ minHeight: z.ZodOptional<z.ZodNumber>;
943
+ maxHeight: z.ZodOptional<z.ZodNumber>;
944
+ shrink: z.ZodOptional<z.ZodBoolean>;
945
+ fg: z.ZodOptional<z.ZodNumber>;
946
+ bg: z.ZodOptional<z.ZodNumber>;
947
+ bold: z.ZodOptional<z.ZodBoolean>;
948
+ italic: z.ZodOptional<z.ZodBoolean>;
949
+ underline: z.ZodOptional<z.ZodBoolean>;
950
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
951
+ dim: z.ZodOptional<z.ZodBoolean>;
952
+ inverse: z.ZodOptional<z.ZodBoolean>;
953
+ blink: z.ZodOptional<z.ZodBoolean>;
954
+ visible: z.ZodOptional<z.ZodBoolean>;
955
+ }, z.core.$strip>;
956
+ /**
957
+ * Configuration options for creating a form entity.
958
+ *
959
+ * @see {@link FormConfigSchema} for validation
960
+ * @see {@link createFormEntity} for entity creation
961
+ */
962
+ type FormConfig = z.infer<typeof FormConfigSchema>;
963
+ /**
964
+ * Schema for validating progress bar configuration.
965
+ */
966
+ declare const ProgressBarConfigSchema: z.ZodObject<{
967
+ parent: z.ZodOptional<z.ZodNumber>;
968
+ value: z.ZodOptional<z.ZodNumber>;
969
+ min: z.ZodOptional<z.ZodNumber>;
970
+ max: z.ZodOptional<z.ZodNumber>;
971
+ orientation: z.ZodOptional<z.ZodNumber>;
972
+ showPercentage: z.ZodOptional<z.ZodBoolean>;
973
+ fillChar: z.ZodOptional<z.ZodString>;
974
+ emptyChar: z.ZodOptional<z.ZodString>;
975
+ fillFg: z.ZodOptional<z.ZodNumber>;
976
+ fillBg: z.ZodOptional<z.ZodNumber>;
977
+ emptyFg: z.ZodOptional<z.ZodNumber>;
978
+ emptyBg: z.ZodOptional<z.ZodNumber>;
979
+ border: z.ZodOptional<z.ZodObject<{
980
+ type: z.ZodOptional<z.ZodNumber>;
981
+ left: z.ZodOptional<z.ZodBoolean>;
982
+ right: z.ZodOptional<z.ZodBoolean>;
983
+ top: z.ZodOptional<z.ZodBoolean>;
984
+ bottom: z.ZodOptional<z.ZodBoolean>;
985
+ fg: z.ZodOptional<z.ZodNumber>;
986
+ bg: z.ZodOptional<z.ZodNumber>;
987
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
988
+ }, z.core.$strip>>;
989
+ padding: z.ZodOptional<z.ZodObject<{
990
+ left: z.ZodOptional<z.ZodNumber>;
991
+ right: z.ZodOptional<z.ZodNumber>;
992
+ top: z.ZodOptional<z.ZodNumber>;
993
+ bottom: z.ZodOptional<z.ZodNumber>;
994
+ }, z.core.$strip>>;
995
+ x: z.ZodOptional<z.ZodNumber>;
996
+ y: z.ZodOptional<z.ZodNumber>;
997
+ z: z.ZodOptional<z.ZodNumber>;
998
+ absolute: z.ZodOptional<z.ZodBoolean>;
999
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
1000
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
1001
+ minWidth: z.ZodOptional<z.ZodNumber>;
1002
+ maxWidth: z.ZodOptional<z.ZodNumber>;
1003
+ minHeight: z.ZodOptional<z.ZodNumber>;
1004
+ maxHeight: z.ZodOptional<z.ZodNumber>;
1005
+ shrink: z.ZodOptional<z.ZodBoolean>;
1006
+ fg: z.ZodOptional<z.ZodNumber>;
1007
+ bg: z.ZodOptional<z.ZodNumber>;
1008
+ bold: z.ZodOptional<z.ZodBoolean>;
1009
+ italic: z.ZodOptional<z.ZodBoolean>;
1010
+ underline: z.ZodOptional<z.ZodBoolean>;
1011
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
1012
+ dim: z.ZodOptional<z.ZodBoolean>;
1013
+ inverse: z.ZodOptional<z.ZodBoolean>;
1014
+ blink: z.ZodOptional<z.ZodBoolean>;
1015
+ visible: z.ZodOptional<z.ZodBoolean>;
1016
+ }, z.core.$strip>;
1017
+ /**
1018
+ * Configuration options for creating a progress bar entity.
1019
+ *
1020
+ * @see {@link ProgressBarConfigSchema} for validation
1021
+ * @see {@link createProgressBarEntity} for entity creation
1022
+ */
1023
+ type ProgressBarConfig = z.infer<typeof ProgressBarConfigSchema>;
1024
+ /**
1025
+ * Schema for validating radio set configuration.
1026
+ */
1027
+ declare const RadioSetConfigSchema: z.ZodObject<{
1028
+ parent: z.ZodOptional<z.ZodNumber>;
1029
+ selectedIndex: z.ZodOptional<z.ZodNumber>;
1030
+ border: z.ZodOptional<z.ZodObject<{
1031
+ type: z.ZodOptional<z.ZodNumber>;
1032
+ left: z.ZodOptional<z.ZodBoolean>;
1033
+ right: z.ZodOptional<z.ZodBoolean>;
1034
+ top: z.ZodOptional<z.ZodBoolean>;
1035
+ bottom: z.ZodOptional<z.ZodBoolean>;
1036
+ fg: z.ZodOptional<z.ZodNumber>;
1037
+ bg: z.ZodOptional<z.ZodNumber>;
1038
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
1039
+ }, z.core.$strip>>;
1040
+ padding: z.ZodOptional<z.ZodObject<{
1041
+ left: z.ZodOptional<z.ZodNumber>;
1042
+ right: z.ZodOptional<z.ZodNumber>;
1043
+ top: z.ZodOptional<z.ZodNumber>;
1044
+ bottom: z.ZodOptional<z.ZodNumber>;
1045
+ }, z.core.$strip>>;
1046
+ x: z.ZodOptional<z.ZodNumber>;
1047
+ y: z.ZodOptional<z.ZodNumber>;
1048
+ z: z.ZodOptional<z.ZodNumber>;
1049
+ absolute: z.ZodOptional<z.ZodBoolean>;
1050
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
1051
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
1052
+ minWidth: z.ZodOptional<z.ZodNumber>;
1053
+ maxWidth: z.ZodOptional<z.ZodNumber>;
1054
+ minHeight: z.ZodOptional<z.ZodNumber>;
1055
+ maxHeight: z.ZodOptional<z.ZodNumber>;
1056
+ shrink: z.ZodOptional<z.ZodBoolean>;
1057
+ fg: z.ZodOptional<z.ZodNumber>;
1058
+ bg: z.ZodOptional<z.ZodNumber>;
1059
+ bold: z.ZodOptional<z.ZodBoolean>;
1060
+ italic: z.ZodOptional<z.ZodBoolean>;
1061
+ underline: z.ZodOptional<z.ZodBoolean>;
1062
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
1063
+ dim: z.ZodOptional<z.ZodBoolean>;
1064
+ inverse: z.ZodOptional<z.ZodBoolean>;
1065
+ blink: z.ZodOptional<z.ZodBoolean>;
1066
+ visible: z.ZodOptional<z.ZodBoolean>;
1067
+ }, z.core.$strip>;
1068
+ /**
1069
+ * Configuration options for creating a radio set entity.
1070
+ *
1071
+ * @see {@link RadioSetConfigSchema} for validation
1072
+ * @see {@link createRadioSetEntity} for entity creation
1073
+ */
1074
+ type RadioSetConfig = z.infer<typeof RadioSetConfigSchema>;
1075
+ /**
1076
+ * Schema for validating radio button configuration.
1077
+ */
1078
+ declare const RadioButtonConfigSchema: z.ZodObject<{
1079
+ parent: z.ZodOptional<z.ZodNumber>;
1080
+ radioSet: z.ZodOptional<z.ZodNumber>;
1081
+ value: z.ZodOptional<z.ZodString>;
1082
+ label: z.ZodOptional<z.ZodString>;
1083
+ selected: z.ZodOptional<z.ZodBoolean>;
1084
+ selectedChar: z.ZodOptional<z.ZodString>;
1085
+ unselectedChar: z.ZodOptional<z.ZodString>;
1086
+ border: z.ZodOptional<z.ZodObject<{
1087
+ type: z.ZodOptional<z.ZodNumber>;
1088
+ left: z.ZodOptional<z.ZodBoolean>;
1089
+ right: z.ZodOptional<z.ZodBoolean>;
1090
+ top: z.ZodOptional<z.ZodBoolean>;
1091
+ bottom: z.ZodOptional<z.ZodBoolean>;
1092
+ fg: z.ZodOptional<z.ZodNumber>;
1093
+ bg: z.ZodOptional<z.ZodNumber>;
1094
+ chars: z.ZodOptional<z.ZodCustom<BorderCharset, BorderCharset>>;
1095
+ }, z.core.$strip>>;
1096
+ padding: z.ZodOptional<z.ZodObject<{
1097
+ left: z.ZodOptional<z.ZodNumber>;
1098
+ right: z.ZodOptional<z.ZodNumber>;
1099
+ top: z.ZodOptional<z.ZodNumber>;
1100
+ bottom: z.ZodOptional<z.ZodNumber>;
1101
+ }, z.core.$strip>>;
1102
+ x: z.ZodOptional<z.ZodNumber>;
1103
+ y: z.ZodOptional<z.ZodNumber>;
1104
+ z: z.ZodOptional<z.ZodNumber>;
1105
+ absolute: z.ZodOptional<z.ZodBoolean>;
1106
+ width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
1107
+ height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
1108
+ minWidth: z.ZodOptional<z.ZodNumber>;
1109
+ maxWidth: z.ZodOptional<z.ZodNumber>;
1110
+ minHeight: z.ZodOptional<z.ZodNumber>;
1111
+ maxHeight: z.ZodOptional<z.ZodNumber>;
1112
+ shrink: z.ZodOptional<z.ZodBoolean>;
1113
+ fg: z.ZodOptional<z.ZodNumber>;
1114
+ bg: z.ZodOptional<z.ZodNumber>;
1115
+ bold: z.ZodOptional<z.ZodBoolean>;
1116
+ italic: z.ZodOptional<z.ZodBoolean>;
1117
+ underline: z.ZodOptional<z.ZodBoolean>;
1118
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
1119
+ dim: z.ZodOptional<z.ZodBoolean>;
1120
+ inverse: z.ZodOptional<z.ZodBoolean>;
1121
+ blink: z.ZodOptional<z.ZodBoolean>;
1122
+ visible: z.ZodOptional<z.ZodBoolean>;
1123
+ clickable: z.ZodOptional<z.ZodBoolean>;
1124
+ draggable: z.ZodOptional<z.ZodBoolean>;
1125
+ hoverable: z.ZodOptional<z.ZodBoolean>;
1126
+ keyable: z.ZodOptional<z.ZodBoolean>;
1127
+ hoverEffectFg: z.ZodOptional<z.ZodNumber>;
1128
+ hoverEffectBg: z.ZodOptional<z.ZodNumber>;
1129
+ focusable: z.ZodOptional<z.ZodBoolean>;
1130
+ tabIndex: z.ZodOptional<z.ZodNumber>;
1131
+ focusEffectFg: z.ZodOptional<z.ZodNumber>;
1132
+ focusEffectBg: z.ZodOptional<z.ZodNumber>;
1133
+ }, z.core.$strip>;
1134
+ /**
1135
+ * Configuration options for creating a radio button entity.
1136
+ *
1137
+ * @see {@link RadioButtonConfigSchema} for validation
1138
+ * @see {@link createRadioButtonEntity} for entity creation
1139
+ */
1140
+ type RadioButtonConfig = z.infer<typeof RadioButtonConfigSchema>;
1141
+ /**
1142
+ * Creates a Box entity with the specified configuration.
1143
+ *
1144
+ * Box is a basic container element with position, dimensions, optional border,
1145
+ * and padding. Boxes serve as the foundation for layout and grouping other
1146
+ * elements in the UI hierarchy.
1147
+ *
1148
+ * @param world - The ECS world to create the entity in
1149
+ * @param config - Optional box configuration options
1150
+ * @returns The created entity ID
1151
+ *
1152
+ * @example
1153
+ * ```typescript
1154
+ * import { createWorld, createBoxEntity, BorderType } from 'blecsd';
1155
+ *
1156
+ * const world = createWorld();
1157
+ *
1158
+ * // Create a simple box
1159
+ * const box = createBoxEntity(world, {
1160
+ * x: 10,
1161
+ * y: 5,
1162
+ * width: 40,
1163
+ * height: 10,
1164
+ * });
1165
+ *
1166
+ * // Create a styled box with border
1167
+ * const styledBox = createBoxEntity(world, {
1168
+ * x: 0,
1169
+ * y: 0,
1170
+ * width: 20,
1171
+ * height: 5,
1172
+ * fg: 0xffffffff,
1173
+ * bg: 0x0000ffff,
1174
+ * border: {
1175
+ * type: BorderType.Line,
1176
+ * left: true,
1177
+ * right: true,
1178
+ * top: true,
1179
+ * bottom: true,
1180
+ * },
1181
+ * padding: {
1182
+ * left: 1,
1183
+ * right: 1,
1184
+ * top: 0,
1185
+ * bottom: 0,
1186
+ * },
1187
+ * });
1188
+ *
1189
+ * // Create a child box
1190
+ * const childBox = createBoxEntity(world, {
1191
+ * parent: styledBox,
1192
+ * x: 2,
1193
+ * y: 1,
1194
+ * width: 10,
1195
+ * height: 3,
1196
+ * });
1197
+ * ```
1198
+ */
1199
+ declare function createBoxEntity(world: World, config?: BoxConfig): Entity;
1200
+ /**
1201
+ * Creates a Text entity with the specified configuration.
1202
+ *
1203
+ * Text entities display content with optional styling, border, and text alignment.
1204
+ * They support text wrapping, vertical and horizontal alignment, and tag parsing
1205
+ * for inline styling.
1206
+ *
1207
+ * @param world - The ECS world to create the entity in
1208
+ * @param config - Optional text configuration options
1209
+ * @returns The created entity ID
1210
+ *
1211
+ * @example
1212
+ * ```typescript
1213
+ * import { createWorld, createTextEntity, TextAlign, TextVAlign } from 'blecsd';
1214
+ *
1215
+ * const world = createWorld();
1216
+ *
1217
+ * // Create simple text
1218
+ * const text = createTextEntity(world, {
1219
+ * x: 5,
1220
+ * y: 2,
1221
+ * text: 'Hello, World!',
1222
+ * });
1223
+ *
1224
+ * // Create styled, centered text
1225
+ * const styledText = createTextEntity(world, {
1226
+ * x: 0,
1227
+ * y: 0,
1228
+ * width: 40,
1229
+ * height: 3,
1230
+ * text: 'Centered Title',
1231
+ * fg: 0x00ff00ff,
1232
+ * align: TextAlign.Center,
1233
+ * valign: TextVAlign.Middle,
1234
+ * });
1235
+ *
1236
+ * // Create wrapped text block
1237
+ * const paragraph = createTextEntity(world, {
1238
+ * x: 5,
1239
+ * y: 10,
1240
+ * width: 60,
1241
+ * text: 'This is a long paragraph that will wrap to fit within the specified width.',
1242
+ * wrap: true,
1243
+ * });
1244
+ * ```
1245
+ */
1246
+ declare function createTextEntity(world: World, config?: TextConfig): Entity;
1247
+ /**
1248
+ * Creates a Button entity with the specified configuration.
1249
+ *
1250
+ * Button entities are interactive elements with focus support, hover effects,
1251
+ * and click handling. They display a centered label and respond to keyboard
1252
+ * and mouse input. Buttons are focusable, clickable, and hoverable by default.
1253
+ *
1254
+ * @param world - The ECS world to create the entity in
1255
+ * @param config - Optional button configuration options
1256
+ * @returns The created entity ID
1257
+ *
1258
+ * @example
1259
+ * ```typescript
1260
+ * import { createWorld, createButtonEntity, BorderType } from 'blecsd';
1261
+ *
1262
+ * const world = createWorld();
1263
+ *
1264
+ * // Create a simple button
1265
+ * const button = createButtonEntity(world, {
1266
+ * x: 10,
1267
+ * y: 5,
1268
+ * width: 12,
1269
+ * height: 3,
1270
+ * label: 'Submit',
1271
+ * });
1272
+ *
1273
+ * // Create a styled button with border
1274
+ * const styledButton = createButtonEntity(world, {
1275
+ * x: 10,
1276
+ * y: 10,
1277
+ * width: 16,
1278
+ * height: 3,
1279
+ * label: 'Cancel',
1280
+ * fg: 0xffffffff,
1281
+ * bg: 0xff0000ff,
1282
+ * hoverEffectFg: 0xffffffff,
1283
+ * hoverEffectBg: 0xff4444ff,
1284
+ * focusEffectFg: 0xffffffff,
1285
+ * focusEffectBg: 0x0066ffff,
1286
+ * border: {
1287
+ * type: BorderType.Line,
1288
+ * left: true,
1289
+ * right: true,
1290
+ * top: true,
1291
+ * bottom: true,
1292
+ * },
1293
+ * });
1294
+ *
1295
+ * // Create a button with custom tab order
1296
+ * const tabButton = createButtonEntity(world, {
1297
+ * x: 30,
1298
+ * y: 5,
1299
+ * label: 'Next',
1300
+ * tabIndex: 2,
1301
+ * });
1302
+ * ```
1303
+ */
1304
+ declare function createButtonEntity(world: World, config?: ButtonConfig): Entity;
1305
+ /**
1306
+ * Creates a Screen entity with the specified configuration.
1307
+ *
1308
+ * Screen entities are the root container for all other entities. They represent
1309
+ * the terminal viewport and define the coordinate space for child elements.
1310
+ * Screens are always positioned at (0,0) and are always visible.
1311
+ *
1312
+ * @param world - The ECS world to create the entity in
1313
+ * @param config - Screen configuration with required width and height
1314
+ * @returns The created entity ID
1315
+ * @throws {ZodError} If width or height are missing or not positive integers
1316
+ *
1317
+ * @example
1318
+ * ```typescript
1319
+ * import { createWorld, createScreenEntity } from 'blecsd';
1320
+ *
1321
+ * const world = createWorld();
1322
+ *
1323
+ * // Create a screen matching terminal size
1324
+ * const screen = createScreenEntity(world, {
1325
+ * width: 80,
1326
+ * height: 24,
1327
+ * });
1328
+ *
1329
+ * // Create a screen with title
1330
+ * const namedScreen = createScreenEntity(world, {
1331
+ * width: 120,
1332
+ * height: 40,
1333
+ * title: 'My Terminal Game',
1334
+ * });
1335
+ * ```
1336
+ */
1337
+ declare function createScreenEntity(world: World, config: ScreenConfig): Entity;
1338
+ /**
1339
+ * Creates an Input entity with the specified configuration.
1340
+ *
1341
+ * Input entities are text input fields with focus and key handling.
1342
+ * They support placeholder text, maximum length constraints, and visual
1343
+ * feedback for focus and hover states. Inputs are focusable, clickable,
1344
+ * and keyable by default.
1345
+ *
1346
+ * @param world - The ECS world to create the entity in
1347
+ * @param config - Optional input configuration options
1348
+ * @returns The created entity ID
1349
+ *
1350
+ * @example
1351
+ * ```typescript
1352
+ * import { createWorld, createInputEntity, BorderType } from 'blecsd';
1353
+ *
1354
+ * const world = createWorld();
1355
+ *
1356
+ * // Create a simple input
1357
+ * const input = createInputEntity(world, {
1358
+ * x: 10,
1359
+ * y: 5,
1360
+ * width: 30,
1361
+ * height: 1,
1362
+ * });
1363
+ *
1364
+ * // Create an input with placeholder and validation
1365
+ * const emailInput = createInputEntity(world, {
1366
+ * x: 10,
1367
+ * y: 8,
1368
+ * width: 40,
1369
+ * height: 1,
1370
+ * value: '',
1371
+ * placeholder: 'Enter your email...',
1372
+ * maxLength: 100,
1373
+ * });
1374
+ *
1375
+ * // Create a styled input with custom focus colors
1376
+ * const styledInput = createInputEntity(world, {
1377
+ * x: 10,
1378
+ * y: 11,
1379
+ * width: 30,
1380
+ * height: 1,
1381
+ * focusEffectFg: 0x00ff00ff,
1382
+ * focusEffectBg: 0x111111ff,
1383
+ * border: {
1384
+ * type: BorderType.Line,
1385
+ * left: true,
1386
+ * right: true,
1387
+ * top: true,
1388
+ * bottom: true,
1389
+ * },
1390
+ * });
1391
+ * ```
1392
+ */
1393
+ declare function createInputEntity(world: World, config?: InputConfig): Entity;
1394
+ /**
1395
+ * Creates a List entity with the specified configuration.
1396
+ *
1397
+ * List entities display a scrollable list of items with selection support.
1398
+ * They are focusable, respond to keyboard navigation, and support configurable
1399
+ * scrollbar visibility. Items are stored as newline-separated content.
1400
+ *
1401
+ * @param world - The ECS world to create the entity in
1402
+ * @param config - Optional list configuration options
1403
+ * @returns The created entity ID
1404
+ *
1405
+ * @example
1406
+ * ```typescript
1407
+ * import { createWorld, createListEntity, BorderType } from 'blecsd';
1408
+ *
1409
+ * const world = createWorld();
1410
+ *
1411
+ * // Create a simple list
1412
+ * const list = createListEntity(world, {
1413
+ * x: 5,
1414
+ * y: 5,
1415
+ * width: 30,
1416
+ * height: 10,
1417
+ * items: ['Option 1', 'Option 2', 'Option 3'],
1418
+ * });
1419
+ *
1420
+ * // Create a list with selection and scrolling
1421
+ * const menuList = createListEntity(world, {
1422
+ * x: 0,
1423
+ * y: 0,
1424
+ * width: 25,
1425
+ * height: 8,
1426
+ * items: ['New Game', 'Load Game', 'Options', 'Credits', 'Exit'],
1427
+ * selectedIndex: 0,
1428
+ * scrollable: true,
1429
+ * border: {
1430
+ * type: BorderType.Line,
1431
+ * left: true,
1432
+ * right: true,
1433
+ * top: true,
1434
+ * bottom: true,
1435
+ * },
1436
+ * });
1437
+ *
1438
+ * // Create a list with custom focus styling
1439
+ * const styledList = createListEntity(world, {
1440
+ * x: 30,
1441
+ * y: 5,
1442
+ * width: 20,
1443
+ * height: 6,
1444
+ * items: ['Red', 'Green', 'Blue'],
1445
+ * focusEffectFg: 0xffff00ff,
1446
+ * focusEffectBg: 0x333333ff,
1447
+ * tabIndex: 1,
1448
+ * });
1449
+ * ```
1450
+ */
1451
+ declare function createListEntity(world: World, config?: ListConfig): Entity;
1452
+ /**
1453
+ * Creates a Checkbox entity with the specified configuration.
1454
+ *
1455
+ * Checkbox entities are toggle controls with checked/unchecked/disabled states.
1456
+ * They support keyboard interaction (Enter/Space to toggle), focus handling,
1457
+ * and customizable display characters. Checkboxes are focusable, clickable,
1458
+ * and keyable by default.
1459
+ *
1460
+ * The checkbox displays a check character followed by an optional label.
1461
+ * The display characters can be customized to use ASCII or Unicode symbols.
1462
+ *
1463
+ * @param world - The ECS world to create the entity in
1464
+ * @param config - Optional checkbox configuration options
1465
+ * @returns The created entity ID
1466
+ *
1467
+ * @example
1468
+ * ```typescript
1469
+ * import { createWorld, createCheckboxEntity } from 'blecsd';
1470
+ *
1471
+ * const world = createWorld();
1472
+ *
1473
+ * // Create a simple checkbox
1474
+ * const checkbox = createCheckboxEntity(world, {
1475
+ * x: 5,
1476
+ * y: 10,
1477
+ * label: 'Enable notifications',
1478
+ * });
1479
+ *
1480
+ * // Create a pre-checked checkbox
1481
+ * const acceptTerms = createCheckboxEntity(world, {
1482
+ * x: 5,
1483
+ * y: 12,
1484
+ * label: 'I accept the terms and conditions',
1485
+ * checked: true,
1486
+ * });
1487
+ *
1488
+ * // Create a checkbox with ASCII characters
1489
+ * const asciiCheckbox = createCheckboxEntity(world, {
1490
+ * x: 5,
1491
+ * y: 14,
1492
+ * label: 'Use ASCII mode',
1493
+ * checkedChar: '[x]',
1494
+ * uncheckedChar: '[ ]',
1495
+ * });
1496
+ *
1497
+ * // Create a styled checkbox with custom focus colors
1498
+ * const styledCheckbox = createCheckboxEntity(world, {
1499
+ * x: 5,
1500
+ * y: 16,
1501
+ * label: 'Dark mode',
1502
+ * focusEffectFg: 0x00ff00ff,
1503
+ * focusEffectBg: 0x111111ff,
1504
+ * tabIndex: 1,
1505
+ * });
1506
+ * ```
1507
+ */
1508
+ declare function createCheckboxEntity(world: World, config?: CheckboxConfig): Entity;
1509
+ /**
1510
+ * Creates a Textbox entity with the specified configuration.
1511
+ *
1512
+ * Textbox entities are single-line text input fields with cursor support,
1513
+ * password masking, placeholder text, and keyboard navigation. They support
1514
+ * Enter to submit, Escape to cancel, and standard text editing keys
1515
+ * (Backspace, Delete, Left/Right arrows, Home/End).
1516
+ *
1517
+ * Textboxes are focusable, clickable, and keyable by default.
1518
+ *
1519
+ * @param world - The ECS world to create the entity in
1520
+ * @param config - Optional textbox configuration options
1521
+ * @returns The created entity ID
1522
+ *
1523
+ * @example
1524
+ * ```typescript
1525
+ * import { createWorld, createTextboxEntity } from 'blecsd';
1526
+ *
1527
+ * const world = createWorld();
1528
+ *
1529
+ * // Create a simple textbox
1530
+ * const textbox = createTextboxEntity(world, {
1531
+ * x: 10,
1532
+ * y: 5,
1533
+ * width: 30,
1534
+ * height: 1,
1535
+ * });
1536
+ *
1537
+ * // Create a textbox with placeholder
1538
+ * const nameInput = createTextboxEntity(world, {
1539
+ * x: 10,
1540
+ * y: 8,
1541
+ * width: 40,
1542
+ * height: 1,
1543
+ * placeholder: 'Enter your name...',
1544
+ * maxLength: 50,
1545
+ * });
1546
+ *
1547
+ * // Create a password field
1548
+ * const passwordInput = createTextboxEntity(world, {
1549
+ * x: 10,
1550
+ * y: 11,
1551
+ * width: 30,
1552
+ * height: 1,
1553
+ * secret: true,
1554
+ * censor: '*',
1555
+ * placeholder: 'Password',
1556
+ * });
1557
+ *
1558
+ * // Create a styled textbox with custom focus colors
1559
+ * const styledTextbox = createTextboxEntity(world, {
1560
+ * x: 10,
1561
+ * y: 14,
1562
+ * width: 30,
1563
+ * height: 1,
1564
+ * value: 'Initial value',
1565
+ * focusEffectFg: 0x00ff00ff,
1566
+ * focusEffectBg: 0x111111ff,
1567
+ * border: {
1568
+ * type: 1,
1569
+ * left: true,
1570
+ * right: true,
1571
+ * top: true,
1572
+ * bottom: true,
1573
+ * },
1574
+ * });
1575
+ * ```
1576
+ */
1577
+ declare function createTextboxEntity(world: World, config?: TextboxConfig): Entity;
1578
+ /**
1579
+ * Creates a Textarea entity with the specified configuration.
1580
+ *
1581
+ * Textarea entities are multi-line text input fields with cursor support,
1582
+ * placeholder text, scrolling, and keyboard navigation. They support
1583
+ * Enter for new lines, Escape or Ctrl+Enter to submit, and standard text
1584
+ * editing keys (Backspace, Delete, Left/Right/Up/Down arrows, Home/End).
1585
+ *
1586
+ * Textareas are focusable, clickable, and keyable by default.
1587
+ *
1588
+ * @param world - The ECS world to create the entity in
1589
+ * @param config - Optional textarea configuration options
1590
+ * @returns The created entity ID
1591
+ *
1592
+ * @example
1593
+ * ```typescript
1594
+ * import { createWorld, createTextareaEntity } from 'blecsd';
1595
+ *
1596
+ * const world = createWorld();
1597
+ *
1598
+ * // Create a simple textarea
1599
+ * const textarea = createTextareaEntity(world, {
1600
+ * x: 10,
1601
+ * y: 5,
1602
+ * width: 40,
1603
+ * height: 5,
1604
+ * });
1605
+ *
1606
+ * // Create a textarea with placeholder
1607
+ * const messageInput = createTextareaEntity(world, {
1608
+ * x: 10,
1609
+ * y: 12,
1610
+ * width: 50,
1611
+ * height: 8,
1612
+ * placeholder: 'Enter your message...',
1613
+ * scrollable: true,
1614
+ * });
1615
+ *
1616
+ * // Create a styled textarea with border
1617
+ * const styledTextarea = createTextareaEntity(world, {
1618
+ * x: 10,
1619
+ * y: 22,
1620
+ * width: 50,
1621
+ * height: 10,
1622
+ * value: 'Initial content\nwith multiple lines',
1623
+ * maxLength: 500,
1624
+ * focusEffectFg: 0x00ff00ff,
1625
+ * focusEffectBg: 0x111111ff,
1626
+ * border: {
1627
+ * type: 1,
1628
+ * left: true,
1629
+ * right: true,
1630
+ * top: true,
1631
+ * bottom: true,
1632
+ * },
1633
+ * });
1634
+ * ```
1635
+ */
1636
+ declare function createTextareaEntity(world: World, config?: TextareaConfig): Entity;
1637
+ /**
1638
+ * Creates a Select/Dropdown entity with the specified configuration.
1639
+ *
1640
+ * Select entities are dropdown controls with a list of options.
1641
+ * They support click to open, keyboard navigation (Up/Down to navigate,
1642
+ * Enter/Space to select, Escape to close), and customizable display.
1643
+ *
1644
+ * Selects are focusable, clickable, and keyable by default.
1645
+ *
1646
+ * @param world - The ECS world to create the entity in
1647
+ * @param config - Optional select configuration options
1648
+ * @returns The created entity ID
1649
+ *
1650
+ * @example
1651
+ * ```typescript
1652
+ * import { createWorld, createSelectEntity, onSelectChange } from 'blecsd';
1653
+ *
1654
+ * const world = createWorld();
1655
+ *
1656
+ * // Create a simple select
1657
+ * const select = createSelectEntity(world, {
1658
+ * x: 10,
1659
+ * y: 5,
1660
+ * width: 30,
1661
+ * options: [
1662
+ * { label: 'Red', value: 'red' },
1663
+ * { label: 'Green', value: 'green' },
1664
+ * { label: 'Blue', value: 'blue' },
1665
+ * ],
1666
+ * selectedIndex: 0,
1667
+ * });
1668
+ *
1669
+ * // Create a select with placeholder
1670
+ * const colorPicker = createSelectEntity(world, {
1671
+ * x: 10,
1672
+ * y: 8,
1673
+ * width: 30,
1674
+ * options: [
1675
+ * { label: 'Primary', value: 'primary' },
1676
+ * { label: 'Secondary', value: 'secondary' },
1677
+ * { label: 'Accent', value: 'accent' },
1678
+ * ],
1679
+ * placeholder: 'Choose a color...',
1680
+ * border: {
1681
+ * type: 1,
1682
+ * left: true,
1683
+ * right: true,
1684
+ * top: true,
1685
+ * bottom: true,
1686
+ * },
1687
+ * });
1688
+ *
1689
+ * // Listen for selection changes
1690
+ * onSelectChange(colorPicker, (value, label, index) => {
1691
+ * console.log(`Selected: ${label} (${value})`);
1692
+ * });
1693
+ * ```
1694
+ */
1695
+ declare function createSelectEntity(world: World, config?: SelectConfig): Entity;
1696
+ /**
1697
+ * Creates a slider entity.
1698
+ *
1699
+ * Sliders allow users to select a value from a range using keyboard or mouse.
1700
+ *
1701
+ * @param world - The ECS world
1702
+ * @param config - Slider configuration
1703
+ * @returns Entity ID
1704
+ *
1705
+ * @example
1706
+ * ```typescript
1707
+ * import { createSliderEntity, onSliderChange } from 'blecsd';
1708
+ *
1709
+ * const slider = createSliderEntity(world, {
1710
+ * x: 10,
1711
+ * y: 5,
1712
+ * width: 30,
1713
+ * min: 0,
1714
+ * max: 100,
1715
+ * value: 50,
1716
+ * step: 5,
1717
+ * showValue: true,
1718
+ * });
1719
+ *
1720
+ * onSliderChange(slider, (value) => {
1721
+ * console.log('Volume:', value);
1722
+ * });
1723
+ * ```
1724
+ */
1725
+ declare function createSliderEntity(world: World, config?: SliderConfig): Entity;
1726
+ /**
1727
+ * Creates a form container entity.
1728
+ *
1729
+ * Forms manage field navigation and data collection.
1730
+ *
1731
+ * @param world - The ECS world
1732
+ * @param config - Form configuration
1733
+ * @returns Entity ID
1734
+ *
1735
+ * @example
1736
+ * ```typescript
1737
+ * import { createFormEntity, createTextboxEntity, onFormSubmit, registerFormField } from 'blecsd';
1738
+ *
1739
+ * const form = createFormEntity(world, {
1740
+ * x: 10,
1741
+ * y: 5,
1742
+ * width: 40,
1743
+ * height: 10,
1744
+ * keys: true,
1745
+ * });
1746
+ *
1747
+ * const username = createTextboxEntity(world, {
1748
+ * parent: form,
1749
+ * x: 1,
1750
+ * y: 1,
1751
+ * width: 30,
1752
+ * });
1753
+ *
1754
+ * // Register field with name for form data
1755
+ * registerFormField(world, form, username, 'username', '');
1756
+ *
1757
+ * onFormSubmit(form, (values) => {
1758
+ * console.log('Username:', values.username);
1759
+ * });
1760
+ * ```
1761
+ */
1762
+ declare function createFormEntity(world: World, config?: FormConfig): Entity;
1763
+ /**
1764
+ * Creates a progress bar entity.
1765
+ *
1766
+ * Progress bars display a visual indicator of completion.
1767
+ *
1768
+ * @param world - The ECS world
1769
+ * @param config - Progress bar configuration
1770
+ * @returns Entity ID
1771
+ *
1772
+ * @example
1773
+ * ```typescript
1774
+ * import { createProgressBarEntity, setProgress, onProgressComplete } from 'blecsd';
1775
+ *
1776
+ * const progressBar = createProgressBarEntity(world, {
1777
+ * x: 10,
1778
+ * y: 5,
1779
+ * width: 30,
1780
+ * height: 1,
1781
+ * value: 0,
1782
+ * max: 100,
1783
+ * });
1784
+ *
1785
+ * onProgressComplete(progressBar, () => {
1786
+ * console.log('Task complete!');
1787
+ * });
1788
+ *
1789
+ * // Update progress
1790
+ * setProgress(world, progressBar, 50);
1791
+ * ```
1792
+ */
1793
+ declare function createProgressBarEntity(world: World, config?: ProgressBarConfig): Entity;
1794
+ /**
1795
+ * Creates a radio set container entity.
1796
+ *
1797
+ * Radio sets manage mutual exclusion of radio buttons.
1798
+ *
1799
+ * @param world - The ECS world
1800
+ * @param config - Radio set configuration
1801
+ * @returns Entity ID
1802
+ *
1803
+ * @example
1804
+ * ```typescript
1805
+ * import { createRadioSetEntity, createRadioButtonEntity, onRadioSelect } from 'blecsd';
1806
+ *
1807
+ * const radioSet = createRadioSetEntity(world, {
1808
+ * x: 10,
1809
+ * y: 5,
1810
+ * });
1811
+ *
1812
+ * const opt1 = createRadioButtonEntity(world, {
1813
+ * radioSet,
1814
+ * value: 'option1',
1815
+ * label: 'Option 1',
1816
+ * selected: true,
1817
+ * });
1818
+ *
1819
+ * onRadioSelect(radioSet, (value) => {
1820
+ * console.log('Selected:', value);
1821
+ * });
1822
+ * ```
1823
+ */
1824
+ declare function createRadioSetEntity(world: World, config?: RadioSetConfig): Entity;
1825
+ /**
1826
+ * Creates a radio button entity.
1827
+ *
1828
+ * Radio buttons provide exclusive selection within a radio set.
1829
+ *
1830
+ * @param world - The ECS world
1831
+ * @param config - Radio button configuration
1832
+ * @returns Entity ID
1833
+ *
1834
+ * @example
1835
+ * ```typescript
1836
+ * import { createRadioButtonEntity, selectRadioButton } from 'blecsd';
1837
+ *
1838
+ * const button = createRadioButtonEntity(world, {
1839
+ * radioSet: radioSetEntity,
1840
+ * value: 'choice1',
1841
+ * label: 'First Choice',
1842
+ * y: 0,
1843
+ * });
1844
+ *
1845
+ * // Select this button
1846
+ * selectRadioButton(world, button);
1847
+ * ```
1848
+ */
1849
+ declare function createRadioButtonEntity(world: World, config?: RadioButtonConfig): Entity;
1850
+
1851
+ /**
1852
+ * Input event buffer for frame-independent input handling.
1853
+ *
1854
+ * Buffers keyboard and mouse events between frames so no input is lost.
1855
+ * Events are collected asynchronously from stdin and drained synchronously
1856
+ * each frame by the game loop.
1857
+ *
1858
+ * HARD REQUIREMENT: No input events should ever be lost or delayed.
1859
+ *
1860
+ * @module core/inputEventBuffer
1861
+ */
1862
+
1863
+ /**
1864
+ * A timestamped keyboard event.
1865
+ */
1866
+ interface TimestampedKeyEvent {
1867
+ readonly type: 'key';
1868
+ readonly event: KeyEvent;
1869
+ readonly timestamp: number;
1870
+ }
1871
+ /**
1872
+ * A timestamped mouse event.
1873
+ */
1874
+ interface TimestampedMouseEvent {
1875
+ readonly type: 'mouse';
1876
+ readonly event: MouseEvent;
1877
+ readonly timestamp: number;
1878
+ }
1879
+ /**
1880
+ * Union of all timestamped input events.
1881
+ */
1882
+ type TimestampedInputEvent = TimestampedKeyEvent | TimestampedMouseEvent;
1883
+ /**
1884
+ * Statistics about the input buffer.
1885
+ */
1886
+ interface InputBufferStats {
1887
+ /** Total key events pushed since creation/reset */
1888
+ readonly totalKeyEvents: number;
1889
+ /** Total mouse events pushed since creation/reset */
1890
+ readonly totalMouseEvents: number;
1891
+ /** Current key events in buffer */
1892
+ readonly pendingKeyEvents: number;
1893
+ /** Current mouse events in buffer */
1894
+ readonly pendingMouseEvents: number;
1895
+ /** Number of events dropped due to overflow */
1896
+ readonly droppedEvents: number;
1897
+ /** Maximum buffer size */
1898
+ readonly maxBufferSize: number;
1899
+ }
1900
+ /**
1901
+ * Latency statistics for input processing.
1902
+ * All values in milliseconds.
1903
+ */
1904
+ interface InputLatencyStats {
1905
+ /** Minimum latency observed */
1906
+ readonly min: number;
1907
+ /** Maximum latency observed */
1908
+ readonly max: number;
1909
+ /** Average latency */
1910
+ readonly avg: number;
1911
+ /** 95th percentile latency */
1912
+ readonly p95: number;
1913
+ /** 99th percentile latency */
1914
+ readonly p99: number;
1915
+ /** Number of samples in the window */
1916
+ readonly sampleCount: number;
1917
+ /** Last frame processing time in ms */
1918
+ readonly lastFrameProcessingTime: number;
1919
+ /** Average frame processing time */
1920
+ readonly avgFrameProcessingTime: number;
1921
+ }
1922
+ /**
1923
+ * Configuration options for the input event buffer.
1924
+ */
1925
+ interface InputEventBufferOptions {
1926
+ /**
1927
+ * Maximum number of events to buffer before dropping oldest.
1928
+ * Set to 0 for unlimited (not recommended).
1929
+ * @default 1000
1930
+ */
1931
+ readonly maxBufferSize?: number;
1932
+ /**
1933
+ * Whether to emit a warning when buffer overflows.
1934
+ * @default true
1935
+ */
1936
+ readonly warnOnOverflow?: boolean;
1937
+ /**
1938
+ * Custom warning handler for overflow events.
1939
+ * @default console.warn
1940
+ */
1941
+ readonly onOverflow?: (droppedCount: number) => void;
1942
+ /**
1943
+ * Maximum number of latency samples to keep for statistics.
1944
+ * @default 1000
1945
+ */
1946
+ readonly maxLatencySamples?: number;
1947
+ /**
1948
+ * Maximum number of frame processing time samples to keep.
1949
+ * @default 100
1950
+ */
1951
+ readonly maxFrameSamples?: number;
1952
+ }
1953
+ /**
1954
+ * Input event buffer data structure.
1955
+ * All state is stored in plain arrays for functional manipulation.
1956
+ */
1957
+ interface InputEventBufferData {
1958
+ /** Pending key events */
1959
+ keyEvents: TimestampedKeyEvent[];
1960
+ /** Pending mouse events */
1961
+ mouseEvents: TimestampedMouseEvent[];
1962
+ /** Latency samples for statistics */
1963
+ latencySamples: number[];
1964
+ /** Frame processing time samples */
1965
+ frameProcessingTimes: number[];
1966
+ /** Frame start timestamp */
1967
+ frameStartTime: number;
1968
+ /** Total key events pushed since creation/reset */
1969
+ totalKeyEvents: number;
1970
+ /** Total mouse events pushed since creation/reset */
1971
+ totalMouseEvents: number;
1972
+ /** Number of events dropped due to overflow */
1973
+ droppedEvents: number;
1974
+ /** Configuration */
1975
+ readonly config: {
1976
+ readonly maxBufferSize: number;
1977
+ readonly maxLatencySamples: number;
1978
+ readonly maxFrameSamples: number;
1979
+ readonly warnOnOverflow: boolean;
1980
+ readonly onOverflow: (droppedCount: number) => void;
1981
+ };
1982
+ }
1983
+ /**
1984
+ * Creates a new input event buffer.
1985
+ *
1986
+ * @param options - Buffer configuration options
1987
+ * @returns A new InputEventBufferData
1988
+ *
1989
+ * @example
1990
+ * ```typescript
1991
+ * import { createInputEventBuffer, pushKeyEvent, drainKeys } from 'blecsd';
1992
+ *
1993
+ * const buffer = createInputEventBuffer({ maxBufferSize: 500 });
1994
+ *
1995
+ * // Push events from stdin
1996
+ * pushKeyEvent(buffer, keyEvent);
1997
+ *
1998
+ * // Drain in game loop
1999
+ * const keys = drainKeys(buffer);
2000
+ * ```
2001
+ */
2002
+ declare function createInputEventBuffer(options?: InputEventBufferOptions): InputEventBufferData;
2003
+ /**
2004
+ * Pushes a keyboard event to the buffer.
2005
+ *
2006
+ * @param buffer - The input event buffer
2007
+ * @param event - The keyboard event to buffer
2008
+ * @param timestamp - Optional timestamp (default: now)
2009
+ *
2010
+ * @example
2011
+ * ```typescript
2012
+ * pushKeyEvent(buffer, { name: 'a', ctrl: false, meta: false, shift: false, sequence: 'a' });
2013
+ * ```
2014
+ */
2015
+ declare function pushKeyEvent(buffer: InputEventBufferData, event: KeyEvent, timestamp?: number): void;
2016
+ /**
2017
+ * Pushes a mouse event to the buffer.
2018
+ *
2019
+ * @param buffer - The input event buffer
2020
+ * @param event - The mouse event to buffer
2021
+ * @param timestamp - Optional timestamp (default: now)
2022
+ *
2023
+ * @example
2024
+ * ```typescript
2025
+ * pushMouseEvent(buffer, { x: 10, y: 20, button: 'left', action: 'mousedown', ctrl: false, meta: false, shift: false });
2026
+ * ```
2027
+ */
2028
+ declare function pushMouseEvent(buffer: InputEventBufferData, event: MouseEvent, timestamp?: number): void;
2029
+ /**
2030
+ * Drains all keyboard events from the buffer.
2031
+ * Returns events in order (oldest first) and clears the buffer.
2032
+ *
2033
+ * @param buffer - The input event buffer
2034
+ * @returns Array of timestamped key events
2035
+ *
2036
+ * @example
2037
+ * ```typescript
2038
+ * const keys = drainKeys(buffer);
2039
+ * for (const { event, timestamp } of keys) {
2040
+ * console.log(`Key: ${event.name} at ${timestamp}`);
2041
+ * }
2042
+ * ```
2043
+ */
2044
+ declare function drainKeys(buffer: InputEventBufferData): TimestampedKeyEvent[];
2045
+ /**
2046
+ * Drains all mouse events from the buffer.
2047
+ * Returns events in order (oldest first) and clears the buffer.
2048
+ *
2049
+ * @param buffer - The input event buffer
2050
+ * @returns Array of timestamped mouse events
2051
+ *
2052
+ * @example
2053
+ * ```typescript
2054
+ * const mouse = drainMouse(buffer);
2055
+ * for (const { event, timestamp } of mouse) {
2056
+ * console.log(`Mouse: ${event.action} at ${event.x},${event.y}`);
2057
+ * }
2058
+ * ```
2059
+ */
2060
+ declare function drainMouse(buffer: InputEventBufferData): TimestampedMouseEvent[];
2061
+ /**
2062
+ * Drains all events (keys and mouse) from the buffer.
2063
+ * Returns events in chronological order by timestamp.
2064
+ *
2065
+ * @param buffer - The input event buffer
2066
+ * @returns Array of all timestamped events sorted by timestamp
2067
+ *
2068
+ * @example
2069
+ * ```typescript
2070
+ * const events = drainAllEvents(buffer);
2071
+ * for (const event of events) {
2072
+ * if (event.type === 'key') {
2073
+ * handleKey(event.event);
2074
+ * } else {
2075
+ * handleMouse(event.event);
2076
+ * }
2077
+ * }
2078
+ * ```
2079
+ */
2080
+ declare function drainAllEvents(buffer: InputEventBufferData): TimestampedInputEvent[];
2081
+ /**
2082
+ * Peeks at all pending events without removing them.
2083
+ *
2084
+ * @param buffer - The input event buffer
2085
+ * @returns Array of all pending events sorted by timestamp
2086
+ */
2087
+ declare function peekEvents(buffer: InputEventBufferData): TimestampedInputEvent[];
2088
+ /**
2089
+ * Peeks at pending key events without removing them.
2090
+ *
2091
+ * @param buffer - The input event buffer
2092
+ * @returns Array of pending key events
2093
+ */
2094
+ declare function peekKeys(buffer: InputEventBufferData): readonly TimestampedKeyEvent[];
2095
+ /**
2096
+ * Peeks at pending mouse events without removing them.
2097
+ *
2098
+ * @param buffer - The input event buffer
2099
+ * @returns Array of pending mouse events
2100
+ */
2101
+ declare function peekMouse(buffer: InputEventBufferData): readonly TimestampedMouseEvent[];
2102
+ /**
2103
+ * Clears all pending events from the buffer.
2104
+ *
2105
+ * @param buffer - The input event buffer
2106
+ */
2107
+ declare function clearBuffer(buffer: InputEventBufferData): void;
2108
+ /**
2109
+ * Gets the number of pending key events.
2110
+ *
2111
+ * @param buffer - The input event buffer
2112
+ */
2113
+ declare function getPendingKeyCount(buffer: InputEventBufferData): number;
2114
+ /**
2115
+ * Gets the number of pending mouse events.
2116
+ *
2117
+ * @param buffer - The input event buffer
2118
+ */
2119
+ declare function getPendingMouseCount(buffer: InputEventBufferData): number;
2120
+ /**
2121
+ * Gets the total number of pending events.
2122
+ *
2123
+ * @param buffer - The input event buffer
2124
+ */
2125
+ declare function getPendingCount(buffer: InputEventBufferData): number;
2126
+ /**
2127
+ * Checks if there are any pending events.
2128
+ *
2129
+ * @param buffer - The input event buffer
2130
+ */
2131
+ declare function hasPendingEvents(buffer: InputEventBufferData): boolean;
2132
+ /**
2133
+ * Gets buffer statistics for debugging.
2134
+ *
2135
+ * @param buffer - The input event buffer
2136
+ * @returns Statistics about the buffer
2137
+ *
2138
+ * @example
2139
+ * ```typescript
2140
+ * const stats = getStats(buffer);
2141
+ * console.log(`Total events: ${stats.totalKeyEvents + stats.totalMouseEvents}`);
2142
+ * console.log(`Dropped: ${stats.droppedEvents}`);
2143
+ * ```
2144
+ */
2145
+ declare function getStats(buffer: InputEventBufferData): InputBufferStats;
2146
+ /**
2147
+ * Resets buffer statistics.
2148
+ *
2149
+ * @param buffer - The input event buffer
2150
+ */
2151
+ declare function resetStats(buffer: InputEventBufferData): void;
2152
+ /**
2153
+ * Marks the start of frame processing.
2154
+ * Call this at the beginning of your input processing phase.
2155
+ *
2156
+ * @param buffer - The input event buffer
2157
+ *
2158
+ * @example
2159
+ * ```typescript
2160
+ * beginFrame(buffer);
2161
+ * const keys = drainKeys(buffer);
2162
+ * // process keys...
2163
+ * endFrame(buffer);
2164
+ * ```
2165
+ */
2166
+ declare function beginFrame(buffer: InputEventBufferData): void;
2167
+ /**
2168
+ * Marks the end of frame processing and records the processing time.
2169
+ * Call this after all input events have been processed.
2170
+ *
2171
+ * @param buffer - The input event buffer
2172
+ * @returns The frame processing time in milliseconds
2173
+ */
2174
+ declare function endFrame(buffer: InputEventBufferData): number;
2175
+ /**
2176
+ * Records latency for a processed event.
2177
+ * Call this when an event has been fully processed to track input latency.
2178
+ *
2179
+ * @param buffer - The input event buffer
2180
+ * @param latencyMs - The latency in milliseconds
2181
+ *
2182
+ * @example
2183
+ * ```typescript
2184
+ * for (const { event, timestamp } of drainKeys(buffer)) {
2185
+ * handleKey(event);
2186
+ * const latency = performance.now() - timestamp;
2187
+ * recordLatency(buffer, latency);
2188
+ * }
2189
+ * ```
2190
+ */
2191
+ declare function recordLatency(buffer: InputEventBufferData, latencyMs: number): void;
2192
+ /**
2193
+ * Records latency for multiple events at once.
2194
+ * More efficient than calling recordLatency for each event.
2195
+ *
2196
+ * @param buffer - The input event buffer
2197
+ * @param avgLatencyMs - Average latency for all events
2198
+ * @param eventCount - Number of events processed
2199
+ */
2200
+ declare function recordLatencyBatch(buffer: InputEventBufferData, avgLatencyMs: number, eventCount: number): void;
2201
+ /**
2202
+ * Gets latency statistics for input processing.
2203
+ * Returns min, max, average, and percentile latencies.
2204
+ *
2205
+ * @param buffer - The input event buffer
2206
+ * @returns Latency statistics in milliseconds
2207
+ *
2208
+ * @example
2209
+ * ```typescript
2210
+ * const stats = getLatencyStats(buffer);
2211
+ * console.log(`Avg latency: ${stats.avg.toFixed(2)}ms`);
2212
+ * console.log(`P95 latency: ${stats.p95.toFixed(2)}ms`);
2213
+ * if (stats.max > 16) {
2214
+ * console.warn('Input latency exceeds frame budget!');
2215
+ * }
2216
+ * ```
2217
+ */
2218
+ declare function getLatencyStats(buffer: InputEventBufferData): InputLatencyStats;
2219
+ /**
2220
+ * Resets latency statistics.
2221
+ *
2222
+ * @param buffer - The input event buffer
2223
+ */
2224
+ declare function resetLatencyStats(buffer: InputEventBufferData): void;
2225
+ /**
2226
+ * Checks if the current latency is within acceptable bounds.
2227
+ * By default, checks if p95 latency is under 16ms (one frame at 60fps).
2228
+ *
2229
+ * @param buffer - The input event buffer
2230
+ * @param maxLatencyMs - Maximum acceptable p95 latency in milliseconds
2231
+ * @returns True if latency is acceptable
2232
+ */
2233
+ declare function isLatencyAcceptable(buffer: InputEventBufferData, maxLatencyMs?: number): boolean;
2234
+ /**
2235
+ * Checks if frame processing time is within budget.
2236
+ * By default, checks if average processing time is under 1ms.
2237
+ *
2238
+ * @param buffer - The input event buffer
2239
+ * @param maxProcessingTimeMs - Maximum acceptable processing time in milliseconds
2240
+ * @returns True if processing time is acceptable
2241
+ */
2242
+ declare function isProcessingTimeAcceptable(buffer: InputEventBufferData, maxProcessingTimeMs?: number): boolean;
2243
+ /**
2244
+ * Global shared input buffer for simple use cases.
2245
+ *
2246
+ * For more complex scenarios (multiple input sources, custom overflow handling),
2247
+ * create your own buffer with createInputEventBuffer().
2248
+ *
2249
+ * @example
2250
+ * ```typescript
2251
+ * import { globalInputBuffer, pushKeyEvent, drainAllEvents } from 'blecsd';
2252
+ *
2253
+ * // Push from stdin handler
2254
+ * pushKeyEvent(globalInputBuffer, event);
2255
+ *
2256
+ * // Drain in game loop
2257
+ * const events = drainAllEvents(globalInputBuffer);
2258
+ * ```
2259
+ */
2260
+ declare const globalInputBuffer: InputEventBufferData;
2261
+
2262
+ /**
2263
+ * Input state tracking for keyboard and mouse.
2264
+ *
2265
+ * Provides frame-aware input queries like isKeyPressed (just this frame),
2266
+ * isKeyReleased, key hold time, and repeat handling.
2267
+ *
2268
+ * @module core/inputState
2269
+ */
2270
+
2271
+ /**
2272
+ * State of a single key.
2273
+ */
2274
+ interface KeyState {
2275
+ /** Key is currently pressed down */
2276
+ readonly pressed: boolean;
2277
+ /** Key was pressed this frame (transitioned from up to down) */
2278
+ readonly justPressed: boolean;
2279
+ /** Key was released this frame (transitioned from down to up) */
2280
+ readonly justReleased: boolean;
2281
+ /** Time the key has been held in milliseconds */
2282
+ readonly heldTime: number;
2283
+ /** Number of auto-repeat events received while held */
2284
+ readonly repeatCount: number;
2285
+ /** Last event timestamp */
2286
+ readonly lastEventTime: number;
2287
+ }
2288
+ /**
2289
+ * State of a mouse button.
2290
+ */
2291
+ interface MouseButtonState {
2292
+ /** Button is currently pressed */
2293
+ readonly pressed: boolean;
2294
+ /** Button was pressed this frame */
2295
+ readonly justPressed: boolean;
2296
+ /** Button was released this frame */
2297
+ readonly justReleased: boolean;
2298
+ /** Time the button has been held in milliseconds */
2299
+ readonly heldTime: number;
2300
+ /** Last event timestamp */
2301
+ readonly lastEventTime: number;
2302
+ }
2303
+ /**
2304
+ * Current mouse position and state.
2305
+ */
2306
+ interface MouseState {
2307
+ /** Current X position */
2308
+ readonly x: number;
2309
+ /** Current Y position */
2310
+ readonly y: number;
2311
+ /** X movement since last frame */
2312
+ readonly deltaX: number;
2313
+ /** Y movement since last frame */
2314
+ readonly deltaY: number;
2315
+ /** Scroll wheel delta since last frame (positive = up) */
2316
+ readonly wheelDelta: number;
2317
+ /** State of each button */
2318
+ readonly buttons: Readonly<Record<MouseButton, MouseButtonState>>;
2319
+ }
2320
+ /**
2321
+ * Input state statistics.
2322
+ */
2323
+ interface InputStateStats {
2324
+ /** Number of keys currently held down */
2325
+ readonly keysDown: number;
2326
+ /** Number of keys pressed this frame */
2327
+ readonly keysPressed: number;
2328
+ /** Number of keys released this frame */
2329
+ readonly keysReleased: number;
2330
+ /** Total key events processed this frame */
2331
+ readonly keyEventsThisFrame: number;
2332
+ /** Total mouse events processed this frame */
2333
+ readonly mouseEventsThisFrame: number;
2334
+ /** Current frame number */
2335
+ readonly frameCount: number;
2336
+ }
2337
+ /**
2338
+ * Configuration for input state tracking.
2339
+ */
2340
+ interface InputStateConfig {
2341
+ /**
2342
+ * Whether to track OS key repeats separately.
2343
+ * When true, repeatCount increments for each repeat event.
2344
+ * When false, repeats are ignored after initial press.
2345
+ * @default true
2346
+ */
2347
+ readonly trackRepeats?: boolean;
2348
+ /**
2349
+ * Minimum time (ms) between key events to consider them separate presses.
2350
+ * Helps filter out very fast unintentional double-presses.
2351
+ * @default 0 (no debouncing)
2352
+ */
2353
+ readonly debounceTime?: number;
2354
+ /**
2355
+ * Custom repeat rate in ms. When set, overrides OS key repeat.
2356
+ * InputState will generate synthetic repeat events at this rate.
2357
+ * @default undefined (use OS repeat)
2358
+ */
2359
+ readonly customRepeatRate?: number;
2360
+ /**
2361
+ * Initial delay before custom repeat starts (ms).
2362
+ * @default 500
2363
+ */
2364
+ readonly customRepeatDelay?: number;
2365
+ }
2366
+ /**
2367
+ * InputState interface for type-safe access.
2368
+ *
2369
+ * Tracks input state across frames.
2370
+ * Call `update()` at the start of each frame with input events from the buffer.
2371
+ * Then use query methods like `isKeyDown()`, `isKeyPressed()`, etc.
2372
+ */
2373
+ interface InputState {
2374
+ update(keyEvents: readonly TimestampedKeyEvent[], mouseEvents: readonly TimestampedMouseEvent[], deltaTime: number): void;
2375
+ isKeyDown(key: KeyName | string): boolean;
2376
+ isKeyPressed(key: KeyName | string): boolean;
2377
+ isKeyReleased(key: KeyName | string): boolean;
2378
+ getKeyHeldTime(key: KeyName | string): number;
2379
+ getKeyState(key: KeyName | string): KeyState;
2380
+ getKeyRepeatCount(key: KeyName | string): number;
2381
+ getPressedKeys(): string[];
2382
+ getJustPressedKeys(): string[];
2383
+ getJustReleasedKeys(): string[];
2384
+ isCtrlDown(): boolean;
2385
+ isAltDown(): boolean;
2386
+ isShiftDown(): boolean;
2387
+ hasModifier(): boolean;
2388
+ isMouseButtonDown(button: MouseButton): boolean;
2389
+ isMouseButtonPressed(button: MouseButton): boolean;
2390
+ isMouseButtonReleased(button: MouseButton): boolean;
2391
+ getMouseX(): number;
2392
+ getMouseY(): number;
2393
+ getMousePosition(): {
2394
+ x: number;
2395
+ y: number;
2396
+ };
2397
+ getMouseDelta(): {
2398
+ deltaX: number;
2399
+ deltaY: number;
2400
+ };
2401
+ getWheelDelta(): number;
2402
+ getMouseState(): MouseState;
2403
+ releaseKey(key: KeyName | string): void;
2404
+ releaseAllKeys(): void;
2405
+ releaseAllMouseButtons(): void;
2406
+ releaseAll(): void;
2407
+ getStats(): InputStateStats;
2408
+ getFrameCount(): number;
2409
+ reset(): void;
2410
+ }
2411
+ /**
2412
+ * Creates a new InputState tracker.
2413
+ *
2414
+ * @param config - Configuration options
2415
+ * @returns A new InputState instance
2416
+ *
2417
+ * @example
2418
+ * ```typescript
2419
+ * import { createInputState } from 'blecsd';
2420
+ *
2421
+ * const inputState = createInputState({
2422
+ * trackRepeats: true,
2423
+ * debounceTime: 50, // Ignore inputs within 50ms
2424
+ * });
2425
+ * ```
2426
+ */
2427
+ declare function createInputState(config?: InputStateConfig): InputState;
2428
+ /**
2429
+ * Checks if any of the specified keys are pressed.
2430
+ *
2431
+ * @param inputState - The input state to check
2432
+ * @param keys - Keys to check
2433
+ * @returns true if any key is currently pressed
2434
+ *
2435
+ * @example
2436
+ * ```typescript
2437
+ * if (isAnyKeyDown(inputState, ['w', 'up'])) {
2438
+ * moveForward();
2439
+ * }
2440
+ * ```
2441
+ */
2442
+ declare function isAnyKeyDown(inputState: InputState, keys: readonly (KeyName | string)[]): boolean;
2443
+ /**
2444
+ * Checks if all specified keys are pressed.
2445
+ *
2446
+ * @param inputState - The input state to check
2447
+ * @param keys - Keys to check
2448
+ * @returns true if all keys are currently pressed
2449
+ *
2450
+ * @example
2451
+ * ```typescript
2452
+ * if (isAllKeysDown(inputState, ['ctrl', 's'])) {
2453
+ * save();
2454
+ * }
2455
+ * ```
2456
+ */
2457
+ declare function isAllKeysDown(inputState: InputState, keys: readonly (KeyName | string)[]): boolean;
2458
+ /**
2459
+ * Checks if any of the specified keys were just pressed this frame.
2460
+ *
2461
+ * @param inputState - The input state to check
2462
+ * @param keys - Keys to check
2463
+ * @returns true if any key was just pressed
2464
+ */
2465
+ declare function isAnyKeyPressed(inputState: InputState, keys: readonly (KeyName | string)[]): boolean;
2466
+ /**
2467
+ * Gets the direction vector from WASD or arrow keys.
2468
+ *
2469
+ * @param inputState - The input state to check
2470
+ * @returns Object with x (-1, 0, or 1) and y (-1, 0, or 1)
2471
+ *
2472
+ * @example
2473
+ * ```typescript
2474
+ * const dir = getMovementDirection(inputState);
2475
+ * player.x += dir.x * speed;
2476
+ * player.y += dir.y * speed;
2477
+ * ```
2478
+ */
2479
+ declare function getMovementDirection(inputState: InputState): {
2480
+ x: number;
2481
+ y: number;
2482
+ };
2483
+
2484
+ /**
2485
+ * Input action mapping system for game controls.
2486
+ *
2487
+ * Maps physical inputs (keys, mouse buttons) to logical game actions.
2488
+ * Supports multiple bindings per action, runtime rebinding, and save/load.
2489
+ *
2490
+ * @module core/inputActions
2491
+ */
2492
+
2493
+ /**
2494
+ * Configuration for a single action binding.
2495
+ */
2496
+ interface ActionBinding {
2497
+ /** Unique action identifier (e.g., 'jump', 'attack', 'move_left') */
2498
+ readonly action: string;
2499
+ /** Keys that activate this action */
2500
+ readonly keys: readonly string[];
2501
+ /** Mouse buttons that activate this action */
2502
+ readonly mouseButtons?: readonly MouseButton[];
2503
+ /** Whether action fires continuously while held (default: false) */
2504
+ readonly continuous?: boolean;
2505
+ /** Deadzone for analog inputs (0-1, default: 0.1) */
2506
+ readonly deadzone?: number;
2507
+ }
2508
+ /**
2509
+ * Runtime state of an action.
2510
+ */
2511
+ interface ActionState {
2512
+ /** Action is currently active (input is held) */
2513
+ readonly active: boolean;
2514
+ /** Action was just activated this frame */
2515
+ readonly justActivated: boolean;
2516
+ /** Action was just deactivated this frame */
2517
+ readonly justDeactivated: boolean;
2518
+ /** How long the action has been active (ms) */
2519
+ readonly activeTime: number;
2520
+ /** Analog value (0-1), 1 when digital input is pressed */
2521
+ readonly value: number;
2522
+ }
2523
+ /**
2524
+ * Serialized action bindings for save/load.
2525
+ */
2526
+ interface SerializedBindings {
2527
+ readonly version: number;
2528
+ readonly bindings: readonly {
2529
+ readonly action: string;
2530
+ readonly keys: readonly string[];
2531
+ readonly mouseButtons?: readonly string[];
2532
+ readonly continuous?: boolean;
2533
+ }[];
2534
+ }
2535
+ /**
2536
+ * Callback for action state changes.
2537
+ */
2538
+ type ActionCallback = (action: string, state: ActionState, inputState: InputState) => void;
2539
+ /**
2540
+ * Zod schema for action binding validation.
2541
+ */
2542
+ declare const ActionBindingSchema: z.ZodObject<{
2543
+ action: z.ZodString;
2544
+ keys: z.ZodDefault<z.ZodArray<z.ZodString>>;
2545
+ mouseButtons: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2546
+ unknown: "unknown";
2547
+ left: "left";
2548
+ right: "right";
2549
+ middle: "middle";
2550
+ wheelUp: "wheelUp";
2551
+ wheelDown: "wheelDown";
2552
+ }>>>;
2553
+ continuous: z.ZodDefault<z.ZodBoolean>;
2554
+ deadzone: z.ZodDefault<z.ZodNumber>;
2555
+ }, z.core.$strip>;
2556
+ /**
2557
+ * Zod schema for serialized bindings.
2558
+ */
2559
+ declare const SerializedBindingsSchema: z.ZodObject<{
2560
+ version: z.ZodNumber;
2561
+ bindings: z.ZodArray<z.ZodObject<{
2562
+ action: z.ZodString;
2563
+ keys: z.ZodArray<z.ZodString>;
2564
+ mouseButtons: z.ZodOptional<z.ZodArray<z.ZodString>>;
2565
+ continuous: z.ZodOptional<z.ZodBoolean>;
2566
+ }, z.core.$strip>>;
2567
+ }, z.core.$strip>;
2568
+ /**
2569
+ * InputActionManager interface for type-safe access.
2570
+ */
2571
+ interface InputActionManager {
2572
+ register(binding: ActionBinding): InputActionManager;
2573
+ registerAll(bindings: readonly ActionBinding[]): InputActionManager;
2574
+ unregister(action: string): boolean;
2575
+ hasAction(action: string): boolean;
2576
+ getActions(): string[];
2577
+ getBinding(action: string): ActionBinding | undefined;
2578
+ update(inputState: InputState, deltaTime: number): void;
2579
+ isActive(action: string): boolean;
2580
+ isJustActivated(action: string): boolean;
2581
+ isJustDeactivated(action: string): boolean;
2582
+ getValue(action: string): number;
2583
+ getActiveTime(action: string): number;
2584
+ getState(action: string): ActionState;
2585
+ getActiveActions(): string[];
2586
+ rebindKeys(action: string, keys: readonly string[]): boolean;
2587
+ rebindMouseButtons(action: string, buttons: readonly MouseButton[]): boolean;
2588
+ addKey(action: string, key: string): boolean;
2589
+ removeKey(action: string, key: string): boolean;
2590
+ getKeysForAction(action: string): string[];
2591
+ getMouseButtonsForAction(action: string): MouseButton[];
2592
+ getActionsForKey(key: string): string[];
2593
+ onAction(action: string, callback: ActionCallback): () => void;
2594
+ onAnyAction(callback: ActionCallback): () => void;
2595
+ saveBindings(): SerializedBindings;
2596
+ loadBindings(data: unknown): void;
2597
+ toJSON(pretty?: boolean): string;
2598
+ fromJSON(json: string): void;
2599
+ resetStates(): void;
2600
+ clear(): void;
2601
+ }
2602
+ /**
2603
+ * Creates a new InputActionManager.
2604
+ *
2605
+ * @param initialBindings - Optional initial bindings to register
2606
+ * @returns A new InputActionManager instance
2607
+ *
2608
+ * @example
2609
+ * ```typescript
2610
+ * import { createInputActionManager } from 'blecsd';
2611
+ *
2612
+ * const actions = createInputActionManager([
2613
+ * { action: 'jump', keys: ['space'] },
2614
+ * { action: 'attack', keys: ['j'], mouseButtons: ['left'] },
2615
+ * ]);
2616
+ * ```
2617
+ */
2618
+ declare function createInputActionManager(initialBindings?: readonly ActionBinding[]): InputActionManager;
2619
+ /**
2620
+ * Common action presets for quick setup.
2621
+ */
2622
+ declare const ActionPresets: {
2623
+ /**
2624
+ * Standard platformer controls.
2625
+ */
2626
+ readonly platformer: readonly ActionBinding[];
2627
+ /**
2628
+ * Standard top-down controls.
2629
+ */
2630
+ readonly topDown: readonly ActionBinding[];
2631
+ /**
2632
+ * Menu navigation controls.
2633
+ */
2634
+ readonly menu: readonly ActionBinding[];
2635
+ };
2636
+
2637
+ export { createCheckboxEntity as $, type ActionBinding as A, type BoxConfig as B, type CheckboxConfig as C, RadioSetConfigSchema as D, type ScreenConfig as E, type FormConfig as F, ScreenConfigSchema as G, SelectConfigSchema as H, type InputEventBufferData as I, type SerializedBindings as J, type KeyState as K, type ListConfig as L, type MouseButtonState as M, SerializedBindingsSchema as N, SliderConfigSchema as O, type ProgressBarConfig as P, TextConfigSchema as Q, type RadioButtonConfig as R, type SelectConfig as S, type TextConfig as T, TextareaConfigSchema as U, TextboxConfigSchema as V, type TimestampedInputEvent as W, type TimestampedKeyEvent as X, type TimestampedMouseEvent as Y, createBoxEntity as Z, createButtonEntity as _, type InputState as a, createFormEntity as a0, createInputActionManager as a1, createInputEntity as a2, createInputEventBuffer as a3, createInputState as a4, createListEntity as a5, createProgressBarEntity as a6, createRadioButtonEntity as a7, createRadioSetEntity as a8, createScreenEntity as a9, recordLatencyBatch as aA, resetLatencyStats as aB, resetStats as aC, beginFrame as aD, clearBuffer as aE, endFrame as aF, getStats as aG, createSelectEntity as aa, createSliderEntity as ab, createTextEntity as ac, createTextareaEntity as ad, createTextboxEntity as ae, drainAllEvents as af, drainKeys as ag, drainMouse as ah, getLatencyStats as ai, getMovementDirection as aj, getPendingCount as ak, getPendingKeyCount as al, getPendingMouseCount as am, globalInputBuffer as an, hasPendingEvents as ao, isAllKeysDown as ap, isAnyKeyDown as aq, isAnyKeyPressed as ar, isLatencyAcceptable as as, isProcessingTimeAcceptable as at, peekEvents as au, peekKeys as av, peekMouse as aw, pushKeyEvent as ax, pushMouseEvent as ay, recordLatency as az, type ButtonConfig as b, type InputConfig as c, type TextareaConfig as d, type TextboxConfig as e, type RadioSetConfig as f, type SliderConfig as g, ActionBindingSchema as h, type ActionCallback as i, ActionPresets as j, type ActionState as k, BoxConfigSchema as l, ButtonConfigSchema as m, CheckboxConfigSchema as n, FormConfigSchema as o, type InputActionManager as p, type InputBufferStats as q, InputConfigSchema as r, type InputEventBufferOptions as s, type InputLatencyStats as t, type InputStateConfig as u, type InputStateStats as v, ListConfigSchema as w, type MouseState as x, ProgressBarConfigSchema as y, RadioButtonConfigSchema as z };