@principal-ai/logo-component 0.1.22 → 0.1.24
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/dist/FileCityBotAvatar.d.ts +31 -0
- package/dist/FileCityBotAvatar.js +161 -0
- package/dist/FileCityLogo.d.ts +35 -1
- package/dist/FileCityLogo.js +39 -6
- package/dist/FileCityLogoAnimated.d.ts +13 -0
- package/dist/FileCityLogoAnimated.js +235 -5
- package/dist/TrailCityBanner.d.ts +53 -0
- package/dist/TrailCityBanner.js +389 -0
- package/dist/TrailCityProgress.d.ts +36 -0
- package/dist/TrailCityProgress.js +156 -0
- package/dist/TrailMarketingBanner.d.ts +36 -0
- package/dist/TrailMarketingBanner.js +494 -0
- package/dist/botAvatarLayout.d.ts +205 -0
- package/dist/botAvatarLayout.js +353 -0
- package/dist/esm/FileCityBotAvatar.js +124 -0
- package/dist/esm/FileCityLogo.js +39 -6
- package/dist/esm/FileCityLogoAnimated.js +235 -5
- package/dist/esm/TrailCityBanner.js +353 -0
- package/dist/esm/TrailCityProgress.js +120 -0
- package/dist/esm/TrailMarketingBanner.js +458 -0
- package/dist/esm/botAvatarLayout.js +348 -0
- package/dist/esm/index.js +5 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +5 -0
- package/dist/index.js +13 -1
- package/package.json +4 -3
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useId } from 'react';
|
|
3
|
+
const SIZES = {
|
|
4
|
+
linkedinProfile: { w: 1584, h: 396 },
|
|
5
|
+
twitterHeader: { w: 1500, h: 500 },
|
|
6
|
+
linkedinCompany: { w: 1128, h: 191 },
|
|
7
|
+
};
|
|
8
|
+
// OG card palette (iceTangerineDark, baked) — matches the web-ade card.
|
|
9
|
+
const OG = {
|
|
10
|
+
text: '#d0e5ea',
|
|
11
|
+
textTertiary: '#7ba8bc',
|
|
12
|
+
background: '#0d274d',
|
|
13
|
+
backgroundSecondary: '#0f2e58',
|
|
14
|
+
surface: '#0f2e58',
|
|
15
|
+
primary: '#ff6b35',
|
|
16
|
+
accent: '#0893d2',
|
|
17
|
+
border: '#1e3a5f',
|
|
18
|
+
headerBand: '#2c3554',
|
|
19
|
+
};
|
|
20
|
+
// Pre-blended city tints over the navy bg (from the OG card).
|
|
21
|
+
const CITY_PALETTE = ['#393349', '#5a3d45', '#1d365a', '#284263', '#385170'];
|
|
22
|
+
// Trail line color — matches FileCityLogoAnimated's connector (light grey).
|
|
23
|
+
const TRAIL_LINE = '#e5e7eb';
|
|
24
|
+
// Frame.io brand: lowercase "frame.io" wordmark set in Kumbh Sans (same color
|
|
25
|
+
// as the body text).
|
|
26
|
+
const FRAME_IO_FONT = "'Kumbh Sans', Inter, -apple-system, sans-serif";
|
|
27
|
+
// File City geometry — panel-space px (its own 540×540 coordinate system).
|
|
28
|
+
const CITY = 540;
|
|
29
|
+
const CELL = 42;
|
|
30
|
+
const OFFSET = 18;
|
|
31
|
+
const COLS = 12;
|
|
32
|
+
const ROWS = 12;
|
|
33
|
+
const SQUARE = CELL - 8;
|
|
34
|
+
// Glyphs from FileCityLogo: 1 = mark square, 2 = hole, 0 = city file.
|
|
35
|
+
const GLYPHS = {
|
|
36
|
+
P: [
|
|
37
|
+
[1, 1, 1],
|
|
38
|
+
[1, 2, 1],
|
|
39
|
+
[1, 1, 1],
|
|
40
|
+
[1, 0, 0],
|
|
41
|
+
[1, 0, 0],
|
|
42
|
+
],
|
|
43
|
+
A: [
|
|
44
|
+
[0, 1, 1, 0],
|
|
45
|
+
[1, 2, 2, 1],
|
|
46
|
+
[1, 1, 1, 1],
|
|
47
|
+
[1, 0, 0, 1],
|
|
48
|
+
[1, 0, 0, 1],
|
|
49
|
+
],
|
|
50
|
+
I: [
|
|
51
|
+
[1, 1, 1],
|
|
52
|
+
[0, 1, 0],
|
|
53
|
+
[0, 1, 0],
|
|
54
|
+
[0, 1, 0],
|
|
55
|
+
[1, 1, 1],
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
// Big P, scaled 2× and centered in the 12×12 panel. { glyph, scale, c0, r0 }.
|
|
59
|
+
// `mark`: 1 = primary-colored, 3 = accent-colored (kept for future letters).
|
|
60
|
+
const PLACEMENTS = [
|
|
61
|
+
{ g: GLYPHS.P, scale: 2, c0: 3, r0: 1, mark: 1 }, // cols 3–8, rows 1–10
|
|
62
|
+
];
|
|
63
|
+
/** Glyph value at a grid cell: 1 = mark, 2 = hole, 0 = city/background. */
|
|
64
|
+
function glyphAt(col, row) {
|
|
65
|
+
for (const p of PLACEMENTS) {
|
|
66
|
+
const gc = col - p.c0;
|
|
67
|
+
const gr = row - p.r0;
|
|
68
|
+
const w = p.g[0].length * p.scale;
|
|
69
|
+
const h = p.g.length * p.scale;
|
|
70
|
+
if (gc < 0 || gr < 0 || gc >= w || gr >= h)
|
|
71
|
+
continue;
|
|
72
|
+
const v = p.g[Math.floor(gr / p.scale)][Math.floor(gc / p.scale)];
|
|
73
|
+
if (v === 1)
|
|
74
|
+
return p.mark; // 1 (primary) or 3 (accent)
|
|
75
|
+
if (v === 2)
|
|
76
|
+
return 2; // hole
|
|
77
|
+
}
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
// Trail wraps around the OUTSIDE of the P and back under it: start on the left
|
|
81
|
+
// (one up from the bottom), up the left, across the top, down the right, then
|
|
82
|
+
// under the P along the bottom to the bottom-left corner where it meets the
|
|
83
|
+
// card. Markers sit on city cells, one out from the P's edges.
|
|
84
|
+
const MARKER_CELLS = [
|
|
85
|
+
{ col: 2, row: 10, label: '1' }, // left side, start (one up from the bottom)
|
|
86
|
+
{ col: 2, row: 0, label: '2' }, // top-left
|
|
87
|
+
{ col: 9, row: 0, label: '3' }, // top-right
|
|
88
|
+
{ col: 9, row: 11, label: '4' }, // bottom-right
|
|
89
|
+
{ col: 1, row: 11, label: '5' }, // bottom-left, under the P (card anchor)
|
|
90
|
+
];
|
|
91
|
+
export function TrailMarketingBanner({ variant = 'linkedinProfile', width, height, headline = 'Code Trails', tagline = 'frame.io for code collaboration', filename = 'feature.ts', byline = 'Principal AI', cityLeft = false, theme, className, }) {
|
|
92
|
+
var _a;
|
|
93
|
+
const size = SIZES[variant];
|
|
94
|
+
const W = width !== null && width !== void 0 ? width : size.w;
|
|
95
|
+
const H = height !== null && height !== void 0 ? height : size.h;
|
|
96
|
+
const uid = useId().replace(/:/g, '');
|
|
97
|
+
const pal = resolvePalette(theme);
|
|
98
|
+
// --- File City panel + hero sizes ------------------------------------
|
|
99
|
+
const panelPad = Math.round(H * 0.075);
|
|
100
|
+
const panelSide = H - panelPad * 2;
|
|
101
|
+
const panelY = panelPad;
|
|
102
|
+
const k = panelSide / CITY;
|
|
103
|
+
// In city-left, nudge the hero up-and-left so it staggers diagonally off the
|
|
104
|
+
// card (which stays anchored in the gap below it).
|
|
105
|
+
const heroStaggerX = cityLeft ? Math.round(W * 0.055) : 0;
|
|
106
|
+
const heroStaggerY = cityLeft ? Math.round(H * 0.1) : 0;
|
|
107
|
+
// Sit the hero high in the frame so it clears the platform's profile photo +
|
|
108
|
+
// name card, which overlap the lower-left of profile backgrounds. (cityLeft
|
|
109
|
+
// keeps its original 0.4 anchor, less its stagger, so that layout is
|
|
110
|
+
// unchanged.)
|
|
111
|
+
const heroBaseFrac = cityLeft ? 0.4 : 0.3;
|
|
112
|
+
const heroCY = Math.round(H * heroBaseFrac) - heroStaggerY;
|
|
113
|
+
const footSize = Math.round(H * 0.04);
|
|
114
|
+
const footGap = Math.round(H * 0.085);
|
|
115
|
+
const headlineFont = Math.round(H * 0.205);
|
|
116
|
+
const bylineFont = Math.round(H * 0.084);
|
|
117
|
+
// Estimate the hero block's width (its widest line) so we can center the
|
|
118
|
+
// hero+panel cluster instead of stranding empty space in the middle of a
|
|
119
|
+
// wide frame. Rough text metrics are fine — this only drives placement.
|
|
120
|
+
const headlineW = headline.length * headlineFont * 0.56;
|
|
121
|
+
const footprintsW = 7 * footGap + footSize;
|
|
122
|
+
const bylineW = byline ? `by ${byline}`.length * bylineFont * 0.56 : 0;
|
|
123
|
+
const heroW = Math.max(headlineW, footprintsW, bylineW);
|
|
124
|
+
// Gap between hero and panel, and the centered start so outer margins
|
|
125
|
+
// balance left/right rather than pinning content to the edges.
|
|
126
|
+
const gap = clamp(panelSide * 0.22, H * 0.3, W * 0.14);
|
|
127
|
+
const minMargin = Math.round(W * 0.05);
|
|
128
|
+
// Panel and hero, centered with balanced margins.
|
|
129
|
+
// cityLeft → [city] gap [hero]
|
|
130
|
+
// default → [hero] gap [city]
|
|
131
|
+
const total = heroW + gap + panelSide;
|
|
132
|
+
let panelX;
|
|
133
|
+
let heroX;
|
|
134
|
+
if (cityLeft) {
|
|
135
|
+
panelX = Math.max(minMargin, Math.round((W - total) / 2));
|
|
136
|
+
heroX = panelX + panelSide + gap - heroStaggerX;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
heroX = Math.max(minMargin, Math.round((W - total) / 2));
|
|
140
|
+
panelX = Math.min(W - panelSide - minMargin, Math.round(heroX + heroW + gap));
|
|
141
|
+
}
|
|
142
|
+
// LinkedIn's profile background crops tighter on the left, so nudge the whole
|
|
143
|
+
// hero + panel + card cluster right (everything is keyed off heroX/panelX).
|
|
144
|
+
const clusterShiftX = variant === 'linkedinProfile' && !cityLeft ? Math.round(W * 0.1) : 0;
|
|
145
|
+
if (clusterShiftX) {
|
|
146
|
+
heroX += clusterShiftX;
|
|
147
|
+
panelX = Math.min(W - panelSide - minMargin, panelX + clusterShiftX);
|
|
148
|
+
}
|
|
149
|
+
// LinkedIn fine-tuning: pull the city panel back left a touch.
|
|
150
|
+
const isLinkedInProfile = variant === 'linkedinProfile' && !cityLeft;
|
|
151
|
+
if (isLinkedInProfile)
|
|
152
|
+
panelX -= Math.round(W * 0.03);
|
|
153
|
+
// X fine-tuning: nudge the city panel right (the card, pinned to the panel's
|
|
154
|
+
// near edge, rides along).
|
|
155
|
+
const isTwitterProfile = variant === 'twitterHeader' && !cityLeft;
|
|
156
|
+
if (isTwitterProfile) {
|
|
157
|
+
panelX = Math.min(W - panelSide - minMargin, panelX + Math.round(W * 0.04));
|
|
158
|
+
}
|
|
159
|
+
// Indent the byline right so it tucks under the headline (profile surfaces).
|
|
160
|
+
const indentByline = !cityLeft && (variant === 'linkedinProfile' || variant === 'twitterHeader');
|
|
161
|
+
const bylineX = heroX + (indentByline ? Math.round(W * 0.025) : 0);
|
|
162
|
+
const headlineY = heroCY + Math.round(headlineFont * 0.34);
|
|
163
|
+
const bylineY = headlineY + Math.round(H * 0.115);
|
|
164
|
+
// Split the byline so its last word (e.g. "AI") can be brand-colored.
|
|
165
|
+
const bylineWords = byline.trim().split(/\s+/);
|
|
166
|
+
const bylineLast = (_a = bylineWords.pop()) !== null && _a !== void 0 ? _a : '';
|
|
167
|
+
const bylineHead = bylineWords.join(' ');
|
|
168
|
+
// --- Snippet card: hangs off the panel on the hero side, wired to the trace
|
|
169
|
+
// corner nearest the card (bowl bottom-right for city-left, stem bottom
|
|
170
|
+
// for city-right). ---
|
|
171
|
+
const cardClip = `snip-${uid}`;
|
|
172
|
+
// Anchor the card to the corner nearest it: bottom-left (last) for city-left
|
|
173
|
+
// is on the right... use bottom-right for city-left, bottom-left for city-right.
|
|
174
|
+
const anchorIndex = cityLeft ? MARKER_CELLS.length - 2 : MARKER_CELLS.length - 1;
|
|
175
|
+
const anchorCell = MARKER_CELLS[anchorIndex];
|
|
176
|
+
const anchorPt = cellCenter(anchorCell.col, anchorCell.row);
|
|
177
|
+
const anchorX = panelX + anchorPt.x * k;
|
|
178
|
+
const anchorY = panelY + anchorPt.y * k;
|
|
179
|
+
const bodyFont = Math.round(H * 0.058);
|
|
180
|
+
const headerFont = Math.round(H * 0.044);
|
|
181
|
+
const headerH = Math.round(bodyFont * 1.6);
|
|
182
|
+
const padX = Math.round(bodyFont * 0.7);
|
|
183
|
+
const padY = Math.round(bodyFont * 0.7);
|
|
184
|
+
// Tagline on a single line; in city-left the card spans the headline width so
|
|
185
|
+
// it centers directly under "Code Trails".
|
|
186
|
+
const taglineWords = tagline ? tagline.trim().split(/\s+/) : [];
|
|
187
|
+
const taglineW = tagline ? Math.round(tagline.length * bodyFont * 0.55) : 0;
|
|
188
|
+
const cardW = cityLeft
|
|
189
|
+
? taglineW + padX * 2 // just fits the one-line tagline
|
|
190
|
+
: Math.max(Math.round(panelSide * 0.92), taglineW + padX * 2); // widen to fit the bigger text
|
|
191
|
+
const cardH = headerH + padY * 2 + bodyFont;
|
|
192
|
+
// The headline renders tighter than the estimate (bold + letterSpacing -2),
|
|
193
|
+
// so use a corrected width to center the card under it.
|
|
194
|
+
const headlineRenderW = Math.round(headlineW * 0.86);
|
|
195
|
+
let cardX = Math.round(heroX + (headlineRenderW - cardW) / 2); // centered under the headline
|
|
196
|
+
if (!cityLeft) {
|
|
197
|
+
// The card would otherwise sit in the lower-left, where the platform drops
|
|
198
|
+
// the profile photo / avatar. Push it right to clear that chrome (and sit
|
|
199
|
+
// nearer the trail it labels) — but never far enough to run into the panel.
|
|
200
|
+
const clearLeft = Math.round(W * 0.36);
|
|
201
|
+
const maxLeft = panelX - cardW - Math.round(W * 0.012);
|
|
202
|
+
cardX = clamp(cardX, Math.min(clearLeft, maxLeft), maxLeft);
|
|
203
|
+
}
|
|
204
|
+
const cardNearX = cityLeft ? cardX : cardX + cardW;
|
|
205
|
+
const cardY = Math.max(panelY, panelY + panelSide - cardH);
|
|
206
|
+
const leaderY = clamp(anchorY, cardY + 12, cardY + cardH - 12);
|
|
207
|
+
return (React.createElement("svg", { viewBox: `0 0 ${W} ${H}`, className: className, style: { display: 'block', width: '100%', height: 'auto' }, role: "img", "aria-label": `${headline} — ${byline ? `by ${byline} — ` : ''}a trail through a city of files` },
|
|
208
|
+
React.createElement("defs", null,
|
|
209
|
+
React.createElement("clipPath", { id: `city-${uid}` },
|
|
210
|
+
React.createElement("rect", { x: 0, y: 0, width: CITY, height: CITY, rx: 16 }))),
|
|
211
|
+
React.createElement("rect", { x: 0, y: 0, width: W, height: H, fill: pal.background }),
|
|
212
|
+
React.createElement("g", { transform: `translate(${panelX}, ${panelY}) scale(${k})` },
|
|
213
|
+
React.createElement("rect", { x: 0, y: 0, width: CITY, height: CITY, rx: 16, fill: pal.backgroundSecondary, stroke: pal.border, strokeWidth: 1 }),
|
|
214
|
+
React.createElement("g", { clipPath: `url(#city-${uid})` },
|
|
215
|
+
React.createElement(FileCity, { pal: pal, markerCells: MARKER_CELLS, glowIndex: anchorIndex }))),
|
|
216
|
+
tagline && (React.createElement(React.Fragment, null,
|
|
217
|
+
React.createElement("path", { d: `M ${anchorX} ${anchorY} L ${cardNearX} ${leaderY}`, fill: "none", stroke: TRAIL_LINE, strokeWidth: 1.5, strokeDasharray: "5 4", opacity: 0.7 }),
|
|
218
|
+
React.createElement("circle", { cx: cardNearX, cy: leaderY, r: 3.5, fill: pal.accent }),
|
|
219
|
+
React.createElement(SnippetCard, { x: cardX, y: cardY, w: cardW, h: cardH, headerH: headerH, headerFont: headerFont, bodyFont: bodyFont, padX: padX, padY: padY, words: taglineWords, filename: filename, pal: pal, clipId: cardClip }))),
|
|
220
|
+
React.createElement("g", null,
|
|
221
|
+
React.createElement("text", { x: heroX, y: headlineY, fontSize: headlineFont, fontWeight: 700, letterSpacing: -2, fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", fill: TRAIL_LINE }, headline),
|
|
222
|
+
byline && (React.createElement("text", { x: bylineX, y: bylineY, fontSize: bylineFont, fontWeight: 600, fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", xmlSpace: "preserve" },
|
|
223
|
+
React.createElement("tspan", { fill: pal.textTertiary }, "by "),
|
|
224
|
+
bylineHead && React.createElement("tspan", { fill: pal.primary },
|
|
225
|
+
bylineHead,
|
|
226
|
+
" "),
|
|
227
|
+
React.createElement("tspan", { fill: pal.primary }, bylineLast))))));
|
|
228
|
+
}
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
// File City (native 540-space, ported from TrailMarketingCardOG)
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
function FileCity({ pal, markerCells, glowIndex = 0, }) {
|
|
233
|
+
const pinned = new Set(markerCells.map((m) => `${m.col},${m.row}`));
|
|
234
|
+
const cells = buildCity(pinned, pal.city, pal.mark, pal.markAccent);
|
|
235
|
+
const markers = markerCells.map((m) => (Object.assign(Object.assign({}, cellCenter(m.col, m.row)), { label: m.label })));
|
|
236
|
+
const feet = trailFootsteps(markers, 52, 7, 30);
|
|
237
|
+
return (React.createElement(React.Fragment, null,
|
|
238
|
+
cells.map((c, i) => (React.createElement("rect", { key: i, x: c.x, y: c.y, width: SQUARE, height: SQUARE, rx: 2, fill: c.fill }))),
|
|
239
|
+
React.createElement("g", { opacity: 0.16 }, feet.map((f, i) => (React.createElement(Footprint, { key: i, x: f.x, y: f.y, angle: f.angle, mirror: f.mirror, size: 13, color: TRAIL_LINE })))),
|
|
240
|
+
markers.map((m, i) => {
|
|
241
|
+
const isGlow = i === glowIndex;
|
|
242
|
+
const r = 12;
|
|
243
|
+
return (React.createElement(React.Fragment, { key: m.label },
|
|
244
|
+
isGlow && React.createElement("circle", { cx: m.x, cy: m.y, r: r + 9, fill: pal.primary, opacity: 0.22 }),
|
|
245
|
+
React.createElement("circle", { cx: m.x, cy: m.y, r: r, fill: pal.primary, opacity: isGlow ? 1 : 0.4 })));
|
|
246
|
+
})));
|
|
247
|
+
}
|
|
248
|
+
/** Snippet card rendered in banner space (outside the city panel). */
|
|
249
|
+
function SnippetCard({ x, y, w, h, headerH, headerFont, bodyFont, padX, padY, words, filename, pal, clipId, }) {
|
|
250
|
+
return (React.createElement("g", null,
|
|
251
|
+
React.createElement("defs", null,
|
|
252
|
+
React.createElement("clipPath", { id: clipId },
|
|
253
|
+
React.createElement("rect", { x: x, y: y, width: w, height: h, rx: 12 }))),
|
|
254
|
+
React.createElement("g", { clipPath: `url(#${clipId})` },
|
|
255
|
+
React.createElement("rect", { x: x, y: y, width: w, height: h, fill: pal.surface }),
|
|
256
|
+
React.createElement("rect", { x: x, y: y, width: w, height: headerH, fill: pal.headerBand }),
|
|
257
|
+
React.createElement("text", { x: x + padX, y: y + headerH / 2, dominantBaseline: "central", fontSize: headerFont, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: pal.textTertiary }, filename),
|
|
258
|
+
words.length > 0 && (React.createElement("text", { x: x + padX, y: y + headerH + padY + bodyFont, fontSize: bodyFont, fontWeight: 600, fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", xmlSpace: "preserve" }, words.map((wd, wi) => {
|
|
259
|
+
// First word is the Frame.io wordmark (dark, Kumbh Sans); the
|
|
260
|
+
// trailing phrase ("code collaboration") is brand-colored; the
|
|
261
|
+
// connective words stay body text.
|
|
262
|
+
const isFrame = wi === 0;
|
|
263
|
+
const isTail = wi >= words.length - 2;
|
|
264
|
+
return (React.createElement("tspan", { key: wi, fill: isTail ? pal.primary : pal.text, fontFamily: isFrame ? FRAME_IO_FONT : undefined },
|
|
265
|
+
wi > 0 ? ' ' : '',
|
|
266
|
+
wd));
|
|
267
|
+
})))),
|
|
268
|
+
React.createElement("rect", { x: x, y: y, width: w, height: h, rx: 12, fill: "none", stroke: pal.primary, strokeWidth: 1.5 })));
|
|
269
|
+
}
|
|
270
|
+
/** Footprint glyph (viewBox "2 1 9 18"). `angle` points the toe along the
|
|
271
|
+
* walk direction (90° = walking →); `mirror` flips left vs right foot. */
|
|
272
|
+
function Footprint({ x, y, angle = 90, mirror = false, size, color, }) {
|
|
273
|
+
const k = size / 9; // glyph is ~9 units wide
|
|
274
|
+
const m = mirror ? ' scale(-1, 1)' : '';
|
|
275
|
+
return (React.createElement("g", { transform: `translate(${x}, ${y}) rotate(${angle})${m} scale(${k}) translate(-6.5, -10)`, fill: "none", stroke: color, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
276
|
+
React.createElement("path", { d: "M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z" }),
|
|
277
|
+
React.createElement("path", { d: "M4 13h4" })));
|
|
278
|
+
}
|
|
279
|
+
/** Lay footprints along the (smoothed) trail through `pts`: sample the curve,
|
|
280
|
+
* walk it at `spacing`, alternate feet, offset each to the side and rotate it
|
|
281
|
+
* to face the direction of travel. */
|
|
282
|
+
function trailFootsteps(pts, spacing, offset, clearance = 0) {
|
|
283
|
+
var _a;
|
|
284
|
+
if (pts.length < 2)
|
|
285
|
+
return [];
|
|
286
|
+
// Straight segments from one marker to the next.
|
|
287
|
+
const samples = pts.map((p) => ({ x: p.x, y: p.y }));
|
|
288
|
+
const cum = [0];
|
|
289
|
+
for (let i = 1; i < samples.length; i++) {
|
|
290
|
+
cum.push(cum[i - 1] + Math.hypot(samples[i].x - samples[i - 1].x, samples[i].y - samples[i - 1].y));
|
|
291
|
+
}
|
|
292
|
+
const total = cum[cum.length - 1];
|
|
293
|
+
const feet = [];
|
|
294
|
+
let si = 1;
|
|
295
|
+
let idx = 0;
|
|
296
|
+
for (let d = spacing * 0.5; d < total; d += spacing, idx++) {
|
|
297
|
+
while (si < cum.length && cum[si] < d)
|
|
298
|
+
si++;
|
|
299
|
+
const a = samples[si - 1];
|
|
300
|
+
const b = samples[Math.min(si, samples.length - 1)];
|
|
301
|
+
const segLen = ((_a = cum[si]) !== null && _a !== void 0 ? _a : total) - cum[si - 1] || 1;
|
|
302
|
+
const f = (d - cum[si - 1]) / segLen;
|
|
303
|
+
const x = a.x + (b.x - a.x) * f;
|
|
304
|
+
const y = a.y + (b.y - a.y) * f;
|
|
305
|
+
// Keep clear of the dots (which sit on the vertices).
|
|
306
|
+
if (clearance > 0 && pts.some((v) => Math.hypot(x - v.x, y - v.y) < clearance))
|
|
307
|
+
continue;
|
|
308
|
+
let dx = b.x - a.x;
|
|
309
|
+
let dy = b.y - a.y;
|
|
310
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
311
|
+
dx /= len;
|
|
312
|
+
dy /= len;
|
|
313
|
+
const sign = idx % 2 === 0 ? -1 : 1; // alternate sides of the path
|
|
314
|
+
feet.push({
|
|
315
|
+
x: x + -dy * offset * sign,
|
|
316
|
+
y: y + dx * offset * sign,
|
|
317
|
+
angle: (Math.atan2(dy, dx) * 180) / Math.PI + 90,
|
|
318
|
+
mirror: sign > 0,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return feet;
|
|
322
|
+
}
|
|
323
|
+
/** Bright primary shades that make the "P" squares pop off the muted city. */
|
|
324
|
+
function markShades(primary) {
|
|
325
|
+
return [
|
|
326
|
+
primary,
|
|
327
|
+
mix(primary, '#ffffff', 0.2),
|
|
328
|
+
mix(primary, '#ffffff', 0.08),
|
|
329
|
+
primary,
|
|
330
|
+
];
|
|
331
|
+
}
|
|
332
|
+
function resolvePalette(theme) {
|
|
333
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
334
|
+
if (!theme) {
|
|
335
|
+
return Object.assign(Object.assign({}, OG), { city: CITY_PALETTE, mark: markShades(OG.primary), markAccent: markShades(OG.accent) });
|
|
336
|
+
}
|
|
337
|
+
const c = theme.colors;
|
|
338
|
+
const primary = (_a = c === null || c === void 0 ? void 0 : c.primary) !== null && _a !== void 0 ? _a : OG.primary;
|
|
339
|
+
const accent = (_c = (_b = c === null || c === void 0 ? void 0 : c.accent) !== null && _b !== void 0 ? _b : c === null || c === void 0 ? void 0 : c.secondary) !== null && _c !== void 0 ? _c : OG.accent;
|
|
340
|
+
const text = (_d = c === null || c === void 0 ? void 0 : c.text) !== null && _d !== void 0 ? _d : OG.text;
|
|
341
|
+
const background = (_e = c === null || c === void 0 ? void 0 : c.background) !== null && _e !== void 0 ? _e : OG.background;
|
|
342
|
+
const surface = (_f = c === null || c === void 0 ? void 0 : c.surface) !== null && _f !== void 0 ? _f : OG.surface;
|
|
343
|
+
return {
|
|
344
|
+
background,
|
|
345
|
+
backgroundSecondary: (_g = c === null || c === void 0 ? void 0 : c.backgroundSecondary) !== null && _g !== void 0 ? _g : surface,
|
|
346
|
+
surface,
|
|
347
|
+
primary,
|
|
348
|
+
accent,
|
|
349
|
+
text,
|
|
350
|
+
textTertiary: (_h = c === null || c === void 0 ? void 0 : c.textMuted) !== null && _h !== void 0 ? _h : OG.textTertiary,
|
|
351
|
+
border: (_j = c === null || c === void 0 ? void 0 : c.border) !== null && _j !== void 0 ? _j : OG.border,
|
|
352
|
+
headerBand: OG.headerBand,
|
|
353
|
+
city: [
|
|
354
|
+
withAlpha(primary, 0.18),
|
|
355
|
+
withAlpha(primary, 0.32),
|
|
356
|
+
withAlpha(text, 0.08),
|
|
357
|
+
withAlpha(text, 0.14),
|
|
358
|
+
withAlpha(text, 0.22),
|
|
359
|
+
],
|
|
360
|
+
mark: markShades(primary),
|
|
361
|
+
markAccent: markShades(accent),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function clamp(v, lo, hi) {
|
|
365
|
+
return Math.max(lo, Math.min(hi, v));
|
|
366
|
+
}
|
|
367
|
+
function cellCenter(col, row) {
|
|
368
|
+
return { x: OFFSET + col * CELL + CELL / 2, y: OFFSET + row * CELL + CELL / 2 };
|
|
369
|
+
}
|
|
370
|
+
function buildCity(pinned, cityPalette, markPalette, markAccentPalette) {
|
|
371
|
+
const rng = mulberry32(7);
|
|
372
|
+
const cells = [];
|
|
373
|
+
for (let r = 0; r < ROWS; r++) {
|
|
374
|
+
for (let c = 0; c < COLS; c++) {
|
|
375
|
+
const isPinned = pinned.has(`${c},${r}`);
|
|
376
|
+
const g = glyphAt(c, r);
|
|
377
|
+
const isMark = g === 1 || g === 3;
|
|
378
|
+
const skipRoll = rng();
|
|
379
|
+
rng();
|
|
380
|
+
rng();
|
|
381
|
+
const colorRoll = rng();
|
|
382
|
+
// Holes punch through to the panel background (unless a marker sits there).
|
|
383
|
+
if (g === 2 && !isPinned)
|
|
384
|
+
continue;
|
|
385
|
+
// City files thin out for texture; marks + markers always render.
|
|
386
|
+
if (!isMark && !isPinned && skipRoll < 0.18)
|
|
387
|
+
continue;
|
|
388
|
+
const pal = g === 3 ? markAccentPalette : g === 1 ? markPalette : cityPalette;
|
|
389
|
+
cells.push({
|
|
390
|
+
x: OFFSET + c * CELL + 4,
|
|
391
|
+
y: OFFSET + r * CELL + 4,
|
|
392
|
+
fill: pal[Math.floor(colorRoll * pal.length)],
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return cells;
|
|
397
|
+
}
|
|
398
|
+
function mulberry32(seed) {
|
|
399
|
+
let t = seed;
|
|
400
|
+
return () => {
|
|
401
|
+
t = (t + 0x6d2b79f5) | 0;
|
|
402
|
+
let r = t;
|
|
403
|
+
r = Math.imul(r ^ (r >>> 15), r | 1);
|
|
404
|
+
r ^= r + Math.imul(r ^ (r >>> 7), r | 61);
|
|
405
|
+
return ((r ^ (r >>> 14)) >>> 0) / 4294967296;
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
/** Greedy word-wrap to ~maxChars per line. */
|
|
409
|
+
function wrapWords(text, maxChars) {
|
|
410
|
+
const lines = [];
|
|
411
|
+
let cur = '';
|
|
412
|
+
for (const w of text.split(' ')) {
|
|
413
|
+
if (cur && (cur + ' ' + w).length > maxChars) {
|
|
414
|
+
lines.push(cur);
|
|
415
|
+
cur = w;
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
cur = cur ? `${cur} ${w}` : w;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (cur)
|
|
422
|
+
lines.push(cur);
|
|
423
|
+
return lines;
|
|
424
|
+
}
|
|
425
|
+
/** Blend hex `a` toward hex `b` by `t` (0..1). */
|
|
426
|
+
function mix(a, b, t) {
|
|
427
|
+
const pa = hexToRgb(a);
|
|
428
|
+
const pb = hexToRgb(b);
|
|
429
|
+
if (!pa || !pb)
|
|
430
|
+
return a;
|
|
431
|
+
const ch = (x, y) => Math.round(x + (y - x) * t);
|
|
432
|
+
const h = (n) => n.toString(16).padStart(2, '0');
|
|
433
|
+
return `#${h(ch(pa.r, pb.r))}${h(ch(pa.g, pb.g))}${h(ch(pa.b, pb.b))}`;
|
|
434
|
+
}
|
|
435
|
+
function hexToRgb(color) {
|
|
436
|
+
if (!/^#([0-9a-f]{3}){1,2}$/i.test(color))
|
|
437
|
+
return null;
|
|
438
|
+
let hex = color.slice(1);
|
|
439
|
+
if (hex.length === 3)
|
|
440
|
+
hex = hex.split('').map((ch) => ch + ch).join('');
|
|
441
|
+
return {
|
|
442
|
+
r: parseInt(hex.slice(0, 2), 16),
|
|
443
|
+
g: parseInt(hex.slice(2, 4), 16),
|
|
444
|
+
b: parseInt(hex.slice(4, 6), 16),
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function withAlpha(color, alpha) {
|
|
448
|
+
if (/^#([0-9a-f]{3}){1,2}$/i.test(color)) {
|
|
449
|
+
let hex = color.slice(1);
|
|
450
|
+
if (hex.length === 3)
|
|
451
|
+
hex = hex.split('').map((ch) => ch + ch).join('');
|
|
452
|
+
const a = Math.round(Math.max(0, Math.min(1, alpha)) * 255)
|
|
453
|
+
.toString(16)
|
|
454
|
+
.padStart(2, '0');
|
|
455
|
+
return `#${hex}${a}`;
|
|
456
|
+
}
|
|
457
|
+
return color;
|
|
458
|
+
}
|