@almadar/ui 5.112.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) {
@@ -13258,14 +12664,16 @@ function Canvas2D({
13258
12664
  cameraPos,
13259
12665
  bgColor
13260
12666
  }) {
12667
+ const instanceId = React90.useMemo(() => Math.random().toString(36).slice(2, 8), []);
12668
+ function isDrawableLayer(node) {
12669
+ return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
12670
+ }
13261
12671
  const layerSummaries = drawables?.map((d) => {
13262
- if (!d || typeof d !== "object") return d;
13263
- const rec = d;
13264
- return { type: rec.type, itemsLen: Array.isArray(rec.items) ? rec.items.length : void 0, firstItem: Array.isArray(rec.items) ? rec.items[0] : void 0 };
12672
+ if (!isDrawableLayer(d)) return { type: d.type };
12673
+ return { type: d.type, itemsLen: d.items.length, firstItem: d.items[0] };
13265
12674
  });
13266
- console.error("[debug:Canvas2D] " + JSON.stringify({ projection, scale, cameraMode: camera, cameraPos, drawablesCount: drawables?.length, layerSummaries }));
12675
+ canvas2DLog.debug("Canvas2D render", { instanceId, projection, scale, cameraMode: camera, cameraPos: cameraPos ? JSON.stringify(cameraPos) : void 0, drawablesCount: drawables?.length, layerSummaries: layerSummaries ? JSON.stringify(layerSummaries) : void 0 });
13267
12676
  const backgroundImage = normalizeBackdrop(backgroundImageRaw);
13268
- const instanceId = React90.useMemo(() => Math.random().toString(36).slice(2, 8), []);
13269
12677
  const isFree = projection === "free";
13270
12678
  const squareGrid = projection === "flat" || isFree || projection === "side";
13271
12679
  const layout = projection === "side" ? "free" : projection;
@@ -13400,7 +12808,7 @@ function Canvas2D({
13400
12808
  }
13401
12809
  const containerRect = containerRef.current?.getBoundingClientRect();
13402
12810
  const canvasRect = canvas.getBoundingClientRect();
13403
- console.error("[debug:Canvas2D:draw:" + instanceId + "] " + JSON.stringify({ viewportSize, baseOffsetX, cam: { x: cam.x, y: cam.y, zoom: cam.zoom }, cameraPos, containerRect: containerRect ? { width: containerRect.width, height: containerRect.height } : null, canvasRect: canvasRect ? { width: canvasRect.width, height: canvasRect.height } : null }));
12811
+ canvas2DLog.debug("Canvas2D draw", { instanceId, viewportSize, baseOffsetX, cam: { x: cam.x, y: cam.y, zoom: cam.zoom }, cameraPos: cameraPos ? JSON.stringify(cameraPos) : void 0, containerRect: containerRect ? { width: containerRect.width, height: containerRect.height } : null, canvasRect: canvasRect ? { width: canvasRect.width, height: canvasRect.height } : null });
13404
12812
  const painter = createWebPainter(ctx, bumpAtlas);
13405
12813
  painter.save();
13406
12814
  painter.translate(viewportSize.width / 2, viewportSize.height / 2);
@@ -13612,6 +13020,7 @@ function Canvas2D({
13612
13020
  }
13613
13021
  );
13614
13022
  }
13023
+ var canvas2DLog;
13615
13024
  var init_Canvas2D = __esm({
13616
13025
  "components/game/molecules/Canvas2D.tsx"() {
13617
13026
  "use client";
@@ -13633,6 +13042,7 @@ var init_Canvas2D = __esm({
13633
13042
  init_paintDispatch();
13634
13043
  init_hitTest();
13635
13044
  init_isometric();
13045
+ canvas2DLog = logger.createLogger("almadar:ui:game-canvas");
13636
13046
  Canvas2D.displayName = "Canvas2D";
13637
13047
  }
13638
13048
  });
@@ -13671,7 +13081,7 @@ function Canvas({
13671
13081
  keyMap,
13672
13082
  keyUpMap
13673
13083
  }) {
13674
- console.error("[debug:Canvas] " + JSON.stringify({ mode, drawablesCount: drawables?.length, projection, camera }));
13084
+ canvasLog.debug("Canvas render", { mode, drawablesCount: drawables?.length, projection, camera: camera ? JSON.stringify(camera) : void 0 });
13675
13085
  const zoom = camera?.zoom;
13676
13086
  if (mode === "3d") {
13677
13087
  const props3d = {
@@ -13724,7 +13134,7 @@ function Canvas({
13724
13134
  }
13725
13135
  );
13726
13136
  }
13727
- var Canvas3DHost;
13137
+ var Canvas3DHost, canvasLog;
13728
13138
  var init_Canvas = __esm({
13729
13139
  "components/game/molecules/Canvas.tsx"() {
13730
13140
  "use client";
@@ -13732,6 +13142,7 @@ var init_Canvas = __esm({
13732
13142
  Canvas3DHost = React90.lazy(
13733
13143
  () => import('@almadar/ui/components/molecules/game/three').then((m) => ({ default: m.Canvas3DHost }))
13734
13144
  );
13145
+ canvasLog = logger.createLogger("almadar:ui:game-canvas");
13735
13146
  Canvas.displayName = "Canvas";
13736
13147
  }
13737
13148
  });
@@ -15267,21 +14678,6 @@ var init_renderer = __esm({
15267
14678
  init_slot_definitions();
15268
14679
  }
15269
14680
  });
15270
-
15271
- // lib/wrapCallbackForEvent.ts
15272
- function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
15273
- const argNames = (callbackArgs ?? []).map((a) => a.name);
15274
- if (argNames.length === 0) {
15275
- return () => emit(qualifiedEvent);
15276
- }
15277
- return (...args) => {
15278
- const payload = {};
15279
- for (let i = 0; i < argNames.length; i += 1) {
15280
- payload[argNames[i]] = args[i];
15281
- }
15282
- emit(qualifiedEvent, payload);
15283
- };
15284
- }
15285
14681
  var init_wrapCallbackForEvent = __esm({
15286
14682
  "lib/wrapCallbackForEvent.ts"() {
15287
14683
  }
@@ -25476,7 +24872,8 @@ function DataGrid({
25476
24872
  const { t } = hooks.useTranslate();
25477
24873
  const [selectedIds, setSelectedIds] = React90.useState(/* @__PURE__ */ new Set());
25478
24874
  const [visibleCount, setVisibleCount] = React90.useState(pageSize || Infinity);
25479
- 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 : [];
25480
24877
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
25481
24878
  const dnd = useDataDnd({
25482
24879
  items: allDataRaw,
@@ -25520,8 +24917,8 @@ function DataGrid({
25520
24917
  const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
25521
24918
  const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
25522
24919
  const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
25523
- const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
25524
- 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");
25525
24922
  const handleActionClick = (action, itemData) => (e) => {
25526
24923
  e.stopPropagation();
25527
24924
  const payload = {
@@ -37844,7 +37241,7 @@ function measureLabelWidth(text) {
37844
37241
  if (typeof document === "undefined") return text.length * 6;
37845
37242
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
37846
37243
  if (!labelMeasureCtx) return text.length * 6;
37847
- labelMeasureCtx.font = "10px system-ui";
37244
+ labelMeasureCtx.font = "12px system-ui";
37848
37245
  return labelMeasureCtx.measureText(text).width;
37849
37246
  }
37850
37247
  function getGroupColor(group, groups) {
@@ -37890,6 +37287,7 @@ var init_GraphCanvas = __esm({
37890
37287
  actions,
37891
37288
  onNodeClick,
37892
37289
  onNodeDoubleClick,
37290
+ onBadgeClick,
37893
37291
  nodeClickEvent,
37894
37292
  selectedNodeId,
37895
37293
  repulsion = 800,
@@ -38037,7 +37435,9 @@ var init_GraphCanvas = __esm({
38037
37435
  const dx = target.x - source.x;
38038
37436
  const dy = target.y - source.y;
38039
37437
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
38040
- 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;
38041
37441
  const fx = dx / dist * force;
38042
37442
  const fy = dy / dist * force;
38043
37443
  source.fx += fx;
@@ -38059,7 +37459,7 @@ var init_GraphCanvas = __esm({
38059
37459
  node.y = Math.max(30, Math.min(h - 30, node.y));
38060
37460
  }
38061
37461
  const LABEL_GAP = 12;
38062
- const LABEL_H = 12;
37462
+ const LABEL_H = 16;
38063
37463
  const pad = nodeSpacing / 2;
38064
37464
  for (let i = 0; i < nodes.length; i++) {
38065
37465
  for (let j = i + 1; j < nodes.length; j++) {
@@ -38080,13 +37480,13 @@ var init_GraphCanvas = __esm({
38080
37480
  const overlapY = Math.min(aBot, bBot) - Math.max(aTop, bTop);
38081
37481
  if (overlapX > 0 && overlapY > 0) {
38082
37482
  if (overlapX <= overlapY) {
38083
- const push2 = overlapX / 2 * (b.x >= a.x ? 1 : -1);
38084
- a.x = Math.max(30, Math.min(w - 30, a.x - push2));
38085
- 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));
38086
37486
  } else {
38087
- const push2 = overlapY / 2 * (bTop + bBot >= aTop + aBot ? 1 : -1);
38088
- a.y = Math.max(30, Math.min(h - 30, a.y - push2));
38089
- 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));
38090
37490
  }
38091
37491
  }
38092
37492
  }
@@ -38114,6 +37514,11 @@ var init_GraphCanvas = __esm({
38114
37514
  const h = height;
38115
37515
  const nodes = nodesRef.current;
38116
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";
38117
37522
  const dpr = typeof window !== "undefined" && window.devicePixelRatio || 1;
38118
37523
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
38119
37524
  ctx.clearRect(0, 0, w, h);
@@ -38133,19 +37538,21 @@ var init_GraphCanvas = __esm({
38133
37538
  const target = nodes.find((n) => n.id === edge.target);
38134
37539
  if (!source || !target) continue;
38135
37540
  const incident = !!hoveredNode && (edge.source === hoveredNode || edge.target === hoveredNode);
38136
- ctx.globalAlpha = hoveredNode ? incident ? 1 : 0.05 : linkOpacity;
37541
+ const w2 = edge.weight ?? 1;
37542
+ ctx.globalAlpha = hoveredNode ? incident ? 1 : 0.05 : linkOpacity * w2;
38137
37543
  ctx.beginPath();
38138
37544
  ctx.moveTo(source.x, source.y);
38139
37545
  ctx.lineTo(target.x, target.y);
38140
37546
  ctx.strokeStyle = incident ? accentColor : edge.color || "#888888";
38141
- ctx.lineWidth = incident ? 2 : edge.weight ? Math.max(1, edge.weight) : 1;
37547
+ ctx.lineWidth = incident ? 2 : Math.max(0.75, w2);
38142
37548
  ctx.stroke();
38143
37549
  if (edge.label && showLabels) {
38144
37550
  const mx = (source.x + target.x) / 2;
38145
37551
  const my = (source.y + target.y) / 2;
38146
- ctx.fillStyle = "#888888";
38147
- ctx.font = "9px system-ui";
37552
+ ctx.fillStyle = mutedColor;
37553
+ ctx.font = `9px ${fontFamily}`;
38148
37554
  ctx.textAlign = "center";
37555
+ ctx.textBaseline = "alphabetic";
38149
37556
  ctx.fillText(edge.label, mx, my - 4);
38150
37557
  }
38151
37558
  }
@@ -38170,10 +37577,33 @@ var init_GraphCanvas = __esm({
38170
37577
  }
38171
37578
  ctx.stroke();
38172
37579
  if (showLabels && node.label) {
38173
- ctx.fillStyle = "#666666";
38174
- 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}`;
38175
37604
  ctx.textAlign = "center";
38176
- ctx.fillText(node.label, node.x, node.y + radius + 12);
37605
+ ctx.textBaseline = "middle";
37606
+ ctx.fillText(String(node.badge), bx, by + 0.5);
38177
37607
  }
38178
37608
  }
38179
37609
  ctx.restore();
@@ -38266,11 +37696,21 @@ var init_GraphCanvas = __esm({
38266
37696
  if (!coords) return;
38267
37697
  const node = nodeAt(coords.graphX, coords.graphY);
38268
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
+ }
38269
37709
  handleNodeClick(node);
38270
37710
  }
38271
37711
  }
38272
37712
  },
38273
- [toCoords, nodeAt, handleNodeClick]
37713
+ [toCoords, nodeAt, handleNodeClick, onBadgeClick, selectedNodeId]
38274
37714
  );
38275
37715
  const handlePointerLeave = React90.useCallback(() => {
38276
37716
  setHoveredNode(null);
@@ -42791,7 +42231,7 @@ function getAllEvents(traits2) {
42791
42231
  function EventDispatcherTab({ traits: traits2, schema }) {
42792
42232
  const eventBus = useEventBus();
42793
42233
  const { t } = hooks.useTranslate();
42794
- const [log12, setLog] = React90__namespace.useState([]);
42234
+ const [log11, setLog] = React90__namespace.useState([]);
42795
42235
  const prevStatesRef = React90__namespace.useRef(/* @__PURE__ */ new Map());
42796
42236
  React90__namespace.useEffect(() => {
42797
42237
  for (const trait of traits2) {
@@ -42855,9 +42295,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
42855
42295
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.otherEvents") }),
42856
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)) })
42857
42297
  ] }),
42858
- log12.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42298
+ log11.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42859
42299
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.recentTransitions") }),
42860
- /* @__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: [
42861
42301
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
42862
42302
  " ",
42863
42303
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46259,7 +45699,7 @@ function SlotContentRenderer({
46259
45699
  if (typeof propValue !== "string") continue;
46260
45700
  const propDef = propsSchema[propKey];
46261
45701
  if (!propDef || propDef.kind !== "callback") continue;
46262
- renderedProps[propKey] = wrapCallbackForEvent(
45702
+ renderedProps[propKey] = ui.wrapCallbackForEvent(
46263
45703
  `UI:${propValue}`,
46264
45704
  propDef.callbackArgs,
46265
45705
  (eventKey, payload) => eventBus.emit(eventKey, payload)
@@ -49861,85 +49301,12 @@ function useResolvedSchema(schema, pageName) {
49861
49301
  }, [ir, pageName, loading, error, schema]);
49862
49302
  return result;
49863
49303
  }
49864
-
49865
- // lib/embedded-traits.ts
49866
- var TRAIT_BINDING_PREFIX = "@trait.";
49867
- function collectTraitRefsFromValue(value, into) {
49868
- if (value === null || value === void 0) return;
49869
- if (typeof value === "string") {
49870
- if (value.startsWith(TRAIT_BINDING_PREFIX)) {
49871
- const rest = value.slice(TRAIT_BINDING_PREFIX.length);
49872
- const dot = rest.indexOf(".");
49873
- const traitName = dot === -1 ? rest : rest.slice(0, dot);
49874
- if (traitName.length > 0) into.add(traitName);
49875
- }
49876
- return;
49877
- }
49878
- if (Array.isArray(value)) {
49879
- for (const item of value) collectTraitRefsFromValue(item, into);
49880
- return;
49881
- }
49882
- if (typeof value === "object") {
49883
- for (const v of Object.values(value)) {
49884
- collectTraitRefsFromValue(v, into);
49885
- }
49886
- }
49887
- }
49888
- function collectTraitRefsFromEffects(effects, into) {
49889
- if (!effects) return;
49890
- for (const effect of effects) {
49891
- if (!Array.isArray(effect)) continue;
49892
- if (effect[0] === "render-ui" && effect.length >= 3) {
49893
- collectTraitRefsFromValue(effect[2], into);
49894
- continue;
49895
- }
49896
- for (let i = 1; i < effect.length; i++) {
49897
- const arg = effect[i];
49898
- if (Array.isArray(arg)) collectTraitRefsFromEffects([arg], into);
49899
- else collectTraitRefsFromValue(arg, into);
49900
- }
49901
- }
49902
- }
49903
- function collectTraitRefsFromResolvedTrait(trait) {
49904
- const out = /* @__PURE__ */ new Set();
49905
- for (const transition of trait.transitions ?? []) {
49906
- collectTraitRefsFromEffects(transition.effects, out);
49907
- }
49908
- for (const tick of trait.ticks ?? []) {
49909
- collectTraitRefsFromEffects(tick.effects, out);
49910
- }
49911
- return out;
49912
- }
49913
- function collectEmbeddedTraits(schema) {
49914
- const out = /* @__PURE__ */ new Set();
49915
- if (!schema?.orbitals) return out;
49916
- for (const orbital of schema.orbitals) {
49917
- const traits2 = orbital.traits;
49918
- if (!Array.isArray(traits2)) continue;
49919
- for (const traitRef of traits2) {
49920
- if (!traitRef || typeof traitRef !== "object") continue;
49921
- const resolved = traitRef._resolved;
49922
- const target = resolved && typeof resolved === "object" ? resolved : traitRef;
49923
- if (target.config) {
49924
- collectTraitRefsFromValue(target.config, out);
49925
- }
49926
- const transitions = target.stateMachine?.transitions;
49927
- if (!Array.isArray(transitions)) continue;
49928
- for (const t of transitions) {
49929
- collectTraitRefsFromEffects(t.effects, out);
49930
- }
49931
- collectTraitRefsFromEffects(target.initialEffects, out);
49932
- const ticks2 = target.ticks;
49933
- if (Array.isArray(ticks2)) {
49934
- for (const tick of ticks2) {
49935
- collectTraitRefsFromEffects(tick.effects, out);
49936
- }
49937
- }
49938
- }
49939
- }
49940
- return out;
49941
- }
49942
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
+ }
49943
49310
  function isFnFormLambda(value) {
49944
49311
  if (!Array.isArray(value)) return false;
49945
49312
  const arr = value;
@@ -49979,7 +49346,14 @@ function resolveLambdaBindings(body, params, item, index) {
49979
49346
  return body;
49980
49347
  }
49981
49348
  if (Array.isArray(body)) {
49982
- 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;
49983
49357
  }
49984
49358
  if (body !== null && typeof body === "object" && !React90__namespace.default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
49985
49359
  const out = {};
@@ -50072,27 +49446,27 @@ var log7 = logger.createLogger("almadar:ui:shared-entity-store");
50072
49446
  var EMPTY_ENTITY_STATE = {};
50073
49447
  function createSharedEntityStore() {
50074
49448
  const states = /* @__PURE__ */ new Map();
50075
- const subscribers2 = /* @__PURE__ */ new Map();
49449
+ const subscribers = /* @__PURE__ */ new Map();
50076
49450
  const getSnapshot2 = (entityId) => states.get(entityId) ?? EMPTY_ENTITY_STATE;
50077
49451
  const subscribe = (entityId, callback) => {
50078
- let set = subscribers2.get(entityId);
49452
+ let set = subscribers.get(entityId);
50079
49453
  if (!set) {
50080
49454
  set = /* @__PURE__ */ new Set();
50081
- subscribers2.set(entityId, set);
49455
+ subscribers.set(entityId, set);
50082
49456
  }
50083
49457
  set.add(callback);
50084
49458
  return () => {
50085
- const current = subscribers2.get(entityId);
49459
+ const current = subscribers.get(entityId);
50086
49460
  if (!current) return;
50087
49461
  current.delete(callback);
50088
49462
  if (current.size === 0) {
50089
- subscribers2.delete(entityId);
49463
+ subscribers.delete(entityId);
50090
49464
  }
50091
49465
  };
50092
49466
  };
50093
49467
  const commit = (entityId, nextState) => {
50094
49468
  states.set(entityId, nextState);
50095
- const set = subscribers2.get(entityId);
49469
+ const set = subscribers.get(entityId);
50096
49470
  if (!set) return;
50097
49471
  set.forEach((callback) => {
50098
49472
  try {
@@ -50194,6 +49568,8 @@ var flushLog = logger.createLogger("almadar:ui:slot-flush");
50194
49568
  var stateLog = logger.createLogger("almadar:ui:state-transitions");
50195
49569
  var tickLog = logger.createLogger("almadar:ui:tick-effects");
50196
49570
  logger.setNamespaceLevel("almadar:ui:tick-effects", "WARN");
49571
+ var sharedEntityLog = logger.createLogger("almadar:ui:shared-entity");
49572
+ logger.setNamespaceLevel("almadar:ui:shared-entity", "WARN");
50197
49573
  var SYNC_TICK_OPERATORS = /* @__PURE__ */ new Set([
50198
49574
  "set",
50199
49575
  "emit",
@@ -50288,14 +49664,14 @@ function createSharedEntityWriter(binding, tick, traitStatesRef, emit) {
50288
49664
  function getBindingConfig(binding) {
50289
49665
  const raw = binding.config;
50290
49666
  const normalized = runtime.normalizeCallSiteConfigToValues(raw);
50291
- console.log("[debug:getBindingConfig]", binding.trait.name, "raw keys=", raw ? Object.keys(raw) : "undefined", "has tiles=", raw ? "tiles" in raw : false);
49667
+ sharedEntityLog.debug("getBindingConfig", { traitName: binding.trait.name, rawKeys: raw ? Object.keys(raw) : void 0, hasTiles: raw ? "tiles" in raw : false });
50292
49668
  return normalized;
50293
49669
  }
50294
49670
  function evalFieldDefault(value) {
50295
49671
  if (!Array.isArray(value) || value.length === 0) return value;
50296
49672
  const head = value[0];
50297
- const isSExpr = typeof head === "string" && (head.includes("/") || head === "let" || head === "if" || head === "lambda");
50298
- if (!isSExpr) return value;
49673
+ const isSExpr2 = typeof head === "string" && (head.includes("/") || head === "let" || head === "if" || head === "lambda");
49674
+ if (!isSExpr2) return value;
50299
49675
  try {
50300
49676
  return evaluator.evaluate(value, evaluator.createMinimalContext({}, {}, ""));
50301
49677
  } catch {
@@ -50303,7 +49679,7 @@ function evalFieldDefault(value) {
50303
49679
  }
50304
49680
  }
50305
49681
  function useTraitStateMachine(traitBindings, uiSlots, options) {
50306
- console.log("[debug:useTraitStateMachine] start, traitBindings count=", traitBindings.length, "names=", traitBindings.map((b) => b.trait.name).join(","));
49682
+ sharedEntityLog.debug("useTraitStateMachine start", { traitBindingsCount: traitBindings.length, traitNames: traitBindings.map((b) => b.trait.name) });
50307
49683
  const eventBus = useEventBus();
50308
49684
  const { entities } = providers.useEntitySchema();
50309
49685
  const traitConfigsByName = options?.traitConfigsByName;
@@ -50322,10 +49698,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50322
49698
  if (!group) {
50323
49699
  let defaults;
50324
49700
  for (const field of entityDef.fields) {
50325
- if (field.default !== void 0) {
49701
+ if (field.default !== void 0 && field.default !== null) {
50326
49702
  const evaluated = evalFieldDefault(field.default);
50327
49703
  if (field.name === "tiles") {
50328
- console.log(`[debug:seed] ${linkedEntityName}.tiles seed type=`, typeof evaluated, Array.isArray(evaluated) ? "len=" + evaluated?.length : "", "head=", Array.isArray(evaluated) && evaluated.length > 0 ? JSON.stringify(evaluated[0]).slice(0, 80) : "n/a");
49704
+ sharedEntityLog.debug("seed tiles", {
49705
+ linkedEntityName,
49706
+ type: typeof evaluated,
49707
+ length: Array.isArray(evaluated) ? evaluated?.length : void 0,
49708
+ head: Array.isArray(evaluated) && evaluated.length > 0 ? JSON.stringify(evaluated[0]).slice(0, 80) : void 0
49709
+ });
50329
49710
  }
50330
49711
  (defaults ?? (defaults = {}))[field.name] = evaluated;
50331
49712
  }
@@ -50342,7 +49723,12 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50342
49723
  for (const group of sharedGroups.values()) {
50343
49724
  if (group.defaults) {
50344
49725
  sharedEntityStore.seed(group.storeKey, group.defaults);
50345
- console.log("[debug:shared-seed]", group.storeKey, "writers=", group.writerBindings.map((b) => b.trait.name).join(","), "renderers=", group.renderBindings.map((b) => b.trait.name).join(","), "defaults.tiles=", Array.isArray(group.defaults.tiles) ? group.defaults.tiles.length : group.defaults.tiles);
49726
+ sharedEntityLog.debug("shared-seed", {
49727
+ storeKey: group.storeKey,
49728
+ writers: group.writerBindings.map((b) => b.trait.name),
49729
+ renderers: group.renderBindings.map((b) => b.trait.name),
49730
+ tilesLength: Array.isArray(group.defaults.tiles) ? group.defaults.tiles.length : group.defaults.tiles
49731
+ });
50346
49732
  }
50347
49733
  }
50348
49734
  const sharedKeyByTraitNameRef = React90.useRef(/* @__PURE__ */ new Map());
@@ -50353,13 +49739,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50353
49739
  for (const binding of group.renderBindings) map.set(binding.trait.name, group.storeKey);
50354
49740
  }
50355
49741
  sharedKeyByTraitNameRef.current = map;
50356
- console.log("[debug:shared-map]", Array.from(map.entries()).map(([k, v]) => `${k}->${v}`).join(","));
49742
+ sharedEntityLog.debug("shared-map", { map: Array.from(map.entries()).map(([k, v]) => `${k}->${v}`) });
50357
49743
  }, [sharedGroups]);
50358
49744
  const manager = React90.useMemo(() => {
50359
49745
  const traitDefs = traitBindings.map(toTraitDefinition);
50360
49746
  const m = new runtime.StateMachineManager(traitDefs);
50361
49747
  for (const binding of traitBindings) {
50362
- 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;
50363
49751
  if (cfg !== void 0) {
50364
49752
  m.setTraitConfig(binding.trait.name, cfg);
50365
49753
  }
@@ -50537,13 +49925,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50537
49925
  };
50538
49926
  }, [traitBindings]);
50539
49927
  const executeTransitionEffects = React90.useCallback(async (params) => {
50540
- const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log12 } = params;
49928
+ const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log11 } = params;
50541
49929
  const traitName = binding.trait.name;
50542
49930
  const linkedEntity = binding.linkedEntity || "";
50543
49931
  const entityId = payload?.entityId;
50544
49932
  const sharedKey = sharedKeyByTraitNameRef.current.get(traitName);
50545
49933
  if (traitName === "Hero" || traitName === "Authority") {
50546
- console.log(`[debug:executeTransitionEffects] ${traitName} sharedKey=`, sharedKey, "store tiles=", sharedKey ? sharedEntityStore.getSnapshot(sharedKey).tiles?.length : "n/a");
49934
+ sharedEntityLog.debug("executeTransitionEffects sharedKey", { traitName, sharedKey, storeTilesLength: sharedKey ? sharedEntityStore.getSnapshot(sharedKey).tiles?.length : void 0 });
50547
49935
  }
50548
49936
  let liveEntity;
50549
49937
  if (sharedKey !== void 0) {
@@ -50570,10 +49958,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50570
49958
  addPattern: (slot, pattern, props) => {
50571
49959
  if (traitName === "Hero" && slot === "main" && props && typeof props === "object") {
50572
49960
  const canvasChild = Array.isArray(props.children) ? props.children[0] : null;
50573
- const grandChildren = canvasChild && typeof canvasChild === "object" ? canvasChild.children : null;
49961
+ const grandChildren = canvasChild && typeof canvasChild === "object" && !Array.isArray(canvasChild) ? canvasChild.children : null;
50574
49962
  const firstLayer = Array.isArray(grandChildren) && grandChildren.length > 0 ? grandChildren[0] : null;
50575
- const firstLayerItems = firstLayer && typeof firstLayer === "object" ? firstLayer.items : null;
50576
- console.log(`[debug:render-ui] ${traitName} slot=${slot} canvasChild=`, canvasChild ? canvasChild.type : "none", "firstLayerItems=", Array.isArray(firstLayerItems) ? firstLayerItems.length : firstLayerItems);
49963
+ const firstLayerItems = firstLayer && typeof firstLayer === "object" && !Array.isArray(firstLayer) ? firstLayer.items : null;
49964
+ sharedEntityLog.debug("render-ui main slot", {
49965
+ traitName,
49966
+ slot,
49967
+ canvasChildType: canvasChild && typeof canvasChild === "object" && !Array.isArray(canvasChild) ? canvasChild.type : "none",
49968
+ firstLayerItemsLength: Array.isArray(firstLayerItems) ? firstLayerItems.length : firstLayerItems
49969
+ });
50577
49970
  }
50578
49971
  const existing = pendingSlots.get(slot) || [];
50579
49972
  existing.push({ pattern, props: props || {} });
@@ -50606,10 +49999,20 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50606
49999
  state: previousState
50607
50000
  };
50608
50001
  const sharedDeclared = runtime.collectDeclaredConfigDefaults(binding.trait);
50609
- const sharedCallSite = getBindingConfig(binding);
50610
- 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) {
50611
50013
  sharedBindings.config = {
50612
50014
  ...sharedDeclared ?? {},
50015
+ ...sharedResolved ?? {},
50613
50016
  ...sharedCallSite ?? {}
50614
50017
  };
50615
50018
  }
@@ -50643,7 +50046,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50643
50046
  ...handlers,
50644
50047
  set: async (targetId, field, value) => {
50645
50048
  if (baseSet) await baseSet(targetId, field, value);
50646
- log12.debug("set:write", {
50049
+ log11.debug("set:write", {
50647
50050
  traitName,
50648
50051
  field,
50649
50052
  value: JSON.stringify(value),
@@ -50657,15 +50060,30 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50657
50060
  state: previousState
50658
50061
  };
50659
50062
  const declaredDefaults = runtime.collectDeclaredConfigDefaults(binding.trait);
50063
+ const resolvedDefaults = traitConfigsByName?.[traitName];
50660
50064
  const callSiteConfig = getBindingConfig(binding);
50661
- 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) {
50662
50074
  bindingCtx.config = {
50663
50075
  ...declaredDefaults ?? {},
50664
- ...callSiteConfig ?? {}
50076
+ ...resolvedDefaults ?? {},
50077
+ ...callSiteOverrides ?? {}
50665
50078
  };
50666
50079
  }
50667
50080
  if (traitName === "Authority" || traitName === "Hero") {
50668
- console.log(`[debug:executeTransitionEffects] ${traitName} config tiles type=`, typeof bindingCtx.config?.tiles, Array.isArray(bindingCtx.config?.tiles) ? "len=" + bindingCtx.config?.tiles?.length : "", "keys=", bindingCtx.config ? Object.keys(bindingCtx.config) : "none");
50081
+ sharedEntityLog.debug("executeTransitionEffects config tiles", {
50082
+ traitName,
50083
+ tilesType: typeof bindingCtx.config?.tiles,
50084
+ tilesLength: Array.isArray(bindingCtx.config?.tiles) ? bindingCtx.config?.tiles?.length : void 0,
50085
+ configKeys: bindingCtx.config ? Object.keys(bindingCtx.config) : void 0
50086
+ });
50669
50087
  }
50670
50088
  const effectContext = {
50671
50089
  traitName,
@@ -50684,18 +50102,28 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50684
50102
  }
50685
50103
  };
50686
50104
  if (traitName === "Hero") {
50687
- console.log(`[debug:executeTransitionEffects] ${traitName} effects count=${effects.length} hasRenderUI=${typeof handlers.renderUI === "function"} effect heads=${effects.map((e) => Array.isArray(e) ? String(e[0]) : "??").join(",")}`);
50105
+ sharedEntityLog.debug("executeTransitionEffects effects summary", {
50106
+ traitName,
50107
+ effectsCount: effects.length,
50108
+ hasRenderUI: typeof handlers.renderUI === "function",
50109
+ effectHeads: effects.map((e) => Array.isArray(e) ? String(e[0]) : "??")
50110
+ });
50688
50111
  }
50689
50112
  const executor = new runtime.EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
50690
50113
  try {
50691
50114
  await executor.executeAll(effects);
50692
50115
  if (traitName === "Authority" || traitName === "Hero") {
50693
- console.log(`[debug:executeTransitionEffects] ${traitName} after executeAll liveEntity.tiles type=`, typeof liveEntity.tiles, Array.isArray(liveEntity.tiles) ? "len=" + liveEntity.tiles?.length : "", "firstTilePos=", Array.isArray(liveEntity.tiles) && liveEntity.tiles.length > 0 ? JSON.stringify(liveEntity.tiles[0]).slice(0, 120) : "n/a");
50116
+ sharedEntityLog.debug("executeTransitionEffects after executeAll", {
50117
+ traitName,
50118
+ tilesType: typeof liveEntity.tiles,
50119
+ tilesLength: Array.isArray(liveEntity.tiles) ? liveEntity.tiles?.length : void 0,
50120
+ firstTilePos: Array.isArray(liveEntity.tiles) && liveEntity.tiles.length > 0 ? JSON.stringify(liveEntity.tiles[0]).slice(0, 120) : void 0
50121
+ });
50694
50122
  }
50695
50123
  if (sharedKey !== void 0) {
50696
50124
  sharedEntityStore.commit(sharedKey, liveEntity);
50697
50125
  }
50698
- log12.debug("effects:executed", () => ({
50126
+ log11.debug("effects:executed", () => ({
50699
50127
  traitName,
50700
50128
  transition: `${previousState}->${newState}`,
50701
50129
  event: flushEvent,
@@ -50705,7 +50133,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50705
50133
  slotsTouched: Array.from(pendingSlots.keys()).join(",")
50706
50134
  }));
50707
50135
  for (const [slot, patterns] of pendingSlots) {
50708
- log12.debug("flush:slot", {
50136
+ log11.debug("flush:slot", {
50709
50137
  traitName,
50710
50138
  slot,
50711
50139
  patternCount: patterns.length,
@@ -50720,7 +50148,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50720
50148
  });
50721
50149
  }
50722
50150
  } catch (error) {
50723
- log12.error("effects:error", {
50151
+ log11.error("effects:error", {
50724
50152
  traitName,
50725
50153
  transition: `${previousState}->${newState}`,
50726
50154
  event: flushEvent,
@@ -50742,7 +50170,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50742
50170
  payload: {},
50743
50171
  state: currentState
50744
50172
  };
50745
- const bindingCfg = getBindingConfig(binding);
50173
+ const bindingCfg = getBindingConfig(binding) ?? traitConfigsByName?.[traitName];
50746
50174
  if (bindingCfg) {
50747
50175
  guardCtx.config = bindingCfg;
50748
50176
  }
@@ -51105,17 +50533,19 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51105
50533
  }, [traitBindings, eventBus, enqueueAndDrain]);
51106
50534
  React90.useEffect(() => {
51107
50535
  const mgr = managerRef.current;
51108
- const inited = initedTraitsRef.current;
50536
+ const eventsToFire = /* @__PURE__ */ new Set();
51109
50537
  for (const binding of traitBindings) {
51110
50538
  const traitName = binding.trait.name;
51111
- if (inited.has(traitName)) continue;
51112
50539
  const lifecycleEvent = LIFECYCLE_EVENTS.find(
51113
50540
  (evt) => mgr.canHandleEvent(traitName, evt)
51114
50541
  );
51115
- if (lifecycleEvent === void 0) continue;
51116
- inited.add(traitName);
51117
- stateLog.debug("mount:fire-lifecycle", { traitName, event: lifecycleEvent });
51118
- 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, {});
51119
50549
  }
51120
50550
  return () => {
51121
50551
  initedTraitsRef.current = /* @__PURE__ */ new Set();
@@ -51129,228 +50559,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51129
50559
  };
51130
50560
  }
51131
50561
 
51132
- // lib/orbitalsByTrait.ts
51133
- function buildOrbitalsByTrait(schema, resolvedPages = []) {
51134
- const map = {};
51135
- if (!schema?.orbitals) return map;
51136
- const pagePathToOrbital = {};
51137
- for (const orb of schema.orbitals) {
51138
- for (const traitRef of orb.traits ?? []) {
51139
- let traitName;
51140
- if (typeof traitRef === "string") {
51141
- const parts = traitRef.split(".");
51142
- traitName = parts[parts.length - 1];
51143
- } else if (typeof traitRef.ref === "string") {
51144
- const parts = traitRef.ref.split(".");
51145
- traitName = traitRef.name ?? parts[parts.length - 1];
51146
- } else if (typeof traitRef.name === "string") {
51147
- traitName = traitRef.name;
51148
- }
51149
- if (traitName) map[traitName] = orb.name;
51150
- }
51151
- for (const pg of orb.pages ?? []) {
51152
- const path = typeof pg === "string" ? pg : pg?.path;
51153
- if (path) pagePathToOrbital[path] = orb.name;
51154
- }
51155
- }
51156
- for (const page of resolvedPages) {
51157
- const orbital = page.path ? pagePathToOrbital[page.path] : void 0;
51158
- if (!orbital) continue;
51159
- for (const traitName of page.traitNames) {
51160
- if (traitName && !(traitName in map)) map[traitName] = orbital;
51161
- }
51162
- }
51163
- return map;
51164
- }
51165
-
51166
50562
  // runtime/OrbPreview.tsx
51167
50563
  init_verificationRegistry();
51168
- var PERF_NAMESPACE = "almadar:perf:canvas";
51169
- var log9 = logger.createLogger(PERF_NAMESPACE);
51170
- var RING_SIZE = 50;
51171
- var ring = [];
51172
- var writeIdx = 0;
51173
- var subscribers = /* @__PURE__ */ new Set();
51174
- var notifyScheduled = false;
51175
- function scheduleNotify() {
51176
- if (notifyScheduled) return;
51177
- notifyScheduled = true;
51178
- queueMicrotask(() => {
51179
- notifyScheduled = false;
51180
- for (const fn of subscribers) fn();
51181
- });
51182
- }
51183
- function push(entry) {
51184
- if (ring.length < RING_SIZE) {
51185
- ring.push(entry);
51186
- } else {
51187
- ring[writeIdx] = entry;
51188
- }
51189
- writeIdx = (writeIdx + 1) % RING_SIZE;
51190
- scheduleNotify();
51191
- }
51192
- function isEnabled() {
51193
- return logger.isLogLevelEnabled("DEBUG", PERF_NAMESPACE);
51194
- }
51195
- function now() {
51196
- return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
51197
- }
51198
- function perfStart(name) {
51199
- if (!isEnabled()) return -1;
51200
- if (typeof performance !== "undefined" && typeof performance.mark === "function") {
51201
- try {
51202
- performance.mark(`${name}-start`);
51203
- } catch {
51204
- }
51205
- }
51206
- return now();
51207
- }
51208
- function perfEnd(name, startToken, detail) {
51209
- if (startToken < 0 || !isEnabled()) return;
51210
- const endTs = now();
51211
- const durationMs = endTs - startToken;
51212
- if (typeof performance !== "undefined" && typeof performance.measure === "function") {
51213
- try {
51214
- performance.mark(`${name}-end`);
51215
- performance.measure(name, `${name}-start`, `${name}-end`);
51216
- } catch {
51217
- }
51218
- }
51219
- push({ name, durationMs, ts: endTs, detail });
51220
- log9.debug(name, () => ({ durationMs, ...detail ?? {} }));
51221
- }
51222
- var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
51223
- if (!isEnabled()) return;
51224
- push({
51225
- name: `profiler:${id}:${phase}`,
51226
- durationMs: actualDuration,
51227
- ts: commitTime,
51228
- detail: { baseDuration }
51229
- });
51230
- log9.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
51231
- };
51232
-
51233
- // lib/prepareSchemaForPreview.ts
51234
- function generateEntityRow(entity, idx) {
51235
- const row = { id: String(idx) };
51236
- for (const f3 of entity.fields) {
51237
- if (f3.name === void 0 || f3.name === "id") continue;
51238
- row[f3.name] = generateFieldValue(entity.name, f3, idx);
51239
- }
51240
- return row;
51241
- }
51242
- function generateFieldValue(entityName, field, idx) {
51243
- if ("values" in field && field.values && field.values.length > 0) {
51244
- return field.values[(idx - 1) % field.values.length];
51245
- }
51246
- const fieldName = field.name ?? "";
51247
- switch (field.type) {
51248
- case "string":
51249
- return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
51250
- case "number":
51251
- return idx * 10;
51252
- case "boolean":
51253
- return idx % 2 === 0;
51254
- default:
51255
- return field.default ?? null;
51256
- }
51257
- }
51258
- function buildMockData(schema) {
51259
- const t = perfStart("build-mock-data");
51260
- const result = {};
51261
- for (const orbital of schema.orbitals) {
51262
- const entity = orbital.entity;
51263
- if (!entity || typeof entity === "string") continue;
51264
- if (core.isEntityCall(entity)) continue;
51265
- const entityName = entity.name;
51266
- if (!entityName) continue;
51267
- if (entity.instances && entity.instances.length > 0) {
51268
- result[entityName] = entity.instances;
51269
- continue;
51270
- }
51271
- const rows = Array.from(
51272
- { length: 10 },
51273
- (_, i) => generateEntityRow(entity, i + 1)
51274
- );
51275
- result[entityName] = rows;
51276
- }
51277
- for (const orbital of schema.orbitals) {
51278
- for (const traitRef of orbital.traits ?? []) {
51279
- if (!isInlineTrait3(traitRef)) continue;
51280
- const trait = traitRef;
51281
- const sourceEntity = trait.sourceEntityDefinition;
51282
- if (!sourceEntity || core.isEntityCall(sourceEntity)) continue;
51283
- const sourceName = sourceEntity.name;
51284
- if (!sourceName) continue;
51285
- if (!result[sourceName]) {
51286
- result[sourceName] = sourceEntity.instances && sourceEntity.instances.length > 0 ? sourceEntity.instances : Array.from(
51287
- { length: 10 },
51288
- (_, i) => generateEntityRow(sourceEntity, i + 1)
51289
- );
51290
- }
51291
- const reboundName = trait.linkedEntity;
51292
- if (!reboundName || reboundName === sourceName) continue;
51293
- const reboundRows = result[reboundName];
51294
- if (!reboundRows || reboundRows.length === 0) continue;
51295
- reboundRows.forEach((row, i) => {
51296
- for (const f3 of sourceEntity.fields) {
51297
- if (f3.name === void 0 || f3.name === "id") continue;
51298
- if (row[f3.name] !== void 0) continue;
51299
- row[f3.name] = generateFieldValue(sourceName, f3, i + 1);
51300
- }
51301
- });
51302
- }
51303
- }
51304
- perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
51305
- return result;
51306
- }
51307
- function isInlineTrait3(traitRef) {
51308
- return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
51309
- }
51310
- function findDataState(sm, initialStateName) {
51311
- return sm.states.find((s) => {
51312
- if (s.name === initialStateName) return false;
51313
- return sm.transitions.some(
51314
- (t) => t.event === "INIT" && (t.from === s.name || Array.isArray(t.from) && t.from.includes(s.name))
51315
- );
51316
- });
51317
- }
51318
- function rewriteTraitInitialState(trait, mockData) {
51319
- const sm = trait.stateMachine;
51320
- if (!sm) return trait;
51321
- const linkedEntity = trait.linkedEntity;
51322
- if (!linkedEntity || !mockData[linkedEntity]?.length) return trait;
51323
- const initialStateName = sm.states.find((s) => s.isInitial)?.name ?? sm.states[0]?.name;
51324
- if (!initialStateName) return trait;
51325
- const dataState = findDataState(sm, initialStateName);
51326
- if (!dataState) return trait;
51327
- const updatedStates = sm.states.map((s) => {
51328
- if (s.name === initialStateName) return { ...s, isInitial: false };
51329
- if (s.name === dataState.name) return { ...s, isInitial: true };
51330
- return s;
51331
- });
51332
- return { ...trait, stateMachine: { ...sm, states: updatedStates } };
51333
- }
51334
- function adjustSchemaForMockData(schema, mockData) {
51335
- let changed = false;
51336
- const updatedOrbitals = schema.orbitals.map((orbital) => {
51337
- const traits2 = orbital.traits ?? [];
51338
- const updatedTraits = traits2.map((traitRef) => {
51339
- if (!isInlineTrait3(traitRef)) return traitRef;
51340
- const updated = rewriteTraitInitialState(traitRef, mockData);
51341
- if (updated !== traitRef) changed = true;
51342
- return updated;
51343
- });
51344
- return changed ? { ...orbital, traits: updatedTraits } : orbital;
51345
- });
51346
- return changed ? { ...schema, orbitals: updatedOrbitals } : schema;
51347
- }
51348
- function prepareSchemaForPreview(input) {
51349
- const parsed = typeof input === "string" ? JSON.parse(input) : input;
51350
- const mockData = buildMockData(parsed);
51351
- const schema = adjustSchemaForMockData(parsed, mockData);
51352
- return { schema, mockData };
51353
- }
51354
50564
  var xOrbitalLog = logger.createLogger("almadar:runtime:cross-orbital");
51355
50565
  var navLog = logger.createLogger("almadar:runtime:navigation");
51356
50566
  function normalizeChild(child) {
@@ -51438,6 +50648,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
51438
50648
  hadPrev: prevTraitsRef.current !== void 0
51439
50649
  }));
51440
50650
  if (refChanged) {
50651
+ navLog.info("page:traits-reset", { traitsCount: Array.isArray(traits2) ? traits2.length : -1 });
51441
50652
  uiSlots.clearAll();
51442
50653
  initSentRef.current = false;
51443
50654
  }
@@ -51516,7 +50727,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51516
50727
  while (queue.length > 0) {
51517
50728
  const binding = queue.shift();
51518
50729
  if (!binding) continue;
51519
- for (const refName of collectTraitRefsFromResolvedTrait(binding.trait)) {
50730
+ for (const refName of ui.collectTraitRefsFromResolvedTrait(binding.trait)) {
51520
50731
  if (byName.has(refName)) continue;
51521
50732
  const rt = allTraits.get(refName);
51522
50733
  if (!rt) continue;
@@ -51534,7 +50745,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51534
50745
  return orbitals.map((o) => o.name);
51535
50746
  }, [schema]);
51536
50747
  const orbitalsByTrait = React90.useMemo(
51537
- () => buildOrbitalsByTrait(
50748
+ () => ui.buildOrbitalsByTrait(
51538
50749
  schema,
51539
50750
  ir ? Array.from(ir.pages.values()).map((p) => ({
51540
50751
  path: p.path,
@@ -51583,26 +50794,12 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51583
50794
  pageOrbitalNames: pageOrbitalNames.join(",")
51584
50795
  });
51585
50796
  }, [pageName, allPageTraits, orbitalsByTrait, pageOrbitalNames]);
51586
- const traitConfigsByName = React90.useMemo(() => {
51587
- const map = {};
51588
- const orbitals = schema?.orbitals;
51589
- if (!orbitals) return map;
51590
- for (const orb of orbitals) {
51591
- const traitRefs = orb.traits;
51592
- if (!traitRefs) continue;
51593
- for (const t of traitRefs) {
51594
- if (typeof t === "string") continue;
51595
- const name = t.name ?? t.ref;
51596
- const config = t.config;
51597
- if (typeof name === "string" && config !== void 0) {
51598
- map[name] = config;
51599
- }
51600
- }
51601
- }
51602
- return map;
51603
- }, [schema]);
50797
+ const traitConfigsByName = React90.useMemo(
50798
+ () => core.buildResolvedTraitConfigs(schema),
50799
+ [schema]
50800
+ );
51604
50801
  const embeddedTraits = React90.useMemo(() => {
51605
- const set = collectEmbeddedTraits(schema);
50802
+ const set = ui.collectEmbeddedTraits(schema);
51606
50803
  xOrbitalLog.info("SchemaRunner:embeddedTraits", {
51607
50804
  pageName,
51608
50805
  embedded: Array.from(set),
@@ -51687,7 +50884,7 @@ function OrbPreview({
51687
50884
  parsed = schema;
51688
50885
  }
51689
50886
  if (autoMock && !serverUrl && !transport) {
51690
- const prepared = prepareSchemaForPreview(parsed);
50887
+ const prepared = ui.prepareSchemaForPreview(parsed);
51691
50888
  return { ok: true, schema: prepared.schema, mockData: prepared.mockData };
51692
50889
  }
51693
50890
  return { ok: true, schema: parsed, mockData: mockData ?? {} };
@@ -51869,7 +51066,7 @@ init_useEventBus();
51869
51066
  // components/avl/hooks/useCanvasDnd.tsx
51870
51067
  init_useEventBus();
51871
51068
  init_useAlmadarDndCollision();
51872
- var log10 = logger.createLogger("almadar:ui:canvas-dnd");
51069
+ var log9 = logger.createLogger("almadar:ui:canvas-dnd");
51873
51070
  function useCanvasDraggable({
51874
51071
  id,
51875
51072
  payload,
@@ -51908,7 +51105,7 @@ function defaultEmit(eventBus, drop) {
51908
51105
  if (payload.kind === "pattern") {
51909
51106
  const patternType = payload.data["type"];
51910
51107
  if (typeof patternType !== "string") {
51911
- log10.warn("default-emit:pattern:missing-type");
51108
+ log9.warn("default-emit:pattern:missing-type");
51912
51109
  return;
51913
51110
  }
51914
51111
  const out = { patternType, containerNode: target.containerNode };
@@ -51917,23 +51114,23 @@ function defaultEmit(eventBus, drop) {
51917
51114
  out.index = resolved.index;
51918
51115
  }
51919
51116
  eventBus.emit("UI:PATTERN_DROP", out);
51920
- log10.info("default-emit:pattern", { patternType, level: target.level });
51117
+ log9.info("default-emit:pattern", { patternType, level: target.level });
51921
51118
  return;
51922
51119
  }
51923
51120
  if (payload.kind === "behavior") {
51924
51121
  const behaviorName = payload.data["name"];
51925
51122
  if (typeof behaviorName !== "string") {
51926
- log10.warn("default-emit:behavior:missing-name");
51123
+ log9.warn("default-emit:behavior:missing-name");
51927
51124
  return;
51928
51125
  }
51929
51126
  eventBus.emit("UI:BEHAVIOR_DROP", {
51930
51127
  behaviorName,
51931
51128
  containerNode: target.containerNode
51932
51129
  });
51933
- log10.info("default-emit:behavior", { behaviorName, level: target.level });
51130
+ log9.info("default-emit:behavior", { behaviorName, level: target.level });
51934
51131
  return;
51935
51132
  }
51936
- log10.debug("default-emit:unhandled-kind", { kind: payload.kind });
51133
+ log9.debug("default-emit:unhandled-kind", { kind: payload.kind });
51937
51134
  }
51938
51135
  function CanvasDndProvider({
51939
51136
  children,
@@ -51949,9 +51146,9 @@ function CanvasDndProvider({
51949
51146
  if (payload) {
51950
51147
  setActivePayload(payload);
51951
51148
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
51952
- log10.info("dragStart", { id: e.active.id, kind: payload.kind });
51149
+ log9.info("dragStart", { id: e.active.id, kind: payload.kind });
51953
51150
  } else {
51954
- log10.warn("dragStart:missing-payload", { id: e.active.id });
51151
+ log9.warn("dragStart:missing-payload", { id: e.active.id });
51955
51152
  }
51956
51153
  }, [eventBus]);
51957
51154
  const handleDragEnd = React90__namespace.default.useCallback((e) => {
@@ -51961,7 +51158,7 @@ function CanvasDndProvider({
51961
51158
  const overData = e.over?.data.current;
51962
51159
  const target = overData?.target;
51963
51160
  const accepts = overData?.accepts;
51964
- log10.info("dragEnd", {
51161
+ log9.info("dragEnd", {
51965
51162
  activeId: e.active.id,
51966
51163
  overId: e.over?.id,
51967
51164
  hasPayload: !!payload,
@@ -51973,7 +51170,7 @@ function CanvasDndProvider({
51973
51170
  }
51974
51171
  if (!payload || !target) return;
51975
51172
  if (accepts && !accepts.includes(payload.kind)) {
51976
- log10.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
51173
+ log9.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
51977
51174
  return;
51978
51175
  }
51979
51176
  const activator = e.activatorEvent;
@@ -51985,7 +51182,7 @@ function CanvasDndProvider({
51985
51182
  }, [eventBus, onDrop]);
51986
51183
  const handleDragCancel = React90__namespace.default.useCallback(() => {
51987
51184
  setActivePayload(null);
51988
- log10.info("dragCancel");
51185
+ log9.info("dragCancel");
51989
51186
  }, []);
51990
51187
  return /* @__PURE__ */ jsxRuntime.jsxs(
51991
51188
  core$1.DndContext,
@@ -53818,7 +53015,7 @@ init_AvlTransitionLane();
53818
53015
  init_AvlSwimLane();
53819
53016
  init_avl_atom_types();
53820
53017
  init_avl_elk_layout();
53821
- var log11 = logger.createLogger("almadar:ui:avl:trait-scene");
53018
+ var log10 = logger.createLogger("almadar:ui:avl:trait-scene");
53822
53019
  var SWIM_GUTTER2 = 120;
53823
53020
  var CENTER_W2 = 360;
53824
53021
  var AvlTraitScene = ({
@@ -53831,7 +53028,7 @@ var AvlTraitScene = ({
53831
53028
  const dataKey = React90.useMemo(() => JSON.stringify(data), [data]);
53832
53029
  React90.useEffect(() => {
53833
53030
  computeTraitLayout(data).then(setLayout).catch((error) => {
53834
- log11.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
53031
+ log10.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
53835
53032
  });
53836
53033
  }, [dataKey]);
53837
53034
  if (!layout) {
@@ -54024,6 +53221,14 @@ TraitCardNode.displayName = "TraitCardNode";
54024
53221
 
54025
53222
  // components/avl/organisms/FlowCanvas.tsx
54026
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
+ };
54027
53232
  var flowCanvasLog = logger.createLogger("almadar:ui:flow-canvas");
54028
53233
  var NODE_TYPES = {
54029
53234
  preview: OrbPreviewNode,
@@ -54120,13 +53325,13 @@ function FlowCanvasInner({
54120
53325
  }), [selectedPattern]);
54121
53326
  const [atBehaviorLevel, setAtBehaviorLevel] = React90.useState(composeLevel === "behavior");
54122
53327
  const { composeNodes, composeEdges, overviewNodes, overviewEdges, expandedNodes, expandedEdges, behaviorExpandedNodes, behaviorExpandedEdges, traitExpandedNodes, traitExpandedEdges } = React90.useMemo(() => {
54123
- const t2 = perfStart("compose-graph");
53328
+ const t2 = ui.perfStart("compose-graph");
54124
53329
  const compose = composeLevel === "behavior" && behaviorEntries?.length ? behaviorsToComposeGraph(behaviorEntries, behaviorWires ?? [], layoutHint) : { nodes: [], edges: [] };
54125
53330
  const overview = schemaToOverviewGraph(parsedSchema, mockData, behaviorMeta, layoutHint, orbitalStatus, screenSize);
54126
53331
  const expanded = expandedOrbital ? orbitalToExpandedGraph(parsedSchema, expandedOrbital, mockData, screenSize) : { nodes: [], edges: [] };
54127
53332
  const behaviorExpanded = expandedOrbital && expandedBehaviorAlias ? orbitalAliasToExpandedGraph(parsedSchema, expandedOrbital, expandedBehaviorAlias, mockData, screenSize) : { nodes: [], edges: [] };
54128
53333
  const traitExpanded = expandedOrbital ? orbitalToTraitGraph(parsedSchema, expandedOrbital) : { nodes: [], edges: [] };
54129
- perfEnd("compose-graph", t2, {
53334
+ ui.perfEnd("compose-graph", t2, {
54130
53335
  composeNodes: compose.nodes.length,
54131
53336
  overviewNodes: overview.nodes.length,
54132
53337
  expandedNodes: expanded.nodes.length,