@almadar/shell-web 1.0.0 → 1.2.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 (109) hide show
  1. package/LICENSE +72 -0
  2. package/dist/AvlGlyph-KZMJDBEB.js +5 -0
  3. package/dist/AvlStateMachine-KVZMFHFU.js +8 -0
  4. package/dist/AvlTransitionDetail-7DVGV27I.js +10 -0
  5. package/dist/AvlTransitionExplainer-RMJ5LQLK.js +11 -0
  6. package/dist/BehaviorView-EYRPME67.js +10 -0
  7. package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
  8. package/dist/FlowCanvas-J54627TC.js +23 -0
  9. package/dist/{FlowCanvas-3JRMNJLV.css → FlowCanvas-R4LL3KRI.css} +190 -192
  10. package/dist/{GameAudioProvider-ceM_n0ey.d.ts → GameAudioProvider-BgWOOYT3.d.ts} +15 -20
  11. package/dist/{KernelEngineContext-CcxGYtlr.d.ts → KernelEngineContext-BPx-q0iw.d.ts} +15 -2
  12. package/dist/{LayersPanel-M2LHWUFF.js → LayersPanel-PSXI4EHG.js} +4 -4
  13. package/dist/ModuleCard-TNRLL45H.js +6 -0
  14. package/dist/{OrbInspector-MHLJ6OEE.css → OrbInspector-2EGVZLOJ.css} +190 -192
  15. package/dist/OrbInspector-UBEQWWZ2.js +23 -0
  16. package/dist/{parseLessonSegments-GpCeMrb2.d.ts → SegmentRenderer-BAQ6Jwf6.d.ts} +4 -20
  17. package/dist/{Select-B-iDdnvE.d.ts → Select-BJ8Fgc8A.d.ts} +1 -1
  18. package/dist/{UISlotContext-Dl_ewwCI.d.ts → UISlotContext-7r0SQdTL.d.ts} +1 -1
  19. package/dist/UISlotRenderer-5OURMAP2.js +23 -0
  20. package/dist/{UISlotRenderer-KVFO6J7R.css → UISlotRenderer-SJBSQGBQ.css} +190 -192
  21. package/dist/auth/react/index.js +7 -6
  22. package/dist/avl/index.css +190 -192
  23. package/dist/avl/index.d.ts +19 -7
  24. package/dist/avl/index.js +170 -39
  25. package/dist/{chunk-AE7VCQB6.js → chunk-2LNXLMK3.js} +2 -2
  26. package/dist/{chunk-REXYVBUO.js → chunk-3DA36FOA.js} +1 -1
  27. package/dist/{chunk-UXLE3IPR.js → chunk-3UQNFRYV.js} +207 -9
  28. package/dist/{chunk-AGXD77SL.js → chunk-3YUMGEEW.js} +1 -1
  29. package/dist/{chunk-K4MOPSEL.js → chunk-6RXP5ZXE.js} +7 -8
  30. package/dist/{chunk-E6KA4J6N.js → chunk-7UCL26QB.js} +4 -5
  31. package/dist/{chunk-57DC34LY.js → chunk-AL2XXMYR.js} +2 -2
  32. package/dist/{chunk-YHMRX6YA.js → chunk-ANTJUQRD.js} +53 -13
  33. package/dist/{chunk-P4ZFUQFF.js → chunk-AZ74UPG6.js} +4 -1
  34. package/dist/{chunk-ROICKAU7.js → chunk-B23EZH2P.js} +3 -3
  35. package/dist/{chunk-CPLN6NBQ.js → chunk-CCO2ZH7F.js} +3 -4
  36. package/dist/{chunk-4YXBKHHM.js → chunk-D5FJU4XC.js} +87 -16
  37. package/dist/{chunk-HH5KSMH5.js → chunk-DPDKBY6Z.js} +1 -1
  38. package/dist/{chunk-A2LR6VQQ.js → chunk-ECC3WQIB.js} +9 -93
  39. package/dist/{chunk-VO2TTLS5.js → chunk-GHAF7QUD.js} +1 -1
  40. package/dist/{chunk-TXAUOLWZ.js → chunk-HA2BYO5E.js} +1 -1
  41. package/dist/{chunk-ILQXJ2AR.js → chunk-JEN4EIUF.js} +1 -1
  42. package/dist/{chunk-UTDC2NEA.js → chunk-KTYOYEVA.js} +1 -1
  43. package/dist/{chunk-X3DMMX27.js → chunk-LINJRTNB.js} +2 -2
  44. package/dist/{chunk-TUPZWTRE.js → chunk-LKL5RULQ.js} +467 -141
  45. package/dist/{chunk-UU57VNS2.js → chunk-PWXZN5G5.js} +2 -2
  46. package/dist/{chunk-SP5CDJ6K.js → chunk-RDPELAFQ.js} +4 -4
  47. package/dist/{chunk-PRXQGGCO.js → chunk-S3LS3B7N.js} +1 -1
  48. package/dist/{chunk-LHP2TK7O.js → chunk-TAEOMNDK.js} +3611 -4737
  49. package/dist/{chunk-3S54FWRC.js → chunk-UFQLHCFJ.js} +1 -1
  50. package/dist/{chunk-AB3X7QTE.js → chunk-V5SVGUYN.js} +2 -3
  51. package/dist/{chunk-3VZ36ZKO.js → chunk-ZDRDJKYB.js} +5 -2
  52. package/dist/components/index.css +190 -192
  53. package/dist/components/index.d.ts +568 -190
  54. package/dist/components/index.js +27 -30
  55. package/dist/context/index.d.ts +2 -2
  56. package/dist/context/index.js +5 -5
  57. package/dist/core.d.ts +21 -4
  58. package/dist/core.js +1 -1
  59. package/dist/{fx-CmQjnHmT.d.ts → fx-Bx5RqplG.d.ts} +10 -7
  60. package/dist/hooks/index.d.ts +8 -8
  61. package/dist/hooks/index.js +6 -6
  62. package/dist/index.d.ts +4 -0
  63. package/dist/index.js +2 -2
  64. package/dist/{katexPlugin-FA7NX4PE.css → katexPlugin-BUHVNRBJ.css} +1 -1
  65. package/dist/{kernel-client-TZKGHJRY.js → kernel-client-NMZ56JVU.js} +60 -6
  66. package/dist/{kernel-wire-wNdAPfhJ.d.ts → kernel-wire-CRsHtLsf.d.ts} +8 -1
  67. package/dist/lib/index.d.ts +3 -4
  68. package/dist/lib/index.js +435 -4
  69. package/dist/providers/index.css +190 -192
  70. package/dist/providers/index.d.ts +6 -8
  71. package/dist/providers/index.js +21 -25
  72. package/dist/renderer/index.d.ts +3 -79
  73. package/dist/renderer/index.js +2 -2
  74. package/dist/runtime/index.css +190 -192
  75. package/dist/runtime/index.d.ts +9 -2
  76. package/dist/runtime/index.js +20 -23
  77. package/dist/ssr/index.cjs +105 -28
  78. package/dist/ssr/index.js +106 -29
  79. package/dist/test-support.js +2 -2
  80. package/dist/{useUISlots-CiobNFGb.d.ts → useUISlots-BLcGd__D.d.ts} +2 -0
  81. package/dist/{paintDispatch-CuJLsr9Y.d.ts → verificationRegistry-BLuQU1JV.d.ts} +127 -15
  82. package/package.json +10 -38
  83. package/src/core/locales/ar.json +10 -1
  84. package/src/core/locales/en.json +10 -1
  85. package/src/core/locales/sl.json +10 -1
  86. package/tailwind-preset.cjs +8 -4
  87. package/dist/AvlGlyph-EPJKFEO3.js +0 -6
  88. package/dist/AvlStateMachine-RKZIKNGC.js +0 -9
  89. package/dist/AvlTransitionDetail-63SD6GZF.js +0 -11
  90. package/dist/AvlTransitionExplainer-ZBTLOM3T.js +0 -12
  91. package/dist/BehaviorView-YS5G4GNB.js +0 -11
  92. package/dist/Canvas3DHost-BkZQB5l2.d.ts +0 -552
  93. package/dist/FlowCanvas-AUMTWMNG.js +0 -26
  94. package/dist/ModuleCard-QHDGK5XK.js +0 -7
  95. package/dist/OrbInspector-QCPEPUPH.js +0 -26
  96. package/dist/UISlotRenderer-C7WWOK43.js +0 -26
  97. package/dist/avl-3d-context-BycmO6tG.d.ts +0 -201
  98. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
  99. package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
  100. package/dist/chunk-4T3P43NS.js +0 -1133
  101. package/dist/chunk-DZBQA2OW.js +0 -176
  102. package/dist/chunk-EOWMARUB.js +0 -16
  103. package/dist/chunk-GFXCPUMX.js +0 -1334
  104. package/dist/chunk-ILZ7ORX7.js +0 -432
  105. package/dist/three/index.css +0 -503
  106. package/dist/three/index.d.ts +0 -1185
  107. package/dist/three/index.js +0 -3908
  108. package/dist/verificationRegistry-CVrcxG1s.d.ts +0 -122
  109. /package/dist/{katexPlugin-NCDKOOQY.js → katexPlugin-WGJ4JFZU.js} +0 -0
