@brunosouzas/design-system 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,16 +25,16 @@ 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). 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). 0.8.1 adds stackledger's accent, retunes the city backdrop to the v2 neutrals and redraws `ledgerMark` as a white page; see [Upgrading to 0.8.1](#upgrading-to-081).
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 two supporting characters (Balão and Chaves, 0.13.0), 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). 0.8.1 adds stackledger's accent, retunes the city backdrop to the v2 neutrals and redraws `ledgerMark` as a white page; see [Upgrading to 0.8.1](#upgrading-to-081).
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
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.
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; an optional `radius`, 17 by default). `FailureRateBar` (`src/brand/rate-bar.tsx`, its pure shapes in `rate-bar-shape.ts`) draws a failure rate against a threshold: a white track, a `color.state.failure` fill at least as wide as its height and never wider than the track, and an ink tick; a rate outside [0, 1], a threshold outside (0, 1) or a size that is not a positive finite number throws a `RangeError` naming the prop. 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.** 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).
37
+ - **A cast and emotes.** Mira, four pillar characters (Visor, Drone, Kiu, Sinal) and two supporting characters for the human roles (Balão, the requester and approver; Chaves, the developer), 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
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)).
@@ -43,7 +43,7 @@ The style started from the illustration covers of the [Spotify Engineering blog]
43
43
 
