@almadar/ui 5.89.0 → 5.91.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 (26) hide show
  1. package/dist/avl/index.cjs +63 -65
  2. package/dist/avl/index.js +63 -65
  3. package/dist/components/game/2d/{organisms → molecules}/ObjectRulePanel.d.ts +9 -4
  4. package/dist/components/game/2d/molecules/StateJsonView.d.ts +37 -0
  5. package/dist/components/game/2d/{organisms → molecules}/TraitSlot.d.ts +6 -3
  6. package/dist/components/game/2d/{organisms → molecules}/TraitStateViewer.d.ts +0 -2
  7. package/dist/components/game/2d/molecules/VariablePanel.d.ts +28 -0
  8. package/dist/components/game/2d/molecules/index.d.ts +11 -11
  9. package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +1 -1
  10. package/dist/components/game/2d/organisms/SequenceBar.d.ts +1 -1
  11. package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
  12. package/dist/components/index.cjs +63 -65
  13. package/dist/components/index.js +63 -65
  14. package/dist/providers/index.cjs +63 -65
  15. package/dist/providers/index.js +63 -65
  16. package/dist/runtime/index.cjs +63 -65
  17. package/dist/runtime/index.js +63 -65
  18. package/package.json +1 -1
  19. package/dist/components/game/2d/organisms/StateJsonView.d.ts +0 -17
  20. package/dist/components/game/2d/organisms/VariablePanel.d.ts +0 -22
  21. /package/dist/components/game/2d/{organisms → molecules}/ActionPalette.d.ts +0 -0
  22. /package/dist/components/game/2d/{organisms → molecules}/ActionTile.d.ts +0 -0
  23. /package/dist/components/game/2d/{organisms → molecules}/EventLog.d.ts +0 -0
  24. /package/dist/components/game/2d/{organisms → molecules}/RuleEditor.d.ts +0 -0
  25. /package/dist/components/game/2d/{organisms → molecules}/StateNode.d.ts +0 -0
  26. /package/dist/components/game/2d/{organisms → molecules}/TransitionArrow.d.ts +0 -0
@@ -8,19 +8,24 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  import React from 'react';
11
- import type { EntityRow } from '@almadar/core';
11
+ import type { EntityRow, EventEmit } from '@almadar/core';
12
12
  import { type RuleDefinition } from './RuleEditor';
13
13
  export interface ObjectRulePanelProps {
14
14
  /** The selected puzzle-object row (`EntityRow` carrying the editable object data) */
15
15
  object: EntityRow;
16
- /** Called when rules change */
17
- onRulesChange: (objectId: string, rules: RuleDefinition[]) => void;
16
+ /** Called when rules change (callback path) */
17
+ onRulesChange?: (objectId: string, rules: RuleDefinition[]) => void;
18
+ /** Emits UI:{rulesChangeEvent} with { objectId, rules } when rules change (declarative path) */
19
+ rulesChangeEvent?: EventEmit<{
20
+ objectId: string;
21
+ rules: RuleDefinition[];
22
+ }>;
18
23
  /** Whether editing is disabled */
19
24
  disabled?: boolean;
20
25
  /** Additional CSS classes */
21
26
  className?: string;
22
27
  }
