@almadar/ui 5.121.3 → 5.121.4

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.
@@ -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
@@ -5078,6 +5089,10 @@ var AnimatedCounter = ({
5078
5089
  setDisplayValue(String(value));
5079
5090
  return;
5080
5091
  }
5092
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
5093
+ setDisplayValue(String(value));
5094
+ return;
5095
+ }
5081
5096
  const startTime = performance.now();
5082
5097
  const tick = (now) => {
5083
5098
  const elapsed = now - startTime;