@meltemi/diagrams-layout 1.9.0 → 1.10.17

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.
Files changed (60) hide show
  1. package/dist/audit.d.ts +8 -6
  2. package/dist/audit.d.ts.map +1 -1
  3. package/dist/audit.js +34 -17
  4. package/dist/audit.js.map +1 -1
  5. package/dist/checks.d.ts +5 -1
  6. package/dist/checks.d.ts.map +1 -1
  7. package/dist/checks.js +11 -3
  8. package/dist/checks.js.map +1 -1
  9. package/dist/frame.d.ts +2 -2
  10. package/dist/frame.d.ts.map +1 -1
  11. package/dist/frame.js +4 -1
  12. package/dist/frame.js.map +1 -1
  13. package/dist/free.d.ts +50 -3
  14. package/dist/free.d.ts.map +1 -1
  15. package/dist/free.js +187 -32
  16. package/dist/free.js.map +1 -1
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +4 -4
  20. package/dist/index.js.map +1 -1
  21. package/dist/layout.d.ts +203 -6
  22. package/dist/layout.d.ts.map +1 -1
  23. package/dist/layout.js +1308 -138
  24. package/dist/layout.js.map +1 -1
  25. package/dist/measure.d.ts +21 -2
  26. package/dist/measure.d.ts.map +1 -1
  27. package/dist/measure.js +30 -7
  28. package/dist/measure.js.map +1 -1
  29. package/dist/messages/en.d.ts +37 -0
  30. package/dist/messages/en.d.ts.map +1 -1
  31. package/dist/messages/en.js +37 -0
  32. package/dist/messages/en.js.map +1 -1
  33. package/dist/messages/es.d.ts.map +1 -1
  34. package/dist/messages/es.js +14 -0
  35. package/dist/messages/es.js.map +1 -1
  36. package/dist/messages/index.d.ts +14 -0
  37. package/dist/messages/index.d.ts.map +1 -1
  38. package/dist/scene.d.ts +46 -1
  39. package/dist/scene.d.ts.map +1 -1
  40. package/dist/sequence.d.ts +1 -1
  41. package/dist/sequence.d.ts.map +1 -1
  42. package/dist/sequence.js +719 -286
  43. package/dist/sequence.js.map +1 -1
  44. package/dist/shapes.d.ts +19 -0
  45. package/dist/shapes.d.ts.map +1 -1
  46. package/dist/shapes.js +58 -0
  47. package/dist/shapes.js.map +1 -1
  48. package/dist/styles.d.ts +7 -1
  49. package/dist/styles.d.ts.map +1 -1
  50. package/dist/styles.js +22 -2
  51. package/dist/styles.js.map +1 -1
  52. package/dist/text.d.ts +8 -0
  53. package/dist/text.d.ts.map +1 -1
  54. package/dist/text.js +132 -0
  55. package/dist/text.js.map +1 -1
  56. package/dist/theme.d.ts +13 -1
  57. package/dist/theme.d.ts.map +1 -1
  58. package/dist/theme.js +69 -30
  59. package/dist/theme.js.map +1 -1
  60. package/package.json +6 -6
package/dist/free.js CHANGED
@@ -2,6 +2,30 @@
2
2
  export function parentOf(element) {
3
3
  return element.groupPath[element.groupPath.length - 1] ?? null;
4
4
  }
5
+ /** Whether an element is a list: a free group whose block writes `layout column|row`. */
6
+ export function isList(element) {
7
+ return element.kind === "group" && element.list !== null;
8
+ }
9
+ /** Whether a list places a child of its own: elements and groups; lines and pens keep their points. */
10
+ export function listPlaces(child) {
11
+ return child.kind !== "line" && child.kind !== "pen";
12
+ }
13
+ /**
14
+ * Everything a list holds, at any depth, by id, with the outermost list around it: the box an
15
+ * engine arranges in its place, since no engine arranges what a list holds.
16
+ */
17
+ export function listHolders(diagram) {
18
+ const holders = new Map();
19
+ for (const element of diagram.elements) {
20
+ const outermost = element.groupPath.find((id) => {
21
+ const group = diagram.elementsById.get(id);
22
+ return group !== undefined && isList(group);
23
+ });
24
+ if (outermost !== undefined)
25
+ holders.set(element.id, outermost);
26
+ }
27
+ return holders;
28
+ }
5
29
  /**
6
30
  * Whether a group is untitled: its label is `""`, it has no `description` and its resolved style
7
31
  * has no `icon`. An untitled group is a plain container: it draws no title band.
@@ -14,7 +38,14 @@ export function isUntitledGroup(group, style) {
14
38
  * group, `groupPadding` for an untitled one. Hosts that compute interior origins use the same rule.
15
39
  */
