@almadar/shell-web 1.0.0 → 1.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.
- package/dist/AvlGlyph-PIXU6QH5.js +5 -0
- package/dist/AvlStateMachine-CKGMECMG.js +8 -0
- package/dist/{AvlTransitionDetail-63SD6GZF.js → AvlTransitionDetail-QZX6G5KJ.js} +4 -5
- package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
- package/dist/BehaviorView-JLZ4PKWY.js +10 -0
- package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
- package/dist/{FlowCanvas-AUMTWMNG.js → FlowCanvas-RPII4V24.js} +10 -13
- package/dist/{FlowCanvas-3JRMNJLV.css → FlowCanvas-VWUPMBKB.css} +189 -191
- package/dist/{GameAudioProvider-ceM_n0ey.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +1 -1
- package/dist/{KernelEngineContext-CcxGYtlr.d.ts → KernelEngineContext-CPeWQMAz.d.ts} +15 -2
- package/dist/ModuleCard-NJD6JQGD.js +6 -0
- package/dist/{OrbInspector-QCPEPUPH.js → OrbInspector-OWWKPOBF.js} +10 -13
- package/dist/{OrbInspector-MHLJ6OEE.css → OrbInspector-VMTMZHNQ.css} +189 -191
- package/dist/{Select-B-iDdnvE.d.ts → Select-C2Uq6t86.d.ts} +1 -1
- package/dist/{UISlotRenderer-KVFO6J7R.css → UISlotRenderer-BIS6KT7T.css} +189 -191
- package/dist/{UISlotRenderer-C7WWOK43.js → UISlotRenderer-PY7FIJXN.js} +10 -13
- package/dist/avl/index.css +189 -191
- package/dist/avl/index.d.ts +19 -7
- package/dist/avl/index.js +157 -26
- package/dist/{chunk-TUPZWTRE.js → chunk-2WGR4TDJ.js} +464 -35
- package/dist/{chunk-SP5CDJ6K.js → chunk-4YJ53G7S.js} +3 -3
- package/dist/{chunk-HH5KSMH5.js → chunk-7N6ZPHQ5.js} +1 -1
- package/dist/{chunk-CPLN6NBQ.js → chunk-AGVSO4WY.js} +2 -3
- package/dist/{chunk-UXLE3IPR.js → chunk-FAKU5F62.js} +205 -4
- package/dist/{chunk-TXAUOLWZ.js → chunk-M74BCDBQ.js} +1 -1
- package/dist/{chunk-LHP2TK7O.js → chunk-MS4K3K2R.js} +2908 -4574
- package/dist/{chunk-K4MOPSEL.js → chunk-OWNG4JZI.js} +3 -4
- package/dist/{chunk-AB3X7QTE.js → chunk-PRLHKBXG.js} +1 -2
- package/dist/{chunk-X3DMMX27.js → chunk-VHC2M26B.js} +1 -1
- package/dist/{chunk-E6KA4J6N.js → chunk-VUIACGDU.js} +3 -4
- package/dist/{chunk-ROICKAU7.js → chunk-YYIHRIDH.js} +1 -1
- package/dist/{chunk-3VZ36ZKO.js → chunk-ZDRDJKYB.js} +5 -2
- package/dist/components/index.css +189 -191
- package/dist/components/index.d.ts +417 -173
- package/dist/components/index.js +14 -17
- package/dist/core.d.ts +3 -3
- package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/{kernel-client-TZKGHJRY.js → kernel-client-JW6OH5FX.js} +24 -3
- package/dist/{kernel-wire-wNdAPfhJ.d.ts → kernel-wire-DGAySGhX.d.ts} +7 -0
- package/dist/lib/index.d.ts +2 -3
- package/dist/lib/index.js +2 -3
- package/dist/providers/index.css +189 -191
- package/dist/providers/index.d.ts +6 -8
- package/dist/providers/index.js +10 -14
- package/dist/runtime/index.css +189 -191
- package/dist/runtime/index.d.ts +6 -1
- package/dist/runtime/index.js +10 -13
- package/dist/test-support.js +2 -2
- package/dist/{paintDispatch-CuJLsr9Y.d.ts → verificationRegistry-oopV1J1n.d.ts} +127 -15
- package/package.json +8 -36
- package/dist/AvlGlyph-EPJKFEO3.js +0 -6
- package/dist/AvlStateMachine-RKZIKNGC.js +0 -9
- package/dist/AvlTransitionExplainer-ZBTLOM3T.js +0 -12
- package/dist/BehaviorView-YS5G4GNB.js +0 -11
- package/dist/Canvas3DHost-BkZQB5l2.d.ts +0 -552
- package/dist/ModuleCard-QHDGK5XK.js +0 -7
- package/dist/avl-3d-context-BycmO6tG.d.ts +0 -201
- package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
- package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
- package/dist/chunk-4T3P43NS.js +0 -1133
- package/dist/chunk-DZBQA2OW.js +0 -176
- package/dist/chunk-EOWMARUB.js +0 -16
- package/dist/chunk-GFXCPUMX.js +0 -1334
- package/dist/chunk-ILZ7ORX7.js +0 -432
- package/dist/three/index.css +0 -503
- package/dist/three/index.d.ts +0 -1185
- package/dist/three/index.js +0 -3908
- package/dist/verificationRegistry-CVrcxG1s.d.ts +0 -122
package/dist/chunk-GFXCPUMX.js
DELETED
|
@@ -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 };
|