@almadar/ui 2.20.0 → 2.20.6
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/LICENSE +72 -21
- package/dist/avl/index.cjs +1437 -1328
- package/dist/avl/index.d.cts +51 -47
- package/dist/avl/index.js +1408 -1299
- package/dist/components/atoms/avl/Avl3DLabel.d.ts +23 -0
- package/dist/components/atoms/avl/Avl3DTooltip.d.ts +25 -0
- package/dist/components/atoms/avl/index.d.ts +2 -0
- package/dist/components/index.cjs +3 -1
- package/dist/components/index.js +3 -1
- package/dist/components/molecules/avl/Avl3DCrossWire.d.ts +22 -0
- package/dist/components/molecules/avl/Avl3DEntityCore.d.ts +26 -0
- package/dist/components/molecules/avl/Avl3DExprTree.d.ts +21 -0
- package/dist/components/molecules/avl/Avl3DOrbitalNode.d.ts +29 -0
- package/dist/components/molecules/avl/Avl3DStateNode.d.ts +34 -0
- package/dist/components/molecules/avl/Avl3DTransitionArc.d.ts +38 -0
- package/dist/components/molecules/avl/index.d.ts +6 -0
- package/dist/components/organisms/avl/Avl3DApplicationScene.d.ts +19 -0
- package/dist/components/organisms/avl/Avl3DEffects.d.ts +18 -0
- package/dist/components/organisms/avl/Avl3DOrbitalScene.d.ts +23 -0
- package/dist/components/organisms/avl/Avl3DTraitScene.d.ts +19 -0
- package/dist/components/organisms/avl/Avl3DTransitionScene.d.ts +17 -0
- package/dist/components/organisms/avl/Avl3DViewer.d.ts +40 -0
- package/dist/components/organisms/avl/AvlOrbitalScene.d.ts +4 -0
- package/dist/components/organisms/avl/avl-3d-context.d.ts +32 -0
- package/dist/components/organisms/avl/avl-3d-layout.d.ts +116 -0
- package/dist/components/organisms/avl/avl-zoom-state.d.ts +3 -0
- package/dist/components/organisms/game/three/index.cjs +2549 -120
- package/dist/components/organisms/game/three/index.d.ts +8 -0
- package/dist/components/organisms/game/three/index.js +2419 -5
- package/dist/illustrations/index.cjs +2880 -109
- package/dist/illustrations/index.js +2879 -108
- package/dist/providers/OrbitalProvider.d.ts +4 -2
- package/dist/providers/index.cjs +263 -284
- package/dist/providers/index.js +189 -210
- package/dist/runtime/OrbPreview.d.ts +9 -6
- package/dist/runtime/ServerBridge.d.ts +23 -0
- package/dist/runtime/enrichFromResponse.d.ts +21 -0
- package/dist/runtime/index.cjs +31754 -2587
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +31735 -2571
- package/package.json +5 -2
package/dist/providers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React108 from 'react';
|
|
2
|
+
import React108__default, { createContext, useCallback, useState, useRef, useLayoutEffect, useEffect, lazy, useContext, useMemo } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { EventBusContext } from '@almadar/ui/providers';
|
|
5
5
|
import 'react-dom';
|
|
@@ -534,172 +534,6 @@ function useSelectionOptional() {
|
|
|
534
534
|
const context = useContext(SelectionContext);
|
|
535
535
|
return context;
|
|
536
536
|
}
|
|
537
|
-
var FetchedDataContext = createContext(null);
|
|
538
|
-
function FetchedDataProvider({
|
|
539
|
-
initialData,
|
|
540
|
-
children
|
|
541
|
-
}) {
|
|
542
|
-
const [state, setState] = useState(() => ({
|
|
543
|
-
data: initialData || {},
|
|
544
|
-
fetchedAt: {},
|
|
545
|
-
loading: false,
|
|
546
|
-
error: null
|
|
547
|
-
}));
|
|
548
|
-
const getData = useCallback(
|
|
549
|
-
(entityName) => {
|
|
550
|
-
return state.data[entityName] || [];
|
|
551
|
-
},
|
|
552
|
-
[state.data]
|
|
553
|
-
);
|
|
554
|
-
const getById = useCallback(
|
|
555
|
-
(entityName, id) => {
|
|
556
|
-
const records = state.data[entityName];
|
|
557
|
-
return records?.find((r) => r.id === id);
|
|
558
|
-
},
|
|
559
|
-
[state.data]
|
|
560
|
-
);
|
|
561
|
-
const hasData = useCallback(
|
|
562
|
-
(entityName) => {
|
|
563
|
-
return entityName in state.data && state.data[entityName].length > 0;
|
|
564
|
-
},
|
|
565
|
-
[state.data]
|
|
566
|
-
);
|
|
567
|
-
const getFetchedAt = useCallback(
|
|
568
|
-
(entityName) => {
|
|
569
|
-
return state.fetchedAt[entityName];
|
|
570
|
-
},
|
|
571
|
-
[state.fetchedAt]
|
|
572
|
-
);
|
|
573
|
-
const setData = useCallback((data) => {
|
|
574
|
-
const now = Date.now();
|
|
575
|
-
setState((prev) => ({
|
|
576
|
-
...prev,
|
|
577
|
-
data: {
|
|
578
|
-
...prev.data,
|
|
579
|
-
...data
|
|
580
|
-
},
|
|
581
|
-
fetchedAt: {
|
|
582
|
-
...prev.fetchedAt,
|
|
583
|
-
...Object.keys(data).reduce(
|
|
584
|
-
(acc, key) => ({ ...acc, [key]: now }),
|
|
585
|
-
{}
|
|
586
|
-
)
|
|
587
|
-
},
|
|
588
|
-
loading: false,
|
|
589
|
-
error: null
|
|
590
|
-
}));
|
|
591
|
-
}, []);
|
|
592
|
-
const clearData = useCallback(() => {
|
|
593
|
-
setState((prev) => ({
|
|
594
|
-
...prev,
|
|
595
|
-
data: {},
|
|
596
|
-
fetchedAt: {}
|
|
597
|
-
}));
|
|
598
|
-
}, []);
|
|
599
|
-
const clearEntity = useCallback((entityName) => {
|
|
600
|
-
setState((prev) => {
|
|
601
|
-
const newData = { ...prev.data };
|
|
602
|
-
const newFetchedAt = { ...prev.fetchedAt };
|
|
603
|
-
delete newData[entityName];
|
|
604
|
-
delete newFetchedAt[entityName];
|
|
605
|
-
return {
|
|
606
|
-
...prev,
|
|
607
|
-
data: newData,
|
|
608
|
-
fetchedAt: newFetchedAt
|
|
609
|
-
};
|
|
610
|
-
});
|
|
611
|
-
}, []);
|
|
612
|
-
const setLoading = useCallback((loading) => {
|
|
613
|
-
setState((prev) => ({ ...prev, loading }));
|
|
614
|
-
}, []);
|
|
615
|
-
const setError = useCallback((error) => {
|
|
616
|
-
setState((prev) => ({ ...prev, error, loading: false }));
|
|
617
|
-
}, []);
|
|
618
|
-
const contextValue = useMemo(
|
|
619
|
-
() => ({
|
|
620
|
-
getData,
|
|
621
|
-
getById,
|
|
622
|
-
hasData,
|
|
623
|
-
getFetchedAt,
|
|
624
|
-
setData,
|
|
625
|
-
clearData,
|
|
626
|
-
clearEntity,
|
|
627
|
-
loading: state.loading,
|
|
628
|
-
setLoading,
|
|
629
|
-
error: state.error,
|
|
630
|
-
setError
|
|
631
|
-
}),
|
|
632
|
-
[
|
|
633
|
-
getData,
|
|
634
|
-
getById,
|
|
635
|
-
hasData,
|
|
636
|
-
getFetchedAt,
|
|
637
|
-
setData,
|
|
638
|
-
clearData,
|
|
639
|
-
clearEntity,
|
|
640
|
-
state.loading,
|
|
641
|
-
setLoading,
|
|
642
|
-
state.error,
|
|
643
|
-
setError
|
|
644
|
-
]
|
|
645
|
-
);
|
|
646
|
-
return /* @__PURE__ */ jsx(FetchedDataContext.Provider, { value: contextValue, children });
|
|
647
|
-
}
|
|
648
|
-
function useFetchedDataContext() {
|
|
649
|
-
return useContext(FetchedDataContext);
|
|
650
|
-
}
|
|
651
|
-
function useFetchedData() {
|
|
652
|
-
const context = useContext(FetchedDataContext);
|
|
653
|
-
if (!context) {
|
|
654
|
-
return {
|
|
655
|
-
getData: () => [],
|
|
656
|
-
getById: () => void 0,
|
|
657
|
-
hasData: () => false,
|
|
658
|
-
getFetchedAt: () => void 0,
|
|
659
|
-
setData: () => {
|
|
660
|
-
},
|
|
661
|
-
clearData: () => {
|
|
662
|
-
},
|
|
663
|
-
clearEntity: () => {
|
|
664
|
-
},
|
|
665
|
-
loading: false,
|
|
666
|
-
setLoading: () => {
|
|
667
|
-
},
|
|
668
|
-
error: null,
|
|
669
|
-
setError: () => {
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
return context;
|
|
674
|
-
}
|
|
675
|
-
function useFetchedEntity(entityName) {
|
|
676
|
-
const context = useFetchedData();
|
|
677
|
-
return {
|
|
678
|
-
/** All fetched records for this entity */
|
|
679
|
-
records: context.getData(entityName),
|
|
680
|
-
/** Get a record by ID */
|
|
681
|
-
getById: (id) => context.getById(entityName, id),
|
|
682
|
-
/** Whether data has been fetched for this entity */
|
|
683
|
-
hasData: context.hasData(entityName),
|
|
684
|
-
/** When data was last fetched */
|
|
685
|
-
fetchedAt: context.getFetchedAt(entityName),
|
|
686
|
-
/** Whether data is loading */
|
|
687
|
-
loading: context.loading,
|
|
688
|
-
/** Current error */
|
|
689
|
-
error: context.error
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
var EntityDataContext = createContext(null);
|
|
693
|
-
function EntityDataProvider({
|
|
694
|
-
adapter,
|
|
695
|
-
children
|
|
696
|
-
}) {
|
|
697
|
-
return React110__default.createElement(
|
|
698
|
-
EntityDataContext.Provider,
|
|
699
|
-
{ value: adapter },
|
|
700
|
-
children
|
|
701
|
-
);
|
|
702
|
-
}
|
|
703
537
|
function cn(...inputs) {
|
|
704
538
|
return twMerge(clsx(inputs));
|
|
705
539
|
}
|
|
@@ -840,7 +674,7 @@ var positionStyles = {
|
|
|
840
674
|
fixed: "fixed",
|
|
841
675
|
sticky: "sticky"
|
|
842
676
|
};
|
|
843
|
-
var Box =
|
|
677
|
+
var Box = React108__default.forwardRef(
|
|
844
678
|
({
|
|
845
679
|
padding,
|
|
846
680
|
paddingX,
|
|
@@ -1110,7 +944,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
1110
944
|
const IconComp = value;
|
|
1111
945
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
1112
946
|
}
|
|
1113
|
-
if (
|
|
947
|
+
if (React108__default.isValidElement(value)) {
|
|
1114
948
|
return value;
|
|
1115
949
|
}
|
|
1116
950
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -1119,7 +953,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
1119
953
|
}
|
|
1120
954
|
return value;
|
|
1121
955
|
}
|
|
1122
|
-
var Button =
|
|
956
|
+
var Button = React108__default.forwardRef(
|
|
1123
957
|
({
|
|
1124
958
|
className,
|
|
1125
959
|
variant = "primary",
|
|
@@ -1214,7 +1048,7 @@ var sizeStyles3 = {
|
|
|
1214
1048
|
md: "px-2.5 py-1 text-sm",
|
|
1215
1049
|
lg: "px-3 py-1.5 text-base"
|
|
1216
1050
|
};
|
|
1217
|
-
var Badge =
|
|
1051
|
+
var Badge = React108__default.forwardRef(
|
|
1218
1052
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
1219
1053
|
const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
1220
1054
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -1241,7 +1075,7 @@ var Badge = React110__default.forwardRef(
|
|
|
1241
1075
|
}
|
|
1242
1076
|
);
|
|
1243
1077
|
Badge.displayName = "Badge";
|
|
1244
|
-
var Input =
|
|
1078
|
+
var Input = React108__default.forwardRef(
|
|
1245
1079
|
({
|
|
1246
1080
|
className,
|
|
1247
1081
|
inputType,
|
|
@@ -1353,7 +1187,7 @@ var Input = React110__default.forwardRef(
|
|
|
1353
1187
|
}
|
|
1354
1188
|
);
|
|
1355
1189
|
Input.displayName = "Input";
|
|
1356
|
-
var Label =
|
|
1190
|
+
var Label = React108__default.forwardRef(
|
|
1357
1191
|
({ className, required, children, ...props }, ref) => {
|
|
1358
1192
|
return /* @__PURE__ */ jsxs(
|
|
1359
1193
|
"label",
|
|
@@ -1373,7 +1207,7 @@ var Label = React110__default.forwardRef(
|
|
|
1373
1207
|
}
|
|
1374
1208
|
);
|
|
1375
1209
|
Label.displayName = "Label";
|
|
1376
|
-
var Textarea =
|
|
1210
|
+
var Textarea = React108__default.forwardRef(
|
|
1377
1211
|
({ className, error, ...props }, ref) => {
|
|
1378
1212
|
return /* @__PURE__ */ jsx(
|
|
1379
1213
|
"textarea",
|
|
@@ -1396,7 +1230,7 @@ var Textarea = React110__default.forwardRef(
|
|
|
1396
1230
|
}
|
|
1397
1231
|
);
|
|
1398
1232
|
Textarea.displayName = "Textarea";
|
|
1399
|
-
var Select =
|
|
1233
|
+
var Select = React108__default.forwardRef(
|
|
1400
1234
|
({ className, options, placeholder, error, ...props }, ref) => {
|
|
1401
1235
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1402
1236
|
/* @__PURE__ */ jsxs(
|
|
@@ -1432,7 +1266,7 @@ var Select = React110__default.forwardRef(
|
|
|
1432
1266
|
}
|
|
1433
1267
|
);
|
|
1434
1268
|
Select.displayName = "Select";
|
|
1435
|
-
var Checkbox =
|
|
1269
|
+
var Checkbox = React108__default.forwardRef(
|
|
1436
1270
|
({ className, label, id, ...props }, ref) => {
|
|
1437
1271
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
1438
1272
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
@@ -1506,7 +1340,7 @@ var shadowStyles2 = {
|
|
|
1506
1340
|
md: "shadow-[var(--shadow-main)]",
|
|
1507
1341
|
lg: "shadow-[var(--shadow-lg)]"
|
|
1508
1342
|
};
|
|
1509
|
-
var Card =
|
|
1343
|
+
var Card = React108__default.forwardRef(
|
|
1510
1344
|
({
|
|
1511
1345
|
className,
|
|
1512
1346
|
variant = "bordered",
|
|
@@ -1542,9 +1376,9 @@ var Card = React110__default.forwardRef(
|
|
|
1542
1376
|
}
|
|
1543
1377
|
);
|
|
1544
1378
|
Card.displayName = "Card";
|
|
1545
|
-
var CardHeader =
|
|
1379
|
+
var CardHeader = React108__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
1546
1380
|
CardHeader.displayName = "CardHeader";
|
|
1547
|
-
var CardTitle =
|
|
1381
|
+
var CardTitle = React108__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1548
1382
|
"h3",
|
|
1549
1383
|
{
|
|
1550
1384
|
ref,
|
|
@@ -1557,11 +1391,11 @@ var CardTitle = React110__default.forwardRef(({ className, ...props }, ref) => /
|
|
|
1557
1391
|
}
|
|
1558
1392
|
));
|
|
1559
1393
|
CardTitle.displayName = "CardTitle";
|
|
1560
|
-
var CardContent =
|
|
1394
|
+
var CardContent = React108__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
1561
1395
|
CardContent.displayName = "CardContent";
|
|
1562
1396
|
var CardBody = CardContent;
|
|
1563
1397
|
CardBody.displayName = "CardBody";
|
|
1564
|
-
var CardFooter =
|
|
1398
|
+
var CardFooter = React108__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1565
1399
|
"div",
|
|
1566
1400
|
{
|
|
1567
1401
|
ref,
|
|
@@ -1576,7 +1410,7 @@ var sizeStyles4 = {
|
|
|
1576
1410
|
md: "h-6 w-6",
|
|
1577
1411
|
lg: "h-8 w-8"
|
|
1578
1412
|
};
|
|
1579
|
-
var Spinner =
|
|
1413
|
+
var Spinner = React108__default.forwardRef(
|
|
1580
1414
|
({ className, size = "md", ...props }, ref) => {
|
|
1581
1415
|
return /* @__PURE__ */ jsx(
|
|
1582
1416
|
"div",
|
|
@@ -1590,7 +1424,7 @@ var Spinner = React110__default.forwardRef(
|
|
|
1590
1424
|
}
|
|
1591
1425
|
);
|
|
1592
1426
|
Spinner.displayName = "Spinner";
|
|
1593
|
-
var Radio =
|
|
1427
|
+
var Radio = React108__default.forwardRef(
|
|
1594
1428
|
({
|
|
1595
1429
|
label,
|
|
1596
1430
|
helperText,
|
|
@@ -1694,7 +1528,7 @@ var Radio = React110__default.forwardRef(
|
|
|
1694
1528
|
}
|
|
1695
1529
|
);
|
|
1696
1530
|
Radio.displayName = "Radio";
|
|
1697
|
-
var Switch =
|
|
1531
|
+
var Switch = React108.forwardRef(
|
|
1698
1532
|
({
|
|
1699
1533
|
checked,
|
|
1700
1534
|
defaultChecked = false,
|
|
@@ -1705,10 +1539,10 @@ var Switch = React110.forwardRef(
|
|
|
1705
1539
|
name,
|
|
1706
1540
|
className
|
|
1707
1541
|
}, ref) => {
|
|
1708
|
-
const [isChecked, setIsChecked] =
|
|
1542
|
+
const [isChecked, setIsChecked] = React108.useState(
|
|
1709
1543
|
checked !== void 0 ? checked : defaultChecked
|
|
1710
1544
|
);
|
|
1711
|
-
|
|
1545
|
+
React108.useEffect(() => {
|
|
1712
1546
|
if (checked !== void 0) {
|
|
1713
1547
|
setIsChecked(checked);
|
|
1714
1548
|
}
|
|
@@ -1866,7 +1700,7 @@ var sizeStyles5 = {
|
|
|
1866
1700
|
md: "w-2.5 h-2.5",
|
|
1867
1701
|
lg: "w-3 h-3"
|
|
1868
1702
|
};
|
|
1869
|
-
var StatusDot =
|
|
1703
|
+
var StatusDot = React108__default.forwardRef(
|
|
1870
1704
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
1871
1705
|
return /* @__PURE__ */ jsx(
|
|
1872
1706
|
"span",
|
|
@@ -1913,7 +1747,7 @@ var iconMap2 = {
|
|
|
1913
1747
|
down: TrendingDown,
|
|
1914
1748
|
flat: ArrowRight
|
|
1915
1749
|
};
|
|
1916
|
-
var TrendIndicator =
|
|
1750
|
+
var TrendIndicator = React108__default.forwardRef(
|
|
1917
1751
|
({
|
|
1918
1752
|
className,
|
|
1919
1753
|
value,
|
|
@@ -1972,7 +1806,7 @@ var thumbSizes = {
|
|
|
1972
1806
|
md: "w-4 h-4",
|
|
1973
1807
|
lg: "w-5 h-5"
|
|
1974
1808
|
};
|
|
1975
|
-
var RangeSlider =
|
|
1809
|
+
var RangeSlider = React108__default.forwardRef(
|
|
1976
1810
|
({
|
|
1977
1811
|
className,
|
|
1978
1812
|
min = 0,
|
|
@@ -2175,7 +2009,7 @@ var paddingClasses = {
|
|
|
2175
2009
|
md: "py-16",
|
|
2176
2010
|
lg: "py-24"
|
|
2177
2011
|
};
|
|
2178
|
-
var ContentSection =
|
|
2012
|
+
var ContentSection = React108__default.forwardRef(
|
|
2179
2013
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
2180
2014
|
return /* @__PURE__ */ jsx(
|
|
2181
2015
|
Box,
|
|
@@ -2349,7 +2183,7 @@ var ErrorState = ({
|
|
|
2349
2183
|
);
|
|
2350
2184
|
};
|
|
2351
2185
|
ErrorState.displayName = "ErrorState";
|
|
2352
|
-
var ErrorBoundary = class extends
|
|
2186
|
+
var ErrorBoundary = class extends React108__default.Component {
|
|
2353
2187
|
constructor(props) {
|
|
2354
2188
|
super(props);
|
|
2355
2189
|
__publicField(this, "reset", () => {
|
|
@@ -2929,7 +2763,7 @@ function bindTraitStateGetter(getter) {
|
|
|
2929
2763
|
}
|
|
2930
2764
|
}
|
|
2931
2765
|
exposeOnWindow();
|
|
2932
|
-
var MarkdownContent =
|
|
2766
|
+
var MarkdownContent = React108__default.memo(
|
|
2933
2767
|
({ content, direction, className }) => {
|
|
2934
2768
|
const { t: _t } = useTranslate();
|
|
2935
2769
|
return /* @__PURE__ */ jsx(
|
|
@@ -3030,7 +2864,7 @@ var MarkdownContent = React110__default.memo(
|
|
|
3030
2864
|
(prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
|
|
3031
2865
|
);
|
|
3032
2866
|
MarkdownContent.displayName = "MarkdownContent";
|
|
3033
|
-
var CodeBlock =
|
|
2867
|
+
var CodeBlock = React108__default.memo(
|
|
3034
2868
|
({
|
|
3035
2869
|
code,
|
|
3036
2870
|
language = "text",
|
|
@@ -3146,12 +2980,12 @@ GameAudioContext.displayName = "GameAudioContext";
|
|
|
3146
2980
|
|
|
3147
2981
|
// components/organisms/component-registry.generated.ts
|
|
3148
2982
|
function lazyThree(name, loader) {
|
|
3149
|
-
const Lazy =
|
|
2983
|
+
const Lazy = React108__default.lazy(() => loader().then((m) => ({ default: m[name] })));
|
|
3150
2984
|
function ThreeWrapper(props) {
|
|
3151
|
-
return
|
|
3152
|
-
|
|
2985
|
+
return React108__default.createElement(
|
|
2986
|
+
React108__default.Suspense,
|
|
3153
2987
|
{ fallback: null },
|
|
3154
|
-
|
|
2988
|
+
React108__default.createElement(Lazy, props)
|
|
3155
2989
|
);
|
|
3156
2990
|
}
|
|
3157
2991
|
ThreeWrapper.displayName = `Lazy(${name})`;
|
|
@@ -3178,7 +3012,7 @@ function SuspenseConfigProvider({
|
|
|
3178
3012
|
config,
|
|
3179
3013
|
children
|
|
3180
3014
|
}) {
|
|
3181
|
-
return
|
|
3015
|
+
return React108__default.createElement(
|
|
3182
3016
|
SuspenseConfigContext.Provider,
|
|
3183
3017
|
{ value: config },
|
|
3184
3018
|
children
|
|
@@ -3323,16 +3157,6 @@ function VerificationProvider({
|
|
|
3323
3157
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
3324
3158
|
}
|
|
3325
3159
|
VerificationProvider.displayName = "VerificationProvider";
|
|
3326
|
-
function FetchedDataBridge({ children }) {
|
|
3327
|
-
const fetchedData = useFetchedData();
|
|
3328
|
-
const adapter = useMemo(() => ({
|
|
3329
|
-
getData: (entity) => fetchedData.getData(entity),
|
|
3330
|
-
getById: (entity, id) => fetchedData.getById(entity, id),
|
|
3331
|
-
isLoading: fetchedData.loading,
|
|
3332
|
-
error: fetchedData.error
|
|
3333
|
-
}), [fetchedData.getData, fetchedData.getById, fetchedData.loading, fetchedData.error]);
|
|
3334
|
-
return /* @__PURE__ */ jsx(EntityDataProvider, { adapter, children });
|
|
3335
|
-
}
|
|
3336
3160
|
function OrbitalProvider({
|
|
3337
3161
|
children,
|
|
3338
3162
|
themes,
|
|
@@ -3349,7 +3173,7 @@ function OrbitalProvider({
|
|
|
3349
3173
|
() => ({ enabled: suspense }),
|
|
3350
3174
|
[suspense]
|
|
3351
3175
|
);
|
|
3352
|
-
const inner = /* @__PURE__ */ jsx(
|
|
3176
|
+
const inner = /* @__PURE__ */ jsx(EventBusProvider, { debug: debug2, children: /* @__PURE__ */ jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) });
|
|
3353
3177
|
if (skipTheme) {
|
|
3354
3178
|
return inner;
|
|
3355
3179
|
}
|
|
@@ -3365,6 +3189,161 @@ function OrbitalProvider({
|
|
|
3365
3189
|
);
|
|
3366
3190
|
}
|
|
3367
3191
|
OrbitalProvider.displayName = "OrbitalProvider";
|
|
3192
|
+
var FetchedDataContext = createContext(null);
|
|
3193
|
+
function FetchedDataProvider({
|
|
3194
|
+
initialData,
|
|
3195
|
+
children
|
|
3196
|
+
}) {
|
|
3197
|
+
const [state, setState] = useState(() => ({
|
|
3198
|
+
data: initialData || {},
|
|
3199
|
+
fetchedAt: {},
|
|
3200
|
+
loading: false,
|
|
3201
|
+
error: null
|
|
3202
|
+
}));
|
|
3203
|
+
const getData = useCallback(
|
|
3204
|
+
(entityName) => {
|
|
3205
|
+
return state.data[entityName] || [];
|
|
3206
|
+
},
|
|
3207
|
+
[state.data]
|
|
3208
|
+
);
|
|
3209
|
+
const getById = useCallback(
|
|
3210
|
+
(entityName, id) => {
|
|
3211
|
+
const records = state.data[entityName];
|
|
3212
|
+
return records?.find((r) => r.id === id);
|
|
3213
|
+
},
|
|
3214
|
+
[state.data]
|
|
3215
|
+
);
|
|
3216
|
+
const hasData = useCallback(
|
|
3217
|
+
(entityName) => {
|
|
3218
|
+
return entityName in state.data && state.data[entityName].length > 0;
|
|
3219
|
+
},
|
|
3220
|
+
[state.data]
|
|
3221
|
+
);
|
|
3222
|
+
const getFetchedAt = useCallback(
|
|
3223
|
+
(entityName) => {
|
|
3224
|
+
return state.fetchedAt[entityName];
|
|
3225
|
+
},
|
|
3226
|
+
[state.fetchedAt]
|
|
3227
|
+
);
|
|
3228
|
+
const setData = useCallback((data) => {
|
|
3229
|
+
const now = Date.now();
|
|
3230
|
+
setState((prev) => ({
|
|
3231
|
+
...prev,
|
|
3232
|
+
data: {
|
|
3233
|
+
...prev.data,
|
|
3234
|
+
...data
|
|
3235
|
+
},
|
|
3236
|
+
fetchedAt: {
|
|
3237
|
+
...prev.fetchedAt,
|
|
3238
|
+
...Object.keys(data).reduce(
|
|
3239
|
+
(acc, key) => ({ ...acc, [key]: now }),
|
|
3240
|
+
{}
|
|
3241
|
+
)
|
|
3242
|
+
},
|
|
3243
|
+
loading: false,
|
|
3244
|
+
error: null
|
|
3245
|
+
}));
|
|
3246
|
+
}, []);
|
|
3247
|
+
const clearData = useCallback(() => {
|
|
3248
|
+
setState((prev) => ({
|
|
3249
|
+
...prev,
|
|
3250
|
+
data: {},
|
|
3251
|
+
fetchedAt: {}
|
|
3252
|
+
}));
|
|
3253
|
+
}, []);
|
|
3254
|
+
const clearEntity = useCallback((entityName) => {
|
|
3255
|
+
setState((prev) => {
|
|
3256
|
+
const newData = { ...prev.data };
|
|
3257
|
+
const newFetchedAt = { ...prev.fetchedAt };
|
|
3258
|
+
delete newData[entityName];
|
|
3259
|
+
delete newFetchedAt[entityName];
|
|
3260
|
+
return {
|
|
3261
|
+
...prev,
|
|
3262
|
+
data: newData,
|
|
3263
|
+
fetchedAt: newFetchedAt
|
|
3264
|
+
};
|
|
3265
|
+
});
|
|
3266
|
+
}, []);
|
|
3267
|
+
const setLoading = useCallback((loading) => {
|
|
3268
|
+
setState((prev) => ({ ...prev, loading }));
|
|
3269
|
+
}, []);
|
|
3270
|
+
const setError = useCallback((error) => {
|
|
3271
|
+
setState((prev) => ({ ...prev, error, loading: false }));
|
|
3272
|
+
}, []);
|
|
3273
|
+
const contextValue = useMemo(
|
|
3274
|
+
() => ({
|
|
3275
|
+
getData,
|
|
3276
|
+
getById,
|
|
3277
|
+
hasData,
|
|
3278
|
+
getFetchedAt,
|
|
3279
|
+
setData,
|
|
3280
|
+
clearData,
|
|
3281
|
+
clearEntity,
|
|
3282
|
+
loading: state.loading,
|
|
3283
|
+
setLoading,
|
|
3284
|
+
error: state.error,
|
|
3285
|
+
setError
|
|
3286
|
+
}),
|
|
3287
|
+
[
|
|
3288
|
+
getData,
|
|
3289
|
+
getById,
|
|
3290
|
+
hasData,
|
|
3291
|
+
getFetchedAt,
|
|
3292
|
+
setData,
|
|
3293
|
+
clearData,
|
|
3294
|
+
clearEntity,
|
|
3295
|
+
state.loading,
|
|
3296
|
+
setLoading,
|
|
3297
|
+
state.error,
|
|
3298
|
+
setError
|
|
3299
|
+
]
|
|
3300
|
+
);
|
|
3301
|
+
return /* @__PURE__ */ jsx(FetchedDataContext.Provider, { value: contextValue, children });
|
|
3302
|
+
}
|
|
3303
|
+
function useFetchedDataContext() {
|
|
3304
|
+
return useContext(FetchedDataContext);
|
|
3305
|
+
}
|
|
3306
|
+
function useFetchedData() {
|
|
3307
|
+
const context = useContext(FetchedDataContext);
|
|
3308
|
+
if (!context) {
|
|
3309
|
+
return {
|
|
3310
|
+
getData: () => [],
|
|
3311
|
+
getById: () => void 0,
|
|
3312
|
+
hasData: () => false,
|
|
3313
|
+
getFetchedAt: () => void 0,
|
|
3314
|
+
setData: () => {
|
|
3315
|
+
},
|
|
3316
|
+
clearData: () => {
|
|
3317
|
+
},
|
|
3318
|
+
clearEntity: () => {
|
|
3319
|
+
},
|
|
3320
|
+
loading: false,
|
|
3321
|
+
setLoading: () => {
|
|
3322
|
+
},
|
|
3323
|
+
error: null,
|
|
3324
|
+
setError: () => {
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
}
|
|
3328
|
+
return context;
|
|
3329
|
+
}
|
|
3330
|
+
function useFetchedEntity(entityName) {
|
|
3331
|
+
const context = useFetchedData();
|
|
3332
|
+
return {
|
|
3333
|
+
/** All fetched records for this entity */
|
|
3334
|
+
records: context.getData(entityName),
|
|
3335
|
+
/** Get a record by ID */
|
|
3336
|
+
getById: (id) => context.getById(entityName, id),
|
|
3337
|
+
/** Whether data has been fetched for this entity */
|
|
3338
|
+
hasData: context.hasData(entityName),
|
|
3339
|
+
/** When data was last fetched */
|
|
3340
|
+
fetchedAt: context.getFetchedAt(entityName),
|
|
3341
|
+
/** Whether data is loading */
|
|
3342
|
+
loading: context.loading,
|
|
3343
|
+
/** Current error */
|
|
3344
|
+
error: context.error
|
|
3345
|
+
};
|
|
3346
|
+
}
|
|
3368
3347
|
var OfflineModeContext = createContext(null);
|
|
3369
3348
|
function OfflineModeProvider({
|
|
3370
3349
|
children,
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* OrbPreview Component
|
|
3
3
|
*
|
|
4
4
|
* Renders a live preview of an Orbital schema (.orb program).
|
|
5
|
-
*
|
|
6
|
-
* and
|
|
5
|
+
* Uses static imports (no lazy loading) to ensure all providers,
|
|
6
|
+
* hooks, and components share the same module instances.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
9
|
* <OrbPreview schema={orbJsonStringOrObject} />
|
|
10
|
+
* <OrbPreview schema={schema} serverUrl="/api/orbitals" />
|
|
10
11
|
*
|
|
11
12
|
* @packageDocumentation
|
|
12
13
|
*/
|
|
@@ -20,20 +21,22 @@ export interface OrbPreviewProps {
|
|
|
20
21
|
height?: string;
|
|
21
22
|
/** CSS class for the outer container. */
|
|
22
23
|
className?: string;
|
|
24
|
+
/** Server URL for dual execution (e.g. "/api/orbitals"). When set, events are forwarded to the server. */
|
|
25
|
+
serverUrl?: string;
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Renders a live preview of an Orbital schema.
|
|
26
29
|
*
|
|
27
|
-
*
|
|
28
|
-
* and
|
|
29
|
-
* and any context where you want to show a running .orb program.
|
|
30
|
+
* Uses static imports for all runtime components to ensure providers
|
|
31
|
+
* and hooks share the same module instances (no context duplication).
|
|
30
32
|
*
|
|
31
33
|
* @example
|
|
32
34
|
* ```tsx
|
|
33
35
|
* <OrbPreview schema={orbJsonString} height="300px" />
|
|
36
|
+
* <OrbPreview schema={schema} serverUrl="/api/orbitals" />
|
|
34
37
|
* ```
|
|
35
38
|
*/
|
|
36
|
-
export declare function OrbPreview({ schema, mockData, height, className, }: OrbPreviewProps): React.ReactElement;
|
|
39
|
+
export declare function OrbPreview({ schema, mockData, height, className, serverUrl, }: OrbPreviewProps): React.ReactElement;
|
|
37
40
|
export declare namespace OrbPreview {
|
|
38
41
|
var displayName: string;
|
|
39
42
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface ServerClientEffect {
|
|
3
|
+
type: 'render-ui' | 'navigate' | 'notify';
|
|
4
|
+
slot?: string;
|
|
5
|
+
pattern?: Record<string, unknown>;
|
|
6
|
+
route?: string;
|
|
7
|
+
params?: Record<string, unknown>;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ServerBridgeContextValue {
|
|
11
|
+
connected: boolean;
|
|
12
|
+
sendEvent: (orbitalName: string, event: string, payload?: Record<string, unknown>) => Promise<ServerClientEffect[]>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Access the server bridge. Returns a no-op stub when outside the provider.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useServerBridge(): ServerBridgeContextValue;
|
|
18
|
+
export interface ServerBridgeProviderProps {
|
|
19
|
+
schema: unknown;
|
|
20
|
+
serverUrl: string;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function ServerBridgeProvider({ schema, serverUrl, children, }: ServerBridgeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* enrichFromResponse
|
|
3
|
+
*
|
|
4
|
+
* Walks a pattern tree from a server response and injects entity data
|
|
5
|
+
* into entity-aware patterns. Uses isEntityAwarePattern() from
|
|
6
|
+
* @almadar/patterns (registry-driven, not a hardcoded list).
|
|
7
|
+
*
|
|
8
|
+
* This is the single place where entity data meets UI patterns.
|
|
9
|
+
* Called by ServerBridge/ServerBridgeProvider when processing
|
|
10
|
+
* clientEffects from the server response.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Enrich a pattern tree with entity data from a server response.
|
|
16
|
+
*
|
|
17
|
+
* @param node - Pattern config node (from server clientEffects)
|
|
18
|
+
* @param data - Entity records keyed by entity name (from server response.data)
|
|
19
|
+
* @returns Enriched pattern with entity arrays injected
|
|
20
|
+
*/
|
|
21
|
+
export declare function enrichFromResponse(node: Record<string, unknown>, data: Record<string, unknown[]>): Record<string, unknown>;
|