@almadar/ui 5.36.0 → 5.37.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.
@@ -7,9 +7,6 @@ var tailwindMerge = require('tailwind-merge');
7
7
  var providers = require('@almadar/ui/providers');
8
8
  var logger = require('@almadar/logger');
9
9
  var LucideIcons2 = require('lucide-react');
10
- var PhosphorIcons = require('@phosphor-icons/react');
11
- var TablerIcons = require('@tabler/icons-react');
12
- var FaIcons = require('react-icons/fa');
13
10
  var reactDom = require('react-dom');
14
11
  var hooks = require('@almadar/ui/hooks');
15
12
  var evaluator = require('@almadar/evaluator');
@@ -70,9 +67,6 @@ function _interopNamespace(e) {
70
67
 
71
68
  var React82__namespace = /*#__PURE__*/_interopNamespace(React82);
72
69
  var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
73
- var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
74
- var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
75
- var FaIcons__namespace = /*#__PURE__*/_interopNamespace(FaIcons);
76
70
  var ELK__default = /*#__PURE__*/_interopDefault(ELK);
77
71
  var SyntaxHighlighter__default = /*#__PURE__*/_interopDefault(SyntaxHighlighter);
78
72
  var dark__default = /*#__PURE__*/_interopDefault(dark);
@@ -578,6 +572,41 @@ function kebabToPascal(name) {
578
572
  return part.charAt(0).toUpperCase() + part.slice(1);
579
573
  }).join("");
580
574
  }
