@almadar/ui 5.89.0 → 5.93.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 +1350 -1562
- package/dist/avl/index.js +353 -565
- package/dist/components/game/2d/atoms/DialogueBubble.d.ts +9 -1
- package/dist/components/game/2d/atoms/GameCard.d.ts +7 -1
- package/dist/components/game/2d/molecules/Canvas2D.d.ts +9 -1
- package/dist/components/game/2d/{organisms → molecules}/ObjectRulePanel.d.ts +9 -4
- package/dist/components/game/2d/{organisms → molecules}/SequenceBar.d.ts +15 -5
- 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 +12 -16
- package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +1 -1
- package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
- package/dist/components/game/shared/spriteAnimationTypes.d.ts +10 -35
- package/dist/components/index.cjs +121 -420
- package/dist/components/index.js +123 -419
- package/dist/lib/verificationRegistry.d.ts +1 -1
- package/dist/providers/index.cjs +1214 -1398
- package/dist/providers/index.js +324 -508
- package/dist/runtime/index.cjs +1211 -1423
- package/dist/runtime/index.js +333 -545
- package/package.json +3 -3
- package/dist/components/game/2d/organisms/SimulationCanvas.d.ts +0 -27
- package/dist/components/game/2d/organisms/SimulationControls.d.ts +0 -51
- package/dist/components/game/2d/organisms/SimulationGraph.d.ts +0 -25
- 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
|
@@ -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/
|
|
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/
|
|
8188
|
+
"components/game/2d/molecules/ActionPalette.tsx"() {
|
|
8189
8189
|
init_atoms();
|
|
8190
8190
|
init_cn();
|
|
8191
8191
|
init_ActionTile();
|
|
@@ -16348,6 +16348,7 @@ function Canvas2D({
|
|
|
16348
16348
|
unitScale = 1,
|
|
16349
16349
|
showMinimap = true,
|
|
16350
16350
|
animate,
|
|
16351
|
+
interpolateUnits = false,
|
|
16351
16352
|
// Tuning
|
|
16352
16353
|
debug: debug2 = false,
|
|
16353
16354
|
spriteHeightRatio = 1.5,
|
|
@@ -16382,6 +16383,8 @@ function Canvas2D({
|
|
|
16382
16383
|
const containerRef = React74.useRef(null);
|
|
16383
16384
|
const lerpRafRef = React74.useRef(0);
|
|
16384
16385
|
const animRafRef = React74.useRef(0);
|
|
16386
|
+
const unitInterp = useRenderInterpolation();
|
|
16387
|
+
const interpolatedUnitPositionsRef = React74.useRef(/* @__PURE__ */ new Map());
|
|
16385
16388
|
const [viewportSize, setViewportSize] = React74.useState({ width: 800, height: 600 });
|
|
16386
16389
|
React74.useEffect(() => {
|
|
16387
16390
|
const el = containerRef.current;
|
|
@@ -16696,7 +16699,8 @@ function Canvas2D({
|
|
|
16696
16699
|
return depthA !== depthB ? depthA - depthB : a.position.y - b.position.y;
|
|
16697
16700
|
});
|
|
16698
16701
|
for (const unit of sortedUnits) {
|
|
16699
|
-
const
|
|
16702
|
+
const interpolated = interpolateUnits ? interpolatedUnitPositionsRef.current.get(unit.id) : void 0;
|
|
16703
|
+
const pos = project(interpolated?.x ?? unit.position.x, interpolated?.y ?? unit.position.y, baseOffsetX);
|
|
16700
16704
|
if (pos.x + scaledTileWidth < visLeft || pos.x > visRight || pos.y + scaledTileHeight < visTop || pos.y > visBottom) {
|
|
16701
16705
|
continue;
|
|
16702
16706
|
}
|
|
@@ -16848,7 +16852,8 @@ function Canvas2D({
|
|
|
16848
16852
|
unitScale,
|
|
16849
16853
|
assetManifest,
|
|
16850
16854
|
spriteHeightRatio,
|
|
16851
|
-
spriteMaxWidthRatio
|
|
16855
|
+
spriteMaxWidthRatio,
|
|
16856
|
+
interpolateUnits
|
|
16852
16857
|
]);
|
|
16853
16858
|
React74.useEffect(() => {
|
|
16854
16859
|
if (camera === "fixed") return;
|
|
@@ -16863,6 +16868,19 @@ function Canvas2D({
|
|
|
16863
16868
|
y: centerY - viewportSize.height / 2
|
|
16864
16869
|
};
|
|
16865
16870
|
}, [camera, selectedUnitId, units, project, baseOffsetX, scaledTileWidth, scaledDiamondTopY, scaledFloorHeight, viewportSize, targetCameraRef]);
|
|
16871
|
+
React74.useEffect(() => {
|
|
16872
|
+
if (isSide || !interpolateUnits) return;
|
|
16873
|
+
unitInterp.onSnapshot(
|
|
16874
|
+
units.filter((u) => !!u.position).map((u) => ({ id: u.id, x: u.position.x, y: u.position.y }))
|
|
16875
|
+
);
|
|
16876
|
+
}, [isSide, interpolateUnits, units, unitInterp]);
|
|
16877
|
+
React74.useEffect(() => {
|
|
16878
|
+
if (isSide || !interpolateUnits) return;
|
|
16879
|
+
return unitInterp.startLoop((positions) => {
|
|
16880
|
+
interpolatedUnitPositionsRef.current = positions;
|
|
16881
|
+
draw();
|
|
16882
|
+
});
|
|
16883
|
+
}, [isSide, interpolateUnits, unitInterp, draw]);
|
|
16866
16884
|
React74.useEffect(() => {
|
|
16867
16885
|
if (isSide) return;
|
|
16868
16886
|
draw();
|
|
@@ -26647,6 +26665,7 @@ function GameCard({
|
|
|
26647
26665
|
selected = false,
|
|
26648
26666
|
disabled = false,
|
|
26649
26667
|
size = "md",
|
|
26668
|
+
animState = "idle",
|
|
26650
26669
|
onClick,
|
|
26651
26670
|
clickEvent,
|
|
26652
26671
|
className
|
|
@@ -26674,6 +26693,7 @@ function GameCard({
|
|
|
26674
26693
|
cardSizeMap[size],
|
|
26675
26694
|
disabled ? "border-border opacity-50 cursor-not-allowed" : "border-accent hover:brightness-125 hover:-translate-y-1 cursor-pointer",
|
|
26676
26695
|
selected && "ring-2 ring-foreground ring-offset-1 ring-offset-background -translate-y-1",
|
|
26696
|
+
ANIM_STATE_CLASS[animState],
|
|
26677
26697
|
className
|
|
26678
26698
|
),
|
|
26679
26699
|
children: [
|
|
@@ -26706,7 +26726,7 @@ function GameCard({
|
|
|
26706
26726
|
}
|
|
26707
26727
|
);
|
|
26708
26728
|
}
|
|
26709
|
-
var cardSizeMap, artPxMap;
|
|
26729
|
+
var cardSizeMap, artPxMap, ANIM_STATE_CLASS;
|
|
26710
26730
|
var init_GameCard = __esm({
|
|
26711
26731
|
"components/game/2d/atoms/GameCard.tsx"() {
|
|
26712
26732
|
"use client";
|
|
@@ -26722,6 +26742,12 @@ var init_GameCard = __esm({
|
|
|
26722
26742
|
lg: "w-24 h-36"
|
|
26723
26743
|
};
|
|
26724
26744
|
artPxMap = { sm: 40, md: 52, lg: 64 };
|
|
26745
|
+
ANIM_STATE_CLASS = {
|
|
26746
|
+
idle: "",
|
|
26747
|
+
drawn: "scale-105",
|
|
26748
|
+
played: "-translate-y-2 opacity-80",
|
|
26749
|
+
flipped: "scale-x-0"
|
|
26750
|
+
};
|
|
26725
26751
|
GameCard.displayName = "GameCard";
|
|
26726
26752
|
}
|
|
26727
26753
|
});
|
|
@@ -27412,8 +27438,11 @@ function DialogueBubble({
|
|
|
27412
27438
|
text = "The dungeon awaits. Choose your path wisely.",
|
|
27413
27439
|
portrait = DEFAULT_PORTRAIT,
|
|
27414
27440
|
position = "bottom",
|
|
27441
|
+
mood = "neutral",
|
|
27442
|
+
revealedChars,
|
|
27415
27443
|
className
|
|
27416
27444
|
}) {
|
|
27445
|
+
const visibleText = revealedChars === void 0 ? text : text.slice(0, revealedChars);
|
|
27417
27446
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27418
27447
|
exports.Box,
|
|
27419
27448
|
{
|
|
@@ -27423,16 +27452,16 @@ function DialogueBubble({
|
|
|
27423
27452
|
className
|
|
27424
27453
|
),
|
|
27425
27454
|
children: [
|
|
27426
|
-
portrait && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex-shrink-0 w-12 h-12 rounded-full overflow-hidden border-2
|
|
27455
|
+
portrait && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: cn("flex-shrink-0 w-12 h-12 rounded-full overflow-hidden border-2 transition-colors duration-300", MOOD_RING_CLASS[mood]), children: /* @__PURE__ */ jsxRuntime.jsx(GameIcon, { assetUrl: portrait, icon: "image", size: 48, alt: speaker ?? "speaker", className: "w-full h-full object-cover" }) }),
|
|
27427
27456
|
/* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { className: "flex flex-col gap-1 min-w-0", children: [
|
|
27428
27457
|
speaker && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { as: "span", className: "text-sm font-bold text-warning", children: speaker }),
|
|
27429
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { as: "span", className: "text-sm text-foreground leading-relaxed", children:
|
|
27458
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { as: "span", className: "text-sm text-foreground leading-relaxed", children: visibleText })
|
|
27430
27459
|
] })
|
|
27431
27460
|
]
|
|
27432
27461
|
}
|
|
27433
27462
|
);
|
|
27434
27463
|
}
|
|
27435
|
-
var DEFAULT_PORTRAIT;
|
|
27464
|
+
var DEFAULT_PORTRAIT, MOOD_RING_CLASS;
|
|
27436
27465
|
var init_DialogueBubble = __esm({
|
|
27437
27466
|
"components/game/2d/atoms/DialogueBubble.tsx"() {
|
|
27438
27467
|
init_cn();
|
|
@@ -27444,6 +27473,12 @@ var init_DialogueBubble = __esm({
|
|
|
27444
27473
|
role: "effect",
|
|
27445
27474
|
category: "character"
|
|
27446
27475
|
};
|
|
27476
|
+
MOOD_RING_CLASS = {
|
|
27477
|
+
neutral: "border-warning/60",
|
|
27478
|
+
happy: "border-success/70",
|
|
27479
|
+
concerned: "border-info/70",
|
|
27480
|
+
angry: "border-error/70"
|
|
27481
|
+
};
|
|
27447
27482
|
DialogueBubble.displayName = "DialogueBubble";
|
|
27448
27483
|
}
|
|
27449
27484
|
});
|
|
@@ -27884,7 +27919,7 @@ function StateNode2({
|
|
|
27884
27919
|
);
|
|
27885
27920
|
}
|
|
27886
27921
|
var init_StateNode = __esm({
|
|
27887
|
-
"components/game/2d/
|
|
27922
|
+
"components/game/2d/molecules/StateNode.tsx"() {
|
|
27888
27923
|
init_atoms();
|
|
27889
27924
|
init_cn();
|
|
27890
27925
|
StateNode2.displayName = "StateNode";
|
|
@@ -27956,7 +27991,7 @@ function TransitionArrow({
|
|
|
27956
27991
|
}
|
|
27957
27992
|
var NODE_RADIUS;
|
|
27958
27993
|
var init_TransitionArrow = __esm({
|
|
27959
|
-
"components/game/2d/
|
|
27994
|
+
"components/game/2d/molecules/TransitionArrow.tsx"() {
|
|
27960
27995
|
init_cn();
|
|
27961
27996
|
NODE_RADIUS = 40;
|
|
27962
27997
|
TransitionArrow.displayName = "TransitionArrow";
|
|
@@ -28620,7 +28655,7 @@ function TraitStateViewer({
|
|
|
28620
28655
|
}
|
|
28621
28656
|
var SIZE_CONFIG2;
|
|
28622
28657
|
var init_TraitStateViewer = __esm({
|
|
28623
|
-
"components/game/2d/
|
|
28658
|
+
"components/game/2d/molecules/TraitStateViewer.tsx"() {
|
|
28624
28659
|
"use client";
|
|
28625
28660
|
init_cn();
|
|
28626
28661
|
init_Box();
|
|
@@ -28653,7 +28688,8 @@ function TraitSlot({
|
|
|
28653
28688
|
onClick,
|
|
28654
28689
|
onRemove,
|
|
28655
28690
|
clickEvent,
|
|
28656
|
-
removeEvent
|
|
28691
|
+
removeEvent,
|
|
28692
|
+
dropEvent
|
|
28657
28693
|
}) {
|
|
28658
28694
|
const { emit } = useEventBus();
|
|
28659
28695
|
const [isHovered, setIsHovered] = React74.useState(false);
|
|
@@ -28685,29 +28721,30 @@ function TraitSlot({
|
|
|
28685
28721
|
onDragStart?.(equippedItem);
|
|
28686
28722
|
}, [equippedItem, draggable, onDragStart]);
|
|
28687
28723
|
const handleDragOver = React74.useCallback((e) => {
|
|
28688
|
-
if (locked || !onItemDrop) return;
|
|
28724
|
+
if (locked || !onItemDrop && !dropEvent) return;
|
|
28689
28725
|
if (e.dataTransfer.types.includes(DRAG_MIME2)) {
|
|
28690
28726
|
e.preventDefault();
|
|
28691
28727
|
const allowed = e.dataTransfer.effectAllowed;
|
|
28692
28728
|
e.dataTransfer.dropEffect = allowed === "copy" ? "copy" : "move";
|
|
28693
28729
|
setIsDragOver(true);
|
|
28694
28730
|
}
|
|
28695
|
-
}, [locked, onItemDrop]);
|
|
28731
|
+
}, [locked, onItemDrop, dropEvent]);
|
|
28696
28732
|
const handleDragLeave = React74.useCallback(() => {
|
|
28697
28733
|
setIsDragOver(false);
|
|
28698
28734
|
}, []);
|
|
28699
28735
|
const handleDrop = React74.useCallback((e) => {
|
|
28700
28736
|
e.preventDefault();
|
|
28701
28737
|
setIsDragOver(false);
|
|
28702
|
-
if (locked || !onItemDrop) return;
|
|
28738
|
+
if (locked || !onItemDrop && !dropEvent) return;
|
|
28703
28739
|
const raw = e.dataTransfer.getData(DRAG_MIME2);
|
|
28704
28740
|
if (!raw) return;
|
|
28705
28741
|
try {
|
|
28706
28742
|
const item = JSON.parse(raw);
|
|
28707
|
-
|
|
28743
|
+
if (dropEvent) emit(`UI:${dropEvent}`, { slotNumber, itemId: item.id });
|
|
28744
|
+
else onItemDrop?.(item);
|
|
28708
28745
|
} catch {
|
|
28709
28746
|
}
|
|
28710
|
-
}, [locked, onItemDrop]);
|
|
28747
|
+
}, [locked, onItemDrop, dropEvent, emit, slotNumber]);
|
|
28711
28748
|
const getTooltipStyle = () => {
|
|
28712
28749
|
if (!slotRef.current) return {};
|
|
28713
28750
|
const rect = slotRef.current.getBoundingClientRect();
|
|
@@ -28827,7 +28864,7 @@ function TraitSlot({
|
|
|
28827
28864
|
}
|
|
28828
28865
|
var SIZE_CONFIG3, DRAG_MIME2;
|
|
28829
28866
|
var init_TraitSlot = __esm({
|
|
28830
|
-
"components/game/2d/
|
|
28867
|
+
"components/game/2d/molecules/TraitSlot.tsx"() {
|
|
28831
28868
|
"use client";
|
|
28832
28869
|
init_cn();
|
|
28833
28870
|
init_useEventBus();
|
|
@@ -29033,6 +29070,8 @@ function SequenceBar({
|
|
|
29033
29070
|
maxSlots,
|
|
29034
29071
|
onSlotDrop,
|
|
29035
29072
|
onSlotRemove,
|
|
29073
|
+
slotDropEvent,
|
|
29074
|
+
slotRemoveEvent,
|
|
29036
29075
|
playing = false,
|
|
29037
29076
|
currentStep = -1,
|
|
29038
29077
|
categoryColors,
|
|
@@ -29040,14 +29079,17 @@ function SequenceBar({
|
|
|
29040
29079
|
size = "lg",
|
|
29041
29080
|
className
|
|
29042
29081
|
}) {
|
|
29082
|
+
const { emit } = useEventBus();
|
|
29043
29083
|
const handleDrop = React74.useCallback((index) => (item) => {
|
|
29044
29084
|
if (playing) return;
|
|
29045
|
-
|
|
29046
|
-
|
|
29085
|
+
if (slotDropEvent) emit(`UI:${slotDropEvent}`, { slotNumber: index, itemId: item.id });
|
|
29086
|
+
else onSlotDrop?.(index, item);
|
|
29087
|
+
}, [emit, slotDropEvent, onSlotDrop, playing]);
|
|
29047
29088
|
const handleRemove = React74.useCallback((index) => () => {
|
|
29048
29089
|
if (playing) return;
|
|
29049
|
-
|
|
29050
|
-
|
|
29090
|
+
if (slotRemoveEvent) emit(`UI:${slotRemoveEvent}`, { slotNumber: index });
|
|
29091
|
+
else onSlotRemove?.(index);
|
|
29092
|
+
}, [emit, slotRemoveEvent, onSlotRemove, playing]);
|
|
29051
29093
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
29052
29094
|
return /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxRuntime.jsxs(React74__namespace.default.Fragment, { children: [
|
|
29053
29095
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -29079,9 +29121,10 @@ function SequenceBar({
|
|
|
29079
29121
|
] }, i)) });
|
|
29080
29122
|
}
|
|
29081
29123
|
var init_SequenceBar = __esm({
|
|
29082
|
-
"components/game/2d/
|
|
29124
|
+
"components/game/2d/molecules/SequenceBar.tsx"() {
|
|
29083
29125
|
init_atoms();
|
|
29084
29126
|
init_cn();
|
|
29127
|
+
init_useEventBus();
|
|
29085
29128
|
init_TraitSlot();
|
|
29086
29129
|
SequenceBar.displayName = "SequenceBar";
|
|
29087
29130
|
}
|
|
@@ -29397,7 +29440,7 @@ function RuleEditor({
|
|
|
29397
29440
|
] });
|
|
29398
29441
|
}
|
|
29399
29442
|
var init_RuleEditor = __esm({
|
|
29400
|
-
"components/game/2d/
|
|
29443
|
+
"components/game/2d/molecules/RuleEditor.tsx"() {
|
|
29401
29444
|
init_atoms();
|
|
29402
29445
|
init_cn();
|
|
29403
29446
|
RuleEditor.displayName = "RuleEditor";
|
|
@@ -29438,7 +29481,7 @@ function EventLog({
|
|
|
29438
29481
|
}
|
|
29439
29482
|
var STATUS_STYLES, STATUS_DOTS;
|
|
29440
29483
|
var init_EventLog = __esm({
|
|
29441
|
-
"components/game/2d/
|
|
29484
|
+
"components/game/2d/molecules/EventLog.tsx"() {
|
|
29442
29485
|
init_atoms();
|
|
29443
29486
|
init_cn();
|
|
29444
29487
|
STATUS_STYLES = {
|
|
@@ -29493,10 +29536,12 @@ var init_puzzleObject = __esm({
|
|
|
29493
29536
|
function ObjectRulePanel({
|
|
29494
29537
|
object,
|
|
29495
29538
|
onRulesChange,
|
|
29539
|
+
rulesChangeEvent,
|
|
29496
29540
|
disabled = false,
|
|
29497
29541
|
className
|
|
29498
29542
|
}) {
|
|
29499
29543
|
const { t } = hooks.useTranslate();
|
|
29544
|
+
const { emit } = useEventBus();
|
|
29500
29545
|
const id = objId(object);
|
|
29501
29546
|
const name = objName(object);
|
|
29502
29547
|
const icon = objIcon(object);
|
|
@@ -29507,15 +29552,19 @@ function ObjectRulePanel({
|
|
|
29507
29552
|
const rules = objRules(object);
|
|
29508
29553
|
const maxRules = objMaxRules(object);
|
|
29509
29554
|
const canAdd = rules.length < maxRules;
|
|
29555
|
+
const emitRules = React74.useCallback((newRules) => {
|
|
29556
|
+
if (rulesChangeEvent) emit(`UI:${rulesChangeEvent}`, { objectId: id, rules: newRules });
|
|
29557
|
+
else onRulesChange?.(id, newRules);
|
|
29558
|
+
}, [rulesChangeEvent, emit, id, onRulesChange]);
|
|
29510
29559
|
const handleRuleChange = React74.useCallback((index, updatedRule) => {
|
|
29511
29560
|
const newRules = [...rules];
|
|
29512
29561
|
newRules[index] = updatedRule;
|
|
29513
|
-
|
|
29514
|
-
}, [
|
|
29562
|
+
emitRules(newRules);
|
|
29563
|
+
}, [rules, emitRules]);
|
|
29515
29564
|
const handleRuleRemove = React74.useCallback((index) => {
|
|
29516
29565
|
const newRules = rules.filter((_, i) => i !== index);
|
|
29517
|
-
|
|
29518
|
-
}, [
|
|
29566
|
+
emitRules(newRules);
|
|
29567
|
+
}, [rules, emitRules]);
|
|
29519
29568
|
const handleAddRule = React74.useCallback(() => {
|
|
29520
29569
|
if (!canAdd || disabled) return;
|
|
29521
29570
|
const firstEvent = availableEvents[0]?.value || "";
|
|
@@ -29525,8 +29574,8 @@ function ObjectRulePanel({
|
|
|
29525
29574
|
whenEvent: firstEvent,
|
|
29526
29575
|
thenAction: firstAction
|
|
29527
29576
|
};
|
|
29528
|
-
|
|
29529
|
-
}, [canAdd, disabled,
|
|
29577
|
+
emitRules([...rules, newRule]);
|
|
29578
|
+
}, [canAdd, disabled, rules, availableEvents, availableActions, emitRules]);
|
|
29530
29579
|
const machine = {
|
|
29531
29580
|
name,
|
|
29532
29581
|
states,
|
|
@@ -29566,9 +29615,10 @@ function ObjectRulePanel({
|
|
|
29566
29615
|
}
|
|
29567
29616
|
var nextRuleId;
|
|
29568
29617
|
var init_ObjectRulePanel = __esm({
|
|
29569
|
-
"components/game/2d/
|
|
29618
|
+
"components/game/2d/molecules/ObjectRulePanel.tsx"() {
|
|
29570
29619
|
init_atoms();
|
|
29571
29620
|
init_cn();
|
|
29621
|
+
init_useEventBus();
|
|
29572
29622
|
init_TraitStateViewer();
|
|
29573
29623
|
init_RuleEditor();
|
|
29574
29624
|
init_puzzleObject();
|
|
@@ -29798,61 +29848,35 @@ function VariablePanel({
|
|
|
29798
29848
|
const { t } = hooks.useTranslate();
|
|
29799
29849
|
return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { className: cn("p-3 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
29800
29850
|
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.variables", { name: entityName }) }),
|
|
29801
|
-
variables.map((v) => {
|
|
29802
|
-
|
|
29803
|
-
|
|
29804
|
-
|
|
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
|
-
})
|
|
29851
|
+
(variables ?? []).map((v) => /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center justify-between", children: [
|
|
29852
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-foreground font-medium", children: v.name }),
|
|
29853
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-accent font-mono", children: v.value })
|
|
29854
|
+
] }, v.name))
|
|
29833
29855
|
] });
|
|
29834
29856
|
}
|
|
29835
|
-
var numField;
|
|
29836
29857
|
var init_VariablePanel = __esm({
|
|
29837
|
-
"components/game/2d/
|
|
29858
|
+
"components/game/2d/molecules/VariablePanel.tsx"() {
|
|
29838
29859
|
init_atoms();
|
|
29839
29860
|
init_cn();
|
|
29840
|
-
numField = (v, fallback = 0) => {
|
|
29841
|
-
const n = Number(v);
|
|
29842
|
-
return Number.isFinite(n) ? n : fallback;
|
|
29843
|
-
};
|
|
29844
29861
|
VariablePanel.displayName = "VariablePanel";
|
|
29845
29862
|
}
|
|
29846
29863
|
});
|
|
29847
29864
|
function StateJsonView({
|
|
29848
|
-
|
|
29865
|
+
name,
|
|
29866
|
+
initialState,
|
|
29867
|
+
states,
|
|
29868
|
+
transitions,
|
|
29849
29869
|
label,
|
|
29850
29870
|
defaultExpanded = false,
|
|
29851
29871
|
className
|
|
29852
29872
|
}) {
|
|
29853
29873
|
const { t } = hooks.useTranslate();
|
|
29854
29874
|
const [expanded, setExpanded] = React74.useState(defaultExpanded);
|
|
29855
|
-
const jsonString = JSON.stringify(
|
|
29875
|
+
const jsonString = JSON.stringify(
|
|
29876
|
+
{ name, initialState, states: states ?? [], transitions: transitions ?? [] },
|
|
29877
|
+
null,
|
|
29878
|
+
2
|
|
29879
|
+
);
|
|
29856
29880
|
return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
|
|
29857
29881
|
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
|
|
29858
29882
|
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
|
|
@@ -29869,7 +29893,7 @@ function StateJsonView({
|
|
|
29869
29893
|
] });
|
|
29870
29894
|
}
|
|
29871
29895
|
var init_StateJsonView = __esm({
|
|
29872
|
-
"components/game/2d/
|
|
29896
|
+
"components/game/2d/molecules/StateJsonView.tsx"() {
|
|
29873
29897
|
init_atoms();
|
|
29874
29898
|
init_cn();
|
|
29875
29899
|
StateJsonView.displayName = "StateJsonView";
|
|
@@ -30038,7 +30062,7 @@ function StateArchitectBoard({
|
|
|
30038
30062
|
setAddingFrom(null);
|
|
30039
30063
|
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
30040
30064
|
}, [initialState, entityVariables, playAgainEvent, emit]);
|
|
30041
|
-
|
|
30065
|
+
React74.useMemo(() => ({
|
|
30042
30066
|
name: entityName,
|
|
30043
30067
|
states: entityStates,
|
|
30044
30068
|
initialState,
|
|
@@ -30173,7 +30197,7 @@ function StateArchitectBoard({
|
|
|
30173
30197
|
VariablePanel,
|
|
30174
30198
|
{
|
|
30175
30199
|
entityName,
|
|
30176
|
-
variables
|
|
30200
|
+
variables: variables.map((v) => ({ name: String(v.name ?? ""), value: String(v.value ?? "") }))
|
|
30177
30201
|
}
|
|
30178
30202
|
),
|
|
30179
30203
|
testResults.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
|
|
@@ -30184,7 +30208,16 @@ function StateArchitectBoard({
|
|
|
30184
30208
|
!r.passed && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
|
|
30185
30209
|
] }, i))
|
|
30186
30210
|
] }),
|
|
30187
|
-
resolved.showCodeView !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
30211
|
+
resolved.showCodeView !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
30212
|
+
StateJsonView,
|
|
30213
|
+
{
|
|
30214
|
+
name: entityName,
|
|
30215
|
+
initialState,
|
|
30216
|
+
states: entityStates,
|
|
30217
|
+
transitions: transitions.map((tr) => ({ from: tr.from, to: tr.to, event: tr.event })),
|
|
30218
|
+
label: "View Code"
|
|
30219
|
+
}
|
|
30220
|
+
)
|
|
30188
30221
|
] })
|
|
30189
30222
|
] }),
|
|
30190
30223
|
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") }) }),
|
|
@@ -30825,336 +30858,6 @@ var init_physicsPresets = __esm({
|
|
|
30825
30858
|
];
|
|
30826
30859
|
}
|
|
30827
30860
|
});
|
|
30828
|
-
function resolvePreset(preset) {
|
|
30829
|
-
if (typeof preset !== "string") return preset;
|
|
30830
|
-
return PRESET_BY_ID[preset] ?? exports.projectileMotion;
|
|
30831
|
-
}
|
|
30832
|
-
function SimulationCanvas({
|
|
30833
|
-
preset: presetProp,
|
|
30834
|
-
width = 600,
|
|
30835
|
-
height = 400,
|
|
30836
|
-
bodies: externalBodies,
|
|
30837
|
-
className
|
|
30838
|
-
}) {
|
|
30839
|
-
const preset = React74.useMemo(() => resolvePreset(presetProp), [presetProp]);
|
|
30840
|
-
const canvasRef = React74.useRef(null);
|
|
30841
|
-
const bodiesRef = React74.useRef(structuredClone(preset.bodies));
|
|
30842
|
-
const interp = useRenderInterpolation();
|
|
30843
|
-
React74.useEffect(() => {
|
|
30844
|
-
bodiesRef.current = structuredClone(preset.bodies);
|
|
30845
|
-
}, [preset]);
|
|
30846
|
-
const draw = React74.useCallback(() => {
|
|
30847
|
-
const canvas = canvasRef.current;
|
|
30848
|
-
if (!canvas) return;
|
|
30849
|
-
const ctx = canvas.getContext("2d");
|
|
30850
|
-
if (!ctx) return;
|
|
30851
|
-
const bodies = bodiesRef.current;
|
|
30852
|
-
ctx.clearRect(0, 0, width, height);
|
|
30853
|
-
ctx.fillStyle = preset.backgroundColor ?? "#1a1a2e";
|
|
30854
|
-
ctx.fillRect(0, 0, width, height);
|
|
30855
|
-
if (preset.constraints) {
|
|
30856
|
-
for (const c of preset.constraints) {
|
|
30857
|
-
const a = bodies[c.bodyA];
|
|
30858
|
-
const b = bodies[c.bodyB];
|
|
30859
|
-
if (a && b) {
|
|
30860
|
-
ctx.beginPath();
|
|
30861
|
-
ctx.moveTo(a.x, a.y);
|
|
30862
|
-
ctx.lineTo(b.x, b.y);
|
|
30863
|
-
ctx.strokeStyle = "#533483";
|
|
30864
|
-
ctx.lineWidth = 1;
|
|
30865
|
-
ctx.setLineDash([4, 4]);
|
|
30866
|
-
ctx.stroke();
|
|
30867
|
-
ctx.setLineDash([]);
|
|
30868
|
-
}
|
|
30869
|
-
}
|
|
30870
|
-
}
|
|
30871
|
-
for (const body of bodies) {
|
|
30872
|
-
ctx.beginPath();
|
|
30873
|
-
ctx.arc(body.x, body.y, body.radius, 0, Math.PI * 2);
|
|
30874
|
-
ctx.fillStyle = body.color ?? "#e94560";
|
|
30875
|
-
ctx.fill();
|
|
30876
|
-
if (preset.showVelocity) {
|
|
30877
|
-
ctx.beginPath();
|
|
30878
|
-
ctx.moveTo(body.x, body.y);
|
|
30879
|
-
ctx.lineTo(body.x + body.vx * 0.1, body.y + body.vy * 0.1);
|
|
30880
|
-
ctx.strokeStyle = "#16213e";
|
|
30881
|
-
ctx.lineWidth = 2;
|
|
30882
|
-
ctx.stroke();
|
|
30883
|
-
}
|
|
30884
|
-
}
|
|
30885
|
-
}, [width, height, preset]);
|
|
30886
|
-
React74.useEffect(() => {
|
|
30887
|
-
if (!externalBodies) return;
|
|
30888
|
-
interp.onSnapshot(externalBodies.map((b) => ({ id: b.id, x: b.x, y: b.y })));
|
|
30889
|
-
}, [externalBodies]);
|
|
30890
|
-
const presetRef = React74.useRef(preset);
|
|
30891
|
-
presetRef.current = preset;
|
|
30892
|
-
const widthRef = React74.useRef(width);
|
|
30893
|
-
widthRef.current = width;
|
|
30894
|
-
const heightRef = React74.useRef(height);
|
|
30895
|
-
heightRef.current = height;
|
|
30896
|
-
React74.useEffect(() => {
|
|
30897
|
-
if (!externalBodies) return;
|
|
30898
|
-
const drawInterpolated = (positions) => {
|
|
30899
|
-
const canvas = canvasRef.current;
|
|
30900
|
-
if (!canvas) return;
|
|
30901
|
-
const ctx = canvas.getContext("2d");
|
|
30902
|
-
if (!ctx) return;
|
|
30903
|
-
const bodies = bodiesRef.current;
|
|
30904
|
-
const p = presetRef.current;
|
|
30905
|
-
const w = widthRef.current;
|
|
30906
|
-
const h = heightRef.current;
|
|
30907
|
-
ctx.clearRect(0, 0, w, h);
|
|
30908
|
-
ctx.fillStyle = p.backgroundColor ?? "#1a1a2e";
|
|
30909
|
-
ctx.fillRect(0, 0, w, h);
|
|
30910
|
-
if (p.constraints) {
|
|
30911
|
-
for (const c of p.constraints) {
|
|
30912
|
-
const a = bodies[c.bodyA];
|
|
30913
|
-
const b = bodies[c.bodyB];
|
|
30914
|
-
if (a && b) {
|
|
30915
|
-
const aPos = positions.get(a.id) ?? a;
|
|
30916
|
-
const bPos = positions.get(b.id) ?? b;
|
|
30917
|
-
ctx.beginPath();
|
|
30918
|
-
ctx.moveTo(aPos.x, aPos.y);
|
|
30919
|
-
ctx.lineTo(bPos.x, bPos.y);
|
|
30920
|
-
ctx.strokeStyle = "#533483";
|
|
30921
|
-
ctx.lineWidth = 1;
|
|
30922
|
-
ctx.setLineDash([4, 4]);
|
|
30923
|
-
ctx.stroke();
|
|
30924
|
-
ctx.setLineDash([]);
|
|
30925
|
-
}
|
|
30926
|
-
}
|
|
30927
|
-
}
|
|
30928
|
-
for (const body of bodies) {
|
|
30929
|
-
const pos = positions.get(body.id) ?? body;
|
|
30930
|
-
ctx.beginPath();
|
|
30931
|
-
ctx.arc(pos.x, pos.y, body.radius, 0, Math.PI * 2);
|
|
30932
|
-
ctx.fillStyle = body.color ?? "#e94560";
|
|
30933
|
-
ctx.fill();
|
|
30934
|
-
if (p.showVelocity) {
|
|
30935
|
-
ctx.beginPath();
|
|
30936
|
-
ctx.moveTo(pos.x, pos.y);
|
|
30937
|
-
ctx.lineTo(pos.x + body.vx * 0.1, pos.y + body.vy * 0.1);
|
|
30938
|
-
ctx.strokeStyle = "#16213e";
|
|
30939
|
-
ctx.lineWidth = 2;
|
|
30940
|
-
ctx.stroke();
|
|
30941
|
-
}
|
|
30942
|
-
}
|
|
30943
|
-
};
|
|
30944
|
-
return interp.startLoop(drawInterpolated);
|
|
30945
|
-
}, [externalBodies !== void 0, interp.startLoop]);
|
|
30946
|
-
React74.useEffect(() => {
|
|
30947
|
-
draw();
|
|
30948
|
-
}, [draw]);
|
|
30949
|
-
React74.useEffect(() => {
|
|
30950
|
-
if (typeof window === "undefined") return;
|
|
30951
|
-
const canvas = canvasRef.current;
|
|
30952
|
-
if (!canvas) return;
|
|
30953
|
-
bindCanvasCapture(() => canvas.toDataURL("image/png"));
|
|
30954
|
-
return () => {
|
|
30955
|
-
bindCanvasCapture(() => null);
|
|
30956
|
-
};
|
|
30957
|
-
}, []);
|
|
30958
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: cn("flex justify-center", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30959
|
-
"canvas",
|
|
30960
|
-
{
|
|
30961
|
-
ref: canvasRef,
|
|
30962
|
-
width,
|
|
30963
|
-
height,
|
|
30964
|
-
className: "rounded-container block max-w-full h-auto"
|
|
30965
|
-
}
|
|
30966
|
-
) });
|
|
30967
|
-
}
|
|
30968
|
-
var PRESET_BY_ID;
|
|
30969
|
-
var init_SimulationCanvas = __esm({
|
|
30970
|
-
"components/game/2d/organisms/SimulationCanvas.tsx"() {
|
|
30971
|
-
init_cn();
|
|
30972
|
-
init_atoms();
|
|
30973
|
-
init_verificationRegistry();
|
|
30974
|
-
init_physicsPresets();
|
|
30975
|
-
init_useRenderInterpolation();
|
|
30976
|
-
PRESET_BY_ID = {
|
|
30977
|
-
"mechanics-projectile": exports.projectileMotion,
|
|
30978
|
-
"mechanics-pendulum": exports.pendulum,
|
|
30979
|
-
"mechanics-spring": exports.springOscillator
|
|
30980
|
-
};
|
|
30981
|
-
SimulationCanvas.displayName = "SimulationCanvas";
|
|
30982
|
-
}
|
|
30983
|
-
});
|
|
30984
|
-
function SimulationControls({
|
|
30985
|
-
running,
|
|
30986
|
-
speed,
|
|
30987
|
-
parameters,
|
|
30988
|
-
onPlay,
|
|
30989
|
-
onPause,
|
|
30990
|
-
onStep,
|
|
30991
|
-
onReset,
|
|
30992
|
-
onSpeedChange,
|
|
30993
|
-
onParameterChange,
|
|
30994
|
-
playEvent,
|
|
30995
|
-
pauseEvent,
|
|
30996
|
-
stepEvent,
|
|
30997
|
-
resetEvent,
|
|
30998
|
-
speedChangeEvent,
|
|
30999
|
-
parameterChangeEvent,
|
|
31000
|
-
assetManifest,
|
|
31001
|
-
className
|
|
31002
|
-
}) {
|
|
31003
|
-
const eventBus = useEventBus();
|
|
31004
|
-
const ui = assetManifest?.ui;
|
|
31005
|
-
const handlePlay = () => {
|
|
31006
|
-
if (playEvent) eventBus.emit(`UI:${playEvent}`, {});
|
|
31007
|
-
onPlay?.();
|
|
31008
|
-
};
|
|
31009
|
-
const handlePause = () => {
|
|
31010
|
-
if (pauseEvent) eventBus.emit(`UI:${pauseEvent}`, {});
|
|
31011
|
-
onPause?.();
|
|
31012
|
-
};
|
|
31013
|
-
const handleStep = () => {
|
|
31014
|
-
if (stepEvent) eventBus.emit(`UI:${stepEvent}`, {});
|
|
31015
|
-
onStep?.();
|
|
31016
|
-
};
|
|
31017
|
-
const handleReset = () => {
|
|
31018
|
-
if (resetEvent) eventBus.emit(`UI:${resetEvent}`, {});
|
|
31019
|
-
onReset?.();
|
|
31020
|
-
};
|
|
31021
|
-
const handleSpeedChange = (s) => {
|
|
31022
|
-
if (speedChangeEvent) eventBus.emit(`UI:${speedChangeEvent}`, { speed: s });
|
|
31023
|
-
onSpeedChange?.(s);
|
|
31024
|
-
};
|
|
31025
|
-
const handleParameterChange = (name, value) => {
|
|
31026
|
-
if (parameterChangeEvent) eventBus.emit(`UI:${parameterChangeEvent}`, { name, value });
|
|
31027
|
-
onParameterChange?.(name, value);
|
|
31028
|
-
};
|
|
31029
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "md", className, children: [
|
|
31030
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", align: "center", children: [
|
|
31031
|
-
running ? /* @__PURE__ */ jsxRuntime.jsxs(exports.Button, { size: "sm", variant: "secondary", onClick: handlePause, children: [
|
|
31032
|
-
/* @__PURE__ */ jsxRuntime.jsx(GameIcon, { icon: LucideIcons2.Pause, assetUrl: ui?.["pause"], size: "sm" }),
|
|
31033
|
-
"Pause"
|
|
31034
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(exports.Button, { size: "sm", variant: "primary", onClick: handlePlay, children: [
|
|
31035
|
-
/* @__PURE__ */ jsxRuntime.jsx(GameIcon, { icon: LucideIcons2.Play, assetUrl: ui?.["play"], size: "sm" }),
|
|
31036
|
-
"Play"
|
|
31037
|
-
] }),
|
|
31038
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Button, { size: "sm", variant: "ghost", onClick: handleStep, disabled: running, children: [
|
|
31039
|
-
/* @__PURE__ */ jsxRuntime.jsx(GameIcon, { icon: LucideIcons2.SkipForward, assetUrl: ui?.["step"], size: "sm" }),
|
|
31040
|
-
"Step"
|
|
31041
|
-
] }),
|
|
31042
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Button, { size: "sm", variant: "ghost", onClick: handleReset, children: [
|
|
31043
|
-
/* @__PURE__ */ jsxRuntime.jsx(GameIcon, { icon: LucideIcons2.RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
31044
|
-
"Reset"
|
|
31045
|
-
] })
|
|
31046
|
-
] }),
|
|
31047
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "xs", children: [
|
|
31048
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", color: "muted", children: [
|
|
31049
|
-
"Speed: ",
|
|
31050
|
-
speed.toFixed(1),
|
|
31051
|
-
"x"
|
|
31052
|
-
] }),
|
|
31053
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31054
|
-
"input",
|
|
31055
|
-
{
|
|
31056
|
-
type: "range",
|
|
31057
|
-
min: 0.1,
|
|
31058
|
-
max: 5,
|
|
31059
|
-
step: 0.1,
|
|
31060
|
-
value: speed,
|
|
31061
|
-
onChange: (e) => handleSpeedChange(parseFloat(e.target.value)),
|
|
31062
|
-
className: "w-full"
|
|
31063
|
-
}
|
|
31064
|
-
)
|
|
31065
|
-
] }),
|
|
31066
|
-
Object.entries(parameters).map(([name, param]) => /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "xs", children: [
|
|
31067
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", color: "muted", children: [
|
|
31068
|
-
param.label,
|
|
31069
|
-
": ",
|
|
31070
|
-
param.value.toFixed(2)
|
|
31071
|
-
] }),
|
|
31072
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31073
|
-
"input",
|
|
31074
|
-
{
|
|
31075
|
-
type: "range",
|
|
31076
|
-
min: param.min,
|
|
31077
|
-
max: param.max,
|
|
31078
|
-
step: param.step,
|
|
31079
|
-
value: param.value,
|
|
31080
|
-
onChange: (e) => handleParameterChange(name, parseFloat(e.target.value)),
|
|
31081
|
-
className: "w-full"
|
|
31082
|
-
}
|
|
31083
|
-
)
|
|
31084
|
-
] }, name))
|
|
31085
|
-
] });
|
|
31086
|
-
}
|
|
31087
|
-
var init_SimulationControls = __esm({
|
|
31088
|
-
"components/game/2d/organisms/SimulationControls.tsx"() {
|
|
31089
|
-
init_useEventBus();
|
|
31090
|
-
init_atoms();
|
|
31091
|
-
init_GameIcon();
|
|
31092
|
-
SimulationControls.displayName = "SimulationControls";
|
|
31093
|
-
}
|
|
31094
|
-
});
|
|
31095
|
-
function SimulationGraph({
|
|
31096
|
-
label,
|
|
31097
|
-
unit,
|
|
31098
|
-
data,
|
|
31099
|
-
maxPoints = 200,
|
|
31100
|
-
width = 300,
|
|
31101
|
-
height = 120,
|
|
31102
|
-
color = "#e94560",
|
|
31103
|
-
className
|
|
31104
|
-
}) {
|
|
31105
|
-
const canvasRef = React74.useRef(null);
|
|
31106
|
-
const visibleData = data.slice(-maxPoints);
|
|
31107
|
-
React74.useEffect(() => {
|
|
31108
|
-
const canvas = canvasRef.current;
|
|
31109
|
-
if (!canvas || visibleData.length < 2) return;
|
|
31110
|
-
const ctx = canvas.getContext("2d");
|
|
31111
|
-
if (!ctx) return;
|
|
31112
|
-
ctx.clearRect(0, 0, width, height);
|
|
31113
|
-
ctx.fillStyle = "#0f0f23";
|
|
31114
|
-
ctx.fillRect(0, 0, width, height);
|
|
31115
|
-
ctx.strokeStyle = "#1a1a3e";
|
|
31116
|
-
ctx.lineWidth = 0.5;
|
|
31117
|
-
for (let i = 0; i < 5; i++) {
|
|
31118
|
-
const y = height / 5 * i;
|
|
31119
|
-
ctx.beginPath();
|
|
31120
|
-
ctx.moveTo(0, y);
|
|
31121
|
-
ctx.lineTo(width, y);
|
|
31122
|
-
ctx.stroke();
|
|
31123
|
-
}
|
|
31124
|
-
let minVal = Infinity;
|
|
31125
|
-
let maxVal = -Infinity;
|
|
31126
|
-
for (const pt of visibleData) {
|
|
31127
|
-
if (pt.value < minVal) minVal = pt.value;
|
|
31128
|
-
if (pt.value > maxVal) maxVal = pt.value;
|
|
31129
|
-
}
|
|
31130
|
-
const range = maxVal - minVal || 1;
|
|
31131
|
-
const pad = height * 0.1;
|
|
31132
|
-
ctx.beginPath();
|
|
31133
|
-
ctx.strokeStyle = color;
|
|
31134
|
-
ctx.lineWidth = 2;
|
|
31135
|
-
for (let i = 0; i < visibleData.length; i++) {
|
|
31136
|
-
const x = i / (maxPoints - 1) * width;
|
|
31137
|
-
const y = pad + (maxVal - visibleData[i].value) / range * (height - 2 * pad);
|
|
31138
|
-
if (i === 0) ctx.moveTo(x, y);
|
|
31139
|
-
else ctx.lineTo(x, y);
|
|
31140
|
-
}
|
|
31141
|
-
ctx.stroke();
|
|
31142
|
-
const last = visibleData[visibleData.length - 1];
|
|
31143
|
-
ctx.fillStyle = color;
|
|
31144
|
-
ctx.font = "12px monospace";
|
|
31145
|
-
ctx.fillText(`${last.value.toFixed(2)} ${unit}`, width - 80, 16);
|
|
31146
|
-
}, [visibleData, width, height, color, unit, maxPoints]);
|
|
31147
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.Card, { padding: "sm", className, children: /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "xs", children: [
|
|
31148
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", weight: "bold", children: label }),
|
|
31149
|
-
/* @__PURE__ */ jsxRuntime.jsx("canvas", { ref: canvasRef, width, height, className: "rounded" })
|
|
31150
|
-
] }) });
|
|
31151
|
-
}
|
|
31152
|
-
var init_SimulationGraph = __esm({
|
|
31153
|
-
"components/game/2d/organisms/SimulationGraph.tsx"() {
|
|
31154
|
-
init_atoms();
|
|
31155
|
-
SimulationGraph.displayName = "SimulationGraph";
|
|
31156
|
-
}
|
|
31157
|
-
});
|
|
31158
30861
|
exports.GameTemplate = void 0;
|
|
31159
30862
|
var init_GameTemplate = __esm({
|
|
31160
30863
|
"components/game/2d/templates/GameTemplate.tsx"() {
|
|
@@ -31418,9 +31121,6 @@ var init_molecules = __esm({
|
|
|
31418
31121
|
init_BuilderBoard();
|
|
31419
31122
|
init_DebuggerBoard();
|
|
31420
31123
|
init_NegotiatorBoard();
|
|
31421
|
-
init_SimulationCanvas();
|
|
31422
|
-
init_SimulationControls();
|
|
31423
|
-
init_SimulationGraph();
|
|
31424
31124
|
init_physicsPresets();
|
|
31425
31125
|
init_GameTemplate();
|
|
31426
31126
|
init_GameShell();
|
|
@@ -32025,13 +31725,13 @@ var init_MapView = __esm({
|
|
|
32025
31725
|
shadowSize: [41, 41]
|
|
32026
31726
|
});
|
|
32027
31727
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
32028
|
-
const { useEffect:
|
|
31728
|
+
const { useEffect: useEffect69, useRef: useRef64, useCallback: useCallback113, useState: useState108 } = React74__namespace.default;
|
|
32029
31729
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
32030
31730
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
32031
31731
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
32032
31732
|
const map = useMap();
|
|
32033
|
-
const prevRef =
|
|
32034
|
-
|
|
31733
|
+
const prevRef = useRef64({ centerLat, centerLng, zoom });
|
|
31734
|
+
useEffect69(() => {
|
|
32035
31735
|
const prev = prevRef.current;
|
|
32036
31736
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
32037
31737
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -32042,7 +31742,7 @@ var init_MapView = __esm({
|
|
|
32042
31742
|
}
|
|
32043
31743
|
function MapClickHandler({ onMapClick }) {
|
|
32044
31744
|
const map = useMap();
|
|
32045
|
-
|
|
31745
|
+
useEffect69(() => {
|
|
32046
31746
|
if (!onMapClick) return;
|
|
32047
31747
|
const handler = (e) => {
|
|
32048
31748
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -32071,7 +31771,7 @@ var init_MapView = __esm({
|
|
|
32071
31771
|
}) {
|
|
32072
31772
|
const eventBus = useEventBus2();
|
|
32073
31773
|
const [clickedPosition, setClickedPosition] = useState108(null);
|
|
32074
|
-
const handleMapClick =
|
|
31774
|
+
const handleMapClick = useCallback113((lat, lng) => {
|
|
32075
31775
|
if (showClickedPin) {
|
|
32076
31776
|
setClickedPosition({ lat, lng });
|
|
32077
31777
|
}
|
|
@@ -32080,7 +31780,7 @@ var init_MapView = __esm({
|
|
|
32080
31780
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
32081
31781
|
}
|
|
32082
31782
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
32083
|
-
const handleMarkerClick =
|
|
31783
|
+
const handleMarkerClick = useCallback113((marker) => {
|
|
32084
31784
|
onMarkerClick?.(marker);
|
|
32085
31785
|
if (markerClickEvent) {
|
|
32086
31786
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -48031,6 +47731,7 @@ var init_component_registry_generated = __esm({
|
|
|
48031
47731
|
init_Navigation();
|
|
48032
47732
|
init_NegotiatorBoard();
|
|
48033
47733
|
init_NumberStepper();
|
|
47734
|
+
init_ObjectRulePanel();
|
|
48034
47735
|
init_OptionConstraintGroup();
|
|
48035
47736
|
init_OrbitalVisualization();
|
|
48036
47737
|
init_Overlay();
|
|
@@ -48076,7 +47777,6 @@ var init_component_registry_generated = __esm({
|
|
|
48076
47777
|
init_Sidebar();
|
|
48077
47778
|
init_SignaturePad();
|
|
48078
47779
|
init_SimpleGrid();
|
|
48079
|
-
init_SimulationCanvas();
|
|
48080
47780
|
init_SimulatorBoard();
|
|
48081
47781
|
init_Skeleton();
|
|
48082
47782
|
init_SocialProof();
|
|
@@ -48094,6 +47794,7 @@ var init_component_registry_generated = __esm({
|
|
|
48094
47794
|
init_StateArchitectBoard();
|
|
48095
47795
|
init_StateGraph();
|
|
48096
47796
|
init_StateIndicator();
|
|
47797
|
+
init_StateJsonView();
|
|
48097
47798
|
init_StateMachineView();
|
|
48098
47799
|
init_StatsGrid();
|
|
48099
47800
|
init_StatsOrganism();
|
|
@@ -48140,6 +47841,7 @@ var init_component_registry_generated = __esm({
|
|
|
48140
47841
|
init_Typography();
|
|
48141
47842
|
init_UISlotRenderer();
|
|
48142
47843
|
init_UploadDropZone();
|
|
47844
|
+
init_VariablePanel();
|
|
48143
47845
|
init_VersionDiff();
|
|
48144
47846
|
init_ViolationAlert();
|
|
48145
47847
|
init_VoteStack();
|
|
@@ -48340,6 +48042,7 @@ var init_component_registry_generated = __esm({
|
|
|
48340
48042
|
"Navigation": exports.Navigation,
|
|
48341
48043
|
"NegotiatorBoard": NegotiatorBoard,
|
|
48342
48044
|
"NumberStepper": exports.NumberStepper,
|
|
48045
|
+
"ObjectRulePanel": ObjectRulePanel,
|
|
48343
48046
|
"OptionConstraintGroup": exports.OptionConstraintGroup,
|
|
48344
48047
|
"OrbitalVisualization": exports.OrbitalVisualization,
|
|
48345
48048
|
"Overlay": exports.Overlay,
|
|
@@ -48385,7 +48088,6 @@ var init_component_registry_generated = __esm({
|
|
|
48385
48088
|
"Sidebar": exports.Sidebar,
|
|
48386
48089
|
"SignaturePad": exports.SignaturePad,
|
|
48387
48090
|
"SimpleGrid": exports.SimpleGrid,
|
|
48388
|
-
"SimulationCanvas": SimulationCanvas,
|
|
48389
48091
|
"SimulatorBoard": SimulatorBoard,
|
|
48390
48092
|
"Skeleton": Skeleton,
|
|
48391
48093
|
"SocialProof": exports.SocialProof,
|
|
@@ -48406,6 +48108,7 @@ var init_component_registry_generated = __esm({
|
|
|
48406
48108
|
"StateArchitectBoard": StateArchitectBoard,
|
|
48407
48109
|
"StateGraph": StateGraph,
|
|
48408
48110
|
"StateIndicator": StateIndicator,
|
|
48111
|
+
"StateJsonView": StateJsonView,
|
|
48409
48112
|
"StateMachineView": exports.StateMachineView,
|
|
48410
48113
|
"StatsGrid": exports.StatsGrid,
|
|
48411
48114
|
"StatsOrganism": exports.StatsOrganism,
|
|
@@ -48453,6 +48156,7 @@ var init_component_registry_generated = __esm({
|
|
|
48453
48156
|
"UISlotRenderer": UISlotRenderer,
|
|
48454
48157
|
"UploadDropZone": exports.UploadDropZone,
|
|
48455
48158
|
"VStack": exports.VStack,
|
|
48159
|
+
"VariablePanel": VariablePanel,
|
|
48456
48160
|
"VersionDiff": exports.VersionDiff,
|
|
48457
48161
|
"ViolationAlert": exports.ViolationAlert,
|
|
48458
48162
|
"VoteStack": exports.VoteStack,
|
|
@@ -51753,9 +51457,6 @@ exports.RuntimeDebugger = RuntimeDebugger;
|
|
|
51753
51457
|
exports.ScoreDisplay = ScoreDisplay;
|
|
51754
51458
|
exports.SequenceBar = SequenceBar;
|
|
51755
51459
|
exports.SequencerBoard = SequencerBoard;
|
|
51756
|
-
exports.SimulationCanvas = SimulationCanvas;
|
|
51757
|
-
exports.SimulationControls = SimulationControls;
|
|
51758
|
-
exports.SimulationGraph = SimulationGraph;
|
|
51759
51460
|
exports.SimulatorBoard = SimulatorBoard;
|
|
51760
51461
|
exports.Skeleton = Skeleton;
|
|
51761
51462
|
exports.SlotContentRenderer = SlotContentRenderer;
|