16
40
  export function groupHeaderOf(group, style, theme) {
17
- return isUntitledGroup(group, style) ? theme.groupPadding : theme.groupHeader;
41
+ if (isUntitledGroup(group, style))
42
+ return theme.groupPadding;
43
+ // A written title size larger than the theme's grows the band by the title's line, keeping
44
+ // the band's spare room around it (decision 0067).
45
+ if (style.fontSize === undefined || theme.groupTitleSize === undefined)
46
+ return theme.groupHeader;
47
+ const spare = Math.round(theme.groupHeader - 1.25 * theme.groupTitleSize);
48
+ return Math.max(theme.groupHeader, Math.round(style.fontSize * 1.25) + spare);
18
49
  }
19
50
  /**
20
51
  * The size of a free group without a `size` statement: its padding, the farthest right and bottom
@@ -47,47 +78,171 @@ export function interiorOrigin(center, size, padding, header) {
47
78
  * then centres from the outermost group inwards. Children of a group without a place are skipped.
48
79
  * `headerOf` gives each group's header (see `groupHeaderOf`), `titleWidth` its minimum width, and
49
80
  * `extentOf` what a leaf of a size draws about its centre when it is more than its box.
81
+ *
82
+ * A list group (`layout column|row`) places its children itself, whatever `local` says: in source
83
+ * order along its axis from its interior origin, each where the previous one ends plus `spacing`
84
+ * (half `groupPadding` by default), and across the axis at the start of the interior, centred in
85
+ * it, at its end, or with `stretch` as wide (column) or as tall (row) as the interior when the
86
+ * child has no written size. Leaves are stacked by what they draw (`extentOf`). The list is
87
+ * derived as any group is, and a written size is its least size. Its lines and pens keep their
88
+ * written places.
50
89
  */