23
- export declare function ObjectRulePanel({ object, onRulesChange, disabled, className, }: ObjectRulePanelProps): React.JSX.Element;
28
+ export declare function ObjectRulePanel({ object, onRulesChange, rulesChangeEvent, disabled, className, }: ObjectRulePanelProps): React.JSX.Element;
24
29
  export declare namespace ObjectRulePanel {
25
30
  var displayName: string;
26
31
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * StateJsonView Component
3
+ *
4
+ * Shows a state machine's definition as an expandable code block, so the learner
5
+ * sees the declarative schema behind the visual graph. Dumb molecule: takes the
6
+ * machine as plain typed fields (name/states/initialState/transitions) — the
7
+ * .lolo organism owns the entity and the molecule renders + stringifies it.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import React from 'react';
12
+ export interface StateJsonTransition {
13
+ from: string;
14
+ to: string;
15
+ event: string;
16
+ }
17
+ export interface StateJsonViewProps {
18
+ /** Machine name */
19
+ name: string;
20
+ /** Initial state */
21
+ initialState: string;
22
+ /** All state names */
23
+ states: string[];
24
+ /** The player's wired transitions */
25
+ transitions: StateJsonTransition[];
26
+ /** Header label */
27
+ label?: string;
28
+ /** Whether the code block is expanded by default */
29
+ defaultExpanded?: boolean;
30
+ /** Additional CSS classes */
31
+ className?: string;
32
+ }
33
+ export declare function StateJsonView({ name, initialState, states, transitions, label, defaultExpanded, className, }: StateJsonViewProps): React.JSX.Element;
34
+ export declare namespace StateJsonView {
35
+ var displayName: string;
36
+ }
37
+ export default StateJsonView;
@@ -66,8 +66,6 @@ export interface TraitSlotProps {
66
66
  isLoading?: boolean;
67
67
  /** Error state */
68
68
  error?: UiError | null;
69
- /** Entity name for schema-driven auto-fetch */
70
- entity?: string;
71
69
  /** Called when an item is dropped on this slot */
72
70
  onItemDrop?: (item: SlotItemData) => void;
73
71
  /** Whether this slot's equipped item is draggable */
@@ -88,8 +86,13 @@ export interface TraitSlotProps {
88
86
  removeEvent?: EventEmit<{
89
87
  slotNumber: number;
90
88
  }>;
89
+ /** Emits UI:{dropEvent} with { slotNumber, itemId } when an item is dropped into this slot */
90
+ dropEvent?: EventEmit<{
91
+ slotNumber: number;
92
+ itemId: string;
93
+ }>;
91
94
  }
92
- export declare function TraitSlot({ slotNumber, equippedItem, locked, lockLabel, selected, size, showTooltip, categoryColors, tooltipFrameUrl, className, feedback, onItemDrop, draggable, onDragStart, onClick, onRemove, clickEvent, removeEvent, }: TraitSlotProps): React.JSX.Element;
95
+ export declare function TraitSlot({ slotNumber, equippedItem, locked, lockLabel, selected, size, showTooltip, categoryColors, tooltipFrameUrl, className, feedback, onItemDrop, draggable, onDragStart, onClick, onRemove, clickEvent, removeEvent, dropEvent, }: TraitSlotProps): React.JSX.Element;
93
96
  export declare namespace TraitSlot {
94
97
  var displayName: string;
95
98
  }
@@ -44,8 +44,6 @@ export interface TraitStateViewerProps {
44
44
  isLoading?: boolean;
45
45
  /** Error state */
46
46
  error?: UiError | null;
47
- /** Entity name for schema-driven auto-fetch */
48
- entity?: string;
49
47
  }
50
48
  export declare function TraitStateViewer({ trait, variant, size, showTransitions, onStateClick, stateStyles, className, }: TraitStateViewerProps): React.JSX.Element;
51
49
  export declare namespace TraitStateViewer {
@@ -0,0 +1,28 @@
1
+ /**
2
+ * VariablePanel Component
3
+ *
4
+ * Shows a machine's variables and their current values during State Architect
5
+ * playback. Dumb molecule: takes a plain typed list of { name, value } — the
6
+ * .lolo organism owns the entity data and passes it already flattened.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import React from 'react';
11
+ /** A single variable row (already flattened by the .lolo — plain strings). */
12
+ export interface VariablePanelVariable {
13
+ name: string;
14
+ value: string;
15
+ }
16
+ export interface VariablePanelProps {
17
+ /** Entity name shown in the header */
18
+ entityName: string;
19
+ /** Variable rows to display */
20
+ variables: VariablePanelVariable[];
21
+ /** Additional CSS classes */
22
+ className?: string;
23
+ }
24
+ export declare function VariablePanel({ entityName, variables, className, }: VariablePanelProps): React.JSX.Element;
25
+ export declare namespace VariablePanel {
26
+ var displayName: string;
27
+ }
28
+ export default VariablePanel;
@@ -39,22 +39,22 @@ export { GameAudioProvider, GameAudioContext, useGameAudioContext, type GameAudi
39
39
  export { GameAudioToggle, type GameAudioToggleProps, } from '../atoms/GameAudioToggle';
40
40
  export { useGameAudio, type AudioManifest, type SoundEntry, type GameAudioControls, type UseGameAudioOptions, } from '../../shared/hooks/useGameAudio';
41
41
  export { useCamera } from '../../shared/hooks/useCamera';
42
- export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from '../organisms/TraitStateViewer';
43
- export { TraitSlot, type TraitSlotProps, type SlotItemData, } from '../organisms/TraitSlot';
42
+ export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from './TraitStateViewer';
43
+ export { TraitSlot, type TraitSlotProps, type SlotItemData, } from './TraitSlot';
44
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';
45
- export { ActionTile, type ActionTileProps } from '../organisms/ActionTile';
46
- export { ActionPalette, type ActionPaletteProps } from '../organisms/ActionPalette';
45
+ export { ActionTile, type ActionTileProps } from './ActionTile';
46
+ export { ActionPalette, type ActionPaletteProps } from './ActionPalette';
47
47
  export { SequenceBar, type SequenceBarProps } from '../organisms/SequenceBar';
48
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';
49
+ export { RuleEditor, type RuleEditorProps, type RuleDefinition } from './RuleEditor';
50
+ export { EventLog, type EventLogProps, type EventLogEntry } from './EventLog';
51
+ export { ObjectRulePanel, type ObjectRulePanelProps } from './ObjectRulePanel';
52
52
  export { EventHandlerBoard, type EventHandlerBoardProps } from '../organisms/EventHandlerBoard';
53
53
  export * from '../../shared/lib/puzzleObject';
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';
54
+ export { StateNode, type StateNodeProps } from './StateNode';
55
+ export { TransitionArrow, type TransitionArrowProps } from './TransitionArrow';
56
+ export { VariablePanel, type VariablePanelProps } from './VariablePanel';
57
+ export { StateJsonView, type StateJsonViewProps } from './StateJsonView';
58
58
  export { StateArchitectBoard, type StateArchitectBoardProps, type StateArchitectTransition, type TestCase, } from '../organisms/StateArchitectBoard';
59
59
  export { SimulatorBoard, type SimulatorBoardProps, type SimulatorParameter } from '../organisms/SimulatorBoard';
60
60
  export { ClassifierBoard, type ClassifierBoardProps, type ClassifierItem, type ClassifierCategory } from '../organisms/ClassifierBoard';
@@ -13,7 +13,7 @@
13
13
  import React from 'react';
14
14
  import type { EventEmit, EntityRow } from '@almadar/core';
15
15
  import type { DisplayStateProps } from '../../../core/organisms/types';
16
- import type { RuleDefinition } from './RuleEditor';
16
+ import type { RuleDefinition } from '../molecules/RuleEditor';
17
17
  export interface EventHandlerBoardProps extends DisplayStateProps {
18
18
  /** Puzzle board-state entity (single row or array). The board reads
19
19
  * `objects` / `triggerEvents` / `goalEvent` etc. off the row; the editable
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  import React from 'react';
11
- import type { SlotItemData } from './TraitSlot';
11
+ import type { SlotItemData } from '../molecules/TraitSlot';
12
12
  export interface SequenceBarProps {
13
13
  /** The current sequence (sparse — undefined means empty slot) */
14
14
  slots: Array<SlotItemData | undefined>;
@@ -9,7 +9,7 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
  import type { EntityWith } from '@almadar/core';
12
- import type { RuleDefinition, RuleOption } from '../../2d/organisms/RuleEditor';
12
+ import type { RuleDefinition, RuleOption } from '../../2d/molecules/RuleEditor';
13
13
  type PuzzleObjectRow = EntityWith<{
14
14
  name?: string;
15
15
  icon?: string;
@@ -8148,7 +8148,7 @@ function ActionTile({
8148
8148
  }
8149
8149
  var DRAG_MIME, SIZE_CONFIG;
8150
8150
  var init_ActionTile = __esm({
8151
- "components/game/2d/organisms/ActionTile.tsx"() {
8151
+ "components/game/2d/molecules/ActionTile.tsx"() {
8152
8152
  init_atoms();
8153
8153
  init_cn();
8154
8154
  DRAG_MIME = "application/x-almadar-slot-item";
@@ -8185,7 +8185,7 @@ function ActionPalette({
8185
8185
  ] });
8186
8186
  }
8187
8187
  var init_ActionPalette = __esm({
8188
- "components/game/2d/organisms/ActionPalette.tsx"() {
8188
+ "components/game/2d/molecules/ActionPalette.tsx"() {
8189
8189
  init_atoms();
8190
8190
  init_cn();
8191
8191
  init_ActionTile();
@@ -27884,7 +27884,7 @@ function StateNode2({
27884
27884
  );
27885
27885
  }
27886
27886
  var init_StateNode = __esm({
27887
- "components/game/2d/organisms/StateNode.tsx"() {
27887
+ "components/game/2d/molecules/StateNode.tsx"() {
27888
27888
  init_atoms();
27889
27889
  init_cn();
27890
27890
  StateNode2.displayName = "StateNode";
@@ -27956,7 +27956,7 @@ function TransitionArrow({
27956
27956
  }
27957
27957
  var NODE_RADIUS;
27958
27958
  var init_TransitionArrow = __esm({
27959
- "components/game/2d/organisms/TransitionArrow.tsx"() {
27959
+ "components/game/2d/molecules/TransitionArrow.tsx"() {
27960
27960
  init_cn();
27961
27961
  NODE_RADIUS = 40;
27962
27962
  TransitionArrow.displayName = "TransitionArrow";
@@ -28620,7 +28620,7 @@ function TraitStateViewer({
28620
28620
  }
28621
28621
  var SIZE_CONFIG2;
28622
28622
  var init_TraitStateViewer = __esm({
28623
- "components/game/2d/organisms/TraitStateViewer.tsx"() {
28623
+ "components/game/2d/molecules/TraitStateViewer.tsx"() {
28624
28624
  "use client";
28625
28625
  init_cn();
28626
28626
  init_Box();
@@ -28653,7 +28653,8 @@ function TraitSlot({
28653
28653
  onClick,
28654
28654
  onRemove,
28655
28655
  clickEvent,
28656
- removeEvent
28656
+ removeEvent,
28657
+ dropEvent
28657
28658
  }) {
28658
28659
  const { emit } = useEventBus();
28659
28660
  const [isHovered, setIsHovered] = React74.useState(false);
@@ -28685,29 +28686,30 @@ function TraitSlot({
28685
28686
  onDragStart?.(equippedItem);
28686
28687
  }, [equippedItem, draggable, onDragStart]);
28687
28688
  const handleDragOver = React74.useCallback((e) => {
28688
- if (locked || !onItemDrop) return;
28689
+ if (locked || !onItemDrop && !dropEvent) return;
28689
28690
  if (e.dataTransfer.types.includes(DRAG_MIME2)) {
28690
28691
  e.preventDefault();
28691
28692
  const allowed = e.dataTransfer.effectAllowed;
28692
28693
  e.dataTransfer.dropEffect = allowed === "copy" ? "copy" : "move";
28693
28694
  setIsDragOver(true);
28694
28695
  }
28695
- }, [locked, onItemDrop]);
28696
+ }, [locked, onItemDrop, dropEvent]);
28696
28697
  const handleDragLeave = React74.useCallback(() => {
28697
28698
  setIsDragOver(false);
28698
28699
  }, []);
28699
28700
  const handleDrop = React74.useCallback((e) => {
28700
28701
  e.preventDefault();
28701
28702
  setIsDragOver(false);
28702
- if (locked || !onItemDrop) return;
28703
+ if (locked || !onItemDrop && !dropEvent) return;
28703
28704
  const raw = e.dataTransfer.getData(DRAG_MIME2);
28704
28705
  if (!raw) return;
28705
28706
  try {
28706
28707
  const item = JSON.parse(raw);
28707
- onItemDrop(item);
28708
+ if (dropEvent) emit(`UI:${dropEvent}`, { slotNumber, itemId: item.id });
28709
+ else onItemDrop?.(item);
28708
28710
  } catch {
28709
28711
  }
28710
- }, [locked, onItemDrop]);
28712
+ }, [locked, onItemDrop, dropEvent, emit, slotNumber]);
28711
28713
  const getTooltipStyle = () => {
28712
28714
  if (!slotRef.current) return {};
28713
28715
  const rect = slotRef.current.getBoundingClientRect();
@@ -28827,7 +28829,7 @@ function TraitSlot({
28827
28829
  }
28828
28830
  var SIZE_CONFIG3, DRAG_MIME2;
28829
28831
  var init_TraitSlot = __esm({
28830
- "components/game/2d/organisms/TraitSlot.tsx"() {
28832
+ "components/game/2d/molecules/TraitSlot.tsx"() {
28831
28833
  "use client";
28832
28834
  init_cn();
28833
28835
  init_useEventBus();
@@ -29397,7 +29399,7 @@ function RuleEditor({
29397
29399
  ] });
29398
29400
  }
29399
29401
  var init_RuleEditor = __esm({
29400
- "components/game/2d/organisms/RuleEditor.tsx"() {
29402
+ "components/game/2d/molecules/RuleEditor.tsx"() {
29401
29403
  init_atoms();
29402
29404
  init_cn();
29403
29405
  RuleEditor.displayName = "RuleEditor";
@@ -29438,7 +29440,7 @@ function EventLog({
29438
29440
  }
29439
29441
  var STATUS_STYLES, STATUS_DOTS;
29440
29442
  var init_EventLog = __esm({
29441
- "components/game/2d/organisms/EventLog.tsx"() {
29443
+ "components/game/2d/molecules/EventLog.tsx"() {
29442
29444
  init_atoms();
29443
29445
  init_cn();
29444
29446
  STATUS_STYLES = {
@@ -29493,10 +29495,12 @@ var init_puzzleObject = __esm({
29493
29495
  function ObjectRulePanel({
29494
29496
  object,
29495
29497
  onRulesChange,
29498
+ rulesChangeEvent,
29496
29499
  disabled = false,
29497
29500
  className
29498
29501
  }) {
29499
29502
  const { t } = hooks.useTranslate();
29503
+ const { emit } = useEventBus();
29500
29504
  const id = objId(object);
29501
29505
  const name = objName(object);
29502
29506
  const icon = objIcon(object);
@@ -29507,15 +29511,19 @@ function ObjectRulePanel({
29507
29511
  const rules = objRules(object);
29508
29512
  const maxRules = objMaxRules(object);
29509
29513
  const canAdd = rules.length < maxRules;
29514
+ const emitRules = React74.useCallback((newRules) => {
29515
+ if (rulesChangeEvent) emit(`UI:${rulesChangeEvent}`, { objectId: id, rules: newRules });
29516
+ else onRulesChange?.(id, newRules);
29517
+ }, [rulesChangeEvent, emit, id, onRulesChange]);
29510
29518
  const handleRuleChange = React74.useCallback((index, updatedRule) => {
29511
29519
  const newRules = [...rules];
29512
29520
  newRules[index] = updatedRule;
29513
- onRulesChange(id, newRules);
29514
- }, [id, rules, onRulesChange]);
29521
+ emitRules(newRules);
29522
+ }, [rules, emitRules]);
29515
29523
  const handleRuleRemove = React74.useCallback((index) => {
29516
29524
  const newRules = rules.filter((_, i) => i !== index);
29517
- onRulesChange(id, newRules);
29518
- }, [id, rules, onRulesChange]);
29525
+ emitRules(newRules);
29526
+ }, [rules, emitRules]);
29519
29527
  const handleAddRule = React74.useCallback(() => {
29520
29528
  if (!canAdd || disabled) return;
29521
29529
  const firstEvent = availableEvents[0]?.value || "";
@@ -29525,8 +29533,8 @@ function ObjectRulePanel({
29525
29533
  whenEvent: firstEvent,
29526
29534
  thenAction: firstAction
29527
29535
  };
29528
- onRulesChange(id, [...rules, newRule]);
29529
- }, [canAdd, disabled, id, rules, availableEvents, availableActions, onRulesChange]);
29536
+ emitRules([...rules, newRule]);
29537
+ }, [canAdd, disabled, rules, availableEvents, availableActions, emitRules]);
29530
29538
  const machine = {
29531
29539
  name,
29532
29540
  states,
@@ -29566,9 +29574,10 @@ function ObjectRulePanel({
29566
29574
  }
29567
29575
  var nextRuleId;
29568
29576
  var init_ObjectRulePanel = __esm({
29569
- "components/game/2d/organisms/ObjectRulePanel.tsx"() {
29577
+ "components/game/2d/molecules/ObjectRulePanel.tsx"() {
29570
29578
  init_atoms();
29571
29579
  init_cn();
29580
+ init_useEventBus();
29572
29581
  init_TraitStateViewer();
29573
29582
  init_RuleEditor();
29574
29583
  init_puzzleObject();
@@ -29798,61 +29807,35 @@ function VariablePanel({
29798
29807
  const { t } = hooks.useTranslate();
29799
29808
  return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { className: cn("p-3 rounded-lg bg-card border border-border", className), gap: "sm", children: [
29800
29809
  /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.variables", { name: entityName }) }),
29801
- variables.map((v) => {
29802
- const name = v.name == null ? "" : String(v.name);
29803
- const value = numField(v.value);
29804
- const max = numField(v.max, 100);
29805
- const min = numField(v.min, 0);
29806
- const unit = v.unit == null ? "" : String(v.unit);
29807
- const pct = Math.round((value - min) / (max - min) * 100);
29808
- const isHigh = pct > 80;
29809
- const isLow = pct < 20;
29810
- return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "none", children: [
29811
- /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center justify-between", children: [
29812
- /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-foreground font-medium", children: name }),
29813
- /* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", className: cn(
29814
- isHigh ? "text-error" : isLow ? "text-warning" : "text-foreground"
29815
- ), children: [
29816
- value,
29817
- unit,
29818
- " / ",
29819
- max,
29820
- unit
29821
- ] })
29822
- ] }),
29823
- /* @__PURE__ */ jsxRuntime.jsx(
29824
- exports.ProgressBar,
29825
- {
29826
- value: pct,
29827
- color: isHigh ? "danger" : isLow ? "warning" : "primary",
29828
- size: "sm"
29829
- }
29830
- )
29831
- ] }, name);
29832
- })
29810
+ (variables ?? []).map((v) => /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center justify-between", children: [
29811
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-foreground font-medium", children: v.name }),
29812
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-accent font-mono", children: v.value })
29813
+ ] }, v.name))
29833
29814
  ] });
29834
29815
  }
29835
- var numField;
29836
29816
  var init_VariablePanel = __esm({
29837
- "components/game/2d/organisms/VariablePanel.tsx"() {
29817
+ "components/game/2d/molecules/VariablePanel.tsx"() {
29838
29818
  init_atoms();
29839
29819
  init_cn();
29840
- numField = (v, fallback = 0) => {
29841
- const n = Number(v);
29842
- return Number.isFinite(n) ? n : fallback;
29843
- };
29844
29820
  VariablePanel.displayName = "VariablePanel";
29845
29821
  }
29846
29822
  });
29847
29823
  function StateJsonView({
29848
- data,
29824
+ name,
29825
+ initialState,
29826
+ states,
29827
+ transitions,
29849
29828
  label,
29850
29829
  defaultExpanded = false,
29851
29830
  className
29852
29831
  }) {
29853
29832
  const { t } = hooks.useTranslate();
29854
29833
  const [expanded, setExpanded] = React74.useState(defaultExpanded);
29855
- const jsonString = JSON.stringify(data, null, 2);
29834
+ const jsonString = JSON.stringify(
29835
+ { name, initialState, states: states ?? [], transitions: transitions ?? [] },
29836
+ null,
29837
+ 2
29838
+ );
29856
29839
  return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
29857
29840
  /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
29858
29841
  /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
@@ -29869,7 +29852,7 @@ function StateJsonView({
29869
29852
  ] });
29870
29853
  }
29871
29854
  var init_StateJsonView = __esm({
29872
- "components/game/2d/organisms/StateJsonView.tsx"() {
29855
+ "components/game/2d/molecules/StateJsonView.tsx"() {
29873
29856
  init_atoms();
29874
29857
  init_cn();
29875
29858
  StateJsonView.displayName = "StateJsonView";
@@ -30038,7 +30021,7 @@ function StateArchitectBoard({
30038
30021
  setAddingFrom(null);
30039
30022
  if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
30040
30023
  }, [initialState, entityVariables, playAgainEvent, emit]);
30041
- const codeData = React74.useMemo(() => ({
30024
+ React74.useMemo(() => ({
30042
30025
  name: entityName,
30043
30026
  states: entityStates,
30044
30027
  initialState,
@@ -30173,7 +30156,7 @@ function StateArchitectBoard({
30173
30156
  VariablePanel,
30174
30157
  {
30175
30158
  entityName,
30176
- variables
30159
+ variables: variables.map((v) => ({ name: String(v.name ?? ""), value: String(v.value ?? "") }))
30177
30160
  }
30178
30161
  ),
30179
30162
  testResults.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
@@ -30184,7 +30167,16 @@ function StateArchitectBoard({
30184
30167
  !r.passed && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
30185
30168
  ] }, i))
30186
30169
  ] }),
30187
- resolved.showCodeView !== false && /* @__PURE__ */ jsxRuntime.jsx(StateJsonView, { data: codeData, label: "View Code" })
30170
+ resolved.showCodeView !== false && /* @__PURE__ */ jsxRuntime.jsx(
30171
+ StateJsonView,
30172
+ {
30173
+ name: entityName,
30174
+ initialState,
30175
+ states: entityStates,
30176
+ transitions: transitions.map((tr) => ({ from: tr.from, to: tr.to, event: tr.event })),
30177
+ label: "View Code"
30178
+ }
30179
+ )
30188
30180
  ] })
30189
30181
  ] }),
30190
30182
  isSuccess && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
@@ -48031,6 +48023,7 @@ var init_component_registry_generated = __esm({
48031
48023
  init_Navigation();
48032
48024
  init_NegotiatorBoard();
48033
48025
  init_NumberStepper();
48026
+ init_ObjectRulePanel();
48034
48027
  init_OptionConstraintGroup();
48035
48028
  init_OrbitalVisualization();
48036
48029
  init_Overlay();
@@ -48094,6 +48087,7 @@ var init_component_registry_generated = __esm({
48094
48087
  init_StateArchitectBoard();
48095
48088
  init_StateGraph();
48096
48089
  init_StateIndicator();
48090
+ init_StateJsonView();
48097
48091
  init_StateMachineView();
48098
48092
  init_StatsGrid();
48099
48093
  init_StatsOrganism();
@@ -48140,6 +48134,7 @@ var init_component_registry_generated = __esm({
48140
48134
  init_Typography();
48141
48135
  init_UISlotRenderer();
48142
48136
  init_UploadDropZone();
48137
+ init_VariablePanel();
48143
48138
  init_VersionDiff();
48144
48139
  init_ViolationAlert();
48145
48140
  init_VoteStack();
@@ -48340,6 +48335,7 @@ var init_component_registry_generated = __esm({
48340
48335
  "Navigation": exports.Navigation,
48341
48336
  "NegotiatorBoard": NegotiatorBoard,
48342
48337
  "NumberStepper": exports.NumberStepper,
48338
+ "ObjectRulePanel": ObjectRulePanel,
48343
48339
  "OptionConstraintGroup": exports.OptionConstraintGroup,
48344
48340
  "OrbitalVisualization": exports.OrbitalVisualization,
48345
48341
  "Overlay": exports.Overlay,
@@ -48406,6 +48402,7 @@ var init_component_registry_generated = __esm({
48406
48402
  "StateArchitectBoard": StateArchitectBoard,
48407
48403
  "StateGraph": StateGraph,
48408
48404
  "StateIndicator": StateIndicator,
48405
+ "StateJsonView": StateJsonView,
48409
48406
  "StateMachineView": exports.StateMachineView,
48410
48407
  "StatsGrid": exports.StatsGrid,
48411
48408
  "StatsOrganism": exports.StatsOrganism,
@@ -48453,6 +48450,7 @@ var init_component_registry_generated = __esm({
48453
48450
  "UISlotRenderer": UISlotRenderer,
48454
48451
  "UploadDropZone": exports.UploadDropZone,
48455
48452
  "VStack": exports.VStack,
48453
+ "VariablePanel": VariablePanel,
48456
48454
  "VersionDiff": exports.VersionDiff,
48457
48455
  "ViolationAlert": exports.ViolationAlert,
48458
48456
  "VoteStack": exports.VoteStack,