@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,280 @@
1
+ import { cn, Typography, useTranslate, VStack, HStack, Icon, Button, Switch, Input } from './chunk-MBQAMMSE.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 };
@@ -0,0 +1,319 @@
1
+ import { routing_exports } from './chunk-DYEKAA4L.js';
2
+ import { renderUiEntriesOf } from '@almadar/core/patterns';
3
+ import { isInlineTrait } from '@almadar/core';
4
+
5
+ function instanceOf(orbital, orbitalId, ref) {
6
+ const at = orbitalId === void 0 ? { orbital } : { orbital, orbitalId };
7
+ if (isInlineTrait(ref)) return { ...at, name: ref.name, trait: ref };
8
+ if (typeof ref === "object" && ref._resolved) return { ...at, name: ref.name ?? ref._resolved.name, trait: ref._resolved };
9
+ return null;
10
+ }
11
+ var wiresBySchema = /* @__PURE__ */ new WeakMap();
12
+ function traitEventWires(schema) {
13
+ const cached = wiresBySchema.get(schema);
14
+ if (cached) return cached;
15
+ const instances = (schema.orbitals ?? []).flatMap(
16
+ (o) => (o.traits ?? []).map((ref) => instanceOf(o.name, o.id, ref)).filter((i) => i !== null)
17
+ );
18
+ const listensByEvent = /* @__PURE__ */ new Map();
19
+ for (const listener of instances) {
20
+ for (const listen of listener.trait.listens ?? []) {
21
+ const { bareEvent, matcher } = (0, routing_exports.parseListenSource)(listen, listener.orbital);
22
+ const bucket = listensByEvent.get(bareEvent);
23
+ if (bucket) bucket.push({ listener, matcher });
24
+ else listensByEvent.set(bareEvent, [{ listener, matcher }]);
25
+ }
26
+ }
27
+ const wires = [];
28
+ for (const emitter of instances) {
29
+ const source = { orbital: emitter.orbital, trait: emitter.name, ...emitter.orbitalId ? { orbitalId: emitter.orbitalId } : {}, ...emitter.trait.id ? { traitId: emitter.trait.id } : {} };
30
+ for (const emit of emitter.trait.emits ?? []) {
31
+ for (const { listener, matcher } of listensByEvent.get(emit.event) ?? []) {
32
+ if (listener.orbital === emitter.orbital && listener.name === emitter.name) continue;
33
+ if (!matcher(source)) continue;
34
+ wires.push({
35
+ emitterOrbital: emitter.orbital,
36
+ emitterTrait: emitter.name,
37
+ listenerOrbital: listener.orbital,
38
+ listenerTrait: listener.name,
39
+ event: emit.event
40
+ });
41
+ }
42
+ }
43
+ }
44
+ wiresBySchema.set(schema, wires);
45
+ return wires;
46
+ }
47
+
48
+ // src/lib/avl-schema-parser.ts
49
+ function getEntity(orbital) {
50
+ const entity = orbital.entity;
51
+ if (typeof entity === "string") {
52
+ return { name: entity, fields: [], persistence: "runtime" };
53
+ }
54
+ if ("extends" in entity) {
55
+ const ec = entity;
56
+ return {
57
+ name: ec.name ?? orbital.name,
58
+ fields: ec.fields ?? [],
59
+ persistence: ec.persistence ?? "runtime"
60
+ };
61
+ }
62
+ const e = entity;
63
+ return {
64
+ name: e.name,
65
+ fields: e.fields ?? [],
66
+ persistence: e.persistence ?? "runtime"
67
+ };
68
+ }
69
+ function getTraits(orbital) {
70
+ if (!orbital.traits) return [];
71
+ return orbital.traits.map((t) => {
72
+ if (typeof t === "string") return { name: t };
73
+ if ("ref" in t && !("stateMachine" in t)) return { name: t.name ?? t.ref };
74
+ return t;
75
+ });
76
+ }
77
+ function getPages(orbital) {
78
+ if (!orbital.pages) return [];
79
+ return orbital.pages.map((p) => {
80
+ if (typeof p === "string") return { name: p, path: `/${p.toLowerCase()}` };
81
+ if ("ref" in p && !("path" in p)) return { name: p.ref, path: `/${p.ref.toLowerCase()}` };
82
+ return p;
83
+ });
84
+ }
85
+ function getStateMachine(trait) {
86
+ return trait.stateMachine ?? null;
87
+ }
88
+ function getStates(sm) {
89
+ return sm.states ?? [];
90
+ }
91
+ function getTransitions(sm) {
92
+ return sm.transitions ?? [];
93
+ }
94
+ function getEvents(sm) {
95
+ return sm.events ?? [];
96
+ }
97
+ function getEmits(trait) {
98
+ const emits = trait.emits;
99
+ if (!emits) return [];
100
+ return emits.map((e) => e.event ?? "");
101
+ }
102
+ function getListens(trait) {
103
+ const listens = trait.listens;
104
+ if (!listens) return [];
105
+ return listens.map((l) => l.event ?? "");
106
+ }
107
+ function jsonEffects(t) {
108
+ return t.effects ?? [];
109
+ }
110
+ function parseEffectType(effect) {
111
+ if (Array.isArray(effect)) {
112
+ const [type, ...args] = effect;
113
+ return { type: String(type), args };
114
+ }
115
+ return { type: "unknown", args: [] };
116
+ }
117
+ function exprToTree(expr) {
118
+ if (Array.isArray(expr)) {
119
+ const [op, ...args] = expr;
120
+ return {
121
+ label: String(op),
122
+ type: "operator",
123
+ children: args.map((a) => exprToTree(a))
124
+ };
125
+ }
126
+ if (typeof expr === "string") {
127
+ if (expr.startsWith("@")) {
128
+ return { label: expr, type: "binding" };
129
+ }
130
+ return { label: expr, type: "literal" };
131
+ }
132
+ if (expr !== null && typeof expr === "object") {
133
+ return { label: JSON.stringify(expr), type: "literal" };
134
+ }
135
+ return { label: String(expr), type: "literal" };
136
+ }
137
+ function parseApplicationLevel(schema) {
138
+ const orbitals = [];
139
+ const crossLinks = [];
140
+ if (!schema.orbitals || schema.orbitals.length === 0) {
141
+ return { orbitals: [], crossLinks: [] };
142
+ }
143
+ const count = schema.orbitals.length;
144
+ const cols = Math.ceil(Math.sqrt(count));
145
+ const rows = Math.ceil(count / cols);
146
+ const spacing = 200;
147
+ const gridW = cols * spacing;
148
+ const gridH = rows * spacing;
149
+ const originX = (600 - gridW) / 2 + spacing / 2;
150
+ const originY = (400 - gridH) / 2 + spacing / 2;
151
+ schema.orbitals.forEach((orbital, i) => {
152
+ const entity = getEntity(orbital);
153
+ const traits = getTraits(orbital);
154
+ const pages = getPages(orbital);
155
+ orbitals.push({
156
+ name: orbital.name,
157
+ entityName: entity.name,
158
+ fieldCount: entity.fields.length,
159
+ persistence: entity.persistence,
160
+ traitNames: traits.map((t) => t.name ?? ""),
161
+ pageNames: pages.map((p) => p.name ?? ""),
162
+ position: {
163
+ x: originX + i % cols * spacing,
164
+ y: originY + Math.floor(i / cols) * spacing
165
+ }
166
+ });
167
+ });
168
+ const seenLinks = /* @__PURE__ */ new Set();
169
+ for (const w of traitEventWires(schema)) {
170
+ if (w.emitterOrbital === w.listenerOrbital) continue;
171
+ const key = `${w.emitterOrbital}\u241F${w.listenerOrbital}\u241F${w.event}`;
172
+ if (seenLinks.has(key)) continue;
173
+ seenLinks.add(key);
174
+ crossLinks.push({
175
+ emitterOrbital: w.emitterOrbital,
176
+ listenerOrbital: w.listenerOrbital,
177
+ eventName: w.event,
178
+ emitterTrait: w.emitterTrait,
179
+ listenerTrait: w.listenerTrait
180
+ });
181
+ }
182
+ return { orbitals, crossLinks };
183
+ }
184
+ function parseOrbitalLevel(schema, orbitalName) {
185
+ if (!schema.orbitals) return null;
186
+ const orbital = schema.orbitals.find((o) => o.name === orbitalName);
187
+ if (!orbital) return null;
188
+ const entity = getEntity(orbital);
189
+ const traits = getTraits(orbital);
190
+ const pages = getPages(orbital);
191
+ const fields = entity.fields.map((f) => ({
192
+ name: f.name ?? "",
193
+ type: f.type ?? "string",
194
+ required: f.required ?? false,
195
+ hasDefault: f.default !== void 0
196
+ }));
197
+ const traitInfos = traits.map((t) => {
198
+ const sm = getStateMachine(t);
199
+ return {
200
+ name: t.name ?? "",
201
+ stateCount: sm ? getStates(sm).length : 0,
202
+ eventCount: sm ? getEvents(sm).length : 0,
203
+ transitionCount: sm ? getTransitions(sm).length : 0,
204
+ emits: getEmits(t),
205
+ listens: getListens(t)
206
+ };
207
+ });
208
+ const pageInfos = pages.map((p) => ({
209
+ name: p.name ?? "",
210
+ route: p.path ?? `/${(p.name ?? "").toLowerCase()}`
211
+ }));
212
+ const externalLinks = [];
213
+ for (const w of traitEventWires(schema)) {
214
+ if (w.emitterOrbital === w.listenerOrbital) continue;
215
+ if (w.emitterOrbital === orbitalName) {
216
+ externalLinks.push({ targetOrbital: w.listenerOrbital, eventName: w.event, direction: "out", traitName: w.emitterTrait });
217
+ } else if (w.listenerOrbital === orbitalName) {
218
+ externalLinks.push({ targetOrbital: w.emitterOrbital, eventName: w.event, direction: "in", traitName: w.listenerTrait });
219
+ }
220
+ }
221
+ return {
222
+ name: orbital.name,
223
+ entity: {
224
+ name: entity.name,
225
+ fields,
226
+ persistence: entity.persistence
227
+ },
228
+ traits: traitInfos,
229
+ pages: pageInfos,
230
+ externalLinks
231
+ };
232
+ }
233
+ function traitTransitionRenderUi(schema, orbitalName, traitName) {
234
+ const orbital = schema.orbitals?.find((o) => o.name === orbitalName);
235
+ const trait = orbital ? getTraits(orbital).find((t) => t.name === traitName) : void 0;
236
+ const sm = trait ? getStateMachine(trait) : void 0;
237
+ return sm ? getTransitions(sm).map((t) => renderUiEntriesOf(jsonEffects(t))) : [];
238
+ }
239
+ function parseTraitLevel(schema, orbitalName, traitName) {
240
+ if (!schema.orbitals) return null;
241
+ const orbital = schema.orbitals.find((o) => o.name === orbitalName);
242
+ if (!orbital) return null;
243
+ const trait = getTraits(orbital).find((t) => t.name === traitName);
244
+ if (!trait) return null;
245
+ return traitLevelFromTrait(trait, getEntity(orbital).name);
246
+ }
247
+ function programTraits(schema) {
248
+ return (schema.orbitals ?? []).flatMap((orbital) => {
249
+ const entity = getEntity(orbital).name;
250
+ return getTraits(orbital).flatMap((trait) => {
251
+ const level = traitLevelFromTrait(trait, entity);
252
+ return level ? [{ orbital: orbital.name, trait, level }] : [];
253
+ });
254
+ });
255
+ }
256
+ function traitLevelFromTrait(trait, linkedEntity) {
257
+ const sm = getStateMachine(trait);
258
+ if (!sm) return null;
259
+ return traitLevelOf(trait.name, linkedEntity, sm, getEmits(trait), getListens(trait));
260
+ }
261
+ function traitLevelFromDescription(description) {
262
+ const machine = description.machine;
263
+ if (!machine) return null;
264
+ return traitLevelOf(
265
+ description.value.trait,
266
+ machine.linkedEntity ?? "",
267
+ machine.stateMachine,
268
+ description.events.emits,
269
+ description.events.listens
270
+ );
271
+ }
272
+ function traitLevelOf(name, linkedEntity, sm, emittedEvents, listenedEvents) {
273
+ const states = getStates(sm).map((s) => ({
274
+ name: s.name ?? "",
275
+ isInitial: s.isInitial ?? null,
276
+ isTerminal: s.isTerminal ?? s.isFinal ?? null
277
+ }));
278
+ const transitions = getTransitions(sm).map((t, i) => ({
279
+ from: t.from ?? "",
280
+ to: t.to ?? "",
281
+ event: t.event ?? "",
282
+ guard: t.guard ?? null,
283
+ effects: jsonEffects(t).map(parseEffectType),
284
+ index: i
285
+ }));
286
+ return {
287
+ name,
288
+ linkedEntity,
289
+ states,
290
+ transitions,
291
+ emittedEvents,
292
+ listenedEvents
293
+ };
294
+ }
295
+ function parseTransitionLevel(schema, orbitalName, traitName, transitionIndex) {
296
+ const traitData = parseTraitLevel(schema, orbitalName, traitName);
297
+ if (!traitData) return null;
298
+ const transition = traitData.transitions[transitionIndex];
299
+ if (!transition) return null;
300
+ const guardVal = transition.guard;
301
+ const guard = guardVal != null ? exprToTree(guardVal) : null;
302
+ const effects = transition.effects.map(
303
+ (e) => exprToTree([e.type, ...e.args])
304
+ );
305
+ const slotTargets = transition.effects.filter((e) => e.type === "render-ui").map((e) => ({
306
+ name: String(e.args[0] ?? "main"),
307
+ pattern: typeof e.args[1] === "object" && e.args[1] !== null && !Array.isArray(e.args[1]) ? e.args[1].type ?? "unknown" : String(e.args[1] ?? "unknown")
308
+ }));
309
+ return {
310
+ from: transition.from,
311
+ to: transition.to,
312
+ event: transition.event,
313
+ guard,
314
+ effects,
315
+ slotTargets
316
+ };
317
+ }
318
+
319
+ export { parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, programTraits, traitEventWires, traitLevelFromDescription, traitLevelFromTrait, traitTransitionRenderUi };