575
+ function loadLib(key, importer) {
576
+ let p2 = libPromises.get(key);
577
+ if (!p2) {
578
+ p2 = importer().then((m) => m);
579
+ libPromises.set(key, p2);
580
+ }
581
+ return p2;
582
+ }
583
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
584
+ const Lazy = React82__namespace.default.lazy(async () => {
585
+ const lib = await loadLib(libKey, importer);
586
+ const Comp = pick(lib);
587
+ if (!Comp) {
588
+ warnFallback(fallbackName, family);
589
+ return { default: makeLucideAdapter(fallbackName, true) };
590
+ }
591
+ return { default: Comp };
592
+ });
593
+ const Wrapped = (props) => /* @__PURE__ */ jsxRuntime.jsx(
594
+ React82__namespace.default.Suspense,
595
+ {
596
+ fallback: /* @__PURE__ */ jsxRuntime.jsx(
597
+ "span",
598
+ {
599
+ "aria-hidden": true,
600
+ className: props.className,
601
+ style: { display: "inline-block", ...props.style }
602
+ }
603
+ ),
604
+ children: /* @__PURE__ */ jsxRuntime.jsx(Lazy, { ...props })
605
+ }
606
+ );
607
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
608
+ return Wrapped;
609
+ }
581
610
  function resolveLucide(name) {
582
611
  if (lucideAliases[name]) return lucideAliases[name];
583
612
  const pascal = kebabToPascal(name);
@@ -588,60 +617,81 @@ function resolveLucide(name) {
588
617
  if (asIs && typeof asIs === "object") return asIs;
589
618
  return LucideIcons2__namespace.HelpCircle;
590
619
  }
591
- function resolvePhosphor(name, weight) {
620
+ function resolvePhosphor(name, weight, family) {
592
621
  const target = phosphorAliases[name] ?? kebabToPascal(name);
593
- const map = PhosphorIcons__namespace;
594
- const PhosphorComp = map[target];
595
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
596
- const Component = PhosphorComp;
597
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
598
- Component,
599
- {
600
- weight,
601
- className: props.className,
602
- style: props.style,
603
- size: props.size ?? "1em"
604
- }
622
+ return lazyFamilyIcon(
623
+ "phosphor",
624
+ () => import('@phosphor-icons/react'),
625
+ (lib) => {
626
+ const PhosphorComp = lib[target];
627
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
628
+ const Component = PhosphorComp;
629
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
630
+ Component,
631
+ {
632
+ weight,
633
+ className: props.className,
634
+ style: props.style,
635
+ size: props.size ?? "1em"
636
+ }
637
+ );
638
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
639
+ return Adapter;
640
+ },
641
+ name,
642
+ family
605
643
  );
606
- Adapter.displayName = `Phosphor.${target}.${weight}`;
607
- return Adapter;
608
644
  }
609
- function resolveTabler(name) {
645
+ function resolveTabler(name, family) {
610
646
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
611
647
  const target = `Icon${suffix}`;
612
- const map = TablerIcons__namespace;
613
- const TablerComp = map[target];
614
- if (!TablerComp || typeof TablerComp !== "object") return null;
615
- const Component = TablerComp;
616
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
617
- Component,
618
- {
619
- stroke: props.strokeWidth ?? 1.5,
620
- className: props.className,
621
- style: props.style,
622
- size: props.size ?? 24
623
- }
648
+ return lazyFamilyIcon(
649
+ "tabler",
650
+ () => import('@tabler/icons-react'),
651
+ (lib) => {
652
+ const TablerComp = lib[target];
653
+ if (!TablerComp || typeof TablerComp !== "object") return null;
654
+ const Component = TablerComp;
655
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
656
+ Component,
657
+ {
658
+ stroke: props.strokeWidth ?? 1.5,
659
+ className: props.className,
660
+ style: props.style,
661
+ size: props.size ?? 24
662
+ }
663
+ );
664
+ Adapter.displayName = `Tabler.${target}`;
665
+ return Adapter;
666
+ },
667
+ name,
668
+ family
624
669
  );
625
- Adapter.displayName = `Tabler.${target}`;
626
- return Adapter;
627
670
  }
628
- function resolveFa(name) {
671
+ function resolveFa(name, family) {
629
672
  const suffix = faAliases[name] ?? kebabToPascal(name);
630
673
  const target = `Fa${suffix}`;
631
- const map = FaIcons__namespace;
632
- const FaComp = map[target];
633
- if (!FaComp || typeof FaComp !== "function") return null;
634
- const Component = FaComp;
635
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
636
- Component,
637
- {
638
- className: props.className,
639
- style: props.style,
640
- size: props.size ?? "1em"
641
- }
674
+ return lazyFamilyIcon(
675
+ "fa",
676
+ () => import('react-icons/fa'),
677
+ (lib) => {
678
+ const FaComp = lib[target];
679
+ if (!FaComp || typeof FaComp !== "function") return null;
680
+ const Component = FaComp;
681
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
682
+ Component,
683
+ {
684
+ className: props.className,
685
+ style: props.style,
686
+ size: props.size ?? "1em"
687
+ }
688
+ );
689
+ Adapter.displayName = `Fa.${target}`;
690
+ return Adapter;
691
+ },
692
+ name,
693
+ family
642
694
  );
643
- Adapter.displayName = `Fa.${target}`;
644
- return Adapter;
645
695
  }
646
696
  function warnFallback(name, family) {
647
697
  const key = `${family}::${name}`;
@@ -675,39 +725,22 @@ function resolveIconForFamily(name, family) {
675
725
  switch (family) {
676
726
  case "lucide":
677
727
  return makeLucideAdapter(name, false);
678
- case "phosphor-outline": {
679
- const p2 = resolvePhosphor(name, "regular");
680
- if (p2) return p2;
681
- warnFallback(name, family);
682
- return makeLucideAdapter(name, true);
683
- }
684
- case "phosphor-fill": {
685
- const p2 = resolvePhosphor(name, "fill");
686
- if (p2) return p2;
687
- warnFallback(name, family);
688
- return makeLucideAdapter(name, true);
689
- }
690
- case "phosphor-duotone": {
691
- const p2 = resolvePhosphor(name, "duotone");
692
- if (p2) return p2;
693
- warnFallback(name, family);
694
- return makeLucideAdapter(name, true);
695
- }
696
- case "tabler": {
697
- const t = resolveTabler(name);
698
- if (t) return t;
699
- warnFallback(name, family);
700
- return makeLucideAdapter(name, true);
701
- }
702
- case "fa-solid": {
703
- const f3 = resolveFa(name);
704
- if (f3) return f3;
705
- warnFallback(name, family);
706
- return makeLucideAdapter(name, true);
707
- }
708
- }
709
- }
710
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
728
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
729
+ // dynamic-imports the library on first render and falls back to lucide
730
+ // internally when the family lacks the icon (see lazyFamilyIcon).
731
+ case "phosphor-outline":
732
+ return resolvePhosphor(name, "regular", family);
733
+ case "phosphor-fill":
734
+ return resolvePhosphor(name, "fill", family);
735
+ case "phosphor-duotone":
736
+ return resolvePhosphor(name, "duotone", family);
737
+ case "tabler":
738
+ return resolveTabler(name, family);
739
+ case "fa-solid":
740
+ return resolveFa(name, family);
741
+ }
742
+ }
743
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
711
744
  var init_iconFamily = __esm({
712
745
  "lib/iconFamily.tsx"() {
713
746
  "use client";
@@ -723,6 +756,7 @@ var init_iconFamily = __esm({
723
756
  cachedFamily = null;
724
757
  listeners = /* @__PURE__ */ new Set();
725
758
  observer = null;
759
+ libPromises = /* @__PURE__ */ new Map();
726
760
  lucideAliases = {
727
761
  close: LucideIcons2__namespace.X,
728
762
  trash: LucideIcons2__namespace.Trash2,
@@ -7,9 +7,6 @@ import { EventBusContext, useTraitScope, OrbitalProvider, TraitScopeProvider, Ve
7
7
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
8
8
  import * as LucideIcons2 from 'lucide-react';
9
9
  import { Loader2, X, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, Code, FileText, WrapText, Check, Copy, RotateCcw, Play, Terminal, XCircle, AlertTriangle, Trash2, Link2, ZoomOut, ZoomIn, Download, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, PauseCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, Pause, SkipForward, Bug, Send, ChevronUp, ChevronDown, Wrench, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
10
- import * as PhosphorIcons from '@phosphor-icons/react';
11
- import * as TablerIcons from '@tabler/icons-react';
12
- import * as FaIcons from 'react-icons/fa';
13
10
  import { createPortal } from 'react-dom';
14
11
  import { useTranslate, useEventBus as useEventBus$1 } from '@almadar/ui/hooks';
15
12
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
@@ -529,6 +526,41 @@ function kebabToPascal(name) {
529
526
  return part.charAt(0).toUpperCase() + part.slice(1);
530
527
  }).join("");
531
528
  }
529
+ function loadLib(key, importer) {
530
+ let p2 = libPromises.get(key);
531
+ if (!p2) {
532
+ p2 = importer().then((m) => m);
533
+ libPromises.set(key, p2);
534
+ }
535
+ return p2;
536
+ }
537
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
538
+ const Lazy = React82__default.lazy(async () => {
539
+ const lib = await loadLib(libKey, importer);
540
+ const Comp = pick(lib);
541
+ if (!Comp) {
542
+ warnFallback(fallbackName, family);
543
+ return { default: makeLucideAdapter(fallbackName, true) };
544
+ }
545
+ return { default: Comp };
546
+ });
547
+ const Wrapped = (props) => /* @__PURE__ */ jsx(
548
+ React82__default.Suspense,
549
+ {
550
+ fallback: /* @__PURE__ */ jsx(
551
+ "span",
552
+ {
553
+ "aria-hidden": true,
554
+ className: props.className,
555
+ style: { display: "inline-block", ...props.style }
556
+ }
557
+ ),
558
+ children: /* @__PURE__ */ jsx(Lazy, { ...props })
559
+ }
560
+ );
561
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
562
+ return Wrapped;
563
+ }
532
564
  function resolveLucide(name) {
533
565
  if (lucideAliases[name]) return lucideAliases[name];
534
566
  const pascal = kebabToPascal(name);
@@ -539,60 +571,81 @@ function resolveLucide(name) {
539
571
  if (asIs && typeof asIs === "object") return asIs;
540
572
  return LucideIcons2.HelpCircle;
541
573
  }
542
- function resolvePhosphor(name, weight) {
574
+ function resolvePhosphor(name, weight, family) {
543
575
  const target = phosphorAliases[name] ?? kebabToPascal(name);
544
- const map = PhosphorIcons;
545
- const PhosphorComp = map[target];
546
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
547
- const Component = PhosphorComp;
548
- const Adapter = (props) => /* @__PURE__ */ jsx(
549
- Component,
550
- {
551
- weight,
552
- className: props.className,
553
- style: props.style,
554
- size: props.size ?? "1em"
555
- }
576
+ return lazyFamilyIcon(
577
+ "phosphor",
578
+ () => import('@phosphor-icons/react'),
579
+ (lib) => {
580
+ const PhosphorComp = lib[target];
581
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
582
+ const Component = PhosphorComp;
583
+ const Adapter = (props) => /* @__PURE__ */ jsx(
584
+ Component,
585
+ {
586
+ weight,
587
+ className: props.className,
588
+ style: props.style,
589
+ size: props.size ?? "1em"
590
+ }
591
+ );
592
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
593
+ return Adapter;
594
+ },
595
+ name,
596
+ family
556
597
  );
557
- Adapter.displayName = `Phosphor.${target}.${weight}`;
558
- return Adapter;
559
598
  }
560
- function resolveTabler(name) {
599
+ function resolveTabler(name, family) {
561
600
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
562
601
  const target = `Icon${suffix}`;
563
- const map = TablerIcons;
564
- const TablerComp = map[target];
565
- if (!TablerComp || typeof TablerComp !== "object") return null;
566
- const Component = TablerComp;
567
- const Adapter = (props) => /* @__PURE__ */ jsx(
568
- Component,
569
- {
570
- stroke: props.strokeWidth ?? 1.5,
571
- className: props.className,
572
- style: props.style,
573
- size: props.size ?? 24
574
- }
602
+ return lazyFamilyIcon(
603
+ "tabler",
604
+ () => import('@tabler/icons-react'),
605
+ (lib) => {
606
+ const TablerComp = lib[target];
607
+ if (!TablerComp || typeof TablerComp !== "object") return null;
608
+ const Component = TablerComp;
609
+ const Adapter = (props) => /* @__PURE__ */ jsx(
610
+ Component,
611
+ {
612
+ stroke: props.strokeWidth ?? 1.5,
613
+ className: props.className,
614
+ style: props.style,
615
+ size: props.size ?? 24
616
+ }
617
+ );
618
+ Adapter.displayName = `Tabler.${target}`;
619
+ return Adapter;
620
+ },
621
+ name,
622
+ family
575
623
  );
576
- Adapter.displayName = `Tabler.${target}`;
577
- return Adapter;
578
624
  }
579
- function resolveFa(name) {
625
+ function resolveFa(name, family) {
580
626
  const suffix = faAliases[name] ?? kebabToPascal(name);
581
627
  const target = `Fa${suffix}`;
582
- const map = FaIcons;
583
- const FaComp = map[target];
584
- if (!FaComp || typeof FaComp !== "function") return null;
585
- const Component = FaComp;
586
- const Adapter = (props) => /* @__PURE__ */ jsx(
587
- Component,
588
- {
589
- className: props.className,
590
- style: props.style,
591
- size: props.size ?? "1em"
592
- }
628
+ return lazyFamilyIcon(
629
+ "fa",
630
+ () => import('react-icons/fa'),
631
+ (lib) => {
632
+ const FaComp = lib[target];
633
+ if (!FaComp || typeof FaComp !== "function") return null;
634
+ const Component = FaComp;
635
+ const Adapter = (props) => /* @__PURE__ */ jsx(
636
+ Component,
637
+ {
638
+ className: props.className,
639
+ style: props.style,
640
+ size: props.size ?? "1em"
641
+ }
642
+ );
643
+ Adapter.displayName = `Fa.${target}`;
644
+ return Adapter;
645
+ },
646
+ name,
647
+ family
593
648
  );
594
- Adapter.displayName = `Fa.${target}`;
595
- return Adapter;
596
649
  }
597
650
  function warnFallback(name, family) {
598
651
  const key = `${family}::${name}`;
@@ -626,39 +679,22 @@ function resolveIconForFamily(name, family) {
626
679
  switch (family) {
627
680
  case "lucide":
628
681
  return makeLucideAdapter(name, false);
629
- case "phosphor-outline": {
630
- const p2 = resolvePhosphor(name, "regular");
631
- if (p2) return p2;
632
- warnFallback(name, family);
633
- return makeLucideAdapter(name, true);
634
- }
635
- case "phosphor-fill": {
636
- const p2 = resolvePhosphor(name, "fill");
637
- if (p2) return p2;
638
- warnFallback(name, family);
639
- return makeLucideAdapter(name, true);
640
- }
641
- case "phosphor-duotone": {
642
- const p2 = resolvePhosphor(name, "duotone");
643
- if (p2) return p2;
644
- warnFallback(name, family);
645
- return makeLucideAdapter(name, true);
646
- }
647
- case "tabler": {
648
- const t = resolveTabler(name);
649
- if (t) return t;
650
- warnFallback(name, family);
651
- return makeLucideAdapter(name, true);
652
- }
653
- case "fa-solid": {
654
- const f3 = resolveFa(name);
655
- if (f3) return f3;
656
- warnFallback(name, family);
657
- return makeLucideAdapter(name, true);
658
- }
659
- }
660
- }
661
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
682
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
683
+ // dynamic-imports the library on first render and falls back to lucide
684
+ // internally when the family lacks the icon (see lazyFamilyIcon).
685
+ case "phosphor-outline":
686
+ return resolvePhosphor(name, "regular", family);
687
+ case "phosphor-fill":
688
+ return resolvePhosphor(name, "fill", family);
689
+ case "phosphor-duotone":
690
+ return resolvePhosphor(name, "duotone", family);
691
+ case "tabler":
692
+ return resolveTabler(name, family);
693
+ case "fa-solid":
694
+ return resolveFa(name, family);
695
+ }
696
+ }
697
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
662
698
  var init_iconFamily = __esm({
663
699
  "lib/iconFamily.tsx"() {
664
700
  "use client";
@@ -674,6 +710,7 @@ var init_iconFamily = __esm({
674
710
  cachedFamily = null;
675
711
  listeners = /* @__PURE__ */ new Set();
676
712
  observer = null;
713
+ libPromises = /* @__PURE__ */ new Map();
677
714
  lucideAliases = {
678
715
  close: LucideIcons2.X,
679
716
  trash: LucideIcons2.Trash2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.36.0",
3
+ "version": "5.37.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [