@brunosouzas/signwright 0.0.0-stage → 0.19.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/LICENSE +202 -0
- package/NOTICE +15 -0
- package/README.md +567 -2
- package/dist/scripts/cover.d.ts +29 -0
- package/dist/scripts/cover.js +186 -0
- package/dist/src/fonts/embed.d.ts +7 -0
- package/dist/src/fonts/embed.js +221 -0
- package/dist/src/pieces/bank-objects.d.ts +12 -0
- package/dist/src/pieces/bank-objects.js +52 -0
- package/dist/src/pieces/brand-cast.d.ts +105 -0
- package/dist/src/pieces/brand-cast.js +221 -0
- package/dist/src/pieces/brand-notation-icons.d.ts +12 -0
- package/dist/src/pieces/brand-notation-icons.js +79 -0
- package/dist/src/pieces/category-icon.d.ts +12 -0
- package/dist/src/pieces/category-icon.js +55 -0
- package/dist/src/pieces/cover.d.ts +138 -0
- package/dist/src/pieces/cover.js +635 -0
- package/dist/src/pieces/diagram.d.ts +141 -0
- package/dist/src/pieces/diagram.js +201 -0
- package/dist/src/pieces/eip-icons.d.ts +12 -0
- package/dist/src/pieces/eip-icons.js +468 -0
- package/dist/src/pieces/emote.d.ts +13 -0
- package/dist/src/pieces/emote.js +88 -0
- package/dist/src/pieces/headline.d.ts +11 -0
- package/dist/src/pieces/headline.js +37 -0
- package/dist/src/pieces/index.d.ts +17 -0
- package/dist/src/pieces/index.js +20 -0
- package/dist/src/pieces/ink.d.ts +71 -0
- package/dist/src/pieces/ink.js +57 -0
- package/dist/src/pieces/keyboard.d.ts +9 -0
- package/dist/src/pieces/keyboard.js +33 -0
- package/dist/src/pieces/library.d.ts +320 -0
- package/dist/src/pieces/library.js +355 -0
- package/dist/src/pieces/link-icons.d.ts +23 -0
- package/dist/src/pieces/link-icons.js +101 -0
- package/dist/src/pieces/metro.d.ts +137 -0
- package/dist/src/pieces/metro.js +288 -0
- package/dist/src/pieces/node.d.ts +29 -0
- package/dist/src/pieces/node.js +56 -0
- package/dist/src/pieces/paper.d.ts +31 -0
- package/dist/src/pieces/paper.js +72 -0
- package/dist/src/pieces/params.d.ts +84 -0
- package/dist/src/pieces/params.js +158 -0
- package/dist/src/pieces/piece.d.ts +9 -0
- package/dist/src/pieces/piece.js +28 -0
- package/dist/src/pieces/pose.d.ts +16 -0
- package/dist/src/pieces/pose.js +30 -0
- package/dist/src/pieces/question-token.d.ts +9 -0
- package/dist/src/pieces/question-token.js +49 -0
- package/dist/src/pieces/react.d.ts +4 -0
- package/dist/src/pieces/react.js +13 -0
- package/dist/src/pieces/render.d.ts +2 -0
- package/dist/src/pieces/render.js +22 -0
- package/dist/src/pieces/skin.d.ts +22 -0
- package/dist/src/pieces/skin.js +13 -0
- package/dist/src/pieces/stamp.d.ts +11 -0
- package/dist/src/pieces/stamp.js +29 -0
- package/dist/src/pieces/supporting-cast.d.ts +35 -0
- package/dist/src/pieces/supporting-cast.js +168 -0
- package/dist/src/pieces/symbol.d.ts +13 -0
- package/dist/src/pieces/symbol.js +27 -0
- package/dist/src/pieces/ui-icons.d.ts +21 -0
- package/dist/src/pieces/ui-icons.js +35 -0
- package/dist/tokens/generated/tokens.d.ts +299 -0
- package/dist/tokens/generated/tokens.js +299 -0
- package/fonts/OFL.txt +97 -0
- package/fonts/SourceCodePro-Bold.ttf +0 -0
- package/fonts/SourceCodePro-Regular.ttf +0 -0
- package/fonts/SourceSans3-Black.ttf +0 -0
- package/fonts/SourceSans3-Bold.ttf +0 -0
- package/fonts/SourceSans3-Regular.ttf +0 -0
- package/fonts/SourceSerif4-Bold.ttf +0 -0
- package/package.json +88 -4
- package/tokens/generated/tokens.css +215 -0
- package/tokens/generated/tokens.json +298 -0
- package/tokens/generated/tokens.ts +302 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
// The illustration pieces (spec illustration-pieces, "Piece catalogue";
|
|
2
|
+
// design §4). Each one is a pure function of its parameters and the tokens.
|
|
3
|
+
// Positions and sizes are cover pixels; colours are token paths, resolved here.
|
|
4
|
+
//
|
|
5
|
+
// Geometry: ported from the approved prototype
|
|
6
|
+
// (~/.hermes/spikes/design-system/illustration-pieces/pieces.ts), or, for the
|
|
7
|
+
// pieces it lacked, measured from the published covers named in design §4.
|
|
8
|
+
// Words: a piece draws only the words its caller passes (ADR 0004).
|
|
9
|
+
import { tokens } from "../../tokens/generated/tokens.js";
|
|
10
|
+
import { EIP_ICONS, EIP_ICON_NAMES } from "./eip-icons.js";
|
|
11
|
+
import { drawn, el, g, r2, shadowed } from "./node.js";
|
|
12
|
+
import { col, colour, count, label, MAX_SIZE, PATH_DATA, pos, size } from "./params.js";
|
|
13
|
+
import { definePiece } from "./piece.js";
|
|
14
|
+
import { METRO_PIECES } from "./metro.js";
|
|
15
|
+
import { DIAGRAM_PIECES, stateStart } from "./diagram.js";
|
|
16
|
+
import { uiIcon } from "./ui-icons.js";
|
|
17
|
+
import { linkIcon } from "./link-icons.js";
|
|
18
|
+
import { emote } from "./emote.js";
|
|
19
|
+
import { mira, visor, drone, kiu, sinal } from "./brand-cast.js";
|
|
20
|
+
import { bankObject } from "./bank-objects.js";
|
|
21
|
+
import { symbol } from "./symbol.js";
|
|
22
|
+
import { brandNotationIcon } from "./brand-notation-icons.js";
|
|
23
|
+
import { categoryIcon } from "./category-icon.js";
|
|
24
|
+
import { headline } from "./headline.js";
|
|
25
|
+
import { questionToken } from "./question-token.js";
|
|
26
|
+
import { pill, sheet } from "./paper.js";
|
|
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 };
|
|
31
|
+
export { emote, mira, visor, drone, kiu, sinal, bankObject, symbol, brandNotationIcon, categoryIcon, headline, questionToken };
|
|
32
|
+
export * from "./metro.js";
|
|
33
|
+
export * from "./diagram.js";
|
|
34
|
+
export * from "./ui-icons.js";
|
|
35
|
+
export * from "./link-icons.js";
|
|
36
|
+
const ink = tokens.color.ink;
|
|
37
|
+
const mono = tokens.font.mono;
|
|
38
|
+
// ---------- labels and paper: pill and sheet live in paper.ts ----------
|
|
39
|
+
// ---------- background ----------
|
|
40
|
+
export const RING_COUNT = 14;
|
|
41
|
+
/** Most rings one call draws: enough for a banner's farthest corner from any centre a cover spec accepts (548). */
|
|
42
|
+
export const MAX_RINGS = 1000;
|
|
43
|
+
/** Concentric rings around (cx, cy): `count` rings (14 by default), step and width from the cover tokens. */
|
|
44
|
+
export const rings = definePiece("rings", { cx: pos(), cy: pos(), radius: size(), color: col(), count: count(1, MAX_RINGS) }, ({ cx, cy, radius = tokens.cover.ringRadius, color = "color.ring", count: rings = RING_COUNT }) => drawn([
|
|
45
|
+
g({ fill: "none", stroke: colour(color, "color"), "stroke-width": tokens.cover.ringWidth }, ...Array.from({ length: rings }, (_, i) => el("circle", { cx, cy, r: radius + i * tokens.cover.ringStep }))),
|
|
46
|
+
]));
|
|
47
|
+
// The line kinds of 0.6.x specs, kept so they stay valid (ADR 0009): on the dark card every line is
|
|
48
|
+
// brand.dark.textMuted, a `white` line brand.dark.text, and the `tall` line (the one under review) the accent.
|
|
49
|
+
const CODE_LINE_COLOURS = ["healthy", "caller", "white", "backend"];
|
|
50
|
+
/** Dark code panel with neutral lines; a tall line, the one under review, takes the accent (ADR 0009). */
|
|
51
|
+
export const codePanel = definePiece("codePanel", {
|
|
52
|
+
x: pos(),
|
|
53
|
+
y: pos(),
|
|
54
|
+
width: size(true),
|
|
55
|
+
height: size(true),
|
|
56
|
+
lines: {
|
|
57
|
+
kind: "array",
|
|
58
|
+
required: true,
|
|
59
|
+
of: {
|
|
60
|
+
kind: "object",
|
|
61
|
+
fields: { indent: { kind: "number", required: true, min: 0, max: MAX_SIZE }, w: size(true), color: { kind: "enum", required: true, values: CODE_LINE_COLOURS }, tall: { kind: "boolean" } },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
top: size(),
|
|
65
|
+
step: size(),
|
|
66
|
+
}, ({ x, y, width, height, lines, top = 38, step = 22 }) => drawn([
|
|
67
|
+
...shadowed(el("rect", { x, y, width, height, rx: 14, fill: tokens.illustration.codePanel })),
|
|
68
|
+
g({ stroke: "none" }, ...lines.map((line, i) => el("rect", {
|
|
69
|
+
x: x + 20 + line.indent,
|
|
70
|
+
y: y + top + i * step - (line.tall ? 3 : 0),
|
|
71
|
+
width: line.w,
|
|
72
|
+
height: line.tall ? 16 : 10,
|
|
73
|
+
rx: line.tall ? 8 : 5,
|
|
74
|
+
fill: line.tall ? tokens.brand.dark.accent : line.color === "white" ? tokens.brand.dark.text : tokens.brand.dark.textMuted,
|
|
75
|
+
}))),
|
|
76
|
+
]));
|
|
77
|
+
/** Chat slip with a tail at the bottom left and one text line. */
|
|
78
|
+
export const speechBubble = definePiece("speechBubble", { x: pos(), y: pos(), width: size(true, 60), height: size(true, 50), fill: col() }, ({ x, y, width: w, height: h, fill = "color.white" }) => {
|
|
79
|
+
const r = 12;
|
|
80
|
+
const b = y + h;
|
|
81
|
+
const d = `M${x},${y + r} Q${x},${y} ${x + r},${y} H${x + w - r} Q${x + w},${y} ${x + w},${y + r} V${b - r} Q${x + w},${b} ${x + w - r},${b} H${x + 44} L${x + 20},${b + 20} L${x + 24},${b} H${x + r} Q${x},${b} ${x},${b - r} Z`;
|
|
82
|
+
return drawn([
|
|
83
|
+
...shadowed(el("path", { d, fill: colour(fill, "fill") })),
|
|
84
|
+
el("rect", { x: x + 22, y: y + 31, width: w - 44, height: 13, rx: 6.5, fill: tokens.illustration.textBar, stroke: "none" }),
|
|
85
|
+
]);
|
|
86
|
+
});
|
|
87
|
+
/** Browser window: title bar with three dots, a hero block and two text lines. */
|
|
88
|
+
export const browserWindow = definePiece("browserWindow", { x: pos(), y: pos(), width: size(false, 60), height: size(false, 130) }, ({ x, y, width: w = 200, height: h = 140 }) => drawn([
|
|
89
|
+
...shadowed(el("rect", { x, y, width: w, height: h, rx: 12, fill: tokens.color.white })),
|
|
90
|
+
el("path", { d: `M${x},${y + 30} H${x + w}`, fill: "none" }),
|
|
91
|
+
...[tokens.color.white, tokens.color.white, tokens.color.white].map((fill, i) => el("circle", { cx: x + 18 + i * 16, cy: y + 15, r: 5, fill, "stroke-width": 2.5 })),
|
|
92
|
+
el("rect", { x: x + 20, y: y + 46, width: w - 40, height: 40, rx: 8, fill: tokens.brand.light.bg, "stroke-width": tokens.outline.small }),
|
|
93
|
+
el("rect", { x: x + 20, y: y + 100, width: r2(w * 0.6), height: 10, rx: 5, fill: tokens.illustration.textBar, stroke: "none" }),
|
|
94
|
+
el("rect", { x: x + 20, y: y + 118, width: r2(w * 0.4), height: 10, rx: 5, fill: tokens.illustration.textBar, stroke: "none" }),
|
|
95
|
+
]));
|
|
96
|
+
/** Open folder with two sheets peeking out, measured from the write-in-obsidian cover (190x198 at scale 1). */
|
|
97
|
+
export const folder = definePiece("folder", { x: pos(), y: pos(), scale: size() }, ({ x, y, scale: s = 1 }) => {
|
|
98
|
+
const p = (dx, dy) => `${r2(x + dx * s)},${r2(y + dy * s)}`;
|
|
99
|
+
const back = `M${p(0, 30)} L${p(0, 12)} Q${p(0, 0)} ${p(12, 0)} L${p(66, 0)} Q${p(76, 0)} ${p(80, 10)} L${p(86, 30)} L${p(178, 30)} Q${p(190, 30)} ${p(190, 42)} L${p(190, 198)} L${p(0, 198)} Z`;
|
|
100
|
+
const front = `M${p(-6, 64)} Q${p(-6, 52)} ${p(6, 52)} L${p(184, 52)} Q${p(196, 52)} ${p(196, 64)} L${p(190, 198)} L${p(0, 198)} Z`;
|
|
101
|
+
const paper = (dx, dy, rot) => el("rect", { x: r2(x + dx * s), y: r2(y + dy * s), width: r2(96 * s), height: r2(120 * s), rx: 8, fill: tokens.color.white, transform: `rotate(${rot} ${r2(x + (dx + 48) * s)} ${r2(y + (dy + 60) * s)})` });
|
|
102
|
+
return drawn([
|
|
103
|
+
...shadowed(el("path", { d: back, fill: tokens.brand.light.border })),
|
|
104
|
+
paper(24, -8, -8),
|
|
105
|
+
paper(66, -16, 6),
|
|
106
|
+
el("path", { d: front, fill: tokens.color.white }),
|
|
107
|
+
]);
|
|
108
|
+
});
|
|
109
|
+
/** A closed book seen from the front: back page, front cover, spine and page edges. */
|
|
110
|
+
export const book = definePiece("book", { x: pos(), y: pos(), width: size(false, 30), height: size(false, 30) }, ({ x, y, width: w = 120, height: h = 200 }) => drawn([
|
|
111
|
+
// The back page stays white; no ink shape behind or offset from the front cover (it read as the old shadow, ADR 0009).
|
|
112
|
+
el("rect", { x: x + 14, y: y + 10, width: w - 2, height: h, rx: 8, fill: tokens.color.white }),
|
|
113
|
+
el("rect", { x, y, width: w, height: h, rx: 8, fill: tokens.color.white }),
|
|
114
|
+
el("rect", { x, y, width: 20, height: h, rx: 8, fill: ink }),
|
|
115
|
+
el("path", { d: `M${x + w + 4},${y + 16} V${y + h - 6} M${x + w + 8},${y + 20} V${y + h - 2}`, "stroke-width": 2 }),
|
|
116
|
+
]));
|
|
117
|
+
/** Chunky arrow pointing right, centred vertically on y. */
|
|
118
|
+
export const blockArrow = definePiece("blockArrow", { x: pos(), y: pos(), length: size(), fill: col() }, ({ x, y, length = 50, fill = "illustration.accent" }) => {
|
|
119
|
+
const shaft = 12;
|
|
120
|
+
const head = 26;
|
|
121
|
+
const headLength = Math.min(30, length * 0.56);
|
|
122
|
+
const hx = r2(x + length - headLength);
|
|
123
|
+
return drawn([
|
|
124
|
+
el("path", { d: `M${x},${y - shaft} H${hx} V${y - head} L${x + length},${y} L${hx},${y + head} V${y + shaft} H${x} Z`, fill: colour(fill, "fill") }),
|
|
125
|
+
]);
|
|
126
|
+
});
|
|
127
|
+
/** Curved arrow (cubic Bézier) with a chevron head at `to`; solid or dashed. */
|
|
128
|
+
export const arcArrow = definePiece("arcArrow", { from: { kind: "point", required: true }, c1: { kind: "point", required: true }, c2: { kind: "point", required: true }, to: { kind: "point", required: true }, color: col(), dashed: { kind: "boolean" }, width: size() }, ({ from, c1, c2, to, color = "color.ink", dashed = false, width }) => {
|
|
129
|
+
const stroke = colour(color, "color");
|
|
130
|
+
const strokeWidth = width ?? (dashed ? 4 : 6);
|
|
131
|
+
const angle = Math.atan2(to[1] - c2[1], to[0] - c2[0]);
|
|
132
|
+
const arm = 14;
|
|
133
|
+
const spread = (40 * Math.PI) / 180;
|
|
134
|
+
const wing = (sign) => `${r2(to[0] - arm * Math.cos(angle + sign * spread))},${r2(to[1] - arm * Math.sin(angle + sign * spread))}`;
|
|
135
|
+
const line = { d: `M${from[0]},${from[1]} C${c1[0]},${c1[1]} ${c2[0]},${c2[1]} ${to[0]},${to[1]}`, fill: "none", stroke, "stroke-width": strokeWidth, "stroke-linecap": "round" };
|
|
136
|
+
if (dashed)
|
|
137
|
+
line["stroke-dasharray"] = "9 8";
|
|
138
|
+
return drawn([
|
|
139
|
+
el("path", line),
|
|
140
|
+
el("path", { d: `M${wing(1)} L${to[0]},${to[1]} L${wing(-1)}`, fill: "none", stroke, "stroke-width": strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round" }),
|
|
141
|
+
]);
|
|
142
|
+
});
|
|
143
|
+
/** A rail (track) with square nodes spread along it. */
|
|
144
|
+
export const rail = definePiece("rail", { x: pos(), y: pos(), width: size(true, 100), nodes: { kind: "array", required: true, minItems: 1, of: { kind: "color" } }, fill: col(), thickness: size() }, ({ x, y, width: w, nodes, fill = "color.white", thickness: t = 44 }) => drawn([
|
|
145
|
+
el("rect", { x, y, width: w, height: t, rx: t / 2, fill: colour(fill, "fill") }),
|
|
146
|
+
el("path", { d: `M${x + 30},${y + t / 2} H${x + w - 30}`, fill: "none", stroke: tokens.brand.light.border, "stroke-width": tokens.outline.small }),
|
|
147
|
+
...nodes.map((node, i) => el("rect", { x: r2(x + 40 + i * ((w - 100) / Math.max(1, nodes.length - 1)) - 10), y: y + t / 2 - 10, width: 20, height: 20, rx: 4, fill: colour(node, `nodes[${i}]`), "stroke-width": tokens.outline.small })),
|
|
148
|
+
]));
|
|
149
|
+
/** A road: a wide grey band along a path with white dashes in the middle. */
|
|
150
|
+
export const road = definePiece("road", { d: { kind: "string", required: true, nonEmpty: true, pattern: PATH_DATA, patternName: "SVG path data (commands, digits, signs, dots, commas, spaces)" } }, ({ d }) => drawn([
|
|
151
|
+
el("path", { d, fill: "none", stroke: tokens.illustration.road, "stroke-width": 40, "stroke-linecap": "round" }),
|
|
152
|
+
el("path", { d, fill: "none", stroke: tokens.color.white, "stroke-width": tokens.outline.block, "stroke-dasharray": "14 12" }),
|
|
153
|
+
]));
|
|
154
|
+
const PIN_SIZE = 18;
|
|
155
|
+
/** A pin standing on (x, y): a stem and a round head with a short label. `size` is the head's radius (18) and
|
|
156
|
+
* scales the head, its outline and the label together (card 190). */
|
|
157
|
+
export const milestonePin = definePiece("milestonePin", { x: pos(), y: pos(), text: label(), fill: col(), stem: size(), size: { kind: "number", min: 6, max: 48 } }, ({ x, y, text, fill = "color.white", stem = 44, size: r }) => {
|
|
158
|
+
// Without `size`, the 0.5.0 expressions exactly (no rounding), so every 0.5.0 call keeps its bytes.
|
|
159
|
+
const k = (r ?? PIN_SIZE) / PIN_SIZE;
|
|
160
|
+
const at = r === undefined ? (v) => v : r2;
|
|
161
|
+
return drawn([el("line", { x1: x, y1: y, x2: x, y2: y - stem }), el("circle", { cx: x, cy: at(y - stem - 14 * k), r: r ?? PIN_SIZE, fill: colour(fill, "fill"), "stroke-width": at(tokens.outline.small * k) })], [el("text", { x, y: at(y - stem - 7 * k), "font-size": r ?? PIN_SIZE, "font-weight": tokens.font.weightHeavy }, text)]);
|
|
162
|
+
});
|
|
163
|
+
/** Price or version tag pointing left from its tip (x, y), with a hole and an optional string. */
|
|
164
|
+
export const priceTag = definePiece("priceTag", { x: pos(), y: pos(), text: label(), width: size(), fill: col(), stringFrom: { kind: "point" } }, ({ x, y, text, width: w = 128, fill = "color.white", stringFrom }) => {
|
|
165
|
+
const h = 48;
|
|
166
|
+
const top = y - h / 2;
|
|
167
|
+
const bottom = y + h / 2;
|
|
168
|
+
const right = x + w;
|
|
169
|
+
const d = `M${x + 20},${top} L${right - 10},${top} Q${right},${top} ${right},${top + 10} L${right},${bottom - 10} Q${right},${bottom} ${right - 10},${bottom} L${x + 20},${bottom} L${x},${y} Z`;
|
|
170
|
+
const body = [];
|
|
171
|
+
if (stringFrom) {
|
|
172
|
+
body.push(el("path", { d: `M${stringFrom[0]},${stringFrom[1]} C${stringFrom[0] - 14},${r2((stringFrom[1] + y) / 2)} ${x + 2},${y + 4} ${x + 20},${y}`, fill: "none", stroke: ink, "stroke-width": tokens.outline.block }));
|
|
173
|
+
}
|
|
174
|
+
body.push(el("path", { d, fill: colour(fill, "fill") }), el("circle", { cx: x + 16, cy: y, r: 5, fill: ink, stroke: "none" }));
|
|
175
|
+
return drawn(body, [el("text", { x: r2(x + 20 + (w - 20) / 2 - 2), y: y + 8, "font-family": mono, "font-size": 22 }, text)]);
|
|
176
|
+
});
|
|
177
|
+
/** A name tag hanging on a string from (hangX, hangY), showing one EIP icon. */
|
|
178
|
+
export const nameTag = definePiece("nameTag", { hangX: pos(), hangY: pos(), cx: pos(), top: pos(), rotate: { kind: "number" }, icon: { kind: "enum", required: true, values: EIP_ICON_NAMES }, fill: col() }, ({ hangX: sx, hangY: sy, cx, top, rotate = 0, icon, fill = "color.white" }) => {
|
|
179
|
+
const w = 96;
|
|
180
|
+
const h = 92;
|
|
181
|
+
const x = cx - w / 2;
|
|
182
|
+
const d = `M${x},${top + 14} L${x + 18},${top} H${x + w - 18} L${x + w},${top + 14} V${top + h - 6} Q${x + w},${top + h} ${x + w - 6},${top + h} H${x + 6} Q${x},${top + h} ${x},${top + h - 6} Z`;
|
|
183
|
+
return drawn([
|
|
184
|
+
el("path", { d: `M${sx},${sy} C${sx - 13},${sy + 28} ${sx + 6},${sy + 36} ${cx},${top + 20}`, fill: "none", "stroke-width": tokens.outline.small }),
|
|
185
|
+
g({ transform: `rotate(${rotate} ${cx} ${top + 20})` }, el("path", { d, fill: colour(fill, "fill") }), el("circle", { cx, cy: top + 14, r: 5, fill: tokens.color.white, "stroke-width": tokens.outline.small }), ...eipIcon({ name: icon, x: cx - 38, y: top + 27, scale: 1.18 }).body),
|
|
186
|
+
]);
|
|
187
|
+
});
|
|
188
|
+
/** Green round badge with a tick. */
|
|
189
|
+
export const checkBadge = definePiece("checkBadge", { cx: pos(), cy: pos(), r: size() }, ({ cx, cy, r = 16 }) => drawn([
|
|
190
|
+
el("circle", { cx, cy, r, fill: tokens.color.state.healthy, "stroke-width": tokens.outline.small }),
|
|
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" }),
|
|
192
|
+
]));
|
|
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. */
|
|
194
|
+
export const robot = definePiece("robot", { cx: pos(), top: pos() }, ({ cx, top }) => {
|
|
195
|
+
const w = 160;
|
|
196
|
+
const h = 152;
|
|
197
|
+
const x = cx - w / 2;
|
|
198
|
+
return drawn([
|
|
199
|
+
el("line", { x1: cx, y1: top, x2: cx, y2: top - 28 }),
|
|
200
|
+
el("circle", { cx, cy: top - 34, r: 10, fill: tokens.brand.light.accent }),
|
|
201
|
+
el("rect", { x: x - 16, y: top + 44, width: 20, height: 52, rx: 6, fill: tokens.color.white }),
|
|
202
|
+
el("rect", { x: x + w - 4, y: top + 44, width: 20, height: 52, rx: 6, fill: tokens.color.white }),
|
|
203
|
+
el("rect", { x, y: top, width: w, height: h, rx: 22, fill: tokens.color.white }),
|
|
204
|
+
el("rect", { x: x + 22, y: top + 22, width: w - 44, height: 72, rx: 14, fill: tokens.brand.light.text }),
|
|
205
|
+
...[-23, 23].map((dx) => el("rect", { x: r2(cx + dx - 6.4), y: top + 43, width: 12.8, height: 30, rx: 6.4, fill: tokens.cast.eyes, stroke: "none" })),
|
|
206
|
+
g({ stroke: "none", fill: tokens.brand.light.border }, el("rect", { x: x + 44, y: top + 114, width: 72, height: 9, rx: 4.5 })),
|
|
207
|
+
]);
|
|
208
|
+
});
|
|
209
|
+
/** Magnifier: lens centred on (cx, cy), handle to the bottom right. */
|
|
210
|
+
export const magnifier = definePiece("magnifier", { cx: pos(), cy: pos(), r: size(false, 12), color: col() }, ({ cx, cy, r = 50, color = "illustration.accent" }) => {
|
|
211
|
+
const c = colour(color, "color");
|
|
212
|
+
const hx = r2(cx + r * 0.88);
|
|
213
|
+
const hy = r2(cy + r * 0.74);
|
|
214
|
+
return drawn([
|
|
215
|
+
el("line", { x1: hx, y1: hy, x2: hx + 38, y2: hy + 42, "stroke-width": 24, "stroke-linecap": "round" }),
|
|
216
|
+
el("line", { x1: hx, y1: hy, x2: hx + 38, y2: hy + 42, stroke: c, "stroke-width": 15, "stroke-linecap": "round" }),
|
|
217
|
+
el("circle", { cx, cy, r, fill: tokens.color.white, "fill-opacity": 0.18, stroke: c, "stroke-width": 12 }),
|
|
218
|
+
el("circle", { cx, cy, r: r + 6, fill: "none" }),
|
|
219
|
+
el("circle", { cx, cy, r: r - 6, fill: "none" }),
|
|
220
|
+
]);
|
|
221
|
+
});
|
|
222
|
+
/** Stack of server units; the `failing` unit (0-based) shows a red light. */
|
|
223
|
+
export const serverStack = definePiece("serverStack", { x: pos(), y: pos(), width: size(), units: count(1, 20), fill: col(), failing: count(0, 19) }, ({ x, y, width: w = 150, units = 3, fill = "color.white", failing }) => {
|
|
224
|
+
const uh = 40;
|
|
225
|
+
const gap = 10;
|
|
226
|
+
return drawn(Array.from({ length: units }, (_, i) => {
|
|
227
|
+
const uy = y + i * (uh + gap);
|
|
228
|
+
return [
|
|
229
|
+
...shadowed(el("rect", { x, y: uy, width: w, height: uh, rx: 8, fill: colour(fill, "fill") })),
|
|
230
|
+
el("rect", { x: x + 16, y: uy + 15, width: r2(w * 0.5), height: 10, rx: 5, fill: tokens.illustration.textBar, stroke: "none" }),
|
|
231
|
+
el("circle", { cx: x + w - 24, cy: uy + 20, r: 6, fill: i === failing ? tokens.color.state.failure : tokens.color.white, "stroke-width": tokens.outline.small }),
|
|
232
|
+
];
|
|
233
|
+
}).flat());
|
|
234
|
+
});
|
|
235
|
+
export const cloud = definePiece("cloud", { cx: pos(), cy: pos(), scale: size(), fill: col() }, ({ cx, cy, scale: s = 1, fill = "color.white" }) => {
|
|
236
|
+
const p = (dx, dy) => `${r2(cx + dx * s)},${r2(cy + dy * s)}`;
|
|
237
|
+
const d = `M${p(-70, 30)} Q${p(-96, 30)} ${p(-94, 4)} Q${p(-90, -20)} ${p(-62, -18)} Q${p(-52, -58)} ${p(-10, -54)} Q${p(26, -52)} ${p(36, -24)} Q${p(86, -30)} ${p(90, 6)} Q${p(92, 30)} ${p(66, 30)} Z`;
|
|
238
|
+
return drawn([el("path", { d, fill: colour(fill, "fill") })]);
|
|
239
|
+
});
|
|
240
|
+
/** Gear with square teeth and a hub, as on the maven-release cover. */
|
|
241
|
+
export const gear = definePiece("gear", { cx: pos(), cy: pos(), r: size(), teeth: count(4, 64), fill: col() }, ({ cx, cy, r = 84, teeth = 12, fill = "color.white" }) => {
|
|
242
|
+
const root = r * 0.78;
|
|
243
|
+
const points = [];
|
|
244
|
+
const step = (2 * Math.PI) / teeth;
|
|
245
|
+
const at = (radius, angle) => `${r2(cx + radius * Math.cos(angle))},${r2(cy + radius * Math.sin(angle))}`;
|
|
246
|
+
for (let i = 0; i < teeth; i++) {
|
|
247
|
+
const a = i * step;
|
|
248
|
+
points.push(at(root, a - step * 0.3), at(r, a - step * 0.18), at(r, a + step * 0.18), at(root, a + step * 0.3));
|
|
249
|
+
}
|
|
250
|
+
return drawn([...shadowed(el("polygon", { points: points.join(" "), fill: colour(fill, "fill") })), el("circle", { cx, cy, r: r2(r * 0.36), fill: tokens.brand.light.bg })]);
|
|
251
|
+
});
|
|
252
|
+
/** Parcel (box) with a lid line and a tape strip. */
|
|
253
|
+
export const parcel = definePiece("parcel", { x: pos(), y: pos(), size: size(), fill: col() }, ({ x, y, size: s = 96, fill = "color.white" }) => drawn([
|
|
254
|
+
...shadowed(el("rect", { x, y, width: s, height: r2(s * 0.8), rx: 6, fill: colour(fill, "fill") })),
|
|
255
|
+
el("path", { d: `M${x},${r2(y + s * 0.3)} H${x + s}`, fill: "none", "stroke-width": tokens.outline.small }),
|
|
256
|
+
el("rect", { x: x + s / 2 - 12, y, width: 24, height: r2(s * 0.8), fill: tokens.illustration.tape, "stroke-width": tokens.outline.small }),
|
|
257
|
+
]));
|
|
258
|
+
/** Steps climbing to the right from the bottom-left corner (x, y), as on the obsidian-to-site guide cover. */
|
|
259
|
+
export const steps = definePiece("steps", { x: pos(), y: pos(), count: count(1, 20), width: size(), rise: size(), fill: col() }, ({ x, y, count = 4, width: w = 145, rise = 40, fill = "color.white" }) => {
|
|
260
|
+
const blocks = Array.from({ length: count }, (_, i) => el("rect", { x: x + i * w, y: y - rise * (i + 1), width: w, height: rise * (i + 1), rx: 10, fill: colour(fill, "fill") }));
|
|
261
|
+
return drawn(blocks);
|
|
262
|
+
});
|
|
263
|
+
const muleGlyph = (kind, cx, cy) => {
|
|
264
|
+
const line = { fill: "none", "stroke-linecap": "round" };
|
|
265
|
+
if (kind === "scatter-gather")
|
|
266
|
+
return [el("path", { ...line, d: `M${cx - 25},${cy - 20} V${cy + 20} M${cx + 25},${cy - 20} V${cy + 20} M${cx - 17},${cy - 12} H${cx + 17} M${cx - 17},${cy} H${cx + 17} M${cx - 17},${cy + 12} H${cx + 17}` })];
|
|
267
|
+
if (kind === "choice")
|
|
268
|
+
return [el("path", { ...line, d: `M${cx - 27},${cy} H${cx - 17} M${cx - 3},${cy - 14} L${cx + 11},${cy} L${cx - 3},${cy + 14} L${cx - 17},${cy} Z M${cx + 11},${cy} L${cx + 27},${cy - 14} M${cx + 11},${cy} L${cx + 27},${cy + 14}` })];
|
|
269
|
+
return [
|
|
270
|
+
el("path", { ...line, d: `M${r2(cx + 18.2)},${r2(cy - 10.5)} A21,21 0 1 1 ${r2(cx - 14.8)},${r2(cy - 14.8)}` }),
|
|
271
|
+
el("path", { d: `M${r2(cx - 8.5)},${r2(cy - 21.2)} L${r2(cx - 9.9)},${r2(cy - 9.9)} L${r2(cx - 19.8)},${r2(cy - 19.8)} Z`, fill: ink, "stroke-width": 2 }),
|
|
272
|
+
el("rect", { x: cx - 8, y: cy - 8, width: 16, height: 16, fill: tokens.color.white, "stroke-width": tokens.outline.small }),
|
|
273
|
+
];
|
|
274
|
+
};
|
|
275
|
+
/** A Mule flow: a bar with processor tiles linked left to right, each with its glyph. */
|
|
276
|
+
export const muleFlow = definePiece("muleFlow", {
|
|
277
|
+
x: pos(),
|
|
278
|
+
y: pos(),
|
|
279
|
+
width: size(true, 120),
|
|
280
|
+
height: size(false, 40),
|
|
281
|
+
tiles: { kind: "array", required: true, minItems: 1, of: { kind: "object", fields: { x: pos(), kind: { kind: "enum", required: true, values: ["scatter-gather", "choice", "for-each"] } } } },
|
|
282
|
+
tileWidth: size(false, 40),
|
|
283
|
+
fill: col(),
|
|
284
|
+
}, ({ x, y, width: w, height: h = 104, tiles, tileWidth = 86, fill = "brand.light.bg" }) => {
|
|
285
|
+
const cy = y + h / 2;
|
|
286
|
+
const links = [`M${x + 18},${cy} H${tiles[0].x - 6}`];
|
|
287
|
+
const heads = [];
|
|
288
|
+
tiles.forEach((tile, i) => {
|
|
289
|
+
const end = i + 1 < tiles.length ? tiles[i + 1].x - 6 : x + w - 16;
|
|
290
|
+
links.push(`M${tile.x + tileWidth},${cy} H${end}`);
|
|
291
|
+
heads.push(el("path", { d: `M${end - 8},${cy - 7} L${end + 1},${cy} L${end - 8},${cy + 7} Z`, fill: ink, "stroke-width": 2 }));
|
|
292
|
+
});
|
|
293
|
+
return drawn([
|
|
294
|
+
...shadowed(el("rect", { x, y, width: w, height: h, rx: 22, fill: colour(fill, "fill") })),
|
|
295
|
+
el("path", { d: links.join(" "), "stroke-linecap": "round" }),
|
|
296
|
+
...heads,
|
|
297
|
+
...tiles.map((tile) => el("rect", { x: tile.x, y: y + 14, width: tileWidth, height: h - 28, rx: 14, fill: tokens.color.white })),
|
|
298
|
+
...tiles.flatMap((tile) => muleGlyph(tile.kind, tile.x + tileWidth / 2, cy)),
|
|
299
|
+
]);
|
|
300
|
+
});
|
|
301
|
+
/** One of the 27 EIP icons (64x40), placed at (x, y) and scaled; the cover's outline does not leak in. */
|
|
302
|
+
export const eipIcon = definePiece("eipIcon", { name: { kind: "enum", required: true, values: EIP_ICON_NAMES }, x: pos(), y: pos(), scale: size() }, ({ name, x, y, scale = 1 }) => {
|
|
303
|
+
const icon = EIP_ICONS.find((candidate) => candidate.name === name);
|
|
304
|
+
return drawn([g({ transform: `translate(${x} ${y}) scale(${scale})`, stroke: "none" }, ...icon.nodes)]);
|
|
305
|
+
});
|
|
306
|
+
/** Every piece, by name, in catalogue order (spec illustration-pieces, "Piece catalogue"). */
|
|
307
|
+
export const PIECES = {
|
|
308
|
+
pill,
|
|
309
|
+
rings,
|
|
310
|
+
sheet,
|
|
311
|
+
blockArrow,
|
|
312
|
+
arcArrow,
|
|
313
|
+
rail,
|
|
314
|
+
checkBadge,
|
|
315
|
+
priceTag,
|
|
316
|
+
nameTag,
|
|
317
|
+
codePanel,
|
|
318
|
+
serverStack,
|
|
319
|
+
cloud,
|
|
320
|
+
stamp,
|
|
321
|
+
robot,
|
|
322
|
+
magnifier,
|
|
323
|
+
gear,
|
|
324
|
+
parcel,
|
|
325
|
+
road,
|
|
326
|
+
milestonePin,
|
|
327
|
+
browserWindow,
|
|
328
|
+
speechBubble,
|
|
329
|
+
steps,
|
|
330
|
+
folder,
|
|
331
|
+
book,
|
|
332
|
+
muleFlow,
|
|
333
|
+
eipIcon,
|
|
334
|
+
...METRO_PIECES,
|
|
335
|
+
uiIcon,
|
|
336
|
+
linkIcon,
|
|
337
|
+
...DIAGRAM_PIECES,
|
|
338
|
+
stateStart,
|
|
339
|
+
emote,
|
|
340
|
+
mira,
|
|
341
|
+
visor,
|
|
342
|
+
drone,
|
|
343
|
+
kiu,
|
|
344
|
+
sinal,
|
|
345
|
+
bankObject,
|
|
346
|
+
symbol,
|
|
347
|
+
brandNotationIcon,
|
|
348
|
+
categoryIcon,
|
|
349
|
+
headline,
|
|
350
|
+
questionToken,
|
|
351
|
+
balao,
|
|
352
|
+
chaves,
|
|
353
|
+
keyboard,
|
|
354
|
+
};
|
|
355
|
+
export const PIECE_NAMES = Object.keys(PIECES);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type SvgNode } from "./node.ts";
|
|
2
|
+
import { type SurfaceName } from "./metro.ts";
|
|
3
|
+
export type LinkIcon = {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly title: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
/** The face colour of the site's 0.6 sticker, a colour token path; since 0.7.0 `linkIcon` draws every face white. */
|
|
8
|
+
readonly face: string;
|
|
9
|
+
readonly glyph: readonly SvgNode[];
|
|
10
|
+
};
|
|
11
|
+
/** Every link icon draws in a 46x46 box. */
|
|
12
|
+
export declare const LINK_ICON_SIZE = 46;
|
|
13
|
+
export declare const LINK_ICONS: readonly LinkIcon[];
|
|
14
|
+
export declare const LINK_ICON_NAMES: string[];
|
|
15
|
+
export type LinkIconParams = {
|
|
16
|
+
icon: string;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
size?: number;
|
|
20
|
+
surface?: SurfaceName;
|
|
21
|
+
};
|
|
22
|
+
/** One link sticker at (x, y), `size` wide (46 by default), on the light or the dark page. */
|
|
23
|
+
export declare const linkIcon: import("./piece.ts").Piece<LinkIconParams>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Link icons as data (spec illustration-pieces, "Link icons as data"; design §6
|
|
2
|
+
// of stackledger-map-and-link-pieces): the social stickers of brunosouzas.com
|
|
3
|
+
// (public/images/home/social-*.svg at e29b3dd), with every colour replaced by
|
|
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), 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
|
|
11
|
+
// face white with its outline and no frame behind it (ADR 0009: no hard shadow,
|
|
12
|
+
// colour only where it means something), then the glyph, at the site's measures
|
|
13
|
+
// (46 box, face 38 at 2, radius 9, outline 2.5). On the dark surface the face's
|
|
14
|
+
// outline is surface.dark.muted; the glyph, inside the white face, stays ink.
|
|
15
|
+
//
|
|
16
|
+
// Credit: the GitHub mark is Font Awesome's (fontawesome.com), licensed
|
|
17
|
+
// CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); its description
|
|
18
|
+
// keeps the credit.
|
|
19
|
+
//
|
|
20
|
+
// What can go wrong: an unknown icon is rejected by the schema. No node holds
|
|
21
|
+
// a link, a style, a script or a URL, so the output can ship as a static file.
|
|
22
|
+
import { tokens } from "../../tokens/generated/tokens.js";
|
|
23
|
+
import { drawn, el, g, r2 } from "./node.js";
|
|
24
|
+
import { pos, size } from "./params.js";
|
|
25
|
+
import { definePiece } from "./piece.js";
|
|
26
|
+
import { SURFACES } from "./metro.js";
|
|
27
|
+
import { symbolShapes } from "./symbol.js";
|
|
28
|
+
const C = tokens.color;
|
|
29
|
+
const INK = C.ink;
|
|
30
|
+
/** Every link icon draws in a 46x46 box. */
|
|
31
|
+
export const LINK_ICON_SIZE = 46;
|
|
32
|
+
export const LINK_ICONS = [
|
|
33
|
+
{
|
|
34
|
+
name: "github",
|
|
35
|
+
title: "GitHub",
|
|
36
|
+
description: "GitHub icon. The GitHub mark is from Font Awesome (fontawesome.com), CC BY 4.0.",
|
|
37
|
+
face: "color.white",
|
|
38
|
+
glyph: [g({ transform: "translate(9.5 9) scale(0.0455)" }, el("path", { d: "M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z", fill: INK, stroke: "none" }))],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "linkedin",
|
|
42
|
+
title: "LinkedIn",
|
|
43
|
+
description: "LinkedIn icon.",
|
|
44
|
+
face: "color.state.caller",
|
|
45
|
+
glyph: [
|
|
46
|
+
el("rect", { x: 12, y: 18.5, width: 4, height: 11.5, rx: 1, fill: INK, stroke: "none" }),
|
|
47
|
+
el("circle", { cx: 14, cy: 13.8, r: 2.4, fill: INK, stroke: "none" }),
|
|
48
|
+
el("path", { d: "M19.5,30 V18.5 H23.5 V20.3 C24.5,19 26.2,18.1 28,18.1 C31.2,18.1 32.5,20.2 32.5,23.6 V30 H28.5 V24.3 C28.5,22.7 27.8,21.9 26.6,21.9 C25.2,21.9 23.5,22.8 23.5,24.7 V30 Z", fill: INK, stroke: "none" }),
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "email",
|
|
53
|
+
title: "Email",
|
|
54
|
+
description: "Email icon.",
|
|
55
|
+
face: "color.state.transitional",
|
|
56
|
+
glyph: [
|
|
57
|
+
el("rect", { x: 9, y: 13, width: 24, height: 17, rx: 3, fill: C.white, stroke: INK, "stroke-width": 2.5 }),
|
|
58
|
+
el("path", { d: "M10,15 L21,23 L32,15", fill: "none", stroke: INK, "stroke-width": 2.5, "stroke-linejoin": "round" }),
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "website",
|
|
63
|
+
title: "Website",
|
|
64
|
+
description: "Website icon: a globe.",
|
|
65
|
+
face: "color.state.healthy",
|
|
66
|
+
glyph: [
|
|
67
|
+
el("circle", { cx: 21, cy: 21, r: 10.5, fill: C.white, stroke: INK, "stroke-width": 2.5 }),
|
|
68
|
+
el("ellipse", { cx: 21, cy: 21, rx: 4.6, ry: 10.5, fill: "none", stroke: INK, "stroke-width": 2 }),
|
|
69
|
+
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" }),
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "stackledger",
|
|
74
|
+
title: "stackledger",
|
|
75
|
+
description: "stackledger icon: the product's mark, a bent line through two stations.",
|
|
76
|
+
face: "color.white",
|
|
77
|
+
// 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
|
|
78
|
+
// station takes the family's outline (2.5) and the small one keeps the mark's ratio (1.6 / 2 x 2.5).
|
|
79
|
+
glyph: [
|
|
80
|
+
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" }),
|
|
81
|
+
el("circle", { cx: 18.6, cy: 21, r: 4.75, fill: C.white, stroke: INK, "stroke-width": 2.5 }),
|
|
82
|
+
el("circle", { cx: 31.7, cy: 21, r: 3.1, fill: C.white, stroke: INK, "stroke-width": 2 }),
|
|
83
|
+
],
|
|
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
|
+
},
|
|
94
|
+
];
|
|
95
|
+
export const LINK_ICON_NAMES = LINK_ICONS.map((icon) => icon.name);
|
|
96
|
+
/** One link sticker at (x, y), `size` wide (46 by default), on the light or the dark page. */
|
|
97
|
+
export const linkIcon = definePiece("linkIcon", { icon: { kind: "enum", required: true, values: LINK_ICON_NAMES }, x: pos(), y: pos(), size: size(), surface: { kind: "enum", values: SURFACES } }, ({ icon, x, y, size: side = LINK_ICON_SIZE, surface = "light" }) => {
|
|
98
|
+
const data = LINK_ICONS.find((candidate) => candidate.name === icon);
|
|
99
|
+
const face = el("rect", { x: 2, y: 2, width: 38, height: 38, rx: 9, fill: C.white, stroke: surface === "dark" ? tokens.surface.dark.muted : INK, "stroke-width": 2.5 });
|
|
100
|
+
return drawn([g({ transform: `translate(${r2(x)} ${r2(y)}) scale(${side / LINK_ICON_SIZE})`, stroke: "none" }, face, ...data.glyph)]);
|
|
101
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type Ink, type Point, type SurfaceName } from "./ink.ts";
|
|
2
|
+
export { SURFACES, type Ink, type SurfaceName } from "./ink.ts";
|
|
3
|
+
export type LineBadgeParams = Ink & {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
text?: string;
|
|
7
|
+
fill: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
flat?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** A line's terminal badge: a pill in the line colour with its code in white, centred on (x, y); without `text`, the pill alone. */
|
|
13
|
+
export declare const lineBadge: import("./piece.ts").Piece<LineBadgeParams>;
|
|
14
|
+
export type StationMarkerParams = Ink & {
|
|
15
|
+
cx: number;
|
|
16
|
+
cy: number;
|
|
17
|
+
to?: Point;
|
|
18
|
+
r?: number;
|
|
19
|
+
state?: "normal" | "deprecated";
|
|
20
|
+
};
|
|
21
|
+
/** A stop (disc), or with `to` an interchange (capsule from the centre to `to`); deprecated is muted. */
|
|
22
|
+
export declare const stationMarker: import("./piece.ts").Piece<StationMarkerParams>;
|
|
23
|
+
export type PipeParams = {
|
|
24
|
+
d: string;
|
|
25
|
+
fill: string;
|
|
26
|
+
width?: number;
|
|
27
|
+
casing?: number;
|
|
28
|
+
};
|
|
29
|
+
/** A line: its colour over an ink casing, round caps and joins, no shadow. */
|
|
30
|
+
export declare const pipe: import("./piece.ts").Piece<PipeParams>;
|
|
31
|
+
export type CountBadgeParams = Ink & {
|
|
32
|
+
cx: number;
|
|
33
|
+
cy: number;
|
|
34
|
+
text: string;
|
|
35
|
+
width?: number;
|
|
36
|
+
height?: number;
|
|
37
|
+
textSize?: number;
|
|
38
|
+
};
|
|
39
|
+
/** A count (rules of a skill): a circle when as wide as high, a pill otherwise, in the surface's panel colour. */
|
|
40
|
+
export declare const countBadge: import("./piece.ts").Piece<CountBadgeParams>;
|
|
41
|
+
export type NodeParams = Ink & {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height?: number;
|
|
46
|
+
title: string;
|
|
47
|
+
subtitle?: string;
|
|
48
|
+
state?: "normal" | "focus" | "placeholder";
|
|
49
|
+
};
|
|
50
|
+
export type NodeBlockParams = NodeParams & {
|
|
51
|
+
radius?: number;
|
|
52
|
+
};
|
|
53
|
+
/** A diagram box (a skill, a software item): rounded rect with a title and an optional subtitle. */
|
|
54
|
+
export declare const nodeBlock: import("./piece.ts").Piece<NodeBlockParams>;
|
|
55
|
+
/** A diagram pill (a playbook). */
|
|
56
|
+
export declare const pillNode: import("./piece.ts").Piece<NodeParams>;
|
|
57
|
+
/** A diagram hexagon (an agent). */
|
|
58
|
+
export declare const hexNode: import("./piece.ts").Piece<NodeParams>;
|
|
59
|
+
export type ArrowKind = "message" | "reply" | "failure" | "failFast";
|
|
60
|
+
export type ArrowHeads = "end" | "start" | "both";
|
|
61
|
+
export type MessageArrowParams = {
|
|
62
|
+
from: Point;
|
|
63
|
+
to: Point;
|
|
64
|
+
curve?: "bezier" | "straight";
|
|
65
|
+
controls?: [Point, Point];
|
|
66
|
+
head?: boolean;
|
|
67
|
+
heads?: ArrowHeads;
|
|
68
|
+
dashed?: boolean;
|
|
69
|
+
label?: string;
|
|
70
|
+
width?: number;
|
|
71
|
+
kind?: ArrowKind;
|
|
72
|
+
surface?: SurfaceName;
|
|
73
|
+
};
|
|
74
|
+
/** An edge with a head at `to`: curved (leaves and enters horizontally), straight, or through the caller's two
|
|
75
|
+
* control points, with an optional label. `kind` paints a reply, a failure or a fail-fast path (card 141). */
|
|
76
|
+
export declare const messageArrow: import("./piece.ts").Piece<MessageArrowParams>;
|
|
77
|
+
export type LedgerMarkParams = {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
size?: number;
|
|
81
|
+
line?: string;
|
|
82
|
+
surface?: SurfaceName;
|
|
83
|
+
};
|
|
84
|
+
/** stackledger's mark (favicon, header), the "Folha" of card 303: a white page with one outline, a bent line and
|
|
85
|
+
* two stations, 32 units scaled to `size`. The outline is ink on the light surface and surface.dark.muted on the dark
|
|
86
|
+
* one, so the page keeps one outline that reads on either background (ADR 0009); the stations sit on the white page
|
|
87
|
+
* and stay ink. */
|
|
88
|
+
export declare const ledgerMark: import("./piece.ts").Piece<LedgerMarkParams>;
|
|
89
|
+
export type RenewalRingParams = Ink & {
|
|
90
|
+
cx: number;
|
|
91
|
+
cy: number;
|
|
92
|
+
r: number;
|
|
93
|
+
width?: number;
|
|
94
|
+
};
|
|
95
|
+
/** The renewal ring: bands like a bent pipe round a station (a rim when the surface has one, the ink line, then
|
|
96
|
+
* color.state.blocked), no shadow. */
|
|
97
|
+
export declare const renewalRing: import("./piece.ts").Piece<RenewalRingParams>;
|
|
98
|
+
export type SuggestedHaloParams = {
|
|
99
|
+
cx: number;
|
|
100
|
+
cy: number;
|
|
101
|
+
r: number;
|
|
102
|
+
surface?: SurfaceName;
|
|
103
|
+
};
|
|
104
|
+
/** The suggested-position halo: a dashed muted circle, no ink. */
|
|
105
|
+
export declare const suggestedHalo: import("./piece.ts").Piece<SuggestedHaloParams>;
|
|
106
|
+
export type LicenceMarkParams = Ink & {
|
|
107
|
+
cx: number;
|
|
108
|
+
cy: number;
|
|
109
|
+
state?: "owned" | "toBuy";
|
|
110
|
+
size?: number;
|
|
111
|
+
};
|
|
112
|
+
/** A licence: a small disc sticker, green when held, white to buy. Its own room rule: size ≥ 3 × outline. */
|
|
113
|
+
export declare const licenceMark: import("./piece.ts").Piece<LicenceMarkParams>;
|
|
114
|
+
export type ZoneParams = {
|
|
115
|
+
points: Point[];
|
|
116
|
+
fill: string;
|
|
117
|
+
title?: string;
|
|
118
|
+
titleAt?: Point;
|
|
119
|
+
surface?: SurfaceName;
|
|
120
|
+
};
|
|
121
|
+
/** A zone: the outline the caller gives (stackledger's hull), widened by a round stroke, at the surface's zone opacity; an optional title. */
|
|
122
|
+
export declare const zone: import("./piece.ts").Piece<ZoneParams>;
|
|
123
|
+
export declare const METRO_PIECES: {
|
|
124
|
+
readonly lineBadge: import("./piece.ts").Piece<LineBadgeParams>;
|
|
125
|
+
readonly stationMarker: import("./piece.ts").Piece<StationMarkerParams>;
|
|
126
|
+
readonly pipe: import("./piece.ts").Piece<PipeParams>;
|
|
127
|
+
readonly countBadge: import("./piece.ts").Piece<CountBadgeParams>;
|
|
128
|
+
readonly nodeBlock: import("./piece.ts").Piece<NodeBlockParams>;
|
|
129
|
+
readonly pillNode: import("./piece.ts").Piece<NodeParams>;
|
|
130
|
+
readonly hexNode: import("./piece.ts").Piece<NodeParams>;
|
|
131
|
+
readonly messageArrow: import("./piece.ts").Piece<MessageArrowParams>;
|
|
132
|
+
readonly ledgerMark: import("./piece.ts").Piece<LedgerMarkParams>;
|
|
133
|
+
readonly renewalRing: import("./piece.ts").Piece<RenewalRingParams>;
|
|
134
|
+
readonly suggestedHalo: import("./piece.ts").Piece<SuggestedHaloParams>;
|
|
135
|
+
readonly licenceMark: import("./piece.ts").Piece<LicenceMarkParams>;
|
|
136
|
+
readonly zone: import("./piece.ts").Piece<ZoneParams>;
|
|
137
|
+
};
|