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
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013-2015, Christopher Jeffrey and contributors
2
+ https://github.com/chjj/
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,220 @@
1
+ # blECSd
2
+
3
+ [![CI](https://github.com/Kadajett/blECSd/actions/workflows/ci.yml/badge.svg)](https://github.com/Kadajett/blECSd/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/blecsd.svg)](https://www.npmjs.com/package/blecsd)
5
+
6
+ A high-performance terminal UI library built on TypeScript and bitECS.
7
+
8
+ blECSd provides a complete toolkit for building terminal applications: dashboards, file managers, system monitors, CLI tools, and games. It combines the performance of an Entity Component System with production-ready widgets and form controls.
9
+
10
+ ## Features
11
+
12
+ - **18 Widgets**: Box, Panel, Tabs, List, Table, Tree, VirtualizedList, and more
13
+ - **Form Controls**: TextInput, Checkbox, RadioButton, Slider, Select, ProgressBar
14
+ - **32 Components**: Position, Renderable, Focusable, Interactive, Animation, Collision, etc.
15
+ - **12 Systems**: Layout, Input, Render, Animation, Collision, Camera, Drag, Focus, etc.
16
+ - **Physics-based Animations**: Velocity, acceleration, friction for smooth transitions
17
+ - **Virtualized Rendering**: Efficiently render 1000s of items
18
+ - **State Machines**: Built-in FSM support for complex UI state
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install blecsd
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```typescript
29
+ import { createWorld, addEntity } from 'bitecs';
30
+ import {
31
+ setPosition,
32
+ setDimensions,
33
+ setBorder,
34
+ setContent,
35
+ createPanel,
36
+ createList,
37
+ createTextInput,
38
+ createEventBus
39
+ } from 'blecsd';
40
+
41
+ // Create a world and entities
42
+ const world = createWorld();
43
+
44
+ // Create a panel with a title
45
+ const panel = createPanel(world, {
46
+ x: 2,
47
+ y: 1,
48
+ width: 40,
49
+ height: 10,
50
+ title: 'My Application',
51
+ border: { type: 'rounded' }
52
+ });
53
+
54
+ // Create an interactive list
55
+ const list = createList(world, {
56
+ x: 4,
57
+ y: 3,
58
+ width: 36,
59
+ height: 6,
60
+ items: [
61
+ { label: 'Option 1', value: 'opt1' },
62
+ { label: 'Option 2', value: 'opt2' },
63
+ { label: 'Option 3', value: 'opt3' }
64
+ ]
65
+ });
66
+
67
+ // Type-safe events
68
+ interface AppEvents {
69
+ 'item:selected': { value: string };
70
+ }
71
+ const events = createEventBus<AppEvents>();
72
+ events.on('item:selected', (e) => console.log(`Selected: ${e.value}`));
73
+ ```
74
+
75
+ ## Widgets
76
+
77
+ | Widget | Description |
78
+ |--------|-------------|
79
+ | Box | Base container with borders, padding, content |
80
+ | Panel | Box with title bar, collapsible, close button |
81
+ | Tabs | Tabbed container with keyboard navigation |
82
+ | Text | Text display with alignment, wrapping |
83
+ | List | Selectable list with keyboard/mouse support |
84
+ | Table | Data table with headers, columns, sorting |
85
+ | Tree | Hierarchical tree view with expand/collapse |
86
+ | VirtualizedList | Efficient list for large datasets |
87
+ | ListTable | Table-style list display |
88
+ | Listbar | Horizontal navigation bar |
89
+ | Line | Horizontal/vertical separator |
90
+ | Loading | Loading indicator with spinner |
91
+ | ScrollableBox | Container with scroll support |
92
+ | ScrollableText | Scrollable text area |
93
+ | HoverText | Tooltip/hover text display |
94
+ | Layout | Flex/grid layout container |
95
+
96
+ ## Form Controls
97
+
98
+ | Control | Description |
99
+ |---------|-------------|
100
+ | TextInput | Single/multi-line text entry with cursor, selection |
101
+ | Checkbox | Boolean toggle with customizable characters |
102
+ | RadioButton | Single selection from group |
103
+ | Slider | Range value selection, horizontal/vertical |
104
+ | Select | Dropdown selection menu |
105
+ | ProgressBar | Progress indicator, horizontal/vertical |
106
+ | Form | Form field management, validation, submit |
107
+
108
+ ## Components
109
+
110
+ blECSd provides ECS components that work with any bitECS world:
111
+
112
+ | Component | Purpose |
113
+ |-----------|---------|
114
+ | Position | X/Y coordinates, z-index, absolute positioning |
115
+ | Renderable | Colors, visibility, dirty tracking |
116
+ | Dimensions | Width, height, min/max constraints, percentages |
117
+ | Hierarchy | Parent-child relationships, traversal |
118
+ | Focusable | Keyboard focus, tab order |
119
+ | Interactive | Click, hover, drag states |
120
+ | Scrollable | Scroll position, content size, scrollbars |
121
+ | Border | Box borders (single, double, rounded, bold, ascii) |
122
+ | Content | Text content, alignment, wrapping, tag parsing |
123
+ | Padding | Inner spacing |
124
+ | Label | Text labels with positioning |
125
+ | Animation | Frame-based sprite animations |
126
+ | Velocity | Movement with speed, friction, max speed |
127
+ | Collision | AABB/circle collision detection, layers, triggers |
128
+ | Camera | Viewport, target following, bounds |
129
+ | StateMachine | Finite state machine with events, transitions |
130
+ | Sprite | Sprite sheets, frames |
131
+ | Shadow | Drop shadows with opacity, blending |
132
+ | VirtualViewport | Virtualized content rendering |
133
+
134
+ See [API Reference](./docs/api/index.md) for the complete list.
135
+
136
+ ## Systems
137
+
138
+ | System | Purpose |
139
+ |--------|---------|
140
+ | inputSystem | Process keyboard/mouse input |
141
+ | focusSystem | Manage focus, tab navigation |
142
+ | layoutSystem | Calculate positions, dimensions |
143
+ | renderSystem | Render entities to screen buffer |
144
+ | virtualizedRenderSystem | Efficient rendering for large datasets |
145
+ | animationSystem | Update sprite animations |
146
+ | movementSystem | Apply velocity to position |
147
+ | collisionSystem | Detect and resolve collisions |
148
+ | cameraSystem | Update camera following target |
149
+ | dragSystem | Handle drag and drop |
150
+ | stateMachineSystem | Process state machine transitions |
151
+ | outputSystem | Write buffer to terminal |
152
+
153
+ ## Library Design
154
+
155
+ blECSd is a library, not a framework:
156
+
157
+ 1. **Components work standalone**: Import them into any bitECS world
158
+ 2. **No required update loop**: All systems are callable functions
159
+ 3. **Mix and match**: Use our input parsing with your rendering, or vice versa
160
+ 4. **You own the world**: Functions take `world` as a parameter; we never hold global state
161
+
162
+ ```typescript
163
+ // Your world, your control
164
+ import { createWorld, addEntity } from 'bitecs';
165
+ import { setPosition, setRenderable, layoutSystem, renderSystem } from 'blecsd';
166
+
167
+ const world = createWorld();
168
+ const eid = addEntity(world);
169
+
170
+ // Use components without our update loop
171
+ setPosition(world, eid, 10, 5);
172
+
173
+ // Call systems when you want
174
+ layoutSystem(world);
175
+ renderSystem(world);
176
+ ```
177
+
178
+ ## Use Cases
179
+
180
+ - **Dashboards**: System monitors, log viewers, status displays
181
+ - **File Managers**: Tree views, virtualized lists, panels
182
+ - **CLI Tools**: Forms, menus, progress indicators
183
+ - **Dev Tools**: Debug panels, profilers, inspectors
184
+ - **Games**: Roguelikes, text adventures, puzzle games
185
+
186
+ ## Comparison
187
+
188
+ | Feature | blECSd | Ink | blessed | Textual |
189
+ |---------|--------|-----|---------|---------|
190
+ | Architecture | ECS (data-oriented) | React (component) | Class-based | Widget classes |
191
+ | Language | TypeScript | TypeScript/JSX | JavaScript | Python |
192
+ | Widgets | 18 built-in | Few built-in | Many built-in | Many built-in |
193
+ | Animation | Physics-based | Manual | Manual | CSS-like |
194
+ | Virtualization | Built-in | Manual | Manual | Built-in |
195
+ | Game support | First-class | Limited | Limited | Limited |
196
+
197
+ Choose blECSd if you want data-oriented design, physics-based animations, or game development support. Choose Ink for React-style development. Choose Textual for Python projects.
198
+
199
+ ## Documentation
200
+
201
+ - [Installation](./docs/getting-started/installation.md): Requirements, terminal compatibility, setup
202
+ - [Core Concepts](./docs/getting-started/concepts.md): ECS, scheduler, events
203
+ - [Hello World](./docs/getting-started/hello-world.md): Your first blECSd application
204
+ - [API Reference](./docs/api/index.md): Components, widgets, systems, terminal I/O
205
+ - [Terminal Widget](./docs/api/widgets/terminal.md): ANSI rendering and PTY shell support
206
+ - [Examples](./docs/examples/index.md): File manager, multiplexer, system monitor, ANSI viewer, telnet server
207
+ - [Guides](./docs/guides/): Animations, forms, layouts, and more
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ pnpm install
213
+ pnpm test
214
+ pnpm lint
215
+ pnpm build
216
+ ```
217
+
218
+ ## License
219
+
220
+ MIT
@@ -0,0 +1,5 @@
1
+ export { A as AmbientLight, a as AmbientLightSchema, b as Animation3D, c as Animation3DData, B as BackendCapabilities, d as BackendCapabilitiesSchema, e as BackendPreference, f as BackendPreferenceSchema, g as BackendSelection, h as BackendSelectionSchema, j as BackendType, k as BackendTypeSchema, l as BrailleConfig, m as BrailleConfigSchema, C as Camera3D, n as Camera3DData, o as ClipRect, p as ClipRectSchema, q as ClippedLine, r as CubeMeshOptions, s as CubeMeshOptionsSchema, t as CylinderMeshOptions, u as CylinderMeshOptionsSchema, D as DirectionalLight, v as DirectionalLightSchema, E as EncodedCell, w as EncodedCellSchema, x as EncodedOutput, y as EncodedOutputSchema, z as EulerAngles, F as EulerAnglesSchema, G as FrustumPlane, H as GraphicsCapabilities, I as HalfBlockConfig, J as HalfBlockConfigSchema, K as KittyConfig, L as KittyConfigSchema, M as LineEndpoint, N as LineEndpointSchema, O as Mat4, P as Mat4Schema, Q as Material3D, R as Material3DData, S as Mesh, T as MeshData, U as MeshProjection, V as MouseDragInput, W as MouseInteraction3D, X as MouseInteraction3DData, Y as ObjFace, Z as ObjGroup, _ as ObjLoadOptions, $ as ObjLoadOptionsSchema, a0 as ObjParseResult, a1 as ObjVertex, a2 as OrthographicConfig, a3 as OrthographicConfigSchema, a4 as PerspectiveConfig, a5 as PerspectiveConfigSchema, a6 as PixelBufferConfig, a7 as PixelBufferConfigSchema, a8 as PixelFramebuffer, a9 as PlaneMeshOptions, aa as PlaneMeshOptionsSchema, ab as ProjectedVertex, ac as RGBAColor, ad as RGBAColorSchema, ae as RendererBackend, af as ScreenCoord, ag as SextantConfig, ah as SextantConfigSchema, ai as SixelConfig, aj as SixelConfigSchema, ak as SphereMeshOptions, al as SphereMeshOptionsSchema, am as Transform3D, an as Transform3DData, ao as TriangleBBox, ap as TriangleVertex, aq as TriangleVertexSchema, ar as Vec3, as as Vec3Input, at as Vec3InputSchema, au as Vec3Schema, av as Viewport3D, aw as Viewport3DData, ax as ViewportConfig, ay as ViewportConfigSchema, az as ViewportOutput, aA as ViewportProjection, aB as animation3DSystem, aC as backendStore, aD as blendPixel, aE as buildMVP, aF as clearBackendStore, aG as clearFramebuffer, aH as clearFramebufferStore, aI as clearMeshStore, aJ as clearMouseInputStore, aK as clearOutputStore, aL as clearProjectionStore, aM as clipLine, aN as computeBoundingBox, aO as computeFaceNormal, aP as computeFlatShading, aQ as computeOutcode, aR as createBackendByType, aS as createBrailleBackend, aT as createCubeMesh, aU as createCylinderMesh, aV as createHalfBlockBackend, aW as createKittyBackend, aX as createMeshFromArrays, aY as createPixelFramebuffer, aZ as createPlaneMesh, a_ as createSextantBackend, a$ as createSixelBackend, b0 as createSphereMesh, b1 as detectBestBackend, b2 as disableMouseInteraction, b3 as drawLine, b4 as drawLineAA, b5 as drawLineColor, b6 as drawLineDepth, b7 as enableMouseInteraction, b8 as extractFrustumPlanes, b9 as feedMouseDrag, ba as feedMouseScroll, bb as fillRect, bc as fillTriangle, bd as fillTriangleFlat, be as framebufferStore, bf as getAnimation3D, bg as getCamera3D, bh as getDepth, bi as getMaterial3D, bj as getMesh, bk as getMeshCount, bl as getMeshData, bm as getMouseInteraction3D, bn as getPixel, bo as getProjMatrix, bp as getTransform3D, bq as getViewMatrix, br as getViewport3D, bs as getWorldMatrix, bt as isDirty, bu as isInBounds, bv as isPointInFrustum, bw as isSphereInFrustum, bx as loadObjAsMesh, by as lookAt, bz as markDirty, bA as mat4Determinant, bB as mat4Equals, bC as mat4FromTRS, bD as mat4Identity, bE as mat4Invert, bF as mat4IsIdentity, bG as mat4Multiply, bH as mat4RotateX, bI as mat4RotateY, bJ as mat4RotateZ, bK as mat4Scale, bL as mat4TransformDirection, bM as mat4TransformVec3, bN as mat4Translate, bO as mat4Transpose, bP as mouseInputStore, bQ as mouseInteraction3DSystem, bR as orthographicMatrix, bS as outputStore, bT as parseObj, bU as perspectiveMatrix, bV as projectVertex, bW as projectionStore, bX as projectionSystem, bY as rasterSystem, bZ as registerMesh, b_ as sceneGraphSystem, b$ as setAnimation3D, c0 as setCamera3D, c1 as setMaterial3D, c2 as setMesh, c3 as setPixel, c4 as setPixelUnsafe, c5 as setRotation, c6 as setScale, c7 as setTransform3D, c8 as setTranslation, c9 as setViewport3D, ca as shadeFace, cb as testAndSetDepth, cc as triangleArea2, cd as triangleBoundingBox, ce as unprojectVertex, cf as unregisterMesh, cg as vec3, ch as vec3Add, ci as vec3Cross, cj as vec3Distance, ck as vec3Dot, cl as vec3Equals, cm as vec3FromArray, cn as vec3Length, co as vec3LengthSq, cp as vec3Lerp, cq as vec3Negate, cr as vec3Normalize, cs as vec3Scale, ct as vec3Sub, cu as vec3Zero, cv as viewportOutputSystem, cw as viewportTransform } from '../index-zSGJ2eUk.js';
2
+ export { A as Animation3DConfig, b as Animation3DConfigSchema, C as Camera3DConfig, c as Camera3DConfigSchema, M as Material3DConfig, d as Material3DConfigSchema, a as MouseInteraction3DConfig, e as MouseInteraction3DConfigSchema, T as Transform3DConfig, f as Transform3DConfigSchema, V as Viewport3DConfig, g as Viewport3DConfigSchema, h as Viewport3DWidgetConfig, i as Viewport3DWidgetConfigSchema } from '../viewport3d-xI33-_wq.js';
3
+ import 'zod';
4
+ import '../types-BcsvoKzf.js';
5
+ import 'bitecs';
@@ -0,0 +1 @@
1
+ export{a as Animation3D,m as CubeMeshOptionsSchema,p as CylinderMeshOptionsSchema,d as MouseInteraction3D,l as ObjLoadOptionsSchema,o as PlaneMeshOptionsSchema,n as SphereMeshOptionsSchema,H as animation3DSystem,K as backendStore,y as blendPixel,M as clearBackendStore,f as clearMouseInputStore,N as clearOutputStore,u as clipLine,r as computeBoundingBox,A as computeFaceNormal,B as computeFlatShading,t as computeOutcode,D as createCubeMesh,G as createCylinderMesh,F as createPlaneMesh,E as createSphereMesh,j as disableMouseInteraction,z as drawLineAA,i as enableMouseInteraction,v as extractFrustumPlanes,g as feedMouseDrag,h as feedMouseScroll,c as getAnimation3D,k as getMouseInteraction3D,w as isPointInFrustum,x as isSphereInFrustum,s as loadObjAsMesh,e as mouseInputStore,I as mouseInteraction3DSystem,L as outputStore,q as parseObj,J as sceneGraphSystem,b as setAnimation3D,C as shadeFace,O as viewportOutputSystem}from'../chunk-VNZ6CWJA.js';export{Xa as AmbientLightSchema,w as Animation3DConfigSchema,b as BackendCapabilitiesSchema,k as BackendPreferenceSchema,e as BackendSelectionSchema,a as BackendTypeSchema,f as BrailleConfigSchema,y as Camera3D,t as Camera3DConfigSchema,ga as ClipRectSchema,Wa as DirectionalLightSchema,c as EncodedCellSchema,d as EncodedOutputSchema,ca as EulerAnglesSchema,g as HalfBlockConfigSchema,j as KittyConfigSchema,Ta as LineEndpointSchema,ba as Mat4Schema,D as Material3D,u as Material3DConfigSchema,G as Mesh,x as MouseInteraction3DConfigSchema,ea as OrthographicConfigSchema,da as PerspectiveConfigSchema,Sa as PixelBufferConfigSchema,Ua as RGBAColorSchema,h as SextantConfigSchema,i as SixelConfigSchema,P as Transform3D,s as Transform3DConfigSchema,Va as TriangleVertexSchema,aa as Vec3InputSchema,$ as Vec3Schema,Y as Viewport3D,v as Viewport3DConfigSchema,mb as Viewport3DWidgetConfigSchema,fa as ViewportConfigSchema,Ra as buildMVP,Za as clearFramebuffer,rb as clearFramebufferStore,O as clearMeshStore,ob as clearProjectionStore,q as createBackendByType,l as createBrailleBackend,m as createHalfBlockBackend,n as createKittyBackend,I as createMeshFromArrays,Ya as createPixelFramebuffer,o as createSextantBackend,p as createSixelBackend,r as detectBestBackend,fb as drawLine,hb as drawLineColor,gb as drawLineDepth,eb as fillRect,kb as fillTriangle,lb as fillTriangleFlat,qb as framebufferStore,A as getCamera3D,cb as getDepth,F as getMaterial3D,M as getMesh,N as getMeshCount,J as getMeshData,$a as getPixel,B as getProjMatrix,R as getTransform3D,C as getViewMatrix,_ as getViewport3D,V as getWorldMatrix,X as isDirty,_a as isInBounds,Na as lookAt,W as markDirty,Ea as mat4Determinant,Ka as mat4Equals,Ia as mat4FromTRS,wa as mat4Identity,Fa as mat4Invert,Ja as mat4IsIdentity,xa as mat4Multiply,za as mat4RotateX,Aa as mat4RotateY,Ba as mat4RotateZ,Ca as mat4Scale,Ha as mat4TransformDirection,Ga as mat4TransformVec3,ya as mat4Translate,Da as mat4Transpose,Ma as orthographicMatrix,La as perspectiveMatrix,Pa as projectVertex,nb as projectionStore,pb as projectionSystem,sb as rasterSystem,H as registerMesh,z as setCamera3D,E as setMaterial3D,L as setMesh,ab as setPixel,bb as setPixelUnsafe,T as setRotation,U as setScale,Q as setTransform3D,S as setTranslation,Z as setViewport3D,db as testAndSetDepth,ib as triangleArea2,jb as triangleBoundingBox,Qa as unprojectVertex,K as unregisterMesh,ha as vec3,ja as vec3Add,na as vec3Cross,ta as vec3Distance,ma as vec3Dot,ua as vec3Equals,ia as vec3FromArray,pa as vec3Length,oa as vec3LengthSq,ra as vec3Lerp,sa as vec3Negate,qa as vec3Normalize,la as vec3Scale,ka as vec3Sub,va as vec3Zero,Oa as viewportTransform}from'../chunk-LYSK5S63.js';import'../chunk-H2YAOJDW.js';import'../chunk-G7GIWWLE.js';import'../chunk-PXXGH3BV.js';import'../chunk-5PELJRUQ.js';
@@ -0,0 +1,177 @@
1
+ import { b as EventMap, E as EventBus } from '../events-BbbxkgvX.js';
2
+ import { U as Unsubscribe } from '../types-BcsvoKzf.js';
3
+ import 'bitecs';
4
+
5
+ /**
6
+ * Audio integration hooks for games.
7
+ *
8
+ * Provides typed interfaces and hook functions for integrating audio
9
+ * into terminal games. blECSd does not play audio directly; instead,
10
+ * users supply an AudioAdapter implementation and the library wires
11
+ * event-based sound triggers, volume control, and channel management.
12
+ *
13
+ * @module audio/hooks
14
+ */
15
+
16
+ /**
17
+ * Audio channel for routing sounds.
18
+ */
19
+ declare const AudioChannel: {
20
+ readonly Music: 0;
21
+ readonly SFX: 1;
22
+ };
23
+ type AudioChannelValue = (typeof AudioChannel)[keyof typeof AudioChannel];
24
+ /**
25
+ * Options for playing a sound.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { AudioChannel } from 'blecsd';
30
+ *
31
+ * const options: PlayOptions = {
32
+ * id: 'explosion',
33
+ * loop: false,
34
+ * volume: 0.8,
35
+ * channel: AudioChannel.SFX,
36
+ * };
37
+ * ```
38
+ */
39
+ interface PlayOptions {
40
+ /** Unique identifier for the sound */
41
+ readonly id: string;
42
+ /** Whether the sound should loop (default: false) */
43
+ readonly loop?: boolean;
44
+ /** Volume level from 0 to 1 (default: 1) */
45
+ readonly volume?: number;
46
+ /** Audio channel to play on (default: AudioChannel.SFX) */
47
+ readonly channel?: AudioChannelValue;
48
+ }
49
+ /**
50
+ * User-provided audio adapter that handles actual audio playback.
51
+ * blECSd never plays audio directly; this interface is what users implement.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import type { AudioAdapter } from 'blecsd';
56
+ *
57
+ * const myAudio: AudioAdapter = {
58
+ * play: (opts) => { console.log(`Playing ${opts.id}`); },
59
+ * stop: (id) => { console.log(`Stopping ${id}`); },
60
+ * stopAll: () => { console.log('Stopping all'); },
61
+ * setVolume: (channel, volume) => { ... },
62
+ * setMuted: (channel, muted) => { ... },
63
+ * };
64
+ * ```
65
+ */
66
+ interface AudioAdapter {
67
+ /** Play a sound with the given options */
68
+ play(options: PlayOptions): void;
69
+ /** Stop a specific sound by its ID */
70
+ stop(id: string): void;
71
+ /** Stop all currently playing sounds */
72
+ stopAll(): void;
73
+ /** Set the volume for a channel (0 to 1) */
74
+ setVolume(channel: AudioChannelValue, volume: number): void;
75
+ /** Mute or unmute a channel */
76
+ setMuted(channel: AudioChannelValue, muted: boolean): void;
77
+ }
78
+ /**
79
+ * A sound trigger that maps an event to a sound.
80
+ */
81
+ interface SoundTrigger<T extends EventMap, K extends keyof T> {
82
+ /** The event name to listen for */
83
+ readonly event: K;
84
+ /** The sound ID to play when the event fires */
85
+ readonly soundId: string;
86
+ /** Optional play options override */
87
+ readonly options?: Omit<PlayOptions, 'id'>;
88
+ /** Optional predicate to conditionally trigger the sound */
89
+ readonly when?: (payload: T[K]) => boolean;
90
+ }
91
+ /**
92
+ * Audio manager state.
93
+ */
94
+ interface AudioState {
95
+ readonly musicVolume: number;
96
+ readonly sfxVolume: number;
97
+ readonly musicMuted: boolean;
98
+ readonly sfxMuted: boolean;
99
+ readonly adapter: AudioAdapter | undefined;
100
+ }
101
+ /**
102
+ * Audio manager returned by createAudioManager.
103
+ */
104
+ interface AudioManager {
105
+ /** Get current audio state */
106
+ getState(): AudioState;
107
+ /** Set the audio adapter implementation */
108
+ setAdapter(adapter: AudioAdapter): void;
109
+ /** Remove the current adapter */
110
+ clearAdapter(): void;
111
+ /** Play a sound */
112
+ play(options: PlayOptions): void;
113
+ /** Play a sound by ID with default options */
114
+ playSound(id: string, channel?: AudioChannelValue): void;
115
+ /** Play background music (loops by default) */
116
+ playMusic(id: string, volume?: number): void;
117
+ /** Stop a specific sound */
118
+ stop(id: string): void;
119
+ /** Stop all sounds */
120
+ stopAll(): void;
121
+ /** Set volume for a channel (0 to 1) */
122
+ setVolume(channel: AudioChannelValue, volume: number): void;
123
+ /** Get volume for a channel */
124
+ getVolume(channel: AudioChannelValue): number;
125
+ /** Mute a channel */
126
+ mute(channel: AudioChannelValue): void;
127
+ /** Unmute a channel */
128
+ unmute(channel: AudioChannelValue): void;
129
+ /** Toggle mute for a channel */
130
+ toggleMute(channel: AudioChannelValue): void;
131
+ /** Check if a channel is muted */
132
+ isMuted(channel: AudioChannelValue): boolean;
133
+ /** Register a sound trigger for an event bus */
134
+ onEvent<T extends EventMap, K extends keyof T>(bus: EventBus<T>, trigger: SoundTrigger<T, K>): Unsubscribe;
135
+ /** Register multiple sound triggers at once */
136
+ onEvents<T extends EventMap>(bus: EventBus<T>, triggers: ReadonlyArray<SoundTrigger<T, keyof T>>): Unsubscribe;
137
+ /** Destroy the audio manager and clean up */
138
+ destroy(): void;
139
+ }
140
+ /**
141
+ * Creates an audio manager for integrating sound into a game.
142
+ *
143
+ * The manager does not play audio directly. Instead, users provide an
144
+ * AudioAdapter that handles actual playback. The manager handles
145
+ * channel volumes, muting, and event-based sound triggers.
146
+ *
147
+ * @param adapter - Optional initial audio adapter
148
+ * @returns An AudioManager instance
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * import { createAudioManager, AudioChannel } from 'blecsd';
153
+ *
154
+ * const audio = createAudioManager();
155
+ *
156
+ * // Set an adapter (user-provided audio implementation)
157
+ * audio.setAdapter(myAudioAdapter);
158
+ *
159
+ * // Play sounds
160
+ * audio.playSound('click', AudioChannel.SFX);
161
+ * audio.playMusic('background_theme');
162
+ *
163
+ * // Volume control
164
+ * audio.setVolume(AudioChannel.Music, 0.5);
165
+ * audio.mute(AudioChannel.SFX);
166
+ *
167
+ * // Event-based triggers
168
+ * const unsub = audio.onEvent(eventBus, {
169
+ * event: 'player:hit',
170
+ * soundId: 'damage',
171
+ * options: { volume: 0.8 },
172
+ * });
173
+ * ```
174
+ */
175
+ declare function createAudioManager(adapter?: AudioAdapter): AudioManager;
176
+
177
+ export { type AudioAdapter, AudioChannel, type AudioChannelValue, type AudioManager, type AudioState, type PlayOptions, type SoundTrigger, createAudioManager };
@@ -0,0 +1 @@
1
+ export{a as AudioChannel,b as createAudioManager}from'../chunk-NZ55KBM6.js';import'../chunk-5PELJRUQ.js';