@almadar/ui 5.95.0 → 5.97.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.
@@ -14,7 +14,8 @@
14
14
  * @packageDocumentation
15
15
  */
16
16
  import React from 'react';
17
- import type { EventEmit } from '@almadar/core';
17
+ import type { EventEmit, Asset } from '@almadar/core';
18
+ import type { Platform, SidePlayer } from '../../2d/molecules/Canvas2D';
18
19
  import * as THREE from 'three';
19
20
  import { AssetLoader } from '../../shared/lib/AssetLoader';
20
21
  import { type MinimalMouseEvent } from '../../shared/hooks/useGameCanvas3DEvents';
@@ -30,8 +31,15 @@ export interface GameEvent {
30
31
  y?: number;
31
32
  message?: string;
32
33
  }
33
- /** Camera mode for 3D view */
34
- export type CameraMode = 'isometric' | 'perspective' | 'top-down';
34
+ /** Camera mode for 3D view. `follow` tracks the side-view player (or the selected unit). */
35
+ export type CameraMode = 'isometric' | 'perspective' | 'top-down' | 'follow';
36
+ /** Per-role model manifest — the 3D analogue of Canvas2D's assetManifest (values are GLB Assets). */
37
+ export interface GameCanvas3DAssetManifest {
38
+ terrains?: Record<string, Asset>;
39
+ units?: Record<string, Asset>;
40
+ features?: Record<string, Asset>;
41
+ effects?: Record<string, Asset>;
42
+ }
35
43
  /** Map orientation */
36
44
  export type MapOrientation = 'standard' | 'rotated';
37
45
  /** Overlay control */
@@ -184,6 +192,29 @@ export interface GameCanvas3DProps {
184
192
  unitScale?: number;
185
193
  /** Board zoom/group scale. Applied to the scene group. Default 0.45. */
186
194
  scale?: number;
195
+ /** Maps a keydown `e.code` → the board's SEMANTIC event, e.g. `{ ArrowLeft: "LEFT", Space: "JUMP" }`.
196
+ * The input layer emits `UI:<event>` so the FSM stays device-agnostic — keyboard and d-pad converge. */
197
+ keyMap?: Record<string, string>;
198
+ /** Maps a keyup `e.code` → the board's SEMANTIC event, e.g. `{ ArrowLeft: "STOP" }`. */
199
+ keyUpMap?: Record<string, string>;
200
+ /** Side-view player (pixel coords, LOLO-owned physics) — presence switches to side-scroller rendering. */
201
+ player?: SidePlayer;
202
+ /** Side-view level geometry (pixel AABBs, same contract as Canvas2D). */
203
+ platforms?: Platform[];
204
+ /** Side-view world size in pixels. */
205
+ worldWidth?: number;
206
+ /** Side-view world size in pixels. */
207
+ worldHeight?: number;
208
+ /** Pixel→world-unit divisor for side view (default 32 = one 2D tile per 3D cell). */
209
+ pixelsPerUnit?: number;
210
+ /** Player model — named for 2D parity; in 3D the Asset's url is a GLB. */
211
+ playerSprite?: Asset;
212
+ /** Platform-type → model map — named for 2D parity; values are GLB Assets. */
213
+ tileSprites?: Record<string, Asset>;
214
+ /** Per-role model manifest; resolves tiles/units/features without explicit modelUrl/assetUrl. */
215
+ assetManifest?: GameCanvas3DAssetManifest;
216
+ /** Opt-in: smooth-lerp unit positions between LOLO tick snapshots. DEFAULT OFF. */
217
+ interpolateUnits?: boolean;
187
218
  }
188
219
  /** Imperative handle for GameCanvas3D */
189
220
  export interface GameCanvas3DHandle {
@@ -26,6 +26,14 @@ export interface ModelLoaderProps {
26
26
  onHover?: (hovered: boolean) => void;
27
27
  /** Fallback geometry type */
28
28
  fallbackGeometry?: 'box' | 'sphere' | 'cylinder' | 'none';
29
+ /**
30
+ * Named GLB animation clip to play (e.g. "idle", "walk") — the LOLO state machine
31
+ * drives this from the unit's `animation` field. Matched case-insensitively; an
32
+ * unknown or absent name leaves the model static (bind pose).
33
+ */
34
+ animation?: string;
35
+ /** Multiply the model's material colors by this CSS color (per-instance; e.g. team tint). */
36
+ tint?: string;
29
37
  /** Enable shadows */
30
38
  castShadow?: boolean;
31
39
  /** Receive shadows */
@@ -40,5 +48,5 @@ export interface ModelLoaderProps {
40
48
  /**
41
49
  * ModelLoader component for rendering GLB models in React Three Fiber
42
50
  */
43
- export declare function ModelLoader({ url, position, scale, rotation, isSelected, isHovered, onClick, onHover, fallbackGeometry, castShadow, receiveShadow, resourceBasePath, }: ModelLoaderProps): React.JSX.Element;
51
+ export declare function ModelLoader({ url, position, scale, rotation, isSelected, isHovered, onClick, onHover, fallbackGeometry, castShadow, receiveShadow, resourceBasePath, animation, tint, }: ModelLoaderProps): React.JSX.Element;
44
52
  export default ModelLoader;
@@ -20,7 +20,6 @@ export { useGameCanvas3DEvents, type UseGameCanvas3DEventsOptions, type UseGameC
20
20
  export { AssetLoader, assetLoader, type LoadedModel, } from '../../shared/lib/AssetLoader';
21
21
  export type { UnitAnimationState } from '../../shared/spriteAnimationTypes';
22
22
  export { GameCanvas3D, type GameCanvas3DProps } from './GameCanvas3D';
23
- export { Canvas3D, type Canvas3DProps } from './Canvas3D';
24
23
  export { GameCanvas3DBattleTemplate, type GameCanvas3DBattleTemplateProps } from '../templates/GameCanvas3DBattleTemplate';
25
24
  export { GameCanvas3DCastleTemplate, type GameCanvas3DCastleTemplateProps } from '../templates/GameCanvas3DCastleTemplate';
26
25
  export { GameCanvas3DWorldMapTemplate, type GameCanvas3DWorldMapTemplateProps } from '../templates/GameCanvas3DWorldMapTemplate';
@@ -46,6 +46,8 @@ export interface IsometricTile {
46
46
  elevation?: number;
47
47
  /** 3D model URL (GLB format) for GameCanvas3D — rendered via ModelLoader with box fallback */
48
48
  modelUrl?: Asset;
49
+ /** Y-axis rotation in degrees (3D) — orients directional pieces (track corners, road bends) */
50
+ rotation?: number;
49
51
  }
50
52
  /** A unit positioned on the isometric grid */
51
53
  export type IsometricUnit = {