@@ -1,1334 +0,0 @@
1
- import { useAvl3DPalette } from './chunk-EOWMARUB.js';
2
- import { avlBlend, AVL_INK, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, avlTint, effectCategoryOf } from './chunk-UXLE3IPR.js';
3
- import { Typography, Box, VStack, useTranslate, usePrefersReducedMotion } from './chunk-4YXBKHHM.js';
4
- import { Vector3, QuadraticBezierCurve3, MathUtils, Quaternion } from 'three';
5
- import { EntityPersistenceSchema } from '@almadar/core';
6
- import { getStdOperatorMeta } from '@almadar/std/registry';
7
- import { Html, RoundedBox } from '@react-three/drei';
8
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
- import { useRef, useState, useMemo } from 'react';
10
- import { useFrame } from '@react-three/fiber';
11
-
12
- function operatorPaletteKey(category) {
13
- return `op:${category}`;
14
- }
15
- function operatorCategoryPalette() {
16
- const out = {};
17
- for (const [category, color] of Object.entries(OPERATOR_CATEGORY_COLORS)) out[operatorPaletteKey(category)] = color;
18
- return out;
19
- }
20
- var AVL_3D_COLORS = {
21
- orbitalSphere: "var(--color-card)",
22
- orbitalRim: "var(--color-info)",
23
- entityCore: "var(--color-warning)",
24
- entityCoreGlow: avlBlend("var(--color-warning)", 70, "var(--color-background)"),
25
- traitOrbit: "var(--color-info)",
26
- traitOrbitHighlight: "var(--color-primary)",
27
- stateIdle: "var(--color-muted)",
28
- stateEdge: "var(--color-info)",
29
- stateActive: "var(--color-primary)",
30
- transitionArc: "var(--color-muted-foreground)",
31
- transitionArcHover: "var(--color-primary)",
32
- guardPass: "var(--color-success)",
33
- guardFail: "var(--color-error)",
34
- crossWire: "var(--color-accent)",
35
- crossWireGlow: avlBlend("var(--color-accent)", 70, "var(--color-background)"),
36
- pagePortal: "var(--color-success)",
37
- background: "var(--color-background)",
38
- backgroundSurface: "var(--color-card)",
39
- fog: "var(--color-background)",
40
- sparkle: "var(--color-info)",
41
- sparkleWarm: "var(--color-warning)",
42
- // Entity persistence badge (Avl3DEntityCore ring + micro-icons)
43
- persistencePersistent: "var(--color-info)",
44
- persistenceRuntime: "var(--color-success)",
45
- persistenceUnknown: "var(--color-muted-foreground)",
46
- // Expression tree (Avl3DExprTree): operator categories, bindings, literals
47
- ...operatorCategoryPalette(),
48
- exprOperatorUnknown: "var(--color-muted-foreground)",
49
- exprBinding: "var(--color-accent)",
50
- exprLiteral: "var(--color-muted-foreground)",
51
- // Effect category (Avl3DTransitionArc micro-icons)
52
- effectUi: EFFECT_CATEGORY_COLORS.ui.color,
53
- effectData: EFFECT_CATEGORY_COLORS.data.color,
54
- effectCommunication: EFFECT_CATEGORY_COLORS.communication.color,
55
- effectLifecycle: EFFECT_CATEGORY_COLORS.lifecycle.color,
56
- effectControl: EFFECT_CATEGORY_COLORS.control.color,
57
- effectAsync: EFFECT_CATEGORY_COLORS.async.color,
58
- effectCompute: EFFECT_CATEGORY_COLORS.compute.color,
59
- effectSystem: EFFECT_CATEGORY_COLORS.system.color,
60
- effectUnknown: "var(--color-muted-foreground)",
61
- // Misc mesh accents
62
- fieldParticle: "var(--color-foreground)",
63
- lightAmbient: "var(--color-info)",
64
- lightDirectional: avlBlend("var(--color-info)", 50, AVL_INK.onFocus),
65
- lightFill: avlBlend("var(--color-info)", 70, AVL_INK.canvas)
66
- };
67
- var PERSISTENCE_PALETTE_KEY = {
68
- persistent: "persistencePersistent",
69
- runtime: "persistenceRuntime"
70
- };
71
- function persistencePaletteKey(persistence) {
72
- const parsed = EntityPersistenceSchema.safeParse(persistence);
73
- return parsed.success ? PERSISTENCE_PALETTE_KEY[parsed.data] : "persistenceUnknown";
74
- }
75
- function exprOperatorPaletteKey(label) {
76
- const meta = getStdOperatorMeta(label);
77
- return meta ? operatorPaletteKey(meta.category) : "exprOperatorUnknown";
78
- }
79
- var EFFECT_CATEGORY_PALETTE_KEY = {
80
- ui: "effectUi",
81
- data: "effectData",
82
- communication: "effectCommunication",
83
- lifecycle: "effectLifecycle",
84
- control: "effectControl",
85
- async: "effectAsync",
86
- compute: "effectCompute",
87
- system: "effectSystem"
88
- };
89
- function effectTypePaletteKey(type) {
90
- const category = effectCategoryOf(type);
91
- return category ? EFFECT_CATEGORY_PALETTE_KEY[category] : "effectUnknown";
92
- }
93
- var GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
94
- function goldenSpiralPositions(count, baseRadius) {
95
- if (count === 0) return [];
96
- if (count === 1) return [{ x: 0, y: 0, z: 0 }];
97
- const positions = [];
98
- for (let i = 0; i < count; i++) {
99
- const angle = i * GOLDEN_ANGLE;
100
- const r = baseRadius * Math.sqrt(i / count);
101
- positions.push({
102
- x: r * Math.cos(angle),
103
- y: 0,
104
- z: r * Math.sin(angle)
105
- });
106
- }
107
- return positions;
108
- }
109
- function forceDirectedPositions(count, edges, baseRadius, iterations = 80) {
110
- if (count === 0) return [];
111
- if (count === 1) return [{ x: 0, y: 0, z: 0 }];
112
- const positions = goldenSpiralPositions(count, baseRadius);
113
- const repulsionStrength = baseRadius * baseRadius * 0.5;
114
- const attractionStrength = 0.15;
115
- const damping = 0.85;
116
- const velocities = positions.map(() => ({ x: 0, y: 0, z: 0 }));
117
- for (let iter = 0; iter < iterations; iter++) {
118
- for (let i = 0; i < count; i++) {
119
- for (let j = i + 1; j < count; j++) {
120
- const dx = positions[i].x - positions[j].x;
121
- const dz = positions[i].z - positions[j].z;
122
- const distSq = dx * dx + dz * dz + 0.01;
123
- const force = repulsionStrength / distSq;
124
- const dist = Math.sqrt(distSq);
125
- const fx = dx / dist * force;
126
- const fz = dz / dist * force;
127
- velocities[i].x += fx;
128
- velocities[i].z += fz;
129
- velocities[j].x -= fx;
130
- velocities[j].z -= fz;
131
- }
132
- }
133
- for (const edge of edges) {
134
- const dx = positions[edge.to].x - positions[edge.from].x;
135
- const dz = positions[edge.to].z - positions[edge.from].z;
136
- const dist = Math.sqrt(dx * dx + dz * dz + 0.01);
137
- const force = dist * attractionStrength;
138
- const fx = dx / dist * force;
139
- const fz = dz / dist * force;
140
- velocities[edge.from].x += fx;
141
- velocities[edge.from].z += fz;
142
- velocities[edge.to].x -= fx;
143
- velocities[edge.to].z -= fz;
144
- }
145
- for (let i = 0; i < count; i++) {
146
- positions[i].x += velocities[i].x * 0.1;
147
- positions[i].z += velocities[i].z * 0.1;
148
- velocities[i].x *= damping;
149
- velocities[i].z *= damping;
150
- }
151
- }
152
- let cx = 0, cz = 0;
153
- for (const p of positions) {
154
- cx += p.x;
155
- cz += p.z;
156
- }
157
- cx /= count;
158
- cz /= count;
159
- for (const p of positions) {
160
- p.x -= cx;
161
- p.z -= cz;
162
- }
163
- return positions;
164
- }
165
- function fibonacciSpherePositions(count, radius) {
166
- if (count === 0) return [];
167
- if (count === 1) return [{ x: 0, y: 0, z: 0 }];
168
- const positions = [];
169
- for (let i = 0; i < count; i++) {
170
- const y = 1 - 2 * i / (count - 1);
171
- const radiusAtY = Math.sqrt(1 - y * y);
172
- const theta = GOLDEN_ANGLE * i;
173
- positions.push({
174
- x: radius * radiusAtY * Math.cos(theta),
175
- y: radius * y,
176
- z: radius * radiusAtY * Math.sin(theta)
177
- });
178
- }
179
- return positions;
180
- }
181
- function orbitRingPositions(count, radius, tilt) {
182
- if (count === 0) return [];
183
- const positions = [];
184
- const step = 2 * Math.PI / count;
185
- for (let i = 0; i < count; i++) {
186
- const angle = i * step;
187
- const x = radius * Math.cos(angle);
188
- const flatZ = radius * Math.sin(angle);
189
- const y = flatZ * Math.sin(tilt);
190
- const z = flatZ * Math.cos(tilt);
191
- positions.push({ x, y, z });
192
- }
193
- return positions;
194
- }
195
- function arcCurve3D(from, to, offset) {
196
- const start = new Vector3(...from);
197
- const end = new Vector3(...to);
198
- const mid = new Vector3().addVectors(start, end).multiplyScalar(0.5);
199
- const dir = new Vector3().subVectors(end, start).normalize();
200
- const up = new Vector3(0, 1, 0);
201
- const perp = new Vector3().crossVectors(dir, up).normalize();
202
- if (perp.length() < 1e-3) {
203
- perp.crossVectors(dir, new Vector3(1, 0, 0)).normalize();
204
- }
205
- const control = mid.clone().add(perp.multiplyScalar(offset));
206
- control.y += Math.abs(offset) * 0.3;
207
- return new QuadraticBezierCurve3(start, control, end);
208
- }
209
- function selfLoopCurve3D(position, loopRadius) {
210
- const base = new Vector3(...position);
211
- const start = base.clone().add(new Vector3(-loopRadius * 0.3, 0, 0));
212
- const end = base.clone().add(new Vector3(loopRadius * 0.3, 0, 0));
213
- const control = base.clone().add(new Vector3(0, loopRadius, 0));
214
- return new QuadraticBezierCurve3(start, control, end);
215
- }
216
- function treeLayout3D(node, origin, horizontalSpacing, verticalSpacing = 2) {
217
- const results = [];
218
- function layoutNode(n, pos, depth) {
219
- results.push({ node: n, position: pos });
220
- if (!n.children || n.children.length === 0) return;
221
- const childCount = n.children.length;
222
- const totalWidth = (childCount - 1) * horizontalSpacing / (depth + 1);
223
- const startX = pos.x - totalWidth / 2;
224
- for (let i = 0; i < childCount; i++) {
225
- const childPos = {
226
- x: startX + i * totalWidth / Math.max(childCount - 1, 1),
227
- y: pos.y - verticalSpacing,
228
- z: pos.z
229
- };
230
- layoutNode(n.children[i], childPos, depth + 1);
231
- }
232
- }
233
- layoutNode(node, origin, 0);
234
- return results;
235
- }
236
- var CAMERA_POSITIONS = {
237
- application: { position: [0, 20, 30], target: [0, 0, 0] },
238
- orbital: { position: [0, 8, 12], target: [0, 0, 0] },
239
- trait: { position: [0, 6, 10], target: [0, 0, 0] },
240
- transition: { position: [0, 4, 8], target: [0, 0, 0] }
241
- };
242
-
243
- // src/lib/avl-zoom-state.ts
244
- var initialZoomState = {
245
- level: "application",
246
- selectedOrbital: null,
247
- selectedTrait: null,
248
- selectedTransition: null,
249
- animating: false,
250
- animationDirection: "in",
251
- animationTarget: null
252
- };
253
- function zoomReducer(state, action) {
254
- switch (action.type) {
255
- case "ZOOM_INTO_ORBITAL": {
256
- if (state.level !== "application" || state.animating) return state;
257
- return {
258
- ...state,
259
- animating: true,
260
- animationDirection: "in",
261
- animationTarget: { x: action.targetPosition.x, y: action.targetPosition.y, scale: 3 },
262
- selectedOrbital: action.orbital
263
- };
264
- }
265
- case "ZOOM_INTO_TRAIT": {
266
- if (state.level !== "orbital" || state.animating) return state;
267
- return {
268
- ...state,
269
- animating: true,
270
- animationDirection: "in",
271
- animationTarget: { x: action.targetPosition.x, y: action.targetPosition.y, scale: 3 },
272
- selectedTrait: action.trait
273
- };
274
- }
275
- case "ZOOM_INTO_TRANSITION": {
276
- if (state.level !== "trait" || state.animating) return state;
277
- return {
278
- ...state,
279
- animating: true,
280
- animationDirection: "in",
281
- animationTarget: { x: action.targetPosition.x, y: action.targetPosition.y, scale: 3 },
282
- selectedTransition: action.transitionIndex
283
- };
284
- }
285
- case "JUMP_TO_TRAIT_CIRCUIT": {
286
- if (state.level !== "application" || state.animating) return state;
287
- return {
288
- ...state,
289
- level: "trait",
290
- selectedOrbital: action.orbital,
291
- selectedTrait: null,
292
- selectedTransition: null,
293
- animating: false,
294
- animationDirection: "in",
295
- animationTarget: null
296
- };
297
- }
298
- case "SELECT_TRAIT": {
299
- return { ...state, selectedTrait: action.trait };
300
- }
301
- case "ZOOM_OUT": {
302
- if (state.level === "application" || state.animating) return state;
303
- return {
304
- ...state,
305
- animating: true,
306
- animationDirection: "out",
307
- animationTarget: { x: 300, y: 200, scale: 0.3 }
308
- };
309
- }
310
- case "ANIMATION_COMPLETE": {
311
- if (!state.animating) return state;
312
- if (state.animationDirection === "in") {
313
- const nextLevel = state.level === "application" ? "orbital" : state.level === "orbital" ? "trait" : "transition";
314
- return {
315
- ...state,
316
- level: nextLevel,
317
- animating: false,
318
- animationTarget: null
319
- };
320
- }
321
- if (state.level === "transition") {
322
- return {
323
- ...state,
324
- level: "trait",
325
- selectedTransition: null,
326
- animating: false,
327
- animationTarget: null
328
- };
329
- }
330
- if (state.level === "trait") {
331
- return {
332
- ...state,
333
- level: "application",
334
- selectedOrbital: null,
335
- selectedTrait: null,
336
- animating: false,
337
- animationTarget: null
338
- };
339
- }
340
- if (state.level === "orbital") {
341
- return {
342
- ...state,
343
- level: "application",
344
- selectedOrbital: null,
345
- animating: false,
346
- animationTarget: null
347
- };
348
- }
349
- return state;
350
- }
351
- case "SWITCH_TRAIT": {
352
- if (state.level !== "trait" || state.animating) return state;
353
- return {
354
- ...state,
355
- selectedTrait: action.trait,
356
- selectedTransition: null
357
- };
358
- }
359
- case "RESET": {
360
- return initialZoomState;
361
- }
362
- default:
363
- return state;
364
- }
365
- }
366
- function getBreadcrumbs(state) {
367
- const crumbs = [{ labelKey: "avl.glyph.application", level: "application" }];
368
- if (state.selectedOrbital) {
369
- crumbs.push({ label: state.selectedOrbital, level: "orbital" });
370
- }
371
- if (state.selectedTrait) {
372
- crumbs.push({ label: state.selectedTrait, level: "trait" });
373
- }
374
- if (state.selectedTransition !== null) {
375
- crumbs.push({ labelKey: "avl.breadcrumb.transitionNumber", labelParams: { n: state.selectedTransition }, level: "transition" });
376
- }
377
- return crumbs;
378
- }
379
- var Avl3DLabel = ({
380
- position,
381
- text,
382
- color = AVL_INK.text,
383
- fontSize = 12,
384
- className,
385
- occlude = false
386
- }) => {
387
- return /* @__PURE__ */ jsx(
388
- Html,
389
- {
390
- position,
391
- center: true,
392
- distanceFactor: 10,
393
- occlude: occlude ? "blending" : void 0,
394
- className,
395
- style: { pointerEvents: "none" },
396
- children: /* @__PURE__ */ jsx(
397
- Typography,
398
- {
399
- variant: "small",
400
- style: {
401
- color,
402
- fontSize: `${fontSize}px`,
403
- whiteSpace: "nowrap",
404
- textShadow: `0 0 4px ${avlTint(AVL_INK.canvas, 80)}`,
405
- userSelect: "none"
406
- },
407
- children: text
408
- }
409
- )
410
- }
411
- );
412
- };
413
- Avl3DLabel.displayName = "Avl3DLabel";
414
- var Avl3DTooltip = ({
415
- position,
416
- title,
417
- rows,
418
- accentColor = AVL_INK.focus
419
- }) => {
420
- return /* @__PURE__ */ jsx(
421
- Html,
422
- {
423
- position,
424
- center: true,
425
- distanceFactor: 8,
426
- style: { pointerEvents: "none" },
427
- zIndexRange: [100, 0],
428
- children: /* @__PURE__ */ jsx(
429
- Box,
430
- {
431
- style: {
432
- background: avlTint(AVL_INK.surface, 92),
433
- backdropFilter: "blur(8px)",
434
- borderLeft: `3px solid ${accentColor}`,
435
- borderRadius: "6px",
436
- padding: "8px 12px",
437
- minWidth: "140px",
438
- maxWidth: "220px",
439
- boxShadow: "var(--shadow-lg)"
440
- },
441
- children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
442
- /* @__PURE__ */ jsx(
443
- Typography,
444
- {
445
- variant: "small",
446
- style: {
447
- color: AVL_INK.text,
448
- fontWeight: 600,
449
- fontSize: "12px",
450
- lineHeight: 1.3
451
- },
452
- children: title
453
- }
454
- ),
455
- rows.map((row) => /* @__PURE__ */ jsxs(
456
- Box,
457
- {
458
- style: {
459
- display: "flex",
460
- justifyContent: "space-between",
461
- gap: "12px"
462
- },
463
- children: [
464
- /* @__PURE__ */ jsx(
465
- Typography,
466
- {
467
- variant: "small",
468
- style: {
469
- color: AVL_INK.quiet,
470
- fontSize: "10px",
471
- whiteSpace: "nowrap"
472
- },
473
- children: row.label
474
- }
475
- ),
476
- /* @__PURE__ */ jsx(
477
- Typography,
478
- {
479
- variant: "small",
480
- style: {
481
- color: AVL_INK.text,
482
- fontSize: "10px",
483
- fontWeight: 500,
484
- textAlign: "right"
485
- },
486
- children: row.value
487
- }
488
- )
489
- ]
490
- },
491
- row.label
492
- ))
493
- ] })
494
- }
495
- )
496
- }
497
- );
498
- };
499
- Avl3DTooltip.displayName = "Avl3DTooltip";
500
- var Avl3DOrbitalNode = ({
501
- name,
502
- entityName,
503
- traitCount,
504
- pageCount = 0,
505
- persistence = "persistent",
506
- position,
507
- onClick
508
- }) => {
509
- const groupRef = useRef(null);
510
- const [hovered, setHovered] = useState(false);
511
- const palette = useAvl3DPalette();
512
- const { t } = useTranslate();
513
- const scale = useMemo(() => 0.6 + Math.min(traitCount, 8) * 0.3, [traitCount]);
514
- const currentScale = useRef(scale);
515
- const targetScale = hovered ? scale * 1.06 : scale;
516
- const reducedMotion = usePrefersReducedMotion();
517
- useFrame((_, delta) => {
518
- if (!groupRef.current) return;
519
- if (reducedMotion) {
520
- currentScale.current = targetScale;
521
- return;
522
- }
523
- groupRef.current.rotation.y += delta * (hovered ? 0.4 : 0.2);
524
- groupRef.current.rotation.x += delta * 0.05;
525
- currentScale.current = MathUtils.damp(currentScale.current, targetScale, 6, delta);
526
- });
527
- const baseBrightness = 0.3 + Math.min(pageCount, 5) * 0.05;
528
- const emissiveIntensity = hovered ? 0.8 : baseBrightness;
529
- if (!palette) return null;
530
- return /* @__PURE__ */ jsxs("group", { position, children: [
531
- /* @__PURE__ */ jsxs("mesh", { scale: scale * 1.3, children: [
532
- /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 16, 16] }),
533
- /* @__PURE__ */ jsx(
534
- "meshStandardMaterial",
535
- {
536
- color: palette.orbitalRim,
537
- emissive: palette.orbitalRim,
538
- emissiveIntensity: hovered ? 0.2 : 0.06,
539
- transparent: true,
540
- opacity: hovered ? 0.08 : 0.03,
541
- depthWrite: false
542
- }
543
- )
544
- ] }),
545
- /* @__PURE__ */ jsxs("group", { ref: groupRef, children: [
546
- /* @__PURE__ */ jsxs(
547
- "mesh",
548
- {
549
- onClick: (e) => {
550
- e.stopPropagation();
551
- onClick?.();
552
- },
553
- onPointerOver: (e) => {
554
- e.stopPropagation();
555
- setHovered(true);
556
- document.body.style.cursor = "pointer";
557
- },
558
- onPointerOut: () => {
559
- setHovered(false);
560
- document.body.style.cursor = "auto";
561
- },
562
- scale: currentScale.current,
563
- rotation: [Math.PI / 4, 0, 0],
564
- children: [
565
- /* @__PURE__ */ jsx("torusGeometry", { args: [1, 0.18, 24, 64] }),
566
- /* @__PURE__ */ jsx(
567
- "meshStandardMaterial",
568
- {
569
- color: palette.orbitalSphere,
570
- emissive: palette.orbitalRim,
571
- emissiveIntensity,
572
- roughness: 0.2,
573
- metalness: 0.7
574
- }
575
- )
576
- ]
577
- }
578
- ),
579
- /* @__PURE__ */ jsxs(
580
- "mesh",
581
- {
582
- scale: scale * 0.9,
583
- rotation: [Math.PI / 2 + 0.3, Math.PI / 5, 0],
584
- children: [
585
- /* @__PURE__ */ jsx("torusGeometry", { args: [1, 0.06, 12, 64] }),
586
- /* @__PURE__ */ jsx(
587
- "meshStandardMaterial",
588
- {
589
- color: palette.traitOrbit,
590
- emissive: palette.traitOrbit,
591
- emissiveIntensity: 0.25,
592
- transparent: true,
593
- opacity: 0.4
594
- }
595
- )
596
- ]
597
- }
598
- )
599
- ] }),
600
- /* @__PURE__ */ jsxs("mesh", { scale: scale * 0.25, children: [
601
- /* @__PURE__ */ jsx("icosahedronGeometry", { args: [1, 1] }),
602
- /* @__PURE__ */ jsx(
603
- "meshStandardMaterial",
604
- {
605
- color: palette.entityCore,
606
- emissive: palette.entityCoreGlow,
607
- emissiveIntensity: 2,
608
- roughness: 0.1
609
- }
610
- )
611
- ] }),
612
- /* @__PURE__ */ jsx(
613
- "pointLight",
614
- {
615
- color: palette.entityCoreGlow,
616
- intensity: 0.5,
617
- distance: 3,
618
- decay: 2
619
- }
620
- ),
621
- /* @__PURE__ */ jsx(
622
- Avl3DLabel,
623
- {
624
- position: [0, scale + 0.6, 0],
625
- text: name,
626
- color: AVL_INK.text,
627
- fontSize: hovered ? 14 : 12
628
- }
629
- ),
630
- /* @__PURE__ */ jsx(
631
- Avl3DLabel,
632
- {
633
- position: [0, -(scale + 0.4), 0],
634
- text: entityName,
635
- color: AVL_INK.quiet,
636
- fontSize: 10
637
- }
638
- ),
639
- hovered && /* @__PURE__ */ jsx(
640
- Avl3DTooltip,
641
- {
642
- position: [scale + 1.2, 0.3, 0],
643
- title: name,
644
- accentColor: AVL_3D_COLORS.orbitalRim,
645
- rows: [
646
- { label: t("avl.entity"), value: entityName },
647
- { label: t("avl.glyph.persistence"), value: persistence },
648
- { label: t("avl.traits"), value: String(traitCount) },
649
- { label: t("avl3d.pages"), value: String(pageCount) }
650
- ]
651
- }
652
- )
653
- ] });
654
- };
655
- Avl3DOrbitalNode.displayName = "Avl3DOrbitalNode";
656
- var Avl3DCrossWire = ({
657
- from,
658
- to,
659
- eventName,
660
- color
661
- }) => {
662
- const palette = useAvl3DPalette();
663
- const { tubeArgs, midpoint } = useMemo(() => {
664
- const curve = arcCurve3D(from, to, 2);
665
- const mid = curve.getPoint(0.5);
666
- return {
667
- tubeArgs: [curve, 32, 0.03, 8, false],
668
- midpoint: [mid.x, mid.y, mid.z]
669
- };
670
- }, [from, to]);
671
- if (!palette) return null;
672
- const wireColor = color ?? palette.crossWire;
673
- return /* @__PURE__ */ jsxs("group", { children: [
674
- /* @__PURE__ */ jsxs("mesh", { children: [
675
- /* @__PURE__ */ jsx("tubeGeometry", { args: [tubeArgs[0], tubeArgs[1], tubeArgs[2], tubeArgs[3], tubeArgs[4]] }),
676
- /* @__PURE__ */ jsx(
677
- "meshStandardMaterial",
678
- {
679
- color: wireColor,
680
- emissive: wireColor,
681
- emissiveIntensity: 0.4,
682
- transparent: true,
683
- opacity: 0.6,
684
- roughness: 0.5
685
- }
686
- )
687
- ] }),
688
- /* @__PURE__ */ jsx(
689
- Avl3DLabel,
690
- {
691
- position: midpoint,
692
- text: eventName,
693
- color: wireColor,
694
- fontSize: 9
695
- }
696
- )
697
- ] });
698
- };
699
- Avl3DCrossWire.displayName = "Avl3DCrossWire";
700
- function fieldPositions(count, radius) {
701
- const positions = [];
702
- const goldenAngle = Math.PI * (3 - Math.sqrt(5));
703
- for (let i = 0; i < Math.min(count, 12); i++) {
704
- const y = 1 - 2 * i / Math.max(count - 1, 1);
705
- const r = Math.sqrt(1 - y * y);
706
- const theta = goldenAngle * i;
707
- positions.push([
708
- radius * r * Math.cos(theta),
709
- radius * y,
710
- radius * r * Math.sin(theta)
711
- ]);
712
- }
713
- return positions;
714
- }
715
- var Avl3DEntityCore = ({
716
- name,
717
- fieldCount,
718
- persistence,
719
- position,
720
- fields
721
- }) => {
722
- const coreRef = useRef(null);
723
- const palette = useAvl3DPalette();
724
- const { t } = useTranslate();
725
- const reducedMotion = usePrefersReducedMotion();
726
- useFrame((_, delta) => {
727
- if (!coreRef.current || reducedMotion) return;
728
- coreRef.current.rotation.y += delta * 0.3;
729
- coreRef.current.rotation.x += delta * 0.1;
730
- });
731
- if (!palette) return null;
732
- const fieldPos = fieldPositions(fieldCount, 1.4);
733
- const pColor = palette[persistencePaletteKey(persistence)];
734
- return /* @__PURE__ */ jsxs("group", { position, children: [
735
- /* @__PURE__ */ jsxs("mesh", { ref: coreRef, children: [
736
- /* @__PURE__ */ jsx("icosahedronGeometry", { args: [1, 2] }),
737
- /* @__PURE__ */ jsx(
738
- "meshStandardMaterial",
739
- {
740
- color: palette.entityCore,
741
- emissive: palette.entityCoreGlow,
742
- emissiveIntensity: 2,
743
- roughness: 0.15,
744
- metalness: 0.85
745
- }
746
- )
747
- ] }),
748
- /* @__PURE__ */ jsxs("mesh", { scale: 1.2, children: [
749
- /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 24, 24] }),
750
- /* @__PURE__ */ jsx(
751
- "meshStandardMaterial",
752
- {
753
- color: palette.entityCoreGlow,
754
- emissive: palette.entityCoreGlow,
755
- emissiveIntensity: 0.6,
756
- transparent: true,
757
- opacity: 0.1,
758
- depthWrite: false
759
- }
760
- )
761
- ] }),
762
- /* @__PURE__ */ jsxs("mesh", { scale: 1.6, children: [
763
- /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 16, 16] }),
764
- /* @__PURE__ */ jsx(
765
- "meshStandardMaterial",
766
- {
767
- color: palette.entityCore,
768
- emissive: palette.entityCore,
769
- emissiveIntensity: 0.2,
770
- transparent: true,
771
- opacity: 0.04,
772
- depthWrite: false
773
- }
774
- )
775
- ] }),
776
- /* @__PURE__ */ jsx(
777
- "pointLight",
778
- {
779
- color: palette.entityCoreGlow,
780
- intensity: 2.5,
781
- distance: 10,
782
- decay: 2
783
- }
784
- ),
785
- fieldPos.map((pos, i) => {
786
- const fieldType = fields?.[i];
787
- return /* @__PURE__ */ jsxs("mesh", { position: pos, scale: 0.08, rotation: [Math.PI / 6, Math.PI / 4, 0], children: [
788
- fieldType === "number" ? /* @__PURE__ */ jsx("tetrahedronGeometry", { args: [1, 0] }) : fieldType === "boolean" ? /* @__PURE__ */ jsx("boxGeometry", { args: [1.2, 1.2, 1.2] }) : fieldType === "date" ? /* @__PURE__ */ jsx("octahedronGeometry", { args: [1, 0] }) : fieldType === "enum" ? /* @__PURE__ */ jsx("torusGeometry", { args: [0.8, 0.3, 6, 12] }) : fieldType === "object" ? /* @__PURE__ */ jsx("dodecahedronGeometry", { args: [1, 0] }) : fieldType === "array" ? /* @__PURE__ */ jsx("cylinderGeometry", { args: [0.8, 0.8, 1.5, 6] }) : (
789
- // string (default): sphere
790
- /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 8, 8] })
791
- ),
792
- /* @__PURE__ */ jsx(
793
- "meshStandardMaterial",
794
- {
795
- color: palette.fieldParticle,
796
- emissive: palette.fieldParticle,
797
- emissiveIntensity: 0.8,
798
- transparent: true,
799
- opacity: 0.7
800
- }
801
- )
802
- ] }, i);
803
- }),
804
- persistence === "singleton" ? (
805
- // Singleton: double concentric rings (thick outer + thin inner)
806
- /* @__PURE__ */ jsxs(Fragment, { children: [
807
- /* @__PURE__ */ jsxs("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
808
- /* @__PURE__ */ jsx("torusGeometry", { args: [1.6, 0.04, 8, 64] }),
809
- /* @__PURE__ */ jsx("meshStandardMaterial", { color: pColor, emissive: pColor, emissiveIntensity: 0.6, transparent: true, opacity: 0.6 })
810
- ] }),
811
- /* @__PURE__ */ jsxs("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
812
- /* @__PURE__ */ jsx("torusGeometry", { args: [1.4, 0.02, 8, 64] }),
813
- /* @__PURE__ */ jsx("meshStandardMaterial", { color: pColor, emissive: pColor, emissiveIntensity: 0.4, transparent: true, opacity: 0.4 })
814
- ] })
815
- ] })
816
- ) : persistence === "runtime" ? (
817
- // Runtime: segmented ring (8 arc segments with gaps)
818
- /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 8 }).map((_, i) => {
819
- const angle = i / 8 * Math.PI * 2;
820
- const x = 1.6 * Math.cos(angle);
821
- const z = 1.6 * Math.sin(angle);
822
- return /* @__PURE__ */ jsxs("mesh", { position: [x, 0, z], rotation: [Math.PI / 2, 0, angle], children: [
823
- /* @__PURE__ */ jsx("torusGeometry", { args: [0.25, 0.025, 6, 12, Math.PI * 0.7] }),
824
- /* @__PURE__ */ jsx("meshStandardMaterial", { color: pColor, emissive: pColor, emissiveIntensity: 0.6, transparent: true, opacity: 0.6 })
825
- ] }, i);
826
- }) })
827
- ) : persistence === "instance" ? (
828
- // Instance: dotted ring (small spheres in a circle)
829
- /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: 16 }).map((_, i) => {
830
- const angle = i / 16 * Math.PI * 2;
831
- const x = 1.6 * Math.cos(angle);
832
- const z = 1.6 * Math.sin(angle);
833
- return /* @__PURE__ */ jsxs("mesh", { position: [x, 0, z], scale: 0.04, children: [
834
- /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 6, 6] }),
835
- /* @__PURE__ */ jsx("meshStandardMaterial", { color: pColor, emissive: pColor, emissiveIntensity: 0.8 })
836
- ] }, i);
837
- }) })
838
- ) : (
839
- // Persistent (default): solid torus ring
840
- /* @__PURE__ */ jsxs("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
841
- /* @__PURE__ */ jsx("torusGeometry", { args: [1.6, 0.03, 8, 64] }),
842
- /* @__PURE__ */ jsx("meshStandardMaterial", { color: pColor, emissive: pColor, emissiveIntensity: 0.6, transparent: true, opacity: 0.6 })
843
- ] })
844
- ),
845
- /* @__PURE__ */ jsx(
846
- Avl3DLabel,
847
- {
848
- position: [0, -1.8, 0],
849
- text: name,
850
- color: AVL_3D_COLORS.entityCore,
851
- fontSize: 14
852
- }
853
- ),
854
- /* @__PURE__ */ jsx(
855
- Avl3DLabel,
856
- {
857
- position: [0, -2.3, 0],
858
- text: t(fieldCount === 1 ? "avl3d.fieldCountOne" : "avl3d.fieldCountOther", { count: fieldCount }),
859
- color: AVL_INK.quiet,
860
- fontSize: 10
861
- }
862
- )
863
- ] });
864
- };
865
- Avl3DEntityCore.displayName = "Avl3DEntityCore";
866
- var Avl3DStateNode = ({
867
- name,
868
- isInitial = false,
869
- isTerminal = false,
870
- position,
871
- active = false,
872
- incomingCount = 0,
873
- outgoingCount = 0,
874
- onClick
875
- }) => {
876
- const [hovered, setHovered] = useState(false);
877
- const palette = useAvl3DPalette();
878
- const { t } = useTranslate();
879
- const targetScale = hovered ? 1.08 : 1;
880
- const currentScale = useRef(1);
881
- const reducedMotion = usePrefersReducedMotion();
882
- useFrame((_, delta) => {
883
- currentScale.current = reducedMotion ? targetScale : MathUtils.damp(currentScale.current, targetScale, 6, delta);
884
- });
885
- const scale = currentScale.current;
886
- if (!palette) return null;
887
- const baseColor = active ? palette.stateActive : palette.stateIdle;
888
- const emissiveColor = active ? palette.stateActive : palette.stateEdge;
889
- const emissiveIntensity = active ? 2 : hovered ? 0.8 : 0.3;
890
- return /* @__PURE__ */ jsxs("group", { position, children: [
891
- /* @__PURE__ */ jsxs("mesh", { scale: scale * 1.4, children: [
892
- /* @__PURE__ */ jsx("boxGeometry", { args: [1.2, 0.7, 0.5] }),
893
- /* @__PURE__ */ jsx(
894
- "meshStandardMaterial",
895
- {
896
- color: emissiveColor,
897
- emissive: emissiveColor,
898
- emissiveIntensity: active ? 0.3 : hovered ? 0.1 : 0.03,
899
- transparent: true,
900
- opacity: active ? 0.08 : 0.03,
901
- depthWrite: false
902
- }
903
- )
904
- ] }),
905
- /* @__PURE__ */ jsx(
906
- RoundedBox,
907
- {
908
- args: [1, 0.55, 0.35],
909
- radius: 0.12,
910
- smoothness: 4,
911
- scale,
912
- onClick: (e) => {
913
- e.stopPropagation();
914
- onClick?.();
915
- },
916
- onPointerOver: (e) => {
917
- e.stopPropagation();
918
- setHovered(true);
919
- document.body.style.cursor = "pointer";
920
- },
921
- onPointerOut: () => {
922
- setHovered(false);
923
- document.body.style.cursor = "auto";
924
- },
925
- children: /* @__PURE__ */ jsx(
926
- "meshStandardMaterial",
927
- {
928
- color: baseColor,
929
- emissive: emissiveColor,
930
- emissiveIntensity,
931
- roughness: 0.35,
932
- metalness: 0.5
933
- }
934
- )
935
- }
936
- ),
937
- isInitial && /* @__PURE__ */ jsxs("group", { position: [-0.75, 0, 0], children: [
938
- /* @__PURE__ */ jsxs("mesh", { rotation: [0, 0, -Math.PI / 2], children: [
939
- /* @__PURE__ */ jsx("coneGeometry", { args: [0.12, 0.25, 8] }),
940
- /* @__PURE__ */ jsx(
941
- "meshStandardMaterial",
942
- {
943
- color: palette.stateActive,
944
- emissive: palette.stateActive,
945
- emissiveIntensity: 1
946
- }
947
- )
948
- ] }),
949
- /* @__PURE__ */ jsxs("mesh", { position: [-0.2, 0, 0], rotation: [0, 0, Math.PI / 2], children: [
950
- /* @__PURE__ */ jsx("cylinderGeometry", { args: [0.02, 0.02, 0.25, 6] }),
951
- /* @__PURE__ */ jsx(
952
- "meshStandardMaterial",
953
- {
954
- color: palette.stateActive,
955
- emissive: palette.stateActive,
956
- emissiveIntensity: 0.6
957
- }
958
- )
959
- ] })
960
- ] }),
961
- isTerminal && /* @__PURE__ */ jsxs("group", { position: [0.75, 0, 0], children: [
962
- /* @__PURE__ */ jsxs("mesh", { scale: 0.15, children: [
963
- /* @__PURE__ */ jsx("octahedronGeometry", { args: [1, 0] }),
964
- /* @__PURE__ */ jsx(
965
- "meshStandardMaterial",
966
- {
967
- color: palette.guardFail,
968
- emissive: palette.guardFail,
969
- emissiveIntensity: 1
970
- }
971
- )
972
- ] }),
973
- /* @__PURE__ */ jsxs("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
974
- /* @__PURE__ */ jsx("torusGeometry", { args: [0.2, 0.015, 8, 24] }),
975
- /* @__PURE__ */ jsx(
976
- "meshStandardMaterial",
977
- {
978
- color: palette.guardFail,
979
- emissive: palette.guardFail,
980
- emissiveIntensity: 0.5
981
- }
982
- )
983
- ] })
984
- ] }),
985
- active && /* @__PURE__ */ jsx(
986
- "pointLight",
987
- {
988
- color: palette.stateActive,
989
- intensity: 1.5,
990
- distance: 4,
991
- decay: 2
992
- }
993
- ),
994
- /* @__PURE__ */ jsx(
995
- Avl3DLabel,
996
- {
997
- position: [0, -0.55, 0],
998
- text: name,
999
- color: active ? palette.stateActive : AVL_INK.text,
1000
- fontSize: 11
1001
- }
1002
- ),
1003
- hovered && /* @__PURE__ */ jsx(
1004
- Avl3DTooltip,
1005
- {
1006
- position: [0.9, 0.3, 0],
1007
- title: name,
1008
- accentColor: active ? AVL_3D_COLORS.stateActive : AVL_3D_COLORS.stateEdge,
1009
- rows: [
1010
- { label: t("avl3d.type"), value: isInitial ? t("avl3d.typeInitial") : isTerminal ? t("avl3d.typeTerminal") : t("avl3d.typeStandard") },
1011
- { label: t("avl3d.incoming"), value: String(incomingCount) },
1012
- { label: t("avl3d.outgoing"), value: String(outgoingCount) },
1013
- ...active ? [{ label: t("avl3d.status"), value: t("status.active") }] : []
1014
- ]
1015
- }
1016
- )
1017
- ] });
1018
- };
1019
- Avl3DStateNode.displayName = "Avl3DStateNode";
1020
- var Avl3DTransitionArc = ({
1021
- from,
1022
- to,
1023
- event,
1024
- hasGuard = false,
1025
- effectTypes,
1026
- index,
1027
- isSelf = false,
1028
- fromState,
1029
- toState,
1030
- onClick,
1031
- color
1032
- }) => {
1033
- const [hovered, setHovered] = useState(false);
1034
- const palette = useAvl3DPalette();
1035
- const { t } = useTranslate();
1036
- const { tubeArgs, labelPos, guardPos, arrowPos, arrowQuat, effectPositions } = useMemo(() => {
1037
- const offset = 1.5 + index * 0.8;
1038
- const curve = isSelf ? selfLoopCurve3D(from, 1.2) : arcCurve3D(from, to, offset);
1039
- const mid = curve.getPoint(0.5);
1040
- const guardPt = curve.getPoint(0.3);
1041
- const arrowPt = curve.getPoint(0.9);
1042
- const arrowTangent = curve.getTangent(0.9);
1043
- const upVec = new Vector3(0, 1, 0);
1044
- const tangentVec = new Vector3(arrowTangent.x, arrowTangent.y, arrowTangent.z).normalize();
1045
- const quat = new Quaternion().setFromUnitVectors(upVec, tangentVec);
1046
- const effectPositions2 = [];
1047
- for (let ei = 0; ei < 4; ei++) {
1048
- const t2 = 0.7 + ei * 0.05;
1049
- const ep = curve.getPoint(t2);
1050
- effectPositions2.push([ep.x, ep.y + 0.2, ep.z]);
1051
- }
1052
- return {
1053
- tubeArgs: [curve, 48, 0.02, 8, false],
1054
- labelPos: [mid.x, mid.y + 0.3, mid.z],
1055
- guardPos: [guardPt.x, guardPt.y, guardPt.z],
1056
- arrowPos: [arrowPt.x, arrowPt.y, arrowPt.z],
1057
- arrowQuat: [quat.x, quat.y, quat.z, quat.w],
1058
- effectPositions: effectPositions2
1059
- };
1060
- }, [from, to, index, isSelf]);
1061
- const emissiveIntensity = hovered ? 0.8 : 0.4;
1062
- if (!palette) return null;
1063
- const arcColor = color ?? palette.transitionArc;
1064
- return /* @__PURE__ */ jsxs("group", { children: [
1065
- /* @__PURE__ */ jsxs(
1066
- "mesh",
1067
- {
1068
- onClick: (e) => {
1069
- e.stopPropagation();
1070
- onClick?.();
1071
- },
1072
- onPointerOver: (e) => {
1073
- e.stopPropagation();
1074
- setHovered(true);
1075
- document.body.style.cursor = "pointer";
1076
- },
1077
- onPointerOut: () => {
1078
- setHovered(false);
1079
- document.body.style.cursor = "auto";
1080
- },
1081
- children: [
1082
- /* @__PURE__ */ jsx("tubeGeometry", { args: [tubeArgs[0], tubeArgs[1], tubeArgs[2], tubeArgs[3], tubeArgs[4]] }),
1083
- /* @__PURE__ */ jsx(
1084
- "meshStandardMaterial",
1085
- {
1086
- color: arcColor,
1087
- emissive: arcColor,
1088
- emissiveIntensity,
1089
- transparent: true,
1090
- opacity: hovered ? 0.9 : 0.7
1091
- }
1092
- )
1093
- ]
1094
- }
1095
- ),
1096
- hasGuard && /* @__PURE__ */ jsxs("mesh", { position: guardPos, scale: 0.15, children: [
1097
- /* @__PURE__ */ jsx("octahedronGeometry", { args: [1, 0] }),
1098
- /* @__PURE__ */ jsx(
1099
- "meshStandardMaterial",
1100
- {
1101
- color: palette.guardPass,
1102
- emissive: palette.guardPass,
1103
- emissiveIntensity: 0.8
1104
- }
1105
- )
1106
- ] }),
1107
- /* @__PURE__ */ jsxs(
1108
- "mesh",
1109
- {
1110
- position: arrowPos,
1111
- quaternion: arrowQuat,
1112
- scale: 0.08,
1113
- children: [
1114
- /* @__PURE__ */ jsx("coneGeometry", { args: [1, 2, 8] }),
1115
- /* @__PURE__ */ jsx(
1116
- "meshStandardMaterial",
1117
- {
1118
- color: arcColor,
1119
- emissive: arcColor,
1120
- emissiveIntensity: 0.6
1121
- }
1122
- )
1123
- ]
1124
- }
1125
- ),
1126
- /* @__PURE__ */ jsx(
1127
- Avl3DLabel,
1128
- {
1129
- position: labelPos,
1130
- text: event,
1131
- color: hovered ? AVL_INK.text : arcColor,
1132
- fontSize: hovered ? 11 : 9
1133
- }
1134
- ),
1135
- hovered && /* @__PURE__ */ jsx(
1136
- Avl3DTooltip,
1137
- {
1138
- position: [labelPos[0], labelPos[1] + 0.6, labelPos[2]],
1139
- title: event,
1140
- accentColor: arcColor,
1141
- rows: [
1142
- ...fromState && toState ? [{ label: t("avl.transition"), value: `${fromState} \u2192 ${toState}` }] : [],
1143
- ...hasGuard ? [{ label: t("avl.guard"), value: t("common.yes") }] : [],
1144
- ...effectTypes && effectTypes.length > 0 ? [{ label: t("avl.effects"), value: effectTypes.slice(0, 3).join(", ") + (effectTypes.length > 3 ? ` +${effectTypes.length - 3}` : "") }] : []
1145
- ]
1146
- }
1147
- ),
1148
- effectTypes && effectTypes.length > 0 && effectTypes.slice(0, 4).map((effectType, ei) => {
1149
- const pt = effectPositions[ei];
1150
- if (!pt) return null;
1151
- const eColor = palette[effectTypePaletteKey(effectType)];
1152
- return /* @__PURE__ */ jsx("group", { position: pt, children: /* @__PURE__ */ jsxs("mesh", { scale: 0.06, children: [
1153
- effectType === "render-ui" ? /* @__PURE__ */ jsx("boxGeometry", { args: [1.5, 1.5, 0.3] }) : effectType === "persist" ? /* @__PURE__ */ jsx("cylinderGeometry", { args: [0.6, 0.6, 1.5, 8] }) : effectType === "emit" ? /* @__PURE__ */ jsx("sphereGeometry", { args: [1, 8, 8] }) : effectType === "navigate" ? /* @__PURE__ */ jsx("coneGeometry", { args: [0.8, 1.5, 6] }) : effectType === "set" ? /* @__PURE__ */ jsx("tetrahedronGeometry", { args: [1, 0] }) : effectType === "call-service" ? /* @__PURE__ */ jsx("torusGeometry", { args: [0.8, 0.3, 6, 12] }) : /* @__PURE__ */ jsx("octahedronGeometry", { args: [0.8, 0] }),
1154
- /* @__PURE__ */ jsx(
1155
- "meshStandardMaterial",
1156
- {
1157
- color: eColor,
1158
- emissive: eColor,
1159
- emissiveIntensity: 0.8
1160
- }
1161
- )
1162
- ] }) }, ei);
1163
- })
1164
- ] });
1165
- };
1166
- Avl3DTransitionArc.displayName = "Avl3DTransitionArc";
1167
- function edgeGeometry(parent, child) {
1168
- const p = new Vector3(parent.x, parent.y, parent.z);
1169
- const c = new Vector3(child.x, child.y, child.z);
1170
- const mid = new Vector3().addVectors(p, c).multiplyScalar(0.5);
1171
- const dir = new Vector3().subVectors(c, p);
1172
- const length = dir.length();
1173
- const yAxis = new Vector3(0, 1, 0);
1174
- const angle = yAxis.angleTo(dir.normalize());
1175
- const axis = new Vector3().crossVectors(yAxis, dir).normalize();
1176
- if (axis.length() < 1e-3) {
1177
- return {
1178
- position: [mid.x, mid.y, mid.z],
1179
- rotation: [0, 0, 0],
1180
- length
1181
- };
1182
- }
1183
- return {
1184
- position: [mid.x, mid.y, mid.z],
1185
- rotation: [
1186
- axis.x * angle,
1187
- axis.y * angle,
1188
- axis.z * angle
1189
- ],
1190
- length
1191
- };
1192
- }
1193
- var Avl3DExprTree = ({
1194
- expression,
1195
- position
1196
- }) => {
1197
- const layoutResults = useMemo(() => {
1198
- const origin = { x: position[0], y: position[1], z: position[2] };
1199
- return treeLayout3D(expression, origin, 2.5, 1.5);
1200
- }, [expression, position]);
1201
- const edges = useMemo(() => {
1202
- const result = [];
1203
- function collectEdges(node, parentPos) {
1204
- const entry = layoutResults.find((r) => r.node === node);
1205
- if (!entry) return;
1206
- if (parentPos) {
1207
- result.push({
1208
- parent: parentPos,
1209
- child: entry.position,
1210
- key: `${parentPos.x}-${parentPos.y}-${entry.position.x}-${entry.position.y}`
1211
- });
1212
- }
1213
- if (node.children) {
1214
- for (const child of node.children) {
1215
- collectEdges(child, entry.position);
1216
- }
1217
- }
1218
- }
1219
- collectEdges(expression, null);
1220
- return result;
1221
- }, [expression, layoutResults]);
1222
- const palette = useAvl3DPalette();
1223
- if (!palette) return null;
1224
- return /* @__PURE__ */ jsxs("group", { children: [
1225
- edges.map((edge) => {
1226
- const geo = edgeGeometry(edge.parent, edge.child);
1227
- return /* @__PURE__ */ jsxs(
1228
- "mesh",
1229
- {
1230
- position: geo.position,
1231
- rotation: geo.rotation,
1232
- children: [
1233
- /* @__PURE__ */ jsx("cylinderGeometry", { args: [0.015, 0.015, geo.length, 6] }),
1234
- /* @__PURE__ */ jsx(
1235
- "meshStandardMaterial",
1236
- {
1237
- color: palette.transitionArc,
1238
- transparent: true,
1239
- opacity: 0.5
1240
- }
1241
- )
1242
- ]
1243
- },
1244
- edge.key
1245
- );
1246
- }),
1247
- layoutResults.map((entry, i) => {
1248
- const pos = [
1249
- entry.position.x,
1250
- entry.position.y,
1251
- entry.position.z
1252
- ];
1253
- if (entry.node.type === "operator") {
1254
- const opColor = palette[exprOperatorPaletteKey(entry.node.label)];
1255
- return /* @__PURE__ */ jsxs("group", { position: pos, children: [
1256
- /* @__PURE__ */ jsxs("mesh", { children: [
1257
- /* @__PURE__ */ jsx("boxGeometry", { args: [0.6, 0.4, 0.3] }),
1258
- /* @__PURE__ */ jsx(
1259
- "meshStandardMaterial",
1260
- {
1261
- color: opColor,
1262
- emissive: opColor,
1263
- emissiveIntensity: 0.4,
1264
- roughness: 0.3
1265
- }
1266
- )
1267
- ] }),
1268
- /* @__PURE__ */ jsx(
1269
- Avl3DLabel,
1270
- {
1271
- position: [0, -0.4, 0],
1272
- text: entry.node.label,
1273
- color: opColor,
1274
- fontSize: 10
1275
- }
1276
- )
1277
- ] }, i);
1278
- }
1279
- if (entry.node.type === "binding") {
1280
- return /* @__PURE__ */ jsxs("group", { position: pos, children: [
1281
- /* @__PURE__ */ jsxs("mesh", { scale: 0.08, children: [
1282
- /* @__PURE__ */ jsx("torusKnotGeometry", { args: [2, 0.6, 48, 8, 2, 3] }),
1283
- /* @__PURE__ */ jsx(
1284
- "meshStandardMaterial",
1285
- {
1286
- color: palette.exprBinding,
1287
- emissive: palette.exprBinding,
1288
- emissiveIntensity: 0.4,
1289
- transparent: true,
1290
- opacity: 0.85,
1291
- roughness: 0.3
1292
- }
1293
- )
1294
- ] }),
1295
- /* @__PURE__ */ jsx(
1296
- Avl3DLabel,
1297
- {
1298
- position: [0, -0.35, 0],
1299
- text: entry.node.label,
1300
- color: palette.exprBinding,
1301
- fontSize: 9
1302
- }
1303
- )
1304
- ] }, i);
1305
- }
1306
- return /* @__PURE__ */ jsxs("group", { position: pos, children: [
1307
- /* @__PURE__ */ jsxs("mesh", { rotation: [Math.PI / 6, Math.PI / 4, 0], children: [
1308
- /* @__PURE__ */ jsx("boxGeometry", { args: [0.2, 0.2, 0.2] }),
1309
- /* @__PURE__ */ jsx(
1310
- "meshStandardMaterial",
1311
- {
1312
- color: palette.exprLiteral,
1313
- emissive: palette.exprLiteral,
1314
- emissiveIntensity: 0.2,
1315
- roughness: 0.5
1316
- }
1317
- )
1318
- ] }),
1319
- /* @__PURE__ */ jsx(
1320
- Avl3DLabel,
1321
- {
1322
- position: [0, -0.3, 0],
1323
- text: entry.node.label,
1324
- color: palette.exprLiteral,
1325
- fontSize: 8
1326
- }
1327
- )
1328
- ] }, i);
1329
- })
1330
- ] });
1331
- };
1332
- Avl3DExprTree.displayName = "Avl3DExprTree";
1333
-
1334
- export { AVL_3D_COLORS, Avl3DCrossWire, Avl3DEntityCore, Avl3DExprTree, Avl3DLabel, Avl3DOrbitalNode, Avl3DStateNode, Avl3DTooltip, Avl3DTransitionArc, CAMERA_POSITIONS, arcCurve3D, fibonacciSpherePositions, forceDirectedPositions, getBreadcrumbs, goldenSpiralPositions, initialZoomState, orbitRingPositions, selfLoopCurve3D, treeLayout3D, zoomReducer };