@weasel-js/diagram 1.14.2 → 1.15.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/README.md +114 -5
- package/dist/{chunk-GR2DK4S2.js → chunk-EIHPPOAM.js} +1480 -229
- package/dist/chunk-EIHPPOAM.js.map +1 -0
- package/dist/{chunk-AXL4JQBM.js → chunk-EIT4BFDK.js} +3 -3
- package/dist/{chunk-AXL4JQBM.js.map → chunk-EIT4BFDK.js.map} +1 -1
- package/dist/{chunk-DE7UILJA.js → chunk-NEX4QKQQ.js} +183 -23
- package/dist/chunk-NEX4QKQQ.js.map +1 -0
- package/dist/{chunk-FDCODMFW.js → chunk-UOFQBGJY.js} +904 -599
- package/dist/chunk-UOFQBGJY.js.map +1 -0
- package/dist/{chunk-IYUU5KUY.js → chunk-UUMLQEMR.js} +8 -96
- package/dist/chunk-UUMLQEMR.js.map +1 -0
- package/dist/{dataTypes-BIkhAOc4.d.ts → dataTypes-1ch6cMtq.d.ts} +12 -3
- package/dist/effect-audio.d.ts +2 -2
- package/dist/effect-audio.js +3 -3
- package/dist/effect.d.ts +5 -5
- package/dist/effect.js +7 -7
- package/dist/effect.js.map +1 -1
- package/dist/icons.table.js +44 -0
- package/dist/icons.table.js.map +1 -1
- package/dist/icons.table.json +44 -0
- package/dist/index.d.ts +938 -37
- package/dist/index.js +708 -34
- package/dist/index.js.map +1 -1
- package/dist/{labelTrait-BBjRgxbz.d.ts → labelTrait-moIciyXr.d.ts} +4 -0
- package/dist/layout.d.ts +3 -3
- package/dist/{layout.entry-CbmGuqE-.d.ts → layout.entry-zstuljAl.d.ts} +2 -2
- package/dist/layout.js +2 -2
- package/dist/{stageTypes-UiO25hcn.d.ts → stageTypes-B7oF8Lww.d.ts} +1 -1
- package/dist/{types-B0n2CNTW.d.ts → types-D5ybp8Xh.d.ts} +32 -1
- package/package.json +11 -11
- package/dist/chunk-DE7UILJA.js.map +0 -1
- package/dist/chunk-FDCODMFW.js.map +0 -1
- package/dist/chunk-GR2DK4S2.js.map +0 -1
- package/dist/chunk-IYUU5KUY.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import './chunk-WDIE35AK.js';
|
|
2
|
-
import { CONTAINERS_GROUP, createConnectAction, avoidSceneInput, sceneEdges, inOrUnder, withHopsData, edgePolylines, themeWrites, hopDataOps, worldWith, diagramDropParentAt, containerBuild } from './chunk-
|
|
3
|
-
export { ADD_LANE_ACTION_ID, CONNECT_ACTION_ID, CONTAINERS_GROUP, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DIAGRAM_ITEM_CARRY, 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, ITEM_DROP_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_ACTION_ID,
|
|
4
|
-
import { createAvoidRouter, HOPS_DOC_KEY, edgeHops, placeLabels } from './chunk-
|
|
5
|
-
export { AVOID_DEFAULTS, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, createAvoidRouter, edgeHops, placeLabels,
|
|
6
|
-
import { DEFAULT_NODE_STYLE, NODE_STROKE_WIDTH, rowTextStyle, DEFAULT_FONT, bodyLayoutOf, offPageTagLook, diagramThemeOf, offPageSplits, offPageTagOf, DIAGRAM_THEMES, DIAGRAM_THEME_KEY, themeDocValue, DIAGRAM_ROLES, themeEdgeStroke, diagramLabelOf, diagramContainerOf, diagramGroupOf, offPageTagId, offPageFarText, offPageTagSpec, offPageTagData, offPageTagSize, relayoutBodies, recordedRows, labelSize, labelStyleOf } from './chunk-
|
|
7
|
-
export { ANCHOR_DERIVE_POSE, CONTAINER_HEADER, CONTAINER_LAYOUTS, DEFAULT_EDGE_STYLE, 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, boxAround, buildGraph, containerShape, dataEdgeStyle, dataNodeStyle, dataOffPage, dataRegionStyle, diagramAnchorOf, diagramContainerLayout, diagramContainerOf, diagramGroupOf, diagramLabelOf, diagramMarkOf, diagramPages, diagramScene, diagramThemeFrom, diagramThemeOf, draggableLabels, dropEmptyEdgeLabel, edgeDerivePath, edgeIdOf, edgeLabelSpec, edgeRouter, editEdgeLabelAction, editEdgeLabelBinding, firstLanes, groupDerivePose, headerBox, labelDerivePose, labelDragLayer, labelScratchOf, labelSize, labelUnder, laneHeader, laneStackLayout, markShape, nextOffPageRef, offPageFarText, offPageSplits, offPageTagData, offPageTagDerivePose, offPageTagId, offPageTagLook, offPageTagOf, offPageTagSize, offPageTagSpec, offPageTagSpecs, offPageTagText, orthogonal, poolHeader, regionSpecs, registerMarkShape, relayoutBodies, resolveEnd, roleEdgeStyle, roleStyle, rowTextStyle, selfLoop, stackedLanes, straight, themeDocValue, themeEdgeStroke, themeFont, themeLabelFont, themeLabelStyle, titleIdOf, titlePose, withDiagramRegistry, withHops } from './chunk-
|
|
8
|
-
import { EVENT_SIZE, GATEWAY_SIZE, DEVICE_SIZE, buildBody, outlineDetail, outlinePath, diagramEdgeOf, samePoints, diagramNodeOf, layoutBody, labelCenter } from './chunk-
|
|
9
|
-
export { COMPASS, DEFAULT_GROUP_INSET, DEFAULT_NODE_GAP, DEFAULT_PORTS, DEFAULT_RANK_GAP, DIAGRAM_TRAIT_KEY, DIVIDER_HEIGHT, PORT_LABEL_GAP, anchorOffset, axesFor, backEdges, bodyOutline, bodyTrait, boxForContent, buildBody, canvasMeasure, chain, contentBox, createDiagramNodes, dataKeyReader, diagramEdgeOf, diagramNodeOf, expandGroupEdges, footprintNode, force, forceRelaxation, forestOf, graphOrder, insetOf, isPinned, labelCenter, layered, layeredPlan, layeredRoutes, layoutBody, layoutOwnsPort, layoutOwnsRoute, layoutRowPorts, layoutWritesRoute, marginOf, measureBody, outlineDetail, outlineFromD, outlinePath, outlinePolyline, packAcross, packClusters, pinnedSet, planOf, plannerPlan, portLabelBox, portLabelsOf, portOf, portSitesOf, portsOf, portsOnOutline, rankGaps, ranksByLength, ranksOf, rayHit, registerOutline, routeHolds, seededOrder, settle, sizeToBody, subpathOf, subtreeBlocks, translated, tree, untilSettled } from './chunk-
|
|
2
|
+
import { CONTAINERS_GROUP, createConnectAction, avoidSceneInput, sceneEdges, inOrUnder, withHopsData, edgePolylines, themeWrites, redrawSequences, sequenceCommitOf, startSequence, newParticipant, addParticipant, insertMark, sequencePartOf, sequenceRootOf, hopDataOps, worldWith, sequenceLayout, insertNote, SEQUENCE_AFFORDANCE_KIND, diagramDropParentAt, containerBuild, placedSequences, insertMessage, SEQ, wrapSteps, SEQ_ARROWS } from './chunk-EIHPPOAM.js';
|
|
3
|
+
export { ADD_LANE_ACTION_ID, CONNECT_ACTION_ID, CONTAINERS_GROUP, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DIAGRAM_ITEM_CARRY, 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_SEQUENCE_ACTION_ID, GRAB_WAYPOINT_ACTION_ID, ITEM_DROP_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_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, SELECT_SEQUENCE_PART_ACTION_ID, SEQUENCE_AFFORDANCE_KIND, SEQUENCE_DRAG_ACTION_ID, SEQUENCE_LAYER_ID, SEQUENCE_ROLES, SEQ_ARROWS, SEQ_MULTI_SECTION, SET_HOPS_ACTION_ID, SET_ROUTER_ACTION_IDS, STEP_REORDER_ACTION_ID, WAYPOINT_AFFORDANCE_KIND, WAYPOINT_HIT_PX, WAYPOINT_LAYER_ID, addBox, addLane, addParticipant, addSection, avoidSceneInput, bodyAt, commitEdgeToScene, commitLabelToScene, commitLaneResizeToScene, commitReconnectToScene, commitRouteToScene, commitRouterToScene, commitSequence, connectBinding, containerBuild, createAddLaneAction, createConnectAction, createDiagramContribution, createEdgeEndAffordance, createItemDropAction, createLabelDragAction, createLaneAffordance, createLaneResizeAction, createPortAffordance, createReconnectAction, createReleaseMembersAction, createRemoveWaypointAction, createReorderAction, createResetLabelAction, createResetRouteAction, createRouteEditAction, createSequenceDeleteAction, createSequenceDragAction, createSetHopsAction, createSetRouterAction, createSpecHops, createSpecLabelPlacer, createSpecRouter, createStepReorderAction, createWaypointAffordance, defaultCanConnect, diagramCanDropInto, diagramContainers, diagramDropParentAt, diagramEdgeEnds, diagramLabelDrag, diagramLayoutOf, diagramPorts, diagramResizable, diagramSequence, diagramShape, diagramWaypoints, dragItemProps, dragSegment, dragVertex, easedProducer, edgeEndLayer, edgeEndScratchOf, editContainerTitleAction, editContainerTitleBinding, findStep, foldSequenceText, forceProducer, freshSeqId, grabPortAction, grabPortBindings, groupReorderContribution, groupReorderSlots, headerIdOf, insertMark, insertMessage, insertNote, insertStep, insertWaypoint, isBodyEnd, isBodyOrRegion, isDiagramBody, isSequenceText, itemDropContribution, laneLayer, laneResizeFrame, laneScratchOf, lanesOf, moveParticipant, moveStep, movedLabelData, newParticipant, pinSegment, placeOf, poolAxisOf, poolsOf, portLayer, portScratchOf, reconnectBinding, reconnectMessage, redrawSequences, regionHeaderAt, registerDiagramShape, releaseMembers, removeBox, removeMarks, removeMarksOf, removeParticipant, removeSection, removeSegment, removeStep, removeStepAt, removeWaypoint, reorderBinding, reorderContribution, routeHandles, routeStateOf, routedData, routerActions, sceneParticipants, segmentAxis, selectSequencePartAction, seqIdTaken, sequenceCommitOf, sequenceDeletes, sequenceLayout, sequencePartNodeOf, sequencePartOf, sequenceRootOf, sequenceScratchOf, sequenceSlots, sequenceSpecs, sequenceTextOf, setAutonumber, setFragmentType, setMessageActivation, setMessageArrow, setParticipantOutline, setSequenceText, startItemDrag, startSequence, stepListOf, themeWrites, unpinSegment, unwrapFragment, useLiveLayout, useMirroredSelection, useSequenceTextEdit, waypointLayer, waypointScratchOf, withRouter, wrapSteps } from './chunk-EIHPPOAM.js';
|
|
4
|
+
import { createAvoidRouter, HOPS_DOC_KEY, edgeHops, placeLabels } from './chunk-UUMLQEMR.js';
|
|
5
|
+
export { AVOID_DEFAULTS, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, createAvoidRouter, edgeHops, placeLabels, simplifyStops } from './chunk-UUMLQEMR.js';
|
|
6
|
+
import { DEFAULT_NODE_STYLE, NODE_STROKE_WIDTH, rowTextStyle, DEFAULT_FONT, bodyLayoutOf, offPageTagLook, diagramThemeOf, offPageSplits, offPageTagOf, DIAGRAM_THEMES, DIAGRAM_THEME_KEY, themeDocValue, DIAGRAM_ROLES, themeEdgeStroke, diagramLabelOf, diagramContainerOf, diagramGroupOf, offPageTagId, offPageFarText, offPageTagSpec, offPageTagData, offPageTagSize, relayoutBodies, recordedRows, roleStyle, labelSize, labelStyleOf } from './chunk-NEX4QKQQ.js';
|
|
7
|
+
export { ANCHOR_DERIVE_POSE, CONTAINER_HEADER, CONTAINER_LAYOUTS, DEFAULT_EDGE_STYLE, 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, END_LABEL_PLACEMENT, GROUP_DERIVE_POSE, LABEL_DERIVE_POSE, LABEL_DRAG_AFFORDANCE_KIND, LABEL_DRAG_LAYER_ID, LABEL_PLACEMENT, LANE_HEADER_SIZE, LANE_STROKE_WIDTH, LAYOUTS, LAYOUT_ACTION_ID, MIN_LANE_SIZE, NODE_STROKE_WIDTH, OFF_PAGE_STUB, OFF_PAGE_TAG_DERIVE_POSE, OFF_PAGE_TAG_PADDING, POOL_HEADER_SIZE, ROUTERS, anchorDerivePose, applyLayout, avoid, bezier, bodyBox, boxAround, buildGraph, containerShape, createLayoutAction, dataEdgeStyle, dataNodeStyle, dataOffPage, dataRegionStyle, diagramAnchorOf, diagramContainerLayout, diagramContainerOf, diagramGroupOf, diagramLabelOf, diagramMarkOf, diagramPages, diagramScene, diagramThemeFrom, diagramThemeOf, draggableLabels, dropEmptyEdgeLabel, edgeDerivePath, edgeIdOf, edgeLabelSpec, edgeRouter, editEdgeLabelAction, editEdgeLabelBinding, endLabelIdOf, firstLanes, groupDerivePose, headerBox, labelDerivePose, labelDragLayer, labelScratchOf, labelSize, labelUnder, laneHeader, laneStackLayout, layoutDiagram, layoutPoses, markShape, nextOffPageRef, offPageFarText, offPageSplits, offPageTagData, offPageTagDerivePose, offPageTagId, offPageTagLook, offPageTagOf, offPageTagSize, offPageTagSpec, offPageTagSpecs, offPageTagText, orthogonal, poolHeader, regionSpecs, registerMarkShape, relayoutBodies, resolveEnd, roleEdgeStyle, roleStyle, routeWrites, routesOf, rowTextStyle, selfLoop, stackedLanes, straight, themeDocValue, themeEdgeStroke, themeFont, themeLabelFont, themeLabelStyle, titleIdOf, titlePose, withDiagramRegistry, withHops } from './chunk-NEX4QKQQ.js';
|
|
8
|
+
import { EVENT_SIZE, GATEWAY_SIZE, DEVICE_SIZE, buildBody, outlineDetail, outlineSolid, outlinePath, diagramEdgeOf, samePoints, diagramNodeOf, layoutBody, labelCenter } from './chunk-UOFQBGJY.js';
|
|
9
|
+
export { COMPASS, DEFAULT_GROUP_INSET, DEFAULT_NODE_GAP, DEFAULT_PORTS, DEFAULT_RANK_GAP, DIAGRAM_TRAIT_KEY, DIVIDER_HEIGHT, PORT_LABEL_GAP, anchorOffset, axesFor, backEdges, bodyOutline, bodyTrait, boxForContent, buildBody, canvasMeasure, chain, contentBox, createDiagramNodes, dataKeyReader, diagramEdgeOf, diagramNodeOf, expandGroupEdges, footprintNode, force, forceRelaxation, forestOf, graphOrder, grid, insetOf, isPinned, labelCenter, layered, layeredPlan, layeredRoutes, layoutBody, layoutOwnsPort, layoutOwnsRoute, layoutRowPorts, layoutWritesRoute, marginOf, measureBody, outlineDetail, outlineFromD, outlinePath, outlinePolyline, outlineSolid, packAcross, packClusters, pinnedSet, planOf, plannerPlan, portLabelBox, portLabelsOf, portOf, portSitesOf, portsOf, portsOnOutline, radial, rankGaps, ranksByLength, ranksOf, rayHit, registerOutline, routeHolds, seededOrder, settle, sizeToBody, subpathOf, subtreeBlocks, translated, tree, untilSettled } from './chunk-UOFQBGJY.js';
|
|
10
10
|
import { useMemo, useRef, useEffect } from 'react';
|
|
11
|
-
import { bodyPredicate, AUTO_POSE_DESCRIPTOR, defineTool, localizeWorldPoses, RIGID_POSE_COMPOSITION, createInsertOp, INSERT_REPOSITION_BINDING, useDepRegistry, useLatest, useDepSource, commitOps, createSetDataOp, useOptionalDepRegistry, useTransformFollower, composeWorldPose, scenePoseAdapter, placedPagesOf, PAGES_DOC_KEY, ActionDisabledReason, measureTextBounds, createTransformOp, writtenBy, documentDepOf, documentPose, createDeleteOp, fitViewToPage, scenePoseFrame, parseColor } from '@weasel-js/core';
|
|
11
|
+
import { bodyPredicate, toolSet, AUTO_POSE_DESCRIPTOR, defineTool, localizeWorldPoses, RIGID_POSE_COMPOSITION, createInsertOp, INSERT_REPOSITION_BINDING, useDepRegistry, useLatest, useDepSource, commitOps, createSetDataOp, useOptionalDepRegistry, useTransformFollower, composeWorldPose, scenePoseAdapter, placedPagesOf, PAGES_DOC_KEY, ActionDisabledReason, measureTextBounds, createTransformOp, writtenBy, documentDepOf, documentPose, createDeleteOp, fitViewToPage, scenePoseFrame, parseColor } from '@weasel-js/core';
|
|
12
12
|
import { pathToD, pathPoint } from '@weasel-js/geom';
|
|
13
13
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
14
|
import { PATH_M } from '@weasel-js/core/math';
|
|
@@ -100,7 +100,7 @@ function stencilBuild(stencil, bounds, opts) {
|
|
|
100
100
|
layer: opts.layer,
|
|
101
101
|
...opts.measure ? { measure: opts.measure } : {},
|
|
102
102
|
body: (trait) => ({
|
|
103
|
-
diagram: { ...trait, ...bodyLayoutOf(spec, trait, opts.measure) },
|
|
103
|
+
diagram: { ...trait, ...bodyLayoutOf(spec, trait, opts.measure), ...stencil.themeRole !== void 0 ? { style: stencil.themeRole } : {} },
|
|
104
104
|
fill: { paint: { color: style.fill } },
|
|
105
105
|
stroke: { paint: { color: style.stroke }, width: style.strokeWidth ?? NODE_STROKE_WIDTH, ...style.dash ? { dash: style.dash } : {} }
|
|
106
106
|
}),
|
|
@@ -108,7 +108,8 @@ function stencilBuild(stencil, bounds, opts) {
|
|
|
108
108
|
text,
|
|
109
109
|
style: rowTextStyle(box.row, opts.font ?? DEFAULT_FONT),
|
|
110
110
|
fill: { paint: { color: style.text } },
|
|
111
|
-
bodyRow: box.index
|
|
111
|
+
bodyRow: box.index,
|
|
112
|
+
...box.row.kind === "field" ? { bodyField: box.row.label } : {}
|
|
112
113
|
} : null
|
|
113
114
|
}
|
|
114
115
|
);
|
|
@@ -148,13 +149,13 @@ function useStencilInsert(stencils, opts = {}) {
|
|
|
148
149
|
if (id === null) return void 0;
|
|
149
150
|
return stencilsRef.current.find((s) => s.id === id) ?? optsRef.current.containers?.find((s) => s.id === id);
|
|
150
151
|
};
|
|
151
|
-
const builtAt = (stencil,
|
|
152
|
+
const builtAt = (stencil, world2) => {
|
|
152
153
|
if (scene === void 0) return null;
|
|
153
|
-
const center = { x:
|
|
154
|
+
const center = { x: world2.x + world2.width / 2, y: world2.y + world2.height / 2 };
|
|
154
155
|
const role = "role" in stencil ? stencil.role : null;
|
|
155
|
-
const { style, measure, font, containerStyle, laneStyles } = optsRef.current;
|
|
156
|
+
const { style, measure, font, containerStyle, laneStyles, theme } = optsRef.current;
|
|
156
157
|
const parent = diagramDropParentAt(scene, center, role);
|
|
157
|
-
const bounds = parent === null ?
|
|
158
|
+
const bounds = parent === null ? world2 : scenePoseFrame(scene).localUnder(parent, { ...world2 });
|
|
158
159
|
const common = { layer: layer(), newId: () => scene.mintId(), parent };
|
|
159
160
|
if ("role" in stencil) {
|
|
160
161
|
const boxStyle = containerStyle ?? style;
|
|
@@ -164,9 +165,10 @@ function useStencilInsert(stencils, opts = {}) {
|
|
|
164
165
|
...laneStyles ? { laneStyles } : {}
|
|
165
166
|
});
|
|
166
167
|
}
|
|
168
|
+
const shapeStyle = stencil.themeRole !== void 0 && theme !== void 0 ? roleStyle(theme, stencil.themeRole) : style;
|
|
167
169
|
return stencilBuild(stencil, bounds, {
|
|
168
170
|
...common,
|
|
169
|
-
...
|
|
171
|
+
...shapeStyle ? { style: shapeStyle } : {},
|
|
170
172
|
...measure ? { measure } : {},
|
|
171
173
|
...font ? { font } : {}
|
|
172
174
|
});
|
|
@@ -196,8 +198,9 @@ function StencilGhost({ stencil, style, scale = 1 }) {
|
|
|
196
198
|
const own = "outline" in stencil ? { ...style, ...stencil.style } : style;
|
|
197
199
|
const width = own.strokeWidth ?? NODE_STROKE_WIDTH;
|
|
198
200
|
const bounds = { x: width / 2, y: width / 2, ...stencil.size };
|
|
199
|
-
const
|
|
200
|
-
const detail = outlineDetail(
|
|
201
|
+
const outline2 = "outline" in stencil ? stencil.outline : "rect";
|
|
202
|
+
const detail = outlineDetail(outline2, bounds);
|
|
203
|
+
const solid = outlineSolid(outline2, bounds);
|
|
201
204
|
const box = { width: stencil.size.width + width, height: stencil.size.height + width };
|
|
202
205
|
const stroke = { stroke: own.stroke, strokeWidth: width, strokeDasharray: own.dash?.join(" ") };
|
|
203
206
|
return /* @__PURE__ */ jsxs(
|
|
@@ -210,7 +213,8 @@ function StencilGhost({ stencil, style, scale = 1 }) {
|
|
|
210
213
|
overflow: "visible",
|
|
211
214
|
"data-stencil": stencil.id,
|
|
212
215
|
children: [
|
|
213
|
-
/* @__PURE__ */ jsx("path", { d: pathToD(outlinePath(
|
|
216
|
+
/* @__PURE__ */ jsx("path", { d: pathToD(outlinePath(outline2, bounds)), fill: own.fill, ...stroke }),
|
|
217
|
+
solid && /* @__PURE__ */ jsx("path", { d: pathToD(solid), fill: own.stroke }),
|
|
214
218
|
detail && /* @__PURE__ */ jsx("path", { d: pathToD(detail), fill: "none", ...stroke })
|
|
215
219
|
]
|
|
216
220
|
}
|
|
@@ -794,11 +798,11 @@ function createFollowOffPageAction(opts = {}) {
|
|
|
794
798
|
invoker: {
|
|
795
799
|
timing: "immediate",
|
|
796
800
|
run(deps, params) {
|
|
797
|
-
const
|
|
798
|
-
if (!
|
|
799
|
-
const target = tagUnder(deps,
|
|
801
|
+
const world2 = params?.world;
|
|
802
|
+
if (!world2) return;
|
|
803
|
+
const target = tagUnder(deps, world2);
|
|
800
804
|
if (target === null) return;
|
|
801
|
-
follow(target, { world, modifiers: { alt: false, shift: false, meta: false, ctrl: false }, deps });
|
|
805
|
+
follow(target, { world: world2, modifiers: { alt: false, shift: false, meta: false, ctrl: false }, deps });
|
|
802
806
|
}
|
|
803
807
|
},
|
|
804
808
|
enabled: (deps, at) => tagUnder(deps, at) !== null ? true : ActionDisabledReason.NotApplicable
|
|
@@ -901,6 +905,7 @@ function applyDiagramTheme(scene, theme, label = `Theme: ${theme.name}`, opts =
|
|
|
901
905
|
scene.batch(label, () => {
|
|
902
906
|
writeAll(scene, themeWrites(scene, theme, void 0, from), opts.measure);
|
|
903
907
|
scene.doc.set(DIAGRAM_THEME_KEY, themeDocValue(theme));
|
|
908
|
+
redrawSequences(scene, { theme, ...opts.measure ? { measure: opts.measure } : {} });
|
|
904
909
|
}, opts.coalesceKey !== void 0 ? { coalesceKey: opts.coalesceKey } : {});
|
|
905
910
|
}
|
|
906
911
|
var withTrait = (data, trait) => ({ ...data, diagram: trait });
|
|
@@ -1423,6 +1428,232 @@ var UML_STENCILS = [
|
|
|
1423
1428
|
];
|
|
1424
1429
|
var UML_GROUP = { id: "uml", label: "UML", stencils: UML_STENCILS };
|
|
1425
1430
|
|
|
1431
|
+
// src/stencils/architecture.ts
|
|
1432
|
+
var SERVICE = { width: 100, height: 90 };
|
|
1433
|
+
var named = (text) => ({ rows: [{ kind: "label", text }] });
|
|
1434
|
+
var ARCHITECTURE_STENCILS = [
|
|
1435
|
+
{ id: "arch-service", label: "Service", outline: "roundRect", size: { width: 120, height: 50 }, ...named("Service"), icon: (
|
|
1436
|
+
/* @icon */
|
|
1437
|
+
"diagram:task"
|
|
1438
|
+
) },
|
|
1439
|
+
{ id: "arch-server", label: "Server", outline: "server", size: SERVICE, ...named("Server"), icon: (
|
|
1440
|
+
/* @icon */
|
|
1441
|
+
"diagram:server"
|
|
1442
|
+
) },
|
|
1443
|
+
{ id: "arch-database", label: "Database", outline: "cylinder", size: SERVICE, ...named("Database"), icon: (
|
|
1444
|
+
/* @icon */
|
|
1445
|
+
"diagram:database"
|
|
1446
|
+
) },
|
|
1447
|
+
{ id: "arch-disk", label: "Disk", outline: "disk", size: SERVICE, ...named("Disk"), icon: (
|
|
1448
|
+
/* @icon */
|
|
1449
|
+
"diagram:database"
|
|
1450
|
+
) },
|
|
1451
|
+
{ id: "arch-cloud", label: "Cloud", outline: "cloud", size: { width: 120, height: 80 }, ...named("Cloud"), icon: (
|
|
1452
|
+
/* @icon */
|
|
1453
|
+
"diagram:cloud"
|
|
1454
|
+
) },
|
|
1455
|
+
{ id: "arch-internet", label: "Internet", outline: "globe", size: SERVICE, ...named("Internet"), icon: (
|
|
1456
|
+
/* @icon */
|
|
1457
|
+
"diagram:internet"
|
|
1458
|
+
) },
|
|
1459
|
+
{ id: "arch-junction", label: "Junction", outline: "start", size: { width: 12, height: 12 }, rows: [], padding: 0, icon: (
|
|
1460
|
+
/* @icon */
|
|
1461
|
+
"diagram:stateStart"
|
|
1462
|
+
) },
|
|
1463
|
+
{ id: "arch-group", label: "Group", role: "container", size: { width: 300, height: 200 }, icon: (
|
|
1464
|
+
/* @icon */
|
|
1465
|
+
"diagram:container"
|
|
1466
|
+
) }
|
|
1467
|
+
];
|
|
1468
|
+
var ARCHITECTURE_GROUP = { id: "architecture", label: "Architecture", stencils: ARCHITECTURE_STENCILS };
|
|
1469
|
+
|
|
1470
|
+
// src/stencils/c4.ts
|
|
1471
|
+
var SMALL = { fontSize: 10 };
|
|
1472
|
+
function element(e) {
|
|
1473
|
+
const name = e.label.replace(/ \(external\)$/, "");
|
|
1474
|
+
const rows = [
|
|
1475
|
+
{ kind: "label", text: `<<${e.kind}>>`, style: SMALL },
|
|
1476
|
+
{ kind: "label", text: name, style: { bold: true } },
|
|
1477
|
+
...e.technology !== void 0 ? [{ kind: "label", text: `[${e.technology}]`, style: SMALL }] : [],
|
|
1478
|
+
{ kind: "label", text: "What it does" }
|
|
1479
|
+
];
|
|
1480
|
+
return {
|
|
1481
|
+
id: e.id,
|
|
1482
|
+
label: e.label,
|
|
1483
|
+
outline: e.outline,
|
|
1484
|
+
size: { width: e.width ?? 200, height: e.height ?? 110 },
|
|
1485
|
+
rows,
|
|
1486
|
+
icon: e.icon,
|
|
1487
|
+
themeRole: e.kind.startsWith("external_") ? "muted" : "accent"
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
var boundary = (id, label, title) => ({ id, label, title, role: "container", size: { width: 320, height: 220 }, icon: (
|
|
1491
|
+
/* @icon */
|
|
1492
|
+
"diagram:container"
|
|
1493
|
+
) });
|
|
1494
|
+
var C4_STENCILS = [
|
|
1495
|
+
element({ id: "c4-person", label: "Person", kind: "person", outline: "person", icon: (
|
|
1496
|
+
/* @icon */
|
|
1497
|
+
"diagram:person"
|
|
1498
|
+
), height: 170 }),
|
|
1499
|
+
element({ id: "c4-person-ext", label: "Person (external)", kind: "external_person", outline: "person", icon: (
|
|
1500
|
+
/* @icon */
|
|
1501
|
+
"diagram:user"
|
|
1502
|
+
), height: 170 }),
|
|
1503
|
+
element({ id: "c4-system", label: "System", kind: "system", outline: "roundRect", icon: (
|
|
1504
|
+
/* @icon */
|
|
1505
|
+
"diagram:task"
|
|
1506
|
+
) }),
|
|
1507
|
+
element({ id: "c4-system-ext", label: "System (external)", kind: "external_system", outline: "roundRect", icon: (
|
|
1508
|
+
/* @icon */
|
|
1509
|
+
"diagram:task"
|
|
1510
|
+
) }),
|
|
1511
|
+
element({ id: "c4-system-db", label: "System database", kind: "system_db", outline: "cylinder", icon: (
|
|
1512
|
+
/* @icon */
|
|
1513
|
+
"diagram:database"
|
|
1514
|
+
), height: 130 }),
|
|
1515
|
+
element({ id: "c4-system-queue", label: "System queue", kind: "system_queue", outline: "queue", icon: (
|
|
1516
|
+
/* @icon */
|
|
1517
|
+
"diagram:queue"
|
|
1518
|
+
) }),
|
|
1519
|
+
element({ id: "c4-container", label: "Container", kind: "container", outline: "roundRect", icon: (
|
|
1520
|
+
/* @icon */
|
|
1521
|
+
"diagram:c4Container"
|
|
1522
|
+
), technology: "Technology", height: 120 }),
|
|
1523
|
+
element({
|
|
1524
|
+
id: "c4-container-db",
|
|
1525
|
+
label: "Container database",
|
|
1526
|
+
kind: "container_db",
|
|
1527
|
+
outline: "cylinder",
|
|
1528
|
+
icon: (
|
|
1529
|
+
/* @icon */
|
|
1530
|
+
"diagram:database"
|
|
1531
|
+
),
|
|
1532
|
+
technology: "Technology",
|
|
1533
|
+
height: 150
|
|
1534
|
+
}),
|
|
1535
|
+
element({ id: "c4-container-queue", label: "Container queue", kind: "container_queue", outline: "queue", icon: (
|
|
1536
|
+
/* @icon */
|
|
1537
|
+
"diagram:queue"
|
|
1538
|
+
), technology: "Technology", width: 240, height: 120 }),
|
|
1539
|
+
element({ id: "c4-component", label: "Component", kind: "component", outline: "roundRect", icon: (
|
|
1540
|
+
/* @icon */
|
|
1541
|
+
"diagram:umlComponent"
|
|
1542
|
+
), technology: "Technology", height: 120 }),
|
|
1543
|
+
boundary("c4-enterprise-boundary", "Enterprise boundary", "Enterprise [enterprise]"),
|
|
1544
|
+
boundary("c4-system-boundary", "System boundary", "System [system]"),
|
|
1545
|
+
boundary("c4-container-boundary", "Container boundary", "Container [container]")
|
|
1546
|
+
];
|
|
1547
|
+
var C4_GROUP = { id: "c4", label: "C4", stencils: C4_STENCILS };
|
|
1548
|
+
|
|
1549
|
+
// src/stencils/kanban.ts
|
|
1550
|
+
var KANBAN_STENCILS = [
|
|
1551
|
+
{
|
|
1552
|
+
id: "kanban-board",
|
|
1553
|
+
label: "Board",
|
|
1554
|
+
title: "Board",
|
|
1555
|
+
role: "pool",
|
|
1556
|
+
axis: "x",
|
|
1557
|
+
lanes: ["To do", "In progress", "Done"],
|
|
1558
|
+
size: { width: 660, height: 420 },
|
|
1559
|
+
icon: (
|
|
1560
|
+
/* @icon */
|
|
1561
|
+
"diagram:poolColumns"
|
|
1562
|
+
)
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
id: "kanban-card",
|
|
1566
|
+
label: "Card",
|
|
1567
|
+
outline: "rect",
|
|
1568
|
+
size: { width: 180, height: 60 },
|
|
1569
|
+
verticalAlign: "top",
|
|
1570
|
+
rows: [{ kind: "label", text: "Task" }, { kind: "field", label: "assigned", value: "someone" }],
|
|
1571
|
+
icon: (
|
|
1572
|
+
/* @icon */
|
|
1573
|
+
"diagram:kanbanCard"
|
|
1574
|
+
)
|
|
1575
|
+
}
|
|
1576
|
+
];
|
|
1577
|
+
var KANBAN_GROUP = { id: "kanban", label: "Kanban", stencils: KANBAN_STENCILS };
|
|
1578
|
+
|
|
1579
|
+
// src/stencils/requirement.ts
|
|
1580
|
+
var SMALL2 = { fontSize: 10 };
|
|
1581
|
+
function block(id, label, kind, name, fields) {
|
|
1582
|
+
const rows = [
|
|
1583
|
+
{ kind: "label", text: `<<${kind}>>`, style: SMALL2 },
|
|
1584
|
+
{ kind: "label", text: name, style: { bold: true } },
|
|
1585
|
+
{ kind: "divider" },
|
|
1586
|
+
...fields.map(([l, value]) => ({ kind: "field", label: l, value }))
|
|
1587
|
+
];
|
|
1588
|
+
const icons = kind === "element" ? (
|
|
1589
|
+
/* @icon */
|
|
1590
|
+
"diagram:umlComponent"
|
|
1591
|
+
) : (
|
|
1592
|
+
/* @icon */
|
|
1593
|
+
"diagram:requirement"
|
|
1594
|
+
);
|
|
1595
|
+
return { id, label, outline: "rect", size: { width: 220, height: 60 + 18 * fields.length }, verticalAlign: "top", rows, icon: icons };
|
|
1596
|
+
}
|
|
1597
|
+
var REQUIREMENT_FIELDS = [["id", "1"], ["text", "The system shall\u2026"], ["risk", "Medium"], ["verifymethod", "Test"]];
|
|
1598
|
+
var REQUIREMENT_STENCILS = [
|
|
1599
|
+
block("requirement", "Requirement", "requirement", "Requirement", REQUIREMENT_FIELDS),
|
|
1600
|
+
block("functional-requirement", "Functional requirement", "functionalRequirement", "Functional", REQUIREMENT_FIELDS),
|
|
1601
|
+
block("design-constraint", "Design constraint", "designConstraint", "Constraint", REQUIREMENT_FIELDS),
|
|
1602
|
+
block("requirement-element", "Element", "element", "Element", [["type", "module"], ["docref", "docs/"]])
|
|
1603
|
+
];
|
|
1604
|
+
var REQUIREMENT_GROUP = { id: "requirement", label: "Requirement", stencils: REQUIREMENT_STENCILS };
|
|
1605
|
+
|
|
1606
|
+
// src/stencils/state.ts
|
|
1607
|
+
var pseudo = { rows: [], padding: 0 };
|
|
1608
|
+
var STATE_STENCILS = [
|
|
1609
|
+
{ id: "state", label: "State", outline: "roundRect", size: { width: 120, height: 50 }, rows: [{ kind: "label", text: "State" }], icon: (
|
|
1610
|
+
/* @icon */
|
|
1611
|
+
"diagram:task"
|
|
1612
|
+
) },
|
|
1613
|
+
{ id: "state-start", label: "Start", outline: "start", size: { width: 20, height: 20 }, ...pseudo, icon: (
|
|
1614
|
+
/* @icon */
|
|
1615
|
+
"diagram:stateStart"
|
|
1616
|
+
) },
|
|
1617
|
+
{ id: "state-end", label: "End", outline: "end", size: { width: 20, height: 20 }, ...pseudo, icon: (
|
|
1618
|
+
/* @icon */
|
|
1619
|
+
"diagram:stateEnd"
|
|
1620
|
+
) },
|
|
1621
|
+
{ id: "state-choice", label: "Choice", outline: "diamond", size: { width: 28, height: 28 }, ...pseudo, icon: (
|
|
1622
|
+
/* @icon */
|
|
1623
|
+
"shape:diamond"
|
|
1624
|
+
) },
|
|
1625
|
+
{ id: "state-fork", label: "Fork or join", outline: "bar", size: { width: 80, height: 10 }, ...pseudo, icon: (
|
|
1626
|
+
/* @icon */
|
|
1627
|
+
"diagram:stateFork"
|
|
1628
|
+
) },
|
|
1629
|
+
{ id: "state-note", label: "Note", outline: "note", size: { width: 140, height: 60 }, rows: [{ kind: "label", text: "Note" }], icon: (
|
|
1630
|
+
/* @icon */
|
|
1631
|
+
"diagram:umlNote"
|
|
1632
|
+
) },
|
|
1633
|
+
{ id: "state-composite", label: "Composite state", title: "Composite", role: "container", size: { width: 280, height: 180 }, icon: (
|
|
1634
|
+
/* @icon */
|
|
1635
|
+
"diagram:container"
|
|
1636
|
+
) },
|
|
1637
|
+
{
|
|
1638
|
+
id: "state-concurrent",
|
|
1639
|
+
label: "Concurrent state",
|
|
1640
|
+
title: "Concurrent",
|
|
1641
|
+
role: "pool",
|
|
1642
|
+
axis: "y",
|
|
1643
|
+
lanes: ["Region 1", "Region 2"],
|
|
1644
|
+
size: { width: 360, height: 240 },
|
|
1645
|
+
icon: (
|
|
1646
|
+
/* @icon */
|
|
1647
|
+
"diagram:poolRows"
|
|
1648
|
+
)
|
|
1649
|
+
}
|
|
1650
|
+
];
|
|
1651
|
+
var STATE_GROUP = { id: "state", label: "State", stencils: STATE_STENCILS };
|
|
1652
|
+
|
|
1653
|
+
// src/diagramTypes/types.ts
|
|
1654
|
+
var FLOWCHART_NOTATION = "flowchart";
|
|
1655
|
+
var DIAGRAM_TYPE_DOC_KEY = "diagram:type";
|
|
1656
|
+
|
|
1426
1657
|
// src/diagramTypes/catalog.ts
|
|
1427
1658
|
var byId = (list) => Object.freeze(Object.fromEntries(list.map((item) => [item.id, item])));
|
|
1428
1659
|
var STENCIL_GROUPS = byId([
|
|
@@ -1433,7 +1664,12 @@ var STENCIL_GROUPS = byId([
|
|
|
1433
1664
|
BPMN_GROUP,
|
|
1434
1665
|
UML_GROUP,
|
|
1435
1666
|
ERD_GROUP,
|
|
1436
|
-
MIND_MAP_GROUP
|
|
1667
|
+
MIND_MAP_GROUP,
|
|
1668
|
+
STATE_GROUP,
|
|
1669
|
+
REQUIREMENT_GROUP,
|
|
1670
|
+
C4_GROUP,
|
|
1671
|
+
ARCHITECTURE_GROUP,
|
|
1672
|
+
KANBAN_GROUP
|
|
1437
1673
|
]);
|
|
1438
1674
|
var FLOWCHART_TYPE = {
|
|
1439
1675
|
id: "flowchart",
|
|
@@ -1442,7 +1678,8 @@ var FLOWCHART_TYPE = {
|
|
|
1442
1678
|
/* @icon */
|
|
1443
1679
|
"shape:diamond"
|
|
1444
1680
|
),
|
|
1445
|
-
groups: [FLOWCHART_GROUP.id, CONTAINERS_GROUP.id]
|
|
1681
|
+
groups: [FLOWCHART_GROUP.id, CONTAINERS_GROUP.id],
|
|
1682
|
+
notations: [FLOWCHART_NOTATION]
|
|
1446
1683
|
};
|
|
1447
1684
|
var NETWORK_TYPE = {
|
|
1448
1685
|
id: "network",
|
|
@@ -1484,7 +1721,8 @@ var MIND_MAP_TYPE = {
|
|
|
1484
1721
|
),
|
|
1485
1722
|
groups: [MIND_MAP_GROUP.id],
|
|
1486
1723
|
edge: { router: "bezier", markerEnd: null },
|
|
1487
|
-
layout: "radial"
|
|
1724
|
+
layout: "radial",
|
|
1725
|
+
notations: ["mindmap"]
|
|
1488
1726
|
};
|
|
1489
1727
|
var UML_CLASS_TYPE = {
|
|
1490
1728
|
id: "umlClass",
|
|
@@ -1494,7 +1732,8 @@ var UML_CLASS_TYPE = {
|
|
|
1494
1732
|
"diagram:umlClass"
|
|
1495
1733
|
),
|
|
1496
1734
|
groups: [UML_GROUP.id, CONTAINERS_GROUP.id],
|
|
1497
|
-
edge: { router: "orthogonal", markerEnd: "arrow-open" }
|
|
1735
|
+
edge: { router: "orthogonal", markerEnd: "arrow-open" },
|
|
1736
|
+
notations: ["class"]
|
|
1498
1737
|
};
|
|
1499
1738
|
var ERD_TYPE = {
|
|
1500
1739
|
id: "erd",
|
|
@@ -1504,7 +1743,71 @@ var ERD_TYPE = {
|
|
|
1504
1743
|
"diagram:erdEntity"
|
|
1505
1744
|
),
|
|
1506
1745
|
groups: [ERD_GROUP.id],
|
|
1507
|
-
edge: { router: "orthogonal", markerStart: "crow-one", markerEnd: "crow-many" }
|
|
1746
|
+
edge: { router: "orthogonal", markerStart: "crow-one", markerEnd: "crow-many" },
|
|
1747
|
+
notations: ["er"]
|
|
1748
|
+
};
|
|
1749
|
+
var STATE_TYPE = {
|
|
1750
|
+
id: "state",
|
|
1751
|
+
label: "State",
|
|
1752
|
+
icon: (
|
|
1753
|
+
/* @icon */
|
|
1754
|
+
"diagram:stateEnd"
|
|
1755
|
+
),
|
|
1756
|
+
groups: [STATE_GROUP.id],
|
|
1757
|
+
notations: ["state"]
|
|
1758
|
+
};
|
|
1759
|
+
var REQUIREMENT_TYPE = {
|
|
1760
|
+
id: "requirement",
|
|
1761
|
+
label: "Requirement",
|
|
1762
|
+
icon: (
|
|
1763
|
+
/* @icon */
|
|
1764
|
+
"diagram:requirement"
|
|
1765
|
+
),
|
|
1766
|
+
groups: [REQUIREMENT_GROUP.id],
|
|
1767
|
+
edge: { markerEnd: "arrow", dash: [4, 4] },
|
|
1768
|
+
notations: ["requirement"]
|
|
1769
|
+
};
|
|
1770
|
+
var C4_TYPE = {
|
|
1771
|
+
id: "c4",
|
|
1772
|
+
label: "C4",
|
|
1773
|
+
icon: (
|
|
1774
|
+
/* @icon */
|
|
1775
|
+
"diagram:c4Container"
|
|
1776
|
+
),
|
|
1777
|
+
groups: [C4_GROUP.id],
|
|
1778
|
+
notations: ["c4-context", "c4-container", "c4-component", "c4-dynamic", "c4-deployment"]
|
|
1779
|
+
};
|
|
1780
|
+
var BLOCK_TYPE = {
|
|
1781
|
+
id: "block",
|
|
1782
|
+
label: "Block",
|
|
1783
|
+
icon: (
|
|
1784
|
+
/* @icon */
|
|
1785
|
+
"diagram:blocks"
|
|
1786
|
+
),
|
|
1787
|
+
groups: [FLOWCHART_GROUP.id, CONTAINERS_GROUP.id],
|
|
1788
|
+
layout: "grid",
|
|
1789
|
+
notations: ["block"]
|
|
1790
|
+
};
|
|
1791
|
+
var ARCHITECTURE_TYPE = {
|
|
1792
|
+
id: "architecture",
|
|
1793
|
+
label: "Architecture",
|
|
1794
|
+
icon: (
|
|
1795
|
+
/* @icon */
|
|
1796
|
+
"diagram:cloud"
|
|
1797
|
+
),
|
|
1798
|
+
groups: [ARCHITECTURE_GROUP.id],
|
|
1799
|
+
edge: { router: "orthogonal", markerEnd: null },
|
|
1800
|
+
notations: ["architecture"]
|
|
1801
|
+
};
|
|
1802
|
+
var KANBAN_TYPE = {
|
|
1803
|
+
id: "kanban",
|
|
1804
|
+
label: "Kanban",
|
|
1805
|
+
icon: (
|
|
1806
|
+
/* @icon */
|
|
1807
|
+
"diagram:kanbanCard"
|
|
1808
|
+
),
|
|
1809
|
+
groups: [KANBAN_GROUP.id],
|
|
1810
|
+
notations: ["kanban"]
|
|
1508
1811
|
};
|
|
1509
1812
|
var DIAGRAM_TYPES = byId([
|
|
1510
1813
|
FLOWCHART_TYPE,
|
|
@@ -1513,7 +1816,13 @@ var DIAGRAM_TYPES = byId([
|
|
|
1513
1816
|
BPMN_TYPE,
|
|
1514
1817
|
UML_CLASS_TYPE,
|
|
1515
1818
|
ERD_TYPE,
|
|
1516
|
-
MIND_MAP_TYPE
|
|
1819
|
+
MIND_MAP_TYPE,
|
|
1820
|
+
STATE_TYPE,
|
|
1821
|
+
REQUIREMENT_TYPE,
|
|
1822
|
+
C4_TYPE,
|
|
1823
|
+
BLOCK_TYPE,
|
|
1824
|
+
ARCHITECTURE_TYPE,
|
|
1825
|
+
KANBAN_TYPE
|
|
1517
1826
|
]);
|
|
1518
1827
|
var isContainerStencil = (stencil) => "role" in stencil;
|
|
1519
1828
|
function groupStencils(ids, catalog = STENCIL_GROUPS) {
|
|
@@ -1521,9 +1830,6 @@ function groupStencils(ids, catalog = STENCIL_GROUPS) {
|
|
|
1521
1830
|
}
|
|
1522
1831
|
var groupStencilIds = (group) => group.stencils.map((s) => s.id);
|
|
1523
1832
|
|
|
1524
|
-
// src/diagramTypes/types.ts
|
|
1525
|
-
var DIAGRAM_TYPE_DOC_KEY = "diagram:type";
|
|
1526
|
-
|
|
1527
1833
|
// src/diagramTypes/doc.ts
|
|
1528
1834
|
function diagramTypeDocValue(id, types = DIAGRAM_TYPES) {
|
|
1529
1835
|
const type = types[id] ?? FLOWCHART_TYPE;
|
|
@@ -1539,6 +1845,11 @@ function diagramTypeDocOf(scene, types = DIAGRAM_TYPES) {
|
|
|
1539
1845
|
function diagramTypeOf(scene, types = DIAGRAM_TYPES) {
|
|
1540
1846
|
return types[diagramTypeDocOf(scene, types).type] ?? FLOWCHART_TYPE;
|
|
1541
1847
|
}
|
|
1848
|
+
var diagramNotationOf = (scene, types = DIAGRAM_TYPES) => diagramTypeOf(scene, types).notations?.[0] ?? FLOWCHART_NOTATION;
|
|
1849
|
+
function diagramTypeOfNotation(notation, types = DIAGRAM_TYPES) {
|
|
1850
|
+
const n = notation ?? FLOWCHART_NOTATION;
|
|
1851
|
+
return Object.values(types).find((t) => (t.notations ?? []).includes(n)) ?? null;
|
|
1852
|
+
}
|
|
1542
1853
|
function write(scene, value, label) {
|
|
1543
1854
|
scene.batch(label, () => scene.doc.set(DIAGRAM_TYPE_DOC_KEY, value));
|
|
1544
1855
|
}
|
|
@@ -1562,7 +1873,12 @@ function diagramTypeEdgeStroke(theme, type) {
|
|
|
1562
1873
|
const { markerStart, markerEnd, ...rest } = themeEdgeStroke(theme);
|
|
1563
1874
|
const start = type.edge?.markerStart === void 0 ? markerStart : type.edge.markerStart;
|
|
1564
1875
|
const end = type.edge?.markerEnd === void 0 ? markerEnd : type.edge.markerEnd;
|
|
1565
|
-
return {
|
|
1876
|
+
return {
|
|
1877
|
+
...rest,
|
|
1878
|
+
...start ? { markerStart: start } : {},
|
|
1879
|
+
...end ? { markerEnd: end } : {},
|
|
1880
|
+
...type.edge?.dash !== void 0 ? { dash: [...type.edge.dash] } : {}
|
|
1881
|
+
};
|
|
1566
1882
|
}
|
|
1567
1883
|
function restacked(sc, geometry, frame) {
|
|
1568
1884
|
const out = [];
|
|
@@ -1603,6 +1919,364 @@ function bodyFollower(scene, geometry = AUTO_POSE_DESCRIPTOR) {
|
|
|
1603
1919
|
};
|
|
1604
1920
|
}
|
|
1605
1921
|
|
|
1606
|
-
|
|
1922
|
+
// src/sequence/authorPlace.ts
|
|
1923
|
+
function sequenceAt(scene, world2) {
|
|
1924
|
+
const all = placedSequences(scene);
|
|
1925
|
+
for (let i = all.length - 1; i >= 0; i--) {
|
|
1926
|
+
const root = all[i];
|
|
1927
|
+
const local = { x: world2.x - root.origin.x, y: world2.y - root.origin.y };
|
|
1928
|
+
if (local.x < 0 || local.y < 0 || local.x > root.width || local.y > root.height) continue;
|
|
1929
|
+
const held = sequenceRootOf(scene.get(root.id));
|
|
1930
|
+
if (held !== null) return { root, data: held.sequence, local };
|
|
1931
|
+
}
|
|
1932
|
+
return null;
|
|
1933
|
+
}
|
|
1934
|
+
function sequenceHitOf(scene, id, world2) {
|
|
1935
|
+
const root = placedSequences(scene).find((p) => p.id === id);
|
|
1936
|
+
const node = root === void 0 ? void 0 : scene.get(id);
|
|
1937
|
+
const held = node === void 0 ? null : sequenceRootOf(node);
|
|
1938
|
+
if (root === void 0 || held === null) return null;
|
|
1939
|
+
return { root, data: held.sequence, local: { x: world2.x - root.origin.x, y: world2.y - root.origin.y } };
|
|
1940
|
+
}
|
|
1941
|
+
function nearestIndex(xs, x) {
|
|
1942
|
+
return xs.reduce((best, v, i) => best < 0 || Math.abs(v - x) < Math.abs(xs[best] - x) ? i : best, -1);
|
|
1943
|
+
}
|
|
1944
|
+
function columnNear(root, x) {
|
|
1945
|
+
const i = nearestIndex(root.geometry.columns.map((c) => c.x), x);
|
|
1946
|
+
return i < 0 ? null : { ...root.geometry.columns[i], index: i };
|
|
1947
|
+
}
|
|
1948
|
+
var columnIndexAt = (root, x) => root.geometry.columns.filter((c) => c.x < x).length;
|
|
1949
|
+
function slotNear(root, y, keep = () => true) {
|
|
1950
|
+
const slots = root.geometry.slots.filter((s) => keep(s.place));
|
|
1951
|
+
const i = nearestIndex(slots.map((s) => s.y), y);
|
|
1952
|
+
return i < 0 ? null : slots[i];
|
|
1953
|
+
}
|
|
1954
|
+
var sameList = (a, b) => a === b || a !== null && b !== null && a.fragment === b.fragment && a.section === b.section;
|
|
1955
|
+
|
|
1956
|
+
// src/sequence/authorActions.ts
|
|
1957
|
+
var ADD_PARTICIPANT_ACTION_ID = "diagram.sequence.addParticipant";
|
|
1958
|
+
var ADD_NOTE_ACTION_ID = "diagram.sequence.addNote";
|
|
1959
|
+
var ADD_MARK_ACTION_ID = "diagram.sequence.addMark";
|
|
1960
|
+
var NOTE_OVER_REACH = 20;
|
|
1961
|
+
var worldOf = (params) => {
|
|
1962
|
+
const w = params?.world;
|
|
1963
|
+
return w !== void 0 && typeof w.x === "number" && typeof w.y === "number" ? w : null;
|
|
1964
|
+
};
|
|
1965
|
+
function clickOf(deps, params) {
|
|
1966
|
+
const scene = deps.scene;
|
|
1967
|
+
const at = worldOf(params);
|
|
1968
|
+
return scene === void 0 || at === null ? null : { scene, at, hit: sequenceAt(scene, at) };
|
|
1969
|
+
}
|
|
1970
|
+
function firstAt(at, p, opts) {
|
|
1971
|
+
const data = { participants: [p], steps: [] };
|
|
1972
|
+
const layout = sequenceLayout(data, opts.measure ? { measure: opts.measure } : {});
|
|
1973
|
+
const head = layout.heads[0];
|
|
1974
|
+
return { at: { x: at.x - layout.columns[0].x, y: at.y - head.box.y }, data };
|
|
1975
|
+
}
|
|
1976
|
+
function createAddParticipantAction(opts = {}) {
|
|
1977
|
+
const commit = sequenceCommitOf(opts);
|
|
1978
|
+
const start = opts.start !== void 0 ? opts.start : opts.commit !== void 0 ? null : (at, data, deps) => {
|
|
1979
|
+
if (deps.scene !== void 0) startSequence(deps.scene, at, data, "Add sequence", opts);
|
|
1980
|
+
};
|
|
1981
|
+
return {
|
|
1982
|
+
id: ADD_PARTICIPANT_ACTION_ID,
|
|
1983
|
+
label: "Add participant",
|
|
1984
|
+
group: "diagram",
|
|
1985
|
+
requires: ["scene"],
|
|
1986
|
+
invoker: {
|
|
1987
|
+
timing: "immediate",
|
|
1988
|
+
run(deps, params) {
|
|
1989
|
+
const click = clickOf(deps, params);
|
|
1990
|
+
if (click === null) return "pass";
|
|
1991
|
+
const kind = params?.kind === "actor" ? "actor" : "participant";
|
|
1992
|
+
const { hit } = click;
|
|
1993
|
+
if (hit === null) {
|
|
1994
|
+
if (start === null) return "pass";
|
|
1995
|
+
const first = firstAt(click.at, newParticipant({ participants: [], steps: [] }, kind), opts);
|
|
1996
|
+
start(first.at, first.data, deps);
|
|
1997
|
+
return void 0;
|
|
1998
|
+
}
|
|
1999
|
+
const data = addParticipant(hit.data, newParticipant(hit.data, kind), columnIndexAt(hit.root, hit.local.x));
|
|
2000
|
+
commit({ id: hit.root.id, data, label: "Add participant" }, { deps });
|
|
2001
|
+
return void 0;
|
|
2002
|
+
}
|
|
2003
|
+
},
|
|
2004
|
+
enabled: () => true
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
function noteAt(hit, x, y) {
|
|
2008
|
+
const column = columnNear(hit.root, x);
|
|
2009
|
+
const slot = slotNear(hit.root, y);
|
|
2010
|
+
if (column === null || slot === null) return hit.data;
|
|
2011
|
+
const dx = x - column.x;
|
|
2012
|
+
const side = Math.abs(dx) <= NOTE_OVER_REACH ? void 0 : dx > 0 ? "right" : "left";
|
|
2013
|
+
return insertNote(hit.data, { over: [column.id], at: slot.place, ...side ? { side } : {} });
|
|
2014
|
+
}
|
|
2015
|
+
function createAddNoteAction(opts = {}) {
|
|
2016
|
+
const commit = sequenceCommitOf(opts);
|
|
2017
|
+
return {
|
|
2018
|
+
id: ADD_NOTE_ACTION_ID,
|
|
2019
|
+
label: "Add note",
|
|
2020
|
+
group: "diagram",
|
|
2021
|
+
requires: ["scene"],
|
|
2022
|
+
invoker: {
|
|
2023
|
+
timing: "immediate",
|
|
2024
|
+
run(deps, params) {
|
|
2025
|
+
const hit = clickOf(deps, params)?.hit ?? null;
|
|
2026
|
+
if (hit === null) return "pass";
|
|
2027
|
+
const data = noteAt(hit, hit.local.x, hit.local.y);
|
|
2028
|
+
if (data !== hit.data) commit({ id: hit.root.id, data, label: "Add note" }, { deps });
|
|
2029
|
+
return void 0;
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
enabled: () => true
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
var MARKS = /* @__PURE__ */ new Set(["activate", "deactivate", "create", "destroy"]);
|
|
2036
|
+
function createAddMarkAction(opts = {}) {
|
|
2037
|
+
const commit = sequenceCommitOf(opts);
|
|
2038
|
+
return {
|
|
2039
|
+
id: ADD_MARK_ACTION_ID,
|
|
2040
|
+
label: "Add lifeline mark",
|
|
2041
|
+
group: "diagram",
|
|
2042
|
+
requires: ["scene"],
|
|
2043
|
+
invoker: {
|
|
2044
|
+
timing: "immediate",
|
|
2045
|
+
run(deps, params) {
|
|
2046
|
+
const hit = clickOf(deps, params)?.hit ?? null;
|
|
2047
|
+
const column = hit === null ? null : columnNear(hit.root, hit.local.x);
|
|
2048
|
+
const slot = hit === null ? null : slotNear(hit.root, hit.local.y);
|
|
2049
|
+
if (hit === null || column === null || slot === null) return "pass";
|
|
2050
|
+
const kind = MARKS.has(params?.mark) ? params.mark : "activate";
|
|
2051
|
+
const data = insertMark(hit.data, { kind, participant: column.id }, slot.place);
|
|
2052
|
+
if (data !== hit.data) commit({ id: hit.root.id, data, label: "Add lifeline mark" }, { deps });
|
|
2053
|
+
return void 0;
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
enabled: () => true
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
// src/sequence/authorDrags.ts
|
|
2061
|
+
var DRAW_MESSAGE_ACTION_ID = "diagram.sequence.drawMessage";
|
|
2062
|
+
var DRAW_NOTE_ACTION_ID = "diagram.sequence.drawNote";
|
|
2063
|
+
var WRAP_FRAGMENT_ACTION_ID = "diagram.sequence.wrapFragment";
|
|
2064
|
+
function paramsOf(opts) {
|
|
2065
|
+
const p = opts?.params;
|
|
2066
|
+
return (typeof p === "function" ? p() : p) ?? {};
|
|
2067
|
+
}
|
|
2068
|
+
function authorDrag(id, label, opts, plan) {
|
|
2069
|
+
const commit = sequenceCommitOf(opts);
|
|
2070
|
+
return {
|
|
2071
|
+
id,
|
|
2072
|
+
label,
|
|
2073
|
+
group: "diagram",
|
|
2074
|
+
requires: ["scene"],
|
|
2075
|
+
invoker: {
|
|
2076
|
+
timing: "ongoing",
|
|
2077
|
+
start(ctx, binding) {
|
|
2078
|
+
const scene = ctx.deps.scene;
|
|
2079
|
+
const start = ctx.drag?.start ?? { x: ctx.world.x, y: ctx.world.y };
|
|
2080
|
+
const press = scene === void 0 ? null : sequenceAt(scene, start);
|
|
2081
|
+
if (scene === void 0 || press === null) return {};
|
|
2082
|
+
let proposal = null;
|
|
2083
|
+
const propose = (at) => {
|
|
2084
|
+
const now = sequenceHitOf(scene, press.root.id, at);
|
|
2085
|
+
proposal = now === null ? null : plan(press, now, paramsOf(binding));
|
|
2086
|
+
};
|
|
2087
|
+
return {
|
|
2088
|
+
kind: id,
|
|
2089
|
+
onMove(move) {
|
|
2090
|
+
propose({ x: move.world.x, y: move.world.y });
|
|
2091
|
+
},
|
|
2092
|
+
overlay: () => proposal?.overlay ?? null,
|
|
2093
|
+
onEnd(end, reason) {
|
|
2094
|
+
if (reason === "commit") propose({ x: end.world.x, y: end.world.y });
|
|
2095
|
+
const done = proposal;
|
|
2096
|
+
proposal = null;
|
|
2097
|
+
if (reason !== "commit" || done === null || done.data === press.data) return;
|
|
2098
|
+
commit({ id: press.root.id, data: done.data, label: done.label }, { deps: { ...end.deps, scene } });
|
|
2099
|
+
}
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
},
|
|
2103
|
+
enabled: () => true
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
var world = (hit, x, y) => ({ x: hit.root.origin.x + x, y: hit.root.origin.y + y });
|
|
2107
|
+
var arrowOf = (params) => typeof params.arrow === "object" && params.arrow !== null ? params.arrow : SEQ_ARROWS[params.arrow ?? "sync"] ?? SEQ_ARROWS.sync;
|
|
2108
|
+
function createDrawMessageAction(opts = {}) {
|
|
2109
|
+
return authorDrag(DRAW_MESSAGE_ACTION_ID, "Draw message", opts, (press, now, params) => {
|
|
2110
|
+
const from = columnNear(press.root, press.local.x);
|
|
2111
|
+
const to = columnNear(now.root, now.local.x);
|
|
2112
|
+
const slot = slotNear(press.root, press.local.y);
|
|
2113
|
+
if (from === null || to === null || slot === null) return null;
|
|
2114
|
+
const data = insertMessage(press.data, { from: from.id, to: to.id, at: slot.place, arrow: arrowOf(params) });
|
|
2115
|
+
const y = slot.y;
|
|
2116
|
+
const points = from.id === to.id ? [world(press, from.x, y), world(press, from.x + SEQ.loopWidth, y), world(press, from.x + SEQ.loopWidth, y + SEQ.loopHeight), world(press, from.x, y + SEQ.loopHeight)] : [world(press, from.x, y), world(press, now.local.x, y)];
|
|
2117
|
+
return { data, label: "Add message", overlay: [{ kind: "polyline", points, role: "connector" }] };
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
var outline = (hit, x0, y0, x1, y1) => [world(hit, x0, y0), world(hit, x1, y0), world(hit, x1, y1), world(hit, x0, y1), world(hit, x0, y0)];
|
|
2121
|
+
function createDrawNoteAction(opts = {}) {
|
|
2122
|
+
return authorDrag(DRAW_NOTE_ACTION_ID, "Draw note", opts, (press, now) => {
|
|
2123
|
+
const from = columnNear(press.root, press.local.x);
|
|
2124
|
+
const to = columnNear(now.root, now.local.x);
|
|
2125
|
+
const slot = slotNear(press.root, press.local.y);
|
|
2126
|
+
if (from === null || to === null || slot === null) return null;
|
|
2127
|
+
const data = from.id === to.id ? noteAt(press, now.local.x, press.local.y) : insertNote(press.data, { over: from.index < to.index ? [from.id, to.id] : [to.id, from.id], at: slot.place });
|
|
2128
|
+
const [x0, x1] = [Math.min(from.x, to.x) - SEQ.noteOverhang, Math.max(from.x, to.x) + SEQ.noteOverhang];
|
|
2129
|
+
return { data, label: "Add note", overlay: [{ kind: "polyline", points: outline(press, x0, slot.y, x1, slot.y + SEQ.rowGap * 2), role: "insert" }] };
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
var FRAGMENT_TYPES = /* @__PURE__ */ new Set(["loop", "alt", "opt", "par", "critical", "break", "region"]);
|
|
2133
|
+
function createWrapFragmentAction(opts = {}) {
|
|
2134
|
+
return authorDrag(WRAP_FRAGMENT_ACTION_ID, "Wrap in fragment", opts, (press, now, params) => {
|
|
2135
|
+
const first = slotNear(press.root, press.local.y);
|
|
2136
|
+
if (first === null) return null;
|
|
2137
|
+
const last = slotNear(press.root, now.local.y, (place) => sameList(place.parent, first.place.parent)) ?? first;
|
|
2138
|
+
const type = FRAGMENT_TYPES.has(params.type) ? params.type : "loop";
|
|
2139
|
+
const data = wrapSteps(press.data, first.place.parent, first.place.index, last.place.index, { type });
|
|
2140
|
+
const xs = press.root.geometry.columns.map((c) => c.x);
|
|
2141
|
+
const [x0, x1] = [Math.min(...xs, press.local.x) - SEQ.fragmentPad, Math.max(...xs, press.local.x) + SEQ.fragmentPad];
|
|
2142
|
+
const [y0, y1] = [Math.min(first.y, last.y), Math.max(first.y, last.y, Math.min(first.y, last.y) + SEQ.rowGap)];
|
|
2143
|
+
return { data, label: "Add fragment", overlay: [{ kind: "polyline", points: outline(press, x0, y0, x1, y1), role: "target" }] };
|
|
2144
|
+
});
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
// src/sequence/selected.ts
|
|
2148
|
+
var LIST_OF = {
|
|
2149
|
+
head: "participants",
|
|
2150
|
+
lifeline: "participants",
|
|
2151
|
+
message: "messages",
|
|
2152
|
+
note: "notes",
|
|
2153
|
+
fragment: "fragments",
|
|
2154
|
+
divider: "fragments",
|
|
2155
|
+
box: "boxes"
|
|
2156
|
+
};
|
|
2157
|
+
function sequenceSelectionOf(scene, ids) {
|
|
2158
|
+
let root = null;
|
|
2159
|
+
for (const id of ids) {
|
|
2160
|
+
const node = scene.get(id);
|
|
2161
|
+
if (node === void 0) continue;
|
|
2162
|
+
const part = sequencePartOf(node);
|
|
2163
|
+
if (part !== null) root = part.root;
|
|
2164
|
+
else if (sequenceRootOf(node) !== null) root = id;
|
|
2165
|
+
if (root !== null) break;
|
|
2166
|
+
}
|
|
2167
|
+
if (root === null) {
|
|
2168
|
+
const all = scene.renderOrderNodes().filter((n) => sequenceRootOf(n) !== null);
|
|
2169
|
+
if (all.length !== 1) return null;
|
|
2170
|
+
root = all[0].id;
|
|
2171
|
+
}
|
|
2172
|
+
const held = sequenceRootOf(scene.get(root));
|
|
2173
|
+
if (held === null) return null;
|
|
2174
|
+
const out = { root, data: held.sequence, participants: [], messages: [], notes: [], fragments: [], boxes: [] };
|
|
2175
|
+
for (const id of ids) {
|
|
2176
|
+
const node = scene.get(id);
|
|
2177
|
+
const part = node === void 0 ? null : sequencePartOf(node);
|
|
2178
|
+
if (part === null || part.root !== root || part.id === void 0) continue;
|
|
2179
|
+
const list = LIST_OF[part.part];
|
|
2180
|
+
if (list !== void 0 && !out[list].includes(part.id)) out[list].push(part.id);
|
|
2181
|
+
}
|
|
2182
|
+
return out;
|
|
2183
|
+
}
|
|
2184
|
+
var SEQUENCE_TOOLS = toolSet("sequence", [
|
|
2185
|
+
"diagram.sequence.participant",
|
|
2186
|
+
"diagram.sequence.message",
|
|
2187
|
+
"diagram.sequence.note",
|
|
2188
|
+
"diagram.sequence.fragment",
|
|
2189
|
+
"diagram.sequence.mark"
|
|
2190
|
+
]);
|
|
2191
|
+
var ON_SEQUENCE = `affordance:${SEQUENCE_AFFORDANCE_KIND}`;
|
|
2192
|
+
function both(tool, kind, actionId, params) {
|
|
2193
|
+
const at = (id) => ({ id: `${tool}.${id}`, ...params ? { params } : {} });
|
|
2194
|
+
return [
|
|
2195
|
+
{ spec: { kind }, actionId, opts: at(kind) },
|
|
2196
|
+
{ spec: { kind, target: ON_SEQUENCE }, actionId, opts: at(`${kind}.onSequence`) }
|
|
2197
|
+
];
|
|
2198
|
+
}
|
|
2199
|
+
function sequenceTools(opts = {}) {
|
|
2200
|
+
const participant = "diagram.sequence.participant";
|
|
2201
|
+
const message = "diagram.sequence.message";
|
|
2202
|
+
const note = "diagram.sequence.note";
|
|
2203
|
+
const fragment = "diagram.sequence.fragment";
|
|
2204
|
+
const mark = "diagram.sequence.mark";
|
|
2205
|
+
return {
|
|
2206
|
+
[participant]: defineTool({
|
|
2207
|
+
id: participant,
|
|
2208
|
+
hookName: "useSequenceTools",
|
|
2209
|
+
cursor: "copy",
|
|
2210
|
+
presentation: { label: "Participant", icon: (
|
|
2211
|
+
/* @icon */
|
|
2212
|
+
"diagram:umlActor"
|
|
2213
|
+
), group: "sequence" },
|
|
2214
|
+
actions: [createAddParticipantAction(opts)],
|
|
2215
|
+
bindings: both(participant, "click", ADD_PARTICIPANT_ACTION_ID, () => ({ kind: opts.participant?.() ?? "participant" }))
|
|
2216
|
+
}),
|
|
2217
|
+
[message]: defineTool({
|
|
2218
|
+
id: message,
|
|
2219
|
+
hookName: "useSequenceTools",
|
|
2220
|
+
cursor: "crosshair",
|
|
2221
|
+
presentation: { label: "Message", icon: (
|
|
2222
|
+
/* @icon */
|
|
2223
|
+
"core:arrow"
|
|
2224
|
+
), group: "sequence" },
|
|
2225
|
+
actions: [createDrawMessageAction(opts)],
|
|
2226
|
+
bindings: both(message, "drag", DRAW_MESSAGE_ACTION_ID, () => ({ arrow: opts.arrow?.() ?? "sync" }))
|
|
2227
|
+
}),
|
|
2228
|
+
[note]: defineTool({
|
|
2229
|
+
id: note,
|
|
2230
|
+
hookName: "useSequenceTools",
|
|
2231
|
+
cursor: "copy",
|
|
2232
|
+
presentation: { label: "Note", icon: (
|
|
2233
|
+
/* @icon */
|
|
2234
|
+
"diagram:umlNote"
|
|
2235
|
+
), group: "sequence" },
|
|
2236
|
+
actions: [createAddNoteAction(opts), createDrawNoteAction(opts)],
|
|
2237
|
+
bindings: [...both(note, "click", ADD_NOTE_ACTION_ID), ...both(note, "drag", DRAW_NOTE_ACTION_ID)]
|
|
2238
|
+
}),
|
|
2239
|
+
[fragment]: defineTool({
|
|
2240
|
+
id: fragment,
|
|
2241
|
+
hookName: "useSequenceTools",
|
|
2242
|
+
cursor: "crosshair",
|
|
2243
|
+
presentation: { label: "Fragment", icon: (
|
|
2244
|
+
/* @icon */
|
|
2245
|
+
"diagram:container"
|
|
2246
|
+
), group: "sequence" },
|
|
2247
|
+
actions: [createWrapFragmentAction(opts)],
|
|
2248
|
+
bindings: both(fragment, "drag", WRAP_FRAGMENT_ACTION_ID, () => ({ type: opts.fragment?.() ?? "loop" }))
|
|
2249
|
+
}),
|
|
2250
|
+
[mark]: defineTool({
|
|
2251
|
+
id: mark,
|
|
2252
|
+
hookName: "useSequenceTools",
|
|
2253
|
+
cursor: "copy",
|
|
2254
|
+
presentation: { label: "Mark", icon: (
|
|
2255
|
+
/* @icon */
|
|
2256
|
+
"diagram:task"
|
|
2257
|
+
), group: "sequence" },
|
|
2258
|
+
actions: [createAddMarkAction(opts)],
|
|
2259
|
+
bindings: both(mark, "click", ADD_MARK_ACTION_ID, () => ({ mark: opts.mark?.() ?? "activate" }))
|
|
2260
|
+
})
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
function useSequenceTools(opts = {}) {
|
|
2264
|
+
const latest = useLatest(opts);
|
|
2265
|
+
const { measure, theme } = opts;
|
|
2266
|
+
const custom = opts.commit !== void 0;
|
|
2267
|
+
const starts = opts.start === void 0 ? "default" : opts.start === null ? "none" : "own";
|
|
2268
|
+
return useMemo(() => sequenceTools({
|
|
2269
|
+
...measure ? { measure } : {},
|
|
2270
|
+
...theme ? { theme } : {},
|
|
2271
|
+
...custom ? { commit: (edit, ctx) => latest.current.commit?.(edit, ctx) } : {},
|
|
2272
|
+
...starts === "none" ? { start: null } : starts === "own" ? { start: (at, data, deps) => latest.current.start?.(at, data, deps) } : {},
|
|
2273
|
+
participant: () => latest.current.participant?.() ?? "participant",
|
|
2274
|
+
arrow: () => latest.current.arrow?.() ?? "sync",
|
|
2275
|
+
fragment: () => latest.current.fragment?.() ?? "loop",
|
|
2276
|
+
mark: () => latest.current.mark?.() ?? "activate"
|
|
2277
|
+
}), [latest, measure, theme, custom, starts]);
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
export { ADD_MARK_ACTION_ID, ADD_NOTE_ACTION_ID, ADD_PARTICIPANT_ACTION_ID, ARCHITECTURE_GROUP, ARCHITECTURE_STENCILS, ARCHITECTURE_TYPE, BLOCK_TYPE, BPMN_GROUP, BPMN_STENCILS, BPMN_TYPE, C4_GROUP, C4_STENCILS, C4_TYPE, CONNECTOR_ACTION_ID, CONNECTOR_TOOL_ID, DIAGRAM_PASS_ORDER, DIAGRAM_THEME_EXTENSION, DIAGRAM_TYPES, DIAGRAM_TYPE_DOC_KEY, DRAW_MESSAGE_ACTION_ID, DRAW_NOTE_ACTION_ID, ERD_GROUP, ERD_STENCILS, ERD_TYPE, FLOWCHART_GROUP, FLOWCHART_NOTATION, FLOWCHART_STENCILS, FLOWCHART_TYPE, FOLLOW_OFF_PAGE_ACTION_ID, KANBAN_GROUP, KANBAN_STENCILS, KANBAN_TYPE, MIND_MAP_GROUP, MIND_MAP_STENCILS, MIND_MAP_TYPE, NETWORK_GROUP, NETWORK_STENCILS, NETWORK_TYPE, NOTE_OVER_REACH, ORG_CHART_TYPE, ORG_GROUP, ORG_STENCILS, REQUIREMENT_GROUP, REQUIREMENT_STENCILS, REQUIREMENT_TYPE, SEQUENCE_TOOLS, STATE_GROUP, STATE_STENCILS, STATE_TYPE, STENCIL_GROUPS, StencilGhost, UML_CLASS_TYPE, UML_GROUP, UML_STENCILS, WRAP_FRAGMENT_ACTION_ID, addStencilGroup, addThemeRole, applyDiagramTheme, bodyFollower, connectorTool, createAddMarkAction, createAddNoteAction, createAddParticipantAction, createDrawMessageAction, createDrawNoteAction, createFollowOffPageAction, createWrapFragmentAction, diagramNotationOf, diagramOffPage, diagramStyleOf, diagramThemeFromTokens, diagramTypeDocOf, diagramTypeDocValue, diagramTypeEdgeStroke, diagramTypeOf, diagramTypeOfNotation, documentBoundsOf, editableTheme, followOffPageBinding, forkTheme, groupStencilIds, groupStencils, hopFollower, installAvoidRouting, installHops, installLabelPlacement, installOffPageMarkers, isContainerStencil, isShippedTheme, offPageOps, offPageTargetOf, parseDiagramTheme, removeStencilGroup, removeThemeRole, renameThemeRole, rendererMeasure, routeDataOps, sequenceSelectionOf, sequenceTools, setDiagramColor, setDiagramFontSize, setDiagramStyle, setDiagramType, setThemeValue, stencilBuild, stencilIdOf, stencilKind, stencilTool, themeRoles, themeToJson, themeValue, useAvoidRouting, useConnectorTool, useHops, useLabelPlacement, useOffPageMarkers, useSequenceTools, useStencilInsert, useStencilTool, waypointFollower };
|
|
1607
2281
|
//# sourceMappingURL=index.js.map
|
|
1608
2282
|
//# sourceMappingURL=index.js.map
|