@brunosouzas/design-system 0.10.0 → 0.11.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
|
@@ -313,7 +313,7 @@ Add it to `src/pieces/library.ts` (or `src/pieces/metro.ts` for a map or diagram
|
|
|
313
313
|
### UI and link icons
|
|
314
314
|
|
|
315
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.
|
|
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 `
|
|
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`, `stackledger` and `brunosouzas` (data in `LINK_ICONS`, names in `LINK_ICON_NAMES`). `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. `brunosouzas` is the brand symbol, the b with the moon of the favicon and the avatar (`symbol`'s own shapes, at 0.875 and centred on the face), in the light symbol's colours on both surfaces; title `brunosouzas.com`. Use it for every link to brunosouzas.com, so the link needs no words; `website` stays the generic globe for any other site. Every link icon is its own piece and its own file (an icon spec with one `linkIcon` writes it alone); the package has no combined icon or row, so a consumer lays out the separate icons itself. The GitHub mark is from [Font Awesome](https://fontawesome.com/), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
317
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.
|
|
318
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.
|
|
319
319
|
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
// its token, plus a `website` globe in the same style and `stackledger`, the
|
|
5
5
|
// product's mark (`ledgerMark`'s bent line and two stations, mapped from its
|
|
6
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)
|
|
7
|
+
// face is the page, so the mark keeps one outline), and `brunosouzas`, the
|
|
8
|
+
// brand symbol of the favicon and the avatar (`symbolShapes`, scaled to the
|
|
9
|
+
// other glyphs' size and centred on the face, change brand-link-icon design §1;
|
|
10
|
+
// the site's own icon, where `website` stays the generic one). `linkIcon` draws the
|
|
8
11
|
// face white with its outline and no frame behind it (ADR 0009: no hard shadow,
|
|
9
12
|
// colour only where it means something), then the glyph, at the site's measures
|
|
10
13
|
// (46 box, face 38 at 2, radius 9, outline 2.5). On the dark surface the face's
|
|
@@ -21,6 +24,7 @@ import { drawn, el, g, r2 } from "./node.js";
|
|
|
21
24
|
import { pos, size } from "./params.js";
|
|
22
25
|
import { definePiece } from "./piece.js";
|
|
23
26
|
import { SURFACES } from "./metro.js";
|
|
27
|
+
import { symbolShapes } from "./symbol.js";
|
|
24
28
|
const C = tokens.color;
|
|
25
29
|
const INK = C.ink;
|
|
26
30
|
/** Every link icon draws in a 46x46 box. */
|
|
@@ -78,6 +82,15 @@ export const LINK_ICONS = [
|
|
|
78
82
|
el("circle", { cx: 31.7, cy: 21, r: 3.1, fill: C.white, stroke: INK, "stroke-width": 2 }),
|
|
79
83
|
],
|
|
80
84
|
},
|
|
85
|
+
{
|
|
86
|
+
name: "brunosouzas",
|
|
87
|
+
title: "brunosouzas.com",
|
|
88
|
+
description: "brunosouzas.com icon: the brand symbol, a b with a moon.",
|
|
89
|
+
face: "color.white",
|
|
90
|
+
// The symbol's 32-unit box at 0.875, its content box (x 5 to 30.3, y 3 to 30.1) centred on the face's (21, 21).
|
|
91
|
+
// The face is white on both surfaces, so the glyph keeps the light symbol's colours on both.
|
|
92
|
+
glyph: [g({ transform: "translate(5.56 6.52) scale(0.875)" }, ...symbolShapes(tokens.brand.light.text, tokens.brand.light.accent))],
|
|
93
|
+
},
|
|
81
94
|
];
|
|
82
95
|
export const LINK_ICON_NAMES = LINK_ICONS.map((icon) => icon.name);
|
|
83
96
|
/** One link sticker at (x, y), `size` wide (46 by default), on the light or the dark page. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SvgNode } from "./node.ts";
|
|
1
2
|
import { type SurfaceName } from "./ink.ts";
|
|
2
3
|
export type SymbolParams = {
|
|
3
4
|
x: number;
|
|
@@ -5,5 +6,8 @@ export type SymbolParams = {
|
|
|
5
6
|
surface?: SurfaceName;
|
|
6
7
|
scale?: number;
|
|
7
8
|
};
|
|
9
|
+
/** The symbol's three shapes in its 32×32 box: the haste and the ring in `text`, the moon in `moon`. One drawing,
|
|
10
|
+
* shared by `symbol` (favicon, avatar, signature) and the `brunosouzas` link icon (change brand-link-icon). */
|
|
11
|
+
export declare const symbolShapes: (text: string, moon: string) => SvgNode[];
|
|
8
12
|
/** The brand symbol ("b" with a moon, I5), in a 32×32 box before `scale`. Favicon and avatar are built from this. */
|
|
9
13
|
export declare const symbol: import("./piece.ts").Piece<SymbolParams>;
|
|
@@ -8,12 +8,19 @@ import { pos, num } from "./params.js";
|
|
|
8
8
|
import { definePiece } from "./piece.js";
|
|
9
9
|
import { colour } from "./params.js";
|
|
10
10
|
const c = (path) => colour(path);
|
|
11
|
+
/** The symbol's three shapes in its 32×32 box: the haste and the ring in `text`, the moon in `moon`. One drawing,
|
|
12
|
+
* shared by `symbol` (favicon, avatar, signature) and the `brunosouzas` link icon (change brand-link-icon). */
|
|
13
|
+
export const symbolShapes = (text, moon) => [
|
|
14
|
+
el("rect", { x: 5, y: 3, width: 5.5, height: 26, rx: 2.75, fill: text }),
|
|
15
|
+
el("circle", { cx: 17.5, cy: 20.5, r: 7.3, fill: "none", stroke: text, "stroke-width": 4.6 }),
|
|
16
|
+
el("circle", { cx: 27.5, cy: 9, r: 2.8, fill: moon }),
|
|
17
|
+
];
|
|
11
18
|
const drawSymbol = (p) => {
|
|
12
19
|
const light = (p.surface ?? "light") === "light";
|
|
13
20
|
const color = light ? c("brand.light.text") : c("brand.dark.text");
|
|
14
21
|
const moon = light ? c("brand.light.accent") : c("brand.dark.accent");
|
|
15
22
|
const scale = p.scale ?? 1; // size is in the 32×32 glyph box, scaled like any other piece
|
|
16
|
-
const body = g({ transform: `translate(${p.x} ${p.y}) scale(${scale})` },
|
|
23
|
+
const body = g({ transform: `translate(${p.x} ${p.y}) scale(${scale})` }, ...symbolShapes(color, moon));
|
|
17
24
|
return drawn([body]);
|
|
18
25
|
};
|
|
19
26
|
/** The brand symbol ("b" with a moon, I5), in a 32×32 box before `scale`. Favicon and avatar are built from this. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brunosouzas/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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": {
|