@brunosouzas/design-system 0.9.0 → 0.10.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 +44 -4
- package/dist/src/pieces/cover.d.ts +35 -6
- package/dist/src/pieces/cover.js +60 -20
- package/dist/src/pieces/index.d.ts +1 -1
- package/dist/src/pieces/index.js +1 -1
- package/dist/src/pieces/link-icons.js +17 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -105,12 +105,14 @@ npm run build # compile the package into dis
|
|
|
105
105
|
npm run cover -- cover.json --out card.svg # build a blog cover (or a banner, diagram or icon) from its spec
|
|
106
106
|
npm run pieces:sheet -- --out out/pieces.svg # every piece once, labelled, for review
|
|
107
107
|
npm run pieces:sheet -- --out out/dark.svg --surface dark # the same on the dark surface
|
|
108
|
+
npm run png -- card.svg --out card.png # a written SVG as PNG, through Chrome (repository only)
|
|
108
109
|
npm run studio # Remotion Studio, for frame-by-frame review
|
|
109
110
|
```
|
|
110
111
|
|
|
111
112
|
- Change a token value in `tokens/source.json` and run `npm run tokens`; never edit `tokens/generated/` by hand. An invalid source prints every problem and writes nothing.
|
|
112
113
|
- `stills` and `render` take one scene name and an optional `--dry-run`, which prints the commands without running them. A render writes a hardware-encoded master (about 28 MB for 33 s) and an x264 web copy (under 1 MB) made with the ffmpeg bundled with Remotion, and prints one line per composition with its time and sizes. The four circuit-breaker clips take about four to five minutes on an Apple M3.
|
|
113
114
|
- Everything rendered goes to `out/`, which Git ignores.
|
|
115
|
+
- `npm run png -- <file.svg> --out <file.png> [--width <px>] [--ground <#rrggbb>] [--zones]` shows a written SVG through one `<img>` in headless Chrome (the renderer that honours the embedded faces, [ADR 0008](docs/adr/0008-type-inside-the-image.md)) and saves the screenshot at the SVG's own size, device scale 1. `--width` shows it smaller (the height follows), `--ground` puts it on a page of that colour with a 24 px margin, `--zones` draws LinkedIn's profile photo zones over a LinkedIn banner (in the page, never in the image). It is a repository script, not part of the package or of `brunosouzas-cover`, and needs Google Chrome or Chromium: the macOS applications, `google-chrome` or `chromium` on `PATH`, or `BRUNOSOUZAS_CHROME` set to the executable. A browser that fails, takes over 60 s or writes the wrong size exits 1 and leaves the target as it was.
|
|
114
116
|
|
|
115
117
|
## How a scene is built
|
|
116
118
|
|
|
@@ -252,16 +254,40 @@ The banner is one image that scales down as a whole. Words in it become small on
|
|
|
252
254
|
|
|
253
255
|
### Signature lockup
|
|
254
256
|
|
|
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
|
|
257
|
+
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, icon or `linkedin-banner` spec refuses the key (an icon accepted it and drew nothing before 0.7.0; on a LinkedIn banner the profile's own photo and name sign the page, and the lockup would show about 12 pt tall on a phone).
|
|
256
258
|
|
|
257
259
|
### Social and platform formats
|
|
258
260
|
|
|
259
|
-
|
|
261
|
+
Five more formats hold the symbol or a reduced cover frame, fixed size, no `height`:
|
|
260
262
|
|
|
261
263
|
- `"format": "linkedin-card"` — 1080x1080, cover frame conventions (`background`, `rings`, `pieces`, `custom`, `signature`). The "new piece" announcement card.
|
|
262
264
|
- `"format": "og"` — 1200x630, cover frame conventions. The site's generic social-preview image (not an article's own cover, which already serves as its og:image).
|
|
263
265
|
- `"format": "favicon"` — 32x32, no `pieces`: the symbol drawn twice, a light-theme group and a dark-theme group switched by a `prefers-color-scheme` media query. This command writes the SVG only; a favicon PNG set (16/32/48/180/192/512) is the consuming site's own build step.
|
|
264
|
-
- `"format": "avatar"` — 500x500, no `
|
|
266
|
+
- `"format": "avatar"` — 500x500, no `pieces` or `rings`: the symbol filling the frame on an accent-coloured ground (`brand.light.accentText`), or, with an optional `"background"` naming a cover background, on that pair's fill. One static image (GitHub profile, a GitHub App's logo), not theme-switching. Without `background` the image is byte-identical to 0.9.1's. The release App's icon is `{ "id": "release-app", "format": "avatar", "background": "neutral", … }`, the symbol on the cream ground; `npm run png` makes its PNG.
|
|
267
|
+
- `"format": "linkedin-banner"` — 1584x396, a LinkedIn profile background; see the next section.
|
|
268
|
+
|
|
269
|
+
### LinkedIn banner
|
|
270
|
+
|
|
271
|
+
A spec with `"format": "linkedin-banner"` builds the background of a LinkedIn personal profile: 1584x396 (`viewBox="0 0 1584 396"`, LinkedIn's recommended upload, 4:1), square corners (LinkedIn rounds its own card), with cover frame conventions: `background` (required), `rings`, `pieces`, `custom` and `customAt`; pieces and labels are not clipped, as on a cover. The rings go on to the farthest corner, as on a banner (42 rings for a centre at 1188, 198 with radius 60). `height` and `signature` are refused. `test/fixtures/covers/linkedin-banner.json` is the fixture, a banner with no words.
|
|
272
|
+
|
|
273
|
+
**The profile photo covers part of it.** LinkedIn publishes the upload size, not the layout around it. The zones were measured by the owner on 2026-11-11 from screenshots of his own profile, converted to banner units, the photo's white ring included, about ±2 units. Each safe radius adds `LINKEDIN_PHOTO_MARGIN` (16) for the measuring error and small drift:
|
|
274
|
+
|
|
275
|
+
| Zone | How the banner is shown | Photo centre | Photo radius | Safe radius | Safe area covers (x, y) |
|
|
276
|
+
|---|---|---|---|---|---|
|
|
277
|
+
| `desktop` | the 792 px profile card, the banner at 0.5 | (207, 362) | 160 | 176 | 31 to 383, 186 to 396 |
|
|
278
|
+
| `ios` | full phone width, not cropped, about 0.28 on a 440-pt phone; the centre lies below the image's bottom edge | (244, 409) | 187 | 203 | 41 to 447, 206 to 396 |
|
|
279
|
+
|
|
280
|
+
**Not measured:** the Android app, and desktop windows narrow enough to change the card's width. The numbers are exported, frozen, as `LINKEDIN_PHOTO_ZONES` (`{ name, cx, cy, r, safeRadius }`) and `LINKEDIN_PHOTO_MARGIN`. The command does not check a spec against them: keep every piece right of x 447 or above y 186, and check it on a render with the zones drawn:
|
|
281
|
+
|
|
282
|
+
```sh
|
|
283
|
+
npm run cover -- linkedin.json --out out/linkedin.svg
|
|
284
|
+
npm run png -- out/linkedin.svg --out out/linkedin-zones.png --width 792 --zones # review, zones drawn over it
|
|
285
|
+
npm run png -- out/linkedin.svg --out out/linkedin.png # the 1584x396 upload
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+

|
|
289
|
+
|
|
290
|
+
**Words: few, large, in English.** On a phone the banner shows at about 0.28 scale: a cover label (19 units) at about 5 pt, a 44-unit `headline` at about 12 pt, a 64-unit one at about 18 pt (at 0.5 on desktop, a label is about 9.5 px). So words, if any, come from `headline` at 44 units or more, in English (STY-8), from an approved source (ADR 0004). A `text` table is accepted for `en` only: any other language is reported at `text.<lang>` as "a LinkedIn banner's words are English".
|
|
265
291
|
|
|
266
292
|
### Body diagrams and icons from a spec
|
|
267
293
|
|
|
@@ -287,7 +313,7 @@ Add it to `src/pieces/library.ts` (or `src/pieces/metro.ts` for a map or diagram
|
|
|
287
313
|
### UI and link icons
|
|
288
314
|
|
|
289
315
|
- `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.
|
|
290
|
-
- `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/).
|
|
316
|
+
- `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` and `stackledger` (data in `LINK_ICONS`). `stackledger` is the product's mark on the white face: `ledgerMark`'s bent line in `illustration.accent` through its two white stations with ink outlines, the face being the page, so one outline. The GitHub mark is from [Font Awesome](https://fontawesome.com/), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
291
317
|
- `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.
|
|
292
318
|
- 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.
|
|
293
319
|
|
|
@@ -300,6 +326,20 @@ const github = toSvg(el("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "
|
|
|
300
326
|
|
|
301
327
|
`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.
|
|
302
328
|
|
|
329
|
+
## Upgrading to 0.10.0
|
|
330
|
+
|
|
331
|
+
0.10.0 (card 325, change `presence-formats`) adds a LinkedIn banner format and the stackledger link icon. Nothing is removed or renamed, and every 0.9.1 spec builds byte-identical.
|
|
332
|
+
|
|
333
|
+
| Added | What |
|
|
334
|
+
|---|---|
|
|
335
|
+
| `"format": "linkedin-banner"` | a 1584x396 LinkedIn profile background (see LinkedIn banner, above); `FORMATS` has nine names, so a check of the exact list must add it |
|
|
336
|
+
| `LINKEDIN_PHOTO_ZONES`, `LINKEDIN_PHOTO_MARGIN` | the profile photo's measured zones and the 16-unit margin of their safe areas, frozen, from the root entry |
|
|
337
|
+
| avatar `background` | an optional cover background name for the avatar's ground; without it the avatar is unchanged |
|
|
338
|
+
| `bannerRingCount(cx, cy, radius, width, height)` | the frame size as two optional parameters after `radius`, defaulting to the banner's 1200x420; every existing call keeps its result |
|
|
339
|
+
| `stackledger` link icon | the product's mark as a link sticker; `LINK_ICON_NAMES` has five names (`github`, `linkedin`, `email`, `website`, `stackledger`) |
|
|
340
|
+
|
|
341
|
+
`npm run png` is new too, but as a repository script: it is not in the package.
|
|
342
|
+
|
|
303
343
|
## Upgrading to 0.9.0
|
|
304
344
|
|
|
305
345
|
0.9.0 (card 307) adds a serif title. Nothing is removed or renamed, and every 0.8.1 spec builds byte-identical.
|
|
@@ -3,9 +3,10 @@ import { type SvgNode } from "./node.ts";
|
|
|
3
3
|
import { type Problem } from "./params.ts";
|
|
4
4
|
export declare const SAFE_ID: RegExp;
|
|
5
5
|
/** Cover (800x420, the default), banner (1200x420, rounded corners), body diagram (560 laid out, 800 shown),
|
|
6
|
-
* icon, favicon (the symbol, both themes), linkedin-card (1080x1080)
|
|
7
|
-
* spec cover-cli, "Banner output", "Diagram output",
|
|
8
|
-
|
|
6
|
+
* icon, favicon (the symbol, both themes), linkedin-card (1080x1080), avatar (500x500, the symbol only) or
|
|
7
|
+
* linkedin-banner (1584x396, a profile background): spec cover-cli, "Banner output", "Diagram output",
|
|
8
|
+
* "Icon output", "New icon formats", "LinkedIn banner output". */
|
|
9
|
+
export declare const FORMATS: readonly ["cover", "banner", "diagram", "icon", "favicon", "linkedin-card", "og", "avatar", "linkedin-banner"];
|
|
9
10
|
export type CoverFormat = (typeof FORMATS)[number];
|
|
10
11
|
/** Fixed frame sizes of the platform-shaped formats (not style, so not tokens — like EIP_ICON_WIDTH). */
|
|
11
12
|
export declare const FAVICON_SIZE = 32;
|
|
@@ -13,6 +14,27 @@ export declare const AVATAR_SIZE = 500;
|
|
|
13
14
|
export declare const LINKEDIN_CARD_SIZE = 1080;
|
|
14
15
|
export declare const OG_WIDTH = 1200;
|
|
15
16
|
export declare const OG_HEIGHT = 630;
|
|
17
|
+
/** LinkedIn's recommended upload for a personal profile background (4:1). */
|
|
18
|
+
export declare const LINKEDIN_BANNER_WIDTH = 1584;
|
|
19
|
+
export declare const LINKEDIN_BANNER_HEIGHT = 396;
|
|
20
|
+
/** Margin added to each profile photo radius for the safe area: the measuring error, the platform's rounding and small drift. */
|
|
21
|
+
export declare const LINKEDIN_PHOTO_MARGIN = 16;
|
|
22
|
+
export type LinkedinPhotoZone = {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly cx: number;
|
|
25
|
+
readonly cy: number;
|
|
26
|
+
readonly r: number;
|
|
27
|
+
readonly safeRadius: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The circles LinkedIn's profile photo covers on a 1584x396 banner, in banner units, the photo's white ring included
|
|
31
|
+
* (spec cover-cli, "LinkedIn profile photo zones"). Measured by the owner on 2026-11-11 from screenshots of his own
|
|
32
|
+
* profile, about ±2 units: desktop web (the 792 px profile card, the banner at 0.5) and the iOS app (full width, about
|
|
33
|
+
* 0.28 on a 440-pt phone; the centre lies below the image's bottom edge). The Android app and desktop windows narrow
|
|
34
|
+
* enough to change the card's width were not measured. The command does not check a spec against them; the PNG
|
|
35
|
+
* script draws them over a render (`npm run png -- … --zones`).
|
|
36
|
+
*/
|
|
37
|
+
export declare const LINKEDIN_PHOTO_ZONES: readonly LinkedinPhotoZone[];
|
|
16
38
|
export type CoverPiece = {
|
|
17
39
|
piece: PieceName;
|
|
18
40
|
} & Record<string, unknown>;
|
|
@@ -47,6 +69,11 @@ export type CoverSpec = (Framed & {
|
|
|
47
69
|
format?: "cover" | "banner" | "linkedin-card" | "og";
|
|
48
70
|
background: string;
|
|
49
71
|
height?: never;
|
|
72
|
+
}) | (Omit<Framed, "signature"> & {
|
|
73
|
+
format: "linkedin-banner";
|
|
74
|
+
background: string;
|
|
75
|
+
height?: never;
|
|
76
|
+
signature?: never;
|
|
50
77
|
}) | (Framed & {
|
|
51
78
|
format: "diagram"; /** Layout units. */
|
|
52
79
|
height: number;
|
|
@@ -78,7 +105,8 @@ export type CoverSpec = (Framed & {
|
|
|
78
105
|
pieces?: never[];
|
|
79
106
|
title?: string;
|
|
80
107
|
description?: string;
|
|
81
|
-
|
|
108
|
+
/** A `coverBackground` name: the square takes its fill (spec cover-cli, "Avatar ground"). */
|
|
109
|
+
background?: string;
|
|
82
110
|
rings?: never;
|
|
83
111
|
custom?: never;
|
|
84
112
|
customAt?: never;
|
|
@@ -95,8 +123,9 @@ export type CoverOptions = {
|
|
|
95
123
|
};
|
|
96
124
|
/** Every problem of a parsed spec, sorted by path; empty when the spec is valid. `lang` picks a text table. */
|
|
97
125
|
export declare const validateCoverSpec: (spec: unknown, options?: CoverOptions) => Problem[];
|
|
98
|
-
/** Rings a banner draws: out to the frame's farthest corner (spec cover-cli, "Banner rings reach the corners").
|
|
99
|
-
|
|
126
|
+
/** Rings a banner draws: out to the frame's farthest corner (spec cover-cli, "Banner rings reach the corners").
|
|
127
|
+
* The frame defaults to the banner's (1200x420); a LinkedIn banner passes its 1584x396 ("Ring count takes a frame size"). */
|
|
128
|
+
export declare const bannerRingCount: (cx: number, cy: number, radius?: number, width?: number, height?: number) => number;
|
|
100
129
|
/** Rings of a diagram (spec cover-cli, "Diagram rings at the shown scale"): the cover's step and width at the shown scale. */
|
|
101
130
|
export declare const diagramRings: (cx: number, cy: number, height: number, radius?: number) => {
|
|
102
131
|
count: number;
|
package/dist/src/pieces/cover.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Cover specs (spec cover-cli; design §6): validation of the JSON a cover is
|
|
2
2
|
// written in, and the frames that draw it from the pieces: the 800x420 cover,
|
|
3
|
-
// the banner, the body diagram and the icon (change designer-formats)
|
|
3
|
+
// the banner, the body diagram and the icon (change designer-formats), and the
|
|
4
|
+
// platform formats (favicon, LinkedIn card, og image, avatar, LinkedIn banner).
|
|
4
5
|
//
|
|
5
6
|
// Why here and not in scripts/: the validation and the frame are pure, so the
|
|
6
7
|
// tests and a future site build can use them without the command line.
|
|
@@ -21,15 +22,31 @@ import { COLOUR_TOKENS, CURRENT_COLOUR, checkParams, isColourLiteral, MAX_SIZE,
|
|
|
21
22
|
export const SAFE_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
22
23
|
const TOP_LEVEL = ["id", "title", "description", "format", "background", "rings", "pieces", "custom", "customAt", "height", "text", "signature"];
|
|
23
24
|
/** Cover (800x420, the default), banner (1200x420, rounded corners), body diagram (560 laid out, 800 shown),
|
|
24
|
-
* icon, favicon (the symbol, both themes), linkedin-card (1080x1080)
|
|
25
|
-
* spec cover-cli, "Banner output", "Diagram output",
|
|
26
|
-
|
|
25
|
+
* icon, favicon (the symbol, both themes), linkedin-card (1080x1080), avatar (500x500, the symbol only) or
|
|
26
|
+
* linkedin-banner (1584x396, a profile background): spec cover-cli, "Banner output", "Diagram output",
|
|
27
|
+
* "Icon output", "New icon formats", "LinkedIn banner output". */
|
|
28
|
+
export const FORMATS = ["cover", "banner", "diagram", "icon", "favicon", "linkedin-card", "og", "avatar", "linkedin-banner"];
|
|
27
29
|
/** Fixed frame sizes of the platform-shaped formats (not style, so not tokens — like EIP_ICON_WIDTH). */
|
|
28
30
|
export const FAVICON_SIZE = 32;
|
|
29
31
|
export const AVATAR_SIZE = 500;
|
|
30
32
|
export const LINKEDIN_CARD_SIZE = 1080;
|
|
31
33
|
export const OG_WIDTH = 1200;
|
|
32
34
|
export const OG_HEIGHT = 630;
|
|
35
|
+
/** LinkedIn's recommended upload for a personal profile background (4:1). */
|
|
36
|
+
export const LINKEDIN_BANNER_WIDTH = 1584;
|
|
37
|
+
export const LINKEDIN_BANNER_HEIGHT = 396;
|
|
38
|
+
/** Margin added to each profile photo radius for the safe area: the measuring error, the platform's rounding and small drift. */
|
|
39
|
+
export const LINKEDIN_PHOTO_MARGIN = 16;
|
|
40
|
+
const photoZone = (name, cx, cy, r) => Object.freeze({ name, cx, cy, r, safeRadius: r + LINKEDIN_PHOTO_MARGIN });
|
|
41
|
+
/**
|
|
42
|
+
* The circles LinkedIn's profile photo covers on a 1584x396 banner, in banner units, the photo's white ring included
|
|
43
|
+
* (spec cover-cli, "LinkedIn profile photo zones"). Measured by the owner on 2026-11-11 from screenshots of his own
|
|
44
|
+
* profile, about ±2 units: desktop web (the 792 px profile card, the banner at 0.5) and the iOS app (full width, about
|
|
45
|
+
* 0.28 on a 440-pt phone; the centre lies below the image's bottom edge). The Android app and desktop windows narrow
|
|
46
|
+
* enough to change the card's width were not measured. The command does not check a spec against them; the PNG
|
|
47
|
+
* script draws them over a render (`npm run png -- … --zones`).
|
|
48
|
+
*/
|
|
49
|
+
export const LINKEDIN_PHOTO_ZONES = Object.freeze([photoZone("desktop", 207, 362, 160), photoZone("ios", 244, 409, 187)]);
|
|
33
50
|
const CUSTOM_TAGS = ["g", "rect", "circle", "ellipse", "line", "polyline", "polygon", "path", "text"];
|
|
34
51
|
// Attributes a free-form object may use (design §6): geometry, paint, text and transform.
|
|
35
52
|
const CUSTOM_ATTRS = new Set([
|
|
@@ -339,12 +356,17 @@ const validateResolved = (spec) => {
|
|
|
339
356
|
blocked.push(key);
|
|
340
357
|
}
|
|
341
358
|
else if (format === "favicon" || format === "avatar") {
|
|
342
|
-
|
|
359
|
+
// An avatar takes an optional ground, a coverBackground name (spec cover-cli, "Avatar ground").
|
|
360
|
+
const refused = format === "avatar" ? ["rings", "custom", "customAt", "height", "signature"] : ["background", "rings", "custom", "customAt", "height", "signature"];
|
|
361
|
+
for (const key of refused) {
|
|
343
362
|
if (spec[key] !== undefined)
|
|
344
363
|
out.push({ path: key, message: `not used by the ${format} format` });
|
|
345
364
|
}
|
|
365
|
+
if (format === "avatar" && spec.background !== undefined && (typeof spec.background !== "string" || !backgroundNames().includes(spec.background))) {
|
|
366
|
+
out.push({ path: "background", message: `expected one of ${backgroundNames().join(", ")}, found ${describe(spec.background)}` });
|
|
367
|
+
}
|
|
346
368
|
for (const key of ["background", "rings", "custom"])
|
|
347
|
-
if (spec[key] !== undefined)
|
|
369
|
+
if (spec[key] !== undefined && refused.includes(key))
|
|
348
370
|
blocked.push(key);
|
|
349
371
|
}
|
|
350
372
|
else {
|
|
@@ -363,7 +385,10 @@ const validateResolved = (spec) => {
|
|
|
363
385
|
}
|
|
364
386
|
if (spec.height !== undefined)
|
|
365
387
|
out.push({ path: "height", message: "only a diagram takes a height" });
|
|
366
|
-
|
|
388
|
+
// The photo and the name sign a LinkedIn profile already; a 44-unit lockup would show about 12 pt on a phone.
|
|
389
|
+
if (format === "linkedin-banner" && spec.signature !== undefined)
|
|
390
|
+
out.push({ path: "signature", message: "not used by the linkedin-banner format" });
|
|
391
|
+
else if (spec.signature !== undefined && typeof spec.signature !== "boolean")
|
|
367
392
|
out.push({ path: "signature", message: "expected true or false" });
|
|
368
393
|
}
|
|
369
394
|
checkRings(spec, out);
|
|
@@ -463,6 +488,12 @@ const finish = (out) => {
|
|
|
463
488
|
export const validateCoverSpec = (spec, options = {}) => {
|
|
464
489
|
if (!isPlainObject(spec))
|
|
465
490
|
return [{ path: "(root)", message: `a cover spec must be a JSON object, found ${Array.isArray(spec) ? "an array" : describe(spec)}` }];
|
|
491
|
+
// A LinkedIn banner's words are English (STY-8): another table is reported whatever --lang names, and stops the check.
|
|
492
|
+
if (spec.format === "linkedin-banner" && isPlainObject(spec.text)) {
|
|
493
|
+
const other = Object.keys(spec.text).filter((code) => code !== "en");
|
|
494
|
+
if (other.length > 0)
|
|
495
|
+
return finish(other.map((code) => ({ path: `text.${code}`, message: "a LinkedIn banner's words are English" })));
|
|
496
|
+
}
|
|
466
497
|
// Text problems stop the check: references cannot be resolved, so the rest would report false problems.
|
|
467
498
|
const { table, problems: textProblems } = pickTable(spec, options.lang);
|
|
468
499
|
if (textProblems.length > 0)
|
|
@@ -489,9 +520,9 @@ const resolveCustom = (node) => {
|
|
|
489
520
|
attrs.stroke = "none";
|
|
490
521
|
return el(node.tag, attrs, ...(node.children ?? []).map((child) => (typeof child === "string" ? child : resolveCustom(child))));
|
|
491
522
|
};
|
|
492
|
-
/** Rings a banner draws: out to the frame's farthest corner (spec cover-cli, "Banner rings reach the corners").
|
|
493
|
-
|
|
494
|
-
|
|
523
|
+
/** Rings a banner draws: out to the frame's farthest corner (spec cover-cli, "Banner rings reach the corners").
|
|
524
|
+
* The frame defaults to the banner's (1200x420); a LinkedIn banner passes its 1584x396 ("Ring count takes a frame size"). */
|
|
525
|
+
export const bannerRingCount = (cx, cy, radius = tokens.cover.ringRadius, width = tokens.banner.width, height = tokens.banner.height) => {
|
|
495
526
|
const far = Math.max(...[[0, 0], [width, 0], [0, height], [width, height]].map(([x, y]) => Math.hypot(x - cx, y - cy)));
|
|
496
527
|
return Math.max(1, Math.ceil((far - radius) / tokens.cover.ringStep) + 1);
|
|
497
528
|
};
|
|
@@ -552,11 +583,12 @@ const faviconTree = (spec) => {
|
|
|
552
583
|
const size = FAVICON_SIZE;
|
|
553
584
|
return root(spec.id, size, size, `0 0 ${size} ${size}`, el("title", { id: `${spec.id}-title` }, spec.title), el("desc", { id: `${spec.id}-desc` }, spec.description), el("style", {}, `.ds-favicon-dark{display:none}@media (prefers-color-scheme:dark){.ds-favicon-light{display:none}.ds-favicon-dark{display:inline}}`), g({ class: "ds-favicon-light" }, ...symbol({ x: 0, y: 0, surface: "light" }).body), g({ class: "ds-favicon-dark" }, ...symbol({ x: 0, y: 0, surface: "dark" }).body));
|
|
554
585
|
};
|
|
555
|
-
/** An avatar (spec cover-cli, "New icon formats"): the symbol only, filling the frame
|
|
586
|
+
/** An avatar (spec cover-cli, "New icon formats", "Avatar ground"): the symbol only, filling the frame, on
|
|
587
|
+
* `brand.light.accentText` or on the `background` pair's fill. Without `background` the tree is 0.9.1's. */
|
|
556
588
|
const avatarTree = (spec) => {
|
|
557
589
|
const size = AVATAR_SIZE;
|
|
558
590
|
const scale = size / 32;
|
|
559
|
-
return root(spec.id, size, size, `0 0 ${size} ${size}`, el("title", { id: `${spec.id}-title` }, spec.title), el("desc", { id: `${spec.id}-desc` }, spec.description), el("rect", { width: size, height: size, fill: tokens.brand.light.accentText }), g({ transform: `scale(${scale})` }, ...symbol({ x: 0, y: 0, surface: "light" }).body));
|
|
591
|
+
return root(spec.id, size, size, `0 0 ${size} ${size}`, el("title", { id: `${spec.id}-title` }, spec.title), el("desc", { id: `${spec.id}-desc` }, spec.description), el("rect", { width: size, height: size, fill: spec.background === undefined ? tokens.brand.light.accentText : tokens.coverBackground[spec.background].fill }), g({ transform: `scale(${scale})` }, ...symbol({ x: 0, y: 0, surface: "light" }).body));
|
|
560
592
|
};
|
|
561
593
|
/** The cover's (banner's, diagram's, icon's, favicon's, avatar's) node tree. The spec must be valid for `lang` (validateCoverSpec returned no problem). */
|
|
562
594
|
export const coverTree = (input, options = {}) => {
|
|
@@ -572,21 +604,29 @@ export const coverTree = (input, options = {}) => {
|
|
|
572
604
|
const banner = spec.format === "banner";
|
|
573
605
|
const linkedinCard = spec.format === "linkedin-card";
|
|
574
606
|
const og = spec.format === "og";
|
|
607
|
+
const linkedinBanner = spec.format === "linkedin-banner";
|
|
575
608
|
const { width, height } = linkedinCard
|
|
576
609
|
? { width: LINKEDIN_CARD_SIZE, height: LINKEDIN_CARD_SIZE }
|
|
577
|
-
:
|
|
578
|
-
? { width:
|
|
579
|
-
:
|
|
580
|
-
?
|
|
581
|
-
:
|
|
582
|
-
|
|
610
|
+
: linkedinBanner
|
|
611
|
+
? { width: LINKEDIN_BANNER_WIDTH, height: LINKEDIN_BANNER_HEIGHT }
|
|
612
|
+
: og
|
|
613
|
+
? { width: OG_WIDTH, height: OG_HEIGHT }
|
|
614
|
+
: banner
|
|
615
|
+
? tokens.banner
|
|
616
|
+
: tokens.cover;
|
|
617
|
+
// A banner's corners are rounded; a cover, a LinkedIn card, an og image and a LinkedIn banner keep the square frame, attribute for attribute.
|
|
583
618
|
const corner = banner ? { rx: tokens.banner.radius } : {};
|
|
584
619
|
const pair = tokens.coverBackground[spec.background];
|
|
585
620
|
const drawnPieces = spec.pieces.map(draw);
|
|
586
621
|
const ringPath = `coverBackground.${spec.background}.ring`;
|
|
587
|
-
|
|
622
|
+
// A banner and a LinkedIn banner draw their rings out to the farthest corner; a cover keeps the default count.
|
|
623
|
+
const ringCount = banner
|
|
624
|
+
? { count: bannerRingCount(spec.rings.cx, spec.rings.cy, spec.rings.radius) }
|
|
625
|
+
: linkedinBanner
|
|
626
|
+
? { count: bannerRingCount(spec.rings.cx, spec.rings.cy, spec.rings.radius, width, height) }
|
|
627
|
+
: {};
|
|
588
628
|
const frame = `url(#${spec.id}-frame)`;
|
|
589
|
-
const signature = spec.signature ? signatureGroup(width, height) : null;
|
|
629
|
+
const signature = spec.format !== "linkedin-banner" && spec.signature ? signatureGroup(width, height) : null;
|
|
590
630
|
const outlined = g({ stroke: tokens.color.ink, "stroke-width": tokens.outline.block, "stroke-linejoin": "round" }, ...bodies(spec, drawnPieces), signature);
|
|
591
631
|
const labels = g({ "font-size": tokens.cover.labelSize, "font-weight": tokens.cover.labelWeight, fill: tokens.color.ink, "text-anchor": "middle" }, ...drawnPieces.flatMap((d) => d.text));
|
|
592
632
|
return root(spec.id, width, height, `0 0 ${width} ${height}`, el("title", { id: `${spec.id}-title` }, spec.title), el("desc", { id: `${spec.id}-desc` }, spec.description), el("defs", {}, el("clipPath", { id: `${spec.id}-frame` }, el("rect", { width, height, ...corner }))), el("rect", { width, height, ...corner, fill: pair.fill }), g({ "clip-path": frame }, ...rings({ ...spec.rings, color: ringPath, ...ringCount }).body),
|
|
@@ -5,7 +5,7 @@ export { COLOUR_TOKENS, DATA_COLOUR, MAX_ITEMS, paint, MAX_SIZE, checkParams, co
|
|
|
5
5
|
export { definePiece, type Piece } from "./piece.ts";
|
|
6
6
|
export * from "./library.ts";
|
|
7
7
|
export { EIP_ICONS, EIP_ICON_NAMES, EIP_ICON_HEIGHT, EIP_ICON_WIDTH, type EipIcon } from "./eip-icons.ts";
|
|
8
|
-
export { FORMATS, LANGUAGE, SAFE_ID, backgroundNames, bannerRingCount, comparePaths, coverTree, diagramRings, validateCoverSpec, type CoverFormat, type CoverOptions, type CoverPiece, type CoverRings, type CoverSpec, type CustomNode } from "./cover.ts";
|
|
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
11
|
export { CAST_EXPRESSIONS, CAST_VIEWS, type CastExpression, type CastView, type MiraParams, type VisorParams, type DroneParams, type KiuParams, type SinalParams } from "./brand-cast.ts";
|
package/dist/src/pieces/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export { COLOUR_TOKENS, DATA_COLOUR, MAX_ITEMS, paint, MAX_SIZE, checkParams, co
|
|
|
10
10
|
export { definePiece } from "./piece.js";
|
|
11
11
|
export * from "./library.js";
|
|
12
12
|
export { EIP_ICONS, EIP_ICON_NAMES, EIP_ICON_HEIGHT, EIP_ICON_WIDTH } from "./eip-icons.js";
|
|
13
|
-
export { FORMATS, LANGUAGE, SAFE_ID, backgroundNames, bannerRingCount, comparePaths, coverTree, diagramRings, validateCoverSpec } from "./cover.js";
|
|
13
|
+
export { FORMATS, LANGUAGE, LINKEDIN_PHOTO_MARGIN, LINKEDIN_PHOTO_ZONES, SAFE_ID, backgroundNames, bannerRingCount, comparePaths, coverTree, diagramRings, validateCoverSpec } from "./cover.js";
|
|
14
14
|
export { tokens } from "../../tokens/generated/tokens.js";
|
|
15
15
|
export { EMOTE_KINDS } from "./emote.js";
|
|
16
16
|
export { CAST_EXPRESSIONS, CAST_VIEWS } from "./brand-cast.js";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Link icons as data (spec illustration-pieces, "Link icons as data"; design §6
|
|
2
2
|
// of stackledger-map-and-link-pieces): the social stickers of brunosouzas.com
|
|
3
3
|
// (public/images/home/social-*.svg at e29b3dd), with every colour replaced by
|
|
4
|
-
// its token, plus a `website` globe in the same style
|
|
4
|
+
// its token, plus a `website` globe in the same style and `stackledger`, the
|
|
5
|
+
// product's mark (`ledgerMark`'s bent line and two stations, mapped from its
|
|
6
|
+
// 32-unit page onto the 38-unit face, change presence-formats design §8; the
|
|
7
|
+
// face is the page, so the mark keeps one outline). `linkIcon` draws the
|
|
5
8
|
// face white with its outline and no frame behind it (ADR 0009: no hard shadow,
|
|
6
9
|
// colour only where it means something), then the glyph, at the site's measures
|
|
7
10
|
// (46 box, face 38 at 2, radius 9, outline 2.5). On the dark surface the face's
|
|
@@ -62,6 +65,19 @@ export const LINK_ICONS = [
|
|
|
62
65
|
el("path", { d: "M10.5 21H31.5M12.5 15.5H29.5M12.5 26.5H29.5", fill: "none", stroke: INK, "stroke-width": 2, "stroke-linecap": "round" }),
|
|
63
66
|
],
|
|
64
67
|
},
|
|
68
|
+
{
|
|
69
|
+
name: "stackledger",
|
|
70
|
+
title: "stackledger",
|
|
71
|
+
description: "stackledger icon: the product's mark, a bent line through two stations.",
|
|
72
|
+
face: "color.white",
|
|
73
|
+
// ledgerMark's content at x 1.1875, then +2. The line's width is the mark's 4.5 scaled (5.34, rounded); the big
|
|
74
|
+
// station takes the family's outline (2.5) and the small one keeps the mark's ratio (1.6 / 2 x 2.5).
|
|
75
|
+
glyph: [
|
|
76
|
+
el("path", { d: "M10.3 29.3 L18.6 21 L31.7 21", fill: "none", stroke: tokens.illustration.accent, "stroke-width": 5.3, "stroke-linecap": "round", "stroke-linejoin": "round" }),
|
|
77
|
+
el("circle", { cx: 18.6, cy: 21, r: 4.75, fill: C.white, stroke: INK, "stroke-width": 2.5 }),
|
|
78
|
+
el("circle", { cx: 31.7, cy: 21, r: 3.1, fill: C.white, stroke: INK, "stroke-width": 2 }),
|
|
79
|
+
],
|
|
80
|
+
},
|
|
65
81
|
];
|
|
66
82
|
export const LINK_ICON_NAMES = LINK_ICONS.map((icon) => icon.name);
|
|
67
83
|
/** One link sticker at (x, y), `size` wide (46 by default), on the light or the dark page. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brunosouzas/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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": {
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"render": "tsx scripts/render.ts",
|
|
65
65
|
"cover": "tsx scripts/cover.ts",
|
|
66
66
|
"pieces:sheet": "tsx scripts/pieces-sheet.ts",
|
|
67
|
+
"png": "tsx scripts/png.ts",
|
|
67
68
|
"studio": "remotion studio src/index.ts",
|
|
68
69
|
"test": "vitest run",
|
|
69
70
|
"typecheck": "tsc -p .",
|