@almadar/ui 5.121.3 → 5.122.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.
@@ -2508,9 +2508,11 @@ function cn(...inputs) {
2508
2508
  logger.createLogger("almadar:eventbus");
2509
2509
  logger.createLogger("almadar:eventbus:subscribe");
2510
2510
  var EventBusContext = React12.createContext(null);
2511
+ var EMPTY_CHAIN = Object.freeze([]);
2511
2512
  var TraitScopeContext = React12.createContext(null);
2512
- function useTraitScope() {
2513
- return React12.useContext(TraitScopeContext);
2513
+ function useTraitScopeChain() {
2514
+ const chain = React12.useContext(TraitScopeContext);
2515
+ return chain ?? EMPTY_CHAIN;
2514
2516
  }
2515
2517
  var log = logger.createLogger("almadar:eventbus");
2516
2518
  var subLog2 = logger.createLogger("almadar:eventbus:subscribe");
@@ -2588,9 +2590,9 @@ var fallbackEventBus = {
2588
2590
  function useEventBus() {
2589
2591
  const context = React12.useContext(EventBusContext);
2590
2592
  const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
2591
- const scope = useTraitScope();
2593
+ const chain = useTraitScopeChain();
2592
2594
  return React12.useMemo(() => {
2593
- if (!scope) {
2595
+ if (chain.length === 0) {
2594
2596
  return {
2595
2597
  ...baseBus,
2596
2598
  emit: (type, payload, source) => {
@@ -2606,22 +2608,31 @@ function useEventBus() {
2606
2608
  emit: (type, payload, source) => {
2607
2609
  if (typeof type === "string" && type.startsWith("UI:")) {
2608
2610
  const tail = type.slice(3);
2609
- const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
2610
- if (qualified !== type) {
2611
- scopeLog.info("emit:qualified", {
2611
+ const isQualified = tail.includes(".");
2612
+ const event = isQualified ? tail.split(".").slice(2).join(".") : tail;
2613
+ if (!event) {
2614
+ baseBus.emit(type, payload, source);
2615
+ return;
2616
+ }
2617
+ const keys = /* @__PURE__ */ new Set();
2618
+ if (isQualified) keys.add(type);
2619
+ for (const sc of chain) {
2620
+ keys.add(`UI:${sc.orbital}.${sc.trait}.${event}`);
2621
+ }
2622
+ if (keys.size > 1) {
2623
+ scopeLog.info("emit:fan-out", {
2612
2624
  from: type,
2613
- to: qualified,
2614
- scopeOrbital: scope.orbital,
2615
- scopeTrait: scope.trait
2625
+ keys: Array.from(keys),
2626
+ chainDepth: chain.length
2616
2627
  });
2617
2628
  }
2618
- baseBus.emit(qualified, payload, source);
2629
+ for (const key of keys) baseBus.emit(key, payload, source);
2619
2630
  return;
2620
2631
  }
2621
2632
  baseBus.emit(type, payload, source);
2622
2633
  }
2623
2634
  };
2624
- }, [baseBus, scope]);
2635
+ }, [baseBus, chain]);
2625
2636
  }
2626
2637
  function useTapReveal(options = {}) {
2627
2638
  const { onReveal, onDismiss, refs, enabled = true } = options;
@@ -3218,13 +3229,13 @@ var Icon = ({
3218
3229
  style
3219
3230
  }) => {
3220
3231
  const directIcon = typeof icon === "string" ? void 0 : icon;
3221
- const effectiveName = typeof icon === "string" ? icon : name;
3232
+ const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
3233
+ const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
3222
3234
  const family = useIconFamily();
3223
3235
  const RenderedComponent = React12__namespace.default.useMemo(() => {
3224
3236
  if (directIcon) return null;
3225
3237
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
3226
3238
  }, [directIcon, effectiveName, family]);
3227
- const effectiveStrokeWidth = strokeWidth ?? void 0;
3228
3239
  const inlineStyle = {
3229
3240
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
3230
3241
  ...style
@@ -3528,7 +3539,8 @@ var Button = React12__namespace.default.forwardRef(
3528
3539
  "font-medium",
3529
3540
  "rounded-sm",
3530
3541
  "cursor-pointer",
3531
- "transition-all duration-[var(--transition-normal)]",
3542
+ "chrome-button",
3543
+ "transition-all duration-normal",
3532
3544
  "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-offset-[length:var(--focus-ring-offset)]",
3533
3545
  "disabled:opacity-50 disabled:cursor-not-allowed",
3534
3546
  variantStyles2[variant],
@@ -3673,21 +3685,21 @@ var variantStyles4 = {
3673
3685
  "bg-card",
3674
3686
  "border-[length:var(--border-width)] border-border",
3675
3687
  "shadow-elevation-card",
3676
- "transition-all duration-[var(--transition-normal)]",
3688
+ "transition-all duration-normal",
3677
3689
  "hover:shadow-elevation-dialog hover:translate-y-[var(--hover-translate-y)]"
3678
3690
  ].join(" "),
3679
3691
  bordered: [
3680
3692
  "bg-card",
3681
3693
  "border-[length:var(--border-width)] border-border",
3682
3694
  "shadow-elevation-card",
3683
- "transition-all duration-[var(--transition-normal)]",
3695
+ "transition-all duration-normal",
3684
3696
  "hover:shadow-elevation-dialog hover:translate-y-[var(--hover-translate-y)]"
3685
3697
  ].join(" "),
3686
3698
  elevated: [
3687
3699
  "bg-card",
3688
3700
  "border-[length:var(--border-width)] border-border",
3689
3701
  "shadow",
3690
- "transition-all duration-[var(--transition-normal)]",
3702
+ "transition-all duration-normal",
3691
3703
  "hover:shadow-elevation-dialog hover:translate-y-[var(--hover-translate-y)]"
3692
3704
  ].join(" "),
3693
3705
  // Interactive variant with theme-specific hover effects
@@ -3696,7 +3708,7 @@ var variantStyles4 = {
3696
3708
  "border-[length:var(--border-width)] border-border",
3697
3709
  "shadow",
3698
3710
  "cursor-pointer",
3699
- "transition-all duration-[var(--transition-normal)]",
3711
+ "transition-all duration-normal",
3700
3712
  "hover:shadow-elevation-dialog"
3701
3713
  ].join(" ")
3702
3714
  };
@@ -3747,7 +3759,8 @@ var Card = React12__namespace.default.forwardRef(
3747
3759
  ref,
3748
3760
  className: cn(
3749
3761
  "rounded-container relative",
3750
- "transition-all duration-[var(--transition-normal)]",
3762
+ "transition-all duration-normal",
3763
+ "chrome-panel",
3751
3764
  variantStyles4[variant],
3752
3765
  paddingStyles2[padding],
3753
3766
  lookStyles[look],
@@ -5099,6 +5112,10 @@ var AnimatedCounter = ({
5099
5112
  setDisplayValue(String(value));
5100
5113
  return;
5101
5114
  }
5115
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
5116
+ setDisplayValue(String(value));
5117
+ return;
5118
+ }
5102
5119
  const startTime = performance.now();
5103
5120
  const tick = (now) => {
5104
5121
  const elapsed = now - startTime;
@@ -2487,9 +2487,11 @@ function cn(...inputs) {
2487
2487
  createLogger("almadar:eventbus");
2488
2488
  createLogger("almadar:eventbus:subscribe");
2489
2489
  var EventBusContext = createContext(null);
2490
+ var EMPTY_CHAIN = Object.freeze([]);
2490
2491
  var TraitScopeContext = createContext(null);
2491
- function useTraitScope() {
2492
- return useContext(TraitScopeContext);
2492
+ function useTraitScopeChain() {
2493
+ const chain = useContext(TraitScopeContext);
2494
+ return chain ?? EMPTY_CHAIN;
2493
2495
  }
2494
2496
  var log = createLogger("almadar:eventbus");
2495
2497
  var subLog2 = createLogger("almadar:eventbus:subscribe");
@@ -2567,9 +2569,9 @@ var fallbackEventBus = {
2567
2569
  function useEventBus() {
2568
2570
  const context = useContext(EventBusContext);
2569
2571
  const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
2570
- const scope = useTraitScope();
2572
+ const chain = useTraitScopeChain();
2571
2573
  return useMemo(() => {
2572
- if (!scope) {
2574
+ if (chain.length === 0) {
2573
2575
  return {
2574
2576
  ...baseBus,
2575
2577
  emit: (type, payload, source) => {
@@ -2585,22 +2587,31 @@ function useEventBus() {
2585
2587
  emit: (type, payload, source) => {
2586
2588
  if (typeof type === "string" && type.startsWith("UI:")) {
2587
2589
  const tail = type.slice(3);
2588
- const qualified = tail.includes(".") ? type : `UI:${scope.orbital}.${scope.trait}.${tail}`;
2589
- if (qualified !== type) {
2590
- scopeLog.info("emit:qualified", {
2590
+ const isQualified = tail.includes(".");
2591
+ const event = isQualified ? tail.split(".").slice(2).join(".") : tail;
2592
+ if (!event) {
2593
+ baseBus.emit(type, payload, source);
2594
+ return;
2595
+ }
2596
+ const keys = /* @__PURE__ */ new Set();
2597
+ if (isQualified) keys.add(type);
2598
+ for (const sc of chain) {
2599
+ keys.add(`UI:${sc.orbital}.${sc.trait}.${event}`);
2600
+ }
2601
+ if (keys.size > 1) {
2602
+ scopeLog.info("emit:fan-out", {
2591
2603
  from: type,
2592
- to: qualified,
2593
- scopeOrbital: scope.orbital,
2594
- scopeTrait: scope.trait
2604
+ keys: Array.from(keys),
2605
+ chainDepth: chain.length
2595
2606
  });
2596
2607
  }
2597
- baseBus.emit(qualified, payload, source);
2608
+ for (const key of keys) baseBus.emit(key, payload, source);
2598
2609
  return;
2599
2610
  }
2600
2611
  baseBus.emit(type, payload, source);
2601
2612
  }
2602
2613
  };
2603
- }, [baseBus, scope]);
2614
+ }, [baseBus, chain]);
2604
2615
  }
2605
2616
  function useTapReveal(options = {}) {
2606
2617
  const { onReveal, onDismiss, refs, enabled = true } = options;
@@ -3197,13 +3208,13 @@ var Icon = ({
3197
3208
  style
3198
3209
  }) => {
3199
3210
  const directIcon = typeof icon === "string" ? void 0 : icon;
3200
- const effectiveName = typeof icon === "string" ? icon : name;
3211
+ const effectiveName = typeof icon === "string" && icon !== "" ? icon : name;
3212
+ const effectiveStrokeWidth = strokeWidth != null && strokeWidth > 0 ? strokeWidth : void 0;
3201
3213
  const family = useIconFamily();
3202
3214
  const RenderedComponent = React12__default.useMemo(() => {
3203
3215
  if (directIcon) return null;
3204
3216
  return effectiveName ? resolveIconForFamily(effectiveName) : null;
3205
3217
  }, [directIcon, effectiveName, family]);
3206
- const effectiveStrokeWidth = strokeWidth ?? void 0;
3207
3218
  const inlineStyle = {
3208
3219
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
3209
3220
  ...style
@@ -3507,7 +3518,8 @@ var Button = React12__default.forwardRef(
3507
3518
  "font-medium",
3508
3519
  "rounded-sm",
3509
3520
  "cursor-pointer",
3510
- "transition-all duration-[var(--transition-normal)]",
3521
+ "chrome-button",
3522
+ "transition-all duration-normal",
3511
3523
  "focus:outline-none focus:ring-[length:var(--focus-ring-width)] focus:ring-ring focus:ring-offset-[length:var(--focus-ring-offset)]",
3512
3524
  "disabled:opacity-50 disabled:cursor-not-allowed",
3513
3525
  variantStyles2[variant],
@@ -3652,21 +3664,21 @@ var variantStyles4 = {
3652
3664
  "bg-card",
3653
3665
  "border-[length:var(--border-width)] border-border",
3654
3666
  "shadow-elevation-card",
3655
- "transition-all duration-[var(--transition-normal)]",
3667
+ "transition-all duration-normal",
3656
3668
  "hover:shadow-elevation-dialog hover:translate-y-[var(--hover-translate-y)]"
3657
3669
  ].join(" "),
3658
3670
  bordered: [
3659
3671
  "bg-card",
3660
3672
  "border-[length:var(--border-width)] border-border",
3661
3673
  "shadow-elevation-card",
3662
- "transition-all duration-[var(--transition-normal)]",
3674
+ "transition-all duration-normal",
3663
3675
  "hover:shadow-elevation-dialog hover:translate-y-[var(--hover-translate-y)]"
3664
3676
  ].join(" "),
3665
3677
  elevated: [
3666
3678
  "bg-card",
3667
3679
  "border-[length:var(--border-width)] border-border",
3668
3680
  "shadow",
3669
- "transition-all duration-[var(--transition-normal)]",
3681
+ "transition-all duration-normal",
3670
3682
  "hover:shadow-elevation-dialog hover:translate-y-[var(--hover-translate-y)]"
3671
3683
  ].join(" "),
3672
3684
  // Interactive variant with theme-specific hover effects
@@ -3675,7 +3687,7 @@ var variantStyles4 = {
3675
3687
  "border-[length:var(--border-width)] border-border",
3676
3688
  "shadow",
3677
3689
  "cursor-pointer",
3678
- "transition-all duration-[var(--transition-normal)]",
3690
+ "transition-all duration-normal",
3679
3691
  "hover:shadow-elevation-dialog"
3680
3692
  ].join(" ")
3681
3693
  };
@@ -3726,7 +3738,8 @@ var Card = React12__default.forwardRef(
3726
3738
  ref,
3727
3739
  className: cn(
3728
3740
  "rounded-container relative",
3729
- "transition-all duration-[var(--transition-normal)]",
3741
+ "transition-all duration-normal",
3742
+ "chrome-panel",
3730
3743
  variantStyles4[variant],
3731
3744
  paddingStyles2[padding],
3732
3745
  lookStyles[look],
@@ -5078,6 +5091,10 @@ var AnimatedCounter = ({
5078
5091
  setDisplayValue(String(value));
5079
5092
  return;
5080
5093
  }
5094
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
5095
+ setDisplayValue(String(value));
5096
+ return;
5097
+ }
5081
5098
  const startTime = performance.now();
5082
5099
  const tick = (now) => {
5083
5100
  const elapsed = now - startTime;