@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.
@@ -8,9 +8,6 @@ var ELK = require('elkjs/lib/elk.bundled.js');
8
8
  var react = require('@xyflow/react');
9
9
  var hooks = require('@almadar/ui/hooks');
10
10
  var LucideIcons2 = require('lucide-react');
11
- var PhosphorIcons = require('@phosphor-icons/react');
12
- var TablerIcons = require('@tabler/icons-react');
13
- var FaIcons = require('react-icons/fa');
14
11
  var reactDom = require('react-dom');
15
12
  var evaluator = require('@almadar/evaluator');
16
13
  var context = require('@almadar/ui/context');
@@ -69,9 +66,6 @@ function _interopNamespace(e) {
69
66
  var React91__namespace = /*#__PURE__*/_interopNamespace(React91);
70
67
  var ELK__default = /*#__PURE__*/_interopDefault(ELK);
71
68
  var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
72
- var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
73
- var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
74
- var FaIcons__namespace = /*#__PURE__*/_interopNamespace(FaIcons);
75
69
  var SyntaxHighlighter__default = /*#__PURE__*/_interopDefault(SyntaxHighlighter);
76
70
  var dark__default = /*#__PURE__*/_interopDefault(dark);
77
71
  var langJson__default = /*#__PURE__*/_interopDefault(langJson);
@@ -4522,6 +4516,41 @@ function kebabToPascal(name) {
4522
4516
  return part.charAt(0).toUpperCase() + part.slice(1);
4523
4517
  }).join("");
4524
4518
  }
