@principal-ai/logo-component 0.1.17 → 0.1.18

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.
@@ -1,5 +1,14 @@
1
1
  import React, { useId } from 'react';
2
2
  const VIEW = 100;
3
+ // Corner radius for the rounded panel, as a fraction of the panel side.
4
+ // macOS app icons use a ~22.4% continuous-corner ("squircle") radius; the
5
+ // Electron app supplies the transparent safe-area padding, so the panel
6
+ // fills the whole viewBox and just needs the right corner curvature to
7
+ // read as a native dock icon. A plain SVG rx is a close approximation.
8
+ const PANEL_RADIUS = VIEW * 0.2237;
9
+ // Width of the edge hairline (in viewBox units) that keeps the icon
10
+ // defined against the dock background.
11
+ const HAIRLINE = 0.75;
3
12
  // 5-row pixel glyphs — the primary-colored files trace these.
4
13
  // `1` = a mark (primary) file
5
14
  // `H` = the letter's counter — a forced hole (background shows through,
@@ -81,15 +90,12 @@ function mix(a, b, t) {
81
90
  return `#${ch(0)}${ch(1)}${ch(2)}`;
82
91
  }
83
92
  /**
84
- * A compact, iconic "file city" mark — the same top-down grid of file
85
- * squares as {@link TrailCityDiagram}, distilled to a logo: a small grid
86
- * of smaller buildings, no trail / markers / snippet. The primary-colored
87
- * files spell out the brand mark (P / AI / PAI) so the letters emerge
88
- * from the muted city.
93
+ * Compute the full layout (cells + overlays + palette) for a file-city
94
+ * mark from the public props. Pure — no hooks — so both the static and
95
+ * animated components can build their SVG from the identical cell list.
89
96
  */
