@almadar/ui 6.52.0 → 6.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/{EntityBindingContext-BbxrwSb9.d.ts → AwaitingSkeletonContext-Bh399p1x.d.ts} +17 -2
  2. package/dist/{Canvas3DHost-CWO0tswb.d.ts → Canvas3DHost-B-y2TNij.d.ts} +1 -1
  3. package/dist/{GameAudioProvider-_hPzjqp-.d.ts → GameAudioProvider-DyBvYP2c.d.ts} +1 -1
  4. package/dist/Typography-7QEWUTW3.js +5 -0
  5. package/dist/{UISlotRenderer-CR7SCAMR.js → UISlotRenderer-P7A4SZSK.js} +10 -10
  6. package/dist/avl/index.cjs +40157 -39958
  7. package/dist/avl/index.d.ts +5 -2
  8. package/dist/avl/index.js +34 -21
  9. package/dist/{chunk-XUSSAWKL.js → chunk-2LFBQ4IS.js} +1 -1
  10. package/dist/{chunk-QWDKMVLX.js → chunk-53VTY5CC.js} +141 -82
  11. package/dist/{chunk-MSBMVG3B.js → chunk-6O37FCX4.js} +1 -0
  12. package/dist/{chunk-WB2A6V3I.js → chunk-7KSLPY56.js} +49 -1
  13. package/dist/{chunk-BHZG4PDZ.js → chunk-7LM6I3NA.js} +629 -626
  14. package/dist/{chunk-NCNP2RKZ.js → chunk-E37BYSXY.js} +2 -2
  15. package/dist/{chunk-5GCI6C7J.js → chunk-FUQASYEW.js} +2 -2
  16. package/dist/{chunk-CLSLVFSP.js → chunk-HB4C27KU.js} +2 -2
  17. package/dist/{chunk-EERAGPBW.js → chunk-HUG25TT3.js} +32341 -33067
  18. package/dist/{chunk-TWHYH25Q.js → chunk-JRW33U35.js} +80 -80
  19. package/dist/{chunk-G4GMXYMY.js → chunk-KQXXO42S.js} +93 -171
  20. package/dist/chunk-OKWD7LPO.js +80 -0
  21. package/dist/{chunk-YHY5K2Y7.js → chunk-PEST66PN.js} +6 -0
  22. package/dist/{chunk-V5AGW2JN.js → chunk-QVXLKFUQ.js} +1 -1
  23. package/dist/chunk-UOTYAPV5.js +284 -0
  24. package/dist/{chunk-2QB2PXOO.js → chunk-VHTJRS2N.js} +3 -5
  25. package/dist/components/index.cjs +42813 -42691
  26. package/dist/components/index.d.ts +182 -319
  27. package/dist/components/index.js +621 -13
  28. package/dist/context/index.cjs +8 -3
  29. package/dist/context/index.js +3 -3
  30. package/dist/hooks/index.cjs +56 -4
  31. package/dist/hooks/index.js +7 -7
  32. package/dist/lib/drawable/three/index.cjs +49 -1
  33. package/dist/lib/drawable/three/index.d.ts +5 -5
  34. package/dist/lib/drawable/three/index.js +7 -7
  35. package/dist/lib/index.cjs +50 -1
  36. package/dist/lib/index.d.ts +2 -2
  37. package/dist/lib/index.js +6 -5
  38. package/dist/locales/index.cjs +147 -3
  39. package/dist/locales/index.js +99 -3
  40. package/dist/{paintDispatch-DHo3WhaU.d.ts → paintDispatch-_6EhJCiL.d.ts} +3 -3
  41. package/dist/providers/index.cjs +35850 -35687
  42. package/dist/providers/index.d.ts +33 -8
  43. package/dist/providers/index.js +37 -13
  44. package/dist/renderer/index.cjs +6 -0
  45. package/dist/renderer/index.d.ts +1 -1
  46. package/dist/renderer/index.js +1 -1
  47. package/dist/runtime/index.cjs +42533 -42343
  48. package/dist/runtime/index.d.ts +4 -2
  49. package/dist/runtime/index.js +12 -12
  50. package/dist/ssr/index.cjs +377 -137
  51. package/dist/ssr/index.d.cts +5 -1
  52. package/dist/ssr/index.d.ts +5 -1
  53. package/dist/ssr/index.js +313 -73
  54. package/dist/{verificationRegistry-BYD3cVhS.d.ts → verificationRegistry-CD7Xb40L.d.ts} +1 -1
  55. package/locales/ar.json +49 -1
  56. package/locales/en.json +49 -1
  57. package/locales/sl.json +49 -1
  58. package/package.json +6 -6
  59. package/tailwind-preset.cjs +23 -0
  60. package/themes/_base.css +28 -8
  61. package/themes/_contract.md +5 -0
  62. package/dist/Typography-7FRZOS2H.js +0 -5
  63. package/dist/{avl-3d-context-DLteNEwu.d.ts → avl-3d-context-MAt_NuU9.d.ts} +3 -3
  64. package/dist/{chunk-IN3BVW2Z.js → chunk-64WACXM7.js} +14 -14
