@almadar/ui 5.86.0 → 5.89.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 +3435 -1250
- package/dist/avl/index.js +2485 -300
- package/dist/components/game/2d/molecules/StateGraph.d.ts +38 -0
- package/dist/components/game/2d/molecules/index.d.ts +24 -15
- package/dist/components/game/2d/organisms/BuilderBoard.d.ts +60 -0
- package/dist/components/game/2d/organisms/ClassifierBoard.d.ts +66 -0
- package/dist/components/game/2d/organisms/DebuggerBoard.d.ts +61 -0
- package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +42 -0
- package/dist/components/game/2d/organisms/NegotiatorBoard.d.ts +56 -0
- package/dist/components/game/2d/{molecules → organisms}/SequenceBar.d.ts +3 -8
- package/dist/components/game/2d/organisms/SequencerBoard.d.ts +69 -0
- package/dist/components/game/2d/organisms/SimulatorBoard.d.ts +58 -0
- package/dist/components/game/2d/organisms/StateArchitectBoard.d.ts +61 -0
- package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
- package/dist/components/index.cjs +3168 -1351
- package/dist/components/index.js +2199 -391
- package/dist/providers/index.cjs +3295 -1110
- package/dist/providers/index.js +2454 -269
- package/dist/runtime/index.cjs +3291 -1106
- package/dist/runtime/index.js +2460 -275
- package/package.json +1 -1
- /package/dist/components/game/2d/{molecules → organisms}/ActionPalette.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/ActionTile.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/EventLog.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/ObjectRulePanel.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/RuleEditor.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationCanvas.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationControls.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationGraph.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/StateJsonView.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/StateNode.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TraitSlot.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TraitStateViewer.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TransitionArrow.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/VariablePanel.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StateGraph (molecule)
|
|
3
|
+
*
|
|
4
|
+
* Dumb visual renderer for a state-machine graph: lays states out on a circle,
|
|
5
|
+
* draws the player's transitions as SVG arrows, and emits a node-click event.
|
|
6
|
+
* All state (which transitions exist, the pending "from" selection, test results)
|
|
7
|
+
* lives in the .lolo FSM — this molecule only renders and reports clicks.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import type { EventKey } from '@almadar/core';
|
|
11
|
+
export interface StateGraphTransition {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
event: string;
|
|
15
|
+
guardHint?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface StateGraphProps {
|
|
18
|
+
/** All states in the machine (node labels). */
|
|
19
|
+
states: string[];
|
|
20
|
+
/** Player-built transitions rendered as arrows. */
|
|
21
|
+
transitions?: StateGraphTransition[];
|
|
22
|
+
/** State highlighted as current (test playback / initial). */
|
|
23
|
+
currentState?: string;
|
|
24
|
+
/** State the player has selected (first click). */
|
|
25
|
+
selectedState?: string;
|
|
26
|
+
/** When set, the graph is in "pick a target" mode from this state. */
|
|
27
|
+
addingFrom?: string;
|
|
28
|
+
/** The machine's initial state (ring-marked). */
|
|
29
|
+
initialState?: string;
|
|
30
|
+
/** Graph canvas width. */
|
|
31
|
+
width?: number;
|
|
32
|
+
/** Graph canvas height. */
|
|
33
|
+
height?: number;
|
|
34
|
+
/** Emits UI:{nodeClickEvent} with { stateId } when a node is clicked. */
|
|
35
|
+
nodeClickEvent?: EventKey;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function StateGraph({ states, transitions, currentState, selectedState, addingFrom, initialState, width, height, nodeClickEvent, className, }: StateGraphProps): React.JSX.Element;
|
|
@@ -32,29 +32,38 @@ export { InventoryGrid, type InventoryGridProps, type InventoryGridItem } from '
|
|
|
32
32
|
export { ResourceBar, type ResourceBarProps, type ResourceBarResource } from './ResourceBar';
|
|
33
33
|
export { GameHud, type GameHudProps, type GameHudStat, type GameHudElement } from './GameHud';
|
|
34
34
|
export { GameMenu, type GameMenuProps, type MenuOption } from './GameMenu';
|
|
35
|
+
export { StateGraph, type StateGraphProps, type StateGraphTransition } from './StateGraph';
|
|
35
36
|
export { Canvas2D, type Canvas2DProps, type Projection, type CameraMode, type Platform, type SidePlayer, type TileCoord, } from './Canvas2D';
|
|
36
37
|
export { useUnitSpriteAtlas } from '../../shared/hooks/useUnitSpriteAtlas';
|
|
37
38
|
export { GameAudioProvider, GameAudioContext, useGameAudioContext, type GameAudioProviderProps, type GameAudioContextValue, } from '../../shared/providers/GameAudioProvider';
|
|
38
39
|
export { GameAudioToggle, type GameAudioToggleProps, } from '../atoms/GameAudioToggle';
|
|
39
40
|
export { useGameAudio, type AudioManifest, type SoundEntry, type GameAudioControls, type UseGameAudioOptions, } from '../../shared/hooks/useGameAudio';
|
|
40
41
|
export { useCamera } from '../../shared/hooks/useCamera';
|
|
41
|
-
export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from '
|
|
42
|
-
export { TraitSlot, type TraitSlotProps, type SlotItemData, } from '
|
|
42
|
+
export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from '../organisms/TraitStateViewer';
|
|
43
|
+
export { TraitSlot, type TraitSlotProps, type SlotItemData, } from '../organisms/TraitSlot';
|
|
43
44
|
export { CollapsibleSection, EditorSlider, EditorSelect, EditorCheckbox, EditorTextInput, StatusBar, TerrainPalette, EditorToolbar, TERRAIN_COLORS, FEATURE_TYPES, type EditorMode, type CollapsibleSectionProps, type EditorSliderProps, type EditorSelectProps, type EditorCheckboxProps, type EditorTextInputProps, type StatusBarProps, type TerrainPaletteProps, type EditorToolbarProps, } from '../../shared/lib/editorUtils';
|
|
44
|
-
export { ActionTile, type ActionTileProps } from '
|
|
45
|
-
export { ActionPalette, type ActionPaletteProps } from '
|
|
46
|
-
export { SequenceBar, type SequenceBarProps } from '
|
|
47
|
-
export {
|
|
48
|
-
export {
|
|
49
|
-
export {
|
|
45
|
+
export { ActionTile, type ActionTileProps } from '../organisms/ActionTile';
|
|
46
|
+
export { ActionPalette, type ActionPaletteProps } from '../organisms/ActionPalette';
|
|
47
|
+
export { SequenceBar, type SequenceBarProps } from '../organisms/SequenceBar';
|
|
48
|
+
export { SequencerBoard, type SequencerBoardProps } from '../organisms/SequencerBoard';
|
|
49
|
+
export { RuleEditor, type RuleEditorProps, type RuleDefinition } from '../organisms/RuleEditor';
|
|
50
|
+
export { EventLog, type EventLogProps, type EventLogEntry } from '../organisms/EventLog';
|
|
51
|
+
export { ObjectRulePanel, type ObjectRulePanelProps } from '../organisms/ObjectRulePanel';
|
|
52
|
+
export { EventHandlerBoard, type EventHandlerBoardProps } from '../organisms/EventHandlerBoard';
|
|
50
53
|
export * from '../../shared/lib/puzzleObject';
|
|
51
|
-
export { StateNode, type StateNodeProps } from '
|
|
52
|
-
export { TransitionArrow, type TransitionArrowProps } from '
|
|
53
|
-
export { VariablePanel, type VariablePanelProps } from '
|
|
54
|
-
export { StateJsonView, type StateJsonViewProps } from '
|
|
55
|
-
export {
|
|
56
|
-
export {
|
|
57
|
-
export {
|
|
54
|
+
export { StateNode, type StateNodeProps } from '../organisms/StateNode';
|
|
55
|
+
export { TransitionArrow, type TransitionArrowProps } from '../organisms/TransitionArrow';
|
|
56
|
+
export { VariablePanel, type VariablePanelProps } from '../organisms/VariablePanel';
|
|
57
|
+
export { StateJsonView, type StateJsonViewProps } from '../organisms/StateJsonView';
|
|
58
|
+
export { StateArchitectBoard, type StateArchitectBoardProps, type StateArchitectTransition, type TestCase, } from '../organisms/StateArchitectBoard';
|
|
59
|
+
export { SimulatorBoard, type SimulatorBoardProps, type SimulatorParameter } from '../organisms/SimulatorBoard';
|
|
60
|
+
export { ClassifierBoard, type ClassifierBoardProps, type ClassifierItem, type ClassifierCategory } from '../organisms/ClassifierBoard';
|
|
61
|
+
export { BuilderBoard, type BuilderBoardProps, type BuilderComponent, type BuilderSlot } from '../organisms/BuilderBoard';
|
|
62
|
+
export { DebuggerBoard, type DebuggerBoardProps, type DebuggerLine } from '../organisms/DebuggerBoard';
|
|
63
|
+
export { NegotiatorBoard, type NegotiatorBoardProps, type NegotiatorAction, type PayoffEntry } from '../organisms/NegotiatorBoard';
|
|
64
|
+
export { SimulationCanvas, type SimulationCanvasProps } from '../organisms/SimulationCanvas';
|
|
65
|
+
export { SimulationControls, type SimulationControlsProps } from '../organisms/SimulationControls';
|
|
66
|
+
export { SimulationGraph, type SimulationGraphProps, type MeasurementPoint } from '../organisms/SimulationGraph';
|
|
58
67
|
export type { PhysicsPreset, PhysicsBody, PhysicsConstraint } from '../../shared/lib/physicsTypes';
|
|
59
68
|
export { projectileMotion, pendulum, springOscillator, ALL_PRESETS } from '../../shared/lib/physicsPresets';
|
|
60
69
|
export { GameTemplate, type GameTemplateProps } from '../templates/GameTemplate';
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import type { EventKey } from '@almadar/core';
|
|
12
11
|
import type { SlotItemData } from './TraitSlot';
|
|
13
12
|
export interface SequenceBarProps {
|
|
14
13
|
/** The current sequence (sparse — undefined means empty slot) */
|
|
@@ -16,13 +15,9 @@ export interface SequenceBarProps {
|
|
|
16
15
|
/** Max number of slots */
|
|
17
16
|
maxSlots: number;
|
|
18
17
|
/** Called when an item is dropped into slot at index */
|
|
19
|
-
onSlotDrop
|
|
18
|
+
onSlotDrop: (index: number, item: SlotItemData) => void;
|
|
20
19
|
/** Called when a slot is cleared */
|
|
21
|
-
onSlotRemove
|
|
22
|
-
/** Declarative event — emits UI:{slotDropEvent} with { slotIndex, actionId } on drop */
|
|
23
|
-
slotDropEvent?: EventKey;
|
|
24
|
-
/** Declarative event — emits UI:{slotRemoveEvent} with { slotIndex } on clear */
|
|
25
|
-
slotRemoveEvent?: EventKey;
|
|
20
|
+
onSlotRemove: (index: number) => void;
|
|
26
21
|
/** Whether the sequence is currently playing (disable interaction) */
|
|
27
22
|
playing?: boolean;
|
|
28
23
|
/** Current step index during playback (-1 = not playing) */
|
|
@@ -39,7 +34,7 @@ export interface SequenceBarProps {
|
|
|
39
34
|
/** Additional CSS classes */
|
|
40
35
|
className?: string;
|
|
41
36
|
}
|
|
42
|
-
export declare function SequenceBar({ slots, maxSlots, onSlotDrop, onSlotRemove,
|
|
37
|
+
export declare function SequenceBar({ slots, maxSlots, onSlotDrop, onSlotRemove, playing, currentStep, categoryColors, slotFeedback, size, className, }: SequenceBarProps): React.JSX.Element;
|
|
43
38
|
export declare namespace SequenceBar {
|
|
44
39
|
var displayName: string;
|
|
45
40
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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;
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
import type { EntityWith } from '@almadar/core';
|
|
12
|
-
import type { RuleDefinition, RuleOption } from '../../2d/
|
|
12
|
+
import type { RuleDefinition, RuleOption } from '../../2d/organisms/RuleEditor';
|
|
13
13
|
type PuzzleObjectRow = EntityWith<{
|
|
14
14
|
name?: string;
|
|
15
15
|
icon?: string;
|