@utsp/core 0.17.0-nightly.20260127101256.e83fcc8 → 0.17.0-nightly.20260127111647.165f2b8
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/dist/benchmark.cjs +6 -6
- package/dist/benchmark.d.ts +136 -46
- package/dist/benchmark.mjs +6 -6
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +136 -46
- package/dist/index.mjs +6 -6
- package/package.json +2 -2
package/dist/benchmark.d.ts
CHANGED
|
@@ -3214,6 +3214,75 @@ interface MulticolorSprite {
|
|
|
3214
3214
|
data: CellBuffer;
|
|
3215
3215
|
}
|
|
3216
3216
|
|
|
3217
|
+
/**
|
|
3218
|
+
* Public-facing types for Sprite Loading API
|
|
3219
|
+
* These types hide internal implementation details like LoadType
|
|
3220
|
+
* and support flexible input formats (strings, numbers, etc.)
|
|
3221
|
+
*/
|
|
3222
|
+
/**
|
|
3223
|
+
* Single Multicolor Cell definition
|
|
3224
|
+
*/
|
|
3225
|
+
interface MulticolorSpriteCell {
|
|
3226
|
+
/**
|
|
3227
|
+
* Character as a string (first char used) or numeric char code (0-65535).
|
|
3228
|
+
* Automatically converted to CP437 if a string is provided.
|
|
3229
|
+
*/
|
|
3230
|
+
charCode: string | number;
|
|
3231
|
+
/**
|
|
3232
|
+
* Foreground color ID (0-255)
|
|
3233
|
+
*/
|
|
3234
|
+
fgColorId: number;
|
|
3235
|
+
/**
|
|
3236
|
+
* Background color ID (0-255)
|
|
3237
|
+
*/
|
|
3238
|
+
bgColorId: number;
|
|
3239
|
+
}
|
|
3240
|
+
/**
|
|
3241
|
+
* Definition for a Unicolor Sprite
|
|
3242
|
+
*/
|
|
3243
|
+
interface UnicolorSpriteDefinition {
|
|
3244
|
+
/**
|
|
3245
|
+
* Unique sprite identifier (0-255)
|
|
3246
|
+
*/
|
|
3247
|
+
spriteId: number;
|
|
3248
|
+
/**
|
|
3249
|
+
* Width in cells (1-255)
|
|
3250
|
+
*/
|
|
3251
|
+
sizeX: number;
|
|
3252
|
+
/**
|
|
3253
|
+
* Height in cells (1-255)
|
|
3254
|
+
*/
|
|
3255
|
+
sizeY: number;
|
|
3256
|
+
/**
|
|
3257
|
+
* Sprite data. Can be:
|
|
3258
|
+
* - Flat array of numbers (char codes)
|
|
3259
|
+
* - Single string (will be treated as a sequence of characters)
|
|
3260
|
+
* - Array of strings (one per row)
|
|
3261
|
+
*/
|
|
3262
|
+
data: number[] | string | string[];
|
|
3263
|
+
}
|
|
3264
|
+
/**
|
|
3265
|
+
* Definition for a Multicolor Sprite
|
|
3266
|
+
*/
|
|
3267
|
+
interface MulticolorSpriteDefinition {
|
|
3268
|
+
/**
|
|
3269
|
+
* Unique sprite identifier (0-255)
|
|
3270
|
+
*/
|
|
3271
|
+
spriteId: number;
|
|
3272
|
+
/**
|
|
3273
|
+
* Width in cells (1-255)
|
|
3274
|
+
*/
|
|
3275
|
+
sizeX: number;
|
|
3276
|
+
/**
|
|
3277
|
+
* Height in cells (1-255)
|
|
3278
|
+
*/
|
|
3279
|
+
sizeY: number;
|
|
3280
|
+
/**
|
|
3281
|
+
* Array of multicolor cells (row-major order, length = sizeX * sizeY)
|
|
3282
|
+
*/
|
|
3283
|
+
data: MulticolorSpriteCell[];
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3217
3286
|
/**
|
|
3218
3287
|
* Central registry to manage unicolor and multicolor sprites
|
|
3219
3288
|
*
|
|
@@ -3229,15 +3298,25 @@ declare class SpriteRegistry {
|
|
|
3229
3298
|
private unicolorSprites;
|
|
3230
3299
|
private multicolorSprites;
|
|
3231
3300
|
/**
|
|
3232
|
-
* Loads unicolor sprites from
|
|
3233
|
-
*
|
|
3301
|
+
* Loads unicolor sprites from public definitions
|
|
3302
|
+
* Supports strings, string arrays, and numbers
|
|
3234
3303
|
*/
|
|
3235
|
-
loadUnicolorSprites(
|
|
3304
|
+
loadUnicolorSprites(definitions: UnicolorSpriteDefinition[] | SpriteLoad): void;
|
|
3236
3305
|
/**
|
|
3237
|
-
*
|
|
3238
|
-
*
|
|
3306
|
+
* Internal method to load unicolor sprites from protocol packet
|
|
3307
|
+
* @internal
|
|
3308
|
+
*/
|
|
3309
|
+
loadUnicolorSpritesFromPacket(loadData: SpriteLoad): void;
|
|
3310
|
+
/**
|
|
3311
|
+
* Loads multicolor sprites from public definitions
|
|
3312
|
+
* Supports string or number charCodes
|
|
3313
|
+
*/
|
|
3314
|
+
loadMulticolorSprites(definitions: MulticolorSpriteDefinition[] | MulticolorSpriteLoad): void;
|
|
3315
|
+
/**
|
|
3316
|
+
* Internal method to load multicolor sprites from protocol packet
|
|
3317
|
+
* @internal
|
|
3239
3318
|
*/
|
|
3240
|
-
|
|
3319
|
+
loadMulticolorSpritesFromPacket(loadData: MulticolorSpriteLoad): void;
|
|
3241
3320
|
/**
|
|
3242
3321
|
* Retrieves a unicolor sprite by its ID
|
|
3243
3322
|
*/
|
|
@@ -8426,63 +8505,74 @@ declare class Core {
|
|
|
8426
8505
|
*/
|
|
8427
8506
|
resetStats(): void;
|
|
8428
8507
|
/**
|
|
8429
|
-
* Loads unicolor sprites
|
|
8508
|
+
* Loads unicolor sprites into the registry.
|
|
8430
8509
|
*
|
|
8431
|
-
* Unicolor sprites
|
|
8432
|
-
*
|
|
8510
|
+
* Unicolor sprites store only character codes. Colors (fg/bg) are
|
|
8511
|
+
* defined at render time via SpriteOrder.
|
|
8433
8512
|
*
|
|
8434
|
-
*
|
|
8513
|
+
* ✨ Supports strings for data (including row-by-row arrays) and auto-converts
|
|
8514
|
+
* characters to CP437 automatically.
|
|
8515
|
+
*
|
|
8516
|
+
* @param definitions - Array of sprite definitions
|
|
8435
8517
|
*
|
|
8436
8518
|
* @example
|
|
8437
8519
|
* ```typescript
|
|
8438
|
-
* // Load a 4x4 unicolor sprite
|
|
8439
|
-
* engine.loadUnicolorSprites(
|
|
8440
|
-
*
|
|
8441
|
-
*
|
|
8442
|
-
*
|
|
8443
|
-
*
|
|
8444
|
-
*
|
|
8445
|
-
*
|
|
8446
|
-
*
|
|
8447
|
-
*
|
|
8448
|
-
*
|
|
8449
|
-
*
|
|
8450
|
-
*
|
|
8451
|
-
*
|
|
8452
|
-
*
|
|
8453
|
-
*
|
|
8520
|
+
* // Load a 4x4 unicolor sprite using a flat string
|
|
8521
|
+
* engine.loadUnicolorSprites([
|
|
8522
|
+
* {
|
|
8523
|
+
* spriteId: 1,
|
|
8524
|
+
* sizeX: 4,
|
|
8525
|
+
* sizeY: 4,
|
|
8526
|
+
* data: "##### ## #####"
|
|
8527
|
+
* }
|
|
8528
|
+
* ]);
|
|
8529
|
+
*
|
|
8530
|
+
* // Load using a string array (row by row) - cleaner!
|
|
8531
|
+
* engine.loadUnicolorSprites([
|
|
8532
|
+
* {
|
|
8533
|
+
* spriteId: 2,
|
|
8534
|
+
* sizeX: 4,
|
|
8535
|
+
* sizeY: 4,
|
|
8536
|
+
* data: [
|
|
8537
|
+
* "####",
|
|
8538
|
+
* "# #",
|
|
8539
|
+
* "# #",
|
|
8540
|
+
* "####"
|
|
8541
|
+
* ]
|
|
8542
|
+
* }
|
|
8543
|
+
* ]);
|
|
8454
8544
|
* ```
|
|
8455
8545
|
*/
|
|
8456
|
-
loadUnicolorSprites(
|
|
8546
|
+
loadUnicolorSprites(definitions: UnicolorSpriteDefinition[]): void;
|
|
8457
8547
|
/**
|
|
8458
|
-
* Loads multicolor sprites
|
|
8548
|
+
* Loads multicolor sprites into the registry.
|
|
8459
8549
|
*
|
|
8460
|
-
* Multicolor sprites store charCode + fgColorId + bgColorId
|
|
8550
|
+
* Multicolor sprites store charCode + fgColorId + bgColorId per cell.
|
|
8461
8551
|
* Optimized for sprites with lots of visual detail.
|
|
8462
8552
|
*
|
|
8463
|
-
*
|
|
8553
|
+
* ✨ Supports string characters for charCode and auto-converts to CP437.
|
|
8554
|
+
*
|
|
8555
|
+
* @param definitions - Array of sprite definitions
|
|
8464
8556
|
*
|
|
8465
8557
|
* @example
|
|
8466
8558
|
* ```typescript
|
|
8467
8559
|
* // Load a 2x2 multicolor sprite
|
|
8468
|
-
* engine.loadMulticolorSprites(
|
|
8469
|
-
*
|
|
8470
|
-
*
|
|
8471
|
-
*
|
|
8472
|
-
*
|
|
8473
|
-
*
|
|
8474
|
-
*
|
|
8475
|
-
*
|
|
8476
|
-
*
|
|
8477
|
-
*
|
|
8478
|
-
*
|
|
8479
|
-
*
|
|
8480
|
-
*
|
|
8481
|
-
* ]
|
|
8482
|
-
* });
|
|
8560
|
+
* engine.loadMulticolorSprites([
|
|
8561
|
+
* {
|
|
8562
|
+
* spriteId: 10,
|
|
8563
|
+
* sizeX: 2,
|
|
8564
|
+
* sizeY: 2,
|
|
8565
|
+
* data: [
|
|
8566
|
+
* { charCode: 'A', fgColorId: 12, bgColorId: 0 },
|
|
8567
|
+
* { charCode: 'B', fgColorId: 14, bgColorId: 0 },
|
|
8568
|
+
* { charCode: 'C', fgColorId: 14, bgColorId: 0 },
|
|
8569
|
+
* { charCode: 'D', fgColorId: 12, bgColorId: 0 }
|
|
8570
|
+
* ]
|
|
8571
|
+
* }
|
|
8572
|
+
* ]);
|
|
8483
8573
|
* ```
|
|
8484
8574
|
*/
|
|
8485
|
-
loadMulticolorSprites(
|
|
8575
|
+
loadMulticolorSprites(definitions: MulticolorSpriteDefinition[]): void;
|
|
8486
8576
|
/**
|
|
8487
8577
|
* Load Font structure (allocate font)
|
|
8488
8578
|
* Defines the font dimensions and allocates the atlas in memory (empty)
|