@almadar/ui 5.76.0 → 5.76.2
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 +1449 -1428
- package/dist/avl/index.js +250 -229
- package/dist/components/index.cjs +103 -46
- package/dist/components/index.js +103 -37
- package/dist/context/index.cjs +690 -47
- package/dist/context/index.js +682 -2
- package/dist/providers/index.cjs +2175 -1255
- package/dist/providers/index.d.ts +8 -0
- package/dist/providers/index.js +1087 -208
- package/dist/runtime/index.cjs +1310 -1289
- package/dist/runtime/index.js +230 -209
- package/package.json +1 -1
package/dist/providers/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { EventBusContext, useTraitScope, useEntitySchemaOptional, TraitScopeProvider, useCurrentPagePath
|
|
1
|
+
import * as React107 from 'react';
|
|
2
|
+
import React107__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId, useSyncExternalStore } from 'react';
|
|
3
|
+
import { EventBusContext, useTraitScope, useEntitySchemaOptional, TraitScopeProvider, useCurrentPagePath } from '@almadar/ui/providers';
|
|
4
4
|
import { createLogger, isLogLevelEnabled } from '@almadar/logger';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -10,6 +10,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
11
11
|
import { useTranslate } from '@almadar/ui/hooks';
|
|
12
12
|
import { useUISlots, ThemeProvider, useTheme } from '@almadar/ui/context';
|
|
13
|
+
export { DesignThemeProvider, useDesignTheme } from '@almadar/ui/context';
|
|
13
14
|
import { evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
14
15
|
import { getPatternDefinition, getComponentForPattern } from '@almadar/patterns';
|
|
15
16
|
import { Link, Outlet, useLocation } from 'react-router-dom';
|
|
@@ -387,7 +388,7 @@ var init_Box = __esm({
|
|
|
387
388
|
fixed: "fixed",
|
|
388
389
|
sticky: "sticky"
|
|
389
390
|
};
|
|
390
|
-
Box =
|
|
391
|
+
Box = React107__default.forwardRef(
|
|
391
392
|
({
|
|
392
393
|
padding,
|
|
393
394
|
paddingX,
|
|
@@ -452,7 +453,7 @@ var init_Box = __esm({
|
|
|
452
453
|
onPointerDown?.(e);
|
|
453
454
|
}, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
|
|
454
455
|
const isClickable = action || onClick;
|
|
455
|
-
return
|
|
456
|
+
return React107__default.createElement(
|
|
456
457
|
Component,
|
|
457
458
|
{
|
|
458
459
|
ref,
|
|
@@ -548,7 +549,7 @@ function loadLib(key, importer) {
|
|
|
548
549
|
return p2;
|
|
549
550
|
}
|
|
550
551
|
function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
551
|
-
const Lazy =
|
|
552
|
+
const Lazy = React107__default.lazy(async () => {
|
|
552
553
|
const lib = await loadLib(libKey, importer);
|
|
553
554
|
const Comp = pick(lib);
|
|
554
555
|
if (!Comp) {
|
|
@@ -558,7 +559,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
|
558
559
|
return { default: Comp };
|
|
559
560
|
});
|
|
560
561
|
const Wrapped = (props) => /* @__PURE__ */ jsx(
|
|
561
|
-
|
|
562
|
+
React107__default.Suspense,
|
|
562
563
|
{
|
|
563
564
|
fallback: /* @__PURE__ */ jsx(
|
|
564
565
|
"span",
|
|
@@ -1285,7 +1286,7 @@ var init_Icon = __esm({
|
|
|
1285
1286
|
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
1286
1287
|
const effectiveName = typeof icon === "string" ? icon : name;
|
|
1287
1288
|
const family = useIconFamily();
|
|
1288
|
-
const RenderedComponent =
|
|
1289
|
+
const RenderedComponent = React107__default.useMemo(() => {
|
|
1289
1290
|
if (directIcon) return null;
|
|
1290
1291
|
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
1291
1292
|
}, [directIcon, effectiveName, family]);
|
|
@@ -1347,7 +1348,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
1347
1348
|
const IconComp = value;
|
|
1348
1349
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
1349
1350
|
}
|
|
1350
|
-
if (
|
|
1351
|
+
if (React107__default.isValidElement(value)) {
|
|
1351
1352
|
return value;
|
|
1352
1353
|
}
|
|
1353
1354
|
if (typeof value === "object" && value !== null && isIconLike(value)) {
|
|
@@ -1423,7 +1424,7 @@ var init_Button = __esm({
|
|
|
1423
1424
|
md: "h-icon-default w-icon-default",
|
|
1424
1425
|
lg: "h-icon-default w-icon-default"
|
|
1425
1426
|
};
|
|
1426
|
-
Button =
|
|
1427
|
+
Button = React107__default.forwardRef(
|
|
1427
1428
|
({
|
|
1428
1429
|
className,
|
|
1429
1430
|
variant = "primary",
|
|
@@ -1489,7 +1490,7 @@ var Dialog;
|
|
|
1489
1490
|
var init_Dialog = __esm({
|
|
1490
1491
|
"components/core/atoms/Dialog.tsx"() {
|
|
1491
1492
|
init_cn();
|
|
1492
|
-
Dialog =
|
|
1493
|
+
Dialog = React107__default.forwardRef(
|
|
1493
1494
|
({
|
|
1494
1495
|
role = "dialog",
|
|
1495
1496
|
"aria-modal": ariaModal = true,
|
|
@@ -1607,7 +1608,7 @@ var init_Typography = __esm({
|
|
|
1607
1608
|
}) => {
|
|
1608
1609
|
const variant = variantProp ?? (level ? `h${level}` : "body1");
|
|
1609
1610
|
const Component = as || defaultElements[variant];
|
|
1610
|
-
return
|
|
1611
|
+
return React107__default.createElement(
|
|
1611
1612
|
Component,
|
|
1612
1613
|
{
|
|
1613
1614
|
id,
|
|
@@ -2102,7 +2103,7 @@ var init_Badge = __esm({
|
|
|
2102
2103
|
md: "px-2.5 py-1 text-sm",
|
|
2103
2104
|
lg: "px-3 py-1.5 text-base"
|
|
2104
2105
|
};
|
|
2105
|
-
Badge =
|
|
2106
|
+
Badge = React107__default.forwardRef(
|
|
2106
2107
|
({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
|
|
2107
2108
|
const iconSizes3 = {
|
|
2108
2109
|
sm: "h-icon-default w-icon-default",
|
|
@@ -2438,7 +2439,7 @@ var init_SvgFlow = __esm({
|
|
|
2438
2439
|
width = 100,
|
|
2439
2440
|
height = 100
|
|
2440
2441
|
}) => {
|
|
2441
|
-
const markerId =
|
|
2442
|
+
const markerId = React107__default.useMemo(() => {
|
|
2442
2443
|
flowIdCounter += 1;
|
|
2443
2444
|
return `almadar-flow-arrow-${flowIdCounter}`;
|
|
2444
2445
|
}, []);
|
|
@@ -3031,7 +3032,7 @@ var init_SvgRing = __esm({
|
|
|
3031
3032
|
width = 100,
|
|
3032
3033
|
height = 100
|
|
3033
3034
|
}) => {
|
|
3034
|
-
const gradientId =
|
|
3035
|
+
const gradientId = React107__default.useMemo(() => {
|
|
3035
3036
|
ringIdCounter += 1;
|
|
3036
3037
|
return `almadar-ring-glow-${ringIdCounter}`;
|
|
3037
3038
|
}, []);
|
|
@@ -3212,7 +3213,7 @@ var init_Input = __esm({
|
|
|
3212
3213
|
init_cn();
|
|
3213
3214
|
init_Icon();
|
|
3214
3215
|
init_useEventBus();
|
|
3215
|
-
Input =
|
|
3216
|
+
Input = React107__default.forwardRef(
|
|
3216
3217
|
({
|
|
3217
3218
|
className,
|
|
3218
3219
|
inputType,
|
|
@@ -3372,7 +3373,7 @@ var Label;
|
|
|
3372
3373
|
var init_Label = __esm({
|
|
3373
3374
|
"components/core/atoms/Label.tsx"() {
|
|
3374
3375
|
init_cn();
|
|
3375
|
-
Label =
|
|
3376
|
+
Label = React107__default.forwardRef(
|
|
3376
3377
|
({ className, required, children, ...props }, ref) => {
|
|
3377
3378
|
return /* @__PURE__ */ jsxs(
|
|
3378
3379
|
"label",
|
|
@@ -3399,7 +3400,7 @@ var init_Textarea = __esm({
|
|
|
3399
3400
|
"components/core/atoms/Textarea.tsx"() {
|
|
3400
3401
|
init_cn();
|
|
3401
3402
|
init_useEventBus();
|
|
3402
|
-
Textarea =
|
|
3403
|
+
Textarea = React107__default.forwardRef(
|
|
3403
3404
|
({ className, error, onChange, ...props }, ref) => {
|
|
3404
3405
|
const eventBus = useEventBus();
|
|
3405
3406
|
const handleChange = (e) => {
|
|
@@ -3638,7 +3639,7 @@ var init_Select = __esm({
|
|
|
3638
3639
|
init_cn();
|
|
3639
3640
|
init_Icon();
|
|
3640
3641
|
init_useEventBus();
|
|
3641
|
-
Select =
|
|
3642
|
+
Select = React107__default.forwardRef(
|
|
3642
3643
|
(props, _ref) => {
|
|
3643
3644
|
const { multiple, searchable, clearable } = props;
|
|
3644
3645
|
if (multiple || searchable || clearable) {
|
|
@@ -3655,7 +3656,7 @@ var init_Checkbox = __esm({
|
|
|
3655
3656
|
"components/core/atoms/Checkbox.tsx"() {
|
|
3656
3657
|
init_cn();
|
|
3657
3658
|
init_useEventBus();
|
|
3658
|
-
Checkbox =
|
|
3659
|
+
Checkbox = React107__default.forwardRef(
|
|
3659
3660
|
({ className, label, id, onChange, ...props }, ref) => {
|
|
3660
3661
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
3661
3662
|
const eventBus = useEventBus();
|
|
@@ -3709,7 +3710,7 @@ var init_Spinner = __esm({
|
|
|
3709
3710
|
md: "h-6 w-6",
|
|
3710
3711
|
lg: "h-8 w-8"
|
|
3711
3712
|
};
|
|
3712
|
-
Spinner =
|
|
3713
|
+
Spinner = React107__default.forwardRef(
|
|
3713
3714
|
({ className, size = "md", overlay, ...props }, ref) => {
|
|
3714
3715
|
if (overlay) {
|
|
3715
3716
|
return /* @__PURE__ */ jsx(
|
|
@@ -3799,7 +3800,7 @@ var init_Card = __esm({
|
|
|
3799
3800
|
chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
|
|
3800
3801
|
"tile-image-first": "p-0 overflow-hidden"
|
|
3801
3802
|
};
|
|
3802
|
-
Card =
|
|
3803
|
+
Card = React107__default.forwardRef(
|
|
3803
3804
|
({
|
|
3804
3805
|
className,
|
|
3805
3806
|
variant = "bordered",
|
|
@@ -3847,9 +3848,9 @@ var init_Card = __esm({
|
|
|
3847
3848
|
}
|
|
3848
3849
|
);
|
|
3849
3850
|
Card.displayName = "Card";
|
|
3850
|
-
CardHeader =
|
|
3851
|
+
CardHeader = React107__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3851
3852
|
CardHeader.displayName = "CardHeader";
|
|
3852
|
-
CardTitle =
|
|
3853
|
+
CardTitle = React107__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3853
3854
|
"h3",
|
|
3854
3855
|
{
|
|
3855
3856
|
ref,
|
|
@@ -3862,11 +3863,11 @@ var init_Card = __esm({
|
|
|
3862
3863
|
}
|
|
3863
3864
|
));
|
|
3864
3865
|
CardTitle.displayName = "CardTitle";
|
|
3865
|
-
CardContent =
|
|
3866
|
+
CardContent = React107__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
3866
3867
|
CardContent.displayName = "CardContent";
|
|
3867
3868
|
CardBody = CardContent;
|
|
3868
3869
|
CardBody.displayName = "CardBody";
|
|
3869
|
-
CardFooter =
|
|
3870
|
+
CardFooter = React107__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3870
3871
|
"div",
|
|
3871
3872
|
{
|
|
3872
3873
|
ref,
|
|
@@ -3921,7 +3922,7 @@ var init_FilterPill = __esm({
|
|
|
3921
3922
|
md: "w-3.5 h-3.5",
|
|
3922
3923
|
lg: "w-4 h-4"
|
|
3923
3924
|
};
|
|
3924
|
-
FilterPill =
|
|
3925
|
+
FilterPill = React107__default.forwardRef(
|
|
3925
3926
|
({
|
|
3926
3927
|
className,
|
|
3927
3928
|
variant = "default",
|
|
@@ -4050,8 +4051,8 @@ var init_Avatar = __esm({
|
|
|
4050
4051
|
actionPayload
|
|
4051
4052
|
}) => {
|
|
4052
4053
|
const eventBus = useEventBus();
|
|
4053
|
-
const [imgFailed, setImgFailed] =
|
|
4054
|
-
|
|
4054
|
+
const [imgFailed, setImgFailed] = React107__default.useState(false);
|
|
4055
|
+
React107__default.useEffect(() => {
|
|
4055
4056
|
setImgFailed(false);
|
|
4056
4057
|
}, [src]);
|
|
4057
4058
|
const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
|
|
@@ -4164,7 +4165,7 @@ var init_Center = __esm({
|
|
|
4164
4165
|
as: Component = "div"
|
|
4165
4166
|
}) => {
|
|
4166
4167
|
const mergedStyle = minHeight ? { minHeight, ...style } : style;
|
|
4167
|
-
return
|
|
4168
|
+
return React107__default.createElement(Component, {
|
|
4168
4169
|
className: cn(
|
|
4169
4170
|
inline ? "inline-flex" : "flex",
|
|
4170
4171
|
horizontal && "justify-center",
|
|
@@ -4432,7 +4433,7 @@ var init_Radio = __esm({
|
|
|
4432
4433
|
md: "w-2.5 h-2.5",
|
|
4433
4434
|
lg: "w-3 h-3"
|
|
4434
4435
|
};
|
|
4435
|
-
Radio =
|
|
4436
|
+
Radio = React107__default.forwardRef(
|
|
4436
4437
|
({
|
|
4437
4438
|
label,
|
|
4438
4439
|
helperText,
|
|
@@ -4449,12 +4450,12 @@ var init_Radio = __esm({
|
|
|
4449
4450
|
onChange,
|
|
4450
4451
|
...props
|
|
4451
4452
|
}, ref) => {
|
|
4452
|
-
const reactId =
|
|
4453
|
+
const reactId = React107__default.useId();
|
|
4453
4454
|
const baseId = id || `radio-${reactId}`;
|
|
4454
4455
|
const hasError = !!error;
|
|
4455
4456
|
const eventBus = useEventBus();
|
|
4456
|
-
const [selected, setSelected] =
|
|
4457
|
-
|
|
4457
|
+
const [selected, setSelected] = React107__default.useState(value);
|
|
4458
|
+
React107__default.useEffect(() => {
|
|
4458
4459
|
if (value !== void 0) setSelected(value);
|
|
4459
4460
|
}, [value]);
|
|
4460
4461
|
const pick = (next, e) => {
|
|
@@ -4636,7 +4637,7 @@ var init_Switch = __esm({
|
|
|
4636
4637
|
"components/core/atoms/Switch.tsx"() {
|
|
4637
4638
|
"use client";
|
|
4638
4639
|
init_cn();
|
|
4639
|
-
Switch =
|
|
4640
|
+
Switch = React107.forwardRef(
|
|
4640
4641
|
({
|
|
4641
4642
|
checked,
|
|
4642
4643
|
defaultChecked = false,
|
|
@@ -4647,10 +4648,10 @@ var init_Switch = __esm({
|
|
|
4647
4648
|
name,
|
|
4648
4649
|
className
|
|
4649
4650
|
}, ref) => {
|
|
4650
|
-
const [isChecked, setIsChecked] =
|
|
4651
|
+
const [isChecked, setIsChecked] = React107.useState(
|
|
4651
4652
|
checked !== void 0 ? checked : defaultChecked
|
|
4652
4653
|
);
|
|
4653
|
-
|
|
4654
|
+
React107.useEffect(() => {
|
|
4654
4655
|
if (checked !== void 0) {
|
|
4655
4656
|
setIsChecked(checked);
|
|
4656
4657
|
}
|
|
@@ -4809,7 +4810,7 @@ var init_Stack = __esm({
|
|
|
4809
4810
|
};
|
|
4810
4811
|
const isHorizontal = direction === "horizontal";
|
|
4811
4812
|
const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
|
|
4812
|
-
return
|
|
4813
|
+
return React107__default.createElement(
|
|
4813
4814
|
Component,
|
|
4814
4815
|
{
|
|
4815
4816
|
className: cn(
|
|
@@ -5009,7 +5010,7 @@ var Aside;
|
|
|
5009
5010
|
var init_Aside = __esm({
|
|
5010
5011
|
"components/core/atoms/Aside.tsx"() {
|
|
5011
5012
|
init_cn();
|
|
5012
|
-
Aside =
|
|
5013
|
+
Aside = React107__default.forwardRef(
|
|
5013
5014
|
({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
|
|
5014
5015
|
);
|
|
5015
5016
|
Aside.displayName = "Aside";
|
|
@@ -5088,9 +5089,9 @@ var init_LawReferenceTooltip = __esm({
|
|
|
5088
5089
|
className
|
|
5089
5090
|
}) => {
|
|
5090
5091
|
const { t } = useTranslate();
|
|
5091
|
-
const [isVisible, setIsVisible] =
|
|
5092
|
-
const timeoutRef =
|
|
5093
|
-
const triggerRef =
|
|
5092
|
+
const [isVisible, setIsVisible] = React107__default.useState(false);
|
|
5093
|
+
const timeoutRef = React107__default.useRef(null);
|
|
5094
|
+
const triggerRef = React107__default.useRef(null);
|
|
5094
5095
|
const handleMouseEnter = () => {
|
|
5095
5096
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
5096
5097
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -5101,7 +5102,7 @@ var init_LawReferenceTooltip = __esm({
|
|
|
5101
5102
|
};
|
|
5102
5103
|
const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
|
|
5103
5104
|
const open = isVisible || revealed;
|
|
5104
|
-
|
|
5105
|
+
React107__default.useEffect(() => {
|
|
5105
5106
|
return () => {
|
|
5106
5107
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
5107
5108
|
};
|
|
@@ -5311,7 +5312,7 @@ var init_StatusDot = __esm({
|
|
|
5311
5312
|
md: "w-2.5 h-2.5",
|
|
5312
5313
|
lg: "w-3 h-3"
|
|
5313
5314
|
};
|
|
5314
|
-
StatusDot =
|
|
5315
|
+
StatusDot = React107__default.forwardRef(
|
|
5315
5316
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
5316
5317
|
return /* @__PURE__ */ jsx(
|
|
5317
5318
|
"span",
|
|
@@ -5365,7 +5366,7 @@ var init_TrendIndicator = __esm({
|
|
|
5365
5366
|
down: "trending-down",
|
|
5366
5367
|
flat: "arrow-right"
|
|
5367
5368
|
};
|
|
5368
|
-
TrendIndicator =
|
|
5369
|
+
TrendIndicator = React107__default.forwardRef(
|
|
5369
5370
|
({
|
|
5370
5371
|
className,
|
|
5371
5372
|
value,
|
|
@@ -5432,7 +5433,7 @@ var init_RangeSlider = __esm({
|
|
|
5432
5433
|
md: "w-4 h-4",
|
|
5433
5434
|
lg: "w-5 h-5"
|
|
5434
5435
|
};
|
|
5435
|
-
RangeSlider =
|
|
5436
|
+
RangeSlider = React107__default.forwardRef(
|
|
5436
5437
|
({
|
|
5437
5438
|
className,
|
|
5438
5439
|
min = 0,
|
|
@@ -5938,7 +5939,7 @@ var init_ContentSection = __esm({
|
|
|
5938
5939
|
md: "py-16",
|
|
5939
5940
|
lg: "py-24"
|
|
5940
5941
|
};
|
|
5941
|
-
ContentSection =
|
|
5942
|
+
ContentSection = React107__default.forwardRef(
|
|
5942
5943
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
5943
5944
|
return /* @__PURE__ */ jsx(
|
|
5944
5945
|
Box,
|
|
@@ -6472,7 +6473,7 @@ var init_AnimatedReveal = __esm({
|
|
|
6472
6473
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
6473
6474
|
"none": {}
|
|
6474
6475
|
};
|
|
6475
|
-
AnimatedReveal =
|
|
6476
|
+
AnimatedReveal = React107__default.forwardRef(
|
|
6476
6477
|
({
|
|
6477
6478
|
trigger = "scroll",
|
|
6478
6479
|
animation = "fade-up",
|
|
@@ -6632,7 +6633,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
6632
6633
|
"components/marketing/atoms/AnimatedGraphic.tsx"() {
|
|
6633
6634
|
"use client";
|
|
6634
6635
|
init_cn();
|
|
6635
|
-
AnimatedGraphic =
|
|
6636
|
+
AnimatedGraphic = React107__default.forwardRef(
|
|
6636
6637
|
({
|
|
6637
6638
|
src,
|
|
6638
6639
|
svgContent,
|
|
@@ -6655,7 +6656,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
6655
6656
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
6656
6657
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
6657
6658
|
const prevAnimateRef = useRef(animate);
|
|
6658
|
-
const setRef =
|
|
6659
|
+
const setRef = React107__default.useCallback(
|
|
6659
6660
|
(node) => {
|
|
6660
6661
|
containerRef.current = node;
|
|
6661
6662
|
if (typeof ref === "function") ref(node);
|
|
@@ -8275,7 +8276,7 @@ function GameCard({
|
|
|
8275
8276
|
className
|
|
8276
8277
|
}) {
|
|
8277
8278
|
const eventBus = useEventBus();
|
|
8278
|
-
const handleClick =
|
|
8279
|
+
const handleClick = React107.useCallback(() => {
|
|
8279
8280
|
if (disabled) return;
|
|
8280
8281
|
onClick?.(id);
|
|
8281
8282
|
if (clickEvent) eventBus.emit(`UI:${clickEvent}`, { cardId: id });
|
|
@@ -8547,9 +8548,9 @@ function ControlButton({
|
|
|
8547
8548
|
className
|
|
8548
8549
|
}) {
|
|
8549
8550
|
const eventBus = useEventBus();
|
|
8550
|
-
const [isPressed, setIsPressed] =
|
|
8551
|
+
const [isPressed, setIsPressed] = React107.useState(false);
|
|
8551
8552
|
const actualPressed = pressed ?? isPressed;
|
|
8552
|
-
const handlePointerDown =
|
|
8553
|
+
const handlePointerDown = React107.useCallback(
|
|
8553
8554
|
(e) => {
|
|
8554
8555
|
e.preventDefault();
|
|
8555
8556
|
if (disabled) return;
|
|
@@ -8559,7 +8560,7 @@ function ControlButton({
|
|
|
8559
8560
|
},
|
|
8560
8561
|
[disabled, pressEvent, eventBus, onPress]
|
|
8561
8562
|
);
|
|
8562
|
-
const handlePointerUp =
|
|
8563
|
+
const handlePointerUp = React107.useCallback(
|
|
8563
8564
|
(e) => {
|
|
8564
8565
|
e.preventDefault();
|
|
8565
8566
|
if (disabled) return;
|
|
@@ -8569,7 +8570,7 @@ function ControlButton({
|
|
|
8569
8570
|
},
|
|
8570
8571
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
8571
8572
|
);
|
|
8572
|
-
const handlePointerLeave =
|
|
8573
|
+
const handlePointerLeave = React107.useCallback(
|
|
8573
8574
|
(e) => {
|
|
8574
8575
|
if (isPressed) {
|
|
8575
8576
|
setIsPressed(false);
|
|
@@ -9628,8 +9629,8 @@ function MiniMap({
|
|
|
9628
9629
|
viewportRect = DEFAULT_VIEWPORT,
|
|
9629
9630
|
className
|
|
9630
9631
|
}) {
|
|
9631
|
-
const canvasRef =
|
|
9632
|
-
|
|
9632
|
+
const canvasRef = React107.useRef(null);
|
|
9633
|
+
React107.useEffect(() => {
|
|
9633
9634
|
const canvas = canvasRef.current;
|
|
9634
9635
|
if (!canvas) return;
|
|
9635
9636
|
const ctx = canvas.getContext("2d");
|
|
@@ -9779,8 +9780,8 @@ function ControlGrid({
|
|
|
9779
9780
|
className
|
|
9780
9781
|
}) {
|
|
9781
9782
|
const eventBus = useEventBus();
|
|
9782
|
-
const [active, setActive] =
|
|
9783
|
-
const handlePress =
|
|
9783
|
+
const [active, setActive] = React107.useState(/* @__PURE__ */ new Set());
|
|
9784
|
+
const handlePress = React107.useCallback(
|
|
9784
9785
|
(id) => {
|
|
9785
9786
|
setActive((prev) => new Set(prev).add(id));
|
|
9786
9787
|
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
@@ -9792,7 +9793,7 @@ function ControlGrid({
|
|
|
9792
9793
|
},
|
|
9793
9794
|
[kind, actionEvent, directionEvent, eventBus, onAction, onDirection]
|
|
9794
9795
|
);
|
|
9795
|
-
const handleRelease =
|
|
9796
|
+
const handleRelease = React107.useCallback(
|
|
9796
9797
|
(id) => {
|
|
9797
9798
|
setActive((prev) => {
|
|
9798
9799
|
const next = new Set(prev);
|
|
@@ -10053,7 +10054,7 @@ function InventoryGrid({
|
|
|
10053
10054
|
const eventBus = useEventBus();
|
|
10054
10055
|
const slotCount = totalSlots ?? items.length;
|
|
10055
10056
|
const emptySlotCount = Math.max(0, slotCount - items.length);
|
|
10056
|
-
const handleSelect =
|
|
10057
|
+
const handleSelect = React107.useCallback(
|
|
10057
10058
|
(id) => {
|
|
10058
10059
|
onSelect?.(id);
|
|
10059
10060
|
if (selectEvent) {
|
|
@@ -10256,7 +10257,7 @@ function GameMenu({
|
|
|
10256
10257
|
} catch {
|
|
10257
10258
|
}
|
|
10258
10259
|
const eventBus = eventBusProp || eventBusFromHook;
|
|
10259
|
-
const handleOptionClick =
|
|
10260
|
+
const handleOptionClick = React107.useCallback(
|
|
10260
10261
|
(option) => {
|
|
10261
10262
|
if (option.event && eventBus) {
|
|
10262
10263
|
eventBus.emit(`UI:${option.event}`, { option });
|
|
@@ -12099,6 +12100,24 @@ var init_useCanvasEffects = __esm({
|
|
|
12099
12100
|
"use client";
|
|
12100
12101
|
}
|
|
12101
12102
|
});
|
|
12103
|
+
var init_useGameAudio = __esm({
|
|
12104
|
+
"components/game/shared/hooks/useGameAudio.ts"() {
|
|
12105
|
+
"use client";
|
|
12106
|
+
}
|
|
12107
|
+
});
|
|
12108
|
+
function useGameAudioContextOptional() {
|
|
12109
|
+
return useContext(GameAudioContext);
|
|
12110
|
+
}
|
|
12111
|
+
var GameAudioContext;
|
|
12112
|
+
var init_GameAudioProvider = __esm({
|
|
12113
|
+
"components/game/shared/providers/GameAudioProvider.tsx"() {
|
|
12114
|
+
"use client";
|
|
12115
|
+
init_useEventBus();
|
|
12116
|
+
init_useGameAudio();
|
|
12117
|
+
GameAudioContext = createContext(null);
|
|
12118
|
+
GameAudioContext.displayName = "GameAudioContext";
|
|
12119
|
+
}
|
|
12120
|
+
});
|
|
12102
12121
|
function GameAudioToggle({
|
|
12103
12122
|
size = "sm",
|
|
12104
12123
|
className
|
|
@@ -12127,6 +12146,7 @@ var init_GameAudioToggle = __esm({
|
|
|
12127
12146
|
"use client";
|
|
12128
12147
|
init_atoms();
|
|
12129
12148
|
init_cn();
|
|
12149
|
+
init_GameAudioProvider();
|
|
12130
12150
|
GameAudioToggle.displayName = "GameAudioToggle";
|
|
12131
12151
|
}
|
|
12132
12152
|
});
|
|
@@ -15794,7 +15814,7 @@ function LinearView({
|
|
|
15794
15814
|
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
|
|
15795
15815
|
const isDone = i < currentIdx;
|
|
15796
15816
|
const isCurrent = i === currentIdx;
|
|
15797
|
-
return /* @__PURE__ */ jsxs(
|
|
15817
|
+
return /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
15798
15818
|
i > 0 && /* @__PURE__ */ jsx(
|
|
15799
15819
|
Typography,
|
|
15800
15820
|
{
|
|
@@ -16322,7 +16342,7 @@ function SequenceBar({
|
|
|
16322
16342
|
onSlotRemove(index);
|
|
16323
16343
|
}, [onSlotRemove, playing]);
|
|
16324
16344
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
16325
|
-
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(
|
|
16345
|
+
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
16326
16346
|
i > 0 && /* @__PURE__ */ jsx(
|
|
16327
16347
|
Typography,
|
|
16328
16348
|
{
|
|
@@ -18749,10 +18769,10 @@ function getSlotContentRenderer2() {
|
|
|
18749
18769
|
}
|
|
18750
18770
|
function resolveDescriptor(value, idPrefix) {
|
|
18751
18771
|
if (value === null || value === void 0) return value;
|
|
18752
|
-
if (
|
|
18772
|
+
if (React107__default.isValidElement(value)) return value;
|
|
18753
18773
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
18754
18774
|
if (Array.isArray(value)) {
|
|
18755
|
-
return value.map((item, i) => /* @__PURE__ */ jsx(
|
|
18775
|
+
return value.map((item, i) => /* @__PURE__ */ jsx(React107__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
|
|
18756
18776
|
}
|
|
18757
18777
|
if (typeof value === "object") {
|
|
18758
18778
|
const rec = value;
|
|
@@ -18888,7 +18908,7 @@ var init_GameTemplate = __esm({
|
|
|
18888
18908
|
}
|
|
18889
18909
|
});
|
|
18890
18910
|
function asDescriptor(v) {
|
|
18891
|
-
if (Array.isArray(v) ||
|
|
18911
|
+
if (Array.isArray(v) || React107__default.isValidElement(v)) return null;
|
|
18892
18912
|
const o = v;
|
|
18893
18913
|
if (typeof o.type !== "string") return null;
|
|
18894
18914
|
const props = o.props !== void 0 && typeof o.props === "object" && !Array.isArray(o.props) && o.props !== null ? o.props : void 0;
|
|
@@ -18903,10 +18923,10 @@ function getSlotContentRenderer3() {
|
|
|
18903
18923
|
}
|
|
18904
18924
|
function resolveDescriptor2(value, idPrefix) {
|
|
18905
18925
|
if (value === null || value === void 0) return value;
|
|
18906
|
-
if (
|
|
18926
|
+
if (React107__default.isValidElement(value)) return value;
|
|
18907
18927
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
18908
18928
|
if (Array.isArray(value)) {
|
|
18909
|
-
return value.map((item, i) => /* @__PURE__ */ jsx(
|
|
18929
|
+
return value.map((item, i) => /* @__PURE__ */ jsx(React107__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
|
|
18910
18930
|
}
|
|
18911
18931
|
if (typeof value === "object" && value !== null) {
|
|
18912
18932
|
const desc = asDescriptor(value);
|
|
@@ -19790,6 +19810,8 @@ var init_CardBattlerTemplate = __esm({
|
|
|
19790
19810
|
CardBattlerTemplate.displayName = "CardBattlerTemplate";
|
|
19791
19811
|
}
|
|
19792
19812
|
});
|
|
19813
|
+
|
|
19814
|
+
// components/game/2d/molecules/index.ts
|
|
19793
19815
|
var init_molecules = __esm({
|
|
19794
19816
|
"components/game/2d/molecules/index.ts"() {
|
|
19795
19817
|
init_shared();
|
|
@@ -19884,7 +19906,7 @@ var init_ErrorBoundary = __esm({
|
|
|
19884
19906
|
}
|
|
19885
19907
|
);
|
|
19886
19908
|
};
|
|
19887
|
-
ErrorBoundary = class extends
|
|
19909
|
+
ErrorBoundary = class extends React107__default.Component {
|
|
19888
19910
|
constructor(props) {
|
|
19889
19911
|
super(props);
|
|
19890
19912
|
__publicField(this, "reset", () => {
|
|
@@ -20549,7 +20571,7 @@ var init_Container = __esm({
|
|
|
20549
20571
|
as: Component = "div"
|
|
20550
20572
|
}) => {
|
|
20551
20573
|
const resolvedSize = maxWidth ?? size ?? "lg";
|
|
20552
|
-
return
|
|
20574
|
+
return React107__default.createElement(
|
|
20553
20575
|
Component,
|
|
20554
20576
|
{
|
|
20555
20577
|
className: cn(
|
|
@@ -23157,7 +23179,7 @@ var init_CodeBlock = __esm({
|
|
|
23157
23179
|
};
|
|
23158
23180
|
LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
23159
23181
|
HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
23160
|
-
CodeBlock =
|
|
23182
|
+
CodeBlock = React107__default.memo(
|
|
23161
23183
|
({
|
|
23162
23184
|
code: rawCode,
|
|
23163
23185
|
language = "text",
|
|
@@ -23744,7 +23766,7 @@ var init_MarkdownContent = __esm({
|
|
|
23744
23766
|
init_Box();
|
|
23745
23767
|
init_CodeBlock();
|
|
23746
23768
|
init_cn();
|
|
23747
|
-
MarkdownContent =
|
|
23769
|
+
MarkdownContent = React107__default.memo(
|
|
23748
23770
|
({ content, direction = "ltr", className }) => {
|
|
23749
23771
|
const { t: _t } = useTranslate();
|
|
23750
23772
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -25071,7 +25093,7 @@ var init_StateMachineView = __esm({
|
|
|
25071
25093
|
style: { top: title ? 30 : 0 },
|
|
25072
25094
|
children: [
|
|
25073
25095
|
entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
|
|
25074
|
-
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(
|
|
25096
|
+
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React107__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
|
|
25075
25097
|
StateNode2,
|
|
25076
25098
|
{
|
|
25077
25099
|
state,
|
|
@@ -30700,8 +30722,8 @@ var init_Menu = __esm({
|
|
|
30700
30722
|
"bottom-end": "bottom-start"
|
|
30701
30723
|
};
|
|
30702
30724
|
const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
|
|
30703
|
-
const triggerChild =
|
|
30704
|
-
const triggerElement =
|
|
30725
|
+
const triggerChild = React107__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
|
|
30726
|
+
const triggerElement = React107__default.cloneElement(
|
|
30705
30727
|
triggerChild,
|
|
30706
30728
|
{
|
|
30707
30729
|
ref: triggerRef,
|
|
@@ -30796,14 +30818,14 @@ function useDataDnd(args) {
|
|
|
30796
30818
|
const isZone = Boolean(dragGroup || accepts || sortable);
|
|
30797
30819
|
const enabled = isZone || Boolean(dndRoot);
|
|
30798
30820
|
const eventBus = useEventBus();
|
|
30799
|
-
const parentRoot =
|
|
30821
|
+
const parentRoot = React107__default.useContext(RootCtx);
|
|
30800
30822
|
const isRoot = enabled && parentRoot === null;
|
|
30801
|
-
const zoneId =
|
|
30823
|
+
const zoneId = React107__default.useId();
|
|
30802
30824
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
30803
|
-
const [optimisticOrders, setOptimisticOrders] =
|
|
30804
|
-
const optimisticOrdersRef =
|
|
30825
|
+
const [optimisticOrders, setOptimisticOrders] = React107__default.useState(() => /* @__PURE__ */ new Map());
|
|
30826
|
+
const optimisticOrdersRef = React107__default.useRef(optimisticOrders);
|
|
30805
30827
|
optimisticOrdersRef.current = optimisticOrders;
|
|
30806
|
-
const clearOptimisticOrder =
|
|
30828
|
+
const clearOptimisticOrder = React107__default.useCallback((group) => {
|
|
30807
30829
|
setOptimisticOrders((prev) => {
|
|
30808
30830
|
if (!prev.has(group)) return prev;
|
|
30809
30831
|
const next = new Map(prev);
|
|
@@ -30828,7 +30850,7 @@ function useDataDnd(args) {
|
|
|
30828
30850
|
const raw = it[dndItemIdField];
|
|
30829
30851
|
return raw != null ? String(raw) : `__idx_${idx}`;
|
|
30830
30852
|
}).join("|");
|
|
30831
|
-
const itemIds =
|
|
30853
|
+
const itemIds = React107__default.useMemo(
|
|
30832
30854
|
() => orderedItems.map((it, idx) => {
|
|
30833
30855
|
const raw = it[dndItemIdField];
|
|
30834
30856
|
return raw != null ? String(raw) : `__idx_${idx}`;
|
|
@@ -30839,7 +30861,7 @@ function useDataDnd(args) {
|
|
|
30839
30861
|
const raw = it[dndItemIdField];
|
|
30840
30862
|
return raw != null ? String(raw) : `__${idx}`;
|
|
30841
30863
|
}).join("|");
|
|
30842
|
-
|
|
30864
|
+
React107__default.useEffect(() => {
|
|
30843
30865
|
const root = isRoot ? null : parentRoot;
|
|
30844
30866
|
if (root) {
|
|
30845
30867
|
root.clearOptimisticOrder(ownGroup);
|
|
@@ -30847,20 +30869,20 @@ function useDataDnd(args) {
|
|
|
30847
30869
|
clearOptimisticOrder(ownGroup);
|
|
30848
30870
|
}
|
|
30849
30871
|
}, [itemsContentSig, ownGroup]);
|
|
30850
|
-
const zonesRef =
|
|
30851
|
-
const registerZone =
|
|
30872
|
+
const zonesRef = React107__default.useRef(/* @__PURE__ */ new Map());
|
|
30873
|
+
const registerZone = React107__default.useCallback((zoneId2, meta2) => {
|
|
30852
30874
|
zonesRef.current.set(zoneId2, meta2);
|
|
30853
30875
|
}, []);
|
|
30854
|
-
const unregisterZone =
|
|
30876
|
+
const unregisterZone = React107__default.useCallback((zoneId2) => {
|
|
30855
30877
|
zonesRef.current.delete(zoneId2);
|
|
30856
30878
|
}, []);
|
|
30857
|
-
const [activeDrag, setActiveDrag] =
|
|
30858
|
-
const [overZoneGroup, setOverZoneGroup] =
|
|
30859
|
-
const meta =
|
|
30879
|
+
const [activeDrag, setActiveDrag] = React107__default.useState(null);
|
|
30880
|
+
const [overZoneGroup, setOverZoneGroup] = React107__default.useState(null);
|
|
30881
|
+
const meta = React107__default.useMemo(
|
|
30860
30882
|
() => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
|
|
30861
30883
|
[ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
|
|
30862
30884
|
);
|
|
30863
|
-
|
|
30885
|
+
React107__default.useEffect(() => {
|
|
30864
30886
|
const target = isRoot ? null : parentRoot;
|
|
30865
30887
|
if (!target) {
|
|
30866
30888
|
zonesRef.current.set(zoneId, meta);
|
|
@@ -30879,7 +30901,7 @@ function useDataDnd(args) {
|
|
|
30879
30901
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
30880
30902
|
const sensors = useAlmadarDndSensors(true);
|
|
30881
30903
|
const collisionDetection = almadarDndCollisionDetection;
|
|
30882
|
-
const findZoneByItem =
|
|
30904
|
+
const findZoneByItem = React107__default.useCallback(
|
|
30883
30905
|
(id) => {
|
|
30884
30906
|
for (const z of zonesRef.current.values()) {
|
|
30885
30907
|
if (z.itemIds.includes(id)) return z;
|
|
@@ -30888,7 +30910,7 @@ function useDataDnd(args) {
|
|
|
30888
30910
|
},
|
|
30889
30911
|
[]
|
|
30890
30912
|
);
|
|
30891
|
-
|
|
30913
|
+
React107__default.useCallback(
|
|
30892
30914
|
(group) => {
|
|
30893
30915
|
for (const z of zonesRef.current.values()) {
|
|
30894
30916
|
if (z.group === group) return z;
|
|
@@ -30897,7 +30919,7 @@ function useDataDnd(args) {
|
|
|
30897
30919
|
},
|
|
30898
30920
|
[]
|
|
30899
30921
|
);
|
|
30900
|
-
const handleDragEnd =
|
|
30922
|
+
const handleDragEnd = React107__default.useCallback(
|
|
30901
30923
|
(event) => {
|
|
30902
30924
|
const { active, over } = event;
|
|
30903
30925
|
const activeIdStr = String(active.id);
|
|
@@ -30988,8 +31010,8 @@ function useDataDnd(args) {
|
|
|
30988
31010
|
},
|
|
30989
31011
|
[eventBus]
|
|
30990
31012
|
);
|
|
30991
|
-
const sortableData =
|
|
30992
|
-
const SortableItem =
|
|
31013
|
+
const sortableData = React107__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
31014
|
+
const SortableItem = React107__default.useCallback(
|
|
30993
31015
|
({ id, children }) => {
|
|
30994
31016
|
const {
|
|
30995
31017
|
attributes,
|
|
@@ -31029,7 +31051,7 @@ function useDataDnd(args) {
|
|
|
31029
31051
|
id: droppableId,
|
|
31030
31052
|
data: sortableData
|
|
31031
31053
|
});
|
|
31032
|
-
const ctx =
|
|
31054
|
+
const ctx = React107__default.useContext(RootCtx);
|
|
31033
31055
|
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
31034
31056
|
const overZoneGroup2 = ctx?.overZoneGroup ?? null;
|
|
31035
31057
|
const isThisZoneOver = overZoneGroup2 === ownGroup;
|
|
@@ -31044,7 +31066,7 @@ function useDataDnd(args) {
|
|
|
31044
31066
|
showForeignPlaceholder,
|
|
31045
31067
|
ctxAvailable: ctx != null
|
|
31046
31068
|
});
|
|
31047
|
-
|
|
31069
|
+
React107__default.useEffect(() => {
|
|
31048
31070
|
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
31049
31071
|
}, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
|
|
31050
31072
|
return /* @__PURE__ */ jsx(
|
|
@@ -31058,11 +31080,11 @@ function useDataDnd(args) {
|
|
|
31058
31080
|
}
|
|
31059
31081
|
);
|
|
31060
31082
|
};
|
|
31061
|
-
const rootContextValue =
|
|
31083
|
+
const rootContextValue = React107__default.useMemo(
|
|
31062
31084
|
() => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
|
|
31063
31085
|
[registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
|
|
31064
31086
|
);
|
|
31065
|
-
const handleDragStart =
|
|
31087
|
+
const handleDragStart = React107__default.useCallback((event) => {
|
|
31066
31088
|
const sourceZone = findZoneByItem(event.active.id);
|
|
31067
31089
|
const rect = event.active.rect.current.initial;
|
|
31068
31090
|
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
@@ -31081,7 +31103,7 @@ function useDataDnd(args) {
|
|
|
31081
31103
|
isRoot
|
|
31082
31104
|
});
|
|
31083
31105
|
}, [findZoneByItem, isRoot, zoneId]);
|
|
31084
|
-
const handleDragOver =
|
|
31106
|
+
const handleDragOver = React107__default.useCallback((event) => {
|
|
31085
31107
|
const { active, over } = event;
|
|
31086
31108
|
const overData = over?.data?.current;
|
|
31087
31109
|
const overGroup = overData?.dndGroup ?? null;
|
|
@@ -31151,7 +31173,7 @@ function useDataDnd(args) {
|
|
|
31151
31173
|
return next;
|
|
31152
31174
|
});
|
|
31153
31175
|
}, []);
|
|
31154
|
-
const handleDragCancel =
|
|
31176
|
+
const handleDragCancel = React107__default.useCallback((event) => {
|
|
31155
31177
|
setActiveDrag(null);
|
|
31156
31178
|
setOverZoneGroup(null);
|
|
31157
31179
|
dndLog.warn("dragCancel", {
|
|
@@ -31159,12 +31181,12 @@ function useDataDnd(args) {
|
|
|
31159
31181
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
31160
31182
|
});
|
|
31161
31183
|
}, []);
|
|
31162
|
-
const handleDragEndWithCleanup =
|
|
31184
|
+
const handleDragEndWithCleanup = React107__default.useCallback((event) => {
|
|
31163
31185
|
handleDragEnd(event);
|
|
31164
31186
|
setActiveDrag(null);
|
|
31165
31187
|
setOverZoneGroup(null);
|
|
31166
31188
|
}, [handleDragEnd]);
|
|
31167
|
-
const wrapContainer =
|
|
31189
|
+
const wrapContainer = React107__default.useCallback(
|
|
31168
31190
|
(children) => {
|
|
31169
31191
|
if (!enabled) return children;
|
|
31170
31192
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
@@ -31218,7 +31240,7 @@ var init_useDataDnd = __esm({
|
|
|
31218
31240
|
init_useAlmadarDndCollision();
|
|
31219
31241
|
init_Box();
|
|
31220
31242
|
dndLog = createLogger("almadar:ui:dnd");
|
|
31221
|
-
RootCtx =
|
|
31243
|
+
RootCtx = React107__default.createContext(null);
|
|
31222
31244
|
}
|
|
31223
31245
|
});
|
|
31224
31246
|
function renderIconInput(icon, props) {
|
|
@@ -31744,7 +31766,7 @@ function DataList({
|
|
|
31744
31766
|
}) {
|
|
31745
31767
|
const eventBus = useEventBus();
|
|
31746
31768
|
const { t } = useTranslate();
|
|
31747
|
-
const [visibleCount, setVisibleCount] =
|
|
31769
|
+
const [visibleCount, setVisibleCount] = React107__default.useState(pageSize || Infinity);
|
|
31748
31770
|
const fieldDefs = fields ?? columns ?? [];
|
|
31749
31771
|
const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
31750
31772
|
const dnd = useDataDnd({
|
|
@@ -31763,7 +31785,7 @@ function DataList({
|
|
|
31763
31785
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
31764
31786
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
31765
31787
|
const hasRenderProp = typeof children === "function";
|
|
31766
|
-
|
|
31788
|
+
React107__default.useEffect(() => {
|
|
31767
31789
|
const renderItemTypeOf = typeof schemaRenderItem;
|
|
31768
31790
|
const childrenTypeOf = typeof children;
|
|
31769
31791
|
if (data.length > 0 && !hasRenderProp) {
|
|
@@ -31867,7 +31889,7 @@ function DataList({
|
|
|
31867
31889
|
const items2 = [...data];
|
|
31868
31890
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
31869
31891
|
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
31870
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
31892
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
31871
31893
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
31872
31894
|
group.items.map((itemData, index) => {
|
|
31873
31895
|
const id = itemData.id || `${gi}-${index}`;
|
|
@@ -32008,7 +32030,7 @@ function DataList({
|
|
|
32008
32030
|
className
|
|
32009
32031
|
),
|
|
32010
32032
|
children: [
|
|
32011
|
-
groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
32033
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
32012
32034
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
32013
32035
|
group.items.map(
|
|
32014
32036
|
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
@@ -32801,7 +32823,7 @@ var init_Flex = __esm({
|
|
|
32801
32823
|
flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
|
|
32802
32824
|
}
|
|
32803
32825
|
}
|
|
32804
|
-
return
|
|
32826
|
+
return React107__default.createElement(Component, {
|
|
32805
32827
|
className: cn(
|
|
32806
32828
|
inline ? "inline-flex" : "flex",
|
|
32807
32829
|
directionStyles[direction],
|
|
@@ -32920,7 +32942,7 @@ var init_Grid = __esm({
|
|
|
32920
32942
|
as: Component = "div"
|
|
32921
32943
|
}) => {
|
|
32922
32944
|
const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
|
|
32923
|
-
return
|
|
32945
|
+
return React107__default.createElement(
|
|
32924
32946
|
Component,
|
|
32925
32947
|
{
|
|
32926
32948
|
className: cn(
|
|
@@ -33116,9 +33138,9 @@ var init_Popover = __esm({
|
|
|
33116
33138
|
onMouseLeave: handleClose,
|
|
33117
33139
|
onPointerDown: tapTriggerProps.onPointerDown
|
|
33118
33140
|
};
|
|
33119
|
-
const childElement =
|
|
33141
|
+
const childElement = React107__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
33120
33142
|
const childPointerDown = childElement.props.onPointerDown;
|
|
33121
|
-
const triggerElement =
|
|
33143
|
+
const triggerElement = React107__default.cloneElement(
|
|
33122
33144
|
childElement,
|
|
33123
33145
|
{
|
|
33124
33146
|
ref: triggerRef,
|
|
@@ -33720,9 +33742,9 @@ var init_Tooltip = __esm({
|
|
|
33720
33742
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
33721
33743
|
};
|
|
33722
33744
|
}, []);
|
|
33723
|
-
const triggerElement =
|
|
33745
|
+
const triggerElement = React107__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
33724
33746
|
const childPointerDown = triggerElement.props.onPointerDown;
|
|
33725
|
-
const trigger =
|
|
33747
|
+
const trigger = React107__default.cloneElement(triggerElement, {
|
|
33726
33748
|
ref: triggerRef,
|
|
33727
33749
|
onMouseEnter: handleMouseEnter,
|
|
33728
33750
|
onMouseLeave: handleMouseLeave,
|
|
@@ -33812,7 +33834,7 @@ var init_WizardProgress = __esm({
|
|
|
33812
33834
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
|
|
33813
33835
|
const isActive = index === currentStep;
|
|
33814
33836
|
const isCompleted = index < currentStep;
|
|
33815
|
-
return /* @__PURE__ */ jsxs(
|
|
33837
|
+
return /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
33816
33838
|
/* @__PURE__ */ jsx(
|
|
33817
33839
|
"button",
|
|
33818
33840
|
{
|
|
@@ -35144,13 +35166,13 @@ var init_MapView = __esm({
|
|
|
35144
35166
|
shadowSize: [41, 41]
|
|
35145
35167
|
});
|
|
35146
35168
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
35147
|
-
const { useEffect:
|
|
35169
|
+
const { useEffect: useEffect75, useRef: useRef76, useCallback: useCallback117, useState: useState108 } = React107__default;
|
|
35148
35170
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
35149
35171
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
35150
35172
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
35151
35173
|
const map = useMap();
|
|
35152
|
-
const prevRef =
|
|
35153
|
-
|
|
35174
|
+
const prevRef = useRef76({ centerLat, centerLng, zoom });
|
|
35175
|
+
useEffect75(() => {
|
|
35154
35176
|
const prev = prevRef.current;
|
|
35155
35177
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
35156
35178
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -35161,7 +35183,7 @@ var init_MapView = __esm({
|
|
|
35161
35183
|
}
|
|
35162
35184
|
function MapClickHandler({ onMapClick }) {
|
|
35163
35185
|
const map = useMap();
|
|
35164
|
-
|
|
35186
|
+
useEffect75(() => {
|
|
35165
35187
|
if (!onMapClick) return;
|
|
35166
35188
|
const handler = (e) => {
|
|
35167
35189
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -35189,8 +35211,8 @@ var init_MapView = __esm({
|
|
|
35189
35211
|
showAttribution = true
|
|
35190
35212
|
}) {
|
|
35191
35213
|
const eventBus = useEventBus2();
|
|
35192
|
-
const [clickedPosition, setClickedPosition] =
|
|
35193
|
-
const handleMapClick =
|
|
35214
|
+
const [clickedPosition, setClickedPosition] = useState108(null);
|
|
35215
|
+
const handleMapClick = useCallback117((lat, lng) => {
|
|
35194
35216
|
if (showClickedPin) {
|
|
35195
35217
|
setClickedPosition({ lat, lng });
|
|
35196
35218
|
}
|
|
@@ -35199,7 +35221,7 @@ var init_MapView = __esm({
|
|
|
35199
35221
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
35200
35222
|
}
|
|
35201
35223
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
35202
|
-
const handleMarkerClick =
|
|
35224
|
+
const handleMarkerClick = useCallback117((marker) => {
|
|
35203
35225
|
onMarkerClick?.(marker);
|
|
35204
35226
|
if (markerClickEvent) {
|
|
35205
35227
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -36059,8 +36081,8 @@ function TableView({
|
|
|
36059
36081
|
}) {
|
|
36060
36082
|
const eventBus = useEventBus();
|
|
36061
36083
|
const { t } = useTranslate();
|
|
36062
|
-
const [visibleCount, setVisibleCount] =
|
|
36063
|
-
const [localSelected, setLocalSelected] =
|
|
36084
|
+
const [visibleCount, setVisibleCount] = React107__default.useState(pageSize > 0 ? pageSize : Infinity);
|
|
36085
|
+
const [localSelected, setLocalSelected] = React107__default.useState(/* @__PURE__ */ new Set());
|
|
36064
36086
|
const colDefs = columns ?? fields ?? [];
|
|
36065
36087
|
const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
36066
36088
|
const dnd = useDataDnd({
|
|
@@ -36255,12 +36277,12 @@ function TableView({
|
|
|
36255
36277
|
]
|
|
36256
36278
|
}
|
|
36257
36279
|
);
|
|
36258
|
-
return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(
|
|
36280
|
+
return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React107__default.Fragment, { children: rowInner }, id);
|
|
36259
36281
|
};
|
|
36260
36282
|
const items = Array.from(data);
|
|
36261
36283
|
const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
|
|
36262
36284
|
let runningIndex = 0;
|
|
36263
|
-
const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
36285
|
+
const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
36264
36286
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
|
|
36265
36287
|
group.items.map((row) => renderRow(row, runningIndex++))
|
|
36266
36288
|
] }, gi)) });
|
|
@@ -37617,7 +37639,7 @@ var init_StepFlow = __esm({
|
|
|
37617
37639
|
className
|
|
37618
37640
|
}) => {
|
|
37619
37641
|
if (orientation === "vertical") {
|
|
37620
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
37642
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React107__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
37621
37643
|
/* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
|
|
37622
37644
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
37623
37645
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
|
|
@@ -37628,7 +37650,7 @@ var init_StepFlow = __esm({
|
|
|
37628
37650
|
] })
|
|
37629
37651
|
] }) }, index)) });
|
|
37630
37652
|
}
|
|
37631
|
-
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(
|
|
37653
|
+
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(React107__default.Fragment, { children: [
|
|
37632
37654
|
/* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
37633
37655
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
37634
37656
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -38613,7 +38635,7 @@ var init_LikertScale = __esm({
|
|
|
38613
38635
|
md: "text-base",
|
|
38614
38636
|
lg: "text-lg"
|
|
38615
38637
|
};
|
|
38616
|
-
LikertScale =
|
|
38638
|
+
LikertScale = React107__default.forwardRef(
|
|
38617
38639
|
({
|
|
38618
38640
|
question,
|
|
38619
38641
|
options = DEFAULT_LIKERT_OPTIONS,
|
|
@@ -38625,7 +38647,7 @@ var init_LikertScale = __esm({
|
|
|
38625
38647
|
variant = "radios",
|
|
38626
38648
|
className
|
|
38627
38649
|
}, ref) => {
|
|
38628
|
-
const groupId =
|
|
38650
|
+
const groupId = React107__default.useId();
|
|
38629
38651
|
const eventBus = useEventBus();
|
|
38630
38652
|
const handleSelect = useCallback(
|
|
38631
38653
|
(next) => {
|
|
@@ -40907,7 +40929,7 @@ var init_DocBreadcrumb = __esm({
|
|
|
40907
40929
|
"aria-label": t("aria.breadcrumb"),
|
|
40908
40930
|
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
|
|
40909
40931
|
const isLast = idx === items.length - 1;
|
|
40910
|
-
return /* @__PURE__ */ jsxs(
|
|
40932
|
+
return /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
40911
40933
|
idx > 0 && /* @__PURE__ */ jsx(
|
|
40912
40934
|
Icon,
|
|
40913
40935
|
{
|
|
@@ -41776,7 +41798,7 @@ var init_MiniStateMachine = __esm({
|
|
|
41776
41798
|
const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
|
|
41777
41799
|
const tc = transitionCounts[s.name] ?? 0;
|
|
41778
41800
|
const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
|
|
41779
|
-
return /* @__PURE__ */ jsxs(
|
|
41801
|
+
return /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
41780
41802
|
/* @__PURE__ */ jsx(
|
|
41781
41803
|
AvlState,
|
|
41782
41804
|
{
|
|
@@ -41980,7 +42002,7 @@ var init_PageHeader = __esm({
|
|
|
41980
42002
|
info: "bg-info/10 text-info"
|
|
41981
42003
|
};
|
|
41982
42004
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
41983
|
-
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(
|
|
42005
|
+
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(React107__default.Fragment, { children: [
|
|
41984
42006
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
41985
42007
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
41986
42008
|
"a",
|
|
@@ -42338,7 +42360,7 @@ var init_Section = __esm({
|
|
|
42338
42360
|
as: Component = "section"
|
|
42339
42361
|
}) => {
|
|
42340
42362
|
const hasHeader = title || description || action;
|
|
42341
|
-
return
|
|
42363
|
+
return React107__default.createElement(
|
|
42342
42364
|
Component,
|
|
42343
42365
|
{
|
|
42344
42366
|
className: cn(
|
|
@@ -42704,7 +42726,7 @@ var init_WizardContainer = __esm({
|
|
|
42704
42726
|
const isCompleted = index < currentStep;
|
|
42705
42727
|
const stepKey = step.id ?? step.tabId ?? `step-${index}`;
|
|
42706
42728
|
const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
|
|
42707
|
-
return /* @__PURE__ */ jsxs(
|
|
42729
|
+
return /* @__PURE__ */ jsxs(React107__default.Fragment, { children: [
|
|
42708
42730
|
/* @__PURE__ */ jsx(
|
|
42709
42731
|
Button,
|
|
42710
42732
|
{
|
|
@@ -45137,7 +45159,7 @@ var init_DetailPanel = __esm({
|
|
|
45137
45159
|
}
|
|
45138
45160
|
});
|
|
45139
45161
|
function extractTitle(children) {
|
|
45140
|
-
if (!
|
|
45162
|
+
if (!React107__default.isValidElement(children)) return void 0;
|
|
45141
45163
|
const props = children.props;
|
|
45142
45164
|
if (typeof props.title === "string") {
|
|
45143
45165
|
return props.title;
|
|
@@ -45483,12 +45505,12 @@ var init_Form = __esm({
|
|
|
45483
45505
|
const isSchemaEntity = isOrbitalEntitySchema(entity);
|
|
45484
45506
|
const resolvedEntity = isSchemaEntity ? entity : void 0;
|
|
45485
45507
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
45486
|
-
const normalizedInitialData =
|
|
45508
|
+
const normalizedInitialData = React107__default.useMemo(() => {
|
|
45487
45509
|
const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
|
|
45488
45510
|
const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
|
|
45489
45511
|
return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
|
|
45490
45512
|
}, [entity, initialData]);
|
|
45491
|
-
const entityDerivedFields =
|
|
45513
|
+
const entityDerivedFields = React107__default.useMemo(() => {
|
|
45492
45514
|
if (fields && fields.length > 0) return void 0;
|
|
45493
45515
|
if (!resolvedEntity) return void 0;
|
|
45494
45516
|
return resolvedEntity.fields.map(
|
|
@@ -45509,16 +45531,16 @@ var init_Form = __esm({
|
|
|
45509
45531
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
45510
45532
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
45511
45533
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
45512
|
-
const [formData, setFormData] =
|
|
45534
|
+
const [formData, setFormData] = React107__default.useState(
|
|
45513
45535
|
normalizedInitialData
|
|
45514
45536
|
);
|
|
45515
|
-
const [collapsedSections, setCollapsedSections] =
|
|
45537
|
+
const [collapsedSections, setCollapsedSections] = React107__default.useState(
|
|
45516
45538
|
/* @__PURE__ */ new Set()
|
|
45517
45539
|
);
|
|
45518
|
-
const [submitError, setSubmitError] =
|
|
45519
|
-
const formRef =
|
|
45540
|
+
const [submitError, setSubmitError] = React107__default.useState(null);
|
|
45541
|
+
const formRef = React107__default.useRef(null);
|
|
45520
45542
|
const formMode = props.mode;
|
|
45521
|
-
const mountedRef =
|
|
45543
|
+
const mountedRef = React107__default.useRef(false);
|
|
45522
45544
|
if (!mountedRef.current) {
|
|
45523
45545
|
mountedRef.current = true;
|
|
45524
45546
|
debug("forms", "mount", {
|
|
@@ -45531,7 +45553,7 @@ var init_Form = __esm({
|
|
|
45531
45553
|
});
|
|
45532
45554
|
}
|
|
45533
45555
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
45534
|
-
const evalContext =
|
|
45556
|
+
const evalContext = React107__default.useMemo(
|
|
45535
45557
|
() => ({
|
|
45536
45558
|
formValues: formData,
|
|
45537
45559
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -45540,7 +45562,7 @@ var init_Form = __esm({
|
|
|
45540
45562
|
}),
|
|
45541
45563
|
[formData, externalContext]
|
|
45542
45564
|
);
|
|
45543
|
-
|
|
45565
|
+
React107__default.useEffect(() => {
|
|
45544
45566
|
debug("forms", "initialData-sync", {
|
|
45545
45567
|
mode: formMode,
|
|
45546
45568
|
normalizedInitialData,
|
|
@@ -45551,7 +45573,7 @@ var init_Form = __esm({
|
|
|
45551
45573
|
setFormData(normalizedInitialData);
|
|
45552
45574
|
}
|
|
45553
45575
|
}, [normalizedInitialData]);
|
|
45554
|
-
const processCalculations =
|
|
45576
|
+
const processCalculations = React107__default.useCallback(
|
|
45555
45577
|
(changedFieldId, newFormData) => {
|
|
45556
45578
|
if (!hiddenCalculations.length) return;
|
|
45557
45579
|
const context = {
|
|
@@ -45576,7 +45598,7 @@ var init_Form = __esm({
|
|
|
45576
45598
|
},
|
|
45577
45599
|
[hiddenCalculations, externalContext, eventBus]
|
|
45578
45600
|
);
|
|
45579
|
-
const checkViolations =
|
|
45601
|
+
const checkViolations = React107__default.useCallback(
|
|
45580
45602
|
(changedFieldId, newFormData) => {
|
|
45581
45603
|
if (!violationTriggers.length) return;
|
|
45582
45604
|
const context = {
|
|
@@ -45614,7 +45636,7 @@ var init_Form = __esm({
|
|
|
45614
45636
|
processCalculations(name, newFormData);
|
|
45615
45637
|
checkViolations(name, newFormData);
|
|
45616
45638
|
};
|
|
45617
|
-
const isFieldVisible =
|
|
45639
|
+
const isFieldVisible = React107__default.useCallback(
|
|
45618
45640
|
(fieldName) => {
|
|
45619
45641
|
const condition = conditionalFields[fieldName];
|
|
45620
45642
|
if (!condition) return true;
|
|
@@ -45622,7 +45644,7 @@ var init_Form = __esm({
|
|
|
45622
45644
|
},
|
|
45623
45645
|
[conditionalFields, evalContext]
|
|
45624
45646
|
);
|
|
45625
|
-
const isSectionVisible =
|
|
45647
|
+
const isSectionVisible = React107__default.useCallback(
|
|
45626
45648
|
(section) => {
|
|
45627
45649
|
if (!section.condition) return true;
|
|
45628
45650
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -45698,7 +45720,7 @@ var init_Form = __esm({
|
|
|
45698
45720
|
eventBus.emit(`UI:${onCancel}`);
|
|
45699
45721
|
}
|
|
45700
45722
|
};
|
|
45701
|
-
const renderField =
|
|
45723
|
+
const renderField = React107__default.useCallback(
|
|
45702
45724
|
(field) => {
|
|
45703
45725
|
const fieldName = field.name || field.field;
|
|
45704
45726
|
if (!fieldName) return null;
|
|
@@ -45719,7 +45741,7 @@ var init_Form = __esm({
|
|
|
45719
45741
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
45720
45742
|
);
|
|
45721
45743
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
45722
|
-
const normalizedFields =
|
|
45744
|
+
const normalizedFields = React107__default.useMemo(() => {
|
|
45723
45745
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
45724
45746
|
return effectiveFields.map((field) => {
|
|
45725
45747
|
if (typeof field === "string") {
|
|
@@ -45743,7 +45765,7 @@ var init_Form = __esm({
|
|
|
45743
45765
|
return field;
|
|
45744
45766
|
});
|
|
45745
45767
|
}, [effectiveFields, resolvedEntity]);
|
|
45746
|
-
const schemaFields =
|
|
45768
|
+
const schemaFields = React107__default.useMemo(() => {
|
|
45747
45769
|
if (normalizedFields.length === 0) return null;
|
|
45748
45770
|
if (isDebugEnabled()) {
|
|
45749
45771
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -45753,7 +45775,7 @@ var init_Form = __esm({
|
|
|
45753
45775
|
}
|
|
45754
45776
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
45755
45777
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
45756
|
-
const sectionElements =
|
|
45778
|
+
const sectionElements = React107__default.useMemo(() => {
|
|
45757
45779
|
if (!sections || sections.length === 0) return null;
|
|
45758
45780
|
return sections.map((section) => {
|
|
45759
45781
|
if (!isSectionVisible(section)) {
|
|
@@ -46478,7 +46500,7 @@ var init_List = __esm({
|
|
|
46478
46500
|
if (entity && typeof entity === "object" && "id" in entity) return [entity];
|
|
46479
46501
|
return [];
|
|
46480
46502
|
}, [entity]);
|
|
46481
|
-
const getItemActions =
|
|
46503
|
+
const getItemActions = React107__default.useCallback(
|
|
46482
46504
|
(item) => {
|
|
46483
46505
|
if (!itemActions) return [];
|
|
46484
46506
|
if (typeof itemActions === "function") {
|
|
@@ -46953,7 +46975,7 @@ var init_MediaGallery = __esm({
|
|
|
46953
46975
|
[selectable, selectedItems, selectionEvent, eventBus]
|
|
46954
46976
|
);
|
|
46955
46977
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
46956
|
-
const items =
|
|
46978
|
+
const items = React107__default.useMemo(() => {
|
|
46957
46979
|
if (propItems) return propItems;
|
|
46958
46980
|
if (entityData.length === 0) return [];
|
|
46959
46981
|
return entityData.map((record, idx) => {
|
|
@@ -47116,7 +47138,7 @@ var init_MediaGallery = __esm({
|
|
|
47116
47138
|
}
|
|
47117
47139
|
});
|
|
47118
47140
|
function extractTitle2(children) {
|
|
47119
|
-
if (!
|
|
47141
|
+
if (!React107__default.isValidElement(children)) return void 0;
|
|
47120
47142
|
const props = children.props;
|
|
47121
47143
|
if (typeof props.title === "string") {
|
|
47122
47144
|
return props.title;
|
|
@@ -47367,7 +47389,7 @@ var init_debugRegistry = __esm({
|
|
|
47367
47389
|
}
|
|
47368
47390
|
});
|
|
47369
47391
|
function useDebugData() {
|
|
47370
|
-
const [data, setData] =
|
|
47392
|
+
const [data, setData] = React107.useState(() => ({
|
|
47371
47393
|
traits: [],
|
|
47372
47394
|
ticks: [],
|
|
47373
47395
|
guards: [],
|
|
@@ -47381,7 +47403,7 @@ function useDebugData() {
|
|
|
47381
47403
|
},
|
|
47382
47404
|
lastUpdate: Date.now()
|
|
47383
47405
|
}));
|
|
47384
|
-
|
|
47406
|
+
React107.useEffect(() => {
|
|
47385
47407
|
const updateData = () => {
|
|
47386
47408
|
setData({
|
|
47387
47409
|
traits: getAllTraits(),
|
|
@@ -47490,12 +47512,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
|
|
|
47490
47512
|
return positions;
|
|
47491
47513
|
}
|
|
47492
47514
|
function WalkMinimap() {
|
|
47493
|
-
const [walkStep, setWalkStep] =
|
|
47494
|
-
const [traits2, setTraits] =
|
|
47495
|
-
const [coveredEdges, setCoveredEdges] =
|
|
47496
|
-
const [completedTraits, setCompletedTraits] =
|
|
47497
|
-
const prevTraitRef =
|
|
47498
|
-
|
|
47515
|
+
const [walkStep, setWalkStep] = React107.useState(null);
|
|
47516
|
+
const [traits2, setTraits] = React107.useState([]);
|
|
47517
|
+
const [coveredEdges, setCoveredEdges] = React107.useState([]);
|
|
47518
|
+
const [completedTraits, setCompletedTraits] = React107.useState(/* @__PURE__ */ new Set());
|
|
47519
|
+
const prevTraitRef = React107.useRef(null);
|
|
47520
|
+
React107.useEffect(() => {
|
|
47499
47521
|
const interval = setInterval(() => {
|
|
47500
47522
|
const w = window;
|
|
47501
47523
|
const step = w.__orbitalWalkStep;
|
|
@@ -47931,15 +47953,15 @@ var init_EntitiesTab = __esm({
|
|
|
47931
47953
|
});
|
|
47932
47954
|
function EventFlowTab({ events: events2 }) {
|
|
47933
47955
|
const { t } = useTranslate();
|
|
47934
|
-
const [filter, setFilter] =
|
|
47935
|
-
const containerRef =
|
|
47936
|
-
const [autoScroll, setAutoScroll] =
|
|
47937
|
-
|
|
47956
|
+
const [filter, setFilter] = React107.useState("all");
|
|
47957
|
+
const containerRef = React107.useRef(null);
|
|
47958
|
+
const [autoScroll, setAutoScroll] = React107.useState(true);
|
|
47959
|
+
React107.useEffect(() => {
|
|
47938
47960
|
if (autoScroll && containerRef.current) {
|
|
47939
47961
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
47940
47962
|
}
|
|
47941
47963
|
}, [events2.length, autoScroll]);
|
|
47942
|
-
const filteredEvents =
|
|
47964
|
+
const filteredEvents = React107.useMemo(() => {
|
|
47943
47965
|
if (filter === "all") return events2;
|
|
47944
47966
|
return events2.filter((e) => e.type === filter);
|
|
47945
47967
|
}, [events2, filter]);
|
|
@@ -48055,7 +48077,7 @@ var init_EventFlowTab = __esm({
|
|
|
48055
48077
|
});
|
|
48056
48078
|
function GuardsPanel({ guards }) {
|
|
48057
48079
|
const { t } = useTranslate();
|
|
48058
|
-
const [filter, setFilter] =
|
|
48080
|
+
const [filter, setFilter] = React107.useState("all");
|
|
48059
48081
|
if (guards.length === 0) {
|
|
48060
48082
|
return /* @__PURE__ */ jsx(
|
|
48061
48083
|
EmptyState,
|
|
@@ -48068,7 +48090,7 @@ function GuardsPanel({ guards }) {
|
|
|
48068
48090
|
}
|
|
48069
48091
|
const passedCount = guards.filter((g) => g.result).length;
|
|
48070
48092
|
const failedCount = guards.length - passedCount;
|
|
48071
|
-
const filteredGuards =
|
|
48093
|
+
const filteredGuards = React107.useMemo(() => {
|
|
48072
48094
|
if (filter === "all") return guards;
|
|
48073
48095
|
if (filter === "passed") return guards.filter((g) => g.result);
|
|
48074
48096
|
return guards.filter((g) => !g.result);
|
|
@@ -48231,10 +48253,10 @@ function EffectBadge({ effect }) {
|
|
|
48231
48253
|
}
|
|
48232
48254
|
function TransitionTimeline({ transitions }) {
|
|
48233
48255
|
const { t } = useTranslate();
|
|
48234
|
-
const containerRef =
|
|
48235
|
-
const [autoScroll, setAutoScroll] =
|
|
48236
|
-
const [expandedId, setExpandedId] =
|
|
48237
|
-
|
|
48256
|
+
const containerRef = React107.useRef(null);
|
|
48257
|
+
const [autoScroll, setAutoScroll] = React107.useState(true);
|
|
48258
|
+
const [expandedId, setExpandedId] = React107.useState(null);
|
|
48259
|
+
React107.useEffect(() => {
|
|
48238
48260
|
if (autoScroll && containerRef.current) {
|
|
48239
48261
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
48240
48262
|
}
|
|
@@ -48514,9 +48536,9 @@ function getAllEvents(traits2) {
|
|
|
48514
48536
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
48515
48537
|
const eventBus = useEventBus();
|
|
48516
48538
|
const { t } = useTranslate();
|
|
48517
|
-
const [
|
|
48518
|
-
const prevStatesRef =
|
|
48519
|
-
|
|
48539
|
+
const [log13, setLog] = React107.useState([]);
|
|
48540
|
+
const prevStatesRef = React107.useRef(/* @__PURE__ */ new Map());
|
|
48541
|
+
React107.useEffect(() => {
|
|
48520
48542
|
for (const trait of traits2) {
|
|
48521
48543
|
const prev = prevStatesRef.current.get(trait.id);
|
|
48522
48544
|
if (prev && prev !== trait.currentState) {
|
|
@@ -48578,9 +48600,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
|
|
|
48578
48600
|
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.otherEvents") }),
|
|
48579
48601
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
|
|
48580
48602
|
] }),
|
|
48581
|
-
|
|
48603
|
+
log13.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
48582
48604
|
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.recentTransitions") }),
|
|
48583
|
-
/* @__PURE__ */ jsx(Stack, { gap: "xs", children:
|
|
48605
|
+
/* @__PURE__ */ jsx(Stack, { gap: "xs", children: log13.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
|
|
48584
48606
|
/* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
|
|
48585
48607
|
" ",
|
|
48586
48608
|
/* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
|
|
@@ -48685,10 +48707,10 @@ function VerifyModePanel({
|
|
|
48685
48707
|
localCount
|
|
48686
48708
|
}) {
|
|
48687
48709
|
const { t } = useTranslate();
|
|
48688
|
-
const [expanded, setExpanded] =
|
|
48689
|
-
const scrollRef =
|
|
48690
|
-
const prevCountRef =
|
|
48691
|
-
|
|
48710
|
+
const [expanded, setExpanded] = React107.useState(true);
|
|
48711
|
+
const scrollRef = React107.useRef(null);
|
|
48712
|
+
const prevCountRef = React107.useRef(0);
|
|
48713
|
+
React107.useEffect(() => {
|
|
48692
48714
|
if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
|
|
48693
48715
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
48694
48716
|
}
|
|
@@ -48745,10 +48767,10 @@ function RuntimeDebugger({
|
|
|
48745
48767
|
schema
|
|
48746
48768
|
}) {
|
|
48747
48769
|
const { t } = useTranslate();
|
|
48748
|
-
const [isCollapsed, setIsCollapsed] =
|
|
48749
|
-
const [isVisible, setIsVisible] =
|
|
48770
|
+
const [isCollapsed, setIsCollapsed] = React107.useState(mode === "verify" ? true : defaultCollapsed);
|
|
48771
|
+
const [isVisible, setIsVisible] = React107.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
|
|
48750
48772
|
const debugData = useDebugData();
|
|
48751
|
-
|
|
48773
|
+
React107.useEffect(() => {
|
|
48752
48774
|
if (mode === "inline") return;
|
|
48753
48775
|
return onDebugToggle((enabled) => {
|
|
48754
48776
|
setIsVisible(enabled);
|
|
@@ -48757,7 +48779,7 @@ function RuntimeDebugger({
|
|
|
48757
48779
|
}
|
|
48758
48780
|
});
|
|
48759
48781
|
}, [mode]);
|
|
48760
|
-
|
|
48782
|
+
React107.useEffect(() => {
|
|
48761
48783
|
if (mode === "inline") return;
|
|
48762
48784
|
const handleKeyDown = (e) => {
|
|
48763
48785
|
if (e.key === "`" && isVisible) {
|
|
@@ -49277,7 +49299,7 @@ var init_StatCard = __esm({
|
|
|
49277
49299
|
const labelToUse = propLabel ?? propTitle;
|
|
49278
49300
|
const eventBus = useEventBus();
|
|
49279
49301
|
const { t } = useTranslate();
|
|
49280
|
-
const handleActionClick =
|
|
49302
|
+
const handleActionClick = React107__default.useCallback(() => {
|
|
49281
49303
|
if (action?.event) {
|
|
49282
49304
|
eventBus.emit(`UI:${action.event}`, {});
|
|
49283
49305
|
}
|
|
@@ -49288,7 +49310,7 @@ var init_StatCard = __esm({
|
|
|
49288
49310
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
49289
49311
|
const isLoading = externalLoading ?? false;
|
|
49290
49312
|
const error = externalError;
|
|
49291
|
-
const computeMetricValue =
|
|
49313
|
+
const computeMetricValue = React107__default.useCallback(
|
|
49292
49314
|
(metric, items) => {
|
|
49293
49315
|
if (metric.value !== void 0) {
|
|
49294
49316
|
return metric.value;
|
|
@@ -49327,7 +49349,7 @@ var init_StatCard = __esm({
|
|
|
49327
49349
|
},
|
|
49328
49350
|
[]
|
|
49329
49351
|
);
|
|
49330
|
-
const schemaStats =
|
|
49352
|
+
const schemaStats = React107__default.useMemo(() => {
|
|
49331
49353
|
if (!metrics || metrics.length === 0) return null;
|
|
49332
49354
|
return metrics.map((metric) => ({
|
|
49333
49355
|
label: metric.label,
|
|
@@ -49335,7 +49357,7 @@ var init_StatCard = __esm({
|
|
|
49335
49357
|
format: metric.format
|
|
49336
49358
|
}));
|
|
49337
49359
|
}, [metrics, data, computeMetricValue]);
|
|
49338
|
-
const calculatedTrend =
|
|
49360
|
+
const calculatedTrend = React107__default.useMemo(() => {
|
|
49339
49361
|
if (manualTrend !== void 0) return manualTrend;
|
|
49340
49362
|
if (previousValue === void 0 || currentValue === void 0)
|
|
49341
49363
|
return void 0;
|
|
@@ -49975,8 +49997,8 @@ var init_SubagentTracePanel = __esm({
|
|
|
49975
49997
|
] });
|
|
49976
49998
|
};
|
|
49977
49999
|
InlineActivityStream = ({ activities, autoScroll = true, className }) => {
|
|
49978
|
-
const endRef =
|
|
49979
|
-
|
|
50000
|
+
const endRef = React107__default.useRef(null);
|
|
50001
|
+
React107__default.useEffect(() => {
|
|
49980
50002
|
if (!autoScroll) return;
|
|
49981
50003
|
endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
49982
50004
|
}, [activities.length, autoScroll]);
|
|
@@ -50070,7 +50092,7 @@ var init_SubagentTracePanel = __esm({
|
|
|
50070
50092
|
};
|
|
50071
50093
|
SubagentRichCard = ({ subagent }) => {
|
|
50072
50094
|
const { t } = useTranslate();
|
|
50073
|
-
const activities =
|
|
50095
|
+
const activities = React107__default.useMemo(
|
|
50074
50096
|
() => subagentMessagesToActivities(subagent.messages),
|
|
50075
50097
|
[subagent.messages]
|
|
50076
50098
|
);
|
|
@@ -50147,8 +50169,8 @@ var init_SubagentTracePanel = __esm({
|
|
|
50147
50169
|
] });
|
|
50148
50170
|
};
|
|
50149
50171
|
CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
|
|
50150
|
-
const endRef =
|
|
50151
|
-
|
|
50172
|
+
const endRef = React107__default.useRef(null);
|
|
50173
|
+
React107__default.useEffect(() => {
|
|
50152
50174
|
if (!autoScroll) return;
|
|
50153
50175
|
endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
50154
50176
|
}, [messages.length, autoScroll]);
|
|
@@ -50578,7 +50600,7 @@ var init_Timeline = __esm({
|
|
|
50578
50600
|
}) => {
|
|
50579
50601
|
const { t } = useTranslate();
|
|
50580
50602
|
const entityData = entity ?? [];
|
|
50581
|
-
const items =
|
|
50603
|
+
const items = React107__default.useMemo(() => {
|
|
50582
50604
|
if (propItems) return propItems;
|
|
50583
50605
|
if (entityData.length === 0) return [];
|
|
50584
50606
|
return entityData.map((record, idx) => {
|
|
@@ -50680,7 +50702,7 @@ var init_Timeline = __esm({
|
|
|
50680
50702
|
}
|
|
50681
50703
|
});
|
|
50682
50704
|
function extractToastProps(children) {
|
|
50683
|
-
if (!
|
|
50705
|
+
if (!React107__default.isValidElement(children)) {
|
|
50684
50706
|
if (typeof children === "string") {
|
|
50685
50707
|
return { message: children };
|
|
50686
50708
|
}
|
|
@@ -50718,7 +50740,7 @@ var init_ToastSlot = __esm({
|
|
|
50718
50740
|
eventBus.emit("UI:CLOSE");
|
|
50719
50741
|
};
|
|
50720
50742
|
if (!isVisible) return null;
|
|
50721
|
-
const isCustomContent =
|
|
50743
|
+
const isCustomContent = React107__default.isValidElement(children) && !message;
|
|
50722
50744
|
return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
|
|
50723
50745
|
Toast,
|
|
50724
50746
|
{
|
|
@@ -51360,7 +51382,7 @@ function SuspenseConfigProvider({
|
|
|
51360
51382
|
config,
|
|
51361
51383
|
children
|
|
51362
51384
|
}) {
|
|
51363
|
-
return
|
|
51385
|
+
return React107__default.createElement(
|
|
51364
51386
|
SuspenseConfigContext.Provider,
|
|
51365
51387
|
{ value: config },
|
|
51366
51388
|
children
|
|
@@ -51402,7 +51424,7 @@ function enrichFormFields(fields, entityDef) {
|
|
|
51402
51424
|
}
|
|
51403
51425
|
return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
|
|
51404
51426
|
}
|
|
51405
|
-
if (field && typeof field === "object" && !Array.isArray(field) && !
|
|
51427
|
+
if (field && typeof field === "object" && !Array.isArray(field) && !React107__default.isValidElement(field) && !(field instanceof Date)) {
|
|
51406
51428
|
const obj = field;
|
|
51407
51429
|
const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
|
|
51408
51430
|
if (!fieldName) return field;
|
|
@@ -51848,7 +51870,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
51848
51870
|
const key = `${parentId}-${index}-trait:${traitName}`;
|
|
51849
51871
|
return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
|
|
51850
51872
|
}
|
|
51851
|
-
return /* @__PURE__ */ jsx(
|
|
51873
|
+
return /* @__PURE__ */ jsx(React107__default.Fragment, { children: child }, `${parentId}-${index}`);
|
|
51852
51874
|
}
|
|
51853
51875
|
if (!child || typeof child !== "object") return null;
|
|
51854
51876
|
const childId = `${parentId}-${index}`;
|
|
@@ -51888,14 +51910,14 @@ function isPatternConfig(value) {
|
|
|
51888
51910
|
if (value === null || value === void 0) return false;
|
|
51889
51911
|
if (typeof value !== "object") return false;
|
|
51890
51912
|
if (Array.isArray(value)) return false;
|
|
51891
|
-
if (
|
|
51913
|
+
if (React107__default.isValidElement(value)) return false;
|
|
51892
51914
|
if (value instanceof Date) return false;
|
|
51893
51915
|
if (typeof value === "function") return false;
|
|
51894
51916
|
const record = value;
|
|
51895
51917
|
return "type" in record && typeof record.type === "string" && getComponentForPattern(record.type) !== null;
|
|
51896
51918
|
}
|
|
51897
51919
|
function isPlainConfigObject(value) {
|
|
51898
|
-
if (
|
|
51920
|
+
if (React107__default.isValidElement(value)) return false;
|
|
51899
51921
|
if (value instanceof Date) return false;
|
|
51900
51922
|
const proto = Object.getPrototypeOf(value);
|
|
51901
51923
|
return proto === Object.prototype || proto === null;
|
|
@@ -52021,7 +52043,7 @@ function SlotContentRenderer({
|
|
|
52021
52043
|
for (const slotKey of CONTENT_NODE_SLOTS) {
|
|
52022
52044
|
const slotVal = restProps[slotKey];
|
|
52023
52045
|
if (slotVal === void 0 || slotVal === null) continue;
|
|
52024
|
-
if (
|
|
52046
|
+
if (React107__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
|
|
52025
52047
|
if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
|
|
52026
52048
|
nodeSlotOverrides[slotKey] = renderPatternChildren(
|
|
52027
52049
|
slotVal,
|
|
@@ -52070,7 +52092,7 @@ function SlotContentRenderer({
|
|
|
52070
52092
|
const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
|
|
52071
52093
|
if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
|
|
52072
52094
|
const sample = resolvedItems[0];
|
|
52073
|
-
if (sample && typeof sample === "object" && !Array.isArray(sample) && !
|
|
52095
|
+
if (sample && typeof sample === "object" && !Array.isArray(sample) && !React107__default.isValidElement(sample) && !(sample instanceof Date)) {
|
|
52074
52096
|
const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
|
|
52075
52097
|
finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
|
|
52076
52098
|
}
|
|
@@ -52728,6 +52750,863 @@ function OrbitalProvider({
|
|
|
52728
52750
|
);
|
|
52729
52751
|
}
|
|
52730
52752
|
OrbitalProvider.displayName = "OrbitalProvider";
|
|
52753
|
+
|
|
52754
|
+
// lib/themeTokens.ts
|
|
52755
|
+
function themeTokensToCssVars(tokens, mode = "light", darkVariant) {
|
|
52756
|
+
const vars = {};
|
|
52757
|
+
const isDark = mode === "dark";
|
|
52758
|
+
const pickColors = isDark && darkVariant?.colors ? darkVariant.colors : tokens.colors;
|
|
52759
|
+
if (pickColors) {
|
|
52760
|
+
for (const [key, value] of Object.entries(pickColors)) {
|
|
52761
|
+
vars[`--color-${key}`] = value;
|
|
52762
|
+
}
|
|
52763
|
+
if (isDark && darkVariant?.colors && tokens.colors) {
|
|
52764
|
+
for (const [key, value] of Object.entries(tokens.colors)) {
|
|
52765
|
+
const varName = `--color-${key}`;
|
|
52766
|
+
if (!(varName in vars)) vars[varName] = value;
|
|
52767
|
+
}
|
|
52768
|
+
}
|
|
52769
|
+
}
|
|
52770
|
+
const pickRadii = isDark && darkVariant?.radii ? darkVariant.radii : tokens.radii;
|
|
52771
|
+
if (pickRadii) {
|
|
52772
|
+
for (const [key, value] of Object.entries(pickRadii)) {
|
|
52773
|
+
vars[`--radius-${key}`] = value;
|
|
52774
|
+
}
|
|
52775
|
+
}
|
|
52776
|
+
const pickSpacing = isDark && darkVariant?.spacing ? darkVariant.spacing : tokens.spacing;
|
|
52777
|
+
if (pickSpacing) {
|
|
52778
|
+
for (const [key, value] of Object.entries(pickSpacing)) {
|
|
52779
|
+
vars[`--space-${key}`] = value;
|
|
52780
|
+
}
|
|
52781
|
+
}
|
|
52782
|
+
const pickTypography = isDark && darkVariant?.typography ? darkVariant.typography : tokens.typography;
|
|
52783
|
+
if (pickTypography) {
|
|
52784
|
+
for (const [key, value] of Object.entries(pickTypography)) {
|
|
52785
|
+
vars[`--${key}`] = value;
|
|
52786
|
+
}
|
|
52787
|
+
}
|
|
52788
|
+
const pickShadows = isDark && darkVariant?.shadows ? darkVariant.shadows : tokens.shadows;
|
|
52789
|
+
if (pickShadows) {
|
|
52790
|
+
for (const [key, value] of Object.entries(pickShadows)) {
|
|
52791
|
+
vars[`--shadow-${key}`] = value;
|
|
52792
|
+
}
|
|
52793
|
+
}
|
|
52794
|
+
const pickDensity = isDark && darkVariant?.density ? darkVariant.density : tokens.density;
|
|
52795
|
+
emitDensity(pickDensity, vars);
|
|
52796
|
+
const pickTypeScale = isDark && darkVariant?.typeScale ? darkVariant.typeScale : tokens.typeScale;
|
|
52797
|
+
emitTypeScale(pickTypeScale, vars);
|
|
52798
|
+
const pickMotion = isDark && darkVariant?.motion ? darkVariant.motion : tokens.motion;
|
|
52799
|
+
emitMotion(pickMotion, vars);
|
|
52800
|
+
const pickIconography = isDark && darkVariant?.iconography ? darkVariant.iconography : tokens.iconography;
|
|
52801
|
+
emitIconography(pickIconography, vars);
|
|
52802
|
+
const pickElevation = isDark && darkVariant?.elevation ? darkVariant.elevation : tokens.elevation;
|
|
52803
|
+
emitElevation(pickElevation, vars);
|
|
52804
|
+
const pickGeometry = isDark && darkVariant?.geometry ? darkVariant.geometry : tokens.geometry;
|
|
52805
|
+
emitGeometry(pickGeometry, vars);
|
|
52806
|
+
return vars;
|
|
52807
|
+
}
|
|
52808
|
+
function emitDensity(density, vars) {
|
|
52809
|
+
if (!density) return;
|
|
52810
|
+
if (density.spacing) {
|
|
52811
|
+
const s = density.spacing;
|
|
52812
|
+
const pairs2 = [
|
|
52813
|
+
["0", s.space0],
|
|
52814
|
+
["1", s.space1],
|
|
52815
|
+
["2", s.space2],
|
|
52816
|
+
["3", s.space3],
|
|
52817
|
+
["4", s.space4],
|
|
52818
|
+
["5", s.space5],
|
|
52819
|
+
["6", s.space6],
|
|
52820
|
+
["7", s.space7],
|
|
52821
|
+
["8", s.space8],
|
|
52822
|
+
["9", s.space9],
|
|
52823
|
+
["10", s.space10],
|
|
52824
|
+
["11", s.space11],
|
|
52825
|
+
["12", s.space12]
|
|
52826
|
+
];
|
|
52827
|
+
for (const [k, v] of pairs2) {
|
|
52828
|
+
if (v !== void 0) vars[`--space-${k}`] = v;
|
|
52829
|
+
}
|
|
52830
|
+
}
|
|
52831
|
+
const pairs = [
|
|
52832
|
+
["button-height-sm", density.buttonHeightSm],
|
|
52833
|
+
["button-height-md", density.buttonHeightMd],
|
|
52834
|
+
["button-height-lg", density.buttonHeightLg],
|
|
52835
|
+
["input-height-sm", density.inputHeightSm],
|
|
52836
|
+
["input-height-md", density.inputHeightMd],
|
|
52837
|
+
["input-height-lg", density.inputHeightLg],
|
|
52838
|
+
["row-height-compact", density.rowHeightCompact],
|
|
52839
|
+
["row-height-normal", density.rowHeightNormal],
|
|
52840
|
+
["row-height-spacious", density.rowHeightSpacious],
|
|
52841
|
+
["card-padding-sm", density.cardPaddingSm],
|
|
52842
|
+
["card-padding-md", density.cardPaddingMd],
|
|
52843
|
+
["card-padding-lg", density.cardPaddingLg],
|
|
52844
|
+
["dialog-padding", density.dialogPadding],
|
|
52845
|
+
["section-gap", density.sectionGap]
|
|
52846
|
+
];
|
|
52847
|
+
for (const [k, v] of pairs) {
|
|
52848
|
+
if (v !== void 0) vars[`--${k}`] = v;
|
|
52849
|
+
}
|
|
52850
|
+
}
|
|
52851
|
+
function typeSizeKeyStr(k) {
|
|
52852
|
+
return k;
|
|
52853
|
+
}
|
|
52854
|
+
function typeWeightStr(w) {
|
|
52855
|
+
return w;
|
|
52856
|
+
}
|
|
52857
|
+
function emitTypeIntent(name, intent, vars) {
|
|
52858
|
+
const sizeKey2 = typeSizeKeyStr(intent.size);
|
|
52859
|
+
const weight = typeWeightStr(intent.weight);
|
|
52860
|
+
vars[`--intent-${name}-size`] = `var(--text-${sizeKey2})`;
|
|
52861
|
+
vars[`--intent-${name}-weight`] = `var(--font-weight-${weight})`;
|
|
52862
|
+
vars[`--intent-${name}-leading`] = `var(--leading-${sizeKey2})`;
|
|
52863
|
+
}
|
|
52864
|
+
function emitTypeScale(ts, vars) {
|
|
52865
|
+
if (!ts) return;
|
|
52866
|
+
if (ts.displayFamily !== void 0) vars["--font-family-display"] = ts.displayFamily;
|
|
52867
|
+
if (ts.bodyFamily !== void 0) vars["--font-family-body"] = ts.bodyFamily;
|
|
52868
|
+
if (ts.monoFamily !== void 0) vars["--font-family-mono"] = ts.monoFamily;
|
|
52869
|
+
if (ts.scale) {
|
|
52870
|
+
const s = ts.scale;
|
|
52871
|
+
const pairs = [
|
|
52872
|
+
["xs", s.xs],
|
|
52873
|
+
["sm", s.sm],
|
|
52874
|
+
["base", s.base],
|
|
52875
|
+
["lg", s.lg],
|
|
52876
|
+
["xl", s.xl],
|
|
52877
|
+
["2xl", s["2xl"]],
|
|
52878
|
+
["3xl", s["3xl"]],
|
|
52879
|
+
["4xl", s["4xl"]],
|
|
52880
|
+
["display-1", s["display-1"]],
|
|
52881
|
+
["display-2", s["display-2"]]
|
|
52882
|
+
];
|
|
52883
|
+
for (const [k, entry] of pairs) {
|
|
52884
|
+
if (entry !== void 0) {
|
|
52885
|
+
vars[`--text-${k}`] = entry.size;
|
|
52886
|
+
vars[`--leading-${k}`] = entry.lineHeight;
|
|
52887
|
+
}
|
|
52888
|
+
}
|
|
52889
|
+
}
|
|
52890
|
+
if (ts.intents) {
|
|
52891
|
+
const i = ts.intents;
|
|
52892
|
+
if (i.headingMajor) emitTypeIntent("heading-major", i.headingMajor, vars);
|
|
52893
|
+
if (i.headingMinor) emitTypeIntent("heading-minor", i.headingMinor, vars);
|
|
52894
|
+
if (i.bodyEmphasis) emitTypeIntent("body-emphasis", i.bodyEmphasis, vars);
|
|
52895
|
+
if (i.bodyDefault) emitTypeIntent("body-default", i.bodyDefault, vars);
|
|
52896
|
+
if (i.bodyQuiet) emitTypeIntent("body-quiet", i.bodyQuiet, vars);
|
|
52897
|
+
if (i.caption) emitTypeIntent("caption", i.caption, vars);
|
|
52898
|
+
if (i.numeric) emitTypeIntent("numeric", i.numeric, vars);
|
|
52899
|
+
}
|
|
52900
|
+
}
|
|
52901
|
+
function emitMotionIntent(name, intent, vars) {
|
|
52902
|
+
vars[`--intent-${name}-duration`] = `var(--duration-${intent.duration})`;
|
|
52903
|
+
vars[`--intent-${name}-easing`] = `var(--easing-${intent.easing})`;
|
|
52904
|
+
}
|
|
52905
|
+
function emitMotion(m, vars) {
|
|
52906
|
+
if (!m) return;
|
|
52907
|
+
if (m.durations) {
|
|
52908
|
+
const d = m.durations;
|
|
52909
|
+
const pairs = [
|
|
52910
|
+
["instant", d.instant],
|
|
52911
|
+
["fast", d.fast],
|
|
52912
|
+
["normal", d.normal],
|
|
52913
|
+
["slow", d.slow],
|
|
52914
|
+
["dramatic", d.dramatic]
|
|
52915
|
+
];
|
|
52916
|
+
for (const [k, v] of pairs) {
|
|
52917
|
+
if (v !== void 0) vars[`--duration-${k}`] = v;
|
|
52918
|
+
}
|
|
52919
|
+
}
|
|
52920
|
+
if (m.easings) {
|
|
52921
|
+
const e = m.easings;
|
|
52922
|
+
const pairs = [
|
|
52923
|
+
["linear", e.linear],
|
|
52924
|
+
["standard", e.standard],
|
|
52925
|
+
["emphasized", e.emphasized],
|
|
52926
|
+
["spring", e.spring]
|
|
52927
|
+
];
|
|
52928
|
+
for (const [k, v] of pairs) {
|
|
52929
|
+
if (v !== void 0) vars[`--easing-${k}`] = v;
|
|
52930
|
+
}
|
|
52931
|
+
}
|
|
52932
|
+
if (m.intents) {
|
|
52933
|
+
const i = m.intents;
|
|
52934
|
+
if (i.enter) emitMotionIntent("enter", i.enter, vars);
|
|
52935
|
+
if (i.exit) emitMotionIntent("exit", i.exit, vars);
|
|
52936
|
+
if (i.hover) emitMotionIntent("hover", i.hover, vars);
|
|
52937
|
+
if (i.press) emitMotionIntent("press", i.press, vars);
|
|
52938
|
+
if (i.expand) emitMotionIntent("expand", i.expand, vars);
|
|
52939
|
+
if (i.transition) emitMotionIntent("transition", i.transition, vars);
|
|
52940
|
+
}
|
|
52941
|
+
}
|
|
52942
|
+
function emitIconography(i, vars) {
|
|
52943
|
+
if (!i) return;
|
|
52944
|
+
if (i.family !== void 0) vars["--icon-family"] = i.family;
|
|
52945
|
+
if (i.strokeWidth !== void 0) vars["--icon-stroke-width"] = i.strokeWidth;
|
|
52946
|
+
if (i.defaultSize !== void 0) vars["--icon-default-size"] = i.defaultSize;
|
|
52947
|
+
}
|
|
52948
|
+
function emitElevation(e, vars) {
|
|
52949
|
+
if (!e) return;
|
|
52950
|
+
if (e.cardElevation !== void 0) vars["--elevation-card"] = e.cardElevation;
|
|
52951
|
+
if (e.popoverElevation !== void 0) vars["--elevation-popover"] = e.popoverElevation;
|
|
52952
|
+
if (e.dialogElevation !== void 0) vars["--elevation-dialog"] = e.dialogElevation;
|
|
52953
|
+
if (e.toastElevation !== void 0) vars["--elevation-toast"] = e.toastElevation;
|
|
52954
|
+
}
|
|
52955
|
+
function emitGeometry(g, vars) {
|
|
52956
|
+
if (!g) return;
|
|
52957
|
+
if (g.radiusContainer !== void 0) vars["--radius-container"] = g.radiusContainer;
|
|
52958
|
+
if (g.radiusInteractive !== void 0) vars["--radius-interactive"] = g.radiusInteractive;
|
|
52959
|
+
if (g.radiusPill !== void 0) vars["--radius-pill"] = g.radiusPill;
|
|
52960
|
+
if (g.borderHairline !== void 0) vars["--border-hairline"] = g.borderHairline;
|
|
52961
|
+
if (g.borderStandard !== void 0) vars["--border-standard"] = g.borderStandard;
|
|
52962
|
+
if (g.borderHeavy !== void 0) vars["--border-heavy"] = g.borderHeavy;
|
|
52963
|
+
}
|
|
52964
|
+
function resolveThemeForRuntime(theme) {
|
|
52965
|
+
if (theme === void 0) return void 0;
|
|
52966
|
+
if (typeof theme === "string") return void 0;
|
|
52967
|
+
return theme;
|
|
52968
|
+
}
|
|
52969
|
+
function OrbitalThemeProvider({ theme, children }) {
|
|
52970
|
+
const resolved = resolveThemeForRuntime(theme);
|
|
52971
|
+
const { resolvedMode } = useTheme();
|
|
52972
|
+
if (!resolved) {
|
|
52973
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
52974
|
+
}
|
|
52975
|
+
const vars = themeTokensToCssVars(resolved.tokens, resolvedMode, resolved.variants?.dark);
|
|
52976
|
+
return /* @__PURE__ */ jsx(
|
|
52977
|
+
"div",
|
|
52978
|
+
{
|
|
52979
|
+
"data-orbital-theme": resolved.name,
|
|
52980
|
+
style: { display: "contents", ...vars },
|
|
52981
|
+
children
|
|
52982
|
+
}
|
|
52983
|
+
);
|
|
52984
|
+
}
|
|
52985
|
+
OrbitalThemeProvider.displayName = "OrbitalThemeProvider";
|
|
52986
|
+
var CurrentPagePathContext = createContext(void 0);
|
|
52987
|
+
var CurrentPagePathProvider = ({
|
|
52988
|
+
value,
|
|
52989
|
+
children
|
|
52990
|
+
}) => /* @__PURE__ */ jsx(CurrentPagePathContext.Provider, { value, children });
|
|
52991
|
+
CurrentPagePathProvider.displayName = "CurrentPagePathProvider";
|
|
52992
|
+
var useCurrentPagePath2 = () => useContext(CurrentPagePathContext);
|
|
52993
|
+
var ANONYMOUS_USER = {
|
|
52994
|
+
id: "anonymous",
|
|
52995
|
+
role: "anonymous",
|
|
52996
|
+
permissions: []
|
|
52997
|
+
};
|
|
52998
|
+
var UserContext = createContext(null);
|
|
52999
|
+
function UserProvider({
|
|
53000
|
+
user = null,
|
|
53001
|
+
children
|
|
53002
|
+
}) {
|
|
53003
|
+
const hasRole = useCallback(
|
|
53004
|
+
(role) => {
|
|
53005
|
+
if (!user) return role === "anonymous";
|
|
53006
|
+
return user.role === role;
|
|
53007
|
+
},
|
|
53008
|
+
[user]
|
|
53009
|
+
);
|
|
53010
|
+
const hasPermission = useCallback(
|
|
53011
|
+
(permission) => {
|
|
53012
|
+
if (!user) return false;
|
|
53013
|
+
return user.permissions?.includes(permission) ?? false;
|
|
53014
|
+
},
|
|
53015
|
+
[user]
|
|
53016
|
+
);
|
|
53017
|
+
const hasAnyRole = useCallback(
|
|
53018
|
+
(roles) => {
|
|
53019
|
+
if (!user) return roles.includes("anonymous");
|
|
53020
|
+
return user.role ? roles.includes(user.role) : false;
|
|
53021
|
+
},
|
|
53022
|
+
[user]
|
|
53023
|
+
);
|
|
53024
|
+
const hasAllPermissions = useCallback(
|
|
53025
|
+
(permissions) => {
|
|
53026
|
+
if (!user || !user.permissions) return false;
|
|
53027
|
+
return permissions.every((p2) => user.permissions?.includes(p2));
|
|
53028
|
+
},
|
|
53029
|
+
[user]
|
|
53030
|
+
);
|
|
53031
|
+
const getUserField = useCallback(
|
|
53032
|
+
(path) => {
|
|
53033
|
+
const userData = user ?? ANONYMOUS_USER;
|
|
53034
|
+
const parts = path.split(".");
|
|
53035
|
+
let value = userData;
|
|
53036
|
+
for (const segment of parts) {
|
|
53037
|
+
if (value === null || value === void 0) {
|
|
53038
|
+
return void 0;
|
|
53039
|
+
}
|
|
53040
|
+
if (typeof value === "object") {
|
|
53041
|
+
value = value[segment];
|
|
53042
|
+
} else {
|
|
53043
|
+
return void 0;
|
|
53044
|
+
}
|
|
53045
|
+
}
|
|
53046
|
+
return value;
|
|
53047
|
+
},
|
|
53048
|
+
[user]
|
|
53049
|
+
);
|
|
53050
|
+
const contextValue = useMemo(
|
|
53051
|
+
() => ({
|
|
53052
|
+
user,
|
|
53053
|
+
isLoggedIn: user !== null,
|
|
53054
|
+
hasRole,
|
|
53055
|
+
hasPermission,
|
|
53056
|
+
hasAnyRole,
|
|
53057
|
+
hasAllPermissions,
|
|
53058
|
+
getUserField
|
|
53059
|
+
}),
|
|
53060
|
+
[user, hasRole, hasPermission, hasAnyRole, hasAllPermissions, getUserField]
|
|
53061
|
+
);
|
|
53062
|
+
return /* @__PURE__ */ jsx(UserContext.Provider, { value: contextValue, children });
|
|
53063
|
+
}
|
|
53064
|
+
function useUser() {
|
|
53065
|
+
const context = useContext(UserContext);
|
|
53066
|
+
if (!context) {
|
|
53067
|
+
return {
|
|
53068
|
+
user: null,
|
|
53069
|
+
isLoggedIn: false,
|
|
53070
|
+
hasRole: (role) => role === "anonymous",
|
|
53071
|
+
hasPermission: () => false,
|
|
53072
|
+
hasAnyRole: (roles) => roles.includes("anonymous"),
|
|
53073
|
+
hasAllPermissions: () => false,
|
|
53074
|
+
getUserField: () => void 0
|
|
53075
|
+
};
|
|
53076
|
+
}
|
|
53077
|
+
return context;
|
|
53078
|
+
}
|
|
53079
|
+
function useHasRole(role) {
|
|
53080
|
+
const { hasRole } = useUser();
|
|
53081
|
+
return hasRole(role);
|
|
53082
|
+
}
|
|
53083
|
+
function useHasPermission(permission) {
|
|
53084
|
+
const { hasPermission } = useUser();
|
|
53085
|
+
return hasPermission(permission);
|
|
53086
|
+
}
|
|
53087
|
+
function useUserForEvaluation() {
|
|
53088
|
+
const { user, isLoggedIn } = useUser();
|
|
53089
|
+
return isLoggedIn && user ? user : void 0;
|
|
53090
|
+
}
|
|
53091
|
+
var EntitySchemaContext = createContext(null);
|
|
53092
|
+
function EntitySchemaProvider({
|
|
53093
|
+
entities,
|
|
53094
|
+
traitLinkedEntities,
|
|
53095
|
+
orbitalsByTrait,
|
|
53096
|
+
children
|
|
53097
|
+
}) {
|
|
53098
|
+
const entitiesMap = useMemo(() => {
|
|
53099
|
+
const map = /* @__PURE__ */ new Map();
|
|
53100
|
+
for (const entity of entities) {
|
|
53101
|
+
map.set(entity.name, entity);
|
|
53102
|
+
}
|
|
53103
|
+
return map;
|
|
53104
|
+
}, [entities]);
|
|
53105
|
+
const linkedMap = useMemo(() => {
|
|
53106
|
+
return traitLinkedEntities ?? /* @__PURE__ */ new Map();
|
|
53107
|
+
}, [traitLinkedEntities]);
|
|
53108
|
+
const orbitalsMap = useMemo(() => {
|
|
53109
|
+
return orbitalsByTrait ?? /* @__PURE__ */ new Map();
|
|
53110
|
+
}, [orbitalsByTrait]);
|
|
53111
|
+
const contextValue = useMemo(
|
|
53112
|
+
() => ({
|
|
53113
|
+
entities: entitiesMap,
|
|
53114
|
+
traitLinkedEntities: linkedMap,
|
|
53115
|
+
orbitalsByTrait: orbitalsMap
|
|
53116
|
+
}),
|
|
53117
|
+
[entitiesMap, linkedMap, orbitalsMap]
|
|
53118
|
+
);
|
|
53119
|
+
return /* @__PURE__ */ jsx(EntitySchemaContext.Provider, { value: contextValue, children });
|
|
53120
|
+
}
|
|
53121
|
+
function useEntitySchema() {
|
|
53122
|
+
const context = useContext(EntitySchemaContext);
|
|
53123
|
+
if (!context) {
|
|
53124
|
+
throw new Error("useEntitySchema must be used within an EntitySchemaProvider");
|
|
53125
|
+
}
|
|
53126
|
+
return context;
|
|
53127
|
+
}
|
|
53128
|
+
function useEntitySchemaOptional3() {
|
|
53129
|
+
return useContext(EntitySchemaContext);
|
|
53130
|
+
}
|
|
53131
|
+
var log11 = createLogger("almadar:ui:navigation");
|
|
53132
|
+
function matchPath2(pattern, path) {
|
|
53133
|
+
const normalizeSegment = (p2) => {
|
|
53134
|
+
let normalized = p2.trim();
|
|
53135
|
+
if (!normalized.startsWith("/")) normalized = "/" + normalized;
|
|
53136
|
+
if (normalized.length > 1 && normalized.endsWith("/")) {
|
|
53137
|
+
normalized = normalized.slice(0, -1);
|
|
53138
|
+
}
|
|
53139
|
+
return normalized;
|
|
53140
|
+
};
|
|
53141
|
+
const normalizedPattern = normalizeSegment(pattern);
|
|
53142
|
+
const normalizedPath = normalizeSegment(path);
|
|
53143
|
+
const patternParts = normalizedPattern.split("/").filter(Boolean);
|
|
53144
|
+
const pathParts = normalizedPath.split("/").filter(Boolean);
|
|
53145
|
+
if (patternParts.length !== pathParts.length) {
|
|
53146
|
+
return null;
|
|
53147
|
+
}
|
|
53148
|
+
const params = {};
|
|
53149
|
+
for (let i = 0; i < patternParts.length; i++) {
|
|
53150
|
+
const patternPart = patternParts[i];
|
|
53151
|
+
const pathPart = pathParts[i];
|
|
53152
|
+
if (patternPart.startsWith(":")) {
|
|
53153
|
+
const paramName = patternPart.slice(1);
|
|
53154
|
+
params[paramName] = decodeURIComponent(pathPart);
|
|
53155
|
+
} else if (patternPart !== pathPart) {
|
|
53156
|
+
return null;
|
|
53157
|
+
}
|
|
53158
|
+
}
|
|
53159
|
+
return params;
|
|
53160
|
+
}
|
|
53161
|
+
function extractRouteParams2(pattern, path) {
|
|
53162
|
+
return matchPath2(pattern, path) || {};
|
|
53163
|
+
}
|
|
53164
|
+
function pathMatches2(pattern, path) {
|
|
53165
|
+
return matchPath2(pattern, path) !== null;
|
|
53166
|
+
}
|
|
53167
|
+
function isInlineOrbital(orbital) {
|
|
53168
|
+
return "name" in orbital && typeof orbital.name === "string";
|
|
53169
|
+
}
|
|
53170
|
+
function isInlinePage(page) {
|
|
53171
|
+
return typeof page === "object" && page !== null && "name" in page && typeof page.name === "string";
|
|
53172
|
+
}
|
|
53173
|
+
function findPageByPath2(schema, path) {
|
|
53174
|
+
if (!schema.orbitals) return null;
|
|
53175
|
+
for (const orbital of schema.orbitals) {
|
|
53176
|
+
if (!isInlineOrbital(orbital)) continue;
|
|
53177
|
+
if (!orbital.pages) continue;
|
|
53178
|
+
for (const pageRef of orbital.pages) {
|
|
53179
|
+
if (!isInlinePage(pageRef)) continue;
|
|
53180
|
+
const page = pageRef;
|
|
53181
|
+
const pagePath = page.path;
|
|
53182
|
+
if (!pagePath) continue;
|
|
53183
|
+
const params = matchPath2(pagePath, path);
|
|
53184
|
+
if (params !== null) {
|
|
53185
|
+
return { page, params, orbitalName: orbital.name };
|
|
53186
|
+
}
|
|
53187
|
+
}
|
|
53188
|
+
}
|
|
53189
|
+
return null;
|
|
53190
|
+
}
|
|
53191
|
+
function findPageByName2(schema, pageName) {
|
|
53192
|
+
if (!schema.orbitals) return null;
|
|
53193
|
+
for (const orbital of schema.orbitals) {
|
|
53194
|
+
if (!isInlineOrbital(orbital)) continue;
|
|
53195
|
+
if (!orbital.pages) continue;
|
|
53196
|
+
for (const pageRef of orbital.pages) {
|
|
53197
|
+
if (!isInlinePage(pageRef)) continue;
|
|
53198
|
+
const page = pageRef;
|
|
53199
|
+
if (page.name === pageName) {
|
|
53200
|
+
return { page, orbitalName: orbital.name };
|
|
53201
|
+
}
|
|
53202
|
+
}
|
|
53203
|
+
}
|
|
53204
|
+
return null;
|
|
53205
|
+
}
|
|
53206
|
+
function getDefaultPage2(schema) {
|
|
53207
|
+
if (!schema.orbitals) return null;
|
|
53208
|
+
for (const orbital of schema.orbitals) {
|
|
53209
|
+
if (!isInlineOrbital(orbital)) continue;
|
|
53210
|
+
if (!orbital.pages) continue;
|
|
53211
|
+
for (const pageRef of orbital.pages) {
|
|
53212
|
+
if (isInlinePage(pageRef)) {
|
|
53213
|
+
return { page: pageRef, orbitalName: orbital.name };
|
|
53214
|
+
}
|
|
53215
|
+
}
|
|
53216
|
+
}
|
|
53217
|
+
return null;
|
|
53218
|
+
}
|
|
53219
|
+
function getAllPages2(schema) {
|
|
53220
|
+
const pages = [];
|
|
53221
|
+
if (!schema.orbitals) return pages;
|
|
53222
|
+
for (const orbital of schema.orbitals) {
|
|
53223
|
+
if (!isInlineOrbital(orbital)) continue;
|
|
53224
|
+
if (!orbital.pages) continue;
|
|
53225
|
+
for (const pageRef of orbital.pages) {
|
|
53226
|
+
if (isInlinePage(pageRef)) {
|
|
53227
|
+
pages.push({ page: pageRef, orbitalName: orbital.name });
|
|
53228
|
+
}
|
|
53229
|
+
}
|
|
53230
|
+
}
|
|
53231
|
+
return pages;
|
|
53232
|
+
}
|
|
53233
|
+
var NavigationContext = createContext(null);
|
|
53234
|
+
function NavigationProvider2({
|
|
53235
|
+
schema,
|
|
53236
|
+
initialPage,
|
|
53237
|
+
updateUrl = true,
|
|
53238
|
+
onNavigate,
|
|
53239
|
+
children
|
|
53240
|
+
}) {
|
|
53241
|
+
const initialState = useMemo(() => {
|
|
53242
|
+
let page = null;
|
|
53243
|
+
let path = "/";
|
|
53244
|
+
if (initialPage) {
|
|
53245
|
+
const found = findPageByName2(schema, initialPage);
|
|
53246
|
+
if (found) {
|
|
53247
|
+
page = found.page;
|
|
53248
|
+
path = page.path || "/";
|
|
53249
|
+
}
|
|
53250
|
+
}
|
|
53251
|
+
if (!page) {
|
|
53252
|
+
const defaultPage = getDefaultPage2(schema);
|
|
53253
|
+
if (defaultPage) {
|
|
53254
|
+
page = defaultPage.page;
|
|
53255
|
+
path = page.path || "/";
|
|
53256
|
+
}
|
|
53257
|
+
}
|
|
53258
|
+
return {
|
|
53259
|
+
activePage: page?.name || "",
|
|
53260
|
+
currentPath: path,
|
|
53261
|
+
initPayload: {},
|
|
53262
|
+
navigationId: 0
|
|
53263
|
+
};
|
|
53264
|
+
}, [schema, initialPage]);
|
|
53265
|
+
const [state, setState] = useState(initialState);
|
|
53266
|
+
const navigateTo = useCallback((path, payload) => {
|
|
53267
|
+
const result = findPageByPath2(schema, path);
|
|
53268
|
+
if (!result) {
|
|
53269
|
+
log11.error("No page found for path", { path });
|
|
53270
|
+
return;
|
|
53271
|
+
}
|
|
53272
|
+
const { page, params } = result;
|
|
53273
|
+
const finalPayload = { ...params, ...payload };
|
|
53274
|
+
log11.debug("Navigating to", () => ({
|
|
53275
|
+
path,
|
|
53276
|
+
page: page.name,
|
|
53277
|
+
params,
|
|
53278
|
+
payload: JSON.stringify(payload),
|
|
53279
|
+
finalPayload: JSON.stringify(finalPayload)
|
|
53280
|
+
}));
|
|
53281
|
+
setState((prev) => ({
|
|
53282
|
+
activePage: page.name,
|
|
53283
|
+
currentPath: path,
|
|
53284
|
+
initPayload: finalPayload,
|
|
53285
|
+
navigationId: prev.navigationId + 1
|
|
53286
|
+
}));
|
|
53287
|
+
if (updateUrl && typeof window !== "undefined") {
|
|
53288
|
+
try {
|
|
53289
|
+
window.history.pushState(finalPayload, "", path);
|
|
53290
|
+
} catch (e) {
|
|
53291
|
+
log11.warn("Could not update URL", { error: e instanceof Error ? e : String(e) });
|
|
53292
|
+
}
|
|
53293
|
+
}
|
|
53294
|
+
if (onNavigate) {
|
|
53295
|
+
onNavigate(page.name, path, finalPayload);
|
|
53296
|
+
}
|
|
53297
|
+
}, [schema, updateUrl, onNavigate]);
|
|
53298
|
+
const navigateToPage = useCallback((pageName, payload) => {
|
|
53299
|
+
const result = findPageByName2(schema, pageName);
|
|
53300
|
+
if (!result) {
|
|
53301
|
+
log11.error("No page found with name", { pageName });
|
|
53302
|
+
return;
|
|
53303
|
+
}
|
|
53304
|
+
const { page } = result;
|
|
53305
|
+
const path = page.path || `/${pageName.toLowerCase()}`;
|
|
53306
|
+
log11.debug("Navigating to page", () => ({
|
|
53307
|
+
pageName,
|
|
53308
|
+
path,
|
|
53309
|
+
payload: JSON.stringify(payload)
|
|
53310
|
+
}));
|
|
53311
|
+
setState((prev) => ({
|
|
53312
|
+
activePage: page.name,
|
|
53313
|
+
currentPath: path,
|
|
53314
|
+
initPayload: payload || {},
|
|
53315
|
+
navigationId: prev.navigationId + 1
|
|
53316
|
+
}));
|
|
53317
|
+
if (updateUrl && typeof window !== "undefined") {
|
|
53318
|
+
try {
|
|
53319
|
+
window.history.pushState(payload || {}, "", path);
|
|
53320
|
+
} catch (e) {
|
|
53321
|
+
log11.warn("Could not update URL", { error: e instanceof Error ? e : String(e) });
|
|
53322
|
+
}
|
|
53323
|
+
}
|
|
53324
|
+
if (onNavigate) {
|
|
53325
|
+
onNavigate(page.name, path, payload || {});
|
|
53326
|
+
}
|
|
53327
|
+
}, [schema, updateUrl, onNavigate]);
|
|
53328
|
+
const contextValue = useMemo(() => ({
|
|
53329
|
+
state,
|
|
53330
|
+
navigateTo,
|
|
53331
|
+
navigateToPage,
|
|
53332
|
+
schema,
|
|
53333
|
+
isReady: !!state.activePage
|
|
53334
|
+
}), [state, navigateTo, navigateToPage, schema]);
|
|
53335
|
+
return /* @__PURE__ */ jsx(NavigationContext.Provider, { value: contextValue, children });
|
|
53336
|
+
}
|
|
53337
|
+
function useNavigation2() {
|
|
53338
|
+
return useContext(NavigationContext);
|
|
53339
|
+
}
|
|
53340
|
+
function useNavigateTo2() {
|
|
53341
|
+
const context = useContext(NavigationContext);
|
|
53342
|
+
const noOp = useCallback((path, _payload) => {
|
|
53343
|
+
log11.warn("navigateTo called outside NavigationProvider", { path });
|
|
53344
|
+
}, []);
|
|
53345
|
+
return context?.navigateTo || noOp;
|
|
53346
|
+
}
|
|
53347
|
+
function useNavigationState2() {
|
|
53348
|
+
const context = useContext(NavigationContext);
|
|
53349
|
+
return context?.state || null;
|
|
53350
|
+
}
|
|
53351
|
+
function useInitPayload2() {
|
|
53352
|
+
const context = useContext(NavigationContext);
|
|
53353
|
+
return context?.state.initPayload || {};
|
|
53354
|
+
}
|
|
53355
|
+
function useActivePage2() {
|
|
53356
|
+
const context = useContext(NavigationContext);
|
|
53357
|
+
return context?.state.activePage || null;
|
|
53358
|
+
}
|
|
53359
|
+
function useNavigationId2() {
|
|
53360
|
+
const context = useContext(NavigationContext);
|
|
53361
|
+
return context?.state.navigationId || 0;
|
|
53362
|
+
}
|
|
53363
|
+
|
|
53364
|
+
// providers/ServerBridge.tsx
|
|
53365
|
+
init_useEventBus();
|
|
53366
|
+
var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
|
|
53367
|
+
var serverBridgeLog = createLogger("almadar:ui:server-bridge");
|
|
53368
|
+
function createHttpTransport(serverUrl) {
|
|
53369
|
+
return {
|
|
53370
|
+
register: async (schema) => {
|
|
53371
|
+
try {
|
|
53372
|
+
const res = await fetch(`${serverUrl}/register`, {
|
|
53373
|
+
method: "POST",
|
|
53374
|
+
headers: { "Content-Type": "application/json" },
|
|
53375
|
+
body: JSON.stringify({ schema })
|
|
53376
|
+
});
|
|
53377
|
+
const result = await res.json();
|
|
53378
|
+
return !!result.success;
|
|
53379
|
+
} catch (err) {
|
|
53380
|
+
if (err instanceof TypeError) {
|
|
53381
|
+
serverBridgeLog.warn("Registration failed", { error: err.message });
|
|
53382
|
+
} else {
|
|
53383
|
+
serverBridgeLog.error("Registration failed", { error: err instanceof Error ? err : String(err) });
|
|
53384
|
+
}
|
|
53385
|
+
return false;
|
|
53386
|
+
}
|
|
53387
|
+
},
|
|
53388
|
+
unregister: async () => {
|
|
53389
|
+
try {
|
|
53390
|
+
await fetch(`${serverUrl}/unregister`, { method: "DELETE" });
|
|
53391
|
+
} catch {
|
|
53392
|
+
}
|
|
53393
|
+
},
|
|
53394
|
+
sendEvent: async (orbitalName, event, payload) => {
|
|
53395
|
+
const res = await fetch(`${serverUrl}/${orbitalName}/events`, {
|
|
53396
|
+
method: "POST",
|
|
53397
|
+
headers: { "Content-Type": "application/json" },
|
|
53398
|
+
body: JSON.stringify({ event, payload })
|
|
53399
|
+
});
|
|
53400
|
+
return res.json();
|
|
53401
|
+
}
|
|
53402
|
+
};
|
|
53403
|
+
}
|
|
53404
|
+
var ServerBridgeContext = createContext(null);
|
|
53405
|
+
function useServerBridge() {
|
|
53406
|
+
const ctx = useContext(ServerBridgeContext);
|
|
53407
|
+
if (!ctx) {
|
|
53408
|
+
const emptyMeta = { success: false, clientEffects: 0, dataEntities: {}, emittedEvents: [] };
|
|
53409
|
+
return { connected: false, sendEvent: async () => ({ effects: [], meta: emptyMeta }) };
|
|
53410
|
+
}
|
|
53411
|
+
return ctx;
|
|
53412
|
+
}
|
|
53413
|
+
function ServerBridgeProvider({
|
|
53414
|
+
schema,
|
|
53415
|
+
serverUrl,
|
|
53416
|
+
transport: customTransport,
|
|
53417
|
+
children
|
|
53418
|
+
}) {
|
|
53419
|
+
if (!serverUrl && !customTransport) {
|
|
53420
|
+
throw new Error("ServerBridgeProvider requires either serverUrl or transport");
|
|
53421
|
+
}
|
|
53422
|
+
if (serverUrl && customTransport) {
|
|
53423
|
+
throw new Error("ServerBridgeProvider accepts serverUrl OR transport, not both");
|
|
53424
|
+
}
|
|
53425
|
+
const eventBus = useEventBus();
|
|
53426
|
+
const [connected, setConnected] = useState(false);
|
|
53427
|
+
const transport = useMemo(
|
|
53428
|
+
() => customTransport ?? createHttpTransport(serverUrl),
|
|
53429
|
+
[serverUrl, customTransport]
|
|
53430
|
+
);
|
|
53431
|
+
const registerSchema = useCallback(
|
|
53432
|
+
async () => transport.register(schema),
|
|
53433
|
+
[schema, transport]
|
|
53434
|
+
);
|
|
53435
|
+
const unregisterSchema = useCallback(
|
|
53436
|
+
async () => transport.unregister(),
|
|
53437
|
+
[transport]
|
|
53438
|
+
);
|
|
53439
|
+
const sendEvent = useCallback(async (orbitalName, event, payload) => {
|
|
53440
|
+
const emptyMeta = { success: false, clientEffects: 0, dataEntities: {}, emittedEvents: [] };
|
|
53441
|
+
if (!connected) return { effects: [], meta: emptyMeta };
|
|
53442
|
+
try {
|
|
53443
|
+
const result = await transport.sendEvent(orbitalName, event, payload);
|
|
53444
|
+
const effects = [];
|
|
53445
|
+
const responseData = result.data || {};
|
|
53446
|
+
const dataEntities = {};
|
|
53447
|
+
for (const [entityName, records] of Object.entries(responseData)) {
|
|
53448
|
+
dataEntities[entityName] = Array.isArray(records) ? records.length : 0;
|
|
53449
|
+
}
|
|
53450
|
+
const meta = {
|
|
53451
|
+
success: !!result.success,
|
|
53452
|
+
clientEffects: result.clientEffects?.length ?? 0,
|
|
53453
|
+
dataEntities,
|
|
53454
|
+
data: responseData,
|
|
53455
|
+
emittedEvents: result.emittedEvents?.map((e) => e.event) ?? [],
|
|
53456
|
+
error: result.error
|
|
53457
|
+
};
|
|
53458
|
+
if (result.success) {
|
|
53459
|
+
const tagged = result.clientEffectsByTrait;
|
|
53460
|
+
const tuples = tagged ? tagged.map((entry) => ({ effect: entry.effect, traitName: entry.traitName })) : (result.clientEffects ?? []).map((eff) => ({ effect: eff }));
|
|
53461
|
+
for (const { effect, traitName } of tuples) {
|
|
53462
|
+
const effectType = effect[0];
|
|
53463
|
+
if (effectType === "render-ui") {
|
|
53464
|
+
const slot = effect[1];
|
|
53465
|
+
const pattern = effect[2];
|
|
53466
|
+
effects.push({
|
|
53467
|
+
type: "render-ui",
|
|
53468
|
+
slot,
|
|
53469
|
+
pattern: pattern !== null && typeof pattern === "object" ? pattern : void 0,
|
|
53470
|
+
traitName
|
|
53471
|
+
});
|
|
53472
|
+
} else if (effectType === "navigate") {
|
|
53473
|
+
const route = effect[1];
|
|
53474
|
+
const rawParams = effect[2];
|
|
53475
|
+
effects.push({
|
|
53476
|
+
type: "navigate",
|
|
53477
|
+
route,
|
|
53478
|
+
params: rawParams !== null && rawParams !== void 0 && typeof rawParams === "object" && !Array.isArray(rawParams) ? rawParams : void 0,
|
|
53479
|
+
traitName
|
|
53480
|
+
});
|
|
53481
|
+
} else if (effectType === "notify") {
|
|
53482
|
+
const message = effect[1];
|
|
53483
|
+
effects.push({ type: "notify", message: typeof message === "string" ? message : void 0, traitName });
|
|
53484
|
+
}
|
|
53485
|
+
}
|
|
53486
|
+
if (result.emittedEvents) {
|
|
53487
|
+
for (const emitted of result.emittedEvents) {
|
|
53488
|
+
const evTrait = emitted.source?.trait;
|
|
53489
|
+
if (!evTrait) {
|
|
53490
|
+
xOrbitalLog.warn("emit:dropped-no-source", {
|
|
53491
|
+
event: emitted.event,
|
|
53492
|
+
dispatchOrbital: orbitalName
|
|
53493
|
+
});
|
|
53494
|
+
continue;
|
|
53495
|
+
}
|
|
53496
|
+
const key = emitted.source?.orbital ? `UI:${emitted.source.orbital}.${evTrait}.${emitted.event}` : `UI:${evTrait}.${emitted.event}`;
|
|
53497
|
+
xOrbitalLog.info("emit:rebroadcast", {
|
|
53498
|
+
busKey: key,
|
|
53499
|
+
sourceOrbital: emitted.source?.orbital,
|
|
53500
|
+
sourceTrait: evTrait,
|
|
53501
|
+
dispatchOrbital: orbitalName
|
|
53502
|
+
});
|
|
53503
|
+
eventBus.emit(key, emitted.payload);
|
|
53504
|
+
}
|
|
53505
|
+
}
|
|
53506
|
+
} else if (result.error) {
|
|
53507
|
+
xOrbitalLog.warn("response:fail", {
|
|
53508
|
+
orbital: orbitalName,
|
|
53509
|
+
event,
|
|
53510
|
+
error: result.error
|
|
53511
|
+
});
|
|
53512
|
+
}
|
|
53513
|
+
return { effects, meta };
|
|
53514
|
+
} catch (err) {
|
|
53515
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
53516
|
+
if (err instanceof TypeError) {
|
|
53517
|
+
xOrbitalLog.warn("response:network", {
|
|
53518
|
+
orbital: orbitalName,
|
|
53519
|
+
event,
|
|
53520
|
+
error: msg,
|
|
53521
|
+
reason: "peer endpoint unreachable (expected in standalone single-orbital mode)"
|
|
53522
|
+
});
|
|
53523
|
+
} else {
|
|
53524
|
+
xOrbitalLog.error("response:network", {
|
|
53525
|
+
orbital: orbitalName,
|
|
53526
|
+
event,
|
|
53527
|
+
error: msg
|
|
53528
|
+
});
|
|
53529
|
+
}
|
|
53530
|
+
return { effects: [], meta: { ...emptyMeta, error: msg } };
|
|
53531
|
+
}
|
|
53532
|
+
}, [connected, transport, eventBus]);
|
|
53533
|
+
useEffect(() => {
|
|
53534
|
+
if (!schema) return;
|
|
53535
|
+
let cancelled = false;
|
|
53536
|
+
registerSchema().then((ok) => {
|
|
53537
|
+
if (!cancelled && ok) setConnected(true);
|
|
53538
|
+
});
|
|
53539
|
+
return () => {
|
|
53540
|
+
cancelled = true;
|
|
53541
|
+
setConnected(false);
|
|
53542
|
+
unregisterSchema();
|
|
53543
|
+
};
|
|
53544
|
+
}, [schema, registerSchema, unregisterSchema]);
|
|
53545
|
+
return /* @__PURE__ */ jsx(ServerBridgeContext.Provider, { value: { connected, sendEvent }, children });
|
|
53546
|
+
}
|
|
53547
|
+
var log12 = createLogger("almadar:ui:trait-provider");
|
|
53548
|
+
var TraitContext = createContext(null);
|
|
53549
|
+
function TraitProvider({
|
|
53550
|
+
traits: traitBindings,
|
|
53551
|
+
children
|
|
53552
|
+
}) {
|
|
53553
|
+
const traitInstances = useMemo(() => {
|
|
53554
|
+
const map = /* @__PURE__ */ new Map();
|
|
53555
|
+
for (const binding of traitBindings) {
|
|
53556
|
+
const trait = binding.trait;
|
|
53557
|
+
const initialState = trait.states.find((s) => s.isInitial);
|
|
53558
|
+
const stateName = initialState?.name || trait.states[0]?.name || "idle";
|
|
53559
|
+
const instance = {
|
|
53560
|
+
name: trait.name,
|
|
53561
|
+
currentState: stateName,
|
|
53562
|
+
availableEvents: trait.transitions.filter((t) => t.from === stateName).map((t) => t.event),
|
|
53563
|
+
dispatch: (eventKey, payload) => {
|
|
53564
|
+
log12.debug("Dispatch", () => ({
|
|
53565
|
+
trait: trait.name,
|
|
53566
|
+
event: eventKey,
|
|
53567
|
+
payloadKeys: payload ? Object.keys(payload) : []
|
|
53568
|
+
}));
|
|
53569
|
+
},
|
|
53570
|
+
canDispatch: (eventKey) => {
|
|
53571
|
+
return trait.transitions.some(
|
|
53572
|
+
(t) => t.from === stateName && t.event === eventKey
|
|
53573
|
+
);
|
|
53574
|
+
},
|
|
53575
|
+
trait
|
|
53576
|
+
};
|
|
53577
|
+
map.set(trait.name, instance);
|
|
53578
|
+
}
|
|
53579
|
+
return map;
|
|
53580
|
+
}, [traitBindings]);
|
|
53581
|
+
const contextValue = useMemo(() => {
|
|
53582
|
+
return {
|
|
53583
|
+
traits: traitInstances,
|
|
53584
|
+
getTrait: (name) => traitInstances.get(name),
|
|
53585
|
+
dispatchToTrait: (traitName, eventKey, payload) => {
|
|
53586
|
+
const instance = traitInstances.get(traitName);
|
|
53587
|
+
if (instance) {
|
|
53588
|
+
instance.dispatch(eventKey, payload);
|
|
53589
|
+
}
|
|
53590
|
+
},
|
|
53591
|
+
canDispatch: (traitName, eventKey) => {
|
|
53592
|
+
const instance = traitInstances.get(traitName);
|
|
53593
|
+
return instance?.canDispatch(eventKey) || false;
|
|
53594
|
+
}
|
|
53595
|
+
};
|
|
53596
|
+
}, [traitInstances]);
|
|
53597
|
+
return /* @__PURE__ */ jsx(TraitContext.Provider, { value: contextValue, children });
|
|
53598
|
+
}
|
|
53599
|
+
function useTraitContext() {
|
|
53600
|
+
const context = useContext(TraitContext);
|
|
53601
|
+
if (!context) {
|
|
53602
|
+
throw new Error("useTraitContext must be used within a TraitProvider");
|
|
53603
|
+
}
|
|
53604
|
+
return context;
|
|
53605
|
+
}
|
|
53606
|
+
function useTrait(traitName) {
|
|
53607
|
+
const context = useTraitContext();
|
|
53608
|
+
return context.getTrait(traitName);
|
|
53609
|
+
}
|
|
52731
53610
|
var TraitScopeContext = createContext(null);
|
|
52732
53611
|
function TraitScopeProvider3({
|
|
52733
53612
|
orbital,
|
|
@@ -52773,4 +53652,4 @@ function useOptionalOfflineMode() {
|
|
|
52773
53652
|
return useContext(OfflineModeContext);
|
|
52774
53653
|
}
|
|
52775
53654
|
|
|
52776
|
-
export { EventBusContext2 as EventBusContext, EventBusProvider, OfflineModeProvider, OrbitalProvider, SelectionContext, SelectionProvider, TraitScopeProvider3 as TraitScopeProvider, VerificationProvider, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional, useTraitScope2 as useTraitScope };
|
|
53655
|
+
export { ANONYMOUS_USER, CurrentPagePathContext, CurrentPagePathProvider, EntitySchemaProvider, EventBusContext2 as EventBusContext, EventBusProvider, NavigationProvider2 as NavigationProvider, OfflineModeProvider, OrbitalProvider, OrbitalThemeProvider, SelectionContext, SelectionProvider, ServerBridgeProvider, TraitContext, TraitProvider, TraitScopeProvider3 as TraitScopeProvider, UserContext, UserProvider, VerificationProvider, extractRouteParams2 as extractRouteParams, findPageByName2 as findPageByName, findPageByPath2 as findPageByPath, getAllPages2 as getAllPages, getDefaultPage2 as getDefaultPage, matchPath2 as matchPath, pathMatches2 as pathMatches, useActivePage2 as useActivePage, useCurrentPagePath2 as useCurrentPagePath, useEntitySchema, useEntitySchemaOptional3 as useEntitySchemaOptional, useHasPermission, useHasRole, useInitPayload2 as useInitPayload, useNavigateTo2 as useNavigateTo, useNavigation2 as useNavigation, useNavigationId2 as useNavigationId, useNavigationState2 as useNavigationState, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional, useServerBridge, useTrait, useTraitContext, useTraitScope2 as useTraitScope, useUser, useUserForEvaluation };
|