@almadar/ui 4.50.22 → 4.51.1
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 +234 -180
- package/dist/avl/index.d.cts +157 -2
- package/dist/avl/index.d.ts +1 -0
- package/dist/avl/index.js +233 -182
- package/dist/components/index.cjs +28 -19
- package/dist/components/index.js +30 -21
- package/dist/components/molecules/avl/useCanvasDnd.d.ts +155 -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,143 @@ 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({
|
|
59162
|
+
children,
|
|
59163
|
+
onDrop,
|
|
59164
|
+
renderOverlay
|
|
59165
|
+
}) {
|
|
59166
|
+
const eventBus = useEventBus();
|
|
59167
|
+
const sensors = useAlmadarDndSensors(false);
|
|
59168
|
+
const [activePayload, setActivePayload] = React93__namespace.default.useState(null);
|
|
59169
|
+
const handleDragStart = React93__namespace.default.useCallback((e) => {
|
|
59170
|
+
const data = e.active.data.current;
|
|
59171
|
+
const payload = data?.payload;
|
|
59172
|
+
if (payload) {
|
|
59173
|
+
setActivePayload(payload);
|
|
59174
|
+
eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
|
|
59175
|
+
log18.info("dragStart", { id: e.active.id, kind: payload.kind });
|
|
59176
|
+
} else {
|
|
59177
|
+
log18.warn("dragStart:missing-payload", { id: e.active.id });
|
|
59178
|
+
}
|
|
59179
|
+
}, [eventBus]);
|
|
59180
|
+
const handleDragEnd = React93__namespace.default.useCallback((e) => {
|
|
59181
|
+
setActivePayload(null);
|
|
59182
|
+
const activeData = e.active.data.current;
|
|
59183
|
+
const payload = activeData?.payload;
|
|
59184
|
+
const overData = e.over?.data.current;
|
|
59185
|
+
const target = overData?.target;
|
|
59186
|
+
const accepts = overData?.accepts;
|
|
59187
|
+
log18.info("dragEnd", {
|
|
59188
|
+
activeId: e.active.id,
|
|
59189
|
+
overId: e.over?.id,
|
|
59190
|
+
hasPayload: !!payload,
|
|
59191
|
+
hasTarget: !!target,
|
|
59192
|
+
targetLevel: target?.level
|
|
59193
|
+
});
|
|
59194
|
+
if (payload) {
|
|
59195
|
+
eventBus.emit("UI:DRAG_END", { kind: payload.kind, data: payload.data });
|
|
59196
|
+
}
|
|
59197
|
+
if (!payload || !target) return;
|
|
59198
|
+
if (accepts && !accepts.includes(payload.kind)) {
|
|
59199
|
+
log18.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
|
|
59200
|
+
return;
|
|
59201
|
+
}
|
|
59202
|
+
const activator = e.activatorEvent;
|
|
59203
|
+
const cursor = activator && typeof activator.clientX === "number" && typeof activator.clientY === "number" ? { x: activator.clientX + e.delta.x, y: activator.clientY + e.delta.y } : null;
|
|
59204
|
+
const resolved = target.resolvePath && cursor ? target.resolvePath(cursor) : null;
|
|
59205
|
+
const drop = { payload, target, cursor, resolved };
|
|
59206
|
+
const suppressed = onDrop ? onDrop(drop) === true : false;
|
|
59207
|
+
if (!suppressed) defaultEmit(eventBus, drop);
|
|
59208
|
+
}, [eventBus, onDrop]);
|
|
59209
|
+
const handleDragCancel = React93__namespace.default.useCallback(() => {
|
|
59210
|
+
setActivePayload(null);
|
|
59211
|
+
log18.info("dragCancel");
|
|
59212
|
+
}, []);
|
|
59213
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
59214
|
+
core$1.DndContext,
|
|
59215
|
+
{
|
|
59216
|
+
sensors,
|
|
59217
|
+
collisionDetection: almadarDndCollisionDetection,
|
|
59218
|
+
onDragStart: handleDragStart,
|
|
59219
|
+
onDragEnd: handleDragEnd,
|
|
59220
|
+
onDragCancel: handleDragCancel,
|
|
59221
|
+
children: [
|
|
59222
|
+
children,
|
|
59223
|
+
renderOverlay ? /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { dropAnimation: null, children: activePayload ? renderOverlay(activePayload) : null }) : null
|
|
59224
|
+
]
|
|
59225
|
+
}
|
|
59226
|
+
);
|
|
59227
|
+
}
|
|
59228
|
+
|
|
59144
59229
|
// components/molecules/avl/wire-validation.ts
|
|
59145
59230
|
function validateWire(sourcePayload, targetPayload) {
|
|
59146
59231
|
const warnings = [];
|
|
@@ -59489,105 +59574,74 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
59489
59574
|
unsub2();
|
|
59490
59575
|
};
|
|
59491
59576
|
}, [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();
|
|
59577
|
+
const resolveL2Path = React93.useCallback(
|
|
59578
|
+
(cursor) => {
|
|
59579
|
+
const hit = document.elementFromPoint(cursor.x, cursor.y);
|
|
59580
|
+
if (!hit) return null;
|
|
59581
|
+
let el = hit;
|
|
59582
|
+
while (el && el.dataset.acceptsChildren !== "true") {
|
|
59583
|
+
if (el === contentRef.current) break;
|
|
59584
|
+
el = el.parentElement;
|
|
59585
|
+
}
|
|
59586
|
+
if (!el) return null;
|
|
59587
|
+
const containerPath = el.dataset?.patternPath;
|
|
59588
|
+
if (!containerPath) return { parentPath: "root", index: 0 };
|
|
59589
|
+
const pathChildren = el.querySelectorAll(":scope > [data-pattern-path]");
|
|
59590
|
+
let insertIndex = pathChildren.length;
|
|
59533
59591
|
const style = el.firstElementChild ? getComputedStyle(el.firstElementChild) : null;
|
|
59534
59592
|
const isVertical = style?.flexDirection !== "row";
|
|
59535
|
-
|
|
59536
|
-
|
|
59537
|
-
|
|
59538
|
-
|
|
59539
|
-
|
|
59593
|
+
for (let i = 0; i < pathChildren.length; i++) {
|
|
59594
|
+
const rect = pathChildren[i].getBoundingClientRect();
|
|
59595
|
+
const mid = isVertical ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
|
|
59596
|
+
const pos = isVertical ? cursor.y : cursor.x;
|
|
59597
|
+
if (pos < mid) {
|
|
59598
|
+
insertIndex = i;
|
|
59599
|
+
break;
|
|
59600
|
+
}
|
|
59540
59601
|
}
|
|
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
|
-
}, []);
|
|
59602
|
+
return { parentPath: containerPath, index: insertIndex };
|
|
59603
|
+
},
|
|
59604
|
+
[]
|
|
59605
|
+
);
|
|
59606
|
+
const l2Target = React93.useMemo(
|
|
59607
|
+
() => ({
|
|
59608
|
+
level: "l2",
|
|
59609
|
+
containerNode: {
|
|
59610
|
+
orbitalName: data.orbitalName,
|
|
59611
|
+
traitName: data.traitName,
|
|
59612
|
+
transitionEvent: data.transitionEvent
|
|
59613
|
+
},
|
|
59614
|
+
resolvePath: resolveL2Path
|
|
59615
|
+
}),
|
|
59616
|
+
[data.orbitalName, data.traitName, data.transitionEvent, resolveL2Path]
|
|
59617
|
+
);
|
|
59618
|
+
const { setNodeRef: l2SetNodeRef, isOver: l2IsOver } = useCanvasDroppable({
|
|
59619
|
+
id: `orb-l2-${data.orbitalName}-${data.traitName ?? ""}-${data.transitionEvent ?? ""}`,
|
|
59620
|
+
target: l2Target,
|
|
59621
|
+
accepts: ["pattern"],
|
|
59622
|
+
disabled: !isExpanded
|
|
59623
|
+
});
|
|
59624
|
+
const setContentRef = React93.useCallback((el) => {
|
|
59625
|
+
contentRef.current = el;
|
|
59626
|
+
l2SetNodeRef(el);
|
|
59627
|
+
}, [l2SetNodeRef]);
|
|
59568
59628
|
const statusBorder = isRunning ? "var(--color-primary)" : isError ? "var(--color-danger)" : isSuccess ? "var(--color-success)" : null;
|
|
59569
59629
|
const borderWidth = isRunning || isError || isSuccess ? "2px" : "1.5px";
|
|
59570
59630
|
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]
|
|
59631
|
+
const l1Target = React93.useMemo(
|
|
59632
|
+
() => ({ level: "l1", containerNode: { orbitalName: data.orbitalName } }),
|
|
59633
|
+
[data.orbitalName]
|
|
59581
59634
|
);
|
|
59582
|
-
const {
|
|
59635
|
+
const { setNodeRef: l1SetNodeRef, isOver: l1IsOver } = useCanvasDroppable({
|
|
59636
|
+
id: `orb-l1-${data.orbitalName}`,
|
|
59637
|
+
target: l1Target,
|
|
59583
59638
|
accepts: ["pattern"],
|
|
59584
|
-
onDrop: handleL1Drop,
|
|
59585
59639
|
disabled: isExpanded
|
|
59586
59640
|
});
|
|
59587
59641
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
59588
59642
|
Box,
|
|
59589
59643
|
{
|
|
59590
|
-
|
|
59644
|
+
ref: isExpanded ? void 0 : l1SetNodeRef,
|
|
59591
59645
|
className: `rounded-lg border shadow-sm bg-card transition-all duration-200 overflow-hidden relative${isRunning ? " orb-preview-running" : ""}`,
|
|
59592
59646
|
style: {
|
|
59593
59647
|
borderColor: l1IsOver ? "var(--color-primary)" : borderColor,
|
|
@@ -59729,12 +59783,9 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
59729
59783
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59730
59784
|
Box,
|
|
59731
59785
|
{
|
|
59732
|
-
ref:
|
|
59733
|
-
className: `orb-preview-live nodrag${dragActive ? " drag-active" : ""}`,
|
|
59786
|
+
ref: setContentRef,
|
|
59787
|
+
className: `orb-preview-live nodrag${dragActive || l2IsOver ? " drag-active" : ""}`,
|
|
59734
59788
|
onClick: handleContentClick,
|
|
59735
|
-
onDrop: handlePreviewDrop,
|
|
59736
|
-
onDragOver: handlePreviewDragOver,
|
|
59737
|
-
onDragLeave: handlePreviewDragLeave,
|
|
59738
59789
|
children: orbitalSchema ? /* @__PURE__ */ jsxRuntime.jsx(Box, { style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
59739
59790
|
BrowserPlayground,
|
|
59740
59791
|
{
|
|
@@ -61230,7 +61281,7 @@ init_AvlTransitionLane();
|
|
|
61230
61281
|
init_AvlSwimLane();
|
|
61231
61282
|
init_types();
|
|
61232
61283
|
init_avl_elk_layout();
|
|
61233
|
-
var
|
|
61284
|
+
var log19 = logger.createLogger("almadar:ui:avl:trait-scene");
|
|
61234
61285
|
var SWIM_GUTTER2 = 120;
|
|
61235
61286
|
var CENTER_W2 = 360;
|
|
61236
61287
|
var AvlTraitScene = ({
|
|
@@ -61242,7 +61293,7 @@ var AvlTraitScene = ({
|
|
|
61242
61293
|
const dataKey = React93.useMemo(() => JSON.stringify(data), [data]);
|
|
61243
61294
|
React93.useEffect(() => {
|
|
61244
61295
|
computeTraitLayout(data).then(setLayout).catch((error) => {
|
|
61245
|
-
|
|
61296
|
+
log19.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
|
|
61246
61297
|
});
|
|
61247
61298
|
}, [dataKey]);
|
|
61248
61299
|
if (!layout) {
|
|
@@ -62416,6 +62467,7 @@ exports.AvlTransition = AvlTransition;
|
|
|
62416
62467
|
exports.AvlTransitionEdge = AvlTransitionEdge;
|
|
62417
62468
|
exports.AvlTransitionScene = AvlTransitionScene;
|
|
62418
62469
|
exports.BehaviorComposeNode = BehaviorComposeNode;
|
|
62470
|
+
exports.CanvasDndProvider = CanvasDndProvider;
|
|
62419
62471
|
exports.DOMAIN_COLORS = DOMAIN_COLORS;
|
|
62420
62472
|
exports.DetailView = DetailView;
|
|
62421
62473
|
exports.EventFlowEdge = EventFlowEdge;
|
|
@@ -62445,5 +62497,7 @@ exports.registryEntryToCanvasEntry = registryEntryToCanvasEntry;
|
|
|
62445
62497
|
exports.ringPositions = ringPositions;
|
|
62446
62498
|
exports.schemaToFlowGraph = schemaToFlowGraph;
|
|
62447
62499
|
exports.schemaToOverviewGraph = schemaToOverviewGraph;
|
|
62500
|
+
exports.useCanvasDraggable = useCanvasDraggable;
|
|
62501
|
+
exports.useCanvasDroppable = useCanvasDroppable;
|
|
62448
62502
|
exports.useZoomBand = useZoomBand;
|
|
62449
62503
|
exports.zoomProgress = zoomProgress;
|