@almadar/ui 6.56.0 → 6.58.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/{ArbitraryClassCompiler-DvzdeHxc.d.ts → ArbitraryClassCompiler-tChQ3nVq.d.ts} +15 -1
- package/dist/{AwaitingSkeletonContext-DPgW__WV.d.ts → AwaitingSkeletonContext-Bh399p1x.d.ts} +1 -3
- package/dist/{Canvas3DHost-DfAhg6EH.d.ts → Canvas3DHost-BTvRPfsr.d.ts} +1 -1
- package/dist/{FileTree-DUi7e7Z8.d.ts → FileTree-BSfgp-HH.d.ts} +29 -2
- package/dist/{GameAudioProvider-DyBvYP2c.d.ts → GameAudioProvider-kXbonWTv.d.ts} +1 -1
- package/dist/Typography-LZTP72Y4.js +5 -0
- package/dist/{UISlotRenderer-QTHFT6Z4.js → UISlotRenderer-N5DFYE6K.js} +8 -8
- package/dist/avl/index.cjs +4940 -4265
- package/dist/avl/index.d.ts +74 -5
- package/dist/avl/index.js +68 -711
- package/dist/{avl-schema-parser-C0wnAp5x.d.ts → avl-schema-parser-CH1QoZw1.d.ts} +1 -1
- package/dist/{chunk-HCSJHRC4.js → chunk-4ZGXIW3B.js} +1 -1
- package/dist/{chunk-RNY5LJXJ.js → chunk-723MJUU3.js} +1 -1
- package/dist/{chunk-6EV3OEBQ.js → chunk-CHNC4UYE.js} +3 -2
- package/dist/{chunk-SGJHVPHC.js → chunk-GZGDBS4S.js} +2 -2
- package/dist/{chunk-Y53Q55H5.js → chunk-HA7CJWQX.js} +1123 -1121
- package/dist/{chunk-FQM37C56.js → chunk-HB3D3HUJ.js} +129 -79
- package/dist/{chunk-XZKGRSIO.js → chunk-I2ZNE5TD.js} +2522 -1188
- package/dist/{chunk-JRW33U35.js → chunk-I5QOYW2Z.js} +1 -1
- package/dist/{chunk-KQXXO42S.js → chunk-KJGVLXEN.js} +78 -1
- package/dist/{chunk-HRCR53OW.js → chunk-LZRW6GXG.js} +18 -3
- package/dist/{chunk-2LFBQ4IS.js → chunk-MZIDOJMD.js} +2 -2
- package/dist/{chunk-QGH4NAQO.js → chunk-N7JIG57B.js} +9 -4
- package/dist/chunk-YYYHH5BA.js +2519 -0
- package/dist/{cn-ClXGlIOY.d.ts → cn-DIql5232.d.ts} +152 -24
- package/dist/components/index.cjs +6917 -3102
- package/dist/components/index.d.ts +54 -101
- package/dist/components/index.js +14 -16
- package/dist/context/index.cjs +23 -0
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +20 -1
- package/dist/hooks/index.cjs +2544 -7
- package/dist/hooks/index.d.ts +4 -1
- package/dist/hooks/index.js +7 -6
- package/dist/lib/drawable/three/index.cjs +22 -6
- package/dist/lib/drawable/three/index.d.ts +4 -4
- package/dist/lib/drawable/three/index.js +7 -7
- package/dist/lib/index.cjs +18 -3
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +4 -5
- package/dist/locales/index.cjs +54 -9
- package/dist/locales/index.js +2 -2489
- package/dist/{paintDispatch-_6EhJCiL.d.ts → paintDispatch-BN8Vbzgs.d.ts} +1 -1
- package/dist/providers/index.cjs +4075 -2415
- package/dist/providers/index.d.ts +6 -6
- package/dist/providers/index.js +26 -18
- package/dist/runtime/index.cjs +4198 -2498
- package/dist/runtime/index.d.ts +4 -17
- package/dist/runtime/index.js +11 -10
- package/dist/ssr/index.cjs +23 -6
- package/dist/ssr/index.js +23 -6
- package/dist/{useEventBus-JUAH3EFW.js → useEventBus-SWRN475O.js} +1 -1
- package/dist/{verificationRegistry-CD7Xb40L.d.ts → verificationRegistry-CK76GUfH.d.ts} +1 -1
- package/locales/ar.json +18 -3
- package/locales/en.json +18 -3
- package/locales/sl.json +18 -3
- package/package.json +9 -8
- package/tailwind-preset.cjs +3 -0
- package/themes/_fonts.css +1 -1
- package/themes/_presets.css +1 -0
- package/themes/kflow.css +299 -0
- package/dist/Typography-7PDT62PG.js +0 -5
- package/dist/chunk-F4ZTPKZL.js +0 -284
- package/dist/chunk-OKWD7LPO.js +0 -80
package/dist/avl/index.js
CHANGED
|
@@ -1,617 +1,34 @@
|
|
|
1
|
-
import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-
|
|
2
|
-
import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-
|
|
3
|
-
import {
|
|
4
|
-
import { useTranslate as useTranslate$1 } from '../chunk-QGH4NAQO.js';
|
|
1
|
+
import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-HB3D3HUJ.js';
|
|
2
|
+
import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-GZGDBS4S.js';
|
|
3
|
+
import { useTranslate as useTranslate$1 } from '../chunk-N7JIG57B.js';
|
|
5
4
|
import '../chunk-VHTJRS2N.js';
|
|
5
|
+
import '../chunk-YYYHH5BA.js';
|
|
6
6
|
import { spacingTokenOf, positionOf, withPosition, snapToSpacingStep, defaultSpacingStepPx, spacingOf, withSizing, withSpacing, layoutOf, withLayout, sizingOf, DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, sizeLimitOf, withSizeLimit, isArbitraryClass, tokenOfDesignClass } from '../chunk-D2E44ODB.js';
|
|
7
|
-
import { AvlGlyph, Popover, Button, Icon, Select, Badge, IconButton, AvlStateMachine, Input,
|
|
8
|
-
export { AVL_GLYPH_KINDS, AvlApplication, AvlBinding, AvlBindingRef, AvlEffect, AvlEntity, AvlEvent, AvlField, AvlFieldType, AvlGlyph, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlPage, AvlPersistence, AvlSExpr, AvlState, AvlStateMachine, AvlTrait, AvlTransition, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-
|
|
9
|
-
import { avlSeries, STATE_COLORS, Box, HStack, VStack, avlTint, CONNECTION_COLORS, parseTraitLevel,
|
|
10
|
-
export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-
|
|
11
|
-
import { Typography, INLINE_TEXT_ATTR } from '../chunk-
|
|
12
|
-
import { usePrefersReducedMotion
|
|
7
|
+
import { AvlGlyph, Popover, Button, Icon, Select, Badge, IconButton, AvlStateMachine, Input, AvlOrbital, AvlTrait, AvlEntity, AvlPage, AvlEvent, AvlGuard, AvlEffect, AvlState, useAlmadarDndSensors, almadarDndCollisionDetection, TagInput, Checkbox, Switch, CodeBlock, AvlFieldType, FileTree, AvlTransitionDetail, RangeSlider, computeTraitLayout, edgePath, Accordion, FormField, Radio, useCompactLayout, ButtonGroup } from '../chunk-I2ZNE5TD.js';
|
|
8
|
+
export { AVL_GLYPH_KINDS, AvlApplication, AvlBinding, AvlBindingRef, AvlCircuit, AvlEffect, AvlEffectChip, AvlEntity, AvlEvent, AvlField, AvlFieldType, AvlGlyph, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlPage, AvlPersistence, AvlSExpr, AvlState, AvlStateMachine, AvlTrait, AvlTransition, AvlTransitionDetail, AvlTransitionExplainer, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-I2ZNE5TD.js';
|
|
9
|
+
import { avlSeries, STATE_COLORS, Box, HStack, VStack, avlTint, CONNECTION_COLORS, parseTraitLevel, parseApplicationLevel, parseOrbitalLevel, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, pressableProps, traitTransitionRenderUi, traitEventWires } from '../chunk-HA7CJWQX.js';
|
|
10
|
+
export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-HA7CJWQX.js';
|
|
11
|
+
import { Typography, INLINE_TEXT_ATTR } from '../chunk-4ZGXIW3B.js';
|
|
12
|
+
import { usePrefersReducedMotion } from '../chunk-I5QOYW2Z.js';
|
|
13
13
|
import '../chunk-XJTHMW4G.js';
|
|
14
|
-
import { useEventBus } from '../chunk-
|
|
15
|
-
import { profilerOnRender, perfStart, perfEnd } from '../chunk-
|
|
14
|
+
import { useEventBus } from '../chunk-CHNC4UYE.js';
|
|
15
|
+
import { profilerOnRender, perfStart, perfEnd } from '../chunk-KJGVLXEN.js';
|
|
16
16
|
import { isEditableTarget } from '../chunk-Q47ZN2DW.js';
|
|
17
17
|
import { cn } from '../chunk-64WACXM7.js';
|
|
18
|
-
import '../chunk-
|
|
19
|
-
import '../chunk-
|
|
18
|
+
import '../chunk-723MJUU3.js';
|
|
19
|
+
import '../chunk-LZRW6GXG.js';
|
|
20
20
|
import '../chunk-PQKU62LK.js';
|
|
21
21
|
import '../chunk-PEST66PN.js';
|
|
22
22
|
import '../chunk-QPXIAUJD.js';
|
|
23
|
-
import
|
|
24
|
-
import { FieldTypeSchema, EFFECT_OPERATORS, isInlineTrait, isPageReference, navigatePatternPath, isAriaRole, formatSExpr, answerToMutations, isBinding } from '@almadar/core';
|
|
25
|
-
import { operatorVisualForm, getStdOperatorMeta } from '@almadar/std/registry';
|
|
26
|
-
import { useTranslate } from '@almadar/ui/hooks';
|
|
23
|
+
import React16, { createContext, useContext, useState, useRef, useCallback, useMemo, useEffect, Profiler, useReducer } from 'react';
|
|
27
24
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
25
|
+
import { useTranslate } from '@almadar/ui/hooks';
|
|
28
26
|
import { MarkerType, Handle, Position, useReactFlow, NodeResizeControl, ResizeControlVariant, getBezierPath, EdgeLabelRenderer, BaseEdge, ReactFlow, Controls, Background, BackgroundVariant, ReactFlowProvider, useNodesState, useEdgesState, useNodesInitialized } from '@xyflow/react';
|
|
29
27
|
import { renderUiEntriesOf, getPatternDefinition, isEntityAwarePattern, eventKeyPropsOf, eventListPropsOf } from '@almadar/core/patterns';
|
|
28
|
+
import { FieldTypeSchema, EFFECT_OPERATORS, isInlineTrait, isPageReference, navigatePatternPath, isAriaRole, answerToMutations } from '@almadar/core';
|
|
30
29
|
import { createLogger } from '@almadar/logger';
|
|
31
30
|
import { useDroppable, useDraggable, DndContext, DragOverlay } from '@dnd-kit/core';
|
|
32
31
|
|
|
33
|
-
var MONO = 7.4;
|
|
34
|
-
var ROW = 40;
|
|
35
|
-
var GAP_X = 112;
|
|
36
|
-
var GAP_Y = 16;
|
|
37
|
-
var PAD = 12;
|
|
38
|
-
var keyOf = (path) => path.join(".");
|
|
39
|
-
function leafLabel(expr) {
|
|
40
|
-
if (typeof expr === "string") return isBinding(expr) ? expr : JSON.stringify(expr);
|
|
41
|
-
if (expr === null) return "null";
|
|
42
|
-
if (typeof expr === "number" || typeof expr === "boolean") return String(expr);
|
|
43
|
-
return Array.isArray(expr) ? "[\u2026]" : "{\u2026}";
|
|
44
|
-
}
|
|
45
|
-
function build(expr, path) {
|
|
46
|
-
const base = { key: keyOf(path), path, expr, x: 0, y: 0, w: 0, h: 0, bandTop: 0, bandBottom: 0, wireLabels: [] };
|
|
47
|
-
if (Array.isArray(expr) && expr.length > 0 && typeof expr[0] === "string") {
|
|
48
|
-
const op = expr[0];
|
|
49
|
-
const args = expr.slice(1);
|
|
50
|
-
const form = operatorVisualForm(op) ?? "unknown";
|
|
51
|
-
if (form === "scope" && Array.isArray(args[0])) {
|
|
52
|
-
const pairs = args[0];
|
|
53
|
-
const bindings = pairs.map((pair, i) => {
|
|
54
|
-
const value = Array.isArray(pair) ? pair[1] : pair;
|
|
55
|
-
return build(value, [...path, 1, i, 1]);
|
|
56
|
-
});
|
|
57
|
-
const names = pairs.map((pair) => Array.isArray(pair) && typeof pair[0] === "string" ? pair[0] : "");
|
|
58
|
-
const body = args.slice(1).map((a, i) => build(a, [...path, i + 2]));
|
|
59
|
-
return { ...base, kind: "call", label: op, form, children: [...bindings, ...body], wireLabels: [...names, ...body.map(() => "")] };
|
|
60
|
-
}
|
|
61
|
-
if (form === "template") {
|
|
62
|
-
const params = args[0];
|
|
63
|
-
const body = args.slice(1).map((a, i) => build(a, [...path, i + 2]));
|
|
64
|
-
const paramText = Array.isArray(params) ? params.join(" ") : typeof params === "string" ? params : "";
|
|
65
|
-
return { ...base, kind: "call", label: `fn [${paramText}]`, form, children: body, wireLabels: body.map(() => "") };
|
|
66
|
-
}
|
|
67
|
-
const children = args.map((a, i) => build(a, [...path, i + 1]));
|
|
68
|
-
return { ...base, kind: "call", label: op, form, children, wireLabels: children.map(() => "") };
|
|
69
|
-
}
|
|
70
|
-
if (Array.isArray(expr)) {
|
|
71
|
-
const children = expr.map((a, i) => build(a, [...path, i]));
|
|
72
|
-
return { ...base, kind: "array", label: "[ ]", form: null, children, wireLabels: children.map((_, i) => String(i)) };
|
|
73
|
-
}
|
|
74
|
-
if (expr !== null && typeof expr === "object") {
|
|
75
|
-
const entries = Object.entries(expr);
|
|
76
|
-
const children = entries.map(([k, v]) => build(v, [...path, k]));
|
|
77
|
-
return { ...base, kind: "object", label: "{ }", form: null, children, wireLabels: entries.map(([k]) => k) };
|
|
78
|
-
}
|
|
79
|
-
return { ...base, kind: isBinding(expr) ? "binding" : "literal", label: leafLabel(expr), form: null, children: [] };
|
|
80
|
-
}
|
|
81
|
-
function size(n) {
|
|
82
|
-
n.children.forEach(size);
|
|
83
|
-
const ports = Math.max(1, n.children.length);
|
|
84
|
-
if (n.kind === "binding" || n.kind === "literal") {
|
|
85
|
-
n.w = Math.max(40, Math.round(n.label.length * MONO + 26));
|
|
86
|
-
n.h = 28;
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const labelW = Math.round(n.label.length * MONO + 28);
|
|
90
|
-
switch (n.form) {
|
|
91
|
-
case "series":
|
|
92
|
-
case "parallel":
|
|
93
|
-
n.w = Math.max(labelW, 120);
|
|
94
|
-
n.h = Math.max(ROW + 16, ports * 40 + 26);
|
|
95
|
-
return;
|
|
96
|
-
case "conveyor":
|
|
97
|
-
n.w = Math.max(labelW, 200);
|
|
98
|
-
n.h = Math.max(64, ports * 30 + 14);
|
|
99
|
-
return;
|
|
100
|
-
case "ladder":
|
|
101
|
-
n.w = Math.max(labelW, 80);
|
|
102
|
-
n.h = Math.max(ROW, ports * 30 + 14);
|
|
103
|
-
return;
|
|
104
|
-
case "actuator":
|
|
105
|
-
n.w = Math.max(labelW + 22, 96);
|
|
106
|
-
n.h = Math.max(ROW, ports * 26 + 12);
|
|
107
|
-
return;
|
|
108
|
-
default:
|
|
109
|
-
n.w = Math.max(labelW, 56);
|
|
110
|
-
n.h = Math.max(ROW, ports * 26 + 12);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function place(n, right, top) {
|
|
114
|
-
n.x = right - n.w;
|
|
115
|
-
if (n.children.length === 0) {
|
|
116
|
-
n.bandTop = top;
|
|
117
|
-
n.bandBottom = top + n.h;
|
|
118
|
-
n.y = top;
|
|
119
|
-
return n.h;
|
|
120
|
-
}
|
|
121
|
-
let cursor = top;
|
|
122
|
-
const childRight = n.x - GAP_X;
|
|
123
|
-
for (const child of n.children) {
|
|
124
|
-
const band2 = place(child, childRight, cursor);
|
|
125
|
-
cursor += band2 + GAP_Y;
|
|
126
|
-
}
|
|
127
|
-
const childrenBottom = cursor - GAP_Y;
|
|
128
|
-
const span = childrenBottom - top;
|
|
129
|
-
const band = Math.max(span, n.h);
|
|
130
|
-
n.bandTop = top;
|
|
131
|
-
n.bandBottom = top + band;
|
|
132
|
-
n.y = top + (band - n.h) / 2;
|
|
133
|
-
return band;
|
|
134
|
-
}
|
|
135
|
-
function subtreeWidth(n) {
|
|
136
|
-
return n.w + (n.children.length ? GAP_X + Math.max(...n.children.map(subtreeWidth)) : 0);
|
|
137
|
-
}
|
|
138
|
-
function shift(n, dx, dy) {
|
|
139
|
-
n.x += dx;
|
|
140
|
-
n.y += dy;
|
|
141
|
-
n.bandTop += dy;
|
|
142
|
-
n.bandBottom += dy;
|
|
143
|
-
n.children.forEach((c) => shift(c, dx, dy));
|
|
144
|
-
}
|
|
145
|
-
function buildCircuit(expr) {
|
|
146
|
-
const root = build(expr, []);
|
|
147
|
-
size(root);
|
|
148
|
-
const width = subtreeWidth(root);
|
|
149
|
-
const height = place(root, width, 0);
|
|
150
|
-
shift(root, PAD, PAD);
|
|
151
|
-
return { root, w: width + 2 * PAD, h: height + 2 * PAD };
|
|
152
|
-
}
|
|
153
|
-
function portY(n, i) {
|
|
154
|
-
const count = Math.max(1, n.children.length);
|
|
155
|
-
return n.y + n.h * (i + 1) / (count + 1);
|
|
156
|
-
}
|
|
157
|
-
function circuitState(trace, cursor) {
|
|
158
|
-
const out = /* @__PURE__ */ new Map();
|
|
159
|
-
const get = (k) => {
|
|
160
|
-
let s = out.get(k);
|
|
161
|
-
if (!s) {
|
|
162
|
-
s = { status: "idle", results: [] };
|
|
163
|
-
out.set(k, s);
|
|
164
|
-
}
|
|
165
|
-
return s;
|
|
166
|
-
};
|
|
167
|
-
for (let i = 0; i <= cursor && i < trace.length; i++) {
|
|
168
|
-
const step = trace[i];
|
|
169
|
-
const s = get(keyOf(step.path));
|
|
170
|
-
if (step.kind === "enter") s.status = "active";
|
|
171
|
-
else if (step.kind === "skip") s.status = "skipped";
|
|
172
|
-
else if (step.kind === "exit") {
|
|
173
|
-
if (step.error !== void 0) {
|
|
174
|
-
s.status = "error";
|
|
175
|
-
s.error = step.error;
|
|
176
|
-
} else {
|
|
177
|
-
s.status = "done";
|
|
178
|
-
s.value = step.value;
|
|
179
|
-
s.results.push(step.value ?? null);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return out;
|
|
184
|
-
}
|
|
185
|
-
function activeStack(trace, cursor) {
|
|
186
|
-
const stack = [];
|
|
187
|
-
for (let i = 0; i <= cursor && i < trace.length; i++) {
|
|
188
|
-
const step = trace[i];
|
|
189
|
-
const k = keyOf(step.path);
|
|
190
|
-
if (step.kind === "enter") stack.push(k);
|
|
191
|
-
else if (step.kind === "exit") {
|
|
192
|
-
const at = stack.lastIndexOf(k);
|
|
193
|
-
if (at >= 0) stack.splice(at, 1);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return stack;
|
|
197
|
-
}
|
|
198
|
-
var MIN_SCALE = 0.85;
|
|
199
|
-
var MAX_SCALE = 1.2;
|
|
200
|
-
var IDLE = { status: "idle", results: [] };
|
|
201
|
-
function truthy(v) {
|
|
202
|
-
return v !== void 0 && v !== null && v !== false && v !== 0 && v !== "";
|
|
203
|
-
}
|
|
204
|
-
function fmt(v) {
|
|
205
|
-
if (v === void 0) return "";
|
|
206
|
-
if (v === null || typeof v !== "object") return typeof v === "string" ? JSON.stringify(v) : String(v);
|
|
207
|
-
if (Array.isArray(v)) {
|
|
208
|
-
return v.length <= 4 && v.every((x) => x === null || typeof x !== "object") ? `[${v.map(fmt).join(" ")}]` : `[${v.length}]`;
|
|
209
|
-
}
|
|
210
|
-
const keys = Object.keys(v);
|
|
211
|
-
return keys.length <= 3 ? `{${keys.join(", ")}}` : `{${keys.length}}`;
|
|
212
|
-
}
|
|
213
|
-
function opColor(op) {
|
|
214
|
-
const meta = getStdOperatorMeta(op);
|
|
215
|
-
return meta ? OPERATOR_CATEGORY_COLORS[meta.category] : AVL_INK.quiet;
|
|
216
|
-
}
|
|
217
|
-
var AvlCircuit = ({ expr, trace, cursor, title, showCode = true, className }) => {
|
|
218
|
-
const { t } = useTranslate();
|
|
219
|
-
const reduceMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
220
|
-
const hostRef = useRef(null);
|
|
221
|
-
const hostWidth = useContainerWidth(hostRef);
|
|
222
|
-
const circuit = useMemo(() => buildCircuit(expr), [expr]);
|
|
223
|
-
const at = trace ? Math.min(cursor ?? trace.length - 1, trace.length - 1) : -1;
|
|
224
|
-
const states = useMemo(() => trace ? circuitState(trace, at) : /* @__PURE__ */ new Map(), [trace, at]);
|
|
225
|
-
const stack = useMemo(() => trace ? activeStack(trace, at) : [], [trace, at]);
|
|
226
|
-
const nodes = useMemo(() => {
|
|
227
|
-
const out = /* @__PURE__ */ new Map();
|
|
228
|
-
const walk2 = (n) => {
|
|
229
|
-
out.set(n.key, n);
|
|
230
|
-
n.children.forEach(walk2);
|
|
231
|
-
};
|
|
232
|
-
walk2(circuit.root);
|
|
233
|
-
return out;
|
|
234
|
-
}, [circuit]);
|
|
235
|
-
const parents = useMemo(() => {
|
|
236
|
-
const out = /* @__PURE__ */ new Map();
|
|
237
|
-
const walk2 = (n) => {
|
|
238
|
-
n.children.forEach((c) => {
|
|
239
|
-
out.set(c.key, n);
|
|
240
|
-
walk2(c);
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
walk2(circuit.root);
|
|
244
|
-
return out;
|
|
245
|
-
}, [circuit]);
|
|
246
|
-
const stateOf = (n) => {
|
|
247
|
-
const s = states.get(n.key) ?? IDLE;
|
|
248
|
-
if (s.status !== "skipped") return s;
|
|
249
|
-
const form = parents.get(n.key)?.form;
|
|
250
|
-
return form === "series" || form === "parallel" || form === "branch" ? s : IDLE;
|
|
251
|
-
};
|
|
252
|
-
const scale = Math.min(MAX_SCALE, Math.max(MIN_SCALE, hostWidth ? hostWidth / (circuit.w + 120) : 1));
|
|
253
|
-
const W = circuit.w + 120;
|
|
254
|
-
const narration = (() => {
|
|
255
|
-
if (!trace || at < 0) return null;
|
|
256
|
-
const step = trace[at];
|
|
257
|
-
const node = nodes.get(step.path.join("."));
|
|
258
|
-
const code = node ? formatSExpr(node.expr) : "";
|
|
259
|
-
if (step.kind === "enter") return t("avl.circuit.evaluating", { code });
|
|
260
|
-
if (step.kind === "skip") return t("avl.circuit.skipped", { code });
|
|
261
|
-
if (step.kind === "iter") return t("avl.circuit.nextItem", { code });
|
|
262
|
-
if (step.error !== void 0) return t("avl.circuit.failed", { code, error: step.error });
|
|
263
|
-
return t("avl.circuit.returned", { code, value: fmt(step.value) });
|
|
264
|
-
})();
|
|
265
|
-
const wire = (parent, child, i) => {
|
|
266
|
-
const s = stateOf(child);
|
|
267
|
-
const x1 = child.x + child.w;
|
|
268
|
-
const y1 = child.y + child.h / 2;
|
|
269
|
-
const x2 = parent.x;
|
|
270
|
-
const y2 = portY(parent, i);
|
|
271
|
-
const xm = x2 - 24;
|
|
272
|
-
const d = roundedEdgePath([{ x: x1, y: y1 }, { x: xm, y: y1 }, { x: xm, y: y2 }, { x: x2, y: y2 }], 8);
|
|
273
|
-
const live = s.status === "done";
|
|
274
|
-
const running = s.status === "active";
|
|
275
|
-
const label = parent.wireLabels[i];
|
|
276
|
-
return /* @__PURE__ */ jsxs("g", { children: [
|
|
277
|
-
/* @__PURE__ */ jsx(
|
|
278
|
-
"path",
|
|
279
|
-
{
|
|
280
|
-
d,
|
|
281
|
-
fill: "none",
|
|
282
|
-
stroke: s.status === "error" ? AVL_INK.fail : live || running ? AVL_INK.focus : AVL_INK.quiet,
|
|
283
|
-
strokeOpacity: s.status === "skipped" ? 0.25 : live || running ? 1 : 0.5,
|
|
284
|
-
strokeWidth: live ? 2 : 1.5,
|
|
285
|
-
strokeDasharray: s.status === "skipped" ? "3 4" : running ? "8 6" : void 0,
|
|
286
|
-
children: running && !reduceMotion ? /* @__PURE__ */ jsx("animate", { attributeName: "stroke-dashoffset", from: "0", to: "-14", dur: "0.8s", repeatCount: "indefinite" }) : null
|
|
287
|
-
}
|
|
288
|
-
),
|
|
289
|
-
label ? /* @__PURE__ */ jsx("text", { x: xm + 4, y: y2 - 6, fontFamily: AVL_FONT.mono, fontSize: 12, fill: AVL_INK.quiet, children: label }) : null,
|
|
290
|
-
live && s.value !== void 0 ? valueChip((x1 + xm) / 2, y1, s.value, true) : null
|
|
291
|
-
] }, `w-${child.key}`);
|
|
292
|
-
};
|
|
293
|
-
const valueChip = (x, y, v, centered = false) => {
|
|
294
|
-
const text = fmt(v);
|
|
295
|
-
const w = Math.max(28, text.length * 7.4 + 14);
|
|
296
|
-
if (centered) x -= w / 2;
|
|
297
|
-
const isBool = typeof v === "boolean";
|
|
298
|
-
const tone = isBool ? v ? AVL_INK.pass : AVL_INK.fail : AVL_INK.focus;
|
|
299
|
-
return /* @__PURE__ */ jsxs("g", { children: [
|
|
300
|
-
/* @__PURE__ */ jsx("title", { children: JSON.stringify(v) }),
|
|
301
|
-
/* @__PURE__ */ jsx("rect", { x, y: y - 22, width: w, height: 18, rx: 9, fill: avlTint(tone, 16), stroke: tone, strokeWidth: 1 }),
|
|
302
|
-
/* @__PURE__ */ jsx(
|
|
303
|
-
"text",
|
|
304
|
-
{
|
|
305
|
-
"data-testid": "avl-circuit-value",
|
|
306
|
-
x: x + w / 2,
|
|
307
|
-
y: y - 13,
|
|
308
|
-
textAnchor: "middle",
|
|
309
|
-
dominantBaseline: "central",
|
|
310
|
-
fontFamily: AVL_FONT.mono,
|
|
311
|
-
fontSize: 12,
|
|
312
|
-
fontWeight: 600,
|
|
313
|
-
fill: AVL_INK.text,
|
|
314
|
-
children: text
|
|
315
|
-
}
|
|
316
|
-
)
|
|
317
|
-
] });
|
|
318
|
-
};
|
|
319
|
-
const switchGlyph = (n, i, cx, cy, vertical) => {
|
|
320
|
-
const child = n.children[i];
|
|
321
|
-
const s = stateOf(child);
|
|
322
|
-
const decided = s.status === "done";
|
|
323
|
-
const closed = decided && truthy(s.value);
|
|
324
|
-
const color = s.status === "skipped" ? AVL_INK.quiet : decided ? closed ? AVL_INK.focus : AVL_INK.fail : AVL_INK.quiet;
|
|
325
|
-
const a = vertical ? { x: cx, y: cy - 13 } : { x: cx - 14, y: cy };
|
|
326
|
-
const b = vertical ? { x: cx, y: cy + 13 } : { x: cx + 14, y: cy };
|
|
327
|
-
const lever = closed || !decided ? b : vertical ? { x: cx + 16, y: cy + 6 } : { x: cx + 8, y: cy - 14 };
|
|
328
|
-
return /* @__PURE__ */ jsxs(
|
|
329
|
-
"g",
|
|
330
|
-
{
|
|
331
|
-
opacity: s.status === "skipped" ? 0.35 : 1,
|
|
332
|
-
...decided && !closed ? { "data-testid": "avl-circuit-open-switch", "data-key": child.key } : {},
|
|
333
|
-
children: [
|
|
334
|
-
/* @__PURE__ */ jsx("line", { x1: n.x, y1: portY(n, i), x2: vertical ? cx - 4 : cx, y2: cy, stroke: AVL_INK.quiet, strokeWidth: 1, strokeDasharray: "2 3" }),
|
|
335
|
-
/* @__PURE__ */ jsx("circle", { cx: a.x, cy: a.y, r: 2.5, fill: AVL_INK.text }),
|
|
336
|
-
/* @__PURE__ */ jsx("circle", { cx: b.x, cy: b.y, r: 2.5, fill: decided && !closed ? AVL_INK.quiet : AVL_INK.text }),
|
|
337
|
-
/* @__PURE__ */ jsx("line", { x1: a.x, y1: a.y, x2: lever.x, y2: lever.y, stroke: color, strokeWidth: 2.5, strokeLinecap: "round" })
|
|
338
|
-
]
|
|
339
|
-
},
|
|
340
|
-
`sw-${child.key}`
|
|
341
|
-
);
|
|
342
|
-
};
|
|
343
|
-
const body = (n) => {
|
|
344
|
-
const s = stateOf(n);
|
|
345
|
-
const cx = n.x + n.w / 2;
|
|
346
|
-
const cy = n.y + n.h / 2;
|
|
347
|
-
const tint = n.kind === "call" && n.form !== "template" ? opColor(n.label) : AVL_INK.quiet;
|
|
348
|
-
const frame = (dashed = false) => /* @__PURE__ */ jsx(
|
|
349
|
-
"rect",
|
|
350
|
-
{
|
|
351
|
-
x: n.x,
|
|
352
|
-
y: n.y,
|
|
353
|
-
width: n.w,
|
|
354
|
-
height: n.h,
|
|
355
|
-
rx: n.kind === "binding" || n.kind === "literal" ? n.h / 2 : 10,
|
|
356
|
-
fill: n.kind === "call" ? avlBlend(tint, 12, AVL_INK.surface) : n.kind === "literal" ? AVL_INK.wash : AVL_INK.surface,
|
|
357
|
-
stroke: s.status === "error" ? AVL_INK.fail : s.status === "active" ? AVL_INK.focus : n.kind === "call" ? avlBlend(tint, 55, AVL_INK.line) : AVL_INK.line,
|
|
358
|
-
strokeWidth: s.status === "active" ? 2 : 1,
|
|
359
|
-
strokeDasharray: dashed || n.form === "unknown" ? "5 4" : void 0
|
|
360
|
-
}
|
|
361
|
-
);
|
|
362
|
-
const caption = (text, big = false) => /* @__PURE__ */ jsx(
|
|
363
|
-
"text",
|
|
364
|
-
{
|
|
365
|
-
x: n.form === "series" || n.form === "parallel" || n.form === "conveyor" || n.form === "ladder" ? n.x + 10 : cx,
|
|
366
|
-
y: n.form === "series" || n.form === "parallel" || n.form === "conveyor" || n.form === "ladder" ? n.y + 14 : cy,
|
|
367
|
-
textAnchor: n.form === "series" || n.form === "parallel" || n.form === "conveyor" || n.form === "ladder" ? "start" : "middle",
|
|
368
|
-
dominantBaseline: "central",
|
|
369
|
-
fontFamily: AVL_FONT.mono,
|
|
370
|
-
fontSize: big ? 18 : 12,
|
|
371
|
-
fontWeight: big ? 600 : 500,
|
|
372
|
-
fill: n.kind === "literal" ? AVL_INK.quiet : AVL_INK.text,
|
|
373
|
-
children: text
|
|
374
|
-
}
|
|
375
|
-
);
|
|
376
|
-
if (n.kind !== "call") return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
377
|
-
frame(),
|
|
378
|
-
caption(n.label)
|
|
379
|
-
] });
|
|
380
|
-
switch (n.form) {
|
|
381
|
-
case "series": {
|
|
382
|
-
const rx = n.x + n.w - 34;
|
|
383
|
-
const ys = n.children.map((_, i) => portY(n, i));
|
|
384
|
-
let lit = true;
|
|
385
|
-
const segs = [];
|
|
386
|
-
let prev = n.y + 8;
|
|
387
|
-
n.children.forEach((c, i) => {
|
|
388
|
-
const cs = stateOf(c);
|
|
389
|
-
segs.push(/* @__PURE__ */ jsx("line", { x1: rx, y1: prev, x2: rx, y2: ys[i] - 13, stroke: lit ? AVL_INK.focus : AVL_INK.quiet, strokeOpacity: lit ? 1 : 0.4, strokeWidth: 2 }, `r${i}`));
|
|
390
|
-
lit = lit && cs.status === "done" && truthy(cs.value);
|
|
391
|
-
prev = ys[i] + 13;
|
|
392
|
-
});
|
|
393
|
-
segs.push(/* @__PURE__ */ jsx("line", { x1: rx, y1: prev, x2: rx, y2: cy, stroke: lit ? AVL_INK.focus : AVL_INK.quiet, strokeOpacity: lit ? 1 : 0.4, strokeWidth: 2 }, "rend"));
|
|
394
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
395
|
-
frame(),
|
|
396
|
-
caption(n.label),
|
|
397
|
-
segs,
|
|
398
|
-
n.children.map((_, i) => switchGlyph(n, i, rx, ys[i], true))
|
|
399
|
-
] });
|
|
400
|
-
}
|
|
401
|
-
case "parallel": {
|
|
402
|
-
const l = n.x + 18;
|
|
403
|
-
const r = n.x + n.w - 18;
|
|
404
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
405
|
-
frame(),
|
|
406
|
-
caption(n.label),
|
|
407
|
-
/* @__PURE__ */ jsx("line", { x1: l, y1: portY(n, 0) - 10, x2: l, y2: portY(n, n.children.length - 1) + 10, stroke: AVL_INK.quiet, strokeWidth: 2 }),
|
|
408
|
-
/* @__PURE__ */ jsx("line", { x1: r, y1: portY(n, 0) - 10, x2: r, y2: portY(n, n.children.length - 1) + 10, stroke: AVL_INK.quiet, strokeWidth: 2 }),
|
|
409
|
-
n.children.map((c, i) => {
|
|
410
|
-
const cs = stateOf(c);
|
|
411
|
-
const on = cs.status === "done" && truthy(cs.value);
|
|
412
|
-
const py = portY(n, i);
|
|
413
|
-
return /* @__PURE__ */ jsxs("g", { children: [
|
|
414
|
-
/* @__PURE__ */ jsx("line", { x1: l, y1: py, x2: (l + r) / 2 - 12, y2: py, stroke: on ? AVL_INK.focus : AVL_INK.quiet, strokeWidth: 1.5 }),
|
|
415
|
-
/* @__PURE__ */ jsx("line", { x1: (l + r) / 2 + 12, y1: py, x2: r, y2: py, stroke: on ? AVL_INK.focus : AVL_INK.quiet, strokeWidth: 1.5 }),
|
|
416
|
-
switchGlyph(n, i, (l + r) / 2, py, false)
|
|
417
|
-
] }, `b${i}`);
|
|
418
|
-
})
|
|
419
|
-
] });
|
|
420
|
-
}
|
|
421
|
-
case "branch": {
|
|
422
|
-
const cond = stateOf(n.children[0]);
|
|
423
|
-
const takenIndex = cond.status === "done" ? truthy(cond.value) ? 1 : 2 : -1;
|
|
424
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
425
|
-
frame(),
|
|
426
|
-
n.children.slice(1).map((c, j) => {
|
|
427
|
-
const i = j + 1;
|
|
428
|
-
const on = i === takenIndex;
|
|
429
|
-
return /* @__PURE__ */ jsx(
|
|
430
|
-
"path",
|
|
431
|
-
{
|
|
432
|
-
d: `M ${n.x} ${portY(n, i)} C ${cx} ${portY(n, i)}, ${cx} ${cy}, ${n.x + n.w} ${cy}`,
|
|
433
|
-
fill: "none",
|
|
434
|
-
stroke: on ? AVL_INK.focus : AVL_INK.quiet,
|
|
435
|
-
strokeOpacity: on ? 1 : 0.35,
|
|
436
|
-
strokeWidth: on ? 2.5 : 1.5
|
|
437
|
-
},
|
|
438
|
-
`t${i}`
|
|
439
|
-
);
|
|
440
|
-
}),
|
|
441
|
-
/* @__PURE__ */ jsx("line", { x1: n.x, y1: portY(n, 0), x2: cx, y2: cy, stroke: AVL_INK.quiet, strokeWidth: 1, strokeDasharray: "2 3" }),
|
|
442
|
-
/* @__PURE__ */ jsx("text", { x: n.x + 8, y: n.y + 12, fontFamily: AVL_FONT.mono, fontSize: 12, fill: AVL_INK.text, children: n.label })
|
|
443
|
-
] });
|
|
444
|
-
}
|
|
445
|
-
case "conveyor": {
|
|
446
|
-
const collection = stateOf(n.children[0]);
|
|
447
|
-
const items = Array.isArray(collection.value) ? collection.value : [];
|
|
448
|
-
const lambda = n.children[1];
|
|
449
|
-
const bodyNode = lambda?.children[lambda.children.length - 1];
|
|
450
|
-
const bodyState = bodyNode ? stateOf(bodyNode) : IDLE;
|
|
451
|
-
const results = bodyState.results;
|
|
452
|
-
const beltY = n.y + n.h - 26;
|
|
453
|
-
const step = items.length ? (n.w - 24) / items.length : 0;
|
|
454
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
455
|
-
frame(),
|
|
456
|
-
caption(n.label),
|
|
457
|
-
/* @__PURE__ */ jsx("rect", { x: n.x + 8, y: beltY - 12, width: n.w - 16, height: 24, rx: 12, fill: AVL_INK.wash, stroke: AVL_INK.line }),
|
|
458
|
-
items.map((item, i) => {
|
|
459
|
-
const done = i < results.length;
|
|
460
|
-
const current = bodyState.status === "active" && i === results.length;
|
|
461
|
-
const result = done ? results[i] : void 0;
|
|
462
|
-
const kept = typeof result === "boolean" ? result : true;
|
|
463
|
-
const x = n.x + 12 + i * step;
|
|
464
|
-
return /* @__PURE__ */ jsxs("g", { "data-testid": "avl-circuit-item", "data-result": done ? String(result) : "pending", children: [
|
|
465
|
-
/* @__PURE__ */ jsx("title", { children: JSON.stringify(item) }),
|
|
466
|
-
/* @__PURE__ */ jsx(
|
|
467
|
-
"rect",
|
|
468
|
-
{
|
|
469
|
-
x,
|
|
470
|
-
y: beltY - 9,
|
|
471
|
-
width: step - 6,
|
|
472
|
-
height: 18,
|
|
473
|
-
rx: 9,
|
|
474
|
-
fill: done ? avlTint(kept ? AVL_INK.pass : AVL_INK.fail, 16) : AVL_INK.surface,
|
|
475
|
-
stroke: current ? AVL_INK.focus : done ? kept ? AVL_INK.pass : AVL_INK.fail : AVL_INK.line,
|
|
476
|
-
strokeWidth: current ? 2 : 1,
|
|
477
|
-
opacity: done && !kept ? 0.55 : 1
|
|
478
|
-
}
|
|
479
|
-
),
|
|
480
|
-
/* @__PURE__ */ jsxs(
|
|
481
|
-
"text",
|
|
482
|
-
{
|
|
483
|
-
x: x + (step - 6) / 2,
|
|
484
|
-
y: beltY,
|
|
485
|
-
textAnchor: "middle",
|
|
486
|
-
dominantBaseline: "central",
|
|
487
|
-
fontFamily: AVL_FONT.mono,
|
|
488
|
-
fontSize: 12,
|
|
489
|
-
fill: AVL_INK.text,
|
|
490
|
-
textDecoration: done && !kept ? "line-through" : void 0,
|
|
491
|
-
children: [
|
|
492
|
-
`#${i + 1}`,
|
|
493
|
-
done ? typeof result === "boolean" ? kept ? " \u2713" : " \u2715" : ` ${fmt(result)}` : ""
|
|
494
|
-
]
|
|
495
|
-
}
|
|
496
|
-
)
|
|
497
|
-
] }, `it${i}`);
|
|
498
|
-
})
|
|
499
|
-
] });
|
|
500
|
-
}
|
|
501
|
-
case "ladder": {
|
|
502
|
-
const rl = n.x + 14;
|
|
503
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
504
|
-
frame(),
|
|
505
|
-
caption(n.label),
|
|
506
|
-
/* @__PURE__ */ jsx("line", { x1: rl, y1: n.y + 22, x2: rl, y2: n.y + n.h - 6, stroke: AVL_INK.focus, strokeWidth: 2 }),
|
|
507
|
-
n.children.map((c, i) => {
|
|
508
|
-
const cs = stateOf(c);
|
|
509
|
-
const color = cs.status === "done" ? AVL_INK.pass : cs.status === "active" ? AVL_INK.focus : cs.status === "error" ? AVL_INK.fail : AVL_INK.quiet;
|
|
510
|
-
return /* @__PURE__ */ jsx("line", { x1: rl, y1: portY(n, i), x2: n.x + n.w - 10, y2: portY(n, i), stroke: color, strokeWidth: cs.status === "idle" ? 1 : 2 }, `r${i}`);
|
|
511
|
-
})
|
|
512
|
-
] });
|
|
513
|
-
}
|
|
514
|
-
case "actuator": {
|
|
515
|
-
const zone = effectZoneOf(n.label);
|
|
516
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
517
|
-
frame(),
|
|
518
|
-
/* @__PURE__ */ jsx("svg", { x: n.x + 6, y: cy - 9, width: 18, height: 18, viewBox: "-9 -9 18 18", overflow: "visible", children: /* @__PURE__ */ jsx(AvlEffect, { effectType: n.label, size: 7, color: s.status === "done" ? AVL_INK.pass : AVL_INK.quiet }) }),
|
|
519
|
-
/* @__PURE__ */ jsx("text", { x: n.x + 28, y: cy, dominantBaseline: "central", fontFamily: AVL_FONT.mono, fontSize: 12, fontWeight: 600, fill: AVL_INK.text, children: n.label }),
|
|
520
|
-
s.status === "done" && zone ? /* @__PURE__ */ jsxs("text", { "data-testid": "avl-circuit-zone", x: n.x + n.w - 8, y: n.y + n.h + 14, textAnchor: "end", fontFamily: AVL_FONT.mono, fontSize: 12, fill: AVL_INK.pass, children: [
|
|
521
|
-
"\u2192 ",
|
|
522
|
-
t(`avl.circuit.zone.${zone}`)
|
|
523
|
-
] }) : null
|
|
524
|
-
] });
|
|
525
|
-
}
|
|
526
|
-
case "invert":
|
|
527
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
528
|
-
/* @__PURE__ */ jsx("path", { d: `M ${n.x + 8} ${n.y + 6} L ${n.x + n.w - 14} ${cy} L ${n.x + 8} ${n.y + n.h - 6} Z`, fill: AVL_INK.surface, stroke: AVL_INK.line }),
|
|
529
|
-
/* @__PURE__ */ jsx("circle", { cx: n.x + n.w - 9, cy, r: 4, fill: AVL_INK.surface, stroke: AVL_INK.line })
|
|
530
|
-
] });
|
|
531
|
-
case "delay":
|
|
532
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
533
|
-
frame(),
|
|
534
|
-
/* @__PURE__ */ jsx("circle", { cx: n.x + 16, cy, r: 7, fill: "none", stroke: AVL_INK.quiet, strokeWidth: 1.5 }),
|
|
535
|
-
/* @__PURE__ */ jsx("polyline", { points: `${n.x + 16},${cy - 4} ${n.x + 16},${cy} ${n.x + 19},${cy + 2}`, fill: "none", stroke: AVL_INK.quiet, strokeWidth: 1.5 }),
|
|
536
|
-
/* @__PURE__ */ jsx("text", { x: n.x + 30, y: cy, dominantBaseline: "central", fontFamily: AVL_FONT.mono, fontSize: 12, fill: AVL_INK.text, children: n.label })
|
|
537
|
-
] });
|
|
538
|
-
case "template":
|
|
539
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
540
|
-
frame(true),
|
|
541
|
-
caption(n.label)
|
|
542
|
-
] });
|
|
543
|
-
default:
|
|
544
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
545
|
-
frame(),
|
|
546
|
-
caption(n.form === "unknown" ? `${n.label} ?` : n.label, n.label.length <= 2)
|
|
547
|
-
] });
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
const drawn = [];
|
|
551
|
-
const walk = (n) => {
|
|
552
|
-
n.children.forEach((c, i) => {
|
|
553
|
-
walk(c);
|
|
554
|
-
drawn.push(wire(n, c, i));
|
|
555
|
-
});
|
|
556
|
-
const s = stateOf(n);
|
|
557
|
-
drawn.push(
|
|
558
|
-
/* @__PURE__ */ jsxs(
|
|
559
|
-
"g",
|
|
560
|
-
{
|
|
561
|
-
"data-testid": "avl-circuit-node",
|
|
562
|
-
"data-key": n.key,
|
|
563
|
-
"data-kind": n.kind,
|
|
564
|
-
"data-form": n.form ?? "",
|
|
565
|
-
"data-status": s.status,
|
|
566
|
-
opacity: s.status === "skipped" ? 0.35 : 1,
|
|
567
|
-
children: [
|
|
568
|
-
s.status === "active" ? /* @__PURE__ */ jsx("rect", { x: n.x - 4, y: n.y - 4, width: n.w + 8, height: n.h + 8, rx: 14, fill: "none", stroke: AVL_INK.focus, strokeOpacity: 0.22, strokeWidth: 4, children: !reduceMotion ? /* @__PURE__ */ jsx("animate", { attributeName: "stroke-opacity", values: "0.28;0.06;0.28", dur: "1.6s", repeatCount: "indefinite" }) : null }) : null,
|
|
569
|
-
body(n)
|
|
570
|
-
]
|
|
571
|
-
},
|
|
572
|
-
`n-${n.key}`
|
|
573
|
-
)
|
|
574
|
-
);
|
|
575
|
-
};
|
|
576
|
-
walk(circuit.root);
|
|
577
|
-
const root = circuit.root;
|
|
578
|
-
const rootState = stateOf(root);
|
|
579
|
-
const outY = root.y + root.h / 2;
|
|
580
|
-
return /* @__PURE__ */ jsxs(Box, { className, style: { width: "100%" }, children: [
|
|
581
|
-
title || showCode ? /* @__PURE__ */ jsxs(Box, { className: "pb-2", children: [
|
|
582
|
-
title ? /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "semibold", children: title }) : null,
|
|
583
|
-
showCode ? /* @__PURE__ */ jsx(Box, { as: "code", "data-testid": "avl-circuit-code", style: { display: "block", fontFamily: AVL_FONT.mono, fontSize: 13, color: AVL_INK.quiet, whiteSpace: "pre-wrap" }, children: formatSExpr(expr) }) : null
|
|
584
|
-
] }) : null,
|
|
585
|
-
/* @__PURE__ */ jsx(Box, { ref: hostRef, className: "overflow-x-auto", style: { width: "100%" }, children: /* @__PURE__ */ jsx(Box, { className: "relative mx-auto", style: { width: W * scale, height: circuit.h * scale }, children: /* @__PURE__ */ jsxs("svg", { width: W * scale, height: circuit.h * scale, viewBox: `0 0 ${W} ${circuit.h}`, role: "img", "aria-label": formatSExpr(expr), children: [
|
|
586
|
-
drawn,
|
|
587
|
-
/* @__PURE__ */ jsx("path", { d: `M ${root.x + root.w} ${outY} H ${root.x + root.w + 38}`, stroke: rootState.status === "done" ? AVL_INK.focus : AVL_INK.quiet, strokeWidth: 2 }),
|
|
588
|
-
rootState.status === "done" && typeof rootState.value === "boolean" ? /* @__PURE__ */ jsx("circle", { cx: root.x + root.w + 48, cy: outY, r: 8, fill: rootState.value ? AVL_INK.pass : AVL_INK.fail }) : null,
|
|
589
|
-
rootState.status === "done" && rootState.value !== void 0 ? valueChip(root.x + root.w + 62, outY + 10, rootState.value) : null
|
|
590
|
-
] }) }) }),
|
|
591
|
-
narration !== null ? /* @__PURE__ */ jsxs(Box, { className: "pt-2", children: [
|
|
592
|
-
/* @__PURE__ */ jsxs(Box, { "data-testid": "avl-circuit-narration", style: { fontSize: 13, color: AVL_INK.quiet }, children: [
|
|
593
|
-
/* @__PURE__ */ jsx(Box, { as: "span", style: { color: AVL_INK.text, fontWeight: 600 }, children: t("avl.circuit.step", { n: at + 1, total: trace?.length ?? 0 }) }),
|
|
594
|
-
" \u2014 ",
|
|
595
|
-
narration
|
|
596
|
-
] }),
|
|
597
|
-
stack.length > 0 ? /* @__PURE__ */ jsxs(Box, { className: "flex flex-wrap items-center gap-1 pt-1", style: { fontFamily: AVL_FONT.mono, fontSize: 12, color: AVL_INK.quiet }, children: [
|
|
598
|
-
t("avl.circuit.stack"),
|
|
599
|
-
stack.map((k, i) => /* @__PURE__ */ jsx(
|
|
600
|
-
Box,
|
|
601
|
-
{
|
|
602
|
-
as: "span",
|
|
603
|
-
"data-testid": "avl-circuit-stack-frame",
|
|
604
|
-
className: "rounded px-1.5",
|
|
605
|
-
style: { border: `1px solid ${i === stack.length - 1 ? AVL_INK.focus : AVL_INK.line}`, color: i === stack.length - 1 ? AVL_INK.focus : AVL_INK.quiet, background: AVL_INK.wash },
|
|
606
|
-
children: nodes.get(k)?.label ?? k
|
|
607
|
-
},
|
|
608
|
-
k
|
|
609
|
-
))
|
|
610
|
-
] }) : null
|
|
611
|
-
] }) : null
|
|
612
|
-
] });
|
|
613
|
-
};
|
|
614
|
-
AvlCircuit.displayName = "AvlCircuit";
|
|
615
32
|
var avlOuId = 0;
|
|
616
33
|
var AvlOrbitalUnit = ({
|
|
617
34
|
entityName,
|
|
@@ -623,7 +40,7 @@ var AvlOrbitalUnit = ({
|
|
|
623
40
|
color = "var(--color-primary)",
|
|
624
41
|
animated = false
|
|
625
42
|
}) => {
|
|
626
|
-
const ids =
|
|
43
|
+
const ids = React16.useMemo(() => {
|
|
627
44
|
avlOuId += 1;
|
|
628
45
|
const base = `avl-ou-${avlOuId}`;
|
|
629
46
|
return { glow: `${base}-glow`, grad: `${base}-grad` };
|
|
@@ -780,7 +197,7 @@ var AvlClosedCircuit = ({
|
|
|
780
197
|
color = "var(--color-primary)",
|
|
781
198
|
animated = false
|
|
782
199
|
}) => {
|
|
783
|
-
const ids =
|
|
200
|
+
const ids = React16.useMemo(() => {
|
|
784
201
|
avlCcId += 1;
|
|
785
202
|
const base = `avl-cc-${avlCcId}`;
|
|
786
203
|
return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
|
|
@@ -933,7 +350,7 @@ var AvlEmitListen = ({
|
|
|
933
350
|
color = "var(--color-primary)",
|
|
934
351
|
animated = false
|
|
935
352
|
}) => {
|
|
936
|
-
const ids =
|
|
353
|
+
const ids = React16.useMemo(() => {
|
|
937
354
|
avlElId += 1;
|
|
938
355
|
const base = `avl-el-${avlElId}`;
|
|
939
356
|
return { arrow: `${base}-arrow`, grad: `${base}-grad` };
|
|
@@ -1207,7 +624,7 @@ function renderNode(node, color, glowId) {
|
|
|
1207
624
|
const baseR = node.type === "operator" ? 20 : 16;
|
|
1208
625
|
const r = Math.max(baseR, labelLen * 3.5 + 6);
|
|
1209
626
|
const nc = nodeColor(node.type, color);
|
|
1210
|
-
return /* @__PURE__ */ jsxs(
|
|
627
|
+
return /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
1211
628
|
node.children.map((child, i) => {
|
|
1212
629
|
const childR = Math.max(
|
|
1213
630
|
child.type === "operator" ? 20 : 16,
|
|
@@ -1264,7 +681,7 @@ var AvlExprTree = ({
|
|
|
1264
681
|
className,
|
|
1265
682
|
color = "var(--color-primary)"
|
|
1266
683
|
}) => {
|
|
1267
|
-
const ids =
|
|
684
|
+
const ids = React16.useMemo(() => {
|
|
1268
685
|
avlEtId += 1;
|
|
1269
686
|
return { glow: `avl-et-${avlEtId}-glow` };
|
|
1270
687
|
}, []);
|
|
@@ -1875,7 +1292,7 @@ var AvlBehaviorGlyph = ({
|
|
|
1875
1292
|
effectTypes = [],
|
|
1876
1293
|
children: childBehaviors,
|
|
1877
1294
|
connections = [],
|
|
1878
|
-
size
|
|
1295
|
+
size = "md",
|
|
1879
1296
|
showLabels = false,
|
|
1880
1297
|
animated = false,
|
|
1881
1298
|
className,
|
|
@@ -1883,7 +1300,7 @@ var AvlBehaviorGlyph = ({
|
|
|
1883
1300
|
}) => {
|
|
1884
1301
|
const { t } = useTranslate();
|
|
1885
1302
|
const resolvedColor = colorOverride ?? (domain ? DOMAIN_COLORS[domain] ?? "var(--color-primary)" : "var(--color-primary)");
|
|
1886
|
-
const dim = SIZE_MAP[
|
|
1303
|
+
const dim = SIZE_MAP[size];
|
|
1887
1304
|
const radius = dim * 0.4;
|
|
1888
1305
|
const cx = dim / 2;
|
|
1889
1306
|
const cy = dim / 2;
|
|
@@ -2095,14 +1512,14 @@ var SystemNodeInner = ({ data }) => {
|
|
|
2095
1512
|
}
|
|
2096
1513
|
);
|
|
2097
1514
|
};
|
|
2098
|
-
var SystemNode =
|
|
1515
|
+
var SystemNode = React16.memo(SystemNodeInner);
|
|
2099
1516
|
SystemNode.displayName = "SystemNode";
|
|
2100
1517
|
var SystemBandNodeInner = ({ data }) => {
|
|
2101
1518
|
const d = data;
|
|
2102
1519
|
const { t } = useTranslate();
|
|
2103
1520
|
return /* @__PURE__ */ jsx(Box, { "data-testid": `avl-system-band-${d.bandKind}`, className: "pointer-events-none whitespace-nowrap", children: /* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t(d.bandKind === "connected" ? "avl.system.connected" : "avl.system.standalone", { count: d.bandCount ?? 0 }) }) });
|
|
2104
1521
|
};
|
|
2105
|
-
var SystemBandNode =
|
|
1522
|
+
var SystemBandNode = React16.memo(SystemBandNodeInner);
|
|
2106
1523
|
SystemBandNode.displayName = "SystemBandNode";
|
|
2107
1524
|
var DEPENDENCY_ROLE_CLASS = {
|
|
2108
1525
|
selected: "border-primary bg-primary/25 text-foreground ring-2 ring-primary/40",
|
|
@@ -2160,14 +1577,14 @@ var DependencyNodeInner = ({ id, data }) => {
|
|
|
2160
1577
|
}
|
|
2161
1578
|
);
|
|
2162
1579
|
};
|
|
2163
|
-
var DependencyNode =
|
|
1580
|
+
var DependencyNode = React16.memo(DependencyNodeInner);
|
|
2164
1581
|
DependencyNode.displayName = "DependencyNode";
|
|
2165
1582
|
var DependencyColumnNodeInner = ({ data }) => {
|
|
2166
1583
|
const d = data;
|
|
2167
1584
|
const { t } = useTranslate();
|
|
2168
1585
|
return /* @__PURE__ */ jsx(Box, { "data-testid": `avl-dependency-column-${d.dependencyColumn}`, className: "pointer-events-none whitespace-nowrap", children: /* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t(`avl.deps.column.${d.dependencyColumn ?? "unknown"}`) }) });
|
|
2169
1586
|
};
|
|
2170
|
-
var DependencyColumnNode =
|
|
1587
|
+
var DependencyColumnNode = React16.memo(DependencyColumnNodeInner);
|
|
2171
1588
|
DependencyColumnNode.displayName = "DependencyColumnNode";
|
|
2172
1589
|
var DetailView = ({ data }) => {
|
|
2173
1590
|
const { t } = useTranslate();
|
|
@@ -3413,8 +2830,8 @@ function axisPositionFrom(axis, constraint, offset) {
|
|
|
3413
2830
|
const end = axis === "x" ? offset.right : offset.bottom;
|
|
3414
2831
|
if (constraint === "center") return { constraint, start: (start - end) / 2, end: 0 };
|
|
3415
2832
|
if (constraint !== "scale") return { constraint, start, end };
|
|
3416
|
-
const
|
|
3417
|
-
return
|
|
2833
|
+
const size = axis === "x" ? offset.parentWidth : offset.parentHeight;
|
|
2834
|
+
return size > 0 ? { constraint, start: start / size * 100, end: end / size * 100 } : { constraint, start: 0, end: 0 };
|
|
3418
2835
|
}
|
|
3419
2836
|
var edgesX = (r) => [r.left, r.left + r.width / 2, r.left + r.width];
|
|
3420
2837
|
var edgesY = (r) => [r.top, r.top + r.height / 2, r.top + r.height];
|
|
@@ -3901,12 +3318,12 @@ function CanvasDndProvider({
|
|
|
3901
3318
|
}) {
|
|
3902
3319
|
const eventBus = useEventBus();
|
|
3903
3320
|
const sensors = useAlmadarDndSensors(false);
|
|
3904
|
-
const [activePayload, setActivePayload] =
|
|
3905
|
-
const lastPointerRef =
|
|
3906
|
-
const trackPointer =
|
|
3321
|
+
const [activePayload, setActivePayload] = React16.useState(null);
|
|
3322
|
+
const lastPointerRef = React16.useRef(null);
|
|
3323
|
+
const trackPointer = React16.useCallback((ev) => {
|
|
3907
3324
|
lastPointerRef.current = { x: ev.clientX, y: ev.clientY };
|
|
3908
3325
|
}, []);
|
|
3909
|
-
const handleDragStart =
|
|
3326
|
+
const handleDragStart = React16.useCallback((e) => {
|
|
3910
3327
|
const data = e.active.data.current;
|
|
3911
3328
|
const payload = data?.payload;
|
|
3912
3329
|
const activator = e.activatorEvent;
|
|
@@ -3920,7 +3337,7 @@ function CanvasDndProvider({
|
|
|
3920
3337
|
log.warn("dragStart:missing-payload", { id: e.active.id });
|
|
3921
3338
|
}
|
|
3922
3339
|
}, [eventBus, trackPointer]);
|
|
3923
|
-
const handleDragEnd =
|
|
3340
|
+
const handleDragEnd = React16.useCallback((e) => {
|
|
3924
3341
|
setActivePayload(null);
|
|
3925
3342
|
document.removeEventListener("pointermove", trackPointer);
|
|
3926
3343
|
const activeData = e.active.data.current;
|
|
@@ -3956,7 +3373,7 @@ function CanvasDndProvider({
|
|
|
3956
3373
|
const suppressed = onDrop ? onDrop(drop) === true : false;
|
|
3957
3374
|
if (!suppressed) defaultEmit(eventBus, drop);
|
|
3958
3375
|
}, [eventBus, onDrop, trackPointer]);
|
|
3959
|
-
const handleDragCancel =
|
|
3376
|
+
const handleDragCancel = React16.useCallback(() => {
|
|
3960
3377
|
setActivePayload(null);
|
|
3961
3378
|
document.removeEventListener("pointermove", trackPointer);
|
|
3962
3379
|
log.info("dragCancel");
|
|
@@ -5497,7 +4914,7 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
5497
4914
|
}
|
|
5498
4915
|
);
|
|
5499
4916
|
};
|
|
5500
|
-
var OrbPreviewNode =
|
|
4917
|
+
var OrbPreviewNode = React16.memo(OrbPreviewNodeInner);
|
|
5501
4918
|
OrbPreviewNode.displayName = "OrbPreviewNode";
|
|
5502
4919
|
orbPreviewLog.debug("export-resolved", () => ({
|
|
5503
4920
|
type: typeof OrbPreviewNode,
|
|
@@ -5602,7 +5019,7 @@ var EventFlowEdgeInner = (props) => {
|
|
|
5602
5019
|
) })
|
|
5603
5020
|
] });
|
|
5604
5021
|
};
|
|
5605
|
-
var EventFlowEdge =
|
|
5022
|
+
var EventFlowEdge = React16.memo(EventFlowEdgeInner);
|
|
5606
5023
|
EventFlowEdge.displayName = "EventFlowEdge";
|
|
5607
5024
|
function asString(v) {
|
|
5608
5025
|
return typeof v === "string" ? v : "";
|
|
@@ -6754,22 +6171,22 @@ function StylesTab({ patternType, patternDef, patternConfig, editable, onPropCha
|
|
|
6754
6171
|
] }),
|
|
6755
6172
|
sizeEnum && sizeEnum.length > 0 && /* @__PURE__ */ jsxs(Box, { children: [
|
|
6756
6173
|
/* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground text-xs uppercase tracking-wider mb-2", children: t("orbInspector.size") }),
|
|
6757
|
-
/* @__PURE__ */ jsx(Box, { className: "flex flex-wrap gap-1", children: sizeEnum.map((
|
|
6758
|
-
const isActive =
|
|
6174
|
+
/* @__PURE__ */ jsx(Box, { className: "flex flex-wrap gap-1", children: sizeEnum.map((size) => {
|
|
6175
|
+
const isActive = size === currentSize || !currentSize && size === "md";
|
|
6759
6176
|
return /* @__PURE__ */ jsx(
|
|
6760
6177
|
Box,
|
|
6761
6178
|
{
|
|
6762
6179
|
as: editable ? "button" : "div",
|
|
6763
|
-
onClick: editable ? () => onPropChange("size",
|
|
6180
|
+
onClick: editable ? () => onPropChange("size", size) : void 0,
|
|
6764
6181
|
"aria-pressed": editable ? isActive : void 0,
|
|
6765
6182
|
className: `rounded px-2 py-0.5 text-xs font-mono ${editable ? "cursor-pointer hover:opacity-80 transition-opacity" : ""}`,
|
|
6766
6183
|
style: {
|
|
6767
6184
|
backgroundColor: isActive ? "var(--color-primary)" : "var(--color-muted)",
|
|
6768
6185
|
color: isActive ? "var(--color-primary-foreground)" : "var(--color-muted-foreground)"
|
|
6769
6186
|
},
|
|
6770
|
-
children:
|
|
6187
|
+
children: size
|
|
6771
6188
|
},
|
|
6772
|
-
|
|
6189
|
+
size
|
|
6773
6190
|
);
|
|
6774
6191
|
}) })
|
|
6775
6192
|
] }),
|
|
@@ -7357,7 +6774,7 @@ var TraitCardNodeInner = (props) => {
|
|
|
7357
6774
|
}
|
|
7358
6775
|
);
|
|
7359
6776
|
};
|
|
7360
|
-
var TraitCardNode =
|
|
6777
|
+
var TraitCardNode = React16.memo(TraitCardNodeInner);
|
|
7361
6778
|
TraitCardNode.displayName = "TraitCardNode";
|
|
7362
6779
|
|
|
7363
6780
|
// lib/avl-layered-graph.ts
|
|
@@ -7513,7 +6930,7 @@ function flowNeighbors(edges, selected) {
|
|
|
7513
6930
|
}
|
|
7514
6931
|
var COLUMNS2 = ["own", "io", "std", "primitive", "unknown"];
|
|
7515
6932
|
var WIDTH2 = { own: 240, io: 340, std: 340, primitive: 260, unknown: 340 };
|
|
7516
|
-
var
|
|
6933
|
+
var ROW = { height: 28, gap: 12, columnGap: 96, headerHeight: 30 };
|
|
7517
6934
|
function traitFlowCanvas(flow) {
|
|
7518
6935
|
return layeredGraph({
|
|
7519
6936
|
columns: COLUMNS2.map((id) => ({ id, width: WIDTH2[id] })),
|
|
@@ -7524,7 +6941,7 @@ function traitFlowCanvas(flow) {
|
|
|
7524
6941
|
...u.column === "own" ? {} : { flowTraits: u.traits.length, flowRenderPieces: u.renderPieces.length }
|
|
7525
6942
|
})),
|
|
7526
6943
|
edges: flow.edges.map((e) => ({ id: `flow-${e.source}-${e.target}`, source: e.source, target: e.target })),
|
|
7527
|
-
row:
|
|
6944
|
+
row: ROW,
|
|
7528
6945
|
handles: "facing"
|
|
7529
6946
|
});
|
|
7530
6947
|
}
|
|
@@ -7660,19 +7077,19 @@ function FlowCanvasInner({
|
|
|
7660
7077
|
const fitPadding = systemLevel || flowLens ? 0.08 : 0.25;
|
|
7661
7078
|
const compact = useCompactLayout();
|
|
7662
7079
|
const [scope, setScope] = useState("local");
|
|
7663
|
-
const scopeRef =
|
|
7080
|
+
const scopeRef = React16.useRef(scope);
|
|
7664
7081
|
scopeRef.current = scope;
|
|
7665
7082
|
const [focusRequest, setFocusRequest] = useState(focusedOrbitalProp ?? initialOrbital);
|
|
7666
7083
|
const [stateByOrbital, setStateByOrbital] = useState({});
|
|
7667
|
-
const fitFocusedRef =
|
|
7668
|
-
const pendingFitRef =
|
|
7669
|
-
const fittedViewRef =
|
|
7084
|
+
const fitFocusedRef = React16.useRef(false);
|
|
7085
|
+
const pendingFitRef = React16.useRef(null);
|
|
7086
|
+
const fittedViewRef = React16.useRef(null);
|
|
7670
7087
|
useEffect(() => {
|
|
7671
7088
|
if (focusedOrbitalProp === void 0) return;
|
|
7672
7089
|
fitFocusedRef.current = true;
|
|
7673
7090
|
setFocusRequest(focusedOrbitalProp);
|
|
7674
7091
|
}, [focusedOrbitalProp]);
|
|
7675
|
-
const screenSizeUserOverrideRef =
|
|
7092
|
+
const screenSizeUserOverrideRef = React16.useRef(false);
|
|
7676
7093
|
const [screenSize, setScreenSize] = useState(
|
|
7677
7094
|
() => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
|
|
7678
7095
|
);
|
|
@@ -7685,9 +7102,9 @@ function FlowCanvasInner({
|
|
|
7685
7102
|
window.addEventListener("resize", onResize);
|
|
7686
7103
|
return () => window.removeEventListener("resize", onResize);
|
|
7687
7104
|
}, []);
|
|
7688
|
-
const pickScreenSize = useCallback((
|
|
7105
|
+
const pickScreenSize = useCallback((size) => {
|
|
7689
7106
|
screenSizeUserOverrideRef.current = true;
|
|
7690
|
-
setScreenSize(
|
|
7107
|
+
setScreenSize(size);
|
|
7691
7108
|
}, []);
|
|
7692
7109
|
const [selectedNode, setSelectedNodeInternal] = useState(initialSelectedNode ?? null);
|
|
7693
7110
|
const setSelectedNode = useCallback((node) => {
|
|
@@ -7828,9 +7245,9 @@ function FlowCanvasInner({
|
|
|
7828
7245
|
const [edges, setEdges, onEdgesChange] = useEdgesState(activeEdges);
|
|
7829
7246
|
const reactFlow = useReactFlow();
|
|
7830
7247
|
const cameraMs = usePrefersReducedMotion() ? 0 : 300;
|
|
7831
|
-
const savedPositionsRef =
|
|
7248
|
+
const savedPositionsRef = React16.useRef(nodePositions);
|
|
7832
7249
|
savedPositionsRef.current = nodePositions;
|
|
7833
|
-
const nodesRef =
|
|
7250
|
+
const nodesRef = React16.useRef(nodes);
|
|
7834
7251
|
nodesRef.current = nodes;
|
|
7835
7252
|
useEffect(() => {
|
|
7836
7253
|
setEdges([]);
|
|
@@ -7975,7 +7392,7 @@ function FlowCanvasInner({
|
|
|
7975
7392
|
targetTraitName: tgtData.traitName
|
|
7976
7393
|
});
|
|
7977
7394
|
}, [nodes, onEventWire, eventBus]);
|
|
7978
|
-
const worldPositionsRef =
|
|
7395
|
+
const worldPositionsRef = React16.useRef(canvas.worldPositions);
|
|
7979
7396
|
worldPositionsRef.current = canvas.worldPositions;
|
|
7980
7397
|
const placementsOf = useCallback((list) => {
|
|
7981
7398
|
const positions = { ...savedPositionsRef.current };
|
|
@@ -8011,8 +7428,8 @@ function FlowCanvasInner({
|
|
|
8011
7428
|
}), [eventBus, setNodes, onPositionsChange, placementsOf]);
|
|
8012
7429
|
const screenSizeKeys = ["mobile", "tablet", "laptop", "wide"];
|
|
8013
7430
|
const isScreenSize = (value) => screenSizeKeys.some((k) => k === value);
|
|
8014
|
-
const applyScreenSize = (
|
|
8015
|
-
pickScreenSize(
|
|
7431
|
+
const applyScreenSize = (size) => {
|
|
7432
|
+
pickScreenSize(size);
|
|
8016
7433
|
requestAnimationFrame(() => {
|
|
8017
7434
|
reactFlow.fitView({ duration: cameraMs, padding: 0.25 });
|
|
8018
7435
|
});
|
|
@@ -8208,7 +7625,7 @@ function FlowCanvasInner({
|
|
|
8208
7625
|
/* @__PURE__ */ jsx(Box, { className: "sm:hidden ml-auto", children: /* @__PURE__ */ jsx(
|
|
8209
7626
|
Select,
|
|
8210
7627
|
{
|
|
8211
|
-
options: screenSizeKeys.map((
|
|
7628
|
+
options: screenSizeKeys.map((size) => ({ value: size, label: t("flowCanvas.presetSize", { label: t(SCREEN_SIZE_PRESETS[size].labelKey), width: SCREEN_SIZE_PRESETS[size].width }) })),
|
|
8212
7629
|
value: screenSize,
|
|
8213
7630
|
onValueChange: (value) => {
|
|
8214
7631
|
if (typeof value === "string" && isScreenSize(value)) applyScreenSize(value);
|
|
@@ -8218,20 +7635,20 @@ function FlowCanvasInner({
|
|
|
8218
7635
|
className: "h-10 py-0 text-sm bg-card/80"
|
|
8219
7636
|
}
|
|
8220
7637
|
) }),
|
|
8221
|
-
/* @__PURE__ */ jsx(Box, { className: "hidden sm:flex ml-auto", "data-testid": "canvas-screen-size-buttons", children: /* @__PURE__ */ jsx(ButtonGroup, { variant: "segmented", className: "bg-card/80 backdrop-blur-sm rounded-md", children: screenSizeKeys.map((
|
|
8222
|
-
const p = SCREEN_SIZE_PRESETS[
|
|
7638
|
+
/* @__PURE__ */ jsx(Box, { className: "hidden sm:flex ml-auto", "data-testid": "canvas-screen-size-buttons", children: /* @__PURE__ */ jsx(ButtonGroup, { variant: "segmented", className: "bg-card/80 backdrop-blur-sm rounded-md", children: screenSizeKeys.map((size) => {
|
|
7639
|
+
const p = SCREEN_SIZE_PRESETS[size];
|
|
8223
7640
|
return /* @__PURE__ */ jsx(
|
|
8224
7641
|
Button,
|
|
8225
7642
|
{
|
|
8226
|
-
variant: screenSize ===
|
|
7643
|
+
variant: screenSize === size ? "primary" : "ghost",
|
|
8227
7644
|
size: "sm",
|
|
8228
|
-
onClick: () => applyScreenSize(
|
|
7645
|
+
onClick: () => applyScreenSize(size),
|
|
8229
7646
|
title: t("flowCanvas.presetSize", { label: t(p.labelKey), width: p.width }),
|
|
8230
7647
|
"aria-label": t("canvas.switchToView", { label: t(p.labelKey) }),
|
|
8231
|
-
"aria-pressed": screenSize ===
|
|
7648
|
+
"aria-pressed": screenSize === size,
|
|
8232
7649
|
children: t(p.labelKey)
|
|
8233
7650
|
},
|
|
8234
|
-
|
|
7651
|
+
size
|
|
8235
7652
|
);
|
|
8236
7653
|
}) }) })
|
|
8237
7654
|
] })
|
|
@@ -8335,7 +7752,7 @@ var ZoomBreadcrumb = ({
|
|
|
8335
7752
|
if (eventName && band === "detail") {
|
|
8336
7753
|
segments.push({ icon: "\u26A1", label: eventName });
|
|
8337
7754
|
}
|
|
8338
|
-
return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(
|
|
7755
|
+
return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
8339
7756
|
i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
|
|
8340
7757
|
/* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
|
|
8341
7758
|
/* @__PURE__ */ jsx("span", { children: seg.label })
|
|
@@ -8412,66 +7829,6 @@ var AvlCosmicZoom = (props) => {
|
|
|
8412
7829
|
);
|
|
8413
7830
|
};
|
|
8414
7831
|
AvlCosmicZoom.displayName = "AvlCosmicZoom";
|
|
8415
|
-
var isConfigObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
8416
|
-
var AvlTransitionDetail = ({ orbital, trait, transition, playback, stepEvent, className }) => {
|
|
8417
|
-
const { t } = useTranslate();
|
|
8418
|
-
const [payload, setPayload] = useState({});
|
|
8419
|
-
const guard = transition.guard;
|
|
8420
|
-
const guardRun = playback?.guard;
|
|
8421
|
-
const request = { orbital, trait, from: transition.from, event: transition.event, payload };
|
|
8422
|
-
const effectItems = useMemo(
|
|
8423
|
-
() => transition.effects.map((effect, i) => {
|
|
8424
|
-
const expr = [effect.type, ...effect.args];
|
|
8425
|
-
const ran = playback?.effects[i];
|
|
8426
|
-
return {
|
|
8427
|
-
id: `effect-${i}`,
|
|
8428
|
-
header: /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
|
|
8429
|
-
/* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", children: effect.type }),
|
|
8430
|
-
ran?.status === "failed" ? /* @__PURE__ */ jsx(Badge, { variant: "danger", size: "sm", children: t("avl.play.effectFailed") }) : null
|
|
8431
|
-
] }),
|
|
8432
|
-
content: /* @__PURE__ */ jsx(AvlCircuit, { expr, trace: ran?.evalTrace, showCode: true })
|
|
8433
|
-
};
|
|
8434
|
-
}),
|
|
8435
|
-
[transition.effects, playback, t]
|
|
8436
|
-
);
|
|
8437
|
-
const openEffects = transition.effects.map((effect, i) => effectZoneOf(effect.type) === "screen" ? null : `effect-${i}`).filter((id) => id !== null);
|
|
8438
|
-
return /* @__PURE__ */ jsx(Card, { className: `w-full max-w-5xl mx-auto ${className ?? ""}`, shadow: "md", "data-testid": "avl-transition-detail", children: /* @__PURE__ */ jsx(Box, { className: "p-6", children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", children: [
|
|
8439
|
-
/* @__PURE__ */ jsxs(HStack, { gap: "md", justify: "between", align: "center", wrap: true, children: [
|
|
8440
|
-
/* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
|
|
8441
|
-
/* @__PURE__ */ jsx(Badge, { variant: "neutral", size: "lg", children: transition.from }),
|
|
8442
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body1", weight: "semibold", children: transition.event }),
|
|
8443
|
-
/* @__PURE__ */ jsx(Typography, { variant: "h5", color: "muted", children: "\u2192" }),
|
|
8444
|
-
/* @__PURE__ */ jsx(Badge, { variant: "neutral", size: "lg", children: transition.to })
|
|
8445
|
-
] }),
|
|
8446
|
-
playback ? /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: /* @__PURE__ */ jsx(Badge, { variant: playback.fired ? "success" : "warning", size: "md", "data-testid": "avl-transition-verdict", children: playback.fired ? t("avl.play.fired") : guardRun && !guardRun.passed ? t("avl.play.blocked") : t("avl.play.notReached") }) }) : null
|
|
8447
|
-
] }),
|
|
8448
|
-
stepEvent ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
8449
|
-
/* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t("avl.play.payload") }),
|
|
8450
|
-
/* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "start", children: [
|
|
8451
|
-
/* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx(JsonTreeEditor, { value: payload, onChange: (next) => setPayload(isConfigObject(next) ? next : {}) }) }),
|
|
8452
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", action: stepEvent, actionPayload: request, leftIcon: "skip-forward", children: t("avl.play.step") })
|
|
8453
|
-
] })
|
|
8454
|
-
] }) : null,
|
|
8455
|
-
!playback && stepEvent ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: t("avl.play.notPlayed") }) : null,
|
|
8456
|
-
guard !== null ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
8457
|
-
/* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
|
|
8458
|
-
/* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t("avl.guard") }),
|
|
8459
|
-
guardRun ? /* @__PURE__ */ jsx(Badge, { variant: guardRun.passed ? "success" : "danger", size: "sm", children: guardRun.passed ? t("avl.play.guardPassed") : t("avl.play.guardFailed") }) : null
|
|
8460
|
-
] }),
|
|
8461
|
-
/* @__PURE__ */ jsx(AvlCircuit, { expr: guard, trace: guardRun?.trace })
|
|
8462
|
-
] }) : null,
|
|
8463
|
-
effectItems.length > 0 ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
8464
|
-
/* @__PURE__ */ jsxs(Typography, { variant: "overline", color: "muted", children: [
|
|
8465
|
-
t("avl.effects"),
|
|
8466
|
-
" (",
|
|
8467
|
-
effectItems.length,
|
|
8468
|
-
")"
|
|
8469
|
-
] }),
|
|
8470
|
-
/* @__PURE__ */ jsx(Accordion, { items: effectItems, multiple: true, defaultOpenItems: openEffects })
|
|
8471
|
-
] }) : null
|
|
8472
|
-
] }) }) });
|
|
8473
|
-
};
|
|
8474
|
-
AvlTransitionDetail.displayName = "AvlTransitionDetail";
|
|
8475
7832
|
var LEVEL_BOX = { inset: 0, paddingTop: 56, paddingBottom: 24, paddingLeft: 24, paddingRight: 24 };
|
|
8476
7833
|
var AvlOrbitalsCosmicZoom = ({
|
|
8477
7834
|
schema: schemaProp,
|
|
@@ -8582,7 +7939,7 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
8582
7939
|
borderRadius: 6,
|
|
8583
7940
|
border: `1px solid ${color}`
|
|
8584
7941
|
},
|
|
8585
|
-
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(
|
|
7942
|
+
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React16.Fragment, { children: [
|
|
8586
7943
|
i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
|
|
8587
7944
|
i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
|
|
8588
7945
|
Box,
|
|
@@ -9125,4 +8482,4 @@ function deploymentGraph(input) {
|
|
|
9125
8482
|
});
|
|
9126
8483
|
}
|
|
9127
8484
|
|
|
9128
|
-
export { AVL_GRAPH_NODE_TYPES, AvlBackwardEdge, AvlBehaviorGlyph, AvlBindingEdge,
|
|
8485
|
+
export { AVL_GRAPH_NODE_TYPES, AvlBackwardEdge, AvlBehaviorGlyph, AvlBindingEdge, AvlClickTarget, AvlClosedCircuit, AvlCosmicZoom, AvlEmitListen, AvlEventWireEdge, AvlExprTree, AvlGraphCanvas, AvlOrbitalUnit, AvlOrbitalsCosmicZoom, AvlPageEdge, AvlSlotMap, AvlSwimLane, AvlTraitScene, AvlTransitionEdge, AvlTransitionLane, AvlTransitionScene, CANVAS_TOOLS, CanvasDndProvider, CanvasVerifyContext, DEPLOYMENT_ROW, DOMAIN_COLORS, DependencyColumnNode, DependencyNode, DetailView, EDITABLE, ElementEditAccessContext, EventFlowEdge, FlowCanvas, KnobField, KnobSettingRow, LIVE_STATE, LayersPanel, OrbInspector, OrbPreviewNode, SystemBandNode, SystemMapContext, SystemNode, ZOOM_BAND_THRESHOLDS, ZoomBandContext, ZoomBreadcrumb, ZoomLegend, arcPath, armPosition, armsOf, canvasViewGraph, computeZoomBand, curveControlPoint, dependencyReach, deploymentGraph, deriveEditFocusFromElement, dropBusEvent, firedTransition, flowNeighbors, gridPositions, hasCanvasTool, initialStateOf, layeredGraph, optionForPlayedStep, parseLayerId, propAccessAt, radialPositions, ringPositions, schemaToDependencyGraph, schemaToFlowGraph, schemaToLayerItems, schemaToOverviewGraph, stateMachinePlayback, stateOptionsOf, traitFlowGraph, transitionPlayback, useCanvasDraggable, useCanvasDroppable, useInlineTextEdit, useZoomBand, zoomProgress };
|