blecsd 0.1.1 → 0.3.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.
- package/LICENSE +4 -2
- package/README.md +209 -66
- package/dist/3d/index.d.ts +2 -2
- package/dist/3d/index.js +1 -1
- package/dist/audio/index.d.ts +2 -2
- package/dist/{border-D_Jb4ZJV.d.ts → border-Jb7TrMob.d.ts} +20 -10
- package/dist/chunk-2IEMMRUO.js +1 -0
- package/dist/chunk-3AV52GY5.js +1 -0
- package/dist/chunk-3LHLSY3Y.js +1 -0
- package/dist/chunk-3O4TQHGK.js +4 -0
- package/dist/chunk-3UJWZ5ZN.js +1 -0
- package/dist/chunk-5N3O25O7.js +1 -0
- package/dist/chunk-6M2J5QUA.js +1 -0
- package/dist/chunk-7IQEUVGF.js +1 -0
- package/dist/chunk-A6M6TFBL.js +1 -0
- package/dist/chunk-CUEUJAHK.js +3 -0
- package/dist/chunk-D42Q2KKR.js +1 -0
- package/dist/chunk-DYEXOFUU.js +2 -0
- package/dist/chunk-DYU72XLL.js +1 -0
- package/dist/chunk-E4CJRSND.js +1 -0
- package/dist/chunk-EAY7B5GL.js +1 -0
- package/dist/chunk-FCMTWFSE.js +1 -0
- package/dist/chunk-FL56THSI.js +25 -0
- package/dist/{chunk-2UBBZFE4.js → chunk-G437VE43.js} +1 -1
- package/dist/chunk-GGXNWT36.js +8 -0
- package/dist/chunk-HLFORKXS.js +1 -0
- package/dist/chunk-J7MBKEBY.js +1 -0
- package/dist/{chunk-TYMY2TBR.js → chunk-JHCKPCUH.js} +3 -3
- package/dist/chunk-K3SX2LY5.js +1 -0
- package/dist/chunk-LDAFEXN5.js +1 -0
- package/dist/chunk-MKMFUXLB.js +33 -0
- package/dist/chunk-MQWPHPUM.js +1 -0
- package/dist/chunk-MTI376CU.js +5 -0
- package/dist/chunk-MTV2RJZD.js +1 -0
- package/dist/chunk-NPDPBAW6.js +4 -0
- package/dist/chunk-OB66FB4F.js +1 -0
- package/dist/chunk-OR3BZY7C.js +1 -0
- package/dist/{chunk-VNZ6CWJA.js → chunk-R7AICVRN.js} +2 -2
- package/dist/{chunk-3B7MIVW6.js → chunk-RZ7FGVI6.js} +1 -1
- package/dist/chunk-UMGTXSQB.js +11 -0
- package/dist/chunk-X3Q3T2SS.js +4 -0
- package/dist/{chunk-JKVHO4LH.js → chunk-XZJRWFOS.js} +1 -1
- package/dist/chunk-ZAHG7Y3X.js +1 -0
- package/dist/cli/init.d.ts +1 -1
- package/dist/componentStorage-CJTh-TPO.d.ts +246 -0
- package/dist/components/index.d.ts +1942 -514
- package/dist/components/index.js +1 -1
- package/dist/core/index.d.ts +857 -259
- package/dist/core/index.js +1 -1
- package/dist/debug/index.d.ts +491 -98
- package/dist/debug/index.js +1 -1
- package/dist/dirtyTracking-C4v8MmM9.d.ts +235 -0
- package/dist/errors/index.d.ts +12 -12
- package/dist/errors/index.js +1 -1
- package/dist/{events-BbbxkgvX.d.ts → events-9ForpTfM.d.ts} +75 -2
- package/dist/game/index.d.ts +7 -7
- package/dist/game/index.js +1 -1
- package/dist/{gameLoop-BIPW7-OY.d.ts → gameLoop-C-Ez_i54.d.ts} +2 -2
- package/dist/{index-zSGJ2eUk.d.ts → index-DBS5Uefn.d.ts} +2 -2
- package/dist/index.d.ts +283 -20
- package/dist/index.js +3 -1
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/{inputActions-CefRUBuT.d.ts → inputActions-CRsUtTHM.d.ts} +10 -721
- package/dist/packedStore-BgvnEdE7.d.ts +191 -0
- package/dist/{renderable-jTMOA-GK.d.ts → renderable-CwqGwrEV.d.ts} +9 -9
- package/dist/{scheduler-DcfoFuum.d.ts → scheduler-CMcYew9Z.d.ts} +65 -3
- package/dist/systems/index.d.ts +356 -55
- package/dist/systems/index.js +1 -1
- package/dist/terminal/index.d.ts +2233 -2299
- package/dist/terminal/index.js +1 -1
- package/dist/{tilemap-D1HJvKy3.d.ts → tilemap-BirMJdbu.d.ts} +92 -3
- package/dist/{types-BcsvoKzf.d.ts → types-CPB4CpbH.d.ts} +2 -2
- package/dist/utils/index.d.ts +27 -180
- package/dist/utils/index.js +1 -1
- package/dist/{virtualScrollback-DvZTRU8a.d.ts → virtualScrollback-D9uLFe8l.d.ts} +4 -4
- package/dist/{virtualViewport-Dx2iJliO.d.ts → virtualViewport-Bpv6jlKt.d.ts} +283 -761
- package/dist/widgets/bigText.d.ts +1 -1
- package/dist/widgets/bigText.js +1 -1
- package/dist/widgets/index.d.ts +10519 -5463
- package/dist/widgets/index.js +1 -1
- package/package.json +102 -6
- package/dist/chunk-35I22JJO.js +0 -1
- package/dist/chunk-3EGGGI5J.js +0 -3
- package/dist/chunk-4X4N4HNQ.js +0 -2
- package/dist/chunk-AQ7LW75B.js +0 -1
- package/dist/chunk-AXZQAH4X.js +0 -1
- package/dist/chunk-BCADUCOZ.js +0 -1
- package/dist/chunk-EJ5WVDDZ.js +0 -6
- package/dist/chunk-FT7BMYSN.js +0 -1
- package/dist/chunk-FYEBZAWN.js +0 -1
- package/dist/chunk-GYHI26UE.js +0 -1
- package/dist/chunk-H2YAOJDW.js +0 -1
- package/dist/chunk-K2B2OXQ5.js +0 -5
- package/dist/chunk-K37L3G4Z.js +0 -4
- package/dist/chunk-KD55INV7.js +0 -1
- package/dist/chunk-KFAK4A3G.js +0 -1
- package/dist/chunk-LCN2ZITE.js +0 -1
- package/dist/chunk-OUXUPF3V.js +0 -33
- package/dist/chunk-P6CJO3BC.js +0 -1
- package/dist/chunk-PI5UOHOH.js +0 -1
- package/dist/chunk-PSXXMBVJ.js +0 -1
- package/dist/chunk-TRK4422V.js +0 -12
- package/dist/chunk-W5OU7Z6J.js +0 -1
- package/dist/chunk-WNG4A3K7.js +0 -4
- package/dist/chunk-XRJNAHNG.js +0 -19
- package/dist/chunk-XZA63ZPO.js +0 -1
- package/dist/chunk-YAMOSPWB.js +0 -4
- package/dist/chunk-YD6ULIUR.js +0 -1
- package/dist/{keyParser-Bwm8-l7v.d.ts → keyParser-BnHbg2iD.d.ts} +1 -1
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { W as World, E as Entity } from './types-BcsvoKzf.js';
|
|
2
|
+
import { h as BorderCharset } from './border-Jb7TrMob.js';
|
|
4
3
|
import { M as MouseEvent, c as MouseButton } from './mouseParser-Cfrbn3AX.js';
|
|
5
|
-
import { b as KeyEvent, K as KeyName } from './keyParser-
|
|
4
|
+
import { b as KeyEvent, K as KeyName } from './keyParser-BnHbg2iD.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @module core/entities
|
|
7
|
+
* Zod validation schemas and TypeScript types for entity configurations.
|
|
8
|
+
* @module core/entities/schemas
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
/**
|
|
@@ -1138,715 +1136,6 @@ declare const RadioButtonConfigSchema: z.ZodObject<{
|
|
|
1138
1136
|
* @see {@link createRadioButtonEntity} for entity creation
|
|
1139
1137
|
*/
|
|
1140
1138
|
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
1139
|
|
|
1851
1140
|
/**
|
|
1852
1141
|
* Input event buffer for frame-independent input handling.
|
|
@@ -2499,11 +1788,11 @@ interface ActionBinding {
|
|
|
2499
1788
|
/** Keys that activate this action */
|
|
2500
1789
|
readonly keys: readonly string[];
|
|
2501
1790
|
/** Mouse buttons that activate this action */
|
|
2502
|
-
readonly mouseButtons?: readonly MouseButton[];
|
|
1791
|
+
readonly mouseButtons?: readonly MouseButton[] | undefined;
|
|
2503
1792
|
/** Whether action fires continuously while held (default: false) */
|
|
2504
|
-
readonly continuous?: boolean;
|
|
1793
|
+
readonly continuous?: boolean | undefined;
|
|
2505
1794
|
/** Deadzone for analog inputs (0-1, default: 0.1) */
|
|
2506
|
-
readonly deadzone?: number;
|
|
1795
|
+
readonly deadzone?: number | undefined;
|
|
2507
1796
|
}
|
|
2508
1797
|
/**
|
|
2509
1798
|
* Runtime state of an action.
|
|
@@ -2528,8 +1817,8 @@ interface SerializedBindings {
|
|
|
2528
1817
|
readonly bindings: readonly {
|
|
2529
1818
|
readonly action: string;
|
|
2530
1819
|
readonly keys: readonly string[];
|
|
2531
|
-
readonly mouseButtons?: readonly string[];
|
|
2532
|
-
readonly continuous?: boolean;
|
|
1820
|
+
readonly mouseButtons?: readonly string[] | undefined;
|
|
1821
|
+
readonly continuous?: boolean | undefined;
|
|
2533
1822
|
}[];
|
|
2534
1823
|
}
|
|
2535
1824
|
/**
|
|
@@ -2634,4 +1923,4 @@ declare const ActionPresets: {
|
|
|
2634
1923
|
readonly menu: readonly ActionBinding[];
|
|
2635
1924
|
};
|
|
2636
1925
|
|
|
2637
|
-
export {
|
|
1926
|
+
export { createInputEventBuffer 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, beginFrame as Z, createInputActionManager as _, type InputState as a, createInputState as a0, drainAllEvents as a1, drainKeys as a2, drainMouse as a3, endFrame as a4, getLatencyStats as a5, getMovementDirection as a6, getPendingCount as a7, getPendingKeyCount as a8, getPendingMouseCount as a9, globalInputBuffer as aa, hasPendingEvents as ab, isAllKeysDown as ac, isAnyKeyDown as ad, isAnyKeyPressed as ae, isLatencyAcceptable as af, isProcessingTimeAcceptable as ag, peekEvents as ah, peekKeys as ai, peekMouse as aj, pushKeyEvent as ak, pushMouseEvent as al, recordLatency as am, recordLatencyBatch as an, resetLatencyStats as ao, resetStats as ap, clearBuffer as aq, getStats as ar, 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 };
|