reladraw 0.16.0 → 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 +810 -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/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 +1777 -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/ast.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ export declare const SIDE_AXIS: Record<Side, Axis>;
|
|
|
40
40
|
export declare const POSITIONS: readonly ["top-left", "top-center", "top-right", "left-center", "center", "right-center", "bottom-left", "bottom-center", "bottom-right"];
|
|
41
41
|
export type Position = (typeof POSITIONS)[number];
|
|
42
42
|
export declare function isPosition(word: string): word is Position;
|
|
43
|
+
/**
|
|
44
|
+
* For a missing name like `bin.left`, whose last part is a side or a point:
|
|
45
|
+
* the hint that the part is a separate word after the box's full name,
|
|
46
|
+
* `host.bin left`. `names` is every box's name; empty when there is no such box.
|
|
47
|
+
*/
|
|
48
|
+
export declare function partWordHint(name: string, names: Iterable<string>): string;
|
|
43
49
|
/**
|
|
44
50
|
* A part of a node that a placement may name: its text, one of its four sides,
|
|
45
51
|
* or one of its nine points. Written as a separate word after the node's name
|
|
@@ -88,7 +94,69 @@ export declare const BOUNDARY_PARTS: readonly string[];
|
|
|
88
94
|
export interface PlacementTarget {
|
|
89
95
|
name: string;
|
|
90
96
|
part?: Part;
|
|
97
|
+
/**
|
|
98
|
+
* How far along a side, or across the whole box: `server 3/4 down`,
|
|
99
|
+
* `3/4 down server` (design.org 4.7, 5.2). With a side, it is one point on
|
|
100
|
+
* that side; without, a line through the box on the fraction's axis.
|
|
101
|
+
*/
|
|
102
|
+
fraction?: Fraction;
|
|
103
|
+
/** A point written out rather than named: `between a and b`, `down from a and left from b`, `2 below c bottom`. */
|
|
104
|
+
point?: PointExpr;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A fraction of the way along: `3/4 down` and `1/4 up` run along a left or
|
|
108
|
+
* right side, `1/3 across` along a top or bottom one, counted from the left
|
|
109
|
+
* unless it says `from right`.
|
|
110
|
+
*/
|
|
111
|
+
export interface Fraction {
|
|
112
|
+
value: number;
|
|
113
|
+
along: 'down' | 'up' | 'across';
|
|
114
|
+
from?: 'left' | 'right';
|
|
115
|
+
/** As written, to quote back: `3/4 down`, `1/3 across from right`. */
|
|
116
|
+
written: string;
|
|
117
|
+
/** Written before the name (`3/4 down x`) rather than after it (`x 3/4 down`). */
|
|
118
|
+
first?: boolean;
|
|
91
119
|
}
|
|
120
|
+
/** The axis a fraction measures along. */
|
|
121
|
+
export declare function fractionAxis(fraction: Fraction): Axis;
|
|
122
|
+
/** The words that start a line from a thing, in `down from a and left from b`. */
|
|
123
|
+
export declare const WAYS: readonly ["up", "down", "left", "right"];
|
|
124
|
+
export type Way = (typeof WAYS)[number];
|
|
125
|
+
/**
|
|
126
|
+
* A point said in words (design.org 4.2–4.4). Every one is worked out from
|
|
127
|
+
* named things, so moving them moves it.
|
|
128
|
+
*/
|
|
129
|
+
export type PointExpr = {
|
|
130
|
+
kind: 'between';
|
|
131
|
+
a: PlacementTarget;
|
|
132
|
+
b: PlacementTarget;
|
|
133
|
+
/** `at 1/3`: that far across the gap, measured from `a`. Absent is halfway. */
|
|
134
|
+
at?: number;
|
|
135
|
+
atWritten?: string;
|
|
136
|
+
/** `(span: both)`: as a region, the gap stretched over both boxes on the other axis. */
|
|
137
|
+
span?: 'both';
|
|
138
|
+
} | {
|
|
139
|
+
kind: 'from';
|
|
140
|
+
/**
|
|
141
|
+
* The line giving the point its place across or up and down, in the
|
|
142
|
+
* order written. `even` is `even with x`: the level line through x,
|
|
143
|
+
* which says no way the point lies from it.
|
|
144
|
+
*/
|
|
145
|
+
lines: [{
|
|
146
|
+
way: Way | 'even';
|
|
147
|
+
target: PlacementTarget;
|
|
148
|
+
}, {
|
|
149
|
+
way: Way | 'even';
|
|
150
|
+
target: PlacementTarget;
|
|
151
|
+
}];
|
|
152
|
+
} | {
|
|
153
|
+
kind: 'moved';
|
|
154
|
+
distance: string;
|
|
155
|
+
direction: Direction;
|
|
156
|
+
from: PlacementTarget;
|
|
157
|
+
};
|
|
158
|
+
/** A point written out, as the author would write it. */
|
|
159
|
+
export declare function describePoint(point: PointExpr): string;
|
|
92
160
|
/**
|
|
93
161
|
* Naming more than one target places the node against the box that just bounds
|
|
94
162
|
* them all — `right of borg and bare` clears both. It is a single target that
|
|
@@ -121,6 +189,16 @@ export interface OffsetPlacement {
|
|
|
121
189
|
* that does not say. Absent means take the node's.
|
|
122
190
|
*/
|
|
123
191
|
gap?: string;
|
|
192
|
+
/**
|
|
193
|
+
* `3 below and 2 right of a`: a different distance on each axis, which
|
|
194
|
+
* stands in for `gap` (design.org 5.2).
|
|
195
|
+
*/
|
|
196
|
+
gaps?: Partial<Record<Axis, string>>;
|
|
197
|
+
/**
|
|
198
|
+
* `center 12 right of a center`: the part of this box the distance is
|
|
199
|
+
* measured from, rather than its facing side (design.org 5.2).
|
|
200
|
+
*/
|
|
201
|
+
own?: Part;
|
|
124
202
|
line: number;
|
|
125
203
|
}
|
|
126
204
|
/** `level with docker` — share a side or a center line, with no gap in between. */
|
|
@@ -181,6 +259,17 @@ export declare const PLACEMENT_KEYS: readonly ["gap"];
|
|
|
181
259
|
* range against each other.
|
|
182
260
|
*/
|
|
183
261
|
export declare const CONTENTS_KEYS: readonly ["widths", "align"];
|
|
262
|
+
/**
|
|
263
|
+
* What `layout: column (…)` and `layout: row (…)` take in their bracket.
|
|
264
|
+
* `align` is read only to be refused by name: it now means where along a side,
|
|
265
|
+
* and lining the children up is `align-children`.
|
|
266
|
+
*/
|
|
267
|
+
export declare const LAYOUT_KEYS: readonly ["gap", "widths", "align-children", "align", "centers", "heights"];
|
|
268
|
+
/**
|
|
269
|
+
* Where `gather-children:` puts a container's children in its spare room: a
|
|
270
|
+
* side, a corner, or the middle.
|
|
271
|
+
*/
|
|
272
|
+
export declare const GATHER_PLACES: readonly ["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"];
|
|
184
273
|
/**
|
|
185
274
|
* What `widths:` may say. `natural` is the default and is today's behavior.
|
|
186
275
|
* `match` is what `align: widths` did — every child as wide as the widest.
|
|
@@ -189,12 +278,14 @@ export declare const CONTENTS_KEYS: readonly ["widths", "align"];
|
|
|
189
278
|
*/
|
|
190
279
|
export declare const CONTENT_WIDTHS: readonly ["natural", "match", "fill"];
|
|
191
280
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* the divergence this scheme exists to remove.
|
|
281
|
+
* How `align-children:` lines laid-out children up with each other: in a
|
|
282
|
+
* column their left edges, middles or right edges; in a row their tops,
|
|
283
|
+
* middles or bottoms.
|
|
196
284
|
*/
|
|
197
|
-
export declare const
|
|
285
|
+
export declare const CHILD_ALIGNMENTS: {
|
|
286
|
+
readonly column: readonly ["left", "center", "right"];
|
|
287
|
+
readonly row: readonly ["top", "center", "bottom"];
|
|
288
|
+
};
|
|
198
289
|
/** How a placement reads back in the author's own words, for error messages. */
|
|
199
290
|
export declare function describePlacement(placement: Placement): string;
|
|
200
291
|
/** "borg", "hub text", "borg and bare" — as the author would write them. */
|
|
@@ -247,13 +338,15 @@ export declare const TEXT_KEYS: readonly ["color", "size", "wrap", "align", "at"
|
|
|
247
338
|
* it goes in one bracket, as the text's do. `line: red` stays as the short form
|
|
248
339
|
* of `line: (color: red)`, and both are stored under the bare `line` key.
|
|
249
340
|
*/
|
|
250
|
-
export declare const LINE_KEYS: readonly ["color", "path", "corners", "crossing", "pattern", "thickness"];
|
|
341
|
+
export declare const LINE_KEYS: readonly ["color", "path", "corners", "crossing", "pattern", "thickness", "curve", "turn", "step-out"];
|
|
251
342
|
/**
|
|
252
343
|
* The words each of the line's properties takes, the default first. Thickness
|
|
253
|
-
* takes a
|
|
344
|
+
* takes a multiple of normal (`2`) or pixels (`3px`) as well. `turn:` takes a fraction and
|
|
345
|
+
* `step-out:` a distance, so neither has a list.
|
|
254
346
|
*/
|
|
255
347
|
export declare const LINE_VALUES: {
|
|
256
|
-
readonly path: readonly ["
|
|
348
|
+
readonly path: readonly ["straight", "square", "curved"];
|
|
349
|
+
readonly curve: readonly ["normal", "strong", "subtle"];
|
|
257
350
|
readonly corners: readonly ["sharp", "rounded"];
|
|
258
351
|
readonly crossing: readonly ["gap", "none", "arc", "square"];
|
|
259
352
|
readonly pattern: readonly ["solid", "dashed", "dotted", "dash-dot"];
|
|
@@ -271,9 +364,13 @@ export interface NodeStmt {
|
|
|
271
364
|
statedText: boolean;
|
|
272
365
|
/** The text's bracketed modifiers, as written. Usually empty. */
|
|
273
366
|
textAttrs: Attrs;
|
|
367
|
+
/** Placements in the text's bracket, against the box's own children (design.org 7.2). */
|
|
368
|
+
titlePlacements?: Placement[];
|
|
274
369
|
/** Everything the author said about where this goes. Empty for the anchor. */
|
|
275
370
|
placements: Placement[];
|
|
276
371
|
attrs: Attrs;
|
|
372
|
+
/** `guide node frame ""`: does everything a node does except draw (design.org 8.1). */
|
|
373
|
+
guide?: boolean;
|
|
277
374
|
line: number;
|
|
278
375
|
}
|
|
279
376
|
/**
|
|
@@ -290,6 +387,61 @@ export type Mark = (typeof MARKS)[number];
|
|
|
290
387
|
* have none: nothing would explain itself, and `<>` is two arrows.
|
|
291
388
|
*/
|
|
292
389
|
export declare const MARK_GLYPHS: Record<'from' | 'to', Record<string, Mark>>;
|
|
390
|
+
/** A side of something, as a text's bracket names it: `above s1`, `right of edge`. */
|
|
391
|
+
export type TextSide = 'above' | 'below' | 'left of' | 'right of';
|
|
392
|
+
/**
|
|
393
|
+
* Where one text on a line sits, as its bracket says (design.org 7.3). Every
|
|
394
|
+
* field is optional: with nothing said the text shares the line with the
|
|
395
|
+
* other unplaced texts, spread evenly.
|
|
396
|
+
*/
|
|
397
|
+
export interface EdgeTextPlace {
|
|
398
|
+
/** `at: 1/4`, `at: 0.25`, `at: start`, `at: end`: a spot along the line, or along the leg `on` names. */
|
|
399
|
+
at?: number | 'start' | 'end';
|
|
400
|
+
/** `on: rise`: the named leg the text sits on. */
|
|
401
|
+
on?: string;
|
|
402
|
+
/** `on: longest level`: the line's longest piece running left to right, the first of two the same length. */
|
|
403
|
+
longestLevel?: boolean;
|
|
404
|
+
/** `straight right from c`: where a line that way from c's middle first meets this one. */
|
|
405
|
+
straight?: {
|
|
406
|
+
way: Way;
|
|
407
|
+
target: PlacementTarget;
|
|
408
|
+
written: string;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* `above s1`, `2 above s1`: a gap from the box, centered on it the other way, as a box
|
|
412
|
+
* placed so would be; with `onLine`, where the line first reaches that height or position across.
|
|
413
|
+
*/
|
|
414
|
+
by?: {
|
|
415
|
+
side: TextSide;
|
|
416
|
+
target: PlacementTarget;
|
|
417
|
+
written: string;
|
|
418
|
+
};
|
|
419
|
+
/** `on the line`: a text placed by a box stays on its line (design.org 7.3). */
|
|
420
|
+
onLine?: boolean;
|
|
421
|
+
/** `right of edge`: moved clear of the part of the line it landed on. */
|
|
422
|
+
beside?: TextSide;
|
|
423
|
+
/**
|
|
424
|
+
* `left even with x right`: one axis set by a box, at most one per axis; the
|
|
425
|
+
* other stays where the text would otherwise sit (design.org 7.3).
|
|
426
|
+
*/
|
|
427
|
+
even?: {
|
|
428
|
+
placement: AlignPlacement;
|
|
429
|
+
written: string;
|
|
430
|
+
}[];
|
|
431
|
+
/** `gap:` — from the node, for `at: start`/`end` and a text placed by a box. */
|
|
432
|
+
gap?: string;
|
|
433
|
+
/** `edge-gap:` — off the line, for a text beside it. */
|
|
434
|
+
edgeGap?: string;
|
|
435
|
+
/** `reads: up`, `down` or `along`. */
|
|
436
|
+
reads?: 'up' | 'down' | 'along';
|
|
437
|
+
}
|
|
438
|
+
/** One text on a line: what it says, how it looks, where it sits. */
|
|
439
|
+
export interface EdgeTextStmt {
|
|
440
|
+
text: string;
|
|
441
|
+
/** `color:`, `size:`, `wrap:` from its bracket. */
|
|
442
|
+
textAttrs: Attrs;
|
|
443
|
+
place: EdgeTextPlace;
|
|
444
|
+
}
|
|
293
445
|
/** The marks written in an edge's arrow, by end. An end with none written is absent. */
|
|
294
446
|
export interface EdgeMarks {
|
|
295
447
|
from?: Mark;
|
|
@@ -304,9 +456,8 @@ export interface EdgeStmt {
|
|
|
304
456
|
arrow: string;
|
|
305
457
|
/** The marks the arrow writes at each end: `->` is an arrow at `to`, `<-` one at `from`. */
|
|
306
458
|
marks: EdgeMarks;
|
|
307
|
-
text
|
|
308
|
-
|
|
309
|
-
textAttrs: Attrs;
|
|
459
|
+
/** `"1" (at: start) "places" "many" (at: end)`: each text in written order, with its own bracket (design.org 7.3). */
|
|
460
|
+
texts: EdgeTextStmt[];
|
|
310
461
|
/** `between desktop1 and laptop1` — the gap the line passes through. */
|
|
311
462
|
between?: Passage;
|
|
312
463
|
/**
|
|
@@ -316,9 +467,162 @@ export interface EdgeStmt {
|
|
|
316
467
|
* line is passing, as `between` does. Always `kind: 'offset'` with no gap.
|
|
317
468
|
*/
|
|
318
469
|
passes?: OffsetPlacement[];
|
|
470
|
+
/** `edge req client -> api`: the line's own name. */
|
|
471
|
+
name?: string;
|
|
472
|
+
/** `straight down`: the line leaves its start that way and stops at what it meets (design.org 6.2). */
|
|
473
|
+
straight?: Way;
|
|
474
|
+
/** `to: left, even with cat1`: what each end is even with, on the side its `from:`/`to:` names (6.2). */
|
|
475
|
+
evenWith?: {
|
|
476
|
+
from?: PlacementTarget[];
|
|
477
|
+
to?: PlacementTarget[];
|
|
478
|
+
};
|
|
479
|
+
/** `via: b top, between c and d, leg climb`: the places the line passes, in order (design.org 6.4). */
|
|
480
|
+
via?: ViaEntry[];
|
|
481
|
+
/** `edge each child of a -> b`: the end whose name is a container, one line per direct child of it (design.org 6.6). */
|
|
482
|
+
each?: 'from' | 'to';
|
|
483
|
+
/** `edge a -> b, c, d`: the end written as a list, and every name in it, one line to each (design.org 6.6). */
|
|
484
|
+
several?: {
|
|
485
|
+
side: 'from' | 'to';
|
|
486
|
+
names: string[];
|
|
487
|
+
};
|
|
319
488
|
attrs: Attrs;
|
|
489
|
+
/** `guide edge a -> b`: shapes nothing differently, and is drawn only when guides are shown. */
|
|
490
|
+
guide?: boolean;
|
|
320
491
|
line: number;
|
|
321
492
|
}
|
|
493
|
+
/** One place a line passes (design.org 6.4). */
|
|
494
|
+
export type ViaStop = {
|
|
495
|
+
/**
|
|
496
|
+
* `b top`, `server right 3/4 down`, `proxy`, `between c and d`, a named
|
|
497
|
+
* point or region: anything section 4 names. A part of a box is just
|
|
498
|
+
* outside it unless `on` or `inside` says otherwise.
|
|
499
|
+
*/
|
|
500
|
+
kind: 'place';
|
|
501
|
+
target: PlacementTarget;
|
|
502
|
+
mode: 'outside' | 'on' | 'inside';
|
|
503
|
+
gap?: string;
|
|
504
|
+
/** `via: trunk (after: z)`: this line's place in a bundle's order, which only a bundle has. */
|
|
505
|
+
order?: {
|
|
506
|
+
way: 'after' | 'before';
|
|
507
|
+
name: string;
|
|
508
|
+
};
|
|
509
|
+
written: string;
|
|
510
|
+
} | {
|
|
511
|
+
/** `via: trunk`: the whole length of a bundle, in this line's lane (6.6). Read from a place naming a bundle. */
|
|
512
|
+
kind: 'bundle';
|
|
513
|
+
bundle: string;
|
|
514
|
+
order?: {
|
|
515
|
+
way: 'after' | 'before';
|
|
516
|
+
name: string;
|
|
517
|
+
};
|
|
518
|
+
written: string;
|
|
519
|
+
} | {
|
|
520
|
+
kind: 'through';
|
|
521
|
+
region: string;
|
|
522
|
+
axis: 'horizontal' | 'vertical';
|
|
523
|
+
written: string;
|
|
524
|
+
} | {
|
|
525
|
+
kind: 'alongside';
|
|
526
|
+
way: 'above' | 'below' | 'left of' | 'right of';
|
|
527
|
+
leg: string;
|
|
528
|
+
gap?: string;
|
|
529
|
+
written: string;
|
|
530
|
+
} | {
|
|
531
|
+
/** `req at 1/3`, `req start`, `req end`, or a bare `req`, its middle: a point on a named line or leg. */
|
|
532
|
+
kind: 'online';
|
|
533
|
+
line: string;
|
|
534
|
+
at: number | 'start' | 'end';
|
|
535
|
+
/** `req b top`: the middle of where req runs along one of its own stops, written as that stop. */
|
|
536
|
+
along?: string;
|
|
537
|
+
written: string;
|
|
538
|
+
};
|
|
539
|
+
/** An entry in a `via:` list: a stop, a leg's name, or a leg's name and the run it names. */
|
|
540
|
+
export interface ViaEntry {
|
|
541
|
+
leg?: {
|
|
542
|
+
name: string;
|
|
543
|
+
attrs: Attrs;
|
|
544
|
+
};
|
|
545
|
+
stop?: ViaStop;
|
|
546
|
+
}
|
|
547
|
+
/** A stop written as the author would write it. */
|
|
548
|
+
export declare function describeStop(stop: ViaStop): string;
|
|
549
|
+
/**
|
|
550
|
+
* `point funnel between c2 and api at 2/3` — a point with a name, so several
|
|
551
|
+
* things can use it and moving it is one edit (design.org 4.5). Drawn as a dot.
|
|
552
|
+
*/
|
|
553
|
+
/**
|
|
554
|
+
* A point's or a region's text and its bracket (design.org 7.4). `place` holds
|
|
555
|
+
* the position words: a direction from the dot (`above-right`), or a side as a
|
|
556
|
+
* title says it (`outside top`).
|
|
557
|
+
*/
|
|
558
|
+
export interface MarkText {
|
|
559
|
+
text: string;
|
|
560
|
+
textAttrs: Record<string, string>;
|
|
561
|
+
}
|
|
562
|
+
export interface PointStmt {
|
|
563
|
+
kind: 'point';
|
|
564
|
+
name: string;
|
|
565
|
+
point: PlacementTarget;
|
|
566
|
+
text?: MarkText;
|
|
567
|
+
attrs: Attrs;
|
|
568
|
+
guide?: boolean;
|
|
569
|
+
line: number;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* `region r c bottom-left to d top-right`, or `region r between a and b` —
|
|
573
|
+
* a rectangle with a name and every part a box has (design.org 4.5). It
|
|
574
|
+
* bounds things without owning them, and is drawn as a tint (8.3).
|
|
575
|
+
*/
|
|
576
|
+
export interface RegionStmt {
|
|
577
|
+
kind: 'region';
|
|
578
|
+
name: string;
|
|
579
|
+
/** The two corners, in either order; or one `between`, which is a region of its own. */
|
|
580
|
+
corners: [PlacementTarget, PlacementTarget] | [PlacementTarget];
|
|
581
|
+
text?: MarkText;
|
|
582
|
+
attrs: Attrs;
|
|
583
|
+
guide?: boolean;
|
|
584
|
+
line: number;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* `bundle trunk via: through slot horizontal`: a shared path several lines
|
|
588
|
+
* travel together, built like a line with no ends (design.org 6.6). A line
|
|
589
|
+
* joins it with `via: trunk` and runs its whole length.
|
|
590
|
+
*/
|
|
591
|
+
export interface BundleStmt {
|
|
592
|
+
kind: 'bundle';
|
|
593
|
+
name: string;
|
|
594
|
+
/** A path out in space. A bundle has this or `between`, never both. */
|
|
595
|
+
via?: ViaEntry[];
|
|
596
|
+
/**
|
|
597
|
+
* `bundle calls a -> b`: between two boxes, the direct way unless its
|
|
598
|
+
* `from:`, `to:` or `line: (path: …)` route it as one line would go.
|
|
599
|
+
*/
|
|
600
|
+
between?: [string, string];
|
|
601
|
+
/**
|
|
602
|
+
* `layout: parallel (gap: tight)`, the default; `layout: collapsed`, a bus;
|
|
603
|
+
* or, between two boxes only, `layout: fan`, lanes widest apart at the middle.
|
|
604
|
+
*/
|
|
605
|
+
arrangement: 'parallel' | 'collapsed' | 'fan';
|
|
606
|
+
/** The gap between neighboring members of a parallel bundle, as written. */
|
|
607
|
+
gap?: string;
|
|
608
|
+
/** `order: y, z, x`: every member, in reading order across where the bundle starts. */
|
|
609
|
+
order?: string[];
|
|
610
|
+
/**
|
|
611
|
+
* `line:`, `from-mark:`, `to-mark:`: how a collapsed bundle's shared stretch
|
|
612
|
+
* is drawn; between two boxes, `from:`, `to:` and `line: (path: …)` route it.
|
|
613
|
+
*/
|
|
614
|
+
attrs: Attrs;
|
|
615
|
+
line: number;
|
|
616
|
+
}
|
|
617
|
+
/** What a bundle may say besides `via:`, `layout:` and `order:`. */
|
|
618
|
+
export declare const BUNDLE_KEYS: readonly ["via", "layout", "order", "line", "from-mark", "to-mark", "from", "to"];
|
|
619
|
+
/** What a point and a region may say. A region's padding pushes every edge out. */
|
|
620
|
+
export declare const POINT_KEYS: readonly ["style", "fill", "depth"];
|
|
621
|
+
/** Which way from its dot a point's text sits (design.org 7.4); the first is the default. */
|
|
622
|
+
export declare const POINT_TEXT_SIDES: readonly ["above", "below", "left", "right", "above-right", "above-left", "below-right", "below-left"];
|
|
623
|
+
/** What a point's or a region's text takes in its bracket besides its position words. */
|
|
624
|
+
export declare const MARK_TEXT_KEYS: readonly ["color", "size", "wrap", "align", "reads", "gap"];
|
|
625
|
+
export declare const REGION_KEYS: readonly ["style", "fill", "opacity", "border", "padding", "padding-top", "padding-right", "padding-bottom", "padding-left", "depth"];
|
|
322
626
|
/**
|
|
323
627
|
* `diagram background: #111111` — settings that belong to the drawing as a
|
|
324
628
|
* whole rather than to anything in it. It has no name because there is only
|
|
@@ -333,8 +637,10 @@ export interface DiagramStmt {
|
|
|
333
637
|
* The attributes a `diagram` statement understands. `text` takes a bracket,
|
|
334
638
|
* `text: (color: …)`, and sets the text color of everything at once — the
|
|
335
639
|
* theme has one text color, shared by nodes and edges, and this is that.
|
|
640
|
+
* `checks` takes a bracket too, `checks: (edge-crossings: on)`, turning kinds
|
|
641
|
+
* of finding on or off by name.
|
|
336
642
|
*/
|
|
337
|
-
export declare const DIAGRAM_KEYS: readonly ["theme", "background", "text"];
|
|
643
|
+
export declare const DIAGRAM_KEYS: readonly ["theme", "background", "text", "checks", "guides"];
|
|
338
644
|
/**
|
|
339
645
|
* `default leaf fill: #2e5d3a` — a style that applies to every thing of one
|
|
340
646
|
* kind without being named. The more specific wins: `node` covers every node,
|
|
@@ -347,7 +653,7 @@ export interface DefaultStmt {
|
|
|
347
653
|
attrs: Attrs;
|
|
348
654
|
line: number;
|
|
349
655
|
}
|
|
350
|
-
export declare const DEFAULT_TARGETS: readonly ["node", "leaf", "container", "edge"];
|
|
656
|
+
export declare const DEFAULT_TARGETS: readonly ["node", "leaf", "container", "edge", "guide node", "guide edge", "guide point", "guide region"];
|
|
351
657
|
export type DefaultTarget = (typeof DEFAULT_TARGETS)[number];
|
|
352
658
|
/**
|
|
353
659
|
* What each default may say. A default carries a style's vocabulary, less the
|
|
@@ -355,10 +661,12 @@ export type DefaultTarget = (typeof DEFAULT_TARGETS)[number];
|
|
|
355
661
|
*
|
|
356
662
|
* - A default names its kind, so it is strict where a style is permissive —
|
|
357
663
|
* `default edge fill:` can only be a mistake.
|
|
358
|
-
* - `badge:` gives a box a child, which makes it a container, so every leaf
|
|
359
|
-
* given one by `default leaf` or `default node` would stop being a leaf.
|
|
360
664
|
* - `icon:` draws a picture, and a picture cannot hold children, so it is a
|
|
361
665
|
* leaf's word and not a container's or every node's.
|
|
666
|
+
* - `heading:` names one node's own child, so it belongs to that node alone.
|
|
667
|
+
*
|
|
668
|
+
* `badge:` is every kind's: it makes the picture part of the label, a heading,
|
|
669
|
+
* and a heading doesn't make a leaf a container.
|
|
362
670
|
*/
|
|
363
671
|
export declare const DEFAULT_KEYS: Record<DefaultTarget, readonly string[]>;
|
|
364
672
|
/**
|
|
@@ -414,8 +722,8 @@ export type Kind = 'shape' | 'icon' | 'none' | 'edge';
|
|
|
414
722
|
* The exclusions are the whole of what this table decides, and each is a place
|
|
415
723
|
* the old silence hid something:
|
|
416
724
|
*
|
|
417
|
-
* - A node drawn as a picture, or with no body at all, takes no `fill
|
|
418
|
-
* `border:`. There is no outline for
|
|
725
|
+
* - A node drawn as a picture, or with no body at all, takes no `fill:`,
|
|
726
|
+
* `border:` or `corners:`. There is no outline for any of them to reach.
|
|
419
727
|
* - Neither of those takes `contents:` either, which says how a node's children
|
|
420
728
|
* sit, and neither may have any.
|
|
421
729
|
* - `shape:` and `icon:` each name the body, so each appears only on the kind it
|
|
@@ -424,7 +732,23 @@ export type Kind = 'shape' | 'icon' | 'none' | 'edge';
|
|
|
424
732
|
* - An edge takes no `gap:` or `overlap:`. Those are about where a box sits, and
|
|
425
733
|
* an edge is not placed — it joins two things that are.
|
|
426
734
|
*/
|
|
735
|
+
/** The keys that state a size; `size.ts` reads their values. */
|
|
736
|
+
export declare const SIZE_KEY_NAMES: readonly ["width", "height", "min-width", "max-width", "min-height", "max-height"];
|
|
737
|
+
/** `padding-right: 4`: one side's padding, over `padding:` on that side. */
|
|
738
|
+
export declare const PADDING_SIDES: readonly ["top", "right", "bottom", "left"];
|
|
739
|
+
export declare const PADDING_SIDE_KEYS: string[];
|
|
740
|
+
/** `right-edge-order: ae, ad, ac`: the lines on one side of a box, in reading order. */
|
|
741
|
+
export declare const EDGE_ORDER_KEYS: readonly ["top-edge-order", "bottom-edge-order", "left-edge-order", "right-edge-order"];
|
|
427
742
|
export declare const ATTR_KEYS: Record<Kind, readonly string[]>;
|
|
743
|
+
/**
|
|
744
|
+
* What a node's `corners:` takes, the default first: a box is drawn rounded
|
|
745
|
+
* unless it says otherwise. The same word and values as a line's `corners:`,
|
|
746
|
+
* whose default is the other one. It applies to every outline with corners — a
|
|
747
|
+
* rectangle and a document, whose fold stays as it is — and changes only the
|
|
748
|
+
* drawing, never where anything sits.
|
|
749
|
+
*/
|
|
750
|
+
export declare const NODE_CORNERS: readonly ["rounded", "sharp"];
|
|
751
|
+
export type NodeCorners = (typeof NODE_CORNERS)[number];
|
|
428
752
|
/**
|
|
429
753
|
* Every word that is an attribute *somewhere*, which is what separates a
|
|
430
754
|
* misspelling from a key written on the wrong kind of thing. The two deserve
|
|
@@ -458,7 +782,7 @@ export interface IconStmt {
|
|
|
458
782
|
pasted: boolean;
|
|
459
783
|
line: number;
|
|
460
784
|
}
|
|
461
|
-
export type Stmt = NodeStmt | EdgeStmt | StyleStmt | DiagramStmt | DefaultStmt | IconStmt;
|
|
785
|
+
export type Stmt = NodeStmt | EdgeStmt | StyleStmt | DiagramStmt | DefaultStmt | IconStmt | PointStmt | RegionStmt | BundleStmt;
|
|
462
786
|
export interface Document {
|
|
463
787
|
statements: Stmt[];
|
|
464
788
|
}
|