@almadar/ui 2.28.2 → 2.30.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 +412 -0
- package/dist/avl/index.d.cts +89 -1
- package/dist/avl/index.d.ts +3 -0
- package/dist/avl/index.js +410 -2
- package/dist/components/index.cjs +82 -29
- package/dist/components/index.js +82 -29
- package/dist/providers/EntityStoreProvider.d.ts +49 -0
- package/dist/providers/index.cjs +221 -141
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +115 -40
- package/dist/runtime/OrbPreview.d.ts +2 -2
- package/dist/runtime/ServerBridge.d.ts +2 -0
- package/dist/runtime/createClientEffectHandlers.d.ts +0 -1
- package/dist/runtime/index.cjs +1034 -988
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.js +258 -211
- package/dist/runtime/useTraitStateMachine.d.ts +1 -1
- package/package.json +1 -1
- package/dist/runtime/enrichFromResponse.d.ts +0 -21
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React118 from 'react';
|
|
2
|
+
import React118__default, { createContext, useCallback, useState, useRef, useEffect, useLayoutEffect, lazy, useContext, useMemo, Suspense, useSyncExternalStore, useId } from 'react';
|
|
3
3
|
import { EventBusContext } from '@almadar/ui/providers';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import '@tanstack/react-query';
|
|
@@ -12,7 +12,7 @@ import { UISlotProvider, useUISlots } from '@almadar/ui/context';
|
|
|
12
12
|
import * as LucideIcons from 'lucide-react';
|
|
13
13
|
import { Loader2, ChevronDown, X, ArrowRight, TrendingDown, TrendingUp, Check, Copy, AlertCircle, AlertTriangle, Info, CheckCircle, ChevronLeft, ChevronRight, FileWarning, Upload, Circle, Clock, CheckCircle2, Sun, Moon, ArrowUp, ArrowDown, MoreVertical, Minus, Star, XCircle, Play, RotateCcw, Pause, SkipForward, Eraser, Search, HelpCircle, ChevronUp, ArrowLeft, Plus, Image as Image$1, ZoomIn, Package, Menu as Menu$1, ZoomOut, Filter, FileQuestion, Inbox, FileText, Download, Printer, Bug, Send, MoreHorizontal, Settings, Bell, LogOut, Trash2, Zap, Sword, Move, Heart, Shield, Code, WrapText, Wrench, List, Calendar, Pencil, Eye, User, Tag, DollarSign } from 'lucide-react';
|
|
14
14
|
import { evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
15
|
-
import {
|
|
15
|
+
import { getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
|
|
16
16
|
import { MapContainer, TileLayer, Marker, Popup, useMap } from 'react-leaflet';
|
|
17
17
|
import L from 'leaflet';
|
|
18
18
|
import 'leaflet/dist/leaflet.css';
|
|
@@ -212,43 +212,43 @@ function useQuerySingleton(query) {
|
|
|
212
212
|
if (!query) {
|
|
213
213
|
return null;
|
|
214
214
|
}
|
|
215
|
-
const
|
|
215
|
+
const store2 = useMemo(() => getOrCreateStore(query), [query]);
|
|
216
216
|
useMemo(() => {
|
|
217
217
|
const listener = () => forceUpdate({});
|
|
218
|
-
|
|
218
|
+
store2.listeners.add(listener);
|
|
219
219
|
return () => {
|
|
220
|
-
|
|
220
|
+
store2.listeners.delete(listener);
|
|
221
221
|
};
|
|
222
|
-
}, [
|
|
222
|
+
}, [store2]);
|
|
223
223
|
const notifyListeners3 = useCallback(() => {
|
|
224
|
-
|
|
225
|
-
}, [
|
|
224
|
+
store2.listeners.forEach((listener) => listener());
|
|
225
|
+
}, [store2]);
|
|
226
226
|
const setSearch = useCallback((value) => {
|
|
227
|
-
|
|
227
|
+
store2.search = value;
|
|
228
228
|
notifyListeners3();
|
|
229
|
-
}, [
|
|
229
|
+
}, [store2, notifyListeners3]);
|
|
230
230
|
const setFilter = useCallback((key, value) => {
|
|
231
|
-
|
|
231
|
+
store2.filters = { ...store2.filters, [key]: value };
|
|
232
232
|
notifyListeners3();
|
|
233
|
-
}, [
|
|
233
|
+
}, [store2, notifyListeners3]);
|
|
234
234
|
const clearFilters = useCallback(() => {
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
store2.filters = {};
|
|
236
|
+
store2.search = "";
|
|
237
237
|
notifyListeners3();
|
|
238
|
-
}, [
|
|
238
|
+
}, [store2, notifyListeners3]);
|
|
239
239
|
const setSort = useCallback((field, direction) => {
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
store2.sortField = field;
|
|
241
|
+
store2.sortDirection = direction;
|
|
242
242
|
notifyListeners3();
|
|
243
|
-
}, [
|
|
243
|
+
}, [store2, notifyListeners3]);
|
|
244
244
|
return {
|
|
245
|
-
search:
|
|
245
|
+
search: store2.search,
|
|
246
246
|
setSearch,
|
|
247
|
-
filters:
|
|
247
|
+
filters: store2.filters,
|
|
248
248
|
setFilter,
|
|
249
249
|
clearFilters,
|
|
250
|
-
sortField:
|
|
251
|
-
sortDirection:
|
|
250
|
+
sortField: store2.sortField,
|
|
251
|
+
sortDirection: store2.sortDirection,
|
|
252
252
|
setSort
|
|
253
253
|
};
|
|
254
254
|
}
|
|
@@ -655,7 +655,7 @@ typeof process !== "undefined" && process.env?.VITE_API_URL ? process.env.VITE_A
|
|
|
655
655
|
|
|
656
656
|
// runtime/createClientEffectHandlers.ts
|
|
657
657
|
function createClientEffectHandlers(options) {
|
|
658
|
-
const { eventBus, slotSetter, navigate, notify
|
|
658
|
+
const { eventBus, slotSetter, navigate, notify } = options;
|
|
659
659
|
return {
|
|
660
660
|
emit: (event, payload) => {
|
|
661
661
|
const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
@@ -676,8 +676,7 @@ function createClientEffectHandlers(options) {
|
|
|
676
676
|
slotSetter.clearSlot(slot);
|
|
677
677
|
return;
|
|
678
678
|
}
|
|
679
|
-
|
|
680
|
-
slotSetter.addPattern(slot, enriched, props);
|
|
679
|
+
slotSetter.addPattern(slot, pattern, props);
|
|
681
680
|
},
|
|
682
681
|
navigate: navigate ?? ((path) => {
|
|
683
682
|
console.warn("[ClientEffectHandlers] No navigate handler, ignoring:", path);
|
|
@@ -1289,7 +1288,7 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
1289
1288
|
}
|
|
1290
1289
|
const onEventProcessed = optionsRef.current?.onEventProcessed;
|
|
1291
1290
|
if (onEventProcessed) {
|
|
1292
|
-
onEventProcessed(normalizedEvent, payload);
|
|
1291
|
+
await onEventProcessed(normalizedEvent, payload);
|
|
1293
1292
|
}
|
|
1294
1293
|
}, [entities, eventBus]);
|
|
1295
1294
|
const drainEventQueue = useCallback(async () => {
|
|
@@ -1616,7 +1615,7 @@ var positionStyles = {
|
|
|
1616
1615
|
fixed: "fixed",
|
|
1617
1616
|
sticky: "sticky"
|
|
1618
1617
|
};
|
|
1619
|
-
var Box =
|
|
1618
|
+
var Box = React118__default.forwardRef(
|
|
1620
1619
|
({
|
|
1621
1620
|
padding,
|
|
1622
1621
|
paddingX,
|
|
@@ -2066,6 +2065,61 @@ function useTheme() {
|
|
|
2066
2065
|
}
|
|
2067
2066
|
return context;
|
|
2068
2067
|
}
|
|
2068
|
+
var store = /* @__PURE__ */ new Map();
|
|
2069
|
+
var storeListeners = /* @__PURE__ */ new Set();
|
|
2070
|
+
var watchCallbacks = /* @__PURE__ */ new Map();
|
|
2071
|
+
function advance(entityType, data) {
|
|
2072
|
+
const prev = store.get(entityType);
|
|
2073
|
+
const oldData = prev?.data ?? [];
|
|
2074
|
+
store.set(entityType, { data, version: (prev?.version ?? 0) + 1 });
|
|
2075
|
+
for (const listener of storeListeners) {
|
|
2076
|
+
listener();
|
|
2077
|
+
}
|
|
2078
|
+
const cbs = watchCallbacks.get(entityType);
|
|
2079
|
+
if (cbs) {
|
|
2080
|
+
for (const cb of cbs) {
|
|
2081
|
+
try {
|
|
2082
|
+
cb(oldData, data);
|
|
2083
|
+
} catch {
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
function getSnapshot3(entityType) {
|
|
2089
|
+
return store.get(entityType)?.data ?? [];
|
|
2090
|
+
}
|
|
2091
|
+
function getVersion(entityType) {
|
|
2092
|
+
return store.get(entityType)?.version ?? 0;
|
|
2093
|
+
}
|
|
2094
|
+
function subscribeToStore(listener) {
|
|
2095
|
+
storeListeners.add(listener);
|
|
2096
|
+
return () => {
|
|
2097
|
+
storeListeners.delete(listener);
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
function useEntityRef(entityType) {
|
|
2101
|
+
const versionRef = useRef(0);
|
|
2102
|
+
const dataRef = useRef([]);
|
|
2103
|
+
const getSnapshotStable = React118__default.useCallback(() => {
|
|
2104
|
+
const currentVersion = getVersion(entityType);
|
|
2105
|
+
if (currentVersion !== versionRef.current) {
|
|
2106
|
+
versionRef.current = currentVersion;
|
|
2107
|
+
dataRef.current = getSnapshot3(entityType);
|
|
2108
|
+
}
|
|
2109
|
+
return dataRef.current;
|
|
2110
|
+
}, [entityType]);
|
|
2111
|
+
return useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
|
|
2112
|
+
}
|
|
2113
|
+
var EntityStoreContext = createContext({
|
|
2114
|
+
advance,
|
|
2115
|
+
getSnapshot: getSnapshot3
|
|
2116
|
+
});
|
|
2117
|
+
function useEntityStore() {
|
|
2118
|
+
return useContext(EntityStoreContext);
|
|
2119
|
+
}
|
|
2120
|
+
function EntityStoreProvider({ children }) {
|
|
2121
|
+
return /* @__PURE__ */ jsx(EntityStoreContext.Provider, { value: { advance, getSnapshot: getSnapshot3 }, children });
|
|
2122
|
+
}
|
|
2069
2123
|
var EventBusContext2 = createContext(null);
|
|
2070
2124
|
function EventBusProvider({ children, debug: debug2 = false }) {
|
|
2071
2125
|
const listenersRef = useRef(/* @__PURE__ */ new Map());
|
|
@@ -2711,7 +2765,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
2711
2765
|
const IconComp = value;
|
|
2712
2766
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
2713
2767
|
}
|
|
2714
|
-
if (
|
|
2768
|
+
if (React118__default.isValidElement(value)) {
|
|
2715
2769
|
return value;
|
|
2716
2770
|
}
|
|
2717
2771
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -2720,7 +2774,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
2720
2774
|
}
|
|
2721
2775
|
return value;
|
|
2722
2776
|
}
|
|
2723
|
-
var Button =
|
|
2777
|
+
var Button = React118__default.forwardRef(
|
|
2724
2778
|
({
|
|
2725
2779
|
className,
|
|
2726
2780
|
variant = "primary",
|
|
@@ -2816,7 +2870,7 @@ var sizeStyles3 = {
|
|
|
2816
2870
|
md: "px-2.5 py-1 text-sm",
|
|
2817
2871
|
lg: "px-3 py-1.5 text-base"
|
|
2818
2872
|
};
|
|
2819
|
-
var Badge =
|
|
2873
|
+
var Badge = React118__default.forwardRef(
|
|
2820
2874
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
2821
2875
|
const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
2822
2876
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -2939,7 +2993,7 @@ var Toast = ({
|
|
|
2939
2993
|
);
|
|
2940
2994
|
};
|
|
2941
2995
|
Toast.displayName = "Toast";
|
|
2942
|
-
var Input =
|
|
2996
|
+
var Input = React118__default.forwardRef(
|
|
2943
2997
|
({
|
|
2944
2998
|
className,
|
|
2945
2999
|
inputType,
|
|
@@ -3051,7 +3105,7 @@ var Input = React117__default.forwardRef(
|
|
|
3051
3105
|
}
|
|
3052
3106
|
);
|
|
3053
3107
|
Input.displayName = "Input";
|
|
3054
|
-
var Label =
|
|
3108
|
+
var Label = React118__default.forwardRef(
|
|
3055
3109
|
({ className, required, children, ...props }, ref) => {
|
|
3056
3110
|
return /* @__PURE__ */ jsxs(
|
|
3057
3111
|
"label",
|
|
@@ -3071,7 +3125,7 @@ var Label = React117__default.forwardRef(
|
|
|
3071
3125
|
}
|
|
3072
3126
|
);
|
|
3073
3127
|
Label.displayName = "Label";
|
|
3074
|
-
var Textarea =
|
|
3128
|
+
var Textarea = React118__default.forwardRef(
|
|
3075
3129
|
({ className, error, ...props }, ref) => {
|
|
3076
3130
|
return /* @__PURE__ */ jsx(
|
|
3077
3131
|
"textarea",
|
|
@@ -3094,7 +3148,7 @@ var Textarea = React117__default.forwardRef(
|
|
|
3094
3148
|
}
|
|
3095
3149
|
);
|
|
3096
3150
|
Textarea.displayName = "Textarea";
|
|
3097
|
-
var Select =
|
|
3151
|
+
var Select = React118__default.forwardRef(
|
|
3098
3152
|
({ className, options, placeholder, error, ...props }, ref) => {
|
|
3099
3153
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3100
3154
|
/* @__PURE__ */ jsxs(
|
|
@@ -3130,7 +3184,7 @@ var Select = React117__default.forwardRef(
|
|
|
3130
3184
|
}
|
|
3131
3185
|
);
|
|
3132
3186
|
Select.displayName = "Select";
|
|
3133
|
-
var Checkbox =
|
|
3187
|
+
var Checkbox = React118__default.forwardRef(
|
|
3134
3188
|
({ className, label, id, ...props }, ref) => {
|
|
3135
3189
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
3136
3190
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -3206,7 +3260,7 @@ var shadowStyles2 = {
|
|
|
3206
3260
|
md: "shadow",
|
|
3207
3261
|
lg: "shadow-lg"
|
|
3208
3262
|
};
|
|
3209
|
-
var Card =
|
|
3263
|
+
var Card = React118__default.forwardRef(
|
|
3210
3264
|
({
|
|
3211
3265
|
className,
|
|
3212
3266
|
variant = "bordered",
|
|
@@ -3242,9 +3296,9 @@ var Card = React117__default.forwardRef(
|
|
|
3242
3296
|
}
|
|
3243
3297
|
);
|
|
3244
3298
|
Card.displayName = "Card";
|
|
3245
|
-
var CardHeader =
|
|
3299
|
+
var CardHeader = React118__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3246
3300
|
CardHeader.displayName = "CardHeader";
|
|
3247
|
-
var CardTitle =
|
|
3301
|
+
var CardTitle = React118__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3248
3302
|
"h3",
|
|
3249
3303
|
{
|
|
3250
3304
|
ref,
|
|
@@ -3257,11 +3311,11 @@ var CardTitle = React117__default.forwardRef(({ className, ...props }, ref) => /
|
|
|
3257
3311
|
}
|
|
3258
3312
|
));
|
|
3259
3313
|
CardTitle.displayName = "CardTitle";
|
|
3260
|
-
var CardContent =
|
|
3314
|
+
var CardContent = React118__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
3261
3315
|
CardContent.displayName = "CardContent";
|
|
3262
3316
|
var CardBody = CardContent;
|
|
3263
3317
|
CardBody.displayName = "CardBody";
|
|
3264
|
-
var CardFooter =
|
|
3318
|
+
var CardFooter = React118__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3265
3319
|
"div",
|
|
3266
3320
|
{
|
|
3267
3321
|
ref,
|
|
@@ -3276,7 +3330,7 @@ var sizeStyles4 = {
|
|
|
3276
3330
|
md: "h-6 w-6",
|
|
3277
3331
|
lg: "h-8 w-8"
|
|
3278
3332
|
};
|
|
3279
|
-
var Spinner =
|
|
3333
|
+
var Spinner = React118__default.forwardRef(
|
|
3280
3334
|
({ className, size = "md", ...props }, ref) => {
|
|
3281
3335
|
return /* @__PURE__ */ jsx(
|
|
3282
3336
|
"div",
|
|
@@ -3692,7 +3746,7 @@ var ProgressBar = ({
|
|
|
3692
3746
|
return null;
|
|
3693
3747
|
};
|
|
3694
3748
|
ProgressBar.displayName = "ProgressBar";
|
|
3695
|
-
var Radio =
|
|
3749
|
+
var Radio = React118__default.forwardRef(
|
|
3696
3750
|
({
|
|
3697
3751
|
label,
|
|
3698
3752
|
helperText,
|
|
@@ -3796,7 +3850,7 @@ var Radio = React117__default.forwardRef(
|
|
|
3796
3850
|
}
|
|
3797
3851
|
);
|
|
3798
3852
|
Radio.displayName = "Radio";
|
|
3799
|
-
var Switch =
|
|
3853
|
+
var Switch = React118.forwardRef(
|
|
3800
3854
|
({
|
|
3801
3855
|
checked,
|
|
3802
3856
|
defaultChecked = false,
|
|
@@ -3807,10 +3861,10 @@ var Switch = React117.forwardRef(
|
|
|
3807
3861
|
name,
|
|
3808
3862
|
className
|
|
3809
3863
|
}, ref) => {
|
|
3810
|
-
const [isChecked, setIsChecked] =
|
|
3864
|
+
const [isChecked, setIsChecked] = React118.useState(
|
|
3811
3865
|
checked !== void 0 ? checked : defaultChecked
|
|
3812
3866
|
);
|
|
3813
|
-
|
|
3867
|
+
React118.useEffect(() => {
|
|
3814
3868
|
if (checked !== void 0) {
|
|
3815
3869
|
setIsChecked(checked);
|
|
3816
3870
|
}
|
|
@@ -4175,8 +4229,8 @@ var LawReferenceTooltip = ({
|
|
|
4175
4229
|
position = "top",
|
|
4176
4230
|
className
|
|
4177
4231
|
}) => {
|
|
4178
|
-
const [isVisible, setIsVisible] =
|
|
4179
|
-
const timeoutRef =
|
|
4232
|
+
const [isVisible, setIsVisible] = React118__default.useState(false);
|
|
4233
|
+
const timeoutRef = React118__default.useRef(null);
|
|
4180
4234
|
const handleMouseEnter = () => {
|
|
4181
4235
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4182
4236
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -4185,7 +4239,7 @@ var LawReferenceTooltip = ({
|
|
|
4185
4239
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4186
4240
|
setIsVisible(false);
|
|
4187
4241
|
};
|
|
4188
|
-
|
|
4242
|
+
React118__default.useEffect(() => {
|
|
4189
4243
|
return () => {
|
|
4190
4244
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4191
4245
|
};
|
|
@@ -4373,7 +4427,7 @@ var sizeStyles5 = {
|
|
|
4373
4427
|
md: "w-2.5 h-2.5",
|
|
4374
4428
|
lg: "w-3 h-3"
|
|
4375
4429
|
};
|
|
4376
|
-
var StatusDot =
|
|
4430
|
+
var StatusDot = React118__default.forwardRef(
|
|
4377
4431
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
4378
4432
|
return /* @__PURE__ */ jsx(
|
|
4379
4433
|
"span",
|
|
@@ -4420,7 +4474,7 @@ var iconMap2 = {
|
|
|
4420
4474
|
down: TrendingDown,
|
|
4421
4475
|
flat: ArrowRight
|
|
4422
4476
|
};
|
|
4423
|
-
var TrendIndicator =
|
|
4477
|
+
var TrendIndicator = React118__default.forwardRef(
|
|
4424
4478
|
({
|
|
4425
4479
|
className,
|
|
4426
4480
|
value,
|
|
@@ -4479,7 +4533,7 @@ var thumbSizes = {
|
|
|
4479
4533
|
md: "w-4 h-4",
|
|
4480
4534
|
lg: "w-5 h-5"
|
|
4481
4535
|
};
|
|
4482
|
-
var RangeSlider =
|
|
4536
|
+
var RangeSlider = React118__default.forwardRef(
|
|
4483
4537
|
({
|
|
4484
4538
|
className,
|
|
4485
4539
|
min = 0,
|
|
@@ -4930,7 +4984,7 @@ var paddingClasses = {
|
|
|
4930
4984
|
md: "py-16",
|
|
4931
4985
|
lg: "py-24"
|
|
4932
4986
|
};
|
|
4933
|
-
var ContentSection =
|
|
4987
|
+
var ContentSection = React118__default.forwardRef(
|
|
4934
4988
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
4935
4989
|
return /* @__PURE__ */ jsx(
|
|
4936
4990
|
Box,
|
|
@@ -4969,7 +5023,7 @@ var animatedStyles = {
|
|
|
4969
5023
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
4970
5024
|
"none": {}
|
|
4971
5025
|
};
|
|
4972
|
-
var AnimatedReveal =
|
|
5026
|
+
var AnimatedReveal = React118__default.forwardRef(
|
|
4973
5027
|
({
|
|
4974
5028
|
trigger = "scroll",
|
|
4975
5029
|
animation = "fade-up",
|
|
@@ -5122,7 +5176,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
|
|
|
5122
5176
|
el.style.opacity = animate ? "1" : "0";
|
|
5123
5177
|
});
|
|
5124
5178
|
}
|
|
5125
|
-
var AnimatedGraphic =
|
|
5179
|
+
var AnimatedGraphic = React118__default.forwardRef(
|
|
5126
5180
|
({
|
|
5127
5181
|
src,
|
|
5128
5182
|
svgContent,
|
|
@@ -5145,7 +5199,7 @@ var AnimatedGraphic = React117__default.forwardRef(
|
|
|
5145
5199
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
5146
5200
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
5147
5201
|
const prevAnimateRef = useRef(animate);
|
|
5148
|
-
const setRef =
|
|
5202
|
+
const setRef = React118__default.useCallback(
|
|
5149
5203
|
(node) => {
|
|
5150
5204
|
containerRef.current = node;
|
|
5151
5205
|
if (typeof ref === "function") ref(node);
|
|
@@ -5316,9 +5370,9 @@ function ScoreDisplay({
|
|
|
5316
5370
|
...rest
|
|
5317
5371
|
}) {
|
|
5318
5372
|
const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
|
|
5319
|
-
const [displayValue, setDisplayValue] =
|
|
5320
|
-
const [isAnimating, setIsAnimating] =
|
|
5321
|
-
|
|
5373
|
+
const [displayValue, setDisplayValue] = React118.useState(resolvedValue);
|
|
5374
|
+
const [isAnimating, setIsAnimating] = React118.useState(false);
|
|
5375
|
+
React118.useEffect(() => {
|
|
5322
5376
|
if (!animated || displayValue === resolvedValue) {
|
|
5323
5377
|
setDisplayValue(resolvedValue);
|
|
5324
5378
|
return;
|
|
@@ -5391,9 +5445,9 @@ function ControlButton({
|
|
|
5391
5445
|
className
|
|
5392
5446
|
}) {
|
|
5393
5447
|
const eventBus = useEventBus();
|
|
5394
|
-
const [isPressed, setIsPressed] =
|
|
5448
|
+
const [isPressed, setIsPressed] = React118.useState(false);
|
|
5395
5449
|
const actualPressed = pressed ?? isPressed;
|
|
5396
|
-
const handlePointerDown =
|
|
5450
|
+
const handlePointerDown = React118.useCallback(
|
|
5397
5451
|
(e) => {
|
|
5398
5452
|
e.preventDefault();
|
|
5399
5453
|
if (disabled) return;
|
|
@@ -5403,7 +5457,7 @@ function ControlButton({
|
|
|
5403
5457
|
},
|
|
5404
5458
|
[disabled, pressEvent, eventBus, onPress]
|
|
5405
5459
|
);
|
|
5406
|
-
const handlePointerUp =
|
|
5460
|
+
const handlePointerUp = React118.useCallback(
|
|
5407
5461
|
(e) => {
|
|
5408
5462
|
e.preventDefault();
|
|
5409
5463
|
if (disabled) return;
|
|
@@ -5413,7 +5467,7 @@ function ControlButton({
|
|
|
5413
5467
|
},
|
|
5414
5468
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
5415
5469
|
);
|
|
5416
|
-
const handlePointerLeave =
|
|
5470
|
+
const handlePointerLeave = React118.useCallback(
|
|
5417
5471
|
(e) => {
|
|
5418
5472
|
if (isPressed) {
|
|
5419
5473
|
setIsPressed(false);
|
|
@@ -6203,9 +6257,9 @@ function MiniMap({
|
|
|
6203
6257
|
viewportRect,
|
|
6204
6258
|
className
|
|
6205
6259
|
}) {
|
|
6206
|
-
const canvasRef =
|
|
6207
|
-
const frameRef =
|
|
6208
|
-
|
|
6260
|
+
const canvasRef = React118.useRef(null);
|
|
6261
|
+
const frameRef = React118.useRef(0);
|
|
6262
|
+
React118.useEffect(() => {
|
|
6209
6263
|
const canvas = canvasRef.current;
|
|
6210
6264
|
if (!canvas) return;
|
|
6211
6265
|
const ctx = canvas.getContext("2d");
|
|
@@ -6314,7 +6368,7 @@ var ErrorState = ({
|
|
|
6314
6368
|
);
|
|
6315
6369
|
};
|
|
6316
6370
|
ErrorState.displayName = "ErrorState";
|
|
6317
|
-
var ErrorBoundary = class extends
|
|
6371
|
+
var ErrorBoundary = class extends React118__default.Component {
|
|
6318
6372
|
constructor(props) {
|
|
6319
6373
|
super(props);
|
|
6320
6374
|
__publicField(this, "reset", () => {
|
|
@@ -6697,8 +6751,8 @@ var Tooltip = ({
|
|
|
6697
6751
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
6698
6752
|
};
|
|
6699
6753
|
}, []);
|
|
6700
|
-
const triggerElement =
|
|
6701
|
-
const trigger =
|
|
6754
|
+
const triggerElement = React118__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
6755
|
+
const trigger = React118__default.cloneElement(triggerElement, {
|
|
6702
6756
|
ref: triggerRef,
|
|
6703
6757
|
onMouseEnter: handleMouseEnter,
|
|
6704
6758
|
onMouseLeave: handleMouseLeave,
|
|
@@ -6811,8 +6865,8 @@ var Popover = ({
|
|
|
6811
6865
|
onMouseEnter: handleOpen,
|
|
6812
6866
|
onMouseLeave: handleClose
|
|
6813
6867
|
};
|
|
6814
|
-
const childElement =
|
|
6815
|
-
const triggerElement =
|
|
6868
|
+
const childElement = React118__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
6869
|
+
const triggerElement = React118__default.cloneElement(
|
|
6816
6870
|
childElement,
|
|
6817
6871
|
{
|
|
6818
6872
|
ref: triggerRef,
|
|
@@ -6916,8 +6970,8 @@ var Menu = ({
|
|
|
6916
6970
|
"bottom-start": "top-full left-0 mt-2",
|
|
6917
6971
|
"bottom-end": "top-full right-0 mt-2"
|
|
6918
6972
|
};
|
|
6919
|
-
const triggerChild =
|
|
6920
|
-
const triggerElement =
|
|
6973
|
+
const triggerChild = React118__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
|
|
6974
|
+
const triggerElement = React118__default.cloneElement(
|
|
6921
6975
|
triggerChild,
|
|
6922
6976
|
{
|
|
6923
6977
|
ref: triggerRef,
|
|
@@ -7617,7 +7671,7 @@ function InputPattern({
|
|
|
7617
7671
|
className
|
|
7618
7672
|
}) {
|
|
7619
7673
|
const { emit } = useEventBus();
|
|
7620
|
-
const [localValue, setLocalValue] =
|
|
7674
|
+
const [localValue, setLocalValue] = React118__default.useState(value);
|
|
7621
7675
|
const handleChange = (e) => {
|
|
7622
7676
|
setLocalValue(e.target.value);
|
|
7623
7677
|
if (onChange) {
|
|
@@ -7654,7 +7708,7 @@ function TextareaPattern({
|
|
|
7654
7708
|
className
|
|
7655
7709
|
}) {
|
|
7656
7710
|
const { emit } = useEventBus();
|
|
7657
|
-
const [localValue, setLocalValue] =
|
|
7711
|
+
const [localValue, setLocalValue] = React118__default.useState(value);
|
|
7658
7712
|
const handleChange = (e) => {
|
|
7659
7713
|
setLocalValue(e.target.value);
|
|
7660
7714
|
if (onChange) {
|
|
@@ -7685,7 +7739,7 @@ function SelectPattern({
|
|
|
7685
7739
|
className
|
|
7686
7740
|
}) {
|
|
7687
7741
|
const { emit } = useEventBus();
|
|
7688
|
-
const [localValue, setLocalValue] =
|
|
7742
|
+
const [localValue, setLocalValue] = React118__default.useState(value);
|
|
7689
7743
|
const handleChange = (e) => {
|
|
7690
7744
|
setLocalValue(e.target.value);
|
|
7691
7745
|
if (onChange) {
|
|
@@ -7714,7 +7768,7 @@ function CheckboxPattern({
|
|
|
7714
7768
|
className
|
|
7715
7769
|
}) {
|
|
7716
7770
|
const { emit } = useEventBus();
|
|
7717
|
-
const [localChecked, setLocalChecked] =
|
|
7771
|
+
const [localChecked, setLocalChecked] = React118__default.useState(checked);
|
|
7718
7772
|
const handleChange = (e) => {
|
|
7719
7773
|
setLocalChecked(e.target.checked);
|
|
7720
7774
|
if (onChange) {
|
|
@@ -7915,8 +7969,8 @@ function ActionButtons({
|
|
|
7915
7969
|
disabled
|
|
7916
7970
|
}) {
|
|
7917
7971
|
const eventBus = useEventBus();
|
|
7918
|
-
const [activeButtons, setActiveButtons] =
|
|
7919
|
-
const handlePress =
|
|
7972
|
+
const [activeButtons, setActiveButtons] = React118.useState(/* @__PURE__ */ new Set());
|
|
7973
|
+
const handlePress = React118.useCallback(
|
|
7920
7974
|
(id) => {
|
|
7921
7975
|
setActiveButtons((prev) => new Set(prev).add(id));
|
|
7922
7976
|
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
@@ -7924,7 +7978,7 @@ function ActionButtons({
|
|
|
7924
7978
|
},
|
|
7925
7979
|
[actionEvent, eventBus, onAction]
|
|
7926
7980
|
);
|
|
7927
|
-
const handleRelease =
|
|
7981
|
+
const handleRelease = React118.useCallback(
|
|
7928
7982
|
(id) => {
|
|
7929
7983
|
setActiveButtons((prev) => {
|
|
7930
7984
|
const next = new Set(prev);
|
|
@@ -9588,7 +9642,7 @@ var ScaledDiagram = ({
|
|
|
9588
9642
|
);
|
|
9589
9643
|
};
|
|
9590
9644
|
ScaledDiagram.displayName = "ScaledDiagram";
|
|
9591
|
-
var MarkdownContent =
|
|
9645
|
+
var MarkdownContent = React118__default.memo(
|
|
9592
9646
|
({ content, direction, className }) => {
|
|
9593
9647
|
const { t: _t } = useTranslate();
|
|
9594
9648
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -9690,7 +9744,7 @@ var MarkdownContent = React117__default.memo(
|
|
|
9690
9744
|
(prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
|
|
9691
9745
|
);
|
|
9692
9746
|
MarkdownContent.displayName = "MarkdownContent";
|
|
9693
|
-
var CodeBlock =
|
|
9747
|
+
var CodeBlock = React118__default.memo(
|
|
9694
9748
|
({
|
|
9695
9749
|
code: rawCode,
|
|
9696
9750
|
language = "text",
|
|
@@ -10650,7 +10704,7 @@ var StateMachineView = ({
|
|
|
10650
10704
|
style: { top: title ? 30 : 0 },
|
|
10651
10705
|
children: [
|
|
10652
10706
|
entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
|
|
10653
|
-
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(
|
|
10707
|
+
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React118__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
|
|
10654
10708
|
StateNode,
|
|
10655
10709
|
{
|
|
10656
10710
|
state,
|
|
@@ -15987,7 +16041,7 @@ function CraftingRecipe({
|
|
|
15987
16041
|
className
|
|
15988
16042
|
}) {
|
|
15989
16043
|
const eventBus = useEventBus();
|
|
15990
|
-
const handleCraft =
|
|
16044
|
+
const handleCraft = React118.useCallback(() => {
|
|
15991
16045
|
onCraft?.();
|
|
15992
16046
|
if (craftEvent) {
|
|
15993
16047
|
eventBus.emit(craftEvent, { output: output.label });
|
|
@@ -16004,7 +16058,7 @@ function CraftingRecipe({
|
|
|
16004
16058
|
children: [
|
|
16005
16059
|
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
|
|
16006
16060
|
const hasSufficient = ingredient.available >= ingredient.required;
|
|
16007
|
-
return /* @__PURE__ */ jsxs(
|
|
16061
|
+
return /* @__PURE__ */ jsxs(React118.Fragment, { children: [
|
|
16008
16062
|
/* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
|
|
16009
16063
|
ItemSlot,
|
|
16010
16064
|
{
|
|
@@ -16283,8 +16337,8 @@ function DPad({
|
|
|
16283
16337
|
}) {
|
|
16284
16338
|
const eventBus = useEventBus();
|
|
16285
16339
|
const sizes = sizeMap15[size];
|
|
16286
|
-
const [activeDirections, setActiveDirections] =
|
|
16287
|
-
const handlePress =
|
|
16340
|
+
const [activeDirections, setActiveDirections] = React118.useState(/* @__PURE__ */ new Set());
|
|
16341
|
+
const handlePress = React118.useCallback(
|
|
16288
16342
|
(direction) => {
|
|
16289
16343
|
setActiveDirections((prev) => new Set(prev).add(direction));
|
|
16290
16344
|
if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
|
|
@@ -16292,7 +16346,7 @@ function DPad({
|
|
|
16292
16346
|
},
|
|
16293
16347
|
[directionEvent, eventBus, onDirection]
|
|
16294
16348
|
);
|
|
16295
|
-
const handleRelease =
|
|
16349
|
+
const handleRelease = React118.useCallback(
|
|
16296
16350
|
(direction) => {
|
|
16297
16351
|
setActiveDirections((prev) => {
|
|
16298
16352
|
const next = new Set(prev);
|
|
@@ -17069,7 +17123,7 @@ var DataList = ({
|
|
|
17069
17123
|
}) => {
|
|
17070
17124
|
const eventBus = useEventBus();
|
|
17071
17125
|
const { t } = useTranslate();
|
|
17072
|
-
const [visibleCount, setVisibleCount] =
|
|
17126
|
+
const [visibleCount, setVisibleCount] = React118__default.useState(pageSize || Infinity);
|
|
17073
17127
|
const fields = fieldsProp ?? columnsProp ?? [];
|
|
17074
17128
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17075
17129
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
@@ -17106,7 +17160,7 @@ var DataList = ({
|
|
|
17106
17160
|
const items2 = data.map((item) => item);
|
|
17107
17161
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
17108
17162
|
const contentField = titleField?.name ?? fields[0]?.name ?? "";
|
|
17109
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
17163
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
17110
17164
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
17111
17165
|
group.items.map((itemData, index) => {
|
|
17112
17166
|
const id = itemData.id || `${gi}-${index}`;
|
|
@@ -17309,7 +17363,7 @@ var DataList = ({
|
|
|
17309
17363
|
className
|
|
17310
17364
|
),
|
|
17311
17365
|
children: [
|
|
17312
|
-
groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
17366
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
17313
17367
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
17314
17368
|
group.items.map(
|
|
17315
17369
|
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
@@ -18278,7 +18332,7 @@ var WizardProgress = ({
|
|
|
18278
18332
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: steps.map((step, index) => {
|
|
18279
18333
|
const isActive = index === currentStep;
|
|
18280
18334
|
const isCompleted = index < currentStep;
|
|
18281
|
-
return /* @__PURE__ */ jsxs(
|
|
18335
|
+
return /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
18282
18336
|
/* @__PURE__ */ jsx(
|
|
18283
18337
|
"button",
|
|
18284
18338
|
{
|
|
@@ -19103,7 +19157,7 @@ function InventoryGrid({
|
|
|
19103
19157
|
const eventBus = useEventBus();
|
|
19104
19158
|
const slotCount = totalSlots ?? items.length;
|
|
19105
19159
|
const emptySlotCount = Math.max(0, slotCount - items.length);
|
|
19106
|
-
const handleSelect =
|
|
19160
|
+
const handleSelect = React118.useCallback(
|
|
19107
19161
|
(id) => {
|
|
19108
19162
|
onSelect?.(id);
|
|
19109
19163
|
if (selectEvent) {
|
|
@@ -19276,15 +19330,15 @@ function GameCanvas2D({
|
|
|
19276
19330
|
fps = 60,
|
|
19277
19331
|
className
|
|
19278
19332
|
}) {
|
|
19279
|
-
const canvasRef =
|
|
19280
|
-
const rafRef =
|
|
19281
|
-
const frameRef =
|
|
19282
|
-
const lastTimeRef =
|
|
19283
|
-
const onDrawRef =
|
|
19333
|
+
const canvasRef = React118.useRef(null);
|
|
19334
|
+
const rafRef = React118.useRef(0);
|
|
19335
|
+
const frameRef = React118.useRef(0);
|
|
19336
|
+
const lastTimeRef = React118.useRef(0);
|
|
19337
|
+
const onDrawRef = React118.useRef(onDraw);
|
|
19284
19338
|
onDrawRef.current = onDraw;
|
|
19285
|
-
const onTickRef =
|
|
19339
|
+
const onTickRef = React118.useRef(onTick);
|
|
19286
19340
|
onTickRef.current = onTick;
|
|
19287
|
-
|
|
19341
|
+
React118.useEffect(() => {
|
|
19288
19342
|
const canvas = canvasRef.current;
|
|
19289
19343
|
if (!canvas) return;
|
|
19290
19344
|
const ctx = canvas.getContext("2d");
|
|
@@ -19537,7 +19591,7 @@ function TurnPanel({
|
|
|
19537
19591
|
className
|
|
19538
19592
|
}) {
|
|
19539
19593
|
const eventBus = useEventBus();
|
|
19540
|
-
const handleAction =
|
|
19594
|
+
const handleAction = React118.useCallback(
|
|
19541
19595
|
(event) => {
|
|
19542
19596
|
if (event) {
|
|
19543
19597
|
eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
|
|
@@ -19662,7 +19716,7 @@ function UnitCommandBar({
|
|
|
19662
19716
|
className
|
|
19663
19717
|
}) {
|
|
19664
19718
|
const eventBus = useEventBus();
|
|
19665
|
-
const handleCommand =
|
|
19719
|
+
const handleCommand = React118.useCallback(
|
|
19666
19720
|
(event) => {
|
|
19667
19721
|
if (event) {
|
|
19668
19722
|
eventBus.emit(event, { unitId: selectedUnitId });
|
|
@@ -20121,7 +20175,7 @@ function GameMenu({
|
|
|
20121
20175
|
} catch {
|
|
20122
20176
|
}
|
|
20123
20177
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
20124
|
-
const handleOptionClick =
|
|
20178
|
+
const handleOptionClick = React118.useCallback(
|
|
20125
20179
|
(option) => {
|
|
20126
20180
|
if (option.event && eventBus) {
|
|
20127
20181
|
eventBus.emit(`UI:${option.event}`, { option });
|
|
@@ -20244,7 +20298,7 @@ function GameOverScreen({
|
|
|
20244
20298
|
} catch {
|
|
20245
20299
|
}
|
|
20246
20300
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
20247
|
-
const handleActionClick =
|
|
20301
|
+
const handleActionClick = React118.useCallback(
|
|
20248
20302
|
(action) => {
|
|
20249
20303
|
if (action.event && eventBus) {
|
|
20250
20304
|
eventBus.emit(`UI:${action.event}`, { action });
|
|
@@ -23344,7 +23398,7 @@ var DocumentViewer = ({
|
|
|
23344
23398
|
};
|
|
23345
23399
|
DocumentViewer.displayName = "DocumentViewer";
|
|
23346
23400
|
function extractTitle(children) {
|
|
23347
|
-
if (!
|
|
23401
|
+
if (!React118__default.isValidElement(children)) return void 0;
|
|
23348
23402
|
const props = children.props;
|
|
23349
23403
|
if (typeof props.title === "string") {
|
|
23350
23404
|
return props.title;
|
|
@@ -23396,7 +23450,7 @@ function LinearView({
|
|
|
23396
23450
|
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
|
|
23397
23451
|
const isDone = i < currentIdx;
|
|
23398
23452
|
const isCurrent = i === currentIdx;
|
|
23399
|
-
return /* @__PURE__ */ jsxs(
|
|
23453
|
+
return /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
23400
23454
|
i > 0 && /* @__PURE__ */ jsx(
|
|
23401
23455
|
Typography,
|
|
23402
23456
|
{
|
|
@@ -24062,7 +24116,7 @@ var Form = ({
|
|
|
24062
24116
|
const normalizedInitialData = initialData ?? {};
|
|
24063
24117
|
const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
|
|
24064
24118
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
24065
|
-
const entityDerivedFields =
|
|
24119
|
+
const entityDerivedFields = React118__default.useMemo(() => {
|
|
24066
24120
|
if (fields && fields.length > 0) return void 0;
|
|
24067
24121
|
if (!resolvedEntity) return void 0;
|
|
24068
24122
|
return resolvedEntity.fields.map(
|
|
@@ -24081,14 +24135,14 @@ var Form = ({
|
|
|
24081
24135
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
24082
24136
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
24083
24137
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
24084
|
-
const [formData, setFormData] =
|
|
24138
|
+
const [formData, setFormData] = React118__default.useState(
|
|
24085
24139
|
normalizedInitialData
|
|
24086
24140
|
);
|
|
24087
|
-
const [collapsedSections, setCollapsedSections] =
|
|
24141
|
+
const [collapsedSections, setCollapsedSections] = React118__default.useState(
|
|
24088
24142
|
/* @__PURE__ */ new Set()
|
|
24089
24143
|
);
|
|
24090
24144
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
24091
|
-
const evalContext =
|
|
24145
|
+
const evalContext = React118__default.useMemo(
|
|
24092
24146
|
() => ({
|
|
24093
24147
|
formValues: formData,
|
|
24094
24148
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -24097,13 +24151,13 @@ var Form = ({
|
|
|
24097
24151
|
}),
|
|
24098
24152
|
[formData, externalContext]
|
|
24099
24153
|
);
|
|
24100
|
-
|
|
24154
|
+
React118__default.useEffect(() => {
|
|
24101
24155
|
const data = initialData;
|
|
24102
24156
|
if (data && Object.keys(data).length > 0) {
|
|
24103
24157
|
setFormData(data);
|
|
24104
24158
|
}
|
|
24105
24159
|
}, [initialData]);
|
|
24106
|
-
const processCalculations =
|
|
24160
|
+
const processCalculations = React118__default.useCallback(
|
|
24107
24161
|
(changedFieldId, newFormData) => {
|
|
24108
24162
|
if (!hiddenCalculations.length) return;
|
|
24109
24163
|
const context = {
|
|
@@ -24128,7 +24182,7 @@ var Form = ({
|
|
|
24128
24182
|
},
|
|
24129
24183
|
[hiddenCalculations, externalContext, eventBus]
|
|
24130
24184
|
);
|
|
24131
|
-
const checkViolations =
|
|
24185
|
+
const checkViolations = React118__default.useCallback(
|
|
24132
24186
|
(changedFieldId, newFormData) => {
|
|
24133
24187
|
if (!violationTriggers.length) return;
|
|
24134
24188
|
const context = {
|
|
@@ -24165,7 +24219,7 @@ var Form = ({
|
|
|
24165
24219
|
processCalculations(name, newFormData);
|
|
24166
24220
|
checkViolations(name, newFormData);
|
|
24167
24221
|
};
|
|
24168
|
-
const isFieldVisible =
|
|
24222
|
+
const isFieldVisible = React118__default.useCallback(
|
|
24169
24223
|
(fieldName) => {
|
|
24170
24224
|
const condition = conditionalFields[fieldName];
|
|
24171
24225
|
if (!condition) return true;
|
|
@@ -24173,7 +24227,7 @@ var Form = ({
|
|
|
24173
24227
|
},
|
|
24174
24228
|
[conditionalFields, evalContext]
|
|
24175
24229
|
);
|
|
24176
|
-
const isSectionVisible =
|
|
24230
|
+
const isSectionVisible = React118__default.useCallback(
|
|
24177
24231
|
(section) => {
|
|
24178
24232
|
if (!section.condition) return true;
|
|
24179
24233
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -24205,7 +24259,7 @@ var Form = ({
|
|
|
24205
24259
|
eventBus.emit(`UI:${onCancel}`);
|
|
24206
24260
|
}
|
|
24207
24261
|
};
|
|
24208
|
-
const renderField =
|
|
24262
|
+
const renderField = React118__default.useCallback(
|
|
24209
24263
|
(field) => {
|
|
24210
24264
|
const fieldName = field.name || field.field;
|
|
24211
24265
|
if (!fieldName) return null;
|
|
@@ -24226,7 +24280,7 @@ var Form = ({
|
|
|
24226
24280
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
24227
24281
|
);
|
|
24228
24282
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
24229
|
-
const normalizedFields =
|
|
24283
|
+
const normalizedFields = React118__default.useMemo(() => {
|
|
24230
24284
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
24231
24285
|
return effectiveFields.map((field) => {
|
|
24232
24286
|
if (typeof field === "string") {
|
|
@@ -24248,7 +24302,7 @@ var Form = ({
|
|
|
24248
24302
|
return field;
|
|
24249
24303
|
});
|
|
24250
24304
|
}, [effectiveFields, resolvedEntity]);
|
|
24251
|
-
const schemaFields =
|
|
24305
|
+
const schemaFields = React118__default.useMemo(() => {
|
|
24252
24306
|
if (normalizedFields.length === 0) return null;
|
|
24253
24307
|
if (isDebugEnabled()) {
|
|
24254
24308
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -24258,7 +24312,7 @@ var Form = ({
|
|
|
24258
24312
|
}
|
|
24259
24313
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
24260
24314
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
24261
|
-
const sectionElements =
|
|
24315
|
+
const sectionElements = React118__default.useMemo(() => {
|
|
24262
24316
|
if (!sections || sections.length === 0) return null;
|
|
24263
24317
|
return sections.map((section) => {
|
|
24264
24318
|
if (!isSectionVisible(section)) {
|
|
@@ -25662,7 +25716,7 @@ var List2 = ({
|
|
|
25662
25716
|
if (entity && typeof entity === "object" && "id" in entity) return [entity];
|
|
25663
25717
|
return [];
|
|
25664
25718
|
}, [entity]);
|
|
25665
|
-
const getItemActions =
|
|
25719
|
+
const getItemActions = React118__default.useCallback(
|
|
25666
25720
|
(item) => {
|
|
25667
25721
|
if (!itemActions) return [];
|
|
25668
25722
|
if (typeof itemActions === "function") {
|
|
@@ -26088,7 +26142,7 @@ var MediaGallery = ({
|
|
|
26088
26142
|
[selectable, selectedItems, selectionEvent, eventBus]
|
|
26089
26143
|
);
|
|
26090
26144
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
26091
|
-
const items =
|
|
26145
|
+
const items = React118__default.useMemo(() => {
|
|
26092
26146
|
if (propItems) return propItems;
|
|
26093
26147
|
if (entityData.length === 0) return [];
|
|
26094
26148
|
return entityData.map((record, idx) => ({
|
|
@@ -26250,7 +26304,7 @@ var MediaGallery = ({
|
|
|
26250
26304
|
};
|
|
26251
26305
|
MediaGallery.displayName = "MediaGallery";
|
|
26252
26306
|
function extractTitle2(children) {
|
|
26253
|
-
if (!
|
|
26307
|
+
if (!React118__default.isValidElement(children)) return void 0;
|
|
26254
26308
|
const props = children.props;
|
|
26255
26309
|
if (typeof props.title === "string") {
|
|
26256
26310
|
return props.title;
|
|
@@ -26920,7 +26974,7 @@ var PageHeader = ({
|
|
|
26920
26974
|
info: "bg-info/10 text-info"
|
|
26921
26975
|
};
|
|
26922
26976
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
26923
|
-
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(
|
|
26977
|
+
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
26924
26978
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
26925
26979
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
26926
26980
|
"a",
|
|
@@ -27046,7 +27100,7 @@ function subscribeToDebugEvents(listener) {
|
|
|
27046
27100
|
|
|
27047
27101
|
// components/organisms/debug/hooks/useDebugData.ts
|
|
27048
27102
|
function useDebugData() {
|
|
27049
|
-
const [data, setData] =
|
|
27103
|
+
const [data, setData] = React118.useState(() => ({
|
|
27050
27104
|
traits: [],
|
|
27051
27105
|
ticks: [],
|
|
27052
27106
|
guards: [],
|
|
@@ -27060,7 +27114,7 @@ function useDebugData() {
|
|
|
27060
27114
|
},
|
|
27061
27115
|
lastUpdate: Date.now()
|
|
27062
27116
|
}));
|
|
27063
|
-
|
|
27117
|
+
React118.useEffect(() => {
|
|
27064
27118
|
const updateData = () => {
|
|
27065
27119
|
setData({
|
|
27066
27120
|
traits: getAllTraits(),
|
|
@@ -27329,15 +27383,15 @@ var TYPE_BADGES = {
|
|
|
27329
27383
|
state: { variant: "danger", icon: "\u{1F4CA}" }
|
|
27330
27384
|
};
|
|
27331
27385
|
function EventFlowTab({ events: events2 }) {
|
|
27332
|
-
const [filter, setFilter] =
|
|
27333
|
-
const containerRef =
|
|
27334
|
-
const [autoScroll, setAutoScroll] =
|
|
27335
|
-
|
|
27386
|
+
const [filter, setFilter] = React118.useState("all");
|
|
27387
|
+
const containerRef = React118.useRef(null);
|
|
27388
|
+
const [autoScroll, setAutoScroll] = React118.useState(true);
|
|
27389
|
+
React118.useEffect(() => {
|
|
27336
27390
|
if (autoScroll && containerRef.current) {
|
|
27337
27391
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
27338
27392
|
}
|
|
27339
27393
|
}, [events2.length, autoScroll]);
|
|
27340
|
-
const filteredEvents =
|
|
27394
|
+
const filteredEvents = React118.useMemo(() => {
|
|
27341
27395
|
if (filter === "all") return events2;
|
|
27342
27396
|
return events2.filter((e) => e.type === filter);
|
|
27343
27397
|
}, [events2, filter]);
|
|
@@ -27436,7 +27490,7 @@ function EventFlowTab({ events: events2 }) {
|
|
|
27436
27490
|
}
|
|
27437
27491
|
EventFlowTab.displayName = "EventFlowTab";
|
|
27438
27492
|
function GuardsPanel({ guards }) {
|
|
27439
|
-
const [filter, setFilter] =
|
|
27493
|
+
const [filter, setFilter] = React118.useState("all");
|
|
27440
27494
|
if (guards.length === 0) {
|
|
27441
27495
|
return /* @__PURE__ */ jsx(
|
|
27442
27496
|
EmptyState,
|
|
@@ -27449,7 +27503,7 @@ function GuardsPanel({ guards }) {
|
|
|
27449
27503
|
}
|
|
27450
27504
|
const passedCount = guards.filter((g) => g.result).length;
|
|
27451
27505
|
const failedCount = guards.length - passedCount;
|
|
27452
|
-
const filteredGuards =
|
|
27506
|
+
const filteredGuards = React118.useMemo(() => {
|
|
27453
27507
|
if (filter === "all") return guards;
|
|
27454
27508
|
if (filter === "passed") return guards.filter((g) => g.result);
|
|
27455
27509
|
return guards.filter((g) => !g.result);
|
|
@@ -27593,10 +27647,10 @@ function EffectBadge({ effect }) {
|
|
|
27593
27647
|
] });
|
|
27594
27648
|
}
|
|
27595
27649
|
function TransitionTimeline({ transitions }) {
|
|
27596
|
-
const containerRef =
|
|
27597
|
-
const [autoScroll, setAutoScroll] =
|
|
27598
|
-
const [expandedId, setExpandedId] =
|
|
27599
|
-
|
|
27650
|
+
const containerRef = React118.useRef(null);
|
|
27651
|
+
const [autoScroll, setAutoScroll] = React118.useState(true);
|
|
27652
|
+
const [expandedId, setExpandedId] = React118.useState(null);
|
|
27653
|
+
React118.useEffect(() => {
|
|
27600
27654
|
if (autoScroll && containerRef.current) {
|
|
27601
27655
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
27602
27656
|
}
|
|
@@ -27857,9 +27911,9 @@ function getAllEvents(traits2) {
|
|
|
27857
27911
|
}
|
|
27858
27912
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
27859
27913
|
const eventBus = useEventBus();
|
|
27860
|
-
const [log, setLog] =
|
|
27861
|
-
const prevStatesRef =
|
|
27862
|
-
|
|
27914
|
+
const [log, setLog] = React118.useState([]);
|
|
27915
|
+
const prevStatesRef = React118.useRef(/* @__PURE__ */ new Map());
|
|
27916
|
+
React118.useEffect(() => {
|
|
27863
27917
|
for (const trait of traits2) {
|
|
27864
27918
|
const prev = prevStatesRef.current.get(trait.id);
|
|
27865
27919
|
if (prev && prev !== trait.currentState) {
|
|
@@ -28012,9 +28066,9 @@ function VerifyModePanel({
|
|
|
28012
28066
|
serverCount,
|
|
28013
28067
|
localCount
|
|
28014
28068
|
}) {
|
|
28015
|
-
const scrollRef =
|
|
28016
|
-
const prevCountRef =
|
|
28017
|
-
|
|
28069
|
+
const scrollRef = React118.useRef(null);
|
|
28070
|
+
const prevCountRef = React118.useRef(0);
|
|
28071
|
+
React118.useEffect(() => {
|
|
28018
28072
|
if (transitions.length > prevCountRef.current && scrollRef.current) {
|
|
28019
28073
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
28020
28074
|
}
|
|
@@ -28055,10 +28109,10 @@ function RuntimeDebugger({
|
|
|
28055
28109
|
defaultTab,
|
|
28056
28110
|
schema
|
|
28057
28111
|
}) {
|
|
28058
|
-
const [isCollapsed, setIsCollapsed] =
|
|
28059
|
-
const [isVisible, setIsVisible] =
|
|
28112
|
+
const [isCollapsed, setIsCollapsed] = React118.useState(mode === "verify" ? true : defaultCollapsed);
|
|
28113
|
+
const [isVisible, setIsVisible] = React118.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
|
|
28060
28114
|
const debugData = useDebugData();
|
|
28061
|
-
|
|
28115
|
+
React118.useEffect(() => {
|
|
28062
28116
|
if (mode === "inline") return;
|
|
28063
28117
|
return onDebugToggle((enabled) => {
|
|
28064
28118
|
setIsVisible(enabled);
|
|
@@ -28067,7 +28121,7 @@ function RuntimeDebugger({
|
|
|
28067
28121
|
}
|
|
28068
28122
|
});
|
|
28069
28123
|
}, [mode]);
|
|
28070
|
-
|
|
28124
|
+
React118.useEffect(() => {
|
|
28071
28125
|
if (mode === "inline") return;
|
|
28072
28126
|
const handleKeyDown = (e) => {
|
|
28073
28127
|
if (e.key === "`" && isVisible) {
|
|
@@ -28572,7 +28626,7 @@ function SequenceBar({
|
|
|
28572
28626
|
onSlotRemove(index);
|
|
28573
28627
|
}, [onSlotRemove, playing]);
|
|
28574
28628
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
28575
|
-
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(
|
|
28629
|
+
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
28576
28630
|
i > 0 && /* @__PURE__ */ jsx(
|
|
28577
28631
|
Typography,
|
|
28578
28632
|
{
|
|
@@ -28693,7 +28747,7 @@ function SequencerBoard({
|
|
|
28693
28747
|
setPlayState("playing");
|
|
28694
28748
|
setCurrentStep(0);
|
|
28695
28749
|
let step = 0;
|
|
28696
|
-
const
|
|
28750
|
+
const advance2 = () => {
|
|
28697
28751
|
step++;
|
|
28698
28752
|
if (step >= entity.maxSlots) {
|
|
28699
28753
|
const playerSeq = slots.map((s) => s?.id);
|
|
@@ -28724,10 +28778,10 @@ function SequencerBoard({
|
|
|
28724
28778
|
}
|
|
28725
28779
|
} else {
|
|
28726
28780
|
setCurrentStep(step);
|
|
28727
|
-
timerRef.current = setTimeout(
|
|
28781
|
+
timerRef.current = setTimeout(advance2, stepDurationMs);
|
|
28728
28782
|
}
|
|
28729
28783
|
};
|
|
28730
|
-
timerRef.current = setTimeout(
|
|
28784
|
+
timerRef.current = setTimeout(advance2, stepDurationMs);
|
|
28731
28785
|
}, [canPlay, slots, entity.maxSlots, entity.solutions, stepDurationMs, playEvent, completeEvent, emit]);
|
|
28732
28786
|
const machine = {
|
|
28733
28787
|
name: entity.title,
|
|
@@ -29810,7 +29864,7 @@ var StatCard = ({
|
|
|
29810
29864
|
const labelToUse = propLabel ?? propTitle;
|
|
29811
29865
|
const eventBus = useEventBus();
|
|
29812
29866
|
const { t } = useTranslate();
|
|
29813
|
-
const handleActionClick =
|
|
29867
|
+
const handleActionClick = React118__default.useCallback(() => {
|
|
29814
29868
|
if (action?.event) {
|
|
29815
29869
|
eventBus.emit(`UI:${action.event}`, {});
|
|
29816
29870
|
}
|
|
@@ -29821,7 +29875,7 @@ var StatCard = ({
|
|
|
29821
29875
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
29822
29876
|
const isLoading = externalLoading ?? false;
|
|
29823
29877
|
const error = externalError;
|
|
29824
|
-
const computeMetricValue =
|
|
29878
|
+
const computeMetricValue = React118__default.useCallback(
|
|
29825
29879
|
(metric, items) => {
|
|
29826
29880
|
if (metric.value !== void 0) {
|
|
29827
29881
|
return metric.value;
|
|
@@ -29860,7 +29914,7 @@ var StatCard = ({
|
|
|
29860
29914
|
},
|
|
29861
29915
|
[]
|
|
29862
29916
|
);
|
|
29863
|
-
const schemaStats =
|
|
29917
|
+
const schemaStats = React118__default.useMemo(() => {
|
|
29864
29918
|
if (!metrics || metrics.length === 0) return null;
|
|
29865
29919
|
return metrics.map((metric) => ({
|
|
29866
29920
|
label: metric.label,
|
|
@@ -29868,7 +29922,7 @@ var StatCard = ({
|
|
|
29868
29922
|
format: metric.format
|
|
29869
29923
|
}));
|
|
29870
29924
|
}, [metrics, data, computeMetricValue]);
|
|
29871
|
-
const calculatedTrend =
|
|
29925
|
+
const calculatedTrend = React118__default.useMemo(() => {
|
|
29872
29926
|
if (manualTrend !== void 0) return manualTrend;
|
|
29873
29927
|
if (previousValue === void 0 || currentValue === void 0)
|
|
29874
29928
|
return void 0;
|
|
@@ -30779,7 +30833,7 @@ var Timeline = ({
|
|
|
30779
30833
|
}) => {
|
|
30780
30834
|
const { t } = useTranslate();
|
|
30781
30835
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
30782
|
-
const items =
|
|
30836
|
+
const items = React118__default.useMemo(() => {
|
|
30783
30837
|
if (propItems) return propItems;
|
|
30784
30838
|
if (entityData.length === 0) return [];
|
|
30785
30839
|
return entityData.map((record, idx) => {
|
|
@@ -30881,7 +30935,7 @@ var Timeline = ({
|
|
|
30881
30935
|
};
|
|
30882
30936
|
Timeline.displayName = "Timeline";
|
|
30883
30937
|
function extractToastProps(children) {
|
|
30884
|
-
if (!
|
|
30938
|
+
if (!React118__default.isValidElement(children)) {
|
|
30885
30939
|
if (typeof children === "string") {
|
|
30886
30940
|
return { message: children };
|
|
30887
30941
|
}
|
|
@@ -30912,7 +30966,7 @@ var ToastSlot = ({
|
|
|
30912
30966
|
eventBus.emit("UI:CLOSE");
|
|
30913
30967
|
};
|
|
30914
30968
|
if (!isVisible) return null;
|
|
30915
|
-
const isCustomContent =
|
|
30969
|
+
const isCustomContent = React118__default.isValidElement(children) && !message;
|
|
30916
30970
|
return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
|
|
30917
30971
|
Toast,
|
|
30918
30972
|
{
|
|
@@ -31156,7 +31210,7 @@ var WizardContainer = ({
|
|
|
31156
31210
|
const isCompleted = index < currentStep;
|
|
31157
31211
|
const stepKey = step.id ?? step.tabId ?? `step-${index}`;
|
|
31158
31212
|
const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
|
|
31159
|
-
return /* @__PURE__ */ jsxs(
|
|
31213
|
+
return /* @__PURE__ */ jsxs(React118__default.Fragment, { children: [
|
|
31160
31214
|
/* @__PURE__ */ jsx(
|
|
31161
31215
|
Button,
|
|
31162
31216
|
{
|
|
@@ -31522,12 +31576,12 @@ WorldMapTemplate.displayName = "WorldMapTemplate";
|
|
|
31522
31576
|
|
|
31523
31577
|
// components/organisms/component-registry.generated.ts
|
|
31524
31578
|
function lazyThree(name, loader) {
|
|
31525
|
-
const Lazy =
|
|
31579
|
+
const Lazy = React118__default.lazy(() => loader().then((m) => ({ default: m[name] })));
|
|
31526
31580
|
function ThreeWrapper(props) {
|
|
31527
|
-
return
|
|
31528
|
-
|
|
31581
|
+
return React118__default.createElement(
|
|
31582
|
+
React118__default.Suspense,
|
|
31529
31583
|
{ fallback: null },
|
|
31530
|
-
|
|
31584
|
+
React118__default.createElement(Lazy, props)
|
|
31531
31585
|
);
|
|
31532
31586
|
}
|
|
31533
31587
|
ThreeWrapper.displayName = `Lazy(${name})`;
|
|
@@ -31815,7 +31869,7 @@ function SuspenseConfigProvider({
|
|
|
31815
31869
|
config,
|
|
31816
31870
|
children
|
|
31817
31871
|
}) {
|
|
31818
|
-
return
|
|
31872
|
+
return React118__default.createElement(
|
|
31819
31873
|
SuspenseConfigContext.Provider,
|
|
31820
31874
|
{ value: config },
|
|
31821
31875
|
children
|
|
@@ -32264,6 +32318,9 @@ function SlotContentRenderer({
|
|
|
32264
32318
|
content,
|
|
32265
32319
|
onDismiss
|
|
32266
32320
|
}) {
|
|
32321
|
+
const entityProp = content.props.entity;
|
|
32322
|
+
const entityType = typeof entityProp === "string" ? entityProp : "";
|
|
32323
|
+
const storeData = useEntityRef(entityType);
|
|
32267
32324
|
const PatternComponent = getComponentForPattern(content.pattern);
|
|
32268
32325
|
if (PatternComponent) {
|
|
32269
32326
|
const childrenConfig = content.props.children;
|
|
@@ -32271,13 +32328,14 @@ function SlotContentRenderer({
|
|
|
32271
32328
|
const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id) : void 0;
|
|
32272
32329
|
const { children: _childrenConfig, ...restProps } = content.props;
|
|
32273
32330
|
const renderedProps = renderPatternProps(restProps, onDismiss);
|
|
32331
|
+
const finalProps = entityType ? { ...renderedProps, entity: storeData } : renderedProps;
|
|
32274
32332
|
return /* @__PURE__ */ jsx(
|
|
32275
32333
|
Box,
|
|
32276
32334
|
{
|
|
32277
32335
|
className: "slot-content",
|
|
32278
32336
|
"data-pattern": content.pattern,
|
|
32279
32337
|
"data-id": content.id,
|
|
32280
|
-
children: /* @__PURE__ */ jsx(PatternComponent, { ...
|
|
32338
|
+
children: /* @__PURE__ */ jsx(PatternComponent, { ...finalProps, children: renderedChildren })
|
|
32281
32339
|
}
|
|
32282
32340
|
);
|
|
32283
32341
|
}
|
|
@@ -32544,7 +32602,7 @@ function OrbitalProvider({
|
|
|
32544
32602
|
() => ({ enabled: suspense }),
|
|
32545
32603
|
[suspense]
|
|
32546
32604
|
);
|
|
32547
|
-
const inner = /* @__PURE__ */ jsx(EventBusProvider, { debug: debug2, children: /* @__PURE__ */ jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) });
|
|
32605
|
+
const inner = /* @__PURE__ */ jsx(EntityStoreProvider, { children: /* @__PURE__ */ jsx(EventBusProvider, { debug: debug2, children: /* @__PURE__ */ jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) }) });
|
|
32548
32606
|
if (skipTheme) {
|
|
32549
32607
|
return inner;
|
|
32550
32608
|
}
|
|
@@ -32560,41 +32618,6 @@ function OrbitalProvider({
|
|
|
32560
32618
|
);
|
|
32561
32619
|
}
|
|
32562
32620
|
OrbitalProvider.displayName = "OrbitalProvider";
|
|
32563
|
-
function enrichFromResponse(node, data) {
|
|
32564
|
-
if (!node || typeof node !== "object") return node ?? {};
|
|
32565
|
-
let enriched = node;
|
|
32566
|
-
if (Array.isArray(enriched.children)) {
|
|
32567
|
-
enriched = {
|
|
32568
|
-
...enriched,
|
|
32569
|
-
children: enriched.children.map(
|
|
32570
|
-
(child) => {
|
|
32571
|
-
if (!child || typeof child !== "object") return child;
|
|
32572
|
-
return enrichFromResponse(child, data);
|
|
32573
|
-
}
|
|
32574
|
-
)
|
|
32575
|
-
};
|
|
32576
|
-
}
|
|
32577
|
-
const nodeType = enriched.type;
|
|
32578
|
-
if (nodeType && isEntityAwarePattern(nodeType) && typeof enriched.entity === "string") {
|
|
32579
|
-
const entityName = enriched.entity;
|
|
32580
|
-
const records = data[entityName];
|
|
32581
|
-
if (records && records.length > 0) {
|
|
32582
|
-
enriched = { ...enriched, entity: records };
|
|
32583
|
-
if (!enriched.fields && !enriched.columns) {
|
|
32584
|
-
const sample = records[0];
|
|
32585
|
-
if (sample && typeof sample === "object") {
|
|
32586
|
-
const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
|
|
32587
|
-
enriched = {
|
|
32588
|
-
...enriched,
|
|
32589
|
-
fields: keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" })),
|
|
32590
|
-
children: void 0
|
|
32591
|
-
};
|
|
32592
|
-
}
|
|
32593
|
-
}
|
|
32594
|
-
}
|
|
32595
|
-
}
|
|
32596
|
-
return enriched;
|
|
32597
|
-
}
|
|
32598
32621
|
var ServerBridgeContext = createContext(null);
|
|
32599
32622
|
function useServerBridge() {
|
|
32600
32623
|
const ctx = useContext(ServerBridgeContext);
|
|
@@ -32651,6 +32674,7 @@ function ServerBridgeProvider({
|
|
|
32651
32674
|
success: !!result.success,
|
|
32652
32675
|
clientEffects: result.clientEffects?.length ?? 0,
|
|
32653
32676
|
dataEntities,
|
|
32677
|
+
data: responseData,
|
|
32654
32678
|
emittedEvents: result.emittedEvents?.map((e) => e.event) ?? [],
|
|
32655
32679
|
error: result.error
|
|
32656
32680
|
};
|
|
@@ -32662,8 +32686,7 @@ function ServerBridgeProvider({
|
|
|
32662
32686
|
if (effectType === "render-ui") {
|
|
32663
32687
|
const slot = arr[1];
|
|
32664
32688
|
const pattern = arr[2];
|
|
32665
|
-
|
|
32666
|
-
effects.push({ type: "render-ui", slot, pattern: enriched });
|
|
32689
|
+
effects.push({ type: "render-ui", slot, pattern: pattern ?? void 0 });
|
|
32667
32690
|
} else if (effectType === "navigate") {
|
|
32668
32691
|
effects.push({ type: "navigate", route: arr[1], params: arr[2] });
|
|
32669
32692
|
} else if (effectType === "notify") {
|
|
@@ -32708,7 +32731,7 @@ function normalizeChild(child) {
|
|
|
32708
32731
|
props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
|
|
32709
32732
|
};
|
|
32710
32733
|
}
|
|
32711
|
-
function SlotBridge(
|
|
32734
|
+
function SlotBridge() {
|
|
32712
32735
|
const slots = useSlots();
|
|
32713
32736
|
const { render, clear } = useUISlots();
|
|
32714
32737
|
useEffect(() => {
|
|
@@ -32718,10 +32741,7 @@ function SlotBridge({ mockData }) {
|
|
|
32718
32741
|
continue;
|
|
32719
32742
|
}
|
|
32720
32743
|
const entry = slotState.patterns[slotState.patterns.length - 1];
|
|
32721
|
-
|
|
32722
|
-
if (mockData && Object.keys(mockData).length > 0) {
|
|
32723
|
-
patternRecord = enrichFromResponse(patternRecord, mockData);
|
|
32724
|
-
}
|
|
32744
|
+
const patternRecord = entry.pattern;
|
|
32725
32745
|
const { type: patternType, children, ...inlineProps } = patternRecord;
|
|
32726
32746
|
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
32727
32747
|
render({
|
|
@@ -32735,17 +32755,26 @@ function SlotBridge({ mockData }) {
|
|
|
32735
32755
|
sourceTrait: slotState.source?.trait
|
|
32736
32756
|
});
|
|
32737
32757
|
}
|
|
32738
|
-
}, [slots, render, clear
|
|
32758
|
+
}, [slots, render, clear]);
|
|
32739
32759
|
return null;
|
|
32740
32760
|
}
|
|
32741
32761
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
|
|
32742
32762
|
const slotsActions = useSlotsActions();
|
|
32743
32763
|
const bridge = useServerBridge();
|
|
32764
|
+
const entityStore = useEntityStore();
|
|
32744
32765
|
const onEventProcessed = useCallback(async (event, payload) => {
|
|
32745
32766
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
32746
32767
|
for (const name of orbitalNames) {
|
|
32747
32768
|
const { effects, meta } = await bridge.sendEvent(name, event, payload);
|
|
32748
32769
|
recordServerResponse(name, event, meta);
|
|
32770
|
+
const responseData = meta?.data;
|
|
32771
|
+
if (responseData) {
|
|
32772
|
+
for (const [entityType, records] of Object.entries(responseData)) {
|
|
32773
|
+
if (Array.isArray(records)) {
|
|
32774
|
+
entityStore.advance(entityType, records);
|
|
32775
|
+
}
|
|
32776
|
+
}
|
|
32777
|
+
}
|
|
32749
32778
|
for (const eff of effects) {
|
|
32750
32779
|
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
32751
32780
|
slotsActions.setSlotPatterns(
|
|
@@ -32758,7 +32787,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
|
|
|
32758
32787
|
}
|
|
32759
32788
|
}
|
|
32760
32789
|
}
|
|
32761
|
-
}, [bridge.connected, bridge.sendEvent, orbitalNames, slotsActions, onNavigate]);
|
|
32790
|
+
}, [bridge.connected, bridge.sendEvent, orbitalNames, slotsActions, onNavigate, entityStore]);
|
|
32762
32791
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
|
|
32763
32792
|
const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
|
|
32764
32793
|
const initSentRef = useRef(false);
|
|
@@ -32797,6 +32826,14 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate }) {
|
|
|
32797
32826
|
effects: effectTraces,
|
|
32798
32827
|
timestamp: Date.now()
|
|
32799
32828
|
});
|
|
32829
|
+
const initResponseData = meta?.data;
|
|
32830
|
+
if (initResponseData) {
|
|
32831
|
+
for (const [entityType, records] of Object.entries(initResponseData)) {
|
|
32832
|
+
if (Array.isArray(records)) {
|
|
32833
|
+
entityStore.advance(entityType, records);
|
|
32834
|
+
}
|
|
32835
|
+
}
|
|
32836
|
+
}
|
|
32800
32837
|
for (const eff of effects) {
|
|
32801
32838
|
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
32802
32839
|
slotsActions.setSlotPatterns(
|
|
@@ -32837,9 +32874,19 @@ function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate }) {
|
|
|
32837
32874
|
if (!orbitals) return [];
|
|
32838
32875
|
return orbitals.filter((o) => typeof o.name === "string").map((o) => o.name);
|
|
32839
32876
|
}, [schema]);
|
|
32877
|
+
const entityStore = useEntityStore();
|
|
32878
|
+
useEffect(() => {
|
|
32879
|
+
if (!serverUrl && mockData) {
|
|
32880
|
+
for (const [entityType, records] of Object.entries(mockData)) {
|
|
32881
|
+
if (Array.isArray(records)) {
|
|
32882
|
+
entityStore.advance(entityType, records);
|
|
32883
|
+
}
|
|
32884
|
+
}
|
|
32885
|
+
}
|
|
32886
|
+
}, [mockData, serverUrl, entityStore]);
|
|
32840
32887
|
const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsx(SlotsProvider, { children: /* @__PURE__ */ jsxs(EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
32841
32888
|
/* @__PURE__ */ jsx(TraitInitializer, { traits: allPageTraits, orbitalNames: serverUrl ? orbitalNames : void 0, onNavigate }),
|
|
32842
|
-
/* @__PURE__ */ jsx(SlotBridge, {
|
|
32889
|
+
/* @__PURE__ */ jsx(SlotBridge, {}),
|
|
32843
32890
|
/* @__PURE__ */ jsx(Box, { className: "min-h-full p-4", children: /* @__PURE__ */ jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) })
|
|
32844
32891
|
] }) }) });
|
|
32845
32892
|
if (serverUrl) {
|
|
@@ -32914,4 +32961,4 @@ function OrbPreview({
|
|
|
32914
32961
|
}
|
|
32915
32962
|
OrbPreview.displayName = "OrbPreview";
|
|
32916
32963
|
|
|
32917
|
-
export { EntitySchemaProvider, OrbPreview, ServerBridgeProvider, SlotsProvider, TraitContext, TraitProvider, clearSchemaCache, createClientEffectHandlers,
|
|
32964
|
+
export { EntitySchemaProvider, OrbPreview, ServerBridgeProvider, SlotsProvider, TraitContext, TraitProvider, clearSchemaCache, createClientEffectHandlers, useEntityDefinition, useEntitySchema, useResolvedSchema, useServerBridge, useSlotContent, useSlots, useSlotsActions, useTrait, useTraitContext, useTraitStateMachine };
|