@almadar/shell-web 0.0.0-stage → 0.1.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.
Files changed (274) hide show
  1. package/bundling.d.mts +18 -0
  2. package/bundling.mjs +28 -0
  3. package/dist/ArbitraryClassCompiler-Mzabq-UB.d.ts +100 -0
  4. package/dist/AvlGlyph-JKJOAH23.js +6 -0
  5. package/dist/AvlStateMachine-PI4YGREK.js +8 -0
  6. package/dist/AvlTransitionDetail-ZH7V24UG.js +12 -0
  7. package/dist/AvlTransitionExplainer-ZSRT7L6Y.js +13 -0
  8. package/dist/BehaviorValueFrame-6RUJXT4A.js +29 -0
  9. package/dist/BehaviorValueFrame-SSEMEBTG.css +1756 -0
  10. package/dist/BehaviorView-RFEE5J6E.js +10 -0
  11. package/dist/Canvas3DHost-_Y-5uLM_.d.ts +552 -0
  12. package/dist/EventBusProvider-CVwjkV_2.d.ts +284 -0
  13. package/dist/FileTree-BCFnBEuQ.d.ts +254 -0
  14. package/dist/FlowCanvas-3JRMNJLV.css +1756 -0
  15. package/dist/FlowCanvas-STDC4OWK.js +27 -0
  16. package/dist/GameAudioProvider-Cm9BnvmP.d.ts +93 -0
  17. package/dist/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
  18. package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
  19. package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
  20. package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
  21. package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
  22. package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
  23. package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
  24. package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
  25. package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
  26. package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
  27. package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
  28. package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
  29. package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
  30. package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
  31. package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
  32. package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
  33. package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
  34. package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
  35. package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
  36. package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
  37. package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
  38. package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
  39. package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
  40. package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
  41. package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
  42. package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
  43. package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
  44. package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
  45. package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
  46. package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
  47. package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
  48. package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
  49. package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
  50. package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
  51. package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
  52. package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
  53. package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
  54. package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
  55. package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
  56. package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
  57. package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
  58. package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
  59. package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
  60. package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
  61. package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
  62. package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
  63. package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
  64. package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
  65. package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
  66. package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
  67. package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
  68. package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
  69. package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
  70. package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
  71. package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
  72. package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
  73. package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
  74. package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
  75. package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
  76. package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
  77. package/dist/KernelEngineContext-BOCQoFwk.d.ts +43 -0
  78. package/dist/LayersPanel-BBQ54IVG.js +7 -0
  79. package/dist/ModuleCard-3TT2X7IW.js +7 -0
  80. package/dist/OrbInspector-K6T6O7GI.js +27 -0
  81. package/dist/OrbInspector-MHLJ6OEE.css +1756 -0
  82. package/dist/Select-mDZIwNqN.d.ts +199 -0
  83. package/dist/ServerBridge-Cm1On51b.d.ts +233 -0
  84. package/dist/ThemeContext-DJmO59xd.d.ts +147 -0
  85. package/dist/TraitValueFrame-2PJGLLVI.js +28 -0
  86. package/dist/TraitValueFrame-4G3KOUBR.css +1756 -0
  87. package/dist/UISlotContext-Dl_ewwCI.d.ts +79 -0
  88. package/dist/UISlotRenderer-JKFSX24W.js +27 -0
  89. package/dist/UISlotRenderer-KVFO6J7R.css +1756 -0
  90. package/dist/UserContext-DqWeZkUZ.d.ts +100 -0
  91. package/dist/auth/browser/index.d.ts +2 -0
  92. package/dist/auth/browser/index.js +1 -0
  93. package/dist/auth/react/index.d.ts +49 -0
  94. package/dist/auth/react/index.js +119 -0
  95. package/dist/avl/index.css +1756 -0
  96. package/dist/avl/index.d.ts +2238 -0
  97. package/dist/avl/index.js +2693 -0
  98. package/dist/avl-3d-context-BIRKWpaL.d.ts +204 -0
  99. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +132 -0
  100. package/dist/avl-zoom-state-CKMVuBFg.d.ts +17 -0
  101. package/dist/chunk-2PY54Z44.js +227 -0
  102. package/dist/chunk-2QOH2HWM.js +95 -0
  103. package/dist/chunk-3BBUBJFF.js +339 -0
  104. package/dist/chunk-42FY4RYA.js +191 -0
  105. package/dist/chunk-5QTYQTPS.js +15 -0
  106. package/dist/chunk-6P3MWXYE.js +440 -0
  107. package/dist/chunk-73SRAB4P.js +1053 -0
  108. package/dist/chunk-A2LR6VQQ.js +349 -0
  109. package/dist/chunk-AILY3XPS.js +562 -0
  110. package/dist/chunk-B4BU77LT.js +432 -0
  111. package/dist/chunk-DFNZUYX4.js +378 -0
  112. package/dist/chunk-DJ433ET5.js +1327 -0
  113. package/dist/chunk-DLZF4PVE.js +24 -0
  114. package/dist/chunk-DYEKAA4L.js +787 -0
  115. package/dist/chunk-DZ42OJQC.js +176 -0
  116. package/dist/chunk-EOWMARUB.js +16 -0
  117. package/dist/chunk-EQAMU2ZC.js +14 -0
  118. package/dist/chunk-FAJDTHWC.js +98 -0
  119. package/dist/chunk-FIW6WN23.js +508 -0
  120. package/dist/chunk-FP3WIKTC.js +303 -0
  121. package/dist/chunk-G7DCAZ22.js +19 -0
  122. package/dist/chunk-GAR5TQ5B.js +199 -0
  123. package/dist/chunk-GKIFONTE.js +131 -0
  124. package/dist/chunk-GYTPOFVC.js +47155 -0
  125. package/dist/chunk-KVQS4GXU.js +328 -0
  126. package/dist/chunk-L2DEKY4J.js +97 -0
  127. package/dist/chunk-L677XGY3.js +701 -0
  128. package/dist/chunk-MBQAMMSE.js +11877 -0
  129. package/dist/chunk-P4LNHAFI.js +1051 -0
  130. package/dist/chunk-P4ZFUQFF.js +93 -0
  131. package/dist/chunk-PC7K4SK7.js +1384 -0
  132. package/dist/chunk-R5O5AUPI.js +573 -0
  133. package/dist/chunk-SGM3FASH.js +672 -0
  134. package/dist/chunk-SJGJJKBY.js +502 -0
  135. package/dist/chunk-TESBIVUA.js +11 -0
  136. package/dist/chunk-TZZBINQY.js +82 -0
  137. package/dist/chunk-U6QRZASX.js +280 -0
  138. package/dist/chunk-VFF5OO47.js +319 -0
  139. package/dist/chunk-YDNJLLG6.js +516 -0
  140. package/dist/chunk-YHMRX6YA.js +455 -0
  141. package/dist/chunk-ZO6MXAS3.js +69 -0
  142. package/dist/components/index.css +1756 -0
  143. package/dist/components/index.d.ts +11093 -0
  144. package/dist/components/index.js +1110 -0
  145. package/dist/context/index.d.ts +9 -0
  146. package/dist/context/index.js +7 -0
  147. package/dist/core.d.ts +2523 -0
  148. package/dist/core.js +2 -0
  149. package/dist/design-classes/index.cjs +429 -0
  150. package/dist/design-classes/index.d.cts +165 -0
  151. package/dist/design-classes/index.d.ts +165 -0
  152. package/dist/design-classes/index.js +397 -0
  153. package/dist/emojiItems-QGSNAABW.js +20 -0
  154. package/dist/fx-CmQjnHmT.d.ts +371 -0
  155. package/dist/hooks/index.d.ts +936 -0
  156. package/dist/hooks/index.js +7 -0
  157. package/dist/index.d.ts +486 -0
  158. package/dist/index.js +38 -0
  159. package/dist/katexPlugin-FA7NX4PE.css +1161 -0
  160. package/dist/katexPlugin-NCDKOOQY.js +2 -0
  161. package/dist/kernel-client-ZH4PSMCN.js +367 -0
  162. package/dist/kernel-wire-B4S8pnP3.d.ts +65 -0
  163. package/dist/lib/index.d.ts +602 -0
  164. package/dist/lib/index.js +1288 -0
  165. package/dist/paintDispatch-ChW5mVuK.d.ts +698 -0
  166. package/dist/parseLessonSegments-GpCeMrb2.d.ts +334 -0
  167. package/dist/perf-CKiBKbkw.d.ts +22 -0
  168. package/dist/perf-Dr28-AgT.d.ts +57 -0
  169. package/dist/prism-AIWGN2X5.js +134 -0
  170. package/dist/providers/index.css +1756 -0
  171. package/dist/providers/index.d.ts +340 -0
  172. package/dist/providers/index.js +30 -0
  173. package/dist/renderer/index.d.ts +467 -0
  174. package/dist/renderer/index.js +3 -0
  175. package/dist/runtime/index.css +1756 -0
  176. package/dist/runtime/index.d.ts +440 -0
  177. package/dist/runtime/index.js +31 -0
  178. package/dist/slot-host-CPzrxLo9.d.ts +48 -0
  179. package/dist/ssr/index.cjs +7631 -0
  180. package/dist/ssr/index.d.cts +487 -0
  181. package/dist/ssr/index.d.ts +487 -0
  182. package/dist/ssr/index.js +7599 -0
  183. package/dist/storage/browser/index.d.ts +1 -0
  184. package/dist/storage/browser/index.js +1 -0
  185. package/dist/test-support.d.ts +35 -0
  186. package/dist/test-support.js +114 -0
  187. package/dist/themeTokens-CRd8AEDF.d.ts +125 -0
  188. package/dist/three/index.css +503 -0
  189. package/dist/three/index.d.ts +1185 -0
  190. package/dist/three/index.js +3896 -0
  191. package/dist/useKeyboardRouter-Dsq553Ur.d.ts +42 -0
  192. package/dist/useUISlots-CiobNFGb.d.ts +211 -0
  193. package/dist/verification-C5pTeMJv.d.ts +66 -0
  194. package/dist/verificationRegistry-CabxhfTv.d.ts +122 -0
  195. package/dist/wrapCallbackForEvent-B9QLbhxX.d.ts +19 -0
  196. package/index.css +199 -0
  197. package/package.json +269 -3
  198. package/src/core/locales/ar.json +1263 -0
  199. package/src/core/locales/en.json +1263 -0
  200. package/src/core/locales/index.ts +54 -0
  201. package/src/core/locales/sl.json +1263 -0
  202. package/src/core/tokens/native-tokens.json +369 -0
  203. package/tailwind-compile.cjs +29 -0
  204. package/tailwind-preset.cjs +991 -0
  205. package/themes/_base.css +451 -0
  206. package/themes/_contract.md +307 -0
  207. package/themes/_fonts-kenney.css +11 -0
  208. package/themes/_fonts.css +12 -0
  209. package/themes/_foundation.css +105 -0
  210. package/themes/_head.css +22 -0
  211. package/themes/_presets.css +67 -0
  212. package/themes/almadar-heritage.css +455 -0
  213. package/themes/almadar-website.css +269 -0
  214. package/themes/almadar.css +269 -0
  215. package/themes/aqua.css +455 -0
  216. package/themes/arabesque.css +459 -0
  217. package/themes/art-deco.css +457 -0
  218. package/themes/art-nouveau.css +459 -0
  219. package/themes/atelier.css +463 -0
  220. package/themes/bauhaus.css +461 -0
  221. package/themes/bloomberg-dense.css +463 -0
  222. package/themes/blueprint.css +457 -0
  223. package/themes/clay.css +449 -0
  224. package/themes/comic.css +453 -0
  225. package/themes/constructivist.css +457 -0
  226. package/themes/corporate.css +449 -0
  227. package/themes/cyberpunk.css +453 -0
  228. package/themes/frutiger-aero.css +458 -0
  229. package/themes/game-adventure.css +201 -0
  230. package/themes/game-rpg.css +203 -0
  231. package/themes/game-sci-fi.css +201 -0
  232. package/themes/game-ui-pack.css +200 -0
  233. package/themes/gazette.css +449 -0
  234. package/themes/glass.css +457 -0
  235. package/themes/gothic.css +453 -0
  236. package/themes/index.css +21 -0
  237. package/themes/ink-wash.css +459 -0
  238. package/themes/kawaii.css +459 -0
  239. package/themes/kflow.css +310 -0
  240. package/themes/kiosk.css +449 -0
  241. package/themes/linear-clean.css +463 -0
  242. package/themes/luxury.css +451 -0
  243. package/themes/mac-classic.css +455 -0
  244. package/themes/material.css +463 -0
  245. package/themes/memphis.css +453 -0
  246. package/themes/mid-century.css +455 -0
  247. package/themes/minimalist.css +449 -0
  248. package/themes/mudcloth.css +459 -0
  249. package/themes/nata.css +310 -0
  250. package/themes/neon.css +453 -0
  251. package/themes/neumorphic.css +451 -0
  252. package/themes/newsprint.css +455 -0
  253. package/themes/notion-editorial.css +463 -0
  254. package/themes/orb.css +465 -0
  255. package/themes/pixel.css +449 -0
  256. package/themes/prism.css +309 -0
  257. package/themes/rawi.css +310 -0
  258. package/themes/retro.css +452 -0
  259. package/themes/risograph.css +463 -0
  260. package/themes/scandi.css +469 -0
  261. package/themes/sketch.css +455 -0
  262. package/themes/solarpunk.css +469 -0
  263. package/themes/steampunk.css +451 -0
  264. package/themes/swiss.css +455 -0
  265. package/themes/terminal.css +466 -0
  266. package/themes/trait-wars.css +487 -0
  267. package/themes/ukiyo-e.css +459 -0
  268. package/themes/vaporwave.css +455 -0
  269. package/themes/victorian.css +453 -0
  270. package/themes/wabi-sabi.css +459 -0
  271. package/themes/win95.css +455 -0
  272. package/themes/wireframe.css +439 -0
  273. package/themes/zine.css +455 -0
  274. package/README.md +0 -3
