@almadar/shell-web 0.0.0-stage → 1.0.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 (266) hide show
  1. package/bundling.d.mts +18 -0
  2. package/bundling.mjs +28 -0
  3. package/dist/ArbitraryClassCompiler-CO_iASBn.d.ts +195 -0
  4. package/dist/AvlGlyph-EPJKFEO3.js +6 -0
  5. package/dist/AvlStateMachine-RKZIKNGC.js +9 -0
  6. package/dist/AvlTransitionDetail-63SD6GZF.js +11 -0
  7. package/dist/AvlTransitionExplainer-ZBTLOM3T.js +12 -0
  8. package/dist/BehaviorView-YS5G4GNB.js +11 -0
  9. package/dist/Canvas3DHost-BkZQB5l2.d.ts +552 -0
  10. package/dist/EventBusProvider-BFFHfN4O.d.ts +296 -0
  11. package/dist/FileTree-BCFnBEuQ.d.ts +254 -0
  12. package/dist/FlowCanvas-3JRMNJLV.css +1756 -0
  13. package/dist/FlowCanvas-AUMTWMNG.js +26 -0
  14. package/dist/GameAudioProvider-ceM_n0ey.d.ts +90 -0
  15. package/dist/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
  16. package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
  17. package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
  18. package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
  19. package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
  20. package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
  21. package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
  22. package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
  23. package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
  24. package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
  25. package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
  26. package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
  27. package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
  28. package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
  29. package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
  30. package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
  31. package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
  32. package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
  33. package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
  34. package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
  35. package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
  36. package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
  37. package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
  38. package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
  39. package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
  40. package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
  41. package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
  42. package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
  43. package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
  44. package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
  45. package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
  46. package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
  47. package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
  48. package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
  49. package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
  50. package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
  51. package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
  52. package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
  53. package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
  54. package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
  55. package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
  56. package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
  57. package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
  58. package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
  59. package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
  60. package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
  61. package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
  62. package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
  63. package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
  64. package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
  65. package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
  66. package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
  67. package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
  68. package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
  69. package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
  70. package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
  71. package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
  72. package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
  73. package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
  74. package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
  75. package/dist/KernelEngineContext-CcxGYtlr.d.ts +33 -0
  76. package/dist/LayersPanel-M2LHWUFF.js +6 -0
  77. package/dist/ModuleCard-QHDGK5XK.js +7 -0
  78. package/dist/OrbInspector-MHLJ6OEE.css +1756 -0
  79. package/dist/OrbInspector-QCPEPUPH.js +26 -0
  80. package/dist/Select-B-iDdnvE.d.ts +185 -0
  81. package/dist/ServerBridge-Bqsj-lOU.d.ts +124 -0
  82. package/dist/ThemeContext-DJmO59xd.d.ts +147 -0
  83. package/dist/UISlotContext-Dl_ewwCI.d.ts +79 -0
  84. package/dist/UISlotRenderer-C7WWOK43.js +26 -0
  85. package/dist/UISlotRenderer-KVFO6J7R.css +1756 -0
  86. package/dist/auth/browser/index.d.ts +2 -0
  87. package/dist/auth/browser/index.js +2 -0
  88. package/dist/auth/react/index.d.ts +56 -0
  89. package/dist/auth/react/index.js +157 -0
  90. package/dist/avl/index.css +1756 -0
  91. package/dist/avl/index.d.ts +2248 -0
  92. package/dist/avl/index.js +2693 -0
  93. package/dist/avl-3d-context-BycmO6tG.d.ts +201 -0
  94. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +132 -0
  95. package/dist/avl-zoom-state-CKMVuBFg.d.ts +17 -0
  96. package/dist/chunk-3BBUBJFF.js +339 -0
  97. package/dist/chunk-3S54FWRC.js +131 -0
  98. package/dist/chunk-3VZ36ZKO.js +775 -0
  99. package/dist/chunk-4T3P43NS.js +1133 -0
  100. package/dist/chunk-4YXBKHHM.js +11488 -0
  101. package/dist/chunk-57DC34LY.js +525 -0
  102. package/dist/chunk-5QTYQTPS.js +15 -0
  103. package/dist/chunk-A2LR6VQQ.js +349 -0
  104. package/dist/chunk-AB3X7QTE.js +505 -0
  105. package/dist/chunk-AE7VCQB6.js +561 -0
  106. package/dist/chunk-AGXD77SL.js +98 -0
  107. package/dist/chunk-AU7O65OX.js +66 -0
  108. package/dist/chunk-CPLN6NBQ.js +701 -0
  109. package/dist/chunk-DZBQA2OW.js +176 -0
  110. package/dist/chunk-E6KA4J6N.js +227 -0
  111. package/dist/chunk-EOWMARUB.js +16 -0
  112. package/dist/chunk-G7DCAZ22.js +19 -0
  113. package/dist/chunk-GFXCPUMX.js +1334 -0
  114. package/dist/chunk-HH5KSMH5.js +311 -0
  115. package/dist/chunk-ILQXJ2AR.js +280 -0
  116. package/dist/chunk-ILZ7ORX7.js +432 -0
  117. package/dist/chunk-K4MOPSEL.js +674 -0
  118. package/dist/chunk-LHP2TK7O.js +47587 -0
  119. package/dist/chunk-P4ZFUQFF.js +93 -0
  120. package/dist/chunk-PCR37T3U.js +296 -0
  121. package/dist/chunk-PRXQGGCO.js +580 -0
  122. package/dist/chunk-REXYVBUO.js +191 -0
  123. package/dist/chunk-ROICKAU7.js +24 -0
  124. package/dist/chunk-SP5CDJ6K.js +338 -0
  125. package/dist/chunk-TUPZWTRE.js +1051 -0
  126. package/dist/chunk-TXAUOLWZ.js +490 -0
  127. package/dist/chunk-TZZBINQY.js +82 -0
  128. package/dist/chunk-UTDC2NEA.js +14 -0
  129. package/dist/chunk-UU57VNS2.js +1053 -0
  130. package/dist/chunk-UXLE3IPR.js +421 -0
  131. package/dist/chunk-VO2TTLS5.js +94 -0
  132. package/dist/chunk-X3DMMX27.js +11 -0
  133. package/dist/chunk-YHMRX6YA.js +455 -0
  134. package/dist/components/index.css +1756 -0
  135. package/dist/components/index.d.ts +11299 -0
  136. package/dist/components/index.js +1110 -0
  137. package/dist/context/index.d.ts +8 -0
  138. package/dist/context/index.js +8 -0
  139. package/dist/core.d.ts +2599 -0
  140. package/dist/core.js +3 -0
  141. package/dist/design-classes/index.cjs +431 -0
  142. package/dist/design-classes/index.d.cts +165 -0
  143. package/dist/design-classes/index.d.ts +165 -0
  144. package/dist/design-classes/index.js +399 -0
  145. package/dist/emojiItems-QGSNAABW.js +20 -0
  146. package/dist/fx-CmQjnHmT.d.ts +371 -0
  147. package/dist/hooks/index.d.ts +971 -0
  148. package/dist/hooks/index.js +8 -0
  149. package/dist/index.d.ts +408 -0
  150. package/dist/index.js +178 -0
  151. package/dist/katexPlugin-FA7NX4PE.css +1161 -0
  152. package/dist/katexPlugin-NCDKOOQY.js +2 -0
  153. package/dist/kernel-client-TZKGHJRY.js +516 -0
  154. package/dist/kernel-wire-wNdAPfhJ.d.ts +88 -0
  155. package/dist/lib/index.d.ts +602 -0
  156. package/dist/lib/index.js +1289 -0
  157. package/dist/paintDispatch-CuJLsr9Y.d.ts +688 -0
  158. package/dist/parseLessonSegments-GpCeMrb2.d.ts +334 -0
  159. package/dist/perf-CKiBKbkw.d.ts +22 -0
  160. package/dist/perf-Dr28-AgT.d.ts +57 -0
  161. package/dist/prism-X5YWKXO5.js +136 -0
  162. package/dist/providers/index.css +1756 -0
  163. package/dist/providers/index.d.ts +355 -0
  164. package/dist/providers/index.js +29 -0
  165. package/dist/renderer/index.d.ts +465 -0
  166. package/dist/renderer/index.js +4 -0
  167. package/dist/runtime/index.css +1756 -0
  168. package/dist/runtime/index.d.ts +239 -0
  169. package/dist/runtime/index.js +28 -0
  170. package/dist/slot-host-CPzrxLo9.d.ts +48 -0
  171. package/dist/ssr/index.cjs +9739 -0
  172. package/dist/ssr/index.d.cts +464 -0
  173. package/dist/ssr/index.d.ts +464 -0
  174. package/dist/ssr/index.js +9703 -0
  175. package/dist/storage/browser/index.d.ts +1 -0
  176. package/dist/storage/browser/index.js +2 -0
  177. package/dist/test-support.d.ts +42 -0
  178. package/dist/test-support.js +181 -0
  179. package/dist/themeTokens-CRd8AEDF.d.ts +125 -0
  180. package/dist/three/index.css +503 -0
  181. package/dist/three/index.d.ts +1185 -0
  182. package/dist/three/index.js +3908 -0
  183. package/dist/useUISlots-CiobNFGb.d.ts +211 -0
  184. package/dist/verification-C5pTeMJv.d.ts +66 -0
  185. package/dist/verificationRegistry-CVrcxG1s.d.ts +122 -0
  186. package/dist/wrapCallbackForEvent-B9QLbhxX.d.ts +19 -0
  187. package/index.css +199 -0
  188. package/package.json +273 -3
  189. package/src/core/lib/band-shapes.json +7 -0
  190. package/src/core/locales/ar.json +1276 -0
  191. package/src/core/locales/en.json +1276 -0
  192. package/src/core/locales/index.ts +54 -0
  193. package/src/core/locales/sl.json +1276 -0
  194. package/src/core/tokens/native-tokens.json +369 -0
  195. package/tailwind-compile.cjs +29 -0
  196. package/tailwind-preset.cjs +1020 -0
  197. package/themes/_base.css +451 -0
  198. package/themes/_contract.md +307 -0
  199. package/themes/_fonts-kenney.css +11 -0
  200. package/themes/_fonts.css +12 -0
  201. package/themes/_foundation.css +105 -0
  202. package/themes/_head.css +22 -0
  203. package/themes/_presets.css +67 -0
  204. package/themes/almadar-heritage.css +455 -0
  205. package/themes/almadar-website.css +269 -0
  206. package/themes/almadar.css +269 -0
  207. package/themes/aqua.css +455 -0
  208. package/themes/arabesque.css +459 -0
  209. package/themes/art-deco.css +457 -0
  210. package/themes/art-nouveau.css +459 -0
  211. package/themes/atelier.css +463 -0
  212. package/themes/bauhaus.css +461 -0
  213. package/themes/bloomberg-dense.css +463 -0
  214. package/themes/blueprint.css +457 -0
  215. package/themes/clay.css +449 -0
  216. package/themes/comic.css +453 -0
  217. package/themes/constructivist.css +457 -0
  218. package/themes/corporate.css +449 -0
  219. package/themes/cyberpunk.css +453 -0
  220. package/themes/frutiger-aero.css +458 -0
  221. package/themes/game-adventure.css +201 -0
  222. package/themes/game-rpg.css +203 -0
  223. package/themes/game-sci-fi.css +201 -0
  224. package/themes/game-ui-pack.css +200 -0
  225. package/themes/gazette.css +449 -0
  226. package/themes/glass.css +457 -0
  227. package/themes/gothic.css +453 -0
  228. package/themes/index.css +21 -0
  229. package/themes/ink-wash.css +459 -0
  230. package/themes/kawaii.css +459 -0
  231. package/themes/kflow.css +310 -0
  232. package/themes/kiosk.css +449 -0
  233. package/themes/linear-clean.css +463 -0
  234. package/themes/luxury.css +451 -0
  235. package/themes/mac-classic.css +455 -0
  236. package/themes/material.css +463 -0
  237. package/themes/memphis.css +453 -0
  238. package/themes/mid-century.css +455 -0
  239. package/themes/minimalist.css +449 -0
  240. package/themes/mudcloth.css +459 -0
  241. package/themes/nata.css +310 -0
  242. package/themes/neon.css +453 -0
  243. package/themes/neumorphic.css +451 -0
  244. package/themes/newsprint.css +455 -0
  245. package/themes/notion-editorial.css +463 -0
  246. package/themes/orb.css +465 -0
  247. package/themes/pixel.css +449 -0
  248. package/themes/prism.css +309 -0
  249. package/themes/rawi.css +310 -0
  250. package/themes/retro.css +452 -0
  251. package/themes/risograph.css +463 -0
  252. package/themes/scandi.css +469 -0
  253. package/themes/sketch.css +455 -0
  254. package/themes/solarpunk.css +469 -0
  255. package/themes/steampunk.css +451 -0
  256. package/themes/swiss.css +455 -0
  257. package/themes/terminal.css +466 -0
  258. package/themes/trait-wars.css +487 -0
  259. package/themes/ukiyo-e.css +459 -0
  260. package/themes/vaporwave.css +455 -0
  261. package/themes/victorian.css +453 -0
  262. package/themes/wabi-sabi.css +459 -0
  263. package/themes/win95.css +455 -0
  264. package/themes/wireframe.css +439 -0
  265. package/themes/zine.css +455 -0
  266. package/README.md +0 -3