44
44
  ```text
45
45
  tokens/source.json ──► tokens/generated/tokens.css ──► brunosouzas.com (site repository, planned)
46
- ├─► tokens/generated/tokens.ts ──► src/brand (motion components) ──► src/scenes ──► MP4 per format and language
46
+ ├─► tokens/generated/tokens.ts ──► src/brand (motion components) ──► src/scenes ──► MP4 per format (and language, for a localised scene)
47
47
  └─► tokens/generated/tokens.json ──► other scripts
48
48
 
49
49
  src/pieces (pure functions → SVG node tree) ──► toSvg ──► covers (npm run cover), diagrams
@@ -101,6 +101,14 @@ npm run render -- circuit-breaker-states # out/master/<id>.mp4 and the
101
101
  npm run stills -- publish-subscribe # 24 phase/final PNGs (six per composition)
102
102
  npm run stills -- publish-subscribe --dry-run # print 24 commands, no effects
103
103
  npm run render -- publish-subscribe --dry-run # print eight commands; real video waits for owner stills approval
104
+ npm run stills -- circuit-breaker-topology # 14 PNGs: the 13 phase ends and the last frame
105
+ npm run render -- circuit-breaker-topology # one master and one web copy (64 s), after the owner approves the stills
106
+ npm run stills -- sdd-request-relay # 14 PNGs: the 13 phase ends and the last frame
107
+ npm run render -- sdd-request-relay # one master and one web copy (36 s), after the owner approves the stills
108
+ npm run stills -- sdd-scene-2-files # 12 PNGs: the 11 phase ends and the last frame
109
+ npm run render -- sdd-scene-2-files # one master and one web copy (29 s), after the owner approves the stills
110
+ npm run stills -- sdd-scene-3-archive # 10 PNGs: the 9 phase ends and the last frame
111
+ npm run render -- sdd-scene-3-archive # one master and one web copy (20 s), after the owner approves the stills
104
112
  npm run build # compile the package into dist/ (the package test needs it)
105
113
  npm run cover -- cover.json --out card.svg # build a blog cover (or a banner, diagram or icon) from its spec
106
114
  npm run pieces:sheet -- --out out/pieces.svg # every piece once, labelled, for review
@@ -122,18 +130,52 @@ The catalogue contains:
122
130
  |---|---|---|
123
131
  | `circuit-breaker-states` | [EN](https://brunosouzas.com/blog/circuit-breaker-in-mulesoft), [PT](https://brunosouzas.com/pt/blog/circuit-breaker-in-mulesoft) | approved pilot, unchanged |
124
132
  | `publish-subscribe` | [EN](https://brunosouzas.com/wiki/publish-subscribe-in-mulesoft/), [PT](https://brunosouzas.com/pt/wiki/publish-subscribe-in-mulesoft/) and their Anypoint MQ diagrams | owner media gate pending |
133
+ | `circuit-breaker-topology` | [EN](https://brunosouzas.com/blog/circuit-breaker-in-mulesoft), [PT](https://brunosouzas.com/pt/blog/circuit-breaker-in-mulesoft) (one neutral video for both) | owner media gate pending ([stills and video sheets](docs/spikes/2026-11-12-circuit-breaker-topology/README.md)) |
134
+ | `sdd-request-relay` | [EN](https://brunosouzas.com/blog/spec-driven-development-in-practice), [PT](https://brunosouzas.com/pt/blog/spec-driven-development-in-practice) (one neutral video for both) | owner media gate pending ([stills and video sheets](docs/spikes/2026-11-12-sdd-request-relay/)) |
135
+ | `sdd-scene-2-files` | [EN](https://brunosouzas.com/blog/spec-driven-development-in-practice), [PT](https://brunosouzas.com/pt/blog/spec-driven-development-in-practice) (one neutral video for both) | owner media gate pending ([stills and video sheets](docs/spikes/2026-11-13-sdd-scene-2-files/)) |
136
+ | `sdd-scene-3-archive` | [EN](https://brunosouzas.com/blog/spec-driven-development-in-practice), [PT](https://brunosouzas.com/pt/blog/spec-driven-development-in-practice) (one neutral video for both) | owner media gate pending ([stills and video sheets](docs/spikes/2026-11-13-sdd-scene-3-archive/)) |
125
137
 
126
- Studio lists four compositions per scene in catalogue order. Pub-sub runs for 1000 frames at 30 fps, with the final 90 frames static. It depicts the article's AUTO acknowledgment case with a propagated invoice error, not every acknowledgment mode. Publish confirms exchange acceptance, not queue delivery. No redelivery is animated. After owner stills approval, `npm run render -- publish-subscribe` produces the four masters and four web copies; do not run it before that gate.
138
+ Studio lists the compositions of each scene in catalogue order: one per format and language for a localised scene, one per format for a neutral one. Pub-sub runs for 1000 frames at 30 fps, with the final 90 frames static. It depicts the article's AUTO acknowledgment case with a propagated invoice error, not every acknowledgment mode. Publish confirms exchange acceptance, not queue delivery. No redelivery is animated. After owner stills approval, `npm run render -- publish-subscribe` produces the four masters and four web copies; do not run it before that gate.
127
139
 
128
140
  A scene lives in `src/scenes/<scene>/` with:
129
141
 
130
- - `scene.ts`: the scene data, with no React: id, formats, languages, the timeline in frames, the text table per language (every string taken from the article) and the source article URL per language.
142
+ - `scene.ts`: the scene data, with no React: id, formats, languages, the timeline in frames, the text table per language (every string taken from the article; a neutral scene has one `en` table) and the source article URL per language.
131
143
  - `layout.ts`: one layout per format, in composition pixels; the 4:5 layout has its own arrow routes.
132
144
  - `Scene.tsx`: the composition, which arranges the components from `src/brand/`.
133
145
 
134
- `src/scenes/index.ts` lists the scenes and `src/Root.tsx` registers each one as a Studio folder with one composition per format and language (`<scene>-16x9-pt`, `-16x9-en`, `-4x5-pt`, `-4x5-en`). The tests check every registered scene: the same text keys in both languages, phases inside the composition and in order, events inside phases, and a reading hold of at least three seconds at the end.
146
+ `src/scenes/index.ts` lists the scenes and `src/Root.tsx` registers each one as a Studio folder; a localised scene has one composition per format and language (`<scene>-16x9-pt`, `-16x9-en`, `-4x5-pt`, `-4x5-en`), a neutral scene one per format (below). The tests check every registered scene: for a localised scene the same text keys in both languages, and for every scene phases inside the composition and in order, events inside phases, and a reading hold of at least three seconds at the end.
135
147
 
136
- `SceneContract<TTimeline>` supplies common metadata and phase ranges (`from`, `to`, events with `at`), duration and outro. `SceneData` remains the legacy state-machine alias with `Timeline`: states, slots, call results and transition fires retain their window checks. `CatalogueScene` also accepts `FlowSceneData` with `kind: "flow"`; it needs no active states or slots. The flow validator rejects unknown endpoints, invalid frames/ranges, trips crossing the outro, and impossible copy ownership/handoffs. There is no plug-in or graph-interpreter API.
148
+ **Neutral scenes.** A scene with `neutral: true` is one video for both pages ([ADR 0005](docs/adr/0005-neutral-videos-and-the-cast.md), amended 2026-11-09): one composition per format, `<scene>-<format>` with no language suffix (its `lang` is `en` and the scene ignores it), `languages: ["en"]`, its few words in one English table `text.en`, and both pages' sources `sources.pt` and `sources.en`. The catalogue rejects a neutral scene with a `pt` table, another language, a missing or non-`https` source, or an empty word. `circuit-breaker-topology` is the first registered neutral scene; `test/fixtures/takes-scene.ts` is a test-only one.
149
+
150
+ **The `takes` kind.** A comparison of two runs of the same stage (`kind: "takes"`, `src/scenes/takes-kind.ts`): take-1 phases, one rewind phase, take-2 phases. It is always neutral. Besides the common rules, the catalogue checks the take order; that every phase cites at least one line of the English article (`cites`, MOT-1); that acts of different characters never overlap (CAST-4); that every emote enters on its character's expression change, one at a time, and is gone (10 frames after `leaveAt`) before the next act (CAST-3); and that nothing moves from the outro on: every act, face, trip arrival, fade, leave and cue before it, and every pop-in at least `motion.fps` frames before it, so it is settled (SCN-4).
151
+
152
+ **The circuit-breaker topology scene** (`circuit-breaker-topology`, AB#334, a `takes` scene) shows the article's comparison: Checkout calls Payment with `retry ×3` and 20 requests become 60 backend calls while Payment goes down (take 1); a rewind; then `circuit-breaker:execute` wraps the call, fills a sliding window of five, opens at 5 of 5 failures (4 of 5 is the 80% threshold and stays CLOSED), fails the next 15 requests fast with `CIRCUIT-BREAKER:OPEN` and the customer's message, runs a compressed `resetTimeout 10s` clock, sends one test call in each HALF_OPEN, closes, ignores one timeout and a `400`, and holds a healthy end for 4 s. 1920 frames (64 s), one 16:9 composition, no character, caption or sound. Its files:
153
+
154
+ - `scene.ts`: the entry and the `text.en` word table;
155
+ - `timeline.ts`: `buildTimeline()`, the beat table of the change's design §4 generated from its formulas (156 legs, counters, lights, tags, state swaps, window results, ramps, clock runs), every movement end also a cue;
156
+ - `frame.ts`: `frameAt(f)`, the whole stage at a frame from `f` and the rewind's object frame `objectFrame(f)`, as plain data;
157
+ - `layout.ts`: positions and routes in 960 × 540 stage units, drawn × 2;
158
+ - `stage.ts`: the two stage SVG layers built from the pieces, and the component props (window squares, failure-rate bar, clock, tokens);
159
+ - `Scene.tsx`: only draws them, in the layer order rings, drop path, arrows and blocks, window, tokens, labels.
160
+
161
+ Its words are at least 33 stage units (36 for state names, the take number and the counters), 11.7 px in the site's 341 px column on a 360 px phone; `test/scenes/circuit-breaker-topology-layout.test.ts` measures them with harfbuzzjs on `fonts/` and checks their placement at every frame. The pieces name Source Sans 3 "Source Sans 3" while `@remotion/google-fonts` registers it as "Source Sans Three", so `Scene.tsx` maps the stage trees' sans stack to the loaded family through `withSansFamily` (`src/brand/svg-fonts.ts`, shared with the request-relay scene below; `stage.ts` re-exports it so its own import path is unedited); without it the SVG words fall back to Helvetica.
162
+
163
+ **The SDD request-relay scene** (`sdd-request-relay`, AB#144, a `takes` scene) shows one request played twice on one stage, with Balão (the logistics team, requester and approver) and Chaves (the developer) as the supporting cast beside Visor (the AI agent) at their shared laptop. Take 1: Balão asks, Chaves relays it to Visor, Visor writes the code alone with the six open questions sunk into it, and the first error comes back to Balão, who never saw those decisions. A rewind (badge `1` → `2`). Take 2: the same relay, then Visor lists the six questions in `proposal.md` instead of choosing; Chaves carries the sheet to Balão; Balão answers each question, stamps `GO`; Chaves carries it back, and only then does Visor implement. 1080 frames (36 s), one 16:9 composition, no caption or sound. Its files:
164
+
165
+ - `scene.ts`: the entry and the `text.en` word table (`proposal.md`, `GO`, `?`, the take numbers);
166
+ - `timeline.ts`: `makeTimeline(travel, fade)`, the beat table of the change's design §4 (acts, faces, emotes, trips, pops, fades, leaves, cues, the rewind's reverse entries), derived from `motion.travel` and `motion.fade` so a token change fails the pinned beat-table test;
167
+ - `frame.ts`: `frameAt(f)` and the rewind's object frame `objectFrame(f)`, the whole stage as plain data; from the outro (980) every frame reads as frame 980, so the final hold (to 1079) is byte-identical;
168
+ - `layout.ts`: positions and routes in 960 × 540 stage units, drawn × 2;
169
+ - `stage.ts`: the five stage SVG layers built from the pieces (below, cast, sheet, tokens, above), words passed through `withSansFamily`;
170
+ - `Scene.tsx`: only draws them, with the `Rings` and the `MotionPath` guides (P1, P2, P4).
171
+
172
+ `SceneContract<TTimeline>` supplies common metadata and phase ranges (`from`, `to`, events with `at`), duration and outro. `SceneData` remains the legacy state-machine alias with `Timeline`: states, slots, call results and transition fires retain their window checks. `CatalogueScene` also accepts `FlowSceneData` with `kind: "flow"`; it needs no active states or slots. It accepts `TakesSceneData` with `kind: "takes"` and `SequenceSceneData` with `kind: "sequence"` too (above). The flow validator rejects unknown endpoints, invalid frames/ranges, trips crossing the outro, and impossible copy ownership/handoffs. There is no plug-in or graph-interpreter API.
173
+
174
+ **The `sequence` kind.** A neutral scene whose phases run once, in order, with no take and no rewind (`kind: "sequence"`, `src/scenes/sequence-kind.ts`). The catalogue checks what it checks for a `takes` scene except the take order: every phase cites an article line, the cast rules (CAST-3, CAST-4) and the reading hold (SCN-4), through the same `checkCast` and `checkHold` that `takes-kind.ts` exports.
175
+
176
+ **The SDD files scene** (`sdd-scene-2-files`, AB#144, a `sequence` scene) is the article's second scene, on scene 1's stage: Chaves types and the `openspec/` folder appears; Visor points and the change's four files (`proposal.md`, `design.md`, `tasks.md`, `spec.md`) come out of it; `proposal.md` lists six `?` and Balão answers them. Then, with nobody on stage acting (the reviewer is another agent), the first review flags four rows of `spec.md` and `tasks.md` (a `?` on the row and a jolt of the file) and a red `NO-GO` lands; the next version checks them; the second review flags two more rows and a second `NO-GO` lands; the fourth version checks them. Balão's `GO` stamp travels to the change, and only then does Visor write the code (the DataWeave `if`/`else if` chain as six code lines). 870 frames (29 s), one 16:9 composition, no caption or sound. Its files follow the request-relay scene's: `scene.ts` (the `text.en` table: the folder and file names, `NO-GO`, `GO`, `?`), `timeline.ts` (`makeTimeline(travel, fade)`, the beat table with every row change of the four files), `frame.ts` (`frameAt(f)`; from the outro, 770, every frame reads as 770), `layout.ts`, `stage.ts` (six stage layers: below, folder, files, cast, verdicts, above) and `Scene.tsx`.
177
+
178
+ **The SDD archive scene** (`sdd-scene-3-archive`, AB#144, a `sequence` scene) is the article's third scene, on the earlier scenes' stage: with no cast member acting, the first change's folder travels off stage to a parked position and the living `book` gains an "exactly two fields" line; days later Balão speaks a second request with no text on screen, Visor points and a second folder pops, and the `book` jolts once as the proposal's impact section surfaces a breaking fact; with no actor acting, a single `?` finding is flagged on the second folder and then cleared (no `NO-GO` anywhere); Balão's `GO` stamp travels to the second folder and lands; Visor's `worked` emote plays the implementation; with no actor acting, the landed `GO` fades and the second folder travels off stage to park beside the first, and only then does the field-count pill read "exactly three fields"; Chaves, beside the book throughout, settles into `done`. 600 frames (20 s), one 16:9 composition, no caption or sound. Its files follow the earlier scenes': `scene.ts` (the `text.en` table: the field-count phrases, `GO`, `?`), `timeline.ts` (`makeTimeline(travel, fade)`, the beat table with every pop, trip, jolt, fade, leave and cue), `frame.ts` (`frameAt(f)`; from the outro, 500, every frame reads as 500), `layout.ts`, `stage.ts` (five stage layers: book, folders, cast, verdict, above) and `Scene.tsx`.
137
179
 
138
180
  Pub-sub separates `text.ts`, `timeline.ts` and pure `flow.ts` from its data entry. Half-open ownership intervals transfer each token atomically at split/arrival/ACK/NACK boundaries. Caption windows use phase ids internally, never as visible labels; captions and labels are frozen against source fixtures. Both media scripts consume only common phase ends and duration, without React or fonts.
139
181
 
@@ -148,7 +190,9 @@ The stage every scene shares is in the `scene.*` tokens (0.12.0), in composition
148
190
  | `scene.pathDash`, `scene.pathGap`, `scene.pathWidth` | 4, 18, 6 | the dashed motion path a travelling object follows, drawn with round caps, so each dash reads as a dot |
149
191
  | `scene.pathColor` | `#5C5852` | the path's colour on the light stage, equal to `brand.light.textMuted` (a test keeps the two equal) |
