@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 providers = require('@almadar/ui/providers');
7
7
  var clsx = require('clsx');
8
8
  var tailwindMerge = require('tailwind-merge');
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');
@@ -68,9 +65,6 @@ function _interopNamespace(e) {
68
65
 
69
66
  var React83__namespace = /*#__PURE__*/_interopNamespace(React83);
70
67
  var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
71
- var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
72
- var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
73
- var FaIcons__namespace = /*#__PURE__*/_interopNamespace(FaIcons);
74
68
  var ELK__default = /*#__PURE__*/_interopDefault(ELK);
75
69
  var SyntaxHighlighter__default = /*#__PURE__*/_interopDefault(SyntaxHighlighter);
76
70
  var dark__default = /*#__PURE__*/_interopDefault(dark);
@@ -842,6 +836,41 @@ function kebabToPascal(name) {
842
836
  return part.charAt(0).toUpperCase() + part.slice(1);
843
837
  }).join("");
844
838
  }
839
+ function loadLib(key, importer) {
840
+ let p2 = libPromises.get(key);
841
+ if (!p2) {
842
+ p2 = importer().then((m) => m);
843
+ libPromises.set(key, p2);
844
+ }
845
+ return p2;
846
+ }
847
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
848
+ const Lazy = React83__namespace.default.lazy(async () => {
849
+ const lib = await loadLib(libKey, importer);
850
+ const Comp = pick(lib);
851
+ if (!Comp) {
852
+ warnFallback(fallbackName, family);
853
+ return { default: makeLucideAdapter(fallbackName, true) };
854
+ }
855
+ return { default: Comp };
856
+ });
857
+ const Wrapped = (props) => /* @__PURE__ */ jsxRuntime.jsx(
858
+ React83__namespace.default.Suspense,
859
+ {
860
+ fallback: /* @__PURE__ */ jsxRuntime.jsx(
861
+ "span",
862
+ {
863
+ "aria-hidden": true,
864
+ className: props.className,
865
+ style: { display: "inline-block", ...props.style }
866
+ }
867
+ ),
868
+ children: /* @__PURE__ */ jsxRuntime.jsx(Lazy, { ...props })
869
+ }
870
+ );
871
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
872
+ return Wrapped;
873
+ }
845
874
  function resolveLucide(name) {
846
875
  if (lucideAliases[name]) return lucideAliases[name];
847
876
  const pascal = kebabToPascal(name);
@@ -852,60 +881,81 @@ function resolveLucide(name) {
852
881
  if (asIs && typeof asIs === "object") return asIs;
853
882
  return LucideIcons2__namespace.HelpCircle;
854
883
  }
855
- function resolvePhosphor(name, weight) {
884
+ function resolvePhosphor(name, weight, family) {
856
885
  const target = phosphorAliases[name] ?? kebabToPascal(name);
857
- const map = PhosphorIcons__namespace;
858
- const PhosphorComp = map[target];
859
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
860
- const Component = PhosphorComp;
861
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
862
- Component,
863
- {
864
- weight,
865
- className: props.className,
866
- style: props.style,
867
- size: props.size ?? "1em"
868
- }
886
+ return lazyFamilyIcon(
887
+ "phosphor",
888
+ () => import('@phosphor-icons/react'),
889
+ (lib) => {
890
+ const PhosphorComp = lib[target];
891
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
892
+ const Component = PhosphorComp;
893
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
894
+ Component,
895
+ {
896
+ weight,
897
+ className: props.className,
898
+ style: props.style,
899
+ size: props.size ?? "1em"
900
+ }
901
+ );
902
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
903
+ return Adapter;
904
+ },
905
+ name,
906
+ family
869
907
  );
870
- Adapter.displayName = `Phosphor.${target}.${weight}`;
871
- return Adapter;
872
908
  }
873
- function resolveTabler(name) {
909
+ function resolveTabler(name, family) {
874
910
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
875
911
  const target = `Icon${suffix}`;
876
- const map = TablerIcons__namespace;
877
- const TablerComp = map[target];
878
- if (!TablerComp || typeof TablerComp !== "object") return null;
879
- const Component = TablerComp;
880
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
881
- Component,
882
- {
883
- stroke: props.strokeWidth ?? 1.5,
884
- className: props.className,
885
- style: props.style,
886
- size: props.size ?? 24
887
- }
912
+ return lazyFamilyIcon(
913
+ "tabler",
914
+ () => import('@tabler/icons-react'),
915
+ (lib) => {
916
+ const TablerComp = lib[target];
917
+ if (!TablerComp || typeof TablerComp !== "object") return null;
918
+ const Component = TablerComp;
919
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
920
+ Component,
921
+ {
922
+ stroke: props.strokeWidth ?? 1.5,
923
+ className: props.className,
924
+ style: props.style,
925
+ size: props.size ?? 24
926
+ }
927
+ );
928
+ Adapter.displayName = `Tabler.${target}`;
929
+ return Adapter;
930
+ },
931
+ name,
932
+ family
888
933
  );
889
- Adapter.displayName = `Tabler.${target}`;
890
- return Adapter;
891
934
  }
892
- function resolveFa(name) {
935
+ function resolveFa(name, family) {
893
936
  const suffix = faAliases[name] ?? kebabToPascal(name);
894
937
  const target = `Fa${suffix}`;
895
- const map = FaIcons__namespace;
896
- const FaComp = map[target];
897
- if (!FaComp || typeof FaComp !== "function") return null;
898
- const Component = FaComp;
899
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
900
- Component,
901
- {
902
- className: props.className,
903
- style: props.style,
904
- size: props.size ?? "1em"
905
- }
938
+ return lazyFamilyIcon(
939
+ "fa",
940
+ () => import('react-icons/fa'),
941
+ (lib) => {
942
+ const FaComp = lib[target];
943
+ if (!FaComp || typeof FaComp !== "function") return null;
944
+ const Component = FaComp;
945
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
946
+ Component,
947
+ {
948
+ className: props.className,
949
+ style: props.style,
950
+ size: props.size ?? "1em"
951
+ }
952
+ );
953
+ Adapter.displayName = `Fa.${target}`;
954
+ return Adapter;
955
+ },
956
+ name,
957
+ family
906
958
  );
907
- Adapter.displayName = `Fa.${target}`;
908
- return Adapter;
909
959
  }
910
960
  function warnFallback(name, family) {
911
961
  const key = `${family}::${name}`;
@@ -939,39 +989,22 @@ function resolveIconForFamily(name, family) {
939
989
  switch (family) {
940
990
  case "lucide":
941
991
  return makeLucideAdapter(name, false);
942
- case "phosphor-outline": {
943
- const p2 = resolvePhosphor(name, "regular");
944
- if (p2) return p2;
945
- warnFallback(name, family);
946
- return makeLucideAdapter(name, true);
947
- }
948
- case "phosphor-fill": {
949
- const p2 = resolvePhosphor(name, "fill");
950
- if (p2) return p2;
951
- warnFallback(name, family);
952
- return makeLucideAdapter(name, true);
953
- }
954
- case "phosphor-duotone": {
955
- const p2 = resolvePhosphor(name, "duotone");
956
- if (p2) return p2;
957
- warnFallback(name, family);
958
- return makeLucideAdapter(name, true);
959
- }
960
- case "tabler": {
961
- const t = resolveTabler(name);
962
- if (t) return t;
963
- warnFallback(name, family);
964
- return makeLucideAdapter(name, true);
965
- }
966
- case "fa-solid": {
967
- const f3 = resolveFa(name);
968
- if (f3) return f3;
969
- warnFallback(name, family);
970
- return makeLucideAdapter(name, true);
971
- }
972
- }
973
- }
974
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
992
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
993
+ // dynamic-imports the library on first render and falls back to lucide
994
+ // internally when the family lacks the icon (see lazyFamilyIcon).
995
+ case "phosphor-outline":
996
+ return resolvePhosphor(name, "regular", family);
997
+ case "phosphor-fill":
998
+ return resolvePhosphor(name, "fill", family);
999
+ case "phosphor-duotone":
1000
+ return resolvePhosphor(name, "duotone", family);
1001
+ case "tabler":
1002
+ return resolveTabler(name, family);
1003
+ case "fa-solid":
1004
+ return resolveFa(name, family);
1005
+ }
1006
+ }
1007
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
975
1008
  var init_iconFamily = __esm({
976
1009
  "lib/iconFamily.tsx"() {
977
1010
  "use client";
@@ -987,6 +1020,7 @@ var init_iconFamily = __esm({
987
1020
  cachedFamily = null;
988
1021
  listeners = /* @__PURE__ */ new Set();
989
1022
  observer = null;
1023
+ libPromises = /* @__PURE__ */ new Map();
990
1024
  lucideAliases = {
991
1025
  close: LucideIcons2__namespace.X,
992
1026
  trash: LucideIcons2__namespace.Trash2,
@@ -7,9 +7,6 @@ import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
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 } from '@almadar/ui/hooks';
15
12
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
@@ -793,6 +790,41 @@ function kebabToPascal(name) {
793
790
  return part.charAt(0).toUpperCase() + part.slice(1);
794
791
  }).join("");
795
792
  }
793
+ function loadLib(key, importer) {
794
+ let p2 = libPromises.get(key);
795
+ if (!p2) {
796
+ p2 = importer().then((m) => m);
797
+ libPromises.set(key, p2);
798
+ }
799
+ return p2;
800
+ }
801
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
802
+ const Lazy = React83__default.lazy(async () => {
803
+ const lib = await loadLib(libKey, importer);
804
+ const Comp = pick(lib);
805
+ if (!Comp) {
806
+ warnFallback(fallbackName, family);
807
+ return { default: makeLucideAdapter(fallbackName, true) };
808
+ }
809
+ return { default: Comp };
810
+ });
811
+ const Wrapped = (props) => /* @__PURE__ */ jsx(
812
+ React83__default.Suspense,
813
+ {
814
+ fallback: /* @__PURE__ */ jsx(
815
+ "span",
816
+ {
817
+ "aria-hidden": true,
818
+ className: props.className,
819
+ style: { display: "inline-block", ...props.style }
820
+ }
821
+ ),
822
+ children: /* @__PURE__ */ jsx(Lazy, { ...props })
823
+ }
824
+ );
825
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
826
+ return Wrapped;
827
+ }
796
828
  function resolveLucide(name) {
797
829
  if (lucideAliases[name]) return lucideAliases[name];
798
830
  const pascal = kebabToPascal(name);
@@ -803,60 +835,81 @@ function resolveLucide(name) {
803
835
  if (asIs && typeof asIs === "object") return asIs;
804
836
  return LucideIcons2.HelpCircle;
805
837
  }
806
- function resolvePhosphor(name, weight) {
838
+ function resolvePhosphor(name, weight, family) {
807
839
  const target = phosphorAliases[name] ?? kebabToPascal(name);
808
- const map = PhosphorIcons;
809
- const PhosphorComp = map[target];
810
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
811
- const Component = PhosphorComp;
812
- const Adapter = (props) => /* @__PURE__ */ jsx(
813
- Component,
814
- {
815
- weight,
816
- className: props.className,
817
- style: props.style,
818
- size: props.size ?? "1em"
819
- }
840
+ return lazyFamilyIcon(
841
+ "phosphor",
842
+ () => import('@phosphor-icons/react'),
843
+ (lib) => {
844
+ const PhosphorComp = lib[target];
845
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
846
+ const Component = PhosphorComp;
847
+ const Adapter = (props) => /* @__PURE__ */ jsx(
848
+ Component,
849
+ {
850
+ weight,
851
+ className: props.className,
852
+ style: props.style,
853
+ size: props.size ?? "1em"
854
+ }
855
+ );
856
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
857
+ return Adapter;
858
+ },
859
+ name,
860
+ family
820
861
  );
821
- Adapter.displayName = `Phosphor.${target}.${weight}`;
822
- return Adapter;
823
862
  }
824
- function resolveTabler(name) {
863
+ function resolveTabler(name, family) {
825
864
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
826
865
  const target = `Icon${suffix}`;
827
- const map = TablerIcons;
828
- const TablerComp = map[target];
829
- if (!TablerComp || typeof TablerComp !== "object") return null;
830
- const Component = TablerComp;
831
- const Adapter = (props) => /* @__PURE__ */ jsx(
832
- Component,
833
- {
834
- stroke: props.strokeWidth ?? 1.5,
835
- className: props.className,
836
- style: props.style,
837
- size: props.size ?? 24
838
- }
866
+ return lazyFamilyIcon(
867
+ "tabler",
868
+ () => import('@tabler/icons-react'),
869
+ (lib) => {
870
+ const TablerComp = lib[target];
871
+ if (!TablerComp || typeof TablerComp !== "object") return null;
872
+ const Component = TablerComp;
873
+ const Adapter = (props) => /* @__PURE__ */ jsx(
874
+ Component,
875
+ {
876
+ stroke: props.strokeWidth ?? 1.5,
877
+ className: props.className,
878
+ style: props.style,
879
+ size: props.size ?? 24
880
+ }
881
+ );
882
+ Adapter.displayName = `Tabler.${target}`;
883
+ return Adapter;
884
+ },
885
+ name,
886
+ family
839
887
  );
840
- Adapter.displayName = `Tabler.${target}`;
841
- return Adapter;
842
888
  }
843
- function resolveFa(name) {
889
+ function resolveFa(name, family) {
844
890
  const suffix = faAliases[name] ?? kebabToPascal(name);
845
891
  const target = `Fa${suffix}`;
846
- const map = FaIcons;
847
- const FaComp = map[target];
848
- if (!FaComp || typeof FaComp !== "function") return null;
849
- const Component = FaComp;
850
- const Adapter = (props) => /* @__PURE__ */ jsx(
851
- Component,
852
- {
853
- className: props.className,
854
- style: props.style,
855
- size: props.size ?? "1em"
856
- }
892
+ return lazyFamilyIcon(
893
+ "fa",
894
+ () => import('react-icons/fa'),
895
+ (lib) => {
896
+ const FaComp = lib[target];
897
+ if (!FaComp || typeof FaComp !== "function") return null;
898
+ const Component = FaComp;
899
+ const Adapter = (props) => /* @__PURE__ */ jsx(
900
+ Component,
901
+ {
902
+ className: props.className,
903
+ style: props.style,
904
+ size: props.size ?? "1em"
905
+ }
906
+ );
907
+ Adapter.displayName = `Fa.${target}`;
908
+ return Adapter;
909
+ },
910
+ name,
911
+ family
857
912
  );
858
- Adapter.displayName = `Fa.${target}`;
859
- return Adapter;
860
913
  }
861
914
  function warnFallback(name, family) {
862
915
  const key = `${family}::${name}`;
@@ -890,39 +943,22 @@ function resolveIconForFamily(name, family) {
890
943
  switch (family) {
891
944
  case "lucide":
892
945
  return makeLucideAdapter(name, false);
893
- case "phosphor-outline": {
894
- const p2 = resolvePhosphor(name, "regular");
895
- if (p2) return p2;
896
- warnFallback(name, family);
897
- return makeLucideAdapter(name, true);
898
- }
899
- case "phosphor-fill": {
900
- const p2 = resolvePhosphor(name, "fill");
901
- if (p2) return p2;
902
- warnFallback(name, family);
903
- return makeLucideAdapter(name, true);
904
- }
905
- case "phosphor-duotone": {
906
- const p2 = resolvePhosphor(name, "duotone");
907
- if (p2) return p2;
908
- warnFallback(name, family);
909
- return makeLucideAdapter(name, true);
910
- }
911
- case "tabler": {
912
- const t = resolveTabler(name);
913
- if (t) return t;
914
- warnFallback(name, family);
915
- return makeLucideAdapter(name, true);
916
- }
917
- case "fa-solid": {
918
- const f3 = resolveFa(name);
919
- if (f3) return f3;
920
- warnFallback(name, family);
921
- return makeLucideAdapter(name, true);
922
- }
923
- }
924
- }
925
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
946
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
947
+ // dynamic-imports the library on first render and falls back to lucide
948
+ // internally when the family lacks the icon (see lazyFamilyIcon).
949
+ case "phosphor-outline":
950
+ return resolvePhosphor(name, "regular", family);
951
+ case "phosphor-fill":
952
+ return resolvePhosphor(name, "fill", family);
953
+ case "phosphor-duotone":
954
+ return resolvePhosphor(name, "duotone", family);
955
+ case "tabler":
956
+ return resolveTabler(name, family);
957
+ case "fa-solid":
958
+ return resolveFa(name, family);
959
+ }
960
+ }
961
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
926
962
  var init_iconFamily = __esm({
927
963
  "lib/iconFamily.tsx"() {
928
964
  "use client";
@@ -938,6 +974,7 @@ var init_iconFamily = __esm({
938
974
  cachedFamily = null;
939
975
  listeners = /* @__PURE__ */ new Set();
940
976
  observer = null;
977
+ libPromises = /* @__PURE__ */ new Map();
941
978
  lucideAliases = {
942
979
  close: LucideIcons2.X,
943
980
  trash: LucideIcons2.Trash2,