4519
+ function loadLib(key, importer) {
4520
+ let p2 = libPromises.get(key);
4521
+ if (!p2) {
4522
+ p2 = importer().then((m) => m);
4523
+ libPromises.set(key, p2);
4524
+ }
4525
+ return p2;
4526
+ }
4527
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4528
+ const Lazy = React91__namespace.default.lazy(async () => {
4529
+ const lib = await loadLib(libKey, importer);
4530
+ const Comp = pick(lib);
4531
+ if (!Comp) {
4532
+ warnFallback(fallbackName, family);
4533
+ return { default: makeLucideAdapter(fallbackName, true) };
4534
+ }
4535
+ return { default: Comp };
4536
+ });
4537
+ const Wrapped = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4538
+ React91__namespace.default.Suspense,
4539
+ {
4540
+ fallback: /* @__PURE__ */ jsxRuntime.jsx(
4541
+ "span",
4542
+ {
4543
+ "aria-hidden": true,
4544
+ className: props.className,
4545
+ style: { display: "inline-block", ...props.style }
4546
+ }
4547
+ ),
4548
+ children: /* @__PURE__ */ jsxRuntime.jsx(Lazy, { ...props })
4549
+ }
4550
+ );
4551
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
4552
+ return Wrapped;
4553
+ }
4525
4554
  function resolveLucide(name) {
4526
4555
  if (lucideAliases[name]) return lucideAliases[name];
4527
4556
  const pascal = kebabToPascal(name);
@@ -4532,60 +4561,81 @@ function resolveLucide(name) {
4532
4561
  if (asIs && typeof asIs === "object") return asIs;
4533
4562
  return LucideIcons2__namespace.HelpCircle;
4534
4563
  }
4535
- function resolvePhosphor(name, weight) {
4564
+ function resolvePhosphor(name, weight, family) {
4536
4565
  const target = phosphorAliases[name] ?? kebabToPascal(name);
4537
- const map = PhosphorIcons__namespace;
4538
- const PhosphorComp = map[target];
4539
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
4540
- const Component = PhosphorComp;
4541
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4542
- Component,
4543
- {
4544
- weight,
4545
- className: props.className,
4546
- style: props.style,
4547
- size: props.size ?? "1em"
4548
- }
4566
+ return lazyFamilyIcon(
4567
+ "phosphor",
4568
+ () => import('@phosphor-icons/react'),
4569
+ (lib) => {
4570
+ const PhosphorComp = lib[target];
4571
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
4572
+ const Component = PhosphorComp;
4573
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4574
+ Component,
4575
+ {
4576
+ weight,
4577
+ className: props.className,
4578
+ style: props.style,
4579
+ size: props.size ?? "1em"
4580
+ }
4581
+ );
4582
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
4583
+ return Adapter;
4584
+ },
4585
+ name,
4586
+ family
4549
4587
  );
4550
- Adapter.displayName = `Phosphor.${target}.${weight}`;
4551
- return Adapter;
4552
4588
  }
4553
- function resolveTabler(name) {
4589
+ function resolveTabler(name, family) {
4554
4590
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
4555
4591
  const target = `Icon${suffix}`;
4556
- const map = TablerIcons__namespace;
4557
- const TablerComp = map[target];
4558
- if (!TablerComp || typeof TablerComp !== "object") return null;
4559
- const Component = TablerComp;
4560
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4561
- Component,
4562
- {
4563
- stroke: props.strokeWidth ?? 1.5,
4564
- className: props.className,
4565
- style: props.style,
4566
- size: props.size ?? 24
4567
- }
4592
+ return lazyFamilyIcon(
4593
+ "tabler",
4594
+ () => import('@tabler/icons-react'),
4595
+ (lib) => {
4596
+ const TablerComp = lib[target];
4597
+ if (!TablerComp || typeof TablerComp !== "object") return null;
4598
+ const Component = TablerComp;
4599
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4600
+ Component,
4601
+ {
4602
+ stroke: props.strokeWidth ?? 1.5,
4603
+ className: props.className,
4604
+ style: props.style,
4605
+ size: props.size ?? 24
4606
+ }
4607
+ );
4608
+ Adapter.displayName = `Tabler.${target}`;
4609
+ return Adapter;
4610
+ },
4611
+ name,
4612
+ family
4568
4613
  );
4569
- Adapter.displayName = `Tabler.${target}`;
4570
- return Adapter;
4571
4614
  }
4572
- function resolveFa(name) {
4615
+ function resolveFa(name, family) {
4573
4616
  const suffix = faAliases[name] ?? kebabToPascal(name);
4574
4617
  const target = `Fa${suffix}`;
4575
- const map = FaIcons__namespace;
4576
- const FaComp = map[target];
4577
- if (!FaComp || typeof FaComp !== "function") return null;
4578
- const Component = FaComp;
4579
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4580
- Component,
4581
- {
4582
- className: props.className,
4583
- style: props.style,
4584
- size: props.size ?? "1em"
4585
- }
4618
+ return lazyFamilyIcon(
4619
+ "fa",
4620
+ () => import('react-icons/fa'),
4621
+ (lib) => {
4622
+ const FaComp = lib[target];
4623
+ if (!FaComp || typeof FaComp !== "function") return null;
4624
+ const Component = FaComp;
4625
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4626
+ Component,
4627
+ {
4628
+ className: props.className,
4629
+ style: props.style,
4630
+ size: props.size ?? "1em"
4631
+ }
4632
+ );
4633
+ Adapter.displayName = `Fa.${target}`;
4634
+ return Adapter;
4635
+ },
4636
+ name,
4637
+ family
4586
4638
  );
4587
- Adapter.displayName = `Fa.${target}`;
4588
- return Adapter;
4589
4639
  }
4590
4640
  function warnFallback(name, family) {
4591
4641
  const key = `${family}::${name}`;
@@ -4619,39 +4669,22 @@ function resolveIconForFamily(name, family) {
4619
4669
  switch (family) {
4620
4670
  case "lucide":
4621
4671
  return makeLucideAdapter(name, false);
4622
- case "phosphor-outline": {
4623
- const p2 = resolvePhosphor(name, "regular");
4624
- if (p2) return p2;
4625
- warnFallback(name, family);
4626
- return makeLucideAdapter(name, true);
4627
- }
4628
- case "phosphor-fill": {
4629
- const p2 = resolvePhosphor(name, "fill");
4630
- if (p2) return p2;
4631
- warnFallback(name, family);
4632
- return makeLucideAdapter(name, true);
4633
- }
4634
- case "phosphor-duotone": {
4635
- const p2 = resolvePhosphor(name, "duotone");
4636
- if (p2) return p2;
4637
- warnFallback(name, family);
4638
- return makeLucideAdapter(name, true);
4639
- }
4640
- case "tabler": {
4641
- const t = resolveTabler(name);
4642
- if (t) return t;
4643
- warnFallback(name, family);
4644
- return makeLucideAdapter(name, true);
4645
- }
4646
- case "fa-solid": {
4647
- const f3 = resolveFa(name);
4648
- if (f3) return f3;
4649
- warnFallback(name, family);
4650
- return makeLucideAdapter(name, true);
4651
- }
4652
- }
4653
- }
4654
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
4672
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
4673
+ // dynamic-imports the library on first render and falls back to lucide
4674
+ // internally when the family lacks the icon (see lazyFamilyIcon).
4675
+ case "phosphor-outline":
4676
+ return resolvePhosphor(name, "regular", family);
4677
+ case "phosphor-fill":
4678
+ return resolvePhosphor(name, "fill", family);
4679
+ case "phosphor-duotone":
4680
+ return resolvePhosphor(name, "duotone", family);
4681
+ case "tabler":
4682
+ return resolveTabler(name, family);
4683
+ case "fa-solid":
4684
+ return resolveFa(name, family);
4685
+ }
4686
+ }
4687
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
4655
4688
  var init_iconFamily = __esm({
4656
4689
  "lib/iconFamily.tsx"() {
4657
4690
  "use client";
@@ -4667,6 +4700,7 @@ var init_iconFamily = __esm({
4667
4700
  cachedFamily = null;
4668
4701
  listeners = /* @__PURE__ */ new Set();
4669
4702
  observer = null;
4703
+ libPromises = /* @__PURE__ */ new Map();
4670
4704
  lucideAliases = {
4671
4705
  close: LucideIcons2__namespace.X,
4672
4706
  trash: LucideIcons2__namespace.Trash2,
package/dist/avl/index.js CHANGED
@@ -8,9 +8,6 @@ import { MarkerType, useReactFlow, Handle, Position, getBezierPath, EdgeLabelRen
8
8
  import { useTranslate, useEventBus as useEventBus$1 } from '@almadar/ui/hooks';
9
9
  import * as LucideIcons2 from 'lucide-react';
10
10
  import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, 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';
11
- import * as PhosphorIcons from '@phosphor-icons/react';
12
- import * as TablerIcons from '@tabler/icons-react';
13
- import * as FaIcons from 'react-icons/fa';
14
11
  import { createPortal } from 'react-dom';
15
12
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
16
13
  import { UISlotProvider, useUISlots } from '@almadar/ui/context';
@@ -4473,6 +4470,41 @@ function kebabToPascal(name) {
4473
4470
  return part.charAt(0).toUpperCase() + part.slice(1);
4474
4471
  }).join("");
4475
4472
  }
4473
+ function loadLib(key, importer) {
4474
+ let p2 = libPromises.get(key);
4475
+ if (!p2) {
4476
+ p2 = importer().then((m) => m);
4477
+ libPromises.set(key, p2);
4478
+ }
4479
+ return p2;
4480
+ }
4481
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4482
+ const Lazy = React91__default.lazy(async () => {
4483
+ const lib = await loadLib(libKey, importer);
4484
+ const Comp = pick(lib);
4485
+ if (!Comp) {
4486
+ warnFallback(fallbackName, family);
4487
+ return { default: makeLucideAdapter(fallbackName, true) };
4488
+ }
4489
+ return { default: Comp };
4490
+ });
4491
+ const Wrapped = (props) => /* @__PURE__ */ jsx(
4492
+ React91__default.Suspense,
4493
+ {
4494
+ fallback: /* @__PURE__ */ jsx(
4495
+ "span",
4496
+ {
4497
+ "aria-hidden": true,
4498
+ className: props.className,
4499
+ style: { display: "inline-block", ...props.style }
4500
+ }
4501
+ ),
4502
+ children: /* @__PURE__ */ jsx(Lazy, { ...props })
4503
+ }
4504
+ );
4505
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
4506
+ return Wrapped;
4507
+ }
4476
4508
  function resolveLucide(name) {
4477
4509
  if (lucideAliases[name]) return lucideAliases[name];
4478
4510
  const pascal = kebabToPascal(name);
@@ -4483,60 +4515,81 @@ function resolveLucide(name) {
4483
4515
  if (asIs && typeof asIs === "object") return asIs;
4484
4516
  return LucideIcons2.HelpCircle;
4485
4517
  }
4486
- function resolvePhosphor(name, weight) {
4518
+ function resolvePhosphor(name, weight, family) {
4487
4519
  const target = phosphorAliases[name] ?? kebabToPascal(name);
4488
- const map = PhosphorIcons;
4489
- const PhosphorComp = map[target];
4490
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
4491
- const Component = PhosphorComp;
4492
- const Adapter = (props) => /* @__PURE__ */ jsx(
4493
- Component,
4494
- {
4495
- weight,
4496
- className: props.className,
4497
- style: props.style,
4498
- size: props.size ?? "1em"
4499
- }
4520
+ return lazyFamilyIcon(
4521
+ "phosphor",
4522
+ () => import('@phosphor-icons/react'),
4523
+ (lib) => {
4524
+ const PhosphorComp = lib[target];
4525
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
4526
+ const Component = PhosphorComp;
4527
+ const Adapter = (props) => /* @__PURE__ */ jsx(
4528
+ Component,
4529
+ {
4530
+ weight,
4531
+ className: props.className,
4532
+ style: props.style,
4533
+ size: props.size ?? "1em"
4534
+ }
4535
+ );
4536
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
4537
+ return Adapter;
4538
+ },
4539
+ name,
4540
+ family
4500
4541
  );
4501
- Adapter.displayName = `Phosphor.${target}.${weight}`;
4502
- return Adapter;
4503
4542
  }
4504
- function resolveTabler(name) {
4543
+ function resolveTabler(name, family) {
4505
4544
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
4506
4545
  const target = `Icon${suffix}`;
4507
- const map = TablerIcons;
4508
- const TablerComp = map[target];
4509
- if (!TablerComp || typeof TablerComp !== "object") return null;
4510
- const Component = TablerComp;
4511
- const Adapter = (props) => /* @__PURE__ */ jsx(
4512
- Component,
4513
- {
4514
- stroke: props.strokeWidth ?? 1.5,
4515
- className: props.className,
4516
- style: props.style,
4517
- size: props.size ?? 24
4518
- }
4546
+ return lazyFamilyIcon(
4547
+ "tabler",
4548
+ () => import('@tabler/icons-react'),
4549
+ (lib) => {
4550
+ const TablerComp = lib[target];
4551
+ if (!TablerComp || typeof TablerComp !== "object") return null;
4552
+ const Component = TablerComp;
4553
+ const Adapter = (props) => /* @__PURE__ */ jsx(
4554
+ Component,
4555
+ {
4556
+ stroke: props.strokeWidth ?? 1.5,
4557
+ className: props.className,
4558
+ style: props.style,
4559
+ size: props.size ?? 24
4560
+ }
4561
+ );
4562
+ Adapter.displayName = `Tabler.${target}`;
4563
+ return Adapter;
4564
+ },
4565
+ name,
4566
+ family
4519
4567
  );
4520
- Adapter.displayName = `Tabler.${target}`;
4521
- return Adapter;
4522
4568
  }
4523
- function resolveFa(name) {
4569
+ function resolveFa(name, family) {
4524
4570
  const suffix = faAliases[name] ?? kebabToPascal(name);
4525
4571
  const target = `Fa${suffix}`;
4526
- const map = FaIcons;
4527
- const FaComp = map[target];
4528
- if (!FaComp || typeof FaComp !== "function") return null;
4529
- const Component = FaComp;
4530
- const Adapter = (props) => /* @__PURE__ */ jsx(
4531
- Component,
4532
- {
4533
- className: props.className,
4534
- style: props.style,
4535
- size: props.size ?? "1em"
4536
- }
4572
+ return lazyFamilyIcon(
4573
+ "fa",
4574
+ () => import('react-icons/fa'),
4575
+ (lib) => {
4576
+ const FaComp = lib[target];
4577
+ if (!FaComp || typeof FaComp !== "function") return null;
4578
+ const Component = FaComp;
4579
+ const Adapter = (props) => /* @__PURE__ */ jsx(
4580
+ Component,
4581
+ {
4582
+ className: props.className,
4583
+ style: props.style,
4584
+ size: props.size ?? "1em"
4585
+ }
4586
+ );
4587
+ Adapter.displayName = `Fa.${target}`;
4588
+ return Adapter;
4589
+ },
4590
+ name,
4591
+ family
4537
4592
  );
4538
- Adapter.displayName = `Fa.${target}`;
4539
- return Adapter;
4540
4593
  }
4541
4594
  function warnFallback(name, family) {
4542
4595
  const key = `${family}::${name}`;
@@ -4570,39 +4623,22 @@ function resolveIconForFamily(name, family) {
4570
4623
  switch (family) {
4571
4624
  case "lucide":
4572
4625
  return makeLucideAdapter(name, false);
4573
- case "phosphor-outline": {
4574
- const p2 = resolvePhosphor(name, "regular");
4575
- if (p2) return p2;
4576
- warnFallback(name, family);
4577
- return makeLucideAdapter(name, true);
4578
- }
4579
- case "phosphor-fill": {
4580
- const p2 = resolvePhosphor(name, "fill");
4581
- if (p2) return p2;
4582
- warnFallback(name, family);
4583
- return makeLucideAdapter(name, true);
4584
- }
4585
- case "phosphor-duotone": {
4586
- const p2 = resolvePhosphor(name, "duotone");
4587
- if (p2) return p2;
4588
- warnFallback(name, family);
4589
- return makeLucideAdapter(name, true);
4590
- }
4591
- case "tabler": {
4592
- const t = resolveTabler(name);
4593
- if (t) return t;
4594
- warnFallback(name, family);
4595
- return makeLucideAdapter(name, true);
4596
- }
4597
- case "fa-solid": {
4598
- const f3 = resolveFa(name);
4599
- if (f3) return f3;
4600
- warnFallback(name, family);
4601
- return makeLucideAdapter(name, true);
4602
- }
4603
- }
4604
- }
4605
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
4626
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
4627
+ // dynamic-imports the library on first render and falls back to lucide
4628
+ // internally when the family lacks the icon (see lazyFamilyIcon).
4629
+ case "phosphor-outline":
4630
+ return resolvePhosphor(name, "regular", family);
4631
+ case "phosphor-fill":
4632
+ return resolvePhosphor(name, "fill", family);
4633
+ case "phosphor-duotone":
4634
+ return resolvePhosphor(name, "duotone", family);
4635
+ case "tabler":
4636
+ return resolveTabler(name, family);
4637
+ case "fa-solid":
4638
+ return resolveFa(name, family);
4639
+ }
4640
+ }
4641
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
4606
4642
  var init_iconFamily = __esm({
4607
4643
  "lib/iconFamily.tsx"() {
4608
4644
  "use client";
@@ -4618,6 +4654,7 @@ var init_iconFamily = __esm({
4618
4654
  cachedFamily = null;
4619
4655
  listeners = /* @__PURE__ */ new Set();
4620
4656
  observer = null;
4657
+ libPromises = /* @__PURE__ */ new Map();
4621
4658
  lucideAliases = {
4622
4659
  close: LucideIcons2.X,
4623
4660
  trash: LucideIcons2.Trash2,