@almadar/ui 4.7.0 → 4.9.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.
@@ -1,4 +1,4 @@
1
- import React4, { createContext, useCallback, useContext, useState, useRef, useEffect } from 'react';
1
+ import React5, { createContext, useCallback, useContext, useMemo, useState, useRef, useEffect } from 'react';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as LucideIcons from 'lucide-react';
4
4
  import { Loader2, ChevronDown, X } 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
- return context ?? getGlobalEventBus() ?? fallbackEventBus;
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 = React4.forwardRef(
2736
+ var Box = React5.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 (React4.isValidElement(value)) {
3165
+ if (React5.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 = React4.forwardRef(
3174
+ var Button = React5.forwardRef(
3155
3175
  ({
3156
3176
  className,
3157
3177
  variant = "primary",
@@ -3254,7 +3274,7 @@ var shadowStyles2 = {
3254
3274
  md: "shadow",
3255
3275
  lg: "shadow-lg"
3256
3276
  };
3257
- var Card = React4.forwardRef(
3277
+ var Card = React5.forwardRef(
3258
3278
  ({
3259
3279
  className,
3260
3280
  variant = "bordered",
@@ -3290,9 +3310,9 @@ var Card = React4.forwardRef(
3290
3310
  }
3291
3311
  );
3292
3312
  Card.displayName = "Card";
3293
- var CardHeader = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3313
+ var CardHeader = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3294
3314
  CardHeader.displayName = "CardHeader";
3295
- var CardTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3315
+ var CardTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3296
3316
  "h3",
3297
3317
  {
3298
3318
  ref,
@@ -3305,11 +3325,11 @@ var CardTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__
3305
3325
  }
3306
3326
  ));
3307
3327
  CardTitle.displayName = "CardTitle";
3308
- var CardContent = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3328
+ var CardContent = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3309
3329
  CardContent.displayName = "CardContent";
3310
3330
  var CardBody = CardContent;
3311
3331
  CardBody.displayName = "CardBody";
3312
- var CardFooter = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3332
+ var CardFooter = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3313
3333
  "div",
3314
3334
  {
3315
3335
  ref,
@@ -3388,7 +3408,7 @@ var Divider = ({
3388
3408
  );
3389
3409
  };
3390
3410
  Divider.displayName = "Divider";
3391
- var Input = React4.forwardRef(
3411
+ var Input = React5.forwardRef(
3392
3412
  ({
3393
3413
  className,
3394
3414
  inputType,
@@ -3656,7 +3676,7 @@ var DocBreadcrumb = ({
3656
3676
  "aria-label": "Breadcrumb",
3657
3677
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
3658
3678
  const isLast = idx === items.length - 1;
3659
- return /* @__PURE__ */ jsxs(React4.Fragment, { children: [
3679
+ return /* @__PURE__ */ jsxs(React5.Fragment, { children: [
3660
3680
  idx > 0 && /* @__PURE__ */ jsx(
3661
3681
  Icon,
3662
3682
  {
@@ -991,7 +991,23 @@ var fallbackEventBus = {
991
991
  };
992
992
  function useEventBus() {
993
993
  const context = react.useContext(providers.EventBusContext);
994
- return context ?? getGlobalEventBus() ?? fallbackEventBus;
994
+ const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
995
+ const scope = providers.useTraitScope();
996
+ return react.useMemo(() => {
997
+ if (!scope) return baseBus;
998
+ return {
999
+ ...baseBus,
1000
+ emit: (type, payload, source) => {
1001
+ if (typeof type === "string" && type.startsWith("UI:")) {
1002
+ const tail = type.slice(3);
1003
+ const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
1004
+ baseBus.emit(qualified, payload, source);
1005
+ return;
1006
+ }
1007
+ baseBus.emit(type, payload, source);
1008
+ }
1009
+ };
1010
+ }, [baseBus, scope]);
995
1011
  }
996
1012
  function useEventListener(event, handler) {
997
1013
  const eventBus = useEventBus();
@@ -1,5 +1,5 @@
1
1
  import { createContext, useCallback, useState, useEffect, useMemo, useContext, useRef, useSyncExternalStore } from 'react';
2
- import { EventBusContext } from '@almadar/ui/providers';
2
+ import { EventBusContext, useTraitScope } from '@almadar/ui/providers';
3
3
  import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
4
4
 
5
5
  function useOrbitalHistory(options) {
@@ -989,7 +989,23 @@ var fallbackEventBus = {
989
989
  };
990
990
  function useEventBus() {
991
991
  const context = useContext(EventBusContext);
992
- return context ?? getGlobalEventBus() ?? fallbackEventBus;
992
+ const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
993
+ const scope = useTraitScope();
994
+ return useMemo(() => {
995
+ if (!scope) return baseBus;
996
+ return {
997
+ ...baseBus,
998
+ emit: (type, payload, source) => {
999
+ if (typeof type === "string" && type.startsWith("UI:")) {
1000
+ const tail = type.slice(3);
1001
+ const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
1002
+ baseBus.emit(qualified, payload, source);
1003
+ return;
1004
+ }
1005
+ baseBus.emit(type, payload, source);
1006
+ }
1007
+ };
1008
+ }, [baseBus, scope]);
993
1009
  }
994
1010
  function useEventListener(event, handler) {
995
1011
  const eventBus = useEventBus();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React5 = require('react');
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 React5__default = /*#__PURE__*/_interopDefault(React5);
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 = React5.createContext(null);
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 = React5.useContext(EventBusContext);
2636
- return context ?? getGlobalEventBus() ?? fallbackEventBus;
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 = React5__default.default.forwardRef(
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 = React5.useCallback((e) => {
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 = React5.useCallback((e) => {
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 = React5.useCallback((e) => {
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 (React5__default.default.isValidElement(value)) {
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 = React5__default.default.forwardRef(
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 = React5__default.default.forwardRef(
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 = React5__default.default.forwardRef(
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 = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
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 = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
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 = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
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 = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
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 = React5__default.default.forwardRef(
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] = React5.useState(false);
3582
- const handleCopy = React5.useCallback(() => {
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(React5__default.default.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
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(React5__default.default.Fragment, { children: [
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 = React5.useRef(null);
4666
- const [displayValue, setDisplayValue] = React5.useState("0");
4667
- const [hasAnimated, setHasAnimated] = React5.useState(false);
4668
- const animate = React5.useCallback(() => {
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
- React5.useEffect(() => {
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 = React5__default.default.forwardRef(
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] = React5.useState(false);
4755
- const internalRef = React5.useRef(null);
4756
- const hasAnimated = React5.useRef(false);
4757
- const setRef = React5.useCallback(
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
- React5.useEffect(() => {
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
- React5.useEffect(() => {
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] = React5.useState(null);
4822
- const cache = React5.useRef({});
4823
- React5.useEffect(() => {
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 = React5__default.default.forwardRef(
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 = React5.useRef(null);
4931
+ const containerRef = React6.useRef(null);
4912
4932
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
4913
4933
  const resolvedSvg = svgContent ?? fetchedSvg;
4914
- const prevAnimateRef = React5.useRef(animate);
4915
- const setRef = React5__default.default.useCallback(
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
- React5.useEffect(() => {
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
- React5.useEffect(() => {
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
- React5.useEffect(() => {
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 = React5.useId();
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 = React5.useId();
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(
@@ -1,4 +1,4 @@
1
- import React5, { createContext, useCallback, useState, useRef, useEffect, useContext, useId } from 'react';
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
- return context ?? getGlobalEventBus() ?? fallbackEventBus;
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 = React5.forwardRef(
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 (React5.isValidElement(value)) {
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 = React5.forwardRef(
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 = React5.forwardRef(
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 = React5.forwardRef(
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 = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
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 = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
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 = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
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 = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
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 = React5.forwardRef(
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(React5.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
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(React5.Fragment, { children: [
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 = React5.forwardRef(
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 = React5.forwardRef(
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 = React5.useCallback(
4911
+ const setRef = React6.useCallback(
4892
4912
  (node) => {
4893
4913
  containerRef.current = node;
4894
4914
  if (typeof ref === "function") ref(node);