@almadar/ui 5.113.0 → 5.114.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.
@@ -11,6 +11,7 @@ var LucideIcons2 = require('lucide-react');
11
11
  var reactDom = require('react-dom');
12
12
  var context = require('@almadar/ui/context');
13
13
  var evaluator = require('@almadar/evaluator');
14
+ var ui = require('@almadar/runtime/ui');
14
15
  var reactRouterDom = require('react-router-dom');
15
16
  var SyntaxHighlighter = require('react-syntax-highlighter/dist/esm/prism-light.js');
16
17
  var dark = require('react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js');
@@ -41,6 +42,7 @@ var sortable = require('@dnd-kit/sortable');
41
42
  var utilities = require('@dnd-kit/utilities');
42
43
  var patterns = require('@almadar/core/patterns');
43
44
  var OrbitalServerRuntime = require('@almadar/runtime/OrbitalServerRuntime');
45
+ var registry = require('@almadar/std/registry');
44
46
  var runtime = require('@almadar/runtime');
45
47
 
46
48
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -4531,41 +4533,6 @@ function kebabToPascal(name) {
4531
4533
  return part.charAt(0).toUpperCase() + part.slice(1);
4532
4534
  }).join("");
4533
4535
  }
4534
- function loadLib(key, importer) {
4535
- let p = libPromises.get(key);
4536
- if (!p) {
4537
- p = importer();
4538
- libPromises.set(key, p);
4539
- }
4540
- return p;
4541
- }
4542
- function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4543
- const Lazy = React90__namespace.default.lazy(async () => {
4544
- const lib = await loadLib(libKey, importer);
4545
- const Comp = pick(lib);
4546
- if (!Comp) {
4547
- warnFallback(fallbackName, family);
4548
- return { default: makeLucideAdapter(fallbackName, true) };
4549
- }
4550
- return { default: Comp };
4551
- });
4552
- const Wrapped = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4553
- React90__namespace.default.Suspense,
4554
- {
4555
- fallback: /* @__PURE__ */ jsxRuntime.jsx(
4556
- "span",
4557
- {
4558
- "aria-hidden": true,
4559
- className: props.className,
4560
- style: { display: "inline-block", ...props.style }
4561
- }
4562
- ),
4563
- children: /* @__PURE__ */ jsxRuntime.jsx(Lazy, { ...props })
4564
- }
4565
- );
4566
- Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
4567
- return Wrapped;
4568
- }
4569
4536
  function isComponentLike(v) {
4570
4537
  return v != null && (typeof v === "function" || typeof v === "object");
4571
4538
  }
@@ -4579,146 +4546,32 @@ function resolveLucide(name) {
4579
4546
  if (isComponentLike(asIs)) return asIs;
4580
4547
  return LucideIcons2__namespace.HelpCircle;
4581
4548
  }
4582
- function resolvePhosphor(name, weight, family) {
4583
- const target = phosphorAliases[name] ?? kebabToPascal(name);
4584
- return lazyFamilyIcon(
4585
- "phosphor",
4586
- () => import('@phosphor-icons/react'),
4587
- (lib) => {
4588
- const PhosphorComp = lib[target];
4589
- if (!PhosphorComp) return null;
4590
- const Component = PhosphorComp;
4591
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4592
- Component,
4593
- {
4594
- weight,
4595
- className: props.className,
4596
- style: props.style,
4597
- size: props.size ?? "1em"
4598
- }
4599
- );
4600
- Adapter.displayName = `Phosphor.${target}.${weight}`;
4601
- return Adapter;
4602
- },
4603
- name,
4604
- family
4605
- );
4606
- }
4607
- function resolveTabler(name, family) {
4608
- const suffix = tablerAliases[name] ?? kebabToPascal(name);
4609
- const target = `Icon${suffix}`;
4610
- return lazyFamilyIcon(
4611
- "tabler",
4612
- () => import('@tabler/icons-react'),
4613
- (lib) => {
4614
- const TablerComp = lib[target];
4615
- if (!TablerComp) return null;
4616
- const Component = TablerComp;
4617
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4618
- Component,
4619
- {
4620
- stroke: props.strokeWidth ?? 1.5,
4621
- className: props.className,
4622
- style: props.style,
4623
- size: props.size ?? 24
4624
- }
4625
- );
4626
- Adapter.displayName = `Tabler.${target}`;
4627
- return Adapter;
4628
- },
4629
- name,
4630
- family
4631
- );
4632
- }
4633
- function resolveFa(name, family) {
4634
- const suffix = faAliases[name] ?? kebabToPascal(name);
4635
- const target = `Fa${suffix}`;
4636
- return lazyFamilyIcon(
4637
- "fa",
4638
- () => import('react-icons/fa'),
4639
- (lib) => {
4640
- const FaComp = lib[target];
4641
- if (!FaComp) return null;
4642
- const Component = FaComp;
4643
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4644
- Component,
4645
- {
4646
- className: props.className,
4647
- style: props.style,
4648
- size: props.size ?? "1em"
4649
- }
4650
- );
4651
- Adapter.displayName = `Fa.${target}`;
4652
- return Adapter;
4653
- },
4654
- name,
4655
- family
4656
- );
4657
- }
4658
- function warnFallback(name, family) {
4659
- const key = `${family}::${name}`;
4660
- if (warned.has(key)) return;
4661
- warned.add(key);
4662
- if (typeof console !== "undefined") {
4663
- console.warn(
4664
- `[iconFamily] No '${name}' mapping in family '${family}'; falling back to lucide. Add an alias in lib/iconFamily.ts.`
4665
- );
4666
- }
4667
- }
4668
- function makeLucideAdapter(name, isFallback = false) {
4549
+ function makeLucideAdapter(name) {
4669
4550
  const LucideComp = resolveLucide(name);
4670
- const Adapter = (props) => {
4671
- const stroke = props.strokeWidth ?? (isFallback ? 2 : void 0);
4672
- const style = isFallback ? { ...props.style ?? {}, strokeWidth: stroke ?? 2 } : props.style;
4673
- return /* @__PURE__ */ jsxRuntime.jsx(
4674
- LucideComp,
4675
- {
4676
- className: props.className,
4677
- strokeWidth: stroke,
4678
- style,
4679
- size: props.size
4680
- }
4681
- );
4682
- };
4683
- Adapter.displayName = `Lucide.${name}${isFallback ? ".fallback" : ""}`;
4551
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
4552
+ LucideComp,
4553
+ {
4554
+ className: props.className,
4555
+ strokeWidth: props.strokeWidth,
4556
+ style: props.style,
4557
+ size: props.size
4558
+ }
4559
+ );
4560
+ Adapter.displayName = `Lucide.${name}`;
4684
4561
  return Adapter;
4685
4562
  }
