@almadar/ui 4.13.1 → 4.14.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.
- package/dist/avl/index.cjs +1363 -1493
- package/dist/avl/index.js +271 -401
- package/dist/components/index.cjs +1069 -1063
- package/dist/components/index.js +168 -162
- package/dist/providers/index.cjs +924 -918
- package/dist/providers/index.js +168 -162
- package/dist/runtime/index.cjs +1045 -1187
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +267 -405
- package/dist/runtime/ui/slot-types.d.ts +48 -0
- package/dist/runtime/useTraitStateMachine.d.ts +20 -2
- package/package.json +1 -1
- package/dist/runtime/ui/SlotsContext.d.ts +0 -114
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React114 from 'react';
|
|
2
|
+
import React114__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
|
|
3
3
|
import { EventBusContext, useTraitScope, OrbitalProvider, TraitScopeProvider, VerificationProvider } from '@almadar/ui/providers';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
@@ -1084,121 +1084,6 @@ var init_verificationRegistry = __esm({
|
|
|
1084
1084
|
exposeOnWindow();
|
|
1085
1085
|
}
|
|
1086
1086
|
});
|
|
1087
|
-
function refId(obj) {
|
|
1088
|
-
if (obj === null || obj === void 0 || typeof obj !== "object") return null;
|
|
1089
|
-
const existing = refIds.get(obj);
|
|
1090
|
-
if (existing !== void 0) return existing;
|
|
1091
|
-
const id = nextRefId++;
|
|
1092
|
-
refIds.set(obj, id);
|
|
1093
|
-
return id;
|
|
1094
|
-
}
|
|
1095
|
-
function slotEntriesInOrder(slot) {
|
|
1096
|
-
if (!slot) return [];
|
|
1097
|
-
const out = [];
|
|
1098
|
-
for (const [sourceKey, entry] of Object.entries(slot)) {
|
|
1099
|
-
if (entry.patterns.length > 0) {
|
|
1100
|
-
out.push({ sourceKey, entry });
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
return out;
|
|
1104
|
-
}
|
|
1105
|
-
function SlotsProvider({ children }) {
|
|
1106
|
-
const [slots, setSlots] = useState({});
|
|
1107
|
-
const setSlotPatterns = useCallback((slot, patterns, source) => {
|
|
1108
|
-
const sourceKey = source?.trait ?? DEFAULT_SOURCE_KEY;
|
|
1109
|
-
const entityProp = patterns[0]?.pattern && typeof patterns[0].pattern === "object" ? patterns[0].pattern.entity : void 0;
|
|
1110
|
-
const firstPatternType = patterns[0]?.pattern && typeof patterns[0].pattern === "object" ? patterns[0].pattern.type : void 0;
|
|
1111
|
-
slotLog.debug("setSlotPatterns", {
|
|
1112
|
-
slot,
|
|
1113
|
-
sourceKey,
|
|
1114
|
-
patternCount: patterns.length,
|
|
1115
|
-
firstPatternType,
|
|
1116
|
-
entityRefId: refId(entityProp)
|
|
1117
|
-
});
|
|
1118
|
-
if (source?.trait) {
|
|
1119
|
-
xOrbitalLog.info("slot-set", {
|
|
1120
|
-
slot,
|
|
1121
|
-
sourceTrait: source.trait,
|
|
1122
|
-
patternCount: patterns.length,
|
|
1123
|
-
firstPatternType,
|
|
1124
|
-
state: source.state
|
|
1125
|
-
});
|
|
1126
|
-
}
|
|
1127
|
-
setSlots((prev) => {
|
|
1128
|
-
const prevSlot = prev[slot] ?? {};
|
|
1129
|
-
return {
|
|
1130
|
-
...prev,
|
|
1131
|
-
[slot]: {
|
|
1132
|
-
...prevSlot,
|
|
1133
|
-
[sourceKey]: { patterns, source }
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
});
|
|
1137
|
-
}, []);
|
|
1138
|
-
const clearSlot = useCallback((slot) => {
|
|
1139
|
-
setSlots((prev) => {
|
|
1140
|
-
const existing = prev[slot];
|
|
1141
|
-
if (existing && Object.keys(existing).length === 0) {
|
|
1142
|
-
return prev;
|
|
1143
|
-
}
|
|
1144
|
-
return { ...prev, [slot]: {} };
|
|
1145
|
-
});
|
|
1146
|
-
}, []);
|
|
1147
|
-
const clearSlotForSource = useCallback((slot, sourceTrait) => {
|
|
1148
|
-
xOrbitalLog.info("slot-clear-source", { slot, sourceTrait });
|
|
1149
|
-
setSlots((prev) => {
|
|
1150
|
-
const existing = prev[slot];
|
|
1151
|
-
if (!existing || !(sourceTrait in existing)) return prev;
|
|
1152
|
-
const next = { ...existing };
|
|
1153
|
-
delete next[sourceTrait];
|
|
1154
|
-
return { ...prev, [slot]: next };
|
|
1155
|
-
});
|
|
1156
|
-
}, []);
|
|
1157
|
-
const clearAllSlots = useCallback(() => {
|
|
1158
|
-
setSlots({});
|
|
1159
|
-
}, []);
|
|
1160
|
-
const actionsRef = useRef({
|
|
1161
|
-
setSlotPatterns,
|
|
1162
|
-
clearSlot,
|
|
1163
|
-
clearSlotForSource,
|
|
1164
|
-
clearAllSlots
|
|
1165
|
-
});
|
|
1166
|
-
actionsRef.current = { setSlotPatterns, clearSlot, clearSlotForSource, clearAllSlots };
|
|
1167
|
-
const [stableActions] = useState(() => ({
|
|
1168
|
-
setSlotPatterns: (...args) => actionsRef.current.setSlotPatterns(...args),
|
|
1169
|
-
clearSlot: (...args) => actionsRef.current.clearSlot(...args),
|
|
1170
|
-
clearSlotForSource: (...args) => actionsRef.current.clearSlotForSource(...args),
|
|
1171
|
-
clearAllSlots: () => actionsRef.current.clearAllSlots()
|
|
1172
|
-
}));
|
|
1173
|
-
return /* @__PURE__ */ jsx(SlotsActionsContext.Provider, { value: stableActions, children: /* @__PURE__ */ jsx(SlotsStateContext.Provider, { value: slots, children }) });
|
|
1174
|
-
}
|
|
1175
|
-
function useSlots() {
|
|
1176
|
-
return useContext(SlotsStateContext);
|
|
1177
|
-
}
|
|
1178
|
-
function useSlotContent(slotName) {
|
|
1179
|
-
const slots = useContext(SlotsStateContext);
|
|
1180
|
-
return slots[slotName] || null;
|
|
1181
|
-
}
|
|
1182
|
-
function useSlotsActions() {
|
|
1183
|
-
const actions = useContext(SlotsActionsContext);
|
|
1184
|
-
if (!actions) {
|
|
1185
|
-
throw new Error("useSlotsActions must be used within a SlotsProvider");
|
|
1186
|
-
}
|
|
1187
|
-
return actions;
|
|
1188
|
-
}
|
|
1189
|
-
var slotLog, xOrbitalLog, refIds, nextRefId, DEFAULT_SOURCE_KEY, SlotsStateContext, SlotsActionsContext;
|
|
1190
|
-
var init_SlotsContext = __esm({
|
|
1191
|
-
"runtime/ui/SlotsContext.tsx"() {
|
|
1192
|
-
init_logger();
|
|
1193
|
-
slotLog = createLogger("almadar:ui:slot-render");
|
|
1194
|
-
xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
|
|
1195
|
-
refIds = /* @__PURE__ */ new WeakMap();
|
|
1196
|
-
nextRefId = 1;
|
|
1197
|
-
DEFAULT_SOURCE_KEY = "__default__";
|
|
1198
|
-
SlotsStateContext = createContext({});
|
|
1199
|
-
SlotsActionsContext = createContext(null);
|
|
1200
|
-
}
|
|
1201
|
-
});
|
|
1202
1087
|
function cn(...inputs) {
|
|
1203
1088
|
return twMerge(clsx(inputs));
|
|
1204
1089
|
}
|
|
@@ -1314,7 +1199,7 @@ var init_Box = __esm({
|
|
|
1314
1199
|
fixed: "fixed",
|
|
1315
1200
|
sticky: "sticky"
|
|
1316
1201
|
};
|
|
1317
|
-
Box =
|
|
1202
|
+
Box = React114__default.forwardRef(
|
|
1318
1203
|
({
|
|
1319
1204
|
padding,
|
|
1320
1205
|
paddingX,
|
|
@@ -2097,7 +1982,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
2097
1982
|
const IconComp = value;
|
|
2098
1983
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
2099
1984
|
}
|
|
2100
|
-
if (
|
|
1985
|
+
if (React114__default.isValidElement(value)) {
|
|
2101
1986
|
return value;
|
|
2102
1987
|
}
|
|
2103
1988
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -2173,7 +2058,7 @@ var init_Button = __esm({
|
|
|
2173
2058
|
md: "h-4 w-4",
|
|
2174
2059
|
lg: "h-5 w-5"
|
|
2175
2060
|
};
|
|
2176
|
-
Button =
|
|
2061
|
+
Button = React114__default.forwardRef(
|
|
2177
2062
|
({
|
|
2178
2063
|
className,
|
|
2179
2064
|
variant = "primary",
|
|
@@ -2276,7 +2161,7 @@ var init_Badge = __esm({
|
|
|
2276
2161
|
md: "px-2.5 py-1 text-sm",
|
|
2277
2162
|
lg: "px-3 py-1.5 text-base"
|
|
2278
2163
|
};
|
|
2279
|
-
Badge =
|
|
2164
|
+
Badge = React114__default.forwardRef(
|
|
2280
2165
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
2281
2166
|
const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
2282
2167
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -2413,11 +2298,30 @@ var init_Toast = __esm({
|
|
|
2413
2298
|
Toast.displayName = "Toast";
|
|
2414
2299
|
}
|
|
2415
2300
|
});
|
|
2301
|
+
|
|
2302
|
+
// runtime/ui/slot-types.ts
|
|
2303
|
+
function refId(obj) {
|
|
2304
|
+
if (obj === null || obj === void 0 || typeof obj !== "object") return null;
|
|
2305
|
+
const existing = refIds.get(obj);
|
|
2306
|
+
if (existing !== void 0) return existing;
|
|
2307
|
+
const id = nextRefId++;
|
|
2308
|
+
refIds.set(obj, id);
|
|
2309
|
+
return id;
|
|
2310
|
+
}
|
|
2311
|
+
var slotLog, refIds, nextRefId;
|
|
2312
|
+
var init_slot_types = __esm({
|
|
2313
|
+
"runtime/ui/slot-types.ts"() {
|
|
2314
|
+
init_logger();
|
|
2315
|
+
slotLog = createLogger("almadar:ui:slot-render");
|
|
2316
|
+
refIds = /* @__PURE__ */ new WeakMap();
|
|
2317
|
+
nextRefId = 1;
|
|
2318
|
+
}
|
|
2319
|
+
});
|
|
2416
2320
|
var Input;
|
|
2417
2321
|
var init_Input = __esm({
|
|
2418
2322
|
"components/atoms/Input.tsx"() {
|
|
2419
2323
|
init_cn();
|
|
2420
|
-
Input =
|
|
2324
|
+
Input = React114__default.forwardRef(
|
|
2421
2325
|
({
|
|
2422
2326
|
className,
|
|
2423
2327
|
inputType,
|
|
@@ -2535,7 +2439,7 @@ var Label;
|
|
|
2535
2439
|
var init_Label = __esm({
|
|
2536
2440
|
"components/atoms/Label.tsx"() {
|
|
2537
2441
|
init_cn();
|
|
2538
|
-
Label =
|
|
2442
|
+
Label = React114__default.forwardRef(
|
|
2539
2443
|
({ className, required, children, ...props }, ref) => {
|
|
2540
2444
|
return /* @__PURE__ */ jsxs(
|
|
2541
2445
|
"label",
|
|
@@ -2561,7 +2465,7 @@ var Textarea;
|
|
|
2561
2465
|
var init_Textarea = __esm({
|
|
2562
2466
|
"components/atoms/Textarea.tsx"() {
|
|
2563
2467
|
init_cn();
|
|
2564
|
-
Textarea =
|
|
2468
|
+
Textarea = React114__default.forwardRef(
|
|
2565
2469
|
({ className, error, ...props }, ref) => {
|
|
2566
2470
|
return /* @__PURE__ */ jsx(
|
|
2567
2471
|
"textarea",
|
|
@@ -2590,7 +2494,7 @@ var Select;
|
|
|
2590
2494
|
var init_Select = __esm({
|
|
2591
2495
|
"components/atoms/Select.tsx"() {
|
|
2592
2496
|
init_cn();
|
|
2593
|
-
Select =
|
|
2497
|
+
Select = React114__default.forwardRef(
|
|
2594
2498
|
({ className, options, placeholder, error, ...props }, ref) => {
|
|
2595
2499
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2596
2500
|
/* @__PURE__ */ jsxs(
|
|
@@ -2632,7 +2536,7 @@ var Checkbox;
|
|
|
2632
2536
|
var init_Checkbox = __esm({
|
|
2633
2537
|
"components/atoms/Checkbox.tsx"() {
|
|
2634
2538
|
init_cn();
|
|
2635
|
-
Checkbox =
|
|
2539
|
+
Checkbox = React114__default.forwardRef(
|
|
2636
2540
|
({ className, label, id, ...props }, ref) => {
|
|
2637
2541
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
2638
2542
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -2714,7 +2618,7 @@ var init_Card = __esm({
|
|
|
2714
2618
|
md: "shadow",
|
|
2715
2619
|
lg: "shadow-lg"
|
|
2716
2620
|
};
|
|
2717
|
-
Card =
|
|
2621
|
+
Card = React114__default.forwardRef(
|
|
2718
2622
|
({
|
|
2719
2623
|
className,
|
|
2720
2624
|
variant = "bordered",
|
|
@@ -2750,9 +2654,9 @@ var init_Card = __esm({
|
|
|
2750
2654
|
}
|
|
2751
2655
|
);
|
|
2752
2656
|
Card.displayName = "Card";
|
|
2753
|
-
CardHeader =
|
|
2657
|
+
CardHeader = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
2754
2658
|
CardHeader.displayName = "CardHeader";
|
|
2755
|
-
CardTitle =
|
|
2659
|
+
CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2756
2660
|
"h3",
|
|
2757
2661
|
{
|
|
2758
2662
|
ref,
|
|
@@ -2765,11 +2669,11 @@ var init_Card = __esm({
|
|
|
2765
2669
|
}
|
|
2766
2670
|
));
|
|
2767
2671
|
CardTitle.displayName = "CardTitle";
|
|
2768
|
-
CardContent =
|
|
2672
|
+
CardContent = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
2769
2673
|
CardContent.displayName = "CardContent";
|
|
2770
2674
|
CardBody = CardContent;
|
|
2771
2675
|
CardBody.displayName = "CardBody";
|
|
2772
|
-
CardFooter =
|
|
2676
|
+
CardFooter = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2773
2677
|
"div",
|
|
2774
2678
|
{
|
|
2775
2679
|
ref,
|
|
@@ -2790,7 +2694,7 @@ var init_Spinner = __esm({
|
|
|
2790
2694
|
md: "h-6 w-6",
|
|
2791
2695
|
lg: "h-8 w-8"
|
|
2792
2696
|
};
|
|
2793
|
-
Spinner =
|
|
2697
|
+
Spinner = React114__default.forwardRef(
|
|
2794
2698
|
({ className, size = "md", ...props }, ref) => {
|
|
2795
2699
|
return /* @__PURE__ */ jsx(
|
|
2796
2700
|
"div",
|
|
@@ -3238,7 +3142,7 @@ var Radio;
|
|
|
3238
3142
|
var init_Radio = __esm({
|
|
3239
3143
|
"components/atoms/Radio.tsx"() {
|
|
3240
3144
|
init_cn();
|
|
3241
|
-
Radio =
|
|
3145
|
+
Radio = React114__default.forwardRef(
|
|
3242
3146
|
({
|
|
3243
3147
|
label,
|
|
3244
3148
|
helperText,
|
|
@@ -3349,7 +3253,7 @@ var init_Switch = __esm({
|
|
|
3349
3253
|
"components/atoms/Switch.tsx"() {
|
|
3350
3254
|
"use client";
|
|
3351
3255
|
init_cn();
|
|
3352
|
-
Switch =
|
|
3256
|
+
Switch = React114.forwardRef(
|
|
3353
3257
|
({
|
|
3354
3258
|
checked,
|
|
3355
3259
|
defaultChecked = false,
|
|
@@ -3360,10 +3264,10 @@ var init_Switch = __esm({
|
|
|
3360
3264
|
name,
|
|
3361
3265
|
className
|
|
3362
3266
|
}, ref) => {
|
|
3363
|
-
const [isChecked, setIsChecked] =
|
|
3267
|
+
const [isChecked, setIsChecked] = React114.useState(
|
|
3364
3268
|
checked !== void 0 ? checked : defaultChecked
|
|
3365
3269
|
);
|
|
3366
|
-
|
|
3270
|
+
React114.useEffect(() => {
|
|
3367
3271
|
if (checked !== void 0) {
|
|
3368
3272
|
setIsChecked(checked);
|
|
3369
3273
|
}
|
|
@@ -3914,8 +3818,8 @@ var init_LawReferenceTooltip = __esm({
|
|
|
3914
3818
|
position = "top",
|
|
3915
3819
|
className
|
|
3916
3820
|
}) => {
|
|
3917
|
-
const [isVisible, setIsVisible] =
|
|
3918
|
-
const timeoutRef =
|
|
3821
|
+
const [isVisible, setIsVisible] = React114__default.useState(false);
|
|
3822
|
+
const timeoutRef = React114__default.useRef(null);
|
|
3919
3823
|
const handleMouseEnter = () => {
|
|
3920
3824
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
3921
3825
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -3924,7 +3828,7 @@ var init_LawReferenceTooltip = __esm({
|
|
|
3924
3828
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
3925
3829
|
setIsVisible(false);
|
|
3926
3830
|
};
|
|
3927
|
-
|
|
3831
|
+
React114__default.useEffect(() => {
|
|
3928
3832
|
return () => {
|
|
3929
3833
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
3930
3834
|
};
|
|
@@ -4134,7 +4038,7 @@ var init_StatusDot = __esm({
|
|
|
4134
4038
|
md: "w-2.5 h-2.5",
|
|
4135
4039
|
lg: "w-3 h-3"
|
|
4136
4040
|
};
|
|
4137
|
-
StatusDot =
|
|
4041
|
+
StatusDot = React114__default.forwardRef(
|
|
4138
4042
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
4139
4043
|
return /* @__PURE__ */ jsx(
|
|
4140
4044
|
"span",
|
|
@@ -4187,7 +4091,7 @@ var init_TrendIndicator = __esm({
|
|
|
4187
4091
|
down: TrendingDown,
|
|
4188
4092
|
flat: ArrowRight
|
|
4189
4093
|
};
|
|
4190
|
-
TrendIndicator =
|
|
4094
|
+
TrendIndicator = React114__default.forwardRef(
|
|
4191
4095
|
({
|
|
4192
4096
|
className,
|
|
4193
4097
|
value,
|
|
@@ -4254,7 +4158,7 @@ var init_RangeSlider = __esm({
|
|
|
4254
4158
|
md: "w-4 h-4",
|
|
4255
4159
|
lg: "w-5 h-5"
|
|
4256
4160
|
};
|
|
4257
|
-
RangeSlider =
|
|
4161
|
+
RangeSlider = React114__default.forwardRef(
|
|
4258
4162
|
({
|
|
4259
4163
|
className,
|
|
4260
4164
|
min = 0,
|
|
@@ -4815,7 +4719,7 @@ var init_ContentSection = __esm({
|
|
|
4815
4719
|
md: "py-16",
|
|
4816
4720
|
lg: "py-24"
|
|
4817
4721
|
};
|
|
4818
|
-
ContentSection =
|
|
4722
|
+
ContentSection = React114__default.forwardRef(
|
|
4819
4723
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
4820
4724
|
return /* @__PURE__ */ jsx(
|
|
4821
4725
|
Box,
|
|
@@ -5349,7 +5253,7 @@ var init_AnimatedReveal = __esm({
|
|
|
5349
5253
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
5350
5254
|
"none": {}
|
|
5351
5255
|
};
|
|
5352
|
-
AnimatedReveal =
|
|
5256
|
+
AnimatedReveal = React114__default.forwardRef(
|
|
5353
5257
|
({
|
|
5354
5258
|
trigger = "scroll",
|
|
5355
5259
|
animation = "fade-up",
|
|
@@ -5509,7 +5413,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
5509
5413
|
"components/atoms/AnimatedGraphic.tsx"() {
|
|
5510
5414
|
"use client";
|
|
5511
5415
|
init_cn();
|
|
5512
|
-
AnimatedGraphic =
|
|
5416
|
+
AnimatedGraphic = React114__default.forwardRef(
|
|
5513
5417
|
({
|
|
5514
5418
|
src,
|
|
5515
5419
|
svgContent,
|
|
@@ -5532,7 +5436,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
5532
5436
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
5533
5437
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
5534
5438
|
const prevAnimateRef = useRef(animate);
|
|
5535
|
-
const setRef =
|
|
5439
|
+
const setRef = React114__default.useCallback(
|
|
5536
5440
|
(node) => {
|
|
5537
5441
|
containerRef.current = node;
|
|
5538
5442
|
if (typeof ref === "function") ref(node);
|
|
@@ -5640,11 +5544,13 @@ function TraitFrame({
|
|
|
5640
5544
|
fallback = null
|
|
5641
5545
|
}) {
|
|
5642
5546
|
const content = useTraitContent(traitName);
|
|
5547
|
+
const entitySchema = useEntitySchemaOptional();
|
|
5548
|
+
const orbital = entitySchema?.orbitalsByTrait.get(traitName);
|
|
5643
5549
|
if (!content) {
|
|
5644
5550
|
return /* @__PURE__ */ jsx(Fragment, { children: fallback });
|
|
5645
5551
|
}
|
|
5646
5552
|
const SlotContentRenderer2 = getSlotContentRenderer();
|
|
5647
|
-
|
|
5553
|
+
const rendered = /* @__PURE__ */ jsx(
|
|
5648
5554
|
SlotContentRenderer2,
|
|
5649
5555
|
{
|
|
5650
5556
|
content,
|
|
@@ -5652,6 +5558,10 @@ function TraitFrame({
|
|
|
5652
5558
|
}
|
|
5653
5559
|
}
|
|
5654
5560
|
);
|
|
5561
|
+
if (!orbital) {
|
|
5562
|
+
return rendered;
|
|
5563
|
+
}
|
|
5564
|
+
return /* @__PURE__ */ jsx(TraitScopeProvider, { orbital, trait: traitName, children: rendered });
|
|
5655
5565
|
}
|
|
5656
5566
|
function getSlotContentRenderer() {
|
|
5657
5567
|
if (_slotContentRenderer) return _slotContentRenderer;
|
|
@@ -5662,6 +5572,7 @@ function getSlotContentRenderer() {
|
|
|
5662
5572
|
var _slotContentRenderer;
|
|
5663
5573
|
var init_TraitFrame = __esm({
|
|
5664
5574
|
"components/atoms/TraitFrame.tsx"() {
|
|
5575
|
+
init_EntitySchemaContext();
|
|
5665
5576
|
TraitFrame.displayName = "TraitFrame";
|
|
5666
5577
|
_slotContentRenderer = null;
|
|
5667
5578
|
}
|
|
@@ -5750,9 +5661,9 @@ function ScoreDisplay({
|
|
|
5750
5661
|
...rest
|
|
5751
5662
|
}) {
|
|
5752
5663
|
const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
|
|
5753
|
-
const [displayValue, setDisplayValue] =
|
|
5754
|
-
const [isAnimating, setIsAnimating] =
|
|
5755
|
-
|
|
5664
|
+
const [displayValue, setDisplayValue] = React114.useState(resolvedValue);
|
|
5665
|
+
const [isAnimating, setIsAnimating] = React114.useState(false);
|
|
5666
|
+
React114.useEffect(() => {
|
|
5756
5667
|
if (!animated || displayValue === resolvedValue) {
|
|
5757
5668
|
setDisplayValue(resolvedValue);
|
|
5758
5669
|
return;
|
|
@@ -5822,9 +5733,9 @@ function ControlButton({
|
|
|
5822
5733
|
className
|
|
5823
5734
|
}) {
|
|
5824
5735
|
const eventBus = useEventBus();
|
|
5825
|
-
const [isPressed, setIsPressed] =
|
|
5736
|
+
const [isPressed, setIsPressed] = React114.useState(false);
|
|
5826
5737
|
const actualPressed = pressed ?? isPressed;
|
|
5827
|
-
const handlePointerDown =
|
|
5738
|
+
const handlePointerDown = React114.useCallback(
|
|
5828
5739
|
(e) => {
|
|
5829
5740
|
e.preventDefault();
|
|
5830
5741
|
if (disabled) return;
|
|
@@ -5834,7 +5745,7 @@ function ControlButton({
|
|
|
5834
5745
|
},
|
|
5835
5746
|
[disabled, pressEvent, eventBus, onPress]
|
|
5836
5747
|
);
|
|
5837
|
-
const handlePointerUp =
|
|
5748
|
+
const handlePointerUp = React114.useCallback(
|
|
5838
5749
|
(e) => {
|
|
5839
5750
|
e.preventDefault();
|
|
5840
5751
|
if (disabled) return;
|
|
@@ -5844,7 +5755,7 @@ function ControlButton({
|
|
|
5844
5755
|
},
|
|
5845
5756
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
5846
5757
|
);
|
|
5847
|
-
const handlePointerLeave =
|
|
5758
|
+
const handlePointerLeave = React114.useCallback(
|
|
5848
5759
|
(e) => {
|
|
5849
5760
|
if (isPressed) {
|
|
5850
5761
|
setIsPressed(false);
|
|
@@ -6742,9 +6653,9 @@ function MiniMap({
|
|
|
6742
6653
|
viewportRect,
|
|
6743
6654
|
className
|
|
6744
6655
|
}) {
|
|
6745
|
-
const canvasRef =
|
|
6746
|
-
const frameRef =
|
|
6747
|
-
|
|
6656
|
+
const canvasRef = React114.useRef(null);
|
|
6657
|
+
const frameRef = React114.useRef(0);
|
|
6658
|
+
React114.useEffect(() => {
|
|
6748
6659
|
const canvas = canvasRef.current;
|
|
6749
6660
|
if (!canvas) return;
|
|
6750
6661
|
const ctx = canvas.getContext("2d");
|
|
@@ -6952,7 +6863,7 @@ var init_ErrorBoundary = __esm({
|
|
|
6952
6863
|
"use client";
|
|
6953
6864
|
init_cn();
|
|
6954
6865
|
init_ErrorState();
|
|
6955
|
-
ErrorBoundary = class extends
|
|
6866
|
+
ErrorBoundary = class extends React114__default.Component {
|
|
6956
6867
|
constructor(props) {
|
|
6957
6868
|
super(props);
|
|
6958
6869
|
__publicField(this, "reset", () => {
|
|
@@ -7425,8 +7336,8 @@ var init_Tooltip = __esm({
|
|
|
7425
7336
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
7426
7337
|
};
|
|
7427
7338
|
}, []);
|
|
7428
|
-
const triggerElement =
|
|
7429
|
-
const trigger =
|
|
7339
|
+
const triggerElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
7340
|
+
const trigger = React114__default.cloneElement(triggerElement, {
|
|
7430
7341
|
ref: triggerRef,
|
|
7431
7342
|
onMouseEnter: handleMouseEnter,
|
|
7432
7343
|
onMouseLeave: handleMouseLeave,
|
|
@@ -7547,8 +7458,8 @@ var init_Popover = __esm({
|
|
|
7547
7458
|
onMouseEnter: handleOpen,
|
|
7548
7459
|
onMouseLeave: handleClose
|
|
7549
7460
|
};
|
|
7550
|
-
const childElement =
|
|
7551
|
-
const triggerElement =
|
|
7461
|
+
const childElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
7462
|
+
const triggerElement = React114__default.cloneElement(
|
|
7552
7463
|
childElement,
|
|
7553
7464
|
{
|
|
7554
7465
|
ref: triggerRef,
|
|
@@ -7665,8 +7576,8 @@ var init_Menu = __esm({
|
|
|
7665
7576
|
"bottom-start": "top-full left-0 mt-2",
|
|
7666
7577
|
"bottom-end": "top-full right-0 mt-2"
|
|
7667
7578
|
};
|
|
7668
|
-
const triggerChild =
|
|
7669
|
-
const triggerElement =
|
|
7579
|
+
const triggerChild = React114__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
|
|
7580
|
+
const triggerElement = React114__default.cloneElement(
|
|
7670
7581
|
triggerChild,
|
|
7671
7582
|
{
|
|
7672
7583
|
ref: triggerRef,
|
|
@@ -8185,12 +8096,12 @@ var init_MapView = __esm({
|
|
|
8185
8096
|
shadowSize: [41, 41]
|
|
8186
8097
|
});
|
|
8187
8098
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
8188
|
-
const { useEffect: useEffect70, useRef:
|
|
8099
|
+
const { useEffect: useEffect70, useRef: useRef64, useCallback: useCallback109, useState: useState102 } = React114__default;
|
|
8189
8100
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
8190
8101
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
8191
8102
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
8192
8103
|
const map = useMap();
|
|
8193
|
-
const prevRef =
|
|
8104
|
+
const prevRef = useRef64({ centerLat, centerLng, zoom });
|
|
8194
8105
|
useEffect70(() => {
|
|
8195
8106
|
const prev = prevRef.current;
|
|
8196
8107
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
@@ -8229,8 +8140,8 @@ var init_MapView = __esm({
|
|
|
8229
8140
|
showAttribution = true
|
|
8230
8141
|
}) {
|
|
8231
8142
|
const eventBus = useEventBus2();
|
|
8232
|
-
const [clickedPosition, setClickedPosition] =
|
|
8233
|
-
const handleMapClick =
|
|
8143
|
+
const [clickedPosition, setClickedPosition] = useState102(null);
|
|
8144
|
+
const handleMapClick = useCallback109((lat, lng) => {
|
|
8234
8145
|
if (showClickedPin) {
|
|
8235
8146
|
setClickedPosition({ lat, lng });
|
|
8236
8147
|
}
|
|
@@ -8239,7 +8150,7 @@ var init_MapView = __esm({
|
|
|
8239
8150
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
8240
8151
|
}
|
|
8241
8152
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
8242
|
-
const handleMarkerClick =
|
|
8153
|
+
const handleMarkerClick = useCallback109((marker) => {
|
|
8243
8154
|
onMarkerClick?.(marker);
|
|
8244
8155
|
if (markerClickEvent) {
|
|
8245
8156
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -8416,7 +8327,7 @@ function InputPattern({
|
|
|
8416
8327
|
fieldName
|
|
8417
8328
|
}) {
|
|
8418
8329
|
const { emit } = useEventBus();
|
|
8419
|
-
const [localValue, setLocalValue] =
|
|
8330
|
+
const [localValue, setLocalValue] = React114__default.useState(value);
|
|
8420
8331
|
const handleChange = (e) => {
|
|
8421
8332
|
setLocalValue(e.target.value);
|
|
8422
8333
|
if (onChange) {
|
|
@@ -8454,7 +8365,7 @@ function TextareaPattern({
|
|
|
8454
8365
|
fieldName
|
|
8455
8366
|
}) {
|
|
8456
8367
|
const { emit } = useEventBus();
|
|
8457
|
-
const [localValue, setLocalValue] =
|
|
8368
|
+
const [localValue, setLocalValue] = React114__default.useState(value);
|
|
8458
8369
|
const handleChange = (e) => {
|
|
8459
8370
|
setLocalValue(e.target.value);
|
|
8460
8371
|
if (onChange) {
|
|
@@ -8486,7 +8397,7 @@ function SelectPattern({
|
|
|
8486
8397
|
fieldName
|
|
8487
8398
|
}) {
|
|
8488
8399
|
const { emit } = useEventBus();
|
|
8489
|
-
const [localValue, setLocalValue] =
|
|
8400
|
+
const [localValue, setLocalValue] = React114__default.useState(value);
|
|
8490
8401
|
const handleChange = (e) => {
|
|
8491
8402
|
setLocalValue(e.target.value);
|
|
8492
8403
|
if (onChange) {
|
|
@@ -8515,7 +8426,7 @@ function CheckboxPattern({
|
|
|
8515
8426
|
className
|
|
8516
8427
|
}) {
|
|
8517
8428
|
const { emit } = useEventBus();
|
|
8518
|
-
const [localChecked, setLocalChecked] =
|
|
8429
|
+
const [localChecked, setLocalChecked] = React114__default.useState(checked);
|
|
8519
8430
|
const handleChange = (e) => {
|
|
8520
8431
|
setLocalChecked(e.target.checked);
|
|
8521
8432
|
if (onChange) {
|
|
@@ -8746,8 +8657,8 @@ function ActionButtons({
|
|
|
8746
8657
|
disabled
|
|
8747
8658
|
}) {
|
|
8748
8659
|
const eventBus = useEventBus();
|
|
8749
|
-
const [activeButtons, setActiveButtons] =
|
|
8750
|
-
const handlePress =
|
|
8660
|
+
const [activeButtons, setActiveButtons] = React114.useState(/* @__PURE__ */ new Set());
|
|
8661
|
+
const handlePress = React114.useCallback(
|
|
8751
8662
|
(id) => {
|
|
8752
8663
|
setActiveButtons((prev) => new Set(prev).add(id));
|
|
8753
8664
|
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
@@ -8755,7 +8666,7 @@ function ActionButtons({
|
|
|
8755
8666
|
},
|
|
8756
8667
|
[actionEvent, eventBus, onAction]
|
|
8757
8668
|
);
|
|
8758
|
-
const handleRelease =
|
|
8669
|
+
const handleRelease = React114.useCallback(
|
|
8759
8670
|
(id) => {
|
|
8760
8671
|
setActiveButtons((prev) => {
|
|
8761
8672
|
const next = new Set(prev);
|
|
@@ -10559,7 +10470,7 @@ var init_MarkdownContent = __esm({
|
|
|
10559
10470
|
init_Box();
|
|
10560
10471
|
init_useTranslate();
|
|
10561
10472
|
init_cn();
|
|
10562
|
-
MarkdownContent =
|
|
10473
|
+
MarkdownContent = React114__default.memo(
|
|
10563
10474
|
({ content, direction, className }) => {
|
|
10564
10475
|
const { t: _t } = useTranslate();
|
|
10565
10476
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -10776,7 +10687,7 @@ var init_CodeBlock = __esm({
|
|
|
10776
10687
|
loloStyle = { ...dark, ...loloStyleOverrides };
|
|
10777
10688
|
LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
10778
10689
|
HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
10779
|
-
CodeBlock =
|
|
10690
|
+
CodeBlock = React114__default.memo(
|
|
10780
10691
|
({
|
|
10781
10692
|
code: rawCode,
|
|
10782
10693
|
language = "text",
|
|
@@ -12035,7 +11946,7 @@ var init_StateMachineView = __esm({
|
|
|
12035
11946
|
style: { top: title ? 30 : 0 },
|
|
12036
11947
|
children: [
|
|
12037
11948
|
entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
|
|
12038
|
-
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(
|
|
11949
|
+
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React114__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
|
|
12039
11950
|
StateNode,
|
|
12040
11951
|
{
|
|
12041
11952
|
state,
|
|
@@ -17751,7 +17662,7 @@ function CraftingRecipe({
|
|
|
17751
17662
|
className
|
|
17752
17663
|
}) {
|
|
17753
17664
|
const eventBus = useEventBus();
|
|
17754
|
-
const handleCraft =
|
|
17665
|
+
const handleCraft = React114.useCallback(() => {
|
|
17755
17666
|
onCraft?.();
|
|
17756
17667
|
if (craftEvent) {
|
|
17757
17668
|
eventBus.emit(craftEvent, { output: output.label });
|
|
@@ -17768,7 +17679,7 @@ function CraftingRecipe({
|
|
|
17768
17679
|
children: [
|
|
17769
17680
|
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
|
|
17770
17681
|
const hasSufficient = ingredient.available >= ingredient.required;
|
|
17771
|
-
return /* @__PURE__ */ jsxs(
|
|
17682
|
+
return /* @__PURE__ */ jsxs(React114.Fragment, { children: [
|
|
17772
17683
|
/* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
|
|
17773
17684
|
ItemSlot,
|
|
17774
17685
|
{
|
|
@@ -18062,8 +17973,8 @@ function DPad({
|
|
|
18062
17973
|
}) {
|
|
18063
17974
|
const eventBus = useEventBus();
|
|
18064
17975
|
const sizes = sizeMap15[size];
|
|
18065
|
-
const [activeDirections, setActiveDirections] =
|
|
18066
|
-
const handlePress =
|
|
17976
|
+
const [activeDirections, setActiveDirections] = React114.useState(/* @__PURE__ */ new Set());
|
|
17977
|
+
const handlePress = React114.useCallback(
|
|
18067
17978
|
(direction) => {
|
|
18068
17979
|
setActiveDirections((prev) => new Set(prev).add(direction));
|
|
18069
17980
|
if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
|
|
@@ -18071,7 +17982,7 @@ function DPad({
|
|
|
18071
17982
|
},
|
|
18072
17983
|
[directionEvent, eventBus, onDirection]
|
|
18073
17984
|
);
|
|
18074
|
-
const handleRelease =
|
|
17985
|
+
const handleRelease = React114.useCallback(
|
|
18075
17986
|
(direction) => {
|
|
18076
17987
|
setActiveDirections((prev) => {
|
|
18077
17988
|
const next = new Set(prev);
|
|
@@ -18957,7 +18868,7 @@ function DataList({
|
|
|
18957
18868
|
}) {
|
|
18958
18869
|
const eventBus = useEventBus();
|
|
18959
18870
|
const { t } = useTranslate();
|
|
18960
|
-
const [visibleCount, setVisibleCount] =
|
|
18871
|
+
const [visibleCount, setVisibleCount] = React114__default.useState(pageSize || Infinity);
|
|
18961
18872
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18962
18873
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18963
18874
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18997,7 +18908,7 @@ function DataList({
|
|
|
18997
18908
|
const items2 = data.map((item) => item);
|
|
18998
18909
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
18999
18910
|
const contentField = titleField?.name ?? fields[0]?.name ?? "";
|
|
19000
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
18911
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
19001
18912
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
19002
18913
|
group.items.map((itemData, index) => {
|
|
19003
18914
|
const id = itemData.id || `${gi}-${index}`;
|
|
@@ -19044,7 +18955,7 @@ function DataList({
|
|
|
19044
18955
|
] }, gi)) });
|
|
19045
18956
|
}
|
|
19046
18957
|
const hasRenderProp = typeof children === "function";
|
|
19047
|
-
|
|
18958
|
+
React114__default.useEffect(() => {
|
|
19048
18959
|
const renderItemTypeOf = typeof schemaRenderItem;
|
|
19049
18960
|
const childrenTypeOf = typeof children;
|
|
19050
18961
|
if (data.length > 0 && !hasRenderProp) {
|
|
@@ -19209,7 +19120,7 @@ function DataList({
|
|
|
19209
19120
|
className
|
|
19210
19121
|
),
|
|
19211
19122
|
children: [
|
|
19212
|
-
groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
19123
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
19213
19124
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
19214
19125
|
group.items.map(
|
|
19215
19126
|
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
@@ -20421,7 +20332,7 @@ var init_WizardProgress = __esm({
|
|
|
20421
20332
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
|
|
20422
20333
|
const isActive = index === currentStep;
|
|
20423
20334
|
const isCompleted = index < currentStep;
|
|
20424
|
-
return /* @__PURE__ */ jsxs(
|
|
20335
|
+
return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
20425
20336
|
/* @__PURE__ */ jsx(
|
|
20426
20337
|
"button",
|
|
20427
20338
|
{
|
|
@@ -21332,7 +21243,7 @@ function InventoryGrid({
|
|
|
21332
21243
|
const eventBus = useEventBus();
|
|
21333
21244
|
const slotCount = totalSlots ?? items.length;
|
|
21334
21245
|
const emptySlotCount = Math.max(0, slotCount - items.length);
|
|
21335
|
-
const handleSelect =
|
|
21246
|
+
const handleSelect = React114.useCallback(
|
|
21336
21247
|
(id) => {
|
|
21337
21248
|
onSelect?.(id);
|
|
21338
21249
|
if (selectEvent) {
|
|
@@ -21545,15 +21456,15 @@ function GameCanvas2D({
|
|
|
21545
21456
|
fps = 60,
|
|
21546
21457
|
className
|
|
21547
21458
|
}) {
|
|
21548
|
-
const canvasRef =
|
|
21549
|
-
const rafRef =
|
|
21550
|
-
const frameRef =
|
|
21551
|
-
const lastTimeRef =
|
|
21552
|
-
const onDrawRef =
|
|
21459
|
+
const canvasRef = React114.useRef(null);
|
|
21460
|
+
const rafRef = React114.useRef(0);
|
|
21461
|
+
const frameRef = React114.useRef(0);
|
|
21462
|
+
const lastTimeRef = React114.useRef(0);
|
|
21463
|
+
const onDrawRef = React114.useRef(onDraw);
|
|
21553
21464
|
onDrawRef.current = onDraw;
|
|
21554
|
-
const onTickRef =
|
|
21465
|
+
const onTickRef = React114.useRef(onTick);
|
|
21555
21466
|
onTickRef.current = onTick;
|
|
21556
|
-
|
|
21467
|
+
React114.useEffect(() => {
|
|
21557
21468
|
const canvas = canvasRef.current;
|
|
21558
21469
|
if (!canvas) return;
|
|
21559
21470
|
const ctx = canvas.getContext("2d");
|
|
@@ -21842,7 +21753,7 @@ function TurnPanel({
|
|
|
21842
21753
|
className
|
|
21843
21754
|
}) {
|
|
21844
21755
|
const eventBus = useEventBus();
|
|
21845
|
-
const handleAction =
|
|
21756
|
+
const handleAction = React114.useCallback(
|
|
21846
21757
|
(event) => {
|
|
21847
21758
|
if (event) {
|
|
21848
21759
|
eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
|
|
@@ -21988,7 +21899,7 @@ function UnitCommandBar({
|
|
|
21988
21899
|
className
|
|
21989
21900
|
}) {
|
|
21990
21901
|
const eventBus = useEventBus();
|
|
21991
|
-
const handleCommand =
|
|
21902
|
+
const handleCommand = React114.useCallback(
|
|
21992
21903
|
(event) => {
|
|
21993
21904
|
if (event) {
|
|
21994
21905
|
eventBus.emit(event, { unitId: selectedUnitId });
|
|
@@ -22473,7 +22384,7 @@ function GameMenu({
|
|
|
22473
22384
|
} catch {
|
|
22474
22385
|
}
|
|
22475
22386
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
22476
|
-
const handleOptionClick =
|
|
22387
|
+
const handleOptionClick = React114.useCallback(
|
|
22477
22388
|
(option) => {
|
|
22478
22389
|
if (option.event && eventBus) {
|
|
22479
22390
|
eventBus.emit(`UI:${option.event}`, { option });
|
|
@@ -22587,7 +22498,7 @@ function GameOverScreen({
|
|
|
22587
22498
|
} catch {
|
|
22588
22499
|
}
|
|
22589
22500
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
22590
|
-
const handleActionClick =
|
|
22501
|
+
const handleActionClick = React114.useCallback(
|
|
22591
22502
|
(action) => {
|
|
22592
22503
|
if (action.event && eventBus) {
|
|
22593
22504
|
eventBus.emit(`UI:${action.event}`, { action });
|
|
@@ -25553,7 +25464,7 @@ var init_StepFlow = __esm({
|
|
|
25553
25464
|
className
|
|
25554
25465
|
}) => {
|
|
25555
25466
|
if (orientation === "vertical") {
|
|
25556
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
25467
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React114__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
25557
25468
|
/* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
|
|
25558
25469
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
25559
25470
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
|
|
@@ -25564,7 +25475,7 @@ var init_StepFlow = __esm({
|
|
|
25564
25475
|
] })
|
|
25565
25476
|
] }) }, index)) });
|
|
25566
25477
|
}
|
|
25567
|
-
return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(
|
|
25478
|
+
return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
25568
25479
|
/* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
25569
25480
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
25570
25481
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -27678,7 +27589,7 @@ var init_DocumentViewer = __esm({
|
|
|
27678
27589
|
}
|
|
27679
27590
|
});
|
|
27680
27591
|
function extractTitle(children) {
|
|
27681
|
-
if (!
|
|
27592
|
+
if (!React114__default.isValidElement(children)) return void 0;
|
|
27682
27593
|
const props = children.props;
|
|
27683
27594
|
if (typeof props.title === "string") {
|
|
27684
27595
|
return props.title;
|
|
@@ -27733,7 +27644,7 @@ function LinearView({
|
|
|
27733
27644
|
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
|
|
27734
27645
|
const isDone = i < currentIdx;
|
|
27735
27646
|
const isCurrent = i === currentIdx;
|
|
27736
|
-
return /* @__PURE__ */ jsxs(
|
|
27647
|
+
return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
27737
27648
|
i > 0 && /* @__PURE__ */ jsx(
|
|
27738
27649
|
Typography,
|
|
27739
27650
|
{
|
|
@@ -28517,12 +28428,12 @@ var init_Form = __esm({
|
|
|
28517
28428
|
const isSchemaEntity = isOrbitalEntitySchema(entity);
|
|
28518
28429
|
const resolvedEntity = isSchemaEntity ? entity : void 0;
|
|
28519
28430
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
28520
|
-
const normalizedInitialData =
|
|
28431
|
+
const normalizedInitialData = React114__default.useMemo(() => {
|
|
28521
28432
|
const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
|
|
28522
28433
|
const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
|
|
28523
28434
|
return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
|
|
28524
28435
|
}, [entity, initialData]);
|
|
28525
|
-
const entityDerivedFields =
|
|
28436
|
+
const entityDerivedFields = React114__default.useMemo(() => {
|
|
28526
28437
|
if (fields && fields.length > 0) return void 0;
|
|
28527
28438
|
if (!resolvedEntity) return void 0;
|
|
28528
28439
|
return resolvedEntity.fields.map(
|
|
@@ -28541,14 +28452,14 @@ var init_Form = __esm({
|
|
|
28541
28452
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
28542
28453
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
28543
28454
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
28544
|
-
const [formData, setFormData] =
|
|
28455
|
+
const [formData, setFormData] = React114__default.useState(
|
|
28545
28456
|
normalizedInitialData
|
|
28546
28457
|
);
|
|
28547
|
-
const [collapsedSections, setCollapsedSections] =
|
|
28458
|
+
const [collapsedSections, setCollapsedSections] = React114__default.useState(
|
|
28548
28459
|
/* @__PURE__ */ new Set()
|
|
28549
28460
|
);
|
|
28550
28461
|
const formMode = props.mode;
|
|
28551
|
-
const mountedRef =
|
|
28462
|
+
const mountedRef = React114__default.useRef(false);
|
|
28552
28463
|
if (!mountedRef.current) {
|
|
28553
28464
|
mountedRef.current = true;
|
|
28554
28465
|
debug("forms", "mount", {
|
|
@@ -28561,7 +28472,7 @@ var init_Form = __esm({
|
|
|
28561
28472
|
});
|
|
28562
28473
|
}
|
|
28563
28474
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
28564
|
-
const evalContext =
|
|
28475
|
+
const evalContext = React114__default.useMemo(
|
|
28565
28476
|
() => ({
|
|
28566
28477
|
formValues: formData,
|
|
28567
28478
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -28570,7 +28481,7 @@ var init_Form = __esm({
|
|
|
28570
28481
|
}),
|
|
28571
28482
|
[formData, externalContext]
|
|
28572
28483
|
);
|
|
28573
|
-
|
|
28484
|
+
React114__default.useEffect(() => {
|
|
28574
28485
|
debug("forms", "initialData-sync", {
|
|
28575
28486
|
mode: formMode,
|
|
28576
28487
|
normalizedInitialData,
|
|
@@ -28581,7 +28492,7 @@ var init_Form = __esm({
|
|
|
28581
28492
|
setFormData(normalizedInitialData);
|
|
28582
28493
|
}
|
|
28583
28494
|
}, [normalizedInitialData]);
|
|
28584
|
-
const processCalculations =
|
|
28495
|
+
const processCalculations = React114__default.useCallback(
|
|
28585
28496
|
(changedFieldId, newFormData) => {
|
|
28586
28497
|
if (!hiddenCalculations.length) return;
|
|
28587
28498
|
const context = {
|
|
@@ -28606,7 +28517,7 @@ var init_Form = __esm({
|
|
|
28606
28517
|
},
|
|
28607
28518
|
[hiddenCalculations, externalContext, eventBus]
|
|
28608
28519
|
);
|
|
28609
|
-
const checkViolations =
|
|
28520
|
+
const checkViolations = React114__default.useCallback(
|
|
28610
28521
|
(changedFieldId, newFormData) => {
|
|
28611
28522
|
if (!violationTriggers.length) return;
|
|
28612
28523
|
const context = {
|
|
@@ -28644,7 +28555,7 @@ var init_Form = __esm({
|
|
|
28644
28555
|
processCalculations(name, newFormData);
|
|
28645
28556
|
checkViolations(name, newFormData);
|
|
28646
28557
|
};
|
|
28647
|
-
const isFieldVisible =
|
|
28558
|
+
const isFieldVisible = React114__default.useCallback(
|
|
28648
28559
|
(fieldName) => {
|
|
28649
28560
|
const condition = conditionalFields[fieldName];
|
|
28650
28561
|
if (!condition) return true;
|
|
@@ -28652,7 +28563,7 @@ var init_Form = __esm({
|
|
|
28652
28563
|
},
|
|
28653
28564
|
[conditionalFields, evalContext]
|
|
28654
28565
|
);
|
|
28655
|
-
const isSectionVisible =
|
|
28566
|
+
const isSectionVisible = React114__default.useCallback(
|
|
28656
28567
|
(section) => {
|
|
28657
28568
|
if (!section.condition) return true;
|
|
28658
28569
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -28696,7 +28607,7 @@ var init_Form = __esm({
|
|
|
28696
28607
|
eventBus.emit(`UI:${onCancel}`);
|
|
28697
28608
|
}
|
|
28698
28609
|
};
|
|
28699
|
-
const renderField =
|
|
28610
|
+
const renderField = React114__default.useCallback(
|
|
28700
28611
|
(field) => {
|
|
28701
28612
|
const fieldName = field.name || field.field;
|
|
28702
28613
|
if (!fieldName) return null;
|
|
@@ -28717,7 +28628,7 @@ var init_Form = __esm({
|
|
|
28717
28628
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
28718
28629
|
);
|
|
28719
28630
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
28720
|
-
const normalizedFields =
|
|
28631
|
+
const normalizedFields = React114__default.useMemo(() => {
|
|
28721
28632
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
28722
28633
|
return effectiveFields.map((field) => {
|
|
28723
28634
|
if (typeof field === "string") {
|
|
@@ -28739,7 +28650,7 @@ var init_Form = __esm({
|
|
|
28739
28650
|
return field;
|
|
28740
28651
|
});
|
|
28741
28652
|
}, [effectiveFields, resolvedEntity]);
|
|
28742
|
-
const schemaFields =
|
|
28653
|
+
const schemaFields = React114__default.useMemo(() => {
|
|
28743
28654
|
if (normalizedFields.length === 0) return null;
|
|
28744
28655
|
if (isDebugEnabled()) {
|
|
28745
28656
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -28749,7 +28660,7 @@ var init_Form = __esm({
|
|
|
28749
28660
|
}
|
|
28750
28661
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
28751
28662
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
28752
|
-
const sectionElements =
|
|
28663
|
+
const sectionElements = React114__default.useMemo(() => {
|
|
28753
28664
|
if (!sections || sections.length === 0) return null;
|
|
28754
28665
|
return sections.map((section) => {
|
|
28755
28666
|
if (!isSectionVisible(section)) {
|
|
@@ -30273,7 +30184,7 @@ var init_List = __esm({
|
|
|
30273
30184
|
if (entity && typeof entity === "object" && "id" in entity) return [entity];
|
|
30274
30185
|
return [];
|
|
30275
30186
|
}, [entity]);
|
|
30276
|
-
const getItemActions =
|
|
30187
|
+
const getItemActions = React114__default.useCallback(
|
|
30277
30188
|
(item) => {
|
|
30278
30189
|
if (!itemActions) return [];
|
|
30279
30190
|
if (typeof itemActions === "function") {
|
|
@@ -30710,7 +30621,7 @@ var init_MediaGallery = __esm({
|
|
|
30710
30621
|
[selectable, selectedItems, selectionEvent, eventBus]
|
|
30711
30622
|
);
|
|
30712
30623
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
30713
|
-
const items =
|
|
30624
|
+
const items = React114__default.useMemo(() => {
|
|
30714
30625
|
if (propItems) return propItems;
|
|
30715
30626
|
if (entityData.length === 0) return [];
|
|
30716
30627
|
return entityData.map((record, idx) => ({
|
|
@@ -30874,7 +30785,7 @@ var init_MediaGallery = __esm({
|
|
|
30874
30785
|
}
|
|
30875
30786
|
});
|
|
30876
30787
|
function extractTitle2(children) {
|
|
30877
|
-
if (!
|
|
30788
|
+
if (!React114__default.isValidElement(children)) return void 0;
|
|
30878
30789
|
const props = children.props;
|
|
30879
30790
|
if (typeof props.title === "string") {
|
|
30880
30791
|
return props.title;
|
|
@@ -31587,7 +31498,7 @@ var init_PageHeader = __esm({
|
|
|
31587
31498
|
info: "bg-info/10 text-info"
|
|
31588
31499
|
};
|
|
31589
31500
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
31590
|
-
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(
|
|
31501
|
+
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(React114__default.Fragment, { children: [
|
|
31591
31502
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
31592
31503
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
31593
31504
|
"a",
|
|
@@ -31745,7 +31656,7 @@ var init_debugRegistry = __esm({
|
|
|
31745
31656
|
}
|
|
31746
31657
|
});
|
|
31747
31658
|
function useDebugData() {
|
|
31748
|
-
const [data, setData] =
|
|
31659
|
+
const [data, setData] = React114.useState(() => ({
|
|
31749
31660
|
traits: [],
|
|
31750
31661
|
ticks: [],
|
|
31751
31662
|
guards: [],
|
|
@@ -31759,7 +31670,7 @@ function useDebugData() {
|
|
|
31759
31670
|
},
|
|
31760
31671
|
lastUpdate: Date.now()
|
|
31761
31672
|
}));
|
|
31762
|
-
|
|
31673
|
+
React114.useEffect(() => {
|
|
31763
31674
|
const updateData = () => {
|
|
31764
31675
|
setData({
|
|
31765
31676
|
traits: getAllTraits(),
|
|
@@ -31868,12 +31779,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
|
|
|
31868
31779
|
return positions;
|
|
31869
31780
|
}
|
|
31870
31781
|
function WalkMinimap() {
|
|
31871
|
-
const [walkStep, setWalkStep] =
|
|
31872
|
-
const [traits2, setTraits] =
|
|
31873
|
-
const [coveredEdges, setCoveredEdges] =
|
|
31874
|
-
const [completedTraits, setCompletedTraits] =
|
|
31875
|
-
const prevTraitRef =
|
|
31876
|
-
|
|
31782
|
+
const [walkStep, setWalkStep] = React114.useState(null);
|
|
31783
|
+
const [traits2, setTraits] = React114.useState([]);
|
|
31784
|
+
const [coveredEdges, setCoveredEdges] = React114.useState([]);
|
|
31785
|
+
const [completedTraits, setCompletedTraits] = React114.useState(/* @__PURE__ */ new Set());
|
|
31786
|
+
const prevTraitRef = React114.useRef(null);
|
|
31787
|
+
React114.useEffect(() => {
|
|
31877
31788
|
const interval = setInterval(() => {
|
|
31878
31789
|
const w = window;
|
|
31879
31790
|
const step = w.__orbitalWalkStep;
|
|
@@ -32320,15 +32231,15 @@ var init_EntitiesTab = __esm({
|
|
|
32320
32231
|
}
|
|
32321
32232
|
});
|
|
32322
32233
|
function EventFlowTab({ events: events2 }) {
|
|
32323
|
-
const [filter, setFilter] =
|
|
32324
|
-
const containerRef =
|
|
32325
|
-
const [autoScroll, setAutoScroll] =
|
|
32326
|
-
|
|
32234
|
+
const [filter, setFilter] = React114.useState("all");
|
|
32235
|
+
const containerRef = React114.useRef(null);
|
|
32236
|
+
const [autoScroll, setAutoScroll] = React114.useState(true);
|
|
32237
|
+
React114.useEffect(() => {
|
|
32327
32238
|
if (autoScroll && containerRef.current) {
|
|
32328
32239
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
32329
32240
|
}
|
|
32330
32241
|
}, [events2.length, autoScroll]);
|
|
32331
|
-
const filteredEvents =
|
|
32242
|
+
const filteredEvents = React114.useMemo(() => {
|
|
32332
32243
|
if (filter === "all") return events2;
|
|
32333
32244
|
return events2.filter((e) => e.type === filter);
|
|
32334
32245
|
}, [events2, filter]);
|
|
@@ -32447,7 +32358,7 @@ var init_EventFlowTab = __esm({
|
|
|
32447
32358
|
}
|
|
32448
32359
|
});
|
|
32449
32360
|
function GuardsPanel({ guards }) {
|
|
32450
|
-
const [filter, setFilter] =
|
|
32361
|
+
const [filter, setFilter] = React114.useState("all");
|
|
32451
32362
|
if (guards.length === 0) {
|
|
32452
32363
|
return /* @__PURE__ */ jsx(
|
|
32453
32364
|
EmptyState,
|
|
@@ -32460,7 +32371,7 @@ function GuardsPanel({ guards }) {
|
|
|
32460
32371
|
}
|
|
32461
32372
|
const passedCount = guards.filter((g) => g.result).length;
|
|
32462
32373
|
const failedCount = guards.length - passedCount;
|
|
32463
|
-
const filteredGuards =
|
|
32374
|
+
const filteredGuards = React114.useMemo(() => {
|
|
32464
32375
|
if (filter === "all") return guards;
|
|
32465
32376
|
if (filter === "passed") return guards.filter((g) => g.result);
|
|
32466
32377
|
return guards.filter((g) => !g.result);
|
|
@@ -32621,10 +32532,10 @@ function EffectBadge({ effect }) {
|
|
|
32621
32532
|
] });
|
|
32622
32533
|
}
|
|
32623
32534
|
function TransitionTimeline({ transitions }) {
|
|
32624
|
-
const containerRef =
|
|
32625
|
-
const [autoScroll, setAutoScroll] =
|
|
32626
|
-
const [expandedId, setExpandedId] =
|
|
32627
|
-
|
|
32535
|
+
const containerRef = React114.useRef(null);
|
|
32536
|
+
const [autoScroll, setAutoScroll] = React114.useState(true);
|
|
32537
|
+
const [expandedId, setExpandedId] = React114.useState(null);
|
|
32538
|
+
React114.useEffect(() => {
|
|
32628
32539
|
if (autoScroll && containerRef.current) {
|
|
32629
32540
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
32630
32541
|
}
|
|
@@ -32910,9 +32821,9 @@ function getAllEvents(traits2) {
|
|
|
32910
32821
|
}
|
|
32911
32822
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
32912
32823
|
const eventBus = useEventBus();
|
|
32913
|
-
const [log3, setLog] =
|
|
32914
|
-
const prevStatesRef =
|
|
32915
|
-
|
|
32824
|
+
const [log3, setLog] = React114.useState([]);
|
|
32825
|
+
const prevStatesRef = React114.useRef(/* @__PURE__ */ new Map());
|
|
32826
|
+
React114.useEffect(() => {
|
|
32916
32827
|
for (const trait of traits2) {
|
|
32917
32828
|
const prev = prevStatesRef.current.get(trait.id);
|
|
32918
32829
|
if (prev && prev !== trait.currentState) {
|
|
@@ -33082,10 +32993,10 @@ function VerifyModePanel({
|
|
|
33082
32993
|
serverCount,
|
|
33083
32994
|
localCount
|
|
33084
32995
|
}) {
|
|
33085
|
-
const [expanded, setExpanded] =
|
|
33086
|
-
const scrollRef =
|
|
33087
|
-
const prevCountRef =
|
|
33088
|
-
|
|
32996
|
+
const [expanded, setExpanded] = React114.useState(true);
|
|
32997
|
+
const scrollRef = React114.useRef(null);
|
|
32998
|
+
const prevCountRef = React114.useRef(0);
|
|
32999
|
+
React114.useEffect(() => {
|
|
33089
33000
|
if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
|
|
33090
33001
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
33091
33002
|
}
|
|
@@ -33151,10 +33062,10 @@ function RuntimeDebugger({
|
|
|
33151
33062
|
defaultTab,
|
|
33152
33063
|
schema
|
|
33153
33064
|
}) {
|
|
33154
|
-
const [isCollapsed, setIsCollapsed] =
|
|
33155
|
-
const [isVisible, setIsVisible] =
|
|
33065
|
+
const [isCollapsed, setIsCollapsed] = React114.useState(mode === "verify" ? true : defaultCollapsed);
|
|
33066
|
+
const [isVisible, setIsVisible] = React114.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
|
|
33156
33067
|
const debugData = useDebugData();
|
|
33157
|
-
|
|
33068
|
+
React114.useEffect(() => {
|
|
33158
33069
|
if (mode === "inline") return;
|
|
33159
33070
|
return onDebugToggle((enabled) => {
|
|
33160
33071
|
setIsVisible(enabled);
|
|
@@ -33163,7 +33074,7 @@ function RuntimeDebugger({
|
|
|
33163
33074
|
}
|
|
33164
33075
|
});
|
|
33165
33076
|
}, [mode]);
|
|
33166
|
-
|
|
33077
|
+
React114.useEffect(() => {
|
|
33167
33078
|
if (mode === "inline") return;
|
|
33168
33079
|
const handleKeyDown = (e) => {
|
|
33169
33080
|
if (e.key === "`" && isVisible) {
|
|
@@ -33712,7 +33623,7 @@ function SequenceBar({
|
|
|
33712
33623
|
onSlotRemove(index);
|
|
33713
33624
|
}, [onSlotRemove, playing]);
|
|
33714
33625
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
33715
|
-
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(
|
|
33626
|
+
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
33716
33627
|
i > 0 && /* @__PURE__ */ jsx(
|
|
33717
33628
|
Typography,
|
|
33718
33629
|
{
|
|
@@ -35057,7 +34968,7 @@ var init_StatCard2 = __esm({
|
|
|
35057
34968
|
const labelToUse = propLabel ?? propTitle;
|
|
35058
34969
|
const eventBus = useEventBus();
|
|
35059
34970
|
const { t } = useTranslate();
|
|
35060
|
-
const handleActionClick =
|
|
34971
|
+
const handleActionClick = React114__default.useCallback(() => {
|
|
35061
34972
|
if (action?.event) {
|
|
35062
34973
|
eventBus.emit(`UI:${action.event}`, {});
|
|
35063
34974
|
}
|
|
@@ -35068,7 +34979,7 @@ var init_StatCard2 = __esm({
|
|
|
35068
34979
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
35069
34980
|
const isLoading = externalLoading ?? false;
|
|
35070
34981
|
const error = externalError;
|
|
35071
|
-
const computeMetricValue =
|
|
34982
|
+
const computeMetricValue = React114__default.useCallback(
|
|
35072
34983
|
(metric, items) => {
|
|
35073
34984
|
if (metric.value !== void 0) {
|
|
35074
34985
|
return metric.value;
|
|
@@ -35107,7 +35018,7 @@ var init_StatCard2 = __esm({
|
|
|
35107
35018
|
},
|
|
35108
35019
|
[]
|
|
35109
35020
|
);
|
|
35110
|
-
const schemaStats =
|
|
35021
|
+
const schemaStats = React114__default.useMemo(() => {
|
|
35111
35022
|
if (!metrics || metrics.length === 0) return null;
|
|
35112
35023
|
return metrics.map((metric) => ({
|
|
35113
35024
|
label: metric.label,
|
|
@@ -35115,7 +35026,7 @@ var init_StatCard2 = __esm({
|
|
|
35115
35026
|
format: metric.format
|
|
35116
35027
|
}));
|
|
35117
35028
|
}, [metrics, data, computeMetricValue]);
|
|
35118
|
-
const calculatedTrend =
|
|
35029
|
+
const calculatedTrend = React114__default.useMemo(() => {
|
|
35119
35030
|
if (manualTrend !== void 0) return manualTrend;
|
|
35120
35031
|
if (previousValue === void 0 || currentValue === void 0)
|
|
35121
35032
|
return void 0;
|
|
@@ -36099,7 +36010,7 @@ var init_Timeline = __esm({
|
|
|
36099
36010
|
}) => {
|
|
36100
36011
|
const { t } = useTranslate();
|
|
36101
36012
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
36102
|
-
const items =
|
|
36013
|
+
const items = React114__default.useMemo(() => {
|
|
36103
36014
|
if (propItems) return propItems;
|
|
36104
36015
|
if (entityData.length === 0) return [];
|
|
36105
36016
|
return entityData.map((record, idx) => {
|
|
@@ -36206,7 +36117,7 @@ var init_Timeline = __esm({
|
|
|
36206
36117
|
}
|
|
36207
36118
|
});
|
|
36208
36119
|
function extractToastProps(children) {
|
|
36209
|
-
if (!
|
|
36120
|
+
if (!React114__default.isValidElement(children)) {
|
|
36210
36121
|
if (typeof children === "string") {
|
|
36211
36122
|
return { message: children };
|
|
36212
36123
|
}
|
|
@@ -36244,7 +36155,7 @@ var init_ToastSlot = __esm({
|
|
|
36244
36155
|
eventBus.emit("UI:CLOSE");
|
|
36245
36156
|
};
|
|
36246
36157
|
if (!isVisible) return null;
|
|
36247
|
-
const isCustomContent =
|
|
36158
|
+
const isCustomContent = React114__default.isValidElement(children) && !message;
|
|
36248
36159
|
return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
|
|
36249
36160
|
Toast,
|
|
36250
36161
|
{
|
|
@@ -36513,7 +36424,7 @@ var init_WizardContainer = __esm({
|
|
|
36513
36424
|
const isCompleted = index < currentStep;
|
|
36514
36425
|
const stepKey = step.id ?? step.tabId ?? `step-${index}`;
|
|
36515
36426
|
const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
|
|
36516
|
-
return /* @__PURE__ */ jsxs(
|
|
36427
|
+
return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
|
|
36517
36428
|
/* @__PURE__ */ jsx(
|
|
36518
36429
|
Button,
|
|
36519
36430
|
{
|
|
@@ -36895,12 +36806,12 @@ var init_WorldMapTemplate = __esm({
|
|
|
36895
36806
|
}
|
|
36896
36807
|
});
|
|
36897
36808
|
function lazyThree(name, loader) {
|
|
36898
|
-
const Lazy =
|
|
36809
|
+
const Lazy = React114__default.lazy(() => loader().then((m) => ({ default: m[name] })));
|
|
36899
36810
|
function ThreeWrapper(props) {
|
|
36900
|
-
return
|
|
36901
|
-
|
|
36811
|
+
return React114__default.createElement(
|
|
36812
|
+
React114__default.Suspense,
|
|
36902
36813
|
{ fallback: null },
|
|
36903
|
-
|
|
36814
|
+
React114__default.createElement(Lazy, props)
|
|
36904
36815
|
);
|
|
36905
36816
|
}
|
|
36906
36817
|
ThreeWrapper.displayName = `Lazy(${name})`;
|
|
@@ -37388,7 +37299,7 @@ function SuspenseConfigProvider({
|
|
|
37388
37299
|
config,
|
|
37389
37300
|
children
|
|
37390
37301
|
}) {
|
|
37391
|
-
return
|
|
37302
|
+
return React114__default.createElement(
|
|
37392
37303
|
SuspenseConfigContext.Provider,
|
|
37393
37304
|
{ value: config },
|
|
37394
37305
|
children
|
|
@@ -37871,7 +37782,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
37871
37782
|
const key = `${parentId}-${index}-trait:${traitName}`;
|
|
37872
37783
|
return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
|
|
37873
37784
|
}
|
|
37874
|
-
return /* @__PURE__ */ jsx(
|
|
37785
|
+
return /* @__PURE__ */ jsx(React114__default.Fragment, { children: child }, `${parentId}-${index}`);
|
|
37875
37786
|
}
|
|
37876
37787
|
if (!child || typeof child !== "object") return null;
|
|
37877
37788
|
const childId = `${parentId}-${index}`;
|
|
@@ -38084,7 +37995,7 @@ var init_UISlotRenderer = __esm({
|
|
|
38084
37995
|
init_Box();
|
|
38085
37996
|
init_Typography();
|
|
38086
37997
|
init_useEventBus();
|
|
38087
|
-
|
|
37998
|
+
init_slot_types();
|
|
38088
37999
|
init_cn();
|
|
38089
38000
|
init_ErrorBoundary();
|
|
38090
38001
|
init_logger();
|
|
@@ -38235,6 +38146,7 @@ init_EntitySchemaContext();
|
|
|
38235
38146
|
init_traitRegistry();
|
|
38236
38147
|
init_verificationRegistry();
|
|
38237
38148
|
var crossTraitLog = createLogger("almadar:ui:cross-trait");
|
|
38149
|
+
var flushLog = createLogger("almadar:ui:slot-flush");
|
|
38238
38150
|
function toTraitDefinition(binding) {
|
|
38239
38151
|
return {
|
|
38240
38152
|
name: binding.trait.name,
|
|
@@ -38246,7 +38158,7 @@ function toTraitDefinition(binding) {
|
|
|
38246
38158
|
function normalizeEventKey(eventKey) {
|
|
38247
38159
|
return eventKey.startsWith("UI:") ? eventKey.slice(3) : eventKey;
|
|
38248
38160
|
}
|
|
38249
|
-
function useTraitStateMachine(traitBindings,
|
|
38161
|
+
function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
38250
38162
|
const eventBus = useEventBus();
|
|
38251
38163
|
const { entities } = useEntitySchema();
|
|
38252
38164
|
const traitConfigsByName = options?.traitConfigsByName;
|
|
@@ -38269,7 +38181,8 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38269
38181
|
const processingRef = useRef(false);
|
|
38270
38182
|
const traitBindingsRef = useRef(traitBindings);
|
|
38271
38183
|
const managerRef = useRef(manager);
|
|
38272
|
-
const
|
|
38184
|
+
const uiSlotsRef = useRef(uiSlots);
|
|
38185
|
+
const embeddedTraitsRef = useRef(options?.embeddedTraits);
|
|
38273
38186
|
const optionsRef = useRef(options);
|
|
38274
38187
|
useEffect(() => {
|
|
38275
38188
|
traitBindingsRef.current = traitBindings;
|
|
@@ -38279,8 +38192,59 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38279
38192
|
setTraitStates(manager.getAllStates());
|
|
38280
38193
|
}, [manager]);
|
|
38281
38194
|
useEffect(() => {
|
|
38282
|
-
|
|
38283
|
-
}, [
|
|
38195
|
+
uiSlotsRef.current = uiSlots;
|
|
38196
|
+
}, [uiSlots]);
|
|
38197
|
+
useEffect(() => {
|
|
38198
|
+
embeddedTraitsRef.current = options?.embeddedTraits;
|
|
38199
|
+
}, [options?.embeddedTraits]);
|
|
38200
|
+
const flushSlot = useCallback(
|
|
38201
|
+
(traitName, slot, patterns) => {
|
|
38202
|
+
const slots = uiSlotsRef.current;
|
|
38203
|
+
const embedded = embeddedTraitsRef.current;
|
|
38204
|
+
if (patterns.length === 0) {
|
|
38205
|
+
flushLog.info("clear", { traitName, slot });
|
|
38206
|
+
slots.clearBySource(slot, traitName);
|
|
38207
|
+
return;
|
|
38208
|
+
}
|
|
38209
|
+
const last = patterns[patterns.length - 1];
|
|
38210
|
+
const record = last.pattern ?? {};
|
|
38211
|
+
const { type: patternType, children: nested, ...inlineProps } = record;
|
|
38212
|
+
const props = {
|
|
38213
|
+
...inlineProps,
|
|
38214
|
+
...last.props,
|
|
38215
|
+
...nested !== void 0 ? { children: nested } : {}
|
|
38216
|
+
};
|
|
38217
|
+
const isEmbedded = embedded?.has(traitName) ?? false;
|
|
38218
|
+
if (isEmbedded) {
|
|
38219
|
+
flushLog.info("embed-route", {
|
|
38220
|
+
traitName,
|
|
38221
|
+
slot,
|
|
38222
|
+
patternType: typeof patternType === "string" ? patternType : void 0,
|
|
38223
|
+
embeddedSize: embedded?.size ?? 0
|
|
38224
|
+
});
|
|
38225
|
+
slots.updateTraitContent(traitName, {
|
|
38226
|
+
pattern: patternType,
|
|
38227
|
+
props,
|
|
38228
|
+
priority: 0,
|
|
38229
|
+
animation: "fade"
|
|
38230
|
+
});
|
|
38231
|
+
return;
|
|
38232
|
+
}
|
|
38233
|
+
flushLog.info("slot-render", {
|
|
38234
|
+
traitName,
|
|
38235
|
+
slot,
|
|
38236
|
+
patternType: typeof patternType === "string" ? patternType : void 0,
|
|
38237
|
+
embedded: Array.from(embedded ?? [])
|
|
38238
|
+
});
|
|
38239
|
+
slots.render({
|
|
38240
|
+
target: slot,
|
|
38241
|
+
pattern: patternType,
|
|
38242
|
+
props,
|
|
38243
|
+
sourceTrait: traitName
|
|
38244
|
+
});
|
|
38245
|
+
},
|
|
38246
|
+
[]
|
|
38247
|
+
);
|
|
38284
38248
|
useEffect(() => {
|
|
38285
38249
|
optionsRef.current = options;
|
|
38286
38250
|
}, [options]);
|
|
@@ -38373,7 +38337,6 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38373
38337
|
};
|
|
38374
38338
|
}, [traitBindings]);
|
|
38375
38339
|
const runTickEffects = useCallback((tick, binding) => {
|
|
38376
|
-
const actions = slotsActionsRef.current;
|
|
38377
38340
|
const currentState = traitStatesRef.current.get(binding.trait.name)?.currentState ?? "";
|
|
38378
38341
|
if (tick.appliesTo.length > 0 && !tick.appliesTo.includes(currentState)) return;
|
|
38379
38342
|
const bindingCtx = { entity: {}, payload: {}, state: currentState };
|
|
@@ -38386,13 +38349,12 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38386
38349
|
if (!passed) return;
|
|
38387
38350
|
}
|
|
38388
38351
|
const pendingSlots = /* @__PURE__ */ new Map();
|
|
38389
|
-
|
|
38352
|
+
({
|
|
38390
38353
|
trait: binding.trait.name,
|
|
38391
|
-
state: currentState,
|
|
38392
38354
|
transition: `${currentState}->tick:${tick.name}`,
|
|
38393
38355
|
effects: tick.effects,
|
|
38394
38356
|
traitDefinition: binding.trait
|
|
38395
|
-
};
|
|
38357
|
+
});
|
|
38396
38358
|
for (const effect of tick.effects) {
|
|
38397
38359
|
if (!Array.isArray(effect)) continue;
|
|
38398
38360
|
const op = effect[0];
|
|
@@ -38411,13 +38373,9 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38411
38373
|
}
|
|
38412
38374
|
}
|
|
38413
38375
|
for (const [slot, patterns] of pendingSlots) {
|
|
38414
|
-
|
|
38415
|
-
actions.clearSlot(slot);
|
|
38416
|
-
} else {
|
|
38417
|
-
actions.setSlotPatterns(slot, patterns, slotSource);
|
|
38418
|
-
}
|
|
38376
|
+
flushSlot(binding.trait.name, slot, patterns);
|
|
38419
38377
|
}
|
|
38420
|
-
}, []);
|
|
38378
|
+
}, [flushSlot]);
|
|
38421
38379
|
useEffect(() => {
|
|
38422
38380
|
const hasFrameTicks = traitBindingsRef.current.some(
|
|
38423
38381
|
(b) => b.trait.ticks?.some((t) => t.interval === "frame")
|
|
@@ -38460,7 +38418,6 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38460
38418
|
const normalizedEvent = normalizeEventKey(eventKey);
|
|
38461
38419
|
const bindings = traitBindingsRef.current;
|
|
38462
38420
|
const currentManager = managerRef.current;
|
|
38463
|
-
const actions = slotsActionsRef.current;
|
|
38464
38421
|
console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
|
|
38465
38422
|
crossTraitLog.debug("processEvent:enter", {
|
|
38466
38423
|
event: normalizedEvent,
|
|
@@ -38611,12 +38568,9 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38611
38568
|
"[TraitStateMachine] After executeAll, pendingSlots:",
|
|
38612
38569
|
Object.fromEntries(pendingSlots.entries())
|
|
38613
38570
|
);
|
|
38571
|
+
void slotSource;
|
|
38614
38572
|
for (const [slot, patterns] of pendingSlots) {
|
|
38615
|
-
|
|
38616
|
-
actions.clearSlot(slot);
|
|
38617
|
-
} else {
|
|
38618
|
-
actions.setSlotPatterns(slot, patterns, slotSource);
|
|
38619
|
-
}
|
|
38573
|
+
flushSlot(traitName, slot, patterns);
|
|
38620
38574
|
}
|
|
38621
38575
|
} catch (error) {
|
|
38622
38576
|
console.error(
|
|
@@ -38968,9 +38922,6 @@ function useTrait(traitName) {
|
|
|
38968
38922
|
return context.getTrait(traitName);
|
|
38969
38923
|
}
|
|
38970
38924
|
|
|
38971
|
-
// runtime/index.ts
|
|
38972
|
-
init_SlotsContext();
|
|
38973
|
-
|
|
38974
38925
|
// runtime/OrbPreview.tsx
|
|
38975
38926
|
init_Box();
|
|
38976
38927
|
init_Typography();
|
|
@@ -39048,13 +38999,12 @@ function collectEmbeddedTraits(schema) {
|
|
|
39048
38999
|
}
|
|
39049
39000
|
|
|
39050
39001
|
// runtime/OrbPreview.tsx
|
|
39051
|
-
init_SlotsContext();
|
|
39052
39002
|
init_EntitySchemaContext();
|
|
39053
39003
|
|
|
39054
39004
|
// runtime/ServerBridge.tsx
|
|
39055
39005
|
init_useEventBus();
|
|
39056
39006
|
init_logger();
|
|
39057
|
-
var
|
|
39007
|
+
var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
|
|
39058
39008
|
function createHttpTransport(serverUrl) {
|
|
39059
39009
|
return {
|
|
39060
39010
|
register: async (schema) => {
|
|
@@ -39160,14 +39110,14 @@ function ServerBridgeProvider({
|
|
|
39160
39110
|
for (const emitted of result.emittedEvents) {
|
|
39161
39111
|
const evTrait = emitted.source?.trait;
|
|
39162
39112
|
if (!evTrait) {
|
|
39163
|
-
|
|
39113
|
+
xOrbitalLog.warn("emit:dropped-no-source", {
|
|
39164
39114
|
event: emitted.event,
|
|
39165
39115
|
dispatchOrbital: orbitalName
|
|
39166
39116
|
});
|
|
39167
39117
|
continue;
|
|
39168
39118
|
}
|
|
39169
39119
|
const key = emitted.source?.orbital ? `UI:${emitted.source.orbital}.${evTrait}.${emitted.event}` : `UI:${evTrait}.${emitted.event}`;
|
|
39170
|
-
|
|
39120
|
+
xOrbitalLog.info("emit:rebroadcast", {
|
|
39171
39121
|
busKey: key,
|
|
39172
39122
|
sourceOrbital: emitted.source?.orbital,
|
|
39173
39123
|
sourceTrait: evTrait,
|
|
@@ -39177,7 +39127,7 @@ function ServerBridgeProvider({
|
|
|
39177
39127
|
}
|
|
39178
39128
|
}
|
|
39179
39129
|
} else if (result.error) {
|
|
39180
|
-
|
|
39130
|
+
xOrbitalLog.warn("response:fail", {
|
|
39181
39131
|
orbital: orbitalName,
|
|
39182
39132
|
event,
|
|
39183
39133
|
error: result.error
|
|
@@ -39185,7 +39135,7 @@ function ServerBridgeProvider({
|
|
|
39185
39135
|
}
|
|
39186
39136
|
return { effects, meta };
|
|
39187
39137
|
} catch (err) {
|
|
39188
|
-
|
|
39138
|
+
xOrbitalLog.error("response:network", {
|
|
39189
39139
|
orbital: orbitalName,
|
|
39190
39140
|
event,
|
|
39191
39141
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -39305,7 +39255,7 @@ function prepareSchemaForPreview(input) {
|
|
|
39305
39255
|
|
|
39306
39256
|
// runtime/OrbPreview.tsx
|
|
39307
39257
|
init_logger();
|
|
39308
|
-
var
|
|
39258
|
+
var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
|
|
39309
39259
|
function normalizeChild(child) {
|
|
39310
39260
|
if (typeof child === "string") return child;
|
|
39311
39261
|
if (child === null || typeof child !== "object" || Array.isArray(child)) {
|
|
@@ -39318,98 +39268,6 @@ function normalizeChild(child) {
|
|
|
39318
39268
|
props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
|
|
39319
39269
|
};
|
|
39320
39270
|
}
|
|
39321
|
-
function SlotBridge({ embeddedTraits }) {
|
|
39322
|
-
const slots = useSlots();
|
|
39323
|
-
const { render, clear, updateTraitContent } = useUISlots();
|
|
39324
|
-
useEffect(() => {
|
|
39325
|
-
slotLog.debug("SlotBridge:effect-fired", {
|
|
39326
|
-
slotCount: Object.keys(slots).length,
|
|
39327
|
-
slots: Object.keys(slots)
|
|
39328
|
-
});
|
|
39329
|
-
for (const [slotName, slotState] of Object.entries(slots)) {
|
|
39330
|
-
const allEntries = slotEntriesInOrder(slotState);
|
|
39331
|
-
const entries = [];
|
|
39332
|
-
for (const e of allEntries) {
|
|
39333
|
-
const traitName = e.entry.source?.trait;
|
|
39334
|
-
if (traitName && embeddedTraits?.has(traitName)) {
|
|
39335
|
-
const last = e.entry.patterns[e.entry.patterns.length - 1];
|
|
39336
|
-
if (last?.pattern && typeof last.pattern === "object") {
|
|
39337
|
-
const record = last.pattern;
|
|
39338
|
-
const { type: patternType, children: nested, ...inlineProps } = record;
|
|
39339
|
-
const normalizedNested = Array.isArray(nested) ? nested.map((c) => normalizeChild(c)) : nested;
|
|
39340
|
-
updateTraitContent(traitName, {
|
|
39341
|
-
pattern: patternType,
|
|
39342
|
-
props: {
|
|
39343
|
-
...inlineProps,
|
|
39344
|
-
...last.props,
|
|
39345
|
-
...normalizedNested !== void 0 ? { children: normalizedNested } : {}
|
|
39346
|
-
},
|
|
39347
|
-
priority: 0,
|
|
39348
|
-
animation: "fade"
|
|
39349
|
-
});
|
|
39350
|
-
}
|
|
39351
|
-
continue;
|
|
39352
|
-
}
|
|
39353
|
-
entries.push(e);
|
|
39354
|
-
}
|
|
39355
|
-
if (entries.length === 0) {
|
|
39356
|
-
if (allEntries.length === 0) {
|
|
39357
|
-
clear(slotName);
|
|
39358
|
-
} else {
|
|
39359
|
-
slotLog.debug("SlotBridge:embed-only-skip", {
|
|
39360
|
-
slot: slotName,
|
|
39361
|
-
embeddedCount: allEntries.length
|
|
39362
|
-
});
|
|
39363
|
-
}
|
|
39364
|
-
continue;
|
|
39365
|
-
}
|
|
39366
|
-
const children = entries.map(({ entry }) => entry.patterns[entry.patterns.length - 1]).filter((p2) => Boolean(p2)).map((entry) => {
|
|
39367
|
-
const record = entry.pattern;
|
|
39368
|
-
const { type: patternType, children: nested, ...inlineProps } = record;
|
|
39369
|
-
const normalizedNested = Array.isArray(nested) ? nested.map((c) => normalizeChild(c)) : nested;
|
|
39370
|
-
return {
|
|
39371
|
-
type: patternType,
|
|
39372
|
-
...inlineProps,
|
|
39373
|
-
...entry.props,
|
|
39374
|
-
...normalizedNested !== void 0 ? { children: normalizedNested } : {}
|
|
39375
|
-
};
|
|
39376
|
-
});
|
|
39377
|
-
if (children.length === 1) {
|
|
39378
|
-
const only = children[0];
|
|
39379
|
-
const { type, children: nested, ...rest } = only;
|
|
39380
|
-
const lastEntry = entries[entries.length - 1];
|
|
39381
|
-
slotLog.debug("SlotBridge:render-single", {
|
|
39382
|
-
slot: slotName,
|
|
39383
|
-
patternType: type,
|
|
39384
|
-
entityRefId: refId(rest.entity),
|
|
39385
|
-
sourceTrait: lastEntry.entry.source?.trait
|
|
39386
|
-
});
|
|
39387
|
-
render({
|
|
39388
|
-
target: slotName,
|
|
39389
|
-
pattern: type,
|
|
39390
|
-
props: {
|
|
39391
|
-
...rest,
|
|
39392
|
-
...nested !== void 0 ? { children: nested } : {}
|
|
39393
|
-
},
|
|
39394
|
-
sourceTrait: lastEntry.entry.source?.trait
|
|
39395
|
-
});
|
|
39396
|
-
} else {
|
|
39397
|
-
const lastEntry = entries[entries.length - 1];
|
|
39398
|
-
render({
|
|
39399
|
-
target: slotName,
|
|
39400
|
-
pattern: "stack",
|
|
39401
|
-
props: {
|
|
39402
|
-
direction: "vertical",
|
|
39403
|
-
gap: "lg",
|
|
39404
|
-
children
|
|
39405
|
-
},
|
|
39406
|
-
sourceTrait: lastEntry.entry.source?.trait
|
|
39407
|
-
});
|
|
39408
|
-
}
|
|
39409
|
-
}
|
|
39410
|
-
}, [slots, render, clear, updateTraitContent, embeddedTraits]);
|
|
39411
|
-
return null;
|
|
39412
|
-
}
|
|
39413
39271
|
function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
|
|
39414
39272
|
for (const eff of effects) {
|
|
39415
39273
|
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
@@ -39423,7 +39281,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
|
|
|
39423
39281
|
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
39424
39282
|
};
|
|
39425
39283
|
if (isEmbedded) {
|
|
39426
|
-
|
|
39284
|
+
xOrbitalLog2.info("slot:embed-routed", {
|
|
39427
39285
|
sourceTrait,
|
|
39428
39286
|
slot: eff.slot,
|
|
39429
39287
|
patternType: typeof patternType === "string" ? patternType : void 0
|
|
@@ -39435,7 +39293,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
|
|
|
39435
39293
|
animation: "fade"
|
|
39436
39294
|
});
|
|
39437
39295
|
} else {
|
|
39438
|
-
|
|
39296
|
+
xOrbitalLog2.info("slot-write", {
|
|
39439
39297
|
slot: eff.slot,
|
|
39440
39298
|
sourceTrait,
|
|
39441
39299
|
patternType: typeof patternType === "string" ? patternType : void 0
|
|
@@ -39453,13 +39311,12 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
|
|
|
39453
39311
|
}
|
|
39454
39312
|
}
|
|
39455
39313
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits }) {
|
|
39456
|
-
const slotsActions = useSlotsActions();
|
|
39457
39314
|
const bridge = useServerBridge();
|
|
39458
39315
|
const uiSlots = useUISlots();
|
|
39459
39316
|
const onEventProcessed = useCallback(async (event, payload, dispatchedOrbitals) => {
|
|
39460
39317
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
39461
39318
|
const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
|
|
39462
|
-
|
|
39319
|
+
xOrbitalLog2.info("TraitInitializer:fanout", {
|
|
39463
39320
|
event,
|
|
39464
39321
|
sentTo: targets,
|
|
39465
39322
|
skipped: orbitalNames.filter((n) => !targets.includes(n)),
|
|
@@ -39471,8 +39328,8 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
39471
39328
|
applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits);
|
|
39472
39329
|
}
|
|
39473
39330
|
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, embeddedTraits]);
|
|
39474
|
-
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait };
|
|
39475
|
-
const { sendEvent } = useTraitStateMachine(traits2,
|
|
39331
|
+
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait, embeddedTraits } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits };
|
|
39332
|
+
const { sendEvent } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
39476
39333
|
const initSentRef = useRef(false);
|
|
39477
39334
|
useEffect(() => {
|
|
39478
39335
|
if (!orbitalNames?.length) {
|
|
@@ -39594,7 +39451,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
|
|
|
39594
39451
|
const orb = orbitalsByTrait[name];
|
|
39595
39452
|
if (orb) orbitalsByTraitForPage[name] = orb;
|
|
39596
39453
|
}
|
|
39597
|
-
|
|
39454
|
+
xOrbitalLog2.info("SchemaRunner:mount", {
|
|
39598
39455
|
pageName,
|
|
39599
39456
|
traitNames,
|
|
39600
39457
|
orbitalsByTraitForPage,
|
|
@@ -39620,9 +39477,15 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
|
|
|
39620
39477
|
return map;
|
|
39621
39478
|
}, [schema]);
|
|
39622
39479
|
const embeddedTraits = useMemo(() => {
|
|
39623
|
-
|
|
39624
|
-
|
|
39625
|
-
|
|
39480
|
+
const set = collectEmbeddedTraits(schema);
|
|
39481
|
+
xOrbitalLog2.info("SchemaRunner:embeddedTraits", {
|
|
39482
|
+
pageName,
|
|
39483
|
+
embedded: Array.from(set),
|
|
39484
|
+
embeddedCount: set.size
|
|
39485
|
+
});
|
|
39486
|
+
return set;
|
|
39487
|
+
}, [schema, pageName]);
|
|
39488
|
+
const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsxs(
|
|
39626
39489
|
EntitySchemaProvider,
|
|
39627
39490
|
{
|
|
39628
39491
|
entities: entitiesArray,
|
|
@@ -39642,11 +39505,10 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
|
|
|
39642
39505
|
persistence
|
|
39643
39506
|
}
|
|
39644
39507
|
),
|
|
39645
|
-
/* @__PURE__ */ jsx(SlotBridge, { embeddedTraits }),
|
|
39646
39508
|
/* @__PURE__ */ jsx(Box, { className: "h-full p-4", children: /* @__PURE__ */ jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) })
|
|
39647
39509
|
]
|
|
39648
39510
|
}
|
|
39649
|
-
) })
|
|
39511
|
+
) });
|
|
39650
39512
|
if (serverUrl || transport) {
|
|
39651
39513
|
return /* @__PURE__ */ jsx(ServerBridgeProvider, { schema, serverUrl, transport, children: inner });
|
|
39652
39514
|
}
|
|
@@ -39818,4 +39680,4 @@ function BrowserPlayground({
|
|
|
39818
39680
|
);
|
|
39819
39681
|
}
|
|
39820
39682
|
|
|
39821
|
-
export { BrowserPlayground, EntitySchemaProvider, OrbPreview, ServerBridgeProvider,
|
|
39683
|
+
export { BrowserPlayground, EntitySchemaProvider, OrbPreview, ServerBridgeProvider, TraitContext, TraitProvider, adjustSchemaForMockData, buildMockData, clearSchemaCache, createClientEffectHandlers, prepareSchemaForPreview, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useTrait, useTraitContext, useTraitStateMachine };
|