@@ -1,19 +1,627 @@
1
+ import { JsonTreeEditor } from '../chunk-UOTYAPV5.js';
2
+ export { JsonTreeEditor } from '../chunk-UOTYAPV5.js';
3
+ export { keyChord, mergeCaptureTables, useAgentChat, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useExtensions, useFileEditor, useFileSystem, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useKeyboardRouter, useNavStack, usePreview, useRenderInterpolation, useTraitListens, useUIEvents, useValidation } from '../chunk-2LFBQ4IS.js';
4
+ export { I18nProvider, createTranslate, useFormatContext, useTranslate } from '../chunk-E37BYSXY.js';
5
+ export { parseLessonSegments } from '../chunk-OKWD7LPO.js';
1
6
  export { assertUniqueSlotsPerHost } from '../chunk-O2EIWXWE.js';
2
- export { keyChord, mergeCaptureTables, useAgentChat, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useExtensions, useFileEditor, useFileSystem, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useKeyboardRouter, useNavStack, usePreview, useRenderInterpolation, useTraitListens, useUIEvents, useValidation } from '../chunk-XUSSAWKL.js';
3
- export { I18nProvider, createTranslate, useFormatContext, useTranslate } from '../chunk-NCNP2RKZ.js';
4
7
  export { SharedEntityStoreContext, createSharedEntityStore, runTickFrame, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext } from '../chunk-DQTV6QVS.js';
5
- export { DEFAULT_SLOTS, useUISlotManager } from '../chunk-2QB2PXOO.js';
6
- export { ALL_PRESETS, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, COMPACT_MEDIA_QUERY, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, Center, ChangeList, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommandPalette, CommitRow, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTION_KEYS, DEFAULT_MATRIX_COLUMN_KEYS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureGrid, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, FloatingToolbar, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioContext, GameAudioCue, GameAudioProvider, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, Gantt, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, Header, HealthBar, Icon, IconButton, IconPicker, Image, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, JazariStateMachine, JsonTreeEditor, Label, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart, List, LoadingState, MapView, MarkdownContent, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, ProgressBar, ProgressDots, PropertyInspector, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichTextEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StatusBar, StatusDot, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagInput, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TopNavItem, TraitFrame, TraitSlot, TraitStateViewer, TrendIndicator, TypewriterText, UISlotComponent, UISlotRenderer, UploadDropZone, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, applyCompletion, applySuggestions, arrowBetween, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, createInitialGameState, createUnitAnimationState, cylinderBetween, dispatchCommandPaletteCommand, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFrame, resolveSheetDirection, rows, sanitizeRichHtml, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAnchorRect, useAtlasSliceDataUrl, useCamera, useCompactLayout, useDockLayout, useGameAudio, useGameAudioContext, useImageCache, useUnitSpriteAtlas, vec2 } from '../chunk-EERAGPBW.js';
7
- export { Box, HStack, Stack, VStack } from '../chunk-BHZG4PDZ.js';
8
- export { Typography } from '../chunk-CLSLVFSP.js';
9
- export { ALMADAR_DND_MIME, parseQueryBinding, useAuthContext, useCanvasGestures, useDragReorder, useDraggable, useDropZone, useInfiniteScroll, useLongPress, useMediaQuery, usePrefersReducedMotion, usePullToRefresh, useQuerySingleton, useSwipeGesture } from '../chunk-TWHYH25Q.js';
8
+ export { DEFAULT_SLOTS, useUISlotManager } from '../chunk-VHTJRS2N.js';
9
+ import { GridPicker, Icon, Button, FormSection, Select, ThemedPortal, Switch, Input } from '../chunk-HUG25TT3.js';
10
+ export { ALL_PRESETS, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, AgentActivityFeed, AgentActivityRow, AgentChatFeed, AgentThinkingRow, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, Aside, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, COMPACT_MEDIA_QUERY, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardHeader, CardTitle, Carousel, Center, ChangeList, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommandPalette, CommitRow, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTION_KEYS, DEFAULT_MATRIX_COLUMN_KEYS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureGrid, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, FloatingToolbar, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioContext, GameAudioCue, GameAudioProvider, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, Gantt, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, Header, HealthBar, Icon, IconButton, Image, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, JazariStateMachine, Label, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart, LoadingState, MapView, MarkdownContent, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NumberStepper, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, ProgressBar, ProgressDots, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichTextEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SkeletonTree, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StatusBar, StatusDot, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagInput, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TopNavItem, TraitFrame, TraitSlot, TraitStateViewer, TrendIndicator, TypewriterText, UISlotComponent, UISlotRenderer, UploadDropZone, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, activityRowFacts, applyCompletion, applySuggestions, arrowBetween, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, createInitialGameState, createUnitAnimationState, cylinderBetween, dispatchCommandPaletteCommand, get3DClickPayload, getCurrentFrame, getTileDimensions, groupIntoConversations, inferDirection, isoToScreen, makeAsset, makeAssetMap, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFrame, resolveSheetDirection, rows, sanitizeRichHtml, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAtlasSliceDataUrl, useCamera, useCompactLayout, useDockLayout, useGameAudio, useGameAudioContext, useImageCache, useUnitSpriteAtlas, vec2 } from '../chunk-HUG25TT3.js';
11
+ import { getKnownPatterns, getPatternDefinition } from '../chunk-PQKU62LK.js';
12
+ import { VStack, HStack, Box } from '../chunk-7LM6I3NA.js';
13
+ export { Box, HStack, Stack, VStack } from '../chunk-7LM6I3NA.js';
14
+ import { Typography } from '../chunk-HB4C27KU.js';
15
+ export { Typography } from '../chunk-HB4C27KU.js';
16
+ export { ALMADAR_DND_MIME, parseQueryBinding, useAuthContext, useCanvasGestures, useDragReorder, useDraggable, useDropZone, useInfiniteScroll, useLongPress, useMediaQuery, usePrefersReducedMotion, usePullToRefresh, useQuerySingleton, useSwipeGesture } from '../chunk-JRW33U35.js';
10
17
  export { useTapReveal } from '../chunk-XJTHMW4G.js';
