@almadar/ui 2.9.4 → 2.10.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.
@@ -3,21 +3,21 @@ import { useAuthContext } from '../chunk-GTIAVPI5.js';
3
3
  export { ENTITY_EVENTS, useAgentChat, useAuthContext, useCompile, useConnectGitHub, useCreateEntity, useDeepAgentGeneration, useDeleteEntity, useDisconnectGitHub, useEntities, useEntitiesByType, useEntity as useEntityById, useEntityMutations, useExtensions, useFileEditor, useFileSystem, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useInput, useOrbitalHistory, useOrbitalMutations, usePhysics, usePinchZoom, usePlayer, usePreview, useResolvedEntity, useSelectedEntity, useSendOrbitalEvent, useSingletonEntity, useUIEvents, useUpdateEntity, useValidation } from '../chunk-GTIAVPI5.js';
4
4
  export { clearEntities, getAllEntities, getByType, getEntity, getSingleton, removeEntity, spawnEntity, updateEntity, updateSingleton } from '../chunk-N7MVUW4R.js';
5
5
  import '../chunk-3HJHHULT.js';
6
- import { VStack, HStack, Typography, Button, Icon, Box, Card, Avatar, Badge, SearchInput, Checkbox, Menu as Menu$1, Pagination, LoadingState, EmptyState, Modal, ErrorState, QuizBlock, CodeBlock, ScaledDiagram, MarkdownContent, Divider, ProgressBar, isoToScreen, IsometricCanvas_default, Stack, Select, Drawer, Toast, Tabs, Input, ThemeToggle, TILE_WIDTH, EntityDisplayEvents, StateIndicator, Container } from '../chunk-P6NZVIE5.js';
7
- export { Accordion, ActionButton, ActionButtons, Card2 as ActionCard, Alert, AnimatedCounter, Avatar, Badge, Box, Breadcrumb, Button, ButtonGroup, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, Center, ChartLegend, Checkbox, ChoiceButton, CodeBlock, CombatLog, ComboCounter, ConditionalWrapper, ConfettiEffect, Container, ControlButton, CraftingRecipe, DIAMOND_TOP_Y, DPad, DamageNumber, DataGrid, DataList, DataTable, DateRangeSelector, DayCell, DetailPanel, DialogueBox, DialogueBubble, Divider, Drawer, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FLOOR_HEIGHT, FilterGroup, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormField, FormSectionHeader, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GraphView, Grid, HStack, Heading, HealthBar, HealthPanel, Icon, InfiniteScrollSentinel, Input, InputGroup, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, Label, LawReferenceTooltip, Lightbox, LineChart, LoadingState, MapView, MarkdownContent, MasterDetail, Menu, Meter, MiniMap, Modal, NumberStepper, Overlay, PageHeader, Pagination, PlatformerCanvas, Popover, PowerupSlots, ProgressBar, ProgressDots, PullToRefresh, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ResourceBar, ResourceCounter, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Select, SidePanel, SimpleGrid, Skeleton, SlotContentRenderer, SortableList, Spacer, Spinner, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateIndicator, StatusDot, StatusEffect, SwipeableRow, Switch, TILE_HEIGHT, TILE_WIDTH, Tabs, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, TimerDisplay, Toast, Tooltip, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UnitCommandBar, UploadDropZone, VStack, ViolationAlert, WaypointMarker, WizardNavigation, WizardProgress, XPBar, drawSprite, isoToScreen, screenToIso, useCamera, useImageCache } from '../chunk-P6NZVIE5.js';
6
+ import { VStack, HStack, Typography, Button, Icon, Box, Card, Avatar, Badge, SearchInput, Checkbox, Menu as Menu$1, Pagination, LoadingState, EmptyState, Modal, ErrorState, QuizBlock, CodeBlock, ScaledDiagram, MarkdownContent, Divider, ProgressBar, isoToScreen, IsometricCanvas_default, Stack, Select, Drawer, Toast, Tabs, Input, ThemeToggle, TILE_WIDTH, EntityDisplayEvents, StateIndicator, Container } from '../chunk-7M2KEJTF.js';
7
+ export { ALL_PRESETS, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, Alert, AnimatedCounter, Avatar, Badge, Box, Breadcrumb, Button, ButtonGroup, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, Center, Chart, ChartLegend, Checkbox, ChoiceButton, CodeBlock, CombatLog, ComboCounter, ConditionalWrapper, ConfettiEffect, Container, ControlButton, CraftingRecipe, DIAMOND_TOP_Y, DPad, DamageNumber, DataGrid, DataList, DataTable, DateRangeSelector, DayCell, DetailPanel, DialogueBox, DialogueBubble, Divider, Drawer, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FLOOR_HEIGHT, FilterGroup, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormField, FormSectionHeader, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GraphView, Grid, HStack, Heading, HealthBar, HealthPanel, Icon, InfiniteScrollSentinel, Input, InputGroup, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, Label, LawReferenceTooltip, Lightbox, LineChart, LoadingState, MapView, MarkdownContent, MasterDetail, Menu, Meter, MiniMap, Modal, NumberStepper, Overlay, PageHeader, Pagination, PlatformerCanvas, Popover, PowerupSlots, ProgressBar, ProgressDots, PullToRefresh, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ResourceBar, ResourceCounter, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Select, SidePanel, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, Skeleton, SlotContentRenderer, SortableList, Spacer, Spinner, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateIndicator, StatusDot, StatusEffect, SwipeableRow, Switch, TILE_HEIGHT, TILE_WIDTH, Tabs, Text, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, TimerDisplay, Toast, Tooltip, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UnitCommandBar, UploadDropZone, VStack, ViolationAlert, WaypointMarker, WizardNavigation, WizardProgress, XPBar, drawSprite, isoToScreen, pendulum, projectileMotion, screenToIso, springOscillator, useCamera, useImageCache } from '../chunk-7M2KEJTF.js';
8
8
  import '../chunk-DKQN5FVU.js';