150
192
 
151
- `stageRingRadii(width, height, values = tokens.scene)` in `src/brand/motion.ts` gives the ring radii for a frame (65 for 1920 x 1080, 45 for 1080 x 1350), and the `Rings` component draws them; it refuses a size that is not a positive finite number and more than 1000 rings. No component draws the dashed path yet: the first scene that needs it draws it from the tokens.
193
+ `stageRingRadii(width, height, values = tokens.scene)` in `src/brand/motion.ts` gives the ring radii for a frame (65 for 1920 x 1080, 45 for 1080 x 1350), and the `Rings` component draws them; it refuses a size that is not a positive finite number and more than 1000 rings.
194
+
195
+ `MotionPath` (`src/brand/components.tsx`) draws the dashed motion path: a scene-supplied SVG path `d`, in composition pixels, with no fill, stroked `scene.pathColor` at `scene.pathWidth`, dashed `scene.pathDash` / `scene.pathGap` with round caps, at the `opacity` the scene gives. It reads no frame of its own, so a scene can draw it at any frame (a rewind feeds its object frame). `motionPathAt(frame, fadeIn, fadeOut?)` in `src/brand/motion.ts` gives that opacity: 0 before `fadeIn`, rising linearly to 1 over it, falling linearly to 0 over the optional `fadeOut`; at opacity 0 nothing is drawn. It throws a `RangeError` naming `frame`, `fadeIn` or `fadeOut` when one is not finite or not in order.
152
196
 
153
197
  ## Illustration pieces and covers
154
198
 
@@ -157,7 +201,7 @@ The stage every scene shares is in the `scene.*` tokens (0.12.0), in composition
157
201
  - `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.
158
202
  - `pose(node, { x, y, tilt, squash, hop, scale, shake, opacity })` animates any piece around its base point; a scene recomputes the numbers every frame.
159
203
  - 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`.
160
- - The 64 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`), `headline` and `questionToken` (below); 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.
204
+ - The 67 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`), `headline`, `questionToken`, `balao`, `chaves` and `keyboard` (below); 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.
161
205
 
162
206
  ### Maps and diagrams
163
207
 
@@ -195,9 +239,17 @@ Ten pieces draw what the blog's body diagrams need beyond the map pieces: `diagr
195
239
 
