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.
- package/LICENSE +20 -0
- package/README.md +220 -0
- package/dist/3d/index.d.ts +5 -0
- package/dist/3d/index.js +1 -0
- package/dist/audio/index.d.ts +177 -0
- package/dist/audio/index.js +1 -0
- package/dist/border-D_Jb4ZJV.d.ts +257 -0
- package/dist/cell-DwIu2ryP.d.ts +505 -0
- package/dist/chunk-2UBBZFE4.js +1 -0
- package/dist/chunk-35LCBY6P.js +1 -0
- package/dist/chunk-3B7MIVW6.js +1 -0
- package/dist/chunk-3EGGGI5J.js +3 -0
- package/dist/chunk-4LWWONFK.js +1 -0
- package/dist/chunk-4X4N4HNQ.js +2 -0
- package/dist/chunk-5PELJRUQ.js +1 -0
- package/dist/chunk-AEJIX2MW.js +1 -0
- package/dist/chunk-AQ7LW75B.js +1 -0
- package/dist/chunk-AXZQAH4X.js +1 -0
- package/dist/chunk-B6Z2JFRY.js +1 -0
- package/dist/chunk-BCADUCOZ.js +1 -0
- package/dist/chunk-C5PCEQ6G.js +1 -0
- package/dist/chunk-CIK4AMUA.js +1 -0
- package/dist/chunk-DNRXW56C.js +1 -0
- package/dist/chunk-FC5FFAAC.js +12 -0
- package/dist/chunk-FGHEFXLK.js +1 -0
- package/dist/chunk-FYEBZAWN.js +1 -0
- package/dist/chunk-G7GIWWLE.js +1 -0
- package/dist/chunk-GYHI26UE.js +1 -0
- package/dist/chunk-H2YAOJDW.js +1 -0
- package/dist/chunk-J4JZ2NU2.js +1 -0
- package/dist/chunk-JKVHO4LH.js +1 -0
- package/dist/chunk-K2B2OXQ5.js +5 -0
- package/dist/chunk-K37L3G4Z.js +4 -0
- package/dist/chunk-KD55INV7.js +1 -0
- package/dist/chunk-KFAK4A3G.js +1 -0
- package/dist/chunk-LCN2ZITE.js +1 -0
- package/dist/chunk-LYSK5S63.js +1 -0
- package/dist/chunk-NZ55KBM6.js +1 -0
- package/dist/chunk-OMMJ7B5P.js +1 -0
- package/dist/chunk-OUXUPF3V.js +33 -0
- package/dist/chunk-OVT2PPGW.js +19 -0
- package/dist/chunk-P6CJO3BC.js +1 -0
- package/dist/chunk-PSXXMBVJ.js +1 -0
- package/dist/chunk-PXXGH3BV.js +1 -0
- package/dist/chunk-QIKIOVP2.js +1 -0
- package/dist/chunk-SHUC6JWA.js +1 -0
- package/dist/chunk-TDXJDLY6.js +6 -0
- package/dist/chunk-TWSWTBYL.js +1 -0
- package/dist/chunk-TYMY2TBR.js +3 -0
- package/dist/chunk-VNZ6CWJA.js +2 -0
- package/dist/chunk-VOCM5T2G.js +5 -0
- package/dist/chunk-W5OU7Z6J.js +1 -0
- package/dist/chunk-WNG4A3K7.js +4 -0
- package/dist/chunk-XQIGERNI.js +1 -0
- package/dist/chunk-XZA63ZPO.js +1 -0
- package/dist/chunk-YAMOSPWB.js +4 -0
- package/dist/chunk-YD6ULIUR.js +1 -0
- package/dist/chunk-Z4EZERNE.js +1 -0
- package/dist/cli/init.d.ts +86 -0
- package/dist/cli/init.js +179 -0
- package/dist/color-B78w3zH-.d.ts +79 -0
- package/dist/components/index.d.ts +10298 -0
- package/dist/components/index.js +1 -0
- package/dist/core/index.d.ts +6700 -0
- package/dist/core/index.js +1 -0
- package/dist/debug/index.d.ts +711 -0
- package/dist/debug/index.js +1 -0
- package/dist/doubleBuffer-CKQFmlPN.d.ts +95 -0
- package/dist/errors/index.d.ts +1110 -0
- package/dist/errors/index.js +1 -0
- package/dist/events-BbbxkgvX.d.ts +125 -0
- package/dist/game/index.d.ts +486 -0
- package/dist/game/index.js +1 -0
- package/dist/gameLoop-BIPW7-OY.d.ts +219 -0
- package/dist/index-zSGJ2eUk.d.ts +3156 -0
- package/dist/index.d.ts +246 -0
- package/dist/index.js +1 -0
- package/dist/input/index.d.ts +158 -0
- package/dist/input/index.js +1 -0
- package/dist/inputActions-CefRUBuT.d.ts +2637 -0
- package/dist/keyParser-Bwm8-l7v.d.ts +229 -0
- package/dist/mouseParser-Cfrbn3AX.d.ts +177 -0
- package/dist/parser-iMHmQuUh.d.ts +265 -0
- package/dist/program-BZaKqDKH.d.ts +141 -0
- package/dist/renderable-jTMOA-GK.d.ts +302 -0
- package/dist/scheduler-DcfoFuum.d.ts +86 -0
- package/dist/schemas/index.d.ts +936 -0
- package/dist/schemas/index.js +1 -0
- package/dist/systems/index.d.ts +4036 -0
- package/dist/systems/index.js +1 -0
- package/dist/terminal/index.d.ts +7357 -0
- package/dist/terminal/index.js +1 -0
- package/dist/terminus-14-bold-HWSPRLJD.js +1 -0
- package/dist/terminus-14-normal-T3SWMH4D.js +1 -0
- package/dist/tilemap-D1HJvKy3.d.ts +1211 -0
- package/dist/types-BcsvoKzf.d.ts +68 -0
- package/dist/utils/index.d.ts +6104 -0
- package/dist/utils/index.js +1 -0
- package/dist/viewport3d-xI33-_wq.d.ts +182 -0
- package/dist/virtualScrollback-DvZTRU8a.d.ts +274 -0
- package/dist/virtualViewport-Dx2iJliO.d.ts +2334 -0
- package/dist/virtualizedLineStore-DwPEvPkk.d.ts +297 -0
- package/dist/widgets/bigText.d.ts +230 -0
- package/dist/widgets/bigText.js +1 -0
- package/dist/widgets/fonts/index.d.ts +211 -0
- package/dist/widgets/fonts/index.js +1 -0
- package/dist/widgets/index.d.ts +8591 -0
- package/dist/widgets/index.js +1 -0
- package/package.json +213 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Schema for a single character's bitmap data.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { CharBitmapSchema } from 'blecsd/widgets/fonts';
|
|
9
|
+
*
|
|
10
|
+
* const result = CharBitmapSchema.safeParse({
|
|
11
|
+
* width: 8,
|
|
12
|
+
* height: 14,
|
|
13
|
+
* bitmap: [
|
|
14
|
+
* [0, 1, 1, 0],
|
|
15
|
+
* ],
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const CharBitmapSchema: z.ZodObject<{
|
|
20
|
+
width: z.ZodNumber;
|
|
21
|
+
height: z.ZodNumber;
|
|
22
|
+
bitmap: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
/**
|
|
25
|
+
* A single character's bitmap data.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import type { CharBitmap } from 'blecsd/widgets/fonts';
|
|
30
|
+
*
|
|
31
|
+
* const glyph: CharBitmap = {
|
|
32
|
+
* width: 8,
|
|
33
|
+
* height: 14,
|
|
34
|
+
* bitmap: [],
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
type CharBitmap = z.infer<typeof CharBitmapSchema>;
|
|
39
|
+
/**
|
|
40
|
+
* Schema for a complete bitmap font.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* import { BitmapFontSchema } from 'blecsd/widgets/fonts';
|
|
45
|
+
*
|
|
46
|
+
* const font = BitmapFontSchema.parse({
|
|
47
|
+
* name: 'Terminus',
|
|
48
|
+
* size: 14,
|
|
49
|
+
* weight: 'bold',
|
|
50
|
+
* charWidth: 8,
|
|
51
|
+
* charHeight: 14,
|
|
52
|
+
* chars: {},
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare const BitmapFontSchema: z.ZodObject<{
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
size: z.ZodNumber;
|
|
59
|
+
weight: z.ZodEnum<{
|
|
60
|
+
bold: "bold";
|
|
61
|
+
normal: "normal";
|
|
62
|
+
}>;
|
|
63
|
+
charWidth: z.ZodNumber;
|
|
64
|
+
charHeight: z.ZodNumber;
|
|
65
|
+
chars: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
66
|
+
width: z.ZodNumber;
|
|
67
|
+
height: z.ZodNumber;
|
|
68
|
+
bitmap: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
/**
|
|
72
|
+
* A complete bitmap font.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* import type { BitmapFont } from 'blecsd/widgets/fonts';
|
|
77
|
+
*
|
|
78
|
+
* const font: BitmapFont = {
|
|
79
|
+
* name: 'Terminus',
|
|
80
|
+
* size: 14,
|
|
81
|
+
* weight: 'normal',
|
|
82
|
+
* charWidth: 8,
|
|
83
|
+
* charHeight: 14,
|
|
84
|
+
* chars: {},
|
|
85
|
+
* };
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
type BitmapFont = z.infer<typeof BitmapFontSchema>;
|
|
89
|
+
/**
|
|
90
|
+
* Built-in bitmap font names.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* import type { FontName } from 'blecsd/widgets/fonts';
|
|
95
|
+
*
|
|
96
|
+
* const name: FontName = 'terminus-14-bold';
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
type FontName = 'terminus-14-bold' | 'terminus-14-normal';
|
|
100
|
+
/**
|
|
101
|
+
* Error thrown when a font name is not recognized.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* import type { FontNotFoundError } from 'blecsd/widgets/fonts';
|
|
106
|
+
*
|
|
107
|
+
* const error = new Error('missing') as FontNotFoundError;
|
|
108
|
+
* error.name = 'FontNotFoundError';
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
type FontNotFoundError = Error & {
|
|
112
|
+
name: 'FontNotFoundError';
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Rendering options for bitmap characters.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* import type { RenderCharOptions } from 'blecsd/widgets/fonts';
|
|
120
|
+
*
|
|
121
|
+
* const options: RenderCharOptions = { fillChar: '#', emptyChar: '.' };
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
type RenderCharOptions = {
|
|
125
|
+
/** Character used to draw filled pixels */
|
|
126
|
+
fillChar?: string;
|
|
127
|
+
/** Character used to draw empty pixels */
|
|
128
|
+
emptyChar?: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Creates a font-not-found error for the given name.
|
|
132
|
+
*
|
|
133
|
+
* @param name - Font identifier that was requested
|
|
134
|
+
* @returns Error instance with a FontNotFoundError name
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* import { createFontNotFoundError } from 'blecsd/widgets/fonts';
|
|
139
|
+
*
|
|
140
|
+
* throw createFontNotFoundError('terminus-14-mono');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
declare const createFontNotFoundError: (name: string) => FontNotFoundError;
|
|
144
|
+
/**
|
|
145
|
+
* Loads a built-in bitmap font by name.
|
|
146
|
+
*
|
|
147
|
+
* Font data is loaded lazily via dynamic import to avoid bundling ~3.2 MB
|
|
148
|
+
* of font JSON into the main entry point.
|
|
149
|
+
*
|
|
150
|
+
* @param name - Font identifier ('terminus-14-bold' | 'terminus-14-normal')
|
|
151
|
+
* @returns Promise resolving to the loaded bitmap font
|
|
152
|
+
* @throws {FontNotFoundError} If font name is not recognized
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* import { loadFont } from 'blecsd/widgets/fonts';
|
|
157
|
+
*
|
|
158
|
+
* const font = await loadFont('terminus-14-bold');
|
|
159
|
+
* console.log(font.charWidth, font.charHeight); // 8, 14
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
declare const loadFont: (name: FontName) => Promise<BitmapFont>;
|
|
163
|
+
/**
|
|
164
|
+
* Returns a cached font if previously loaded, or undefined.
|
|
165
|
+
* Use this for synchronous access after an initial `loadFont` call.
|
|
166
|
+
*
|
|
167
|
+
* @param name - Font identifier
|
|
168
|
+
* @returns The cached font, or undefined if not yet loaded
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* import { loadFont, getCachedFont } from 'blecsd/widgets/fonts';
|
|
173
|
+
*
|
|
174
|
+
* await loadFont('terminus-14-bold');
|
|
175
|
+
* const font = getCachedFont('terminus-14-bold'); // synchronous
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare const getCachedFont: (name: FontName) => BitmapFont | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Gets the bitmap data for a specific character.
|
|
181
|
+
*
|
|
182
|
+
* @param font - The bitmap font to use
|
|
183
|
+
* @param char - Single character to look up
|
|
184
|
+
* @returns Bitmap data for the character, or undefined if not found
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const bitmap = getCharBitmap(font, 'A');
|
|
189
|
+
* if (bitmap) {
|
|
190
|
+
* console.log(bitmap.width, bitmap.height);
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
declare const getCharBitmap: (font: BitmapFont, char: string) => CharBitmap | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Renders a character to an array of strings using block characters.
|
|
197
|
+
*
|
|
198
|
+
* @param font - The bitmap font to use
|
|
199
|
+
* @param char - Character to render
|
|
200
|
+
* @param options - Rendering options
|
|
201
|
+
* @returns Array of strings representing the rendered character
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* const lines = renderChar(font, 'A', { fillChar: '█', emptyChar: ' ' });
|
|
206
|
+
* lines.forEach(line => console.log(line));
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
declare const renderChar: (font: BitmapFont, char: string, options?: RenderCharOptions) => readonly string[];
|
|
210
|
+
|
|
211
|
+
export { type BitmapFont, BitmapFontSchema, type CharBitmap, CharBitmapSchema, type FontName, type FontNotFoundError, type RenderCharOptions, createFontNotFoundError, getCachedFont, getCharBitmap, loadFont, renderChar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as BitmapFontSchema,a as CharBitmapSchema,c as createFontNotFoundError,e as getCachedFont,f as getCharBitmap,d as loadFont,g as renderChar}from'../../chunk-DNRXW56C.js';import'../../chunk-5PELJRUQ.js';
|