9
9
  import { useTranslate } from '../chunk-WGJIL4YR.js';
10
10
  export { EntityDataProvider, I18nProvider, createTranslate, entityDataKeys, parseQueryBinding, useDragReorder, useEntity, useEntityDataAdapter, useEntityDetail, useEntityList, useEntityListSuspense, useEntitySuspense, useInfiniteScroll, useLongPress, usePullToRefresh, useQuerySingleton, useSwipeGesture, useTranslate } from '../chunk-WGJIL4YR.js';
11
11
  import { useEventBus, useEventListener } from '../chunk-YXZM3WCF.js';
12
12
  export { useEmitEvent, useEventBus, useEventListener } from '../chunk-YXZM3WCF.js';
13
13
  export { DEFAULT_SLOTS, useUISlotManager } from '../chunk-3JGAROCW.js';
14
- import { cn, getNestedValue, bindCanvasCapture } from '../chunk-6D5QMEUS.js';
14
+ import { cn, getNestedValue } from '../chunk-6D5QMEUS.js';
15
15
  export { cn } from '../chunk-6D5QMEUS.js';
16
16
  import '../chunk-TSETXL2E.js';
17
17
  import '../chunk-K2D5D3WK.js';
18
18
  import { __publicField } from '../chunk-PKBMQBKP.js';
19
19
  import React, { createContext, useState, useCallback, useMemo, useEffect, useRef, useContext } from 'react';
20
- import { ChevronDown, X, Menu, ChevronRight, ChevronLeft, ArrowUp, ArrowDown, MoreVertical, Package, Check, AlertTriangle, Trash2, List as List$1, Printer, CheckCircle, XCircle, Play, RotateCcw, Send, Wrench, Bug, ArrowRight, Pause, SkipForward, AlertCircle, Circle, Clock, CheckCircle2, Image as Image$1, Upload, ZoomIn, Eraser, FileText, ZoomOut, Download, Code, WrapText, Copy, Settings, Search, Bell, LogOut, Calendar, Pencil, Eye, MoreHorizontal, Minus, Plus } from 'lucide-react';
20
+ import { ChevronDown, X, Menu, ChevronRight, ChevronLeft, ArrowUp, ArrowDown, MoreVertical, Package, Check, AlertTriangle, Trash2, List as List$1, Printer, CheckCircle, XCircle, Play, RotateCcw, Send, Wrench, Bug, ArrowRight, AlertCircle, Circle, Clock, CheckCircle2, Image as Image$1, Upload, ZoomIn, Eraser, FileText, ZoomOut, Download, Code, WrapText, Copy, Settings, Search, Bell, LogOut, Pause, Calendar, Pencil, Eye, MoreHorizontal, Minus, Plus } from 'lucide-react';
21
21
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
22
22
  import { createPortal } from 'react-dom';
23
23
  import { useLocation, Link, Outlet } from 'react-router-dom';
@@ -415,7 +415,7 @@ var Section = ({
415
415
  };
416
416
  Section.displayName = "Section";
417
417
  var SidebarNavItem = ({ item, collapsed }) => {
418
- const Icon3 = item.icon;
418
+ const Icon2 = item.icon;
419
419
  const isActive = item.active ?? item.isActive;
420
420
  return /* @__PURE__ */ jsxs(
421
421
  Button,
@@ -437,8 +437,8 @@ var SidebarNavItem = ({ item, collapsed }) => {
437
437
  ),
438
438
  title: collapsed ? item.label : void 0,
439
439
  children: [
440
- Icon3 && /* @__PURE__ */ jsx(
441
- Icon3,
440
+ Icon2 && /* @__PURE__ */ jsx(
441
+ Icon2,
442
442
  {
443
443
  size: 20,
444
444
  className: cn(
@@ -5828,7 +5828,7 @@ var FEATURE_TYPES = [
5828
5828
  "castle"
5829
5829
  ];
5830
5830
  function CollapsibleSection({ title, expanded, onToggle, children, className }) {
5831
- const Icon3 = expanded ? ChevronDown : ChevronRight;
5831
+ const Icon2 = expanded ? ChevronDown : ChevronRight;
5832
5832
  return /* @__PURE__ */ jsxs(VStack, { gap: "xs", className, children: [
5833
5833
  /* @__PURE__ */ jsx(
5834
5834
  Button,
@@ -5838,7 +5838,7 @@ function CollapsibleSection({ title, expanded, onToggle, children, className })
5838
5838
  onClick: onToggle,
5839
5839
  className: "w-full justify-start text-left",
5840
5840
  children: /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
5841
- /* @__PURE__ */ jsx(Icon3, { size: 14 }),
5841
+ /* @__PURE__ */ jsx(Icon2, { size: 14 }),
5842
5842
  /* @__PURE__ */ jsx(Typography, { variant: "label", weight: "semibold", children: title })
5843
5843
  ] })
5844
5844
  }
@@ -7854,331 +7854,6 @@ function NegotiatorBoard({
7854
7854
  }
7855
7855
  NegotiatorBoard.displayName = "NegotiatorBoard";
7856
7856
 
7857
- // components/organisms/game/physics-sim/presets/mechanics.ts
7858
- var projectileMotion = {
7859
- id: "mechanics-projectile",
7860
- name: "Projectile Motion",
7861
- description: "Launch a ball and observe parabolic trajectory under gravity.",
7862
- domain: "natural",
7863
- gravity: { x: 0, y: 9.81 },
7864
- bodies: [
7865
- { id: "ball", x: 50, y: 350, vx: 80, vy: -120, mass: 1, radius: 10, color: "#e94560", fixed: false },
7866
- { id: "ground", x: 300, y: 390, vx: 0, vy: 0, mass: 1e3, radius: 400, color: "#333", fixed: true }
7867
- ],
7868
- showVelocity: true,
7869
- parameters: {
7870
- angle: { value: 45, min: 0, max: 90, step: 1, label: "Launch angle (deg)" },
7871
- velocity: { value: 100, min: 10, max: 200, step: 5, label: "Initial velocity (m/s)" },
7872
- gravity: { value: 9.81, min: 0, max: 20, step: 0.1, label: "Gravity (m/s\xB2)" }
7873
- }
7874
- };
7875
- var pendulum = {
7876
- id: "mechanics-pendulum",
7877
- name: "Simple Pendulum",
7878
- description: "A mass on a string swinging under gravity.",
7879
- domain: "natural",
7880
- gravity: { x: 0, y: 9.81 },
7881
- bodies: [
7882
- { id: "pivot", x: 300, y: 50, vx: 0, vy: 0, mass: 1e3, radius: 5, color: "#888", fixed: true },
7883
- { id: "bob", x: 400, y: 200, vx: 0, vy: 0, mass: 5, radius: 15, color: "#e94560", fixed: false }
7884
- ],
7885
- constraints: [{ bodyA: 0, bodyB: 1, length: 180, stiffness: 1 }],
7886
- parameters: {
7887
- length: { value: 180, min: 50, max: 300, step: 10, label: "String length (px)" },
7888
- mass: { value: 5, min: 1, max: 20, step: 0.5, label: "Mass (kg)" },
7889
- gravity: { value: 9.81, min: 0, max: 20, step: 0.1, label: "Gravity (m/s\xB2)" }
7890
- }
7891
- };
7892
- var springOscillator = {
7893
- id: "mechanics-spring",
7894
- name: "Spring Oscillator",
7895
- description: "A mass bouncing on a spring \u2014 simple harmonic motion.",
7896
- domain: "natural",
7897
- gravity: { x: 0, y: 0 },
7898
- bodies: [
7899
- { id: "anchor", x: 300, y: 50, vx: 0, vy: 0, mass: 1e3, radius: 8, color: "#888", fixed: true },
7900
- { id: "mass", x: 300, y: 250, vx: 0, vy: 0, mass: 2, radius: 20, color: "#0f3460", fixed: false }
7901
- ],
7902
- constraints: [{ bodyA: 0, bodyB: 1, length: 150, stiffness: 0.5 }],
7903
- parameters: {
7904
- stiffness: { value: 0.5, min: 0.1, max: 2, step: 0.05, label: "Spring stiffness (k)" },
7905
- mass: { value: 2, min: 0.5, max: 10, step: 0.5, label: "Mass (kg)" },
7906
- damping: { value: 0, min: 0, max: 0.5, step: 0.01, label: "Damping" }
7907
- }
7908
- };
7909
-
7910
- // components/organisms/game/physics-sim/presets/index.ts
7911
- var ALL_PRESETS = [
7912
- projectileMotion,
7913
- pendulum,
7914
- springOscillator
7915
- ];
7916
- function resolvePreset(preset) {
7917
- if (typeof preset !== "string") return preset;
7918
- const needle = preset.toLowerCase();
7919
- return ALL_PRESETS.find(
7920
- (p) => p.id === preset || p.id.includes(needle) || p.name.toLowerCase().includes(needle)
7921
- ) ?? projectileMotion;
7922
- }
7923
- function SimulationCanvas({
7924
- preset: presetProp,
7925
- width = 600,
7926
- height = 400,
7927
- running,
7928
- speed = 1,
7929
- className
7930
- }) {
7931
- const preset = useMemo(() => resolvePreset(presetProp), [presetProp]);
7932
- const canvasRef = useRef(null);
7933
- const bodiesRef = useRef(structuredClone(preset.bodies));
7934
- useEffect(() => {
7935
- bodiesRef.current = structuredClone(preset.bodies);
7936
- }, [preset]);
7937
- const step = useCallback(() => {
7938
- const dt = Math.min(1 / 60 * speed, 1 / 15);
7939
- const gx = preset.gravity?.x ?? 0;
7940
- const gy = preset.gravity?.y ?? 9.81;
7941
- const bodies = bodiesRef.current;
7942
- const maxVel = Math.max(width, height) * 5;
7943
- for (const body of bodies) {
7944
- if (body.fixed) continue;
7945
- body.vx += gx * dt;
7946
- body.vy += gy * dt;
7947
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
7948
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
7949
- body.x += body.vx * dt;
7950
- body.y += body.vy * dt;
7951
- if (body.y + body.radius > height) {
7952
- body.y = height - body.radius;
7953
- body.vy = -body.vy * 0.8;
7954
- }
7955
- if (body.y - body.radius < 0) {
7956
- body.y = body.radius;
7957
- body.vy = -body.vy * 0.8;
7958
- }
7959
- if (body.x + body.radius > width) {
7960
- body.x = width - body.radius;
7961
- body.vx = -body.vx * 0.8;
7962
- }
7963
- if (body.x - body.radius < 0) {
7964
- body.x = body.radius;
7965
- body.vx = -body.vx * 0.8;
7966
- }
7967
- }
7968
- if (preset.constraints) {
7969
- for (const c of preset.constraints) {
7970
- const a = bodies[c.bodyA];
7971
- const b = bodies[c.bodyB];
7972
- if (!a || !b) continue;
7973
- const dx = b.x - a.x;
7974
- const dy = b.y - a.y;
7975
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
7976
- const diff = (dist - c.length) / dist;
7977
- const fx = dx * diff * c.stiffness;
7978
- const fy = dy * diff * c.stiffness;
7979
- if (!a.fixed) {
7980
- a.vx += fx * dt;
7981
- a.vy += fy * dt;
7982
- }
7983
- if (!b.fixed) {
7984
- b.vx -= fx * dt;
7985
- b.vy -= fy * dt;
7986
- }
7987
- }
7988
- }
7989
- }, [preset, width, height, speed]);
7990
- const draw = useCallback(() => {
7991
- const canvas = canvasRef.current;
7992
- if (!canvas) return;
7993
- const ctx = canvas.getContext("2d");
7994
- if (!ctx) return;
7995
- const bodies = bodiesRef.current;
7996
- ctx.clearRect(0, 0, width, height);
7997
- ctx.fillStyle = preset.backgroundColor ?? "#1a1a2e";
7998
- ctx.fillRect(0, 0, width, height);
7999
- if (preset.constraints) {
8000
- for (const c of preset.constraints) {
8001
- const a = bodies[c.bodyA];
8002
- const b = bodies[c.bodyB];
8003
- if (a && b) {
8004
- ctx.beginPath();
8005
- ctx.moveTo(a.x, a.y);
8006
- ctx.lineTo(b.x, b.y);
8007
- ctx.strokeStyle = "#533483";
8008
- ctx.lineWidth = 1;
8009
- ctx.setLineDash([4, 4]);
8010
- ctx.stroke();
8011
- ctx.setLineDash([]);
8012
- }
8013
- }
8014
- }
8015
- for (const body of bodies) {
8016
- ctx.beginPath();
8017
- ctx.arc(body.x, body.y, body.radius, 0, Math.PI * 2);
8018
- ctx.fillStyle = body.color ?? "#e94560";
8019
- ctx.fill();
8020
- if (preset.showVelocity) {
8021
- ctx.beginPath();
8022
- ctx.moveTo(body.x, body.y);
8023
- ctx.lineTo(body.x + body.vx * 0.1, body.y + body.vy * 0.1);
8024
- ctx.strokeStyle = "#16213e";
8025
- ctx.lineWidth = 2;
8026
- ctx.stroke();
8027
- }
8028
- }
8029
- }, [width, height, preset]);
8030
- useEffect(() => {
8031
- if (!running) return;
8032
- let raf;
8033
- const loop = () => {
8034
- step();
8035
- draw();
8036
- raf = requestAnimationFrame(loop);
8037
- };
8038
- raf = requestAnimationFrame(loop);
8039
- return () => cancelAnimationFrame(raf);
8040
- }, [running, step, draw]);
8041
- useEffect(() => {
8042
- draw();
8043
- }, [draw]);
8044
- useEffect(() => {
8045
- if (typeof window === "undefined") return;
8046
- const canvas = canvasRef.current;
8047
- if (!canvas) return;
8048
- bindCanvasCapture(() => canvas.toDataURL("image/png"));
8049
- return () => {
8050
- bindCanvasCapture(() => null);
8051
- };
8052
- }, []);
8053
- return /* @__PURE__ */ jsx(Box, { className: cn("flex justify-center", className), children: /* @__PURE__ */ jsx(
8054
- "canvas",
8055
- {
8056
- ref: canvasRef,
8057
- width,
8058
- height,
8059
- className: "rounded-md block max-w-full h-auto"
8060
- }
8061
- ) });
8062
- }
8063
- SimulationCanvas.displayName = "SimulationCanvas";
8064
- function SimulationControls({
8065
- running,
8066
- speed,
8067
- parameters,
8068
- onPlay,
8069
- onPause,
8070
- onStep,
8071
- onReset,
8072
- onSpeedChange,
8073
- onParameterChange,
8074
- className
8075
- }) {
8076
- return /* @__PURE__ */ jsxs(VStack, { gap: "md", className, children: [
8077
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
8078
- running ? /* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", onClick: onPause, icon: Pause, children: "Pause" }) : /* @__PURE__ */ jsx(Button, { size: "sm", variant: "primary", onClick: onPlay, icon: Play, children: "Play" }),
8079
- /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onStep, icon: SkipForward, disabled: running, children: "Step" }),
8080
- /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onReset, icon: RotateCcw, children: "Reset" })
8081
- ] }),
8082
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
8083
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "muted", children: [
8084
- "Speed: ",
8085
- speed.toFixed(1),
8086
- "x"
8087
- ] }),
8088
- /* @__PURE__ */ jsx(
8089
- "input",
8090
- {
8091
- type: "range",
8092
- min: 0.1,
8093
- max: 5,
8094
- step: 0.1,
8095
- value: speed,
8096
- onChange: (e) => onSpeedChange(parseFloat(e.target.value)),
8097
- className: "w-full"
8098
- }
8099
- )
8100
- ] }),
8101
- Object.entries(parameters).map(([name, param]) => /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
8102
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "muted", children: [
8103
- param.label,
8104
- ": ",
8105
- param.value.toFixed(2)
8106
- ] }),
8107
- /* @__PURE__ */ jsx(
8108
- "input",
8109
- {
8110
- type: "range",
8111
- min: param.min,
8112
- max: param.max,
8113
- step: param.step,
8114
- value: param.value,
8115
- onChange: (e) => onParameterChange(name, parseFloat(e.target.value)),
8116
- className: "w-full"
8117
- }
8118
- )
8119
- ] }, name))
8120
- ] });
8121
- }
8122
- SimulationControls.displayName = "SimulationControls";
8123
- function SimulationGraph({
8124
- label,
8125
- unit,
8126
- data,
8127
- maxPoints = 200,
8128
- width = 300,
8129
- height = 120,
8130
- color = "#e94560",
8131
- className
8132
- }) {
8133
- const canvasRef = useRef(null);
8134
- const visibleData = data.slice(-maxPoints);
8135
- useEffect(() => {
8136
- const canvas = canvasRef.current;
8137
- if (!canvas || visibleData.length < 2) return;
8138
- const ctx = canvas.getContext("2d");
8139
- if (!ctx) return;
8140
- ctx.clearRect(0, 0, width, height);
8141
- ctx.fillStyle = "#0f0f23";
8142
- ctx.fillRect(0, 0, width, height);
8143
- ctx.strokeStyle = "#1a1a3e";
8144
- ctx.lineWidth = 0.5;
8145
- for (let i = 0; i < 5; i++) {
8146
- const y = height / 5 * i;
8147
- ctx.beginPath();
8148
- ctx.moveTo(0, y);
8149
- ctx.lineTo(width, y);
8150
- ctx.stroke();
8151
- }
8152
- let minVal = Infinity;
8153
- let maxVal = -Infinity;
8154
- for (const pt of visibleData) {
8155
- if (pt.value < minVal) minVal = pt.value;
8156
- if (pt.value > maxVal) maxVal = pt.value;
8157
- }
8158
- const range = maxVal - minVal || 1;
8159
- const pad = height * 0.1;
8160
- ctx.beginPath();
8161
- ctx.strokeStyle = color;
8162
- ctx.lineWidth = 2;
8163
- for (let i = 0; i < visibleData.length; i++) {
8164
- const x = i / (maxPoints - 1) * width;
8165
- const y = pad + (maxVal - visibleData[i].value) / range * (height - 2 * pad);
8166
- if (i === 0) ctx.moveTo(x, y);
8167
- else ctx.lineTo(x, y);
8168
- }
8169
- ctx.stroke();
8170
- const last = visibleData[visibleData.length - 1];
8171
- ctx.fillStyle = color;
8172
- ctx.font = "12px monospace";
8173
- ctx.fillText(`${last.value.toFixed(2)} ${unit}`, width - 80, 16);
8174
- }, [visibleData, width, height, color, unit, maxPoints]);
8175
- return /* @__PURE__ */ jsx(Card, { padding: "sm", className, children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
8176
- /* @__PURE__ */ jsx(Typography, { variant: "caption", weight: "bold", children: label }),
8177
- /* @__PURE__ */ jsx("canvas", { ref: canvasRef, width, height, className: "rounded" })
8178
- ] }) });
8179
- }
8180
- SimulationGraph.displayName = "SimulationGraph";
8181
-
8182
7857
  // components/organisms/game/types/game.ts
