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,141 @@
1
+ import { Readable, Writable } from 'node:stream';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Program Module
6
+ *
7
+ * Main terminal control interface. Manages input/output streams,
8
+ * terminal dimensions, cursor position, and event handling.
9
+ *
10
+ * @module terminal/program
11
+ * @internal This module is internal and not exported from the main package.
12
+ */
13
+
14
+ /**
15
+ * Program configuration schema
16
+ */
17
+ declare const ProgramConfigSchema: z.ZodObject<{
18
+ input: z.ZodOptional<z.ZodCustom<Readable, Readable>>;
19
+ output: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
20
+ useAlternateScreen: z.ZodDefault<z.ZodBoolean>;
21
+ hideCursor: z.ZodDefault<z.ZodBoolean>;
22
+ title: z.ZodOptional<z.ZodString>;
23
+ forceWidth: z.ZodOptional<z.ZodNumber>;
24
+ forceHeight: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strip>;
26
+ type ProgramConfig = z.input<typeof ProgramConfigSchema>;
27
+ /**
28
+ * Key event data
29
+ */
30
+ interface KeyEvent {
31
+ /** Key name or character */
32
+ name: string;
33
+ /** Raw key sequence */
34
+ sequence: string;
35
+ /** Ctrl key pressed */
36
+ ctrl: boolean;
37
+ /** Meta/Alt key pressed */
38
+ meta: boolean;
39
+ /** Shift key pressed */
40
+ shift: boolean;
41
+ }
42
+ /**
43
+ * Mouse event data
44
+ */
45
+ interface MouseEvent {
46
+ /** Mouse X position (1-indexed) */
47
+ x: number;
48
+ /** Mouse Y position (1-indexed) */
49
+ y: number;
50
+ /** Mouse button (0=left, 1=middle, 2=right) */
51
+ button: number;
52
+ /** Event action */
53
+ action: 'mousedown' | 'mouseup' | 'mousemove' | 'wheel';
54
+ /** Ctrl key pressed */
55
+ ctrl: boolean;
56
+ /** Meta/Alt key pressed */
57
+ meta: boolean;
58
+ /** Shift key pressed */
59
+ shift: boolean;
60
+ }
61
+ /**
62
+ * Resize event data
63
+ */
64
+ interface ResizeEvent {
65
+ /** New width in columns */
66
+ cols: number;
67
+ /** New height in rows */
68
+ rows: number;
69
+ }
70
+ /**
71
+ * Program event types
72
+ */
73
+ interface ProgramEvents {
74
+ key: [event: KeyEvent];
75
+ mouse: [event: MouseEvent];
76
+ resize: [event: ResizeEvent];
77
+ focus: [];
78
+ blur: [];
79
+ [key: string]: unknown[];
80
+ }
81
+ /**
82
+ * Program interface for type-safe access.
83
+ *
84
+ * Manages:
85
+ * - Input/output streams
86
+ * - Terminal dimensions
87
+ * - Cursor position
88
+ * - Buffered output
89
+ * - Alternate screen buffer
90
+ * - Event handling (key, mouse, resize)
91
+ */
92
+ interface Program {
93
+ readonly input: Readable;
94
+ readonly output: Writable;
95
+ readonly cols: number;
96
+ readonly rows: number;
97
+ readonly x: number;
98
+ readonly y: number;
99
+ readonly initialized: boolean;
100
+ on<K extends keyof ProgramEvents & string>(event: K, listener: (...args: ProgramEvents[K]) => void): void;
101
+ off<K extends keyof ProgramEvents & string>(event: K, listener: (...args: ProgramEvents[K]) => void): void;
102
+ once<K extends keyof ProgramEvents & string>(event: K, listener: (...args: ProgramEvents[K]) => void): void;
103
+ removeAllListeners<K extends keyof ProgramEvents & string>(event?: K): void;
104
+ init(): Promise<void>;
105
+ destroy(): void;
106
+ write(data: string): void;
107
+ rawWrite(data: string): void;
108
+ flush(): void;
109
+ clear(): void;
110
+ move(x: number, y: number): void;
111
+ cursorTo(x: number, y: number): void;
112
+ showCursor(): void;
113
+ hideCursor(): void;
114
+ setTitle(title: string): void;
115
+ resetStyle(): void;
116
+ }
117
+ /**
118
+ * Creates a new Program instance.
119
+ *
120
+ * @param config - Program configuration
121
+ * @returns A new Program instance
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const program = createProgram();
126
+ * await program.init();
127
+ *
128
+ * program.on('key', (event) => {
129
+ * if (event.name === 'q') {
130
+ * program.destroy();
131
+ * }
132
+ * });
133
+ *
134
+ * program.move(10, 5);
135
+ * program.write('Hello, World!');
136
+ * program.flush();
137
+ * ```
138
+ */
139
+ declare function createProgram(config?: ProgramConfig): Program;
140
+
141
+ export { type KeyEvent as K, type MouseEvent as M, type Program as P, type ResizeEvent as R, type ProgramConfig as a, ProgramConfigSchema as b, createProgram as c };
@@ -0,0 +1,302 @@
1
+ import { W as World, E as Entity } from './types-BcsvoKzf.js';
2
+
3
+ /**
4
+ * Renderable component for visual styling of entities.
5
+ * @module components/renderable
6
+ */
7
+
8
+ /**
9
+ * Default foreground color (white).
10
+ */
11
+ declare const DEFAULT_FG: number;
12
+ /**
13
+ * Default background color (black, fully transparent).
14
+ */
15
+ declare const DEFAULT_BG: number;
16
+ /**
17
+ * Renderable component store using SoA (Structure of Arrays) for performance.
18
+ *
19
+ * - `visible`: Whether entity should be rendered (0=hidden, 1=visible)
20
+ * - `dirty`: Whether entity needs redraw (0=clean, 1=dirty)
21
+ * - `fg`: Foreground color (packed RGBA)
22
+ * - `bg`: Background color (packed RGBA)
23
+ * - `bold`, `underline`, `blink`, `inverse`: Text styling flags
24
+ * - `transparent`: Whether background is transparent
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { Renderable, setStyle, getStyle, markDirty } from 'blecsd';
29
+ *
30
+ * setStyle(world, entity, { fg: '#ff0000', bold: true });
31
+ * markDirty(world, entity);
32
+ *
33
+ * const style = getStyle(world, entity);
34
+ * console.log(style.bold); // true
35
+ * ```
36
+ */
37
+ declare const Renderable: {
38
+ /** 0 = hidden, 1 = visible */
39
+ visible: Uint8Array<ArrayBuffer>;
40
+ /** 0 = clean, 1 = needs redraw */
41
+ dirty: Uint8Array<ArrayBuffer>;
42
+ /** Foreground color (packed RGBA) */
43
+ fg: Uint32Array<ArrayBuffer>;
44
+ /** Background color (packed RGBA) */
45
+ bg: Uint32Array<ArrayBuffer>;
46
+ /** Bold text */
47
+ bold: Uint8Array<ArrayBuffer>;
48
+ /** Underlined text */
49
+ underline: Uint8Array<ArrayBuffer>;
50
+ /** Blinking text */
51
+ blink: Uint8Array<ArrayBuffer>;
52
+ /** Inverse colors */
53
+ inverse: Uint8Array<ArrayBuffer>;
54
+ /** Transparent background */
55
+ transparent: Uint8Array<ArrayBuffer>;
56
+ /** Opacity for alpha blending (0-255, where 255 = fully opaque) */
57
+ opacity: Uint8Array<ArrayBuffer>;
58
+ };
59
+ /**
60
+ * Style options for setStyle.
61
+ */
62
+ interface StyleOptions {
63
+ /** Foreground color (hex string or packed number) */
64
+ fg?: string | number;
65
+ /** Background color (hex string or packed number) */
66
+ bg?: string | number;
67
+ /** Bold text */
68
+ bold?: boolean;
69
+ /** Underlined text */
70
+ underline?: boolean;
71
+ /** Blinking text */
72
+ blink?: boolean;
73
+ /** Inverse colors */
74
+ inverse?: boolean;
75
+ /** Transparent background */
76
+ transparent?: boolean;
77
+ /** Opacity for alpha blending (0-1, where 1 = fully opaque) */
78
+ opacity?: number;
79
+ }
80
+ /**
81
+ * Style data returned by getStyle.
82
+ */
83
+ interface StyleData {
84
+ readonly fg: number;
85
+ readonly bg: number;
86
+ readonly bold: boolean;
87
+ readonly underline: boolean;
88
+ readonly blink: boolean;
89
+ readonly inverse: boolean;
90
+ readonly transparent: boolean;
91
+ /** Opacity value (0-1, where 1 = fully opaque) */
92
+ readonly opacity: number;
93
+ }
94
+ /**
95
+ * Renderable data returned by getRenderable.
96
+ */
97
+ interface RenderableData extends StyleData {
98
+ readonly visible: boolean;
99
+ readonly dirty: boolean;
100
+ }
101
+ /**
102
+ * Sets the visual style of an entity.
103
+ * Adds the Renderable component if not already present.
104
+ *
105
+ * @param world - The ECS world
106
+ * @param eid - The entity ID
107
+ * @param style - Style options to apply
108
+ * @returns The entity ID for chaining
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * import { createWorld, addEntity } from '../core/ecs';
113
+ * import { setStyle } from 'blecsd';
114
+ *
115
+ * const world = createWorld();
116
+ * const entity = addEntity(world);
117
+ *
118
+ * // Set style with hex colors
119
+ * setStyle(world, entity, {
120
+ * fg: '#ff0000',
121
+ * bg: '#000000',
122
+ * bold: true,
123
+ * });
124
+ *
125
+ * // Or with packed colors
126
+ * setStyle(world, entity, { fg: 0xffff0000 });
127
+ * ```
128
+ */
129
+ declare function setStyle(world: World, eid: Entity, style: StyleOptions): Entity;
130
+ /**
131
+ * Gets the style data of an entity.
132
+ * Returns undefined if the entity doesn't have a Renderable component.
133
+ *
134
+ * @param world - The ECS world
135
+ * @param eid - The entity ID
136
+ * @returns Style data or undefined
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * import { getStyle, colorToHex } from 'blecsd';
141
+ *
142
+ * const style = getStyle(world, entity);
143
+ * if (style) {
144
+ * console.log(`FG: ${colorToHex(style.fg)}, Bold: ${style.bold}`);
145
+ * }
146
+ * ```
147
+ */
148
+ declare function getStyle(world: World, eid: Entity): StyleData | undefined;
149
+ /**
150
+ * Gets the full renderable data of an entity.
151
+ * Returns undefined if the entity doesn't have a Renderable component.
152
+ *
153
+ * @param world - The ECS world
154
+ * @param eid - The entity ID
155
+ * @returns Renderable data or undefined
156
+ */
157
+ declare function getRenderable(world: World, eid: Entity): RenderableData | undefined;
158
+ /**
159
+ * Marks an entity as needing redraw.
160
+ *
161
+ * @param world - The ECS world
162
+ * @param eid - The entity ID
163
+ * @returns The entity ID for chaining
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * import { markDirty } from 'blecsd';
168
+ *
169
+ * // After changing entity state, mark for redraw
170
+ * markDirty(world, entity);
171
+ * ```
172
+ */
173
+ declare function markDirty(world: World, eid: Entity): Entity;
174
+ /**
175
+ * Marks an entity as clean (no redraw needed).
176
+ *
177
+ * @param world - The ECS world
178
+ * @param eid - The entity ID
179
+ * @returns The entity ID for chaining
180
+ */
181
+ declare function markClean(world: World, eid: Entity): Entity;
182
+ /**
183
+ * Checks if an entity needs redraw.
184
+ *
185
+ * @param world - The ECS world
186
+ * @param eid - The entity ID
187
+ * @returns true if dirty, false otherwise
188
+ */
189
+ declare function isDirty(world: World, eid: Entity): boolean;
190
+ /**
191
+ * Sets visibility of an entity.
192
+ *
193
+ * @param world - The ECS world
194
+ * @param eid - The entity ID
195
+ * @param visible - true to show, false to hide
196
+ * @returns The entity ID for chaining
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * import { setVisible } from 'blecsd';
201
+ *
202
+ * setVisible(world, entity, false); // Hide entity
203
+ * setVisible(world, entity, true); // Show entity
204
+ * ```
205
+ */
206
+ declare function setVisible(world: World, eid: Entity, visible: boolean): Entity;
207
+ /**
208
+ * Checks if an entity is visible.
209
+ *
210
+ * @param world - The ECS world
211
+ * @param eid - The entity ID
212
+ * @returns true if visible, false otherwise
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * import { isVisible } from 'blecsd';
217
+ *
218
+ * if (isVisible(world, entity)) {
219
+ * // Render the entity
220
+ * }
221
+ * ```
222
+ */
223
+ declare function isVisible(world: World, eid: Entity): boolean;
224
+ /**
225
+ * Checks if an entity has a Renderable component.
226
+ *
227
+ * @param world - The ECS world
228
+ * @param eid - The entity ID
229
+ * @returns true if entity has Renderable component
230
+ */
231
+ declare function hasRenderable(world: World, eid: Entity): boolean;
232
+ /**
233
+ * Shows an entity (sets visible to true).
234
+ *
235
+ * @param world - The ECS world
236
+ * @param eid - The entity ID
237
+ * @returns The entity ID for chaining
238
+ */
239
+ declare function show(world: World, eid: Entity): Entity;
240
+ /**
241
+ * Hides an entity (sets visible to false).
242
+ *
243
+ * @param world - The ECS world
244
+ * @param eid - The entity ID
245
+ * @returns The entity ID for chaining
246
+ */
247
+ declare function hide(world: World, eid: Entity): Entity;
248
+ /**
249
+ * Toggles an entity's visibility.
250
+ *
251
+ * @param world - The ECS world
252
+ * @param eid - The entity ID
253
+ * @returns The entity ID for chaining
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * import { toggle } from 'blecsd';
258
+ *
259
+ * // Toggle visibility on key press
260
+ * toggle(world, menuEntity);
261
+ * ```
262
+ */
263
+ declare function toggle(world: World, eid: Entity): Entity;
264
+ /**
265
+ * Checks if an entity is effectively visible.
266
+ * An entity is effectively visible only if it and all its ancestors are visible.
267
+ *
268
+ * @param world - The ECS world
269
+ * @param eid - The entity ID
270
+ * @returns true if entity and all ancestors are visible
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * import { isEffectivelyVisible, hide, show } from 'blecsd';
275
+ *
276
+ * // Parent is hidden, so child is not effectively visible
277
+ * hide(world, parentEntity);
278
+ * show(world, childEntity);
279
+ * console.log(isEffectivelyVisible(world, childEntity)); // false
280
+ * ```
281
+ */
282
+ declare function isEffectivelyVisible(world: World, eid: Entity): boolean;
283
+ /**
284
+ * Checks if an entity is detached from the root.
285
+ * An entity is detached if it has a hierarchy but no path to a root entity.
286
+ *
287
+ * @param world - The ECS world
288
+ * @param eid - The entity ID
289
+ * @returns true if entity is detached from root
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * import { isDetached, removeChild } from 'blecsd';
294
+ *
295
+ * // After removing from parent, entity may be detached
296
+ * removeChild(world, parentEntity, childEntity);
297
+ * console.log(isDetached(world, childEntity)); // true (if no other parent)
298
+ * ```
299
+ */
300
+ declare function isDetached(world: World, eid: Entity): boolean;
301
+
302
+ export { DEFAULT_BG as D, Renderable as R, type StyleData as S, DEFAULT_FG as a, type RenderableData as b, type StyleOptions as c, getStyle as d, hide as e, isDirty as f, getRenderable as g, hasRenderable as h, isDetached as i, isEffectivelyVisible as j, isVisible as k, markDirty as l, markClean as m, setVisible as n, show as o, setStyle as s, toggle as t };
@@ -0,0 +1,86 @@
1
+ import { L as LoopPhase, S as System, W as World } from './types-BcsvoKzf.js';
2
+
3
+ /**
4
+ * System scheduler for ordered execution.
5
+ * @module core/scheduler
6
+ */
7
+
8
+ /**
9
+ * Gets the current frame's delta time.
10
+ * Call this from within a system to get the time elapsed since the last frame.
11
+ *
12
+ * @returns Delta time in seconds
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { getDeltaTime } from 'blecsd';
17
+ *
18
+ * const movementSystem: System = (world) => {
19
+ * const dt = getDeltaTime();
20
+ * // Use dt for frame-rate independent movement
21
+ * return world;
22
+ * };
23
+ * ```
24
+ */
25
+ declare function getDeltaTime(): number;
26
+ /**
27
+ * Scheduler interface for managing and executing systems in order.
28
+ *
29
+ * Systems are organized into phases that run in a fixed order.
30
+ * Within each phase, systems run by priority (lower = earlier).
31
+ *
32
+ * The INPUT phase is protected and cannot be modified by users
33
+ * to ensure input is always processed first.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * import { createScheduler, LoopPhase } from 'blecsd';
38
+ *
39
+ * const scheduler = createScheduler();
40
+ *
41
+ * scheduler.registerSystem(LoopPhase.UPDATE, movementSystem);
42
+ * scheduler.registerSystem(LoopPhase.RENDER, renderSystem);
43
+ *
44
+ * // In game loop
45
+ * scheduler.run(world, deltaTime);
46
+ * ```
47
+ */
48
+ interface Scheduler {
49
+ registerSystem(phase: LoopPhase, system: System, priority?: number): void;
50
+ registerInputSystem(system: System, priority?: number): void;
51
+ unregisterSystem(system: System): void;
52
+ unregisterInputSystem(system: System): void;
53
+ run(world: World, deltaTime: number): World;
54
+ runInputOnly(world: World, deltaTime: number): World;
55
+ runFixedUpdatePhases(world: World, fixedDeltaTime: number): World;
56
+ runRenderPhases(world: World, deltaTime: number): World;
57
+ getSystemsForPhase(phase: LoopPhase): System[];
58
+ getSystemCount(phase: LoopPhase): number;
59
+ getTotalSystemCount(): number;
60
+ hasSystem(system: System): boolean;
61
+ clearPhase(phase: LoopPhase): void;
62
+ clearAllSystems(): void;
63
+ }
64
+ /**
65
+ * Creates a new scheduler instance.
66
+ *
67
+ * @returns A new Scheduler instance
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * import { createScheduler, LoopPhase } from 'blecsd';
72
+ *
73
+ * const scheduler = createScheduler();
74
+ *
75
+ * // Register systems
76
+ * scheduler.registerSystem(LoopPhase.UPDATE, movementSystem);
77
+ * scheduler.registerSystem(LoopPhase.PHYSICS, physicsSystem);
78
+ * scheduler.registerSystem(LoopPhase.RENDER, renderSystem);
79
+ *
80
+ * // Run in game loop
81
+ * scheduler.run(world, deltaTime);
82
+ * ```
83
+ */
84
+ declare function createScheduler(): Scheduler;
85
+
86
+ export { type Scheduler as S, createScheduler as c, getDeltaTime as g };