@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.
- package/dist/avl/index.cjs +63 -65
- package/dist/avl/index.js +63 -65
- package/dist/components/game/2d/{organisms → molecules}/ObjectRulePanel.d.ts +9 -4
- package/dist/components/game/2d/molecules/StateJsonView.d.ts +37 -0
- package/dist/components/game/2d/{organisms → molecules}/TraitSlot.d.ts +6 -3
- package/dist/components/game/2d/{organisms → molecules}/TraitStateViewer.d.ts +0 -2
- package/dist/components/game/2d/molecules/VariablePanel.d.ts +28 -0
- package/dist/components/game/2d/molecules/index.d.ts +11 -11
- package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +1 -1
- package/dist/components/game/2d/organisms/SequenceBar.d.ts +1 -1
- package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
- package/dist/components/index.cjs +63 -65
- package/dist/components/index.js +63 -65
- package/dist/providers/index.cjs +63 -65
- package/dist/providers/index.js +63 -65
- package/dist/runtime/index.cjs +63 -65
- package/dist/runtime/index.js +63 -65
- package/package.json +1 -1
- package/dist/components/game/2d/organisms/StateJsonView.d.ts +0 -17
- package/dist/components/game/2d/organisms/VariablePanel.d.ts +0 -22
- /package/dist/components/game/2d/{organisms → molecules}/ActionPalette.d.ts +0 -0
- /package/dist/components/game/2d/{organisms → molecules}/ActionTile.d.ts +0 -0
- /package/dist/components/game/2d/{organisms → molecules}/EventLog.d.ts +0 -0
- /package/dist/components/game/2d/{organisms → molecules}/RuleEditor.d.ts +0 -0
- /package/dist/components/game/2d/{organisms → molecules}/StateNode.d.ts +0 -0
- /package/dist/components/game/2d/{organisms → molecules}/TransitionArrow.d.ts +0 -0
package/dist/components/index.js
CHANGED
|
@@ -8102,7 +8102,7 @@ function ActionTile({
|
|
|
8102
8102
|
}
|
|
8103
8103
|
var DRAG_MIME, SIZE_CONFIG;
|
|
8104
8104
|
var init_ActionTile = __esm({
|
|
8105
|
-
"components/game/2d/
|
|
8105
|
+
"components/game/2d/molecules/ActionTile.tsx"() {
|
|
8106
8106
|
init_atoms();
|
|
8107
8107
|
init_cn();
|
|
8108
8108
|
DRAG_MIME = "application/x-almadar-slot-item";
|
|
@@ -8139,7 +8139,7 @@ function ActionPalette({
|
|
|
8139
8139
|
] });
|
|
8140
8140
|
}
|
|
8141
8141
|
var init_ActionPalette = __esm({
|
|
8142
|
-
"components/game/2d/
|
|
8142
|
+
"components/game/2d/molecules/ActionPalette.tsx"() {
|
|
8143
8143
|
init_atoms();
|
|
8144
8144
|
init_cn();
|
|
8145
8145
|
init_ActionTile();
|
|
@@ -27838,7 +27838,7 @@ function StateNode2({
|
|
|
27838
27838
|
);
|
|
27839
27839
|
}
|
|
27840
27840
|
var init_StateNode = __esm({
|
|
27841
|
-
"components/game/2d/
|
|
27841
|
+
"components/game/2d/molecules/StateNode.tsx"() {
|
|
27842
27842
|
init_atoms();
|
|
27843
27843
|
init_cn();
|
|
27844
27844
|
StateNode2.displayName = "StateNode";
|
|
@@ -27910,7 +27910,7 @@ function TransitionArrow({
|
|
|
27910
27910
|
}
|
|
27911
27911
|
var NODE_RADIUS;
|
|
27912
27912
|
var init_TransitionArrow = __esm({
|
|
27913
|
-
"components/game/2d/
|
|
27913
|
+
"components/game/2d/molecules/TransitionArrow.tsx"() {
|
|
27914
27914
|
init_cn();
|
|
27915
27915
|
NODE_RADIUS = 40;
|
|
27916
27916
|
TransitionArrow.displayName = "TransitionArrow";
|
|
@@ -28574,7 +28574,7 @@ function TraitStateViewer({
|
|
|
28574
28574
|
}
|
|
28575
28575
|
var SIZE_CONFIG2;
|
|
28576
28576
|
var init_TraitStateViewer = __esm({
|
|
28577
|
-
"components/game/2d/
|
|
28577
|
+
"components/game/2d/molecules/TraitStateViewer.tsx"() {
|
|
28578
28578
|
"use client";
|
|
28579
28579
|
init_cn();
|
|
28580
28580
|
init_Box();
|
|
@@ -28607,7 +28607,8 @@ function TraitSlot({
|
|
|
28607
28607
|
onClick,
|
|
28608
28608
|
onRemove,
|
|
28609
28609
|
clickEvent,
|
|
28610
|
-
removeEvent
|
|
28610
|
+
removeEvent,
|
|
28611
|
+
dropEvent
|
|
28611
28612
|
}) {
|
|
28612
28613
|
const { emit } = useEventBus();
|
|
28613
28614
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -28639,29 +28640,30 @@ function TraitSlot({
|
|
|
28639
28640
|
onDragStart?.(equippedItem);
|
|
28640
28641
|
}, [equippedItem, draggable, onDragStart]);
|
|
28641
28642
|
const handleDragOver = useCallback((e) => {
|
|
28642
|
-
if (locked || !onItemDrop) return;
|
|
28643
|
+
if (locked || !onItemDrop && !dropEvent) return;
|
|
28643
28644
|
if (e.dataTransfer.types.includes(DRAG_MIME2)) {
|
|
28644
28645
|
e.preventDefault();
|
|
28645
28646
|
const allowed = e.dataTransfer.effectAllowed;
|
|
28646
28647
|
e.dataTransfer.dropEffect = allowed === "copy" ? "copy" : "move";
|
|
28647
28648
|
setIsDragOver(true);
|
|
28648
28649
|
}
|
|
28649
|
-
}, [locked, onItemDrop]);
|
|
28650
|
+
}, [locked, onItemDrop, dropEvent]);
|
|
28650
28651
|
const handleDragLeave = useCallback(() => {
|
|
28651
28652
|
setIsDragOver(false);
|
|
28652
28653
|
}, []);
|
|
28653
28654
|
const handleDrop = useCallback((e) => {
|
|
28654
28655
|
e.preventDefault();
|
|
28655
28656
|
setIsDragOver(false);
|
|
28656
|
-
if (locked || !onItemDrop) return;
|
|
28657
|
+
if (locked || !onItemDrop && !dropEvent) return;
|
|
28657
28658
|
const raw = e.dataTransfer.getData(DRAG_MIME2);
|
|
28658
28659
|
if (!raw) return;
|
|
28659
28660
|
try {
|
|
28660
28661
|
const item = JSON.parse(raw);
|
|
28661
|
-
|
|
28662
|
+
if (dropEvent) emit(`UI:${dropEvent}`, { slotNumber, itemId: item.id });
|
|
28663
|
+
else onItemDrop?.(item);
|
|
28662
28664
|
} catch {
|
|
28663
28665
|
}
|
|
28664
|
-
}, [locked, onItemDrop]);
|
|
28666
|
+
}, [locked, onItemDrop, dropEvent, emit, slotNumber]);
|
|
28665
28667
|
const getTooltipStyle = () => {
|
|
28666
28668
|
if (!slotRef.current) return {};
|
|
28667
28669
|
const rect = slotRef.current.getBoundingClientRect();
|
|
@@ -28781,7 +28783,7 @@ function TraitSlot({
|
|
|
28781
28783
|
}
|
|
28782
28784
|
var SIZE_CONFIG3, DRAG_MIME2;
|
|
28783
28785
|
var init_TraitSlot = __esm({
|
|
28784
|
-
"components/game/2d/
|
|
28786
|
+
"components/game/2d/molecules/TraitSlot.tsx"() {
|
|
28785
28787
|
"use client";
|
|
28786
28788
|
init_cn();
|
|
28787
28789
|
init_useEventBus();
|
|
@@ -29351,7 +29353,7 @@ function RuleEditor({
|
|
|
29351
29353
|
] });
|
|
29352
29354
|
}
|
|
29353
29355
|
var init_RuleEditor = __esm({
|
|
29354
|
-
"components/game/2d/
|
|
29356
|
+
"components/game/2d/molecules/RuleEditor.tsx"() {
|
|
29355
29357
|
init_atoms();
|
|
29356
29358
|
init_cn();
|
|
29357
29359
|
RuleEditor.displayName = "RuleEditor";
|
|
@@ -29392,7 +29394,7 @@ function EventLog({
|
|
|
29392
29394
|
}
|
|
29393
29395
|
var STATUS_STYLES, STATUS_DOTS;
|
|
29394
29396
|
var init_EventLog = __esm({
|
|
29395
|
-
"components/game/2d/
|
|
29397
|
+
"components/game/2d/molecules/EventLog.tsx"() {
|
|
29396
29398
|
init_atoms();
|
|
29397
29399
|
init_cn();
|
|
29398
29400
|
STATUS_STYLES = {
|
|
@@ -29447,10 +29449,12 @@ var init_puzzleObject = __esm({
|
|
|
29447
29449
|
function ObjectRulePanel({
|
|
29448
29450
|
object,
|
|
29449
29451
|
onRulesChange,
|
|
29452
|
+
rulesChangeEvent,
|
|
29450
29453
|
disabled = false,
|
|
29451
29454
|
className
|
|
29452
29455
|
}) {
|
|
29453
29456
|
const { t } = useTranslate();
|
|
29457
|
+
const { emit } = useEventBus();
|
|
29454
29458
|
const id = objId(object);
|
|
29455
29459
|
const name = objName(object);
|
|
29456
29460
|
const icon = objIcon(object);
|
|
@@ -29461,15 +29465,19 @@ function ObjectRulePanel({
|
|
|
29461
29465
|
const rules = objRules(object);
|
|
29462
29466
|
const maxRules = objMaxRules(object);
|
|
29463
29467
|
const canAdd = rules.length < maxRules;
|
|
29468
|
+
const emitRules = useCallback((newRules) => {
|
|
29469
|
+
if (rulesChangeEvent) emit(`UI:${rulesChangeEvent}`, { objectId: id, rules: newRules });
|
|
29470
|
+
else onRulesChange?.(id, newRules);
|
|
29471
|
+
}, [rulesChangeEvent, emit, id, onRulesChange]);
|
|
29464
29472
|
const handleRuleChange = useCallback((index, updatedRule) => {
|
|
29465
29473
|
const newRules = [...rules];
|
|
29466
29474
|
newRules[index] = updatedRule;
|
|
29467
|
-
|
|
29468
|
-
}, [
|
|
29475
|
+
emitRules(newRules);
|
|
29476
|
+
}, [rules, emitRules]);
|
|
29469
29477
|
const handleRuleRemove = useCallback((index) => {
|
|
29470
29478
|
const newRules = rules.filter((_, i) => i !== index);
|
|
29471
|
-
|
|
29472
|
-
}, [
|
|
29479
|
+
emitRules(newRules);
|
|
29480
|
+
}, [rules, emitRules]);
|
|
29473
29481
|
const handleAddRule = useCallback(() => {
|
|
29474
29482
|
if (!canAdd || disabled) return;
|
|
29475
29483
|
const firstEvent = availableEvents[0]?.value || "";
|
|
@@ -29479,8 +29487,8 @@ function ObjectRulePanel({
|
|
|
29479
29487
|
whenEvent: firstEvent,
|
|
29480
29488
|
thenAction: firstAction
|
|
29481
29489
|
};
|
|
29482
|
-
|
|
29483
|
-
}, [canAdd, disabled,
|
|
29490
|
+
emitRules([...rules, newRule]);
|
|
29491
|
+
}, [canAdd, disabled, rules, availableEvents, availableActions, emitRules]);
|
|
29484
29492
|
const machine = {
|
|
29485
29493
|
name,
|
|
29486
29494
|
states,
|
|
@@ -29520,9 +29528,10 @@ function ObjectRulePanel({
|
|
|
29520
29528
|
}
|
|
29521
29529
|
var nextRuleId;
|
|
29522
29530
|
var init_ObjectRulePanel = __esm({
|
|
29523
|
-
"components/game/2d/
|
|
29531
|
+
"components/game/2d/molecules/ObjectRulePanel.tsx"() {
|
|
29524
29532
|
init_atoms();
|
|
29525
29533
|
init_cn();
|
|
29534
|
+
init_useEventBus();
|
|
29526
29535
|
init_TraitStateViewer();
|
|
29527
29536
|
init_RuleEditor();
|
|
29528
29537
|
init_puzzleObject();
|
|
@@ -29752,61 +29761,35 @@ function VariablePanel({
|
|
|
29752
29761
|
const { t } = useTranslate();
|
|
29753
29762
|
return /* @__PURE__ */ jsxs(VStack, { className: cn("p-3 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
29754
29763
|
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.variables", { name: entityName }) }),
|
|
29755
|
-
variables.map((v) => {
|
|
29756
|
-
|
|
29757
|
-
|
|
29758
|
-
|
|
29759
|
-
const min = numField(v.min, 0);
|
|
29760
|
-
const unit = v.unit == null ? "" : String(v.unit);
|
|
29761
|
-
const pct = Math.round((value - min) / (max - min) * 100);
|
|
29762
|
-
const isHigh = pct > 80;
|
|
29763
|
-
const isLow = pct < 20;
|
|
29764
|
-
return /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
29765
|
-
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
29766
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground font-medium", children: name }),
|
|
29767
|
-
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: cn(
|
|
29768
|
-
isHigh ? "text-error" : isLow ? "text-warning" : "text-foreground"
|
|
29769
|
-
), children: [
|
|
29770
|
-
value,
|
|
29771
|
-
unit,
|
|
29772
|
-
" / ",
|
|
29773
|
-
max,
|
|
29774
|
-
unit
|
|
29775
|
-
] })
|
|
29776
|
-
] }),
|
|
29777
|
-
/* @__PURE__ */ jsx(
|
|
29778
|
-
ProgressBar,
|
|
29779
|
-
{
|
|
29780
|
-
value: pct,
|
|
29781
|
-
color: isHigh ? "danger" : isLow ? "warning" : "primary",
|
|
29782
|
-
size: "sm"
|
|
29783
|
-
}
|
|
29784
|
-
)
|
|
29785
|
-
] }, name);
|
|
29786
|
-
})
|
|
29764
|
+
(variables ?? []).map((v) => /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
29765
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground font-medium", children: v.name }),
|
|
29766
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-mono", children: v.value })
|
|
29767
|
+
] }, v.name))
|
|
29787
29768
|
] });
|
|
29788
29769
|
}
|
|
29789
|
-
var numField;
|
|
29790
29770
|
var init_VariablePanel = __esm({
|
|
29791
|
-
"components/game/2d/
|
|
29771
|
+
"components/game/2d/molecules/VariablePanel.tsx"() {
|
|
29792
29772
|
init_atoms();
|
|
29793
29773
|
init_cn();
|
|
29794
|
-
numField = (v, fallback = 0) => {
|
|
29795
|
-
const n = Number(v);
|
|
29796
|
-
return Number.isFinite(n) ? n : fallback;
|
|
29797
|
-
};
|
|
29798
29774
|
VariablePanel.displayName = "VariablePanel";
|
|
29799
29775
|
}
|
|
29800
29776
|
});
|
|
29801
29777
|
function StateJsonView({
|
|
29802
|
-
|
|
29778
|
+
name,
|
|
29779
|
+
initialState,
|
|
29780
|
+
states,
|
|
29781
|
+
transitions,
|
|
29803
29782
|
label,
|
|
29804
29783
|
defaultExpanded = false,
|
|
29805
29784
|
className
|
|
29806
29785
|
}) {
|
|
29807
29786
|
const { t } = useTranslate();
|
|
29808
29787
|
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
29809
|
-
const jsonString = JSON.stringify(
|
|
29788
|
+
const jsonString = JSON.stringify(
|
|
29789
|
+
{ name, initialState, states: states ?? [], transitions: transitions ?? [] },
|
|
29790
|
+
null,
|
|
29791
|
+
2
|
|
29792
|
+
);
|
|
29810
29793
|
return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
|
|
29811
29794
|
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
|
|
29812
29795
|
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
|
|
@@ -29823,7 +29806,7 @@ function StateJsonView({
|
|
|
29823
29806
|
] });
|
|
29824
29807
|
}
|
|
29825
29808
|
var init_StateJsonView = __esm({
|
|
29826
|
-
"components/game/2d/
|
|
29809
|
+
"components/game/2d/molecules/StateJsonView.tsx"() {
|
|
29827
29810
|
init_atoms();
|
|
29828
29811
|
init_cn();
|
|
29829
29812
|
StateJsonView.displayName = "StateJsonView";
|
|
@@ -29992,7 +29975,7 @@ function StateArchitectBoard({
|
|
|
29992
29975
|
setAddingFrom(null);
|
|
29993
29976
|
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
29994
29977
|
}, [initialState, entityVariables, playAgainEvent, emit]);
|
|
29995
|
-
|
|
29978
|
+
useMemo(() => ({
|
|
29996
29979
|
name: entityName,
|
|
29997
29980
|
states: entityStates,
|
|
29998
29981
|
initialState,
|
|
@@ -30127,7 +30110,7 @@ function StateArchitectBoard({
|
|
|
30127
30110
|
VariablePanel,
|
|
30128
30111
|
{
|
|
30129
30112
|
entityName,
|
|
30130
|
-
variables
|
|
30113
|
+
variables: variables.map((v) => ({ name: String(v.name ?? ""), value: String(v.value ?? "") }))
|
|
30131
30114
|
}
|
|
30132
30115
|
),
|
|
30133
30116
|
testResults.length > 0 && /* @__PURE__ */ jsxs(VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
|
|
@@ -30138,7 +30121,16 @@ function StateArchitectBoard({
|
|
|
30138
30121
|
!r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
|
|
30139
30122
|
] }, i))
|
|
30140
30123
|
] }),
|
|
30141
|
-
resolved.showCodeView !== false && /* @__PURE__ */ jsx(
|
|
30124
|
+
resolved.showCodeView !== false && /* @__PURE__ */ jsx(
|
|
30125
|
+
StateJsonView,
|
|
30126
|
+
{
|
|
30127
|
+
name: entityName,
|
|
30128
|
+
initialState,
|
|
30129
|
+
states: entityStates,
|
|
30130
|
+
transitions: transitions.map((tr) => ({ from: tr.from, to: tr.to, event: tr.event })),
|
|
30131
|
+
label: "View Code"
|
|
30132
|
+
}
|
|
30133
|
+
)
|
|
30142
30134
|
] })
|
|
30143
30135
|
] }),
|
|
30144
30136
|
isSuccess && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
|
|
@@ -47985,6 +47977,7 @@ var init_component_registry_generated = __esm({
|
|
|
47985
47977
|
init_Navigation();
|
|
47986
47978
|
init_NegotiatorBoard();
|
|
47987
47979
|
init_NumberStepper();
|
|
47980
|
+
init_ObjectRulePanel();
|
|
47988
47981
|
init_OptionConstraintGroup();
|
|
47989
47982
|
init_OrbitalVisualization();
|
|
47990
47983
|
init_Overlay();
|
|
@@ -48048,6 +48041,7 @@ var init_component_registry_generated = __esm({
|
|
|
48048
48041
|
init_StateArchitectBoard();
|
|
48049
48042
|
init_StateGraph();
|
|
48050
48043
|
init_StateIndicator();
|
|
48044
|
+
init_StateJsonView();
|
|
48051
48045
|
init_StateMachineView();
|
|
48052
48046
|
init_StatsGrid();
|
|
48053
48047
|
init_StatsOrganism();
|
|
@@ -48094,6 +48088,7 @@ var init_component_registry_generated = __esm({
|
|
|
48094
48088
|
init_Typography();
|
|
48095
48089
|
init_UISlotRenderer();
|
|
48096
48090
|
init_UploadDropZone();
|
|
48091
|
+
init_VariablePanel();
|
|
48097
48092
|
init_VersionDiff();
|
|
48098
48093
|
init_ViolationAlert();
|
|
48099
48094
|
init_VoteStack();
|
|
@@ -48294,6 +48289,7 @@ var init_component_registry_generated = __esm({
|
|
|
48294
48289
|
"Navigation": Navigation,
|
|
48295
48290
|
"NegotiatorBoard": NegotiatorBoard,
|
|
48296
48291
|
"NumberStepper": NumberStepper,
|
|
48292
|
+
"ObjectRulePanel": ObjectRulePanel,
|
|
48297
48293
|
"OptionConstraintGroup": OptionConstraintGroup,
|
|
48298
48294
|
"OrbitalVisualization": OrbitalVisualization,
|
|
48299
48295
|
"Overlay": Overlay,
|
|
@@ -48360,6 +48356,7 @@ var init_component_registry_generated = __esm({
|
|
|
48360
48356
|
"StateArchitectBoard": StateArchitectBoard,
|
|
48361
48357
|
"StateGraph": StateGraph,
|
|
48362
48358
|
"StateIndicator": StateIndicator,
|
|
48359
|
+
"StateJsonView": StateJsonView,
|
|
48363
48360
|
"StateMachineView": StateMachineView,
|
|
48364
48361
|
"StatsGrid": StatsGrid,
|
|
48365
48362
|
"StatsOrganism": StatsOrganism,
|
|
@@ -48407,6 +48404,7 @@ var init_component_registry_generated = __esm({
|
|
|
48407
48404
|
"UISlotRenderer": UISlotRenderer,
|
|
48408
48405
|
"UploadDropZone": UploadDropZone,
|
|
48409
48406
|
"VStack": VStack,
|
|
48407
|
+
"VariablePanel": VariablePanel,
|
|
48410
48408
|
"VersionDiff": VersionDiff,
|
|
48411
48409
|
"ViolationAlert": ViolationAlert,
|
|
48412
48410
|
"VoteStack": VoteStack,
|
package/dist/providers/index.cjs
CHANGED
|
@@ -9482,7 +9482,7 @@ function StateNode({
|
|
|
9482
9482
|
);
|
|
9483
9483
|
}
|
|
9484
9484
|
var init_StateNode = __esm({
|
|
9485
|
-
"components/game/2d/
|
|
9485
|
+
"components/game/2d/molecules/StateNode.tsx"() {
|
|
9486
9486
|
init_atoms();
|
|
9487
9487
|
init_cn();
|
|
9488
9488
|
StateNode.displayName = "StateNode";
|
|
@@ -9554,7 +9554,7 @@ function TransitionArrow({
|
|
|
9554
9554
|
}
|
|
9555
9555
|
var NODE_RADIUS;
|
|
9556
9556
|
var init_TransitionArrow = __esm({
|
|
9557
|
-
"components/game/2d/
|
|
9557
|
+
"components/game/2d/molecules/TransitionArrow.tsx"() {
|
|
9558
9558
|
init_cn();
|
|
9559
9559
|
NODE_RADIUS = 40;
|
|
9560
9560
|
TransitionArrow.displayName = "TransitionArrow";
|
|
@@ -11438,7 +11438,7 @@ function TraitStateViewer({
|
|
|
11438
11438
|
}
|
|
11439
11439
|
var SIZE_CONFIG;
|
|
11440
11440
|
var init_TraitStateViewer = __esm({
|
|
11441
|
-
"components/game/2d/
|
|
11441
|
+
"components/game/2d/molecules/TraitStateViewer.tsx"() {
|
|
11442
11442
|
"use client";
|
|
11443
11443
|
init_cn();
|
|
11444
11444
|
init_Box();
|
|
@@ -11471,7 +11471,8 @@ function TraitSlot({
|
|
|
11471
11471
|
onClick,
|
|
11472
11472
|
onRemove,
|
|
11473
11473
|
clickEvent,
|
|
11474
|
-
removeEvent
|
|
11474
|
+
removeEvent,
|
|
11475
|
+
dropEvent
|
|
11475
11476
|
}) {
|
|
11476
11477
|
const { emit } = useEventBus();
|
|
11477
11478
|
const [isHovered, setIsHovered] = React98.useState(false);
|
|
@@ -11503,29 +11504,30 @@ function TraitSlot({
|
|
|
11503
11504
|
onDragStart?.(equippedItem);
|
|
11504
11505
|
}, [equippedItem, draggable, onDragStart]);
|
|
11505
11506
|
const handleDragOver = React98.useCallback((e) => {
|
|
11506
|
-
if (locked || !onItemDrop) return;
|
|
11507
|
+
if (locked || !onItemDrop && !dropEvent) return;
|
|
11507
11508
|
if (e.dataTransfer.types.includes(DRAG_MIME)) {
|
|
11508
11509
|
e.preventDefault();
|
|
11509
11510
|
const allowed = e.dataTransfer.effectAllowed;
|
|
11510
11511
|
e.dataTransfer.dropEffect = allowed === "copy" ? "copy" : "move";
|
|
11511
11512
|
setIsDragOver(true);
|
|
11512
11513
|
}
|
|
11513
|
-
}, [locked, onItemDrop]);
|
|
11514
|
+
}, [locked, onItemDrop, dropEvent]);
|
|
11514
11515
|
const handleDragLeave = React98.useCallback(() => {
|
|
11515
11516
|
setIsDragOver(false);
|
|
11516
11517
|
}, []);
|
|
11517
11518
|
const handleDrop = React98.useCallback((e) => {
|
|
11518
11519
|
e.preventDefault();
|
|
11519
11520
|
setIsDragOver(false);
|
|
11520
|
-
if (locked || !onItemDrop) return;
|
|
11521
|
+
if (locked || !onItemDrop && !dropEvent) return;
|
|
11521
11522
|
const raw = e.dataTransfer.getData(DRAG_MIME);
|
|
11522
11523
|
if (!raw) return;
|
|
11523
11524
|
try {
|
|
11524
11525
|
const item = JSON.parse(raw);
|
|
11525
|
-
|
|
11526
|
+
if (dropEvent) emit(`UI:${dropEvent}`, { slotNumber, itemId: item.id });
|
|
11527
|
+
else onItemDrop?.(item);
|
|
11526
11528
|
} catch {
|
|
11527
11529
|
}
|
|
11528
|
-
}, [locked, onItemDrop]);
|
|
11530
|
+
}, [locked, onItemDrop, dropEvent, emit, slotNumber]);
|
|
11529
11531
|
const getTooltipStyle = () => {
|
|
11530
11532
|
if (!slotRef.current) return {};
|
|
11531
11533
|
const rect = slotRef.current.getBoundingClientRect();
|
|
@@ -11645,7 +11647,7 @@ function TraitSlot({
|
|
|
11645
11647
|
}
|
|
11646
11648
|
var SIZE_CONFIG2, DRAG_MIME;
|
|
11647
11649
|
var init_TraitSlot = __esm({
|
|
11648
|
-
"components/game/2d/
|
|
11650
|
+
"components/game/2d/molecules/TraitSlot.tsx"() {
|
|
11649
11651
|
"use client";
|
|
11650
11652
|
init_cn();
|
|
11651
11653
|
init_useEventBus();
|
|
@@ -11704,7 +11706,7 @@ function ActionTile({
|
|
|
11704
11706
|
}
|
|
11705
11707
|
var DRAG_MIME2, SIZE_CONFIG3;
|
|
11706
11708
|
var init_ActionTile = __esm({
|
|
11707
|
-
"components/game/2d/
|
|
11709
|
+
"components/game/2d/molecules/ActionTile.tsx"() {
|
|
11708
11710
|
init_atoms();
|
|
11709
11711
|
init_cn();
|
|
11710
11712
|
DRAG_MIME2 = "application/x-almadar-slot-item";
|
|
@@ -11741,7 +11743,7 @@ function ActionPalette({
|
|
|
11741
11743
|
] });
|
|
11742
11744
|
}
|
|
11743
11745
|
var init_ActionPalette = __esm({
|
|
11744
|
-
"components/game/2d/
|
|
11746
|
+
"components/game/2d/molecules/ActionPalette.tsx"() {
|
|
11745
11747
|
init_atoms();
|
|
11746
11748
|
init_cn();
|
|
11747
11749
|
init_ActionTile();
|
|
@@ -12117,7 +12119,7 @@ function RuleEditor({
|
|
|
12117
12119
|
] });
|
|
12118
12120
|
}
|
|
12119
12121
|
var init_RuleEditor = __esm({
|
|
12120
|
-
"components/game/2d/
|
|
12122
|
+
"components/game/2d/molecules/RuleEditor.tsx"() {
|
|
12121
12123
|
init_atoms();
|
|
12122
12124
|
init_cn();
|
|
12123
12125
|
RuleEditor.displayName = "RuleEditor";
|
|
@@ -12158,7 +12160,7 @@ function EventLog({
|
|
|
12158
12160
|
}
|
|
12159
12161
|
var STATUS_STYLES, STATUS_DOTS;
|
|
12160
12162
|
var init_EventLog = __esm({
|
|
12161
|
-
"components/game/2d/
|
|
12163
|
+
"components/game/2d/molecules/EventLog.tsx"() {
|
|
12162
12164
|
init_atoms();
|
|
12163
12165
|
init_cn();
|
|
12164
12166
|
STATUS_STYLES = {
|
|
@@ -12213,10 +12215,12 @@ var init_puzzleObject = __esm({
|
|
|
12213
12215
|
function ObjectRulePanel({
|
|
12214
12216
|
object,
|
|
12215
12217
|
onRulesChange,
|
|
12218
|
+
rulesChangeEvent,
|
|
12216
12219
|
disabled = false,
|
|
12217
12220
|
className
|
|
12218
12221
|
}) {
|
|
12219
12222
|
const { t } = hooks.useTranslate();
|
|
12223
|
+
const { emit } = useEventBus();
|
|
12220
12224
|
const id = objId(object);
|
|
12221
12225
|
const name = objName(object);
|
|
12222
12226
|
const icon = objIcon(object);
|
|
@@ -12227,15 +12231,19 @@ function ObjectRulePanel({
|
|
|
12227
12231
|
const rules = objRules(object);
|
|
12228
12232
|
const maxRules = objMaxRules(object);
|
|
12229
12233
|
const canAdd = rules.length < maxRules;
|
|
12234
|
+
const emitRules = React98.useCallback((newRules) => {
|
|
12235
|
+
if (rulesChangeEvent) emit(`UI:${rulesChangeEvent}`, { objectId: id, rules: newRules });
|
|
12236
|
+
else onRulesChange?.(id, newRules);
|
|
12237
|
+
}, [rulesChangeEvent, emit, id, onRulesChange]);
|
|
12230
12238
|
const handleRuleChange = React98.useCallback((index, updatedRule) => {
|
|
12231
12239
|
const newRules = [...rules];
|
|
12232
12240
|
newRules[index] = updatedRule;
|
|
12233
|
-
|
|
12234
|
-
}, [
|
|
12241
|
+
emitRules(newRules);
|
|
12242
|
+
}, [rules, emitRules]);
|
|
12235
12243
|
const handleRuleRemove = React98.useCallback((index) => {
|
|
12236
12244
|
const newRules = rules.filter((_, i) => i !== index);
|
|
12237
|
-
|
|
12238
|
-
}, [
|
|
12245
|
+
emitRules(newRules);
|
|
12246
|
+
}, [rules, emitRules]);
|
|
12239
12247
|
const handleAddRule = React98.useCallback(() => {
|
|
12240
12248
|
if (!canAdd || disabled) return;
|
|
12241
12249
|
const firstEvent = availableEvents[0]?.value || "";
|
|
@@ -12245,8 +12253,8 @@ function ObjectRulePanel({
|
|
|
12245
12253
|
whenEvent: firstEvent,
|
|
12246
12254
|
thenAction: firstAction
|
|
12247
12255
|
};
|
|
12248
|
-
|
|
12249
|
-
}, [canAdd, disabled,
|
|
12256
|
+
emitRules([...rules, newRule]);
|
|
12257
|
+
}, [canAdd, disabled, rules, availableEvents, availableActions, emitRules]);
|
|
12250
12258
|
const machine = {
|
|
12251
12259
|
name,
|
|
12252
12260
|
states,
|
|
@@ -12286,9 +12294,10 @@ function ObjectRulePanel({
|
|
|
12286
12294
|
}
|
|
12287
12295
|
var nextRuleId;
|
|
12288
12296
|
var init_ObjectRulePanel = __esm({
|
|
12289
|
-
"components/game/2d/
|
|
12297
|
+
"components/game/2d/molecules/ObjectRulePanel.tsx"() {
|
|
12290
12298
|
init_atoms();
|
|
12291
12299
|
init_cn();
|
|
12300
|
+
init_useEventBus();
|
|
12292
12301
|
init_TraitStateViewer();
|
|
12293
12302
|
init_RuleEditor();
|
|
12294
12303
|
init_puzzleObject();
|
|
@@ -12518,61 +12527,35 @@ function VariablePanel({
|
|
|
12518
12527
|
const { t } = hooks.useTranslate();
|
|
12519
12528
|
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { className: cn("p-3 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
12520
12529
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.variables", { name: entityName }) }),
|
|
12521
|
-
variables.map((v) => {
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
const min = numField(v.min, 0);
|
|
12526
|
-
const unit = v.unit == null ? "" : String(v.unit);
|
|
12527
|
-
const pct = Math.round((value - min) / (max - min) * 100);
|
|
12528
|
-
const isHigh = pct > 80;
|
|
12529
|
-
const isLow = pct < 20;
|
|
12530
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "none", children: [
|
|
12531
|
-
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center justify-between", children: [
|
|
12532
|
-
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "text-foreground font-medium", children: name }),
|
|
12533
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "caption", className: cn(
|
|
12534
|
-
isHigh ? "text-error" : isLow ? "text-warning" : "text-foreground"
|
|
12535
|
-
), children: [
|
|
12536
|
-
value,
|
|
12537
|
-
unit,
|
|
12538
|
-
" / ",
|
|
12539
|
-
max,
|
|
12540
|
-
unit
|
|
12541
|
-
] })
|
|
12542
|
-
] }),
|
|
12543
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12544
|
-
ProgressBar,
|
|
12545
|
-
{
|
|
12546
|
-
value: pct,
|
|
12547
|
-
color: isHigh ? "danger" : isLow ? "warning" : "primary",
|
|
12548
|
-
size: "sm"
|
|
12549
|
-
}
|
|
12550
|
-
)
|
|
12551
|
-
] }, name);
|
|
12552
|
-
})
|
|
12530
|
+
(variables ?? []).map((v) => /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center justify-between", children: [
|
|
12531
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "text-foreground font-medium", children: v.name }),
|
|
12532
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "text-accent font-mono", children: v.value })
|
|
12533
|
+
] }, v.name))
|
|
12553
12534
|
] });
|
|
12554
12535
|
}
|
|
12555
|
-
var numField;
|
|
12556
12536
|
var init_VariablePanel = __esm({
|
|
12557
|
-
"components/game/2d/
|
|
12537
|
+
"components/game/2d/molecules/VariablePanel.tsx"() {
|
|
12558
12538
|
init_atoms();
|
|
12559
12539
|
init_cn();
|
|
12560
|
-
numField = (v, fallback = 0) => {
|
|
12561
|
-
const n = Number(v);
|
|
12562
|
-
return Number.isFinite(n) ? n : fallback;
|
|
12563
|
-
};
|
|
12564
12540
|
VariablePanel.displayName = "VariablePanel";
|
|
12565
12541
|
}
|
|
12566
12542
|
});
|
|
12567
12543
|
function StateJsonView({
|
|
12568
|
-
|
|
12544
|
+
name,
|
|
12545
|
+
initialState,
|
|
12546
|
+
states,
|
|
12547
|
+
transitions,
|
|
12569
12548
|
label,
|
|
12570
12549
|
defaultExpanded = false,
|
|
12571
12550
|
className
|
|
12572
12551
|
}) {
|
|
12573
12552
|
const { t } = hooks.useTranslate();
|
|
12574
12553
|
const [expanded, setExpanded] = React98.useState(defaultExpanded);
|
|
12575
|
-
const jsonString = JSON.stringify(
|
|
12554
|
+
const jsonString = JSON.stringify(
|
|
12555
|
+
{ name, initialState, states: states ?? [], transitions: transitions ?? [] },
|
|
12556
|
+
null,
|
|
12557
|
+
2
|
|
12558
|
+
);
|
|
12576
12559
|
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
|
|
12577
12560
|
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
|
|
12578
12561
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
|
|
@@ -12589,7 +12572,7 @@ function StateJsonView({
|
|
|
12589
12572
|
] });
|
|
12590
12573
|
}
|
|
12591
12574
|
var init_StateJsonView = __esm({
|
|
12592
|
-
"components/game/2d/
|
|
12575
|
+
"components/game/2d/molecules/StateJsonView.tsx"() {
|
|
12593
12576
|
init_atoms();
|
|
12594
12577
|
init_cn();
|
|
12595
12578
|
StateJsonView.displayName = "StateJsonView";
|
|
@@ -12758,7 +12741,7 @@ function StateArchitectBoard({
|
|
|
12758
12741
|
setAddingFrom(null);
|
|
12759
12742
|
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
12760
12743
|
}, [initialState, entityVariables, playAgainEvent, emit]);
|
|
12761
|
-
|
|
12744
|
+
React98.useMemo(() => ({
|
|
12762
12745
|
name: entityName,
|
|
12763
12746
|
states: entityStates,
|
|
12764
12747
|
initialState,
|
|
@@ -12893,7 +12876,7 @@ function StateArchitectBoard({
|
|
|
12893
12876
|
VariablePanel,
|
|
12894
12877
|
{
|
|
12895
12878
|
entityName,
|
|
12896
|
-
variables
|
|
12879
|
+
variables: variables.map((v) => ({ name: String(v.name ?? ""), value: String(v.value ?? "") }))
|
|
12897
12880
|
}
|
|
12898
12881
|
),
|
|
12899
12882
|
testResults.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
|
|
@@ -12904,7 +12887,16 @@ function StateArchitectBoard({
|
|
|
12904
12887
|
!r.passed && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
|
|
12905
12888
|
] }, i))
|
|
12906
12889
|
] }),
|
|
12907
|
-
resolved.showCodeView !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12890
|
+
resolved.showCodeView !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12891
|
+
StateJsonView,
|
|
12892
|
+
{
|
|
12893
|
+
name: entityName,
|
|
12894
|
+
initialState,
|
|
12895
|
+
states: entityStates,
|
|
12896
|
+
transitions: transitions.map((tr) => ({ from: tr.from, to: tr.to, event: tr.event })),
|
|
12897
|
+
label: "View Code"
|
|
12898
|
+
}
|
|
12899
|
+
)
|
|
12908
12900
|
] })
|
|
12909
12901
|
] }),
|
|
12910
12902
|
isSuccess && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
|
|
@@ -46242,6 +46234,7 @@ var init_component_registry_generated = __esm({
|
|
|
46242
46234
|
init_Navigation();
|
|
46243
46235
|
init_NegotiatorBoard();
|
|
46244
46236
|
init_NumberStepper();
|
|
46237
|
+
init_ObjectRulePanel();
|
|
46245
46238
|
init_OptionConstraintGroup();
|
|
46246
46239
|
init_OrbitalVisualization();
|
|
46247
46240
|
init_Overlay();
|
|
@@ -46305,6 +46298,7 @@ var init_component_registry_generated = __esm({
|
|
|
46305
46298
|
init_StateArchitectBoard();
|
|
46306
46299
|
init_StateGraph();
|
|
46307
46300
|
init_StateIndicator();
|
|
46301
|
+
init_StateJsonView();
|
|
46308
46302
|
init_StateMachineView();
|
|
46309
46303
|
init_StatsGrid();
|
|
46310
46304
|
init_StatsOrganism();
|
|
@@ -46351,6 +46345,7 @@ var init_component_registry_generated = __esm({
|
|
|
46351
46345
|
init_Typography();
|
|
46352
46346
|
init_UISlotRenderer();
|
|
46353
46347
|
init_UploadDropZone();
|
|
46348
|
+
init_VariablePanel();
|
|
46354
46349
|
init_VersionDiff();
|
|
46355
46350
|
init_ViolationAlert();
|
|
46356
46351
|
init_VoteStack();
|
|
@@ -46551,6 +46546,7 @@ var init_component_registry_generated = __esm({
|
|
|
46551
46546
|
"Navigation": Navigation,
|
|
46552
46547
|
"NegotiatorBoard": NegotiatorBoard,
|
|
46553
46548
|
"NumberStepper": NumberStepper,
|
|
46549
|
+
"ObjectRulePanel": ObjectRulePanel,
|
|
46554
46550
|
"OptionConstraintGroup": OptionConstraintGroup,
|
|
46555
46551
|
"OrbitalVisualization": OrbitalVisualization,
|
|
46556
46552
|
"Overlay": Overlay,
|
|
@@ -46617,6 +46613,7 @@ var init_component_registry_generated = __esm({
|
|
|
46617
46613
|
"StateArchitectBoard": StateArchitectBoard,
|
|
46618
46614
|
"StateGraph": StateGraph,
|
|
46619
46615
|
"StateIndicator": StateIndicator,
|
|
46616
|
+
"StateJsonView": StateJsonView,
|
|
46620
46617
|
"StateMachineView": StateMachineView,
|
|
46621
46618
|
"StatsGrid": StatsGrid,
|
|
46622
46619
|
"StatsOrganism": StatsOrganism,
|
|
@@ -46664,6 +46661,7 @@ var init_component_registry_generated = __esm({
|
|
|
46664
46661
|
"UISlotRenderer": UISlotRenderer,
|
|
46665
46662
|
"UploadDropZone": UploadDropZone,
|
|
46666
46663
|
"VStack": VStack,
|
|
46664
|
+
"VariablePanel": VariablePanel,
|
|
46667
46665
|
"VersionDiff": VersionDiff,
|
|
46668
46666
|
"ViolationAlert": ViolationAlert,
|
|
46669
46667
|
"VoteStack": VoteStack,
|