@almadar/ui 5.85.0 → 5.86.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 (39) hide show
  1. package/dist/avl/index.cjs +1379 -4754
  2. package/dist/avl/index.js +431 -3806
  3. package/dist/components/game/2d/{organisms → molecules}/SequenceBar.d.ts +8 -3
  4. package/dist/components/game/2d/molecules/index.d.ts +15 -25
  5. package/dist/components/game/shared/index.d.ts +0 -2
  6. package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
  7. package/dist/components/index.cjs +1357 -4440
  8. package/dist/components/index.js +399 -3463
  9. package/dist/providers/index.cjs +1209 -4584
  10. package/dist/providers/index.js +370 -3745
  11. package/dist/runtime/index.cjs +1211 -4586
  12. package/dist/runtime/index.js +382 -3757
  13. package/package.json +1 -1
  14. package/dist/components/game/2d/organisms/BuilderBoard.d.ts +0 -60
  15. package/dist/components/game/2d/organisms/CanvasEffect.d.ts +0 -70
  16. package/dist/components/game/2d/organisms/ClassifierBoard.d.ts +0 -66
  17. package/dist/components/game/2d/organisms/DebuggerBoard.d.ts +0 -61
  18. package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +0 -42
  19. package/dist/components/game/2d/organisms/NegotiatorBoard.d.ts +0 -56
  20. package/dist/components/game/2d/organisms/SequencerBoard.d.ts +0 -69
  21. package/dist/components/game/2d/organisms/SimulatorBoard.d.ts +0 -58
  22. package/dist/components/game/2d/organisms/StateArchitectBoard.d.ts +0 -61
  23. package/dist/components/game/shared/canvasEffects.d.ts +0 -50
  24. package/dist/components/game/shared/combatPresets.d.ts +0 -15
  25. package/dist/components/game/shared/hooks/useCanvasEffects.d.ts +0 -27
  26. /package/dist/components/game/2d/{organisms → molecules}/ActionPalette.d.ts +0 -0
  27. /package/dist/components/game/2d/{organisms → molecules}/ActionTile.d.ts +0 -0
  28. /package/dist/components/game/2d/{organisms → molecules}/EventLog.d.ts +0 -0
  29. /package/dist/components/game/2d/{organisms → molecules}/ObjectRulePanel.d.ts +0 -0
  30. /package/dist/components/game/2d/{organisms → molecules}/RuleEditor.d.ts +0 -0
  31. /package/dist/components/game/2d/{organisms → molecules}/SimulationCanvas.d.ts +0 -0
  32. /package/dist/components/game/2d/{organisms → molecules}/SimulationControls.d.ts +0 -0
  33. /package/dist/components/game/2d/{organisms → molecules}/SimulationGraph.d.ts +0 -0
  34. /package/dist/components/game/2d/{organisms → molecules}/StateJsonView.d.ts +0 -0
  35. /package/dist/components/game/2d/{organisms → molecules}/StateNode.d.ts +0 -0
  36. /package/dist/components/game/2d/{organisms → molecules}/TraitSlot.d.ts +0 -0
  37. /package/dist/components/game/2d/{organisms → molecules}/TraitStateViewer.d.ts +0 -0
  38. /package/dist/components/game/2d/{organisms → molecules}/TransitionArrow.d.ts +0 -0
  39. /package/dist/components/game/2d/{organisms → molecules}/VariablePanel.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.85.0",