51
90
  export function freeFrames(diagram, local, written, leafSizes, theme, titleWidth, headerOf, extentOf) {
91
+ const padding = theme.groupPadding;
52
92
  const sizeOf = new Map(leafSizes);
53
- const groupSizes = new Map();
93
+ // Places relative to the parent's interior: the written ones, and those the lists give.
94
+ const places = new Map(local);
95
+ const childrenOf = new Map();
96
+ for (const element of diagram.elements) {
97
+ const parent = parentOf(element);
98
+ if (parent === null)
99
+ continue;
100
+ const known = childrenOf.get(parent);
101
+ if (known)
102
+ known.push(element);
103
+ else
104
+ childrenOf.set(parent, [element]);
105
+ }
106
+ // Groups are their box; leaves may draw beyond it.
107
+ const extentAt = (child, size) => child.kind !== "group" && extentOf ? extentOf(child.id, size) : undefined;
108
+ const derive = (group) => derivedGroupSize((childrenOf.get(group.id) ?? []).flatMap((child) => {
109
+ const place = places.get(child.id);
110
+ const size = sizeOf.get(child.id);
111
+ if (!place || !size)
112
+ return [];
113
+ const extent = extentAt(child, size);
114
+ return [{ place, size, ...(extent ? { extent } : {}) }];
115
+ }), padding, headerOf(group), titleWidth(group));
116
+ const lists = new Map();
117
+ // The size of each child of a list before the list stretches it.
118
+ const natural = new Map();
119
+ const stretched = new Map();
120
+ /**
121
+ * Places the children of a list: along its axis one after another; across it at the start, or,
122
+ * once the list's `size` is known, by its `align` within the interior.
123
+ */
124
+ const arrange = (group, list, size) => {
125
+ const column = list.layout === "column";
126
+ const cross = size === undefined
127
+ ? undefined
128
+ : column
129
+ ? size.width - 2 * padding
130
+ : size.height - headerOf(group) - padding;
131
+ let along = 0;
132
+ for (const id of list.children) {
133
+ const child = diagram.elementsById.get(id);
134
+ const own = natural.get(id);
135
+ if (!own)
136
+ continue;
137
+ const stretch = cross !== undefined && list.align === "stretch" && !written.has(id);
138
+ const drawn = !stretch
139
+ ? own
140
+ : column
141
+ ? { width: cross, height: own.height }
142
+ : { width: own.width, height: cross };
143
+ sizeOf.set(id, drawn);
144
+ if (stretch && child.kind !== "group")
145
+ stretched.set(id, drawn);
146
+ else
147
+ stretched.delete(id);
148
+ const extent = extentAt(child, drawn) ?? {
149
+ x: -drawn.width / 2,
150
+ y: -drawn.height / 2,
151
+ width: drawn.width,
152
+ height: drawn.height,
153
+ };
154
+ const [start, length] = column ? [extent.y, extent.height] : [extent.x, extent.width];
155
+ const [side, breadth] = column ? [extent.x, extent.width] : [extent.y, extent.height];
156
+ const offset = cross === undefined || list.align === "start" || list.align === "stretch"
157
+ ? 0
158
+ : list.align === "center"
159
+ ? (cross - breadth) / 2
160
+ : cross - breadth;
161
+ const main = along - start;
162
+ const across = offset - side;
163
+ places.set(id, column ? { x: across, y: main } : { x: main, y: across });
164
+ along += length + list.spacing;
165
+ }
166
+ };
54
167
  const groups = diagram.elements.filter((e) => e.kind === "group");
55
168
  for (const group of [...groups].sort((a, b) => b.groupPath.length - a.groupPath.length)) {
56
169
  const explicit = written.get(group.id);
57
- const size = explicit ??
58
- derivedGroupSize(diagram.elements.flatMap((child) => {
59
- if (parentOf(child) !== group.id)
60
- return [];
61
- const place = local.get(child.id);
62
- const childSize = sizeOf.get(child.id);
63
- if (!place || !childSize)
64
- return [];
65
- // Groups are their box; leaves may draw beyond it.
66
- const extent = child.kind !== "group" && extentOf ? extentOf(child.id, childSize) : undefined;
67
- return [{ place, size: childSize, ...(extent ? { extent } : {}) }];
68
- }), theme.groupPadding, headerOf(group), titleWidth(group));
170
+ if (group.list === null) {
171
+ sizeOf.set(group.id, explicit ?? derive(group));
172
+ continue;
173
+ }
174
+ const list = {
175
+ layout: group.list.layout,
176
+ spacing: group.list.spacing ?? padding / 2,
177
+ align: group.list.align ?? "start",
178
+ children: (childrenOf.get(group.id) ?? []).filter(listPlaces).map((child) => child.id),
179
+ };
180
+ lists.set(group.id, list);
181
+ for (const id of list.children) {
182
+ const size = sizeOf.get(id);
183
+ if (size)
184
+ natural.set(id, size);
185
+ }
186
+ // The list is derived from its children at the start of the interior, then aligns them in it.
187
+ arrange(group, list);
188
+ const derived = derive(group);
189
+ // A written size is the least size: the list grows with its children.
190
+ const size = explicit
191
+ ? {
192
+ width: Math.max(explicit.width, derived.width),
193
+ height: Math.max(explicit.height, derived.height),
194
+ }
195
+ : derived;
69
196
  sizeOf.set(group.id, size);
70
- if (local.has(group.id))
71
- groupSizes.set(group.id, size);
197
+ arrange(group, list, size);
198
+ }
199
+ // A list that the list holding it stretched aligns its children in its new interior.
200
+ for (const group of [...groups].sort((a, b) => a.groupPath.length - b.groupPath.length)) {
201
+ const list = lists.get(group.id);
202
+ if (list)
203
+ arrange(group, list, sizeOf.get(group.id));
204
+ }
205
+ const groupSizes = new Map();
206
+ for (const group of groups) {
207
+ if (places.has(group.id))
208
+ groupSizes.set(group.id, sizeOf.get(group.id));
72
209
  }
73
- const centers = new Map();
74
- const origins = new Map();
75
210
  const outerFirst = [...diagram.elements].sort((a, b) => a.groupPath.length - b.groupPath.length);
76
- for (const element of outerFirst) {
77
- const place = local.get(element.id);
78
- if (!place)
79
- continue;
80
- const parent = parentOf(element);
81
- const origin = parent === null ? { x: 0, y: 0 } : origins.get(parent);
82
- if (!origin)
83
- continue;
84
- const center = { x: origin.x + place.x, y: origin.y + place.y };
85
- centers.set(element.id, center);
86
- if (element.kind === "group") {
87
- origins.set(element.id, interiorOrigin(center, sizeOf.get(element.id), theme.groupPadding, headerOf(element)));
211
+ /**
212
+ * Centres from the interior origins known, outermost groups first: from the diagram's origin,
213
+ * or only inside the group `inside` from the origin given for it.
214
+ */
215
+ const centersFrom = (origins, centers, inside) => {
216
+ for (const element of outerFirst) {
217
+ if (inside !== undefined && !element.groupPath.includes(inside))
218
+ continue;
219
+ const place = places.get(element.id);
220
+ if (!place)
221
+ continue;
222
+ const parent = parentOf(element);
223
+ const origin = parent === null ? (inside === undefined ? { x: 0, y: 0 } : undefined) : origins.get(parent);
224
+ if (!origin)
225
+ continue;
226
+ const center = { x: origin.x + place.x, y: origin.y + place.y };
227
+ centers.set(element.id, center);
228
+ if (element.kind === "group") {
229
+ origins.set(element.id, interiorOrigin(center, sizeOf.get(element.id), padding, headerOf(element)));
230
+ }
88
231
  }
89
- }
90
- return { centers, groupSizes };
232
+ return centers;
233
+ };
234
+ return {
235
+ centers: centersFrom(new Map(), new Map()),
236
+ groupSizes,
237
+ sizes: sizeOf,
238
+ stretched,
239
+ lists,
240
+ within: (id, center) => {
241
+ const group = diagram.elementsById.get(id);
242
+ const origin = interiorOrigin(center, sizeOf.get(id), padding, headerOf(group));
243
+ return centersFrom(new Map([[id, origin]]), new Map([[id, center]]), id);
244
+ },
245
+ };
91
246
  }
92
247
  /**
93
248
  * Paint order of a free diagram: layer by layer from back to front; within a layer, groups (outer
package/dist/free.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"free.js","sourceRoot":"","sources":["../src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AAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;gBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;QACzE,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACzC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,12 +5,12 @@ export * from "./geometry.js";
5
5
  export * from "./markers.js";
6
6
  export { strokeDash } from "./scene.js";
7
7
  export { MELTEMI_MARK, MARK_GRADIENT_ID, markGradient, markGroup } from "./mark.js";
8
- export { estimateTextWidth, splitLines } from "./text.js";
8
+ export { estimateTextWidth, splitLines, wrapLines } from "./text.js";
9
9
  export { MIN_TEXT_MARGIN, TEXT_PADDING, TextMetrics, estimateMeasurer, type TextMeasurer, } from "./measure.js";
10
- export { c4TypeLine, c4TypeName, layoutDiagram, typeScale, DEFAULT_SIZES, DOCUMENT_MAX_WIDTH, PATTERN_SIZE, SLIDE_SIZE, type LayoutOptions, type LayoutResult, type ConnectorGeometry, type TypeScale, } from "./layout.js";
10
+ export { c4TypeLine, c4TypeName, layoutDiagram, typeScale, DEFAULT_PEN_WIDTH, DEFAULT_SIZES, DOCUMENT_MAX_WIDTH, PATTERN_SIZE, SLIDE_SIZE, STICKY_MIN_FONT_SIZE, penPath, type LayoutOptions, type LayoutResult, type BarGeometry, type ConnectorGeometry, type ListGeometry, type MessageText, type PenGeometry, type StickyText, type TypeScale, } from "./layout.js";
11
11
  export { StyleResolver, themeColor, type PatternKind, type ResolvedStyle } from "./styles.js";
12
- export { CORNERED_POLYGONS, CORNERED_SHAPES, SHAPE_SIZES, onOutline, onPolygon, pointInPolygon, pointInShape, segmentCrossesShape, shapeMagnets, shapeOutline, shapeTextArea, shapeTextCenter, turnPoint, turnedOutline, type BoxShape, type ShapeMagnet, type ShapeOptions, type ShapeOutline, type ShapeSize, } from "./shapes.js";
13
- export { groupHeaderOf, isUntitledGroup, type FrameTheme } from "./free.js";
12
+ export { CORNERED_POLYGONS, CORNERED_SHAPES, SHAPE_SIZES, boundaryToward, onOutline, onPolygon, pointInPolygon, pointInShape, segmentCrossesShape, shapeMagnets, shapeOutline, shapeTextArea, shapeTextCenter, turnPoint, turnedOutline, type BoxShape, type ShapeMagnet, type ShapeOptions, type ShapeOutline, type ShapeSize, } from "./shapes.js";
13
+ export { groupHeaderOf, isList, isUntitledGroup, listPlaces, type FrameTheme, type ListArrangement, } from "./free.js";
14
14
  export * from "./engine.js";
15
15
  export { solveConstraints, type ConstraintConflict, type SolverBox } from "./constraints.js";
16
16
  export { checkComposition, stacked, type CheckedConnector } from "./checks.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,6BAA6B,CAAC;AAEvD,mBAAmB,YAAY,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,kBA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,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,SAAS,EACT,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -4,12 +4,12 @@ export * from "./geometry.js";
4
4
  export * from "./markers.js";
5
5
  export { strokeDash } from "./scene.js";
6
6
  export { MELTEMI_MARK, MARK_GRADIENT_ID, markGradient, markGroup } from "./mark.js";
7
- export { estimateTextWidth, splitLines } from "./text.js";
7
+ export { estimateTextWidth, splitLines, wrapLines } from "./text.js";
8
8
  export { MIN_TEXT_MARGIN, TEXT_PADDING, TextMetrics, estimateMeasurer, } from "./measure.js";
9
- export { c4TypeLine, c4TypeName, layoutDiagram, typeScale, DEFAULT_SIZES, DOCUMENT_MAX_WIDTH, PATTERN_SIZE, SLIDE_SIZE, } from "./layout.js";
9
+ export { c4TypeLine, c4TypeName, layoutDiagram, typeScale, DEFAULT_PEN_WIDTH, DEFAULT_SIZES, DOCUMENT_MAX_WIDTH, PATTERN_SIZE, SLIDE_SIZE, STICKY_MIN_FONT_SIZE, penPath, } from "./layout.js";
10
10
  export { StyleResolver, themeColor } from "./styles.js";
11
- export { CORNERED_POLYGONS, CORNERED_SHAPES, SHAPE_SIZES, onOutline, onPolygon, pointInPolygon, pointInShape, segmentCrossesShape, shapeMagnets, shapeOutline, shapeTextArea, shapeTextCenter, turnPoint, turnedOutline, } from "./shapes.js";
12
- export { groupHeaderOf, isUntitledGroup } from "./free.js";
11
+ export { CORNERED_POLYGONS, CORNERED_SHAPES, SHAPE_SIZES, boundaryToward, onOutline, onPolygon, pointInPolygon, pointInShape, segmentCrossesShape, shapeMagnets, shapeOutline, shapeTextArea, shapeTextCenter, turnPoint, turnedOutline, } from "./shapes.js";
12
+ export { groupHeaderOf, isList, isUntitledGroup, listPlaces, } from "./free.js";
13
13
  export * from "./engine.js";
14
14
  export { solveConstraints } from "./constraints.js";
15
15
  export { checkComposition, stacked } from "./checks.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAGvD,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,gBAAgB,GAEjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,UAAU,GAKX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAwC,MAAM,aAAa,CAAC;AAC9F,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAS,EACT,aAAa,GAMd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAmB,MAAM,WAAW,CAAC;AAC5E,cAAc,aAAa,CAAC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Aa,CAAC;AACrB,OAAO,EACL,aAAa,EACb,MAAM,EACN,eAAe,EACf,UAAU,GAGX,MAAM,WAAW,CAAC;AACnB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAA2C,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAyB,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAsC,MAAM,YAAY,CAAC;AAC7E,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,SAAS,GAEV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/layout.d.ts CHANGED
@@ -4,13 +4,21 @@ import type { Diagnostic, LineIndex } from "@meltemi/diagrams-language";
4
4
  import type { Compilation, Element, ElementKind, FlowDiagram, LayoutMode, Point, ThemeDefinition } from "@meltemi/diagrams-model";
5
5
  import { type LayoutEngine } from "./engine.js";
6
6
  import { type Box } from "./geometry.js";
7
- import { type GroupItem, type Scene } from "./scene.js";
8
- import { TextMetrics, type TextMeasurer } from "./measure.js";
7
+ import { type ListArrangement } from "./free.js";
8
+ import { type GroupItem, type RectItem, type Scene, type StrokeDash, type TextItem } from "./scene.js";
9
+ import { TextMetrics, type TextFont, type TextMeasurer } from "./measure.js";
9
10
  import { type BoxShape } from "./shapes.js";
11
+ import { type ResolvedStyle } from "./styles.js";
10
12
  import { type Theme } from "./theme.js";
11
13
  export interface LayoutOptions {
12
14
  /** Theme name that overrides the diagram's `theme` property. */
13
15
  readonly theme?: string | null;
16
+ /**
17
+ * Draws the scene with `frame none` whatever the theme says, keeping every other token: no strip
18
+ * at the foot of the sheet (the mark, the wordmark and the title) and no mark gradient. An export
19
+ * without the Meltemi branding asks for it.
20
+ */
21
+ readonly frame?: "none";
14
22
  /** Theme used when the diagram has no `theme` property, such as the project's default theme. */
15
23
  readonly defaultTheme?: string | null;
16
24
  /**
@@ -47,15 +55,49 @@ export interface LayoutResult {
47
55
  readonly diagnostics: readonly Diagnostic[];
48
56
  /**
49
57
  * Boxes of the elements and groups in diagram coordinates, where `place` statements live, when
50
- * there is a scene. The scene itself is moved to make room for margins and the frame.
58
+ * there is a scene. The scene itself is moved to make room for margins and the frame. Sequence
59
+ * diagrams add their notes, fragments and written activation bars by event key.
51
60
  */
52
61
  readonly boxes?: ReadonlyMap<string, Box>;
53
62
  /** Scene coordinates minus diagram coordinates, when there is a scene. */
54
63
  readonly offset?: Point;
55
64
  /** Label pills of the relations that have one, by relation key, in diagram coordinates. */
56
65
  readonly labels?: ReadonlyMap<string, Box>;
66
+ /**
67
+ * Sequence diagrams: how the label of every message is drawn, by message key, in diagram
68
+ * coordinates: the room it wraps in and the lines it wrapped to, which editors that type over it
69
+ * take so that their text wraps as the drawing's does. A message's block is in `labels`.
70
+ */
71
+ readonly messageTexts?: ReadonlyMap<string, MessageText>;
72
+ /**
73
+ * Sequence diagrams: every activation bar, by the key of the `activate` that opens it or of the
74
+ * call whose block draws it, in diagram coordinates. A written bar's box is also in `boxes`.
75
+ */
76
+ readonly bars?: ReadonlyMap<string, BarGeometry>;
77
+ /**
78
+ * Sequence diagrams: the pills of the tags of every message and participant that has some, by
79
+ * message key or participant id, in source order, in diagram coordinates.
80
+ */
81
+ readonly tags?: ReadonlyMap<string, readonly Box[]>;
57
82
  /** The route of every relation, by relation key, in diagram coordinates. */
58
83
  readonly connectors?: ReadonlyMap<string, ConnectorGeometry>;
84
+ /**
85
+ * Free diagrams: every pen stroke by its id, in diagram coordinates. Its box in `boxes` is its
86
+ * `bounds`, which marquee selection and derived groups use.
87
+ */
88
+ readonly pens?: ReadonlyMap<string, PenGeometry>;
89
+ /**
90
+ * Free diagrams: how the text of every sticky is drawn, by its id, in diagram coordinates: the
91
+ * room it is wrapped in and the font size it shrank to, which editors that type over the card
92
+ * take so that their text wraps as the card's does.
93
+ */
94
+ readonly stickies?: ReadonlyMap<string, StickyText>;
95
+ /**
96
+ * Free diagrams: every list group (`layout column|row`) by its id: its layout, spacing and
97
+ * alignment with their defaults, the children it places in their order, and its interior origin,
98
+ * in diagram coordinates. The children's drawn boxes are in `boxes`, as any group child's.
99
+ */
100
+ readonly lists?: ReadonlyMap<string, ListGeometry>;
59
101
  /**
60
102
  * Free diagrams: the interior origin of the parent group of every group child, in diagram
61
103
  * coordinates. A child's written `place` is its centre minus this origin. Empty for flow.
@@ -71,8 +113,10 @@ export interface LayoutResult {
71
113
  /**
72
114
  * The drawn shape of every element box but groups', when there is a scene: the `shape` of a free
73
115
  * box or a flow node, a decision's diamond, a data store's cylinder, a C4 person's person, a
74
- * tag's pill, and `rounded` for the others. Hosts pass it with the box to `shapeOutline`,
75
- * `onOutline`, `shapeMagnets` and `pointInShape`. Absent for sequence diagrams.
116
+ * tag's pill, a sticky's `rectangle` (its card, with its radius in `radii`), and `rounded` for
117
+ * the others. Hosts pass it with the box to `shapeOutline`, `onOutline`, `shapeMagnets` and
118
+ * `pointInShape`. Sequence diagrams give their box-kind heads: `cylinder` for databases,
119
+ * `rounded` for the others; figures have none.
76
120
  */
77
121
  readonly shapes?: ReadonlyMap<string, BoxShape>;
78
122
  /**
@@ -109,6 +153,100 @@ export interface ConnectorGeometry {
109
153
  /** The waypoints written in the relation's `route` and used for drawing. */
110
154
  readonly via: readonly Point[];
111
155
  }
