@brunosouzas/design-system 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +13 -0
- package/README.md +90 -41
- package/dist/scripts/cover.d.ts +7 -4
- package/dist/scripts/cover.js +25 -8
- package/dist/src/fonts/embed.d.ts +7 -0
- package/dist/src/fonts/embed.js +219 -0
- package/dist/src/pieces/bank-objects.d.ts +1 -1
- package/dist/src/pieces/bank-objects.js +26 -18
- package/dist/src/pieces/category-icon.d.ts +4 -4
- package/dist/src/pieces/category-icon.js +33 -22
- package/dist/src/pieces/cover.js +9 -3
- package/dist/src/pieces/diagram.js +3 -3
- package/dist/src/pieces/eip-icons.js +27 -27
- package/dist/src/pieces/emote.d.ts +13 -0
- package/dist/src/pieces/emote.js +88 -0
- package/dist/src/pieces/index.d.ts +1 -1
- package/dist/src/pieces/index.js +1 -1
- package/dist/src/pieces/ink.d.ts +26 -16
- package/dist/src/pieces/ink.js +15 -6
- package/dist/src/pieces/library.d.ts +9 -15
- package/dist/src/pieces/library.js +52 -53
- package/dist/src/pieces/link-icons.d.ts +2 -1
- package/dist/src/pieces/link-icons.js +10 -18
- package/dist/src/pieces/metro.d.ts +4 -2
- package/dist/src/pieces/metro.js +14 -13
- package/dist/src/pieces/node.d.ts +5 -3
- package/dist/src/pieces/node.js +6 -4
- package/dist/src/pieces/params.js +2 -2
- package/dist/tokens/generated/tokens.d.ts +86 -171
- package/dist/tokens/generated/tokens.js +87 -172
- package/fonts/OFL.txt +97 -0
- package/fonts/SourceCodePro-Bold.ttf +0 -0
- package/fonts/SourceCodePro-Regular.ttf +0 -0
- package/fonts/SourceSans3-Black.ttf +0 -0
- package/fonts/SourceSans3-Bold.ttf +0 -0
- package/fonts/SourceSans3-Regular.ttf +0 -0
- package/package.json +10 -1
- package/tokens/generated/tokens.css +78 -125
- package/tokens/generated/tokens.json +87 -172
- package/tokens/generated/tokens.ts +87 -172
- package/dist/src/pieces/cast.d.ts +0 -35
- package/dist/src/pieces/cast.js +0 -333
package/NOTICE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@brunosouzas/design-system
|
|
2
|
+
Copyright Bruno Souza. Licensed under the Apache License, Version 2.0 (LICENSE).
|
|
3
|
+
|
|
4
|
+
This package ships third-party font files, unmodified, in fonts/:
|
|
5
|
+
|
|
6
|
+
- Source Sans 3, release 3.052R (SourceSans3-Regular.ttf, SourceSans3-Bold.ttf,
|
|
7
|
+
SourceSans3-Black.ttf), from https://github.com/adobe-fonts/source-sans
|
|
8
|
+
- Source Code Pro, release 2.042R (SourceCodePro-Regular.ttf,
|
|
9
|
+
SourceCodePro-Bold.ttf), from https://github.com/adobe-fonts/source-code-pro
|
|
10
|
+
|
|
11
|
+
Copyright Adobe, with Reserved Font Name 'Source'. Licensed under the SIL Open
|
|
12
|
+
Font License, Version 1.1: fonts/OFL.txt. The cover command embeds a subset of
|
|
13
|
+
these faces in the SVG files it writes (an embedded document font, OFL-FAQ 1.12).
|
package/README.md
CHANGED
|
@@ -25,19 +25,19 @@ The visual identity of [brunosouzas.com](https://brunosouzas.com): design tokens
|
|
|
25
25
|
|
|
26
26
|
## Status
|
|
27
27
|
|
|
28
|
-
Early. The first change of the [roadmap](docs/roadmap.md) is implemented: the token source and its CSS, TypeScript and JSON exports, the motion components, and the circuit-breaker state machine as the first catalogue scene (16:9 and 4:5, Portuguese and English), with commands to render its stills and videos. The first variety scene, `publish-subscribe`, is implemented with independent message copies, Publish acceptance, two ACKs and a local invoice NACK. Its owner stills/video approval is pending; implementation is not visual approval. The illustration pieces (roadmap item 3), the metro and diagram pieces (item 6) stackledger's map markers, zones and icons (AB#167, 0.3.0) and the body diagram pieces (AB#141, 0.3.2) are implemented: the static drawing library that covers, banners, diagrams and scenes share, with a command that builds a blog cover from a JSON spec. The published covers are not ported to it yet (item 5).
|
|
28
|
+
Early. The first change of the [roadmap](docs/roadmap.md) is implemented: the token source and its CSS, TypeScript and JSON exports, the motion components, and the circuit-breaker state machine as the first catalogue scene (16:9 and 4:5, Portuguese and English), with commands to render its stills and videos. The first variety scene, `publish-subscribe`, is implemented with independent message copies, Publish acceptance, two ACKs and a local invoice NACK. Its owner stills/video approval is pending; implementation is not visual approval. The illustration pieces (roadmap item 3), the metro and diagram pieces (item 6) stackledger's map markers, zones and icons (AB#167, 0.3.0) and the body diagram pieces (AB#141, 0.3.2) are implemented: the static drawing library that covers, banners, diagrams and scenes share, with a command that builds a blog cover from a JSON spec. The published covers are not ported to it yet (item 5). Mira, the four pillar characters, the bank objects and the emotes are pieces too ([ADR 0007](docs/adr/0007-mira-and-the-pillar-cast.md)); new videos are language-neutral by default ([ADR 0005](docs/adr/0005-neutral-videos-and-the-cast.md)). Since 0.7.0 every piece follows one grammar ([ADR 0009](docs/adr/0009-one-piece-grammar.md)) and every written SVG carries its Source faces ([ADR 0008](docs/adr/0008-type-inside-the-image.md)); see [Upgrading to 0.7.0](#upgrading-to-070). 0.8.0 maps the site palette onto the brand roles and adds the category badges; see [Upgrading to 0.8.0](#upgrading-to-080).
|
|
29
29
|
|
|
30
30
|
## What it is
|
|
31
31
|
|
|
32
32
|
The blog's articles explain how systems behave: a circuit breaker opening, a pipeline promoting a build, a message being retried. Static diagrams show the states; an animation shows the change. This repository keeps both in one visual language, so a reader recognises the site in an article, on LinkedIn and on a slide.
|
|
33
33
|
|
|
34
|
-
- **Design tokens, one source.** Colours with fixed meanings (green healthy, orange blocked, yellow transitional, red the failure path), the
|
|
35
|
-
- **Motion components.** React components for [Remotion](https://www.remotion.dev): an ink block
|
|
34
|
+
- **Design tokens, one source.** Colours with fixed meanings (green healthy, orange blocked, yellow transitional, red the failure path, under `color.state.*`), the brand palette, the Source type stacks (Source Sans 3, Source Code Pro, Source Serif 4), the thick ink outline, radii, and motion timings. Exported as CSS variables for the site, TypeScript for the animations and JSON for anything else (the SVG generators of the static diagrams).
|
|
35
|
+
- **Motion components.** React components for [Remotion](https://www.remotion.dev): an ink block, a pill label, an arrow that draws itself, a token travelling along a transition, call-result squares, a countdown ring. Flow primitives in `src/brand/flow-components.tsx` add a white hexagonal `Exchange`, rail-ended `Queue`, white-tab `TaggedContainer` and persistent `PositionedToken` (stationary or path-positioned). Copy identities, splits and ACK/NACK rules belong to scenes, not to a generic message engine.
|
|
36
36
|
- **Illustration pieces.** The objects the blog's covers and diagrams draw again and again (pill label, sheet, code panel, robot, server stack, gear, road, the 26 EIP icons and more), each a pure TypeScript function that returns an SVG node tree from the tokens. The same tree becomes an SVG file for a cover and React elements for a scene, and a scene animates a piece by recomputing its parameters every frame. See [Illustration pieces and covers](#illustration-pieces-and-covers).
|
|
37
|
-
- **A cast and emotes.**
|
|
37
|
+
- **A cast and emotes.** Mira and four pillar characters (Visor, Drone, Kiu, Sinal), six bank objects for scenery, and eight reaction symbols with a fixed meaning, so a video can tell its story without words. See [The cast and the emotes](#the-cast-and-the-emotes).
|
|
38
38
|
- **A catalogue of scenes.** Each scene animates something a published article already says. The first two are in 16:9 (article) and 4:5 (LinkedIn), in Portuguese and English from one text table; new scenes are one language-neutral 16:9 video ([ADR 0005](docs/adr/0005-neutral-videos-and-the-cast.md)). The first is the [circuit-breaker state machine](docs/spikes/2026-10-22-motion-pilot/README.md).
|
|
39
39
|
|
|
40
|
-
The style
|
|
40
|
+
The style started from the illustration covers of the [Spotify Engineering blog](https://engineering.atspotify.com/) and, since 0.7.0, follows the brand's own grammar: flat shapes, one rounded ink outline, no hard shadow, white bodies on a warm page, one orange accent, and colour only where it means something ([ADR 0009](docs/adr/0009-one-piece-grammar.md)).
|
|
41
41
|
|
|
42
42
|
## How it works
|
|
43
43
|
|
|
@@ -54,7 +54,7 @@ The generated files are committed, so a consumer can read them without running N
|
|
|
54
54
|
|
|
55
55
|
## Install
|
|
56
56
|
|
|
57
|
-
The tokens and the illustration pieces are published on npm as [`@brunosouzas/design-system`](https://www.npmjs.com/package/@brunosouzas/design-system), with provenance; releases follow [docs/release.md](docs/release.md).
|
|
57
|
+
The tokens and the illustration pieces are published on npm as [`@brunosouzas/design-system`](https://www.npmjs.com/package/@brunosouzas/design-system), with provenance; releases follow [docs/release.md](docs/release.md). Its one runtime dependency is `harfbuzzjs`, pinned exactly, which subsets the fonts it ships in `fonts/` (Source Sans 3 and Source Code Pro, under the [SIL Open Font License](fonts/OFL.txt)); Remotion, the motion components and the scenes stay in this repository.
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
npm install @brunosouzas/design-system
|
|
@@ -64,6 +64,7 @@ npm install @brunosouzas/design-system
|
|
|
64
64
|
|---|---|
|
|
65
65
|
| `@brunosouzas/design-system` | the pieces, `toSvg`, `pose`, the cover spec helpers and `tokens` |
|
|
66
66
|
| `@brunosouzas/design-system/react` | `toReact`, for React and Remotion (needs `react` 19) |
|
|
67
|
+
| `@brunosouzas/design-system/fonts` | `embedFonts`, for Node: embeds the Source faces a tree's text uses (reads `fonts/`, loads WebAssembly) |
|
|
67
68
|
| `@brunosouzas/design-system/tokens` | the typed `tokens` object |
|
|
68
69
|
| `@brunosouzas/design-system/tokens.css` | the `--ds-*` custom properties |
|
|
69
70
|
| `@brunosouzas/design-system/tokens.json` | the plain values |
|
|
@@ -75,9 +76,19 @@ const label = pill({ x: 60, y: 30, text: "main" });
|
|
|
75
76
|
|
|
76
77
|
The package also installs the cover command as `brunosouzas-cover <spec.json> --out <file.svg>`.
|
|
77
78
|
|
|
79
|
+
### Type in a written image
|
|
80
|
+
|
|
81
|
+
An SVG shown through `<img>` cannot load web fonts, so a written image carries its own: `embedFonts(tree)` adds one `<style>` after the `<desc>` with a `@font-face` per Source face the tree's text uses, each a subset holding only the glyphs drawn ([ADR 0008](docs/adr/0008-type-inside-the-image.md)). The cover command and `npm run pieces:sheet` call it before they write; a tree without Source text is returned unchanged. It is async, reads only the faces it needs, and rejects naming the font file or `harfbuzzjs` when one fails to load. It lives in its own entry so the root entry stays importable in a browser. Its output is for written files and `<img>`: when you inline a piece's SVG in an HTML page, skip `embedFonts` and let the page's fonts apply, because an inline `<style>` with `@font-face` applies to the whole document and would replace the page's Source faces with a subset.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { coverTree, toSvg } from "@brunosouzas/design-system";
|
|
85
|
+
import { embedFonts } from "@brunosouzas/design-system/fonts";
|
|
86
|
+
const svg = toSvg(await embedFonts(coverTree(spec)));
|
|
87
|
+
```
|
|
88
|
+
|
|
78
89
|
## Commands
|
|
79
90
|
|
|
80
|
-
Requirements: Node.js 22.12 or later. Rendering also needs the network: Remotion downloads its headless browser on first use, and every render fetches
|
|
91
|
+
Requirements: Node.js 22.12 or later. Rendering also needs the network: Remotion downloads its headless browser on first use, and every render fetches Source Sans 3 and Source Code Pro from Google Fonts.
|
|
81
92
|
|
|
82
93
|
```bash
|
|
83
94
|
npm ci # install the pinned dependencies
|
|
@@ -93,6 +104,7 @@ npm run render -- publish-subscribe --dry-run # print eight commands; real v
|
|
|
93
104
|
npm run build # compile the package into dist/ (the package test needs it)
|
|
94
105
|
npm run cover -- cover.json --out card.svg # build a blog cover (or a banner, diagram or icon) from its spec
|
|
95
106
|
npm run pieces:sheet -- --out out/pieces.svg # every piece once, labelled, for review
|
|
107
|
+
npm run pieces:sheet -- --out out/dark.svg --surface dark # the same on the dark surface
|
|
96
108
|
npm run studio # Remotion Studio, for frame-by-frame review
|
|
97
109
|
```
|
|
98
110
|
|
|
@@ -131,22 +143,22 @@ The components take every colour and size from the tokens, and what is visible a
|
|
|
131
143
|
|
|
132
144
|
- `toSvg(node)` writes a tree as SVG text; `toReact(node)` turns the same tree into React elements. Both describe the same elements, attributes and text, which the tests check.
|
|
133
145
|
- `pose(node, { x, y, tilt, squash, hop, scale, shake, opacity })` animates any piece around its base point; a scene recomputes the numbers every frame.
|
|
134
|
-
- Every colour parameter is a token path (`"color.healthy"`, `"illustration.accent"`), never a hex value, except the three data fills of the map pieces below. Each piece checks its parameters before drawing and names the first wrong one. Positions and points take any finite number, because a map has no edge; sizes stay within 10000. A drawing that would hold a non-finite number throws `<piece>: the drawing overflows`.
|
|
135
|
-
- The
|
|
146
|
+
- Every colour parameter is a token path (`"color.state.healthy"`, `"illustration.accent"`), never a hex value, except the three data fills of the map pieces below. Each piece checks its parameters before drawing and names the first wrong one. Positions and points take any finite number, because a map has no edge; sizes stay within 10000. A drawing that would hold a non-finite number throws `<piece>: the drawing overflows`.
|
|
147
|
+
- The 62 pieces, with their anchors, parameters and defaults, are listed in [design §4](openspec/changes/archive/2026-10-23-illustration-pieces/design.md) (the 26 cover pieces), in [design §3](openspec/changes/archive/2026-10-23-metro-and-diagram-pieces/design.md) of `metro-and-diagram-pieces` (the nine map and diagram pieces) and in [design §3, §5 and §6](openspec/changes/archive/2026-10-23-stackledger-map-and-link-pieces/design.md) of `stackledger-map-and-link-pieces` (the six markers, zones and icons) and in [design §3 to §5](openspec/changes/archive/2026-10-23-body-diagram-pieces/design.md) of `body-diagram-pieces` (the ten body diagram pieces), plus `stateStart` ([design §4](openspec/changes/archive/2026-10-24-designer-formats/design.md) of `designer-formats`); the rules are in [`openspec/specs/illustration-pieces/`](openspec/specs/illustration-pieces/spec.md). `npm run pieces:sheet -- --out <file.svg>` draws them all, and `--surface dark` draws every piece that takes `surface` on the dark surface.
|
|
136
148
|
|
|
137
149
|
### Maps and diagrams
|
|
138
150
|
|
|
139
|
-
Thirteen pieces draw a metro map and its page diagrams, for [stackledger](https://github.com/brunosouzas/stackledger) and any other map in this style: `lineBadge`, `stationMarker` (stop, interchange as a capsule, deprecated), `pipe`, `countBadge`, `nodeBlock`, `pillNode`, `hexNode` (normal, focus, placeholder), `messageArrow` (curved, straight or through two `controls` points, with a head and an optional label; `kind` `reply`, `failure` or `failFast` dashes it and paints it as ADR 0003 says; `heads: "start"` or `"both"` puts heads at `from`, `dashed` overrides the kind's dash), `ledgerMark` (stackledger's mark; `surface: "dark"`
|
|
151
|
+
Thirteen pieces draw a metro map and its page diagrams, for [stackledger](https://github.com/brunosouzas/stackledger) and any other map in this style: `lineBadge`, `stationMarker` (stop, interchange as a capsule, deprecated), `pipe`, `countBadge`, `nodeBlock`, `pillNode`, `hexNode` (normal, focus, placeholder), `messageArrow` (curved, straight or through two `controls` points, with a head and an optional label; `kind` `reply`, `failure` or `failFast` dashes it and paints it as ADR 0003 says; `heads: "start"` or `"both"` puts heads at `from`, `dashed` overrides the kind's dash), `ledgerMark` (stackledger's mark; on `surface: "dark"` a muted band lines its ink square), `renewalRing` (orange bands round a station), `suggestedHalo` (a dashed muted circle), `licenceMark` (a 10-unit disc, green when held, white to buy) and `zone` (the outline the caller gives, widened by a round 32-unit stroke at the surface's zone opacity, with an optional title). They paint what the caller lays out: positions, hulls, text measurement and truncation stay with the map engine.
|
|
140
152
|
|
|
141
153
|
- A `placeholder` node may have a `subtitle` (drawn like a normal node's, all muted), and `lineBadge` may have no `text` (the pill alone, 30 wide by default).
|
|
142
154
|
- The licence's disc is small, so it has its own room rule: `size` at least three outlines (9 at ink scale 1).
|
|
143
155
|
|
|
144
|
-
- `surface: "light" | "dark"` picks the background they sit on (`surface.*` tokens); every map and diagram piece takes it except `pipe`; `ledgerMark` takes only `surface`. On dark the
|
|
145
|
-
- `inkScale` (0.25 to 8) thickens the outline
|
|
156
|
+
- `surface: "light" | "dark"` picks the background they sit on (`surface.*` tokens); every map and diagram piece takes it except `pipe`; `ledgerMark` takes only `surface`. On dark, ink strokes on the background or on a dark face take `surface.dark.muted`, since ink vanishes on black; marks over a light or state fill stay ink ([ADR 0009](docs/adr/0009-one-piece-grammar.md)).
|
|
157
|
+
- `inkScale` (0.25 to 8) thickens the outline without changing the geometry, on `lineBadge`, `stationMarker`, `countBadge` and the three nodes; the map uses 1, the page diagrams 1.6. A shape's height (a marker's diameter) must be at least four outlines; a placeholder node, which draws no ink, is exempt.
|
|
146
158
|
- `countBadge` takes `textSize` (6 to 48, default 11): without `height`, the height, width and baseline grow with it.
|
|
147
159
|
- A line's colour comes from the map's data, so `pipe.fill`, `lineBadge.fill` and `zone.fill` also accept `#RRGGBB`. Every other colour is a token path, and a cover spec rejects any hex.
|
|
148
160
|
- `map.bendRadius` (32) is the radius of a bundle's centre line at a 45° or 90° bend; no piece reads it, the map engine draws the arcs (`pipe.d` takes `A`).
|
|
149
|
-
- The `map.*` tokens hold the measures (outline 3, shadow
|
|
161
|
+
- The `map.*` tokens hold the measures (outline 3, shadow 0, line 12, casing 6, badge 20, node 46, ring 3, halo 1.5, licence 10, zone padding 32, bend radius 32…), `surface.*.zoneOpacity` the zone's opacity (0.12, dark 0.22), `surface.*.backdropWater`, `backdropWaterEdge`, `backdropPark` and `backdropCredit` the colours of a city backdrop behind a map and its OpenStreetMap credit (no piece draws it; stackledger does), and `site.*` the page palette, fonts and type scale of brunosouzas.com in light and dark. Since 0.8.0 each `site` colour is the brand role it stands for (ADR 0006, amended): `primary`, `dark`, `text` and `textDark` are `brand.<theme>.text`, `body` is `bg`, `light` is `cardBg`, `border` is `border`, `textLight` is `textMuted` and `link` is `accentText`; `site.font` names Source Sans 3 (`primary`), Source Serif 4 (`secondary`) and Source Code Pro (`mono`). Against body text a link is 3.25:1 in light and 2.23:1 in dark, so a page keeps its link underline: colour alone does not mark a link (WCAG 1.4.1).
|
|
150
162
|
|
|
151
163
|
```ts
|
|
152
164
|
import { lineBadge, pipe, stationMarker, toSvg } from "@brunosouzas/design-system";
|
|
@@ -163,43 +175,31 @@ Ten pieces draw what the blog's body diagrams need beyond the map pieces: `diagr
|
|
|
163
175
|
- Backticks mark code: `` "adopts a `correlationId`" `` draws `correlationId` in the monospace stack, as a `tspan`. An odd number of backticks is drawn as is. The cover `pill` follows the same rule (`` "`main`" ``).
|
|
164
176
|
- `milestonePin` takes `size`, the head's radius (6 to 48, default 18); the head, its outline and the label scale with it.
|
|
165
177
|
- Widths the piece estimates (`tagWidth`, `conditionWidth`, a label's `width`) can be passed by a caller that measures its text.
|
|
166
|
-
- A body diagram is 800 wide. Lay it out in 560 units and show it 800 wide: the pieces then come out at the sizes of the published diagrams (text about 18, outline about 4)
|
|
178
|
+
- A body diagram is 800 wide. Lay it out in 560 units and show it 800 wide: the pieces then come out at the sizes of the published diagrams (text about 18, outline about 4). The cover command does this for you with `"format": "diagram"` (below).
|
|
167
179
|
- `stateStart({ cx, cy, r, surface })` draws the filled start dot of a state machine (7.7 units, 11 at 800), in the surface's text colour, with no outline and no shadow.
|
|
168
180
|
|
|
169
181
|
### The cast and the emotes
|
|
170
182
|
|
|
171
|
-
|
|
183
|
+
The cast of [ADR 0007](docs/adr/0007-mira-and-the-pillar-cast.md) shares one skin (white body, ink outline, a near-black visor with the amber idle eyes, `cast.eyes`); a character's identity is its shape, never a colour. Each takes `x`, `y` (the centre of its ground line), `scale`, `surface`, `expression` (`idle`, `done`, `waiting`, `failed`) and `view` (`front`, `back`):
|
|
172
184
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| `agent` | retro lamp all-in-one: dome, chrome neck, the screen is the head | AI spark | | white, glowing face (`cast.glow`) |
|
|
177
|
-
| `architect` | drafting set square with its hole and a pencil | ruler ticks | diagram board | `cast.architect.*` |
|
|
178
|
-
| `devops` | gear | ∞ | wrench | `cast.devops.*` (magenta, never the blocked orange) |
|
|
179
|
-
| `data` | cylinder with a lid | two bands | magnifier | `cast.data.*` |
|
|
180
|
-
| `request` | speech bubble | the request line | | `color.caller` |
|
|
181
|
-
| `message` | envelope (0.7 of the others) | flap and seal | | white |
|
|
182
|
-
|
|
183
|
-
- `face`: `normal`, `blink`, `happy`, `wink`, `surprised`, `worried`, `thinking`, `focused`. One drawing for everyone; the agent's face glows on its dark screen.
|
|
184
|
-
- `action`: `none` (the default: an expression has no hands or feet), `rest`, `wave`, `hold`, `reach`, `up`, `shrug`, `type`. Arms and legs start at the body's sides; hands are mittens.
|
|
185
|
-
- `look` (-1 to 1) moves the gaze, `headTilt` (-30 to 30) turns the agent's head on its neck, `prop: false` hides the prop. Every part is a group named by `data-part` (`body`, `face`, `eyes`, `brows`, `mouth`, `arm-left`, `arm-right`, `legs`, `prop`, `mark`, …), so a scene can animate it.
|
|
185
|
+
- `mira(…)`: the protagonist, an astrolabe with a screen face; `needleAngle` points the route, `carries` rides a message on the needle's tip.
|
|
186
|
+
- `visor` (AI engineering; `holds`, `points`), `drone` (delivery; `carries`), `kiu` (wiki and series; `steps`), `sinal` (stackledger, without the parent-brand hood tip).
|
|
187
|
+
- `bankObject({ name, x, y, scale, surface })`: six objects for scenery, `courier`, `lume`, `carga`, `anel`, `modulo`, `hub`, with the cast's idle eyes on their screen and no expression.
|
|
186
188
|
|
|
187
189
|
`emote({ kind, x, y, scale, burst, surface })` draws a reaction beside a head, never over the face. Each kind keeps one meaning in every video, like the colours:
|
|
188
190
|
|
|
189
191
|
| `kind` | Shape | Meaning |
|
|
190
192
|
|---|---|---|
|
|
191
|
-
| `idea` | bulb | an idea |
|
|
193
|
+
| `idea` | amber bulb with rays | an idea |
|
|
192
194
|
| `doubt` | ? | doubt, not understood |
|
|
193
195
|
| `problem` | ! in a red triangle | a problem appears |
|
|
194
196
|
| `worked` | green check | it worked |
|
|
195
197
|
| `refused` | red cross | refused |
|
|
196
|
-
| `pressure` | sweat drops | under pressure |
|
|
197
|
-
| `liked` | heart | liked |
|
|
198
|
-
| `waiting` | Z Z Z | waiting |
|
|
199
|
-
|
|
200
|
-
In a scene, an emote pops in on the frame the face changes (`emotePop` in `src/brand/cast-motion.ts`, with `leave`, `blinking`, `breathe`, `squashAfter` and `hop`), one at a time, and the body acts through `pose`. A mascot's colour is its identity and never changes with state. The approved motion test is the Studio composition `cast-motion-test` (folder `cast`): `npx remotion render src/index.ts cast-motion-test`. It is a proof of the cast, not an article scene, so `npm run stills` and `npm run render` do not list it.
|
|
198
|
+
| `pressure` | white sweat drops | under pressure |
|
|
199
|
+
| `liked` | heart in the accent | liked |
|
|
200
|
+
| `waiting` | white Z Z Z | waiting |
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
In a scene, an emote pops in on the frame the face changes (`emotePop` in `src/brand/cast-motion.ts`, with `leave`, `blinking`, `breathe`, `squashAfter` and `hop`), one at a time, and the body acts through `pose`. On a dark page pass `surface: "dark"`: the outlines, rays and Z casings take `surface.dark.muted`, the marks over a fill stay ink.
|
|
203
203
|
|
|
204
204
|
### A cover
|
|
205
205
|
|
|
@@ -210,7 +210,7 @@ A cover is a JSON spec kept with its article, outside this repository: drafts ar
|
|
|
210
210
|
"id": "sdd",
|
|
211
211
|
"title": "A one-line request becomes a reviewed spec before any code",
|
|
212
212
|
"description": "Illustration. On the left, a small slip …",
|
|
213
|
-
"background": "
|
|
213
|
+
"background": "trackAi",
|
|
214
214
|
"rings": { "cx": 400, "cy": 220, "radius": 96 },
|
|
215
215
|
"pieces": [
|
|
216
216
|
{ "piece": "speechBubble", "x": 52, "y": 174, "width": 160, "height": 74 },
|
|
@@ -219,7 +219,23 @@ A cover is a JSON spec kept with its article, outside this repository: drafts ar
|
|
|
219
219
|
}
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
- `background` names one pair in `coverBackground` (a background and its ring colour)
|
|
222
|
+
- `background` names one pair in `coverBackground` (a background and its ring colour). Since 0.7.0 the pairs are track families (ADR 0006, amended 2026-11-06): each track has a default `track<Name>` and named tones `<track><Tone>`, and each article picks one tone of its track, so a series varies and the track stays recognisable; `neutral` (the brand background) is for a cover with no track. These twelve are the only pairs. Which cover takes which tone is the `illustration` skill's rule, not the package's.
|
|
223
|
+
|
|
224
|
+
| Track | Name | Tone | Fill | Ring |
|
|
225
|
+
|---|---|---|---|---|
|
|
226
|
+
| Integration | `trackIntegration` | peach, default | `#F7C6A1` | `#E3AB84` |
|
|
227
|
+
| Integration | `integrationClay` | clay | `#E9CDBE` | `#D3B3A3` |
|
|
228
|
+
| Integration | `integrationSand` | sand | `#EED7A8` | `#D8BF8C` |
|
|
229
|
+
| Delivery | `trackDelivery` | sage, default | `#B9DEC3` | `#98C6A5` |
|
|
230
|
+
| Delivery | `deliveryMint` | mint | `#A9DCD6` | `#88C4BD` |
|
|
231
|
+
| Delivery | `deliveryOlive` | olive | `#D3DFA8` | `#B9C78A` |
|
|
232
|
+
| AI | `trackAi` | periwinkle, default | `#C5CDF2` | `#A5AEDA` |
|
|
233
|
+
| AI | `aiSky` | sky | `#B5D5F2` | `#94BBDE` |
|
|
234
|
+
| AI | `aiLilac` | lilac | `#DCC7F0` | `#C3A9DC` |
|
|
235
|
+
| Personal tools | `trackPersonal` | butter, default (new) | `#F4DD8E` | `#DDC46C` |
|
|
236
|
+
| Personal tools | `personalRose` | rose | `#F5C9DA` | `#E0ABC0` |
|
|
237
|
+
| no track | `neutral` | cream (unchanged) | `#F6F3EC` | `#D8D6D0` |
|
|
238
|
+
|
|
223
239
|
- `pieces` are drawn in order; their words go on top.
|
|
224
240
|
- The `rings` centre stays within ±10000 in a cover spec, and a piece that overflows is reported at its entry (`pieces[1]: the drawing overflows`).
|
|
225
241
|
- `custom` (optional) is the cover's one free-form object, a JSON node tree limited to drawing tags and a fixed list of attributes, with no external references. An object that repeats becomes a piece instead. It is painted after every piece's shapes; `customAt: <i>` paints it before `pieces[i]` instead, so a pill can sit on top of it (words always stay on top).
|
|
@@ -236,7 +252,7 @@ The banner is one image that scales down as a whole. Words in it become small on
|
|
|
236
252
|
|
|
237
253
|
### Signature lockup
|
|
238
254
|
|
|
239
|
-
A cover, banner, LinkedIn card or og spec takes an optional `"signature": true`: Mira (scale 0.25) and the symbol, anchored to the frame's bottom-right corner by `cover.signatureMargin` from both edges. Omit it and nothing is added
|
|
255
|
+
A cover, banner, LinkedIn card or og spec takes an optional `"signature": true`: Mira (scale 0.25) and the symbol, anchored to the frame's bottom-right corner by `cover.signatureMargin` from both edges. Omit it and nothing is added. A diagram, favicon, avatar or icon spec refuses the key (an icon accepted it and drew nothing before 0.7.0).
|
|
240
256
|
|
|
241
257
|
### Social and platform formats
|
|
242
258
|
|
|
@@ -256,7 +272,7 @@ npx --yes --package @brunosouzas/design-system@<version> brunosouzas-cover desig
|
|
|
256
272
|
```
|
|
257
273
|
|
|
258
274
|
- `"format": "diagram"` takes a `height` in layout units (1 to 10000) and no `background`: the spec is laid out 560 wide and written 800 wide, on the `color.panel` panel with rounded corners (`bodyDiagram.radius`, 14 at 800) and rings in `color.ring` that show at step 28 and width 2, out to the farthest corner. Pieces get the map outline (3) and label size (13), which show at 4.3 and 18.6. `test/fixtures/covers/circuit-breaker-states.json` is the circuit breaker article's state diagram.
|
|
259
|
-
- `"format": "icon"` holds one `eipIcon`, `uiIcon` or `
|
|
275
|
+
- `"format": "icon"` holds one `eipIcon`, `uiIcon`, `linkIcon` or `categoryIcon` at 0,0 and writes it in a box of its own size (64x40 for an EIP icon, 42 × `scale` for a category badge). An EIP icon takes its title and description, with the CC BY 4.0 credit, from the icon's data, so its spec has neither; a UI, link or category icon spec needs both. No `background`, `rings`, `custom` or `signature`.
|
|
260
276
|
- **Text tables.** `"text": { "pt": { "open": ["taxa de falha", "> limite"] }, "en": { ... } }` holds one table per language with the same keys; any string `"@open"` elsewhere in the spec (pieces, `title`, `description`, even `id`) is replaced by that key's value for the language passed with `--lang <code>`. Every language must define every key, and the ids in the output gain the language (`<id>-pt`). Without `text`, strings are drawn as written, so `"@home"` stays a label.
|
|
261
277
|
- Like a cover, a diagram or icon is a standalone image: `uiIcon` `colour: "currentColor"` is refused in every format.
|
|
262
278
|
|
|
@@ -267,8 +283,9 @@ Add it to `src/pieces/library.ts` (or `src/pieces/metro.ts` for a map or diagram
|
|
|
267
283
|
### UI and link icons
|
|
268
284
|
|
|
269
285
|
- `uiIcon({ name, x, y, size, colour })` draws one of seven glyphs of the sites' chrome in a 24-unit box and one token colour: `sun`, `moon`, `zoomIn`, `zoomOut`, `reset`, `calendar`, `download` (data in `UI_ICONS`). `colour: "currentColor"` makes the icon follow its element's text colour (a button that inverts on hover, say); it only works when the SVG is inline in the page, since an `<img>` does not inherit the page's colour, and a cover spec refuses it.
|
|
270
|
-
- `linkIcon({ icon, x, y, size, surface })` draws a link sticker
|
|
271
|
-
-
|
|
286
|
+
- `linkIcon({ icon, x, y, size, surface })` draws a link sticker in a 46-unit box, a white face with its outline and no frame (on dark the outline takes `surface.dark.muted`): `github`, `linkedin`, `email`, `website` (data in `LINK_ICONS`). The GitHub mark is from [Font Awesome](https://fontawesome.com/), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
287
|
+
- `categoryIcon({ category, x, y, scale })` draws the site's category badge in a 42-unit box: a disc in the default tone of the category's track (`coverBackground.<track>.fill`, ringed in its `.ring`) with a glyph on it, the same on light and dark pages. `integration` (`trackIntegration`, the notation's `pointToPointChannel`), `delivery` (`trackDelivery`, `gateToProduction`), `aiEngineering` (`trackAi`, `contextWindow`), `personalTools` (`trackPersonal`, its own wrench and screwdriver); names in `CATEGORY_ICON_NAMES`. At `scale` 4 it is the 168-pixel badge the site shows.
|
|
288
|
+
- None holds a link, a style, a script or a URL, so a consumer can write one with `toSvg` inside its own `<svg xmlns=…>` and ship it as a static file.
|
|
272
289
|
|
|
273
290
|
```ts
|
|
274
291
|
import { el, linkIcon, toSvg } from "@brunosouzas/design-system";
|
|
@@ -279,6 +296,34 @@ const github = toSvg(el("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "
|
|
|
279
296
|
|
|
280
297
|
`src/pieces/eip-icons.ts` holds the 26 Enterprise Integration Patterns icons as data. They are redrawn from the icons by Gregor Hohpe and Bobby Woolf ([enterpriseintegrationpatterns.com](https://www.enterpriseintegrationpatterns.com/)), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); each icon keeps that credit in its description.
|
|
281
298
|
|
|
299
|
+
## Upgrading to 0.8.0
|
|
300
|
+
|
|
301
|
+
0.8.0 (card 302) changes what the site palette holds and the category icon's call.
|
|
302
|
+
|
|
303
|
+
| Changed | Before | Now |
|
|
304
|
+
|---|---|---|
|
|
305
|
+
| `site.light.*`, `site.dark.*` colours (`--ds-site-*`) | the Astroplate palette (`body` `#FFFFFF` / `#1C1C1C`, `text` `#444444` / `#B4AFB6`…) | the brand roles above (`body` `#F6F3EC` / `#121110`, `text` `#121212` / `#F1EEE8`…); same names |
|
|
306
|
+
| `site.light.link`, `site.dark.link`, `site.font.mono` | absent | `#B83A0C`, `#FF7A45`, `'Source Code Pro', monospace` |
|
|
307
|
+
| `categoryIcon` | `personalTools` only, a glyph with `surface` | four category badges on a track-tone disc; `surface` is refused |
|
|
308
|
+
| `icon` format | `eipIcon`, `uiIcon`, `linkIcon` | also `categoryIcon` |
|
|
309
|
+
|
|
310
|
+
A page that reads `--ds-site-*` changes colour when it moves to 0.8.0. With `primary` equal to `text`, a hover that turns text-coloured links `primary` no longer shows: move it to `link`.
|
|
311
|
+
|
|
312
|
+
## Upgrading to 0.7.0
|
|
313
|
+
|
|
314
|
+
0.7.0 is a breaking release (cards 300 and 301). Rebuild every image once on it; the output changes appearance (ADR 0009) and carries its fonts (ADR 0008).
|
|
315
|
+
|
|
316
|
+
| Removed | Use instead |
|
|
317
|
+
|---|---|
|
|
318
|
+
| `color.healthy`, `color.blocked`, `color.transitional`, `color.caller`, `color.backend`, `color.failure`, `color.failFast` (and their `--ds-color-*` variables) | the same values at `color.state.*` (`--ds-color-state-*`); a spec that passes `"color.healthy"` is refused, pass `"color.state.healthy"` |
|
|
319
|
+
| the 21 `coverBackground` pairs from before 0.6.0 (`blush`, `peach`, `lavender`, `navy`, `mustard`, …) | a tone of the cover's track family (`trackIntegration`, `integrationClay`, `deliveryMint`, `aiSky`, `trackPersonal`, … see "Cover spec") or `neutral` |
|
|
320
|
+
| `mascot`, `MASCOTS`, `MASCOT_ACTIONS`, `MASCOT_FACES`, the types `MascotName`, `MascotFace`, `MascotAction`, `MascotParams` and the seven-role `cast.*` colours | Mira, the pillar characters or a bank object (ADR 0007); `emote` and `EMOTE_KINDS` stay |
|
|
321
|
+
| `illustration.healthyShade`, `illustration.transitionalShade` | nothing reads them; pass a token path if a drawing needs a shade |
|
|
322
|
+
| `"signature"` in an icon spec | remove it (it drew nothing) |
|
|
323
|
+
| the `cast-motion-test` composition | none; the cast timing helpers in `src/brand/cast-motion.ts` stay |
|
|
324
|
+
|
|
325
|
+
Other changes a consumer sees: `font.sans` and `font.mono` name Source Sans 3 and Source Code Pro first, and the new `font.serif` names Source Serif 4; `cover.labelWeight` is 700 (Source Sans 3 has no static 800); the `shadow` tokens and `map.shadow` are 0; `color.ink`, `color.panel`, `color.ring`, `illustration.*` and `surface.*` take the v2 values; several pieces have new defaults (a white `taggedContainer` tab, an ink `arcArrow`, white bodies), listed in [ADR 0009](docs/adr/0009-one-piece-grammar.md) and the change's design.
|
|
326
|
+
|
|
282
327
|
## Decisions
|
|
283
328
|
|
|
284
329
|
Project-wide decisions are recorded as ADRs in [`docs/adr/`](docs/adr/README.md).
|
|
@@ -288,6 +333,10 @@ Project-wide decisions are recorded as ADRs in [`docs/adr/`](docs/adr/README.md)
|
|
|
288
333
|
- **One visual language, fixed colour meanings.** Green is always healthy, orange always blocked, red always the failure path, so a reader learns the code once. Rotated text is allowed since the 2026-10-23 amendment. [ADR 0003](docs/adr/0003-visual-language-and-colour-meaning.md)
|
|
289
334
|
- **Scenes illustrate an approved source.** Every string on screen comes from a published article, or from a post or page the owner approved, so a scene or piece never says more than the reviewed text. Catalogue scenes still come from published articles. [ADR 0004](docs/adr/0004-scenes-illustrate-published-articles.md)
|
|
290
335
|
- **Neutral videos, told by a fixed cast.** One video for both languages, no words on screen, a caption only when the motion cannot explain itself, and every gesture tied to an article line. [ADR 0005](docs/adr/0005-neutral-videos-and-the-cast.md)
|
|
336
|
+
- **Three token layers.** Primitive, semantic and component tokens, with the brand palette measured for AA contrast in both themes and the states under `color.state.*`. [ADR 0006](docs/adr/0006-three-layer-tokens-and-brand-colour.md)
|
|
337
|
+
- **Mira and the pillar cast.** A protagonist and four pillar characters replace the engineering-role cast. [ADR 0007](docs/adr/0007-mira-and-the-pillar-cast.md)
|
|
338
|
+
- **Type inside the image.** Every written SVG embeds a subset of the Source faces its text uses, so readers see Source through `<img>`. [ADR 0008](docs/adr/0008-type-inside-the-image.md)
|
|
339
|
+
- **One piece grammar.** No hard shadow, white bodies, one accent, colour only where it means something, ink muted on dark; a test checks every piece. [ADR 0009](docs/adr/0009-one-piece-grammar.md)
|
|
291
340
|
|
|
292
341
|
## How this project is built
|
|
293
342
|
|
package/dist/scripts/cover.d.ts
CHANGED
|
@@ -15,12 +15,15 @@ export declare const parseCoverArgs: (args: string[], cwd: string) => {
|
|
|
15
15
|
ok: false;
|
|
16
16
|
problem: string;
|
|
17
17
|
};
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Builds the cover text for a spec file's contents, its fonts embedded, or the
|
|
20
|
+
* problem lines. Rejects when embedding fails (a font file, or harfbuzzjs).
|
|
21
|
+
*/
|
|
22
|
+
export declare const buildCover: (text: string, label: string, lang?: string) => Promise<{
|
|
20
23
|
ok: true;
|
|
21
24
|
svg: string;
|
|
22
25
|
} | {
|
|
23
26
|
ok: false;
|
|
24
27
|
lines: string[];
|
|
25
|
-
}
|
|
26
|
-
export declare const runCover: (args: string[], io: CoverIo) => number
|
|
28
|
+
}>;
|
|
29
|
+
export declare const runCover: (args: string[], io: CoverIo) => Promise<number>;
|
package/dist/scripts/cover.js
CHANGED
|
@@ -7,13 +7,19 @@
|
|
|
7
7
|
// makes every cover reproducible, and only the pieces live in this public
|
|
8
8
|
// repository.
|
|
9
9
|
//
|
|
10
|
+
// Every written image embeds, as subsets, the Source faces its text uses
|
|
11
|
+
// (`embedFonts`, ADR 0008), so a reader sees Source inside an `<img>`.
|
|
12
|
+
//
|
|
10
13
|
// What can go wrong: a bad invocation reports its first problem with the
|
|
11
|
-
// usage; an invalid spec reports every problem by JSON path
|
|
12
|
-
//
|
|
14
|
+
// usage; an invalid spec reports every problem by JSON path; a font file that
|
|
15
|
+
// cannot be read or a WebAssembly subsetter that does not load prints the
|
|
16
|
+
// error's one line (naming the file or harfbuzzjs). In each case the command
|
|
17
|
+
// exits 1 and writes nothing. An existing output file is replaced.
|
|
13
18
|
import { closeSync, existsSync, openSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
14
19
|
import { randomUUID } from "node:crypto";
|
|
15
20
|
import { dirname, resolve } from "node:path";
|
|
16
21
|
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { embedFonts } from "../src/fonts/embed.js";
|
|
17
23
|
import { coverTree, LANGUAGE, validateCoverSpec } from "../src/pieces/cover.js";
|
|
18
24
|
import { toSvg } from "../src/pieces/render.js";
|
|
19
25
|
export const COVER_USAGE = "usage: npm run cover -- <spec.json> --out <file.svg> [--lang <code>]";
|
|
@@ -93,17 +99,20 @@ const parseJson = (text, label) => {
|
|
|
93
99
|
return { problem: `${label}: invalid JSON${where} (${message})` };
|
|
94
100
|
}
|
|
95
101
|
};
|
|
96
|
-
/**
|
|
97
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Builds the cover text for a spec file's contents, its fonts embedded, or the
|
|
104
|
+
* problem lines. Rejects when embedding fails (a font file, or harfbuzzjs).
|
|
105
|
+
*/
|
|
106
|
+
export const buildCover = async (text, label, lang) => {
|
|
98
107
|
const parsed = parseJson(text, label);
|
|
99
108
|
if ("problem" in parsed)
|
|
100
109
|
return { ok: false, lines: [parsed.problem] };
|
|
101
110
|
const problems = validateCoverSpec(parsed.value, { lang });
|
|
102
111
|
if (problems.length > 0)
|
|
103
112
|
return { ok: false, lines: problems.map((p) => `${p.path}: ${p.message}`) };
|
|
104
|
-
return { ok: true, svg: `${toSvg(coverTree(parsed.value, { lang }))}\n` };
|
|
113
|
+
return { ok: true, svg: `${toSvg(await embedFonts(coverTree(parsed.value, { lang })))}\n` };
|
|
105
114
|
};
|
|
106
|
-
export const runCover = (args, io) => {
|
|
115
|
+
export const runCover = async (args, io) => {
|
|
107
116
|
const invocation = parseCoverArgs(args, io.cwd);
|
|
108
117
|
if (!invocation.ok) {
|
|
109
118
|
io.error(invocation.problem);
|
|
@@ -120,7 +129,15 @@ export const runCover = (args, io) => {
|
|
|
120
129
|
io.error(COVER_USAGE);
|
|
121
130
|
return 1;
|
|
122
131
|
}
|
|
123
|
-
|
|
132
|
+
let result;
|
|
133
|
+
try {
|
|
134
|
+
result = await buildCover(text, invocation.spec, invocation.lang);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
// The embedding failed: no image ships without its faces.
|
|
138
|
+
io.error(error instanceof Error ? error.message : String(error));
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
124
141
|
if (!result.ok) {
|
|
125
142
|
for (const line of result.lines)
|
|
126
143
|
io.error(line);
|
|
@@ -165,5 +182,5 @@ const isMain = (() => {
|
|
|
165
182
|
}
|
|
166
183
|
})();
|
|
167
184
|
if (isMain) {
|
|
168
|
-
process.exitCode = runCover(process.argv.slice(2), { cwd: process.env.INIT_CWD ?? process.cwd(), log: console.log, error: console.error });
|
|
185
|
+
process.exitCode = await runCover(process.argv.slice(2), { cwd: process.env.INIT_CWD ?? process.cwd(), log: console.log, error: console.error });
|
|
169
186
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SvgNode } from "../pieces/node.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The tree with the Source faces its drawn text uses embedded as subsets, in
|
|
4
|
+
* one `style` right after the root's `desc` (or as its first child). A tree
|
|
5
|
+
* with no face to embed resolves to the input; the input is never modified.
|
|
6
|
+
*/
|
|
7
|
+
export declare const embedFonts: (tree: SvgNode) => Promise<SvgNode>;
|