@almadar/ui 4.8.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +1369 -1282
- package/dist/avl/index.js +276 -189
- package/dist/components/index.cjs +33 -6
- package/dist/components/index.js +35 -8
- package/dist/components/organisms/game/three/index.cjs +17 -1
- package/dist/components/organisms/game/three/index.js +18 -2
- package/dist/docs/index.cjs +54 -34
- package/dist/docs/index.js +32 -12
- package/dist/hooks/index.cjs +17 -1
- package/dist/hooks/index.js +18 -2
- package/dist/marketing/index.cjs +66 -46
- package/dist/marketing/index.js +37 -17
- package/dist/providers/TraitScopeProvider.d.ts +43 -0
- package/dist/providers/index.cjs +47 -6
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +48 -9
- package/dist/runtime/EntitySchemaContext.d.ts +16 -1
- package/dist/runtime/index.cjs +90 -23
- package/dist/runtime/index.js +92 -25
- package/package.json +1 -1
package/dist/marketing/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React6 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var LucideIcons = require('lucide-react');
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var React6__default = /*#__PURE__*/_interopDefault(React6);
|
|
28
28
|
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
29
29
|
|
|
30
30
|
// node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
@@ -2556,7 +2556,11 @@ function createLogger(namespace) {
|
|
|
2556
2556
|
}
|
|
2557
2557
|
createLogger("almadar:eventbus");
|
|
2558
2558
|
createLogger("almadar:eventbus:subscribe");
|
|
2559
|
-
var EventBusContext =
|
|
2559
|
+
var EventBusContext = React6.createContext(null);
|
|
2560
|
+
var TraitScopeContext = React6.createContext(null);
|
|
2561
|
+
function useTraitScope() {
|
|
2562
|
+
return React6.useContext(TraitScopeContext);
|
|
2563
|
+
}
|
|
2560
2564
|
|
|
2561
2565
|
// hooks/useEventBus.ts
|
|
2562
2566
|
var log = createLogger("almadar:eventbus");
|
|
@@ -2632,8 +2636,24 @@ var fallbackEventBus = {
|
|
|
2632
2636
|
}
|
|
2633
2637
|
};
|
|
2634
2638
|
function useEventBus() {
|
|
2635
|
-
const context =
|
|
2636
|
-
|
|
2639
|
+
const context = React6.useContext(EventBusContext);
|
|
2640
|
+
const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
2641
|
+
const scope = useTraitScope();
|
|
2642
|
+
return React6.useMemo(() => {
|
|
2643
|
+
if (!scope) return baseBus;
|
|
2644
|
+
return {
|
|
2645
|
+
...baseBus,
|
|
2646
|
+
emit: (type, payload, source) => {
|
|
2647
|
+
if (typeof type === "string" && type.startsWith("UI:")) {
|
|
2648
|
+
const tail = type.slice(3);
|
|
2649
|
+
const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
|
|
2650
|
+
baseBus.emit(qualified, payload, source);
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
baseBus.emit(type, payload, source);
|
|
2654
|
+
}
|
|
2655
|
+
};
|
|
2656
|
+
}, [baseBus, scope]);
|
|
2637
2657
|
}
|
|
2638
2658
|
var paddingStyles = {
|
|
2639
2659
|
none: "p-0",
|
|
@@ -2737,7 +2757,7 @@ var positionStyles = {
|
|
|
2737
2757
|
fixed: "fixed",
|
|
2738
2758
|
sticky: "sticky"
|
|
2739
2759
|
};
|
|
2740
|
-
var Box =
|
|
2760
|
+
var Box = React6__default.default.forwardRef(
|
|
2741
2761
|
({
|
|
2742
2762
|
padding,
|
|
2743
2763
|
paddingX,
|
|
@@ -2767,20 +2787,20 @@ var Box = React5__default.default.forwardRef(
|
|
|
2767
2787
|
...rest
|
|
2768
2788
|
}, ref) => {
|
|
2769
2789
|
const eventBus = useEventBus();
|
|
2770
|
-
const handleClick =
|
|
2790
|
+
const handleClick = React6.useCallback((e) => {
|
|
2771
2791
|
if (action) {
|
|
2772
2792
|
e.stopPropagation();
|
|
2773
2793
|
eventBus.emit(`UI:${action}`, actionPayload ?? {});
|
|
2774
2794
|
}
|
|
2775
2795
|
onClick?.(e);
|
|
2776
2796
|
}, [action, actionPayload, eventBus, onClick]);
|
|
2777
|
-
const handleMouseEnter =
|
|
2797
|
+
const handleMouseEnter = React6.useCallback((e) => {
|
|
2778
2798
|
if (hoverEvent) {
|
|
2779
2799
|
eventBus.emit(`UI:${hoverEvent}`, { hovered: true });
|
|
2780
2800
|
}
|
|
2781
2801
|
onMouseEnter?.(e);
|
|
2782
2802
|
}, [hoverEvent, eventBus, onMouseEnter]);
|
|
2783
|
-
const handleMouseLeave =
|
|
2803
|
+
const handleMouseLeave = React6.useCallback((e) => {
|
|
2784
2804
|
if (hoverEvent) {
|
|
2785
2805
|
eventBus.emit(`UI:${hoverEvent}`, { hovered: false });
|
|
2786
2806
|
}
|
|
@@ -3166,7 +3186,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3166
3186
|
const IconComp = value;
|
|
3167
3187
|
return /* @__PURE__ */ jsxRuntime.jsx(IconComp, { className: sizeClass });
|
|
3168
3188
|
}
|
|
3169
|
-
if (
|
|
3189
|
+
if (React6__default.default.isValidElement(value)) {
|
|
3170
3190
|
return value;
|
|
3171
3191
|
}
|
|
3172
3192
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -3175,7 +3195,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3175
3195
|
}
|
|
3176
3196
|
return value;
|
|
3177
3197
|
}
|
|
3178
|
-
var Button =
|
|
3198
|
+
var Button = React6__default.default.forwardRef(
|
|
3179
3199
|
({
|
|
3180
3200
|
className,
|
|
3181
3201
|
variant = "primary",
|
|
@@ -3271,7 +3291,7 @@ var sizeStyles3 = {
|
|
|
3271
3291
|
md: "px-2.5 py-1 text-sm",
|
|
3272
3292
|
lg: "px-3 py-1.5 text-base"
|
|
3273
3293
|
};
|
|
3274
|
-
var Badge =
|
|
3294
|
+
var Badge = React6__default.default.forwardRef(
|
|
3275
3295
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
3276
3296
|
const iconSizes = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
3277
3297
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -3342,7 +3362,7 @@ var shadowStyles2 = {
|
|
|
3342
3362
|
md: "shadow",
|
|
3343
3363
|
lg: "shadow-lg"
|
|
3344
3364
|
};
|
|
3345
|
-
var Card =
|
|
3365
|
+
var Card = React6__default.default.forwardRef(
|
|
3346
3366
|
({
|
|
3347
3367
|
className,
|
|
3348
3368
|
variant = "bordered",
|
|
@@ -3378,9 +3398,9 @@ var Card = React5__default.default.forwardRef(
|
|
|
3378
3398
|
}
|
|
3379
3399
|
);
|
|
3380
3400
|
Card.displayName = "Card";
|
|
3381
|
-
var CardHeader =
|
|
3401
|
+
var CardHeader = React6__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3382
3402
|
CardHeader.displayName = "CardHeader";
|
|
3383
|
-
var CardTitle =
|
|
3403
|
+
var CardTitle = React6__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3384
3404
|
"h3",
|
|
3385
3405
|
{
|
|
3386
3406
|
ref,
|
|
@@ -3393,11 +3413,11 @@ var CardTitle = React5__default.default.forwardRef(({ className, ...props }, ref
|
|
|
3393
3413
|
}
|
|
3394
3414
|
));
|
|
3395
3415
|
CardTitle.displayName = "CardTitle";
|
|
3396
|
-
var CardContent =
|
|
3416
|
+
var CardContent = React6__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
|
|
3397
3417
|
CardContent.displayName = "CardContent";
|
|
3398
3418
|
var CardBody = CardContent;
|
|
3399
3419
|
CardBody.displayName = "CardBody";
|
|
3400
|
-
var CardFooter =
|
|
3420
|
+
var CardFooter = React6__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3401
3421
|
"div",
|
|
3402
3422
|
{
|
|
3403
3423
|
ref,
|
|
@@ -3554,7 +3574,7 @@ var paddingClasses = {
|
|
|
3554
3574
|
md: "py-16",
|
|
3555
3575
|
lg: "py-24"
|
|
3556
3576
|
};
|
|
3557
|
-
var ContentSection =
|
|
3577
|
+
var ContentSection = React6__default.default.forwardRef(
|
|
3558
3578
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
3559
3579
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3560
3580
|
Box,
|
|
@@ -3578,8 +3598,8 @@ var InstallBox = ({
|
|
|
3578
3598
|
label,
|
|
3579
3599
|
className
|
|
3580
3600
|
}) => {
|
|
3581
|
-
const [copied, setCopied] =
|
|
3582
|
-
const handleCopy =
|
|
3601
|
+
const [copied, setCopied] = React6.useState(false);
|
|
3602
|
+
const handleCopy = React6.useCallback(() => {
|
|
3583
3603
|
void navigator.clipboard.writeText(command);
|
|
3584
3604
|
setCopied(true);
|
|
3585
3605
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
@@ -4141,7 +4161,7 @@ var StepFlow = ({
|
|
|
4141
4161
|
className
|
|
4142
4162
|
}) => {
|
|
4143
4163
|
if (orientation === "vertical") {
|
|
4144
|
-
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4164
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsx(React6__default.default.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
4145
4165
|
/* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "none", align: "center", children: [
|
|
4146
4166
|
/* @__PURE__ */ jsxRuntime.jsx(StepCircle, { step, index }),
|
|
4147
4167
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-px h-8 bg-border" })
|
|
@@ -4152,7 +4172,7 @@ var StepFlow = ({
|
|
|
4152
4172
|
] })
|
|
4153
4173
|
] }) }, index)) });
|
|
4154
4174
|
}
|
|
4155
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsxs(React6__default.default.Fragment, { children: [
|
|
4156
4176
|
/* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
4157
4177
|
/* @__PURE__ */ jsxRuntime.jsx(StepCircle, { step, index }),
|
|
4158
4178
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -4662,10 +4682,10 @@ var AnimatedCounter = ({
|
|
|
4662
4682
|
duration = 1500,
|
|
4663
4683
|
className
|
|
4664
4684
|
}) => {
|
|
4665
|
-
const ref =
|
|
4666
|
-
const [displayValue, setDisplayValue] =
|
|
4667
|
-
const [hasAnimated, setHasAnimated] =
|
|
4668
|
-
const animate =
|
|
4685
|
+
const ref = React6.useRef(null);
|
|
4686
|
+
const [displayValue, setDisplayValue] = React6.useState("0");
|
|
4687
|
+
const [hasAnimated, setHasAnimated] = React6.useState(false);
|
|
4688
|
+
const animate = React6.useCallback(() => {
|
|
4669
4689
|
const { num, prefix, suffix, decimals } = parseValue(value);
|
|
4670
4690
|
if (num === 0) {
|
|
4671
4691
|
setDisplayValue(String(value));
|
|
@@ -4686,7 +4706,7 @@ var AnimatedCounter = ({
|
|
|
4686
4706
|
};
|
|
4687
4707
|
requestAnimationFrame(tick);
|
|
4688
4708
|
}, [value, duration]);
|
|
4689
|
-
|
|
4709
|
+
React6.useEffect(() => {
|
|
4690
4710
|
if (hasAnimated) return;
|
|
4691
4711
|
const el = ref.current;
|
|
4692
4712
|
if (!el) return;
|
|
@@ -4736,7 +4756,7 @@ var animatedStyles = {
|
|
|
4736
4756
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
4737
4757
|
"none": {}
|
|
4738
4758
|
};
|
|
4739
|
-
var AnimatedReveal =
|
|
4759
|
+
var AnimatedReveal = React6__default.default.forwardRef(
|
|
4740
4760
|
({
|
|
4741
4761
|
trigger = "scroll",
|
|
4742
4762
|
animation = "fade-up",
|
|
@@ -4751,10 +4771,10 @@ var AnimatedReveal = React5__default.default.forwardRef(
|
|
|
4751
4771
|
style,
|
|
4752
4772
|
...props
|
|
4753
4773
|
}, forwardedRef) => {
|
|
4754
|
-
const [isAnimated, setIsAnimated] =
|
|
4755
|
-
const internalRef =
|
|
4756
|
-
const hasAnimated =
|
|
4757
|
-
const setRef =
|
|
4774
|
+
const [isAnimated, setIsAnimated] = React6.useState(false);
|
|
4775
|
+
const internalRef = React6.useRef(null);
|
|
4776
|
+
const hasAnimated = React6.useRef(false);
|
|
4777
|
+
const setRef = React6.useCallback(
|
|
4758
4778
|
(node) => {
|
|
4759
4779
|
internalRef.current = node;
|
|
4760
4780
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
@@ -4762,7 +4782,7 @@ var AnimatedReveal = React5__default.default.forwardRef(
|
|
|
4762
4782
|
},
|
|
4763
4783
|
[forwardedRef]
|
|
4764
4784
|
);
|
|
4765
|
-
|
|
4785
|
+
React6.useEffect(() => {
|
|
4766
4786
|
if (trigger !== "scroll") return;
|
|
4767
4787
|
const el = internalRef.current;
|
|
4768
4788
|
if (!el) return;
|
|
@@ -4788,7 +4808,7 @@ var AnimatedReveal = React5__default.default.forwardRef(
|
|
|
4788
4808
|
setIsAnimated(false);
|
|
4789
4809
|
}
|
|
4790
4810
|
} : void 0;
|
|
4791
|
-
|
|
4811
|
+
React6.useEffect(() => {
|
|
4792
4812
|
if (trigger === "manual" && manualAnimate !== void 0) {
|
|
4793
4813
|
setIsAnimated(manualAnimate);
|
|
4794
4814
|
}
|
|
@@ -4818,9 +4838,9 @@ var AnimatedReveal = React5__default.default.forwardRef(
|
|
|
4818
4838
|
);
|
|
4819
4839
|
AnimatedReveal.displayName = "AnimatedReveal";
|
|
4820
4840
|
function useFetchedSvg(src) {
|
|
4821
|
-
const [svg, setSvg] =
|
|
4822
|
-
const cache =
|
|
4823
|
-
|
|
4841
|
+
const [svg, setSvg] = React6.useState(null);
|
|
4842
|
+
const cache = React6.useRef({});
|
|
4843
|
+
React6.useEffect(() => {
|
|
4824
4844
|
if (!src) {
|
|
4825
4845
|
setSvg(null);
|
|
4826
4846
|
return;
|
|
@@ -4889,7 +4909,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
|
|
|
4889
4909
|
el.style.opacity = animate ? "1" : "0";
|
|
4890
4910
|
});
|
|
4891
4911
|
}
|
|
4892
|
-
var AnimatedGraphic =
|
|
4912
|
+
var AnimatedGraphic = React6__default.default.forwardRef(
|
|
4893
4913
|
({
|
|
4894
4914
|
src,
|
|
4895
4915
|
svgContent,
|
|
@@ -4908,11 +4928,11 @@ var AnimatedGraphic = React5__default.default.forwardRef(
|
|
|
4908
4928
|
children,
|
|
4909
4929
|
...props
|
|
4910
4930
|
}, ref) => {
|
|
4911
|
-
const containerRef =
|
|
4931
|
+
const containerRef = React6.useRef(null);
|
|
4912
4932
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
4913
4933
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
4914
|
-
const prevAnimateRef =
|
|
4915
|
-
const setRef =
|
|
4934
|
+
const prevAnimateRef = React6.useRef(animate);
|
|
4935
|
+
const setRef = React6__default.default.useCallback(
|
|
4916
4936
|
(node) => {
|
|
4917
4937
|
containerRef.current = node;
|
|
4918
4938
|
if (typeof ref === "function") ref(node);
|
|
@@ -4920,7 +4940,7 @@ var AnimatedGraphic = React5__default.default.forwardRef(
|
|
|
4920
4940
|
},
|
|
4921
4941
|
[ref]
|
|
4922
4942
|
);
|
|
4923
|
-
|
|
4943
|
+
React6.useEffect(() => {
|
|
4924
4944
|
const el = containerRef.current;
|
|
4925
4945
|
if (!el || !strokeColor) return;
|
|
4926
4946
|
const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
|
|
@@ -4928,7 +4948,7 @@ var AnimatedGraphic = React5__default.default.forwardRef(
|
|
|
4928
4948
|
p.style.stroke = strokeColor;
|
|
4929
4949
|
});
|
|
4930
4950
|
}, [resolvedSvg, strokeColor]);
|
|
4931
|
-
|
|
4951
|
+
React6.useEffect(() => {
|
|
4932
4952
|
const el = containerRef.current;
|
|
4933
4953
|
if (!el || !resolvedSvg) return;
|
|
4934
4954
|
if (animation === "draw" || animation === "fill") {
|
|
@@ -4953,7 +4973,7 @@ var AnimatedGraphic = React5__default.default.forwardRef(
|
|
|
4953
4973
|
});
|
|
4954
4974
|
}
|
|
4955
4975
|
}, [resolvedSvg, animation]);
|
|
4956
|
-
|
|
4976
|
+
React6.useEffect(() => {
|
|
4957
4977
|
const el = containerRef.current;
|
|
4958
4978
|
if (!el) return;
|
|
4959
4979
|
const id = requestAnimationFrame(() => {
|
|
@@ -5753,7 +5773,7 @@ var GeometricPattern = ({
|
|
|
5753
5773
|
children,
|
|
5754
5774
|
className
|
|
5755
5775
|
}) => {
|
|
5756
|
-
const reactId =
|
|
5776
|
+
const reactId = React6.useId();
|
|
5757
5777
|
const patternId = `gp${reactId.replace(/:/g, "")}`;
|
|
5758
5778
|
const size = 60 * scale;
|
|
5759
5779
|
const stripHeight = 40 * scale;
|
|
@@ -5980,7 +6000,7 @@ var EdgeDecoration = ({
|
|
|
5980
6000
|
width = 15,
|
|
5981
6001
|
className
|
|
5982
6002
|
}) => {
|
|
5983
|
-
const id =
|
|
6003
|
+
const id = React6.useId();
|
|
5984
6004
|
const Variant = VARIANT_MAP2[variant];
|
|
5985
6005
|
const sides = side === "both" ? ["left", "right"] : [side];
|
|
5986
6006
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: sides.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/marketing/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React6, { createContext, useCallback, useState, useRef, useEffect, useContext, useMemo, useId } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as LucideIcons from 'lucide-react';
|
|
4
4
|
import { Loader2, Check, User } from 'lucide-react';
|
|
@@ -2533,6 +2533,10 @@ function createLogger(namespace) {
|
|
|
2533
2533
|
createLogger("almadar:eventbus");
|
|
2534
2534
|
createLogger("almadar:eventbus:subscribe");
|
|
2535
2535
|
var EventBusContext = createContext(null);
|
|
2536
|
+
var TraitScopeContext = createContext(null);
|
|
2537
|
+
function useTraitScope() {
|
|
2538
|
+
return useContext(TraitScopeContext);
|
|
2539
|
+
}
|
|
2536
2540
|
|
|
2537
2541
|
// hooks/useEventBus.ts
|
|
2538
2542
|
var log = createLogger("almadar:eventbus");
|
|
@@ -2609,7 +2613,23 @@ var fallbackEventBus = {
|
|
|
2609
2613
|
};
|
|
2610
2614
|
function useEventBus() {
|
|
2611
2615
|
const context = useContext(EventBusContext);
|
|
2612
|
-
|
|
2616
|
+
const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
2617
|
+
const scope = useTraitScope();
|
|
2618
|
+
return useMemo(() => {
|
|
2619
|
+
if (!scope) return baseBus;
|
|
2620
|
+
return {
|
|
2621
|
+
...baseBus,
|
|
2622
|
+
emit: (type, payload, source) => {
|
|
2623
|
+
if (typeof type === "string" && type.startsWith("UI:")) {
|
|
2624
|
+
const tail = type.slice(3);
|
|
2625
|
+
const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
|
|
2626
|
+
baseBus.emit(qualified, payload, source);
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
baseBus.emit(type, payload, source);
|
|
2630
|
+
}
|
|
2631
|
+
};
|
|
2632
|
+
}, [baseBus, scope]);
|
|
2613
2633
|
}
|
|
2614
2634
|
var paddingStyles = {
|
|
2615
2635
|
none: "p-0",
|
|
@@ -2713,7 +2733,7 @@ var positionStyles = {
|
|
|
2713
2733
|
fixed: "fixed",
|
|
2714
2734
|
sticky: "sticky"
|
|
2715
2735
|
};
|
|
2716
|
-
var Box =
|
|
2736
|
+
var Box = React6.forwardRef(
|
|
2717
2737
|
({
|
|
2718
2738
|
padding,
|
|
2719
2739
|
paddingX,
|
|
@@ -3142,7 +3162,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3142
3162
|
const IconComp = value;
|
|
3143
3163
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
3144
3164
|
}
|
|
3145
|
-
if (
|
|
3165
|
+
if (React6.isValidElement(value)) {
|
|
3146
3166
|
return value;
|
|
3147
3167
|
}
|
|
3148
3168
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -3151,7 +3171,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3151
3171
|
}
|
|
3152
3172
|
return value;
|
|
3153
3173
|
}
|
|
3154
|
-
var Button =
|
|
3174
|
+
var Button = React6.forwardRef(
|
|
3155
3175
|
({
|
|
3156
3176
|
className,
|
|
3157
3177
|
variant = "primary",
|
|
@@ -3247,7 +3267,7 @@ var sizeStyles3 = {
|
|
|
3247
3267
|
md: "px-2.5 py-1 text-sm",
|
|
3248
3268
|
lg: "px-3 py-1.5 text-base"
|
|
3249
3269
|
};
|
|
3250
|
-
var Badge =
|
|
3270
|
+
var Badge = React6.forwardRef(
|
|
3251
3271
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
3252
3272
|
const iconSizes = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
3253
3273
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -3318,7 +3338,7 @@ var shadowStyles2 = {
|
|
|
3318
3338
|
md: "shadow",
|
|
3319
3339
|
lg: "shadow-lg"
|
|
3320
3340
|
};
|
|
3321
|
-
var Card =
|
|
3341
|
+
var Card = React6.forwardRef(
|
|
3322
3342
|
({
|
|
3323
3343
|
className,
|
|
3324
3344
|
variant = "bordered",
|
|
@@ -3354,9 +3374,9 @@ var Card = React5.forwardRef(
|
|
|
3354
3374
|
}
|
|
3355
3375
|
);
|
|
3356
3376
|
Card.displayName = "Card";
|
|
3357
|
-
var CardHeader =
|
|
3377
|
+
var CardHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3358
3378
|
CardHeader.displayName = "CardHeader";
|
|
3359
|
-
var CardTitle =
|
|
3379
|
+
var CardTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3360
3380
|
"h3",
|
|
3361
3381
|
{
|
|
3362
3382
|
ref,
|
|
@@ -3369,11 +3389,11 @@ var CardTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
3369
3389
|
}
|
|
3370
3390
|
));
|
|
3371
3391
|
CardTitle.displayName = "CardTitle";
|
|
3372
|
-
var CardContent =
|
|
3392
|
+
var CardContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
3373
3393
|
CardContent.displayName = "CardContent";
|
|
3374
3394
|
var CardBody = CardContent;
|
|
3375
3395
|
CardBody.displayName = "CardBody";
|
|
3376
|
-
var CardFooter =
|
|
3396
|
+
var CardFooter = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3377
3397
|
"div",
|
|
3378
3398
|
{
|
|
3379
3399
|
ref,
|
|
@@ -3530,7 +3550,7 @@ var paddingClasses = {
|
|
|
3530
3550
|
md: "py-16",
|
|
3531
3551
|
lg: "py-24"
|
|
3532
3552
|
};
|
|
3533
|
-
var ContentSection =
|
|
3553
|
+
var ContentSection = React6.forwardRef(
|
|
3534
3554
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
3535
3555
|
return /* @__PURE__ */ jsx(
|
|
3536
3556
|
Box,
|
|
@@ -4117,7 +4137,7 @@ var StepFlow = ({
|
|
|
4117
4137
|
className
|
|
4118
4138
|
}) => {
|
|
4119
4139
|
if (orientation === "vertical") {
|
|
4120
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
4140
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React6.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
4121
4141
|
/* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
|
|
4122
4142
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
4123
4143
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
|
|
@@ -4128,7 +4148,7 @@ var StepFlow = ({
|
|
|
4128
4148
|
] })
|
|
4129
4149
|
] }) }, index)) });
|
|
4130
4150
|
}
|
|
4131
|
-
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(
|
|
4151
|
+
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(React6.Fragment, { children: [
|
|
4132
4152
|
/* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
4133
4153
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
4134
4154
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -4712,7 +4732,7 @@ var animatedStyles = {
|
|
|
4712
4732
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
4713
4733
|
"none": {}
|
|
4714
4734
|
};
|
|
4715
|
-
var AnimatedReveal =
|
|
4735
|
+
var AnimatedReveal = React6.forwardRef(
|
|
4716
4736
|
({
|
|
4717
4737
|
trigger = "scroll",
|
|
4718
4738
|
animation = "fade-up",
|
|
@@ -4865,7 +4885,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
|
|
|
4865
4885
|
el.style.opacity = animate ? "1" : "0";
|
|
4866
4886
|
});
|
|
4867
4887
|
}
|
|
4868
|
-
var AnimatedGraphic =
|
|
4888
|
+
var AnimatedGraphic = React6.forwardRef(
|
|
4869
4889
|
({
|
|
4870
4890
|
src,
|
|
4871
4891
|
svgContent,
|
|
@@ -4888,7 +4908,7 @@ var AnimatedGraphic = React5.forwardRef(
|
|
|
4888
4908
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
4889
4909
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
4890
4910
|
const prevAnimateRef = useRef(animate);
|
|
4891
|
-
const setRef =
|
|
4911
|
+
const setRef = React6.useCallback(
|
|
4892
4912
|
(node) => {
|
|
4893
4913
|
containerRef.current = node;
|
|
4894
4914
|
if (typeof ref === "function") ref(node);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TraitScopeProvider
|
|
3
|
+
*
|
|
4
|
+
* Wraps a trait's rendered subtree with its owning `{ orbital, trait }`
|
|
5
|
+
* pair. Pure components inside the subtree (Button, Form, etc.) keep
|
|
6
|
+
* calling `useEventBus().emit('UI:X', ...)` exactly as today; the
|
|
7
|
+
* scoped wrapper that `useEventBus` returns inside this provider
|
|
8
|
+
* rewrites bare `UI:X` keys into the qualified
|
|
9
|
+
* `UI:Orbital.Trait.X` form that `useTraitStateMachine` (and the rest
|
|
10
|
+
* of the post-Phase 4 subscriber side) listens on.
|
|
11
|
+
*
|
|
12
|
+
* Producer-side fix for the gap where Button-emitted bare keys never
|
|
13
|
+
* reached the trait state machine in the runtime path. The compiled
|
|
14
|
+
* path's codegen wraps each trait view with the same provider so both
|
|
15
|
+
* paths share the qualification contract.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
import React from 'react';
|
|
20
|
+
export interface TraitScope {
|
|
21
|
+
/** Owning orbital name (e.g. `"ContactOrbital"`). */
|
|
22
|
+
orbital: string;
|
|
23
|
+
/** Trait name within the orbital (e.g. `"ContactBrowse"`). */
|
|
24
|
+
trait: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TraitScopeProviderProps {
|
|
27
|
+
orbital: string;
|
|
28
|
+
trait: string;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Wrap a trait's rendered subtree to qualify bare `UI:*` emits with the
|
|
33
|
+
* trait's scope. Mount this at the slot-content boundary in runtime
|
|
34
|
+
* mode (UISlotRenderer) and at each generated trait view's outermost
|
|
35
|
+
* element in compiled mode (orbital-shell-typescript codegen).
|
|
36
|
+
*/
|
|
37
|
+
export declare function TraitScopeProvider({ orbital, trait, children, }: TraitScopeProviderProps): React.ReactElement;
|
|
38
|
+
/**
|
|
39
|
+
* Read the current trait scope. Returns `null` when called outside
|
|
40
|
+
* any `TraitScopeProvider` (e.g. Storybook, design-system catalog).
|
|
41
|
+
*/
|
|
42
|
+
export declare function useTraitScope(): TraitScope | null;
|
|
43
|
+
export default TraitScopeProvider;
|
package/dist/providers/index.cjs
CHANGED
|
@@ -436,7 +436,23 @@ function getGlobalEventBus() {
|
|
|
436
436
|
}
|
|
437
437
|
function useEventBus() {
|
|
438
438
|
const context = React116.useContext(providers.EventBusContext);
|
|
439
|
-
|
|
439
|
+
const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
440
|
+
const scope = providers.useTraitScope();
|
|
441
|
+
return React116.useMemo(() => {
|
|
442
|
+
if (!scope) return baseBus;
|
|
443
|
+
return {
|
|
444
|
+
...baseBus,
|
|
445
|
+
emit: (type, payload, source) => {
|
|
446
|
+
if (typeof type === "string" && type.startsWith("UI:")) {
|
|
447
|
+
const tail = type.slice(3);
|
|
448
|
+
const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
|
|
449
|
+
baseBus.emit(qualified, payload, source);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
baseBus.emit(type, payload, source);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}, [baseBus, scope]);
|
|
440
456
|
}
|
|
441
457
|
function useEventListener(event, handler) {
|
|
442
458
|
const eventBus = useEventBus();
|
|
@@ -37854,6 +37870,17 @@ function renderContainedPortal(slot, content, onDismiss) {
|
|
|
37854
37870
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, children: slotContent });
|
|
37855
37871
|
}
|
|
37856
37872
|
}
|
|
37873
|
+
function MaybeTraitScope({
|
|
37874
|
+
sourceTrait,
|
|
37875
|
+
children
|
|
37876
|
+
}) {
|
|
37877
|
+
const schemaCtx = useEntitySchemaOptional();
|
|
37878
|
+
const orbital = sourceTrait !== void 0 && schemaCtx !== null ? schemaCtx.orbitalsByTrait.get(sourceTrait) : void 0;
|
|
37879
|
+
if (sourceTrait !== void 0 && orbital !== void 0) {
|
|
37880
|
+
return /* @__PURE__ */ jsxRuntime.jsx(providers.TraitScopeProvider, { orbital, trait: sourceTrait, children });
|
|
37881
|
+
}
|
|
37882
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
37883
|
+
}
|
|
37857
37884
|
function UISlotComponent({
|
|
37858
37885
|
slot,
|
|
37859
37886
|
portal = false,
|
|
@@ -37881,11 +37908,11 @@ function UISlotComponent({
|
|
|
37881
37908
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37882
37909
|
"data-pattern": pattern,
|
|
37883
37910
|
"data-source-trait": sourceTrait,
|
|
37884
|
-
children
|
|
37911
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait, children })
|
|
37885
37912
|
}
|
|
37886
37913
|
);
|
|
37887
37914
|
}
|
|
37888
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CompiledPortal, { slot, className, pattern, sourceTrait, children });
|
|
37915
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CompiledPortal, { slot, className, pattern, sourceTrait, children: /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait, children }) });
|
|
37889
37916
|
}
|
|
37890
37917
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37891
37918
|
Box,
|
|
@@ -37894,7 +37921,7 @@ function UISlotComponent({
|
|
|
37894
37921
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37895
37922
|
"data-pattern": pattern,
|
|
37896
37923
|
"data-source-trait": sourceTrait,
|
|
37897
|
-
children
|
|
37924
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait, children })
|
|
37898
37925
|
}
|
|
37899
37926
|
);
|
|
37900
37927
|
}
|
|
@@ -37940,7 +37967,7 @@ function UISlotComponent({
|
|
|
37940
37967
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37941
37968
|
"data-pattern": content.pattern,
|
|
37942
37969
|
"data-source-trait": content.sourceTrait,
|
|
37943
|
-
children: wrappedContent
|
|
37970
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait: content.sourceTrait, children: wrappedContent })
|
|
37944
37971
|
}
|
|
37945
37972
|
);
|
|
37946
37973
|
}
|
|
@@ -38048,7 +38075,7 @@ function SlotPortal({
|
|
|
38048
38075
|
});
|
|
38049
38076
|
if (!portalRoot) return null;
|
|
38050
38077
|
const slotId = `slot-${slot}`;
|
|
38051
|
-
const slotContent = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
|
|
38078
|
+
const slotContent = /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait: content.sourceTrait, children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss }) });
|
|
38052
38079
|
let wrapper;
|
|
38053
38080
|
switch (slot) {
|
|
38054
38081
|
case "modal":
|
|
@@ -38880,6 +38907,18 @@ function OrbitalProvider({
|
|
|
38880
38907
|
);
|
|
38881
38908
|
}
|
|
38882
38909
|
OrbitalProvider.displayName = "OrbitalProvider";
|
|
38910
|
+
var TraitScopeContext = React116.createContext(null);
|
|
38911
|
+
function TraitScopeProvider2({
|
|
38912
|
+
orbital,
|
|
38913
|
+
trait,
|
|
38914
|
+
children
|
|
38915
|
+
}) {
|
|
38916
|
+
const value = React116.useMemo(() => ({ orbital, trait }), [orbital, trait]);
|
|
38917
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TraitScopeContext.Provider, { value, children });
|
|
38918
|
+
}
|
|
38919
|
+
function useTraitScope2() {
|
|
38920
|
+
return React116.useContext(TraitScopeContext);
|
|
38921
|
+
}
|
|
38883
38922
|
|
|
38884
38923
|
// providers/OfflineModeProvider.tsx
|
|
38885
38924
|
init_offline_executor();
|
|
@@ -38919,8 +38958,10 @@ exports.OfflineModeProvider = OfflineModeProvider;
|
|
|
38919
38958
|
exports.OrbitalProvider = OrbitalProvider;
|
|
38920
38959
|
exports.SelectionContext = SelectionContext;
|
|
38921
38960
|
exports.SelectionProvider = SelectionProvider;
|
|
38961
|
+
exports.TraitScopeProvider = TraitScopeProvider2;
|
|
38922
38962
|
exports.VerificationProvider = VerificationProvider;
|
|
38923
38963
|
exports.useOfflineMode = useOfflineMode;
|
|
38924
38964
|
exports.useOptionalOfflineMode = useOptionalOfflineMode;
|
|
38925
38965
|
exports.useSelection = useSelection;
|
|
38926
38966
|
exports.useSelectionOptional = useSelectionOptional;
|
|
38967
|
+
exports.useTraitScope = useTraitScope2;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export { OrbitalProvider, type OrbitalProviderProps } from './OrbitalProvider';
|
|
8
8
|
export type { ThemeDefinition } from '../context/ThemeContext';
|
|
9
9
|
export { EventBusProvider, EventBusContext } from './EventBusProvider';
|
|
10
|
+
export { TraitScopeProvider, useTraitScope } from './TraitScopeProvider';
|
|
11
|
+
export type { TraitScope, TraitScopeProviderProps } from './TraitScopeProvider';
|
|
10
12
|
export { SelectionProvider, SelectionContext, useSelection, useSelectionOptional } from './SelectionProvider';
|
|
11
13
|
export type { SelectionContextType } from './SelectionProvider';
|
|
12
14
|
export { VerificationProvider } from './VerificationProvider';
|