@weasel-js/diagram 1.11.1 → 1.12.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.
@@ -1,5 +1,5 @@
1
- import { grownBy, labelCenter, diagramEdgeOf, DIAGRAM_TRAIT_KEY, insetOf, subpathOf, portsOf, portSitesOf, routeHolds, sizeToBody, measureBody, layoutBody, layoutOwnsRoute, diagramNodeOf, expandGroupEdges, DEFAULT_GROUP_INSET, bodyTrait, authoredOver, chain, force, tree, layered, planOf, buildBody } from './chunk-IM6DHWZO.js';
2
- import { bodyPredicate, AUTO_POSE_DESCRIPTOR, translatePoseViaDescriptor, createTransformOp, polylineFromPoints, PathBuilder, documentDepOf, documentPose, composeAffordanceLayer, ActionDisabledReason, pageName, pageOfBounds, layoutPages, RECT_POSE_DESCRIPTOR, commandFill, commandStroke, transformPath, registerNodeShape, pathFromD } from '@weasel-js/core';
1
+ import { grownBy, labelCenter, diagramEdgeOf, DIAGRAM_TRAIT_KEY, insetOf, subpathOf, portsOf, portSitesOf, routeHolds, sizeToBody, measureBody, layoutBody, layoutOwnsRoute, diagramNodeOf, expandGroupEdges, DEFAULT_GROUP_INSET, bodyTrait, authoredOver, chain, force, tree, layered, planOf, buildBody } from './chunk-R2XB6D32.js';
2
+ import { bodyPredicate, AUTO_POSE_DESCRIPTOR, translatePoseViaDescriptor, createTransformOp, polylineFromPoints, PathBuilder, documentDepOf, documentPose, composeAffordanceLayer, ActionDisabledReason, pageName, pageOfBounds, layoutPages, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, transformPath, registerNodeShape, pathFromD } from '@weasel-js/core';
3
3
  import { PathBuilder as PathBuilder$1, polylineFromPoints as polylineFromPoints$1, portCurvePoints } from '@weasel-js/geom';
4
4
  import { AUTO_POSE_DESCRIPTOR as AUTO_POSE_DESCRIPTOR$1 } from '@weasel-js/core/math';
5
5
 
@@ -426,7 +426,7 @@ function editEdgeLabelAction(opts = {}) {
426
426
  }
427
427
  var onBody = bodyPredicate((target) => target === "selected-body" || target === "unselected-body");
428
428
  function editEdgeLabelBinding(actionId = EDIT_EDGE_LABEL_ACTION_ID) {
429
- return { spec: { kind: "doubleClick", target: { kindOf: onBody } }, actionId };
429
+ return { spec: { kind: "doubleClick", target: { kindOf: onBody } }, actionId, opts: { id: `${actionId}.doubleClick` } };
430
430
  }
431
431
 
432
432
  // src/theme/themes.ts