11
18
  export { useEmitEvent, useEventBus, useEventListener } from '../chunk-6EV3OEBQ.js';
12
- export { Presence, parseLessonSegments, parseMarkdownWithCodeBlocks, usePresence } from '../chunk-G4GMXYMY.js';
19
+ import '../chunk-PEST66PN.js';
20
+ export { Presence, parseMarkdownWithCodeBlocks, usePresence } from '../chunk-KQXXO42S.js';
13
21
  import '../chunk-O7OLVVBR.js';
14
- export { cn } from '../chunk-IN3BVW2Z.js';
15
- import '../chunk-V5AGW2JN.js';
16
- import '../chunk-WB2A6V3I.js';
17
- import '../chunk-PQKU62LK.js';
18
- import '../chunk-YHY5K2Y7.js';
22
+ import { cn, domPassthrough } from '../chunk-64WACXM7.js';
23
+ export { cn } from '../chunk-64WACXM7.js';
24
+ import '../chunk-QVXLKFUQ.js';
25
+ import '../chunk-7KSLPY56.js';
19
26
  import '../chunk-QPXIAUJD.js';
27
+ import React4, { useMemo, useCallback, useState, useEffect, useRef, useLayoutEffect } from 'react';
28
+ import { isSecretConfigType } from '@almadar/core';
29
+ import { useTranslate } from '@almadar/ui/hooks';
30
+ import * as LucideIcons from 'lucide-react';
31
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
32
+
33
+ function pascalToKebab(name) {
34
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
35
+ }
36
+ function kebabToPascal(name) {
37
+ return name.split("-").map((part) => /^\d+$/.test(part) ? part : part.charAt(0).toUpperCase() + part.slice(1)).join("");
38
+ }
39
+ var ICON_ITEMS = (() => {
40
+ const items = [];
41
+ for (const [exportName, candidate] of Object.entries(LucideIcons)) {
42
+ if (!/^[A-Z]/.test(exportName)) continue;
43
+ if (exportName.endsWith("Icon")) continue;
44
+ if (exportName.startsWith("Lucide")) continue;
45
+ const isComponent = candidate !== null && (typeof candidate === "object" || typeof candidate === "function") && "$$typeof" in candidate;
46
+ if (!isComponent) continue;
47
+ const kebab = pascalToKebab(exportName);
48
+ if (kebabToPascal(kebab) !== exportName) continue;
49
+ items.push({ id: kebab, label: kebab, category: "icons" });
50
+ }
51
+ return items;
52
+ })();
53
+ var IconPicker = ({ value, onChange, className }) => {
54
+ const { t } = useTranslate();
55
+ const items = useMemo(() => {
56
+ const category = t("iconPicker.category");
57
+ return ICON_ITEMS.map((item) => ({ ...item, category }));
58
+ }, [t]);
59
+ return /* @__PURE__ */ jsx(
60
+ GridPicker,
61
+ {
62
+ items,
63
+ value,
64
+ onChange,
65
+ searchPlaceholder: t("iconPicker.search"),
66
+ renderThumbnail: (it) => /* @__PURE__ */ jsx(Icon, { name: it.id }),
67
+ cellSize: 32,
68
+ className
69
+ }
70
+ );
71
+ };
72
+ IconPicker.displayName = "IconPicker";
73
+ var THUMB_PX = 32;
74
+ var IMAGE_KINDS = /* @__PURE__ */ new Set([
75
+ "image",
76
+ "spritesheet",
77
+ "scene",
78
+ "portrait"
79
+ ]);
80
+ function iconForKind(kind) {
81
+ if (kind === "audio") return "music";
82
+ if (kind === "model") return "box";
83
+ return "file";
84
+ }
85
+ var AssetPicker = ({
86
+ assets,
87
+ value,
88
+ onChange,
89
+ className
90
+ }) => {
91
+ const byUrl = useMemo(() => {
92
+ const map = /* @__PURE__ */ new Map();
93
+ for (const entry of assets) map.set(entry.url, entry);
94
+ return map;
95
+ }, [assets]);
96
+ const items = useMemo(
97
+ () => assets.map((entry) => ({
98
+ id: entry.url,
99
+ label: entry.name,
100
+ category: entry.category
101
+ })),
102
+ [assets]
103
+ );
104
+ const categories = useMemo(() => {
105
+ const seen = [];
106
+ for (const entry of assets) {
107
+ if (!seen.includes(entry.category)) seen.push(entry.category);
108
+ }
109
+ return seen;
110
+ }, [assets]);
111
+ const renderThumbnail = useCallback(
112
+ (item) => {
113
+ const entry = byUrl.get(item.id);
114
+ if (entry === void 0) return null;
115
+ if (IMAGE_KINDS.has(entry.kind)) {
116
+ return /* @__PURE__ */ jsx(
117
+ "img",
118
+ {
119
+ src: entry.thumbnailUrl ?? entry.url,
120
+ alt: entry.name,
121
+ loading: "lazy",
122
+ width: THUMB_PX,
123
+ height: THUMB_PX,
124
+ style: { width: THUMB_PX, height: THUMB_PX, objectFit: "cover" }
125
+ }
126
+ );
127
+ }
128
+ return /* @__PURE__ */ jsx(Icon, { name: iconForKind(entry.kind), size: "sm" });
129
+ },
130
+ [byUrl]
131
+ );
132
+ return /* @__PURE__ */ jsx(
133
+ GridPicker,
134
+ {
135
+ items,
136
+ value,
137
+ onChange,
138
+ categories,
139
+ renderThumbnail,
140
+ cellSize: THUMB_PX,
141
+ className
142
+ }
143
+ );
144
+ };
145
+ AssetPicker.displayName = "AssetPicker";
146
+ var TIER_ORDER = ["presentation", "domain", "policy", "infra", "internal"];
147
+ var TIER_LABEL_KEYS = {
148
+ presentation: "propertyInspector.tier.presentation",
149
+ domain: "propertyInspector.tier.domain",
150
+ policy: "propertyInspector.tier.policy",
151
+ infra: "propertyInspector.tier.infra",
152
+ internal: "propertyInspector.tier.internal"
153
+ };
154
+ function currentValue(decl, override) {
155
+ return override !== void 0 ? override : decl.default;
156
+ }
157
+ function TextLikeControl({
158
+ field,
159
+ numeric,
160
+ secret,
161
+ value,
162
+ onCommit
163
+ }) {
164
+ const initial = value === void 0 || value === null ? "" : String(value);
165
+ const [draft, setDraft] = React4.useState(initial);
166
+ React4.useEffect(() => setDraft(initial), [initial]);
167
+ const commit = () => {
168
+ if (numeric) {
169
+ const n = draft.trim() === "" ? 0 : Number(draft);
170
+ onCommit(field, Number.isNaN(n) ? 0 : n);
171
+ } else {
172
+ onCommit(field, draft);
173
+ }
174
+ };
175
+ return /* @__PURE__ */ jsx(
176
+ Input,
177
+ {
178
+ inputType: secret ? "password" : numeric ? "number" : "text",
179
+ value: draft,
180
+ onChange: (e) => setDraft(e.target.value),
181
+ onBlur: commit,
182
+ onKeyDown: (e) => {
183
+ if (e.key === "Enter") commit();
184
+ }
185
+ }
186
+ );
187
+ }
188
+ var SCALAR_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "icon", "asset", "Asset", "secret", "event"]);
189
+ function isTraitConfigObject(v) {
190
+ return v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
191
+ }
192
+ function isAssetObject(v) {
193
+ return isTraitConfigObject(v) && typeof v.url === "string";
194
+ }
195
+ function FieldControl({
196
+ name,
197
+ decl,
198
+ value,
199
+ onChange,
200
+ assets
201
+ }) {
202
+ const { t } = useTranslate();
203
+ let control;
204
+ const stringValue = typeof value === "string" ? value : void 0;
205
+ const effectiveValue = value ?? decl.default;
206
+ if (decl.type === "icon") {
207
+ control = /* @__PURE__ */ jsx(IconPicker, { value: stringValue, onChange: (icon) => onChange(name, icon) });
208
+ } else if (decl.type === "asset") {
209
+ control = /* @__PURE__ */ jsx(
210
+ AssetPicker,
211
+ {
212
+ assets: assets ?? [],
213
+ value: stringValue,
214
+ onChange: (url) => onChange(name, url)
215
+ }
216
+ );
217
+ } else if (decl.type === "Asset") {
218
+ const assetUrl = isAssetObject(effectiveValue) ? effectiveValue.url : "";
219
+ const baseAsset = isAssetObject(effectiveValue) ? effectiveValue : {};
220
+ control = /* @__PURE__ */ jsx(
221
+ AssetPicker,
222
+ {
223
+ assets: assets ?? [],
224
+ value: assetUrl,
225
+ onChange: (url) => onChange(name, { ...baseAsset, url })
226
+ }
227
+ );
228
+ } else if (decl.type === "boolean") {
229
+ control = /* @__PURE__ */ jsx(Switch, { checked: value === true, onChange: (c) => onChange(name, c) });
230
+ } else if (decl.type === "string" && decl.values !== void 0 && decl.values.length > 0) {
231
+ control = /* @__PURE__ */ jsx(
232
+ Select,
233
+ {
234
+ options: decl.values.map((v) => ({ value: v, label: v })),
235
+ value: typeof value === "string" ? value : "",
236
+ onValueChange: (v) => onChange(name, v)
237
+ }
238
+ );
239
+ } else if (decl.type === "number") {
240
+ control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: true, value, onCommit: onChange });
241
+ } else if (isSecretConfigType(decl.type)) {
242
+ control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: false, secret: true, value, onCommit: onChange });
243
+ } else if (decl.type === "event") {
244
+ control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: false, value, onCommit: onChange });
245
+ } else if (decl.type === "string") {
246
+ control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: false, value, onCommit: onChange });
247
+ } else if (decl.type === "node") {
248
+ control = /* @__PURE__ */ jsx(NodeSlotEditor, { value: effectiveValue, onChange: (next) => onChange(name, next) });
249
+ } else if (decl.type.startsWith("[") || Array.isArray(effectiveValue)) {
250
+ const arr = Array.isArray(effectiveValue) ? effectiveValue : [];
251
+ control = /* @__PURE__ */ jsx(JsonTreeEditor, { value: arr, onChange: (next) => onChange(name, next) });
252
+ } else if (decl.type === "object" || decl.type.startsWith("Map ") || !SCALAR_TYPES.has(decl.type) && isTraitConfigObject(effectiveValue)) {
253
+ const obj = isTraitConfigObject(effectiveValue) ? effectiveValue : {};
254
+ control = /* @__PURE__ */ jsx(JsonTreeEditor, { value: obj, onChange: (next) => onChange(name, next) });
255
+ } else {
256
+ control = /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: t("propertyInspector.editInSource", { type: decl.type }) });
257
+ }
258
+ return /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
259
+ /* @__PURE__ */ jsx(Typography, { variant: "label", children: decl.label ?? name }),
260
+ control,
261
+ decl.description !== void 0 && decl.description !== "" && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: decl.description })
262
+ ] });
263
+ }
264
+ var PropertyInspector = ({
265
+ config,
266
+ values,
267
+ onChange,
268
+ onReset,
269
+ title,
270
+ className,
271
+ assets,
272
+ tiers
273
+ }) => {
274
+ const { t } = useTranslate();
275
+ const allowedTiers = tiers ? new Set(tiers) : null;
276
+ const fields = Object.entries(config).filter(([, decl]) => {
277
+ if (!allowedTiers) return true;
278
+ return allowedTiers.has(decl.tier ?? "presentation");
279
+ });
280
+ const byTier = /* @__PURE__ */ new Map();
281
+ for (const [name, decl] of fields) {
282
+ const tier = decl.tier ?? "presentation";
283
+ const arr = byTier.get(tier) ?? [];
284
+ arr.push([name, decl]);
285
+ byTier.set(tier, arr);
286
+ }
287
+ const tierList = [...byTier.keys()].sort((a, b) => {
288
+ const ia = TIER_ORDER.indexOf(a);
289
+ const ib = TIER_ORDER.indexOf(b);
290
+ return (ia === -1 ? 99 : ia) - (ib === -1 ? 99 : ib);
291
+ });
292
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: cn("w-full", className), children: [
293
+ /* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
294
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", weight: "bold", children: title ?? t("propertyInspector.config") }),
295
+ onReset !== void 0 && /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", icon: "rotate-ccw", label: t("common.reset"), onClick: onReset })
296
+ ] }),
297
+ fields.length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: t("propertyInspector.noProperties") }),
298
+ tierList.map((tier) => /* @__PURE__ */ jsx(FormSection, { title: TIER_LABEL_KEYS[tier] ? t(TIER_LABEL_KEYS[tier]) : tier, collapsible: true, defaultCollapsed: tier !== "presentation", children: /* @__PURE__ */ jsx(VStack, { gap: "sm", children: byTier.get(tier)?.map(([name, decl]) => /* @__PURE__ */ jsx(
299
+ FieldControl,
300
+ {
301
+ name,
302
+ decl,
303
+ value: currentValue(decl, values?.[name]),
304
+ onChange,
305
+ assets
306
+ },
307
+ name
308
+ )) }) }, tier))
309
+ ] });
310
+ };
311
+ var isObj = (v) => v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
312
+ function normalize(value) {
313
+ const wasArray = Array.isArray(value);
314
+ const pattern = wasArray ? value[0] : value;
315
+ const type = isObj(pattern) && typeof pattern["type"] === "string" ? pattern["type"] : "";
316
+ const props = {};
317
+ if (isObj(pattern)) {
318
+ for (const [k, v] of Object.entries(pattern)) if (k !== "type") props[k] = v;
319
+ }
320
+ return { type, props, wasArray };
321
+ }
322
+ var NodeSlotEditor = ({ value, onChange, className }) => {
323
+ const { t } = useTranslate();
324
+ const { type, props, wasArray } = normalize(value);
325
+ const patterns = React4.useMemo(() => {
326
+ try {
327
+ return [...getKnownPatterns()].sort();
328
+ } catch {
329
+ return [];
330
+ }
331
+ }, []);
332
+ const options = React4.useMemo(
333
+ () => [{ value: "", label: t("nodeSlot.none") }, ...patterns.map((p) => ({ value: p, label: p }))],
334
+ [patterns, t]
335
+ );
336
+ const emit = (nextType, nextProps) => {
337
+ if (!nextType) {
338
+ onChange(wasArray ? [] : {});
339
+ return;
340
+ }
341
+ const pattern = { type: nextType, ...nextProps };
342
+ onChange(wasArray || value === void 0 ? [pattern] : pattern);
343
+ };
344
+ const schemaEntries = React4.useMemo(() => {
345
+ if (!type) return [];
346
+ const def = getPatternDefinition(type);
347
+ if (!def?.propsSchema) return [];
348
+ return Object.entries(def.propsSchema).map(([propName, propDef]) => {
349
+ const decl = {
350
+ type: propDef.types?.[0] ?? "string",
351
+ description: propDef.description,
352
+ label: propName,
353
+ ...propDef.enumValues && propDef.enumValues.length > 0 ? { values: propDef.enumValues } : {}
354
+ };
355
+ return [propName, decl];
356
+ });
357
+ }, [type]);
358
+ const hasSchema = schemaEntries.length > 0;
359
+ return /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("w-full", className), children: [
360
+ /* @__PURE__ */ jsx(
361
+ Select,
362
+ {
363
+ options,
364
+ value: type,
365
+ onValueChange: (v) => emit(v, props)
366
+ }
367
+ ),
368
+ type !== "" && /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "pl-1", children: [
369
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: t("nodeSlot.props") }),
370
+ hasSchema ? /* @__PURE__ */ jsx(VStack, { gap: "xs", children: schemaEntries.map(([propName, decl]) => /* @__PURE__ */ jsx(
371
+ FieldControl,
372
+ {
373
+ name: propName,
374
+ decl,
375
+ value: props[propName],
376
+ onChange: (field, val) => emit(type, { ...props, [field]: val })
377
+ },
378
+ propName
379
+ )) }) : /* @__PURE__ */ jsx(JsonTreeEditor, { value: props, onChange: (next) => emit(type, isObj(next) ? next : {}) })
380
+ ] })
381
+ ] });
382
+ };
383
+ var GAP = 10;
384
+ var EDGE = 8;
385
+ function resolveAnchorRect(anchor) {
386
+ if (typeof anchor === "string") {
387
+ return document.querySelector(anchor)?.getBoundingClientRect() ?? null;
388
+ }
389
+ if (anchor instanceof DOMRect) return anchor;
390
+ return anchor?.current?.getBoundingClientRect() ?? null;
391
+ }
392
+ function useAnchorRect(anchor, active) {
393
+ const [rect, setRect] = useState(null);
394
+ const read = useCallback(() => resolveAnchorRect(anchor), [anchor]);
395
+ useEffect(() => {
396
+ if (!active || typeof document === "undefined") {
397
+ setRect(null);
398
+ return;
399
+ }
400
+ const update = () => setRect(read());
401
+ update();
402
+ window.addEventListener("scroll", update, true);
403
+ window.addEventListener("resize", update);
404
+ let raf = 0;
405
+ let tries = 0;
406
+ const poll = () => {
407
+ const found = read();
408
+ if (found) {
409
+ setRect(found);
410
+ } else if (tries++ < 40) {
411
+ raf = requestAnimationFrame(poll);
412
+ }
413
+ };
414
+ if (!read()) raf = requestAnimationFrame(poll);
415
+ return () => {
416
+ window.removeEventListener("scroll", update, true);
417
+ window.removeEventListener("resize", update);
418
+ if (raf) cancelAnimationFrame(raf);
419
+ };
420
+ }, [active, read]);
421
+ return rect;
422
+ }
423
+ function placeCard(placement, rect, size) {
424
+ const vw = typeof window !== "undefined" ? window.innerWidth : 1024;
425
+ const vh = typeof window !== "undefined" ? window.innerHeight : 768;
426
+ let top = 0;
427
+ let left = 0;
428
+ switch (placement) {
429
+ case "top":
430
+ top = rect.top - size.h - GAP;
431
+ left = rect.left + rect.width / 2 - size.w / 2;
432
+ break;
433
+ case "left":
434
+ left = rect.left - size.w - GAP;
435
+ top = rect.top + rect.height / 2 - size.h / 2;
436
+ break;
437
+ case "right":
438
+ left = rect.right + GAP;
439
+ top = rect.top + rect.height / 2 - size.h / 2;
440
+ break;
441
+ case "bottom":
442
+ default:
443
+ top = rect.bottom + GAP;
444
+ left = rect.left + rect.width / 2 - size.w / 2;
445
+ break;
446
+ }
447
+ left = Math.max(EDGE, Math.min(left, vw - size.w - EDGE));
448
+ top = Math.max(EDGE, Math.min(top, vh - size.h - EDGE));
449
+ return { top, left };
450
+ }
451
+ var Coachmark = ({
452
+ open,
453
+ anchor,
454
+ placement = "bottom",
455
+ title,
456
+ children,
457
+ onDismiss,
458
+ onPrimary,
459
+ primaryLabel,
460
+ onSecondary,
461
+ secondaryLabel,
462
+ showBeacon = false,
463
+ fallbackCentered = false,
464
+ className,
465
+ ...rest
466
+ }) => {
467
+ const cardRef = useRef(null);
468
+ const { t } = useTranslate();
469
+ const rect = useAnchorRect(anchor, open);
470
+ const [pos, setPos] = useState(null);
471
+ const centered = open && !rect && fallbackCentered;
472
+ useLayoutEffect(() => {
473
+ if (!open || !rect || !cardRef.current) {
474
+ setPos(null);
475
+ return;
476
+ }
477
+ const size = {
478
+ w: cardRef.current.offsetWidth,
479
+ h: cardRef.current.offsetHeight
480
+ };
481
+ setPos(placeCard(placement, rect, size));
482
+ }, [open, rect, placement, children, title]);
483
+ useEffect(() => {
484
+ if (!open) return;
485
+ const onKey = (e) => {
486
+ if (e.key === "Escape") onDismiss();
487
+ };
488
+ window.addEventListener("keydown", onKey);
489
+ return () => window.removeEventListener("keydown", onKey);
490
+ }, [open, onDismiss]);
491
+ if (!open || typeof document === "undefined") return null;
492
+ if (!rect && !centered) return null;
493
+ const hasFooter = Boolean(onPrimary || onSecondary);
494
+ const cardStyle = centered ? { top: "50%", left: "50%", transform: "translate(-50%, -50%)" } : pos ? { top: pos.top, left: pos.left } : { top: -9999, left: -9999 };
495
+ const card = /* @__PURE__ */ jsxs(
496
+ Box,
497
+ {
498
+ ref: cardRef,
499
+ bg: "surface",
500
+ border: true,
501
+ rounded: "lg",
502
+ padding: "md",
503
+ ...domPassthrough(rest),
504
+ role: "dialog",
505
+ "aria-label": rest["aria-label"] ?? title,
506
+ className: cn(
507
+ "shadow-elevation-popover",
508
+ "fixed z-50 max-w-xs w-72 transition-opacity duration-fast",
509
+ centered || pos ? "opacity-100" : "opacity-0",
510
+ className
511
+ ),
512
+ style: cardStyle,
513
+ children: [
514
+ /* @__PURE__ */ jsx(
515
+ Button,
516
+ {
517
+ variant: "ghost",
518
+ size: "sm",
519
+ icon: "close",
520
+ "aria-label": t("aria.dismiss"),
521
+ onClick: onDismiss,
522
+ className: "absolute top-1 right-1 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)]"
523
+ }
524
+ ),
525
+ title && /* @__PURE__ */ jsx(Typography, { variant: "body1", weight: "semibold", className: "pr-6 mb-1", children: title }),
526
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "muted", as: "div", children }),
527
+ hasFooter && /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
528
+ onSecondary && /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onClick: onSecondary, children: secondaryLabel ?? t("coachmark.skip") }),
529
+ onPrimary && /* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: onPrimary, children: primaryLabel ?? t("coachmark.gotIt") })
530
+ ] })
531
+ ]
532
+ }
533
+ );
534
+ const beacon = showBeacon && rect ? /* @__PURE__ */ jsx(
535
+ "div",
536
+ {
537
+ className: "fixed z-50 pointer-events-none",
538
+ style: {
539
+ top: rect.top + rect.height / 2 - 6,
540
+ left: rect.left + rect.width / 2 - 6
541
+ },
542
+ "aria-hidden": "true",
543
+ children: /* @__PURE__ */ jsxs("span", { className: "relative flex h-3 w-3", children: [
544
+ /* @__PURE__ */ jsx("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-[var(--color-primary)] opacity-75" }),
545
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex h-3 w-3 rounded-full bg-[var(--color-primary)]" })
546
+ ] })
547
+ }
548
+ ) : null;
549
+ return /* @__PURE__ */ jsx(ThemedPortal, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
550
+ beacon,
551
+ card
552
+ ] }) });
553
+ };
554
+ Coachmark.displayName = "Coachmark";
555
+ var DIM = "fixed z-[45] bg-scrim";
556
+ var OnboardingSpotlight = ({
557
+ steps,
558
+ stepIndex,
559
+ onNext,
560
+ onSkip,
561
+ onFinish,
562
+ cutoutPadding = 6
563
+ }) => {
564
+ const { t } = useTranslate();
565
+ const step = steps[stepIndex];
566
+ const rect = useAnchorRect(step?.anchor ?? "", Boolean(step));
567
+ if (!step || typeof document === "undefined") return null;
568
+ const isLast = stepIndex >= steps.length - 1;
569
+ const backdrop = rect ? (() => {
570
+ const p = cutoutPadding;
571
+ const top = Math.max(0, rect.top - p);
572
+ const left = Math.max(0, rect.left - p);
573
+ const right = rect.right + p;
574
+ const bottom = rect.bottom + p;
575
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
576
+ /* @__PURE__ */ jsx("div", { className: DIM, style: { top: 0, left: 0, right: 0, height: top } }),
577
+ /* @__PURE__ */ jsx("div", { className: DIM, style: { top: bottom, left: 0, right: 0, bottom: 0 } }),
578
+ /* @__PURE__ */ jsx("div", { className: DIM, style: { top, left: 0, width: left, height: bottom - top } }),
579
+ /* @__PURE__ */ jsx("div", { className: DIM, style: { top, left: right, right: 0, height: bottom - top } })
580
+ ] });
581
+ })() : /* @__PURE__ */ jsx("div", { className: cn(DIM, "inset-0") });
582
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
583
+ /* @__PURE__ */ jsx(ThemedPortal, { children: backdrop }),
584
+ /* @__PURE__ */ jsxs(
585
+ Coachmark,
586
+ {
587
+ open: true,
588
+ anchor: step.anchor,
589
+ placement: step.placement ?? "bottom",
590
+ fallbackCentered: true,
591
+ title: step.title,
592
+ onDismiss: onSkip,
593
+ onSecondary: onSkip,
594
+ secondaryLabel: t("coachmark.skip"),
595
+ onPrimary: isLast ? onFinish : onNext,
596
+ primaryLabel: isLast ? t("common.done") : t("nav.next"),
597
+ children: [
598
+ /* @__PURE__ */ jsx("span", { children: step.body }),
599
+ /* @__PURE__ */ jsx("span", { className: "mt-3 flex items-center gap-1.5", children: steps.map((_, i) => /* @__PURE__ */ jsx(
600
+ "span",
601
+ {
602
+ className: cn(
603
+ "h-1.5 w-1.5 rounded-full",
604
+ i === stepIndex ? "bg-[var(--color-primary)]" : "bg-[var(--color-border)]"
605
+ )
606
+ },
607
+ i
608
+ )) })
609
+ ]
610
+ }
611
+ )
612
+ ] });
613
+ };
614
+ OnboardingSpotlight.displayName = "OnboardingSpotlight";
615
+
616
+ // components/core/organisms/types.ts
617
+ var EntityDisplayEvents = {
618
+ SORT: "SORT",
619
+ PAGINATE: "PAGINATE",
620
+ SEARCH: "SEARCH",
621
+ FILTER: "FILTER",
622
+ CLEAR_FILTERS: "CLEAR_FILTERS",
623
+ SELECT: "SELECT",
624
+ DESELECT: "DESELECT"
625
+ };
626
+
627
+ export { AssetPicker, Coachmark, EntityDisplayEvents, IconPicker, NodeSlotEditor, OnboardingSpotlight, PropertyInspector, useAnchorRect };