@squinch/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +41 -0
- package/dist/api.d.ts +91 -0
- package/dist/api.js +232 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +9 -0
- package/dist/diff/diff.d.ts +30 -0
- package/dist/diff/diff.js +365 -0
- package/dist/fonts.generated.d.ts +1 -0
- package/dist/fonts.generated.js +6 -0
- package/dist/grammar/parser.js +22 -0
- package/dist/grammar/parser.terms.js +115 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/layout/layout.d.ts +197 -0
- package/dist/layout/layout.js +1721 -0
- package/dist/metrics.d.ts +20 -0
- package/dist/metrics.generated.d.ts +4 -0
- package/dist/metrics.generated.js +4 -0
- package/dist/metrics.js +57 -0
- package/dist/model/build.d.ts +8 -0
- package/dist/model/build.js +1343 -0
- package/dist/model/packs.d.ts +13 -0
- package/dist/model/packs.js +29 -0
- package/dist/model/source.d.ts +10 -0
- package/dist/model/source.js +28 -0
- package/dist/model/suggest.d.ts +2 -0
- package/dist/model/suggest.js +24 -0
- package/dist/model/types.d.ts +226 -0
- package/dist/model/types.js +24 -0
- package/dist/packs/node-fs.d.ts +1 -0
- package/dist/packs/node-fs.js +37 -0
- package/dist/packs/registry.d.ts +61 -0
- package/dist/packs/registry.js +122 -0
- package/dist/packs/sanitize.d.ts +12 -0
- package/dist/packs/sanitize.js +127 -0
- package/dist/packs/sysGlyphs.d.ts +2 -0
- package/dist/packs/sysGlyphs.js +21 -0
- package/dist/render/adaptive.d.ts +13 -0
- package/dist/render/adaptive.js +112 -0
- package/dist/render/html/runtime.d.ts +1 -0
- package/dist/render/html/runtime.generated.d.ts +1 -0
- package/dist/render/html/runtime.generated.js +6 -0
- package/dist/render/html/runtime.js +362 -0
- package/dist/render/html.d.ts +39 -0
- package/dist/render/html.js +235 -0
- package/dist/render/svg.d.ts +75 -0
- package/dist/render/svg.js +1403 -0
- package/dist/render/validate.d.ts +4 -0
- package/dist/render/validate.js +9 -0
- package/dist/themes/index.d.ts +84 -0
- package/dist/themes/index.js +90 -0
- package/dist/view/dive.d.ts +55 -0
- package/dist/view/dive.js +57 -0
- package/dist/view/navigate.d.ts +38 -0
- package/dist/view/navigate.js +81 -0
- package/dist/view/resolve.d.ts +92 -0
- package/dist/view/resolve.js +591 -0
- package/fonts/inter-400.ttf +0 -0
- package/fonts/inter-500.ttf +0 -0
- package/fonts/inter-600.ttf +0 -0
- package/fonts/mono-400.ttf +0 -0
- package/metrics.json +510 -0
- package/package.json +89 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
export const
|
|
3
|
+
Comment = 1,
|
|
4
|
+
File = 2,
|
|
5
|
+
PackStmt = 4,
|
|
6
|
+
Ident = 5,
|
|
7
|
+
pack = 6,
|
|
8
|
+
from = 7,
|
|
9
|
+
String = 8,
|
|
10
|
+
PersonDecl = 9,
|
|
11
|
+
person = 10,
|
|
12
|
+
Tag = 11,
|
|
13
|
+
Container = 12,
|
|
14
|
+
system = 13,
|
|
15
|
+
container = 14,
|
|
16
|
+
NodeKind = 15,
|
|
17
|
+
external = 16,
|
|
18
|
+
datastore = 17,
|
|
19
|
+
ContainerBody = 20,
|
|
20
|
+
NodeDecl = 21,
|
|
21
|
+
IconRef = 23,
|
|
22
|
+
box = 25,
|
|
23
|
+
AttrBlock = 26,
|
|
24
|
+
Attr = 28,
|
|
25
|
+
Value = 30,
|
|
26
|
+
Number = 31,
|
|
27
|
+
Path = 32,
|
|
28
|
+
EdgeStmt = 33,
|
|
29
|
+
Arrow = 34,
|
|
30
|
+
PathList = 35,
|
|
31
|
+
ZoneDecl = 36,
|
|
32
|
+
zone = 37,
|
|
33
|
+
ZoneKind = 38,
|
|
34
|
+
ZoneBody = 39,
|
|
35
|
+
ContainsStmt = 40,
|
|
36
|
+
contains = 41,
|
|
37
|
+
FlowDecl = 42,
|
|
38
|
+
flow = 43,
|
|
39
|
+
FlowBody = 44,
|
|
40
|
+
FlowChain = 45,
|
|
41
|
+
View = 46,
|
|
42
|
+
view = 47,
|
|
43
|
+
ViewBody = 48,
|
|
44
|
+
TitleStmt = 49,
|
|
45
|
+
title = 50,
|
|
46
|
+
ThemeStmt = 51,
|
|
47
|
+
theme = 52,
|
|
48
|
+
ScopeStmt = 53,
|
|
49
|
+
scope = 54,
|
|
50
|
+
OnlyStmt = 55,
|
|
51
|
+
only = 56,
|
|
52
|
+
TargetList = 57,
|
|
53
|
+
Target = 58,
|
|
54
|
+
IncludeStmt = 59,
|
|
55
|
+
include = 60,
|
|
56
|
+
Star = 61,
|
|
57
|
+
ExcludeStmt = 63,
|
|
58
|
+
exclude = 64,
|
|
59
|
+
DetailStmt = 65,
|
|
60
|
+
detail = 66,
|
|
61
|
+
ExpandStmt = 67,
|
|
62
|
+
expand = 68,
|
|
63
|
+
ContextStmt = 69,
|
|
64
|
+
context = 70,
|
|
65
|
+
auto = 71,
|
|
66
|
+
off = 72,
|
|
67
|
+
HighlightStmt = 73,
|
|
68
|
+
highlight = 74,
|
|
69
|
+
ColorStmt = 75,
|
|
70
|
+
color = 76,
|
|
71
|
+
ShowStmt = 77,
|
|
72
|
+
show = 78,
|
|
73
|
+
descriptions = 79,
|
|
74
|
+
NoteStmt = 80,
|
|
75
|
+
note = 81,
|
|
76
|
+
NoteAnchor = 82,
|
|
77
|
+
RelPos = 83,
|
|
78
|
+
above = 86,
|
|
79
|
+
below = 87,
|
|
80
|
+
on = 88,
|
|
81
|
+
Corner = 89,
|
|
82
|
+
LegendStmt = 94,
|
|
83
|
+
legend = 95,
|
|
84
|
+
TitleBlockStmt = 96,
|
|
85
|
+
titleblock = 97,
|
|
86
|
+
LayoutBlock = 98,
|
|
87
|
+
layout = 99,
|
|
88
|
+
DirectionStmt = 100,
|
|
89
|
+
direction = 101,
|
|
90
|
+
down = 102,
|
|
91
|
+
right = 103,
|
|
92
|
+
LinesStmt = 104,
|
|
93
|
+
lines = 105,
|
|
94
|
+
DensityStmt = 106,
|
|
95
|
+
density = 107,
|
|
96
|
+
RowsStmt = 108,
|
|
97
|
+
rows = 109,
|
|
98
|
+
Rank = 112,
|
|
99
|
+
ColsStmt = 113,
|
|
100
|
+
cols = 114,
|
|
101
|
+
PlaceStmt = 115,
|
|
102
|
+
place = 116,
|
|
103
|
+
AlignStmt = 117,
|
|
104
|
+
align = 118,
|
|
105
|
+
RouteStmt = 119,
|
|
106
|
+
route = 120,
|
|
107
|
+
Side = 121,
|
|
108
|
+
north = 122,
|
|
109
|
+
south = 123,
|
|
110
|
+
east = 124,
|
|
111
|
+
west = 125,
|
|
112
|
+
to = 126,
|
|
113
|
+
ChannelStmt = 127,
|
|
114
|
+
channel = 128,
|
|
115
|
+
FileTheme = 129
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { VNode } from "../view/resolve.js";
|
|
2
|
+
import type { SModel, SView, Side, Diagnostic, Hue, ZoneKind, ZoneLabelPos } from "../model/types.js";
|
|
3
|
+
import type { ThemeFont } from "../themes/index.js";
|
|
4
|
+
/** The shelf strip along a card's bottom: child icons, `+N`, domain chip. */
|
|
5
|
+
export declare const SHELF_H = 30;
|
|
6
|
+
/** How far the stacked sheets bleed past a container, right and below. Not
|
|
7
|
+
* added to the node's size on purpose — see the comment at `canvasExtent`. */
|
|
8
|
+
export declare const SHEET_BLEED = 8;
|
|
9
|
+
/** Zone chip height (docs/design). Shared: the placer reserves it, the
|
|
10
|
+
* renderer fills it, and the chip straddles its border by half of it. */
|
|
11
|
+
export declare const CHIP_H = 22;
|
|
12
|
+
/** Room a note reserves for its leading glyph, gutter included. Shared: layout
|
|
13
|
+
* wraps text to what is left, the renderer draws the mark in it. */
|
|
14
|
+
export declare const NOTE_GUTTER = 19;
|
|
15
|
+
/** The pill a label will render as, measured with the layout's font — the
|
|
16
|
+
* single source of truth shared by the ELK reservation (here) and the
|
|
17
|
+
* renderer's pill text (svg.ts). If these two ever diverge, the reservation
|
|
18
|
+
* is for a different pill than the one drawn. Cap 240 mirrors computePills'
|
|
19
|
+
* maxW; the canvas-width term is unknowable before layout and only ever
|
|
20
|
+
* shrinks tiny diagrams, where a slightly generous reservation is harmless. */
|
|
21
|
+
export declare function pillDims(text: string, font: Pick<ThemeFont, "metrics" | "scale">): {
|
|
22
|
+
label: string;
|
|
23
|
+
w: number;
|
|
24
|
+
h: number;
|
|
25
|
+
};
|
|
26
|
+
/** The box a note will render as, and the lines inside it — the single source
|
|
27
|
+
* of truth shared by every path that places one (edge notes, layer notes, the
|
|
28
|
+
* candidate-ladder resolver) and by the renderer that draws it.
|
|
29
|
+
*
|
|
30
|
+
* It is one function because it was briefly two. The resolver kept its own
|
|
31
|
+
* copy of this arithmetic, so when notes gained a leading glyph only the
|
|
32
|
+
* other copy learned about the gutter: corner and `right-of` notes reserved a
|
|
33
|
+
* box 19px narrower than the text drawn into it, and the text ran out through
|
|
34
|
+
* the side. Exactly the failure `pillDims` exists to prevent, in the one
|
|
35
|
+
* place that had not been given the same treatment.
|
|
36
|
+
*
|
|
37
|
+
* The column narrows by the gutter and the box widens by it, so the text
|
|
38
|
+
* keeps its 12px right margin whatever the glyph does. */
|
|
39
|
+
export declare function noteBox(text: string, font: Pick<ThemeFont, "metrics" | "scale">): {
|
|
40
|
+
lines: string[];
|
|
41
|
+
w: number;
|
|
42
|
+
h: number;
|
|
43
|
+
};
|
|
44
|
+
export interface PNode extends VNode {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
w: number;
|
|
48
|
+
h: number;
|
|
49
|
+
rank: number;
|
|
50
|
+
}
|
|
51
|
+
export interface PPort {
|
|
52
|
+
edge: string;
|
|
53
|
+
node: string;
|
|
54
|
+
side: Side;
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
}
|
|
58
|
+
export interface PFrame {
|
|
59
|
+
path: string;
|
|
60
|
+
label: string;
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
w: number;
|
|
64
|
+
h: number;
|
|
65
|
+
color?: Hue;
|
|
66
|
+
/** Frame-chain nesting depth, outermost = 0. Counts *frames* only — a frame
|
|
67
|
+
* inside a zone is still depth 0 — because the renderer keys the recessed
|
|
68
|
+
* fill off it (depth 0 only; docs/notes/full-detail.md). */
|
|
69
|
+
depth: number;
|
|
70
|
+
}
|
|
71
|
+
export interface PZone {
|
|
72
|
+
id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
kind: ZoneKind;
|
|
75
|
+
icon?: {
|
|
76
|
+
pack: string;
|
|
77
|
+
id: string;
|
|
78
|
+
};
|
|
79
|
+
labelPos: ZoneLabelPos;
|
|
80
|
+
color?: Hue;
|
|
81
|
+
/** mono chip segment — a CIDR, an account id (SPEC §zones) */
|
|
82
|
+
detail?: string;
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
w: number;
|
|
86
|
+
h: number;
|
|
87
|
+
depth: number;
|
|
88
|
+
}
|
|
89
|
+
export interface PEdge {
|
|
90
|
+
id: string;
|
|
91
|
+
from: string;
|
|
92
|
+
to: string;
|
|
93
|
+
label?: string;
|
|
94
|
+
async: boolean;
|
|
95
|
+
animate?: import("../model/types.js").EdgeAnimate;
|
|
96
|
+
style?: "dashed" | "dotted";
|
|
97
|
+
count: number;
|
|
98
|
+
tags: string[];
|
|
99
|
+
color?: Hue;
|
|
100
|
+
heads: "one" | "both" | "none";
|
|
101
|
+
points: {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
}[];
|
|
105
|
+
/** Label space reserved by ELK at layout time (cross-rank edges). The pill
|
|
106
|
+
* is drawn exactly here — no search, no fallback, no way to collide: the
|
|
107
|
+
* room exists because the layout made it. Coplanar edges get theirs from
|
|
108
|
+
* the router (phase 2); until then they are undefined and the renderer's
|
|
109
|
+
* search still covers them. */
|
|
110
|
+
labelRect?: {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
w: number;
|
|
114
|
+
h: number;
|
|
115
|
+
};
|
|
116
|
+
/** Produced by the coplanar router rather than ELK. ELK's wires may cross a
|
|
117
|
+
* frame interior legitimately (it routes them around what it knows); ours
|
|
118
|
+
* must not cross anything, and the invariant sweep holds us to it. */
|
|
119
|
+
coplanar?: true;
|
|
120
|
+
}
|
|
121
|
+
export interface Positioned {
|
|
122
|
+
name: string;
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
nodes: PNode[];
|
|
126
|
+
edges: PEdge[];
|
|
127
|
+
ports: PPort[];
|
|
128
|
+
frames: PFrame[];
|
|
129
|
+
zones: PZone[];
|
|
130
|
+
flow?: {
|
|
131
|
+
label: string;
|
|
132
|
+
byEdge: Record<string, number[]>;
|
|
133
|
+
};
|
|
134
|
+
lines: "orthogonal" | "curved" | "straight";
|
|
135
|
+
/** Zone label chips: geometry only — colour is a theme concern and layout
|
|
136
|
+
* is theme-free (the adaptive contract shares one layout across palettes).
|
|
137
|
+
* Slid along their zone's border to the least-crossed spot, exactly the
|
|
138
|
+
* algorithm that lived in svg.ts. */
|
|
139
|
+
chips: {
|
|
140
|
+
x: number;
|
|
141
|
+
y: number;
|
|
142
|
+
w: number;
|
|
143
|
+
h: number;
|
|
144
|
+
label: string;
|
|
145
|
+
zone: string;
|
|
146
|
+
icon?: {
|
|
147
|
+
pack: string;
|
|
148
|
+
id: string;
|
|
149
|
+
};
|
|
150
|
+
/** mono segment text, and the width reserved for it — measured here so
|
|
151
|
+
* the renderer draws the segment the placer actually made room for */
|
|
152
|
+
detail?: string;
|
|
153
|
+
detailW?: number;
|
|
154
|
+
}[];
|
|
155
|
+
/** Flow badges, reserved for the FULL flow's step text. Walking a flow
|
|
156
|
+
* (`flowStep`) is a viewer concern: the renderer draws the walked subset
|
|
157
|
+
* right-aligned inside the reservation, so per-step text changes never move
|
|
158
|
+
* or collide with anything. */
|
|
159
|
+
badges: {
|
|
160
|
+
edgeId: string;
|
|
161
|
+
x: number;
|
|
162
|
+
y: number;
|
|
163
|
+
w: number;
|
|
164
|
+
h: number;
|
|
165
|
+
nums: number[];
|
|
166
|
+
}[];
|
|
167
|
+
/** Fully placed notes, in declaration order: the resolver lives in layout
|
|
168
|
+
* now. Text lines are pre-wrapped (font-derived, theme-free); style/colour
|
|
169
|
+
* stay the renderer's. */
|
|
170
|
+
notes?: {
|
|
171
|
+
i: number;
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
w: number;
|
|
175
|
+
h: number;
|
|
176
|
+
lines: string[];
|
|
177
|
+
leader?: {
|
|
178
|
+
x1: number;
|
|
179
|
+
y1: number;
|
|
180
|
+
x2: number;
|
|
181
|
+
y2: number;
|
|
182
|
+
};
|
|
183
|
+
}[];
|
|
184
|
+
/** Layout-reserved note boxes by view-note index — today the edge-anchored
|
|
185
|
+
* ones (second inline labels on their own elk edge). The resolver draws a
|
|
186
|
+
* reserved note exactly here and skips its candidate ladder. */
|
|
187
|
+
noteBoxes?: Map<number, {
|
|
188
|
+
x: number;
|
|
189
|
+
y: number;
|
|
190
|
+
w: number;
|
|
191
|
+
h: number;
|
|
192
|
+
}>;
|
|
193
|
+
}
|
|
194
|
+
export declare function layoutView(model: SModel, view: SView, font?: Pick<ThemeFont, "metrics" | "scale">): Promise<{
|
|
195
|
+
positioned: Positioned;
|
|
196
|
+
diagnostics: Diagnostic[];
|
|
197
|
+
}>;
|