@@ -988,7 +988,7 @@ function relayoutBodies(scene, ids, measure) {
988
988
  // src/dataTypes.ts
989
989
  var DEFAULT_POOL_ACROSS = 600;
990
990
  var DEFAULT_LANE_SIZE = 120;
991
- var NODE = { fill: "#16222c", stroke: "#7ba7c7", text: "#dbe7f2" };
991
+ var DEFAULT_NODE_STYLE = { fill: "#16222c", stroke: "#7ba7c7", text: "#dbe7f2" };
992
992
  var NODE_STROKE_WIDTH = 2;
993
993
  var LANE_STROKE_WIDTH = 1;
994
994
  var EDGE_STROKE_WIDTH = 1.5;
@@ -1010,7 +1010,7 @@ var titleData = (text, style, fontFamily = DEFAULT_FONT.fontFamily) => ({
1010
1010
  fill: { paint: { color: style.text } }
1011
1011
  });
1012
1012
  function regionSpecs(role, axis, pose, title, opts) {
1013
- const style = opts.style ?? NODE;
1013
+ const style = opts.style ?? DEFAULT_NODE_STYLE;
1014
1014
  const { layout, header } = containerShape(role, axis);
1015
1015
  const region = {
1016
1016
  id: opts.id,
@@ -1070,18 +1070,18 @@ function withColors(style, colors) {
1070
1070
  }
1071
1071
 
1072
1072
  // src/dataStyles.ts
1073
- var EDGE = { stroke: "#7ba7c7" };
1073
+ var DEFAULT_EDGE_STYLE = { stroke: "#7ba7c7" };
1074
1074
  function dataNodeStyle(node, theme) {
1075
- return withColors(theme ? roleStyle(theme, node.style) : NODE, node.colors);
1075
+ return withColors(theme ? roleStyle(theme, node.style) : DEFAULT_NODE_STYLE, node.colors);
1076
1076
  }
1077
1077
  function dataEdgeStyle(edge, theme) {
1078
- return withColors(theme ? roleEdgeStyle(theme, edge.style) : EDGE, edge.colors);
1078
+ return withColors(theme ? roleEdgeStyle(theme, edge.style) : DEFAULT_EDGE_STYLE, edge.colors);
1079
1079
  }
1080
1080
  function dataRegionStyle(region, theme, laneIndex = 0) {
1081
1081
  return withColors(themeRegionStyle(region, theme, laneIndex), region.colors);
1082
1082
  }
1083
1083
  function themeRegionStyle(r, theme, laneIndex) {
1084
- if (theme === void 0) return NODE;
1084
+ if (theme === void 0) return DEFAULT_NODE_STYLE;
1085
1085
  const own = r.style !== void 0 ? theme.roles[r.style] : void 0;
1086
1086
  if (own !== void 0) return own;
1087
1087
  if (r.role === "pool") return theme.lane.header;
@@ -1368,8 +1368,10 @@ function markShape(opts = {}) {
1368
1368
  if (mark === null) return [];
1369
1369
  const box = geometry.getBounds(pose);
1370
1370
  const d = node.data;
1371
- const fill = d.fill && commandFill(d.fill, box);
1372
- const stroke = d.stroke && commandStroke(d.stroke, box);
1371
+ const declaredFill = resolveFill(d.fill);
1372
+ const declaredStroke = resolveStroke(d.stroke);
1373
+ const fill = declaredFill && commandFill(declaredFill, box);
1374
+ const stroke = declaredStroke && commandStroke(declaredStroke, box);
1373
1375
  return [{
1374
1376
  kind: "path",
1375
1377
  path: transformPath(unitPath(mark.d), [box.width, 0, 0, box.height, box.x, box.y]),
@@ -1858,7 +1860,7 @@ function edgeSpecs(edges, ctx) {
1858
1860
 
1859
1861
  // src/fromData.ts
1860
1862
  var SLOT_FRAME = "M0 0H1V1H0Z";
1861
- var GROUP = { fill: "rgba(123, 167, 199, 0.08)", stroke: "#7ba7c7", text: "#9fbdd6", strokeWidth: 1, dash: [4, 3] };
1863
+ var DEFAULT_GROUP_STYLE = { fill: "rgba(123, 167, 199, 0.08)", stroke: "#7ba7c7", text: "#9fbdd6", strokeWidth: 1, dash: [4, 3] };
1862
1864
  var LINE2 = 1.4;
1863
1865
  var MIN_WIDTH = 64;
1864
1866
  var LAYOUTS = { layered, tree, force, chain };
@@ -1977,7 +1979,7 @@ function mainSpecs(data, opts) {
1977
1979
  const placedAt = new Map([...laid.placed, ...placeContainers(regions, boxes, laid.placed, sizes, pad)]);
1978
1980
  const routes = laid.plan === null ? null : authoredOver(edges.filter((e) => !laid.remapped.has(e)).map((e) => ({ ...e, id: edgeIdOf(e) })), laid.plan);
1979
1981
  const edgeCtx = { idOf: edgeIdOf, font, labelFont, measure, labelPlacement: LABEL_PLACEMENT, routes, opts, ...theme ? { theme } : {} };
1980
- const groupLook = (g) => ({ style: opts.groupStyle?.(g) ?? theme?.container ?? GROUP, text: styleOf(titleStyle) });
1982
+ const groupLook = (g) => ({ style: opts.groupStyle?.(g) ?? theme?.container ?? DEFAULT_GROUP_STYLE, text: styleOf(titleStyle) });
1981
1983
  const footprints = new Map([...placedAt, ...seeds.map((s) => [s.id, grownBy(placedAt.get(s.id), s.margin)])]);
1982
1984
  specs.push(...containerSpecs(regions, placedAt, theme, font.fontFamily));
1983
1985
  specs.push(...groupSpecs(groups, footprints, groupLook, wireLabels(edges, edgeCtx)));
@@ -2048,6 +2050,6 @@ function layOut(seeds, edges, groups, boxes, opts, room) {
2048
2050
  return { placed, plan: layout?.plan === void 0 ? null : plan, remapped };
2049
2051
  }
2050
2052
 
2051
- export { ANCHOR_DERIVE_POSE, CONTAINER_HEADER, CONTAINER_LAYOUTS, DEFAULT_FONT, DEFAULT_LANE_SIZE, DEFAULT_POOL_ACROSS, DIAGRAM_ANCHOR, DIAGRAM_CONTAINER_LAYOUT, DIAGRAM_EDGE, DIAGRAM_GROUP, DIAGRAM_LABEL, DIAGRAM_LANE_COLUMNS_LAYOUT, DIAGRAM_LANE_ROWS_LAYOUT, DIAGRAM_OFF_PAGE_TAG, DIAGRAM_POOL_COLUMNS_LAYOUT, DIAGRAM_POOL_ROWS_LAYOUT, DIAGRAM_ROLES, DIAGRAM_THEMES, DIAGRAM_THEME_KEY, EDGE_DERIVE_PATH, EDGE_STROKE_WIDTH, EDIT_EDGE_LABEL_ACTION_ID, GROUP_DERIVE_POSE, LABEL_DERIVE_POSE, LABEL_DRAG_AFFORDANCE_KIND, LABEL_DRAG_LAYER_ID, LABEL_PLACEMENT, LANE_HEADER_SIZE, LANE_STROKE_WIDTH, MIN_LANE_SIZE, NODE, NODE_STROKE_WIDTH, OFF_PAGE_STUB, OFF_PAGE_TAG_DERIVE_POSE, OFF_PAGE_TAG_PADDING, POOL_HEADER_SIZE, ROUTERS, anchorDerivePose, avoid, bezier, bodyBox, bodyLayoutOf, boxAround, boxCenter, buildGraph, containerShape, dataEdgeStyle, dataNodeStyle, dataOffPage, dataRegionStyle, diagramAnchorOf, diagramContainerLayout, diagramContainerOf, diagramGroupOf, diagramLabelOf, diagramMarkOf, diagramPages, diagramScene, diagramThemeFrom, diagramThemeOf, draggableLabels, dropEmptyEdgeLabel, edgeDerivePath, edgeIdOf, edgeLabelSpec, edgeRouter, editEdgeLabelAction, editEdgeLabelBinding, editableLabels, endAims, firstLanes, groupDerivePose, groupLabelIdOf, groupMinWidth, headerBox, labelDerivePose, labelDragLayer, labelFollowsLayout, labelScratchOf, labelSize, labelStyleOf, labelUnder, laneHeader, laneOutlineOf, laneStackLayout, markShape, nestGroups, nextOffPageRef, offPageFarText, offPageSplits, offPageTagData, offPageTagDerivePose, offPageTagId, offPageTagLook, offPageTagOf, offPageTagSize, offPageTagSpec, offPageTagSpecs, offPageTagText, orthogonal, poolHeader, regionSpecs, registerMarkShape, relayoutBodies, resolveEnd, roleEdgeStyle, roleStyle, routerOf, rowTextStyle, selfLoop, stackedLanes, straight, themeDocValue, themeEdgeStroke, themeFont, themeLabelFamily, themeLabelFont, themeLabelStyle, titleIdOf, titlePose, withDiagramRegistry, withHops };
2052
- //# sourceMappingURL=chunk-43LDZ6L4.js.map
2053
- //# sourceMappingURL=chunk-43LDZ6L4.js.map
2053
+ export { ANCHOR_DERIVE_POSE, CONTAINER_HEADER, CONTAINER_LAYOUTS, DEFAULT_EDGE_STYLE, DEFAULT_FONT, DEFAULT_GROUP_STYLE, DEFAULT_LANE_SIZE, DEFAULT_NODE_STYLE, DEFAULT_POOL_ACROSS, DIAGRAM_ANCHOR, DIAGRAM_CONTAINER_LAYOUT, DIAGRAM_EDGE, DIAGRAM_GROUP, DIAGRAM_LABEL, DIAGRAM_LANE_COLUMNS_LAYOUT, DIAGRAM_LANE_ROWS_LAYOUT, DIAGRAM_OFF_PAGE_TAG, DIAGRAM_POOL_COLUMNS_LAYOUT, DIAGRAM_POOL_ROWS_LAYOUT, DIAGRAM_ROLES, DIAGRAM_THEMES, DIAGRAM_THEME_KEY, EDGE_DERIVE_PATH, EDGE_STROKE_WIDTH, EDIT_EDGE_LABEL_ACTION_ID, GROUP_DERIVE_POSE, LABEL_DERIVE_POSE, LABEL_DRAG_AFFORDANCE_KIND, LABEL_DRAG_LAYER_ID, LABEL_PLACEMENT, LANE_HEADER_SIZE, LANE_STROKE_WIDTH, MIN_LANE_SIZE, NODE_STROKE_WIDTH, OFF_PAGE_STUB, OFF_PAGE_TAG_DERIVE_POSE, OFF_PAGE_TAG_PADDING, POOL_HEADER_SIZE, ROUTERS, anchorDerivePose, avoid, bezier, bodyBox, bodyLayoutOf, boxAround, boxCenter, buildGraph, containerShape, dataEdgeStyle, dataNodeStyle, dataOffPage, dataRegionStyle, diagramAnchorOf, diagramContainerLayout, diagramContainerOf, diagramGroupOf, diagramLabelOf, diagramMarkOf, diagramPages, diagramScene, diagramThemeFrom, diagramThemeOf, draggableLabels, dropEmptyEdgeLabel, edgeDerivePath, edgeIdOf, edgeLabelSpec, edgeRouter, editEdgeLabelAction, editEdgeLabelBinding, editableLabels, endAims, firstLanes, groupDerivePose, groupLabelIdOf, groupMinWidth, headerBox, labelDerivePose, labelDragLayer, labelFollowsLayout, labelScratchOf, labelSize, labelStyleOf, labelUnder, laneHeader, laneOutlineOf, laneStackLayout, markShape, nestGroups, nextOffPageRef, offPageFarText, offPageSplits, offPageTagData, offPageTagDerivePose, offPageTagId, offPageTagLook, offPageTagOf, offPageTagSize, offPageTagSpec, offPageTagSpecs, offPageTagText, orthogonal, poolHeader, regionSpecs, registerMarkShape, relayoutBodies, resolveEnd, roleEdgeStyle, roleStyle, routerOf, rowTextStyle, selfLoop, stackedLanes, straight, themeDocValue, themeEdgeStroke, themeFont, themeLabelFamily, themeLabelFont, themeLabelStyle, titleIdOf, titlePose, withDiagramRegistry, withHops };
2054
+ //# sourceMappingURL=chunk-2SYY4W3B.js.map
2055
+ //# sourceMappingURL=chunk-2SYY4W3B.js.map