4686
- function resolveIconForFamily(name, family) {
4687
- switch (family) {
4688
- case "lucide":
4689
- return makeLucideAdapter(name, false);
4690
- // Non-lucide families resolve to a lazy, Suspense-wrapped component that
4691
- // dynamic-imports the library on first render and falls back to lucide
4692
- // internally when the family lacks the icon (see lazyFamilyIcon).
4693
- case "phosphor-outline":
4694
- return resolvePhosphor(name, "regular", family);
4695
- case "phosphor-fill":
4696
- return resolvePhosphor(name, "fill", family);
4697
- case "phosphor-duotone":
4698
- return resolvePhosphor(name, "duotone", family);
4699
- case "tabler":
4700
- return resolveTabler(name, family);
4701
- case "fa-solid":
4702
- return resolveFa(name, family);
4703
- }
4704
- }
4705
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
4563
+ function resolveIconForFamily(name, _family) {
4564
+ return makeLucideAdapter(name);
4565
+ }
4566
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases;
4706
4567
  var init_iconFamily = __esm({
4707
4568
  "lib/iconFamily.tsx"() {
4708
4569
  "use client";
4709
4570
  DEFAULT_FAMILY = "lucide";
4710
- VALID_FAMILIES = [
4711
- "lucide",
4712
- "phosphor-outline",
4713
- "phosphor-fill",
4714
- "phosphor-duotone",
4715
- "tabler",
4716
- "fa-solid"
4717
- ];
4571
+ VALID_FAMILIES = [DEFAULT_FAMILY];
4718
4572
  cachedFamily = null;
4719
4573
  listeners = /* @__PURE__ */ new Set();
4720
4574
  observer = null;
4721
- libPromises = /* @__PURE__ */ new Map();
4722
4575
  lucideAliases = {
4723
4576
  close: LucideIcons2__namespace.X,
4724
4577
  trash: LucideIcons2__namespace.Trash2,
@@ -4731,478 +4584,6 @@ var init_iconFamily = __esm({
4731
4584
  "sort-asc": LucideIcons2__namespace.ArrowUpNarrowWide,
4732
4585
  "sort-desc": LucideIcons2__namespace.ArrowDownNarrowWide
4733
4586
  };
4734
- phosphorAliases = {
4735
- // lucide name → phosphor PascalCase name
4736
- // Actions
4737
- plus: "Plus",
4738
- minus: "Minus",
4739
- x: "X",
4740
- check: "Check",
4741
- close: "X",
4742
- edit: "PencilSimple",
4743
- pencil: "PencilSimple",
4744
- trash: "Trash",
4745
- save: "FloppyDisk",
4746
- copy: "Copy",
4747
- share: "Share",
4748
- send: "PaperPlaneRight",
4749
- download: "DownloadSimple",
4750
- upload: "UploadSimple",
4751
- archive: "Archive",
4752
- refresh: "ArrowsClockwise",
4753
- loader: "CircleNotch",
4754
- link: "Link",
4755
- paperclip: "Paperclip",
4756
- // Navigation
4757
- "chevron-down": "CaretDown",
4758
- "chevron-up": "CaretUp",
4759
- "chevron-left": "CaretLeft",
4760
- "chevron-right": "CaretRight",
4761
- "arrow-up": "ArrowUp",
4762
- "arrow-down": "ArrowDown",
4763
- "arrow-left": "ArrowLeft",
4764
- "arrow-right": "ArrowRight",
4765
- menu: "List",
4766
- more: "DotsThree",
4767
- "more-vertical": "DotsThreeVertical",
4768
- "more-horizontal": "DotsThree",
4769
- external: "ArrowSquareOut",
4770
- "external-link": "ArrowSquareOut",
4771
- // Files
4772
- file: "File",
4773
- "file-text": "FileText",
4774
- "file-plus": "FilePlus",
4775
- "file-minus": "FileMinus",
4776
- folder: "Folder",
4777
- "folder-open": "FolderOpen",
4778
- document: "FileText",
4779
- // Charts
4780
- "bar-chart": "ChartBar",
4781
- "bar-chart-2": "ChartBar",
4782
- "bar-chart-3": "ChartBar",
4783
- "line-chart": "ChartLine",
4784
- "pie-chart": "ChartPie",
4785
- activity: "Pulse",
4786
- "trending-up": "TrendUp",
4787
- "trending-down": "TrendDown",
4788
- // Messages
4789
- message: "ChatCircle",
4790
- "message-circle": "ChatCircle",
4791
- "message-square": "ChatText",
4792
- "messages-square": "ChatsCircle",
4793
- comment: "ChatCircle",
4794
- comments: "ChatsCircle",
4795
- inbox: "Tray",
4796
- mail: "Envelope",
4797
- envelope: "Envelope",
4798
- // Status
4799
- "alert-circle": "WarningCircle",
4800
- "alert-triangle": "Warning",
4801
- "check-circle": "CheckCircle",
4802
- "x-circle": "XCircle",
4803
- info: "Info",
4804
- "help-circle": "Question",
4805
- "life-buoy": "Lifebuoy",
4806
- lifebuoy: "Lifebuoy",
4807
- warning: "Warning",
4808
- error: "WarningCircle",
4809
- // Media
4810
- image: "Image",
4811
- video: "VideoCamera",
4812
- film: "FilmStrip",
4813
- camera: "Camera",
4814
- music: "MusicNote",
4815
- play: "Play",
4816
- pause: "Pause",
4817
- stop: "Stop",
4818
- "skip-forward": "SkipForward",
4819
- "skip-back": "SkipBack",
4820
- volume: "SpeakerHigh",
4821
- "volume-2": "SpeakerHigh",
4822
- "volume-x": "SpeakerX",
4823
- mic: "Microphone",
4824
- "mic-off": "MicrophoneSlash",
4825
- // People
4826
- user: "User",
4827
- users: "Users",
4828
- "user-plus": "UserPlus",
4829
- "user-check": "UserCheck",
4830
- // Time
4831
- calendar: "Calendar",
4832
- clock: "Clock",
4833
- timer: "Timer",
4834
- // Location
4835
- map: "MapTrifold",
4836
- "map-pin": "MapPin",
4837
- navigation: "NavigationArrow",
4838
- compass: "Compass",
4839
- globe: "Globe",
4840
- target: "Target",
4841
- // Project / layout
4842
- kanban: "Kanban",
4843
- list: "List",
4844
- table: "Table",
4845
- grid: "GridFour",
4846
- layout: "Layout",
4847
- columns: "Columns",
4848
- rows: "Rows",
4849
- // Misc
4850
- bell: "Bell",
4851
- bookmark: "Bookmark",
4852
- briefcase: "Briefcase",
4853
- flag: "Flag",
4854
- tag: "Tag",
4855
- tags: "Tag",
4856
- star: "Star",
4857
- heart: "Heart",
4858
- home: "House",
4859
- settings: "Gear",
4860
- eye: "Eye",
4861
- "eye-off": "EyeSlash",
4862
- lock: "Lock",
4863
- unlock: "LockOpen",
4864
- key: "Key",
4865
- shield: "Shield",
4866
- search: "MagnifyingGlass",
4867
- filter: "Funnel",
4868
- "sort-asc": "SortAscending",
4869
- "sort-desc": "SortDescending",
4870
- zap: "Lightning",
4871
- sparkles: "Sparkle",
4872
- // Code
4873
- code: "Code",
4874
- terminal: "Terminal",
4875
- database: "Database",
4876
- server: "HardDrives",
4877
- cloud: "Cloud",
4878
- wifi: "WifiHigh",
4879
- package: "Package",
4880
- box: "Package",
4881
- // Theme
4882
- sun: "Sun",
4883
- moon: "Moon",
4884
- // Phone
4885
- phone: "Phone",
4886
- printer: "Printer",
4887
- // Hierarchy
4888
- tree: "Tree",
4889
- network: "Network"
4890
- };
4891
- tablerAliases = {
4892
- // lucide name → tabler suffix (after the `Icon` prefix)
4893
- // Actions
4894
- plus: "Plus",
4895
- minus: "Minus",
4896
- x: "X",
4897
- check: "Check",
4898
- close: "X",
4899
- edit: "Pencil",
4900
- pencil: "Pencil",
4901
- trash: "Trash",
4902
- save: "DeviceFloppy",
4903
- copy: "Copy",
4904
- share: "Share",
4905
- send: "Send",
4906
- download: "Download",
4907
- upload: "Upload",
4908
- archive: "Archive",
4909
- refresh: "Refresh",
4910
- loader: "Loader2",
4911
- link: "Link",
4912
- paperclip: "Paperclip",
4913
- external: "ExternalLink",
4914
- "external-link": "ExternalLink",
4915
- // Navigation
4916
- "chevron-down": "ChevronDown",
4917
- "chevron-up": "ChevronUp",
4918
- "chevron-left": "ChevronLeft",
4919
- "chevron-right": "ChevronRight",
4920
- "arrow-down": "ArrowDown",
4921
- "arrow-up": "ArrowUp",
4922
- "arrow-left": "ArrowLeft",
4923
- "arrow-right": "ArrowRight",
4924
- menu: "Menu2",
4925
- more: "Dots",
4926
- "more-vertical": "DotsVertical",
4927
- // Files
4928
- file: "File",
4929
- "file-text": "FileText",
4930
- "file-plus": "FilePlus",
4931
- "file-check": "FileCheck",
4932
- "file-minus": "FileMinus",
4933
- folder: "Folder",
4934
- "folder-open": "FolderOpen",
4935
- document: "FileText",
4936
- // Charts
4937
- "bar-chart": "ChartBar",
4938
- "bar-chart-2": "ChartBar",
4939
- "bar-chart-3": "ChartBar",
4940
- "line-chart": "ChartLine",
4941
- "pie-chart": "ChartPie",
4942
- activity: "Activity",
4943
- "trending-up": "TrendingUp",
4944
- "trending-down": "TrendingDown",
4945
- // Messages
4946
- message: "Message",
4947
- "message-circle": "MessageCircle",
4948
- "message-square": "Message2",
4949
- "messages-square": "Messages",
4950
- comment: "Message",
4951
- comments: "Messages",
4952
- inbox: "Inbox",
4953
- mail: "Mail",
4954
- envelope: "Mail",
4955
- // Status
4956
- "alert-circle": "AlertCircle",
4957
- "alert-triangle": "AlertTriangle",
4958
- "check-circle": "CircleCheck",
4959
- "x-circle": "CircleX",
4960
- info: "InfoCircle",
4961
- "help-circle": "HelpCircle",
4962
- "life-buoy": "Lifebuoy",
4963
- warning: "AlertTriangle",
4964
- error: "AlertOctagon",
4965
- // Media
4966
- image: "Photo",
4967
- video: "Video",
4968
- camera: "Camera",
4969
- music: "Music",
4970
- play: "PlayerPlay",
4971
- pause: "PlayerPause",
4972
- stop: "PlayerStop",
4973
- "skip-forward": "PlayerSkipForward",
4974
- "skip-back": "PlayerSkipBack",
4975
- volume: "Volume",
4976
- "volume-2": "Volume",
4977
- "volume-x": "VolumeOff",
4978
- mic: "Microphone",
4979
- "mic-off": "MicrophoneOff",
4980
- // People
4981
- user: "User",
4982
- users: "Users",
4983
- "user-plus": "UserPlus",
4984
- "user-check": "UserCheck",
4985
- // Time
4986
- calendar: "Calendar",
4987
- clock: "Clock",
4988
- timer: "Hourglass",
4989
- // Location
4990
- map: "Map",
4991
- "map-pin": "MapPin",
4992
- navigation: "Navigation",
4993
- compass: "Compass",
4994
- globe: "World",
4995
- target: "Target",
4996
- // Project / layout
4997
- kanban: "LayoutKanban",
4998
- list: "List",
4999
- table: "Table",
5000
- grid: "LayoutGrid",
5001
- layout: "Layout",
5002
- columns: "LayoutColumns",
5003
- rows: "LayoutRows",
5004
- // Misc
5005
- bell: "Bell",
5006
- bookmark: "Bookmark",
5007
- briefcase: "Briefcase",
5008
- flag: "Flag",
5009
- tag: "Tag",
5010
- tags: "Tags",
5011
- star: "Star",
5012
- heart: "Heart",
5013
- home: "Home",
5014
- settings: "Settings",
5015
- eye: "Eye",
5016
- "eye-off": "EyeOff",
5017
- lock: "Lock",
5018
- unlock: "LockOpen",
5019
- key: "Key",
5020
- shield: "Shield",
5021
- search: "Search",
5022
- filter: "Filter",
5023
- "sort-asc": "SortAscending",
5024
- "sort-desc": "SortDescending",
5025
- zap: "Bolt",
5026
- sparkles: "Sparkles",
5027
- // Code / data
5028
- code: "Code",
5029
- terminal: "Terminal",
5030
- database: "Database",
5031
- server: "Server",
5032
- cloud: "Cloud",
5033
- wifi: "Wifi",
5034
- package: "Package",
5035
- box: "Box",
5036
- // Theme
5037
- sun: "Sun",
5038
- moon: "Moon",
5039
- // Phone
5040
- phone: "Phone",
5041
- printer: "Printer",
5042
- // Hierarchy
5043
- tree: "Hierarchy",
5044
- network: "Network"
5045
- };
5046
- faAliases = {
5047
- // lucide name → fa-solid suffix (after the `Fa` prefix).
5048
- // react-icons/fa ships FontAwesome 5 — names like `FaFileText` don't exist
5049
- // (FA renamed to `FaFileAlt`). When you see a console.warn from
5050
- // [iconFamily] about an unmapped lucide name in this family, add the
5051
- // closest FA5 sibling here so the fallback stays in-family.
5052
- search: "Search",
5053
- close: "Times",
5054
- x: "Times",
5055
- loader: "Spinner",
5056
- refresh: "Sync",
5057
- "sort-asc": "SortAmountUp",
5058
- "sort-desc": "SortAmountDown",
5059
- "chevron-down": "ChevronDown",
5060
- "chevron-up": "ChevronUp",
5061
- "chevron-left": "ChevronLeft",
5062
- "chevron-right": "ChevronRight",
5063
- "help-circle": "QuestionCircle",
5064
- "alert-triangle": "ExclamationTriangle",
5065
- "alert-circle": "ExclamationCircle",
5066
- "check-circle": "CheckCircle",
5067
- "x-circle": "TimesCircle",
5068
- edit: "Edit",
5069
- pencil: "PencilAlt",
5070
- trash: "Trash",
5071
- send: "PaperPlane",
5072
- share: "ShareAlt",
5073
- external: "ExternalLinkAlt",
5074
- plus: "Plus",
5075
- minus: "Minus",
5076
- check: "Check",
5077
- star: "Star",
5078
- heart: "Heart",
5079
- home: "Home",
5080
- user: "User",
5081
- users: "Users",
5082
- "user-plus": "UserPlus",
5083
- "user-check": "UserCheck",
5084
- settings: "Cog",
5085
- menu: "Bars",
5086
- "arrow-up": "ArrowUp",
5087
- "arrow-down": "ArrowDown",
5088
- "arrow-left": "ArrowLeft",
5089
- "arrow-right": "ArrowRight",
5090
- copy: "Copy",
5091
- download: "Download",
5092
- upload: "Upload",
5093
- filter: "Filter",
5094
- calendar: "Calendar",
5095
- clock: "Clock",
5096
- bell: "Bell",
5097
- mail: "Envelope",
5098
- envelope: "Envelope",
5099
- lock: "Lock",
5100
- unlock: "LockOpen",
5101
- eye: "Eye",
5102
- "eye-off": "EyeSlash",
5103
- more: "EllipsisH",
5104
- "more-vertical": "EllipsisV",
5105
- info: "InfoCircle",
5106
- warning: "ExclamationTriangle",
5107
- error: "ExclamationCircle",
5108
- // Time
5109
- timer: "Hourglass",
5110
- // Files (FA renamed FileText → FileAlt)
5111
- file: "File",
5112
- "file-text": "FileAlt",
5113
- "file-plus": "FileMedical",
5114
- "file-minus": "FileExcel",
5115
- "file-check": "FileSignature",
5116
- document: "FileAlt",
5117
- // Charts (lucide BarChart2 / BarChart3 → FA ChartBar)
5118
- "bar-chart": "ChartBar",
5119
- "bar-chart-2": "ChartBar",
5120
- "bar-chart-3": "ChartBar",
5121
- "line-chart": "ChartLine",
5122
- "pie-chart": "ChartPie",
5123
- activity: "ChartLine",
5124
- "trending-up": "ChartLine",
5125
- "trending-down": "ChartLine",
5126
- // Messages (lucide MessageCircle/MessageSquare → FA CommentDots/CommentAlt)
5127
- message: "Comment",
5128
- "message-circle": "CommentDots",
5129
- "message-square": "CommentAlt",
5130
- "messages-square": "Comments",
5131
- comment: "Comment",
5132
- comments: "Comments",
5133
- inbox: "Inbox",
5134
- // Support / help
5135
- "life-buoy": "LifeRing",
5136
- lifebuoy: "LifeRing",
5137
- // Project / kanban (FA has no kanban; closest semantic is Tasks/Columns)
5138
- kanban: "Tasks",
5139
- columns: "Columns",
5140
- rows: "Bars",
5141
- layout: "ThLarge",
5142
- grid: "Th",
5143
- list: "List",
5144
- table: "Table",
5145
- // Storage / folders
5146
- folder: "Folder",
5147
- "folder-open": "FolderOpen",
5148
- archive: "Archive",
5149
- bookmark: "Bookmark",
5150
- briefcase: "Briefcase",
5151
- package: "Box",
5152
- box: "Box",
5153
- // Map / location
5154
- map: "Map",
5155
- "map-pin": "MapMarkerAlt",
5156
- navigation: "LocationArrow",
5157
- compass: "Compass",
5158
- globe: "Globe",
5159
- target: "Bullseye",
5160
- // Media
5161
- image: "Image",
5162
- video: "Video",
5163
- film: "Film",
5164
- camera: "Camera",
5165
- music: "Music",
5166
- play: "Play",
5167
- pause: "Pause",
5168
- stop: "Stop",
5169
- "skip-forward": "Forward",
5170
- "skip-back": "Backward",
5171
- volume: "VolumeUp",
5172
- "volume-2": "VolumeUp",
5173
- "volume-x": "VolumeMute",
5174
- mic: "Microphone",
5175
- "mic-off": "MicrophoneSlash",
5176
- phone: "Phone",
5177
- // Code / data
5178
- code: "Code",
5179
- terminal: "Terminal",
5180
- database: "Database",
5181
- server: "Server",
5182
- cloud: "Cloud",
5183
- wifi: "Wifi",
5184
- // Security
5185
- shield: "ShieldAlt",
5186
- key: "Key",
5187
- // Misc actions
5188
- printer: "Print",
5189
- save: "Save",
5190
- link: "Link",
5191
- unlink: "Unlink",
5192
- paperclip: "Paperclip",
5193
- flag: "Flag",
5194
- tag: "Tag",
5195
- tags: "Tags",
5196
- zap: "Bolt",
5197
- sparkles: "Magic",
5198
- // Theme
5199
- sun: "Sun",
5200
- moon: "Moon",
5201
- // Hierarchy (FA has no Tree icon for hierarchies; Sitemap is the org-chart icon)
5202
- tree: "Sitemap",
5203
- network: "NetworkWired"
5204
- };
5205
- warned = /* @__PURE__ */ new Set();
5206
4587
  }
5207
4588
  });
5208
4589
  function kebabToPascal2(name) {
@@ -5283,7 +4664,7 @@ var init_Icon = __esm({
5283
4664
  const family = useIconFamily();
5284
4665
  const RenderedComponent = React90__namespace.default.useMemo(() => {
5285
4666
  if (directIcon) return null;
5286
- return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
4667
+ return effectiveName ? resolveIconForFamily(effectiveName) : null;
5287
4668
  }, [directIcon, effectiveName, family]);
5288
4669
  const effectiveStrokeWidth = strokeWidth ?? void 0;
5289
4670
  const inlineStyle = {
@@ -5662,7 +5043,7 @@ var init_Button = __esm({
5662
5043
  ref,
5663
5044
  disabled: disabled || isLoading,
5664
5045
  className: cn(
5665
- "inline-flex items-center justify-center gap-2",
5046
+ "relative inline-flex items-center justify-center gap-2",
5666
5047
  "font-medium",
5667
5048
  "rounded-sm",
5668
5049
  "cursor-pointer",
@@ -7312,6 +6693,7 @@ var init_Input = __esm({
7312
6693
  icon: iconProp,
7313
6694
  clearable,
7314
6695
  onClear,
6696
+ action,
7315
6697
  value,
7316
6698
  options,
7317
6699
  rows = 3,
@@ -7361,6 +6743,11 @@ var init_Input = __esm({
7361
6743
  onClear?.();
7362
6744
  }
7363
6745
  };
6746
+ const handleKeyDown = (e) => {
6747
+ if (action && e.key === "Enter") {
6748
+ eventBus.emit(`UI:${action}`, { value: e.currentTarget.value });
6749
+ }
6750
+ };
7364
6751
  const wrapField = (field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
7365
6752
  label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "block text-sm font-medium text-foreground mb-1", children: label }),
7366
6753
  field,
@@ -7434,6 +6821,7 @@ var init_Input = __esm({
7434
6821
  type,
7435
6822
  value,
7436
6823
  onChange: handleChange,
6824
+ onKeyDown: handleKeyDown,
7437
6825
  className: baseClassName,
7438
6826
  ...props
7439
6827
  }
@@ -7966,7 +7354,7 @@ var init_Card = __esm({
7966
7354
  });
7967
7355
  function GameIcon({ assetUrl, icon, size = "md", alt, className }) {
7968
7356
  const px = typeof size === "number" ? size : sizeMap[size];
7969
- const family = useIconFamily();
7357
+ useIconFamily();
7970
7358
  if (assetUrl?.url) {
7971
7359
  return /* @__PURE__ */ jsxRuntime.jsx(
7972
7360
  AtlasImage,
@@ -7978,7 +7366,7 @@ function GameIcon({ assetUrl, icon, size = "md", alt, className }) {
7978
7366
  }
7979
7367
  );
7980
7368
  }
7981
- const I = typeof icon === "string" ? resolveIconForFamily(icon, family) : icon;
7369
+ const I = typeof icon === "string" ? resolveIconForFamily(icon) : icon;
7982
7370
  return /* @__PURE__ */ jsxRuntime.jsx(I, { width: px, height: px, className: cn("flex-shrink-0", className) });
7983
7371
  }
7984
7372
  var sizeMap;
@@ -10325,8 +9713,8 @@ function Seigaiha({ size, color, strokeWidth }) {
10325
9713
  [s, s * 0.1]
10326
9714
  ];
10327
9715
  for (const [cx, cy] of centers) {
10328
- for (let ring2 = 1; ring2 <= 3; ring2++) {
10329
- const cr = r2 * (ring2 / 3);
9716
+ for (let ring = 1; ring <= 3; ring++) {
9717
+ const cr = r2 * (ring / 3);
10330
9718
  paths.push(
10331
9719
  `M ${f(cx - cr)},${f(cy)} A ${f(cr)} ${f(cr)} 0 0 1 ${f(cx + cr)},${f(cy)}`
10332
9720
  );
@@ -10423,8 +9811,8 @@ function Arch({ size, color, strokeWidth }) {
10423
9811
  const h = size * 1.5;
10424
9812
  const cx = w / 2;
10425
9813
  const paths = [];
10426
- for (let ring2 = 0; ring2 < 4; ring2++) {
10427
- const scale = 1 - ring2 * 0.2;
9814
+ for (let ring = 0; ring < 4; ring++) {
9815
+ const scale = 1 - ring * 0.2;
10428
9816
  const archW = w * 0.48 * scale;
10429
9817
  const archH = h * 0.7 * scale;
10430
9818
  const baseY = h * 0.85;
@@ -10439,7 +9827,7 @@ function Arch({ size, color, strokeWidth }) {
10439
9827
  paths.push(
10440
9828
  `M ${f(lx)},${f(baseY)} A ${f(radius)} ${f(radius)} 0 0 1 ${f(cx)},${f(tipY)} A ${f(radius)} ${f(radius)} 0 0 1 ${f(rx)},${f(baseY)}`
10441
9829
  );
10442
- if (ring2 === 0) {
9830
+ if (ring === 0) {
10443
9831
  paths.push(`M ${f(lx)},${f(baseY)} L ${f(rx)},${f(baseY)}`);
10444
9832
  }
10445
9833
  }
@@ -12954,9 +12342,9 @@ var init_webPainter2d = __esm({
12954
12342
  // lib/drawable/projector.ts
12955
12343
  function create2DProjector(opts) {
12956
12344
  const { scale, baseOffsetX, layout } = opts;
12957
- const tileWidth = TILE_WIDTH * scale;
12958
- const floorHeight = FLOOR_HEIGHT * scale;
12959
- const diamondTopY = (opts.diamondTopY ?? DIAMOND_TOP_Y) * scale;
12345
+ const tileWidth = layout === "free" ? 1 : TILE_WIDTH * scale;
12346
+ const floorHeight = layout === "free" ? 1 : FLOOR_HEIGHT * scale;
12347
+ const diamondTopY = layout === "free" ? 0 : (opts.diamondTopY ?? DIAMOND_TOP_Y) * scale;
12960
12348
  const squareGrid = layout === "flat" || layout === "free";
12961
12349
  const project = (pos) => layout === "free" ? { x: pos.x, y: pos.y } : isoToScreen(pos.x, pos.y, scale, baseOffsetX, layout);
12962
12350
  const anchorPoint = (pos, anchor) => {
@@ -12997,6 +12385,15 @@ var init_projector = __esm({
12997
12385
  }
12998
12386
  });
12999
12387
 
12388
+ // lib/drawable/contract.ts
12389
+ function isValidScenePos(pos) {
12390
+ return Number.isFinite(pos?.x) && Number.isFinite(pos?.y);
12391
+ }
12392
+ var init_contract = __esm({
12393
+ "lib/drawable/contract.ts"() {
12394
+ }
12395
+ });
12396
+
13000
12397
  // components/game/atoms/DrawSprite.tsx
13001
12398
  function DrawSprite(_props) {
13002
12399
  return null;
@@ -13006,10 +12403,12 @@ var init_DrawSprite = __esm({
13006
12403
  "components/game/atoms/DrawSprite.tsx"() {
13007
12404
  "use client";
13008
12405
  init_atlasSlice();
12406
+ init_contract();
13009
12407
  paintSprite = (painter, node, dctx) => {
12408
+ if (!node.asset?.url || !isValidScenePos(node.position)) return;
13010
12409
  const tex = painter.resolveTexture(node.asset.url);
13011
12410
  if (!tex) return;
13012
- let src = node.frame;
12411
+ let src = typeof node.frame === "object" ? node.frame : void 0;
13013
12412
  if (!src && isAtlasAsset(node.asset)) {
13014
12413
  const atlas = getAtlas(node.asset.atlas, dctx.invalidate);
13015
12414
  if (!atlas) return;
@@ -13054,7 +12453,9 @@ var paintShape;
13054
12453
  var init_DrawShape = __esm({
13055
12454
  "components/game/atoms/DrawShape.tsx"() {
13056
12455
  "use client";
12456
+ init_contract();
13057
12457
  paintShape = (painter, node, dctx) => {
12458
+ if (!isValidScenePos(node.position)) return;
13058
12459
  painter.save();
13059
12460
  if (node.opacity !== void 0 && node.opacity !== 1) painter.setAlpha(node.opacity);
13060
12461
  switch (node.shape) {
@@ -13108,7 +12509,9 @@ var paintText;
13108
12509
  var init_DrawText = __esm({
13109
12510
  "components/game/atoms/DrawText.tsx"() {
13110
12511
  "use client";
12512
+ init_contract();
13111
12513
  paintText = (painter, node, dctx) => {
12514
+ if (!isValidScenePos(node.position)) return;
13112
12515
  const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "center");
13113
12516
  const x = p.x + (node.offsetX ?? 0);
13114
12517
  const y = p.y + (node.offsetY ?? 0);
@@ -13213,12 +12616,14 @@ function collectDrawnItems(nodes) {
13213
12616
  case "draw-sprite":
13214
12617
  case "draw-shape":
13215
12618
  case "draw-text":
13216
- out.push({ pos: n.position, id: n.id });
12619
+ if (isValidScenePos(n.position)) out.push({ pos: n.position, id: n.id });
13217
12620
  break;
13218
12621
  case "draw-sprite-layer":
13219
12622
  case "draw-shape-layer":
13220
12623
  case "draw-text-layer":
13221
- for (const it of n.items) out.push({ pos: it.position, id: it.id });
12624
+ for (const it of n.items) {
12625
+ if (isValidScenePos(it.position)) out.push({ pos: it.position, id: it.id });
12626
+ }
13222
12627
  break;
13223
12628
  }
13224
12629
  }
@@ -13233,6 +12638,7 @@ function buildHitIndex(items) {
13233
12638
  }
13234
12639
  var init_hitTest = __esm({
13235
12640
  "lib/drawable/hitTest.ts"() {
12641
+ init_contract();
13236
12642
  }
13237
12643
  });
13238
12644
  function normalizeBackdrop(bg) {
@@ -15272,21 +14678,6 @@ var init_renderer = __esm({
15272
14678
  init_slot_definitions();
15273
14679
  }
15274
14680
  });
15275
-
15276
- // lib/wrapCallbackForEvent.ts
15277
- function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
15278
- const argNames = (callbackArgs ?? []).map((a) => a.name);
15279
- if (argNames.length === 0) {
15280
- return () => emit(qualifiedEvent);
15281
- }
15282
- return (...args) => {
15283
- const payload = {};
15284
- for (let i = 0; i < argNames.length; i += 1) {
15285
- payload[argNames[i]] = args[i];
15286
- }
15287
- emit(qualifiedEvent, payload);
15288
- };
15289
- }
15290
14681
  var init_wrapCallbackForEvent = __esm({
15291
14682
  "lib/wrapCallbackForEvent.ts"() {
15292
14683
  }
@@ -25481,7 +24872,8 @@ function DataGrid({
25481
24872
  const { t } = hooks.useTranslate();
25482
24873
  const [selectedIds, setSelectedIds] = React90.useState(/* @__PURE__ */ new Set());
25483
24874
  const [visibleCount, setVisibleCount] = React90.useState(pageSize || Infinity);
25484
- const fieldDefs = fields ?? columns ?? [];
24875
+ const fieldDefs = (Array.isArray(fields) ? fields : void 0) ?? (Array.isArray(columns) ? columns : void 0) ?? [];
24876
+ const actionDefs = Array.isArray(itemActions) ? itemActions : [];
25485
24877
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
25486
24878
  const dnd = useDataDnd({
25487
24879
  items: allDataRaw,
@@ -25525,8 +24917,8 @@ function DataGrid({
25525
24917
  const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
25526
24918
  const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
25527
24919
  const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
25528
- const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
25529
- const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
24920
+ const primaryActions = actionDefs.filter((a) => a.variant !== "danger");
24921
+ const dangerActions = actionDefs.filter((a) => a.variant === "danger");
25530
24922
  const handleActionClick = (action, itemData) => (e) => {
25531
24923
  e.stopPropagation();
25532
24924
  const payload = {
@@ -37849,7 +37241,7 @@ function measureLabelWidth(text) {
37849
37241
  if (typeof document === "undefined") return text.length * 6;
37850
37242
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
37851
37243
  if (!labelMeasureCtx) return text.length * 6;
37852
- labelMeasureCtx.font = "10px system-ui";
37244
+ labelMeasureCtx.font = "12px system-ui";
37853
37245
  return labelMeasureCtx.measureText(text).width;
37854
37246
  }
37855
37247
  function getGroupColor(group, groups) {
@@ -37895,6 +37287,7 @@ var init_GraphCanvas = __esm({
37895
37287
  actions,
37896
37288
  onNodeClick,
37897
37289
  onNodeDoubleClick,
37290
+ onBadgeClick,
37898
37291
  nodeClickEvent,
37899
37292
  selectedNodeId,
37900
37293
  repulsion = 800,
@@ -38042,7 +37435,9 @@ var init_GraphCanvas = __esm({
38042
37435
  const dx = target.x - source.x;
38043
37436
  const dy = target.y - source.y;
38044
37437
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
38045
- const force = (dist - linkDistance) * 0.05;
37438
+ const w2 = edge.weight ?? 1;
37439
+ const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
37440
+ const force = (dist - linkTarget) * 0.05;
38046
37441
  const fx = dx / dist * force;
38047
37442
  const fy = dy / dist * force;
38048
37443
  source.fx += fx;
@@ -38064,7 +37459,7 @@ var init_GraphCanvas = __esm({
38064
37459
  node.y = Math.max(30, Math.min(h - 30, node.y));
38065
37460
  }
38066
37461
  const LABEL_GAP = 12;
38067
- const LABEL_H = 12;
37462
+ const LABEL_H = 16;
38068
37463
  const pad = nodeSpacing / 2;
38069
37464
  for (let i = 0; i < nodes.length; i++) {
38070
37465
  for (let j = i + 1; j < nodes.length; j++) {
@@ -38085,13 +37480,13 @@ var init_GraphCanvas = __esm({
38085
37480
  const overlapY = Math.min(aBot, bBot) - Math.max(aTop, bTop);
38086
37481
  if (overlapX > 0 && overlapY > 0) {
38087
37482
  if (overlapX <= overlapY) {
38088
- const push2 = overlapX / 2 * (b.x >= a.x ? 1 : -1);
38089
- a.x = Math.max(30, Math.min(w - 30, a.x - push2));
38090
- b.x = Math.max(30, Math.min(w - 30, b.x + push2));
37483
+ const push = overlapX / 2 * (b.x >= a.x ? 1 : -1);
37484
+ a.x = Math.max(30, Math.min(w - 30, a.x - push));
37485
+ b.x = Math.max(30, Math.min(w - 30, b.x + push));
38091
37486
  } else {
38092
- const push2 = overlapY / 2 * (bTop + bBot >= aTop + aBot ? 1 : -1);
38093
- a.y = Math.max(30, Math.min(h - 30, a.y - push2));
38094
- b.y = Math.max(30, Math.min(h - 30, b.y + push2));
37487
+ const push = overlapY / 2 * (bTop + bBot >= aTop + aBot ? 1 : -1);
37488
+ a.y = Math.max(30, Math.min(h - 30, a.y - push));
37489
+ b.y = Math.max(30, Math.min(h - 30, b.y + push));
38095
37490
  }
38096
37491
  }
38097
37492
  }
@@ -38119,6 +37514,11 @@ var init_GraphCanvas = __esm({
38119
37514
  const h = height;
38120
37515
  const nodes = nodesRef.current;
38121
37516
  const accentColor = resolveColor3("var(--color-accent)", canvas);
37517
+ const fontFamily = resolveColor3("var(--font-family)", canvas) || "system-ui";
37518
+ const fgColor = resolveColor3("var(--color-foreground)", canvas);
37519
+ const mutedColor = resolveColor3("var(--color-muted-foreground)", canvas) || fgColor;
37520
+ const bgColor = resolveColor3("var(--color-background)", canvas) || "#ffffff";
37521
+ const accentFg = resolveColor3("var(--color-accent-foreground)", canvas) || "#ffffff";
38122
37522
  const dpr = typeof window !== "undefined" && window.devicePixelRatio || 1;
38123
37523
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
38124
37524
  ctx.clearRect(0, 0, w, h);
@@ -38138,19 +37538,21 @@ var init_GraphCanvas = __esm({
38138
37538
  const target = nodes.find((n) => n.id === edge.target);
38139
37539
  if (!source || !target) continue;
38140
37540
  const incident = !!hoveredNode && (edge.source === hoveredNode || edge.target === hoveredNode);
38141
- ctx.globalAlpha = hoveredNode ? incident ? 1 : 0.05 : linkOpacity;
37541
+ const w2 = edge.weight ?? 1;
37542
+ ctx.globalAlpha = hoveredNode ? incident ? 1 : 0.05 : linkOpacity * w2;
38142
37543
  ctx.beginPath();
38143
37544
  ctx.moveTo(source.x, source.y);
38144
37545
  ctx.lineTo(target.x, target.y);
38145
37546
  ctx.strokeStyle = incident ? accentColor : edge.color || "#888888";
38146
- ctx.lineWidth = incident ? 2 : edge.weight ? Math.max(1, edge.weight) : 1;
37547
+ ctx.lineWidth = incident ? 2 : Math.max(0.75, w2);
38147
37548
  ctx.stroke();
38148
37549
  if (edge.label && showLabels) {
38149
37550
  const mx = (source.x + target.x) / 2;
38150
37551
  const my = (source.y + target.y) / 2;
38151
- ctx.fillStyle = "#888888";
38152
- ctx.font = "9px system-ui";
37552
+ ctx.fillStyle = mutedColor;
37553
+ ctx.font = `9px ${fontFamily}`;
38153
37554
  ctx.textAlign = "center";
37555
+ ctx.textBaseline = "alphabetic";
38154
37556
  ctx.fillText(edge.label, mx, my - 4);
38155
37557
  }
38156
37558
  }
@@ -38175,10 +37577,33 @@ var init_GraphCanvas = __esm({
38175
37577
  }
38176
37578
  ctx.stroke();
38177
37579
  if (showLabels && node.label) {
38178
- ctx.fillStyle = "#666666";
38179
- ctx.font = `${isSelected || isHovered ? "bold " : ""}10px system-ui`;
37580
+ ctx.font = `${isSelected || isHovered ? "600" : "500"} 12px ${fontFamily}`;
37581
+ ctx.textAlign = "center";
37582
+ ctx.textBaseline = "middle";
37583
+ const ly = node.y + radius + 14;
37584
+ ctx.lineWidth = 3;
37585
+ ctx.lineJoin = "round";
37586
+ ctx.strokeStyle = bgColor;
37587
+ ctx.strokeText(node.label, node.x, ly);
37588
+ ctx.fillStyle = isSelected || isHovered ? fgColor : mutedColor;
37589
+ ctx.fillText(node.label, node.x, ly);
37590
+ }
37591
+ if (node.badge && node.badge > 1) {
37592
+ const bx = node.x + radius * 0.7;
37593
+ const by = node.y - radius * 0.7;
37594
+ const br = Math.max(7, Math.min(11, radius * 0.45));
37595
+ ctx.beginPath();
37596
+ ctx.arc(bx, by, br, 0, Math.PI * 2);
37597
+ ctx.fillStyle = accentColor;
37598
+ ctx.fill();
37599
+ ctx.strokeStyle = bgColor;
37600
+ ctx.lineWidth = 2;
37601
+ ctx.stroke();
37602
+ ctx.fillStyle = accentFg;
37603
+ ctx.font = `600 9px ${fontFamily}`;
38180
37604
  ctx.textAlign = "center";
38181
- ctx.fillText(node.label, node.x, node.y + radius + 12);
37605
+ ctx.textBaseline = "middle";
37606
+ ctx.fillText(String(node.badge), bx, by + 0.5);
38182
37607
  }
38183
37608
  }
38184
37609
  ctx.restore();
@@ -38271,11 +37696,21 @@ var init_GraphCanvas = __esm({
38271
37696
  if (!coords) return;
38272
37697
  const node = nodeAt(coords.graphX, coords.graphY);
38273
37698
  if (node) {
37699
+ if (node.badge && node.badge > 1 && onBadgeClick) {
37700
+ const r2 = (node.size || 8) + (selectedNodeId === node.id ? 4 : 0);
37701
+ const bx = node.x + r2 * 0.7;
37702
+ const by = node.y - r2 * 0.7;
37703
+ const br = Math.max(7, Math.min(11, r2 * 0.45)) + 3;
37704
+ if (Math.hypot(coords.graphX - bx, coords.graphY - by) <= br) {
37705
+ onBadgeClick(node);
37706
+ return;
37707
+ }
37708
+ }
38274
37709
  handleNodeClick(node);
38275
37710
  }
38276
37711
  }
38277
37712
  },
38278
- [toCoords, nodeAt, handleNodeClick]
37713
+ [toCoords, nodeAt, handleNodeClick, onBadgeClick, selectedNodeId]
38279
37714
  );
38280
37715
  const handlePointerLeave = React90.useCallback(() => {
38281
37716
  setHoveredNode(null);
@@ -42796,7 +42231,7 @@ function getAllEvents(traits2) {
42796
42231
  function EventDispatcherTab({ traits: traits2, schema }) {
42797
42232
  const eventBus = useEventBus();
42798
42233
  const { t } = hooks.useTranslate();
42799
- const [log12, setLog] = React90__namespace.useState([]);
42234
+ const [log11, setLog] = React90__namespace.useState([]);
42800
42235
  const prevStatesRef = React90__namespace.useRef(/* @__PURE__ */ new Map());
42801
42236
  React90__namespace.useEffect(() => {
42802
42237
  for (const trait of traits2) {
@@ -42860,9 +42295,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
42860
42295
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.otherEvents") }),
42861
42296
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
42862
42297
  ] }),
42863
- log12.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42298
+ log11.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42864
42299
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.recentTransitions") }),
42865
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log12.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42300
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log11.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42866
42301
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
42867
42302
  " ",
42868
42303
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46264,7 +45699,7 @@ function SlotContentRenderer({
46264
45699
  if (typeof propValue !== "string") continue;
46265
45700
  const propDef = propsSchema[propKey];
46266
45701
  if (!propDef || propDef.kind !== "callback") continue;
46267
- renderedProps[propKey] = wrapCallbackForEvent(
45702
+ renderedProps[propKey] = ui.wrapCallbackForEvent(
46268
45703
  `UI:${propValue}`,
46269
45704
  propDef.callbackArgs,
46270
45705
  (eventKey, payload) => eventBus.emit(eventKey, payload)
@@ -49866,85 +49301,12 @@ function useResolvedSchema(schema, pageName) {
49866
49301
  }, [ir, pageName, loading, error, schema]);
49867
49302
  return result;
49868
49303
  }
49869
-
49870
- // lib/embedded-traits.ts
49871
- var TRAIT_BINDING_PREFIX = "@trait.";
49872
- function collectTraitRefsFromValue(value, into) {
49873
- if (value === null || value === void 0) return;
49874
- if (typeof value === "string") {
49875
- if (value.startsWith(TRAIT_BINDING_PREFIX)) {
49876
- const rest = value.slice(TRAIT_BINDING_PREFIX.length);
49877
- const dot = rest.indexOf(".");
49878
- const traitName = dot === -1 ? rest : rest.slice(0, dot);
49879
- if (traitName.length > 0) into.add(traitName);
49880
- }
49881
- return;
49882
- }
49883
- if (Array.isArray(value)) {
49884
- for (const item of value) collectTraitRefsFromValue(item, into);
49885
- return;
49886
- }
49887
- if (typeof value === "object") {
49888
- for (const v of Object.values(value)) {
49889
- collectTraitRefsFromValue(v, into);
49890
- }
49891
- }
49892
- }
49893
- function collectTraitRefsFromEffects(effects, into) {
49894
- if (!effects) return;
49895
- for (const effect of effects) {
49896
- if (!Array.isArray(effect)) continue;
49897
- if (effect[0] === "render-ui" && effect.length >= 3) {
49898
- collectTraitRefsFromValue(effect[2], into);
49899
- continue;
49900
- }
49901
- for (let i = 1; i < effect.length; i++) {
49902
- const arg = effect[i];
49903
- if (Array.isArray(arg)) collectTraitRefsFromEffects([arg], into);
49904
- else collectTraitRefsFromValue(arg, into);
49905
- }
49906
- }
49907
- }
49908
- function collectTraitRefsFromResolvedTrait(trait) {
49909
- const out = /* @__PURE__ */ new Set();
49910
- for (const transition of trait.transitions ?? []) {
49911
- collectTraitRefsFromEffects(transition.effects, out);
49912
- }
49913
- for (const tick of trait.ticks ?? []) {
49914
- collectTraitRefsFromEffects(tick.effects, out);
49915
- }
49916
- return out;
49917
- }
49918
- function collectEmbeddedTraits(schema) {
49919
- const out = /* @__PURE__ */ new Set();
49920
- if (!schema?.orbitals) return out;
49921
- for (const orbital of schema.orbitals) {
49922
- const traits2 = orbital.traits;
49923
- if (!Array.isArray(traits2)) continue;
49924
- for (const traitRef of traits2) {
49925
- if (!traitRef || typeof traitRef !== "object") continue;
49926
- const resolved = traitRef._resolved;
49927
- const target = resolved && typeof resolved === "object" ? resolved : traitRef;
49928
- if (target.config) {
49929
- collectTraitRefsFromValue(target.config, out);
49930
- }
49931
- const transitions = target.stateMachine?.transitions;
49932
- if (!Array.isArray(transitions)) continue;
49933
- for (const t of transitions) {
49934
- collectTraitRefsFromEffects(t.effects, out);
49935
- }
49936
- collectTraitRefsFromEffects(target.initialEffects, out);
49937
- const ticks2 = target.ticks;
49938
- if (Array.isArray(ticks2)) {
49939
- for (const tick of ticks2) {
49940
- collectTraitRefsFromEffects(tick.effects, out);
49941
- }
49942
- }
49943
- }
49944
- }
49945
- return out;
49946
- }
49947
49304
  var lambdaLog = logger.createLogger("almadar:ui:fn-form-lambda");
49305
+ function isOperatorCall(value) {
49306
+ const first = value[0];
49307
+ if (typeof first !== "string") return false;
49308
+ return registry.isKnownStdOperator(first) || first.includes("/") || first === "lambda" || first === "let";
49309
+ }
49948
49310
  function isFnFormLambda(value) {
49949
49311
  if (!Array.isArray(value)) return false;
49950
49312
  const arr = value;
@@ -49984,7 +49346,14 @@ function resolveLambdaBindings(body, params, item, index) {
49984
49346
  return body;
49985
49347
  }
49986
49348
  if (Array.isArray(body)) {
49987
- return body.map((b) => recur(b));
49349
+ if (isFnFormLambda(body)) return body;
49350
+ const arr = body;
49351
+ const substituted = arr.map((b) => recur(b));
49352
+ if (isOperatorCall(substituted) && core.isSExpr(substituted)) {
49353
+ const evaluated = evaluator.evaluate(substituted, evaluator.createMinimalContext());
49354
+ return core.isEventPayloadValue(evaluated) ? evaluated : String(evaluated);
49355
+ }
49356
+ return substituted;
49988
49357
  }
49989
49358
  if (body !== null && typeof body === "object" && !React90__namespace.default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
49990
49359
  const out = {};
@@ -50077,27 +49446,27 @@ var log7 = logger.createLogger("almadar:ui:shared-entity-store");
50077
49446
  var EMPTY_ENTITY_STATE = {};
50078
49447
  function createSharedEntityStore() {
50079
49448
  const states = /* @__PURE__ */ new Map();
50080
- const subscribers2 = /* @__PURE__ */ new Map();
49449
+ const subscribers = /* @__PURE__ */ new Map();
50081
49450
  const getSnapshot2 = (entityId) => states.get(entityId) ?? EMPTY_ENTITY_STATE;
50082
49451
  const subscribe = (entityId, callback) => {
50083
- let set = subscribers2.get(entityId);
49452
+ let set = subscribers.get(entityId);
50084
49453
  if (!set) {
50085
49454
  set = /* @__PURE__ */ new Set();
50086
- subscribers2.set(entityId, set);
49455
+ subscribers.set(entityId, set);
50087
49456
  }
50088
49457
  set.add(callback);
50089
49458
  return () => {
50090
- const current = subscribers2.get(entityId);
49459
+ const current = subscribers.get(entityId);
50091
49460
  if (!current) return;
50092
49461
  current.delete(callback);
50093
49462
  if (current.size === 0) {
50094
- subscribers2.delete(entityId);
49463
+ subscribers.delete(entityId);
50095
49464
  }
50096
49465
  };
50097
49466
  };
50098
49467
  const commit = (entityId, nextState) => {
50099
49468
  states.set(entityId, nextState);
50100
- const set = subscribers2.get(entityId);
49469
+ const set = subscribers.get(entityId);
50101
49470
  if (!set) return;
50102
49471
  set.forEach((callback) => {
50103
49472
  try {
@@ -50301,8 +49670,8 @@ function getBindingConfig(binding) {
50301
49670
  function evalFieldDefault(value) {
50302
49671
  if (!Array.isArray(value) || value.length === 0) return value;
50303
49672
  const head = value[0];
50304
- const isSExpr = typeof head === "string" && (head.includes("/") || head === "let" || head === "if" || head === "lambda");
50305
- if (!isSExpr) return value;
49673
+ const isSExpr2 = typeof head === "string" && (head.includes("/") || head === "let" || head === "if" || head === "lambda");
49674
+ if (!isSExpr2) return value;
50306
49675
  try {
50307
49676
  return evaluator.evaluate(value, evaluator.createMinimalContext({}, {}, ""));
50308
49677
  } catch {
@@ -50376,7 +49745,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50376
49745
  const traitDefs = traitBindings.map(toTraitDefinition);
50377
49746
  const m = new runtime.StateMachineManager(traitDefs);
50378
49747
  for (const binding of traitBindings) {
50379
- const cfg = getBindingConfig(binding) ?? traitConfigsByName?.[binding.trait.name];
49748
+ const rawCfg = getBindingConfig(binding);
49749
+ const resolvedCfg = traitConfigsByName?.[binding.trait.name];
49750
+ const cfg = rawCfg || resolvedCfg ? { ...rawCfg ?? {}, ...resolvedCfg ?? {} } : void 0;
50380
49751
  if (cfg !== void 0) {
50381
49752
  m.setTraitConfig(binding.trait.name, cfg);
50382
49753
  }
@@ -50554,7 +49925,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50554
49925
  };
50555
49926
  }, [traitBindings]);
50556
49927
  const executeTransitionEffects = React90.useCallback(async (params) => {
50557
- const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log12 } = params;
49928
+ const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log11 } = params;
50558
49929
  const traitName = binding.trait.name;
50559
49930
  const linkedEntity = binding.linkedEntity || "";
50560
49931
  const entityId = payload?.entityId;
@@ -50628,10 +49999,20 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50628
49999
  state: previousState
50629
50000
  };
50630
50001
  const sharedDeclared = runtime.collectDeclaredConfigDefaults(binding.trait);
50631
- const sharedCallSite = getBindingConfig(binding);
50632
- if (sharedDeclared || sharedCallSite) {
50002
+ const sharedResolved = traitConfigsByName?.[traitName];
50003
+ const sharedCallSiteRaw = getBindingConfig(binding);
50004
+ const sharedCallSite = sharedCallSiteRaw ? runtime.resolveCallSitePayloadCaptures(
50005
+ Object.fromEntries(
50006
+ Object.entries(sharedCallSiteRaw).filter(
50007
+ ([, v]) => !(typeof v === "string" && v.startsWith("@config."))
50008
+ )
50009
+ ),
50010
+ payload || {}
50011
+ ) : void 0;
50012
+ if (sharedDeclared || sharedResolved || sharedCallSite) {
50633
50013
  sharedBindings.config = {
50634
50014
  ...sharedDeclared ?? {},
50015
+ ...sharedResolved ?? {},
50635
50016
  ...sharedCallSite ?? {}
50636
50017
  };
50637
50018
  }
@@ -50665,7 +50046,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50665
50046
  ...handlers,
50666
50047
  set: async (targetId, field, value) => {
50667
50048
  if (baseSet) await baseSet(targetId, field, value);
50668
- log12.debug("set:write", {
50049
+ log11.debug("set:write", {
50669
50050
  traitName,
50670
50051
  field,
50671
50052
  value: JSON.stringify(value),
@@ -50679,11 +50060,21 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50679
50060
  state: previousState
50680
50061
  };
50681
50062
  const declaredDefaults = runtime.collectDeclaredConfigDefaults(binding.trait);
50063
+ const resolvedDefaults = traitConfigsByName?.[traitName];
50682
50064
  const callSiteConfig = getBindingConfig(binding);
50683
- if (declaredDefaults || callSiteConfig) {
50065
+ const callSiteOverrides = callSiteConfig ? runtime.resolveCallSitePayloadCaptures(
50066
+ Object.fromEntries(
50067
+ Object.entries(callSiteConfig).filter(
50068
+ ([, v]) => !(typeof v === "string" && v.startsWith("@config."))
50069
+ )
50070
+ ),
50071
+ payload || {}
50072
+ ) : void 0;
50073
+ if (declaredDefaults || resolvedDefaults || callSiteOverrides) {
50684
50074
  bindingCtx.config = {
50685
50075
  ...declaredDefaults ?? {},
50686
- ...callSiteConfig ?? {}
50076
+ ...resolvedDefaults ?? {},
50077
+ ...callSiteOverrides ?? {}
50687
50078
  };
50688
50079
  }
50689
50080
  if (traitName === "Authority" || traitName === "Hero") {
@@ -50732,7 +50123,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50732
50123
  if (sharedKey !== void 0) {
50733
50124
  sharedEntityStore.commit(sharedKey, liveEntity);
50734
50125
  }
50735
- log12.debug("effects:executed", () => ({
50126
+ log11.debug("effects:executed", () => ({
50736
50127
  traitName,
50737
50128
  transition: `${previousState}->${newState}`,
50738
50129
  event: flushEvent,
@@ -50742,7 +50133,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50742
50133
  slotsTouched: Array.from(pendingSlots.keys()).join(",")
50743
50134
  }));
50744
50135
  for (const [slot, patterns] of pendingSlots) {
50745
- log12.debug("flush:slot", {
50136
+ log11.debug("flush:slot", {
50746
50137
  traitName,
50747
50138
  slot,
50748
50139
  patternCount: patterns.length,
@@ -50757,7 +50148,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50757
50148
  });
50758
50149
  }
50759
50150
  } catch (error) {
50760
- log12.error("effects:error", {
50151
+ log11.error("effects:error", {
50761
50152
  traitName,
50762
50153
  transition: `${previousState}->${newState}`,
50763
50154
  event: flushEvent,
@@ -50779,7 +50170,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50779
50170
  payload: {},
50780
50171
  state: currentState
50781
50172
  };
50782
- const bindingCfg = getBindingConfig(binding);
50173
+ const bindingCfg = getBindingConfig(binding) ?? traitConfigsByName?.[traitName];
50783
50174
  if (bindingCfg) {
50784
50175
  guardCtx.config = bindingCfg;
50785
50176
  }
@@ -51142,17 +50533,19 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51142
50533
  }, [traitBindings, eventBus, enqueueAndDrain]);
51143
50534
  React90.useEffect(() => {
51144
50535
  const mgr = managerRef.current;
51145
- const inited = initedTraitsRef.current;
50536
+ const eventsToFire = /* @__PURE__ */ new Set();
51146
50537
  for (const binding of traitBindings) {
51147
50538
  const traitName = binding.trait.name;
51148
- if (inited.has(traitName)) continue;
51149
50539
  const lifecycleEvent = LIFECYCLE_EVENTS.find(
51150
50540
  (evt) => mgr.canHandleEvent(traitName, evt)
51151
50541
  );
51152
- if (lifecycleEvent === void 0) continue;
51153
- inited.add(traitName);
51154
- stateLog.debug("mount:fire-lifecycle", { traitName, event: lifecycleEvent });
51155
- enqueueAndDrain(lifecycleEvent, {});
50542
+ if (lifecycleEvent !== void 0) {
50543
+ eventsToFire.add(lifecycleEvent);
50544
+ }
50545
+ }
50546
+ for (const event of eventsToFire) {
50547
+ stateLog.debug("mount:fire-lifecycle", { event, traitCount: traitBindings.length });
50548
+ enqueueAndDrain(event, {});
51156
50549
  }
51157
50550
  return () => {
51158
50551
  initedTraitsRef.current = /* @__PURE__ */ new Set();
@@ -51166,228 +50559,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51166
50559
  };
51167
50560
  }
51168
50561
 
51169
- // lib/orbitalsByTrait.ts
51170
- function buildOrbitalsByTrait(schema, resolvedPages = []) {
51171
- const map = {};
51172
- if (!schema?.orbitals) return map;
51173
- const pagePathToOrbital = {};
51174
- for (const orb of schema.orbitals) {
51175
- for (const traitRef of orb.traits ?? []) {
51176
- let traitName;
51177
- if (typeof traitRef === "string") {
51178
- const parts = traitRef.split(".");
51179
- traitName = parts[parts.length - 1];
51180
- } else if (typeof traitRef.ref === "string") {
51181
- const parts = traitRef.ref.split(".");
51182
- traitName = traitRef.name ?? parts[parts.length - 1];
51183
- } else if (typeof traitRef.name === "string") {
51184
- traitName = traitRef.name;
51185
- }
51186
- if (traitName) map[traitName] = orb.name;
51187
- }
51188
- for (const pg of orb.pages ?? []) {
51189
- const path = typeof pg === "string" ? pg : pg?.path;
51190
- if (path) pagePathToOrbital[path] = orb.name;
51191
- }
51192
- }
51193
- for (const page of resolvedPages) {
51194
- const orbital = page.path ? pagePathToOrbital[page.path] : void 0;
51195
- if (!orbital) continue;
51196
- for (const traitName of page.traitNames) {
51197
- if (traitName && !(traitName in map)) map[traitName] = orbital;
51198
- }
51199
- }
51200
- return map;
51201
- }
51202
-
51203
50562
  // runtime/OrbPreview.tsx
51204
50563
  init_verificationRegistry();
51205
- var PERF_NAMESPACE = "almadar:perf:canvas";
51206
- var log9 = logger.createLogger(PERF_NAMESPACE);
51207
- var RING_SIZE = 50;
51208
- var ring = [];
51209
- var writeIdx = 0;
51210
- var subscribers = /* @__PURE__ */ new Set();
51211
- var notifyScheduled = false;
51212
- function scheduleNotify() {
51213
- if (notifyScheduled) return;
51214
- notifyScheduled = true;
51215
- queueMicrotask(() => {
51216
- notifyScheduled = false;
51217
- for (const fn of subscribers) fn();
51218
- });
51219
- }
51220
- function push(entry) {
51221
- if (ring.length < RING_SIZE) {
51222
- ring.push(entry);
51223
- } else {
51224
- ring[writeIdx] = entry;
51225
- }
51226
- writeIdx = (writeIdx + 1) % RING_SIZE;
51227
- scheduleNotify();
51228
- }
51229
- function isEnabled() {
51230
- return logger.isLogLevelEnabled("DEBUG", PERF_NAMESPACE);
51231
- }
51232
- function now() {
51233
- return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
51234
- }
51235
- function perfStart(name) {
51236
- if (!isEnabled()) return -1;
51237
- if (typeof performance !== "undefined" && typeof performance.mark === "function") {
51238
- try {
51239
- performance.mark(`${name}-start`);
51240
- } catch {
51241
- }
51242
- }
51243
- return now();
51244
- }
51245
- function perfEnd(name, startToken, detail) {
51246
- if (startToken < 0 || !isEnabled()) return;
51247
- const endTs = now();
51248
- const durationMs = endTs - startToken;
51249
- if (typeof performance !== "undefined" && typeof performance.measure === "function") {
51250
- try {
51251
- performance.mark(`${name}-end`);
51252
- performance.measure(name, `${name}-start`, `${name}-end`);
51253
- } catch {
51254
- }
51255
- }
51256
- push({ name, durationMs, ts: endTs, detail });
51257
- log9.debug(name, () => ({ durationMs, ...detail ?? {} }));
51258
- }
51259
- var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
51260
- if (!isEnabled()) return;
51261
- push({
51262
- name: `profiler:${id}:${phase}`,
51263
- durationMs: actualDuration,
51264
- ts: commitTime,
51265
- detail: { baseDuration }
51266
- });
51267
- log9.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
51268
- };
51269
-
51270
- // lib/prepareSchemaForPreview.ts
51271
- function generateEntityRow(entity, idx) {
51272
- const row = { id: String(idx) };
51273
- for (const f3 of entity.fields) {
51274
- if (f3.name === void 0 || f3.name === "id") continue;
51275
- row[f3.name] = generateFieldValue(entity.name, f3, idx);
51276
- }
51277
- return row;
51278
- }
51279
- function generateFieldValue(entityName, field, idx) {
51280
- if ("values" in field && field.values && field.values.length > 0) {
51281
- return field.values[(idx - 1) % field.values.length];
51282
- }
51283
- const fieldName = field.name ?? "";
51284
- switch (field.type) {
51285
- case "string":
51286
- return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
51287
- case "number":
51288
- return idx * 10;
51289
- case "boolean":
51290
- return idx % 2 === 0;
51291
- default:
51292
- return field.default ?? null;
51293
- }
51294
- }
51295
- function buildMockData(schema) {
51296
- const t = perfStart("build-mock-data");
51297
- const result = {};
51298
- for (const orbital of schema.orbitals) {
51299
- const entity = orbital.entity;
51300
- if (!entity || typeof entity === "string") continue;
51301
- if (core.isEntityCall(entity)) continue;
51302
- const entityName = entity.name;
51303
- if (!entityName) continue;
51304
- if (entity.instances && entity.instances.length > 0) {
51305
- result[entityName] = entity.instances;
51306
- continue;
51307
- }
51308
- const rows = Array.from(
51309
- { length: 10 },
51310
- (_, i) => generateEntityRow(entity, i + 1)
51311
- );
51312
- result[entityName] = rows;
51313
- }
51314
- for (const orbital of schema.orbitals) {
51315
- for (const traitRef of orbital.traits ?? []) {
51316
- if (!isInlineTrait3(traitRef)) continue;
51317
- const trait = traitRef;
51318
- const sourceEntity = trait.sourceEntityDefinition;
51319
- if (!sourceEntity || core.isEntityCall(sourceEntity)) continue;
51320
- const sourceName = sourceEntity.name;
51321
- if (!sourceName) continue;
51322
- if (!result[sourceName]) {
51323
- result[sourceName] = sourceEntity.instances && sourceEntity.instances.length > 0 ? sourceEntity.instances : Array.from(
51324
- { length: 10 },
51325
- (_, i) => generateEntityRow(sourceEntity, i + 1)
51326
- );
51327
- }
51328
- const reboundName = trait.linkedEntity;
51329
- if (!reboundName || reboundName === sourceName) continue;
51330
- const reboundRows = result[reboundName];
51331
- if (!reboundRows || reboundRows.length === 0) continue;
51332
- reboundRows.forEach((row, i) => {
51333
- for (const f3 of sourceEntity.fields) {
51334
- if (f3.name === void 0 || f3.name === "id") continue;
51335
- if (row[f3.name] !== void 0) continue;
51336
- row[f3.name] = generateFieldValue(sourceName, f3, i + 1);
51337
- }
51338
- });
51339
- }
51340
- }
51341
- perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
51342
- return result;
51343
- }
51344
- function isInlineTrait3(traitRef) {
51345
- return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
51346
- }
51347
- function findDataState(sm, initialStateName) {
51348
- return sm.states.find((s) => {
51349
- if (s.name === initialStateName) return false;
51350
- return sm.transitions.some(
51351
- (t) => t.event === "INIT" && (t.from === s.name || Array.isArray(t.from) && t.from.includes(s.name))
51352
- );
51353
- });
51354
- }
51355
- function rewriteTraitInitialState(trait, mockData) {
51356
- const sm = trait.stateMachine;
51357
- if (!sm) return trait;
51358
- const linkedEntity = trait.linkedEntity;
51359
- if (!linkedEntity || !mockData[linkedEntity]?.length) return trait;
51360
- const initialStateName = sm.states.find((s) => s.isInitial)?.name ?? sm.states[0]?.name;
51361
- if (!initialStateName) return trait;
51362
- const dataState = findDataState(sm, initialStateName);
51363
- if (!dataState) return trait;
51364
- const updatedStates = sm.states.map((s) => {
51365
- if (s.name === initialStateName) return { ...s, isInitial: false };
51366
- if (s.name === dataState.name) return { ...s, isInitial: true };
51367
- return s;
51368
- });
51369
- return { ...trait, stateMachine: { ...sm, states: updatedStates } };
51370
- }
51371
- function adjustSchemaForMockData(schema, mockData) {
51372
- let changed = false;
51373
- const updatedOrbitals = schema.orbitals.map((orbital) => {
51374
- const traits2 = orbital.traits ?? [];
51375
- const updatedTraits = traits2.map((traitRef) => {
51376
- if (!isInlineTrait3(traitRef)) return traitRef;
51377
- const updated = rewriteTraitInitialState(traitRef, mockData);
51378
- if (updated !== traitRef) changed = true;
51379
- return updated;
51380
- });
51381
- return changed ? { ...orbital, traits: updatedTraits } : orbital;
51382
- });
51383
- return changed ? { ...schema, orbitals: updatedOrbitals } : schema;
51384
- }
51385
- function prepareSchemaForPreview(input) {
51386
- const parsed = typeof input === "string" ? JSON.parse(input) : input;
51387
- const mockData = buildMockData(parsed);
51388
- const schema = adjustSchemaForMockData(parsed, mockData);
51389
- return { schema, mockData };
51390
- }
51391
50564
  var xOrbitalLog = logger.createLogger("almadar:runtime:cross-orbital");
51392
50565
  var navLog = logger.createLogger("almadar:runtime:navigation");
51393
50566
  function normalizeChild(child) {
@@ -51554,7 +50727,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51554
50727
  while (queue.length > 0) {
51555
50728
  const binding = queue.shift();
51556
50729
  if (!binding) continue;
51557
- for (const refName of collectTraitRefsFromResolvedTrait(binding.trait)) {
50730
+ for (const refName of ui.collectTraitRefsFromResolvedTrait(binding.trait)) {
51558
50731
  if (byName.has(refName)) continue;
51559
50732
  const rt = allTraits.get(refName);
51560
50733
  if (!rt) continue;
@@ -51572,7 +50745,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51572
50745
  return orbitals.map((o) => o.name);
51573
50746
  }, [schema]);
51574
50747
  const orbitalsByTrait = React90.useMemo(
51575
- () => buildOrbitalsByTrait(
50748
+ () => ui.buildOrbitalsByTrait(
51576
50749
  schema,
51577
50750
  ir ? Array.from(ir.pages.values()).map((p) => ({
51578
50751
  path: p.path,
@@ -51621,26 +50794,12 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51621
50794
  pageOrbitalNames: pageOrbitalNames.join(",")
51622
50795
  });
51623
50796
  }, [pageName, allPageTraits, orbitalsByTrait, pageOrbitalNames]);
51624
- const traitConfigsByName = React90.useMemo(() => {
51625
- const map = {};
51626
- const orbitals = schema?.orbitals;
51627
- if (!orbitals) return map;
51628
- for (const orb of orbitals) {
51629
- const traitRefs = orb.traits;
51630
- if (!traitRefs) continue;
51631
- for (const t of traitRefs) {
51632
- if (typeof t === "string") continue;
51633
- const name = t.name ?? t.ref;
51634
- const config = t.config;
51635
- if (typeof name === "string" && config !== void 0) {
51636
- map[name] = config;
51637
- }
51638
- }
51639
- }
51640
- return map;
51641
- }, [schema]);
50797
+ const traitConfigsByName = React90.useMemo(
50798
+ () => core.buildResolvedTraitConfigs(schema),
50799
+ [schema]
50800
+ );
51642
50801
  const embeddedTraits = React90.useMemo(() => {
51643
- const set = collectEmbeddedTraits(schema);
50802
+ const set = ui.collectEmbeddedTraits(schema);
51644
50803
  xOrbitalLog.info("SchemaRunner:embeddedTraits", {
51645
50804
  pageName,
51646
50805
  embedded: Array.from(set),
@@ -51725,7 +50884,7 @@ function OrbPreview({
51725
50884
  parsed = schema;
51726
50885
  }
51727
50886
  if (autoMock && !serverUrl && !transport) {
51728
- const prepared = prepareSchemaForPreview(parsed);
50887
+ const prepared = ui.prepareSchemaForPreview(parsed);
51729
50888
  return { ok: true, schema: prepared.schema, mockData: prepared.mockData };
51730
50889
  }
51731
50890
  return { ok: true, schema: parsed, mockData: mockData ?? {} };
@@ -51907,7 +51066,7 @@ init_useEventBus();
51907
51066
  // components/avl/hooks/useCanvasDnd.tsx
51908
51067
  init_useEventBus();
51909
51068
  init_useAlmadarDndCollision();
51910
- var log10 = logger.createLogger("almadar:ui:canvas-dnd");
51069
+ var log9 = logger.createLogger("almadar:ui:canvas-dnd");
51911
51070
  function useCanvasDraggable({
51912
51071
  id,
51913
51072
  payload,
@@ -51946,7 +51105,7 @@ function defaultEmit(eventBus, drop) {
51946
51105
  if (payload.kind === "pattern") {
51947
51106
  const patternType = payload.data["type"];
51948
51107
  if (typeof patternType !== "string") {
51949
- log10.warn("default-emit:pattern:missing-type");
51108
+ log9.warn("default-emit:pattern:missing-type");
51950
51109
  return;
51951
51110
  }
51952
51111
  const out = { patternType, containerNode: target.containerNode };
@@ -51955,23 +51114,23 @@ function defaultEmit(eventBus, drop) {
51955
51114
  out.index = resolved.index;
51956
51115
  }
51957
51116
  eventBus.emit("UI:PATTERN_DROP", out);
51958
- log10.info("default-emit:pattern", { patternType, level: target.level });
51117
+ log9.info("default-emit:pattern", { patternType, level: target.level });
51959
51118
  return;
51960
51119
  }
51961
51120
  if (payload.kind === "behavior") {
51962
51121
  const behaviorName = payload.data["name"];
51963
51122
  if (typeof behaviorName !== "string") {
51964
- log10.warn("default-emit:behavior:missing-name");
51123
+ log9.warn("default-emit:behavior:missing-name");
51965
51124
  return;
51966
51125
  }
51967
51126
  eventBus.emit("UI:BEHAVIOR_DROP", {
51968
51127
  behaviorName,
51969
51128
  containerNode: target.containerNode
51970
51129
  });
51971
- log10.info("default-emit:behavior", { behaviorName, level: target.level });
51130
+ log9.info("default-emit:behavior", { behaviorName, level: target.level });
51972
51131
  return;
51973
51132
  }
51974
- log10.debug("default-emit:unhandled-kind", { kind: payload.kind });
51133
+ log9.debug("default-emit:unhandled-kind", { kind: payload.kind });
51975
51134
  }
51976
51135
  function CanvasDndProvider({
51977
51136
  children,
@@ -51987,9 +51146,9 @@ function CanvasDndProvider({
51987
51146
  if (payload) {
51988
51147
  setActivePayload(payload);
51989
51148
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
51990
- log10.info("dragStart", { id: e.active.id, kind: payload.kind });
51149
+ log9.info("dragStart", { id: e.active.id, kind: payload.kind });
51991
51150
  } else {
51992
- log10.warn("dragStart:missing-payload", { id: e.active.id });
51151
+ log9.warn("dragStart:missing-payload", { id: e.active.id });
51993
51152
  }
51994
51153
  }, [eventBus]);
51995
51154
  const handleDragEnd = React90__namespace.default.useCallback((e) => {
@@ -51999,7 +51158,7 @@ function CanvasDndProvider({
51999
51158
  const overData = e.over?.data.current;
52000
51159
  const target = overData?.target;
52001
51160
  const accepts = overData?.accepts;
52002
- log10.info("dragEnd", {
51161
+ log9.info("dragEnd", {
52003
51162
  activeId: e.active.id,
52004
51163
  overId: e.over?.id,
52005
51164
  hasPayload: !!payload,
@@ -52011,7 +51170,7 @@ function CanvasDndProvider({
52011
51170
  }
52012
51171
  if (!payload || !target) return;
52013
51172
  if (accepts && !accepts.includes(payload.kind)) {
52014
- log10.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
51173
+ log9.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
52015
51174
  return;
52016
51175
  }
52017
51176
  const activator = e.activatorEvent;
@@ -52023,7 +51182,7 @@ function CanvasDndProvider({
52023
51182
  }, [eventBus, onDrop]);
52024
51183
  const handleDragCancel = React90__namespace.default.useCallback(() => {
52025
51184
  setActivePayload(null);
52026
- log10.info("dragCancel");
51185
+ log9.info("dragCancel");
52027
51186
  }, []);
52028
51187
  return /* @__PURE__ */ jsxRuntime.jsxs(
52029
51188
  core$1.DndContext,
@@ -53856,7 +53015,7 @@ init_AvlTransitionLane();
53856
53015
  init_AvlSwimLane();
53857
53016
  init_avl_atom_types();
53858
53017
  init_avl_elk_layout();
53859
- var log11 = logger.createLogger("almadar:ui:avl:trait-scene");
53018
+ var log10 = logger.createLogger("almadar:ui:avl:trait-scene");
53860
53019
  var SWIM_GUTTER2 = 120;
53861
53020
  var CENTER_W2 = 360;
53862
53021
  var AvlTraitScene = ({
@@ -53869,7 +53028,7 @@ var AvlTraitScene = ({
53869
53028
  const dataKey = React90.useMemo(() => JSON.stringify(data), [data]);
53870
53029
  React90.useEffect(() => {
53871
53030
  computeTraitLayout(data).then(setLayout).catch((error) => {
53872
- log11.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
53031
+ log10.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
53873
53032
  });
53874
53033
  }, [dataKey]);
53875
53034
  if (!layout) {
@@ -54062,6 +53221,14 @@ TraitCardNode.displayName = "TraitCardNode";
54062
53221
 
54063
53222
  // components/avl/organisms/FlowCanvas.tsx
54064
53223
  init_useEventBus();
53224
+ var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
53225
+ ui.pushPerfEntry({
53226
+ name: `profiler:${id}:${phase}`,
53227
+ durationMs: actualDuration,
53228
+ ts: commitTime,
53229
+ detail: { baseDuration }
53230
+ });
53231
+ };
54065
53232
  var flowCanvasLog = logger.createLogger("almadar:ui:flow-canvas");
54066
53233
  var NODE_TYPES = {
54067
53234
  preview: OrbPreviewNode,
@@ -54158,13 +53325,13 @@ function FlowCanvasInner({
54158
53325
  }), [selectedPattern]);
54159
53326
  const [atBehaviorLevel, setAtBehaviorLevel] = React90.useState(composeLevel === "behavior");
54160
53327
  const { composeNodes, composeEdges, overviewNodes, overviewEdges, expandedNodes, expandedEdges, behaviorExpandedNodes, behaviorExpandedEdges, traitExpandedNodes, traitExpandedEdges } = React90.useMemo(() => {
54161
- const t2 = perfStart("compose-graph");
53328
+ const t2 = ui.perfStart("compose-graph");
54162
53329
  const compose = composeLevel === "behavior" && behaviorEntries?.length ? behaviorsToComposeGraph(behaviorEntries, behaviorWires ?? [], layoutHint) : { nodes: [], edges: [] };
54163
53330
  const overview = schemaToOverviewGraph(parsedSchema, mockData, behaviorMeta, layoutHint, orbitalStatus, screenSize);
54164
53331
  const expanded = expandedOrbital ? orbitalToExpandedGraph(parsedSchema, expandedOrbital, mockData, screenSize) : { nodes: [], edges: [] };
54165
53332
  const behaviorExpanded = expandedOrbital && expandedBehaviorAlias ? orbitalAliasToExpandedGraph(parsedSchema, expandedOrbital, expandedBehaviorAlias, mockData, screenSize) : { nodes: [], edges: [] };
54166
53333
  const traitExpanded = expandedOrbital ? orbitalToTraitGraph(parsedSchema, expandedOrbital) : { nodes: [], edges: [] };
54167
- perfEnd("compose-graph", t2, {
53334
+ ui.perfEnd("compose-graph", t2, {
54168
53335
  composeNodes: compose.nodes.length,
54169
53336
  overviewNodes: overview.nodes.length,
54170
53337
  expandedNodes: expanded.nodes.length,