@almadar/ui 5.21.11 → 5.22.2
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 +939 -638
- package/dist/avl/index.js +939 -638
- package/dist/components/core/molecules/CalendarGrid.d.ts +3 -10
- package/dist/components/core/molecules/ContentRenderer.d.ts +2 -2
- package/dist/components/core/molecules/DataGrid.d.ts +11 -20
- package/dist/components/core/molecules/DataList.d.ts +9 -15
- package/dist/components/core/molecules/FormSection.d.ts +4 -4
- package/dist/components/core/molecules/PositionedCanvas.d.ts +4 -17
- package/dist/components/core/molecules/ReplyTree.d.ts +2 -13
- package/dist/components/core/molecules/RichBlockEditor.d.ts +3 -6
- package/dist/components/core/molecules/SortableList.d.ts +7 -5
- package/dist/components/core/molecules/TableView.d.ts +7 -7
- package/dist/components/core/molecules/index.d.ts +3 -3
- package/dist/components/core/molecules/useDataDnd.d.ts +5 -5
- package/dist/components/core/organisms/CardGrid.d.ts +5 -2
- package/dist/components/core/organisms/CaseStudyOrganism.d.ts +4 -3
- package/dist/components/core/organisms/DataTable.d.ts +4 -2
- package/dist/components/core/organisms/DetailPanel.d.ts +6 -6
- package/dist/components/core/organisms/FeatureGridOrganism.d.ts +4 -3
- package/dist/components/core/organisms/HeroOrganism.d.ts +4 -5
- package/dist/components/core/organisms/List.d.ts +5 -2
- package/dist/components/core/organisms/MasterDetail.d.ts +4 -2
- package/dist/components/core/organisms/MediaGallery.d.ts +4 -2
- package/dist/components/core/organisms/ShowcaseOrganism.d.ts +4 -3
- package/dist/components/core/organisms/StatCard.d.ts +5 -2
- package/dist/components/core/organisms/StepFlowOrganism.d.ts +4 -3
- package/dist/components/core/organisms/Timeline.d.ts +2 -2
- package/dist/components/core/organisms/book/index.d.ts +1 -1
- package/dist/components/core/organisms/book/types.d.ts +28 -48
- package/dist/components/core/organisms/index.d.ts +1 -2
- package/dist/components/core/organisms/layout/DashboardGrid.d.ts +2 -2
- package/dist/components/core/organisms/marketing-types.d.ts +5 -94
- package/dist/components/core/organisms/types.d.ts +9 -27
- package/dist/components/core/templates/index.d.ts +6 -6
- package/dist/components/game/organisms/BattleBoard.d.ts +14 -90
- package/dist/components/game/organisms/CastleBoard.d.ts +7 -21
- package/dist/components/game/organisms/UncontrolledBattleBoard.d.ts +2 -7
- package/dist/components/game/organisms/WorldMapBoard.d.ts +13 -59
- package/dist/components/game/organisms/boardEntity.d.ts +44 -0
- package/dist/components/game/organisms/hooks/useBattleState.d.ts +7 -7
- package/dist/components/game/organisms/index.d.ts +3 -3
- package/dist/components/game/organisms/puzzles/builder/BuilderBoard.d.ts +7 -20
- package/dist/components/game/organisms/puzzles/builder/index.d.ts +1 -1
- package/dist/components/game/organisms/puzzles/classifier/ClassifierBoard.d.ts +7 -20
- package/dist/components/game/organisms/puzzles/classifier/index.d.ts +1 -1
- package/dist/components/game/organisms/puzzles/debugger/DebuggerBoard.d.ts +6 -22
- package/dist/components/game/organisms/puzzles/debugger/index.d.ts +1 -1
- package/dist/components/game/organisms/puzzles/event-handler/EventHandlerBoard.d.ts +6 -33
- package/dist/components/game/organisms/puzzles/event-handler/ObjectRulePanel.d.ts +3 -21
- package/dist/components/game/organisms/puzzles/event-handler/index.d.ts +2 -2
- package/dist/components/game/organisms/puzzles/event-handler/puzzleObject.d.ts +21 -0
- package/dist/components/game/organisms/puzzles/negotiator/NegotiatorBoard.d.ts +8 -24
- package/dist/components/game/organisms/puzzles/negotiator/index.d.ts +1 -1
- package/dist/components/game/organisms/puzzles/sequencer/ActionTile.d.ts +2 -2
- package/dist/components/game/organisms/puzzles/sequencer/SequencerBoard.d.ts +7 -36
- package/dist/components/game/organisms/puzzles/sequencer/index.d.ts +1 -1
- package/dist/components/game/organisms/puzzles/simulator/SimulatorBoard.d.ts +6 -25
- package/dist/components/game/organisms/puzzles/simulator/index.d.ts +1 -1
- package/dist/components/game/organisms/puzzles/state-architect/StateArchitectBoard.d.ts +7 -40
- package/dist/components/game/organisms/puzzles/state-architect/VariablePanel.d.ts +3 -9
- package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
- package/dist/components/game/organisms/three/index.cjs +35 -21
- package/dist/components/game/organisms/three/index.js +35 -21
- package/dist/components/game/templates/BattleTemplate.d.ts +2 -3
- package/dist/components/game/templates/CastleTemplate.d.ts +2 -3
- package/dist/components/game/templates/GameCanvas3DBattleTemplate.d.ts +1 -16
- package/dist/components/game/templates/GameCanvas3DCastleTemplate.d.ts +1 -18
- package/dist/components/game/templates/GameCanvas3DWorldMapTemplate.d.ts +1 -14
- package/dist/components/game/templates/GameTemplate.d.ts +1 -6
- package/dist/components/game/templates/WorldMapTemplate.d.ts +2 -3
- package/dist/components/index.cjs +2036 -1675
- package/dist/components/index.js +1148 -787
- package/dist/components/marketing/organisms/PricingOrganism.d.ts +4 -3
- package/dist/components/marketing/organisms/StatsOrganism.d.ts +4 -3
- package/dist/components/marketing/organisms/TeamOrganism.d.ts +4 -3
- package/dist/components/marketing/organisms/book/BookChapterView.d.ts +5 -2
- package/dist/components/marketing/organisms/book/BookTableOfContents.d.ts +3 -2
- package/dist/components/marketing/organisms/book/BookViewer.d.ts +4 -4
- package/dist/components/marketing/templates/AboutPageTemplate.d.ts +32 -6
- package/dist/components/marketing/templates/FeatureDetailPageTemplate.d.ts +14 -4
- package/dist/components/marketing/templates/LandingPageTemplate.d.ts +47 -9
- package/dist/components/marketing/templates/PricingPageTemplate.d.ts +23 -5
- package/dist/providers/index.cjs +932 -631
- package/dist/providers/index.js +932 -631
- package/dist/runtime/index.cjs +934 -633
- package/dist/runtime/index.js +934 -633
- package/package.json +2 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* boardEntity — tiny coercion helpers for reading `EntityRow` data inside game
|
|
3
|
+
* boards.
|
|
4
|
+
*
|
|
5
|
+
* The single entity type is `@almadar/core`'s `EntityRow`
|
|
6
|
+
* (`{ id?: string } & Record<string, FieldValue | undefined>`). Boards read
|
|
7
|
+
* deeply-nested, weakly-typed fields off it; these helpers narrow scalars,
|
|
8
|
+
* arrays, and small positional objects without reintroducing private entity
|
|
9
|
+
* interfaces. None of these are entity types — they are pure value coercers.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import type { EntityRow } from '@almadar/core';
|
|
14
|
+
/** A 2D grid position read off an entity row. */
|
|
15
|
+
export interface Vec2 {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
/** Lightweight trait-display shape carried on unit-like rows (UI value DTO). */
|
|
20
|
+
export interface TeamUnitTraits {
|
|
21
|
+
name: string;
|
|
22
|
+
currentState: string;
|
|
23
|
+
states: string[];
|
|
24
|
+
cooldown?: number;
|
|
25
|
+
}
|
|
26
|
+
/** Resolve the single board-state entity row from a prop that may be a row,
|
|
27
|
+
* an array of rows, or undefined. Boards operate on one board state. */
|
|
28
|
+
export declare function boardEntity(entity: EntityRow | readonly EntityRow[] | undefined): EntityRow | undefined;
|
|
29
|
+
/** Coerce a field value to a string (empty string when absent). */
|
|
30
|
+
export declare function str(v: unknown): string;
|
|
31
|
+
/** Coerce a field value to a number (0 when absent / non-numeric). */
|
|
32
|
+
export declare function num(v: unknown, fallback?: number): number;
|
|
33
|
+
/** Coerce a field value to a boolean. */
|
|
34
|
+
export declare function bool(v: unknown): boolean;
|
|
35
|
+
/** Coerce a nested array field to a readonly array of entity rows. */
|
|
36
|
+
export declare function rows(v: unknown): readonly EntityRow[];
|
|
37
|
+
/** Read an `{ x, y }` position off an entity row's named field. */
|
|
38
|
+
export declare function vec2(v: unknown): Vec2;
|
|
39
|
+
/** Read a unit row's `position` as a `Vec2`. */
|
|
40
|
+
export declare function unitPosition(u: EntityRow): Vec2;
|
|
41
|
+
/** Read a unit row's `team` ('player' | 'enemy' | string). */
|
|
42
|
+
export declare function unitTeam(u: EntityRow): string;
|
|
43
|
+
/** Read a unit row's `health`. */
|
|
44
|
+
export declare function unitHealth(u: EntityRow): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EventEmit } from '@almadar/core';
|
|
2
|
-
import type {
|
|
1
|
+
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
2
|
+
import type { BattlePhase } from '../BattleBoard';
|
|
3
3
|
export interface BattleStateEventConfig {
|
|
4
4
|
tileClickEvent?: EventEmit<{
|
|
5
5
|
x: number;
|
|
@@ -22,19 +22,19 @@ export interface BattleStateEventConfig {
|
|
|
22
22
|
}
|
|
23
23
|
export interface BattleStateCallbacks {
|
|
24
24
|
/** Called when a unit attacks another */
|
|
25
|
-
onAttack?: (attacker:
|
|
25
|
+
onAttack?: (attacker: EntityRow, target: EntityRow, damage: number) => void;
|
|
26
26
|
/** Called when battle ends */
|
|
27
27
|
onGameEnd?: (result: 'victory' | 'defeat') => void;
|
|
28
28
|
/** Called after a unit moves */
|
|
29
|
-
onUnitMove?: (unit:
|
|
29
|
+
onUnitMove?: (unit: EntityRow, to: {
|
|
30
30
|
x: number;
|
|
31
31
|
y: number;
|
|
32
32
|
}) => void;
|
|
33
33
|
/** Custom combat damage calculator */
|
|
34
|
-
calculateDamage?: (attacker:
|
|
34
|
+
calculateDamage?: (attacker: EntityRow, target: EntityRow) => number;
|
|
35
35
|
}
|
|
36
36
|
export interface BattleStateResult {
|
|
37
|
-
units:
|
|
37
|
+
units: EntityRow[];
|
|
38
38
|
selectedUnitId: string | null;
|
|
39
39
|
phase: BattlePhase;
|
|
40
40
|
turn: number;
|
|
@@ -44,4 +44,4 @@ export interface BattleStateResult {
|
|
|
44
44
|
handleEndTurn: () => void;
|
|
45
45
|
handleRestart: () => void;
|
|
46
46
|
}
|
|
47
|
-
export declare function useBattleState(initialUnits:
|
|
47
|
+
export declare function useBattleState(initialUnits: EntityRow[], eventConfig?: BattleStateEventConfig, callbacks?: BattleStateCallbacks): BattleStateResult;
|
|
@@ -27,11 +27,11 @@ export { GameMenu, type GameMenuProps, type MenuOption } from './GameMenu';
|
|
|
27
27
|
export { GameOverScreen, type GameOverScreenProps, type GameOverStat, type GameOverAction } from './GameOverScreen';
|
|
28
28
|
export { InventoryPanel, type InventoryPanelProps, type InventoryItem } from './InventoryPanel';
|
|
29
29
|
export { DialogueBox, type DialogueBoxProps, type DialogueNode, type DialogueChoice } from './DialogueBox';
|
|
30
|
-
export { BattleBoard, type BattleBoardProps, type
|
|
30
|
+
export { BattleBoard, type BattleBoardProps, type BattlePhase, type BattleSlotContext, } from './BattleBoard';
|
|
31
31
|
export { UncontrolledBattleBoard, type UncontrolledBattleBoardProps, } from './UncontrolledBattleBoard';
|
|
32
32
|
export { useBattleState, type BattleStateEventConfig, type BattleStateCallbacks, type BattleStateResult, } from './hooks/useBattleState';
|
|
33
|
-
export { WorldMapBoard, type WorldMapBoardProps, type
|
|
34
|
-
export { CastleBoard, type CastleBoardProps, type
|
|
33
|
+
export { WorldMapBoard, type WorldMapBoardProps, type WorldMapSlotContext, } from './WorldMapBoard';
|
|
34
|
+
export { CastleBoard, type CastleBoardProps, type CastleSlotContext, } from './CastleBoard';
|
|
35
35
|
export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from './TraitStateViewer';
|
|
36
36
|
export { TraitSlot, type TraitSlotProps, type SlotItemData, } from './TraitSlot';
|
|
37
37
|
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 './editor';
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
13
|
-
import type {
|
|
13
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
14
|
+
/** A draggable build component (UI value DTO read off the entity). */
|
|
14
15
|
export interface BuilderComponent {
|
|
15
16
|
id: string;
|
|
16
17
|
label: string;
|
|
@@ -20,31 +21,17 @@ export interface BuilderComponent {
|
|
|
20
21
|
iconUrl?: string;
|
|
21
22
|
category?: string;
|
|
22
23
|
}
|
|
24
|
+
/** A blueprint slot accepting a component (UI value DTO read off the entity). */
|
|
23
25
|
export interface BuilderSlot {
|
|
24
26
|
id: string;
|
|
25
27
|
label: string;
|
|
26
28
|
description?: string;
|
|
27
29
|
acceptsComponentId: string;
|
|
28
30
|
}
|
|
29
|
-
export interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
components: BuilderComponent[];
|
|
34
|
-
slots: BuilderSlot[];
|
|
35
|
-
successMessage?: string;
|
|
36
|
-
failMessage?: string;
|
|
37
|
-
hint?: string;
|
|
38
|
-
/** Header image URL displayed above the title */
|
|
39
|
-
headerImage?: string;
|
|
40
|
-
/** Visual theme overrides */
|
|
41
|
-
theme?: {
|
|
42
|
-
background?: string;
|
|
43
|
-
accentColor?: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export interface BuilderBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
47
|
-
entity?: BuilderPuzzleEntity | EntityRow | readonly (BuilderPuzzleEntity | EntityRow)[];
|
|
31
|
+
export interface BuilderBoardProps extends DisplayStateProps {
|
|
32
|
+
/** Puzzle board-state entity (single row or array). The board reads
|
|
33
|
+
* `components` / `slots` arrays plus title/description/hint off the row. */
|
|
34
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
48
35
|
completeEvent?: EventEmit<{
|
|
49
36
|
success: boolean;
|
|
50
37
|
attempts: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { BuilderBoard } from './BuilderBoard';
|
|
2
|
-
export type { BuilderBoardProps,
|
|
2
|
+
export type { BuilderBoardProps, BuilderComponent, BuilderSlot } from './BuilderBoard';
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
14
|
-
import type {
|
|
14
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
15
|
+
/** A sortable item (UI value DTO read off the entity). */
|
|
15
16
|
export interface ClassifierItem {
|
|
16
17
|
id: string;
|
|
17
18
|
label: string;
|
|
@@ -20,6 +21,7 @@ export interface ClassifierItem {
|
|
|
20
21
|
/** Image URL icon for story-specific visual skin */
|
|
21
22
|
iconUrl?: string;
|
|
22
23
|
}
|
|
24
|
+
/** A category bucket (UI value DTO read off the entity). */
|
|
23
25
|
export interface ClassifierCategory {
|
|
24
26
|
id: string;
|
|
25
27
|
label: string;
|
|
@@ -27,25 +29,10 @@ export interface ClassifierCategory {
|
|
|
27
29
|
/** Image URL for story-specific category header */
|
|
28
30
|
imageUrl?: string;
|
|
29
31
|
}
|
|
30
|
-
export interface
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
items: ClassifierItem[];
|
|
35
|
-
categories: ClassifierCategory[];
|
|
36
|
-
successMessage?: string;
|
|
37
|
-
failMessage?: string;
|
|
38
|
-
hint?: string;
|
|
39
|
-
/** Header image URL displayed above the title */
|
|
40
|
-
headerImage?: string;
|
|
41
|
-
/** Visual theme overrides */
|
|
42
|
-
theme?: {
|
|
43
|
-
background?: string;
|
|
44
|
-
accentColor?: string;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export interface ClassifierBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
48
|
-
entity?: ClassifierPuzzleEntity | EntityRow | readonly (ClassifierPuzzleEntity | EntityRow)[];
|
|
32
|
+
export interface ClassifierBoardProps extends DisplayStateProps {
|
|
33
|
+
/** Puzzle board-state entity (single row or array). The board reads
|
|
34
|
+
* `items` / `categories` arrays plus title/description/hint off the row. */
|
|
35
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
49
36
|
completeEvent?: EventEmit<{
|
|
50
37
|
success: boolean;
|
|
51
38
|
attempts: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ClassifierBoard } from './ClassifierBoard';
|
|
2
|
-
export type { ClassifierBoardProps,
|
|
2
|
+
export type { ClassifierBoardProps, ClassifierItem, ClassifierCategory } from './ClassifierBoard';
|
|
@@ -10,34 +10,18 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
13
|
-
import type {
|
|
13
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
14
|
+
/** A reviewable code line (UI value DTO read off the entity). */
|
|
14
15
|
export interface DebuggerLine {
|
|
15
16
|
id: string;
|
|
16
17
|
content: string;
|
|
17
18
|
isBug: boolean;
|
|
18
19
|
explanation?: string;
|
|
19
20
|
}
|
|
20
|
-
export interface
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
language?: string;
|
|
25
|
-
lines: DebuggerLine[];
|
|
26
|
-
/** How many bugs the player should find */
|
|
27
|
-
bugCount: number;
|
|
28
|
-
successMessage?: string;
|
|
29
|
-
failMessage?: string;
|
|
30
|
-
hint?: string;
|
|
31
|
-
/** Header image URL displayed above the title */
|
|
32
|
-
headerImage?: string;
|
|
33
|
-
/** Visual theme overrides */
|
|
34
|
-
theme?: {
|
|
35
|
-
background?: string;
|
|
36
|
-
accentColor?: string;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export interface DebuggerBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
40
|
-
entity?: DebuggerPuzzleEntity | EntityRow | readonly (DebuggerPuzzleEntity | EntityRow)[];
|
|
21
|
+
export interface DebuggerBoardProps extends DisplayStateProps {
|
|
22
|
+
/** Puzzle board-state entity (single row or array). The board reads
|
|
23
|
+
* `lines` array plus title/description/bugCount/hint off the row. */
|
|
24
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
41
25
|
completeEvent?: EventEmit<{
|
|
42
26
|
success: boolean;
|
|
43
27
|
attempts: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DebuggerBoard } from './DebuggerBoard';
|
|
2
|
-
export type { DebuggerBoardProps,
|
|
2
|
+
export type { DebuggerBoardProps, DebuggerLine } from './DebuggerBoard';
|
|
@@ -12,39 +12,12 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
15
|
-
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** Objects the kid can configure */
|
|
22
|
-
objects: PuzzleObjectDef[];
|
|
23
|
-
/** Goal condition description */
|
|
24
|
-
goalCondition: string;
|
|
25
|
-
/** Event that represents goal completion */
|
|
26
|
-
goalEvent: string;
|
|
27
|
-
/** Sequence of events that auto-fire to start the simulation */
|
|
28
|
-
triggerEvents?: string[];
|
|
29
|
-
/** Feedback */
|
|
30
|
-
successMessage?: string;
|
|
31
|
-
failMessage?: string;
|
|
32
|
-
/** Progressive hint shown after 3 failures */
|
|
33
|
-
hint?: string;
|
|
34
|
-
/** Header image URL displayed above the title */
|
|
35
|
-
headerImage?: string;
|
|
36
|
-
/** Visual theme overrides */
|
|
37
|
-
theme?: {
|
|
38
|
-
background?: string;
|
|
39
|
-
accentColor?: string;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export interface EventHandlerBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
43
|
-
/** Puzzle data. The compiler binds the generic `EntityRow`, so the inlet
|
|
44
|
-
* accepts it (and arrays) as union members; the component narrows to its
|
|
45
|
-
* curated `EventHandlerPuzzleEntity` read-shape below (a valid
|
|
46
|
-
* union-narrow) and renders nothing until a puzzle entity is present. */
|
|
47
|
-
entity?: EventHandlerPuzzleEntity | EntityRow | readonly (EventHandlerPuzzleEntity | EntityRow)[];
|
|
15
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
16
|
+
export interface EventHandlerBoardProps extends DisplayStateProps {
|
|
17
|
+
/** Puzzle board-state entity (single row or array). The board reads
|
|
18
|
+
* `objects` / `triggerEvents` / `goalEvent` etc. off the row; the editable
|
|
19
|
+
* puzzle objects are themselves `EntityRow`s carried under `objects`. */
|
|
20
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
48
21
|
/** Playback speed in ms per event */
|
|
49
22
|
stepDurationMs?: number;
|
|
50
23
|
/** Emits UI:{playEvent} */
|
|
@@ -8,29 +8,11 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
+
import type { EntityRow } from '@almadar/core';
|
|
11
12
|
import { type RuleDefinition } from './RuleEditor';
|
|
12
|
-
export type PuzzleObjectDef = {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
icon: string;
|
|
16
|
-
states: string[];
|
|
17
|
-
initialState: string;
|
|
18
|
-
currentState: string;
|
|
19
|
-
availableEvents: Array<{
|
|
20
|
-
value: string;
|
|
21
|
-
label: string;
|
|
22
|
-
}>;
|
|
23
|
-
availableActions: Array<{
|
|
24
|
-
value: string;
|
|
25
|
-
label: string;
|
|
26
|
-
}>;
|
|
27
|
-
rules: RuleDefinition[];
|
|
28
|
-
/** Max rules allowed on this object */
|
|
29
|
-
maxRules?: number;
|
|
30
|
-
};
|
|
31
13
|
export interface ObjectRulePanelProps {
|
|
32
|
-
/** The selected object */
|
|
33
|
-
object:
|
|
14
|
+
/** The selected puzzle-object row (`EntityRow` carrying the editable object data) */
|
|
15
|
+
object: EntityRow;
|
|
34
16
|
/** Called when rules change */
|
|
35
17
|
onRulesChange: (objectId: string, rules: RuleDefinition[]) => void;
|
|
36
18
|
/** Whether editing is disabled */
|
|
@@ -3,6 +3,6 @@ export type { RuleEditorProps, RuleDefinition } from './RuleEditor';
|
|
|
3
3
|
export { EventLog } from './EventLog';
|
|
4
4
|
export type { EventLogProps, EventLogEntry } from './EventLog';
|
|
5
5
|
export { ObjectRulePanel } from './ObjectRulePanel';
|
|
6
|
-
export type { ObjectRulePanelProps
|
|
6
|
+
export type { ObjectRulePanelProps } from './ObjectRulePanel';
|
|
7
7
|
export { EventHandlerBoard } from './EventHandlerBoard';
|
|
8
|
-
export type { EventHandlerBoardProps
|
|
8
|
+
export type { EventHandlerBoardProps } from './EventHandlerBoard';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* puzzleObject — field accessors for reading Event-Handler puzzle-object data
|
|
3
|
+
* off an `EntityRow`.
|
|
4
|
+
*
|
|
5
|
+
* The puzzle objects the kid configures arrive as `entity.objects` (an array of
|
|
6
|
+
* `EntityRow`). These helpers narrow the weakly-typed fields the panel reads.
|
|
7
|
+
* `RuleDefinition` / `RuleOption` remain plain UI value DTOs (see `RuleEditor`).
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import type { EntityRow } from '@almadar/core';
|
|
12
|
+
import type { RuleDefinition, RuleOption } from './RuleEditor';
|
|
13
|
+
export declare function objId(o: EntityRow): string;
|
|
14
|
+
export declare function objName(o: EntityRow): string;
|
|
15
|
+
export declare function objIcon(o: EntityRow): string;
|
|
16
|
+
export declare function objStates(o: EntityRow): string[];
|
|
17
|
+
export declare function objCurrentState(o: EntityRow): string;
|
|
18
|
+
export declare function objAvailableEvents(o: EntityRow): RuleOption[];
|
|
19
|
+
export declare function objAvailableActions(o: EntityRow): RuleOption[];
|
|
20
|
+
export declare function objRules(o: EntityRow): RuleDefinition[];
|
|
21
|
+
export declare function objMaxRules(o: EntityRow): number;
|
|
@@ -12,41 +12,25 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
15
|
-
import type {
|
|
15
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
16
|
+
/** A selectable round action (UI value DTO read off the entity). */
|
|
16
17
|
export interface NegotiatorAction {
|
|
17
18
|
id: string;
|
|
18
19
|
label: string;
|
|
19
20
|
description?: string;
|
|
20
21
|
}
|
|
22
|
+
/** A payoff-matrix cell (UI value DTO read off the entity). */
|
|
21
23
|
export interface PayoffEntry {
|
|
22
24
|
playerAction: string;
|
|
23
25
|
opponentAction: string;
|
|
24
26
|
playerPayoff: number;
|
|
25
27
|
opponentPayoff: number;
|
|
26
28
|
}
|
|
27
|
-
export interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
payoffMatrix: PayoffEntry[];
|
|
33
|
-
totalRounds: number;
|
|
34
|
-
/** AI strategy: 'tit-for-tat' | 'always-cooperate' | 'always-defect' | 'random' */
|
|
35
|
-
opponentStrategy: string;
|
|
36
|
-
targetScore: number;
|
|
37
|
-
successMessage?: string;
|
|
38
|
-
failMessage?: string;
|
|
39
|
-
hint?: string;
|
|
40
|
-
/** Header image URL displayed above the title */
|
|
41
|
-
headerImage?: string;
|
|
42
|
-
/** Visual theme overrides */
|
|
43
|
-
theme?: {
|
|
44
|
-
background?: string;
|
|
45
|
-
accentColor?: string;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export interface NegotiatorBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
49
|
-
entity?: NegotiatorPuzzleEntity | EntityRow | readonly (NegotiatorPuzzleEntity | EntityRow)[];
|
|
29
|
+
export interface NegotiatorBoardProps extends DisplayStateProps {
|
|
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. */
|
|
33
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
50
34
|
completeEvent?: EventEmit<{
|
|
51
35
|
success: boolean;
|
|
52
36
|
score: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { NegotiatorBoard } from './NegotiatorBoard';
|
|
2
|
-
export type { NegotiatorBoardProps,
|
|
2
|
+
export type { NegotiatorBoardProps, NegotiatorAction, PayoffEntry } from './NegotiatorBoard';
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import type {
|
|
11
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
12
12
|
import type { SlotItemData } from '../../TraitSlot';
|
|
13
|
-
export interface ActionTileProps extends
|
|
13
|
+
export interface ActionTileProps extends DisplayStateProps {
|
|
14
14
|
/** The action data */
|
|
15
15
|
action: SlotItemData;
|
|
16
16
|
/** Size variant */
|
|
@@ -19,42 +19,13 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
22
|
-
import type {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
availableActions: SlotItemData[];
|
|
30
|
-
/** How many slots in the sequence bar */
|
|
31
|
-
maxSlots: number;
|
|
32
|
-
/** Whether actions can be reused */
|
|
33
|
-
allowDuplicates?: boolean;
|
|
34
|
-
/** The correct sequence(s) — list of action IDs. First match wins. */
|
|
35
|
-
solutions: string[][];
|
|
36
|
-
/** Feedback messages */
|
|
37
|
-
successMessage?: string;
|
|
38
|
-
failMessage?: string;
|
|
39
|
-
/** Progressive hint shown after 3 failures */
|
|
40
|
-
hint?: string;
|
|
41
|
-
/** Hex coordinates for map animation — one per action + starting position */
|
|
42
|
-
path?: Array<{
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
}>;
|
|
46
|
-
/** Header image URL displayed above the title */
|
|
47
|
-
headerImage?: string;
|
|
48
|
-
/** Visual theme overrides */
|
|
49
|
-
theme?: {
|
|
50
|
-
background?: string;
|
|
51
|
-
accentColor?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export interface SequencerBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
55
|
-
/** Puzzle data. Also accepts the canonical `EntityRow` the compiler binds
|
|
56
|
-
* (and arrays); narrowed to `SequencerPuzzleEntity` internally. */
|
|
57
|
-
entity?: SequencerPuzzleEntity | EntityRow | readonly (SequencerPuzzleEntity | EntityRow)[];
|
|
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[];
|
|
58
29
|
/** Category → color mapping */
|
|
59
30
|
categoryColors?: Record<string, {
|
|
60
31
|
bg: string;
|
|
@@ -5,4 +5,4 @@ export type { ActionPaletteProps } from './ActionPalette';
|
|
|
5
5
|
export { SequenceBar } from './SequenceBar';
|
|
6
6
|
export type { SequenceBarProps } from './SequenceBar';
|
|
7
7
|
export { SequencerBoard } from './SequencerBoard';
|
|
8
|
-
export type { SequencerBoardProps
|
|
8
|
+
export type { SequencerBoardProps } from './SequencerBoard';
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
14
|
-
import type {
|
|
14
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
15
|
+
/** A tunable simulation parameter (UI value DTO read off the entity). */
|
|
15
16
|
export interface SimulatorParameter {
|
|
16
17
|
id: string;
|
|
17
18
|
label: string;
|
|
@@ -23,30 +24,10 @@ export interface SimulatorParameter {
|
|
|
23
24
|
correct: number;
|
|
24
25
|
tolerance: number;
|
|
25
26
|
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
parameters: SimulatorParameter[];
|
|
31
|
-
outputLabel: string;
|
|
32
|
-
outputUnit: string;
|
|
33
|
-
/** Pure function body as string: receives params object, returns number */
|
|
34
|
-
computeExpression: string;
|
|
35
|
-
targetValue: number;
|
|
36
|
-
targetTolerance: number;
|
|
37
|
-
successMessage?: string;
|
|
38
|
-
failMessage?: string;
|
|
39
|
-
hint?: string;
|
|
40
|
-
/** Header image URL displayed above the title */
|
|
41
|
-
headerImage?: string;
|
|
42
|
-
/** Visual theme overrides */
|
|
43
|
-
theme?: {
|
|
44
|
-
background?: string;
|
|
45
|
-
accentColor?: string;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export interface SimulatorBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
49
|
-
entity?: SimulatorPuzzleEntity | EntityRow | readonly (SimulatorPuzzleEntity | EntityRow)[];
|
|
27
|
+
export interface SimulatorBoardProps extends DisplayStateProps {
|
|
28
|
+
/** Puzzle board-state entity (single row or array). The board reads the
|
|
29
|
+
* `parameters` array plus title/description/target/hint off the row. */
|
|
30
|
+
entity?: EntityRow | readonly EntityRow[];
|
|
50
31
|
completeEvent?: EventEmit<{
|
|
51
32
|
success: boolean;
|
|
52
33
|
attempts: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { SimulatorBoard } from './SimulatorBoard';
|
|
2
|
-
export type { SimulatorBoardProps,
|
|
2
|
+
export type { SimulatorBoardProps, SimulatorParameter } from './SimulatorBoard';
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import type { EventEmit, EntityRow } from '@almadar/core';
|
|
12
|
-
import type {
|
|
13
|
-
|
|
12
|
+
import type { DisplayStateProps } from '../../../../core/organisms/types';
|
|
13
|
+
/** A kid-built transition in the visual graph editor (UI value DTO). */
|
|
14
14
|
export interface StateArchitectTransition {
|
|
15
15
|
id: string;
|
|
16
16
|
from: string;
|
|
@@ -18,6 +18,7 @@ export interface StateArchitectTransition {
|
|
|
18
18
|
event: string;
|
|
19
19
|
guardHint?: string;
|
|
20
20
|
}
|
|
21
|
+
/** A puzzle test case (UI value DTO). */
|
|
21
22
|
export interface TestCase {
|
|
22
23
|
/** Sequence of events to fire */
|
|
23
24
|
events: string[];
|
|
@@ -26,44 +27,10 @@ export interface TestCase {
|
|
|
26
27
|
/** Description */
|
|
27
28
|
label: string;
|
|
28
29
|
}
|
|
29
|
-
export interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
hint: string;
|
|
34
|
-
/** Entity being designed */
|
|
35
|
-
entityName: string;
|
|
36
|
-
/** Variables with initial values */
|
|
37
|
-
variables: VariableDef[];
|
|
38
|
-
/** States provided (kid may need to add more) */
|
|
39
|
-
states: string[];
|
|
40
|
-
/** Initial state */
|
|
41
|
-
initialState: string;
|
|
42
|
-
/** Pre-existing transitions (puzzle may have some already) */
|
|
43
|
-
transitions: StateArchitectTransition[];
|
|
44
|
-
/** Events available to use */
|
|
45
|
-
availableEvents: string[];
|
|
46
|
-
/** States available to add */
|
|
47
|
-
availableStates?: string[];
|
|
48
|
-
/** Test cases to validate against */
|
|
49
|
-
testCases: TestCase[];
|
|
50
|
-
/** Show code view toggle */
|
|
51
|
-
showCodeView?: boolean;
|
|
52
|
-
/** Feedback */
|
|
53
|
-
successMessage?: string;
|
|
54
|
-
failMessage?: string;
|
|
55
|
-
/** Header image URL displayed above the title */
|
|
56
|
-
headerImage?: string;
|
|
57
|
-
/** Visual theme overrides */
|
|
58
|
-
theme?: {
|
|
59
|
-
background?: string;
|
|
60
|
-
accentColor?: string;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export interface StateArchitectBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
64
|
-
/** Puzzle data. Also accepts the canonical `EntityRow` the compiler binds
|
|
65
|
-
* (and arrays); narrowed to `StateArchitectPuzzleEntity` internally. */
|
|
66
|
-
entity?: StateArchitectPuzzleEntity | EntityRow | readonly (StateArchitectPuzzleEntity | EntityRow)[];
|
|
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[];
|
|
67
34
|
/** Playback speed */
|
|
68
35
|
stepDurationMs?: number;
|
|
69
36
|
/** Emits UI:{testEvent} */
|
|
@@ -6,18 +6,12 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
|
|
10
|
-
name: string;
|
|
11
|
-
value: number;
|
|
12
|
-
min?: number;
|
|
13
|
-
max?: number;
|
|
14
|
-
unit?: string;
|
|
15
|
-
}
|
|
9
|
+
import type { EntityRow } from '@almadar/core';
|
|
16
10
|
export interface VariablePanelProps {
|
|
17
11
|
/** Entity name */
|
|
18
12
|
entityName: string;
|
|
19
|
-
/**
|
|
20
|
-
variables:
|
|
13
|
+
/** Variable rows to display (`EntityRow` carrying name/value/min/max/unit) */
|
|
14
|
+
variables: readonly EntityRow[];
|
|
21
15
|
/** Additional CSS classes */
|
|
22
16
|
className?: string;
|
|
23
17
|
}
|
|
@@ -3,8 +3,8 @@ export type { StateNodeProps } from './StateNode';
|
|
|
3
3
|
export { TransitionArrow } from './TransitionArrow';
|
|
4
4
|
export type { TransitionArrowProps } from './TransitionArrow';
|
|
5
5
|
export { VariablePanel } from './VariablePanel';
|
|
6
|
-
export type { VariablePanelProps
|
|
6
|
+
export type { VariablePanelProps } from './VariablePanel';
|
|
7
7
|
export { CodeView } from './CodeView';
|
|
8
8
|
export type { CodeViewProps } from './CodeView';
|
|
9
9
|
export { StateArchitectBoard } from './StateArchitectBoard';
|
|
10
|
-
export type { StateArchitectBoardProps,
|
|
10
|
+
export type { StateArchitectBoardProps, StateArchitectTransition, TestCase, } from './StateArchitectBoard';
|