Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

feat(erd): draw the table title alone and band every domain

mango791abcd91886
diff --git a/archify.zip b/archify.zip
index 551d7fe8..40e699ea 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/SKILL.md b/archify/SKILL.md
index 7d42209c..b19bf633 100644
--- a/archify/SKILL.md
+++ b/archify/SKILL.md
@@ -28,7 +28,7 @@ Use this path for ordinary generation. Read branch references only when their st
1. Choose `architecture`, `workflow`, `sequence`, `dataflow`, `lifecycle`, or `erd` from the question.
2. Use the exact schema and example paths in the Type router without listing their directories. Read [Authoring defaults](references/authoring-defaults.md) and the mode's example in a bounded batch separate from project documents and complete schemas so neither is truncated; recover any missing section before writing. For Architecture, use the matching showcase example. For Sequence, Dataflow, and Lifecycle, also read the mode and common schemas. Read the relevant schema definition before choosing any new field, enum, or constrained text, especially boundary kinds. Examples teach shape, not facts. Use fresh IDs, wording, and layout. Go directly to the candidate without preliminary help, doctor, starter validation, temporary diagrams, or output-path listing. Query brands only for an explicitly requested mark; read [Brand marks](references/brand-marks.md) for an unknown mark with a user-provided URL.
-3. Once the requested scope and, for a real codebase, [source evidence](references/repository-authoring.md) are covered, write the complete candidate directly without planning coordinates in prose. Choose Architecture abstraction and connected placement using Authoring defaults before coordinates: show the main user journey and necessary branches, preserve control roles and behavior-changing conditions, and leave enough room for actual relationship labels. No node, relationship, source, view, card, or boundary count is a target or ceiling. Use automatic routes first; add explicit routing only for necessary branch, return, supplied geometry, or measured repair. Set `meta.quality_profile` to `"showcase"` unless the user requests dense `standard`. For ERD, use a table-first layout: show every physical column in `entities[].attributes`, keep its SQL type and source comment, state every key role a column carries (`key` takes a role or a list, so a junction column is `["pk", "fk"]`), and never move columns into cards as a substitute for the table. Classify tables into functional domains before placement, give each domain a concise `tag`, and place its members in one contiguous non-interleaved run. A multi-domain schema reads best as one domain per column — each `tag` a vertical run — because the reader scales a wide canvas up to the reader width and shrinks a tall one until the page fits, so the wide arrangement is the one that stays complete and legible inside a laptop viewport. A schema-first ERD over roughly 8 tables or 50 fields is itself a dense map: author its first complete-field pass at `standard` and upgrade only once the layout still reads.
+3. Once the requested scope and, for a real codebase, [source evidence](references/repository-authoring.md) are covered, write the complete candidate directly without planning coordinates in prose. Choose Architecture abstraction and connected placement using Authoring defaults before coordinates: show the main user journey and necessary branches, preserve control roles and behavior-changing conditions, and leave enough room for actual relationship labels. No node, relationship, source, view, card, or boundary count is a target or ceiling. Use automatic routes first; add explicit routing only for necessary branch, return, supplied geometry, or measured repair. Set `meta.quality_profile` to `"showcase"` unless the user requests dense `standard`. For ERD, use a table-first layout: show every physical column in `entities[].attributes`, keep its SQL type and source comment, state every key role a column carries (`key` takes a role or a list, so a junction column is `["pk", "fk"]`), and never move columns into cards as a substitute for the table. Classify tables into functional domains before placement, give each domain a concise `tag`, and place its members in one solid block of grid cells — a single row, a single column, or a full block. A tagged table always needs `row`/`col`, because absolute coordinates have no grid cells and a domain whose tables do not fill one block cannot be drawn as a band: the renderer reports `erd/domain-not-drawn` instead of publishing a diagram that cannot name the domain. A multi-domain schema reads best as one domain per column — each `tag` a vertical run — because the reader scales a wide canvas up to the reader width and shrinks a tall one until the page fits, so the wide arrangement is the one that stays complete and legible inside a laptop viewport. A schema-first ERD over roughly 8 tables or 50 fields is itself a dense map: author its first complete-field pass at `standard` and upgrade only once the layout still reads.
4. Once the complete first candidate is written, run `finalize` directly. Its first gate is showcase validation; successful first drafts need no separate pre-validation. Keep the candidate unchanged while the command runs:
```bash
diff --git a/archify/examples/erd-orders-rendered.html b/archify/examples/erd-orders-rendered.html
index 0c75126c..e181b01e 100644
--- a/archify/examples/erd-orders-rendered.html
+++ b/archify/examples/erd-orders-rendered.html
@@ -5059,10 +5059,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<rect width="100%" height="100%" fill="url(#grid)" />
<!-- Domain bands (behind the routes so a channel is never washed out) -->
+ <g data-domain-band="accounts">
+ <rect x="20" y="22" width="264" height="142" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="30" y="35" class="t-muted" font-size="9" font-weight="700">accounts</text>
+ </g>
<g data-domain-band="checkout">
<rect x="332" y="22" width="603" height="202" rx="8" class="c-lane" stroke-width="1"/>
<text data-domain-label="" x="342" y="35" class="t-muted" font-size="9" font-weight="700">checkout</text>
</g>
+ <g data-domain-band="line items">
+ <rect x="664" y="236" width="278" height="182" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="674" y="249" class="t-muted" font-size="9" font-weight="700">line items</text>
+ </g>
<g data-domain-band="catalog">
<rect x="22" y="236" width="584" height="202" rx="8" class="c-lane" stroke-width="1"/>
<text data-domain-label="" x="32" y="249" class="t-muted" font-size="9" font-weight="700">catalog</text>
@@ -5091,8 +5099,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="62" y="59" class="t-primary" font-size="13" font-weight="700">customer</text>
- <text data-detail="context" x="260" y="59" class="er-type" font-size="10" text-anchor="end">accounts</text>
+ <text data-node-label="" x="152" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">customer</text>
<line x1="32" y1="70" x2="272" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="32" y1="70" x2="272" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5129,7 +5136,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="374" y="59" class="t-primary" font-size="13" font-weight="700">order</text>
+ <text data-node-label="" x="474" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">order</text>
<line x1="344" y1="70" x2="604" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="344" y1="70" x2="604" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5184,8 +5191,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="706" y="273" class="t-primary" font-size="13" font-weight="700">order_item</text>
- <text data-detail="context" x="918" y="273" class="er-type" font-size="10" text-anchor="end">line items</text>
+ <text data-node-label="" x="803" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">order_item</text>
<line x1="676" y1="284" x2="930" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="676" y1="284" x2="930" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5234,7 +5240,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="384" y="273" class="t-primary" font-size="13" font-weight="700">product</text>
+ <text data-node-label="" x="474" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">product</text>
<line x1="354" y1="284" x2="594" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="354" y1="284" x2="594" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5289,7 +5295,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="64" y="273" class="t-primary" font-size="13" font-weight="700">inventory</text>
+ <text data-node-label="" x="152" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">inventory</text>
<line x1="34" y1="284" x2="270" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="34" y1="284" x2="270" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5338,7 +5344,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="713" y="59" class="t-primary" font-size="13" font-weight="700">payment</text>
+ <text data-node-label="" x="803" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment</text>
<line x1="683" y1="70" x2="923" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="683" y1="70" x2="923" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
diff --git a/archify/examples/subscription-billing-rendered.html b/archify/examples/subscription-billing-rendered.html
index 83c0a79f..65e0d4c9 100644
--- a/archify/examples/subscription-billing-rendered.html
+++ b/archify/examples/subscription-billing-rendered.html
@@ -5105,7 +5105,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="67" y="59" class="t-primary" font-size="13" font-weight="700">tenant</text>
+ <text data-node-label="" x="157" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">tenant</text>
<line x1="37" y1="70" x2="277" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="37" y1="70" x2="277" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5148,7 +5148,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="67" y="261" class="t-primary" font-size="13" font-weight="700">user_account</text>
+ <text data-node-label="" x="157" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">user_account</text>
<line x1="37" y1="272" x2="277" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="37" y1="272" x2="277" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5197,7 +5197,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="62" y="483" class="t-primary" font-size="13" font-weight="700">membership</text>
+ <text data-node-label="" x="157" y="483" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">membership</text>
<line x1="32" y1="494" x2="282" y2="494" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="32" y1="494" x2="282" y2="494" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5240,7 +5240,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="692" y="59" class="t-primary" font-size="13" font-weight="700">plan</text>
+ <text data-node-label="" x="782" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">plan</text>
<line x1="662" y1="70" x2="902" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="662" y1="70" x2="902" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5283,7 +5283,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="692" y="261" class="t-primary" font-size="13" font-weight="700">price</text>
+ <text data-node-label="" x="782" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">price</text>
<line x1="662" y1="272" x2="902" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="662" y1="272" x2="902" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5326,7 +5326,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="382" y="59" class="t-primary" font-size="13" font-weight="700">subscription</text>
+ <text data-node-label="" x="472" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">subscription</text>
<line x1="352" y1="70" x2="592" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="352" y1="70" x2="592" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5381,7 +5381,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="376" y="261" class="t-primary" font-size="13" font-weight="700">invoice</text>
+ <text data-node-label="" x="472" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">invoice</text>
<line x1="346" y1="272" x2="598" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="346" y1="272" x2="598" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5442,7 +5442,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="377" y="483" class="t-primary" font-size="13" font-weight="700">invoice_line</text>
+ <text data-node-label="" x="472" y="483" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">invoice_line</text>
<line x1="347" y1="494" x2="597" y2="494" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="347" y1="494" x2="597" y2="494" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5491,7 +5491,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="996" y="59" class="t-primary" font-size="13" font-weight="700">payment_method</text>
+ <text data-node-label="" x="1086" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment_method</text>
<line x1="966" y1="70" x2="1206" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="966" y1="70" x2="1206" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5540,7 +5540,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="996" y="261" class="t-primary" font-size="13" font-weight="700">payment</text>
+ <text data-node-label="" x="1086" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment</text>
<line x1="966" y1="272" x2="1206" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="966" y1="272" x2="1206" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5589,7 +5589,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="996" y="483" class="t-primary" font-size="13" font-weight="700">refund</text>
+ <text data-node-label="" x="1086" y="483" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">refund</text>
<line x1="966" y1="494" x2="1206" y2="494" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="966" y1="494" x2="1206" y2="494" class="c-grid er-row-rule" stroke-width="0.5"/>
diff --git a/archify/references/authoring-contract.md b/archify/references/authoring-contract.md
index 5089e44c..c1666c54 100644
--- a/archify/references/authoring-contract.md
+++ b/archify/references/authoring-contract.md
@@ -327,13 +327,17 @@ replace a field list.
Before placing boxes, classify tables into functional domains using verified table
names, comments, module paths, and foreign-key meaning. Put the domain name in
-`tag` and give each domain one contiguous run of grid cells: a single row with
-adjacent columns, or a single column with adjacent rows. All tables with the same
-tag stay together; do not interleave unrelated tables between members. A domain
-that forms one such run is drawn as a labelled band behind its tables, so the
+`tag` and give each domain one solid block of grid cells: a single row, a single
+column, or a full block, with every cell of the block holding one of its tables.
+All tables with the same tag stay together; do not interleave unrelated tables
+between members. A domain that fills one such block is drawn as a labelled band
+behind its tables, so the
grouping is visible without reading every box;
-a tag spread across the canvas earns no band and stays in that table's header
-instead, which is also how a single-table domain reads. Order parent/core tables
+a tag whose tables do not fill one block earns no band, and because the band is
+the only place a domain name is drawn the renderer reports `erd/domain-not-drawn`
+rather than publishing a diagram that cannot name the domain. Absolute
+coordinates have no grid cells at all, so a tagged table always needs `row`/`col`.
+Order parent/core tables
toward the shared boundary and
place their direct children beside or beneath them. Columns read left to right and
rows read top to bottom, so a relationship between neighbouring columns is one
diff --git a/archify/renderers/erd/README.md b/archify/renderers/erd/README.md
index 2cee4416..934f6265 100644
--- a/archify/renderers/erd/README.md
+++ b/archify/renderers/erd/README.md
@@ -113,25 +113,34 @@ text cannot fit inside the declared entity width.
## Domain bands
`tag` names a table's functional domain, and a domain is drawn as a band when the
-tables carrying that tag occupy a contiguous run of grid cells — one row with
-adjacent columns, or one column with adjacent rows. The band is measured from the
-placed boxes and carries the tag as its caption, which is what makes a grouped
-schema readable at a glance: the reader sees blocks instead of six equally
-weighted boxes.
-
-A tag spread across the canvas earns no band, because a band around the gap would
-claim a grouping the placement contradicts; that tag stays in the table header
-instead, together with any `sublabel`. A single-table domain always reads that
-way. `sublabel` is the per-table note and is never drawn on a band.
-
-The title and header note share the measured width of the header. The note
-stays right-aligned with a clear gap from the left-aligned title. If both cannot
-fit at readable sizes, the renderer returns `erd/header-text-capacity` rather
-than hiding authored information. Widen the table, shorten its title or note,
-or explicitly set `layout.headerH` to at least 40 to allow a second line.
-Existing header and entity dimensions are preserved unless the author changes
-them. Banded tables still show the domain on the band rather than repeating it
-in the header.
+tables carrying that tag fill a solid block of grid cells — every cell of their
+bounding box holds one of them. A single row, a single column, and a block are
+all that same claim, and a one-table domain is that claim at its smallest. The
+band is measured from the placed boxes and carries the tag as its caption, which
+is what makes a grouped schema readable at a glance: the reader sees blocks
+instead of six equally weighted boxes.
+
+A tag whose members do not fill one block earns no band, because a band around
+them would enclose cells the domain does not own and claim a grouping the
+placement contradicts. The band is the only place a domain name is drawn, so the
+renderer returns `erd/domain-not-drawn` rather than publishing a diagram whose
+tables are complete and whose domain cannot be named. Move the members into one
+block, split the tag, or drop it. The same diagnostic covers the other ways the
+name can go missing: a member placed outside the grid, because a band is measured
+from cells and absolute coordinates have none; two members in one cell, which the
+grid placement check reports instead so the author gets the pair that has to move;
+a band whose padding would cover an unrelated table, which happens when
+`layout.gapX`/`gapY` are smaller than the padding; and a caption the canvas does
+not reach, which a `layout.origin` closer to the edge than the padding produces.
+
+The header carries the table title alone. It is centered on the table's own
+center line and held inside the interval it is measured against — the sigil porch
+on the left, the padding on the right — so it does not run past either while the
+shared text model's advance estimate holds. A title that cannot fit the header at
+a readable size raises `erd/header-text-capacity`; widen the table or shorten the
+title. Existing header and entity dimensions are preserved unless the author
+changes them. An authored `sublabel` is not drawn: it stays on the node as
+`data-node-sublabel` and in the accessible name.
## Cardinality ink
diff --git a/archify/renderers/erd/render-erd.mjs b/archify/renderers/erd/render-erd.mjs
index 92f05b18..f14db426 100644
--- a/archify/renderers/erd/render-erd.mjs
+++ b/archify/renderers/erd/render-erd.mjs
@@ -77,8 +77,6 @@ const layout = {
rowFontMinimum: 9,
typeFont: 10.5,
typeFontMinimum: 9,
- detailPreferred: 10,
- detailMinimum: 8,
minRelationshipLength: 24,
};
@@ -162,22 +160,35 @@ const relationships = asArray(er.relationships);
// A `tag` names a domain, and a domain has to read as one block. The band is
// measured from the placed boxes of the entities that carry the tag, so it
// follows the authored grid instead of introducing a second layout pass. Only a
-// run that is genuinely contiguous (one row with adjacent columns, or one column
-// with adjacent rows) earns a band: a tag whose members are spread across the
-// canvas is a grouping the author did not actually make, and drawing a band
-// around the gap would claim a structure the table placement contradicts. A
-// single-member or scattered tag still shows in its table's header note.
+// block the members actually fill earns a band: a tag whose members are spread
+// across the canvas is a grouping the author did not actually make, and drawing
+// a band around the gap would claim a structure the table placement contradicts.
+// Since the band is the only place a domain name is drawn, an unbandable tag is
+// refused rather than published unnamed; see `erd/domain-not-drawn`.
const DOMAIN_PAD_X = 12;
const DOMAIN_PAD_TOP = 18;
const DOMAIN_PAD_BOTTOM = 8;
+// A domain is drawn as a band when its members fill a solid block of grid cells:
+// every cell of the bounding box holds one of them, so the band encloses no cell
+// the domain does not own. A single row or column, the common case, is that same
+// claim with one dimension of one.
function gridRunIsContiguous(members) {
- const cols = [...new Set(members.map((entity) => entity.col))].sort((a, b) => a - b);
- const rows = [...new Set(members.map((entity) => entity.row))].sort((a, b) => a - b);
- const adjacent = (values) => values.every((value, index) => index === 0 || value === values[index - 1] + 1);
- if (rows.length === 1) return adjacent(cols);
- if (cols.length === 1) return adjacent(rows);
- return false;
+ const cols = members.map((entity) => entity.col);
+ const rows = members.map((entity) => entity.row);
+ const cells = new Set(members.map((entity) => `${entity.row}:${entity.col}`));
+ if (cells.size !== members.length) return false;
+ const box = (Math.max(...cols) - Math.min(...cols) + 1) * (Math.max(...rows) - Math.min(...rows) + 1);
+ return cells.size === box;
+}
+
+// A band is measured from grid cells, so it can only follow a table that is
+// placed by them. A table that also declares `pos` is drawn at that point
+// whatever its cells say, and banding it would wrap a box the domain does not
+// own around wherever the author put it.
+function placedByGrid(entity) {
+ return Number.isInteger(entity.row) && Number.isInteger(entity.col)
+ && !(Array.isArray(entity.pos) && entity.pos.length === 2);
}
const domainGroups = (() => {
@@ -189,30 +200,67 @@ const domainGroups = (() => {
}
const groups = [];
for (const [tag, members] of byTag) {
- if (members.length < 2) continue;
- if (!members.every((entity) => Number.isInteger(entity.row) && Number.isInteger(entity.col))) continue;
+ if (!members.every(placedByGrid)) continue;
if (!gridRunIsContiguous(members)) continue;
groups.push({ tag, members });
}
return groups;
})();
-const bandedEntityIds = new Set(domainGroups.flatMap((group) => group.members.map((entity) => entity.id)));
+// A band is the only place a domain name is drawn, because the header carries
+// the table title alone. A tag whose members cannot form one therefore loses its
+// name from the canvas while the tables look complete, so the render refuses the
+// document instead of drawing a domain the reader cannot name.
+const unlabelableDomains = (() => {
+ const banded = new Set(domainGroups.map((group) => group.tag));
+ const byTag = new Map();
+ for (const entity of entities.values()) {
+ if (!entity.tag || banded.has(entity.tag)) continue;
+ if (!byTag.has(entity.tag)) byTag.set(entity.tag, []);
+ byTag.get(entity.tag).push(entity);
+ }
+ return [...byTag.entries()].map(([tag, members]) => {
+ const gridPlaced = members.every(placedByGrid);
+ // Two members can share a cell, which the grid placement check already
+ // reports with the pair that has to move; do not also blame the block.
+ const sharedCell = gridPlaced
+ && new Set(members.map((entity) => `${entity.row}:${entity.col}`)).size !== members.length;
+ return {
+ tag,
+ members,
+ reason: sharedCell ? 'shared-cell' : gridPlaced ? 'scattered' : 'no-grid',
+ offGrid: members.filter((entity) => !placedByGrid(entity)).map((entity) => entity.id),
+ };
+ });
+})();
+
+// The band box and the caption the band draws, measured once so the drawing and
+// the capacity check cannot disagree about where the domain name lands.
+function domainBandBox(members) {
+ const minX = Math.min(...members.map((entity) => entity.x));
+ const minY = Math.min(...members.map((entity) => entity.y));
+ const maxX = Math.max(...members.map((entity) => entity.x + entity.width));
+ const maxY = Math.max(...members.map((entity) => entity.y + entity.height));
+ return {
+ x: minX - DOMAIN_PAD_X,
+ y: minY - DOMAIN_PAD_TOP,
+ width: maxX - minX + DOMAIN_PAD_X * 2,
+ height: maxY - minY + DOMAIN_PAD_TOP + DOMAIN_PAD_BOTTOM,
+ };
+}
+
+function domainBandCaption(box) {
+ return { x: box.x + 10, y: box.y + 13 };
+}
function renderDomainBands() {
if (!domainGroups.length) return '';
return domainGroups.map(({ tag, members }) => {
- const minX = Math.min(...members.map((entity) => entity.x));
- const minY = Math.min(...members.map((entity) => entity.y));
- const maxX = Math.max(...members.map((entity) => entity.x + entity.width));
- const maxY = Math.max(...members.map((entity) => entity.y + entity.height));
- const x = minX - DOMAIN_PAD_X;
- const y = minY - DOMAIN_PAD_TOP;
- const width = maxX - minX + DOMAIN_PAD_X * 2;
- const height = maxY - minY + DOMAIN_PAD_TOP + DOMAIN_PAD_BOTTOM;
+ const box = domainBandBox(members);
+ const caption = domainBandCaption(box);
return ` <g data-domain-band="${esc(tag)}">
- <rect x="${x}" y="${y}" width="${width}" height="${height}" rx="8" class="c-lane" stroke-width="1"/>
- <text data-domain-label="" x="${x + 10}" y="${y + 13}" class="t-muted" font-size="9" font-weight="700">${esc(tag)}</text>
+ <rect x="${box.x}" y="${box.y}" width="${box.width}" height="${box.height}" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="${caption.x}" y="${caption.y}" class="t-muted" font-size="9" font-weight="700">${esc(tag)}</text>
</g>`;
}).join('\n');
}
@@ -830,59 +878,99 @@ function rowTextWidths(attribute) {
return { name, type };
}
-// Measure the title and note together: each owns a disjoint interval rather
-// than independently fitting against the entire header. A second line is only
-// possible when the author's existing header has enough height; never resize
-// the table or hide an explicit note to make it pass.
+// The header carries one string: the table title. A domain that earns a band is
+// named by the band, and a tagged table the renderer cannot band is refused
+// outright, so nothing depends on the header to carry a name.
function entityHeader(entity) {
- const detail = entity.sublabel ?? (bandedEntityIds.has(entity.id) ? undefined : entity.tag);
const titleInset = 30;
const titleWidth = entity.width - titleInset - layout.padX;
- const advance = (text, font) => textUnits(text) * font * nodeTextFit.widthFactor;
- let detailFont = detail ? layout.detailPreferred : 0;
- let labelFont = fittedNodeFontSize(entity.label, titleWidth + nodeTextFit.horizontalPadding, layout.headerFont, layout.headerFontMinimum);
- const labelY = 19;
- let detailY = labelY;
- let detailWidth = detail ? advance(detail, detailFont) : 0;
- if (detail) {
- const gap = 12;
- const minLabelWidth = advance(entity.label, layout.headerFontMinimum);
- const noteCapacity = titleWidth - minLabelWidth - gap;
- detailFont = fittedNodeFontSize(detail, noteCapacity + nodeTextFit.horizontalPadding, layout.detailPreferred, layout.detailMinimum);
- detailWidth = advance(detail, detailFont);
- labelFont = fittedNodeFontSize(entity.label, titleWidth - detailWidth - gap + nodeTextFit.horizontalPadding, layout.headerFont, layout.headerFontMinimum);
- if (advance(entity.label, labelFont) + detailWidth + gap > titleWidth) {
- if (metrics.headerH >= 40) {
- labelFont = fittedNodeFontSize(entity.label, titleWidth + nodeTextFit.horizontalPadding, layout.headerFont, layout.headerFontMinimum);
- detailFont = fittedNodeFontSize(detail, titleWidth + nodeTextFit.horizontalPadding, layout.detailPreferred, layout.detailMinimum);
- detailWidth = advance(detail, detailFont);
- detailY = 33;
- } else return { problem: true, detail, titleWidth };
- }
- }
- if (advance(entity.label, labelFont) > titleWidth || detailWidth > titleWidth) {
- return { problem: true, detail, titleWidth };
- }
- return { detail, labelFont, detailFont, labelY, detailY, titleInset };
+ const labelFont = fittedNodeFontSize(entity.label, titleWidth + nodeTextFit.horizontalPadding, layout.headerFont, layout.headerFontMinimum);
+ const labelWidth = textUnits(entity.label) * labelFont * nodeTextFit.widthFactor;
+ if (labelWidth > titleWidth) return { problem: true, titleWidth };
+ // The title is centered on the table's own center line. It is measured against
+ // a narrower interval than the box — the sigil porch on the left, the padding
+ // on the right — so a title that nearly fills that interval is held inside it
+ // rather than left to reach either edge.
+ const leftEdge = entity.x + titleInset;
+ const rightEdge = leftEdge + titleWidth;
+ const labelX = Math.round(Math.min(Math.max(entity.x + entity.width / 2, leftEdge + labelWidth / 2), rightEdge - labelWidth / 2) * 10) / 10;
+ return { labelFont, labelY: 19, labelX };
}
function validateEr() {
const problems = [];
const headerDetails = [];
+ const domainDetails = [];
for (const entity of entities.values()) {
const header = entityHeader(entity);
if (!header.problem) continue;
- const message = `Entity "${entity.id}" title and header note do not fit at readable sizes — widen the entity, shorten the text, or increase layout.headerH to at least 40 for a second line.`;
+ const message = `Entity "${entity.id}" title does not fit the header at a readable size — widen the entity or shorten the title.`;
problems.push(message);
headerDetails.push({
code: 'erd/header-text-capacity', severity: 'error', message,
subject: { diagramType: 'erd', entityId: entity.id },
- evidence: { label: entity.label, detail: header.detail, availableWidth: header.titleWidth, headerHeight: metrics.headerH },
- supportedFixes: ['Widen the entity.', 'Shorten the title or header note.', 'Increase layout.headerH to at least 40 for a second line.'],
+ evidence: { label: entity.label, availableWidth: header.titleWidth, headerHeight: metrics.headerH },
+ supportedFixes: ['Widen the entity.', 'Shorten the title.'],
+ });
+ }
+ for (const domain of unlabelableDomains) {
+ // A shared cell is already reported by the grid placement check, with the
+ // pair that has to move; blaming the block as well would give the author two
+ // fixes for one mistake.
+ if (domain.reason === 'shared-cell') continue;
+ const members = domain.members.map((entity) => entity.id);
+ const listed = members.map((id) => `"${id}"`).join(', ');
+ const offGrid = domain.offGrid.map((id) => `"${id}"`).join(', ');
+ const message = domain.reason === 'no-grid'
+ ? `Domain "${domain.tag}" is named but cannot be drawn: ${offGrid} have no grid cells, and a band is measured from them. Give every member row/col cells, or drop the tag.`
+ : `Domain "${domain.tag}" is named but cannot be drawn: ${listed} do not fill a solid block of grid cells, and a band around them would enclose cells the domain does not own. Move them into one block, or split the tag.`;
+ problems.push(message);
+ domainDetails.push({
+ code: 'erd/domain-not-drawn', severity: 'error', message,
+ subject: { diagramType: 'erd', entityId: members[0], domain: domain.tag },
+ evidence: { domain: domain.tag, entities: members, reason: domain.reason, offGrid: domain.offGrid },
+ supportedFixes: domain.reason === 'no-grid'
+ ? ['Give every domain member row/col cells.', 'Drop the tag to group nothing.']
+ : ['Give the domain members one solid block of grid cells.', 'Split the tag so each domain can be drawn as a band.', 'Drop the tag to group nothing.'],
+ });
+ }
+ // The band draws the domain name, so a band the canvas cannot show would put
+ // the domain back to unnamed. The caption is what has to land inside; it sits
+ // a few units into the band from its top-left corner.
+ for (const { tag, members } of domainGroups) {
+ const caption = domainBandCaption(domainBandBox(members));
+ if (caption.x >= 4 && caption.y >= 4 && caption.y <= viewBox[1] - 4 && caption.x <= viewBox[0] - 4) continue;
+ const listed = members.map((entity) => `"${entity.id}"`).join(', ');
+ const message = `Domain "${tag}" is named but cannot be drawn: the canvas does not reach the band caption for ${listed} at (${caption.x}, ${caption.y}). Move the domain clear of the canvas edge, or drop the tag.`;
+ problems.push(message);
+ domainDetails.push({
+ code: 'erd/domain-not-drawn', severity: 'error', message,
+ subject: { diagramType: 'erd', entityId: members[0].id, domain: tag },
+ evidence: { domain: tag, entities: members.map((entity) => entity.id), reason: 'off-canvas', caption, viewBox },
+ supportedFixes: ['Move the domain clear of the canvas edge.', 'Drop the tag to group nothing.'],
+ });
+ }
+ // A band claims the box it covers. With gaps smaller than the band padding the
+ // box reaches a table the domain does not own, which is the same false claim as
+ // a band drawn across a gap.
+ const memberIds = new Set([...domainGroups.flatMap((group) => group.members)].map((entity) => entity.id));
+ for (const { tag, members } of domainGroups) {
+ const box = domainBandBox(members);
+ const intruder = [...entities.values()].find((entity) => !memberIds.has(entity.id)
+ && entity.x < box.x + box.width && entity.x + entity.width > box.x
+ && entity.y < box.y + box.height && entity.y + entity.height > box.y);
+ if (!intruder) continue;
+ const listed = members.map((entity) => `"${entity.id}"`).join(', ');
+ const message = `Domain "${tag}" is named but cannot be drawn: its band would cover the unrelated table "${intruder.id}". Widen layout.gapX/gapY past the band padding, or split the tag.`;
+ problems.push(message);
+ domainDetails.push({
+ code: 'erd/domain-not-drawn', severity: 'error', message,
+ subject: { diagramType: 'erd', entityId: members[0].id, domain: tag },
+ evidence: { domain: tag, entities: members.map((entity) => entity.id), reason: 'band-covers-entity', band: box, coveredEntity: intruder.id },
+ supportedFixes: ['Widen layout.gapX/gapY past the band padding.', 'Split the tag so each band covers only its own tables.'],
});
}
validateErGridPlacement(er, grid, bands, problems);
-
const seenEntityIds = new Set();
for (const entity of asArray(er.entities)) {
if (seenEntityIds.has(entity.id)) problems.push(`Entity ids must be unique; "${entity.id}" is declared twice.`);
@@ -1072,7 +1160,7 @@ function validateEr() {
throwDiagnosticProblems('Entity-relationship layout validation failed', problems, {
code: 'layout/constraint',
subject: { diagramType: 'erd' },
- diagnostics: [...headerDetails, ...portSpacingDetails],
+ diagnostics: [...headerDetails, ...domainDetails, ...portSpacingDetails],
});
}
}
@@ -1126,16 +1214,13 @@ function renderEntityColumnRows(entity) {
function renderEntity(entity) {
const header = entity.y + metrics.headerH;
- const { detail, labelFont, detailFont, labelY, detailY, titleInset } = entityHeader(entity);
+ const { labelFont, labelY, labelX } = entityHeader(entity);
const passport = {
kind: 'database',
sublabel: entity.sublabel,
tag: entity.tag,
context: i18nText(er.meta.locale, 'node.context.erd'),
};
- const sublabel = detail
- ? `\n <text data-detail="context" x="${entity.x + entity.width - layout.padX}" y="${entity.y + detailY}" class="er-type" font-size="${detailFont}" text-anchor="end">${esc(detail)}</text>`
- : '';
const rows = renderEntityColumnRows(entity);
return ` <g ${focusNodeAttrs(entity.id, entity.label, passport, er.meta.locale)}>
${focusNodeTitle(entity.label, passport)}
@@ -1143,7 +1228,7 @@ function renderEntity(entity) {
<rect x="${entity.x}" y="${entity.y}" width="${entity.width}" height="${entity.height}" rx="5" class="c-database er-table"${animateAttr(er.meta, 'node', entitySteps.get(entity.id))} stroke-width="1.5"/>
<path class="er-table-header" d="M ${entity.x + 5} ${entity.y} H ${entity.x + entity.width - 5} Q ${entity.x + entity.width} ${entity.y} ${entity.x + entity.width} ${entity.y + 5} V ${header} H ${entity.x} V ${entity.y + 5} Q ${entity.x} ${entity.y} ${entity.x + 5} ${entity.y} Z"/>
${renderSemanticSigil('database', { x: entity.x + 8, y: entity.y + 7, size: 14 })}
- <text data-node-label="" x="${entity.x + titleInset}" y="${entity.y + labelY}" class="t-primary" font-size="${labelFont}" font-weight="700">${esc(entity.label)}</text>${sublabel}
+ <text data-node-label="" x="${labelX}" y="${entity.y + labelY}" class="t-primary" font-size="${labelFont}" font-weight="700" text-anchor="middle">${esc(entity.label)}</text>
<line x1="${entity.x}" y1="${header}" x2="${entity.x + entity.width}" y2="${header}" class="c-grid" stroke-width="1"/>
${rows}
</g>`;
diff --git a/archify/test/erd-rendering.test.mjs b/archify/test/erd-rendering.test.mjs
index 8316ed46..4c583cdd 100644
--- a/archify/test/erd-rendering.test.mjs
+++ b/archify/test/erd-rendering.test.mjs
@@ -622,9 +622,22 @@ test('a contiguous domain draws a band and a scattered tag does not', () => {
assert.match(contiguous, /data-domain-band="catalog"/, 'a second contiguous domain earns its own band');
// Two members on a diagonal: their columns and their rows are both spread, so
- // the run is not contiguous and the tag must draw no box across the gap.
- const scattered = band(nodes((id) => (id === 'alpha' || id === 'delta' ? 'checkout' : 'other')), links);
- assert.doesNotMatch(scattered, /data-domain-band="checkout"/, 'a tag split across the canvas draws no band');
+ // no band can be measured, and the band is the only place a domain name is
+ // drawn. The render names the problem instead of drawing nothing for the tag.
+ const scatteredDiagram = {
+ schema_version: 1,
+ diagram_type: 'erd',
+ meta: { title: 'Domains', locale: 'en' },
+ layout: { mode: 'grid' },
+ entities: nodes((id) => (id === 'alpha' || id === 'delta' ? 'checkout' : 'other')),
+ relationships: links,
+ };
+ const scatteredDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-band-scattered-'));
+ const scattered = render(scatteredDiagram, scatteredDirectory);
+ assert.notEqual(scattered.status, 0, 'a tag split across the canvas must not render');
+ assert.match(scattered.stderr + scattered.stdout, /erd\/domain-not-drawn/);
+ assert.match(scattered.stderr + scattered.stdout, /"alpha", "delta" do not fill a solid block/);
+ assert.equal(fs.existsSync(scattered.output), false, 'the diagram is not written at all');
});
// Port spacing and glyph ink are what make both ends readable: the shared 14px
@@ -953,7 +966,7 @@ test('a bundled trunk is painted under the markers it passes', () => {
});
-test('table title and explicit note occupy separate header intervals or fail with capacity evidence', () => {
+test('the header draws the centered title alone and reports a title that cannot fit', () => {
const diagram = cloneWithoutViews(example);
diagram.entities = [{
id: 'subscription', label: 'customer_subscription', sublabel: 'billing',
@@ -966,30 +979,133 @@ test('table title and explicit note occupy separate header intervals or fail wit
assert.equal(success.status, 0, success.stderr);
const html = fs.readFileSync(success.output, 'utf8');
const title = attrs(html.match(/<text data-node-label=""[^>]*>customer_subscription<\/text>/)[0]);
- const note = attrs(html.match(/<text[^>]*>billing<\/text>/)[0]);
- // Same-line bounds use the renderer's conservative text advance, including
- // the explicit 12-unit separation between independently authored strings.
- const titleRight = +title.x + 'customer_subscription'.length * +title['font-size'] * 0.6;
- const noteLeft = +note.x - 'billing'.length * +note['font-size'] * 0.6;
- assert.equal(title.y, note.y);
- assert.ok(noteLeft - titleRight >= 11.9, `header text must stay apart: ${titleRight}, ${noteLeft}`);
+ // The title is centered, so its x is the anchor, not its left edge.
+ assert.equal(title['text-anchor'], 'middle', 'the table title is centered on its own center line');
assert.deepEqual(entityBoxes(html).get('subscription'), { x: 40, y: 80, width: 240, height: 56 });
- diagram.entities[0].sublabel = 'An explicitly authored billing ownership note that cannot fit';
+ // The header carries the title alone. The author's note stays on the node,
+ // where the accessible name and the node index read it, but it is not drawn.
+ assert.doesNotMatch(html, /<text[^>]*>billing<\/text>/, 'the authored note is not drawn');
+ assert.match(html, /data-node-sublabel="billing"/, 'the authored note stays on the node');
+
+ // A short title has the room to sit on the center line exactly, and it takes
+ // it: the clamp only moves a title that would otherwise reach a bound.
+ const shortDiagram = cloneWithoutViews(example);
+ shortDiagram.entities = [{
+ id: 'subscription', label: 'sub', sublabel: 'billing',
+ pos: [40, 80], width: 240,
+ attributes: [{ name: 'id', type: 'bigint', key: 'pk' }],
+ }];
+ shortDiagram.relationships = [];
+ const shortDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-header-short-'));
+ const short = render(shortDiagram, shortDirectory);
+ assert.equal(short.status, 0, short.stderr);
+ const shortTitle = attrs(fs.readFileSync(short.output, 'utf8').match(/<text data-node-label=""[^>]*>sub<\/text>/)[0]);
+ assert.equal(+shortTitle.x, 40 + 240 / 2, 'a short title sits on the table center line');
+
+ // A title with the whole interval to itself can be wide enough that the
+ // unclamped center line would push it into the sigil porch. The clamp holds
+ // it at the bound and lets it sit right of the center line it cannot use.
+ const wideDiagram = cloneWithoutViews(example);
+ wideDiagram.entities = [{
+ id: 'subscription', label: 'subscription_billing_cycle',
+ pos: [40, 80], width: 240,
+ attributes: [{ name: 'id', type: 'bigint', key: 'pk' }],
+ }];
+ wideDiagram.relationships = [];
+ const wideDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-header-wide-'));
+ const wide = render(wideDiagram, wideDirectory);
+ assert.equal(wide.status, 0, wide.stderr);
+ const wideTitle = attrs(fs.readFileSync(wide.output, 'utf8').match(/<text data-node-label=""[^>]*>subscription_billing_cycle<\/text>/)[0]);
+ const wideLeft = +wideTitle.x - 'subscription_billing_cycle'.length * +wideTitle['font-size'] * 0.6 / 2;
+ assert.ok(wideLeft >= 69.9, `a title wide enough to reach the porch is held at the bound (got ${wideLeft})`);
+ assert.ok(+wideTitle.x > 40 + 240 / 2, `and it sits right of the center line it could not use (got ${wideTitle.x})`);
+
+ // The header is one string wide, so a title past the interval has no second
+ // place to go: the render names it instead of shrinking it past readability.
+ diagram.entities[0].label = 'customer_subscription_billing_cycle_archive';
const failureDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-header-capacity-'));
const failure = render(diagram, failureDirectory);
- assert.notEqual(failure.status, 0, 'an oversized explicit note must never be silently dropped');
+ assert.notEqual(failure.status, 0, 'an oversized title must never be drawn past the header');
assert.match(failure.stderr + failure.stdout, /erd\/header-text-capacity/);
assert.equal(fs.existsSync(failure.output), false);
+});
+
+test('a domain that cannot be drawn as a band stops the render instead of losing its name', () => {
+ // A domain is named by its band, and the header carries the table title alone,
+ // so a tag that cannot be banded would leave the domain unnamed on the canvas.
+ const base = cloneWithoutViews(example);
+ const table = (id, row, col, tag) => ({
+ id, label: id, tag, row, col,
+ attributes: [{ name: 'id', type: 'bigint', key: 'pk' }],
+ });
- diagram.layout = { mode: 'grid', headerH: 40 };
- diagram.entities[0].sublabel = 'billing ownership';
- diagram.entities[0].width = 200;
- const twoLineDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-header-two-lines-'));
- const twoLine = render(diagram, twoLineDirectory);
- assert.equal(twoLine.status, 0, twoLine.stderr);
- const twoLineHtml = fs.readFileSync(twoLine.output, 'utf8');
- const separateTitle = attrs(twoLineHtml.match(/<text data-node-label=""[^>]*>customer_subscription<\/text>/)[0]);
- const separateNote = attrs(twoLineHtml.match(/<text[^>]*>billing ownership<\/text>/)[0]);
- assert.ok(+separateNote.y > +separateTitle.y, 'an authored taller header can use the spare line');
+ const solid = clone(base);
+ solid.entities = [
+ table('a', 0, 0, 'core'), table('b', 0, 1, 'core'),
+ table('c', 1, 0, 'core'), table('d', 1, 1, 'core'),
+ ];
+ solid.relationships = [];
+ const solidDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-block-'));
+ const solidRun = render(solid, solidDirectory);
+ assert.equal(solidRun.status, 0, solidRun.stderr);
+ assert.match(fs.readFileSync(solidRun.output, 'utf8'), /data-domain-band="core"/,
+ 'a block of grid cells is drawn as a band');
+
+ // One row and one column are the same claim with a dimension of one.
+ for (const [name, cells] of [['row', [[0, 0], [0, 1], [0, 2]]], ['column', [[0, 0], [1, 0], [2, 0]]]]) {
+ const strip = clone(base);
+ strip.entities = cells.map(([row, col], index) => table(`t${index}`, row, col, 'core'));
+ strip.relationships = [];
+ const stripDirectory = fs.mkdtempSync(path.join(os.tmpdir(), `archify-er-domain-${name}-`));
+ const stripRun = render(strip, stripDirectory);
+ assert.equal(stripRun.status, 0, stripRun.stderr);
+ assert.match(fs.readFileSync(stripRun.output, 'utf8'), /data-domain-band="core"/, `a ${name} is a band`);
+ }
+
+ // An L does not fill its bounding box: a band would claim the empty cell.
+ const ell = clone(base);
+ ell.entities = [table('a', 0, 0, 'core'), table('b', 0, 1, 'core'), table('c', 1, 0, 'core')];
+ ell.relationships = [];
+ const ellDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-ell-'));
+ const ellRun = render(ell, ellDirectory);
+ assert.notEqual(ellRun.status, 0, 'an L-shaped domain must not be banded');
+ assert.match(ellRun.stderr + ellRun.stdout, /erd\/domain-not-drawn/);
+ assert.match(ellRun.stderr + ellRun.stdout, /"a", "b", "c" do not fill a solid block/);
+ assert.equal(fs.existsSync(ellRun.output), false, 'nothing is written when a domain cannot be named');
+
+ // Absolute coordinates have no cells to group, so a tag cannot be drawn there.
+ const absolute = clone(base);
+ absolute.entities = [{
+ id: 'solo', label: 'solo', tag: 'core', pos: [40, 80],
+ attributes: [{ name: 'id', type: 'bigint', key: 'pk' }],
+ }];
+ absolute.relationships = [];
+ const absoluteDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-pos-'));
+ const absoluteRun = render(absolute, absoluteDirectory);
+ assert.notEqual(absoluteRun.status, 0, 'a tagged table outside the grid must not render');
+ assert.match(absoluteRun.stderr + absoluteRun.stdout, /have no grid cells, and a band is measured from them/);
+
+ // Two members in one cell is the grid placement check's report, not the
+ // domain's: the author gets the pair that has to move, not a block to build.
+ const shared = clone(base);
+ shared.entities = [table('a', 0, 0, 'core'), table('b', 0, 0, 'core')];
+ shared.relationships = [];
+ const sharedDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-shared-'));
+ const sharedRun = render(shared, sharedDirectory);
+ assert.notEqual(sharedRun.status, 0, 'two tables in one cell must not render');
+ assert.match(sharedRun.stderr + sharedRun.stdout, /share grid cell/);
+ assert.doesNotMatch(sharedRun.stderr + sharedRun.stdout, /do not fill a solid block/,
+ 'the domain check defers to the placement error instead of blaming the block');
+
+ // A table with no tag groups nothing and stays placeable by coordinates.
+ const untagged = clone(base);
+ untagged.entities = [{
+ id: 'solo', label: 'solo', pos: [40, 80],
+ attributes: [{ name: 'id', type: 'bigint', key: 'pk' }],
+ }];
+ untagged.relationships = [];
+ const untaggedDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-untagged-'));
+ const untaggedRun = render(untagged, untaggedDirectory);
+ assert.equal(untaggedRun.status, 0, untaggedRun.stderr);
});
diff --git a/docs/gallery.html b/docs/gallery.html
index 1704ec49..06b7333a 100644
--- a/docs/gallery.html
+++ b/docs/gallery.html
@@ -619,7 +619,7 @@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">6N · 5E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="70555dd9b569961bddb1255c2d1cd0a0e3e1bc5949f09f4ae7e92042446610dd">70555dd9b569</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="fc1a10700c203514e3789402e2e5d78c3888688d068938466e67b24ee89773df">fc1a10700c20</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/orders.erd.html#focus=order" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -2304,8 +2304,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 6,
"edgeCount": 5,
- "artifactBytes": 776386,
- "artifactSha256": "70555dd9b569961bddb1255c2d1cd0a0e3e1bc5949f09f4ae7e92042446610dd",
+ "artifactBytes": 776811,
+ "artifactSha256": "fc1a10700c203514e3789402e2e5d78c3888688d068938466e67b24ee89773df",
"sourceBytes": 7321,
"sourceSha256": "1777a374647084466f4d7ce3a968004be6ab70ac9cf82459b96bed7c556cdfdd",
"checks": [
@@ -2410,7 +2410,7 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
},
"minimumSourceTextPx": 9,
"minimumProjectedTextPx": 8.773584905660378,
- "semanticTextCount": 94
+ "semanticTextCount": 92
},
"issues": []
}
diff --git a/docs/gallery/artifacts/orders.erd.html b/docs/gallery/artifacts/orders.erd.html
index 0c75126c..e181b01e 100644
--- a/docs/gallery/artifacts/orders.erd.html
+++ b/docs/gallery/artifacts/orders.erd.html
@@ -5059,10 +5059,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<rect width="100%" height="100%" fill="url(#grid)" />
<!-- Domain bands (behind the routes so a channel is never washed out) -->
+ <g data-domain-band="accounts">
+ <rect x="20" y="22" width="264" height="142" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="30" y="35" class="t-muted" font-size="9" font-weight="700">accounts</text>
+ </g>
<g data-domain-band="checkout">
<rect x="332" y="22" width="603" height="202" rx="8" class="c-lane" stroke-width="1"/>
<text data-domain-label="" x="342" y="35" class="t-muted" font-size="9" font-weight="700">checkout</text>
</g>
+ <g data-domain-band="line items">
+ <rect x="664" y="236" width="278" height="182" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="674" y="249" class="t-muted" font-size="9" font-weight="700">line items</text>
+ </g>
<g data-domain-band="catalog">
<rect x="22" y="236" width="584" height="202" rx="8" class="c-lane" stroke-width="1"/>
<text data-domain-label="" x="32" y="249" class="t-muted" font-size="9" font-weight="700">catalog</text>
@@ -5091,8 +5099,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="62" y="59" class="t-primary" font-size="13" font-weight="700">customer</text>
- <text data-detail="context" x="260" y="59" class="er-type" font-size="10" text-anchor="end">accounts</text>
+ <text data-node-label="" x="152" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">customer</text>
<line x1="32" y1="70" x2="272" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="32" y1="70" x2="272" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5129,7 +5136,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="374" y="59" class="t-primary" font-size="13" font-weight="700">order</text>
+ <text data-node-label="" x="474" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">order</text>
<line x1="344" y1="70" x2="604" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="344" y1="70" x2="604" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5184,8 +5191,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="706" y="273" class="t-primary" font-size="13" font-weight="700">order_item</text>
- <text data-detail="context" x="918" y="273" class="er-type" font-size="10" text-anchor="end">line items</text>
+ <text data-node-label="" x="803" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">order_item</text>
<line x1="676" y1="284" x2="930" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="676" y1="284" x2="930" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5234,7 +5240,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="384" y="273" class="t-primary" font-size="13" font-weight="700">product</text>
+ <text data-node-label="" x="474" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">product</text>
<line x1="354" y1="284" x2="594" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="354" y1="284" x2="594" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5289,7 +5295,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="64" y="273" class="t-primary" font-size="13" font-weight="700">inventory</text>
+ <text data-node-label="" x="152" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">inventory</text>
<line x1="34" y1="284" x2="270" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="34" y1="284" x2="270" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5338,7 +5344,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="713" y="59" class="t-primary" font-size="13" font-weight="700">payment</text>
+ <text data-node-label="" x="803" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment</text>
<line x1="683" y1="70" x2="923" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="683" y1="70" x2="923" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.json
index 43f504ff..14222b49 100644
--- a/docs/gallery/manifest.json
+++ b/docs/gallery/manifest.json
@@ -1625,8 +1625,8 @@
"engineeringProfile": null,
"nodeCount": 6,
"edgeCount": 5,
- "artifactBytes": 776386,
- "artifactSha256": "70555dd9b569961bddb1255c2d1cd0a0e3e1bc5949f09f4ae7e92042446610dd",
+ "artifactBytes": 776811,
+ "artifactSha256": "fc1a10700c203514e3789402e2e5d78c3888688d068938466e67b24ee89773df",
"sourceBytes": 7321,
"sourceSha256": "1777a374647084466f4d7ce3a968004be6ab70ac9cf82459b96bed7c556cdfdd",
"checks": [
@@ -1731,7 +1731,7 @@
},
"minimumSourceTextPx": 9,
"minimumProjectedTextPx": 8.773584905660378,
- "semanticTextCount": 94
+ "semanticTextCount": 92
},
"issues": []
}
diff --git a/examples/erd-orders-rendered.html b/examples/erd-orders-rendered.html
index 0c75126c..e181b01e 100644
--- a/examples/erd-orders-rendered.html
+++ b/examples/erd-orders-rendered.html
@@ -5059,10 +5059,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<rect width="100%" height="100%" fill="url(#grid)" />
<!-- Domain bands (behind the routes so a channel is never washed out) -->
+ <g data-domain-band="accounts">
+ <rect x="20" y="22" width="264" height="142" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="30" y="35" class="t-muted" font-size="9" font-weight="700">accounts</text>
+ </g>
<g data-domain-band="checkout">
<rect x="332" y="22" width="603" height="202" rx="8" class="c-lane" stroke-width="1"/>
<text data-domain-label="" x="342" y="35" class="t-muted" font-size="9" font-weight="700">checkout</text>
</g>
+ <g data-domain-band="line items">
+ <rect x="664" y="236" width="278" height="182" rx="8" class="c-lane" stroke-width="1"/>
+ <text data-domain-label="" x="674" y="249" class="t-muted" font-size="9" font-weight="700">line items</text>
+ </g>
<g data-domain-band="catalog">
<rect x="22" y="236" width="584" height="202" rx="8" class="c-lane" stroke-width="1"/>
<text data-domain-label="" x="32" y="249" class="t-muted" font-size="9" font-weight="700">catalog</text>
@@ -5091,8 +5099,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="62" y="59" class="t-primary" font-size="13" font-weight="700">customer</text>
- <text data-detail="context" x="260" y="59" class="er-type" font-size="10" text-anchor="end">accounts</text>
+ <text data-node-label="" x="152" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">customer</text>
<line x1="32" y1="70" x2="272" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="32" y1="70" x2="272" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5129,7 +5136,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="374" y="59" class="t-primary" font-size="13" font-weight="700">order</text>
+ <text data-node-label="" x="474" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">order</text>
<line x1="344" y1="70" x2="604" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="344" y1="70" x2="604" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5184,8 +5191,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="706" y="273" class="t-primary" font-size="13" font-weight="700">order_item</text>
- <text data-detail="context" x="918" y="273" class="er-type" font-size="10" text-anchor="end">line items</text>
+ <text data-node-label="" x="803" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">order_item</text>
<line x1="676" y1="284" x2="930" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="676" y1="284" x2="930" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5234,7 +5240,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="384" y="273" class="t-primary" font-size="13" font-weight="700">product</text>
+ <text data-node-label="" x="474" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">product</text>
<line x1="354" y1="284" x2="594" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="354" y1="284" x2="594" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5289,7 +5295,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="64" y="273" class="t-primary" font-size="13" font-weight="700">inventory</text>
+ <text data-node-label="" x="152" y="273" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">inventory</text>
<line x1="34" y1="284" x2="270" y2="284" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="34" y1="284" x2="270" y2="284" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5338,7 +5344,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="713" y="59" class="t-primary" font-size="13" font-weight="700">payment</text>
+ <text data-node-label="" x="803" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment</text>
<line x1="683" y1="70" x2="923" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="683" y1="70" x2="923" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
diff --git a/examples/subscription-billing-rendered.html b/examples/subscription-billing-rendered.html
index 83c0a79f..65e0d4c9 100644
--- a/examples/subscription-billing-rendered.html
+++ b/examples/subscription-billing-rendered.html
@@ -5105,7 +5105,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="67" y="59" class="t-primary" font-size="13" font-weight="700">tenant</text>
+ <text data-node-label="" x="157" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">tenant</text>
<line x1="37" y1="70" x2="277" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="37" y1="70" x2="277" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5148,7 +5148,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="67" y="261" class="t-primary" font-size="13" font-weight="700">user_account</text>
+ <text data-node-label="" x="157" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">user_account</text>
<line x1="37" y1="272" x2="277" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="37" y1="272" x2="277" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5197,7 +5197,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="62" y="483" class="t-primary" font-size="13" font-weight="700">membership</text>
+ <text data-node-label="" x="157" y="483" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">membership</text>
<line x1="32" y1="494" x2="282" y2="494" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="32" y1="494" x2="282" y2="494" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5240,7 +5240,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="692" y="59" class="t-primary" font-size="13" font-weight="700">plan</text>
+ <text data-node-label="" x="782" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">plan</text>
<line x1="662" y1="70" x2="902" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="662" y1="70" x2="902" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5283,7 +5283,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="692" y="261" class="t-primary" font-size="13" font-weight="700">price</text>
+ <text data-node-label="" x="782" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">price</text>
<line x1="662" y1="272" x2="902" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="662" y1="272" x2="902" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5326,7 +5326,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="382" y="59" class="t-primary" font-size="13" font-weight="700">subscription</text>
+ <text data-node-label="" x="472" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">subscription</text>
<line x1="352" y1="70" x2="592" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="352" y1="70" x2="592" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5381,7 +5381,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="376" y="261" class="t-primary" font-size="13" font-weight="700">invoice</text>
+ <text data-node-label="" x="472" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">invoice</text>
<line x1="346" y1="272" x2="598" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="346" y1="272" x2="598" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5442,7 +5442,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="377" y="483" class="t-primary" font-size="13" font-weight="700">invoice_line</text>
+ <text data-node-label="" x="472" y="483" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">invoice_line</text>
<line x1="347" y1="494" x2="597" y2="494" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="347" y1="494" x2="597" y2="494" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5491,7 +5491,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="996" y="59" class="t-primary" font-size="13" font-weight="700">payment_method</text>
+ <text data-node-label="" x="1086" y="59" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment_method</text>
<line x1="966" y1="70" x2="1206" y2="70" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="966" y1="70" x2="1206" y2="70" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5540,7 +5540,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="996" y="261" class="t-primary" font-size="13" font-weight="700">payment</text>
+ <text data-node-label="" x="1086" y="261" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">payment</text>
<line x1="966" y1="272" x2="1206" y2="272" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="966" y1="272" x2="1206" y2="272" class="c-grid er-row-rule" stroke-width="0.5"/>
@@ -5589,7 +5589,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<ellipse cx="8" cy="4" rx="5" ry="2"/>
<path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>
</g>
- <text data-node-label="" x="996" y="483" class="t-primary" font-size="13" font-weight="700">refund</text>
+ <text data-node-label="" x="1086" y="483" class="t-primary" font-size="13" font-weight="700" text-anchor="middle">refund</text>
<line x1="966" y1="494" x2="1206" y2="494" class="c-grid" stroke-width="1"/>
<g data-detail="context" data-er-row="0">
<line x1="966" y1="494" x2="1206" y2="494" class="c-grid er-row-rule" stroke-width="0.5"/>