196
240
  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`):
197
241
 
198
- - `mira(…)`: the protagonist, an astrolabe with a screen face; `needleAngle` points the route, `carries` rides a message on the needle's tip.
199
- - `visor` (AI engineering; `holds`, `holdsSheet`, `points`, `facing`), `drone` (delivery; `carries`), `kiu` (wiki and series; `steps`), `sinal` (stackledger, without the parent-brand hood tip).
200
- - `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.
242
+ | Character | Piece | Role (ADR 0007) | Actions | Hood tip |
243
+ |---|---|---|---|---|
244
+ | Mira | `mira` | the protagonist, an astrolabe with a screen face | `needleAngle` points the route, `carries` rides a message on the needle's tip, `stride` | yes |
245
+ | Visor | `visor` | AI engineering: the AI agent | `holds`, `holdsSheet`, `points`, `facing` | yes |
246
+ | Drone | `drone` | delivery: DevOps, shipping and running a system | `carries` | yes |
247
+ | Kiu | `kiu` | wiki and series | `steps` | yes |
248
+ | Sinal | `sinal` | stackledger | none | no (the product's own identity) |
249
+ | Balão | `balao` | supporting: the requester and approver | `speaks`, `holdsStamp`, `facing` | yes |
250
+ | Chaves | `chaves` | supporting: the developer, who works with Visor | `types`, `points`, `holdsSheet`, `facing` | yes |
251
+
252
+ `bankObject({ name, x, y, scale, surface })` draws six objects for scenery, `courier`, `lume`, `carga`, `anel`, `modulo`, `hub`, with the cast's idle eyes on their screen and no expression.
201
253
 
202
254
  Visor's two actions of 0.12.0, for the SDD scene of AB#144:
203
255
 
@@ -212,6 +264,24 @@ const agent = visor({ x: 480, y: 440, scale: 1.15, facing: "left", holdsSheet: {
212
264
  const question = questionToken({ cx: 300, cy: 120, scale: 1.5 });
213
265
  ```
214
266
 
267
+ The supporting characters of 0.13.0 (card 337, the concept the owner chose in the identity studio of 2026-11-12) are glyphs of their trade on Mira's legs, for the human roles of a scene. Both take the shared parameters and `facing: "right" | "left"` (default `right`; facing left is the mirror image of the body only, and a held prop and its words are never mirrored), do one action at a time and do nothing unless an action is set ([model sheet](docs/spikes/2026-11-12-supporting-characters/README.md)):
268
+
269
+ - `balao`, the requester and approver: a speech balloon whose tail points at the listener (the side it faces). `speaks: true` lights the request line on its belly in the accent. `holdsStamp: { word }` holds the `stamp` piece in the front hand with the caller's word (the SDD scene's `GO`); the held stamp is always the approval green (`color.state.healthy`), so its word says yes (`GO`, `OK`), never a refusal; the stamp is 24 in radius and draws its word at 27 whatever its length, so keep the word to two or three letters. Refused with `speaks` or from behind. Balão answering is a `sheet` the scene places beside its front hand.
270
+ - `chaves`, the developer: a `{ }` body with sharp brace points and a waist (it reads as a brace at 24 px), and the cursor in the accent. `types: true` puts the `keyboard` under the front hand; the screen above it is a `codePanel` the scene places. `points: true` swaps the front hand for Visor's pointing hand. `holdsSheet` hands a sheet over, as Visor's (`width` 80 to 300, `height` 80 to 400, 1 to 8 `rows`, `label`), held out in the front hand. `types` and `holdsSheet` are refused from behind.
271
+ - `keyboard({ x, y, width, surface })`, the laptop's base: a white slab (`width` 80 to 300, default 150, 16 high, top-left corner at `x`, `y`) with ink key marks, outlined on both surfaces. It takes no colour and no text; a cover can draw it under a `codePanel`.
272
+
273
+ ```ts
274
+ import { balao, chaves, codePanel } from "@brunosouzas/design-system";
275
+ // A cover (a still). In a scene one character acts at a time (motion CAST-4): Balão speaks, then Chaves types.
276
+ const requester = balao({ x: 300, y: 450, scale: 1.25, speaks: true });
277
+ // The developer's screen above the keyboard, drawn before Chaves so the typing hand stays in front: in Chaves's
278
+ // units at scale 1 a panel 132 x 62 at (-238, -148) facing left ((106, -148) facing right), low enough to clear the emote spot.
279
+ const screen = codePanel({ x: 680 - 238 * 1.25, y: 450 - 148 * 1.25, width: 165, height: 77.5, top: 25, step: 25, lines: [{ indent: 0, w: 105, color: "white" }, { indent: 0, w: 50, color: "white", tall: true }] });
280
+ const developer = chaves({ x: 680, y: 450, scale: 1.25, facing: "left", types: true });
281
+ ```
282
+
283
+ **Emote spot.** An emote for Balão or Chaves sits beside the head on the front side, at the character's `scale` (about the head's size, motion CAST-3): its centre at (`x` + 116·`scale`, `y` − 200·`scale`) facing right and (`x` − 116·`scale`, `y` − 200·`scale`) facing left. There every emote, its burst included, clears the body, the hood tip, the hands, the pointing hand, the held stamp, the keyboard and the screen of the example above (a taller screen, like a panel reaching y −178, covers the spot). A sheet Chaves holds taller than 114 reaches the spot, and so does one taller than 96 whose label pill is at least as wide as the page (a narrower pill reaches it only higher: check the stills): then the scene moves the emote or the sheet, on its stills. The five pillar characters have no documented spot.
284
+
215
285
  `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:
216
286
 
217
287
  | `kind` | Shape | Meaning |
@@ -350,6 +420,19 @@ const github = toSvg(el("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "
350
420
 
351
421
  `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.
352
422
 
423
+ ## Upgrading to 0.13.0
424
+
425
+ 0.13.0 (card 337, change `supporting-characters`) adds the supporting cast. Nothing is removed or renamed, and every 0.12.0 call, spec and scene draws the same: the five cast pieces stay pinned against their 0.11.0 drawings (`test/fixtures/cast-0.11.0.json`), `stamp` against its 0.12.0 drawings (`test/fixtures/stamp-0.12.0.json`), and every other fixture and golden is unchanged.
426
+
427
+ | Added | What |
428
+ |---|---|
429
+ | `balao`, `chaves` | the supporting characters (see The cast and the emotes), with `BalaoParams`, `ChavesParams`, `CAST_FACINGS` and `CastFacing` from the root entry |
430
+ | `keyboard` | the laptop's base, a prop piece, with `KeyboardParams` |
431
+ | `HeldSheet` | the held-sheet object of Visor and Chaves; `VisorHeldSheet` stays as its alias, and `VISOR_FACINGS` and `VisorFacing` stay |
432
+ | `PIECE_NAMES` | 67 names, ending with `headline`, `questionToken`, `balao`, `chaves`, `keyboard`: a check of the exact list or an exhaustive `switch` over `PieceName` must add them; every other name keeps its index |
433
+
434
+ `stamp` moved from `src/pieces/library.ts` to `src/pieces/stamp.ts` unchanged; the root entry exports it as before.
435
+
353
436
  ## Upgrading to 0.12.0
354
437
 
355
438
  0.12.0 (card 333, change `sdd-scene-pieces`) adds what the SDD scene of AB#144 needs. Nothing is removed or renamed, and every 0.11.0 call, spec and scene draws the same: the five cast pieces are pinned against their 0.11.0 drawings (`test/fixtures/cast-0.11.0.json`) and the circuit-breaker and publish-subscribe stills are byte-identical.
@@ -434,7 +517,7 @@ Project-wide decisions are recorded as ADRs in [`docs/adr/`](docs/adr/README.md)
434
517
  - **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)
435
518
  - **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)
436
519
  - **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)
437
- - **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)
520
+ - **Mira and the pillar cast.** A protagonist and four pillar characters replace the engineering-role cast; since its amendment of 2026-11-12, two supporting characters, Balão and Chaves, tell the requester and the developer. [ADR 0007](docs/adr/0007-mira-and-the-pillar-cast.md)
438
521
  - **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)
439
522
  - **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)
440
523
 
@@ -1,6 +1,7 @@
1
- import { type SvgNode } from "./node.ts";
1
+ import { type Drawn, type SvgNode } from "./node.ts";
2
2
  import { type SurfaceName } from "./ink.ts";
3
3
  import { type SheetRow } from "./paper.ts";
4
+ import { type Schema } from "./params.ts";
4
5
  import { type Skin } from "./skin.ts";
5
6
  export declare const CAST_EXPRESSIONS: readonly ["idle", "done", "waiting", "failed"];
6
7
  export type CastExpression = (typeof CAST_EXPRESSIONS)[number];
@@ -33,8 +34,8 @@ export type MiraParams = {
33
34
  export declare const mira: import("./piece.ts").Piece<MiraParams>;
34
35
  export declare const VISOR_FACINGS: readonly ["right", "left"];
35
36
  export type VisorFacing = (typeof VISOR_FACINGS)[number];
36
- /** The sheet Visor holds: the `sheet` piece's page parameters, plus the file name pill. */
37
- export type VisorHeldSheet = {
37
+ /** A held sheet (Visor's, and Chaves's since change supporting-characters): the `sheet` piece's page parameters, plus the file name pill. */
38
+ export type HeldSheet = {
38
39
  width: number;
39
40
  height: number;
40
41
  rows: SheetRow[];
@@ -42,6 +43,8 @@ export type VisorHeldSheet = {
42
43
  step?: number;
43
44
  label?: string;
44
45
  };
46
+ /** The name of 0.12.0, kept as an alias of `HeldSheet`. */
47
+ export type VisorHeldSheet = HeldSheet;
45
48
  export type VisorParams = {
46
49
  x: number;
47
50
  y: number;
@@ -52,11 +55,24 @@ export type VisorParams = {
52
55
  /** The small accent card in the left hand. */
53
56
  holds?: boolean;
54
57
  /** A sheet in the left hand instead of the card; refused with `holds: true` or `view: "back"`. */
55
- holdsSheet?: VisorHeldSheet;
58
+ holdsSheet?: HeldSheet;
56
59
  points?: boolean;
57
60
  /** `right` (the default, the drawing of 0.11.0) or `left`, the mirror image; the held sheet and words stay unmirrored. */
58
61
  facing?: VisorFacing;
59
62
  };
63
+ /**
64
+ * A held sheet with its page's top-left corner at (x, y), in the holder's
65
+ * units: the `sheet` and `pill` pieces' own drawings in one group that gives
66
+ * them the cast's outline (cast pieces set `stroke: none` on their root), so
67
+ * it draws the same in a cover and in a scene. The marks sit on the white page,
68
+ * so they stay ink on the dark surface too (ADR 0009). Its words go to the
69
+ * holder's text. Shared by Visor and Chaves (change supporting-characters, design §1).
70
+ */
71
+ export declare const holdSheet: (held: HeldSheet, s: Skin, x: number, y: number) => Drawn;
72
+ /** Visor's pointing hand, a finger pill above the palm, turned `angle` degrees about the palm at (x, y). Shared with Chaves (change supporting-characters, design §1). */
73
+ export declare const pointingHand: (s: Skin, x: number, y: number, angle: number) => SvgNode;
74
+ /** The held sheet's schema (Visor's and Chaves's `holdsSheet`). */
75
+ export declare const heldSheetSchema: Schema;
60
76
  export declare const visor: import("./piece.ts").Piece<VisorParams>;
61
77
  export type DroneParams = {
62
78
  x: number;
@@ -103,14 +103,14 @@ export const VISOR_FACINGS = ["right", "left"];
103
103
  const HELD_SHEET_EDGE = 98;
104
104
  const HELD_SHEET_BOTTOM = -4;
105
105
  /**
106
- * The held sheet: the `sheet` and `pill` pieces' own drawings in one group that
107
- * gives them Visor's outline (cast pieces set `stroke: none` on their root), so
106
+ * A held sheet with its page's top-left corner at (x, y), in the holder's
107
+ * units: the `sheet` and `pill` pieces' own drawings in one group that gives
108
+ * them the cast's outline (cast pieces set `stroke: none` on their root), so
108
109
  * it draws the same in a cover and in a scene. The marks sit on the white page,
109
- * so they stay ink on the dark surface too (ADR 0009). Its words go to Visor's text.
110
+ * so they stay ink on the dark surface too (ADR 0009). Its words go to the
111
+ * holder's text. Shared by Visor and Chaves (change supporting-characters, design §1).
110
112
  */
111
- const heldSheet = (held, s, facing) => {
112
- const x = facing === "right" ? -HELD_SHEET_EDGE - held.width : HELD_SHEET_EDGE;
113
- const y = HELD_SHEET_BOTTOM - held.height;
113
+ export const holdSheet = (held, s, x, y) => {
114
114
  const page = sheet({ x, y, width: held.width, height: held.height, rows: held.rows, top: held.top, step: held.step });
115
115
  const tag = held.label === undefined ? null : pill({ x: x + held.width / 2, y, text: held.label });
116
116
  // The sheet's marks group (the `g` at outline.small) gets its ink stroke here.
@@ -119,14 +119,16 @@ const heldSheet = (held, s, facing) => {
119
119
  : node);
120
120
  return drawn([g({ "data-held": "sheet", stroke: s.outline, "stroke-width": tokens.outline.block, "stroke-linejoin": "round" }, ...body, ...(tag?.body ?? []))], [...page.text, ...(tag?.text ?? [])]);
121
121
  };
122
+ /** Visor's pointing hand, a finger pill above the palm, turned `angle` degrees about the palm at (x, y). Shared with Chaves (change supporting-characters, design §1). */
123
+ export const pointingHand = (s, x, y, angle) => g({ transform: `translate(${x},${y}) rotate(${angle})` }, el("rect", { x: -6, y: -30, width: 12, height: 26, rx: 6, ...outlined(s, 4.5) }), el("circle", { cx: 0, cy: 0, r: 15, ...outlined(s) }));
122
124
  const drawVisor = (p) => {
123
125
  const s = skin(p.surface ?? "light");
124
126
  const expression = p.expression ?? "idle", view = p.view ?? "front", back = view === "back";
125
127
  const hold = p.holds ?? false, point = p.points ?? true, facing = p.facing ?? "right";
126
- const held = p.holdsSheet === undefined ? null : heldSheet(p.holdsSheet, s, facing);
127
- const handR = point
128
- ? g({ transform: "translate(88,-104) rotate(-35)" }, el("rect", { x: -6, y: -30, width: 12, height: 26, rx: 6, ...outlined(s, 4.5) }), el("circle", { cx: 0, cy: 0, r: 15, ...outlined(s) }))
129
- : el("circle", { cx: 86, cy: -58, r: 15, ...outlined(s) });
128
+ const held = p.holdsSheet === undefined
129
+ ? null
130
+ : holdSheet(p.holdsSheet, s, facing === "right" ? -HELD_SHEET_EDGE - p.holdsSheet.width : HELD_SHEET_EDGE, HELD_SHEET_BOTTOM - p.holdsSheet.height);
131
+ const handR = point ? pointingHand(s, 88, -104, -35) : el("circle", { cx: 86, cy: -58, r: 15, ...outlined(s) });
130
132
  // With a held sheet the card hand stays where it is, without the card, over the sheet's edge.
131
133
  const handL = hold || held
132
134
  ? [...(held ? [] : [el("rect", { x: -106, y: -96, width: 28, height: 24, rx: 5, fill: s.accent })]), el("circle", { cx: -92, cy: -66, r: 15, ...outlined(s) })]
@@ -147,7 +149,8 @@ const drawVisor = (p) => {
147
149
  : [];
148
150
  return drawn([g({ "data-piece": "visor", transform, stroke: "none" }, ...(held?.body ?? []), body)], text);
149
151
  };
150
- const visorHeldSheetSchema = {
152
+ /** The held sheet's schema (Visor's and Chaves's `holdsSheet`). */
153
+ export const heldSheetSchema = {
151
154
  width: { kind: "number", required: true, min: 80, max: 300 },
152
155
  height: { kind: "number", required: true, min: 80, max: 400 },
153
156
  rows: { kind: "array", required: true, minItems: 1, maxItems: 8, of: { kind: "object", fields: sheetRowSchema } },
@@ -159,7 +162,7 @@ export const visor = definePiece("visor", {
159
162
  x: pos(), y: pos(), surface: surfaceParam, scale: num({ min: 0.25, max: 4 }),
160
163
  expression: { kind: "enum", values: CAST_EXPRESSIONS }, view: { kind: "enum", values: CAST_VIEWS },
161
164
  holds: { kind: "boolean" },
162
- holdsSheet: { kind: "object", fields: visorHeldSheetSchema },
165
+ holdsSheet: { kind: "object", fields: heldSheetSchema },
163
166
  points: { kind: "boolean" },
164
167
  facing: { kind: "enum", values: VISOR_FACINGS },
165
168
  }, drawVisor,
@@ -8,7 +8,8 @@ export { EIP_ICONS, EIP_ICON_NAMES, EIP_ICON_HEIGHT, EIP_ICON_WIDTH, type EipIco
8
8
  export { FORMATS, LANGUAGE, LINKEDIN_PHOTO_MARGIN, LINKEDIN_PHOTO_ZONES, SAFE_ID, backgroundNames, bannerRingCount, comparePaths, coverTree, diagramRings, validateCoverSpec, type CoverFormat, type CoverOptions, type CoverPiece, type CoverRings, type CoverSpec, type CustomNode, type LinkedinPhotoZone } from "./cover.ts";
9
9
  export { tokens, type Tokens } from "../../tokens/generated/tokens.ts";
10
10
  export { EMOTE_KINDS, type EmoteKind, type EmoteParams } from "./emote.ts";
11
- export { CAST_EXPRESSIONS, CAST_VIEWS, VISOR_FACINGS, type CastExpression, type CastView, type MiraParams, type VisorParams, type VisorFacing, type VisorHeldSheet, type DroneParams, type KiuParams, type SinalParams } from "./brand-cast.ts";
11
+ export { CAST_EXPRESSIONS, CAST_VIEWS, VISOR_FACINGS, type CastExpression, type CastView, type HeldSheet, type MiraParams, type VisorParams, type VisorFacing, type VisorHeldSheet, type DroneParams, type KiuParams, type SinalParams } from "./brand-cast.ts";
12
+ export { CAST_FACINGS, type CastFacing } from "./supporting-cast.ts";
12
13
  export { BANK_OBJECT_NAMES, type BankObjectName, type BankObjectParams } from "./bank-objects.ts";
13
14
  export { type SymbolParams } from "./symbol.ts";
14
15
  export { BRAND_NOTATION_ICON_NAMES, type BrandNotationIconName, type BrandNotationIconParams } from "./brand-notation-icons.ts";
@@ -14,6 +14,7 @@ export { FORMATS, LANGUAGE, LINKEDIN_PHOTO_MARGIN, LINKEDIN_PHOTO_ZONES, SAFE_ID
14
14
  export { tokens } from "../../tokens/generated/tokens.js";
15
15
  export { EMOTE_KINDS } from "./emote.js";
16
16
  export { CAST_EXPRESSIONS, CAST_VIEWS, VISOR_FACINGS } from "./brand-cast.js";
17
+ export { CAST_FACINGS } from "./supporting-cast.js";
17
18
  export { BANK_OBJECT_NAMES } from "./bank-objects.js";
18
19
  export { BRAND_NOTATION_ICON_NAMES } from "./brand-notation-icons.js";
19
20
  export { CATEGORY_ICON_NAMES } from "./category-icon.js";
@@ -0,0 +1,9 @@
1
+ import { type SurfaceName } from "./ink.ts";
2
+ export type KeyboardParams = {
3
+ x: number;
4
+ y: number;
5
+ width?: number;
6
+ surface?: SurfaceName;
7
+ };
8
+ /** The laptop's base: a white slab outlined in the surface's ink line, with ink key marks. */
9
+ export declare const keyboard: import("./piece.ts").Piece<KeyboardParams>;
@@ -0,0 +1,33 @@
1
+ // The `keyboard` prop piece (spec illustration-pieces, "Keyboard"; change
2
+ // supporting-characters, design §4): the base of a laptop, a white slab with a
3
+ // row of key marks. Chaves types at it (`types`, supporting-cast.ts); a cover
4
+ // can draw it alone, under a `codePanel` as the screen.
5
+ //
6
+ // Why the keys sit in a `stroke: none` group: the cover command wraps every
7
+ // body in an ink-stroked group (cover.ts, the outlined group), so a key with
8
+ // only a fill would take a 4-unit outline there and blur into a blob; the slab
9
+ // carries its own stroke, so the piece draws the same alone, in a cover and in
10
+ // Chaves's hand (as `sheet` keeps its bars).
11
+ //
12
+ // What can go wrong: the schema rejects a width outside 80 to 300, a missing x
13
+ // or y, an unknown surface and any other parameter (no colour, no text), naming it.
14
+ import { tokens } from "../../tokens/generated/tokens.js";
15
+ import { drawn, el, g } from "./node.js";
16
+ import { inkOf, surfaceParam } from "./ink.js";
17
+ import { num, pos } from "./params.js";
18
+ import { definePiece } from "./piece.js";
19
+ /** The slab's height and the key marks' measures (design §4, from the approved concept sheet's deck). */
20
+ const SLAB_HEIGHT = 16;
21
+ const SLAB_RADIUS = 6;
22
+ const KEY = { inset: 16, top: 6, pitch: 21, width: 12, height: 4, radius: 2 };
23
+ /** Key marks that fit the slab: the first `KEY.inset` in, each `KEY.pitch` apart, the last at least `KEY.inset` from the right edge. */
24
+ const keyCount = (width) => Math.floor((width - 2 * KEY.inset - KEY.width) / KEY.pitch) + 1;
25
+ /** The laptop's base: a white slab outlined in the surface's ink line, with ink key marks. */
26
+ export const keyboard = definePiece("keyboard", { x: pos(), y: pos(), width: num({ min: 80, max: 300 }), surface: surfaceParam }, ({ x, y, width = 150, surface = "light" }) => {
27
+ const keys = Array.from({ length: keyCount(width) }, (_, i) =>
28
+ // Marks on a white face stay ink on the dark surface too (ADR 0009).
29
+ el("rect", { x: x + KEY.inset + KEY.pitch * i, y: y + KEY.top, width: KEY.width, height: KEY.height, rx: KEY.radius, fill: tokens.color.ink }));
30
+ return drawn([
31
+ g({ "data-piece": "keyboard" }, el("rect", { x, y, width, height: SLAB_HEIGHT, rx: SLAB_RADIUS, fill: tokens.color.white, stroke: inkOf({ surface }).line, "stroke-width": tokens.outline.block, "stroke-linejoin": "round" }), g({ stroke: "none" }, ...keys)),
32
+ ]);
33
+ });
@@ -7,8 +7,11 @@ import { categoryIcon, type CategoryIconParams } from "./category-icon.ts";
7
7
  import { headline, type HeadlineParams } from "./headline.ts";
8
8
  import { questionToken, type QuestionTokenParams } from "./question-token.ts";
9
9
  import { pill, sheet, type PillParams, type SheetParams, type SheetRow } from "./paper.ts";
10
- export { pill, sheet };
11
- export type { PillParams, SheetParams, SheetRow };
10
+ import { stamp, type StampParams } from "./stamp.ts";
11
+ import { keyboard, type KeyboardParams } from "./keyboard.ts";
12
+ import { balao, chaves, type BalaoParams, type ChavesParams } from "./supporting-cast.ts";
13
+ export { pill, sheet, stamp, keyboard, balao, chaves };
14
+ export type { PillParams, SheetParams, SheetRow, StampParams, KeyboardParams, BalaoParams, ChavesParams };
12
15
  export { emote, mira, visor, drone, kiu, sinal, bankObject, symbol, brandNotationIcon, categoryIcon, headline, questionToken };
13
16
  export type { MiraParams, VisorParams, DroneParams, KiuParams, SinalParams, BankObjectName, BankObjectParams, SymbolParams, BrandNotationIconName, BrandNotationIconParams, CategoryIconParams, HeadlineParams, QuestionTokenParams };
14
17
  export * from "./metro.ts";
@@ -151,17 +154,6 @@ export type CheckBadgeParams = {
151
154
  };
152
155
  /** Green round badge with a tick. */
153
156
  export declare const checkBadge: import("./piece.ts").Piece<CheckBadgeParams>;
154
- export type StampParams = {
155
- cx: number;
156
- cy: number;
157
- word: string;
158
- fill?: string;
159
- r?: number;
160
- rotate?: number;
161
- shape?: "round" | "rect";
162
- };
163
- /** Rubber stamp, round (dashed inner ring) or rectangular, tilted, with one word. */
164
- export declare const stamp: import("./piece.ts").Piece<StampParams>;
165
157
  export type RobotParams = {
166
158
  cx: number;
167
159
  top: number;
@@ -320,6 +312,9 @@ export declare const PIECES: {
320
312
  readonly categoryIcon: import("./piece.ts").Piece<CategoryIconParams>;
321
313
  readonly headline: import("./piece.ts").Piece<HeadlineParams>;
322
314
  readonly questionToken: import("./piece.ts").Piece<QuestionTokenParams>;
315
+ readonly balao: import("./piece.ts").Piece<BalaoParams>;
316
+ readonly chaves: import("./piece.ts").Piece<ChavesParams>;
317
+ readonly keyboard: import("./piece.ts").Piece<KeyboardParams>;
323
318
  };
324
319
  export type PieceName = keyof typeof PIECES;
325
320
  export declare const PIECE_NAMES: PieceName[];
@@ -24,7 +24,10 @@ import { categoryIcon } from "./category-icon.js";
24
24
  import { headline } from "./headline.js";
25
25
  import { questionToken } from "./question-token.js";
26
26
  import { pill, sheet } from "./paper.js";
27
- export { pill, sheet };
27
+ import { stamp } from "./stamp.js";
28
+ import { keyboard } from "./keyboard.js";
29
+ import { balao, chaves } from "./supporting-cast.js";
30
+ export { pill, sheet, stamp, keyboard, balao, chaves };
28
31
  export { emote, mira, visor, drone, kiu, sinal, bankObject, symbol, brandNotationIcon, categoryIcon, headline, questionToken };
29
32
  export * from "./metro.js";
30
33
  export * from "./diagram.js";
@@ -187,20 +190,6 @@ export const checkBadge = definePiece("checkBadge", { cx: pos(), cy: pos(), r: s
187
190
  el("circle", { cx, cy, r, fill: tokens.color.state.healthy, "stroke-width": tokens.outline.small }),
188
191
  el("path", { d: `M${r2(cx - r * 0.42)},${cy} L${r2(cx - r * 0.1)},${r2(cy + r * 0.34)} L${r2(cx + r * 0.45)},${r2(cy - r * 0.32)}`, fill: "none", "stroke-width": 3.5, "stroke-linecap": "round" }),
189
192
  ]));
190
- /** Rubber stamp, round (dashed inner ring) or rectangular, tilted, with one word. */
191
- export const stamp = definePiece("stamp", { cx: pos(), cy: pos(), word: label(), fill: col(), r: size(false, 12), rotate: { kind: "number" }, shape: { kind: "enum", values: ["round", "rect"] } }, ({ cx, cy, word, fill = "color.state.healthy", r = 40, rotate = -12, shape = "round" }) => {
192
- const turn = `rotate(${rotate} ${cx} ${cy})`;
193
- const face = shape === "round"
194
- ? [
195
- el("circle", { cx, cy, r, fill: colour(fill, "fill") }),
196
- el("circle", { cx, cy, r: r - 10, fill: "none", stroke: tokens.color.white, "stroke-width": tokens.outline.small, "stroke-dasharray": "6 5" }),
197
- ]
198
- : [
199
- el("rect", { x: cx - r * 1.6, y: cy - r * 0.7, width: r * 3.2, height: r * 1.4, rx: 8, fill: colour(fill, "fill") }),
200
- el("rect", { x: cx - r * 1.6 + 8, y: cy - r * 0.7 + 8, width: r * 3.2 - 16, height: r * 1.4 - 16, rx: 4, fill: "none", stroke: tokens.color.white, "stroke-width": tokens.outline.small }),
201
- ];
202
- return drawn([g({ transform: turn }, ...face)], [el("text", { x: cx, y: cy + 10, "font-size": 27, "font-weight": tokens.font.weightHeavy, transform: turn }, word)]);
203
- });
204
193
  /** Robot in the v2 grammar: white body and ears, a dark visor with the cast's idle eyes, one grille bar, the accent on the antenna tip. Scale it with pose. */
205
194
  export const robot = definePiece("robot", { cx: pos(), top: pos() }, ({ cx, top }) => {
206
195
  const w = 160;
@@ -359,5 +348,8 @@ export const PIECES = {
359
348
  categoryIcon,
360
349
  headline,
361
350
  questionToken,
351
+ balao,
352
+ chaves,
353
+ keyboard,
362
354
  };
363
355
  export const PIECE_NAMES = Object.keys(PIECES);
@@ -0,0 +1,11 @@
1
+ export type StampParams = {
2
+ cx: number;
3
+ cy: number;
4
+ word: string;
5
+ fill?: string;
6
+ r?: number;
7
+ rotate?: number;
8
+ shape?: "round" | "rect";
9
+ };
10
+ /** Rubber stamp, round (dashed inner ring) or rectangular, tilted, with one word. */
11
+ export declare const stamp: import("./piece.ts").Piece<StampParams>;
@@ -0,0 +1,29 @@
1
+ // The `stamp` piece (spec illustration-pieces, "Piece catalogue"), moved
2
+ // unchanged from library.ts by change supporting-characters (card 337): Balão
3
+ // holds a stamp (`holdsStamp`, supporting-cast.ts), and supporting-cast.ts
4
+ // cannot import library.ts, which imports it to list Balão in PIECES (the same
5
+ // cycle paper.ts broke for `pill` and `sheet`). library.ts re-exports it and
6
+ // keeps it at its place in PIECES. test/fixtures/stamp-0.12.0.json pins its
7
+ // 0.12.0 drawings ("Stamp calls of 0.12.0 unchanged").
8
+ //
9
+ // What can go wrong: the schema rejects an empty word, a radius under 12 and an
10
+ // unknown shape, naming the parameter. The word is drawn at size 27 whatever
11
+ // the radius, so a long word overhangs a small stamp: fitting it is the caller's job.
12
+ import { tokens } from "../../tokens/generated/tokens.js";
13
+ import { drawn, el, g } from "./node.js";
14
+ import { col, colour, label, pos, size } from "./params.js";
15
+ import { definePiece } from "./piece.js";
16
+ /** Rubber stamp, round (dashed inner ring) or rectangular, tilted, with one word. */
17
+ export const stamp = definePiece("stamp", { cx: pos(), cy: pos(), word: label(), fill: col(), r: size(false, 12), rotate: { kind: "number" }, shape: { kind: "enum", values: ["round", "rect"] } }, ({ cx, cy, word, fill = "color.state.healthy", r = 40, rotate = -12, shape = "round" }) => {
18
+ const turn = `rotate(${rotate} ${cx} ${cy})`;
19
+ const face = shape === "round"
20
+ ? [
21
+ el("circle", { cx, cy, r, fill: colour(fill, "fill") }),
22
+ el("circle", { cx, cy, r: r - 10, fill: "none", stroke: tokens.color.white, "stroke-width": tokens.outline.small, "stroke-dasharray": "6 5" }),
23
+ ]
24
+ : [
25
+ el("rect", { x: cx - r * 1.6, y: cy - r * 0.7, width: r * 3.2, height: r * 1.4, rx: 8, fill: colour(fill, "fill") }),
26
+ el("rect", { x: cx - r * 1.6 + 8, y: cy - r * 0.7 + 8, width: r * 3.2 - 16, height: r * 1.4 - 16, rx: 4, fill: "none", stroke: tokens.color.white, "stroke-width": tokens.outline.small }),
27
+ ];
28
+ return drawn([g({ transform: turn }, ...face)], [el("text", { x: cx, y: cy + 10, "font-size": 27, "font-weight": tokens.font.weightHeavy, transform: turn }, word)]);
29
+ });
@@ -0,0 +1,35 @@
1
+ import { type CastExpression, type CastView, type HeldSheet } from "./brand-cast.ts";
2
+ import { type SurfaceName } from "./ink.ts";
3
+ export declare const CAST_FACINGS: readonly ["right", "left"];
4
+ /** The side a supporting character faces: its signature part and front hand go there. */
5
+ export type CastFacing = (typeof CAST_FACINGS)[number];
6
+ type Shared = {
7
+ x: number;
8
+ y: number;
9
+ surface?: SurfaceName;
10
+ scale?: number;
11
+ expression?: CastExpression;
12
+ view?: CastView;
13
+ facing?: CastFacing;
14
+ };
15
+ export type BalaoParams = Shared & {
16
+ /** The request line on the belly lit in the accent: Balão is asking. */
17
+ speaks?: boolean;
18
+ /** The `stamp` piece in the front hand, with the caller's word (the SDD scene's `GO`); refused with `speaks` or from behind. */
19
+ holdsStamp?: {
20
+ word: string;
21
+ };
22
+ };
23
+ /** Balão, the requester and approver: a speech balloon whose tail points at the listener. */
24
+ export declare const balao: import("./piece.ts").Piece<BalaoParams>;
25
+ export type ChavesParams = Shared & {
26
+ /** Types at the `keyboard`, held under the front hand; refused with another action or from behind. */
27
+ types?: boolean;
28
+ /** The front hand becomes Visor's pointing hand, reaching up and forward; refused with another action. */
29
+ points?: boolean;
30
+ /** Hands a sheet over, held out in the front hand (Visor's held sheet); refused with another action or from behind. */
31
+ holdsSheet?: HeldSheet;
32
+ };
33
+ /** Chaves, the developer: a `{ }` body with sharp brace points and the cursor in the accent. */
34
+ export declare const chaves: import("./piece.ts").Piece<ChavesParams>;
35
+ export {};
@@ -0,0 +1,168 @@
1
+ // The supporting cast (ADR 0007, amended 2026-11-12; spec illustration-pieces,
2
+ // "Balão", "Chaves" and their parameters; change supporting-characters, design
3
+ // §1 to §5): two characters for the human roles the pillar cast cannot tell,
4
+ // drawn from the approved concept C sheet, "the notation" (identity studio,
5
+ // 2026-11-12; prototype ~/.hermes/cache/scratch/ab337-characters/chars.ts).
6
+ //
7
+ // balao the requester and approver: a speech balloon on Mira's legs whose
8
+ // tail points at the listener; `speaks` lights the request line on
9
+ // its belly, `holdsStamp` holds the `stamp` piece to approve.
10
+ // chaves the developer: a `{ }` body with sharp brace points and a waist (so
11
+ // it reads as a brace at 24 px, not a pillow) and the accent cursor;
12
+ // `types` at the `keyboard`, `points`, `holdsSheet` hands a sheet over.
13
+ //
14
+ // Both wear the shared skin (skin.ts), the screen face and the parent-brand hood
15
+ // tip (brand-cast.ts), take the cast's shared parameters plus `facing`, and do
16
+ // one action at a time, every action off unless set (motion CAST-2 to CAST-5).
17
+ // Coordinates are local units at scale 1 facing right: the ground line is y 0,
18
+ // up is negative, the anchor (x, y) is the centre of the ground line.
19
+ //
20
+ // Why a module of its own: the supporting cast stays apart from the five pinned
21
+ // pillar drawings (design §1, option B). It imports stamp.ts, keyboard.ts,
22
+ // paper.ts and brand-cast.ts, never library.ts, which imports it (the cycle
23
+ // stamp.ts was moved out to break).
24
+ //
25
+ // What can go wrong: the schema rejects a bad parameter, naming it; then each
26
+ // piece returns at most one relation problem (two actions together, or a prop
27
+ // seen from behind), so a cover spec reports one line per piece.
28
+ import { tokens } from "../../tokens/generated/tokens.js";
29
+ import { CAST_EXPRESSIONS, CAST_VIEWS, faceAt, heldSheetSchema, holdSheet, peak, pointingHand } from "./brand-cast.js";
30
+ import { surfaceParam } from "./ink.js";
31
+ import { drawn, el, g } from "./node.js";
32
+ import { label, num, pos } from "./params.js";
33
+ import { definePiece } from "./piece.js";
34
+ import { outlined, skin } from "./skin.js";
35
+ import { keyboard } from "./keyboard.js";
36
+ import { stamp } from "./stamp.js";
37
+ export const CAST_FACINGS = ["right", "left"];
38
+ /** The parameters every supporting character shares with the cast, plus `facing`. */
39
+ const sharedSchema = {
40
+ x: pos(), y: pos(), surface: surfaceParam,
41
+ scale: num({ min: 0.25, max: 4 }),
42
+ expression: { kind: "enum", values: CAST_EXPRESSIONS },
43
+ view: { kind: "enum", values: CAST_VIEWS },
44
+ facing: { kind: "enum", values: CAST_FACINGS },
45
+ };
46
+ /** Mira's legs (two strokes of width 8 and two foot pills) from the hips at (±hip, top) to the feet at (±foot, 0). */
47
+ const legs = (s, top, hip, foot) => [
48
+ el("path", { d: `M${-hip} ${top} L${-foot} 0 M${hip} ${top} L${foot} 0`, stroke: s.outline, "stroke-width": 8, "stroke-linecap": "round" }),
49
+ el("rect", { x: -foot - 10, y: -6, width: 20, height: 7, rx: 3.5, fill: s.outline }),
50
+ el("rect", { x: foot - 10, y: -6, width: 20, height: 7, rx: 3.5, fill: s.outline }),
51
+ ];
52
+ /** Visor's hand: a circle of radius 15 with the cast's outline. */
53
+ const hand = (s, cx, cy) => el("circle", { cx, cy, r: 15, ...outlined(s) });
54
+ /** The hood tip seen from behind, a flat lens on the top edge (Visor's back, at the character's top). */
55
+ const tipBack = (s, top) => el("path", { d: `M-28 ${top} Q0 ${top - 8} 28 ${top} Q0 ${top + 8} -28 ${top} Z`, fill: s.accent, stroke: s.outline, "stroke-width": 5, "stroke-linejoin": "round" });
56
+ /** A held prop's group: the prop's shapes with the skin's outline (the cast's root sets `stroke: none`). */
57
+ const heldGroup = (name, s, ...children) => g({ "data-held": name, stroke: s.outline, "stroke-width": tokens.outline.block, "stroke-linejoin": "round" }, ...children);
58
+ /**
59
+ * The character's tree (design §1, Visor's shape): the root group at the anchor
60
+ * and scale with `stroke: none`; the held prop first (outside the mirror, at its
61
+ * mirrored position, so its words and marks read), then the body group, mirrored
62
+ * facing left; the words in one text group with the root's transform.
63
+ */
64
+ const assemble = (name, p, held, parts) => {
65
+ const transform = `translate(${p.x} ${p.y}) scale(${p.scale ?? 1})`;
66
+ // Facing left mirrors the body only: a uniform -1 scale keeps every stroke width and colour (ADR 0009).
67
+ const body = g((p.facing ?? "right") === "left" ? { transform: "scale(-1,1)" } : {}, ...parts);
68
+ const words = held?.text ?? [];
69
+ const text = words.length > 0
70
+ ? [g({ transform, "font-family": tokens.font.sans, "font-size": tokens.cover.labelSize, "font-weight": tokens.cover.labelWeight, fill: tokens.color.ink, "text-anchor": "middle" }, ...words)]
71
+ : [];
72
+ return drawn([g({ "data-piece": name, transform, stroke: "none" }, ...(held?.body ?? []), body)], text);
73
+ };
74
+ /** -1 facing left, 1 facing right: the side of a held prop drawn outside the mirrored body. */
75
+ const side = (p) => ((p.facing ?? "right") === "left" ? -1 : 1);
76
+ /** Balão's body: the rounded balloon with its tail low on the front side, pointing out and down at (94, -76), never between the legs (design §2). */
77
+ const BALAO_BODY = "M-62 -132 Q-62 -162 -32 -162 H32 Q62 -162 62 -132 V-104 L94 -76 L56 -70 Q48 -60 32 -60 H-32 Q-62 -60 -62 -88 Z";
78
+ const BALAO_TOP = -162;
79
+ /** The held stamp's centre and radius, beside the tail (design §2); the front hand sits over its top edge. */
80
+ const BALAO_STAMP = { cx: 132, cy: -70, r: 24 };
81
+ const drawBalao = (p) => {
82
+ const s = skin(p.surface ?? "light");
83
+ const back = (p.view ?? "front") === "back";
84
+ const held = p.holdsStamp === undefined ? null : stamp({ ...BALAO_STAMP, cx: BALAO_STAMP.cx * side(p), word: p.holdsStamp.word });
85
+ const front = back
86
+ ? [tipBack(s, BALAO_TOP)]
87
+ : [
88
+ faceAt(-38, -146, 76, 40, s, p.expression ?? "idle"),
89
+ // The request is a bar, not a word: Balão draws no word of its own.
90
+ el("rect", { x: -30, y: -88, width: 60, height: 9, rx: 4.5, fill: p.speaks === true ? s.accent : tokens.illustration.textBar }),
91
+ peak(s, 0, BALAO_TOP, 28, 24),
92
+ ];
93
+ const parts = [
94
+ ...legs(s, -62, 20, 28),
95
+ el("path", { d: BALAO_BODY, ...outlined(s) }),
96
+ ...front,
97
+ hand(s, -86, -100),
98
+ held ? hand(s, BALAO_STAMP.cx, BALAO_STAMP.cy - 30) : hand(s, 92, -132),
99
+ ];
100
+ return assemble("balao", p, held && { body: [heldGroup("stamp", s, ...held.body)], text: held.text }, parts);
101
+ };
102
+ /** Balão's relation problem, at most one (design §5): one action at a time, then no stamp from behind. */
103
+ const balaoRelations = (p) => {
104
+ if (p.holdsStamp === undefined)
105
+ return [];
106
+ if (p.speaks === true)
107
+ return [{ path: "holdsStamp", message: "Balão does one action at a time" }];
108
+ if (p.view === "back")
109
+ return [{ path: "holdsStamp", message: "Balão holds a stamp only in the front view" }];
110
+ return [];
111
+ };
112
+ /** Balão, the requester and approver: a speech balloon whose tail points at the listener. */
113
+ export const balao = definePiece("balao", { ...sharedSchema, speaks: { kind: "boolean" }, holdsStamp: { kind: "object", fields: { word: label() } } }, drawBalao, balaoRelations);
114
+ /**
115
+ * Chaves's body, a brace outline that reads at 24 px (design §3, option A): the
116
+ * points reach x ±90 at mid height (y -88), 36 outside the corners (±54) and 46
117
+ * outside the waist (±44), each a corner between two curves.
118
+ */
119
+ const CHAVES_BODY = "M-30 -150 H30 Q54 -150 54 -128 Q54 -112 44 -108 Q60 -96 90 -88 Q60 -80 44 -68 Q54 -64 54 -48 Q54 -26 30 -26 H-30 Q-54 -26 -54 -48 Q-54 -64 -44 -68 Q-60 -80 -90 -88 Q-60 -96 -44 -108 Q-54 -112 -54 -128 Q-54 -150 -30 -150 Z";
120
+ const CHAVES_TOP = -150;
121
+ /** Where the held props sit (design §3): the keyboard's top-left corner, and the held page's near edge and bottom. */
122
+ const CHAVES_KEYBOARD = { x: 98, y: -74, width: 150 };
123
+ const CHAVES_SHEET_EDGE = 118;
124
+ const CHAVES_SHEET_BOTTOM = -40;
125
+ const drawChaves = (p) => {
126
+ const s = skin(p.surface ?? "light");
127
+ const back = (p.view ?? "front") === "back";
128
+ const turn = side(p);
129
+ let held = null;
130
+ let frontHand = hand(s, 100, -50);
131
+ if (p.types === true) {
132
+ // The keyboard's own shapes (its slab carries its stroke, its keys sit in a `stroke: none` group), without its
133
+ // `data-piece` root, so a selector of `[data-piece]` counts one piece per character.
134
+ const board = keyboard({ ...CHAVES_KEYBOARD, x: turn > 0 ? CHAVES_KEYBOARD.x : -CHAVES_KEYBOARD.x - CHAVES_KEYBOARD.width, surface: p.surface });
135
+ held = { body: [g({ "data-held": "keyboard" }, ...board.body[0].children.filter((child) => typeof child !== "string"))], text: [] };
136
+ frontHand = hand(s, 120, -80);
137
+ }
138
+ else if (p.holdsSheet !== undefined) {
139
+ const page = p.holdsSheet;
140
+ held = holdSheet(page, s, turn > 0 ? CHAVES_SHEET_EDGE : -CHAVES_SHEET_EDGE - page.width, CHAVES_SHEET_BOTTOM - page.height);
141
+ frontHand = hand(s, 112, -92);
142
+ }
143
+ else if (p.points === true) {
144
+ frontHand = pointingHand(s, 104, -128, 55);
145
+ }
146
+ const front = back
147
+ ? [tipBack(s, CHAVES_TOP)]
148
+ : [
149
+ faceAt(-34, -132, 68, 38, s, p.expression ?? "idle"),
150
+ el("rect", { x: -9, y: -76, width: 18, height: 8, rx: 2, fill: s.accent }),
151
+ peak(s, 0, CHAVES_TOP, 28, 24),
152
+ ];
153
+ const parts = [...legs(s, -30, 16, 26), el("path", { d: CHAVES_BODY, ...outlined(s) }), ...front, hand(s, -100, -50), frontHand];
154
+ return assemble("chaves", p, held, parts);
155
+ };
156
+ /** Chaves's relation problem, at most one (design §5): one action at a time (naming the second on), then no prop from behind. */
157
+ const chavesRelations = (p) => {
158
+ const on = [["types", p.types === true], ["points", p.points === true], ["holdsSheet", p.holdsSheet !== undefined]].filter(([, isOn]) => isOn).map(([name]) => name);
159
+ if (on.length > 1)
160
+ return [{ path: on[1], message: "Chaves does one action at a time" }];
161
+ if (p.view === "back" && on[0] === "types")
162
+ return [{ path: "types", message: "Chaves types only in the front view" }];
163
+ if (p.view === "back" && on[0] === "holdsSheet")
164
+ return [{ path: "holdsSheet", message: "Chaves holds a sheet only in the front view" }];
165
+ return [];
166
+ };
167
+ /** Chaves, the developer: a `{ }` body with sharp brace points and the cursor in the accent. */
168
+ export const chaves = definePiece("chaves", { ...sharedSchema, types: { kind: "boolean" }, points: { kind: "boolean" }, holdsSheet: { kind: "object", fields: heldSheetSchema } }, drawChaves, chavesRelations);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunosouzas/design-system",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Design tokens and illustration pieces of brunosouzas.com: tokens as CSS, JSON and TypeScript, pieces that draw SVG (and React), and a cover command.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {