reladraw 0.15.1 → 0.17.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 +11 -7
- package/SYNTAX.md +818 -680
- package/dist/ast.d.ts +342 -18
- package/dist/ast.js +138 -27
- package/dist/checks.d.ts +58 -0
- package/dist/checks.js +891 -0
- package/dist/cli.js +88 -12
- package/dist/constants.d.ts +15 -55
- package/dist/constants.js +30 -78
- package/dist/grammar.d.ts +2 -2
- package/dist/grammar.js +70 -10
- package/dist/index.d.ts +20 -0
- package/dist/index.js +18 -1
- package/dist/lexer.d.ts +12 -0
- package/dist/lexer.js +34 -0
- package/dist/lines.d.ts +96 -0
- package/dist/lines.js +1968 -0
- package/dist/linetexts.d.ts +44 -0
- package/dist/linetexts.js +412 -0
- package/dist/model.d.ts +187 -36
- package/dist/model.js +23 -1
- package/dist/parser.js +1811 -107
- package/dist/place.d.ts +501 -0
- package/dist/place.js +2226 -0
- package/dist/render.d.ts +3 -1
- package/dist/render.js +691 -2493
- package/dist/resolve.d.ts +1 -1
- package/dist/resolve.js +1195 -1789
- package/dist/size.d.ts +64 -0
- package/dist/size.js +222 -0
- package/dist/themes.d.ts +17 -0
- package/dist/themes.js +28 -3
- package/package.json +2 -2
- package/dist/constrain.d.ts +0 -56
- package/dist/constrain.js +0 -95
package/dist/place.d.ts
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where every box goes, and how big each container is.
|
|
3
|
+
*
|
|
4
|
+
* Nothing here is solved and nothing is pushed. A placement gives a box an
|
|
5
|
+
* exact distance from its target, each axis of each box comes from exactly one
|
|
6
|
+
* statement, and a box is worked out from things already worked out, in
|
|
7
|
+
* whatever order its targets allow. A container is the outline of its children
|
|
8
|
+
* plus its padding. Two boxes the file puts on one spot are drawn there, and
|
|
9
|
+
* the findings report it.
|
|
10
|
+
*
|
|
11
|
+
* Every quantity is worked out on demand and remembered: a box's start on an
|
|
12
|
+
* axis, its size, and a container's frame. A box asked for while it is still
|
|
13
|
+
* being worked out is a circle in the file, reported with the placements that
|
|
14
|
+
* make it.
|
|
15
|
+
*
|
|
16
|
+
* Coordinates are per frame. The top level's frame is the page. A container's
|
|
17
|
+
* children are placed in its own frame, whose origin is wherever its anchor
|
|
18
|
+
* landed, and the container's box is found around them; a child's place on the
|
|
19
|
+
* page is its container's plus its offset in that frame.
|
|
20
|
+
*/
|
|
21
|
+
import type { Axis, PlacementTarget, PointStmt, RegionStmt } from './ast.js';
|
|
22
|
+
import { type LayoutNode } from './model.js';
|
|
23
|
+
/** A stretch of one axis. */
|
|
24
|
+
interface Extent {
|
|
25
|
+
start: number;
|
|
26
|
+
size: number;
|
|
27
|
+
}
|
|
28
|
+
/** Where a container's title sits: against which side, and how. */
|
|
29
|
+
export interface TitlePlace {
|
|
30
|
+
/** `inside`, `on` or `outside` a side, or `center` for the middle of the box. */
|
|
31
|
+
how: 'inside' | 'on' | 'outside' | 'center';
|
|
32
|
+
side: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
33
|
+
/** Along the side: the start (left or top), the middle, or the end. */
|
|
34
|
+
along: 'start' | 'center' | 'end';
|
|
35
|
+
}
|
|
36
|
+
/** A region's text as the placer needs it: its turned size, its gap, and where it sits. */
|
|
37
|
+
export interface RegionTextFacts {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
gap: number;
|
|
41
|
+
how: 'inside' | 'on' | 'outside';
|
|
42
|
+
side: 'top' | 'bottom' | 'left' | 'right';
|
|
43
|
+
along: 'start' | 'center' | 'end';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* How a region grows to hold its text, on one axis (design.org 7.4). Inside,
|
|
47
|
+
* it gains a band on that side as tall as the text and its gap, as a container
|
|
48
|
+
* makes room for its title; inside or on the border, it widens to hold the
|
|
49
|
+
* text along the side, from the end the text is aligned to. Outside, nothing.
|
|
50
|
+
*/
|
|
51
|
+
export declare function regionGrown(extent: Extent, text: RegionTextFacts, axis: Axis): Extent;
|
|
52
|
+
/**
|
|
53
|
+
* Where a region's text sits on one axis, against the region as drawn (already
|
|
54
|
+
* grown): a gap inside or outside the side, or across the border; along the
|
|
55
|
+
* side, at its start, middle or end, held off the corner by the gap except
|
|
56
|
+
* outside, where its end is even with the region's edge, as a title's is.
|
|
57
|
+
*/
|
|
58
|
+
export declare function regionTextAt(region: Extent, text: RegionTextFacts, axis: Axis): Extent;
|
|
59
|
+
/** What `layout:` said, read and checked. */
|
|
60
|
+
export interface Layout {
|
|
61
|
+
/** A deck stacks its children, the first in front and each next one up and to the left behind it. */
|
|
62
|
+
kind: 'column' | 'row' | 'deck';
|
|
63
|
+
/** Between facing sides of neighbors, in pixels. Absent when `centers` is given. */
|
|
64
|
+
gap?: number;
|
|
65
|
+
/** Between neighbors' centers, in pixels. */
|
|
66
|
+
centers?: number;
|
|
67
|
+
widths: 'natural' | 'match' | 'fill';
|
|
68
|
+
/** `align-children:`: the children's starts, middles or ends even with each other. */
|
|
69
|
+
align: 'start' | 'center' | 'end';
|
|
70
|
+
}
|
|
71
|
+
/** What `layout: venn` said: its three parts in order, whether the two sets share a height, and the gap outside each crossing border. */
|
|
72
|
+
export interface Venn {
|
|
73
|
+
heights: 'natural' | 'equal';
|
|
74
|
+
gap: number;
|
|
75
|
+
/** `align-children:`: the two sets lined up by their tops, middles or bottoms. */
|
|
76
|
+
align: 'start' | 'center' | 'end';
|
|
77
|
+
/** The left set, the overlap, the right set. */
|
|
78
|
+
parts: [LayoutNode, LayoutNode, LayoutNode];
|
|
79
|
+
}
|
|
80
|
+
/** What the tree pass settled about each node before anything is placed. */
|
|
81
|
+
export interface NodeFacts {
|
|
82
|
+
/** The size the node's own contents give it: a leaf's text and padding, a picture. Zero for a container. */
|
|
83
|
+
natural: {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
};
|
|
87
|
+
/** The text's ink box from the node's top-left, as a leaf is sized. */
|
|
88
|
+
textBox: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
};
|
|
94
|
+
/** Whether the node has any text. An empty text takes no room. */
|
|
95
|
+
hasText: boolean;
|
|
96
|
+
/** `padding:`, which a title keeps its inset by. */
|
|
97
|
+
padding: number;
|
|
98
|
+
/** Each side's padding: `padding:`, or `padding-right:` and the rest over it. */
|
|
99
|
+
pad: Record<'top' | 'right' | 'bottom' | 'left', number>;
|
|
100
|
+
/** One line of the node's text, and one character, for sizes in `lines` and `chars`. */
|
|
101
|
+
lineHeight: number;
|
|
102
|
+
charWidth: number;
|
|
103
|
+
title: TitlePlace;
|
|
104
|
+
layout?: Layout;
|
|
105
|
+
venn?: Venn;
|
|
106
|
+
circle: boolean;
|
|
107
|
+
/** Where `gather-children:` puts the children in the box's spare room, on each axis. */
|
|
108
|
+
gather: Record<Axis, 'start' | 'center' | 'end'>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A gap as written: a gap word, a number in the file's unit, or a number of
|
|
112
|
+
* pixels with `px`. A distance is never negative; the words for an overlap are
|
|
113
|
+
* `inside` and `on`.
|
|
114
|
+
*/
|
|
115
|
+
export declare function gapPixels(written: string, subject: string, line: number): number;
|
|
116
|
+
/**
|
|
117
|
+
* A region's `opacity:`, an amount from none to full: `0` to `1.0`. The one
|
|
118
|
+
* look whose bare number is not a multiple of its normal (design.org 8.3).
|
|
119
|
+
*/
|
|
120
|
+
export declare function checkOpacity(value: string, subject: string, line: number): void;
|
|
121
|
+
export declare class Placer {
|
|
122
|
+
private readonly roots;
|
|
123
|
+
private readonly byName;
|
|
124
|
+
private readonly facts;
|
|
125
|
+
/** Named points and regions (design.org 4.5), worked out wherever they are used. */
|
|
126
|
+
private readonly named;
|
|
127
|
+
/** A region's text, which may grow the region to hold it (design.org 7.4). */
|
|
128
|
+
private readonly regionTexts;
|
|
129
|
+
private readonly starts;
|
|
130
|
+
private readonly sizes;
|
|
131
|
+
private readonly frames;
|
|
132
|
+
private readonly outlines;
|
|
133
|
+
private readonly working;
|
|
134
|
+
/** What is being worked out, innermost last, for reporting a circle. */
|
|
135
|
+
private readonly trail;
|
|
136
|
+
/** A node's size on its own, from what it states or holds, within its limits. */
|
|
137
|
+
private readonly owns;
|
|
138
|
+
/** A layout's child's position and size on each axis, worked out for the whole layout at once. */
|
|
139
|
+
private readonly laid;
|
|
140
|
+
/** Where each of a venn's parts' frames sits in the venn's, on each axis. */
|
|
141
|
+
private readonly vennPlans;
|
|
142
|
+
/** Where one venn part's frame sits in the venn's, up and down. */
|
|
143
|
+
private readonly vennShifts;
|
|
144
|
+
/** The band a laid-out container's children are aligned in, across its layout. */
|
|
145
|
+
private readonly bands;
|
|
146
|
+
/** Where a node joined to its container's text starts, measured from the text's start. */
|
|
147
|
+
private readonly unitStarts;
|
|
148
|
+
/** The stretch a container's text and what is joined to it cover, measured from the text's start. */
|
|
149
|
+
private readonly units;
|
|
150
|
+
/** Where a container's frame's origin is on the page. */
|
|
151
|
+
private readonly origins;
|
|
152
|
+
/** Containers whose anchor is being placed on the page, so a box outside them is measured on the page rather than in their frame. */
|
|
153
|
+
private readonly onPage;
|
|
154
|
+
/** Named points and regions being worked out, innermost last, to refuse one defined through itself. */
|
|
155
|
+
private readonly expanding;
|
|
156
|
+
constructor(roots: LayoutNode[], byName: Map<string, LayoutNode>, facts: Map<LayoutNode, NodeFacts>,
|
|
157
|
+
/** Named points and regions (design.org 4.5), worked out wherever they are used. */
|
|
158
|
+
named?: Map<string, PointStmt | RegionStmt>,
|
|
159
|
+
/** A region's text, which may grow the region to hold it (design.org 7.4). */
|
|
160
|
+
regionTexts?: Map<string, RegionTextFacts>);
|
|
161
|
+
/**
|
|
162
|
+
* Where each named point and region is on the page. A point names one spot,
|
|
163
|
+
* so one that works out to a stretch (a side, a whole box) is refused.
|
|
164
|
+
*/
|
|
165
|
+
placeNamed(): Map<string, {
|
|
166
|
+
x: number;
|
|
167
|
+
y: number;
|
|
168
|
+
width: number;
|
|
169
|
+
height: number;
|
|
170
|
+
}>;
|
|
171
|
+
/**
|
|
172
|
+
* Where a target is on the page once everything is placed: a box, a side (a
|
|
173
|
+
* stretch on one axis), a point, a named point or region. For a line's
|
|
174
|
+
* `via:` stops (design.org 6.4).
|
|
175
|
+
*/
|
|
176
|
+
locate(target: PlacementTarget, subject: string, line: number): {
|
|
177
|
+
x: number;
|
|
178
|
+
y: number;
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
};
|
|
182
|
+
/** Work out everything, and write it onto the nodes. */
|
|
183
|
+
run(): void;
|
|
184
|
+
/** Where a node starts on the page. */
|
|
185
|
+
page(node: LayoutNode, axis: Axis): number;
|
|
186
|
+
/**
|
|
187
|
+
* Where a container's frame's origin is on the page. A container that says
|
|
188
|
+
* nothing about where it goes shares its own container's origin, so it is
|
|
189
|
+
* known without its outline; one placed by what it holds is where its
|
|
190
|
+
* anchor goes; any other is found from where its box went.
|
|
191
|
+
*/
|
|
192
|
+
private origin;
|
|
193
|
+
/**
|
|
194
|
+
* A container that says where it goes on one axis cannot also hold a child
|
|
195
|
+
* placed against a box outside it on that axis: both would say where the
|
|
196
|
+
* container goes, and it is refused even when the two agree.
|
|
197
|
+
*/
|
|
198
|
+
private refusePlacedTwice;
|
|
199
|
+
/** The origin a box outside `parent` is measured from: the page while `parent`'s anchor is being placed on it. */
|
|
200
|
+
private originFor;
|
|
201
|
+
/** Where the anchor of a container placed by what it holds goes on the page, which is its frame's origin. */
|
|
202
|
+
private anchorOnPage;
|
|
203
|
+
/**
|
|
204
|
+
* A container that is its frame's anchor: it says nothing about where it
|
|
205
|
+
* goes, and nothing inside it is placed against a box outside it in its
|
|
206
|
+
* stead. Its frame's origin is its own container's.
|
|
207
|
+
*/
|
|
208
|
+
private floats;
|
|
209
|
+
/**
|
|
210
|
+
* A container placed by what it holds, on one axis (design.org 5.5): it
|
|
211
|
+
* says nothing about where it goes, nothing inside it is its anchor, and a
|
|
212
|
+
* child is placed against boxes outside it. The first such child is the
|
|
213
|
+
* frame's anchor, and where it goes says where the container goes.
|
|
214
|
+
*/
|
|
215
|
+
private frameAnchor;
|
|
216
|
+
/** A box that says nothing about where it goes, and so anchors its frame. */
|
|
217
|
+
private unplaced;
|
|
218
|
+
/** Whether everything a box is placed against on one axis is outside `of`. */
|
|
219
|
+
private fromOutside;
|
|
220
|
+
/** The boxes a target is worked out from: the box it names, or those a point or region it names is worked out from. */
|
|
221
|
+
private boxesNamed;
|
|
222
|
+
/** Where a node starts in its container's frame, or on the page for the top level. */
|
|
223
|
+
start(node: LayoutNode, axis: Axis): number;
|
|
224
|
+
size(node: LayoutNode, axis: Axis): number;
|
|
225
|
+
/** A container's box and title in its own frame, at the size it ends up. */
|
|
226
|
+
private frame;
|
|
227
|
+
/** A container's outline around what it holds, before anything states its size. */
|
|
228
|
+
private outline;
|
|
229
|
+
private remember;
|
|
230
|
+
/**
|
|
231
|
+
* Work something out, refusing a circle. The trail holds what was being
|
|
232
|
+
* worked out on the way here, and the placements that asked for each.
|
|
233
|
+
*/
|
|
234
|
+
private guard;
|
|
235
|
+
private circle;
|
|
236
|
+
private workOutStart;
|
|
237
|
+
/** Where a node joined to its container's text starts, from the text's start. */
|
|
238
|
+
private unitStart;
|
|
239
|
+
/** A box's start from its own placements. */
|
|
240
|
+
private placed;
|
|
241
|
+
private edgeOf;
|
|
242
|
+
/** A box's start from one statement. */
|
|
243
|
+
private apply;
|
|
244
|
+
/**
|
|
245
|
+
* Nothing states this axis. A lone direction on the other axis centers the
|
|
246
|
+
* box on its target here, since walking right from something keeps you on
|
|
247
|
+
* its center line. Two of them leave it open which target to center on, and
|
|
248
|
+
* that is refused rather than decided.
|
|
249
|
+
*/
|
|
250
|
+
private lone;
|
|
251
|
+
/**
|
|
252
|
+
* The stretch of this box a placement measures from, from the box's start:
|
|
253
|
+
* the part it names, or the whole box.
|
|
254
|
+
*/
|
|
255
|
+
private ownPart;
|
|
256
|
+
private overStated;
|
|
257
|
+
/** Every statement a node's placements make about one axis. */
|
|
258
|
+
private statements;
|
|
259
|
+
/** A direction with nothing said about its distance, which a pin on its axis may refine. */
|
|
260
|
+
private yields;
|
|
261
|
+
/**
|
|
262
|
+
* The sides that gave up their distance to a pin still have to hold: a box
|
|
263
|
+
* said to be below another, and pinned beside it, is refused.
|
|
264
|
+
*/
|
|
265
|
+
private checkYielded;
|
|
266
|
+
/**
|
|
267
|
+
* Two alignments pinning opposite edges: `top even with a bottom even with
|
|
268
|
+
* c` positions the box and sizes it, and counts as one statement.
|
|
269
|
+
*/
|
|
270
|
+
private pins;
|
|
271
|
+
/** The gap a placement leaves, in pixels. */
|
|
272
|
+
private gapOf;
|
|
273
|
+
/** The extent on one axis of what a placement names: one target, or the region bounding several. */
|
|
274
|
+
private region;
|
|
275
|
+
/**
|
|
276
|
+
* One target's extent on one axis, in the frame `node` is placed in: a
|
|
277
|
+
* point written out, a named point or region, a fraction of the way across
|
|
278
|
+
* a box, or a box and its part.
|
|
279
|
+
*/
|
|
280
|
+
private extentOf;
|
|
281
|
+
/**
|
|
282
|
+
* A fraction of the way across `whole` on its own axis (`3/4 down`, `1/3
|
|
283
|
+
* across from right`). On the other axis it is the side it runs along, or
|
|
284
|
+
* the whole box when it was written first.
|
|
285
|
+
*/
|
|
286
|
+
private alongFraction;
|
|
287
|
+
/** A named point or region, worked out in the frame `node` is placed in, with a region's padding. */
|
|
288
|
+
private namedExtent;
|
|
289
|
+
/** A point written out, on one axis. */
|
|
290
|
+
private pointExtent;
|
|
291
|
+
/**
|
|
292
|
+
* `between a and b`: the space between two things. On an axis where they are
|
|
293
|
+
* apart it is the gap, from `a`'s facing side to `b`'s; where they overlap,
|
|
294
|
+
* the stretch they share. As a point it is the middle of that, or `at` the
|
|
295
|
+
* fraction of the gap from `a`. As a region (`region` given) it is the whole
|
|
296
|
+
* of it, and `(span: both)` stretches it over both boxes where they overlap
|
|
297
|
+
* (design.org 4.2).
|
|
298
|
+
*/
|
|
299
|
+
private betweenOf;
|
|
300
|
+
/**
|
|
301
|
+
* `down from a and left from b`: where a line straight down from `a` meets
|
|
302
|
+
* one straight left from `b`. The words also say which way the point lies
|
|
303
|
+
* from each, and that is checked (design.org 4.3).
|
|
304
|
+
*/
|
|
305
|
+
private crossingOf;
|
|
306
|
+
/** A box, or a part of one, on one axis, in the frame `node` is placed in. */
|
|
307
|
+
private nodeExtent;
|
|
308
|
+
/** A node's text on one axis, given where the node starts. */
|
|
309
|
+
private textOf;
|
|
310
|
+
/** A child placed against its own container's box, which it does not grow. */
|
|
311
|
+
framed(node: LayoutNode): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* A child placed against its container's text, or against its heading,
|
|
314
|
+
* which makes the title its frame's anchor.
|
|
315
|
+
*/
|
|
316
|
+
private onTitle;
|
|
317
|
+
/** The stretch a container's text and what is joined to it cover, measured from the text's start. */
|
|
318
|
+
private unit;
|
|
319
|
+
/** Whether anything is joined to a container's text. */
|
|
320
|
+
private hasUnit;
|
|
321
|
+
/** How big a container's own text is on one axis, without what is joined to it. */
|
|
322
|
+
private textSize;
|
|
323
|
+
/**
|
|
324
|
+
* Whether a container's title anchors its frame, because a child is placed
|
|
325
|
+
* against it. A title placed against the children is a link between them
|
|
326
|
+
* instead, and the child it is placed against anchors the frame.
|
|
327
|
+
*/
|
|
328
|
+
private anchoredOnTitle;
|
|
329
|
+
/**
|
|
330
|
+
* The children a container's box is the outline of, besides its title: not
|
|
331
|
+
* its heading, not what is joined to its text, and not those placed against
|
|
332
|
+
* the box.
|
|
333
|
+
*/
|
|
334
|
+
private contentOf;
|
|
335
|
+
/** Whether a node has a title: its text, what is joined to it, or a heading. */
|
|
336
|
+
private hasTitle;
|
|
337
|
+
/** How big a container's title is on one axis: its heading, or its text with what is joined to it. */
|
|
338
|
+
private titleSize;
|
|
339
|
+
/**
|
|
340
|
+
* Where a container's title sits. A heading, or a text with something joined
|
|
341
|
+
* to it, over nothing else is centered, as a leaf's text is, unless its
|
|
342
|
+
* bracket says where.
|
|
343
|
+
*/
|
|
344
|
+
private titleOf;
|
|
345
|
+
/**
|
|
346
|
+
* A node's size: from two pinned edges, from its layout's stretching, or from
|
|
347
|
+
* what it states or holds. Each axis's size is stated once, so a size key
|
|
348
|
+
* beside pins or a stretching layout is refused.
|
|
349
|
+
*/
|
|
350
|
+
private workOutSize;
|
|
351
|
+
/** Whether a laid-out container sets its children's size on this axis. */
|
|
352
|
+
private stretches;
|
|
353
|
+
/** A node's size from what it states, or else what it holds, within its limits. */
|
|
354
|
+
private ownSize;
|
|
355
|
+
/** What a node's own contents make it, before anything stretches it. */
|
|
356
|
+
private naturalSize;
|
|
357
|
+
/** Work out one size key's value, in pixels. */
|
|
358
|
+
private measure;
|
|
359
|
+
private evaluate;
|
|
360
|
+
/** The box a size names. */
|
|
361
|
+
private sized;
|
|
362
|
+
/**
|
|
363
|
+
* `a top to c bottom`: the distance between two edges. Both are found in the
|
|
364
|
+
* frame of the innermost container holding them both, so a span between two
|
|
365
|
+
* children never waits on their container's box.
|
|
366
|
+
*/
|
|
367
|
+
private span;
|
|
368
|
+
/**
|
|
369
|
+
* Whether `named` sits inside a sibling within `frame`'s frame, with every
|
|
370
|
+
* container between them placed in that frame rather than by what it holds.
|
|
371
|
+
*/
|
|
372
|
+
private nestedInFrame;
|
|
373
|
+
/** Where a node starts in the frame of `frame`, one of its containers, or on the page when that is undefined. */
|
|
374
|
+
private within;
|
|
375
|
+
/**
|
|
376
|
+
* A container on one axis: its box in its own frame, and where its title
|
|
377
|
+
* sits. The box is the outline of what it holds, plus padding: the children
|
|
378
|
+
* not placed against the box itself, and the title when it sits inside the
|
|
379
|
+
* border or on it.
|
|
380
|
+
*/
|
|
381
|
+
private workOutFrame;
|
|
382
|
+
/**
|
|
383
|
+
* A container's box at the size it ends up, when something states one: its
|
|
384
|
+
* outline grown or shrunk so what it holds sits where gather-children: says,
|
|
385
|
+
* the middle unless it says, and its title moved with the side it keeps to. A title something
|
|
386
|
+
* is placed against is part of what it holds, and stays.
|
|
387
|
+
*/
|
|
388
|
+
private fit;
|
|
389
|
+
/** The title's placements that state one axis. */
|
|
390
|
+
private titleStatementsOn;
|
|
391
|
+
/** Whether the title's bracket places it on this axis with a placement. */
|
|
392
|
+
private titleStates;
|
|
393
|
+
/**
|
|
394
|
+
* Where a title placed against the box's own children starts on one axis,
|
|
395
|
+
* in the box's frame, or undefined when no placement states the axis and
|
|
396
|
+
* its side words place it (design.org 7.2). Each axis is stated once.
|
|
397
|
+
*/
|
|
398
|
+
private titlePlaced;
|
|
399
|
+
/** Where one placement of a title against the box's own children puts the title's start. */
|
|
400
|
+
private titleStart;
|
|
401
|
+
/** The padded-in block of a circle on the other axis, which its diameter depends on as well. */
|
|
402
|
+
private innerOther;
|
|
403
|
+
/**
|
|
404
|
+
* A child of a laid-out container: placed by the layout, in written order,
|
|
405
|
+
* and never by itself.
|
|
406
|
+
*/
|
|
407
|
+
private inLayout;
|
|
408
|
+
/** Which part of a venn a node is: 0 the left set, 1 the overlap, 2 the right set. */
|
|
409
|
+
private vennPart;
|
|
410
|
+
/** The outline of what a venn's part holds, in its own frame. The overlap's includes its title's width. */
|
|
411
|
+
private partContent;
|
|
412
|
+
/**
|
|
413
|
+
* Where each part's own frame sits in the venn's: what to add to a part's
|
|
414
|
+
* coordinates. Across, the left set's contents, the overlap's and the right
|
|
415
|
+
* set's in that order. The border between a pair is the crossing set's
|
|
416
|
+
* padding from what is inside it, and the venn's gap from what is outside it,
|
|
417
|
+
* as a box beside a container would be. Up and down, see `vennShift`.
|
|
418
|
+
*/
|
|
419
|
+
private vennPlan;
|
|
420
|
+
/**
|
|
421
|
+
* Where a part's frame sits in the venn's up and down. A part whose anchor
|
|
422
|
+
* is placed against a box in another part goes where that puts the anchor;
|
|
423
|
+
* the set that moves to line the two sets' tops or bottoms up goes there
|
|
424
|
+
* (`vennAlign`); otherwise its contents are centered on the line every
|
|
425
|
+
* unplaced part shares.
|
|
426
|
+
*/
|
|
427
|
+
private vennShift;
|
|
428
|
+
/**
|
|
429
|
+
* Which set moves to line up the two sets' tops or bottoms, and by which edge.
|
|
430
|
+
* `top even with` between the sets is a relation between them, not an order
|
|
431
|
+
* to move the one it's written on: only where they sit against each other
|
|
432
|
+
* shows, since the venn wraps them both. So the set it's written on moves,
|
|
433
|
+
* unless what it would move to meet moves with it (the overlap or the other
|
|
434
|
+
* set placed against it); then the other set moves, if nothing holds it.
|
|
435
|
+
* A stagger on a set whose contents are held in place says where its box
|
|
436
|
+
* goes, not its contents (`boxOnly`): the box starts there and still holds
|
|
437
|
+
* what it wraps.
|
|
438
|
+
*/
|
|
439
|
+
private vennAlign;
|
|
440
|
+
/** Whether a venn part moves with `part`: its anchor is placed against a box in `part`, directly or through the third part. */
|
|
441
|
+
private leansOn;
|
|
442
|
+
/** The part of the same venn that this part's anchor is placed against, if it has one. */
|
|
443
|
+
private anchorPart;
|
|
444
|
+
/** Whether `named` is a child of a different part of the venn `node`'s part belongs to. */
|
|
445
|
+
private inOtherPart;
|
|
446
|
+
/** A child of a venn's part placed against a box in another part, which `checkAnchors` lets only the part's anchor be. */
|
|
447
|
+
private acrossParts;
|
|
448
|
+
/** The overlap's contents in a set's own frame, which the set's box wraps as well as its own. */
|
|
449
|
+
private vennPhantom;
|
|
450
|
+
/** Where a venn's part starts in the venn's frame. */
|
|
451
|
+
private vennStart;
|
|
452
|
+
/** A venn's part's size: a set wraps what it holds, or takes the box `vennBox` gives it; the overlap is where they cross. */
|
|
453
|
+
private vennSize;
|
|
454
|
+
/**
|
|
455
|
+
* A set's box up and down in the venn's frame, where it is not just the
|
|
456
|
+
* outline round what it holds. With `heights: equal`, the span from the
|
|
457
|
+
* higher set's top to the lower one's bottom, which both boxes then cover,
|
|
458
|
+
* so they start and end together however their contents are lined up; a set
|
|
459
|
+
* staggered by `top even with 2 below …` keeps its stagger, its box the span
|
|
460
|
+
* moved by that much. A stagger that places only the box (`vennAlign`'s
|
|
461
|
+
* `boxOnly`) moves the side it names, and the box must still hold its contents.
|
|
462
|
+
*/
|
|
463
|
+
private vennBox;
|
|
464
|
+
/** Where a venn's two sets cross, in the venn's frame. */
|
|
465
|
+
private strip;
|
|
466
|
+
/**
|
|
467
|
+
* The overlap's frame: the strip where the sets cross, with no border of its
|
|
468
|
+
* own. Its title is centered across the strip, on the row of the title of
|
|
469
|
+
* the set whose top is lower, so the strip's contents start below it.
|
|
470
|
+
*/
|
|
471
|
+
private stripFrame;
|
|
472
|
+
/**
|
|
473
|
+
* Exactly one box in each frame says nothing about where it goes, and every
|
|
474
|
+
* other is placed against it, directly or through others. In a container a
|
|
475
|
+
* title something is placed against anchors the frame instead.
|
|
476
|
+
*/
|
|
477
|
+
private checkAnchors;
|
|
478
|
+
/**
|
|
479
|
+
* A box in a venn's part may be placed against a box in another part, and
|
|
480
|
+
* then it says where its whole part goes up and down: so it must be the
|
|
481
|
+
* part's anchor, say nothing else, and say nothing across, which is the venn's.
|
|
482
|
+
*/
|
|
483
|
+
private checkAcrossParts;
|
|
484
|
+
/** The text box, how far the node reaches past its own box, and the flags the renderer reads. */
|
|
485
|
+
private finish;
|
|
486
|
+
/**
|
|
487
|
+
* Where a leaf's text sits, from the leaf's top-left. Centered unless its
|
|
488
|
+
* bracket says a side, and then where a container's title would be: inside,
|
|
489
|
+
* on or outside that side, at the start, middle or end along it. A picture
|
|
490
|
+
* and a circle keep their text where their shape puts it.
|
|
491
|
+
*/
|
|
492
|
+
private leafText;
|
|
493
|
+
/**
|
|
494
|
+
* How far a node reaches past its own box on one axis: its title outside the
|
|
495
|
+
* border, and its children, with whatever they reach in turn. A container's
|
|
496
|
+
* outline holds what its children reach, so it is worked out as soon as a
|
|
497
|
+
* container asks, not after everything is placed.
|
|
498
|
+
*/
|
|
499
|
+
private reachOf;
|
|
500
|
+
}
|
|
501
|
+
export {};
|