@principal-ai/logo-component 0.1.21 → 0.1.23
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/FileCityLogoAnimated.d.ts +6 -4
- package/dist/FileCityLogoAnimated.js +99 -39
- 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/esm/FileCityLogoAnimated.js +99 -39
- package/dist/esm/TrailCityBanner.js +353 -0
- package/dist/esm/TrailCityProgress.js +120 -0
- package/dist/esm/TrailMarketingBanner.js +458 -0
- package/dist/esm/index.js +3 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +3 -0
- package/dist/index.js +7 -1
- package/package.json +3 -2
|
@@ -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
|
|
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
|
|
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
|
|
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 =
|
|
63
|
-
|
|
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
|
|
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 () =>
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
react_1.default.createElement("
|
|
222
|
-
|
|
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;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Theme } from '@principal-ade/industry-theme';
|
|
3
|
+
/**
|
|
4
|
+
* Banner-native sibling of {@link TrailCityDiagram}.
|
|
5
|
+
*
|
|
6
|
+
* Same visual DNA — a seeded top-down city of file "buildings" with a dashed
|
|
7
|
+
* trail threading numbered markers — but composed for wide, short social
|
|
8
|
+
* banners instead of a 700×700 square:
|
|
9
|
+
* • the city is a wide strip whose column/row count derives from the frame,
|
|
10
|
+
* • the trail runs left→right with a gentle wave,
|
|
11
|
+
* • the left edge fades out to reserve room for a platform logo / wordmark,
|
|
12
|
+
* • the tall 280×200 snippet card is replaced by a compact code chip.
|
|
13
|
+
*
|
|
14
|
+
* Presets target the two surfaces we ship:
|
|
15
|
+
* • twitterHeader — 1500 × 500 (3:1)
|
|
16
|
+
* • linkedinCompany — 1128 × 191 (~5.9:1)
|
|
17
|
+
*/
|
|
18
|
+
export type BannerVariant = 'twitterHeader' | 'linkedinCompany' | 'linkedinProfile';
|
|
19
|
+
export interface TrailCityBannerProps {
|
|
20
|
+
/** Theme supplying colors. Falls back to dark-mode defaults when absent. */
|
|
21
|
+
theme?: Theme;
|
|
22
|
+
/** Class applied to the wrapping <svg>. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Preset surface. Ignored for sizing if width/height are both given. */
|
|
25
|
+
variant?: BannerVariant;
|
|
26
|
+
/** Override the native frame width (defaults to the variant). */
|
|
27
|
+
width?: number;
|
|
28
|
+
/** Override the native frame height (defaults to the variant). */
|
|
29
|
+
height?: number;
|
|
30
|
+
/** Deterministic layout seed — change it to reshuffle the skyline. */
|
|
31
|
+
seed?: number;
|
|
32
|
+
/** Keep the left portion clear of the trail/markers so a logo or wordmark
|
|
33
|
+
* can overlay there. (No visual fade — just shifts where the trail starts.) */
|
|
34
|
+
reserveLeft?: boolean;
|
|
35
|
+
/** Show the dashed trail + numbered markers. */
|
|
36
|
+
showTrail?: boolean;
|
|
37
|
+
/** Show the compact code chip near the focal marker. Defaults per variant. */
|
|
38
|
+
showChip?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Which marker (1-based) the code chip's leader connects to — also the
|
|
41
|
+
* highlighted/active marker. Defaults to 2.
|
|
42
|
+
*/
|
|
43
|
+
leaderMarker?: number;
|
|
44
|
+
/**
|
|
45
|
+
* When set, the banner drops the random skyline + trail and instead spells
|
|
46
|
+
* this text *out of the city* — primary-colored "buildings" forming the
|
|
47
|
+
* letters against the muted city, the wide-banner sibling of
|
|
48
|
+
* {@link FileCityLogo}'s `mark="P"`. Rendered uppercase, single baseline,
|
|
49
|
+
* centered with a vertical letterbox of city.
|
|
50
|
+
*/
|
|
51
|
+
wordmark?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function TrailCityBanner({ theme, className, variant, width, height, seed, reserveLeft, showTrail, showChip, leaderMarker, wordmark, }: TrailCityBannerProps): React.JSX.Element;
|