8183
7858
  function createInitialGameState(width, height, units, defaultTerrain = "floorStone") {
8184
7859
  const board = Array.from(
@@ -8484,260 +8159,6 @@ function NotifyListener() {
8484
8159
  );
8485
8160
  }
8486
8161
  NotifyListener.displayName = "NotifyListener";
8487
- var CHART_COLORS = [
8488
- "var(--color-primary)",
8489
- "var(--color-success)",
8490
- "var(--color-warning)",
8491
- "var(--color-error)",
8492
- "var(--color-info)",
8493
- "var(--color-accent)"
8494
- ];
8495
- var BarChart = ({ data, height, showValues }) => {
8496
- const maxValue = Math.max(...data.map((d) => d.value), 1);
8497
- return /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "end", className: "w-full", style: { height }, children: data.map((point, idx) => {
8498
- const barHeight = point.value / maxValue * 100;
8499
- const color = point.color || CHART_COLORS[idx % CHART_COLORS.length];
8500
- return /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", flex: true, className: "min-w-0", children: [
8501
- showValues && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "tabular-nums", children: point.value }),
8502
- /* @__PURE__ */ jsx(
8503
- Box,
8504
- {
8505
- className: cn(
8506
- "w-full rounded-t-[var(--radius-sm)] transition-all duration-500 ease-out min-h-[4px]"
8507
- ),
8508
- style: {
8509
- height: `${barHeight}%`,
8510
- backgroundColor: color
8511
- }
8512
- }
8513
- ),
8514
- /* @__PURE__ */ jsx(
8515
- Typography,
8516
- {
8517
- variant: "caption",
8518
- color: "secondary",
8519
- className: "truncate w-full text-center",
8520
- children: point.label
8521
- }
8522
- )
8523
- ] }, point.label);
8524
- }) });
8525
- };
8526
- var PieChart = ({ data, height, showValues, donut = false }) => {
8527
- const total = data.reduce((sum, d) => sum + d.value, 0);
8528
- const size = Math.min(height, 200);
8529
- const radius = size / 2 - 8;
8530
- const innerRadius = donut ? radius * 0.6 : 0;
8531
- const center = size / 2;
8532
- const segments = useMemo(() => {
8533
- let currentAngle = -Math.PI / 2;
8534
- return data.map((point, idx) => {
8535
- const angle = point.value / total * 2 * Math.PI;
8536
- const startAngle = currentAngle;
8537
- const endAngle = currentAngle + angle;
8538
- currentAngle = endAngle;
8539
- const largeArc = angle > Math.PI ? 1 : 0;
8540
- const x1 = center + radius * Math.cos(startAngle);
8541
- const y1 = center + radius * Math.sin(startAngle);
8542
- const x2 = center + radius * Math.cos(endAngle);
8543
- const y2 = center + radius * Math.sin(endAngle);
8544
- let d;
8545
- if (innerRadius > 0) {
8546
- const ix1 = center + innerRadius * Math.cos(startAngle);
8547
- const iy1 = center + innerRadius * Math.sin(startAngle);
8548
- const ix2 = center + innerRadius * Math.cos(endAngle);
8549
- const iy2 = center + innerRadius * Math.sin(endAngle);
8550
- d = `M ${ix1} ${iy1} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} L ${ix2} ${iy2} A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${ix1} ${iy1} Z`;
8551
- } else {
8552
- d = `M ${center} ${center} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z`;
8553
- }
8554
- return {
8555
- d,
8556
- color: point.color || CHART_COLORS[idx % CHART_COLORS.length],
8557
- label: point.label,
8558
- value: point.value,
8559
- percentage: (point.value / total * 100).toFixed(1)
8560
- };
8561
- });
8562
- }, [data, total, radius, innerRadius, center]);
8563
- return /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "center", justify: "center", className: "w-full", children: [
8564
- /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, children: [
8565
- segments.map((seg, idx) => /* @__PURE__ */ jsx(
8566
- "path",
8567
- {
8568
- d: seg.d,
8569
- fill: seg.color,
8570
- stroke: "var(--color-card)",
8571
- strokeWidth: "2",
8572
- className: "transition-opacity duration-200 hover:opacity-80"
8573
- },
8574
- idx
8575
- )),
8576
- donut && /* @__PURE__ */ jsx(
8577
- "text",
8578
- {
8579
- x: center,
8580
- y: center,
8581
- textAnchor: "middle",
8582
- dominantBaseline: "middle",
8583
- fill: "var(--color-foreground)",
8584
- fontSize: "14",
8585
- fontWeight: "bold",
8586
- children: total
8587
- }
8588
- )
8589
- ] }),
8590
- showValues && /* @__PURE__ */ jsx(VStack, { gap: "xs", children: segments.map((seg, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
8591
- /* @__PURE__ */ jsx(
8592
- Box,
8593
- {
8594
- className: "w-3 h-3 rounded-[var(--radius-sm)] flex-shrink-0",
8595
- style: { backgroundColor: seg.color }
8596
- }
8597
- ),
8598
- /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "secondary", className: "truncate", children: [
8599
- seg.label,
8600
- ": ",
8601
- seg.percentage,
8602
- "%"
8603
- ] })
8604
- ] }, idx)) })
8605
- ] });
8606
- };
8607
- var LineChart2 = ({ data, height, showValues, fill = false }) => {
8608
- const maxValue = Math.max(...data.map((d) => d.value), 1);
8609
- const width = 400;
8610
- const padding = { top: 20, right: 20, bottom: 30, left: 40 };
8611
- const chartWidth = width - padding.left - padding.right;
8612
- const chartHeight = height - padding.top - padding.bottom;
8613
- const points = useMemo(() => {
8614
- return data.map((point, idx) => ({
8615
- x: padding.left + idx / Math.max(data.length - 1, 1) * chartWidth,
8616
- y: padding.top + chartHeight - point.value / maxValue * chartHeight,
8617
- ...point
8618
- }));
8619
- }, [data, maxValue, chartWidth, chartHeight, padding]);
8620
- const linePath = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
8621
- const areaPath = `${linePath} L ${points[points.length - 1]?.x ?? 0} ${padding.top + chartHeight} L ${padding.left} ${padding.top + chartHeight} Z`;
8622
- return /* @__PURE__ */ jsxs("svg", { width: "100%", height, viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", children: [
8623
- [0, 0.25, 0.5, 0.75, 1].map((frac) => {
8624
- const y = padding.top + chartHeight * (1 - frac);
8625
- return /* @__PURE__ */ jsx(
8626
- "line",
8627
- {
8628
- x1: padding.left,
8629
- y1: y,
8630
- x2: width - padding.right,
8631
- y2: y,
8632
- stroke: "var(--color-border)",
8633
- strokeDasharray: "4 4",
8634
- opacity: 0.5
8635
- },
8636
- frac
8637
- );
8638
- }),
8639
- fill && /* @__PURE__ */ jsx("path", { d: areaPath, fill: "var(--color-primary)", opacity: 0.1 }),
8640
- /* @__PURE__ */ jsx("path", { d: linePath, fill: "none", stroke: "var(--color-primary)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
8641
- points.map((p, idx) => /* @__PURE__ */ jsxs("g", { children: [
8642
- /* @__PURE__ */ jsx("circle", { cx: p.x, cy: p.y, r: "4", fill: "var(--color-card)", stroke: "var(--color-primary)", strokeWidth: "2" }),
8643
- showValues && /* @__PURE__ */ jsx("text", { x: p.x, y: p.y - 10, textAnchor: "middle", fill: "var(--color-foreground)", fontSize: "10", fontWeight: "500", children: p.value }),
8644
- /* @__PURE__ */ jsx(
8645
- "text",
8646
- {
8647
- x: p.x,
8648
- y: height - 8,
8649
- textAnchor: "middle",
8650
- fill: "var(--color-muted-foreground)",
8651
- fontSize: "9",
8652
- children: p.label
8653
- }
8654
- )
8655
- ] }, idx))
8656
- ] });
8657
- };
8658
- var Chart = ({
8659
- title,
8660
- subtitle,
8661
- chartType = "bar",
8662
- series,
8663
- data: simpleData,
8664
- height = 200,
8665
- showLegend = true,
8666
- showValues = false,
8667
- actions,
8668
- entity,
8669
- isLoading = false,
8670
- error,
8671
- className
8672
- }) => {
8673
- const eventBus = useEventBus();
8674
- const { t } = useTranslate();
8675
- const handleAction = useCallback(
8676
- (action) => {
8677
- if (action.event) {
8678
- eventBus.emit(`UI:${action.event}`, {});
8679
- }
8680
- },
8681
- [eventBus]
8682
- );
8683
- const normalizedData = useMemo(() => {
8684
- if (simpleData) return simpleData;
8685
- if (series && series.length > 0) return series[0].data;
8686
- return [];
8687
- }, [simpleData, series]);
8688
- if (isLoading) {
8689
- return /* @__PURE__ */ jsx(LoadingState, { message: "Loading chart...", className });
8690
- }
8691
- if (error) {
8692
- return /* @__PURE__ */ jsx(
8693
- ErrorState,
8694
- {
8695
- title: "Chart error",
8696
- message: error.message,
8697
- className
8698
- }
8699
- );
8700
- }
8701
- if (normalizedData.length === 0) {
8702
- return /* @__PURE__ */ jsx(EmptyState, { title: t("empty.noData"), description: t("empty.noData"), className });
8703
- }
8704
- return /* @__PURE__ */ jsx(Card, { className: cn("p-6", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
8705
- (title || subtitle || actions && actions.length > 0) && /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "start", children: [
8706
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
8707
- title && /* @__PURE__ */ jsx(Typography, { variant: "h5", weight: "semibold", children: title }),
8708
- subtitle && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle })
8709
- ] }),
8710
- actions && actions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", children: actions.map((action, idx) => /* @__PURE__ */ jsx(
8711
- Badge,
8712
- {
8713
- variant: "default",
8714
- className: "cursor-pointer hover:opacity-80 transition-opacity",
8715
- onClick: () => handleAction(action),
8716
- children: action.label
8717
- },
8718
- idx
8719
- )) })
8720
- ] }),
8721
- /* @__PURE__ */ jsxs(Box, { className: "w-full", children: [
8722
- chartType === "bar" && /* @__PURE__ */ jsx(BarChart, { data: normalizedData, height, showValues }),
8723
- chartType === "line" && /* @__PURE__ */ jsx(LineChart2, { data: normalizedData, height, showValues }),
8724
- chartType === "area" && /* @__PURE__ */ jsx(LineChart2, { data: normalizedData, height, showValues, fill: true }),
8725
- chartType === "pie" && /* @__PURE__ */ jsx(PieChart, { data: normalizedData, height, showValues: showLegend }),
8726
- chartType === "donut" && /* @__PURE__ */ jsx(PieChart, { data: normalizedData, height, showValues: showLegend, donut: true })
8727
- ] }),
8728
- showLegend && series && series.length > 1 && /* @__PURE__ */ jsx(HStack, { gap: "md", justify: "center", wrap: true, children: series.map((s, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
8729
- /* @__PURE__ */ jsx(
8730
- Box,
8731
- {
8732
- className: "w-3 h-3 rounded-[var(--radius-full)] flex-shrink-0",
8733
- style: { backgroundColor: s.color || CHART_COLORS[idx % CHART_COLORS.length] }
8734
- }
8735
- ),
8736
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: s.name })
8737
- ] }, idx)) })
8738
- ] }) });
8739
- };
8740
- Chart.displayName = "Chart";
8741
8162
  var STATUS_STYLES3 = {
8742
8163
  complete: {
8743
8164
  dotColor: "text-[var(--color-success)]",
@@ -10247,7 +9668,7 @@ var NavLink = ({
10247
9668
  currentPath
10248
9669
  }) => {
10249
9670
  const isActive = currentPath === item.href || currentPath.startsWith(item.href + "/");
10250
- const Icon3 = item.icon;
9671
+ const Icon2 = item.icon;
10251
9672
  return /* @__PURE__ */ jsxs(
10252
9673
  Link,
10253
9674
  {
@@ -10257,8 +9678,8 @@ var NavLink = ({
10257
9678
  isActive ? "bg-[var(--color-primary)] text-[var(--color-primary-foreground)] shadow-[var(--shadow-sm)]" : "text-[var(--color-muted-foreground)] hover:bg-[var(--color-muted)] hover:text-[var(--color-foreground)]"
10258
9679
  ),
10259
9680
  children: [
10260
- Icon3 && /* @__PURE__ */ jsx(
10261
- Icon3,
9681
+ Icon2 && /* @__PURE__ */ jsx(
9682
+ Icon2,
10262
9683
  {
10263
9684
  className: cn(
10264
9685
  "h-5 w-5",
@@ -10901,4 +10322,4 @@ function WorldMapTemplate({
10901
10322
  }
10902
10323
  WorldMapTemplate.displayName = "WorldMapTemplate";
10903
10324
 
10904
- export { ALL_PRESETS, AR_BOOK_FIELDS, ActionPalette, ActionTile, AuthLayout, BattleBoard, BattleTemplate, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, BuilderBoard, CastleBoard, CastleTemplate, Chart, ClassifierBoard, CodeView, CodeViewer, CollapsibleSection, ConfirmDialog, ContentRenderer, CounterTemplate, DashboardGrid, DashboardLayout, DebuggerBoard, DocumentViewer, StateMachineView as DomStateMachineVisualizer, DrawerSlot, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EventHandlerBoard, EventLog, FEATURE_TYPES, FormActions, FormLayout, FormSection, GameAudioContext, GameAudioProvider, GameAudioToggle, GameShell, GameTemplate, GenericAppTemplate, GraphCanvas, Header, IDENTITY_BOOK_FIELDS, JazariStateMachine, List, MediaGallery, ModalSlot, Navigation, NegotiatorBoard, NotifyListener, ObjectRulePanel, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, PhysicsManager, RuleEditor, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, Section, SequenceBar, SequencerBoard, Sidebar, SignaturePad, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Split, SplitPane, StateArchitectBoard, StateMachineView, StateNode2 as StateNode, StatusBar, TERRAIN_COLORS, TabbedContainer, Table, TerrainPalette, Timeline, ToastSlot, TraitSlot, TraitStateViewer, TransitionArrow, UncontrolledBattleBoard, VariablePanel, WizardContainer, WorldMapBoard, WorldMapTemplate, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, generateCombatMessage, getCurrentFrame, inferDirection, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, springOscillator, tickAnimationState, transitionAnimation, useBattleState, useGameAudio, useGameAudioContext, usePhysics2D, useSpriteAnimations };
10325
+ export { AR_BOOK_FIELDS, ActionPalette, ActionTile, AuthLayout, BattleBoard, BattleTemplate, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, BuilderBoard, CastleBoard, CastleTemplate, ClassifierBoard, CodeView, CodeViewer, CollapsibleSection, ConfirmDialog, ContentRenderer, CounterTemplate, DashboardGrid, DashboardLayout, DebuggerBoard, DocumentViewer, StateMachineView as DomStateMachineVisualizer, DrawerSlot, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EventHandlerBoard, EventLog, FEATURE_TYPES, FormActions, FormLayout, FormSection, GameAudioContext, GameAudioProvider, GameAudioToggle, GameShell, GameTemplate, GenericAppTemplate, GraphCanvas, Header, IDENTITY_BOOK_FIELDS, JazariStateMachine, List, MediaGallery, ModalSlot, Navigation, NegotiatorBoard, NotifyListener, ObjectRulePanel, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, PhysicsManager, RuleEditor, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, Section, SequenceBar, SequencerBoard, Sidebar, SignaturePad, SimulatorBoard, Split, SplitPane, StateArchitectBoard, StateMachineView, StateNode2 as StateNode, StatusBar, TERRAIN_COLORS, TabbedContainer, Table, TerrainPalette, Timeline, ToastSlot, TraitSlot, TraitStateViewer, TransitionArrow, UncontrolledBattleBoard, VariablePanel, WizardContainer, WorldMapBoard, WorldMapTemplate, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, generateCombatMessage, getCurrentFrame, inferDirection, mapBookData, resolveFieldMap, resolveFrame, resolveSheetDirection, tickAnimationState, transitionAnimation, useBattleState, useGameAudio, useGameAudioContext, usePhysics2D, useSpriteAnimations };