3
+ "version": "5.86.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,60 +0,0 @@
1
- /**
2
- * BuilderBoard
3
- *
4
- * Component-snapping game board. The player places components
5
- * onto slots in a blueprint. Correct placement completes the build.
6
- *
7
- * Good for: architecture, circuits, molecules, system design stories.
8
- *
9
- * Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
10
- */
11
- import React from 'react';
12
- import type { AssetUrl, EventEmit, EntityRow, Asset } from '@almadar/core';
13
- import type { DisplayStateProps } from '../../../core/organisms/types';
14
- /** A draggable build component (UI value DTO read off the entity). */
15
- export interface BuilderComponent {
16
- id: string;
17
- label: string;
18
- description?: string;
19
- iconEmoji?: string;
20
- /** Image URL icon (takes precedence over iconEmoji) */
21
- iconUrl?: AssetUrl;
22
- category?: string;
23
- }
24
- /** A blueprint slot accepting a component (UI value DTO read off the entity).
25
- * Mirrors the state machine's `BuilderBoardSlotsItem`: the required component
26
- * and the currently placed component both live on the entity. */
27
- export interface BuilderSlot {
28
- id: string;
29
- label?: string;
30
- description?: string;
31
- requiredComponentId: string;
32
- placedComponentId?: string;
33
- }
34
- export interface BuilderBoardProps extends DisplayStateProps {
35
- /** Puzzle board-state entity (single row or array). The board reads
36
- * `components` / `slots` arrays plus `attempts` / `result` off the row —
37
- * the state machine is the single source of truth for placements. */
38
- entity?: EntityRow | readonly EntityRow[];
39
- completeEvent?: EventEmit<{
40
- success: boolean;
41
- attempts: number;
42
- }>;
43
- /** Emits UI:{placeEvent} with { slotId, componentId } on component placement. */
44
- placeEvent?: EventEmit<{
45
- slotId: string;
46
- componentId: string;
47
- }>;
48
- /** Emits UI:{checkEvent} with {} when the player checks the build. */
49
- checkEvent?: EventEmit<Record<string, never>>;
50
- /** Emits UI:{playAgainEvent} with {} on play again / reset. */
51
- playAgainEvent?: EventEmit<Record<string, never>>;
52
- /** Optional per-semantic-key asset overrides for icons (correct/incorrect/reset/build). */
53
- assetManifest?: {
54
- ui?: Record<string, Asset>;
55
- };
56
- }
57
- export declare function BuilderBoard({ entity, completeEvent, placeEvent, checkEvent, playAgainEvent, assetManifest, className, }: BuilderBoardProps): React.JSX.Element | null;
58
- export declare namespace BuilderBoard {
59
- var displayName: string;
60
- }
@@ -1,70 +0,0 @@
1
- /**
2
- * CanvasEffect Component
3
- *
4
- * Renders animated visual effects using a `<canvas>` element with
5
- * sprite-based particles, frame-sequence animations, and overlays.
6
- * This is a render-ui pattern that can be placed in any slot —
7
- * it renders on top of whatever occupies that slot.
8
- *
9
- * Pattern: canvas-effect
10
- *
11
- * When an EffectAssetManifest is provided (via assetManifest prop),
12
- * the component uses the full particle engine with tinted sprites.
13
- * Without a manifest, it falls back to emoji-based rendering.
14
- *
15
- * **State categories (closed-circuit compliant):**
16
- * - Configuration (actionType, position, duration, manifest) → received via props
17
- * - Animation state (particles, shake, flash, RAF loop, phase timers) → local only
18
- * - Completion event → emitted via `useEventBus()` for trait integration
19
- *
20
- * This is an **ephemeral fire-and-forget** animation component. All
21
- * internal state is rendering-only (particle physics, screen shake decay,
22
- * flash alpha, emoji phase timers). No game logic lives here.
23
- *
24
- * @packageDocumentation
25
- */
26
- import * as React from 'react';
27
- import type { AssetUrl, EventEmit } from '@almadar/core';
28
- import type { CombatActionType, EffectAssetManifest } from '../../shared/effects';
29
- import type { UiError } from '../../../core/atoms/types';
30
- export type { CombatActionType } from '../../shared/effects';
31
- export type { EffectAssetManifest } from '../../shared/effects';
32
- export interface CanvasEffectProps {
33
- /** The type of combat action to visualise */
34
- actionType: CombatActionType;
35
- /** Screen-space X position (center of the effect) */
36
- x: number;
37
- /** Screen-space Y position (center of the effect) */
38
- y: number;
39
- /** Duration in ms before auto-dismiss (default 2000 for canvas, 800 for emoji) */
40
- duration?: number;
41
- /** Optional intensity multiplier (1 = normal, 2 = double size/brightness) */
42
- intensity?: number;
43
- /** Callback when the effect animation completes */
44
- onComplete?: () => void;
45
- /** Declarative event: emits UI:{completeEvent} when the effect animation completes */
46
- completeEvent?: EventEmit<Record<string, never>>;
47
- /** Additional CSS classes */
48
- className?: string;
49
- /** Loading state indicator */
50
- isLoading?: boolean;
51
- /** Error state */
52
- error?: UiError | null;
53
- /** Sprite URL for the effect (emoji fallback mode).
54
- * When set without assetManifest, renders this image instead of emoji. */
55
- effectSpriteUrl?: AssetUrl;
56
- /** Base URL for remote assets. Prepended to relative effectSpriteUrl paths. */
57
- assetBaseUrl?: AssetUrl;
58
- /** Full effect asset manifest for the sprite particle engine.
59
- * When provided, enables the canvas-based particle system. */
60
- assetManifest?: EffectAssetManifest;
61
- /** Canvas width (default 400) */
62
- width?: number;
63
- /** Canvas height (default 300) */
64
- height?: number;
65
- }
66
- export declare function CanvasEffect({ effectSpriteUrl, assetBaseUrl, ...props }: CanvasEffectProps): React.JSX.Element | null;
67
- export declare namespace CanvasEffect {
68
- var displayName: string;
69
- }
70
- export default CanvasEffect;
@@ -1,66 +0,0 @@
1
- /**
2
- * ClassifierBoard
3
- *
4
- * Drag-and-drop classification game. The player sorts items
5
- * into the correct category buckets. All items must be correctly
6
- * classified to win.
7
- *
8
- * Good for: taxonomy, pattern recognition, sorting stories.
9
- *
10
- * Gameplay events are emitted onto the bus so the bound Orbital trait
11
- * (ui-classifier-board.lolo: menu -> playing -> complete) owns the state:
12
- * assignEvent (ASSIGN), checkEvent (CHECK), playAgainEvent (PLAY_AGAIN),
13
- * plus completeEvent (default UI:PUZZLE_COMPLETE). When the entity carries
14
- * per-item `assignedCategory` / `result` / `attempts`, the board renders
15
- * from those; otherwise it self-manages with local state.
16
- */
17
- import React from 'react';
18
- import type { AssetUrl, EventEmit, EntityRow, Asset } from '@almadar/core';
19
- import type { DisplayStateProps } from '../../../core/organisms/types';
20
- /** A sortable item (UI value DTO read off the entity). */
21
- export interface ClassifierItem {
22
- id: string;
23
- label: string;
24
- description?: string;
25
- correctCategory: string;
26
- /** Category the player has assigned (entity-provided; machine-owned). */
27
- assignedCategory?: string;
28
- /** Image URL icon for story-specific visual skin */
29
- iconUrl?: AssetUrl;
30
- }
31
- /** A category bucket (UI value DTO read off the entity). */
32
- export interface ClassifierCategory {
33
- id: string;
34
- label: string;
35
- color?: string;
36
- /** Image URL for story-specific category header */
37
- imageUrl?: AssetUrl;
38
- }
39
- export interface ClassifierBoardProps extends DisplayStateProps {
40
- /** Puzzle board-state entity (single row or array). The board reads
41
- * `items` / `categories` arrays plus title/description/hint off the row.
42
- * Items may carry `assignedCategory`; the row may carry `result` and
43
- * `attempts` — all machine-owned. */
44
- entity?: EntityRow | readonly EntityRow[];
45
- completeEvent?: EventEmit<{
46
- success: boolean;
47
- attempts: number;
48
- }>;
49
- /** Emits UI:{assignEvent} with { itemId, categoryId } when an item is sorted. */
50
- assignEvent?: EventEmit<{
51
- itemId: string;
52
- categoryId: string;
53
- }>;
54
- /** Emits UI:{checkEvent} with {} when the player submits/checks. */
55
- checkEvent?: EventEmit<Record<string, never>>;
56
- /** Emits UI:{playAgainEvent} with {} on reset / play again. */
57
- playAgainEvent?: EventEmit<Record<string, never>>;
58
- /** Optional per-semantic-key asset overrides for icons (correct/incorrect/reset/send). */
59
- assetManifest?: {
60
- ui?: Record<string, Asset>;
61
- };
62
- }
63
- export declare function ClassifierBoard({ entity, completeEvent, assignEvent, checkEvent, playAgainEvent, assetManifest, className, }: ClassifierBoardProps): React.JSX.Element | null;
64
- export declare namespace ClassifierBoard {
65
- var displayName: string;
66
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * DebuggerBoard
3
- *
4
- * Error-finding game board. The player reviews a code/system
5
- * listing and identifies lines or elements that contain bugs.
6
- *
7
- * Good for: programming, logic, troubleshooting stories.
8
- *
9
- * Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
10
- */
11
- import React from 'react';
12
- import type { EventEmit, EntityRow, EntityWith, Asset } from '@almadar/core';
13
- import type { DisplayStateProps } from '../../../core/organisms/types';
14
- /** A reviewable code line (UI value DTO read off the entity). */
15
- export interface DebuggerLine {
16
- id: string;
17
- content: string;
18
- isBug: boolean;
19
- isFlagged?: boolean;
20
- explanation?: string;
21
- }
22
- export interface DebuggerBoardProps extends DisplayStateProps {
23
- /** Puzzle board-state entity (single row or array). The board reads
24
- * `lines` array (each with `isFlagged`), `result`, `attempts`, plus
25
- * title/description/bugCount/hint off the row. */
26
- entity?: EntityWith<{
27
- lines?: DebuggerLine[];
28
- result?: string;
29
- attempts?: number;
30
- title?: string;
31
- description?: string;
32
- bugCount?: number;
33
- hint?: string;
34
- headerImage?: string;
35
- theme?: {
36
- background?: string;
37
- accentColor?: string;
38
- };
39
- successMessage?: string;
40
- }> | readonly EntityRow[];
41
- completeEvent?: EventEmit<{
42
- success: boolean;
43
- attempts: number;
44
- }>;
45
- /** Emits UI:{toggleFlagEvent} with { lineId } when a line's bug-flag is toggled. */
46
- toggleFlagEvent?: EventEmit<{
47
- lineId: string;
48
- }>;
49
- /** Emits UI:{checkEvent} with {} when the player checks/submits. */
50
- checkEvent?: EventEmit<Record<string, never>>;
51
- /** Emits UI:{playAgainEvent} with {} on play again / reset. */
52
- playAgainEvent?: EventEmit<Record<string, never>>;
53
- /** Optional per-semantic-key asset overrides for icons (correct/incorrect/reset/bug/send). */
54
- assetManifest?: {
55
- ui?: Record<string, Asset>;
56
- };
57
- }
58
- export declare function DebuggerBoard({ entity, completeEvent, toggleFlagEvent, checkEvent, playAgainEvent, assetManifest, className, }: DebuggerBoardProps): React.JSX.Element | null;
59
- export declare namespace DebuggerBoard {
60
- var displayName: string;
61
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * EventHandlerBoard Organism
3
- *
4
- * Contains ALL game logic for the Event Handler tier (ages 9-12).
5
- * Kids click on world objects, set WHEN/THEN rules, and watch
6
- * event chains cascade during playback.
7
- *
8
- * Encourages experimentation: on failure, resets to editing so the kid
9
- * can try different rules. After 3 failures, shows a progressive hint.
10
- *
11
- * @packageDocumentation
12
- */
13
- import React from 'react';
14
- import type { EventEmit, EntityRow } from '@almadar/core';
15
- import type { DisplayStateProps } from '../../../core/organisms/types';
16
- import type { RuleDefinition } from './RuleEditor';
17
- export interface EventHandlerBoardProps extends DisplayStateProps {
18
- /** Puzzle board-state entity (single row or array). The board reads
19
- * `objects` / `triggerEvents` / `goalEvent` etc. off the row; the editable
20
- * puzzle objects are themselves `EntityRow`s carried under `objects`. */
21
- entity?: EntityRow | readonly EntityRow[];
22
- /** Playback speed in ms per event */
23
- stepDurationMs?: number;
24
- /** Emits UI:{playEvent} */
25
- playEvent?: EventEmit<Record<string, never>>;
26
- /** Emits UI:{completeEvent} with { success } */
27
- completeEvent?: EventEmit<{
28
- success: boolean;
29
- }>;
30
- /** Emits UI:{editRuleEvent} with { objectId, rules } — model updates @entity.objects */
31
- editRuleEvent?: EventEmit<{
32
- objectId: string;
33
- rules: RuleDefinition[];
34
- }>;
35
- /** Emits UI:{playAgainEvent} to reset the model */
36
- playAgainEvent?: EventEmit<Record<string, never>>;
37
- }
38
- export declare function EventHandlerBoard({ entity, stepDurationMs, playEvent, completeEvent, editRuleEvent, playAgainEvent, className, }: EventHandlerBoardProps): React.JSX.Element | null;
39
- export declare namespace EventHandlerBoard {
40
- var displayName: string;
41
- }
42
- export default EventHandlerBoard;
@@ -1,56 +0,0 @@
1
- /**
2
- * NegotiatorBoard
3
- *
4
- * Turn-based decision matrix game. The player makes choices
5
- * over multiple rounds against an AI opponent. Each round
6
- * both sides pick an action, and payoffs are determined by
7
- * the combination.
8
- *
9
- * Good for: ethics, business, game theory, economics stories.
10
- *
11
- * Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
12
- */
13
- import React from 'react';
14
- import type { EventEmit, EntityRow, Asset } from '@almadar/core';
15
- import type { DisplayStateProps } from '../../../core/organisms/types';
16
- /** A selectable round action (UI value DTO read off the entity). */
17
- export interface NegotiatorAction {
18
- id: string;
19
- label: string;
20
- description?: string;
21
- }
22
- /** A payoff-matrix cell (UI value DTO read off the entity). */
23
- export interface PayoffEntry {
24
- playerAction: string;
25
- opponentAction: string;
26
- playerPayoff: number;
27
- opponentPayoff: number;
28
- }
29
- export interface NegotiatorBoardProps extends DisplayStateProps {
30
- /** Puzzle board-state entity (single row or array). The board reads
31
- * `score` / `round` / `result` / `targetScore` / `maxRounds` plus the
32
- * `actions` / `payoffMatrix` arrays and title/description/hint off the row.
33
- * Score accumulation + win/lose are owned by the gameplay machine. */
34
- entity?: EntityRow | readonly EntityRow[];
35
- completeEvent?: EventEmit<{
36
- success: boolean;
37
- score: number;
38
- }>;
39
- /** Emits UI:{playRoundEvent} with the picked action + the UI-resolved payoff. */
40
- playRoundEvent?: EventEmit<{
41
- playerAction: string;
42
- payoff: number;
43
- }>;
44
- /** Emits UI:{finishEvent} with {} when all rounds are spent. */
45
- finishEvent?: EventEmit<Record<string, never>>;
46
- /** Emits UI:{playAgainEvent} with {} on play again / reset. */
47
- playAgainEvent?: EventEmit<Record<string, never>>;
48
- /** Optional per-semantic-key asset overrides for icons (correct/arrow). */
49
- assetManifest?: {
50
- ui?: Record<string, Asset>;
51
- };
52
- }
53
- export declare function NegotiatorBoard({ entity, completeEvent, playRoundEvent, finishEvent, playAgainEvent, assetManifest, className, }: NegotiatorBoardProps): React.JSX.Element | null;
54
- export declare namespace NegotiatorBoard {
55
- var displayName: string;
56
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * SequencerBoard Organism
3
- *
4
- * Contains ALL game logic for the Sequencer tier (ages 5-8).
5
- * Manages the action sequence, validates it, and animates Kekec
6
- * executing each step on the puzzle scene.
7
- *
8
- * Feedback-first UX:
9
- * - On failure: slots stay in place, each slot gets a green or red
10
- * ring showing exactly which steps are correct and which need to change.
11
- * - Modifying a slot clears its individual feedback so the kid can re-try.
12
- * - After 3 failures a persistent hint appears above the sequence bar.
13
- * - "Reset" clears everything including attempts / hint.
14
- *
15
- * TraitStateViewer states use indexed labels ("1. Walk", "2. Jump") so that
16
- * repeated actions are correctly highlighted during playback.
17
- *
18
- * @packageDocumentation
19
- */
20
- import React from 'react';
21
- import type { EventEmit, EntityRow } from '@almadar/core';
22
- import type { DisplayStateProps } from '../../../core/organisms/types';
23
- export interface SequencerBoardProps extends DisplayStateProps {
24
- /** Puzzle board-state entity (single row or array). The board reads
25
- * `availableActions` / `maxSlots` / `solutions` etc. off the row.
26
- * `availableActions` carries `SlotItemData[]` (a UI drag-DTO, not entity
27
- * data — it holds a non-FieldValue `stateMachine` member). */
28
- entity?: EntityRow | readonly EntityRow[];
29
- /** Category → color mapping */
30
- categoryColors?: Record<string, {
31
- bg: string;
32
- border: string;
33
- }>;
34
- /** Playback speed in ms per step */
35
- stepDurationMs?: number;
36
- /** Emits UI:{playEvent} with { sequence: string[] } */
37
- playEvent?: EventEmit<{
38
- sequence: string[];
39
- }>;
40
- /** Emits UI:{completeEvent} with { success: boolean } */
41
- completeEvent?: EventEmit<{
42
- success: boolean;
43
- sequence: string[];
44
- }>;
45
- /** Emits UI:{placeEvent} with { slotIndex, actionId } when an action is dropped into a slot */
46
- placeEvent?: EventEmit<{
47
- slotIndex: number;
48
- actionId: string;
49
- }>;
50
- /** Emits UI:{removeEvent} with { slotIndex } when an action is removed from a slot */
51
- removeEvent?: EventEmit<{
52
- slotIndex: number;
53
- }>;
54
- /** Emits UI:{checkEvent} with { sequence } when the player submits the sequence */
55
- checkEvent?: EventEmit<{
56
- sequence: string[];
57
- }>;
58
- /** Emits UI:{playAgainEvent} with {} on reset */
59
- playAgainEvent?: EventEmit<Record<string, never>>;
60
- /** Emits UI:{stepEvent} with { step } during playback animation advancement */
61
- stepEvent?: EventEmit<{
62
- step: number;
63
- }>;
64
- }
65
- export declare function SequencerBoard({ entity, categoryColors, stepDurationMs, playEvent, completeEvent, placeEvent, removeEvent, checkEvent, playAgainEvent, stepEvent, className, }: SequencerBoardProps): React.JSX.Element | null;
66
- export declare namespace SequencerBoard {
67
- var displayName: string;
68
- }
69
- export default SequencerBoard;
@@ -1,58 +0,0 @@
1
- /**
2
- * SimulatorBoard
3
- *
4
- * Parameter-slider game board. The player adjusts two parameters (A and B)
5
- * and observes the machine-derived output. Correct parameter values must
6
- * bring the output within tolerance of the target to win.
7
- *
8
- * Good for: physics, economics, system design stories.
9
- *
10
- * Controlled-only: params, output, attempts, and result are owned by the
11
- * gameplay machine and read off the bound entity. Slider/check/play-again
12
- * interactions are emitted as events; the machine recomputes and re-renders.
13
- */
14
- import React from 'react';
15
- import type { EventEmit, EntityRow, Asset } from '@almadar/core';
16
- import type { DisplayStateProps } from '../../../core/organisms/types';
17
- /** A tunable simulation parameter slider descriptor (UI value DTO read off the entity). */
18
- export interface SimulatorParameter {
19
- id: string;
20
- label: string;
21
- unit: string;
22
- min: number;
23
- max: number;
24
- step: number;
25
- initial: number;
26
- correct: number;
27
- tolerance: number;
28
- }
29
- export interface SimulatorBoardProps extends DisplayStateProps {
30
- /** Puzzle board-state entity (single row or array). The board reads the
31
- * `parameters` slider descriptors plus the machine-owned `paramA`/`paramB`/
32
- * `output`/`target`/`tolerance`/`attempts`/`result` fields off the row. */
33
- entity?: EntityRow | readonly EntityRow[];
34
- completeEvent?: EventEmit<{
35
- success: boolean;
36
- attempts: number;
37
- }>;
38
- /** Emits UI:{setAEvent} with { value } when parameter A's slider changes. */
39
- setAEvent?: EventEmit<{
40
- value: number;
41
- }>;
42
- /** Emits UI:{setBEvent} with { value } when parameter B's slider changes. */
43
- setBEvent?: EventEmit<{
44
- value: number;
45
- }>;
46
- /** Emits UI:{checkEvent} with {} on simulate / check. */
47
- checkEvent?: EventEmit<Record<string, never>>;
48
- /** Emits UI:{playAgainEvent} with {} on reset / play again. */
49
- playAgainEvent?: EventEmit<Record<string, never>>;
50
- /** Optional per-semantic-key asset overrides for icons (correct/incorrect/play/reset). */
51
- assetManifest?: {
52
- ui?: Record<string, Asset>;
53
- };
54
- }
55
- export declare function SimulatorBoard({ entity, completeEvent, setAEvent, setBEvent, checkEvent, playAgainEvent, assetManifest, className, }: SimulatorBoardProps): React.JSX.Element | null;
56
- export declare namespace SimulatorBoard {
57
- var displayName: string;
58
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * StateArchitectBoard Organism
3
- *
4
- * Contains ALL game logic for the State Architect tier (ages 13+).
5
- * Kids design state machines via a visual graph editor, then run
6
- * them to see if the behavior matches the puzzle goal.
7
- *
8
- * @packageDocumentation
9
- */
10
- import React from 'react';
11
- import type { EventEmit, EntityRow } from '@almadar/core';
12
- import type { DisplayStateProps } from '../../../core/organisms/types';
13
- /** A kid-built transition in the visual graph editor (UI value DTO). */
14
- export interface StateArchitectTransition {
15
- id: string;
16
- from: string;
17
- to: string;
18
- event: string;
19
- guardHint?: string;
20
- }
21
- /** A puzzle test case (UI value DTO). */
22
- export interface TestCase {
23
- /** Sequence of events to fire */
24
- events: string[];
25
- /** Expected final state */
26
- expectedState: string;
27
- /** Description */
28
- label: string;
29
- }
30
- export interface StateArchitectBoardProps extends DisplayStateProps {
31
- /** Puzzle board-state entity (single row or array). The board reads
32
- * `variables` / `states` / `transitions` / `testCases` etc. off the row. */
33
- entity?: EntityRow | readonly EntityRow[];
34
- /** Playback speed */
35
- stepDurationMs?: number;
36
- /** Emits UI:{testEvent} */
37
- testEvent?: EventEmit<Record<string, never>>;
38
- /** Emits UI:{completeEvent} with { success, passedTests } */
39
- completeEvent?: EventEmit<{
40
- success: boolean;
41
- passedTests: number;
42
- }>;
43
- /** Emits UI:{addTransitionEvent} — lolo handles ADD_TRANSITION */
44
- addTransitionEvent?: EventEmit<{
45
- id: string;
46
- from: string;
47
- to: string;
48
- event: string;
49
- }>;
50
- /** Emits UI:{removeTransitionEvent} — lolo handles REMOVE_TRANSITION */
51
- removeTransitionEvent?: EventEmit<{
52
- id: string;
53
- }>;
54
- /** Emits UI:{playAgainEvent} — lolo handles PLAY_AGAIN */
55
- playAgainEvent?: EventEmit<Record<string, never>>;
56
- }
57
- export declare function StateArchitectBoard({ entity, stepDurationMs, testEvent, completeEvent, addTransitionEvent, removeTransitionEvent, playAgainEvent, className, }: StateArchitectBoardProps): React.JSX.Element | null;
58
- export declare namespace StateArchitectBoard {
59
- var displayName: string;
60
- }
61
- export default StateArchitectBoard;
@@ -1,50 +0,0 @@
1
- /**
2
- * Canvas Effect Engine
3
- *
4
- * Pure functions for spawning, updating, and drawing canvas effects.
5
- * No React dependencies — called from the RAF loop via useCanvasEffects hook.
6
- *
7
- * Ported from trait-wars and generalized for any almadar-ui client.
8
- */
9
- import type { CanvasParticle, CanvasSequence, CanvasOverlay, CanvasEffectState, ParticleEmitterConfig, SequenceConfig, OverlayConfig } from './effects';
10
- /**
11
- * Draw a sprite tinted with an RGB color onto the main canvas.
12
- * Uses offscreen canvas with `source-atop` compositing to recolor
13
- * white-on-transparent sprites.
14
- */
15
- export declare function drawTintedImage(ctx: CanvasRenderingContext2D, img: HTMLImageElement | ImageBitmap, x: number, y: number, w: number, h: number, tint: {
16
- r: number;
17
- g: number;
18
- b: number;
19
- }, alpha: number, blendMode?: GlobalCompositeOperation): void;
20
- /**
21
- * Spawn a burst of particles from an emitter config.
22
- */
23
- export declare function spawnParticles(config: ParticleEmitterConfig, animTime: number): CanvasParticle[];
24
- /**
25
- * Spawn a frame sequence animation.
26
- */
27
- export declare function spawnSequence(config: SequenceConfig, animTime: number): CanvasSequence;
28
- /**
29
- * Spawn an overlay effect.
30
- */
31
- export declare function spawnOverlay(config: OverlayConfig, animTime: number): CanvasOverlay;
32
- /**
33
- * Advance effect state by one frame. Returns new state with expired effects removed.
34
- */
35
- export declare function updateEffectState(state: CanvasEffectState, animTime: number, deltaMs: number): CanvasEffectState;
36
- type GetImageFn = (url: string) => HTMLImageElement | undefined;
37
- /**
38
- * Draw all active effects onto the canvas.
39
- */
40
- export declare function drawEffectState(ctx: CanvasRenderingContext2D, state: CanvasEffectState, animTime: number, getImage: GetImageFn): void;
41
- export declare function hasActiveEffects(state: CanvasEffectState): boolean;
42
- /**
43
- * Collect all sprite URLs from an EffectAssetManifest for preloading.
44
- */
45
- export declare function getAllEffectSpriteUrls(manifest: {
46
- baseUrl: string;
47
- particles?: Record<string, string[] | string | undefined>;
48
- animations?: Record<string, string[] | undefined>;
49
- }): string[];
50
- export {};
@@ -1,15 +0,0 @@
1
- /**
2
- * Combat Presets
3
- *
4
- * Maps combat actions to composed effect layers (particles + sequences + overlays).
5
- * Each preset factory takes a screen-space origin and returns a CombatPreset.
6
- *
7
- * Generalized from trait-wars: uses EffectAssetManifest instead of TraitWarsAssetManifest.
8
- */
9
- import type { CombatActionType, CombatPreset, EffectAssetManifest } from './effects';
10
- type PresetFactory = (originX: number, originY: number) => CombatPreset;
11
- /**
12
- * Create combat preset factories from an effect asset manifest.
13
- */
14
- export declare function createCombatPresets(manifest: EffectAssetManifest): Record<CombatActionType, PresetFactory>;
15
- export {};
@@ -1,27 +0,0 @@
1
- import type { AssetUrl } from '@almadar/core';
2
- import type { CombatActionType, EffectAssetManifest } from '../effects';
3
- export interface UseCanvasEffectsOptions {
4
- /** Effect asset manifest (baseUrl + particles + animations) */
5
- manifest: EffectAssetManifest;
6
- }
7
- export interface UseCanvasEffectsResult {
8
- /** All effect sprite URLs for preloading via useImageCache */
9
- effectSpriteUrls: AssetUrl[];
10
- /** Spawn a combat effect at the given screen position */
11
- spawnEffect: (type: CombatActionType, screenX: number, screenY: number) => void;
12
- /** Draw all active effects — call inside draw() after units, before ctx.restore() */
13
- drawEffects: (ctx: CanvasRenderingContext2D, animTime: number, getImage: (url: string) => HTMLImageElement | undefined) => void;
14
- /** Whether there are active effects (keeps RAF alive) */
15
- hasActiveEffects: boolean;
16
- /** Screen shake offset to apply to container transform */
17
- screenShake: {
18
- x: number;
19
- y: number;
20
- };
21
- /** Screen flash overlay (null = no flash) */
22
- screenFlash: {
23
- color: string;
24
- alpha: number;
25
- } | null;
26
- }
27
- export declare function useCanvasEffects({ manifest, }: UseCanvasEffectsOptions): UseCanvasEffectsResult;