@almadar/ui 5.35.0 → 5.37.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.
@@ -21,23 +21,36 @@ export interface BuilderComponent {
21
21
  iconUrl?: AssetUrl;
22
22
  category?: string;
23
23
  }
24
- /** A blueprint slot accepting a component (UI value DTO read off the entity). */
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. */
25
27
  export interface BuilderSlot {
26
28
  id: string;
27
- label: string;
29
+ label?: string;
28
30
  description?: string;
29
- acceptsComponentId: string;
31
+ requiredComponentId: string;
32
+ placedComponentId?: string;
30
33
  }
31
34
  export interface BuilderBoardProps extends DisplayStateProps {
32
35
  /** Puzzle board-state entity (single row or array). The board reads
33
- * `components` / `slots` arrays plus title/description/hint off the row. */
36
+ * `components` / `slots` arrays plus `attempts` / `result` off the row
37
+ * the state machine is the single source of truth for placements. */
34
38
  entity?: EntityRow | readonly EntityRow[];
35
39
  completeEvent?: EventEmit<{
36
40
  success: boolean;
37
41
  attempts: number;
38
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>>;
39
52
  }
40
- export declare function BuilderBoard({ entity, completeEvent, className, }: BuilderBoardProps): React.JSX.Element | null;
53
+ export declare function BuilderBoard({ entity, completeEvent, placeEvent, checkEvent, playAgainEvent, className, }: BuilderBoardProps): React.JSX.Element | null;
41
54
  export declare namespace BuilderBoard {
42
55
  var displayName: string;
43
56
  }
@@ -7,7 +7,12 @@
7
7
  *
8
8
  * Good for: taxonomy, pattern recognition, sorting stories.
9
9
  *
10
- * Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
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.
11
16
  */
12
17
  import React from 'react';
13
18
  import type { AssetUrl, EventEmit, EntityRow } from '@almadar/core';
@@ -18,6 +23,8 @@ export interface ClassifierItem {
18
23
  label: string;
19
24
  description?: string;
20
25
  correctCategory: string;
26
+ /** Category the player has assigned (entity-provided; machine-owned). */
27
+ assignedCategory?: string;
21
28
  /** Image URL icon for story-specific visual skin */
22
29
  iconUrl?: AssetUrl;
23
30
  }
@@ -31,14 +38,25 @@ export interface ClassifierCategory {
31
38
  }
32
39
  export interface ClassifierBoardProps extends DisplayStateProps {
33
40
  /** Puzzle board-state entity (single row or array). The board reads
34
- * `items` / `categories` arrays plus title/description/hint off the row. */
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. */
35
44
  entity?: EntityRow | readonly EntityRow[];
36
45
  completeEvent?: EventEmit<{
37
46
  success: boolean;
38
47
  attempts: number;
39
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>>;
40
58
  }
41
- export declare function ClassifierBoard({ entity, completeEvent, className, }: ClassifierBoardProps): React.JSX.Element | null;
59
+ export declare function ClassifierBoard({ entity, completeEvent, assignEvent, checkEvent, playAgainEvent, className, }: ClassifierBoardProps): React.JSX.Element | null;
42
60
  export declare namespace ClassifierBoard {
43
61
  var displayName: string;
44
62
  }
@@ -16,18 +16,28 @@ export interface DebuggerLine {
16
16
  id: string;
17
17
  content: string;
18
18
  isBug: boolean;
19
+ isFlagged?: boolean;
19
20
  explanation?: string;
20
21
  }
21
22
  export interface DebuggerBoardProps extends DisplayStateProps {
22
23
  /** Puzzle board-state entity (single row or array). The board reads
23
- * `lines` array plus title/description/bugCount/hint off the row. */
24
+ * `lines` array (each with `isFlagged`), `result`, `attempts`, plus
25
+ * title/description/bugCount/hint off the row. */
24
26
  entity?: EntityRow | readonly EntityRow[];
25
27
  completeEvent?: EventEmit<{
26
28
  success: boolean;
27
29
  attempts: number;
28
30
  }>;
31
+ /** Emits UI:{toggleFlagEvent} with { lineId } when a line's bug-flag is toggled. */
32
+ toggleFlagEvent?: EventEmit<{
33
+ lineId: string;
34
+ }>;
35
+ /** Emits UI:{checkEvent} with {} when the player checks/submits. */
36
+ checkEvent?: EventEmit<Record<string, never>>;
37
+ /** Emits UI:{playAgainEvent} with {} on play again / reset. */
38
+ playAgainEvent?: EventEmit<Record<string, never>>;
29
39
  }
30
- export declare function DebuggerBoard({ entity, completeEvent, className, }: DebuggerBoardProps): React.JSX.Element | null;
40
+ export declare function DebuggerBoard({ entity, completeEvent, toggleFlagEvent, checkEvent, playAgainEvent, className, }: DebuggerBoardProps): React.JSX.Element | null;
31
41
  export declare namespace DebuggerBoard {
32
42
  var displayName: string;
33
43
  }
@@ -28,15 +28,25 @@ export interface PayoffEntry {
28
28
  }
29
29
  export interface NegotiatorBoardProps extends DisplayStateProps {
30
30
  /** Puzzle board-state entity (single row or array). The board reads
31
- * `actions` / `payoffMatrix` arrays plus title/description/rounds/hint off
32
- * the row. */
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. */
33
34
  entity?: EntityRow | readonly EntityRow[];
34
35
  completeEvent?: EventEmit<{
35
36
  success: boolean;
36
37
  score: number;
37
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>>;
38
48
  }
39
- export declare function NegotiatorBoard({ entity, completeEvent, className, }: NegotiatorBoardProps): React.JSX.Element | null;
49
+ export declare function NegotiatorBoard({ entity, completeEvent, playRoundEvent, finishEvent, playAgainEvent, className, }: NegotiatorBoardProps): React.JSX.Element | null;
40
50
  export declare namespace NegotiatorBoard {
41
51
  var displayName: string;
42
52
  }
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * SimulatorBoard
3
3
  *
4
- * Parameter-slider game board. The player adjusts parameters
5
- * and observes real-time output. Correct parameter values
6
- * must bring the output within a target range to win.
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
7
  *
8
8
  * Good for: physics, economics, system design stories.
9
9
  *
10
- * Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
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.
11
13
  */
12
14
  import React from 'react';
13
15
  import type { EventEmit, EntityRow } from '@almadar/core';
14
16
  import type { DisplayStateProps } from '../../../../core/organisms/types';
15
- /** A tunable simulation parameter (UI value DTO read off the entity). */
17
+ /** A tunable simulation parameter slider descriptor (UI value DTO read off the entity). */
16
18
  export interface SimulatorParameter {
17
19
  id: string;
18
20
  label: string;
@@ -26,14 +28,27 @@ export interface SimulatorParameter {
26
28
  }
27
29
  export interface SimulatorBoardProps extends DisplayStateProps {
28
30
  /** Puzzle board-state entity (single row or array). The board reads the
29
- * `parameters` array plus title/description/target/hint off the row. */
31
+ * `parameters` slider descriptors plus the machine-owned `paramA`/`paramB`/
32
+ * `output`/`target`/`tolerance`/`attempts`/`result` fields off the row. */
30
33
  entity?: EntityRow | readonly EntityRow[];
31
34
  completeEvent?: EventEmit<{
32
35
  success: boolean;
33
36
  attempts: number;
34
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>>;
35
50
  }
36
- export declare function SimulatorBoard({ entity, completeEvent, className, }: SimulatorBoardProps): React.JSX.Element | null;
51
+ export declare function SimulatorBoard({ entity, completeEvent, setAEvent, setBEvent, checkEvent, playAgainEvent, className, }: SimulatorBoardProps): React.JSX.Element | null;
37
52
  export declare namespace SimulatorBoard {
38
53
  var displayName: string;
39
54
  }