@almadar/ui 5.112.0 → 5.114.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/dist/avl/index.cjs +278 -1073
- package/dist/avl/index.js +273 -1068
- package/dist/{avl-schema-parser-DKRm-nyh.d.cts → avl-schema-parser-B8Onmfsu.d.cts} +2 -220
- package/dist/{avl-schema-parser-DKRm-nyh.d.ts → avl-schema-parser-B8Onmfsu.d.ts} +2 -220
- package/dist/{cn-BbPvQLHt.d.ts → cn-D3H9UzCW.d.cts} +2 -1
- package/dist/{cn-BbPvQLHt.d.cts → cn-Dm0VrLRG.d.ts} +2 -1
- package/dist/components/index.cjs +124 -685
- package/dist/components/index.d.cts +9 -4
- package/dist/components/index.d.ts +9 -4
- package/dist/components/index.js +123 -684
- package/dist/lib/drawable/three/index.cjs +52 -37
- package/dist/lib/drawable/three/index.d.cts +5 -3
- package/dist/lib/drawable/three/index.d.ts +5 -3
- package/dist/lib/drawable/three/index.js +52 -37
- package/dist/lib/index.d.cts +2 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/marketing/index.cjs +16 -637
- package/dist/marketing/index.js +16 -637
- package/dist/paintDispatch-BXJgISot.d.cts +223 -0
- package/dist/paintDispatch-BXJgISot.d.ts +223 -0
- package/dist/providers/index.cjs +124 -685
- package/dist/providers/index.js +123 -684
- package/dist/runtime/index.cjs +305 -1107
- package/dist/runtime/index.d.cts +11 -112
- package/dist/runtime/index.d.ts +11 -112
- package/dist/runtime/index.js +268 -1096
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnimationName, Asset,
|
|
1
|
+
import { AnimationName, Asset, JsonObject, JsonValue } from '@almadar/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Sprite Sheet Animation Types
|
|
@@ -278,224 +278,6 @@ interface CameraState {
|
|
|
278
278
|
zoom: number;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
/** Source sub-rectangle within a texture (an atlas frame). Omitted → whole texture. */
|
|
282
|
-
interface BlitSrc {
|
|
283
|
-
x: number;
|
|
284
|
-
y: number;
|
|
285
|
-
w: number;
|
|
286
|
-
h: number;
|
|
287
|
-
}
|
|
288
|
-
/** A polyline/polygon vertex in pixel space. */
|
|
289
|
-
interface PainterPoint {
|
|
290
|
-
x: number;
|
|
291
|
-
y: number;
|
|
292
|
-
}
|
|
293
|
-
/** A drop shadow applied to subsequent draws until cleared. */
|
|
294
|
-
interface PainterShadow {
|
|
295
|
-
color: string;
|
|
296
|
-
blur: number;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Drawable contract — the shared vocabulary every neutral drawable primitive
|
|
301
|
-
* (the `draw-sprite`/`draw-shape`/`draw-text` atoms, `draw-sprite-layer`/
|
|
302
|
-
* `draw-shape-layer` molecules) is authored against. A drawable is a pure
|
|
303
|
-
* descriptor the canvas HOST walks and paints via the portable {@link Painter2D}
|
|
304
|
-
* seam — no `CanvasRenderingContext2D`, no DOM. Genre (a "unit"/"tile"/
|
|
305
|
-
* "highlight") is a `.lolo` COMPOSITION of these, never its own primitive.
|
|
306
|
-
*
|
|
307
|
-
* A position is a core `ScenePos` (logical scene space). The host's {@link Projector}
|
|
308
|
-
* maps it to pixels; primitives never do projection math themselves. Because the
|
|
309
|
-
* `ScenePos` type identity is what pattern-sync stamps as the `drawable`
|
|
310
|
-
* capability, every drawable descriptor's `position` MUST be a core `ScenePos`.
|
|
311
|
-
*/
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* How a drawable aligns to its projected position.
|
|
315
|
-
* - `top-left` — the cell's top-left corner (tiles).
|
|
316
|
-
* - `ground` — the cell's ground point, bottom-center of the drawable (units/features).
|
|
317
|
-
* - `center` — the cell's visual center (effects).
|
|
318
|
-
*/
|
|
319
|
-
type DrawableAnchor = 'top-left' | 'ground' | 'center';
|
|
320
|
-
/** Common shape of every drawable descriptor. `type` keys the host's paint dispatch. */
|
|
321
|
-
interface DrawableBase {
|
|
322
|
-
type: string;
|
|
323
|
-
/**
|
|
324
|
-
* Optional hit-test handle. When a board authors a per-entity id here (e.g.
|
|
325
|
-
* `id: (object/get @u id)` on a unit sprite), the canvas host indexes the
|
|
326
|
-
* descriptor's `ScenePos → id` and resolves a pointer/raycast at that cell to
|
|
327
|
-
* this id — the source of `unitClickEvent {unitId}`. A source-tagged handle,
|
|
328
|
-
* NOT a heuristic: no id → the host emits only the coordinate (tile click).
|
|
329
|
-
*/
|
|
330
|
-
id?: string;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* `draw-sprite` — the neutral image/atlas-frame drawable atom (dimension-agnostic).
|
|
335
|
-
*
|
|
336
|
-
* ONE descriptor (`DrawSpriteProps`, grounded in core `ScenePos` + `Asset`) with
|
|
337
|
-
* TWO backends: `paintSprite` (2D, here — via the portable `Painter2D` seam) and
|
|
338
|
-
* an R3F mesh (`Sprite3D` in `lib/drawable/mesh3d`, kept OUT of this file so the
|
|
339
|
-
* 2D paint path never pulls `three`/`drei` into an app bundle — the codebase
|
|
340
|
-
* code-splits R3F). The canvas host picks the backend by `mode`; that is what
|
|
341
|
-
* makes canvas-2d and canvas-3d the same `children` interface. Genre uses (tile,
|
|
342
|
-
* unit body, feature, effect, movement ghost, background cover) are all this atom
|
|
343
|
-
* with different `anchor`/`size`/`frame`/`flip`/`shadow` — composed in `.lolo`,
|
|
344
|
-
* not here. The React component renders `null` (a drawable is painted by the host,
|
|
345
|
-
* not the DOM); it exists so the pattern pipeline registers a `draw-sprite`
|
|
346
|
-
* pattern and standalone pages stay inspectable.
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
interface DrawSpriteProps extends DrawableBase {
|
|
350
|
-
type: 'draw-sprite';
|
|
351
|
-
/** Logical scene position; the projector maps it to pixels / world. */
|
|
352
|
-
position: ScenePos;
|
|
353
|
-
/** The image / atlas reference to blit. */
|
|
354
|
-
asset: Asset;
|
|
355
|
-
/** How the sprite aligns to its projected position. Default `'top-left'`. */
|
|
356
|
-
anchor?: DrawableAnchor;
|
|
357
|
-
/** Draw width in world units (fractions of `projector.tileWidth`); omitted → resolved source width in px. */
|
|
358
|
-
width?: number;
|
|
359
|
-
/** Draw height in world units (fractions of `projector.tileWidth`); omitted → resolved source height in px. */
|
|
360
|
-
height?: number;
|
|
361
|
-
/** Explicit atlas sub-rect override (px); omitted → resolved from `asset.atlas`/`asset.sprite`. */
|
|
362
|
-
frame?: BlitSrc;
|
|
363
|
-
/** Mirror horizontally (facing). */
|
|
364
|
-
flipX?: boolean;
|
|
365
|
-
/** Rotation in radians about the sprite's center. */
|
|
366
|
-
rotation?: number;
|
|
367
|
-
/** 0..1 opacity. */
|
|
368
|
-
opacity?: number;
|
|
369
|
-
/** Drop shadow (e.g. a team-colored glow). */
|
|
370
|
-
shadow?: PainterShadow;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* `draw-shape` — the neutral vector-fill/stroke drawable atom (dimension-agnostic).
|
|
375
|
-
*
|
|
376
|
-
* ONE descriptor (`DrawShapeProps`, grounded in core `ScenePos`) with TWO
|
|
377
|
-
* backends: `paintShape` (2D, here) and an R3F ground-plane mesh (`Shape3D` in
|
|
378
|
-
* `lib/drawable/mesh3d`, kept OUT of this file so the 2D path never pulls R3F).
|
|
379
|
-
* Paints a cell footprint, an axis-aligned rect, an ellipse, or a poly at a scene
|
|
380
|
-
* position, fill and/or stroke. Genre uses (tile fallback, iso/hex diamond
|
|
381
|
-
* fallback, cell highlight, feature disc, unit selection ring, unit fallback
|
|
382
|
-
* circle, ground/ghost discs, solid backgrounds, side-view platform rects) are
|
|
383
|
-
* all this atom with different `shape`/`anchor`/geometry — composed in `.lolo`,
|
|
384
|
-
* not here. The React component renders `null`; it exists so the pattern pipeline
|
|
385
|
-
* registers a `draw-shape` pattern and standalone pages stay inspectable.
|
|
386
|
-
*/
|
|
387
|
-
|
|
388
|
-
type ShapeKind = 'cell' | 'rect' | 'ellipse' | 'poly';
|
|
389
|
-
interface DrawShapeProps extends DrawableBase {
|
|
390
|
-
type: 'draw-shape';
|
|
391
|
-
shape: ShapeKind;
|
|
392
|
-
/** Logical scene position; the projector maps it to pixels / world. */
|
|
393
|
-
position: ScenePos;
|
|
394
|
-
/** How the shape aligns to its projected position. Default varies by `shape`. */
|
|
395
|
-
anchor?: DrawableAnchor;
|
|
396
|
-
/** Rect width in world units (fractions of `projector.tileWidth`). */
|
|
397
|
-
width?: number;
|
|
398
|
-
/** Rect height in world units (fractions of `projector.tileWidth`). */
|
|
399
|
-
height?: number;
|
|
400
|
-
/** Ellipse horizontal radius in world units (fractions of `projector.tileWidth`). */
|
|
401
|
-
radiusX?: number;
|
|
402
|
-
/** Ellipse vertical radius in world units; omitted → `radiusX` (a circle). */
|
|
403
|
-
radiusY?: number;
|
|
404
|
-
/** Fine nudge from the anchor point in world units. */
|
|
405
|
-
offsetX?: number;
|
|
406
|
-
offsetY?: number;
|
|
407
|
-
/** Poly vertices as world-unit offsets relative to the cell's projected top-left. */
|
|
408
|
-
points?: PainterPoint[];
|
|
409
|
-
fill?: string;
|
|
410
|
-
stroke?: string;
|
|
411
|
-
strokeWidth?: number;
|
|
412
|
-
/** 0..1 opacity. */
|
|
413
|
-
opacity?: number;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* `draw-text` — the neutral text drawable atom (dimension-agnostic).
|
|
418
|
-
*
|
|
419
|
-
* ONE descriptor (`DrawTextProps`, grounded in core `ScenePos`) with TWO backends:
|
|
420
|
-
* `paintText` (2D, here) and an R3F billboarded `<Text>` (`Text3D` in
|
|
421
|
-
* `lib/drawable/mesh3d`, kept OUT of this file so the 2D path never pulls R3F).
|
|
422
|
-
* Paints a string at a scene position with font/color/alignment. The React
|
|
423
|
-
* component renders `null` (a drawable is painted by the host, not the DOM).
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
interface DrawTextProps extends DrawableBase {
|
|
427
|
-
type: 'draw-text';
|
|
428
|
-
text: string;
|
|
429
|
-
/** Logical scene position; the projector maps it to pixels / world. */
|
|
430
|
-
position: ScenePos;
|
|
431
|
-
anchor?: DrawableAnchor;
|
|
432
|
-
offsetX?: number;
|
|
433
|
-
offsetY?: number;
|
|
434
|
-
color: string;
|
|
435
|
-
font?: string;
|
|
436
|
-
align?: CanvasTextAlign;
|
|
437
|
-
baseline?: CanvasTextBaseline;
|
|
438
|
-
opacity?: number;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* `draw-sprite-layer` — batch multiple sprites in one descriptor for O(layers) rendering.
|
|
443
|
-
*
|
|
444
|
-
* Composes the `draw-sprite` atom; the layer itself carries no `position` — each
|
|
445
|
-
* item does. It is drawable-by-composition: its `items` are `draw-sprite`
|
|
446
|
-
* descriptors (each grounded in core `ScenePos`), which is what stamps the layer
|
|
447
|
-
* `drawable` at pattern-sync time.
|
|
448
|
-
*/
|
|
449
|
-
|
|
450
|
-
interface DrawSpriteLayerProps extends DrawableBase {
|
|
451
|
-
type: 'draw-sprite-layer';
|
|
452
|
-
/** Sprites painted in array order; z-ordering is the caller's responsibility. */
|
|
453
|
-
items: DrawSpriteProps[];
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* `draw-shape-layer` — batch of shapes in one descriptor for O(layers) perf.
|
|
458
|
-
*
|
|
459
|
-
* Composes the `draw-shape` atom; drawable-by-composition (its `items` are
|
|
460
|
-
* `draw-shape` descriptors, each grounded in core `ScenePos`). The React
|
|
461
|
-
* component renders `null` (a drawable is painted by the host, not the DOM).
|
|
462
|
-
*/
|
|
463
|
-
|
|
464
|
-
interface DrawShapeLayerProps extends DrawableBase {
|
|
465
|
-
type: 'draw-shape-layer';
|
|
466
|
-
items: DrawShapeProps[];
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* `draw-text-layer` — batch of text labels in one descriptor for O(layers) perf.
|
|
471
|
-
*
|
|
472
|
-
* Composes the `draw-text` atom; drawable-by-composition (its `items` are
|
|
473
|
-
* `draw-text` descriptors, each grounded in core `ScenePos`). Covers the batched
|
|
474
|
-
* world-space text pass — fx messages, damage numbers, unit labels — that a
|
|
475
|
-
* board maps from an entity array (`items: (array/map @entity.fx (fn ...))`),
|
|
476
|
-
* which a literal `children` array can't express. The React component renders
|
|
477
|
-
* `null` (a drawable is painted by the host, not the DOM).
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
interface DrawTextLayerProps extends DrawableBase {
|
|
481
|
-
type: 'draw-text-layer';
|
|
482
|
-
items: DrawTextProps[];
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Drawable paint dispatch (2D) + the `DrawableNode` union.
|
|
487
|
-
*
|
|
488
|
-
* `paintDrawable` routes ONE descriptor to its 2D painter; the host walks its
|
|
489
|
-
* `children` through it. The "drawable" designation itself is NOT recorded here —
|
|
490
|
-
* it is DERIVED from the core `ScenePos` type each descriptor's `position` uses
|
|
491
|
-
* and stamped into `patterns-registry.json` by pattern-sync (mirroring how `Asset`
|
|
492
|
-
* is tagged), then read by the orbital-rust validator. So this module is pure
|
|
493
|
-
* paint routing; the capability is the registry's, not a hand-list.
|
|
494
|
-
*/
|
|
495
|
-
|
|
496
|
-
/** Every drawable descriptor. The host's `children` are a `DrawableNode[]`. */
|
|
497
|
-
type DrawableNode = DrawSpriteProps | DrawShapeProps | DrawTextProps | DrawSpriteLayerProps | DrawShapeLayerProps | DrawTextLayerProps;
|
|
498
|
-
|
|
499
281
|
/**
|
|
500
282
|
* AVL Schema Parser
|
|
501
283
|
*
|
|
@@ -608,4 +390,4 @@ interface TransitionLevelData {
|
|
|
608
390
|
slotTargets: SlotTarget[];
|
|
609
391
|
}
|
|
610
392
|
|
|
611
|
-
export { type ApplicationLevelData as A, type BoardTile as B, type CameraState as C, type
|
|
393
|
+
export { type ApplicationLevelData as A, type BoardTile as B, type CameraState as C, type ExternalLink as E, type FacingDirection as F, type GameAction as G, type IsometricTile as I, type OrbitalLevelData as O, type Position as P, type ResolvedFrame as R, type SpriteSheetUrls as S, type TraitLevelData as T, type UnitAnimationState as U, type IsometricUnit as a, type IsometricFeature as b, type TransitionLevelData as c, type SpriteFrameDims as d, type FieldInfo as e, type OrbitalTraitInfo as f, type OrbitalPageInfo as g, type GamePhase as h, type GameState as i, type GameUnit as j, type UnitTrait as k, calculateAttackTargets as l, calculateValidMoves as m, createInitialGameState as n };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnimationName, Asset,
|
|
1
|
+
import { AnimationName, Asset, JsonObject, JsonValue } from '@almadar/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Sprite Sheet Animation Types
|
|
@@ -278,224 +278,6 @@ interface CameraState {
|
|
|
278
278
|
zoom: number;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
/** Source sub-rectangle within a texture (an atlas frame). Omitted → whole texture. */
|
|
282
|
-
interface BlitSrc {
|
|
283
|
-
x: number;
|
|
284
|
-
y: number;
|
|
285
|
-
w: number;
|
|
286
|
-
h: number;
|
|
287
|
-
}
|
|
288
|
-
/** A polyline/polygon vertex in pixel space. */
|
|
289
|
-
interface PainterPoint {
|
|
290
|
-
x: number;
|
|
291
|
-
y: number;
|
|
292
|
-
}
|
|
293
|
-
/** A drop shadow applied to subsequent draws until cleared. */
|
|
294
|
-
interface PainterShadow {
|
|
295
|
-
color: string;
|
|
296
|
-
blur: number;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Drawable contract — the shared vocabulary every neutral drawable primitive
|
|
301
|
-
* (the `draw-sprite`/`draw-shape`/`draw-text` atoms, `draw-sprite-layer`/
|
|
302
|
-
* `draw-shape-layer` molecules) is authored against. A drawable is a pure
|
|
303
|
-
* descriptor the canvas HOST walks and paints via the portable {@link Painter2D}
|
|
304
|
-
* seam — no `CanvasRenderingContext2D`, no DOM. Genre (a "unit"/"tile"/
|
|
305
|
-
* "highlight") is a `.lolo` COMPOSITION of these, never its own primitive.
|
|
306
|
-
*
|
|
307
|
-
* A position is a core `ScenePos` (logical scene space). The host's {@link Projector}
|
|
308
|
-
* maps it to pixels; primitives never do projection math themselves. Because the
|
|
309
|
-
* `ScenePos` type identity is what pattern-sync stamps as the `drawable`
|
|
310
|
-
* capability, every drawable descriptor's `position` MUST be a core `ScenePos`.
|
|
311
|
-
*/
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* How a drawable aligns to its projected position.
|
|
315
|
-
* - `top-left` — the cell's top-left corner (tiles).
|
|
316
|
-
* - `ground` — the cell's ground point, bottom-center of the drawable (units/features).
|
|
317
|
-
* - `center` — the cell's visual center (effects).
|
|
318
|
-
*/
|
|
319
|
-
type DrawableAnchor = 'top-left' | 'ground' | 'center';
|
|
320
|
-
/** Common shape of every drawable descriptor. `type` keys the host's paint dispatch. */
|
|
321
|
-
interface DrawableBase {
|
|
322
|
-
type: string;
|
|
323
|
-
/**
|
|
324
|
-
* Optional hit-test handle. When a board authors a per-entity id here (e.g.
|
|
325
|
-
* `id: (object/get @u id)` on a unit sprite), the canvas host indexes the
|
|
326
|
-
* descriptor's `ScenePos → id` and resolves a pointer/raycast at that cell to
|
|
327
|
-
* this id — the source of `unitClickEvent {unitId}`. A source-tagged handle,
|
|
328
|
-
* NOT a heuristic: no id → the host emits only the coordinate (tile click).
|
|
329
|
-
*/
|
|
330
|
-
id?: string;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* `draw-sprite` — the neutral image/atlas-frame drawable atom (dimension-agnostic).
|
|
335
|
-
*
|
|
336
|
-
* ONE descriptor (`DrawSpriteProps`, grounded in core `ScenePos` + `Asset`) with
|
|
337
|
-
* TWO backends: `paintSprite` (2D, here — via the portable `Painter2D` seam) and
|
|
338
|
-
* an R3F mesh (`Sprite3D` in `lib/drawable/mesh3d`, kept OUT of this file so the
|
|
339
|
-
* 2D paint path never pulls `three`/`drei` into an app bundle — the codebase
|
|
340
|
-
* code-splits R3F). The canvas host picks the backend by `mode`; that is what
|
|
341
|
-
* makes canvas-2d and canvas-3d the same `children` interface. Genre uses (tile,
|
|
342
|
-
* unit body, feature, effect, movement ghost, background cover) are all this atom
|
|
343
|
-
* with different `anchor`/`size`/`frame`/`flip`/`shadow` — composed in `.lolo`,
|
|
344
|
-
* not here. The React component renders `null` (a drawable is painted by the host,
|
|
345
|
-
* not the DOM); it exists so the pattern pipeline registers a `draw-sprite`
|
|
346
|
-
* pattern and standalone pages stay inspectable.
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
interface DrawSpriteProps extends DrawableBase {
|
|
350
|
-
type: 'draw-sprite';
|
|
351
|
-
/** Logical scene position; the projector maps it to pixels / world. */
|
|
352
|
-
position: ScenePos;
|
|
353
|
-
/** The image / atlas reference to blit. */
|
|
354
|
-
asset: Asset;
|
|
355
|
-
/** How the sprite aligns to its projected position. Default `'top-left'`. */
|
|
356
|
-
anchor?: DrawableAnchor;
|
|
357
|
-
/** Draw width in world units (fractions of `projector.tileWidth`); omitted → resolved source width in px. */
|
|
358
|
-
width?: number;
|
|
359
|
-
/** Draw height in world units (fractions of `projector.tileWidth`); omitted → resolved source height in px. */
|
|
360
|
-
height?: number;
|
|
361
|
-
/** Explicit atlas sub-rect override (px); omitted → resolved from `asset.atlas`/`asset.sprite`. */
|
|
362
|
-
frame?: BlitSrc;
|
|
363
|
-
/** Mirror horizontally (facing). */
|
|
364
|
-
flipX?: boolean;
|
|
365
|
-
/** Rotation in radians about the sprite's center. */
|
|
366
|
-
rotation?: number;
|
|
367
|
-
/** 0..1 opacity. */
|
|
368
|
-
opacity?: number;
|
|
369
|
-
/** Drop shadow (e.g. a team-colored glow). */
|
|
370
|
-
shadow?: PainterShadow;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* `draw-shape` — the neutral vector-fill/stroke drawable atom (dimension-agnostic).
|
|
375
|
-
*
|
|
376
|
-
* ONE descriptor (`DrawShapeProps`, grounded in core `ScenePos`) with TWO
|
|
377
|
-
* backends: `paintShape` (2D, here) and an R3F ground-plane mesh (`Shape3D` in
|
|
378
|
-
* `lib/drawable/mesh3d`, kept OUT of this file so the 2D path never pulls R3F).
|
|
379
|
-
* Paints a cell footprint, an axis-aligned rect, an ellipse, or a poly at a scene
|
|
380
|
-
* position, fill and/or stroke. Genre uses (tile fallback, iso/hex diamond
|
|
381
|
-
* fallback, cell highlight, feature disc, unit selection ring, unit fallback
|
|
382
|
-
* circle, ground/ghost discs, solid backgrounds, side-view platform rects) are
|
|
383
|
-
* all this atom with different `shape`/`anchor`/geometry — composed in `.lolo`,
|
|
384
|
-
* not here. The React component renders `null`; it exists so the pattern pipeline
|
|
385
|
-
* registers a `draw-shape` pattern and standalone pages stay inspectable.
|
|
386
|
-
*/
|
|
387
|
-
|
|
388
|
-
type ShapeKind = 'cell' | 'rect' | 'ellipse' | 'poly';
|
|
389
|
-
interface DrawShapeProps extends DrawableBase {
|
|
390
|
-
type: 'draw-shape';
|
|
391
|
-
shape: ShapeKind;
|
|
392
|
-
/** Logical scene position; the projector maps it to pixels / world. */
|
|
393
|
-
position: ScenePos;
|
|
394
|
-
/** How the shape aligns to its projected position. Default varies by `shape`. */
|
|
395
|
-
anchor?: DrawableAnchor;
|
|
396
|
-
/** Rect width in world units (fractions of `projector.tileWidth`). */
|
|
397
|
-
width?: number;
|
|
398
|
-
/** Rect height in world units (fractions of `projector.tileWidth`). */
|
|
399
|
-
height?: number;
|
|
400
|
-
/** Ellipse horizontal radius in world units (fractions of `projector.tileWidth`). */
|
|
401
|
-
radiusX?: number;
|
|
402
|
-
/** Ellipse vertical radius in world units; omitted → `radiusX` (a circle). */
|
|
403
|
-
radiusY?: number;
|
|
404
|
-
/** Fine nudge from the anchor point in world units. */
|
|
405
|
-
offsetX?: number;
|
|
406
|
-
offsetY?: number;
|
|
407
|
-
/** Poly vertices as world-unit offsets relative to the cell's projected top-left. */
|
|
408
|
-
points?: PainterPoint[];
|
|
409
|
-
fill?: string;
|
|
410
|
-
stroke?: string;
|
|
411
|
-
strokeWidth?: number;
|
|
412
|
-
/** 0..1 opacity. */
|
|
413
|
-
opacity?: number;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* `draw-text` — the neutral text drawable atom (dimension-agnostic).
|
|
418
|
-
*
|
|
419
|
-
* ONE descriptor (`DrawTextProps`, grounded in core `ScenePos`) with TWO backends:
|
|
420
|
-
* `paintText` (2D, here) and an R3F billboarded `<Text>` (`Text3D` in
|
|
421
|
-
* `lib/drawable/mesh3d`, kept OUT of this file so the 2D path never pulls R3F).
|
|
422
|
-
* Paints a string at a scene position with font/color/alignment. The React
|
|
423
|
-
* component renders `null` (a drawable is painted by the host, not the DOM).
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
interface DrawTextProps extends DrawableBase {
|
|
427
|
-
type: 'draw-text';
|
|
428
|
-
text: string;
|
|
429
|
-
/** Logical scene position; the projector maps it to pixels / world. */
|
|
430
|
-
position: ScenePos;
|
|
431
|
-
anchor?: DrawableAnchor;
|
|
432
|
-
offsetX?: number;
|
|
433
|
-
offsetY?: number;
|
|
434
|
-
color: string;
|
|
435
|
-
font?: string;
|
|
436
|
-
align?: CanvasTextAlign;
|
|
437
|
-
baseline?: CanvasTextBaseline;
|
|
438
|
-
opacity?: number;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* `draw-sprite-layer` — batch multiple sprites in one descriptor for O(layers) rendering.
|
|
443
|
-
*
|
|
444
|
-
* Composes the `draw-sprite` atom; the layer itself carries no `position` — each
|
|
445
|
-
* item does. It is drawable-by-composition: its `items` are `draw-sprite`
|
|
446
|
-
* descriptors (each grounded in core `ScenePos`), which is what stamps the layer
|
|
447
|
-
* `drawable` at pattern-sync time.
|
|
448
|
-
*/
|
|
449
|
-
|
|
450
|
-
interface DrawSpriteLayerProps extends DrawableBase {
|
|
451
|
-
type: 'draw-sprite-layer';
|
|
452
|
-
/** Sprites painted in array order; z-ordering is the caller's responsibility. */
|
|
453
|
-
items: DrawSpriteProps[];
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* `draw-shape-layer` — batch of shapes in one descriptor for O(layers) perf.
|
|
458
|
-
*
|
|
459
|
-
* Composes the `draw-shape` atom; drawable-by-composition (its `items` are
|
|
460
|
-
* `draw-shape` descriptors, each grounded in core `ScenePos`). The React
|
|
461
|
-
* component renders `null` (a drawable is painted by the host, not the DOM).
|
|
462
|
-
*/
|
|
463
|
-
|
|
464
|
-
interface DrawShapeLayerProps extends DrawableBase {
|
|
465
|
-
type: 'draw-shape-layer';
|
|
466
|
-
items: DrawShapeProps[];
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* `draw-text-layer` — batch of text labels in one descriptor for O(layers) perf.
|
|
471
|
-
*
|
|
472
|
-
* Composes the `draw-text` atom; drawable-by-composition (its `items` are
|
|
473
|
-
* `draw-text` descriptors, each grounded in core `ScenePos`). Covers the batched
|
|
474
|
-
* world-space text pass — fx messages, damage numbers, unit labels — that a
|
|
475
|
-
* board maps from an entity array (`items: (array/map @entity.fx (fn ...))`),
|
|
476
|
-
* which a literal `children` array can't express. The React component renders
|
|
477
|
-
* `null` (a drawable is painted by the host, not the DOM).
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
interface DrawTextLayerProps extends DrawableBase {
|
|
481
|
-
type: 'draw-text-layer';
|
|
482
|
-
items: DrawTextProps[];
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Drawable paint dispatch (2D) + the `DrawableNode` union.
|
|
487
|
-
*
|
|
488
|
-
* `paintDrawable` routes ONE descriptor to its 2D painter; the host walks its
|
|
489
|
-
* `children` through it. The "drawable" designation itself is NOT recorded here —
|
|
490
|
-
* it is DERIVED from the core `ScenePos` type each descriptor's `position` uses
|
|
491
|
-
* and stamped into `patterns-registry.json` by pattern-sync (mirroring how `Asset`
|
|
492
|
-
* is tagged), then read by the orbital-rust validator. So this module is pure
|
|
493
|
-
* paint routing; the capability is the registry's, not a hand-list.
|
|
494
|
-
*/
|
|
495
|
-
|
|
496
|
-
/** Every drawable descriptor. The host's `children` are a `DrawableNode[]`. */
|
|
497
|
-
type DrawableNode = DrawSpriteProps | DrawShapeProps | DrawTextProps | DrawSpriteLayerProps | DrawShapeLayerProps | DrawTextLayerProps;
|
|
498
|
-
|
|
499
281
|
/**
|
|
500
282
|
* AVL Schema Parser
|
|
501
283
|
*
|
|
@@ -608,4 +390,4 @@ interface TransitionLevelData {
|
|
|
608
390
|
slotTargets: SlotTarget[];
|
|
609
391
|
}
|
|
610
392
|
|
|
611
|
-
export { type ApplicationLevelData as A, type BoardTile as B, type CameraState as C, type
|
|
393
|
+
export { type ApplicationLevelData as A, type BoardTile as B, type CameraState as C, type ExternalLink as E, type FacingDirection as F, type GameAction as G, type IsometricTile as I, type OrbitalLevelData as O, type Position as P, type ResolvedFrame as R, type SpriteSheetUrls as S, type TraitLevelData as T, type UnitAnimationState as U, type IsometricUnit as a, type IsometricFeature as b, type TransitionLevelData as c, type SpriteFrameDims as d, type FieldInfo as e, type OrbitalTraitInfo as f, type OrbitalPageInfo as g, type GamePhase as h, type GameState as i, type GameUnit as j, type UnitTrait as k, calculateAttackTargets as l, calculateValidMoves as m, createInitialGameState as n };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OrbitalSchema, SExpr, Effect, OrbitalVerificationAPI, TraitStateSnapshot, EventPayload, BusEvent, VerificationCheck, BridgeHealth, VerificationSnapshot, VerificationSummary, TransitionTrace, ServerResponseTrace, CheckStatus, AssetLoadStatus } from '@almadar/core';
|
|
2
|
+
import { D as DrawableNode } from './paintDispatch-BXJgISot.cjs';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -277,7 +278,7 @@ declare function bindCanvasCapture(captureFn: () => string | null): void;
|
|
|
277
278
|
* Lets verification scripts inspect exactly which neutral descriptors reached
|
|
278
279
|
* the painter without re-deriving them from state.
|
|
279
280
|
*/
|
|
280
|
-
declare function bindLastDrawables(getDrawables: () =>
|
|
281
|
+
declare function bindLastDrawables(getDrawables: () => DrawableNode[] | null): void;
|
|
281
282
|
/**
|
|
282
283
|
* Update asset load status for canvas verification.
|
|
283
284
|
* Game organisms call this when images load or fail.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OrbitalSchema, SExpr, Effect, OrbitalVerificationAPI, TraitStateSnapshot, EventPayload, BusEvent, VerificationCheck, BridgeHealth, VerificationSnapshot, VerificationSummary, TransitionTrace, ServerResponseTrace, CheckStatus, AssetLoadStatus } from '@almadar/core';
|
|
2
|
+
import { D as DrawableNode } from './paintDispatch-BXJgISot.js';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -277,7 +278,7 @@ declare function bindCanvasCapture(captureFn: () => string | null): void;
|
|
|
277
278
|
* Lets verification scripts inspect exactly which neutral descriptors reached
|
|
278
279
|
* the painter without re-deriving them from state.
|
|
279
280
|
*/
|
|
280
|
-
declare function bindLastDrawables(getDrawables: () =>
|
|
281
|
+
declare function bindLastDrawables(getDrawables: () => DrawableNode[] | null): void;
|
|
281
282
|
/**
|
|
282
283
|
* Update asset load status for canvas verification.
|
|
283
284
|
* Game organisms call this when images load or fail.
|