156
+ /** Where a pen stroke is drawn, for editors. */
157
+ export interface PenGeometry {
158
+ /** Its written points moved by the interior origin of its group: where it is drawn. */
159
+ readonly points: readonly Point[];
160
+ /** The box of the points grown by half the stroke's width on every side. */
161
+ readonly bounds: Box;
162
+ /** The stroke's resolved width. */
163
+ readonly width: number;
164
+ }
165
+ /** The width of a pen stroke whose style writes none. */
166
+ export declare const DEFAULT_PEN_WIDTH = 3;
167
+ /**
168
+ * How a list group arranges its children, for editors: its `layout`, its `spacing` (half the
169
+ * theme's `groupPadding` when not written) and its `align` (`start` when not written), the
170
+ * children it places in source order (its elements and groups; its lines and pens keep their
171
+ * points), and where its first child starts.
172
+ */
173
+ export interface ListGeometry extends ListArrangement {
174
+ /** The list's interior origin, in diagram coordinates: inside its padding, below its header. */
175
+ readonly origin: Point;
176
+ }
177
+ /** How the text of a sticky is drawn, for editors. */
178
+ export interface StickyText {
179
+ /**
180
+ * The room the text is wrapped in and aligned within: the card inside the theme's `padding`,
181
+ * right of its icon when it has one. Unturned, as the card's box is.
182
+ */
183
+ readonly area: Box;
184
+ /** The font size the lines are drawn at: `fontSize` or 1.2 times the label size, shrunk to fit. */
185
+ readonly size: number;
186
+ readonly weight: number;
187
+ /** The font the lines are measured and drawn in: the body font, or the style's stack. */
188
+ readonly font: TextFont;
189
+ /** The distance between two lines: 1.25 times the size. */
190
+ readonly line: number;
191
+ /** The lines as drawn: the text wrapped at the area's width. */
192
+ readonly lines: readonly string[];
193
+ readonly align: "left" | "center" | "right";
194
+ readonly verticalAlign: "top" | "middle" | "bottom";
195
+ /**
196
+ * Whether the lines fit the area. When they do not even at `STICKY_MIN_FONT_SIZE`, they are
197
+ * drawn from the area's top at that size, clipped to the card, and `layout.text-overflow` says so.
198
+ */
199
+ readonly fits: boolean;
200
+ }
201
+ /** How the label of a sequence message is drawn, for editors. */
202
+ export interface MessageText {
203
+ /**
204
+ * The room the label wraps in: the top and height of its block of lines, and the distance
205
+ * between the two lifelines less 24 (and the number disc's 22 under `autonumber`) wide, centred
206
+ * on the block. A self-call's label does not wrap: its room is its block, beside the loop.
207
+ */
208
+ readonly area: Box;
209
+ /**
210
+ * The lines as drawn: the label broken at `\n`, and wrapped at spaces where the area is
211
+ * narrower than a line; a self-call's broken at `\n` only. Empty when the message has no label.
212
+ */
213
+ readonly lines: readonly string[];
214
+ /** The font size of the lines: the theme's relation label size, or the message's `fontSize`. */
215
+ readonly size: number;
216
+ /** The distance between two lines: 1.25 times the size. */
217
+ readonly line: number;
218
+ /** The weight of the lines: 400, or the message's `fontWeight`. */
219
+ readonly weight?: number;
220
+ /** The stack the message's style writes (`font`), when it writes one. */
221
+ readonly font?: string;
222
+ /**
223
+ * Whether the label wraps at the area's width: true when a pull (a negative `gap`, a `spacing`
224
+ * below the default) brings a pair of columns between its two lifelines closer than the label
225
+ * held them, so the room caps it; false for a self-call and for a message whose columns are at
226
+ * their natural distance, whose label pushes them apart on one line instead.
227
+ */
228
+ readonly wraps: boolean;
229
+ }
230
+ /** Where an activation bar of a sequence diagram is drawn, for editors. */
231
+ export interface BarGeometry {
232
+ /** The participant whose lifeline the bar stands on. */
233
+ readonly participant: string;
234
+ /** The bar's rectangle. */
235
+ readonly box: Box;
236
+ /** How many bars of the participant are open under it: 0 for the outermost. */
237
+ readonly depth: number;
238
+ /** The key of the `activate` that opens the bar, or of the call whose block draws it. */
239
+ readonly from: string;
240
+ /**
241
+ * The key of the `deactivate` that closes the bar; null for a bar open to the end of the
242
+ * lifeline (or to its `destroy`) and for the bar of a call's block.
243
+ */
244
+ readonly to: string | null;
245
+ /** Whether a call's block draws the bar, rather than an `activate` statement. */
246
+ readonly block: boolean;
247
+ }
248
+ /** The smallest size a sticky's text shrinks to before it is clipped to its card. */
249
+ export declare const STICKY_MIN_FONT_SIZE = 8;
112
250
  /** Widest content canvas of `preset document` before `layout.too-large`. */