90
- export const FileCityLogo = ({ width = 150, height = 150, mark = 'P', primary, accent, color, background, theme, cells = 5, highlight = true, trail = false, gradient = 'diagonal', rounded = true, opacity = 0.9, }) => {
97
+ export function computeFileCityLayout({ mark = 'P', primary, accent, color, background, theme, cells = 5, highlight = true, trail = false, gradient = 'diagonal', rounded = true, margin = 1, aiCard = false, opacity = 0.9, }) {
91
98
  var _a, _b, _c, _d;
92
- const uid = useId().replace(/:/g, '');
93
99
  const primaryColor = (_a = primary !== null && primary !== void 0 ? primary : theme === null || theme === void 0 ? void 0 : theme.colors.primary) !== null && _a !== void 0 ? _a : '#22d3ee';
94
100
  const accentColor = (_b = accent !== null && accent !== void 0 ? accent : theme === null || theme === void 0 ? void 0 : theme.colors.accent) !== null && _b !== void 0 ? _b : primaryColor;
95
101
  const baseColor = (_c = color !== null && color !== void 0 ? color : theme === null || theme === void 0 ? void 0 : theme.colors.text) !== null && _c !== void 0 ? _c : '#f8fafc';
@@ -130,8 +136,8 @@ export const FileCityLogo = ({ width = 150, height = 150, mark = 'P', primary, a
130
136
  // Build a square grid. For `mark="none"` it's a plain `cells × cells`
131
137
  // city; otherwise the glyph bitmap sits inside a square grid (side =
132
138
  // longest glyph dimension + a margin ring) so the city reads square.
133
- const margin = 1;
134
139
  const trailEnabled = trail && (mark === 'P' || mark === 'PAI');
140
+ const aiCardOn = aiCard && mark === 'P';
135
141
  let side;
136
142
  let offX = 0;
137
143
  let offY = 0;
@@ -180,6 +186,9 @@ export const FileCityLogo = ({ width = 150, height = 150, mark = 'P', primary, a
180
186
  // With a trail, shove the letter to the left so the trail has room
181
187
  // on the right; otherwise center it in the square.
182
188
  offX = trailEnabled ? margin : Math.floor((side - bw) / 2);
189
+ // Nudge the P one column left so the AI card has room on the right.
190
+ if (aiCardOn)
191
+ offX = Math.max(0, offX - 1);
183
192
  offY = Math.floor((side - bh) / 2);
184
193
  kindAt = (c, r) => {
185
194
  const bc = c - offX;
@@ -192,6 +201,18 @@ export const FileCityLogo = ({ width = 150, height = 150, mark = 'P', primary, a
192
201
  }
193
202
  const cols = side;
194
203
  const rows = side;
204
+ // The AI card occupies the bottom-right 4×3 block of cells. Those cells
205
+ // render no building — the card covers them.
206
+ const AI_CARD_COLS = 3;
207
+ const AI_CARD_ROWS = 2;
208
+ // Inset one cell up and left from the bottom-right corner.
209
+ const aiCardC0 = cols - AI_CARD_COLS - 1;
210
+ const aiCardR0 = rows - AI_CARD_ROWS - 1;
211
+ // Nudge the card down half a cell so it straddles the row line — its
212
+ // body sits over the bottom of the top row and the top of the bottom
213
+ // row. The city renders behind it, so squares show around its edges.
214
+ const AI_CARD_ROW_SHIFT = 0.5;
215
+ const AI_CARD_COL_SHIFT = 0.5;
195
216
  // Trail to the right of the letter — starts in the top-right corner,
196
217
  // crosses 2 cells diagonally to its first node, zigzags down, and ends
197
218
  // in the bottom-right corner. The dots sit on city files, which are
@@ -248,7 +269,8 @@ export const FileCityLogo = ({ width = 150, height = 150, mark = 'P', primary, a
248
269
  const startX = (VIEW - cell * cols) / 2;
249
270
  const startY = (VIEW - cell * rows) / 2;
250
271
  const rng = mulberry32(7);
251
- const files = [];
272
+ const cellsOut = [];
273
+ const extras = [];
252
274
  // Track the previous cell to the left (per row) and above (per column)
253
275
  // so we never leave two empty squares back to back in either
254
276
  // direction — that's what produced the long blank runs.
@@ -289,30 +311,109 @@ export const FileCityLogo = ({ width = 150, height = 150, mark = 'P', primary, a
289
311
  : gradientShade(baseFor(kind), c, r);
290
312
  const x = startX + c * cell + inset;
291
313
  const y = startY + r * cell + inset;
292
- files.push(React.createElement("rect", { key: `${c}-${r}`, x: x, y: y, width: sq, height: sq, rx: Math.max(1, sq * 0.12), fill: isLetter
314
+ cellsOut.push({
315
+ key: `${c}-${r}`,
316
+ c,
317
+ r,
318
+ x,
319
+ y,
320
+ sq,
321
+ rx: Math.max(1, sq * 0.12),
322
+ fill: isLetter
293
323
  ? letterFill
294
- : palette[Math.floor(colorRoll * palette.length)], stroke: isLetter ? withAlpha(letterColor, 0.55) : withAlpha(baseColor, 0.08), strokeWidth: isLetter ? 0.6 : 0.4 }));
324
+ : palette[Math.floor(colorRoll * palette.length)],
325
+ stroke: isLetter ? withAlpha(letterColor, 0.55) : withAlpha(baseColor, 0.08),
326
+ strokeWidth: isLetter ? 0.6 : 0.4,
327
+ isLetter,
328
+ // Letter files weigh the most so they build up over several
329
+ // samples; city files weigh less and resolve in one or two hits.
330
+ weight: isLetter ? 1 : 0.4,
331
+ });
295
332
  }
296
333
  }
334
+ // AI card — a small file card (filename header band + "AI" contents)
335
+ // dropped into the bottom-right block, mirroring TrailCityDiagram's
336
+ // snippet card.
337
+ if (aiCardOn) {
338
+ const cx0 = startX + (aiCardC0 + AI_CARD_COL_SHIFT) * cell + inset;
339
+ const cy0 = startY + (aiCardR0 + AI_CARD_ROW_SHIFT) * cell + inset;
340
+ const cw = AI_CARD_COLS * cell - inset * 2;
341
+ const chh = AI_CARD_ROWS * cell - inset * 2;
342
+ const headerH = chh * 0.28;
343
+ const cardR = Math.max(2, cell * 0.2);
344
+ const barH = Math.max(1, headerH * 0.26);
345
+ const fs = Math.min(cw * 0.42, (chh - headerH) * 0.64);
346
+ // Leader — anchored at the center of the P's bottom square. Routed
347
+ // with right-angle segments: down, right, up, then right into the
348
+ // card's left edge, "opening" the block. Dot at each end.
349
+ const aX = startX + (offX + 0.5) * cell; // center of the stem column
350
+ const aY = startY + (offY + 4.5) * cell; // middle of the bottom square
351
+ const bX = cx0; // left edge of the card
352
+ const bY = cy0 + chh * 0.2; // near the top of that edge
353
+ // Route along grid centerlines so the runs thread through square
354
+ // centers: dip to the row below the P, climb at the column just left
355
+ // of the card.
356
+ const valleyY = startY + (offY + 5.5) * cell; // center of the next row down
357
+ const turnX = startX + 2.5 * cell; // center of the 3rd column
358
+ const dot = Math.max(1, cell * 0.12);
359
+ const leaderPath = `M ${aX} ${aY} L ${aX} ${valleyY} L ${turnX} ${valleyY} L ${turnX} ${bY} L ${bX} ${bY}`;
360
+ extras.push(React.createElement("g", { key: "ai-leader", opacity: 0.75 },
361
+ React.createElement("path", { d: leaderPath, fill: "none", stroke: accentColor, strokeWidth: Math.max(0.6, cell * 0.07), strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${cell * 0.2} ${cell * 0.15}` }),
362
+ React.createElement("circle", { cx: aX, cy: aY, r: dot, fill: accentColor }),
363
+ React.createElement("circle", { cx: bX, cy: bY, r: dot, fill: accentColor })));
364
+ extras.push(React.createElement("g", { key: "ai-card" },
365
+ React.createElement("rect", { x: cx0, y: cy0, width: cw, height: chh, rx: cardR, fill: mix(bgColor, '#ffffff', 0.06), stroke: withAlpha(accentColor, 0.55), strokeWidth: 0.8 }),
366
+ React.createElement("path", { d: `M ${cx0} ${cy0 + headerH} L ${cx0} ${cy0 + cardR} Q ${cx0} ${cy0} ${cx0 + cardR} ${cy0} L ${cx0 + cw - cardR} ${cy0} Q ${cx0 + cw} ${cy0} ${cx0 + cw} ${cy0 + cardR} L ${cx0 + cw} ${cy0 + headerH} Z`, fill: withAlpha(accentColor, 0.14) }),
367
+ React.createElement("rect", { x: cx0 + cw * 0.16, y: cy0 + headerH / 2 - barH / 2, width: cw * 0.44, height: barH, rx: barH / 2, fill: withAlpha(baseColor, 0.5) }),
368
+ React.createElement("text", { x: cx0 + cw / 2, y: cy0 + headerH + (chh - headerH) / 2, textAnchor: "middle", dominantBaseline: "central", fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fontWeight: 700, fontSize: fs, letterSpacing: "0.06em", fill: accentColor }, "AI")));
369
+ }
297
370
  // Trail overlay — a dashed accent path to the right of the letter with
298
371
  // a marker dot on each node.
299
372
  if (trailEnabled && trailGrid.length > 1) {
300
373
  const linePts = trailGrid.map(([c, r]) => centerOf(c, r));
301
374
  const d = linePts.map((p, i) => `${i ? 'L' : 'M'} ${p.x} ${p.y}`).join(' ');
302
375
  const dot = Math.max(1.5, sq * 0.3);
303
- files.push(React.createElement("path", { key: "trail-path", d: d, fill: "none", stroke: accentColor, strokeWidth: Math.max(1, cell * 0.12), strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${cell * 0.18} ${cell * 0.18}`, opacity: 0.9 }));
376
+ extras.push(React.createElement("path", { key: "trail-path", d: d, fill: "none", stroke: accentColor, strokeWidth: Math.max(1, cell * 0.12), strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${cell * 0.18} ${cell * 0.18}`, opacity: 0.9 }));
304
377
  trailGrid.forEach(([c, r], i) => {
305
378
  const p = centerOf(c, r);
306
- files.push(React.createElement("circle", { key: `trail-dot-${i}`, cx: p.x, cy: p.y, r: dot, fill: mix(accentColor, '#ffffff', 0.15), stroke: bgColor, strokeWidth: 0.5 }));
379
+ extras.push(React.createElement("circle", { key: `trail-dot-${i}`, cx: p.x, cy: p.y, r: dot, fill: mix(accentColor, '#ffffff', 0.15), stroke: bgColor, strokeWidth: 0.5 }));
307
380
  });
308
381
  }
309
- return (React.createElement("svg", { width: width, height: height, viewBox: `0 0 ${VIEW} ${VIEW}`, xmlns: "http://www.w3.org/2000/svg", style: { opacity, display: 'block', overflow: 'visible' }, role: "img", "aria-label": mark === 'none'
310
- ? 'A top-down grid of file squares'
311
- : `A top-down grid of file squares spelling ${mark}` },
382
+ return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark };
383
+ }
384
+ /** Accessible label for a given mark, shared by both components. */
385
+ export function fileCityLabel(mark) {
386
+ return mark === 'none'
387
+ ? 'A top-down grid of file squares'
388
+ : `A top-down grid of file squares spelling ${mark}`;
389
+ }
390
+ /**
391
+ * SVG panel chrome shared by the static and animated components: the
392
+ * rounded background panel (clipping its children) and the edge hairline.
393
+ * `children` are the grid + overlays drawn inside the clip.
394
+ */
395
+ export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, children }) => {
396
+ const uid = useId().replace(/:/g, '');
397
+ return (React.createElement("svg", { width: width, height: height, viewBox: `0 0 ${VIEW} ${VIEW}`, xmlns: "http://www.w3.org/2000/svg", style: { opacity, display: 'block', overflow: 'visible' }, role: "img", "aria-label": label },
312
398
  React.createElement("defs", null,
313
399
  React.createElement("clipPath", { id: `panel-${uid}` },
314
- React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? 14 : 0 }))),
400
+ React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 }))),
315
401
  React.createElement("g", { clipPath: `url(#panel-${uid})` },
316
- React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: bgColor, rx: rounded ? 14 : 0 }),
317
- files)));
402
+ React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: bgColor, rx: rounded ? PANEL_RADIUS : 0 }),
403
+ children),
404
+ React.createElement("rect", { x: HAIRLINE / 2, y: HAIRLINE / 2, width: VIEW - HAIRLINE, height: VIEW - HAIRLINE, rx: rounded ? Math.max(0, PANEL_RADIUS - HAIRLINE / 2) : 0, fill: "none", stroke: withAlpha(baseColor, 0.14), strokeWidth: HAIRLINE })));
405
+ };
406
+ /**
407
+ * A compact, iconic "file city" mark — the same top-down grid of file
408
+ * squares as {@link TrailCityDiagram}, distilled to a logo: a small grid
409
+ * of smaller buildings, no trail / markers / snippet. The primary-colored
410
+ * files spell out the brand mark (P / AI / PAI) so the letters emerge
411
+ * from the muted city.
412
+ */
413
+ export const FileCityLogo = (props) => {
414
+ const { width = 150, height = 150 } = props;
415
+ const { cells, extras, bgColor, baseColor, rounded, opacity, mark } = computeFileCityLayout(props);
416
+ return (React.createElement(FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, label: fileCityLabel(mark) },
417
+ cells.map((cell) => (React.createElement("rect", { key: cell.key, x: cell.x, y: cell.y, width: cell.sq, height: cell.sq, rx: cell.rx, fill: cell.fill, stroke: cell.stroke, strokeWidth: cell.strokeWidth }))),
418
+ extras));
318
419
  };
@@ -0,0 +1,193 @@
1
+ import React, { useEffect, useId, useMemo, useRef, useState } from 'react';
2
+ import { computeFileCityLayout, fileCityLabel, FileCityPanel, } from './FileCityLogo';
3
+ // CSS keyframe name for the connector draw-on. CSS animations restart on
4
+ // element remount (unlike SMIL's document-timeline `begin`), so each group's
5
+ // freshly-keyed connector draws from the start.
6
+ const CONN_DRAW = 'fc-conn-draw';
7
+ function mulberry32(seed) {
8
+ let t = seed;
9
+ return () => {
10
+ t = (t + 0x6d2b79f5) | 0;
11
+ let r = t;
12
+ r = Math.imul(r ^ (r >>> 15), r | 1);
13
+ r ^= r + Math.imul(r ^ (r >>> 7), r | 61);
14
+ return ((r ^ (r >>> 14)) >>> 0) / 4294967296;
15
+ };
16
+ }
17
+ /**
18
+ * Animated file-city mark: the squares accumulate like a heatmap. Each tick
19
+ * a batch of cells gets a "sample" added; letter cells weigh more so they
20
+ * take several samples to reach full intensity while city files resolve
21
+ * quickly. Once the summed weights fill in, the logo holds on screen.
22
+ */
23
+ export const FileCityLogoAnimated = (props) => {
24
+ var _a, _b, _c, _d, _e, _f;
25
+ const uid = useId().replace(/:/g, '');
26
+ const { width = 150, height = 150, batchMin = 3, batchMax = 6, cellMs = 130, pauseMs = 700, buildSteps = 3, connectors = true, connectorColor, autoPlay = true, playKey, onComplete, } = props;
27
+ const accentColor = (_f = (_d = (_c = (_a = connectorColor !== null && connectorColor !== void 0 ? connectorColor : props.accent) !== null && _a !== void 0 ? _a : (_b = props.theme) === null || _b === void 0 ? void 0 : _b.colors.accent) !== null && _c !== void 0 ? _c : props.primary) !== null && _d !== void 0 ? _d : (_e = props.theme) === null || _e === void 0 ? void 0 : _e.colors.primary) !== null && _f !== void 0 ? _f : '#22d3ee';
28
+ const { cells, extras, bgColor, baseColor, rounded, opacity, mark } = useMemo(() => computeFileCityLayout(props),
29
+ // Re-derive only when an input that affects layout changes.
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ [
32
+ props.mark,
33
+ props.primary,
34
+ props.accent,
35
+ props.color,
36
+ props.background,
37
+ props.theme,
38
+ props.cells,
39
+ props.highlight,
40
+ props.trail,
41
+ props.gradient,
42
+ props.rounded,
43
+ props.margin,
44
+ props.aiCard,
45
+ props.opacity,
46
+ ]);
47
+ // Per-cell number of samples to fully reveal it (>=1; letter cells take
48
+ // `buildSteps`, city cells proportionally fewer by their weight).
49
+ const stepsFor = useMemo(() => cells.map((cell) => Math.max(1, Math.round(cell.weight * buildSteps))), [cells, buildSteps]);
50
+ // The pool of pending samples: each cell index repeated `steps` times,
51
+ // shuffled deterministically so the batches scatter across the grid,
52
+ // then sliced into groups of `batchMin`..`batchMax`.
53
+ const groups = useMemo(() => {
54
+ const p = [];
55
+ stepsFor.forEach((n, i) => {
56
+ for (let k = 0; k < n; k++)
57
+ p.push(i);
58
+ });
59
+ const shuffle = mulberry32(0x5eed + cells.length);
60
+ for (let i = p.length - 1; i > 0; i--) {
61
+ const j = Math.floor(shuffle() * (i + 1));
62
+ [p[i], p[j]] = [p[j], p[i]];
63
+ }
64
+ const sizeRand = mulberry32(0xb47c4 + cells.length);
65
+ const g = [];
66
+ let i = 0;
67
+ while (i < p.length) {
68
+ const size = batchMin + Math.floor(sizeRand() * (batchMax - batchMin + 1));
69
+ g.push(p.slice(i, i + size));
70
+ i += size;
71
+ }
72
+ return g;
73
+ }, [stepsFor, cells.length, batchMin, batchMax]);
74
+ // `progress[i]` = samples applied to cell i. Once every group has been
75
+ // walked the animation is done and the logo holds.
76
+ const [progress, setProgress] = useState(() => cells.map(() => 0));
77
+ const [done, setDone] = useState(false);
78
+ // The connector for the active group: which group it traces, and whether
79
+ // it's drawing on (during the reveal) or fading out (during the pause).
80
+ const [conn, setConn] = useState(null);
81
+ const groupRef = useRef(0);
82
+ const memberRef = useRef(0);
83
+ const onCompleteRef = useRef(onComplete);
84
+ onCompleteRef.current = onComplete;
85
+ // Drive the accumulation. Re-runs whenever the layout, timing, or the
86
+ // explicit `playKey` changes — that's our "replay."
87
+ useEffect(() => {
88
+ var _a;
89
+ // Respect reduced-motion: jump straight to the resolved logo.
90
+ const reduce = typeof window !== 'undefined' &&
91
+ window.matchMedia &&
92
+ window.matchMedia('(prefers-reduced-motion: reduce)').matches;
93
+ groupRef.current = 0;
94
+ memberRef.current = 0;
95
+ setProgress(cells.map(() => 0));
96
+ setConn(null);
97
+ setDone(false);
98
+ if (!autoPlay || cells.length === 0 || reduce) {
99
+ setProgress(stepsFor.slice());
100
+ setDone(true);
101
+ (_a = onCompleteRef.current) === null || _a === void 0 ? void 0 : _a.call(onCompleteRef);
102
+ return;
103
+ }
104
+ let timer;
105
+ // Reveal one cell per step. Within a group the steps are `cellMs`
106
+ // apart; finishing a group schedules the next one after `pauseMs`.
107
+ const step = () => {
108
+ var _a;
109
+ const gi = groupRef.current;
110
+ if (gi >= groups.length) {
111
+ setDone(true);
112
+ (_a = onCompleteRef.current) === null || _a === void 0 ? void 0 : _a.call(onCompleteRef);
113
+ return;
114
+ }
115
+ const group = groups[gi];
116
+ const mi = memberRef.current;
117
+ const idx = group[mi];
118
+ setProgress((prev) => {
119
+ const next = prev.slice();
120
+ next[idx] = Math.min(stepsFor[idx], next[idx] + 1);
121
+ return next;
122
+ });
123
+ const lastInGroup = mi + 1 >= group.length;
124
+ // Start the connector drawing on when the group begins; once it's
125
+ // complete, flip to fading so it dissolves through the pause.
126
+ if (mi === 0)
127
+ setConn({ group: gi, fading: false });
128
+ if (lastInGroup)
129
+ setConn({ group: gi, fading: true });
130
+ if (lastInGroup) {
131
+ groupRef.current = gi + 1;
132
+ memberRef.current = 0;
133
+ timer = setTimeout(step, pauseMs);
134
+ }
135
+ else {
136
+ memberRef.current = mi + 1;
137
+ timer = setTimeout(step, cellMs);
138
+ }
139
+ };
140
+ timer = setTimeout(step, cellMs);
141
+ return () => clearTimeout(timer);
142
+ // eslint-disable-next-line react-hooks/exhaustive-deps
143
+ }, [cells, groups, stepsFor, cellMs, pauseMs, autoPlay, playKey]);
144
+ // Easing for the per-cell fill-in so each sample lands softly.
145
+ const ease = (t) => 1 - Math.pow(1 - t, 2);
146
+ // Connector geometry — the full path through the active group's cell
147
+ // centers (drawn on with stroke-dashoffset, so we render every point up
148
+ // front and animate the reveal).
149
+ const sq = cells.length ? cells[0].sq : 1;
150
+ const centerOf = (idx) => ({
151
+ x: cells[idx].x + cells[idx].sq / 2,
152
+ y: cells[idx].y + cells[idx].sq / 2,
153
+ });
154
+ const connGroup = conn ? groups[conn.group] : null;
155
+ const connectorPath = connGroup && connGroup.length > 1
156
+ ? connGroup
157
+ .map((idx, i) => {
158
+ const p = centerOf(idx);
159
+ return `${i ? 'L' : 'M'} ${p.x} ${p.y}`;
160
+ })
161
+ .join(' ')
162
+ : null;
163
+ // Draw the trail on across the group's reveal (so the line reaches each
164
+ // cell about as it lights up); fade should finish inside the pause.
165
+ const drawMs = connGroup ? Math.max(cellMs, (connGroup.length - 1) * cellMs) : 0;
166
+ const fadeMs = Math.max(120, Math.min(pauseMs - 60, 360));
167
+ return (React.createElement(FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, label: fileCityLabel(mark) },
168
+ cells.map((cell, i) => {
169
+ const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
170
+ if (reveal <= 0)
171
+ return null;
172
+ return (React.createElement("rect", { key: cell.key, x: cell.x, y: cell.y, width: cell.sq, height: cell.sq, rx: cell.rx, fill: cell.fill, fillOpacity: reveal, stroke: cell.stroke, strokeWidth: cell.strokeWidth, strokeOpacity: reveal }));
173
+ }),
174
+ connectors && connectorPath && conn && !done ? (
175
+ // The trail is a dashed (dotted) path, revealed progressively by a
176
+ // mask: a solid line draws itself on (stroke-dashoffset 1 → 0 with
177
+ // pathLength normalized to 1), uncovering the dots block by block as
178
+ // the trail extends.
179
+ (() => {
180
+ const maskId = `conn-mask-${uid}-${conn.group}`;
181
+ const w = Math.max(0.6, sq * 0.12);
182
+ return (React.createElement("g", { key: `conn-${conn.group}` },
183
+ React.createElement("style", null, `@keyframes ${CONN_DRAW}{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}`),
184
+ React.createElement("defs", null,
185
+ React.createElement("mask", { id: maskId, maskUnits: "userSpaceOnUse" },
186
+ React.createElement("path", { d: connectorPath, fill: "none", stroke: "#fff", strokeWidth: w * 2.6, strokeLinecap: "round", strokeLinejoin: "round", pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1, style: { animation: `${CONN_DRAW} ${drawMs}ms linear forwards` } }))),
187
+ React.createElement("path", { d: connectorPath, fill: "none", stroke: accentColor, strokeWidth: w, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${sq * 0.18} ${sq * 0.14}`, mask: `url(#${maskId})`, style: {
188
+ transition: `opacity ${fadeMs}ms ease`,
189
+ opacity: conn.fading ? 0 : 0.9,
190
+ } })));
191
+ })()) : null,
192
+ done ? extras : null));
193
+ };
package/dist/esm/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  export { Logo } from './Logo';
2
2
  export { LogoSmall } from './LogoSmall';
3
3
  export { ForksLogo } from './ForksLogo';
4
- export { SquareLogo } from './SquareLogo';
5
- export { WreathLogo } from './WreathLogo';
6
4
  export { TelemetryReveal } from './TelemetryReveal';
7
5
  export { TextReveal } from './TextReveal';
8
6
  export { OpenTypeTextReveal } from './OpenTypeTextReveal';
9
7
  export { TrailCityDiagram } from './TrailCityDiagram';
10
- export { FileCityLogo } from './FileCityLogo';
8
+ export { FileCityLogo, FileCityPanel, computeFileCityLayout, fileCityLabel } from './FileCityLogo';
9
+ export { FileCityLogoAnimated } from './FileCityLogoAnimated';
11
10
  export { TELEMETRY_PRESETS } from './presets';
12
11
  export { STROKE_CHARACTERS, layoutText } from './strokeCharacters';
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  export { Logo } from './Logo';
2
2
  export { LogoSmall } from './LogoSmall';
3
3
  export { ForksLogo } from './ForksLogo';
4
- export { SquareLogo } from './SquareLogo';
5
- export { WreathLogo } from './WreathLogo';
6
4
  export { TelemetryReveal } from './TelemetryReveal';
7
5
  export { TextReveal } from './TextReveal';
8
6
  export { OpenTypeTextReveal } from './OpenTypeTextReveal';
9
7
  export { TrailCityDiagram } from './TrailCityDiagram';
10
8
  export type { TrailCityDiagramProps } from './TrailCityDiagram';
11
- export { FileCityLogo } from './FileCityLogo';
12
- export type { FileCityLogoProps, FileCityMark, FileCityGradient } from './FileCityLogo';
9
+ export { FileCityLogo, FileCityPanel, computeFileCityLayout, fileCityLabel } from './FileCityLogo';
10
+ export type { FileCityLogoProps, FileCityMark, FileCityGradient, FileCityCell, FileCityLayout, } from './FileCityLogo';
11
+ export { FileCityLogoAnimated } from './FileCityLogoAnimated';
12
+ export type { FileCityLogoAnimatedProps } from './FileCityLogoAnimated';
13
13
  export { TELEMETRY_PRESETS } from './presets';
14
14
  export { STROKE_CHARACTERS, layoutText } from './strokeCharacters';
15
15
  export type { PathDefinition, ShapePreset } from './presets';
package/dist/index.esm.js CHANGED
@@ -1,12 +1,11 @@
1
1
  export { Logo } from './Logo';
2
2
  export { LogoSmall } from './LogoSmall';
3
3
  export { ForksLogo } from './ForksLogo';
4
- export { SquareLogo } from './SquareLogo';
5
- export { WreathLogo } from './WreathLogo';
6
4
  export { TelemetryReveal } from './TelemetryReveal';
7
5
  export { TextReveal } from './TextReveal';
8
6
  export { OpenTypeTextReveal } from './OpenTypeTextReveal';
9
7
  export { TrailCityDiagram } from './TrailCityDiagram';
10
- export { FileCityLogo } from './FileCityLogo';
8
+ export { FileCityLogo, FileCityPanel, computeFileCityLayout, fileCityLabel } from './FileCityLogo';
9
+ export { FileCityLogoAnimated } from './FileCityLogoAnimated';
11
10
  export { TELEMETRY_PRESETS } from './presets';
12
11
  export { STROKE_CHARACTERS, layoutText } from './strokeCharacters';
package/dist/index.js CHANGED
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.layoutText = exports.STROKE_CHARACTERS = exports.TELEMETRY_PRESETS = exports.FileCityLogo = exports.TrailCityDiagram = exports.OpenTypeTextReveal = exports.TextReveal = exports.TelemetryReveal = exports.WreathLogo = exports.SquareLogo = exports.ForksLogo = exports.LogoSmall = exports.Logo = void 0;
3
+ exports.layoutText = exports.STROKE_CHARACTERS = exports.TELEMETRY_PRESETS = exports.FileCityLogoAnimated = exports.fileCityLabel = exports.computeFileCityLayout = exports.FileCityPanel = exports.FileCityLogo = exports.TrailCityDiagram = exports.OpenTypeTextReveal = exports.TextReveal = exports.TelemetryReveal = exports.ForksLogo = exports.LogoSmall = exports.Logo = void 0;
4
4
  var Logo_1 = require("./Logo");
5
5
  Object.defineProperty(exports, "Logo", { enumerable: true, get: function () { return Logo_1.Logo; } });
6
6
  var LogoSmall_1 = require("./LogoSmall");
7
7
  Object.defineProperty(exports, "LogoSmall", { enumerable: true, get: function () { return LogoSmall_1.LogoSmall; } });
8
8
  var ForksLogo_1 = require("./ForksLogo");
9
9
  Object.defineProperty(exports, "ForksLogo", { enumerable: true, get: function () { return ForksLogo_1.ForksLogo; } });
10
- var SquareLogo_1 = require("./SquareLogo");
11
- Object.defineProperty(exports, "SquareLogo", { enumerable: true, get: function () { return SquareLogo_1.SquareLogo; } });
12
- var WreathLogo_1 = require("./WreathLogo");
13
- Object.defineProperty(exports, "WreathLogo", { enumerable: true, get: function () { return WreathLogo_1.WreathLogo; } });
14
10
  var TelemetryReveal_1 = require("./TelemetryReveal");
15
11
  Object.defineProperty(exports, "TelemetryReveal", { enumerable: true, get: function () { return TelemetryReveal_1.TelemetryReveal; } });
16
12
  var TextReveal_1 = require("./TextReveal");
@@ -21,6 +17,11 @@ var TrailCityDiagram_1 = require("./TrailCityDiagram");
21
17
  Object.defineProperty(exports, "TrailCityDiagram", { enumerable: true, get: function () { return TrailCityDiagram_1.TrailCityDiagram; } });
22
18
  var FileCityLogo_1 = require("./FileCityLogo");
23
19
  Object.defineProperty(exports, "FileCityLogo", { enumerable: true, get: function () { return FileCityLogo_1.FileCityLogo; } });
20
+ Object.defineProperty(exports, "FileCityPanel", { enumerable: true, get: function () { return FileCityLogo_1.FileCityPanel; } });
21
+ Object.defineProperty(exports, "computeFileCityLayout", { enumerable: true, get: function () { return FileCityLogo_1.computeFileCityLayout; } });
22
+ Object.defineProperty(exports, "fileCityLabel", { enumerable: true, get: function () { return FileCityLogo_1.fileCityLabel; } });
23
+ var FileCityLogoAnimated_1 = require("./FileCityLogoAnimated");
24
+ Object.defineProperty(exports, "FileCityLogoAnimated", { enumerable: true, get: function () { return FileCityLogoAnimated_1.FileCityLogoAnimated; } });
24
25
  var presets_1 = require("./presets");
25
26
  Object.defineProperty(exports, "TELEMETRY_PRESETS", { enumerable: true, get: function () { return presets_1.TELEMETRY_PRESETS; } });
26
27
  var strokeCharacters_1 = require("./strokeCharacters");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/logo-component",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Animated wireframe sphere logo component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- interface SquareLogoProps {
3
- width?: number;
4
- height?: number;
5
- colors?: string[];
6
- opacity?: number;
7
- }
8
- export declare const SquareLogo: React.FC<SquareLogoProps>;
9
- export {};
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SquareLogo = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const SquareLogo = ({ width = 150, height = 150, colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA07A', '#96CEB4', '#FFEAA7', '#DDA15E', '#BC6C25', '#E76F51'], opacity = 0.9, }) => {
9
- const rectangleStyle = {
10
- transition: 'all 0.3s ease',
11
- };
12
- return (react_1.default.createElement("svg", { width: width, height: height, viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg", style: { opacity } },
13
- react_1.default.createElement("defs", null,
14
- react_1.default.createElement("filter", { id: "glow" },
15
- react_1.default.createElement("feGaussianBlur", { stdDeviation: "1.5", result: "coloredBlur" }),
16
- react_1.default.createElement("feMerge", null,
17
- react_1.default.createElement("feMergeNode", { in: "coloredBlur" }),
18
- react_1.default.createElement("feMergeNode", { in: "SourceGraphic" })))),
19
- react_1.default.createElement("rect", { x: "10", y: "10", width: "10", height: "15", fill: colors[1], style: rectangleStyle, filter: "url(#glow)" },
20
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite" })),
21
- react_1.default.createElement("rect", { x: "20", y: "10", width: "15", height: "80", fill: colors[0], style: rectangleStyle, filter: "url(#glow)" },
22
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "0.3s" })),
23
- react_1.default.createElement("rect", { x: "35", y: "10", width: "30", height: "12", fill: colors[0], style: rectangleStyle, filter: "url(#glow)" },
24
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "0.6s" })),
25
- react_1.default.createElement("rect", { x: "65", y: "10", width: "25", height: "12", fill: colors[0], style: rectangleStyle, filter: "url(#glow)" },
26
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "0.9s" })),
27
- react_1.default.createElement("rect", { x: "35", y: "22", width: "15", height: "18", fill: colors[3], style: rectangleStyle, filter: "url(#glow)" },
28
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "1.2s" })),
29
- react_1.default.createElement("rect", { x: "50", y: "22", width: "15", height: "18", fill: colors[4], style: rectangleStyle, filter: "url(#glow)" },
30
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "1.5s" })),
31
- react_1.default.createElement("rect", { x: "65", y: "22", width: "12", height: "18", fill: colors[0], style: rectangleStyle, filter: "url(#glow)" },
32
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "1.8s" })),
33
- react_1.default.createElement("rect", { x: "77", y: "22", width: "13", height: "28", fill: colors[0], style: rectangleStyle, filter: "url(#glow)" },
34
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "2.1s" })),
35
- react_1.default.createElement("rect", { x: "77", y: "50", width: "13", height: "40", fill: colors[5], style: rectangleStyle, filter: "url(#glow)" },
36
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "2.1s" })),
37
- react_1.default.createElement("rect", { x: "35", y: "40", width: "55", height: "10", fill: colors[0], style: rectangleStyle, filter: "url(#glow)" },
38
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "2.4s" })),
39
- react_1.default.createElement("rect", { x: "10", y: "25", width: "10", height: "35", fill: colors[6], style: rectangleStyle, filter: "url(#glow)" },
40
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "2.7s" })),
41
- react_1.default.createElement("rect", { x: "35", y: "50", width: "20", height: "20", fill: colors[7], style: rectangleStyle, filter: "url(#glow)" },
42
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "0.3s" })),
43
- react_1.default.createElement("rect", { x: "55", y: "50", width: "22", height: "20", fill: colors[8], style: rectangleStyle, filter: "url(#glow)" },
44
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "0.6s" })),
45
- react_1.default.createElement("rect", { x: "10", y: "60", width: "10", height: "30", fill: colors[1], style: rectangleStyle, filter: "url(#glow)" },
46
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "0.9s" })),
47
- react_1.default.createElement("rect", { x: "35", y: "70", width: "25", height: "20", fill: colors[2], style: rectangleStyle, filter: "url(#glow)" },
48
- react_1.default.createElement("animate", { attributeName: "opacity", values: "1;0.8;1", dur: "3s", repeatCount: "indefinite", begin: "1.2s" })),
49
- react_1.default.createElement("rect", { x: "60", y: "70", width: "17", height: "20", fill: colors[3], style: rectangleStyle, filter: "url(#glow)" },
50
- react_1.default.createElement("animate", { attributeName: "opacity", values: "0.8;1;0.8", dur: "3s", repeatCount: "indefinite", begin: "1.5s" })),
51
- react_1.default.createElement("line", { x1: "20", y1: "10", x2: "20", y2: "90", stroke: "rgba(255, 255, 255, 0.15)", strokeWidth: "0.5" }),
52
- react_1.default.createElement("line", { x1: "35", y1: "10", x2: "35", y2: "90", stroke: "rgba(255, 255, 255, 0.15)", strokeWidth: "0.5" }),
53
- react_1.default.createElement("line", { x1: "10", y1: "22", x2: "90", y2: "22", stroke: "rgba(255, 255, 255, 0.15)", strokeWidth: "0.5" }),
54
- react_1.default.createElement("line", { x1: "10", y1: "40", x2: "90", y2: "40", stroke: "rgba(255, 255, 255, 0.15)", strokeWidth: "0.5" }),
55
- react_1.default.createElement("line", { x1: "10", y1: "50", x2: "90", y2: "50", stroke: "rgba(255, 255, 255, 0.15)", strokeWidth: "0.5" })));
56
- };
57
- exports.SquareLogo = SquareLogo;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- interface WreathLogoProps {
3
- width?: number;
4
- height?: number;
5
- pColor?: string;
6
- wreathColor?: string;
7
- leafAccentColor?: string;
8
- opacity?: number;
9
- animationSpeed?: number;
10
- }
11
- export declare const WreathLogo: React.FC<WreathLogoProps>;
12
- export {};