@principal-ai/logo-component 0.1.18 → 0.1.20
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/FileCityLogo.d.ts +43 -3
- package/dist/FileCityLogo.js +50 -15
- package/dist/FileCityLogoAnimated.js +4 -2
- package/dist/TrailCityDiagram.js +6 -6
- package/dist/esm/FileCityLogo.js +50 -15
- package/dist/esm/FileCityLogoAnimated.js +4 -2
- package/dist/esm/TrailCityDiagram.js +6 -6
- package/dist/index.d.ts +1 -1
- package/package.json +9 -4
package/dist/FileCityLogo.d.ts
CHANGED
|
@@ -8,6 +8,28 @@ export type FileCityMark = 'P' | 'AI' | 'PAI' | 'lockup' | 'none';
|
|
|
8
8
|
* across the grid, dark → light.
|
|
9
9
|
*/
|
|
10
10
|
export type FileCityGradient = 'scatter' | 'vertical' | 'horizontal' | 'diagonal';
|
|
11
|
+
/**
|
|
12
|
+
* Which edge the imaginary light comes from for the glass sheen. The
|
|
13
|
+
* highlight is brightest at that edge and fades to clear across the panel;
|
|
14
|
+
* the optional glint sits in the corresponding corner.
|
|
15
|
+
*/
|
|
16
|
+
export type GlossSide = 'top' | 'top-left' | 'top-right' | 'left' | 'right';
|
|
17
|
+
/**
|
|
18
|
+
* Fine control over the glass sheen. All fields optional — `gloss={true}`
|
|
19
|
+
* is the same as `gloss={{}}` (a faint top-lit sheen).
|
|
20
|
+
*/
|
|
21
|
+
export interface GlossConfig {
|
|
22
|
+
/** Edge the light comes from. Default `'top-right'`. */
|
|
23
|
+
side?: GlossSide;
|
|
24
|
+
/** Peak white opacity at the lit edge. ~0.09 = faint, ~0.2 = shiny. Default 0.09. */
|
|
25
|
+
intensity?: number;
|
|
26
|
+
/** How far across the panel the highlight reaches before clearing (0–1). Default 0.46. */
|
|
27
|
+
spread?: number;
|
|
28
|
+
/** Add a concentrated specular hot-spot in the lit corner. Default false. */
|
|
29
|
+
glint?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** `true` = faint top sheen (defaults), an object = tuned sheen, `false` = flat. */
|
|
32
|
+
export type GlossOption = boolean | GlossConfig;
|
|
11
33
|
export interface FileCityLogoProps {
|
|
12
34
|
width?: number;
|
|
13
35
|
height?: number;
|
|
@@ -33,8 +55,11 @@ export interface FileCityLogoProps {
|
|
|
33
55
|
*/
|
|
34
56
|
color?: string;
|
|
35
57
|
/**
|
|
36
|
-
* Panel background behind the grid.
|
|
37
|
-
*
|
|
58
|
+
* Panel background behind the grid. Defaults to the theme's
|
|
59
|
+
* `backgroundSecondary` (falling back to `background`), so the icon
|
|
60
|
+
* sits on the panel/surface color rather than the page background. Pass
|
|
61
|
+
* `"transparent"` to drop the panel and let the mark sit directly on
|
|
62
|
+
* its surface.
|
|
38
63
|
*/
|
|
39
64
|
background?: string;
|
|
40
65
|
/**
|
|
@@ -62,6 +87,19 @@ export interface FileCityLogoProps {
|
|
|
62
87
|
gradient?: FileCityGradient;
|
|
63
88
|
/** Round the panel corners. Default true. */
|
|
64
89
|
rounded?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Corner radius of each building square, as a fraction of the square's
|
|
92
|
+
* side. `0` (default) gives sharp-cornered squares; raise it (e.g.
|
|
93
|
+
* `0.12`) for softly rounded tiles.
|
|
94
|
+
*/
|
|
95
|
+
squareRadius?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Lay a glass sheen over the panel so the icon reads a touch glossy.
|
|
98
|
+
* `false` (default) is flat; `true` is a faint top-lit sheen; pass a
|
|
99
|
+
* {@link GlossConfig} object to tune the light's direction, strength,
|
|
100
|
+
* spread, and whether it has a specular glint.
|
|
101
|
+
*/
|
|
102
|
+
gloss?: GlossOption;
|
|
65
103
|
/**
|
|
66
104
|
* Empty ring of city cells around the mark glyph, in cells. `1`
|
|
67
105
|
* (default) gives the mark breathing room; `0` packs the glyph
|
|
@@ -114,13 +152,14 @@ export interface FileCityLayout {
|
|
|
114
152
|
rounded: boolean;
|
|
115
153
|
opacity: number;
|
|
116
154
|
mark: FileCityMark;
|
|
155
|
+
gloss: GlossOption;
|
|
117
156
|
}
|
|
118
157
|
/**
|
|
119
158
|
* Compute the full layout (cells + overlays + palette) for a file-city
|
|
120
159
|
* mark from the public props. Pure — no hooks — so both the static and
|
|
121
160
|
* animated components can build their SVG from the identical cell list.
|
|
122
161
|
*/
|
|
123
|
-
export declare function computeFileCityLayout({ mark, primary, accent, color, background, theme, cells, highlight, trail, gradient, rounded, margin, aiCard, opacity, }: FileCityLogoProps): FileCityLayout;
|
|
162
|
+
export declare function computeFileCityLayout({ mark, primary, accent, color, background, theme, cells, highlight, trail, gradient, rounded, margin, aiCard, opacity, gloss, squareRadius, }: FileCityLogoProps): FileCityLayout;
|
|
124
163
|
/** Accessible label for a given mark, shared by both components. */
|
|
125
164
|
export declare function fileCityLabel(mark: FileCityMark): string;
|
|
126
165
|
/**
|
|
@@ -136,6 +175,7 @@ export declare const FileCityPanel: React.FC<{
|
|
|
136
175
|
rounded: boolean;
|
|
137
176
|
opacity: number;
|
|
138
177
|
label: string;
|
|
178
|
+
gloss?: GlossOption;
|
|
139
179
|
children: React.ReactNode;
|
|
140
180
|
}>;
|
|
141
181
|
/**
|
package/dist/FileCityLogo.js
CHANGED
|
@@ -132,19 +132,26 @@ function mix(a, b, t) {
|
|
|
132
132
|
* mark from the public props. Pure — no hooks — so both the static and
|
|
133
133
|
* animated components can build their SVG from the identical cell list.
|
|
134
134
|
*/
|
|
135
|
-
function computeFileCityLayout({ mark = 'P', primary, accent, color, background, theme, cells = 5, highlight = true, trail = false, gradient = 'diagonal', rounded = true, margin = 1, aiCard = false,
|
|
136
|
-
|
|
135
|
+
function computeFileCityLayout({ mark = 'P', primary, accent, color, background, theme, cells = 5, highlight = true, trail = false, gradient = 'diagonal', rounded = true, margin = 1, aiCard = false,
|
|
136
|
+
// Slight global translucency gives the mark a faded "film" quality and
|
|
137
|
+
// keeps the muted city from competing with the P. Restored after a
|
|
138
|
+
// brief de-haze experiment that made the city too present.
|
|
139
|
+
opacity = 0.9, gloss = false, squareRadius = 0, }) {
|
|
140
|
+
var _a, _b, _c, _d, _e;
|
|
137
141
|
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';
|
|
138
142
|
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;
|
|
139
143
|
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';
|
|
140
|
-
const bgColor = (_d = background !== null && background !== void 0 ? background : theme === null || theme === void 0 ? void 0 : theme.colors.
|
|
144
|
+
const bgColor = (_e = (_d = background !== null && background !== void 0 ? background : theme === null || theme === void 0 ? void 0 : theme.colors.backgroundSecondary) !== null && _d !== void 0 ? _d : theme === null || theme === void 0 ? void 0 : theme.colors.background) !== null && _e !== void 0 ? _e : '#0a0f14';
|
|
141
145
|
// Same palette weighting as TrailCityDiagram so the two read as a set.
|
|
146
|
+
// The city tiles stay deliberately muted (low alpha) so the vivid,
|
|
147
|
+
// full-strength `markPalette` P reads as the figure against this faded
|
|
148
|
+
// "film" of buildings — that contrast is the whole point of the mark.
|
|
142
149
|
const palette = [
|
|
143
|
-
withAlpha(primaryColor, 0.
|
|
144
|
-
withAlpha(primaryColor, 0.
|
|
145
|
-
withAlpha(baseColor, 0.
|
|
146
|
-
withAlpha(baseColor, 0.
|
|
147
|
-
withAlpha(baseColor, 0.
|
|
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),
|
|
148
155
|
];
|
|
149
156
|
// The mark files vary in shade so the letter doesn't read as one flat
|
|
150
157
|
// block, but every shade stays vivid so it still stands out from the
|
|
@@ -356,7 +363,7 @@ function computeFileCityLayout({ mark = 'P', primary, accent, color, background,
|
|
|
356
363
|
x,
|
|
357
364
|
y,
|
|
358
365
|
sq,
|
|
359
|
-
rx: Math.max(1, sq * 0
|
|
366
|
+
rx: squareRadius > 0 ? Math.max(1, sq * squareRadius) : 0,
|
|
360
367
|
fill: isLetter
|
|
361
368
|
? letterFill
|
|
362
369
|
: palette[Math.floor(colorRoll * palette.length)],
|
|
@@ -417,7 +424,7 @@ function computeFileCityLayout({ mark = 'P', primary, accent, color, background,
|
|
|
417
424
|
extras.push(react_1.default.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 }));
|
|
418
425
|
});
|
|
419
426
|
}
|
|
420
|
-
return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark };
|
|
427
|
+
return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark, gloss };
|
|
421
428
|
}
|
|
422
429
|
/** Accessible label for a given mark, shared by both components. */
|
|
423
430
|
function fileCityLabel(mark) {
|
|
@@ -430,15 +437,43 @@ function fileCityLabel(mark) {
|
|
|
430
437
|
* rounded background panel (clipping its children) and the edge hairline.
|
|
431
438
|
* `children` are the grid + overlays drawn inside the clip.
|
|
432
439
|
*/
|
|
433
|
-
const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, children }) => {
|
|
440
|
+
const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, gloss = false, children }) => {
|
|
434
441
|
const uid = (0, react_1.useId)().replace(/:/g, '');
|
|
442
|
+
// Normalize the gloss option → a config (or null when flat). `true`
|
|
443
|
+
// means "use all defaults"; an object overrides individual fields.
|
|
444
|
+
const g = gloss === false
|
|
445
|
+
? null
|
|
446
|
+
: Object.assign({ side: 'top-right', intensity: 0.09, spread: 0.46, glint: false }, (gloss === true ? {} : gloss));
|
|
447
|
+
// Light direction → linear-gradient endpoints (the lit edge is the
|
|
448
|
+
// start point) and the glint's corner, both in 0–1 object-bounding-box
|
|
449
|
+
// coordinates.
|
|
450
|
+
const GLOSS_DIRS = {
|
|
451
|
+
top: { x1: 0, y1: 0, x2: 0, y2: 1, gx: 0.5, gy: 0.05 },
|
|
452
|
+
'top-left': { x1: 0, y1: 0, x2: 1, y2: 1, gx: 0.22, gy: 0.08 },
|
|
453
|
+
'top-right': { x1: 1, y1: 0, x2: 0, y2: 1, gx: 0.78, gy: 0.08 },
|
|
454
|
+
left: { x1: 0, y1: 0, x2: 1, y2: 0, gx: 0.06, gy: 0.30 },
|
|
455
|
+
right: { x1: 1, y1: 0, x2: 0, y2: 0, gx: 0.94, gy: 0.30 },
|
|
456
|
+
};
|
|
457
|
+
const dir = g ? GLOSS_DIRS[g.side] : GLOSS_DIRS.top;
|
|
435
458
|
return (react_1.default.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 },
|
|
436
459
|
react_1.default.createElement("defs", null,
|
|
437
460
|
react_1.default.createElement("clipPath", { id: `panel-${uid}` },
|
|
438
|
-
react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 }))
|
|
461
|
+
react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 })),
|
|
462
|
+
g && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
463
|
+
react_1.default.createElement("linearGradient", { id: `gloss-top-${uid}`, x1: dir.x1, y1: dir.y1, x2: dir.x2, y2: dir.y2 },
|
|
464
|
+
react_1.default.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity }),
|
|
465
|
+
react_1.default.createElement("stop", { offset: `${g.spread * 60}%`, stopColor: "#ffffff", stopOpacity: g.intensity * 0.22 }),
|
|
466
|
+
react_1.default.createElement("stop", { offset: `${g.spread * 100}%`, stopColor: "#ffffff", stopOpacity: 0 })),
|
|
467
|
+
g.glint && (react_1.default.createElement("radialGradient", { id: `gloss-spec-${uid}`, cx: dir.gx, cy: dir.gy, r: 0.7 },
|
|
468
|
+
react_1.default.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity * 1.6 }),
|
|
469
|
+
react_1.default.createElement("stop", { offset: "55%", stopColor: "#ffffff", stopOpacity: g.intensity * 0.3 }),
|
|
470
|
+
react_1.default.createElement("stop", { offset: "100%", stopColor: "#ffffff", stopOpacity: 0 })))))),
|
|
439
471
|
react_1.default.createElement("g", { clipPath: `url(#panel-${uid})` },
|
|
440
472
|
react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: bgColor, rx: rounded ? PANEL_RADIUS : 0 }),
|
|
441
|
-
children
|
|
473
|
+
children,
|
|
474
|
+
g && (react_1.default.createElement("g", { style: { pointerEvents: 'none' } },
|
|
475
|
+
react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-top-${uid})` }),
|
|
476
|
+
g.glint && (react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-spec-${uid})` }))))),
|
|
442
477
|
react_1.default.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 })));
|
|
443
478
|
};
|
|
444
479
|
exports.FileCityPanel = FileCityPanel;
|
|
@@ -451,8 +486,8 @@ exports.FileCityPanel = FileCityPanel;
|
|
|
451
486
|
*/
|
|
452
487
|
const FileCityLogo = (props) => {
|
|
453
488
|
const { width = 150, height = 150 } = props;
|
|
454
|
-
const { cells, extras, bgColor, baseColor, rounded, opacity, mark } = computeFileCityLayout(props);
|
|
455
|
-
return (react_1.default.createElement(exports.FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, label: fileCityLabel(mark) },
|
|
489
|
+
const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = computeFileCityLayout(props);
|
|
490
|
+
return (react_1.default.createElement(exports.FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: fileCityLabel(mark) },
|
|
456
491
|
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, fill: cell.fill, stroke: cell.stroke, strokeWidth: cell.strokeWidth }))),
|
|
457
492
|
extras));
|
|
458
493
|
};
|
|
@@ -61,7 +61,7 @@ const FileCityLogoAnimated = (props) => {
|
|
|
61
61
|
const uid = (0, react_1.useId)().replace(/:/g, '');
|
|
62
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
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';
|
|
64
|
-
const { cells, extras, bgColor, baseColor, rounded, opacity, mark } = (0, react_1.useMemo)(() => (0, FileCityLogo_1.computeFileCityLayout)(props),
|
|
64
|
+
const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = (0, react_1.useMemo)(() => (0, FileCityLogo_1.computeFileCityLayout)(props),
|
|
65
65
|
// Re-derive only when an input that affects layout changes.
|
|
66
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
67
|
[
|
|
@@ -79,6 +79,8 @@ const FileCityLogoAnimated = (props) => {
|
|
|
79
79
|
props.margin,
|
|
80
80
|
props.aiCard,
|
|
81
81
|
props.opacity,
|
|
82
|
+
props.gloss,
|
|
83
|
+
props.squareRadius,
|
|
82
84
|
]);
|
|
83
85
|
// Per-cell number of samples to fully reveal it (>=1; letter cells take
|
|
84
86
|
// `buildSteps`, city cells proportionally fewer by their weight).
|
|
@@ -200,7 +202,7 @@ const FileCityLogoAnimated = (props) => {
|
|
|
200
202
|
// cell about as it lights up); fade should finish inside the pause.
|
|
201
203
|
const drawMs = connGroup ? Math.max(cellMs, (connGroup.length - 1) * cellMs) : 0;
|
|
202
204
|
const fadeMs = Math.max(120, Math.min(pauseMs - 60, 360));
|
|
203
|
-
return (react_1.default.createElement(FileCityLogo_1.FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, label: (0, FileCityLogo_1.fileCityLabel)(mark) },
|
|
205
|
+
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) },
|
|
204
206
|
cells.map((cell, i) => {
|
|
205
207
|
const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
|
|
206
208
|
if (reveal <= 0)
|
package/dist/TrailCityDiagram.js
CHANGED
|
@@ -140,11 +140,11 @@ function TrailCityDiagram({ theme, className, hideSnippet = false, snippetVisibl
|
|
|
140
140
|
// reads cleanly against the dark city.
|
|
141
141
|
const silver = '#d1d8e0';
|
|
142
142
|
const palette = (0, react_1.useMemo)(() => [
|
|
143
|
-
withAlpha(accent, 0.
|
|
144
|
-
withAlpha(accent, 0.
|
|
145
|
-
withAlpha(text, 0.
|
|
146
|
-
withAlpha(text, 0.
|
|
147
|
-
withAlpha(text, 0.
|
|
143
|
+
withAlpha(accent, 0.36),
|
|
144
|
+
withAlpha(accent, 0.55),
|
|
145
|
+
withAlpha(text, 0.18),
|
|
146
|
+
withAlpha(text, 0.3),
|
|
147
|
+
withAlpha(text, 0.45),
|
|
148
148
|
], [accent, text]);
|
|
149
149
|
const markerCells = (0, react_1.useMemo)(() => [
|
|
150
150
|
{ col: 1, row: 10, label: '1' },
|
|
@@ -176,7 +176,7 @@ function TrailCityDiagram({ theme, className, hideSnippet = false, snippetVisibl
|
|
|
176
176
|
react_1.default.createElement("stop", { offset: "100%", stopColor: bg, stopOpacity: 0.7 }))),
|
|
177
177
|
react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW_W, height: VIEW_H, fill: bg, rx: 12 }),
|
|
178
178
|
react_1.default.createElement("g", { style: {
|
|
179
|
-
opacity: highlightTrail ? 0.
|
|
179
|
+
opacity: highlightTrail ? 0.4 : 1,
|
|
180
180
|
transition: 'opacity 300ms ease',
|
|
181
181
|
} }, buildings.map((b, i) => (react_1.default.createElement("rect", { key: i, x: b.x, y: b.y, width: b.w, height: b.h, fill: b.fill, stroke: withAlpha(text, 0.08), strokeWidth: 0.5, rx: 2 })))),
|
|
182
182
|
!hideSnippet && (() => {
|
package/dist/esm/FileCityLogo.js
CHANGED
|
@@ -94,19 +94,26 @@ function mix(a, b, t) {
|
|
|
94
94
|
* mark from the public props. Pure — no hooks — so both the static and
|
|
95
95
|
* animated components can build their SVG from the identical cell list.
|
|
96
96
|
*/
|
|
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,
|
|
98
|
-
|
|
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,
|
|
98
|
+
// Slight global translucency gives the mark a faded "film" quality and
|
|
99
|
+
// keeps the muted city from competing with the P. Restored after a
|
|
100
|
+
// brief de-haze experiment that made the city too present.
|
|
101
|
+
opacity = 0.9, gloss = false, squareRadius = 0, }) {
|
|
102
|
+
var _a, _b, _c, _d, _e;
|
|
99
103
|
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';
|
|
100
104
|
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;
|
|
101
105
|
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';
|
|
102
|
-
const bgColor = (_d = background !== null && background !== void 0 ? background : theme === null || theme === void 0 ? void 0 : theme.colors.
|
|
106
|
+
const bgColor = (_e = (_d = background !== null && background !== void 0 ? background : theme === null || theme === void 0 ? void 0 : theme.colors.backgroundSecondary) !== null && _d !== void 0 ? _d : theme === null || theme === void 0 ? void 0 : theme.colors.background) !== null && _e !== void 0 ? _e : '#0a0f14';
|
|
103
107
|
// Same palette weighting as TrailCityDiagram so the two read as a set.
|
|
108
|
+
// The city tiles stay deliberately muted (low alpha) so the vivid,
|
|
109
|
+
// full-strength `markPalette` P reads as the figure against this faded
|
|
110
|
+
// "film" of buildings — that contrast is the whole point of the mark.
|
|
104
111
|
const palette = [
|
|
105
|
-
withAlpha(primaryColor, 0.
|
|
106
|
-
withAlpha(primaryColor, 0.
|
|
107
|
-
withAlpha(baseColor, 0.
|
|
108
|
-
withAlpha(baseColor, 0.
|
|
109
|
-
withAlpha(baseColor, 0.
|
|
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),
|
|
110
117
|
];
|
|
111
118
|
// The mark files vary in shade so the letter doesn't read as one flat
|
|
112
119
|
// block, but every shade stays vivid so it still stands out from the
|
|
@@ -318,7 +325,7 @@ export function computeFileCityLayout({ mark = 'P', primary, accent, color, back
|
|
|
318
325
|
x,
|
|
319
326
|
y,
|
|
320
327
|
sq,
|
|
321
|
-
rx: Math.max(1, sq * 0
|
|
328
|
+
rx: squareRadius > 0 ? Math.max(1, sq * squareRadius) : 0,
|
|
322
329
|
fill: isLetter
|
|
323
330
|
? letterFill
|
|
324
331
|
: palette[Math.floor(colorRoll * palette.length)],
|
|
@@ -379,7 +386,7 @@ export function computeFileCityLayout({ mark = 'P', primary, accent, color, back
|
|
|
379
386
|
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 }));
|
|
380
387
|
});
|
|
381
388
|
}
|
|
382
|
-
return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark };
|
|
389
|
+
return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark, gloss };
|
|
383
390
|
}
|
|
384
391
|
/** Accessible label for a given mark, shared by both components. */
|
|
385
392
|
export function fileCityLabel(mark) {
|
|
@@ -392,15 +399,43 @@ export function fileCityLabel(mark) {
|
|
|
392
399
|
* rounded background panel (clipping its children) and the edge hairline.
|
|
393
400
|
* `children` are the grid + overlays drawn inside the clip.
|
|
394
401
|
*/
|
|
395
|
-
export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, children }) => {
|
|
402
|
+
export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, gloss = false, children }) => {
|
|
396
403
|
const uid = useId().replace(/:/g, '');
|
|
404
|
+
// Normalize the gloss option → a config (or null when flat). `true`
|
|
405
|
+
// means "use all defaults"; an object overrides individual fields.
|
|
406
|
+
const g = gloss === false
|
|
407
|
+
? null
|
|
408
|
+
: Object.assign({ side: 'top-right', intensity: 0.09, spread: 0.46, glint: false }, (gloss === true ? {} : gloss));
|
|
409
|
+
// Light direction → linear-gradient endpoints (the lit edge is the
|
|
410
|
+
// start point) and the glint's corner, both in 0–1 object-bounding-box
|
|
411
|
+
// coordinates.
|
|
412
|
+
const GLOSS_DIRS = {
|
|
413
|
+
top: { x1: 0, y1: 0, x2: 0, y2: 1, gx: 0.5, gy: 0.05 },
|
|
414
|
+
'top-left': { x1: 0, y1: 0, x2: 1, y2: 1, gx: 0.22, gy: 0.08 },
|
|
415
|
+
'top-right': { x1: 1, y1: 0, x2: 0, y2: 1, gx: 0.78, gy: 0.08 },
|
|
416
|
+
left: { x1: 0, y1: 0, x2: 1, y2: 0, gx: 0.06, gy: 0.30 },
|
|
417
|
+
right: { x1: 1, y1: 0, x2: 0, y2: 0, gx: 0.94, gy: 0.30 },
|
|
418
|
+
};
|
|
419
|
+
const dir = g ? GLOSS_DIRS[g.side] : GLOSS_DIRS.top;
|
|
397
420
|
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 },
|
|
398
421
|
React.createElement("defs", null,
|
|
399
422
|
React.createElement("clipPath", { id: `panel-${uid}` },
|
|
400
|
-
React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 }))
|
|
423
|
+
React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 })),
|
|
424
|
+
g && (React.createElement(React.Fragment, null,
|
|
425
|
+
React.createElement("linearGradient", { id: `gloss-top-${uid}`, x1: dir.x1, y1: dir.y1, x2: dir.x2, y2: dir.y2 },
|
|
426
|
+
React.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity }),
|
|
427
|
+
React.createElement("stop", { offset: `${g.spread * 60}%`, stopColor: "#ffffff", stopOpacity: g.intensity * 0.22 }),
|
|
428
|
+
React.createElement("stop", { offset: `${g.spread * 100}%`, stopColor: "#ffffff", stopOpacity: 0 })),
|
|
429
|
+
g.glint && (React.createElement("radialGradient", { id: `gloss-spec-${uid}`, cx: dir.gx, cy: dir.gy, r: 0.7 },
|
|
430
|
+
React.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity * 1.6 }),
|
|
431
|
+
React.createElement("stop", { offset: "55%", stopColor: "#ffffff", stopOpacity: g.intensity * 0.3 }),
|
|
432
|
+
React.createElement("stop", { offset: "100%", stopColor: "#ffffff", stopOpacity: 0 })))))),
|
|
401
433
|
React.createElement("g", { clipPath: `url(#panel-${uid})` },
|
|
402
434
|
React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: bgColor, rx: rounded ? PANEL_RADIUS : 0 }),
|
|
403
|
-
children
|
|
435
|
+
children,
|
|
436
|
+
g && (React.createElement("g", { style: { pointerEvents: 'none' } },
|
|
437
|
+
React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-top-${uid})` }),
|
|
438
|
+
g.glint && (React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-spec-${uid})` }))))),
|
|
404
439
|
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
440
|
};
|
|
406
441
|
/**
|
|
@@ -412,8 +447,8 @@ export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opac
|
|
|
412
447
|
*/
|
|
413
448
|
export const FileCityLogo = (props) => {
|
|
414
449
|
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) },
|
|
450
|
+
const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = computeFileCityLayout(props);
|
|
451
|
+
return (React.createElement(FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: fileCityLabel(mark) },
|
|
417
452
|
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
453
|
extras));
|
|
419
454
|
};
|
|
@@ -25,7 +25,7 @@ export const FileCityLogoAnimated = (props) => {
|
|
|
25
25
|
const uid = useId().replace(/:/g, '');
|
|
26
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
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),
|
|
28
|
+
const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = useMemo(() => computeFileCityLayout(props),
|
|
29
29
|
// Re-derive only when an input that affects layout changes.
|
|
30
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
31
|
[
|
|
@@ -43,6 +43,8 @@ export const FileCityLogoAnimated = (props) => {
|
|
|
43
43
|
props.margin,
|
|
44
44
|
props.aiCard,
|
|
45
45
|
props.opacity,
|
|
46
|
+
props.gloss,
|
|
47
|
+
props.squareRadius,
|
|
46
48
|
]);
|
|
47
49
|
// Per-cell number of samples to fully reveal it (>=1; letter cells take
|
|
48
50
|
// `buildSteps`, city cells proportionally fewer by their weight).
|
|
@@ -164,7 +166,7 @@ export const FileCityLogoAnimated = (props) => {
|
|
|
164
166
|
// cell about as it lights up); fade should finish inside the pause.
|
|
165
167
|
const drawMs = connGroup ? Math.max(cellMs, (connGroup.length - 1) * cellMs) : 0;
|
|
166
168
|
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) },
|
|
169
|
+
return (React.createElement(FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: fileCityLabel(mark) },
|
|
168
170
|
cells.map((cell, i) => {
|
|
169
171
|
const reveal = done ? 1 : ease(progress[i] / stepsFor[i]);
|
|
170
172
|
if (reveal <= 0)
|
|
@@ -104,11 +104,11 @@ export function TrailCityDiagram({ theme, className, hideSnippet = false, snippe
|
|
|
104
104
|
// reads cleanly against the dark city.
|
|
105
105
|
const silver = '#d1d8e0';
|
|
106
106
|
const palette = useMemo(() => [
|
|
107
|
-
withAlpha(accent, 0.
|
|
108
|
-
withAlpha(accent, 0.
|
|
109
|
-
withAlpha(text, 0.
|
|
110
|
-
withAlpha(text, 0.
|
|
111
|
-
withAlpha(text, 0.
|
|
107
|
+
withAlpha(accent, 0.36),
|
|
108
|
+
withAlpha(accent, 0.55),
|
|
109
|
+
withAlpha(text, 0.18),
|
|
110
|
+
withAlpha(text, 0.3),
|
|
111
|
+
withAlpha(text, 0.45),
|
|
112
112
|
], [accent, text]);
|
|
113
113
|
const markerCells = useMemo(() => [
|
|
114
114
|
{ col: 1, row: 10, label: '1' },
|
|
@@ -140,7 +140,7 @@ export function TrailCityDiagram({ theme, className, hideSnippet = false, snippe
|
|
|
140
140
|
React.createElement("stop", { offset: "100%", stopColor: bg, stopOpacity: 0.7 }))),
|
|
141
141
|
React.createElement("rect", { x: 0, y: 0, width: VIEW_W, height: VIEW_H, fill: bg, rx: 12 }),
|
|
142
142
|
React.createElement("g", { style: {
|
|
143
|
-
opacity: highlightTrail ? 0.
|
|
143
|
+
opacity: highlightTrail ? 0.4 : 1,
|
|
144
144
|
transition: 'opacity 300ms ease',
|
|
145
145
|
} }, buildings.map((b, i) => (React.createElement("rect", { key: i, x: b.x, y: b.y, width: b.w, height: b.h, fill: b.fill, stroke: withAlpha(text, 0.08), strokeWidth: 0.5, rx: 2 })))),
|
|
146
146
|
!hideSnippet && (() => {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { OpenTypeTextReveal } from './OpenTypeTextReveal';
|
|
|
7
7
|
export { TrailCityDiagram } from './TrailCityDiagram';
|
|
8
8
|
export type { TrailCityDiagramProps } from './TrailCityDiagram';
|
|
9
9
|
export { FileCityLogo, FileCityPanel, computeFileCityLayout, fileCityLabel } from './FileCityLogo';
|
|
10
|
-
export type { FileCityLogoProps, FileCityMark, FileCityGradient, FileCityCell, FileCityLayout, } from './FileCityLogo';
|
|
10
|
+
export type { FileCityLogoProps, FileCityMark, FileCityGradient, FileCityCell, FileCityLayout, GlossSide, GlossConfig, GlossOption, } from './FileCityLogo';
|
|
11
11
|
export { FileCityLogoAnimated } from './FileCityLogoAnimated';
|
|
12
12
|
export type { FileCityLogoAnimatedProps } from './FileCityLogoAnimated';
|
|
13
13
|
export { TELEMETRY_PRESETS } from './presets';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ai/logo-component",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.20",
|
|
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",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -20,13 +20,18 @@
|
|
|
20
20
|
"logo",
|
|
21
21
|
"component",
|
|
22
22
|
"svg",
|
|
23
|
-
"animated"
|
|
23
|
+
"animated",
|
|
24
|
+
"file-city",
|
|
25
|
+
"trail-city",
|
|
26
|
+
"diagram",
|
|
27
|
+
"brand",
|
|
28
|
+
"principal-ai"
|
|
24
29
|
],
|
|
25
30
|
"peerDependencies": {
|
|
26
31
|
"react": "^18.0.0 || ^19.0.0"
|
|
27
32
|
},
|
|
28
33
|
"devDependencies": {
|
|
29
|
-
"@principal-ade/industry-theme": "^0.1.
|
|
34
|
+
"@principal-ade/industry-theme": "^0.1.22",
|
|
30
35
|
"@storybook/addon-essentials": "^8.6.14",
|
|
31
36
|
"@storybook/blocks": "^8.6.14",
|
|
32
37
|
"@storybook/react": "^8.6.14",
|