@@ -0,0 +1,311 @@
1
+ import { STATE_COLORS } from './chunk-UXLE3IPR.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
+ i8: "triangle",
208
+ i16: "triangle",
209
+ i32: "triangle",
210
+ u8: "triangle",
211
+ u16: "triangle",
212
+ u32: "triangle",
213
+ u64: "triangle",
214
+ f32: "triangle",
215
+ boolean: "square",
216
+ date: "diamond",
217
+ timestamp: "diamond",
218
+ datetime: "diamond",
219
+ instant: "diamond",
220
+ enum: "ring",
221
+ union: "ring",
222
+ object: "hexagon",
223
+ image: "hexagon",
224
+ file: "hexagon",
225
+ bytes: "hexagon",
226
+ trait: "hexagon",
227
+ orbital: "hexagon",
228
+ behavior: "hexagon",
229
+ slot: "hexagon",
230
+ pattern: "hexagon",
231
+ node: "hexagon",
232
+ event: "hexagon",
233
+ EventAddress: "hexagon",
234
+ CallKey: "hexagon",
235
+ SExpr: "hexagon",
236
+ array: "bars",
237
+ tuple: "bars",
238
+ relation: "link"
239
+ };
240
+ function fieldTypeShape(kind) {
241
+ return isTypeVariable(kind) ? "variable" : FIELD_TYPE_SHAPES[kind];
242
+ }
243
+ function drawShape(shape, x, y, s, color) {
244
+ switch (shape) {
245
+ case "circle":
246
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: color });
247
+ case "triangle":
248
+ return /* @__PURE__ */ jsx("polygon", { points: `${x},${y - s} ${x + s},${y + s * 0.7} ${x - s},${y + s * 0.7}`, fill: color });
249
+ case "square":
250
+ return /* @__PURE__ */ jsx("rect", { x: x - s * 0.8, y: y - s * 0.8, width: s * 1.6, height: s * 1.6, fill: color });
251
+ case "diamond":
252
+ return /* @__PURE__ */ jsx("polygon", { points: `${x},${y - s} ${x + s},${y} ${x},${y + s} ${x - s},${y}`, fill: color });
253
+ case "ring":
254
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 });
255
+ case "variable":
256
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5, strokeDasharray: "2 2" });
257
+ case "hexagon":
258
+ return /* @__PURE__ */ jsx(
259
+ "polygon",
260
+ {
261
+ points: Array.from({ length: 6 }, (_, i) => {
262
+ const a = Math.PI * 2 * i / 6 - Math.PI / 6;
263
+ return `${x + s * Math.cos(a)},${y + s * Math.sin(a)}`;
264
+ }).join(" "),
265
+ fill: color,
266
+ opacity: 0.8
267
+ }
268
+ );
269
+ case "bars":
270
+ return /* @__PURE__ */ jsxs("g", { children: [
271
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x + s, y2: y - s * 0.6, stroke: color, strokeWidth: 2 }),
272
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 2 }),
273
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y + s * 0.6, x2: x + s, y2: y + s * 0.6, stroke: color, strokeWidth: 2 })
274
+ ] });
275
+ case "link":
276
+ return /* @__PURE__ */ jsxs("g", { children: [
277
+ /* @__PURE__ */ jsx("circle", { cx: x - s * 0.45, cy: y, r: s * 0.55, fill: "none", stroke: color, strokeWidth: 1.5 }),
278
+ /* @__PURE__ */ jsx("circle", { cx: x + s * 0.45, cy: y, r: s * 0.55, fill: "none", stroke: color, strokeWidth: 1.5 })
279
+ ] });
280
+ }
281
+ }
282
+ var AvlFieldType = ({
283
+ x = 0,
284
+ y = 0,
285
+ kind,
286
+ size = 5,
287
+ label,
288
+ color = "var(--color-primary)",
289
+ opacity = 1,
290
+ className
291
+ }) => {
292
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
293
+ drawShape(fieldTypeShape(kind), x, y, size, color),
294
+ label && /* @__PURE__ */ jsx(
295
+ "text",
296
+ {
297
+ x,
298
+ y: y + size + 10,
299
+ textAnchor: "middle",
300
+ fill: color,
301
+ fontSize: 8,
302
+ fontFamily: "inherit",
303
+ opacity: 0.7,
304
+ children: label
305
+ }
306
+ )
307
+ ] });
308
+ };
309
+ AvlFieldType.displayName = "AvlFieldType";
310
+
311
+ export { AvlEntity, AvlFieldType, AvlPage, AvlState, FIELD_TYPE_SHAPES };
@@ -0,0 +1,280 @@
1
+ import { cn, Typography, useTranslate, VStack, HStack, Icon, Button, Switch, Input } from './chunk-4YXBKHHM.js';
2
+ import React from 'react';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ var isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
6
+ var isArr = (v) => Array.isArray(v);
7
+ function kindOf(v) {
8
+ if (v === null) return "null";
9
+ if (isArr(v)) return "array";
10
+ if (isObj(v)) return "object";
11
+ if (typeof v === "number") return "number";
12
+ if (typeof v === "boolean") return "boolean";
13
+ return "string";
14
+ }
15
+ var TYPE_LABEL_KEY = {
16
+ string: "jsonTree.type.text",
17
+ number: "jsonTree.type.number",
18
+ boolean: "jsonTree.type.boolean"
19
+ };
20
+ var TYPE_LABEL_SYMBOL = {
21
+ object: "{}",
22
+ array: "[]",
23
+ null: "\u2014"
24
+ };
25
+ function typeLabel(kind, t) {
26
+ if (kind === "object" || kind === "array" || kind === "null") return TYPE_LABEL_SYMBOL[kind];
27
+ return t(TYPE_LABEL_KEY[kind] ?? "");
28
+ }
29
+ var KIND_OPTIONS = ["string", "number", "boolean", "object", "array"];
30
+ function emptyOf(kind) {
31
+ switch (kind) {
32
+ case "object":
33
+ return {};
34
+ case "array":
35
+ return [];
36
+ case "number":
37
+ return 0;
38
+ case "boolean":
39
+ return false;
40
+ case "null":
41
+ return null;
42
+ default:
43
+ return "";
44
+ }
45
+ }
46
+ function templateFrom(arr) {
47
+ if (arr.length === 0) return "";
48
+ const first = arr[0];
49
+ if (isObj(first)) {
50
+ const blank = {};
51
+ for (const k of Object.keys(first)) blank[k] = isObj(first[k]) ? {} : isArr(first[k]) ? [] : first[k];
52
+ return blank;
53
+ }
54
+ if (isArr(first)) return [];
55
+ return emptyOf(kindOf(first));
56
+ }
57
+ function ScalarControl({
58
+ value,
59
+ onChange
60
+ }) {
61
+ if (typeof value === "boolean") {
62
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onChange(c) });
63
+ }
64
+ const numeric = typeof value === "number";
65
+ const initial = value === null ? "" : String(value);
66
+ const [draft, setDraft] = React.useState(initial);
67
+ React.useEffect(() => setDraft(initial), [initial]);
68
+ const commit = () => {
69
+ if (numeric) {
70
+ const n = draft.trim() === "" ? 0 : Number(draft);
71
+ onChange(Number.isNaN(n) ? 0 : n);
72
+ } else {
73
+ onChange(draft);
74
+ }
75
+ };
76
+ return /* @__PURE__ */ jsx(
77
+ Input,
78
+ {
79
+ inputType: numeric ? "number" : "text",
80
+ value: draft,
81
+ placeholder: value === null ? "null" : void 0,
82
+ onChange: (e) => setDraft(e.target.value),
83
+ onBlur: commit,
84
+ onKeyDown: (e) => {
85
+ if (e.key === "Enter") commit();
86
+ }
87
+ }
88
+ );
89
+ }
90
+ function KindSelect({
91
+ kind,
92
+ onChange
93
+ }) {
94
+ const { t } = useTranslate();
95
+ return /* @__PURE__ */ jsx(
96
+ "select",
97
+ {
98
+ value: kind === "null" ? "string" : kind,
99
+ onChange: (e) => onChange(e.target.value),
100
+ "aria-label": t("jsonTree.valueType"),
101
+ className: cn(
102
+ "h-6 rounded-interactive bg-muted text-muted-foreground text-[10px] font-mono px-1",
103
+ "border-[length:var(--border-width-thin)] border-border",
104
+ "hover:bg-card focus:outline-none focus:ring-1 focus:ring-ring"
105
+ ),
106
+ children: KIND_OPTIONS.map((k) => /* @__PURE__ */ jsx("option", { value: k, children: typeLabel(k, t) }, k))
107
+ }
108
+ );
109
+ }
110
+ function ValueNode({
111
+ value,
112
+ onChange,
113
+ depth,
114
+ readonly
115
+ }) {
116
+ const kind = kindOf(value);
117
+ if (kind === "object" || kind === "array") {
118
+ return /* @__PURE__ */ jsx(ContainerNode, { value, onChange, depth, readonly });
119
+ }
120
+ if (readonly) {
121
+ return /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-mono text-foreground", children: value === null ? "null" : String(value) });
122
+ }
123
+ return /* @__PURE__ */ jsx(ScalarControl, { value, onChange });
124
+ }
125
+ function Row({
126
+ rowKey,
127
+ isArrayItem,
128
+ value,
129
+ depth,
130
+ onValue,
131
+ onRenameKey,
132
+ onChangeKind,
133
+ onRemove,
134
+ readonly
135
+ }) {
136
+ const { t } = useTranslate();
137
+ const [keyDraft, setKeyDraft] = React.useState(rowKey);
138
+ React.useEffect(() => setKeyDraft(rowKey), [rowKey]);
139
+ const container = isObj(value) || isArr(value);
140
+ return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "group w-max min-w-full", children: [
141
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className: "py-0.5 w-max", children: [
142
+ readonly ? /* @__PURE__ */ jsx("span", { className: cn(
143
+ "h-6 rounded-interactive bg-muted text-muted-foreground text-[10px] font-mono px-1 flex items-center",
144
+ "border-[length:var(--border-width-thin)] border-border"
145
+ ), children: typeLabel(kindOf(value), t) }) : /* @__PURE__ */ jsx(KindSelect, { kind: kindOf(value), onChange: onChangeKind }),
146
+ isArrayItem ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "w-6 shrink-0 font-mono", children: rowKey }) : readonly ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "w-20 shrink-0 font-mono truncate", children: rowKey }) : /* @__PURE__ */ jsx("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ jsx(
147
+ Input,
148
+ {
149
+ inputType: "text",
150
+ value: keyDraft,
151
+ onChange: (e) => setKeyDraft(e.target.value),
152
+ onBlur: () => keyDraft !== rowKey && onRenameKey(keyDraft),
153
+ onKeyDown: (e) => {
154
+ if (e.key === "Enter" && keyDraft !== rowKey) onRenameKey(keyDraft);
155
+ },
156
+ className: "font-mono"
157
+ }
158
+ ) }),
159
+ !container && /* @__PURE__ */ jsx("div", { className: "w-48 shrink-0", children: /* @__PURE__ */ jsx(ValueNode, { value, onChange: onValue, depth: depth + 1, readonly }) }),
160
+ !readonly && /* @__PURE__ */ jsx(
161
+ Button,
162
+ {
163
+ variant: "ghost",
164
+ size: "sm",
165
+ icon: "x",
166
+ onClick: onRemove,
167
+ "aria-label": t("common.remove"),
168
+ className: "shrink-0 text-muted-foreground hover:text-error"
169
+ }
170
+ )
171
+ ] }),
172
+ container && /* @__PURE__ */ jsx("div", { className: "pl-2", children: /* @__PURE__ */ jsx(ValueNode, { value, onChange: onValue, depth: depth + 1, readonly }) })
173
+ ] });
174
+ }
175
+ function ContainerNode({
176
+ value,
177
+ onChange,
178
+ depth,
179
+ readonly
180
+ }) {
181
+ const { t } = useTranslate();
182
+ const [open, setOpen] = React.useState(depth < 2);
183
+ const array = isArr(value);
184
+ const entries = array ? value.map((v, i) => [String(i), v]) : Object.entries(value);
185
+ const setObjValue = (key, next) => {
186
+ onChange({ ...value, [key]: next });
187
+ };
188
+ const renameKey = (oldKey, newKey) => {
189
+ if (!newKey || newKey === oldKey) return;
190
+ const out = {};
191
+ for (const [k, v] of Object.entries(value)) out[k === oldKey ? newKey : k] = v;
192
+ onChange(out);
193
+ };
194
+ const removeObjKey = (key) => {
195
+ const out = {};
196
+ for (const [k, v] of Object.entries(value)) if (k !== key) out[k] = v;
197
+ onChange(out);
198
+ };
199
+ const changeObjKind = (key, k) => setObjValue(key, emptyOf(k));
200
+ const setArrValue = (idx, next) => {
201
+ const copy = [...value];
202
+ copy[idx] = next;
203
+ onChange(copy);
204
+ };
205
+ const removeArrIdx = (idx) => onChange(value.filter((_, i) => i !== idx));
206
+ const changeArrKind = (idx, k) => setArrValue(idx, emptyOf(k));
207
+ const add = () => {
208
+ if (array) {
209
+ onChange([...value, templateFrom(value)]);
210
+ } else {
211
+ const obj = value;
212
+ let key = "key";
213
+ let n = 1;
214
+ while (key in obj) {
215
+ key = `key${n}`;
216
+ n += 1;
217
+ }
218
+ onChange({ ...obj, [key]: "" });
219
+ }
220
+ };
221
+ const summaryKey = array ? entries.length === 1 ? "jsonTree.itemCountOne" : "jsonTree.itemCountOther" : entries.length === 1 ? "jsonTree.fieldCountOne" : "jsonTree.fieldCountOther";
222
+ const summary = t(summaryKey, { count: entries.length });
223
+ return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "w-full", children: [
224
+ /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: /* @__PURE__ */ jsxs(
225
+ "button",
226
+ {
227
+ type: "button",
228
+ onClick: () => setOpen((o) => !o),
229
+ className: "flex items-center gap-1 text-muted-foreground hover:text-foreground",
230
+ "aria-label": open ? t("jsonTree.collapse") : t("jsonTree.expand"),
231
+ children: [
232
+ /* @__PURE__ */ jsx(Icon, { name: open ? "chevron-down" : "chevron-right", size: "sm" }),
233
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: array ? "[ ]" : "{ }" }),
234
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: summary })
235
+ ]
236
+ }
237
+ ) }),
238
+ open && /* @__PURE__ */ jsxs(
239
+ VStack,
240
+ {
241
+ gap: "none",
242
+ className: cn("ml-1.5 pl-1.5 w-max min-w-full border-l-[length:var(--border-width-thin)] border-border"),
243
+ children: [
244
+ entries.map(([k, v], idx) => /* @__PURE__ */ jsx(
245
+ Row,
246
+ {
247
+ rowKey: k,
248
+ isArrayItem: array,
249
+ value: v,
250
+ depth,
251
+ onValue: (next) => array ? setArrValue(idx, next) : setObjValue(k, next),
252
+ onRenameKey: (nk) => renameKey(k, nk),
253
+ onChangeKind: (kind) => array ? changeArrKind(idx, kind) : changeObjKind(k, kind),
254
+ onRemove: () => array ? removeArrIdx(idx) : removeObjKey(k),
255
+ readonly
256
+ },
257
+ array ? idx : k
258
+ )),
259
+ !readonly && /* @__PURE__ */ jsx(
260
+ Button,
261
+ {
262
+ variant: "ghost",
263
+ size: "sm",
264
+ icon: "plus",
265
+ label: array ? t("jsonTree.addItem") : t("jsonTree.addField"),
266
+ onClick: add,
267
+ className: "self-start text-muted-foreground"
268
+ }
269
+ )
270
+ ]
271
+ }
272
+ )
273
+ ] });
274
+ }
275
+ var JsonTreeEditor = ({ value, onChange, className, readonly }) => {
276
+ const root = value ?? "";
277
+ return /* @__PURE__ */ jsx("div", { className: cn("w-full overflow-x-auto rounded-container bg-card/40 p-2 border-[length:var(--border-width-thin)] border-border", className), children: /* @__PURE__ */ jsx(ValueNode, { value: root, onChange, depth: 0, readonly }) });
278
+ };
279
+
280
+ export { JsonTreeEditor };