@principal-ai/logo-component 0.1.20 → 0.1.22

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.
@@ -146,12 +146,13 @@ opacity = 0.9, gloss = false, squareRadius = 0, }) {
146
146
  // The city tiles stay deliberately muted (low alpha) so the vivid,
147
147
  // full-strength `markPalette` P reads as the figure against this faded
148
148
  // "film" of buildings — that contrast is the whole point of the mark.
149
+ // These match the mobile port's values, which read correctly.
149
150
  const palette = [
150
- withAlpha(primaryColor, 0.36),
151
- withAlpha(primaryColor, 0.55),
152
- withAlpha(baseColor, 0.18),
153
- withAlpha(baseColor, 0.3),
154
- withAlpha(baseColor, 0.45),
151
+ withAlpha(primaryColor, 0.18),
152
+ withAlpha(primaryColor, 0.32),
153
+ withAlpha(baseColor, 0.08),
154
+ withAlpha(baseColor, 0.14),
155
+ withAlpha(baseColor, 0.22),
155
156
  ];
156
157
  // The mark files vary in shade so the letter doesn't read as one flat
157
158
  // block, but every shade stays vivid so it still stands out from the
@@ -4,13 +4,13 @@ export interface FileCityLogoAnimatedProps extends FileCityLogoProps {
4
4
  /**
5
5
  * Min / max number of cells in each group. The cells in a group reveal
6
6
  * one at a time (`cellMs` apart); then the build holds for `pauseMs`
7
- * before the next group. Default 3–6.
7
+ * before the next group. Default 5–10.
8
8
  */
9
9
  batchMin?: number;
10
10
  batchMax?: number;
11
- /** Milliseconds between cells within a group. Default 130. */
11
+ /** Milliseconds between cells within a group. Default 185. */
12
12
  cellMs?: number;
13
- /** Milliseconds to hold after a group completes, before the next. Default 700. */
13
+ /** Milliseconds to hold after a group completes, before the next. Default 900. */
14
14
  pauseMs?: number;
15
15
  /**
16
16
  * Draw a connector line threading the cells of the active group in reveal
@@ -23,7 +23,9 @@ export interface FileCityLogoAnimatedProps extends FileCityLogoProps {
23
23
  /**
24
24
  * How many samples a full-weight (letter) cell needs before it reaches
25
25
  * full intensity. City files need proportionally fewer (by their lower
26
- * weight), so the letter builds up gradually while the city pops in. */
26
+ * weight), so the letter builds up gradually while the city pops in.
27
+ * Default 1 — every square is touched exactly once and pops to full.
28
+ * Raise it (e.g. 3) for the gradual heatmap build-up. */
27
29
  buildSteps?: number;
28
30
  /** Start playing on mount. Default true. */
29
31
  autoPlay?: boolean;
@@ -40,6 +40,10 @@ const FileCityLogo_1 = require("./FileCityLogo");
40
40
  // element remount (unlike SMIL's document-timeline `begin`), so each group's
41
41
  // freshly-keyed connector draws from the start.
42
42
  const CONN_DRAW = 'fc-conn-draw';
43
+ // Node dots pop in (scale + fade) as the trail reaches each one.
44
+ const DOT_POP = 'fc-dot-pop';
45
+ // Once resolved, a soft sheen sweeps diagonally across the mark.
46
+ const SHEEN = 'fc-sheen';
43
47
  function mulberry32(seed) {
44
48
  let t = seed;
45
49
  return () => {
@@ -57,10 +61,13 @@ function mulberry32(seed) {
57
61
  * quickly. Once the summed weights fill in, the logo holds on screen.
58
62
  */
59
63
  const FileCityLogoAnimated = (props) => {
60
- var _a, _b, _c, _d, _e, _f;
64
+ var _a, _b, _c, _d, _e, _f, _g;
61
65
  const uid = (0, react_1.useId)().replace(/:/g, '');
62
- const { width = 150, height = 150, batchMin = 3, batchMax = 6, cellMs = 130, pauseMs = 700, buildSteps = 3, connectors = true, connectorColor, autoPlay = true, playKey, onComplete, } = props;
63
- 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';
66
+ const { width = 150, height = 150, batchMin = 5, batchMax = 10, cellMs = 185, pauseMs = 900, buildSteps = 1, connectors = true, connectorColor, autoPlay = true, playKey, onComplete, } = props;
67
+ // The trail line is a light grey (close to white); the nodes it threads
68
+ // to are marked with accent-colored dots so the destinations pop.
69
+ const trailColor = connectorColor !== null && connectorColor !== void 0 ? connectorColor : '#e5e7eb';
70
+ const dotColor = (_f = (_d = (_c = (_a = 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';
64
71
  const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = (0, react_1.useMemo)(() => (0, FileCityLogo_1.computeFileCityLayout)(props),
65
72
  // Re-derive only when an input that affects layout changes.
66
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -140,6 +147,10 @@ const FileCityLogoAnimated = (props) => {
140
147
  return;
141
148
  }
142
149
  let timer;
150
+ let fadeTimer;
151
+ // Hold the finished trail on screen before it fades, so the completed
152
+ // group lingers a beat. Keep linger + fade within the pause.
153
+ const lingerMs = Math.max(0, Math.min(pauseMs - fadeMs - 40, 450));
143
154
  // Reveal one cell per step. Within a group the steps are `cellMs`
144
155
  // apart; finishing a group schedules the next one after `pauseMs`.
145
156
  const step = () => {
@@ -159,13 +170,13 @@ const FileCityLogoAnimated = (props) => {
159
170
  return next;
160
171
  });
161
172
  const lastInGroup = mi + 1 >= group.length;
162
- // Start the connector drawing on when the group begins; once it's
163
- // complete, flip to fading so it dissolves through the pause.
173
+ // Start the connector drawing on when the group begins.
164
174
  if (mi === 0)
165
175
  setConn({ group: gi, fading: false });
166
- if (lastInGroup)
167
- setConn({ group: gi, fading: true });
168
176
  if (lastInGroup) {
177
+ // The trail is fully drawn — hold it for `lingerMs`, then flip to
178
+ // fading so it dissolves before the next group begins.
179
+ fadeTimer = setTimeout(() => setConn({ group: gi, fading: true }), lingerMs);
169
180
  groupRef.current = gi + 1;
170
181
  memberRef.current = 0;
171
182
  timer = setTimeout(step, pauseMs);
@@ -176,7 +187,10 @@ const FileCityLogoAnimated = (props) => {
176
187
  }
177
188
  };
178
189
  timer = setTimeout(step, cellMs);
179
- return () => clearTimeout(timer);
190
+ return () => {
191
+ clearTimeout(timer);
192
+ clearTimeout(fadeTimer);
193
+ };
180
194
  // eslint-disable-next-line react-hooks/exhaustive-deps
181
195
  }, [cells, groups, stepsFor, cellMs, pauseMs, autoPlay, playKey]);
182
196
  // Easing for the per-cell fill-in so each sample lands softly.
@@ -190,43 +204,89 @@ const FileCityLogoAnimated = (props) => {
190
204
  y: cells[idx].y + cells[idx].sq / 2,
191
205
  });
192
206
  const connGroup = conn ? groups[conn.group] : null;
207
+ // Build a gently-curved path through the node centers (Catmull-Rom →
208
+ // cubic Béziers). It still passes exactly through every dot, just with a
209
+ // soft bend between them instead of straight segments. `k` is the curve
210
+ // strength — small keeps it subtle.
211
+ const smoothPath = (pts) => {
212
+ var _a, _b;
213
+ if (pts.length < 2)
214
+ return null;
215
+ if (pts.length === 2)
216
+ return `M ${pts[0].x} ${pts[0].y} L ${pts[1].x} ${pts[1].y}`;
217
+ const k = 0.2;
218
+ let d = `M ${pts[0].x} ${pts[0].y}`;
219
+ for (let i = 0; i < pts.length - 1; i++) {
220
+ const p0 = (_a = pts[i - 1]) !== null && _a !== void 0 ? _a : pts[i];
221
+ const p1 = pts[i];
222
+ const p2 = pts[i + 1];
223
+ const p3 = (_b = pts[i + 2]) !== null && _b !== void 0 ? _b : p2;
224
+ const cp1x = p1.x + (p2.x - p0.x) * k;
225
+ const cp1y = p1.y + (p2.y - p0.y) * k;
226
+ const cp2x = p2.x - (p3.x - p1.x) * k;
227
+ const cp2y = p2.y - (p3.y - p1.y) * k;
228
+ d += ` C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`;
229
+ }
230
+ return d;
231
+ };
193
232
  const connectorPath = connGroup && connGroup.length > 1
194
- ? connGroup
195
- .map((idx, i) => {
196
- const p = centerOf(idx);
197
- return `${i ? 'L' : 'M'} ${p.x} ${p.y}`;
198
- })
199
- .join(' ')
233
+ ? smoothPath(connGroup.map((idx) => centerOf(idx)))
200
234
  : null;
201
235
  // Draw the trail on across the group's reveal (so the line reaches each
202
236
  // cell about as it lights up); fade should finish inside the pause.
203
237
  const drawMs = connGroup ? Math.max(cellMs, (connGroup.length - 1) * cellMs) : 0;
204
238
  const fadeMs = Math.max(120, Math.min(pauseMs - 60, 360));
239
+ // One cell as a <rect>.
240
+ const renderCell = (cell, i) => {
241
+ const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
242
+ if (reveal <= 0)
243
+ return null;
244
+ return (react_1.default.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 }));
245
+ };
246
+ const showTrail = connectors && connectorPath && conn && !done;
247
+ const fadeStyle = {
248
+ transition: `opacity ${fadeMs}ms ease`,
249
+ opacity: (conn === null || conn === void 0 ? void 0 : conn.fading) ? 0 : 1,
250
+ };
251
+ const maskId = `conn-mask-${uid}-${(_g = conn === null || conn === void 0 ? void 0 : conn.group) !== null && _g !== void 0 ? _g : 0}`;
252
+ const lineW = Math.max(0.6, sq * 0.12);
253
+ const dotR = Math.max(1.4, sq * 0.27);
254
+ const segCount = connGroup ? connGroup.length - 1 : 0;
255
+ // The trail line (drawn-on dashed path) on its own layer.
256
+ const trailLine = showTrail ? (react_1.default.createElement("g", { key: `conn-line-${conn.group}`, style: fadeStyle },
257
+ react_1.default.createElement("style", null, `@keyframes ${CONN_DRAW}{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}@keyframes ${DOT_POP}{from{opacity:0;transform:scale(0.2)}to{opacity:1;transform:scale(1)}}`),
258
+ react_1.default.createElement("defs", null,
259
+ react_1.default.createElement("mask", { id: maskId, maskUnits: "userSpaceOnUse" },
260
+ react_1.default.createElement("path", { d: connectorPath, fill: "none", stroke: "#fff", strokeWidth: lineW * 2.6, strokeLinecap: "round", strokeLinejoin: "round", pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1, style: { animation: `${CONN_DRAW} ${drawMs}ms linear forwards` } }))),
261
+ react_1.default.createElement("path", { d: connectorPath, fill: "none", stroke: trailColor, strokeWidth: lineW, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${sq * 0.18} ${sq * 0.14}`, mask: `url(#${maskId})`, opacity: 0.9 }))) : null;
262
+ // The accent node-dots — always the topmost trail layer so they read as
263
+ // markers even when the line tucks behind the blocks.
264
+ const trailDots = showTrail ? (react_1.default.createElement("g", { key: `conn-dots-${conn.group}`, style: fadeStyle }, connGroup.map((idx, i) => {
265
+ const p = centerOf(idx);
266
+ const delay = segCount > 0 ? (i / segCount) * drawMs : 0;
267
+ return (react_1.default.createElement("circle", { key: `dot-${idx}-${i}`, cx: p.x, cy: p.y, r: dotR, fill: dotColor, style: {
268
+ transformBox: 'fill-box',
269
+ transformOrigin: 'center',
270
+ animation: `${DOT_POP} 220ms ease-out ${delay}ms both`,
271
+ } }));
272
+ }))) : null;
205
273
  return (react_1.default.createElement(FileCityLogo_1.FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: (0, FileCityLogo_1.fileCityLabel)(mark) },
206
- cells.map((cell, i) => {
207
- const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
208
- if (reveal <= 0)
209
- return null;
210
- return (react_1.default.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 }));
211
- }),
212
- connectors && connectorPath && conn && !done ? (
213
- // The trail is a dashed (dotted) path, revealed progressively by a
214
- // mask: a solid line draws itself on (stroke-dashoffset 1 → 0 with
215
- // pathLength normalized to 1), uncovering the dots block by block as
216
- // the trail extends.
217
- (() => {
218
- const maskId = `conn-mask-${uid}-${conn.group}`;
219
- const w = Math.max(0.6, sq * 0.12);
220
- return (react_1.default.createElement("g", { key: `conn-${conn.group}` },
221
- react_1.default.createElement("style", null, `@keyframes ${CONN_DRAW}{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}`),
222
- react_1.default.createElement("defs", null,
223
- react_1.default.createElement("mask", { id: maskId, maskUnits: "userSpaceOnUse" },
224
- react_1.default.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` } }))),
225
- react_1.default.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: {
226
- transition: `opacity ${fadeMs}ms ease`,
227
- opacity: conn.fading ? 0 : 0.9,
228
- } })));
229
- })()) : null,
230
- done ? extras : null));
274
+ cells.map((cell, i) => renderCell(cell, i)),
275
+ trailLine,
276
+ trailDots,
277
+ done ? extras : null,
278
+ done ? (react_1.default.createElement(react_1.default.Fragment, null,
279
+ react_1.default.createElement("style", null, `@keyframes ${SHEEN}{from{transform:translateX(-120px)}to{transform:translateX(120px)}}`),
280
+ react_1.default.createElement("defs", null,
281
+ react_1.default.createElement("clipPath", { id: `sheen-clip-${uid}` }, cells.map((cell) => (react_1.default.createElement("rect", { key: cell.key, x: cell.x, y: cell.y, width: cell.sq, height: cell.sq, rx: cell.rx })))),
282
+ react_1.default.createElement("linearGradient", { id: `sheen-grad-${uid}`, x1: "0", y1: "0", x2: "1", y2: "1" },
283
+ react_1.default.createElement("stop", { offset: "0%", stopColor: "#fff", stopOpacity: 0 }),
284
+ react_1.default.createElement("stop", { offset: "42%", stopColor: "#fff", stopOpacity: 0 }),
285
+ react_1.default.createElement("stop", { offset: "50%", stopColor: "#fff", stopOpacity: 0.5 }),
286
+ react_1.default.createElement("stop", { offset: "58%", stopColor: "#fff", stopOpacity: 0 }),
287
+ react_1.default.createElement("stop", { offset: "100%", stopColor: "#fff", stopOpacity: 0 }))),
288
+ react_1.default.createElement("g", { clipPath: `url(#sheen-clip-${uid})`, style: { pointerEvents: 'none' } },
289
+ react_1.default.createElement("g", { style: { animation: `${SHEEN} 1.1s ease-in-out forwards` } },
290
+ react_1.default.createElement("rect", { x: -20, y: -20, width: 140, height: 140, fill: `url(#sheen-grad-${uid})` }))))) : null));
231
291
  };
232
292
  exports.FileCityLogoAnimated = FileCityLogoAnimated;
@@ -108,12 +108,13 @@ opacity = 0.9, gloss = false, squareRadius = 0, }) {
108
108
  // The city tiles stay deliberately muted (low alpha) so the vivid,
109
109
  // full-strength `markPalette` P reads as the figure against this faded
110
110
  // "film" of buildings — that contrast is the whole point of the mark.
111
+ // These match the mobile port's values, which read correctly.
111
112
  const palette = [
112
- withAlpha(primaryColor, 0.36),
113
- withAlpha(primaryColor, 0.55),
114
- withAlpha(baseColor, 0.18),
115
- withAlpha(baseColor, 0.3),
116
- withAlpha(baseColor, 0.45),
113
+ withAlpha(primaryColor, 0.18),
114
+ withAlpha(primaryColor, 0.32),
115
+ withAlpha(baseColor, 0.08),
116
+ withAlpha(baseColor, 0.14),
117
+ withAlpha(baseColor, 0.22),
117
118
  ];
118
119
  // The mark files vary in shade so the letter doesn't read as one flat
119
120
  // block, but every shade stays vivid so it still stands out from the
@@ -4,6 +4,10 @@ import { computeFileCityLayout, fileCityLabel, FileCityPanel, } from './FileCity
4
4
  // element remount (unlike SMIL's document-timeline `begin`), so each group's
5
5
  // freshly-keyed connector draws from the start.
6
6
  const CONN_DRAW = 'fc-conn-draw';
7
+ // Node dots pop in (scale + fade) as the trail reaches each one.
8
+ const DOT_POP = 'fc-dot-pop';
9
+ // Once resolved, a soft sheen sweeps diagonally across the mark.
10
+ const SHEEN = 'fc-sheen';
7
11
  function mulberry32(seed) {
8
12
  let t = seed;
9
13
  return () => {
@@ -21,10 +25,13 @@ function mulberry32(seed) {
21
25
  * quickly. Once the summed weights fill in, the logo holds on screen.
22
26
  */
23
27
  export const FileCityLogoAnimated = (props) => {
24
- var _a, _b, _c, _d, _e, _f;
28
+ var _a, _b, _c, _d, _e, _f, _g;
25
29
  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';
30
+ const { width = 150, height = 150, batchMin = 5, batchMax = 10, cellMs = 185, pauseMs = 900, buildSteps = 1, connectors = true, connectorColor, autoPlay = true, playKey, onComplete, } = props;
31
+ // The trail line is a light grey (close to white); the nodes it threads
32
+ // to are marked with accent-colored dots so the destinations pop.
33
+ const trailColor = connectorColor !== null && connectorColor !== void 0 ? connectorColor : '#e5e7eb';
34
+ const dotColor = (_f = (_d = (_c = (_a = 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
35
  const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = useMemo(() => computeFileCityLayout(props),
29
36
  // Re-derive only when an input that affects layout changes.
30
37
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -104,6 +111,10 @@ export const FileCityLogoAnimated = (props) => {
104
111
  return;
105
112
  }
106
113
  let timer;
114
+ let fadeTimer;
115
+ // Hold the finished trail on screen before it fades, so the completed
116
+ // group lingers a beat. Keep linger + fade within the pause.
117
+ const lingerMs = Math.max(0, Math.min(pauseMs - fadeMs - 40, 450));
107
118
  // Reveal one cell per step. Within a group the steps are `cellMs`
108
119
  // apart; finishing a group schedules the next one after `pauseMs`.
109
120
  const step = () => {
@@ -123,13 +134,13 @@ export const FileCityLogoAnimated = (props) => {
123
134
  return next;
124
135
  });
125
136
  const lastInGroup = mi + 1 >= group.length;
126
- // Start the connector drawing on when the group begins; once it's
127
- // complete, flip to fading so it dissolves through the pause.
137
+ // Start the connector drawing on when the group begins.
128
138
  if (mi === 0)
129
139
  setConn({ group: gi, fading: false });
130
- if (lastInGroup)
131
- setConn({ group: gi, fading: true });
132
140
  if (lastInGroup) {
141
+ // The trail is fully drawn — hold it for `lingerMs`, then flip to
142
+ // fading so it dissolves before the next group begins.
143
+ fadeTimer = setTimeout(() => setConn({ group: gi, fading: true }), lingerMs);
133
144
  groupRef.current = gi + 1;
134
145
  memberRef.current = 0;
135
146
  timer = setTimeout(step, pauseMs);
@@ -140,7 +151,10 @@ export const FileCityLogoAnimated = (props) => {
140
151
  }
141
152
  };
142
153
  timer = setTimeout(step, cellMs);
143
- return () => clearTimeout(timer);
154
+ return () => {
155
+ clearTimeout(timer);
156
+ clearTimeout(fadeTimer);
157
+ };
144
158
  // eslint-disable-next-line react-hooks/exhaustive-deps
145
159
  }, [cells, groups, stepsFor, cellMs, pauseMs, autoPlay, playKey]);
146
160
  // Easing for the per-cell fill-in so each sample lands softly.
@@ -154,42 +168,88 @@ export const FileCityLogoAnimated = (props) => {
154
168
  y: cells[idx].y + cells[idx].sq / 2,
155
169
  });
156
170
  const connGroup = conn ? groups[conn.group] : null;
171
+ // Build a gently-curved path through the node centers (Catmull-Rom →
172
+ // cubic Béziers). It still passes exactly through every dot, just with a
173
+ // soft bend between them instead of straight segments. `k` is the curve
174
+ // strength — small keeps it subtle.
175
+ const smoothPath = (pts) => {
176
+ var _a, _b;
177
+ if (pts.length < 2)
178
+ return null;
179
+ if (pts.length === 2)
180
+ return `M ${pts[0].x} ${pts[0].y} L ${pts[1].x} ${pts[1].y}`;
181
+ const k = 0.2;
182
+ let d = `M ${pts[0].x} ${pts[0].y}`;
183
+ for (let i = 0; i < pts.length - 1; i++) {
184
+ const p0 = (_a = pts[i - 1]) !== null && _a !== void 0 ? _a : pts[i];
185
+ const p1 = pts[i];
186
+ const p2 = pts[i + 1];
187
+ const p3 = (_b = pts[i + 2]) !== null && _b !== void 0 ? _b : p2;
188
+ const cp1x = p1.x + (p2.x - p0.x) * k;
189
+ const cp1y = p1.y + (p2.y - p0.y) * k;
190
+ const cp2x = p2.x - (p3.x - p1.x) * k;
191
+ const cp2y = p2.y - (p3.y - p1.y) * k;
192
+ d += ` C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`;
193
+ }
194
+ return d;
195
+ };
157
196
  const connectorPath = connGroup && connGroup.length > 1
158
- ? connGroup
159
- .map((idx, i) => {
160
- const p = centerOf(idx);
161
- return `${i ? 'L' : 'M'} ${p.x} ${p.y}`;
162
- })
163
- .join(' ')
197
+ ? smoothPath(connGroup.map((idx) => centerOf(idx)))
164
198
  : null;
165
199
  // Draw the trail on across the group's reveal (so the line reaches each
166
200
  // cell about as it lights up); fade should finish inside the pause.
167
201
  const drawMs = connGroup ? Math.max(cellMs, (connGroup.length - 1) * cellMs) : 0;
168
202
  const fadeMs = Math.max(120, Math.min(pauseMs - 60, 360));
203
+ // One cell as a <rect>.
204
+ const renderCell = (cell, i) => {
205
+ const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
206
+ if (reveal <= 0)
207
+ return null;
208
+ 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 }));
209
+ };
210
+ const showTrail = connectors && connectorPath && conn && !done;
211
+ const fadeStyle = {
212
+ transition: `opacity ${fadeMs}ms ease`,
213
+ opacity: (conn === null || conn === void 0 ? void 0 : conn.fading) ? 0 : 1,
214
+ };
215
+ const maskId = `conn-mask-${uid}-${(_g = conn === null || conn === void 0 ? void 0 : conn.group) !== null && _g !== void 0 ? _g : 0}`;
216
+ const lineW = Math.max(0.6, sq * 0.12);
217
+ const dotR = Math.max(1.4, sq * 0.27);
218
+ const segCount = connGroup ? connGroup.length - 1 : 0;
219
+ // The trail line (drawn-on dashed path) on its own layer.
220
+ const trailLine = showTrail ? (React.createElement("g", { key: `conn-line-${conn.group}`, style: fadeStyle },
221
+ React.createElement("style", null, `@keyframes ${CONN_DRAW}{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}@keyframes ${DOT_POP}{from{opacity:0;transform:scale(0.2)}to{opacity:1;transform:scale(1)}}`),
222
+ React.createElement("defs", null,
223
+ React.createElement("mask", { id: maskId, maskUnits: "userSpaceOnUse" },
224
+ React.createElement("path", { d: connectorPath, fill: "none", stroke: "#fff", strokeWidth: lineW * 2.6, strokeLinecap: "round", strokeLinejoin: "round", pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1, style: { animation: `${CONN_DRAW} ${drawMs}ms linear forwards` } }))),
225
+ React.createElement("path", { d: connectorPath, fill: "none", stroke: trailColor, strokeWidth: lineW, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${sq * 0.18} ${sq * 0.14}`, mask: `url(#${maskId})`, opacity: 0.9 }))) : null;
226
+ // The accent node-dots — always the topmost trail layer so they read as
227
+ // markers even when the line tucks behind the blocks.
228
+ const trailDots = showTrail ? (React.createElement("g", { key: `conn-dots-${conn.group}`, style: fadeStyle }, connGroup.map((idx, i) => {
229
+ const p = centerOf(idx);
230
+ const delay = segCount > 0 ? (i / segCount) * drawMs : 0;
231
+ return (React.createElement("circle", { key: `dot-${idx}-${i}`, cx: p.x, cy: p.y, r: dotR, fill: dotColor, style: {
232
+ transformBox: 'fill-box',
233
+ transformOrigin: 'center',
234
+ animation: `${DOT_POP} 220ms ease-out ${delay}ms both`,
235
+ } }));
236
+ }))) : null;
169
237
  return (React.createElement(FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: fileCityLabel(mark) },
170
- cells.map((cell, i) => {
171
- const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
172
- if (reveal <= 0)
173
- return null;
174
- 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 }));
175
- }),
176
- connectors && connectorPath && conn && !done ? (
177
- // The trail is a dashed (dotted) path, revealed progressively by a
178
- // mask: a solid line draws itself on (stroke-dashoffset 1 → 0 with
179
- // pathLength normalized to 1), uncovering the dots block by block as
180
- // the trail extends.
181
- (() => {
182
- const maskId = `conn-mask-${uid}-${conn.group}`;
183
- const w = Math.max(0.6, sq * 0.12);
184
- return (React.createElement("g", { key: `conn-${conn.group}` },
185
- React.createElement("style", null, `@keyframes ${CONN_DRAW}{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}`),
186
- React.createElement("defs", null,
187
- React.createElement("mask", { id: maskId, maskUnits: "userSpaceOnUse" },
188
- 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` } }))),
189
- 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: {
190
- transition: `opacity ${fadeMs}ms ease`,
191
- opacity: conn.fading ? 0 : 0.9,
192
- } })));
193
- })()) : null,
194
- done ? extras : null));
238
+ cells.map((cell, i) => renderCell(cell, i)),
239
+ trailLine,
240
+ trailDots,
241
+ done ? extras : null,
242
+ done ? (React.createElement(React.Fragment, null,
243
+ React.createElement("style", null, `@keyframes ${SHEEN}{from{transform:translateX(-120px)}to{transform:translateX(120px)}}`),
244
+ React.createElement("defs", null,
245
+ React.createElement("clipPath", { id: `sheen-clip-${uid}` }, cells.map((cell) => (React.createElement("rect", { key: cell.key, x: cell.x, y: cell.y, width: cell.sq, height: cell.sq, rx: cell.rx })))),
246
+ React.createElement("linearGradient", { id: `sheen-grad-${uid}`, x1: "0", y1: "0", x2: "1", y2: "1" },
247
+ React.createElement("stop", { offset: "0%", stopColor: "#fff", stopOpacity: 0 }),
248
+ React.createElement("stop", { offset: "42%", stopColor: "#fff", stopOpacity: 0 }),
249
+ React.createElement("stop", { offset: "50%", stopColor: "#fff", stopOpacity: 0.5 }),
250
+ React.createElement("stop", { offset: "58%", stopColor: "#fff", stopOpacity: 0 }),
251
+ React.createElement("stop", { offset: "100%", stopColor: "#fff", stopOpacity: 0 }))),
252
+ React.createElement("g", { clipPath: `url(#sheen-clip-${uid})`, style: { pointerEvents: 'none' } },
253
+ React.createElement("g", { style: { animation: `${SHEEN} 1.1s ease-in-out forwards` } },
254
+ React.createElement("rect", { x: -20, y: -20, width: 140, height: 140, fill: `url(#sheen-grad-${uid})` }))))) : null));
195
255
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/logo-component",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Principal AI brand logo and visualization components — animated wireframe sphere logo, FileCity grid mark, TrailCity diagram, and text-reveal effects",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",