113
251
  export declare const DOCUMENT_MAX_WIDTH = 1200;
114
252
  /** The 16:9 canvas of `preset slide`. */
@@ -160,11 +298,69 @@ export interface TypeScale {
160
298
  * at 12 px.
161
299
  */
162
300
  export declare function typeScale(theme: Theme): TypeScale;
301
+ /** The text kinds whose size a style may write, each with the token it overrides. */
302
+ export type TextScaleKind = "label" | "groupTitle" | "note" | "tag" | "relationLabel";
303
+ /**
304
+ * The type scale of a target whose style writes `fontSize`: the theme's scale with the size of
305
+ * its kind and every measure derived from it, as the theme's token would give them: a label's
306
+ * description at the theme's ratio of description to label, a pill's height and padding, a tag's
307
+ * pill, a note's line (decision 0067). Without a written size, `scale` itself.
308
+ */
309
+ export declare function writtenScale(theme: Theme, scale: TypeScale, kind: TextScaleKind, size: number | undefined): TypeScale;
310
+ /** The text of a connector's label pill: its scale, weight and font. */
311
+ export interface PillText {
312
+ readonly scale: TypeScale;
313
+ readonly weight: number;
314
+ readonly font: TextFont;
315
+ }
316
+ /**
317
+ * The text of a relation's or a free line's label pill from its resolved style: the theme's
318
+ * relation label size at weight 500 in the body font, or what the style writes.
319
+ */
320
+ export declare function pillText(theme: Theme, scale: TypeScale, style: ResolvedStyle): PillText;
321
+ /**
322
+ * The width of a tag's pill: its text in the mono font at `tagSize`, weight 500, with `beside`
323
+ * more for an icon, plus `tagPadding`. A pill is `tagHeight` high. Flow tags and the tags of
324
+ * sequence messages and participants are measured alike.
325
+ */
326
+ export declare function tagPillWidth(metrics: TextMetrics, scale: TypeScale, text: string, beside?: number, face?: TagFace): number;
327
+ /** The font and weight of a tag's text: the mono font at 500 unless a style writes them. */
328
+ export interface TagFace {
329
+ readonly font: TextFont;
330
+ readonly weight: number;
331
+ }
332
+ /** How a tag's pill is painted: the theme's `tag` and `tagText` unless a flow style says otherwise. */
333
+ export interface TagPaint {
334
+ readonly fill: string;
335
+ readonly stroke: string;
336
+ readonly strokeWidth: number;
337
+ readonly dashed: StrokeDash;
338
+ /** The text's colour. */
339
+ readonly color: string;
340
+ }
341
+ /**
342
+ * A tag's pill in `box`, in scene coordinates: its outline, as round as its shorter side allows
343
+ * (upright when the tag is taller than wide), and its text centred on it in the mono font at
344
+ * `tagSize`, weight 500. Flow tags and the tags of sequence messages and participants are drawn
345
+ * alike.
346
+ */
347
+ export declare function tagPill(metrics: TextMetrics, scale: TypeScale, box: Box, text: string, paint: TagPaint, face?: TagFace): {
348
+ readonly outline: RectItem;
349
+ readonly label: TextItem;
350
+ };
163
351
  /**
164
352
  * The visible pieces of a polyline that passes under `holes`: the parts inside a hole are left
165
353
  * out. A line no hole touches is one piece.
166
354
  */
167
355
  export declare function splitAround(line: readonly Point[], holes: readonly Box[]): Point[][];
356
+ /**
357
+ * The path of a pen stroke through its points, as the layout draws it: `M p0`, then for every
358
+ * inner point a quadratic curve to the midpoint between it and the next one, with the point as its
359
+ * control (`Q p_i mid(p_i, p_i+1)`), then `L p_last`; two points are one segment, and one point
360
+ * is `M p0 L p0`, which round caps draw as a dot. Numbers are rounded to hundredths, as the scene
361
+ * writes them. Hosts draw a stroke in progress with it, so it looks as it will be written.
362
+ */
363
+ export declare function penPath(points: readonly Point[]): string;
168
364
  /**
169
365
  * Lays out one compiled diagram into a scene, then checks that no label is cut or overlaps
170
366
  * another label, a box or a connector (`layout.label-cut`, `layout.label-overlap`).
@@ -182,7 +378,8 @@ export declare function withUrl(group: GroupItem, element: Pick<Element, "url">)
182
378
  export declare function withBounds(group: GroupItem, box: Box, inner?: Box, label?: Box): GroupItem;
183
379
  /**
184
380
  * The canvas for the diagram's `preset` or `canvas`, reporting `layout.too-large` when the content
185
- * canvas exceeds what the preset holds. Nothing is clipped: a fixed canvas grows to fit.
381
+ * canvas exceeds what the preset holds. Nothing is clipped: a fixed canvas grows to fit. A board
382
+ * (`preset board`) is the content canvas whatever its size: a whiteboard grows as it is drawn on.
186
383
  */
187
384
  export declare function canvasSize(diagram: FlowDiagram, width: number, height: number, lines: LineIndex, diagnostics: Diagnostic[]): {
188
385
  width: number;