@x12i/diagrams 1.0.0 → 1.1.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 +20 -14
- package/dist/chunk-3DJFQRU3.js +2708 -0
- package/dist/chunk-3DJFQRU3.js.map +1 -0
- package/dist/index.d.ts +67 -54
- package/dist/index.js +204 -45
- package/dist/index.js.map +1 -1
- package/dist/messages-ZCyCfyO0.d.ts +857 -0
- package/dist/react.d.ts +348 -0
- package/dist/react.js +2525 -0
- package/dist/react.js.map +1 -0
- package/dist/styles.css +1389 -0
- package/package.json +51 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,58 +1,25 @@
|
|
|
1
|
+
import { D as DiagramDocument, N as NodeKind, a as NodeStatus, L as LayoutDirection } from './messages-ZCyCfyO0.js';
|
|
2
|
+
export { A as Alignment, C as COLLAPSED_HEIGHT, b as ConnectOptions, c as ConnectionCheck, d as ConnectionRejection, e as ConnectionRules, f as DEFAULT_NODE_SIZE, g as DIAGRAM_KINDS, h as DIAGRAM_VERSION, i as DiagramConnection, j as DiagramEdge, k as DiagramFragment, l as DiagramImportError, m as DiagramIndex, n as DiagramIssue, o as DiagramKind, p as DiagramMessages, q as DiagramMessagesOverride, r as DiagramMigration, s as DiagramMutationError, t as DiagramNode, u as DiagramPalette, v as DiagramPaletteOverride, E as EDGE_KINDS, w as EdgeGeometry, x as EdgeKind, y as EdgePatch, z as EdgePath, B as EdgePathInput, F as ExportJsonOptions, G as FocusDirection, H as GRID_SIZE, I as GeometryContext, J as GeometryOptions, K as GroupOptions, M as HistoryAction, O as HistoryOptions, P as HistoryState, Q as ImportErrorCode, R as ImportOptions, S as ImportResult, T as IssueCode, U as IssueSeverity, V as LayoutAlgorithm, W as LayoutOptions, X as LayoutResult, Y as LayoutSpacing, Z as Message, _ as MessageValues, $ as MutationErrorCode, a0 as NODE_KINDS, a1 as NODE_STATUSES, a2 as NewEdge, a3 as NewNode, a4 as NodePatch, a5 as PasteOptions, a6 as PasteResult, a7 as Point, a8 as PortPlacement, a9 as Position, aa as ReadingOrderOptions, ab as Rect, ac as RemoveOptions, ad as Side, ae as Size, af as StatusPalette, ag as SvgAttributes, ah as SvgElement, ai as SvgOptions, aj as TEXT_METRICS, ak as ValidateOptions, al as ValidationResult, am as addNode, an as alignNodes, ao as applyLayout, ap as buildIndex, aq as canRedo, ar as canUndo, as as checkConnection, at as computeEdgePath, au as connect, av as createDiagram, aw as createGeometryContext, ax as createHistory, ay as createNode, az as defaultMessages, aA as defaultPalette, aB as defineDiagram, aC as diagramToSvg, aD as diagramToSvgTree, aE as directionSides, aF as disconnect, aG as distributeNodes, aH as duplicateNodes, aI as escapeXml, aJ as estimateTextWidth, aK as exportDiagramJson, aL as exportDiagramSvg, aM as extractFragment, aN as findCycle, aO as findDirectionalNeighbor, aP as formatMessage, aQ as getAbsoluteBounds, aR as getAbsolutePosition, aS as getAbsolutePositions, aT as getAncestors, aU as getDescendants, aV as getDocumentBounds, aW as getEdgeGeometry, aX as getNeighbors, aY as getNodeBounds, aZ as getNodeSize, a_ as getPortPlacements, a$ as getReadingOrder, b0 as getRoots, b1 as groupNodes, b2 as hasPath, b3 as historyReducer, b4 as importDiagram, b5 as isContainerKind, b6 as isHorizontal, b7 as isSafeImageUrl, b8 as layoutDiagram, b9 as layoutedDiagram, ba as mirrorDirection, bb as moveNodes, bc as nextEdgeId, bd as nextNodeId, be as pasteFragment, bf as portTypesCompatible, bg as rectCenter, bh as rectContainsPoint, bi as rectsIntersect, bj as removeEdges, bk as removeNode, bl as removeNodes, bm as resizeNode, bn as resolveConnectionRules, bo as resolveMessages, bp as resolvePalette, bq as serializeSvg, br as setNodeParent, bs as sideAnchor, bt as sideVector, bu as snapPoint, bv as snapValue, bw as topologicalOrder, bx as translateNodes, by as ungroupNode, bz as unionRects, bA as updateEdge, bB as updateNode, bC as validateDiagram, bD as wrapText } from './messages-ZCyCfyO0.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
5
|
+
* Id utilities. They are deterministic where it matters (`nextId`), so
|
|
6
|
+
* documents built by the editor stay diffable and tests stay stable.
|
|
4
7
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
/** A random id such as `node-k3j9x2ab`. Not for tests; use `nextId` there. */
|
|
9
|
+
declare function generateId(prefix?: string, random?: () => number): string;
|
|
10
|
+
/** The smallest `prefix1`, `prefix2`, ... that is not taken. */
|
|
11
|
+
declare function nextId(taken: Iterable<string>, prefix: string): string;
|
|
12
|
+
interface IdAllocator {
|
|
13
|
+
/** Returns a new id and reserves it. */
|
|
14
|
+
next(prefix: string): string;
|
|
15
|
+
/** Marks an id as used. */
|
|
16
|
+
reserve(id: string): void;
|
|
17
|
+
has(id: string): boolean;
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
label: string;
|
|
20
|
-
position: Position;
|
|
21
|
-
status?: NodeStatus;
|
|
22
|
-
/** Set on children of a group or subflow. */
|
|
23
|
-
parentId?: string;
|
|
24
|
-
width?: number;
|
|
25
|
-
height?: number;
|
|
26
|
-
/** Typed handles, for connection validation. */
|
|
27
|
-
ports?: Array<{
|
|
28
|
-
id: string;
|
|
29
|
-
direction: "in" | "out";
|
|
30
|
-
type?: string;
|
|
31
|
-
}>;
|
|
32
|
-
/** Free-form payload for custom node bodies, such as a ChartSpec for a chart node. */
|
|
33
|
-
data?: Record<string, unknown>;
|
|
34
|
-
}
|
|
35
|
-
interface DiagramEdge {
|
|
36
|
-
id: string;
|
|
37
|
-
source: string;
|
|
38
|
-
target: string;
|
|
39
|
-
sourcePort?: string;
|
|
40
|
-
targetPort?: string;
|
|
41
|
-
kind?: EdgeKind;
|
|
42
|
-
label?: string;
|
|
43
|
-
/** Draw arrowheads at both ends. */
|
|
44
|
-
bidirectional?: boolean;
|
|
45
|
-
animated?: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface DiagramDocument {
|
|
48
|
-
version: typeof DIAGRAM_VERSION;
|
|
49
|
-
/** Every diagram has a title that states what it shows. */
|
|
50
|
-
title: string;
|
|
51
|
-
nodes: DiagramNode[];
|
|
52
|
-
edges: DiagramEdge[];
|
|
53
|
-
}
|
|
54
|
-
/** Identity helper for authoring-time type checking. */
|
|
55
|
-
declare function defineDiagram(document: DiagramDocument): DiagramDocument;
|
|
19
|
+
/** Hands out unique ids in bulk without rescanning the taken set each time. */
|
|
20
|
+
declare function createIdAllocator(taken?: Iterable<string>): IdAllocator;
|
|
21
|
+
/** The readable stem of an id: `task12` becomes `task`, `a-copy` stays. Falls back to `fallback`. */
|
|
22
|
+
declare function idStem(id: string, fallback: string): string;
|
|
56
23
|
|
|
57
24
|
interface OutlineOptions {
|
|
58
25
|
/** Joins labels along a path. Pass a translated word. Defaults to "to". */
|
|
@@ -68,5 +35,51 @@ interface OutlineOptions {
|
|
|
68
35
|
*/
|
|
69
36
|
declare function diagramToOutline(diagram: DiagramDocument, { connector, maxPaths }?: OutlineOptions): string[];
|
|
70
37
|
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
interface OutlineConnection {
|
|
39
|
+
edgeId: string;
|
|
40
|
+
/** The node at the other end. */
|
|
41
|
+
nodeId: string;
|
|
42
|
+
/** That node's label. */
|
|
43
|
+
label: string;
|
|
44
|
+
/** The edge's own label, if it has one (for example "yes" or "no"). */
|
|
45
|
+
edgeLabel?: string;
|
|
46
|
+
}
|
|
47
|
+
/** One node of the structured outline. Groups hold their children in `children`. */
|
|
48
|
+
interface OutlineItem {
|
|
49
|
+
id: string;
|
|
50
|
+
label: string;
|
|
51
|
+
kind: NodeKind;
|
|
52
|
+
status?: NodeStatus;
|
|
53
|
+
description?: string;
|
|
54
|
+
/** Edges that arrive at this node, with the node each comes from. */
|
|
55
|
+
incoming: OutlineConnection[];
|
|
56
|
+
/** Edges that leave this node, with the node each goes to. */
|
|
57
|
+
outgoing: OutlineConnection[];
|
|
58
|
+
children: OutlineItem[];
|
|
59
|
+
}
|
|
60
|
+
interface OutlineTreeOptions {
|
|
61
|
+
/** Orders siblings the way the canvas orders Tab stops. Defaults to `TB`. */
|
|
62
|
+
direction?: LayoutDirection;
|
|
63
|
+
rtl?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The structured counterpart of `diagramToOutline`: every node once, nested
|
|
67
|
+
* by group, in reading order, each with the nodes it connects to and from.
|
|
68
|
+
* The `DiagramOutline` component renders it as a nested list.
|
|
69
|
+
*/
|
|
70
|
+
declare function diagramToOutlineTree(doc: DiagramDocument, options?: OutlineTreeOptions): OutlineItem[];
|
|
71
|
+
/** What a screen reader needs to name a node: its kind, label and how many connections it has. */
|
|
72
|
+
interface NodeSummary {
|
|
73
|
+
id: string;
|
|
74
|
+
kind: NodeKind;
|
|
75
|
+
label: string;
|
|
76
|
+
incoming: number;
|
|
77
|
+
outgoing: number;
|
|
78
|
+
status?: NodeStatus;
|
|
79
|
+
description?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Summaries for every node, keyed by id. Cheap to build once per render. */
|
|
82
|
+
declare function summarizeNodes(doc: DiagramDocument): Map<string, NodeSummary>;
|
|
83
|
+
|
|
84
|
+
export { DiagramDocument, LayoutDirection, NodeKind, NodeStatus, createIdAllocator, diagramToOutline, diagramToOutlineTree, generateId, idStem, nextId, summarizeNodes };
|
|
85
|
+
export type { IdAllocator, NodeSummary, OutlineConnection, OutlineItem, OutlineOptions, OutlineTreeOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,205 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
import {
|
|
2
|
+
COLLAPSED_HEIGHT,
|
|
3
|
+
DEFAULT_NODE_SIZE,
|
|
4
|
+
DIAGRAM_KINDS,
|
|
5
|
+
DIAGRAM_VERSION,
|
|
6
|
+
DiagramImportError,
|
|
7
|
+
DiagramMutationError,
|
|
8
|
+
EDGE_KINDS,
|
|
9
|
+
GRID_SIZE,
|
|
10
|
+
NODE_KINDS,
|
|
11
|
+
NODE_STATUSES,
|
|
12
|
+
TEXT_METRICS,
|
|
13
|
+
addNode,
|
|
14
|
+
alignNodes,
|
|
15
|
+
applyLayout,
|
|
16
|
+
buildIndex,
|
|
17
|
+
canRedo,
|
|
18
|
+
canUndo,
|
|
19
|
+
checkConnection,
|
|
20
|
+
computeEdgePath,
|
|
21
|
+
connect,
|
|
22
|
+
createDiagram,
|
|
23
|
+
createGeometryContext,
|
|
24
|
+
createHistory,
|
|
25
|
+
createIdAllocator,
|
|
26
|
+
createNode,
|
|
27
|
+
defaultMessages,
|
|
28
|
+
defaultPalette,
|
|
29
|
+
defineDiagram,
|
|
30
|
+
diagramToOutline,
|
|
31
|
+
diagramToOutlineTree,
|
|
32
|
+
diagramToSvg,
|
|
33
|
+
diagramToSvgTree,
|
|
34
|
+
directionSides,
|
|
35
|
+
disconnect,
|
|
36
|
+
distributeNodes,
|
|
37
|
+
duplicateNodes,
|
|
38
|
+
escapeXml,
|
|
39
|
+
estimateTextWidth,
|
|
40
|
+
exportDiagramJson,
|
|
41
|
+
exportDiagramSvg,
|
|
42
|
+
extractFragment,
|
|
43
|
+
findCycle,
|
|
44
|
+
findDirectionalNeighbor,
|
|
45
|
+
formatMessage,
|
|
46
|
+
generateId,
|
|
47
|
+
getAbsoluteBounds,
|
|
48
|
+
getAbsolutePosition,
|
|
49
|
+
getAbsolutePositions,
|
|
50
|
+
getAncestors,
|
|
51
|
+
getDescendants,
|
|
52
|
+
getDocumentBounds,
|
|
53
|
+
getEdgeGeometry,
|
|
54
|
+
getNeighbors,
|
|
55
|
+
getNodeBounds,
|
|
56
|
+
getNodeSize,
|
|
57
|
+
getPortPlacements,
|
|
58
|
+
getReadingOrder,
|
|
59
|
+
getRoots,
|
|
60
|
+
groupNodes,
|
|
61
|
+
hasPath,
|
|
62
|
+
historyReducer,
|
|
63
|
+
idStem,
|
|
64
|
+
importDiagram,
|
|
65
|
+
isContainerKind,
|
|
66
|
+
isHorizontal,
|
|
67
|
+
isSafeImageUrl,
|
|
68
|
+
layoutDiagram,
|
|
69
|
+
layoutedDiagram,
|
|
70
|
+
mirrorDirection,
|
|
71
|
+
moveNodes,
|
|
72
|
+
nextEdgeId,
|
|
73
|
+
nextId,
|
|
74
|
+
nextNodeId,
|
|
75
|
+
pasteFragment,
|
|
76
|
+
portTypesCompatible,
|
|
77
|
+
rectCenter,
|
|
78
|
+
rectContainsPoint,
|
|
79
|
+
rectsIntersect,
|
|
80
|
+
removeEdges,
|
|
81
|
+
removeNode,
|
|
82
|
+
removeNodes,
|
|
83
|
+
resizeNode,
|
|
84
|
+
resolveConnectionRules,
|
|
85
|
+
resolveMessages,
|
|
86
|
+
resolvePalette,
|
|
87
|
+
serializeSvg,
|
|
88
|
+
setNodeParent,
|
|
89
|
+
sideAnchor,
|
|
90
|
+
sideVector,
|
|
91
|
+
snapPoint,
|
|
92
|
+
snapValue,
|
|
93
|
+
summarizeNodes,
|
|
94
|
+
topologicalOrder,
|
|
95
|
+
translateNodes,
|
|
96
|
+
ungroupNode,
|
|
97
|
+
unionRects,
|
|
98
|
+
updateEdge,
|
|
99
|
+
updateNode,
|
|
100
|
+
validateDiagram,
|
|
101
|
+
wrapText
|
|
102
|
+
} from "./chunk-3DJFQRU3.js";
|
|
103
|
+
export {
|
|
104
|
+
COLLAPSED_HEIGHT,
|
|
105
|
+
DEFAULT_NODE_SIZE,
|
|
106
|
+
DIAGRAM_KINDS,
|
|
107
|
+
DIAGRAM_VERSION,
|
|
108
|
+
DiagramImportError,
|
|
109
|
+
DiagramMutationError,
|
|
110
|
+
EDGE_KINDS,
|
|
111
|
+
GRID_SIZE,
|
|
112
|
+
NODE_KINDS,
|
|
113
|
+
NODE_STATUSES,
|
|
114
|
+
TEXT_METRICS,
|
|
115
|
+
addNode,
|
|
116
|
+
alignNodes,
|
|
117
|
+
applyLayout,
|
|
118
|
+
buildIndex,
|
|
119
|
+
canRedo,
|
|
120
|
+
canUndo,
|
|
121
|
+
checkConnection,
|
|
122
|
+
computeEdgePath,
|
|
123
|
+
connect,
|
|
124
|
+
createDiagram,
|
|
125
|
+
createGeometryContext,
|
|
126
|
+
createHistory,
|
|
127
|
+
createIdAllocator,
|
|
128
|
+
createNode,
|
|
129
|
+
defaultMessages,
|
|
130
|
+
defaultPalette,
|
|
131
|
+
defineDiagram,
|
|
132
|
+
diagramToOutline,
|
|
133
|
+
diagramToOutlineTree,
|
|
134
|
+
diagramToSvg,
|
|
135
|
+
diagramToSvgTree,
|
|
136
|
+
directionSides,
|
|
137
|
+
disconnect,
|
|
138
|
+
distributeNodes,
|
|
139
|
+
duplicateNodes,
|
|
140
|
+
escapeXml,
|
|
141
|
+
estimateTextWidth,
|
|
142
|
+
exportDiagramJson,
|
|
143
|
+
exportDiagramSvg,
|
|
144
|
+
extractFragment,
|
|
145
|
+
findCycle,
|
|
146
|
+
findDirectionalNeighbor,
|
|
147
|
+
formatMessage,
|
|
148
|
+
generateId,
|
|
149
|
+
getAbsoluteBounds,
|
|
150
|
+
getAbsolutePosition,
|
|
151
|
+
getAbsolutePositions,
|
|
152
|
+
getAncestors,
|
|
153
|
+
getDescendants,
|
|
154
|
+
getDocumentBounds,
|
|
155
|
+
getEdgeGeometry,
|
|
156
|
+
getNeighbors,
|
|
157
|
+
getNodeBounds,
|
|
158
|
+
getNodeSize,
|
|
159
|
+
getPortPlacements,
|
|
160
|
+
getReadingOrder,
|
|
161
|
+
getRoots,
|
|
162
|
+
groupNodes,
|
|
163
|
+
hasPath,
|
|
164
|
+
historyReducer,
|
|
165
|
+
idStem,
|
|
166
|
+
importDiagram,
|
|
167
|
+
isContainerKind,
|
|
168
|
+
isHorizontal,
|
|
169
|
+
isSafeImageUrl,
|
|
170
|
+
layoutDiagram,
|
|
171
|
+
layoutedDiagram,
|
|
172
|
+
mirrorDirection,
|
|
173
|
+
moveNodes,
|
|
174
|
+
nextEdgeId,
|
|
175
|
+
nextId,
|
|
176
|
+
nextNodeId,
|
|
177
|
+
pasteFragment,
|
|
178
|
+
portTypesCompatible,
|
|
179
|
+
rectCenter,
|
|
180
|
+
rectContainsPoint,
|
|
181
|
+
rectsIntersect,
|
|
182
|
+
removeEdges,
|
|
183
|
+
removeNode,
|
|
184
|
+
removeNodes,
|
|
185
|
+
resizeNode,
|
|
186
|
+
resolveConnectionRules,
|
|
187
|
+
resolveMessages,
|
|
188
|
+
resolvePalette,
|
|
189
|
+
serializeSvg,
|
|
190
|
+
setNodeParent,
|
|
191
|
+
sideAnchor,
|
|
192
|
+
sideVector,
|
|
193
|
+
snapPoint,
|
|
194
|
+
snapValue,
|
|
195
|
+
summarizeNodes,
|
|
196
|
+
topologicalOrder,
|
|
197
|
+
translateNodes,
|
|
198
|
+
ungroupNode,
|
|
199
|
+
unionRects,
|
|
200
|
+
updateEdge,
|
|
201
|
+
updateNode,
|
|
202
|
+
validateDiagram,
|
|
203
|
+
wrapText
|
|
204
|
+
};
|
|
46
205
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|