@weasel-js/diagram 1.12.0 → 1.13.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/README.md +1 -1
- package/dist/{chunk-DYDX6EJC.js → chunk-ESFIS7BB.js} +23 -18
- package/dist/chunk-ESFIS7BB.js.map +1 -0
- package/dist/{chunk-5GIP2LA6.js → chunk-FAQXYGMX.js} +3 -3
- package/dist/{chunk-5GIP2LA6.js.map → chunk-FAQXYGMX.js.map} +1 -1
- package/dist/{chunk-R2XB6D32.js → chunk-L4H444QI.js} +10 -9
- package/dist/chunk-L4H444QI.js.map +1 -0
- package/dist/{chunk-2SYY4W3B.js → chunk-QU4QZUC6.js} +16 -16
- package/dist/chunk-QU4QZUC6.js.map +1 -0
- package/dist/{chunk-GA4BX7SH.js → chunk-Y72FK3Y7.js} +3 -3
- package/dist/{chunk-GA4BX7SH.js.map → chunk-Y72FK3Y7.js.map} +1 -1
- package/dist/{dataTypes-DHdkzCL8.d.ts → dataTypes-DW-MljuN.d.ts} +1 -1
- package/dist/effect-audio.js +3 -3
- package/dist/effect.d.ts +2 -2
- package/dist/effect.js +9 -9
- package/dist/effect.js.map +1 -1
- package/dist/index.d.ts +18 -17
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +2 -2
- package/dist/{layout.entry-B-jJMc50.d.ts → layout.entry-CQoPNfzA.d.ts} +2 -5
- package/dist/layout.js +2 -2
- package/dist/{types-M_ccNAlk.d.ts → types-vbW21fHm.d.ts} +3 -3
- package/package.json +9 -9
- package/dist/chunk-2SYY4W3B.js.map +0 -1
- package/dist/chunk-DYDX6EJC.js.map +0 -1
- package/dist/chunk-R2XB6D32.js.map +0 -1
package/README.md
CHANGED
|
@@ -415,7 +415,7 @@ the `insert` dep it displaced, so core's rect, ellipse and text tools keep worki
|
|
|
415
415
|
### Containers and pools
|
|
416
416
|
|
|
417
417
|
A container is a titled box that holds other shapes; a pool is a header and a
|
|
418
|
-
stack of lanes, each holding shapes. Both are core `
|
|
418
|
+
stack of lanes, each holding shapes. Both are core `GroupNode`s carrying a
|
|
419
419
|
`container` trait (`diagramContainerOf`): a role of `container`, `pool`, or
|
|
420
420
|
`lane`, and a header. A region's title is a text child named
|
|
421
421
|
`<id>/title`, so double-clicking a header renames it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createAvoidRouter, placeLabels, edgeHops, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, simplifyStops } from './chunk-
|
|
2
|
-
import { edgeRouter, registerMarkShape, withDiagramRegistry, diagramLabelOf, editEdgeLabelBinding, editEdgeLabelAction, diagramGroupOf, diagramContainerOf, headerBox, labelFollowsLayout, buildGraph, LABEL_DRAG_AFFORDANCE_KIND, EDIT_EDGE_LABEL_ACTION_ID, labelDragLayer, laneOutlineOf, routerOf, labelScratchOf, ROUTERS, avoid, LABEL_PLACEMENT, editableLabels, titleIdOf, orthogonal, diagramAnchorOf, MIN_LANE_SIZE, endAims, resolveEnd, EDGE_DERIVE_PATH, titlePose, regionSpecs, DIAGRAM_THEME_KEY, diagramThemeOf, boxCenter, themeLabelFamily, roleEdgeStyle, roleStyle, themeLabelFont, firstLanes, DEFAULT_LANE_SIZE, bodyBox } from './chunk-
|
|
3
|
-
import { diagramEdgeOf, isPromise, dataKeyReader, diagramNodeOf, portsOf, portSitesOf, outlinePath, samePoints, layoutWritesRoute, plannerPlan, planOf, layered, forceRelaxation, center, layoutOwnsPort, chain, force, tree, portOf, labelCenter, labelSpotAt, isPinned, layoutOwnsRoute } from './chunk-
|
|
1
|
+
import { createAvoidRouter, placeLabels, edgeHops, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, simplifyStops } from './chunk-Y72FK3Y7.js';
|
|
2
|
+
import { edgeRouter, registerMarkShape, withDiagramRegistry, diagramLabelOf, editEdgeLabelBinding, editEdgeLabelAction, diagramGroupOf, diagramContainerOf, headerBox, labelFollowsLayout, buildGraph, LABEL_DRAG_AFFORDANCE_KIND, EDIT_EDGE_LABEL_ACTION_ID, labelDragLayer, laneOutlineOf, routerOf, labelScratchOf, ROUTERS, avoid, LABEL_PLACEMENT, editableLabels, titleIdOf, orthogonal, diagramAnchorOf, MIN_LANE_SIZE, endAims, resolveEnd, EDGE_DERIVE_PATH, titlePose, regionSpecs, DIAGRAM_THEME_KEY, diagramThemeOf, boxCenter, themeLabelFamily, roleEdgeStyle, roleStyle, themeLabelFont, firstLanes, DEFAULT_LANE_SIZE, bodyBox } from './chunk-QU4QZUC6.js';
|
|
3
|
+
import { diagramEdgeOf, isPromise, dataKeyReader, diagramNodeOf, portsOf, portSitesOf, outlinePath, samePoints, layoutWritesRoute, plannerPlan, planOf, layered, forceRelaxation, center, layoutOwnsPort, chain, force, tree, portOf, labelCenter, labelSpotAt, isPinned, layoutOwnsRoute } from './chunk-L4H444QI.js';
|
|
4
4
|
import { bodyPredicate, dragPanContribution, WeaselProvider, useScene, useSelection, useLatest, SceneCanvas, useDepSource, registerNodeShape, reconcileSpecs, nodeGates, effectivePose, pagesBounds, pagesLayer, AUTO_POSE_DESCRIPTOR, usePoseRun, drawnBoundsScene, pointAlongPath, drawnAABBOf, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, fitViewToBounds, translatePoseViaDescriptor, composeAffordanceLayer, createResizeAction, createDeleteAction, polylineFromPoints, SNAP_ROLES, ActionDisabledReason, paintsLayer, viewToTransform, ellipsePath, snapMods, documentDepOf, carriedDescendants, sceneCarrySource, derivedDepOf, PathBuilder, createInsertOp, createSetDataOp, documentPose } from '@weasel-js/core';
|
|
5
5
|
import { AUTO_POSE_DESCRIPTOR as AUTO_POSE_DESCRIPTOR$1, rotatePoint } from '@weasel-js/core/math';
|
|
6
6
|
import { clampRectWithin, placeRect, pathContainsPoint } from '@weasel-js/geom';
|
|
@@ -212,7 +212,7 @@ function commitEdgeToScene(edge, ctx, opts = {}) {
|
|
|
212
212
|
};
|
|
213
213
|
const source = scene.get(edge.from.nodeId);
|
|
214
214
|
scene.add({
|
|
215
|
-
kind: "
|
|
215
|
+
kind: "mark",
|
|
216
216
|
layer: source?.layer ?? scene.layers[0].id,
|
|
217
217
|
pose: { x: 0, y: 0, width: 0, height: 0 },
|
|
218
218
|
data: { diagram: trait, stroke: opts.stroke ?? DEFAULT_EDGE_STROKE },
|
|
@@ -315,7 +315,7 @@ function diagramDropParentAt(scene, point, role) {
|
|
|
315
315
|
const walk = (ids) => {
|
|
316
316
|
for (const id of ids) {
|
|
317
317
|
const node = scene.get(id);
|
|
318
|
-
if (node === void 0
|
|
318
|
+
if (node === void 0) continue;
|
|
319
319
|
const trait = diagramContainerOf(node);
|
|
320
320
|
const b = bodyBox(node.pose, trait?.header);
|
|
321
321
|
const inside2 = point.x >= b.x && point.x < b.x + b.width && point.y >= b.y && point.y < b.y + b.height;
|
|
@@ -799,7 +799,7 @@ function editContainerTitleAction(commit) {
|
|
|
799
799
|
label: "Edit container title",
|
|
800
800
|
group: "diagram",
|
|
801
801
|
requires: ["scene", "nodeAtPoint"],
|
|
802
|
-
eligible: { mode:
|
|
802
|
+
eligible: { mode: "normal" },
|
|
803
803
|
invoker: {
|
|
804
804
|
timing: "immediate",
|
|
805
805
|
run(deps, params) {
|
|
@@ -891,7 +891,7 @@ function createLabelDragAction(opts = {}) {
|
|
|
891
891
|
label: "Move label",
|
|
892
892
|
group: "diagram",
|
|
893
893
|
requires: ["scene"],
|
|
894
|
-
eligible: { mode:
|
|
894
|
+
eligible: { mode: "normal" },
|
|
895
895
|
invoker: {
|
|
896
896
|
timing: "ongoing",
|
|
897
897
|
start(ctx) {
|
|
@@ -2790,14 +2790,14 @@ function pathHold(scene) {
|
|
|
2790
2790
|
const held = /* @__PURE__ */ new Map();
|
|
2791
2791
|
const release = (id, entry) => {
|
|
2792
2792
|
held.delete(id);
|
|
2793
|
-
|
|
2793
|
+
scene.overrides.clear(id, entry);
|
|
2794
2794
|
};
|
|
2795
2795
|
return {
|
|
2796
2796
|
show(paths) {
|
|
2797
2797
|
for (const [id, entry] of held) if (!paths.has(id)) release(id, entry);
|
|
2798
2798
|
for (const [id, path] of paths) {
|
|
2799
2799
|
const entry = held.get(id);
|
|
2800
|
-
if (entry !== void 0 && scene.overrides.
|
|
2800
|
+
if (entry !== void 0 && scene.overrides.has(id, entry)) {
|
|
2801
2801
|
entry.path = path;
|
|
2802
2802
|
continue;
|
|
2803
2803
|
}
|
|
@@ -3003,6 +3003,10 @@ function dividerPath(box, header) {
|
|
|
3003
3003
|
function registerDiagramShape(opts = {}) {
|
|
3004
3004
|
return registerNodeShape(diagramShape(opts), { priority: "high" });
|
|
3005
3005
|
}
|
|
3006
|
+
|
|
3007
|
+
// src/bodyNode.ts
|
|
3008
|
+
var isDiagramBody = (node) => diagramContainerOf(node) === null && diagramGroupOf(node) === null && dataKeyReader(node) !== null;
|
|
3009
|
+
var isBodyOrRegion = (node) => diagramContainerOf(node) !== null || isDiagramBody(node);
|
|
3006
3010
|
function useMirroredSelection(selection, selected, onSelect) {
|
|
3007
3011
|
const want = selected ?? null;
|
|
3008
3012
|
const pushed = useRef(void 0);
|
|
@@ -3083,10 +3087,11 @@ function readScene(scene) {
|
|
|
3083
3087
|
const nodes = /* @__PURE__ */ new Map();
|
|
3084
3088
|
const routes = /* @__PURE__ */ new Map();
|
|
3085
3089
|
for (const n of scene.renderOrderNodes()) {
|
|
3086
|
-
if (n
|
|
3087
|
-
|
|
3090
|
+
if (isDiagramBody(n)) {
|
|
3091
|
+
nodes.set(n.id, { x: n.pose.x, y: n.pose.y, parent: n.parent });
|
|
3088
3092
|
continue;
|
|
3089
3093
|
}
|
|
3094
|
+
if (diagramContainerOf(n) !== null) continue;
|
|
3090
3095
|
const edge = diagramEdgeOf(n);
|
|
3091
3096
|
if (edge !== null) routes.set(n.id, routeOf2(edge));
|
|
3092
3097
|
}
|
|
@@ -3099,7 +3104,7 @@ function diagramLayoutOf(specs) {
|
|
|
3099
3104
|
for (const s of specs) {
|
|
3100
3105
|
const id = s.id;
|
|
3101
3106
|
if (id === void 0) continue;
|
|
3102
|
-
if (s
|
|
3107
|
+
if (isBodyOrRegion(s)) {
|
|
3103
3108
|
const region = diagramContainerOf(s);
|
|
3104
3109
|
const pinned = isPinned({ id, kind: s.kind, data: s.data });
|
|
3105
3110
|
if (region !== null) {
|
|
@@ -3107,7 +3112,7 @@ function diagramLayoutOf(specs) {
|
|
|
3107
3112
|
const { x, y, width, height } = s.pose;
|
|
3108
3113
|
containers.push({ kind: "box", id, box: { x, y, width, height } });
|
|
3109
3114
|
}
|
|
3110
|
-
} else if (
|
|
3115
|
+
} else if (!pinned) moves.push({ id, x: s.pose.x, y: s.pose.y });
|
|
3111
3116
|
continue;
|
|
3112
3117
|
}
|
|
3113
3118
|
const edge = diagramEdgeOf(s);
|
|
@@ -3179,7 +3184,7 @@ function laneResizeReports(scene, resize) {
|
|
|
3179
3184
|
const { x, y, width, height } = pose;
|
|
3180
3185
|
if (region !== null) {
|
|
3181
3186
|
if (region.role === "container" && region.fitted !== true) boxes.push({ kind: "box", id, box: { x, y, width, height } });
|
|
3182
|
-
} else if (
|
|
3187
|
+
} else if (isDiagramBody(node)) moves.push({ id, x, y });
|
|
3183
3188
|
}
|
|
3184
3189
|
return { lanes: { kind: "lanes", pool: pool.id, lanes }, moves, boxes };
|
|
3185
3190
|
}
|
|
@@ -3362,7 +3367,7 @@ function usePagesView(pages) {
|
|
|
3362
3367
|
}, [placed, fill]);
|
|
3363
3368
|
}
|
|
3364
3369
|
function diagramBounds(specs, extra) {
|
|
3365
|
-
const boxes = specs.filter((s) => s
|
|
3370
|
+
const boxes = specs.filter((s) => isBodyOrRegion(s) || diagramGroupOf(s) !== null).map((s) => s.pose);
|
|
3366
3371
|
if (extra !== void 0) boxes.push(extra);
|
|
3367
3372
|
if (boxes.length === 0) return null;
|
|
3368
3373
|
const x = Math.min(...boxes.map((b) => b.x));
|
|
@@ -3648,6 +3653,6 @@ function useDiagramApi(apiRef, canvasRef, scene, live, setRun, fitNow) {
|
|
|
3648
3653
|
}), [canvasRef, live, scene, setRun, fitNow]);
|
|
3649
3654
|
}
|
|
3650
3655
|
|
|
3651
|
-
export { ADD_LANE_ACTION_ID, ANYWHERE, CONNECT_ACTION_ID, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DiagramView, EASED_LAYOUTS, EDGE_END_AFFORDANCE_KIND, EDGE_END_LAYER_ID, EDIT_CONTAINER_TITLE_ACTION_ID, GRAB_EDGE_END_ACTION_ID, GRAB_LABEL_ACTION_ID, GRAB_PORT_ACTION_ID, GRAB_WAYPOINT_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_ACTION_ID, LAYOUTS, LAYOUT_ACTION_ID, MOVE_LABEL_ACTION_ID, PORT_AFFORDANCE_KIND, PORT_LAYER_ID, RECONNECT_ACTION_ID, RELEASE_MEMBERS_ACTION_ID, REMOVE_WAYPOINT_ACTION_ID, REORDER_ACTION_ID, RESET_LABEL_ACTION_ID, RESET_ROUTE_ACTION_ID, ROUTER_LABELS, ROUTE_EDIT_ACTION_ID, SELECT_LABEL_EDGE_ACTION_ID, SET_HOPS_ACTION_ID, SET_ROUTER_ACTION_IDS, STEP_REORDER_ACTION_ID, WAYPOINT_AFFORDANCE_KIND, WAYPOINT_HIT_PX, WAYPOINT_LAYER_ID, addLane, applyLayout, avoidSceneInput, bodyAt, commitEdgeToScene, commitLabelToScene, commitLaneResizeToScene, commitReconnectToScene, commitRouteToScene, commitRouterToScene, connectBinding, containerBuild, createAddLaneAction, createConnectAction, createDiagramContribution, createEdgeEndAffordance, createLabelDragAction, createLaneAffordance, createLaneResizeAction, createLayoutAction, createPortAffordance, createReconnectAction, createReleaseMembersAction, createRemoveWaypointAction, createReorderAction, createResetLabelAction, createResetRouteAction, createRouteEditAction, createSetHopsAction, createSetRouterAction, createSpecHops, createSpecLabelPlacer, createSpecRouter, createStepReorderAction, createWaypointAffordance, defaultCanConnect, diagramCanDropInto, diagramContainers, diagramDropParentAt, diagramEdgeEnds, diagramLabelDrag, diagramLayoutOf, diagramPorts, diagramResizable, diagramShape, diagramWaypoints, dragSegment, dragVertex, easedProducer, edgeEndLayer, edgeEndScratchOf, edgePolylines, editContainerTitleAction, editContainerTitleBinding, forceProducer, grabPortAction, grabPortBindings, groupReorderContribution, groupReorderSlots, headerIdOf, hopDataOps, inOrUnder, insertWaypoint, isBodyEnd, laneLayer, laneResizeFrame, laneScratchOf, lanesOf, layoutPoses, movedLabelData, pinSegment, poolAxisOf, poolsOf, portLayer, portScratchOf, reconnectBinding, regionHeaderAt, registerDiagramShape, releaseMembers, removeSegment, removeWaypoint, reorderBinding, reorderContribution, routeHandles, routeStateOf, routeWrites, routedData, routerActions, routesOf, sceneEdges, sceneParticipants, segmentAxis, sequenceSlots, themeWrites, unpinSegment, useLiveLayout, useMirroredSelection, waypointLayer, waypointScratchOf, withHopsData, withRouter };
|
|
3652
|
-
//# sourceMappingURL=chunk-
|
|
3653
|
-
//# sourceMappingURL=chunk-
|
|
3656
|
+
export { ADD_LANE_ACTION_ID, ANYWHERE, CONNECT_ACTION_ID, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DiagramView, EASED_LAYOUTS, EDGE_END_AFFORDANCE_KIND, EDGE_END_LAYER_ID, EDIT_CONTAINER_TITLE_ACTION_ID, GRAB_EDGE_END_ACTION_ID, GRAB_LABEL_ACTION_ID, GRAB_PORT_ACTION_ID, GRAB_WAYPOINT_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_ACTION_ID, LAYOUTS, LAYOUT_ACTION_ID, MOVE_LABEL_ACTION_ID, PORT_AFFORDANCE_KIND, PORT_LAYER_ID, RECONNECT_ACTION_ID, RELEASE_MEMBERS_ACTION_ID, REMOVE_WAYPOINT_ACTION_ID, REORDER_ACTION_ID, RESET_LABEL_ACTION_ID, RESET_ROUTE_ACTION_ID, ROUTER_LABELS, ROUTE_EDIT_ACTION_ID, SELECT_LABEL_EDGE_ACTION_ID, SET_HOPS_ACTION_ID, SET_ROUTER_ACTION_IDS, STEP_REORDER_ACTION_ID, WAYPOINT_AFFORDANCE_KIND, WAYPOINT_HIT_PX, WAYPOINT_LAYER_ID, addLane, applyLayout, avoidSceneInput, bodyAt, commitEdgeToScene, commitLabelToScene, commitLaneResizeToScene, commitReconnectToScene, commitRouteToScene, commitRouterToScene, connectBinding, containerBuild, createAddLaneAction, createConnectAction, createDiagramContribution, createEdgeEndAffordance, createLabelDragAction, createLaneAffordance, createLaneResizeAction, createLayoutAction, createPortAffordance, createReconnectAction, createReleaseMembersAction, createRemoveWaypointAction, createReorderAction, createResetLabelAction, createResetRouteAction, createRouteEditAction, createSetHopsAction, createSetRouterAction, createSpecHops, createSpecLabelPlacer, createSpecRouter, createStepReorderAction, createWaypointAffordance, defaultCanConnect, diagramCanDropInto, diagramContainers, diagramDropParentAt, diagramEdgeEnds, diagramLabelDrag, diagramLayoutOf, diagramPorts, diagramResizable, diagramShape, diagramWaypoints, dragSegment, dragVertex, easedProducer, edgeEndLayer, edgeEndScratchOf, edgePolylines, editContainerTitleAction, editContainerTitleBinding, forceProducer, grabPortAction, grabPortBindings, groupReorderContribution, groupReorderSlots, headerIdOf, hopDataOps, inOrUnder, insertWaypoint, isBodyEnd, isBodyOrRegion, isDiagramBody, laneLayer, laneResizeFrame, laneScratchOf, lanesOf, layoutPoses, movedLabelData, pinSegment, poolAxisOf, poolsOf, portLayer, portScratchOf, reconnectBinding, regionHeaderAt, registerDiagramShape, releaseMembers, removeSegment, removeWaypoint, reorderBinding, reorderContribution, routeHandles, routeStateOf, routeWrites, routedData, routerActions, routesOf, sceneEdges, sceneParticipants, segmentAxis, sequenceSlots, themeWrites, unpinSegment, useLiveLayout, useMirroredSelection, waypointLayer, waypointScratchOf, withHopsData, withRouter };
|
|
3657
|
+
//# sourceMappingURL=chunk-ESFIS7BB.js.map
|
|
3658
|
+
//# sourceMappingURL=chunk-ESFIS7BB.js.map
|