@ponchia/ui 0.5.0 → 0.6.3
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/CHANGELOG.md +386 -4
- package/MIGRATIONS.json +14 -0
- package/README.md +29 -6
- package/annotations/index.d.ts +398 -276
- package/annotations/index.d.ts.map +1 -0
- package/annotations/index.js +350 -77
- package/behaviors/carousel.d.ts +28 -0
- package/behaviors/carousel.d.ts.map +1 -0
- package/behaviors/carousel.js +20 -16
- package/behaviors/combobox.d.ts +40 -0
- package/behaviors/combobox.d.ts.map +1 -0
- package/behaviors/combobox.js +111 -29
- package/behaviors/command.d.ts +41 -0
- package/behaviors/command.d.ts.map +1 -0
- package/behaviors/command.js +27 -15
- package/behaviors/connectors.d.ts +17 -0
- package/behaviors/connectors.d.ts.map +1 -0
- package/behaviors/connectors.js +7 -5
- package/behaviors/crosshair.d.ts +42 -0
- package/behaviors/crosshair.d.ts.map +1 -0
- package/behaviors/crosshair.js +23 -6
- package/behaviors/dialog.d.ts +20 -0
- package/behaviors/dialog.d.ts.map +1 -0
- package/behaviors/dialog.js +6 -2
- package/behaviors/disclosure.d.ts +10 -0
- package/behaviors/disclosure.d.ts.map +1 -0
- package/behaviors/disclosure.js +6 -2
- package/behaviors/dismissible.d.ts +10 -0
- package/behaviors/dismissible.d.ts.map +1 -0
- package/behaviors/dismissible.js +6 -2
- package/behaviors/forms.d.ts +27 -0
- package/behaviors/forms.d.ts.map +1 -0
- package/behaviors/forms.js +54 -13
- package/behaviors/glyph.d.ts +14 -0
- package/behaviors/glyph.d.ts.map +1 -0
- package/behaviors/glyph.js +28 -5
- package/behaviors/index.d.ts +31 -237
- package/behaviors/index.d.ts.map +1 -0
- package/behaviors/index.js +17 -0
- package/behaviors/inert.d.ts +20 -0
- package/behaviors/inert.d.ts.map +1 -0
- package/behaviors/inert.js +46 -0
- package/behaviors/internal.d.ts +25 -0
- package/behaviors/internal.d.ts.map +1 -0
- package/behaviors/internal.js +77 -1
- package/behaviors/legend.d.ts +35 -0
- package/behaviors/legend.d.ts.map +1 -0
- package/behaviors/legend.js +32 -2
- package/behaviors/menu.d.ts +16 -0
- package/behaviors/menu.d.ts.map +1 -0
- package/behaviors/menu.js +6 -2
- package/behaviors/modal.d.ts +41 -0
- package/behaviors/modal.d.ts.map +1 -0
- package/behaviors/modal.js +124 -0
- package/behaviors/popover.d.ts +28 -0
- package/behaviors/popover.d.ts.map +1 -0
- package/behaviors/popover.js +78 -7
- package/behaviors/spotlight.d.ts +17 -0
- package/behaviors/spotlight.d.ts.map +1 -0
- package/behaviors/spotlight.js +7 -5
- package/behaviors/table.d.ts +36 -0
- package/behaviors/table.d.ts.map +1 -0
- package/behaviors/table.js +84 -17
- package/behaviors/tabs.d.ts +20 -0
- package/behaviors/tabs.d.ts.map +1 -0
- package/behaviors/tabs.js +17 -14
- package/behaviors/theme.d.ts +54 -0
- package/behaviors/theme.d.ts.map +1 -0
- package/behaviors/theme.js +22 -3
- package/behaviors/toast.d.ts +49 -0
- package/behaviors/toast.d.ts.map +1 -0
- package/behaviors/toast.js +47 -3
- package/classes/classes.json +2527 -0
- package/classes/index.d.ts +134 -15
- package/classes/index.js +280 -80
- package/classes/vscode.css-custom-data.json +12 -0
- package/connectors/index.d.ts +201 -69
- package/connectors/index.d.ts.map +1 -0
- package/connectors/index.js +142 -25
- package/css/app.css +69 -13
- package/css/base.css +15 -10
- package/css/bullet.css +108 -0
- package/css/code.css +98 -0
- package/css/connectors.css +17 -0
- package/css/content.css +22 -3
- package/css/crosshair.css +7 -7
- package/css/dataviz.css +5 -1
- package/css/diff.css +153 -0
- package/css/disclosure.css +53 -7
- package/css/dots.css +94 -7
- package/css/feedback.css +97 -7
- package/css/forms.css +113 -4
- package/css/legend.css +16 -9
- package/css/marks.css +38 -8
- package/css/motion.css +98 -53
- package/css/navigation.css +7 -0
- package/css/overlay.css +90 -3
- package/css/primitives.css +158 -13
- package/css/report.css +73 -56
- package/css/sidenote.css +67 -0
- package/css/site.css +16 -2
- package/css/sources.css +43 -1
- package/css/spark.css +62 -0
- package/css/spotlight.css +1 -1
- package/css/table.css +9 -2
- package/css/term.css +110 -0
- package/css/textref.css +63 -0
- package/css/toc.css +91 -0
- package/css/tokens.css +49 -1
- package/css/tree.css +134 -0
- package/css/workbench.css +1 -1
- package/dist/bronto.css +1 -1
- package/dist/css/analytical.css +1 -1
- package/dist/css/app.css +1 -1
- package/dist/css/base.css +1 -1
- package/dist/css/bullet.css +1 -0
- package/dist/css/code.css +1 -0
- package/dist/css/connectors.css +1 -1
- package/dist/css/content.css +1 -1
- package/dist/css/crosshair.css +1 -1
- package/dist/css/diff.css +1 -0
- package/dist/css/disclosure.css +1 -1
- package/dist/css/dots.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/forms.css +1 -1
- package/dist/css/legend.css +1 -1
- package/dist/css/marks.css +1 -1
- package/dist/css/motion.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/primitives.css +1 -1
- package/dist/css/report.css +1 -1
- package/dist/css/sidenote.css +1 -0
- package/dist/css/site.css +1 -1
- package/dist/css/sources.css +1 -1
- package/dist/css/spark.css +1 -0
- package/dist/css/spotlight.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/term.css +1 -0
- package/dist/css/textref.css +1 -0
- package/dist/css/toc.css +1 -0
- package/dist/css/tokens.css +1 -1
- package/dist/css/tree.css +1 -0
- package/dist/css/workbench.css +1 -1
- package/docs/adr/0003-theme-model.md +1 -1
- package/docs/annotations.md +133 -14
- package/docs/architecture.md +49 -6
- package/docs/bullet.md +78 -0
- package/docs/code.md +76 -0
- package/docs/contrast.md +116 -92
- package/docs/d2.md +196 -0
- package/docs/diff.md +146 -0
- package/docs/legends.md +23 -3
- package/docs/marks.md +9 -2
- package/docs/mermaid.md +169 -0
- package/docs/reference.md +201 -26
- package/docs/reporting.md +416 -57
- package/docs/sidenote.md +64 -0
- package/docs/sources.md +27 -0
- package/docs/spark.md +78 -0
- package/docs/stability.md +10 -2
- package/docs/term.md +81 -0
- package/docs/textref.md +78 -0
- package/docs/theming.md +44 -5
- package/docs/toc.md +83 -0
- package/docs/tree.md +74 -0
- package/docs/usage.md +354 -16
- package/docs/vega.md +244 -0
- package/docs/workbench.md +7 -1
- package/glyphs/glyphs.js +13 -5
- package/llms.txt +285 -14
- package/package.json +95 -17
- package/qwik/index.d.ts +44 -59
- package/qwik/index.d.ts.map +1 -0
- package/qwik/index.js +65 -3
- package/react/index.d.ts +41 -61
- package/react/index.d.ts.map +1 -0
- package/react/index.js +63 -3
- package/solid/index.d.ts +68 -61
- package/solid/index.d.ts.map +1 -0
- package/solid/index.js +66 -3
- package/tokens/d2.d.ts +38 -0
- package/tokens/d2.js +71 -0
- package/tokens/d2.json +43 -0
- package/tokens/index.d.ts +5 -5
- package/tokens/index.js +15 -1
- package/tokens/index.json +9 -0
- package/tokens/mermaid.d.ts +23 -0
- package/tokens/mermaid.js +181 -0
- package/tokens/mermaid.json +163 -0
- package/tokens/resolved.json +45 -1
- package/tokens/skins.js +3 -2
- package/tokens/tokens.dtcg.json +26 -0
- package/tokens/vega.d.ts +34 -0
- package/tokens/vega.js +155 -0
- package/tokens/vega.json +179 -0
package/docs/contrast.md
CHANGED
|
@@ -40,51 +40,57 @@ Overall: **all contractual pairings meet their floor ✅**.
|
|
|
40
40
|
|
|
41
41
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
42
42
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
43
|
-
| `--text` | `--bg` | Body text on page background | AA text (4.5:1) | 17.98:1 | Lc 99 | ✅ pass |
|
|
44
|
-
| `--text` | `--surface` | Body text on a card/panel | AA text (4.5:1) | 19.80:1 | Lc
|
|
45
|
-
| `--text` | `--surface-muted` | Body text on a muted panel | AA text (4.5:1) | 16.74:1 | Lc 94 | ✅ pass |
|
|
46
|
-
| `--text-soft` | `--bg` | Secondary text on page background | AA text (4.5:1) | 11.16:1 | Lc 91 | ✅ pass |
|
|
47
|
-
| `--text-soft` | `--surface` | Secondary text on a card | AA text (4.5:1) | 12.29:1 | Lc 98 | ✅ pass |
|
|
48
|
-
| `--text-soft` | `--surface-muted` | Secondary text on a muted panel | AA text (4.5:1) | 10.39:1 | Lc
|
|
49
|
-
| `--text-dim` | `--bg` | Dim/meta text on page background | AA text (4.5:1) | 5.09:1 | Lc 71 | ✅ pass |
|
|
50
|
-
| `--text-dim` | `--surface` | Dim/meta text on a card | AA text (4.5:1) | 5.60:1 | Lc 78 | ✅ pass |
|
|
51
|
-
| `--text-dim` | `--surface-muted` | Dim/meta text on a muted panel | AA text (4.5:1) | 4.74:1 | Lc
|
|
52
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.32:1 | Lc 75 | ✅ pass |
|
|
53
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 6.96:1 | Lc 82 | ✅ pass |
|
|
54
|
-
| `--
|
|
55
|
-
| `--
|
|
56
|
-
| `--
|
|
57
|
-
| `--accent` | `--
|
|
58
|
-
| `--
|
|
59
|
-
| `--
|
|
60
|
-
| `--
|
|
61
|
-
| `--
|
|
62
|
-
| `--
|
|
43
|
+
| `--text` | `--bg` | Body text on page background | AA text (4.5:1) | 17.98:1 | Lc 99.2 | ✅ pass |
|
|
44
|
+
| `--text` | `--surface` | Body text on a card/panel | AA text (4.5:1) | 19.80:1 | Lc 105.8 | ✅ pass |
|
|
45
|
+
| `--text` | `--surface-muted` | Body text on a muted panel | AA text (4.5:1) | 16.74:1 | Lc 94.5 | ✅ pass |
|
|
46
|
+
| `--text-soft` | `--bg` | Secondary text on page background | AA text (4.5:1) | 11.16:1 | Lc 91.4 | ✅ pass |
|
|
47
|
+
| `--text-soft` | `--surface` | Secondary text on a card | AA text (4.5:1) | 12.29:1 | Lc 98.1 | ✅ pass |
|
|
48
|
+
| `--text-soft` | `--surface-muted` | Secondary text on a muted panel | AA text (4.5:1) | 10.39:1 | Lc 86.7 | ✅ pass |
|
|
49
|
+
| `--text-dim` | `--bg` | Dim/meta text on page background | AA text (4.5:1) | 5.09:1 | Lc 71.4 | ✅ pass |
|
|
50
|
+
| `--text-dim` | `--surface` | Dim/meta text on a card | AA text (4.5:1) | 5.60:1 | Lc 78.0 | ✅ pass |
|
|
51
|
+
| `--text-dim` | `--surface-muted` | Dim/meta text on a muted panel | AA text (4.5:1) | 4.74:1 | Lc 66.7 | ✅ pass |
|
|
52
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.32:1 | Lc 75.4 | ✅ pass |
|
|
53
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 6.96:1 | Lc 82.1 | ✅ pass |
|
|
54
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 5.91:1 | Lc 71.0 | ℹ️ not gated |
|
|
55
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 6.31:1 | Lc 75.3 | ℹ️ not gated |
|
|
56
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 5.18:1 | Lc 78.9 | ✅ pass |
|
|
57
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 5.18:1 | Lc 78.9 | ✅ pass |
|
|
58
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 4.71:1 | Lc 66.8 | ✅ pass |
|
|
59
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 5.18:1 | Lc 73.5 | ✅ pass |
|
|
60
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 4.71:1 | Lc 66.8 | ✅ pass |
|
|
61
|
+
| `--success` | `--surface` | Success indicator vs a card | UI / large (3:1) | 5.04:1 | Lc 74.6 | ✅ pass |
|
|
62
|
+
| `--warning` | `--surface` | Warning indicator vs a card | UI / large (3:1) | 5.60:1 | Lc 77.8 | ✅ pass |
|
|
63
|
+
| `--danger` | `--surface` | Danger indicator vs a card | UI / large (3:1) | 6.21:1 | Lc 78.9 | ✅ pass |
|
|
64
|
+
| `--info` | `--surface` | Info indicator vs a card | UI / large (3:1) | 5.77:1 | Lc 78.3 | ✅ pass |
|
|
65
|
+
| `--line-strong` | `--surface` | Strong hairline vs a card | Decorative (1.4.11-exempt) | 2.39:1 | Lc 47.1 | ℹ️ not gated |
|
|
63
66
|
|
|
64
67
|
## Dark theme
|
|
65
68
|
|
|
66
69
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
67
70
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
68
|
-
| `--text` | `--bg` | Body text on page background | AA text (4.5:1) | 15.01:1 | Lc 91 | ✅ pass |
|
|
69
|
-
| `--text` | `--surface` | Body text on a card/panel | AA text (4.5:1) | 13.65:1 | Lc 90 | ✅ pass |
|
|
70
|
-
| `--text` | `--surface-muted` | Body text on a muted panel | AA text (4.5:1) | 12.44:1 | Lc
|
|
71
|
-
| `--text-soft` | `--bg` | Secondary text on page background | AA text (4.5:1) | 11.20:1 | Lc
|
|
72
|
-
| `--text-soft` | `--surface` | Secondary text on a card | AA text (4.5:1) | 10.19:1 | Lc
|
|
73
|
-
| `--text-soft` | `--surface-muted` | Secondary text on a muted panel | AA text (4.5:1) | 9.28:1 | Lc
|
|
74
|
-
| `--text-dim` | `--bg` | Dim/meta text on page background | AA text (4.5:1) | 7.16:1 | Lc 50 | ✅ pass |
|
|
75
|
-
| `--text-dim` | `--surface` | Dim/meta text on a card | AA text (4.5:1) | 6.52:1 | Lc 49 | ✅ pass |
|
|
76
|
-
| `--text-dim` | `--surface-muted` | Dim/meta text on a muted panel | AA text (4.5:1) | 5.94:1 | Lc 48 | ✅ pass |
|
|
77
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.14:1 | Lc
|
|
78
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 5.58:1 | Lc
|
|
79
|
-
| `--
|
|
80
|
-
| `--
|
|
81
|
-
| `--
|
|
82
|
-
| `--accent` | `--
|
|
83
|
-
| `--
|
|
84
|
-
| `--
|
|
85
|
-
| `--
|
|
86
|
-
| `--
|
|
87
|
-
| `--
|
|
71
|
+
| `--text` | `--bg` | Body text on page background | AA text (4.5:1) | 15.01:1 | Lc 91.1 | ✅ pass |
|
|
72
|
+
| `--text` | `--surface` | Body text on a card/panel | AA text (4.5:1) | 13.65:1 | Lc 90.1 | ✅ pass |
|
|
73
|
+
| `--text` | `--surface-muted` | Body text on a muted panel | AA text (4.5:1) | 12.44:1 | Lc 88.9 | ✅ pass |
|
|
74
|
+
| `--text-soft` | `--bg` | Secondary text on page background | AA text (4.5:1) | 11.20:1 | Lc 72.7 | ✅ pass |
|
|
75
|
+
| `--text-soft` | `--surface` | Secondary text on a card | AA text (4.5:1) | 10.19:1 | Lc 71.7 | ✅ pass |
|
|
76
|
+
| `--text-soft` | `--surface-muted` | Secondary text on a muted panel | AA text (4.5:1) | 9.28:1 | Lc 70.6 | ✅ pass |
|
|
77
|
+
| `--text-dim` | `--bg` | Dim/meta text on page background | AA text (4.5:1) | 7.16:1 | Lc 50.3 | ✅ pass |
|
|
78
|
+
| `--text-dim` | `--surface` | Dim/meta text on a card | AA text (4.5:1) | 6.52:1 | Lc 49.3 | ✅ pass |
|
|
79
|
+
| `--text-dim` | `--surface-muted` | Dim/meta text on a muted panel | AA text (4.5:1) | 5.94:1 | Lc 48.1 | ✅ pass |
|
|
80
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.14:1 | Lc 44.9 | ✅ pass |
|
|
81
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 5.58:1 | Lc 43.9 | ✅ pass |
|
|
82
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 2.53:1 | Lc 43.8 | ℹ️ not gated |
|
|
83
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 2.75:1 | Lc 49.1 | ℹ️ not gated |
|
|
84
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 5.95:1 | Lc 42.9 | ✅ pass |
|
|
85
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 5.95:1 | Lc 42.9 | ✅ pass |
|
|
86
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 5.31:1 | Lc 40.0 | ✅ pass |
|
|
87
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 4.83:1 | Lc 39.0 | ✅ pass |
|
|
88
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 5.31:1 | Lc 40.0 | ✅ pass |
|
|
89
|
+
| `--success` | `--surface` | Success indicator vs a card | UI / large (3:1) | 7.58:1 | Lc 56.6 | ✅ pass |
|
|
90
|
+
| `--warning` | `--surface` | Warning indicator vs a card | UI / large (3:1) | 9.29:1 | Lc 66.6 | ✅ pass |
|
|
91
|
+
| `--danger` | `--surface` | Danger indicator vs a card | UI / large (3:1) | 5.23:1 | Lc 41.5 | ✅ pass |
|
|
92
|
+
| `--info` | `--surface` | Info indicator vs a card | UI / large (3:1) | 7.33:1 | Lc 54.8 | ✅ pass |
|
|
93
|
+
| `--line-strong` | `--surface` | Strong hairline vs a card | Decorative (1.4.11-exempt) | 2.29:1 | Lc 14.5 | ℹ️ not gated |
|
|
88
94
|
|
|
89
95
|
## Display colorways (skins)
|
|
90
96
|
|
|
@@ -101,67 +107,85 @@ palette untouched). Accents are authored in OKLCH; `--accent-text` is the
|
|
|
101
107
|
|
|
102
108
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
103
109
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
104
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.75:1 | Lc
|
|
105
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 7.44:1 | Lc
|
|
106
|
-
| `--
|
|
107
|
-
| `--
|
|
108
|
-
| `--
|
|
109
|
-
| `--accent` | `--
|
|
110
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.75:1 | Lc 78.9 | ✅ pass |
|
|
111
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 7.44:1 | Lc 85.6 | ✅ pass |
|
|
112
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 6.31:1 | Lc 74.5 | ℹ️ not gated |
|
|
113
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 6.74:1 | Lc 78.8 | ℹ️ not gated |
|
|
114
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 5.66:1 | Lc 83.3 | ✅ pass |
|
|
115
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 5.66:1 | Lc 83.3 | ✅ pass |
|
|
116
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 5.14:1 | Lc 71.4 | ✅ pass |
|
|
117
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 5.66:1 | Lc 78.0 | ✅ pass |
|
|
118
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 5.14:1 | Lc 71.4 | ✅ pass |
|
|
110
119
|
|
|
111
120
|
### Amber CRT — dark
|
|
112
121
|
|
|
113
122
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
114
123
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
115
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 11.57:1 | Lc
|
|
116
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 10.52:1 | Lc
|
|
117
|
-
| `--
|
|
118
|
-
| `--
|
|
119
|
-
| `--
|
|
120
|
-
| `--accent` | `--
|
|
124
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 11.57:1 | Lc 74.8 | ✅ pass |
|
|
125
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 10.52:1 | Lc 73.8 | ✅ pass |
|
|
126
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 1.34:1 | Lc 15.1 | ℹ️ not gated |
|
|
127
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 1.46:1 | Lc 20.3 | ℹ️ not gated |
|
|
128
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 11.88:1 | Lc 71.6 | ✅ pass |
|
|
129
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 11.88:1 | Lc 71.6 | ✅ pass |
|
|
130
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 10.60:1 | Lc 69.9 | ✅ pass |
|
|
131
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 9.64:1 | Lc 68.9 | ✅ pass |
|
|
132
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 10.60:1 | Lc 69.9 | ✅ pass |
|
|
121
133
|
|
|
122
134
|
### E-ink — light
|
|
123
135
|
|
|
124
136
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
125
137
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
126
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 12.23:1 | Lc 93 | ✅ pass |
|
|
127
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 13.47:1 | Lc
|
|
128
|
-
| `--
|
|
129
|
-
| `--
|
|
130
|
-
| `--
|
|
131
|
-
| `--accent` | `--
|
|
138
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 12.23:1 | Lc 93.3 | ✅ pass |
|
|
139
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 13.47:1 | Lc 99.9 | ✅ pass |
|
|
140
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 11.43:1 | Lc 88.8 | ℹ️ not gated |
|
|
141
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 12.22:1 | Lc 93.2 | ℹ️ not gated |
|
|
142
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 11.74:1 | Lc 100.6 | ✅ pass |
|
|
143
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 11.74:1 | Lc 100.6 | ✅ pass |
|
|
144
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 10.66:1 | Lc 90.4 | ✅ pass |
|
|
145
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 11.74:1 | Lc 97.0 | ✅ pass |
|
|
146
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 10.66:1 | Lc 90.4 | ✅ pass |
|
|
132
147
|
|
|
133
148
|
### E-ink — dark
|
|
134
149
|
|
|
135
150
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
136
151
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
137
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 12.47:1 | Lc 79 | ✅ pass |
|
|
138
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 11.35:1 | Lc 78 | ✅ pass |
|
|
139
|
-
| `--
|
|
140
|
-
| `--
|
|
141
|
-
| `--
|
|
142
|
-
| `--accent` | `--
|
|
152
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 12.47:1 | Lc 79.1 | ✅ pass |
|
|
153
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 11.35:1 | Lc 78.1 | ✅ pass |
|
|
154
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 1.25:1 | Lc 11.0 | ℹ️ not gated |
|
|
155
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 1.35:1 | Lc 16.3 | ℹ️ not gated |
|
|
156
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 12.86:1 | Lc 75.6 | ✅ pass |
|
|
157
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 12.86:1 | Lc 75.6 | ✅ pass |
|
|
158
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 11.48:1 | Lc 74.1 | ✅ pass |
|
|
159
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 10.44:1 | Lc 73.1 | ✅ pass |
|
|
160
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 11.48:1 | Lc 74.1 | ✅ pass |
|
|
143
161
|
|
|
144
162
|
### Phosphor Green — light
|
|
145
163
|
|
|
146
164
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
147
165
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
148
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.22:1 | Lc
|
|
149
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 6.85:1 | Lc 83 | ✅ pass |
|
|
150
|
-
| `--
|
|
151
|
-
| `--
|
|
152
|
-
| `--
|
|
153
|
-
| `--accent` | `--
|
|
166
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 6.22:1 | Lc 76.6 | ✅ pass |
|
|
167
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 6.85:1 | Lc 83.3 | ✅ pass |
|
|
168
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 5.81:1 | Lc 72.2 | ℹ️ not gated |
|
|
169
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 6.21:1 | Lc 76.5 | ℹ️ not gated |
|
|
170
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 5.19:1 | Lc 80.7 | ✅ pass |
|
|
171
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 5.19:1 | Lc 80.7 | ✅ pass |
|
|
172
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 4.71:1 | Lc 68.6 | ✅ pass |
|
|
173
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 5.19:1 | Lc 75.3 | ✅ pass |
|
|
174
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 4.71:1 | Lc 68.6 | ✅ pass |
|
|
154
175
|
|
|
155
176
|
### Phosphor Green — dark
|
|
156
177
|
|
|
157
178
|
| Foreground | Background | Role | Held to | Ratio | APCA _(advisory)_ | Verdict |
|
|
158
179
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
159
|
-
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 12.97:1 | Lc
|
|
160
|
-
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 11.80:1 | Lc
|
|
161
|
-
| `--
|
|
162
|
-
| `--
|
|
163
|
-
| `--
|
|
164
|
-
| `--accent` | `--
|
|
180
|
+
| `--accent-text` | `--bg` | Accent text on page background | AA text (4.5:1) | 12.97:1 | Lc 81.8 | ✅ pass |
|
|
181
|
+
| `--accent-text` | `--surface` | Accent text on a card | AA text (4.5:1) | 11.80:1 | Lc 80.8 | ✅ pass |
|
|
182
|
+
| `--accent-text` | `--accent-soft` | Accent text on an accent tint | Advisory (translucent tint — not gated) | 1.20:1 | Lc 8.4 | ℹ️ not gated |
|
|
183
|
+
| `--accent-text` | `--bg-accent` | Accent text on an accent-tinted surface | Advisory (translucent tint — not gated) | 1.30:1 | Lc 13.7 | ℹ️ not gated |
|
|
184
|
+
| `--button-text` | `--accent` | Label on the primary button | AA text (4.5:1) | 13.75:1 | Lc 79.7 | ✅ pass |
|
|
185
|
+
| `--on-accent` | `--accent` | Ink on an accent fill | AA text (4.5:1) | 13.75:1 | Lc 79.7 | ✅ pass |
|
|
186
|
+
| `--focus-ring` | `--bg` | Focus ring vs page background | UI / large (3:1) | 12.27:1 | Lc 78.5 | ✅ pass |
|
|
187
|
+
| `--focus-ring` | `--surface` | Focus ring vs a card | UI / large (3:1) | 11.16:1 | Lc 77.5 | ✅ pass |
|
|
188
|
+
| `--accent` | `--bg` | Accent fill vs page background | UI / large (3:1) | 12.27:1 | Lc 78.5 | ✅ pass |
|
|
165
189
|
|
|
166
190
|
## Data-viz palette (advisory)
|
|
167
191
|
|
|
@@ -178,27 +202,27 @@ the brand accent.
|
|
|
178
202
|
|
|
179
203
|
| Series | Colour | Ratio _(advisory)_ | APCA _(advisory)_ |
|
|
180
204
|
| --- | --- | --- | --- |
|
|
181
|
-
| 1 _(accent)_ | `#d71921` | 4.71:1 | Lc
|
|
182
|
-
| 2 | `#e69f00` | 2.05:1 | Lc 37 |
|
|
183
|
-
| 3 | `#56b4e9` | 2.10:1 | Lc
|
|
184
|
-
| 4 | `#009e73` | 3.11:1 | Lc 54 |
|
|
185
|
-
| 5 | `#f0e442` | 1.20:1 | Lc 9 |
|
|
186
|
-
| 6 | `#0072b2` | 4.71:1 | Lc 68 |
|
|
187
|
-
| 7 | `#cc79a7` | 2.78:1 | Lc
|
|
188
|
-
| 8 | `#4d5358` | 7.08:1 | Lc 80 |
|
|
205
|
+
| 1 _(accent)_ | `#d71921` | 4.71:1 | Lc 66.8 |
|
|
206
|
+
| 2 | `#e69f00` | 2.05:1 | Lc 37.4 |
|
|
207
|
+
| 3 | `#56b4e9` | 2.10:1 | Lc 38.6 |
|
|
208
|
+
| 4 | `#009e73` | 3.11:1 | Lc 54.4 |
|
|
209
|
+
| 5 | `#f0e442` | 1.20:1 | Lc 9.1 |
|
|
210
|
+
| 6 | `#0072b2` | 4.71:1 | Lc 68.4 |
|
|
211
|
+
| 7 | `#cc79a7` | 2.78:1 | Lc 50.6 |
|
|
212
|
+
| 8 | `#4d5358` | 7.08:1 | Lc 80.4 |
|
|
189
213
|
|
|
190
214
|
### Dark theme — categorical vs `--bg`
|
|
191
215
|
|
|
192
216
|
| Series | Colour | Ratio _(advisory)_ | APCA _(advisory)_ |
|
|
193
217
|
| --- | --- | --- | --- |
|
|
194
|
-
| 1 _(accent)_ | `#ff3b41` | 5.31:1 | Lc 40 |
|
|
195
|
-
| 2 | `#e69f00` | 8.32:1 | Lc
|
|
196
|
-
| 3 | `#56b4e9` | 8.12:1 | Lc 56 |
|
|
197
|
-
| 4 | `#009e73` | 5.48:1 | Lc 40 |
|
|
198
|
-
| 5 | `#f0e442` | 14.17:1 | Lc 87 |
|
|
199
|
-
| 6 | `#0072b2` | 3.61:1 | Lc 26 |
|
|
200
|
-
| 7 | `#cc79a7` | 6.12:1 | Lc
|
|
201
|
-
| 8 | `#4d5358` | 2.40:1 | Lc 14 |
|
|
218
|
+
| 1 _(accent)_ | `#ff3b41` | 5.31:1 | Lc 40.0 |
|
|
219
|
+
| 2 | `#e69f00` | 8.32:1 | Lc 57.5 |
|
|
220
|
+
| 3 | `#56b4e9` | 8.12:1 | Lc 56.3 |
|
|
221
|
+
| 4 | `#009e73` | 5.48:1 | Lc 40.0 |
|
|
222
|
+
| 5 | `#f0e442` | 14.17:1 | Lc 87.4 |
|
|
223
|
+
| 6 | `#0072b2` | 3.61:1 | Lc 26.1 |
|
|
224
|
+
| 7 | `#cc79a7` | 6.12:1 | Lc 43.9 |
|
|
225
|
+
| 8 | `#4d5358` | 2.40:1 | Lc 14.4 |
|
|
202
226
|
|
|
203
227
|
## Scope & caveats
|
|
204
228
|
|
package/docs/d2.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# D2
|
|
2
|
+
|
|
3
|
+
[D2](https://d2lang.com) compiles a diagram script to **SVG** (Go CLI or the
|
|
4
|
+
`@terrastruct/d2` WASM build). Like the [Mermaid integration](./mermaid.md),
|
|
5
|
+
`@ponchia/ui` doesn't render diagrams — it **themes** them from your tokens and
|
|
6
|
+
lets you **annotate** the result. Two things ship:
|
|
7
|
+
|
|
8
|
+
- `@ponchia/ui/d2` — helpers that produce on-brand D2 theme overrides.
|
|
9
|
+
- `@ponchia/ui/d2.json` — the resolved slot → hex maps, for any consumer.
|
|
10
|
+
|
|
11
|
+
D2 stays the consumer's renderer; this is config only, and D2 is **not** a
|
|
12
|
+
dependency.
|
|
13
|
+
|
|
14
|
+
## Theme a diagram
|
|
15
|
+
|
|
16
|
+
D2's theme is a compact set of named colour slots. Override them with the bronto
|
|
17
|
+
palette by prepending a `vars` block to your diagram source — `brontoD2Vars()`
|
|
18
|
+
returns exactly that block (both light and dark):
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { brontoD2Vars } from '@ponchia/ui/d2';
|
|
22
|
+
|
|
23
|
+
const source = brontoD2Vars() + `
|
|
24
|
+
api -> db: query
|
|
25
|
+
db: Store { shape: cylinder }
|
|
26
|
+
`;
|
|
27
|
+
// → render `source` with the D2 CLI or @terrastruct/d2
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If you render through D2's Go or WASM API instead of source, pass the slot map to
|
|
31
|
+
its `themeOverrides` / `darkThemeOverrides`:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { brontoD2Overrides } from '@ponchia/ui/d2';
|
|
35
|
+
brontoD2Overrides('dark'); // { N1: '#e6e6e6', B1: '#555555', … }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For a build step or non-JS host, read `@ponchia/ui/d2.json` directly.
|
|
39
|
+
|
|
40
|
+
> **file:// portability.** A report opened from disk (`file://`) cannot
|
|
41
|
+
> `import` the `@ponchia/ui/d2` module **nor** `fetch('…/d2.json')` — the browser
|
|
42
|
+
> blocks both across the `null`/file origin (CORS), exactly as with
|
|
43
|
+
> [Vega](./vega.md#from-a-cdn-no-bundler) and [Mermaid](./mermaid.md#theme-a-diagram).
|
|
44
|
+
> This is rarely an issue for D2, whose native path is **build-time
|
|
45
|
+
> pre-rendering** to a frozen SVG (no client runtime — see below), but if you do
|
|
46
|
+
> theme D2 in the browser over `file://`, **inline** the slot map (generate the
|
|
47
|
+
> paste-ready literal with `npm run emit:theme d2 light` / `dark`, and guard it
|
|
48
|
+
> against token drift with `npm run emit:theme:check <file>`) rather than
|
|
49
|
+
> importing it. Over `http(s)` the `import`/`fetch` forms both work.
|
|
50
|
+
|
|
51
|
+
### Why resolved colours, not `var(--x)`
|
|
52
|
+
|
|
53
|
+
D2 compiles to a **frozen SVG** in Go/WASM — there is no client CSS cascade, so a
|
|
54
|
+
`var(--accent)` could never resolve. The maps therefore ship **resolved hex per
|
|
55
|
+
theme**, projected from the same token source as
|
|
56
|
+
[`tokens/resolved.json`](./architecture.md) / `charts.json`. Each slot is set
|
|
57
|
+
explicitly (D2 does not derive a ramp from one seed). Because the output is a
|
|
58
|
+
static SVG, **build-time pre-rendering is D2's native path** — ideal for the
|
|
59
|
+
[report layer](./reporting.md).
|
|
60
|
+
|
|
61
|
+
### What the slots paint
|
|
62
|
+
|
|
63
|
+
The mapping keeps a diagram **monochrome by default** — the rationed accent is
|
|
64
|
+
not spent on borders, edges, or shapes the author never marked:
|
|
65
|
+
|
|
66
|
+
| Slots | Paint | bronto mapping |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| `N1`–`N3` | Text · muted · subtle | `--text` · `--text-soft` · `--text-dim` |
|
|
69
|
+
| `N4`–`N5` | Strong / regular lines | `--line-strong` · `--line` |
|
|
70
|
+
| `N6`–`N7` | Subtle background · canvas | `--panel-soft` · `--bg` |
|
|
71
|
+
| `B1` | Shape borders **and** connections (edges) | `--line-strong` |
|
|
72
|
+
| `B2`–`B3` | Muted borders | `--line` |
|
|
73
|
+
| `B4`–`B6` | Container fills (outer → leaf) | `--panel-soft` · `--bg-elevated` · `--panel` |
|
|
74
|
+
| `AA*` / `AB*` | Alternative-accent ramps (special-shape fills, class/sql headers) | kept **neutral** |
|
|
75
|
+
|
|
76
|
+
The alt-accent ramps are deliberately neutral: D2 spends them on special shapes
|
|
77
|
+
(cylinders, class/sql-table headers) by default, so mapping them to the accent
|
|
78
|
+
would colour shapes you never marked. Keeping them neutral is what holds the
|
|
79
|
+
monochrome default.
|
|
80
|
+
|
|
81
|
+
### Spending the accent
|
|
82
|
+
|
|
83
|
+
To emphasise a node, opt it into a class that sets the accent explicitly — the
|
|
84
|
+
accent appears only where you ask for it:
|
|
85
|
+
|
|
86
|
+
```d2
|
|
87
|
+
classes: {
|
|
88
|
+
accent: {
|
|
89
|
+
style: { fill: "#d71921"; font-color: "#ffffff"; stroke: "#b2151b" }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
alert: Alert { class: accent }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use the resolved `--accent` / `--accent-strong` hex (from
|
|
97
|
+
[`tokens/resolved.json`](./architecture.md), per theme) for the `fill` / `stroke`
|
|
98
|
+
so the emphasis matches the rest of the surface. Reserve it for the one thing a
|
|
99
|
+
reader must not miss.
|
|
100
|
+
|
|
101
|
+
> **The label on an accent fill uses `--on-accent`, not `--accent-text`.** A
|
|
102
|
+
> filled-accent node needs **on-accent ink** for its `font-color` — the resolved
|
|
103
|
+
> `--on-accent` token (white on the light accent, black on the dark accent;
|
|
104
|
+
> ≥ 4.5:1, gated in [contrast.md](./contrast.md)). Do **not** reach for
|
|
105
|
+
> `--accent-text` by name: that is the inverse token — _accent-coloured text for
|
|
106
|
+
> a neutral background_ (it resolves to `--accent-strong`, ~1.3:1 on the accent
|
|
107
|
+
> fill, an unreadable label). The literal `#ffffff` above is `--on-accent` for
|
|
108
|
+
> the light theme; pull the per-theme hex from `tokens/resolved.json`.
|
|
109
|
+
|
|
110
|
+
### Frozen inline SVG (no D2 runtime)
|
|
111
|
+
|
|
112
|
+
A static, PDF-first report often has no D2 binary in its pipeline. When you only
|
|
113
|
+
need a few boxes and arrows, **hand-author a token-themed inline `<svg>`** instead
|
|
114
|
+
of running D2 — the same frozen-figure route the [report chart
|
|
115
|
+
recipe](./reporting.md#chart-figure-recipe) uses. Paint each element from the
|
|
116
|
+
token that the live theme map would have resolved, so the frozen diagram still
|
|
117
|
+
re-skins (drive fills from `var(--token)` in the inline `style`/attributes, or
|
|
118
|
+
paste the resolved hex from [`tokens/resolved.json`](./architecture.md) for a
|
|
119
|
+
`file://` PDF):
|
|
120
|
+
|
|
121
|
+
| Diagram element | bronto token | (live D2 slot it mirrors) |
|
|
122
|
+
| --- | --- | --- |
|
|
123
|
+
| Node fill | `--panel` | `B4`–`B6` container fills |
|
|
124
|
+
| Node border | `--line-strong` | `B1` |
|
|
125
|
+
| Node label | `--text` | `N1` |
|
|
126
|
+
| Edge / connector + arrowhead | `--line-strong` | `B1` |
|
|
127
|
+
| Edge label | `--text-soft` | `N2` |
|
|
128
|
+
| Cluster / container fill | `--panel-soft` | `B4` |
|
|
129
|
+
| Accent (emphasised) node fill · its label | `--accent` · `--on-accent` | the `accent` class above |
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<svg viewBox="0 0 320 120" role="img" aria-labelledby="flow-title">
|
|
133
|
+
<title id="flow-title">Ingest → Queue → Worker</title>
|
|
134
|
+
<!-- edge -->
|
|
135
|
+
<line x1="92" y1="40" x2="128" y2="40" stroke="var(--line-strong)" marker-end="url(#arrow)" />
|
|
136
|
+
<line x1="220" y1="40" x2="256" y2="40" stroke="var(--line-strong)" marker-end="url(#arrow)" />
|
|
137
|
+
<defs>
|
|
138
|
+
<marker id="arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
|
|
139
|
+
<path d="M0,0 L8,4 L0,8 z" fill="var(--line-strong)" />
|
|
140
|
+
</marker>
|
|
141
|
+
</defs>
|
|
142
|
+
<!-- neutral node -->
|
|
143
|
+
<rect x="16" y="22" width="76" height="36" rx="6" fill="var(--panel)" stroke="var(--line-strong)" />
|
|
144
|
+
<text x="54" y="44" text-anchor="middle" fill="var(--text)" font-size="12">Ingest</text>
|
|
145
|
+
<!-- accent (emphasised) node: on-accent ink on the accent fill -->
|
|
146
|
+
<rect x="128" y="22" width="92" height="36" rx="6" fill="var(--accent)" stroke="var(--accent-strong)" />
|
|
147
|
+
<text x="174" y="44" text-anchor="middle" fill="var(--on-accent)" font-size="12">Queue</text>
|
|
148
|
+
<rect x="256" y="22" width="64" height="36" rx="6" fill="var(--panel)" stroke="var(--line-strong)" />
|
|
149
|
+
<text x="288" y="44" text-anchor="middle" fill="var(--text)" font-size="12">Worker</text>
|
|
150
|
+
</svg>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
For anything larger or graph-laid-out, run D2 with the theme map and freeze its
|
|
154
|
+
output — don't hand-lay a complex graph.
|
|
155
|
+
|
|
156
|
+
### Fit to small screens
|
|
157
|
+
|
|
158
|
+
D2 emits an SVG with explicit `width`/`height` from its layout, so on a narrow
|
|
159
|
+
screen it overflows unless you make it fluid. Two build-time options:
|
|
160
|
+
|
|
161
|
+
- **Scale to fit** — drop the fixed `width`/`height` attributes (keep the
|
|
162
|
+
`viewBox`) so the SVG shrinks to its container. Best for diagrams that stay
|
|
163
|
+
legible at smaller sizes.
|
|
164
|
+
- **Scroll a wide diagram** — wrap it in `overflow-x: auto` so a large diagram
|
|
165
|
+
scrolls inside its box instead of pushing the page wide, the same pattern the
|
|
166
|
+
report layer uses for wide figures.
|
|
167
|
+
|
|
168
|
+
```css
|
|
169
|
+
.diagram-scroll {
|
|
170
|
+
overflow-x: auto;
|
|
171
|
+
}
|
|
172
|
+
.diagram-scroll svg {
|
|
173
|
+
max-inline-size: 100%;
|
|
174
|
+
block-size: auto;
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Render **non-sketch** at a fixed `scale` for predictable boxes.
|
|
179
|
+
|
|
180
|
+
## Annotate a diagram
|
|
181
|
+
|
|
182
|
+
D2 output is SVG, so the [annotation layer](./annotations.md) composes onto it
|
|
183
|
+
exactly as in the [Mermaid recipe](./mermaid.md#annotate-a-diagram): render to a
|
|
184
|
+
frozen SVG (the D2 CLI `d2 in.d2 out.svg`, or `@terrastruct/d2` in a build
|
|
185
|
+
script), read the target shape's box, and paste a `<g class="ui-annotation">`
|
|
186
|
+
computed with `@ponchia/ui/annotations`. The same caveats apply — D2's internal
|
|
187
|
+
SVG (element ids, the root transform) is not a public contract, so pin your D2
|
|
188
|
+
version, render **non-sketch**, account for `pad` / `scale`, and avoid
|
|
189
|
+
`animate-interval` (a multi-board animated SVG would not track a single overlay).
|
|
190
|
+
|
|
191
|
+
## Scope
|
|
192
|
+
|
|
193
|
+
bronto owns the theme map (gated: every slot resolves to a colour, both themes,
|
|
194
|
+
no `var()` leaks) and the annotation geometry. It does not own D2's rendering,
|
|
195
|
+
its internal SVG, or its CLI — those stay D2's, and the overlay is a documented
|
|
196
|
+
composition, not a shipped runtime binding.
|
package/docs/diff.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Diff
|
|
2
|
+
|
|
3
|
+
`@ponchia/ui/css/diff.css` is an opt-in change-review grammar — the surface for
|
|
4
|
+
showing what **changed**: code review, changelogs, version history, config
|
|
5
|
+
diffs, and generated reports. Marks call out a sentence; diff calls out a line.
|
|
6
|
+
Its sibling is [code.css](code.md) (single-file fenced code); the two share one
|
|
7
|
+
change vocabulary — `--add` / `--remove` (`ui-diff__row--remove` ↔
|
|
8
|
+
`ui-code__line--remove`).
|
|
9
|
+
|
|
10
|
+
```css
|
|
11
|
+
@import '@ponchia/ui';
|
|
12
|
+
@import '@ponchia/ui/css/diff.css';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<!-- node_modules / CDN: source css/ → built dist/css/ -->
|
|
17
|
+
<link rel="stylesheet" href="./node_modules/@ponchia/ui/dist/css/diff.css" />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Boundary — what Bronto owns vs. what you own
|
|
21
|
+
|
|
22
|
+
Bronto paints the gutter grammar. **You** pre-classify each row (`add` /
|
|
23
|
+
`remove` / `context`), compute the hunks, and align the two sides in split
|
|
24
|
+
view. Bronto never parses or diffs source — that needs your tokenizer and your
|
|
25
|
+
alignment, the same line that removed the local chart renderer in `0.6.0`. Feed
|
|
26
|
+
it rows that are already classified by your diff engine (`jsdiff`, `git`, a
|
|
27
|
+
language server, …).
|
|
28
|
+
|
|
29
|
+
## Unified view — `.ui-diff`
|
|
30
|
+
|
|
31
|
+
Rows are direct children of `.ui-diff` (optionally grouped in a
|
|
32
|
+
`.ui-diff__hunk`). Columns are `[old-ln] [new-ln] [code]`. Mark each changed row
|
|
33
|
+
`--add` / `--remove`, and leave unchanged rows `--context`. Line numbers are
|
|
34
|
+
decorative — keep them `aria-hidden`; the `__code` cell carries the content.
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="ui-diff">
|
|
38
|
+
<div class="ui-diff__hunk">
|
|
39
|
+
<div class="ui-diff__head">@@ -12,6 +12,6 @@ .ui-diff</div>
|
|
40
|
+
|
|
41
|
+
<div class="ui-diff__row ui-diff__row--context">
|
|
42
|
+
<span class="ui-diff__ln" aria-hidden="true">12</span>
|
|
43
|
+
<span class="ui-diff__ln" aria-hidden="true">12</span>
|
|
44
|
+
<code class="ui-diff__code"> border: 1px solid var(--line);</code>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="ui-diff__row ui-diff__row--remove">
|
|
48
|
+
<span class="ui-diff__ln" aria-hidden="true">13</span>
|
|
49
|
+
<span class="ui-diff__ln" aria-hidden="true"></span>
|
|
50
|
+
<code class="ui-diff__code"> font-size: var(--text-sm);</code>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="ui-diff__row ui-diff__row--add">
|
|
54
|
+
<span class="ui-diff__ln" aria-hidden="true"></span>
|
|
55
|
+
<span class="ui-diff__ln" aria-hidden="true">13</span>
|
|
56
|
+
<code class="ui-diff__code"> font-size: var(--text-xs);</code>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A removed row leaves the **new** line-number cell empty; an added row leaves the
|
|
63
|
+
**old** one empty. The `+` / `−` gutter glyph is painted for you from the row
|
|
64
|
+
modifier.
|
|
65
|
+
|
|
66
|
+
## Split view — `.ui-diff--split`
|
|
67
|
+
|
|
68
|
+
`.ui-diff--split` lays two `.ui-diff__pane` columns side by side (old | new),
|
|
69
|
+
each its own `[ln] [code]` grid. Put `--remove` / `--context` rows in the left
|
|
70
|
+
pane and `--add` / `--context` rows in the right. You align the panes by
|
|
71
|
+
emitting matching row counts (filler `--context` rows where one side is empty).
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<div class="ui-diff ui-diff--split">
|
|
75
|
+
<div class="ui-diff__pane">
|
|
76
|
+
<div class="ui-diff__row ui-diff__row--context">
|
|
77
|
+
<span class="ui-diff__ln" aria-hidden="true">1</span>
|
|
78
|
+
<code class="ui-diff__code">retries: 3</code>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="ui-diff__row ui-diff__row--remove">
|
|
81
|
+
<span class="ui-diff__ln" aria-hidden="true">2</span>
|
|
82
|
+
<code class="ui-diff__code">timeout: 30</code>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="ui-diff__pane">
|
|
86
|
+
<div class="ui-diff__row ui-diff__row--context">
|
|
87
|
+
<span class="ui-diff__ln" aria-hidden="true">1</span>
|
|
88
|
+
<code class="ui-diff__code">retries: 3</code>
|
|
89
|
+
</div>
|
|
90
|
+
<div class="ui-diff__row ui-diff__row--add">
|
|
91
|
+
<span class="ui-diff__ln" aria-hidden="true">2</span>
|
|
92
|
+
<code class="ui-diff__code">timeout: 10</code>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For a hard before/after of two whole files, you can also drop two plain
|
|
99
|
+
`.ui-diff` blocks into a [`.ui-compare--2up`](./reporting.md) layout.
|
|
100
|
+
|
|
101
|
+
## Class reference
|
|
102
|
+
|
|
103
|
+
| Class | Role |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `.ui-diff` | The grid container (unified view). |
|
|
106
|
+
| `.ui-diff--split` | Two-pane (old \| new) layout modifier. |
|
|
107
|
+
| `.ui-diff__pane` | One column in split view; its own `[ln] [code]` grid. |
|
|
108
|
+
| `.ui-diff__hunk` | Optional `role="rowgroup"` wrapper for a hunk (layout-transparent). |
|
|
109
|
+
| `.ui-diff__head` | A hunk / file header row, spanning all columns. |
|
|
110
|
+
| `.ui-diff__row` | A line row (layout-transparent; the cells are the grid items). |
|
|
111
|
+
| `.ui-diff__row--add` | Added line — green tint + `+` gutter glyph. |
|
|
112
|
+
| `.ui-diff__row--remove` | Removed line — red tint + `−` gutter glyph. |
|
|
113
|
+
| `.ui-diff__row--context` | Unchanged line — no tint, blank gutter. |
|
|
114
|
+
| `.ui-diff__ln` | A line-number gutter cell (`tabular-nums`, `user-select:none`; keep it `aria-hidden`). |
|
|
115
|
+
| `.ui-diff__code` | A code cell. Long lines wrap (no horizontal scroll), so it prints cleanly. |
|
|
116
|
+
|
|
117
|
+
## Recipes
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import { ui } from '@ponchia/ui/classes';
|
|
121
|
+
|
|
122
|
+
ui.diff(); // "ui-diff"
|
|
123
|
+
ui.diff({ split: true }); // "ui-diff ui-diff--split"
|
|
124
|
+
ui.diffRow({ change: 'add' }); // "ui-diff__row ui-diff__row--add"
|
|
125
|
+
ui.diffRow({ change: 'remove' }); // "ui-diff__row ui-diff__row--remove"
|
|
126
|
+
ui.diffRow(); // "ui-diff__row" (use --context for an explicit unchanged row)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Accessibility & robustness
|
|
130
|
+
|
|
131
|
+
- **Redundant channel (WCAG 1.4.1).** Add/remove is never colour-only: the
|
|
132
|
+
`+` / `−` gutter glyph is generated content, so it survives **forced colours**
|
|
133
|
+
and **print**, where the tone tint is dropped. In forced-colors mode the
|
|
134
|
+
changed code cell also gains an inline-start border.
|
|
135
|
+
- **Print.** Tints are forced through with `print-color-adjust: exact`, and long
|
|
136
|
+
lines wrap rather than clip — the diff survives the PDF pipeline.
|
|
137
|
+
- **Line numbers** are decorative: `aria-hidden` them and they stay out of a
|
|
138
|
+
copy selection (`user-select: none`), so copying the diff yields clean code.
|
|
139
|
+
- **Semantics** live in your markup. By default the surface is role-free: with
|
|
140
|
+
the line numbers `aria-hidden`, a screen reader reads the `__code` lines in
|
|
141
|
+
DOM order, which is a faithful reading of the diff. If you want grid/table
|
|
142
|
+
semantics, use a real `<table>` or add the full ARIA chain
|
|
143
|
+
(`role="table" > rowgroup > row > cell`) — a bare `role="row"` without
|
|
144
|
+
`role="cell"` children is an ARIA violation. If the change kind itself must be
|
|
145
|
+
announced, add an off-screen label per changed row; do not rely on the glyph
|
|
146
|
+
alone.
|