@@ -0,0 +1,303 @@
1
+ import { STATE_COLORS } from './chunk-DFNZUYX4.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { isTypeVariable } from '@almadar/core';
4
+
5
+ var PERSISTENCE_STROKE = {
6
+ persistent: { strokeWidth: 2.5 },
7
+ runtime: { strokeDasharray: "6 3", strokeWidth: 2 }
8
+ };
9
+ var AvlEntity = ({
10
+ x = 0,
11
+ y = 0,
12
+ r = 18,
13
+ fieldCount = 0,
14
+ persistence = "persistent",
15
+ label,
16
+ color = "var(--color-primary)",
17
+ opacity = 1,
18
+ className
19
+ }) => {
20
+ const strokeProps = PERSISTENCE_STROKE[persistence];
21
+ const facets = Array.from({ length: fieldCount }, (_, i) => {
22
+ const angle = Math.PI * 2 * i / fieldCount - Math.PI / 2;
23
+ const innerR = r + 2;
24
+ const outerR = r + 10;
25
+ return {
26
+ x1: x + innerR * Math.cos(angle),
27
+ y1: y + innerR * Math.sin(angle),
28
+ x2: x + outerR * Math.cos(angle),
29
+ y2: y + outerR * Math.sin(angle)
30
+ };
31
+ });
32
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
33
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r, fill: color, opacity: 0.15 }),
34
+ /* @__PURE__ */ jsx(
35
+ "circle",
36
+ {
37
+ cx: x,
38
+ cy: y,
39
+ r,
40
+ fill: "none",
41
+ stroke: color,
42
+ strokeWidth: strokeProps.strokeWidth,
43
+ strokeDasharray: strokeProps.strokeDasharray
44
+ }
45
+ ),
46
+ facets.map((f, i) => /* @__PURE__ */ jsx(
47
+ "line",
48
+ {
49
+ x1: f.x1,
50
+ y1: f.y1,
51
+ x2: f.x2,
52
+ y2: f.y2,
53
+ stroke: color,
54
+ strokeWidth: 1,
55
+ opacity: 0.6
56
+ },
57
+ i
58
+ )),
59
+ label && /* @__PURE__ */ jsx(
60
+ "text",
61
+ {
62
+ x,
63
+ y: y + r + (fieldCount > 0 ? 18 : 14),
64
+ textAnchor: "middle",
65
+ fill: color,
66
+ fontSize: 10,
67
+ fontFamily: "inherit",
68
+ fontWeight: "bold",
69
+ children: label
70
+ }
71
+ )
72
+ ] });
73
+ };
74
+ AvlEntity.displayName = "AvlEntity";
75
+ var AvlPage = ({
76
+ x = 0,
77
+ y = 0,
78
+ size = 12,
79
+ label,
80
+ color = "var(--color-primary)",
81
+ opacity = 1,
82
+ className
83
+ }) => {
84
+ const half = size / 2;
85
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
86
+ /* @__PURE__ */ jsx(
87
+ "rect",
88
+ {
89
+ x: x - half,
90
+ y: y - half,
91
+ width: size,
92
+ height: size,
93
+ fill: color,
94
+ opacity: 0.3,
95
+ stroke: color,
96
+ strokeWidth: 1.5
97
+ }
98
+ ),
99
+ label && /* @__PURE__ */ jsx(
100
+ "text",
101
+ {
102
+ x,
103
+ y: y + half + 12,
104
+ textAnchor: "middle",
105
+ fill: color,
106
+ fontSize: 8,
107
+ fontFamily: "inherit",
108
+ children: label
109
+ }
110
+ )
111
+ ] });
112
+ };
113
+ AvlPage.displayName = "AvlPage";
114
+ function computeWidth(explicit, transitionCount) {
115
+ if (explicit != null) return explicit;
116
+ if (transitionCount == null) return 100;
117
+ if (transitionCount >= 5) return 160;
118
+ if (transitionCount >= 3) return 130;
119
+ return 100;
120
+ }
121
+ var AvlState = ({
122
+ x = 0,
123
+ y = 0,
124
+ name,
125
+ isInitial = false,
126
+ isTerminal = false,
127
+ width: explicitWidth,
128
+ height = 40,
129
+ color = "var(--color-primary)",
130
+ opacity = 1,
131
+ className,
132
+ role,
133
+ transitionCount
134
+ }) => {
135
+ const width = computeWidth(explicitWidth, transitionCount);
136
+ const rx = height / 2;
137
+ const roleColors = role ? STATE_COLORS[role] : null;
138
+ const fillColor = roleColors ? roleColors.fill : "none";
139
+ const strokeColor = roleColors ? roleColors.border : color;
140
+ const textColor = roleColors ? roleColors.border : color;
141
+ return /* @__PURE__ */ jsxs("g", { className, opacity, transform: `translate(${x},${y})`, children: [
142
+ isInitial && /* @__PURE__ */ jsx(
143
+ "circle",
144
+ {
145
+ cx: -16,
146
+ cy: height / 2,
147
+ r: 6,
148
+ fill: strokeColor
149
+ }
150
+ ),
151
+ isTerminal && /* @__PURE__ */ jsx(
152
+ "rect",
153
+ {
154
+ x: -4,
155
+ y: -4,
156
+ width: width + 8,
157
+ height: height + 8,
158
+ rx: rx + 4,
159
+ ry: rx + 4,
160
+ fill: "none",
161
+ stroke: strokeColor,
162
+ strokeWidth: 1,
163
+ opacity: 0.5
164
+ }
165
+ ),
166
+ /* @__PURE__ */ jsx(
167
+ "rect",
168
+ {
169
+ x: 0,
170
+ y: 0,
171
+ width,
172
+ height,
173
+ rx,
174
+ ry: rx,
175
+ fill: fillColor,
176
+ stroke: strokeColor,
177
+ strokeWidth: 2
178
+ }
179
+ ),
180
+ name && /* @__PURE__ */ jsx(
181
+ "text",
182
+ {
183
+ x: width / 2,
184
+ y: height / 2,
185
+ textAnchor: "middle",
186
+ dominantBaseline: "central",
187
+ fill: textColor,
188
+ fontSize: role ? 14 : 11,
189
+ fontWeight: role ? 600 : 400,
190
+ fontFamily: "inherit",
191
+ children: name
192
+ }
193
+ )
194
+ ] });
195
+ };
196
+ AvlState.displayName = "AvlState";
197
+ var FIELD_TYPE_SHAPES = {
198
+ string: "circle",
199
+ email: "circle",
200
+ url: "circle",
201
+ phone: "circle",
202
+ uuid: "circle",
203
+ field: "circle",
204
+ number: "triangle",
205
+ int: "triangle",
206
+ money: "triangle",
207
+ boolean: "square",
208
+ date: "diamond",
209
+ timestamp: "diamond",
210
+ datetime: "diamond",
211
+ instant: "diamond",
212
+ enum: "ring",
213
+ union: "ring",
214
+ object: "hexagon",
215
+ image: "hexagon",
216
+ file: "hexagon",
217
+ bytes: "hexagon",
218
+ trait: "hexagon",
219
+ orbital: "hexagon",
220
+ behavior: "hexagon",
221
+ slot: "hexagon",
222
+ pattern: "hexagon",
223
+ node: "hexagon",
224
+ event: "hexagon",
225
+ EventAddress: "hexagon",
226
+ CallKey: "hexagon",
227
+ SExpr: "hexagon",
228
+ array: "bars",
229
+ tuple: "bars",
230
+ relation: "link"
231
+ };
232
+ function fieldTypeShape(kind) {
233
+ return isTypeVariable(kind) ? "variable" : FIELD_TYPE_SHAPES[kind];
234
+ }
235
+ function drawShape(shape, x, y, s, color) {
236
+ switch (shape) {
237
+ case "circle":
238
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: color });
239
+ case "triangle":
240
+ return /* @__PURE__ */ jsx("polygon", { points: `${x},${y - s} ${x + s},${y + s * 0.7} ${x - s},${y + s * 0.7}`, fill: color });
241
+ case "square":
242
+ return /* @__PURE__ */ jsx("rect", { x: x - s * 0.8, y: y - s * 0.8, width: s * 1.6, height: s * 1.6, fill: color });
243
+ case "diamond":
244
+ return /* @__PURE__ */ jsx("polygon", { points: `${x},${y - s} ${x + s},${y} ${x},${y + s} ${x - s},${y}`, fill: color });
245
+ case "ring":
246
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 });
247
+ case "variable":
248
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5, strokeDasharray: "2 2" });
249
+ case "hexagon":
250
+ return /* @__PURE__ */ jsx(
251
+ "polygon",
252
+ {
253
+ points: Array.from({ length: 6 }, (_, i) => {
254
+ const a = Math.PI * 2 * i / 6 - Math.PI / 6;
255
+ return `${x + s * Math.cos(a)},${y + s * Math.sin(a)}`;
256
+ }).join(" "),
257
+ fill: color,
258
+ opacity: 0.8
259
+ }
260
+ );
261
+ case "bars":
262
+ return /* @__PURE__ */ jsxs("g", { children: [
263
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x + s, y2: y - s * 0.6, stroke: color, strokeWidth: 2 }),
264
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 2 }),
265
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y + s * 0.6, x2: x + s, y2: y + s * 0.6, stroke: color, strokeWidth: 2 })
266
+ ] });
267
+ case "link":
268
+ return /* @__PURE__ */ jsxs("g", { children: [
269
+ /* @__PURE__ */ jsx("circle", { cx: x - s * 0.45, cy: y, r: s * 0.55, fill: "none", stroke: color, strokeWidth: 1.5 }),
270
+ /* @__PURE__ */ jsx("circle", { cx: x + s * 0.45, cy: y, r: s * 0.55, fill: "none", stroke: color, strokeWidth: 1.5 })
271
+ ] });
272
+ }
273
+ }
274
+ var AvlFieldType = ({
275
+ x = 0,
276
+ y = 0,
277
+ kind,
278
+ size = 5,
279
+ label,
280
+ color = "var(--color-primary)",
281
+ opacity = 1,
282
+ className
283
+ }) => {
284
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
285
+ drawShape(fieldTypeShape(kind), x, y, size, color),
286
+ label && /* @__PURE__ */ jsx(
287
+ "text",
288
+ {
289
+ x,
290
+ y: y + size + 10,
291
+ textAnchor: "middle",
292
+ fill: color,
293
+ fontSize: 8,
294
+ fontFamily: "inherit",
295
+ opacity: 0.7,
296
+ children: label
297
+ }
298
+ )
299
+ ] });
300
+ };
301
+ AvlFieldType.displayName = "AvlFieldType";
302
+
303
+ export { AvlEntity, AvlFieldType, AvlPage, AvlState, FIELD_TYPE_SHAPES };
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+
19
+ export { __export, __reExport };
@@ -0,0 +1,199 @@
1
+ import { getStateRole } from './chunk-DFNZUYX4.js';
2
+ import { useState, useLayoutEffect } from 'react';
3
+
4
+ function useContainerWidth(ref) {
5
+ const [width, setWidth] = useState(null);
6
+ useLayoutEffect(() => {
7
+ const el = ref.current;
8
+ if (!el) return;
9
+ setWidth(el.clientWidth);
10
+ if (typeof ResizeObserver === "undefined") return;
11
+ const ro = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));
12
+ ro.observe(el);
13
+ return () => ro.disconnect();
14
+ }, [ref]);
15
+ return width;
16
+ }
17
+
18
+ // src/lib/avl-elk-layout.ts
19
+ function stateWidth(transitionCount) {
20
+ if (transitionCount >= 5) return 160;
21
+ if (transitionCount >= 3) return 130;
22
+ return 110;
23
+ }
24
+ var STATE_H = 40;
25
+ var elk;
26
+ function loadElk() {
27
+ elk ??= import('elkjs/lib/elk.bundled.js').then(({ default: Elk }) => new Elk());
28
+ return elk;
29
+ }
30
+ function flowOrder(data) {
31
+ const byName = new Map(data.states.map((s) => [s.name, s]));
32
+ const seen = /* @__PURE__ */ new Set();
33
+ const queue = data.states.filter((s) => s.isInitial).map((s) => s.name);
34
+ const out = [];
35
+ while (queue.length > 0) {
36
+ const name = queue.shift();
37
+ if (seen.has(name)) continue;
38
+ const state = byName.get(name);
39
+ if (!state) continue;
40
+ seen.add(name);
41
+ out.push(state);
42
+ for (const t of data.transitions) if (t.from === name && !seen.has(t.to)) queue.push(t.to);
43
+ }
44
+ for (const s of data.states) if (!seen.has(s.name)) out.push(s);
45
+ return out;
46
+ }
47
+ async function computeTraitLayout(data, metrics) {
48
+ const transitionCounts = {};
49
+ for (const s of data.states) transitionCounts[s.name] = 0;
50
+ for (const t of data.transitions) {
51
+ transitionCounts[t.from] = (transitionCounts[t.from] ?? 0) + 1;
52
+ transitionCounts[t.to] = (transitionCounts[t.to] ?? 0) + 1;
53
+ }
54
+ const maxTC = Math.max(...Object.values(transitionCounts), 0);
55
+ const LABEL_BASE_W = 100;
56
+ const LABEL_H = 44;
57
+ const states = metrics ? flowOrder(data) : data.states;
58
+ const elkGraph = {
59
+ id: "root",
60
+ layoutOptions: {
61
+ "elk.algorithm": "layered",
62
+ "elk.direction": metrics?.direction === "rtl" ? "LEFT" : "RIGHT",
63
+ "elk.spacing.nodeNode": String(metrics?.nodeSpacing ?? 80),
64
+ "elk.spacing.edgeNode": "30",
65
+ "elk.spacing.edgeEdge": "24",
66
+ "elk.spacing.edgeLabel": "10",
67
+ "elk.spacing.labelLabel": "8",
68
+ "elk.layered.spacing.nodeNodeBetweenLayers": String(metrics?.layerSpacing ?? 100),
69
+ ...metrics?.orthogonal ? { "elk.edgeRouting": "ORTHOGONAL" } : {},
70
+ ...metrics ? { "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES", "elk.layered.cycleBreaking.strategy": "MODEL_ORDER" } : {},
71
+ "elk.edgeLabels.placement": "CENTER",
72
+ "elk.layered.mergeEdges": "false",
73
+ "elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX"
74
+ },
75
+ children: states.map((s) => {
76
+ const tc = transitionCounts[s.name] ?? 0;
77
+ const size = metrics ? metrics.nodeSize(s.name) : { width: stateWidth(tc), height: STATE_H };
78
+ return {
79
+ id: s.name,
80
+ width: size.width,
81
+ height: size.height,
82
+ labels: [{ text: s.name, width: size.width - 10, height: 14 }],
83
+ ...metrics && s.isInitial ? { layoutOptions: { "elk.layered.layering.layerConstraint": "FIRST" } } : {}
84
+ };
85
+ }),
86
+ edges: data.transitions.map((t, i) => {
87
+ const textW = Math.max(t.event.length * 8, 60);
88
+ const iconsW = Math.min(t.effects.length, 6) * 28 + 20;
89
+ const label = metrics ? metrics.labelSize(t) : { width: Math.max(textW, iconsW, LABEL_BASE_W), height: LABEL_H };
90
+ return {
91
+ id: `e${i}`,
92
+ sources: [t.from],
93
+ targets: [t.to],
94
+ labels: [{
95
+ text: t.event,
96
+ width: label.width,
97
+ height: label.height,
98
+ ...metrics ? { layoutOptions: { "elk.edgeLabels.inline": "true" } } : {}
99
+ }]
100
+ };
101
+ })
102
+ };
103
+ const layout = await (await loadElk()).layout(elkGraph);
104
+ const layoutChildren = layout.children ?? [];
105
+ const layoutEdges = layout.edges ?? [];
106
+ const nodeXMap = {};
107
+ for (const n of layoutChildren) {
108
+ nodeXMap[n.id] = n.x ?? 0;
109
+ }
110
+ const nodes = layoutChildren.map((n) => {
111
+ const name = n.id;
112
+ const stateInfo = data.states.find((s) => s.name === name);
113
+ const tc = transitionCounts[name] ?? 0;
114
+ return {
115
+ id: name,
116
+ x: n.x ?? 0,
117
+ y: n.y ?? 0,
118
+ width: n.width ?? 110,
119
+ height: n.height ?? STATE_H,
120
+ isInitial: stateInfo?.isInitial ?? void 0,
121
+ isTerminal: stateInfo?.isTerminal ?? void 0,
122
+ role: getStateRole(stateInfo?.isInitial ?? void 0, stateInfo?.isTerminal ?? void 0, tc, maxTC),
123
+ transitionCount: tc
124
+ };
125
+ });
126
+ const edges = layoutEdges.map((e, i) => {
127
+ const t = data.transitions[i];
128
+ const labels = e.labels ?? [];
129
+ const label = labels[0];
130
+ const sections = e.sections ?? [];
131
+ const points = [];
132
+ for (const section of sections) {
133
+ const bendPoints = section.bendPoints ?? [];
134
+ points.push({ x: section.startPoint.x, y: section.startPoint.y });
135
+ for (const bp of bendPoints) points.push({ x: bp.x, y: bp.y });
136
+ points.push({ x: section.endPoint.x, y: section.endPoint.y });
137
+ }
138
+ const isSelf = t.from === t.to;
139
+ const toX = nodeXMap[t.to] ?? 0;
140
+ const fromX = nodeXMap[t.from] ?? 0;
141
+ const isBackward = !isSelf && (metrics?.direction === "rtl" ? toX >= fromX : toX <= fromX);
142
+ const lw = label?.width ?? LABEL_BASE_W;
143
+ const lh = label?.height ?? LABEL_H;
144
+ return {
145
+ id: e.id,
146
+ from: t.from,
147
+ to: t.to,
148
+ event: t.event,
149
+ effects: t.effects,
150
+ guard: !!t.guard,
151
+ guardExpr: typeof t.guard === "string" ? t.guard : void 0,
152
+ index: t.index,
153
+ labelX: label?.x ?? 0,
154
+ labelY: label?.y ?? 0,
155
+ labelW: lw,
156
+ labelH: lh,
157
+ points,
158
+ isSelf,
159
+ isBackward
160
+ };
161
+ });
162
+ return {
163
+ nodes,
164
+ edges,
165
+ width: layout.width ?? 600,
166
+ height: layout.height ?? 400
167
+ };
168
+ }
169
+ function roundedEdgePath(points, radius) {
170
+ if (points.length < 3) return edgePath(points);
171
+ let d = `M ${points[0].x},${points[0].y}`;
172
+ for (let i = 1; i < points.length - 1; i++) {
173
+ const prev = points[i - 1];
174
+ const cur = points[i];
175
+ const next = points[i + 1];
176
+ const inLen = Math.hypot(cur.x - prev.x, cur.y - prev.y);
177
+ const outLen = Math.hypot(next.x - cur.x, next.y - cur.y);
178
+ const r = Math.min(radius, inLen / 2, outLen / 2);
179
+ if (r <= 0) {
180
+ d += ` L ${cur.x},${cur.y}`;
181
+ continue;
182
+ }
183
+ const ax = cur.x - (cur.x - prev.x) / inLen * r;
184
+ const ay = cur.y - (cur.y - prev.y) / inLen * r;
185
+ const bx = cur.x + (next.x - cur.x) / outLen * r;
186
+ const by = cur.y + (next.y - cur.y) / outLen * r;
187
+ d += ` L ${ax},${ay} Q ${cur.x},${cur.y} ${bx},${by}`;
188
+ }
189
+ const last = points[points.length - 1];
190
+ return `${d} L ${last.x},${last.y}`;
191
+ }
192
+ function edgePath(points) {
193
+ if (points.length === 0) return "";
194
+ let d = `M ${points[0].x},${points[0].y}`;
195
+ for (let i = 1; i < points.length; i++) d += ` L ${points[i].x},${points[i].y}`;
196
+ return d;
197
+ }
198
+
199
+ export { computeTraitLayout, edgePath, roundedEdgePath, useContainerWidth };
@@ -0,0 +1,131 @@
1
+ import { FileTree } from './chunk-YDNJLLG6.js';
2
+ import { parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, traitTransitionRenderUi } from './chunk-VFF5OO47.js';
3
+ import { useMemo } from 'react';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ function isSExprObject(value) {
7
+ return value !== null && value !== void 0 && typeof value === "object" && !Array.isArray(value);
8
+ }
9
+ function normalizeChildren(children) {
10
+ if (children === void 0 || children === null) return [];
11
+ return Array.isArray(children) ? children : [children];
12
+ }
13
+ function distinguishingSuffix(config) {
14
+ if (typeof config.label === "string" && config.label.length > 0) return config.label;
15
+ if (typeof config.text === "string" && config.text.length > 0) return config.text;
16
+ if (typeof config.content === "string" && config.content.length > 0) return config.content;
17
+ return void 0;
18
+ }
19
+ function patternRowLabel(value) {
20
+ if (isSExprObject(value)) {
21
+ const type = typeof value.type === "string" ? value.type : "unknown";
22
+ const suffix = distinguishingSuffix(value);
23
+ return suffix ? `${type} \u2014 ${suffix}` : type;
24
+ }
25
+ return value === void 0 || value === null ? "unknown" : String(value);
26
+ }
27
+ function pushPatternRows(items, slotId, slotIndex, parentRowId, patternPath, config) {
28
+ const id = `${slotId}/pattern:${slotIndex}:${patternPath}`;
29
+ items.push({ id, label: patternRowLabel(config), parentId: parentRowId, icon: "component" });
30
+ if (!isSExprObject(config)) return;
31
+ normalizeChildren(config.children).forEach((child, index) => {
32
+ if (!isSExprObject(child)) return;
33
+ pushPatternRows(items, slotId, slotIndex, id, `${patternPath}.children.${index}`, child);
34
+ });
35
+ }
36
+ function schemaToLayerItems(schema) {
37
+ const items = [];
38
+ const seenSlotIds = /* @__PURE__ */ new Set();
39
+ for (const appOrbital of parseApplicationLevel(schema).orbitals) {
40
+ const orbitalId = `orbital:${appOrbital.name}`;
41
+ items.push({ id: orbitalId, label: appOrbital.name, icon: "box" });
42
+ const orbitalData = parseOrbitalLevel(schema, appOrbital.name);
43
+ if (!orbitalData) continue;
44
+ for (const page of orbitalData.pages) {
45
+ items.push({
46
+ id: `${orbitalId}/page:${page.name}`,
47
+ label: page.name,
48
+ parentId: orbitalId,
49
+ icon: "file-text"
50
+ });
51
+ }
52
+ for (const traitInfo of orbitalData.traits) {
53
+ const traitId = `${orbitalId}/trait:${traitInfo.name}`;
54
+ items.push({ id: traitId, label: traitInfo.name, parentId: orbitalId, icon: "git-branch" });
55
+ const traitData = parseTraitLevel(schema, appOrbital.name, traitInfo.name);
56
+ if (!traitData) continue;
57
+ const renderUi = traitTransitionRenderUi(schema, appOrbital.name, traitInfo.name);
58
+ traitData.transitions.forEach((transition, transitionIndex) => {
59
+ const transitionId = `${traitId}/transition:${transitionIndex}`;
60
+ items.push({
61
+ id: transitionId,
62
+ label: transition.event || `${transition.from} \u2192 ${transition.to}`,
63
+ parentId: traitId,
64
+ icon: "zap"
65
+ });
66
+ (renderUi[transitionIndex] ?? []).forEach((entry, slotIndex) => {
67
+ const slotName = entry.slot;
68
+ const slotId = `${transitionId}/slot:${slotName}`;
69
+ if (!seenSlotIds.has(slotId)) {
70
+ seenSlotIds.add(slotId);
71
+ items.push({ id: slotId, label: slotName, parentId: transitionId, icon: "layout-panel-top" });
72
+ }
73
+ pushPatternRows(items, slotId, slotIndex, slotId, "root", entry.pattern);
74
+ });
75
+ });
76
+ }
77
+ }
78
+ return items;
79
+ }
80
+ function parseLayerId(id) {
81
+ const [head, ...rest] = id.split("/");
82
+ const orbitalMatch = /^orbital:(.+)$/.exec(head ?? "");
83
+ if (!orbitalMatch) return null;
84
+ const parts = { orbitalName: orbitalMatch[1] };
85
+ for (const segment of rest) {
86
+ const pageMatch = /^page:(.+)$/.exec(segment);
87
+ if (pageMatch) {
88
+ parts.pageName = pageMatch[1];
89
+ continue;
90
+ }
91
+ const traitMatch = /^trait:(.+)$/.exec(segment);
92
+ if (traitMatch) {
93
+ parts.traitName = traitMatch[1];
94
+ continue;
95
+ }
96
+ const transitionMatch = /^transition:(\d+)$/.exec(segment);
97
+ if (transitionMatch) {
98
+ parts.transitionIndex = Number(transitionMatch[1]);
99
+ continue;
100
+ }
101
+ const slotMatch = /^slot:(.+)$/.exec(segment);
102
+ if (slotMatch) {
103
+ parts.slotName = slotMatch[1];
104
+ continue;
105
+ }
106
+ const patternMatch = /^pattern:(\d+):(.+)$/.exec(segment);
107
+ if (patternMatch) {
108
+ parts.patternSlotIndex = Number(patternMatch[1]);
109
+ parts.patternPath = patternMatch[2];
110
+ continue;
111
+ }
112
+ return null;
113
+ }
114
+ return parts;
115
+ }
116
+ var LayersPanel = ({ schema, selectedId, onSelect, onReorder }) => {
117
+ const items = useMemo(() => schemaToLayerItems(schema), [schema]);
118
+ return /* @__PURE__ */ jsx(
119
+ FileTree,
120
+ {
121
+ items,
122
+ look: "nav",
123
+ selectedId,
124
+ onNodeSelect: onSelect,
125
+ onNodeReorder: onReorder
126
+ }
127
+ );
128
+ };
129
+ LayersPanel.displayName = "LayersPanel";
130
+
131
+ export { LayersPanel, parseLayerId, schemaToLayerItems };