@almadar/ui 4.50.22 → 4.51.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/avl/index.cjs +219 -180
- package/dist/avl/index.d.cts +146 -2
- package/dist/avl/index.d.ts +1 -0
- package/dist/avl/index.js +218 -182
- package/dist/components/index.cjs +28 -19
- package/dist/components/index.js +30 -21
- package/dist/components/molecules/avl/useCanvasDnd.d.ts +144 -0
- package/dist/hooks/useAlmadarDndCollision.d.ts +34 -0
- package/dist/providers/index.cjs +28 -19
- package/dist/providers/index.js +30 -21
- package/dist/runtime/index.cjs +28 -19
- package/dist/runtime/index.js +30 -21
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -13697,7 +13697,7 @@ var init_MapView = __esm({
|
|
|
13697
13697
|
shadowSize: [41, 41]
|
|
13698
13698
|
});
|
|
13699
13699
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
13700
|
-
const { useEffect: useEffect87, useRef: useRef87, useCallback:
|
|
13700
|
+
const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback126, useState: useState120 } = React93__namespace.default;
|
|
13701
13701
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
13702
13702
|
const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
13703
13703
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
@@ -13742,8 +13742,8 @@ var init_MapView = __esm({
|
|
|
13742
13742
|
showAttribution = true
|
|
13743
13743
|
}) {
|
|
13744
13744
|
const eventBus = useEventBus3();
|
|
13745
|
-
const [clickedPosition, setClickedPosition] =
|
|
13746
|
-
const handleMapClick =
|
|
13745
|
+
const [clickedPosition, setClickedPosition] = useState120(null);
|
|
13746
|
+
const handleMapClick = useCallback126((lat, lng) => {
|
|
13747
13747
|
if (showClickedPin) {
|
|
13748
13748
|
setClickedPosition({ lat, lng });
|
|
13749
13749
|
}
|
|
@@ -13752,7 +13752,7 @@ var init_MapView = __esm({
|
|
|
13752
13752
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
13753
13753
|
}
|
|
13754
13754
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
13755
|
-
const handleMarkerClick =
|
|
13755
|
+
const handleMarkerClick = useCallback126((marker) => {
|
|
13756
13756
|
onMarkerClick?.(marker);
|
|
13757
13757
|
if (markerClickEvent) {
|
|
13758
13758
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -24906,6 +24906,31 @@ var init_DashboardLayout = __esm({
|
|
|
24906
24906
|
NavLink.displayName = "NavLink";
|
|
24907
24907
|
}
|
|
24908
24908
|
});
|
|
24909
|
+
function useAlmadarDndSensors(withSortableKeyboard = true) {
|
|
24910
|
+
return core$1.useSensors(
|
|
24911
|
+
core$1.useSensor(core$1.PointerSensor, {
|
|
24912
|
+
activationConstraint: { distance: ALMADAR_DND_ACTIVATION_DISTANCE }
|
|
24913
|
+
}),
|
|
24914
|
+
core$1.useSensor(
|
|
24915
|
+
core$1.KeyboardSensor,
|
|
24916
|
+
withSortableKeyboard ? { coordinateGetter: sortable.sortableKeyboardCoordinates } : void 0
|
|
24917
|
+
)
|
|
24918
|
+
);
|
|
24919
|
+
}
|
|
24920
|
+
var ALMADAR_DND_ACTIVATION_DISTANCE, almadarDndCollisionDetection;
|
|
24921
|
+
var init_useAlmadarDndCollision = __esm({
|
|
24922
|
+
"hooks/useAlmadarDndCollision.ts"() {
|
|
24923
|
+
"use client";
|
|
24924
|
+
ALMADAR_DND_ACTIVATION_DISTANCE = 5;
|
|
24925
|
+
almadarDndCollisionDetection = (args) => {
|
|
24926
|
+
const pw = core$1.pointerWithin(args);
|
|
24927
|
+
if (pw.length > 0) return pw;
|
|
24928
|
+
const ri = core$1.rectIntersection(args);
|
|
24929
|
+
if (ri.length > 0) return ri;
|
|
24930
|
+
return core$1.closestCorners(args);
|
|
24931
|
+
};
|
|
24932
|
+
}
|
|
24933
|
+
});
|
|
24909
24934
|
function useDataDnd(args) {
|
|
24910
24935
|
const {
|
|
24911
24936
|
dragGroup,
|
|
@@ -25001,25 +25026,8 @@ function useDataDnd(args) {
|
|
|
25001
25026
|
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
25002
25027
|
};
|
|
25003
25028
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
25004
|
-
const sensors =
|
|
25005
|
-
|
|
25006
|
-
core$1.useSensor(core$1.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
|
|
25007
|
-
);
|
|
25008
|
-
const collisionDetection = React93__namespace.default.useCallback((args2) => {
|
|
25009
|
-
const pointerCollisions = core$1.pointerWithin(args2);
|
|
25010
|
-
if (pointerCollisions.length > 0) {
|
|
25011
|
-
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
25012
|
-
return pointerCollisions;
|
|
25013
|
-
}
|
|
25014
|
-
const rectCollisions = core$1.rectIntersection(args2);
|
|
25015
|
-
if (rectCollisions.length > 0) {
|
|
25016
|
-
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
25017
|
-
return rectCollisions;
|
|
25018
|
-
}
|
|
25019
|
-
const cornerCollisions = core$1.closestCorners(args2);
|
|
25020
|
-
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
25021
|
-
return cornerCollisions;
|
|
25022
|
-
}, []);
|
|
25029
|
+
const sensors = useAlmadarDndSensors(true);
|
|
25030
|
+
const collisionDetection = almadarDndCollisionDetection;
|
|
25023
25031
|
const findZoneByItem = React93__namespace.default.useCallback(
|
|
25024
25032
|
(id) => {
|
|
25025
25033
|
for (const z of zonesRef.current.values()) {
|
|
@@ -25356,6 +25364,7 @@ var init_useDataDnd = __esm({
|
|
|
25356
25364
|
"components/molecules/useDataDnd.tsx"() {
|
|
25357
25365
|
"use client";
|
|
25358
25366
|
init_useEventBus();
|
|
25367
|
+
init_useAlmadarDndCollision();
|
|
25359
25368
|
init_Box();
|
|
25360
25369
|
dndLog = logger.createLogger("almadar:ui:dnd");
|
|
25361
25370
|
RootCtx = React93__namespace.default.createContext(null);
|
|
@@ -42979,7 +42988,7 @@ function getAllEvents(traits2) {
|
|
|
42979
42988
|
}
|
|
42980
42989
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
42981
42990
|
const eventBus = useEventBus();
|
|
42982
|
-
const [
|
|
42991
|
+
const [log20, setLog] = React93__namespace.useState([]);
|
|
42983
42992
|
const prevStatesRef = React93__namespace.useRef(/* @__PURE__ */ new Map());
|
|
42984
42993
|
React93__namespace.useEffect(() => {
|
|
42985
42994
|
for (const trait of traits2) {
|
|
@@ -43043,9 +43052,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
|
|
|
43043
43052
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
|
|
43044
43053
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
|
|
43045
43054
|
] }),
|
|
43046
|
-
|
|
43055
|
+
log20.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
43047
43056
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
|
|
43048
|
-
/* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children:
|
|
43057
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log20.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
|
|
43049
43058
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
|
|
43050
43059
|
" ",
|
|
43051
43060
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
|
|
@@ -57468,67 +57477,6 @@ function convertFnFormLambdasInProps(props) {
|
|
|
57468
57477
|
|
|
57469
57478
|
// hooks/index.ts
|
|
57470
57479
|
init_useEventBus();
|
|
57471
|
-
var ALMADAR_DND_MIME = "application/x-almadar-dnd";
|
|
57472
|
-
|
|
57473
|
-
// hooks/useDropZone.ts
|
|
57474
|
-
init_useEventBus();
|
|
57475
|
-
function parsePayload(e) {
|
|
57476
|
-
try {
|
|
57477
|
-
const raw = e.dataTransfer.getData(ALMADAR_DND_MIME);
|
|
57478
|
-
if (!raw) return null;
|
|
57479
|
-
const parsed = JSON.parse(raw);
|
|
57480
|
-
if (typeof parsed.kind !== "string" || !parsed.data) return null;
|
|
57481
|
-
return parsed;
|
|
57482
|
-
} catch {
|
|
57483
|
-
return null;
|
|
57484
|
-
}
|
|
57485
|
-
}
|
|
57486
|
-
function hasAlmadarPayload(e) {
|
|
57487
|
-
return e.dataTransfer.types.includes(ALMADAR_DND_MIME);
|
|
57488
|
-
}
|
|
57489
|
-
function useDropZone({ accepts, onDrop, disabled = false }) {
|
|
57490
|
-
const [isOver, setIsOver] = React93.useState(false);
|
|
57491
|
-
const eventBus = useEventBus();
|
|
57492
|
-
const handleDragOver = React93.useCallback(
|
|
57493
|
-
(e) => {
|
|
57494
|
-
if (disabled) return;
|
|
57495
|
-
if (!hasAlmadarPayload(e)) return;
|
|
57496
|
-
e.preventDefault();
|
|
57497
|
-
e.dataTransfer.dropEffect = "copy";
|
|
57498
|
-
setIsOver(true);
|
|
57499
|
-
},
|
|
57500
|
-
[disabled]
|
|
57501
|
-
);
|
|
57502
|
-
const handleDragLeave = React93.useCallback(
|
|
57503
|
-
(e) => {
|
|
57504
|
-
setIsOver(false);
|
|
57505
|
-
},
|
|
57506
|
-
[]
|
|
57507
|
-
);
|
|
57508
|
-
const handleDrop = React93.useCallback(
|
|
57509
|
-
(e) => {
|
|
57510
|
-
e.preventDefault();
|
|
57511
|
-
setIsOver(false);
|
|
57512
|
-
if (disabled) return;
|
|
57513
|
-
const payload = parsePayload(e);
|
|
57514
|
-
if (!payload) return;
|
|
57515
|
-
if (!accepts.includes(payload.kind)) return;
|
|
57516
|
-
const position = { x: e.clientX, y: e.clientY };
|
|
57517
|
-
onDrop(payload, position);
|
|
57518
|
-
eventBus.emit("UI:DROP", { kind: payload.kind, data: payload.data, ...position });
|
|
57519
|
-
},
|
|
57520
|
-
[disabled, accepts, onDrop, eventBus]
|
|
57521
|
-
);
|
|
57522
|
-
const dropProps = React93.useMemo(
|
|
57523
|
-
() => ({
|
|
57524
|
-
onDragOver: handleDragOver,
|
|
57525
|
-
onDragLeave: handleDragLeave,
|
|
57526
|
-
onDrop: handleDrop
|
|
57527
|
-
}),
|
|
57528
|
-
[handleDragOver, handleDragLeave, handleDrop]
|
|
57529
|
-
);
|
|
57530
|
-
return { dropProps, isOver };
|
|
57531
|
-
}
|
|
57532
57480
|
var log16 = logger.createLogger("almadar:ui:effects:client-handlers");
|
|
57533
57481
|
function createClientEffectHandlers(options) {
|
|
57534
57482
|
const { eventBus, slotSetter, navigate, notify, callService } = options;
|
|
@@ -59141,6 +59089,128 @@ function BrowserPlayground({
|
|
|
59141
59089
|
// components/molecules/avl/OrbPreviewNode.tsx
|
|
59142
59090
|
init_useEventBus();
|
|
59143
59091
|
|
|
59092
|
+
// components/molecules/avl/useCanvasDnd.tsx
|
|
59093
|
+
init_useEventBus();
|
|
59094
|
+
init_useAlmadarDndCollision();
|
|
59095
|
+
var log18 = logger.createLogger("almadar:ui:canvas-dnd");
|
|
59096
|
+
function useCanvasDraggable({
|
|
59097
|
+
id,
|
|
59098
|
+
payload,
|
|
59099
|
+
disabled
|
|
59100
|
+
}) {
|
|
59101
|
+
const { setNodeRef, attributes, listeners: listeners6, isDragging, transform } = core$1.useDraggable({
|
|
59102
|
+
id,
|
|
59103
|
+
data: { payload },
|
|
59104
|
+
disabled
|
|
59105
|
+
});
|
|
59106
|
+
const style = {
|
|
59107
|
+
transform: utilities.CSS.Translate.toString(transform),
|
|
59108
|
+
cursor: disabled ? "not-allowed" : isDragging ? "grabbing" : "grab",
|
|
59109
|
+
opacity: isDragging ? 0.5 : 1,
|
|
59110
|
+
touchAction: "none"
|
|
59111
|
+
};
|
|
59112
|
+
return { setNodeRef, attributes, listeners: listeners6, isDragging, style };
|
|
59113
|
+
}
|
|
59114
|
+
var DEFAULT_ACCEPTS = ["pattern", "behavior"];
|
|
59115
|
+
function useCanvasDroppable({
|
|
59116
|
+
id,
|
|
59117
|
+
target,
|
|
59118
|
+
accepts,
|
|
59119
|
+
disabled
|
|
59120
|
+
}) {
|
|
59121
|
+
const acceptsList = accepts ?? DEFAULT_ACCEPTS;
|
|
59122
|
+
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
59123
|
+
id,
|
|
59124
|
+
data: { target, accepts: acceptsList },
|
|
59125
|
+
disabled
|
|
59126
|
+
});
|
|
59127
|
+
return { setNodeRef, isOver };
|
|
59128
|
+
}
|
|
59129
|
+
function defaultEmit(eventBus, drop) {
|
|
59130
|
+
const { payload, target, resolved } = drop;
|
|
59131
|
+
if (payload.kind === "pattern") {
|
|
59132
|
+
const patternType = payload.data.type;
|
|
59133
|
+
if (typeof patternType !== "string") {
|
|
59134
|
+
log18.warn("default-emit:pattern:missing-type");
|
|
59135
|
+
return;
|
|
59136
|
+
}
|
|
59137
|
+
const out = { patternType, containerNode: target.containerNode };
|
|
59138
|
+
if (resolved) {
|
|
59139
|
+
out.parentPath = resolved.parentPath;
|
|
59140
|
+
out.index = resolved.index;
|
|
59141
|
+
}
|
|
59142
|
+
eventBus.emit("UI:PATTERN_DROP", out);
|
|
59143
|
+
log18.info("default-emit:pattern", { patternType, level: target.level });
|
|
59144
|
+
return;
|
|
59145
|
+
}
|
|
59146
|
+
if (payload.kind === "behavior") {
|
|
59147
|
+
const behaviorName = payload.data.name;
|
|
59148
|
+
if (typeof behaviorName !== "string") {
|
|
59149
|
+
log18.warn("default-emit:behavior:missing-name");
|
|
59150
|
+
return;
|
|
59151
|
+
}
|
|
59152
|
+
eventBus.emit("UI:BEHAVIOR_DROP", {
|
|
59153
|
+
behaviorName,
|
|
59154
|
+
containerNode: target.containerNode
|
|
59155
|
+
});
|
|
59156
|
+
log18.info("default-emit:behavior", { behaviorName, level: target.level });
|
|
59157
|
+
return;
|
|
59158
|
+
}
|
|
59159
|
+
log18.debug("default-emit:unhandled-kind", { kind: payload.kind });
|
|
59160
|
+
}
|
|
59161
|
+
function CanvasDndProvider({ children, onDrop }) {
|
|
59162
|
+
const eventBus = useEventBus();
|
|
59163
|
+
const sensors = useAlmadarDndSensors(false);
|
|
59164
|
+
const handleDragStart = React93__namespace.default.useCallback((e) => {
|
|
59165
|
+
const data = e.active.data.current;
|
|
59166
|
+
const payload = data?.payload;
|
|
59167
|
+
if (payload) {
|
|
59168
|
+
eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
|
|
59169
|
+
log18.info("dragStart", { id: e.active.id, kind: payload.kind });
|
|
59170
|
+
} else {
|
|
59171
|
+
log18.warn("dragStart:missing-payload", { id: e.active.id });
|
|
59172
|
+
}
|
|
59173
|
+
}, [eventBus]);
|
|
59174
|
+
const handleDragEnd = React93__namespace.default.useCallback((e) => {
|
|
59175
|
+
const activeData = e.active.data.current;
|
|
59176
|
+
const payload = activeData?.payload;
|
|
59177
|
+
const overData = e.over?.data.current;
|
|
59178
|
+
const target = overData?.target;
|
|
59179
|
+
const accepts = overData?.accepts;
|
|
59180
|
+
log18.info("dragEnd", {
|
|
59181
|
+
activeId: e.active.id,
|
|
59182
|
+
overId: e.over?.id,
|
|
59183
|
+
hasPayload: !!payload,
|
|
59184
|
+
hasTarget: !!target,
|
|
59185
|
+
targetLevel: target?.level
|
|
59186
|
+
});
|
|
59187
|
+
if (payload) {
|
|
59188
|
+
eventBus.emit("UI:DRAG_END", { kind: payload.kind, data: payload.data });
|
|
59189
|
+
}
|
|
59190
|
+
if (!payload || !target) return;
|
|
59191
|
+
if (accepts && !accepts.includes(payload.kind)) {
|
|
59192
|
+
log18.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
|
|
59193
|
+
return;
|
|
59194
|
+
}
|
|
59195
|
+
const activator = e.activatorEvent;
|
|
59196
|
+
const cursor = activator && typeof activator.clientX === "number" && typeof activator.clientY === "number" ? { x: activator.clientX + e.delta.x, y: activator.clientY + e.delta.y } : null;
|
|
59197
|
+
const resolved = target.resolvePath && cursor ? target.resolvePath(cursor) : null;
|
|
59198
|
+
const drop = { payload, target, cursor, resolved };
|
|
59199
|
+
const suppressed = onDrop ? onDrop(drop) === true : false;
|
|
59200
|
+
if (!suppressed) defaultEmit(eventBus, drop);
|
|
59201
|
+
}, [eventBus, onDrop]);
|
|
59202
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
59203
|
+
core$1.DndContext,
|
|
59204
|
+
{
|
|
59205
|
+
sensors,
|
|
59206
|
+
collisionDetection: almadarDndCollisionDetection,
|
|
59207
|
+
onDragStart: handleDragStart,
|
|
59208
|
+
onDragEnd: handleDragEnd,
|
|
59209
|
+
children
|
|
59210
|
+
}
|
|
59211
|
+
);
|
|
59212
|
+
}
|
|
59213
|
+
|
|
59144
59214
|
// components/molecules/avl/wire-validation.ts
|
|
59145
59215
|
function validateWire(sourcePayload, targetPayload) {
|
|
59146
59216
|
const warnings = [];
|
|
@@ -59489,105 +59559,74 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
59489
59559
|
unsub2();
|
|
59490
59560
|
};
|
|
59491
59561
|
}, [eventBus]);
|
|
59492
|
-
const
|
|
59493
|
-
|
|
59494
|
-
|
|
59495
|
-
|
|
59496
|
-
|
|
59497
|
-
|
|
59498
|
-
|
|
59499
|
-
|
|
59500
|
-
|
|
59501
|
-
|
|
59502
|
-
|
|
59503
|
-
|
|
59504
|
-
|
|
59505
|
-
|
|
59506
|
-
return;
|
|
59507
|
-
}
|
|
59508
|
-
if (payload.kind !== "pattern") return;
|
|
59509
|
-
let el = e.target;
|
|
59510
|
-
while (el && el.dataset.acceptsChildren !== "true") {
|
|
59511
|
-
el = el.parentElement;
|
|
59512
|
-
if (!el || el === contentRef.current) break;
|
|
59513
|
-
}
|
|
59514
|
-
const containerNode = {
|
|
59515
|
-
orbitalName: data.orbitalName,
|
|
59516
|
-
traitName: data.traitName,
|
|
59517
|
-
transitionEvent: data.transitionEvent
|
|
59518
|
-
};
|
|
59519
|
-
const containerPath = el?.dataset?.patternPath;
|
|
59520
|
-
if (!containerPath) {
|
|
59521
|
-
eventBus.emit("UI:PATTERN_DROP", {
|
|
59522
|
-
parentPath: "root",
|
|
59523
|
-
patternType: payload.data.type,
|
|
59524
|
-
index: 0,
|
|
59525
|
-
containerNode
|
|
59526
|
-
});
|
|
59527
|
-
return;
|
|
59528
|
-
}
|
|
59529
|
-
const pathChildren = el.querySelectorAll(":scope > [data-pattern-path]");
|
|
59530
|
-
let insertIndex = pathChildren.length;
|
|
59531
|
-
for (let i = 0; i < pathChildren.length; i++) {
|
|
59532
|
-
const rect = pathChildren[i].getBoundingClientRect();
|
|
59562
|
+
const resolveL2Path = React93.useCallback(
|
|
59563
|
+
(cursor) => {
|
|
59564
|
+
const hit = document.elementFromPoint(cursor.x, cursor.y);
|
|
59565
|
+
if (!hit) return null;
|
|
59566
|
+
let el = hit;
|
|
59567
|
+
while (el && el.dataset.acceptsChildren !== "true") {
|
|
59568
|
+
if (el === contentRef.current) break;
|
|
59569
|
+
el = el.parentElement;
|
|
59570
|
+
}
|
|
59571
|
+
if (!el) return null;
|
|
59572
|
+
const containerPath = el.dataset?.patternPath;
|
|
59573
|
+
if (!containerPath) return { parentPath: "root", index: 0 };
|
|
59574
|
+
const pathChildren = el.querySelectorAll(":scope > [data-pattern-path]");
|
|
59575
|
+
let insertIndex = pathChildren.length;
|
|
59533
59576
|
const style = el.firstElementChild ? getComputedStyle(el.firstElementChild) : null;
|
|
59534
59577
|
const isVertical = style?.flexDirection !== "row";
|
|
59535
|
-
|
|
59536
|
-
|
|
59537
|
-
|
|
59538
|
-
|
|
59539
|
-
|
|
59578
|
+
for (let i = 0; i < pathChildren.length; i++) {
|
|
59579
|
+
const rect = pathChildren[i].getBoundingClientRect();
|
|
59580
|
+
const mid = isVertical ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
|
|
59581
|
+
const pos = isVertical ? cursor.y : cursor.x;
|
|
59582
|
+
if (pos < mid) {
|
|
59583
|
+
insertIndex = i;
|
|
59584
|
+
break;
|
|
59585
|
+
}
|
|
59540
59586
|
}
|
|
59541
|
-
|
|
59542
|
-
|
|
59543
|
-
|
|
59544
|
-
|
|
59545
|
-
|
|
59546
|
-
|
|
59547
|
-
|
|
59548
|
-
|
|
59549
|
-
|
|
59550
|
-
|
|
59551
|
-
|
|
59552
|
-
|
|
59553
|
-
|
|
59554
|
-
|
|
59555
|
-
|
|
59556
|
-
|
|
59557
|
-
|
|
59558
|
-
|
|
59559
|
-
|
|
59560
|
-
|
|
59561
|
-
|
|
59562
|
-
|
|
59563
|
-
|
|
59564
|
-
|
|
59565
|
-
|
|
59566
|
-
|
|
59567
|
-
}, []);
|
|
59587
|
+
return { parentPath: containerPath, index: insertIndex };
|
|
59588
|
+
},
|
|
59589
|
+
[]
|
|
59590
|
+
);
|
|
59591
|
+
const l2Target = React93.useMemo(
|
|
59592
|
+
() => ({
|
|
59593
|
+
level: "l2",
|
|
59594
|
+
containerNode: {
|
|
59595
|
+
orbitalName: data.orbitalName,
|
|
59596
|
+
traitName: data.traitName,
|
|
59597
|
+
transitionEvent: data.transitionEvent
|
|
59598
|
+
},
|
|
59599
|
+
resolvePath: resolveL2Path
|
|
59600
|
+
}),
|
|
59601
|
+
[data.orbitalName, data.traitName, data.transitionEvent, resolveL2Path]
|
|
59602
|
+
);
|
|
59603
|
+
const { setNodeRef: l2SetNodeRef, isOver: l2IsOver } = useCanvasDroppable({
|
|
59604
|
+
id: `orb-l2-${data.orbitalName}-${data.traitName ?? ""}-${data.transitionEvent ?? ""}`,
|
|
59605
|
+
target: l2Target,
|
|
59606
|
+
accepts: ["pattern"],
|
|
59607
|
+
disabled: !isExpanded
|
|
59608
|
+
});
|
|
59609
|
+
const setContentRef = React93.useCallback((el) => {
|
|
59610
|
+
contentRef.current = el;
|
|
59611
|
+
l2SetNodeRef(el);
|
|
59612
|
+
}, [l2SetNodeRef]);
|
|
59568
59613
|
const statusBorder = isRunning ? "var(--color-primary)" : isError ? "var(--color-danger)" : isSuccess ? "var(--color-success)" : null;
|
|
59569
59614
|
const borderWidth = isRunning || isError || isSuccess ? "2px" : "1.5px";
|
|
59570
59615
|
const borderColor = statusBorder ?? (hovered ? "var(--color-primary)" : colors.border);
|
|
59571
|
-
const
|
|
59572
|
-
(
|
|
59573
|
-
|
|
59574
|
-
if (typeof payload.data.type !== "string") return;
|
|
59575
|
-
eventBus.emit("UI:PATTERN_DROP", {
|
|
59576
|
-
patternType: payload.data.type,
|
|
59577
|
-
containerNode: { orbitalName: data.orbitalName }
|
|
59578
|
-
});
|
|
59579
|
-
},
|
|
59580
|
-
[eventBus, data.orbitalName]
|
|
59616
|
+
const l1Target = React93.useMemo(
|
|
59617
|
+
() => ({ level: "l1", containerNode: { orbitalName: data.orbitalName } }),
|
|
59618
|
+
[data.orbitalName]
|
|
59581
59619
|
);
|
|
59582
|
-
const {
|
|
59620
|
+
const { setNodeRef: l1SetNodeRef, isOver: l1IsOver } = useCanvasDroppable({
|
|
59621
|
+
id: `orb-l1-${data.orbitalName}`,
|
|
59622
|
+
target: l1Target,
|
|
59583
59623
|
accepts: ["pattern"],
|
|
59584
|
-
onDrop: handleL1Drop,
|
|
59585
59624
|
disabled: isExpanded
|
|
59586
59625
|
});
|
|
59587
59626
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
59588
59627
|
Box,
|
|
59589
59628
|
{
|
|
59590
|
-
|
|
59629
|
+
ref: isExpanded ? void 0 : l1SetNodeRef,
|
|
59591
59630
|
className: `rounded-lg border shadow-sm bg-card transition-all duration-200 overflow-hidden relative${isRunning ? " orb-preview-running" : ""}`,
|
|
59592
59631
|
style: {
|
|
59593
59632
|
borderColor: l1IsOver ? "var(--color-primary)" : borderColor,
|
|
@@ -59729,12 +59768,9 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
59729
59768
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59730
59769
|
Box,
|
|
59731
59770
|
{
|
|
59732
|
-
ref:
|
|
59733
|
-
className: `orb-preview-live nodrag${dragActive ? " drag-active" : ""}`,
|
|
59771
|
+
ref: setContentRef,
|
|
59772
|
+
className: `orb-preview-live nodrag${dragActive || l2IsOver ? " drag-active" : ""}`,
|
|
59734
59773
|
onClick: handleContentClick,
|
|
59735
|
-
onDrop: handlePreviewDrop,
|
|
59736
|
-
onDragOver: handlePreviewDragOver,
|
|
59737
|
-
onDragLeave: handlePreviewDragLeave,
|
|
59738
59774
|
children: orbitalSchema ? /* @__PURE__ */ jsxRuntime.jsx(Box, { style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
59739
59775
|
BrowserPlayground,
|
|
59740
59776
|
{
|
|
@@ -61230,7 +61266,7 @@ init_AvlTransitionLane();
|
|
|
61230
61266
|
init_AvlSwimLane();
|
|
61231
61267
|
init_types();
|
|
61232
61268
|
init_avl_elk_layout();
|
|
61233
|
-
var
|
|
61269
|
+
var log19 = logger.createLogger("almadar:ui:avl:trait-scene");
|
|
61234
61270
|
var SWIM_GUTTER2 = 120;
|
|
61235
61271
|
var CENTER_W2 = 360;
|
|
61236
61272
|
var AvlTraitScene = ({
|
|
@@ -61242,7 +61278,7 @@ var AvlTraitScene = ({
|
|
|
61242
61278
|
const dataKey = React93.useMemo(() => JSON.stringify(data), [data]);
|
|
61243
61279
|
React93.useEffect(() => {
|
|
61244
61280
|
computeTraitLayout(data).then(setLayout).catch((error) => {
|
|
61245
|
-
|
|
61281
|
+
log19.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
|
|
61246
61282
|
});
|
|
61247
61283
|
}, [dataKey]);
|
|
61248
61284
|
if (!layout) {
|
|
@@ -62416,6 +62452,7 @@ exports.AvlTransition = AvlTransition;
|
|
|
62416
62452
|
exports.AvlTransitionEdge = AvlTransitionEdge;
|
|
62417
62453
|
exports.AvlTransitionScene = AvlTransitionScene;
|
|
62418
62454
|
exports.BehaviorComposeNode = BehaviorComposeNode;
|
|
62455
|
+
exports.CanvasDndProvider = CanvasDndProvider;
|
|
62419
62456
|
exports.DOMAIN_COLORS = DOMAIN_COLORS;
|
|
62420
62457
|
exports.DetailView = DetailView;
|
|
62421
62458
|
exports.EventFlowEdge = EventFlowEdge;
|
|
@@ -62445,5 +62482,7 @@ exports.registryEntryToCanvasEntry = registryEntryToCanvasEntry;
|
|
|
62445
62482
|
exports.ringPositions = ringPositions;
|
|
62446
62483
|
exports.schemaToFlowGraph = schemaToFlowGraph;
|
|
62447
62484
|
exports.schemaToOverviewGraph = schemaToOverviewGraph;
|
|
62485
|
+
exports.useCanvasDraggable = useCanvasDraggable;
|
|
62486
|
+
exports.useCanvasDroppable = useCanvasDroppable;
|
|
62448
62487
|
exports.useZoomBand = useZoomBand;
|
|
62449
62488
|
exports.zoomProgress = zoomProgress;
|