@principal-ai/logo-component 0.1.18 → 0.1.19

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.
@@ -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. Pass `"transparent"` to drop the
37
- * panel and let the mark sit directly on its surface.
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
  /**
@@ -132,19 +132,22 @@ 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, opacity = 0.9, }) {
136
- var _a, _b, _c, _d;
135
+ function computeFileCityLayout({ mark = 'P', primary, accent, color, background, theme, cells = 5, highlight = true, trail = false, gradient = 'diagonal', rounded = true, margin = 1, aiCard = false, opacity = 1, gloss = false, squareRadius = 0, }) {
136
+ var _a, _b, _c, _d, _e;
137
137
  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
138
  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
139
  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.background) !== null && _d !== void 0 ? _d : '#0a0f14';
140
+ 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
141
  // Same palette weighting as TrailCityDiagram so the two read as a set.
142
+ // Alphas bumped up from the original (0.36/0.55/0.18/0.3/0.45) so the
143
+ // muted city tiles keep enough contrast against the lighter
144
+ // `backgroundSecondary` panel and don't wash out.
142
145
  const palette = [
143
- withAlpha(primaryColor, 0.18),
144
- withAlpha(primaryColor, 0.32),
145
- withAlpha(baseColor, 0.08),
146
- withAlpha(baseColor, 0.14),
147
- withAlpha(baseColor, 0.22),
146
+ withAlpha(primaryColor, 0.46),
147
+ withAlpha(primaryColor, 0.68),
148
+ withAlpha(baseColor, 0.28),
149
+ withAlpha(baseColor, 0.42),
150
+ withAlpha(baseColor, 0.58),
148
151
  ];
149
152
  // The mark files vary in shade so the letter doesn't read as one flat
150
153
  // block, but every shade stays vivid so it still stands out from the
@@ -356,7 +359,7 @@ function computeFileCityLayout({ mark = 'P', primary, accent, color, background,
356
359
  x,
357
360
  y,
358
361
  sq,
359
- rx: Math.max(1, sq * 0.12),
362
+ rx: squareRadius > 0 ? Math.max(1, sq * squareRadius) : 0,
360
363
  fill: isLetter
361
364
  ? letterFill
362
365
  : palette[Math.floor(colorRoll * palette.length)],
@@ -417,7 +420,7 @@ function computeFileCityLayout({ mark = 'P', primary, accent, color, background,
417
420
  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
421
  });
419
422
  }
420
- return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark };
423
+ return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark, gloss };
421
424
  }
422
425
  /** Accessible label for a given mark, shared by both components. */
423
426
  function fileCityLabel(mark) {
@@ -430,15 +433,43 @@ function fileCityLabel(mark) {
430
433
  * rounded background panel (clipping its children) and the edge hairline.
431
434
  * `children` are the grid + overlays drawn inside the clip.
432
435
  */
433
- const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, children }) => {
436
+ const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, gloss = false, children }) => {
434
437
  const uid = (0, react_1.useId)().replace(/:/g, '');
438
+ // Normalize the gloss option → a config (or null when flat). `true`
439
+ // means "use all defaults"; an object overrides individual fields.
440
+ const g = gloss === false
441
+ ? null
442
+ : Object.assign({ side: 'top-right', intensity: 0.09, spread: 0.46, glint: false }, (gloss === true ? {} : gloss));
443
+ // Light direction → linear-gradient endpoints (the lit edge is the
444
+ // start point) and the glint's corner, both in 0–1 object-bounding-box
445
+ // coordinates.
446
+ const GLOSS_DIRS = {
447
+ top: { x1: 0, y1: 0, x2: 0, y2: 1, gx: 0.5, gy: 0.05 },
448
+ 'top-left': { x1: 0, y1: 0, x2: 1, y2: 1, gx: 0.22, gy: 0.08 },
449
+ 'top-right': { x1: 1, y1: 0, x2: 0, y2: 1, gx: 0.78, gy: 0.08 },
450
+ left: { x1: 0, y1: 0, x2: 1, y2: 0, gx: 0.06, gy: 0.30 },
451
+ right: { x1: 1, y1: 0, x2: 0, y2: 0, gx: 0.94, gy: 0.30 },
452
+ };
453
+ const dir = g ? GLOSS_DIRS[g.side] : GLOSS_DIRS.top;
435
454
  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
455
  react_1.default.createElement("defs", null,
437
456
  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 }))),
457
+ react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 })),
458
+ g && (react_1.default.createElement(react_1.default.Fragment, null,
459
+ react_1.default.createElement("linearGradient", { id: `gloss-top-${uid}`, x1: dir.x1, y1: dir.y1, x2: dir.x2, y2: dir.y2 },
460
+ react_1.default.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity }),
461
+ react_1.default.createElement("stop", { offset: `${g.spread * 60}%`, stopColor: "#ffffff", stopOpacity: g.intensity * 0.22 }),
462
+ react_1.default.createElement("stop", { offset: `${g.spread * 100}%`, stopColor: "#ffffff", stopOpacity: 0 })),
463
+ g.glint && (react_1.default.createElement("radialGradient", { id: `gloss-spec-${uid}`, cx: dir.gx, cy: dir.gy, r: 0.7 },
464
+ react_1.default.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity * 1.6 }),
465
+ react_1.default.createElement("stop", { offset: "55%", stopColor: "#ffffff", stopOpacity: g.intensity * 0.3 }),
466
+ react_1.default.createElement("stop", { offset: "100%", stopColor: "#ffffff", stopOpacity: 0 })))))),
439
467
  react_1.default.createElement("g", { clipPath: `url(#panel-${uid})` },
440
468
  react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: bgColor, rx: rounded ? PANEL_RADIUS : 0 }),
441
- children),
469
+ children,
470
+ g && (react_1.default.createElement("g", { style: { pointerEvents: 'none' } },
471
+ react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-top-${uid})` }),
472
+ g.glint && (react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-spec-${uid})` }))))),
442
473
  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
474
  };
444
475
  exports.FileCityPanel = FileCityPanel;
@@ -451,8 +482,8 @@ exports.FileCityPanel = FileCityPanel;
451
482
  */
452
483
  const FileCityLogo = (props) => {
453
484
  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) },
485
+ const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = computeFileCityLayout(props);
486
+ 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
487
  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
488
  extras));
458
489
  };
@@ -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)
@@ -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.18),
144
- withAlpha(accent, 0.32),
145
- withAlpha(text, 0.08),
146
- withAlpha(text, 0.14),
147
- withAlpha(text, 0.22),
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.2 : 1,
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 && (() => {
@@ -94,19 +94,22 @@ 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, opacity = 0.9, }) {
98
- var _a, _b, _c, _d;
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 = 1, gloss = false, squareRadius = 0, }) {
98
+ var _a, _b, _c, _d, _e;
99
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';
100
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;
101
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';
102
- const bgColor = (_d = background !== null && background !== void 0 ? background : theme === null || theme === void 0 ? void 0 : theme.colors.background) !== null && _d !== void 0 ? _d : '#0a0f14';
102
+ 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
103
  // Same palette weighting as TrailCityDiagram so the two read as a set.
104
+ // Alphas bumped up from the original (0.36/0.55/0.18/0.3/0.45) so the
105
+ // muted city tiles keep enough contrast against the lighter
106
+ // `backgroundSecondary` panel and don't wash out.
104
107
  const palette = [
105
- withAlpha(primaryColor, 0.18),
106
- withAlpha(primaryColor, 0.32),
107
- withAlpha(baseColor, 0.08),
108
- withAlpha(baseColor, 0.14),
109
- withAlpha(baseColor, 0.22),
108
+ withAlpha(primaryColor, 0.46),
109
+ withAlpha(primaryColor, 0.68),
110
+ withAlpha(baseColor, 0.28),
111
+ withAlpha(baseColor, 0.42),
112
+ withAlpha(baseColor, 0.58),
110
113
  ];
111
114
  // The mark files vary in shade so the letter doesn't read as one flat
112
115
  // block, but every shade stays vivid so it still stands out from the
@@ -318,7 +321,7 @@ export function computeFileCityLayout({ mark = 'P', primary, accent, color, back
318
321
  x,
319
322
  y,
320
323
  sq,
321
- rx: Math.max(1, sq * 0.12),
324
+ rx: squareRadius > 0 ? Math.max(1, sq * squareRadius) : 0,
322
325
  fill: isLetter
323
326
  ? letterFill
324
327
  : palette[Math.floor(colorRoll * palette.length)],
@@ -379,7 +382,7 @@ export function computeFileCityLayout({ mark = 'P', primary, accent, color, back
379
382
  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
383
  });
381
384
  }
382
- return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark };
385
+ return { cells: cellsOut, extras, bgColor, baseColor, rounded, opacity, mark, gloss };
383
386
  }
384
387
  /** Accessible label for a given mark, shared by both components. */
385
388
  export function fileCityLabel(mark) {
@@ -392,15 +395,43 @@ export function fileCityLabel(mark) {
392
395
  * rounded background panel (clipping its children) and the edge hairline.
393
396
  * `children` are the grid + overlays drawn inside the clip.
394
397
  */
395
- export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, children }) => {
398
+ export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, gloss = false, children }) => {
396
399
  const uid = useId().replace(/:/g, '');
400
+ // Normalize the gloss option → a config (or null when flat). `true`
401
+ // means "use all defaults"; an object overrides individual fields.
402
+ const g = gloss === false
403
+ ? null
404
+ : Object.assign({ side: 'top-right', intensity: 0.09, spread: 0.46, glint: false }, (gloss === true ? {} : gloss));
405
+ // Light direction → linear-gradient endpoints (the lit edge is the
406
+ // start point) and the glint's corner, both in 0–1 object-bounding-box
407
+ // coordinates.
408
+ const GLOSS_DIRS = {
409
+ top: { x1: 0, y1: 0, x2: 0, y2: 1, gx: 0.5, gy: 0.05 },
410
+ 'top-left': { x1: 0, y1: 0, x2: 1, y2: 1, gx: 0.22, gy: 0.08 },
411
+ 'top-right': { x1: 1, y1: 0, x2: 0, y2: 1, gx: 0.78, gy: 0.08 },
412
+ left: { x1: 0, y1: 0, x2: 1, y2: 0, gx: 0.06, gy: 0.30 },
413
+ right: { x1: 1, y1: 0, x2: 0, y2: 0, gx: 0.94, gy: 0.30 },
414
+ };
415
+ const dir = g ? GLOSS_DIRS[g.side] : GLOSS_DIRS.top;
397
416
  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
417
  React.createElement("defs", null,
399
418
  React.createElement("clipPath", { id: `panel-${uid}` },
400
- React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 }))),
419
+ React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, rx: rounded ? PANEL_RADIUS : 0 })),
420
+ g && (React.createElement(React.Fragment, null,
421
+ React.createElement("linearGradient", { id: `gloss-top-${uid}`, x1: dir.x1, y1: dir.y1, x2: dir.x2, y2: dir.y2 },
422
+ React.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity }),
423
+ React.createElement("stop", { offset: `${g.spread * 60}%`, stopColor: "#ffffff", stopOpacity: g.intensity * 0.22 }),
424
+ React.createElement("stop", { offset: `${g.spread * 100}%`, stopColor: "#ffffff", stopOpacity: 0 })),
425
+ g.glint && (React.createElement("radialGradient", { id: `gloss-spec-${uid}`, cx: dir.gx, cy: dir.gy, r: 0.7 },
426
+ React.createElement("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: g.intensity * 1.6 }),
427
+ React.createElement("stop", { offset: "55%", stopColor: "#ffffff", stopOpacity: g.intensity * 0.3 }),
428
+ React.createElement("stop", { offset: "100%", stopColor: "#ffffff", stopOpacity: 0 })))))),
401
429
  React.createElement("g", { clipPath: `url(#panel-${uid})` },
402
430
  React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: bgColor, rx: rounded ? PANEL_RADIUS : 0 }),
403
- children),
431
+ children,
432
+ g && (React.createElement("g", { style: { pointerEvents: 'none' } },
433
+ React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-top-${uid})` }),
434
+ g.glint && (React.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-spec-${uid})` }))))),
404
435
  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
436
  };
406
437
  /**
@@ -412,8 +443,8 @@ export const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opac
412
443
  */
413
444
  export const FileCityLogo = (props) => {
414
445
  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) },
446
+ const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = computeFileCityLayout(props);
447
+ return (React.createElement(FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: fileCityLabel(mark) },
417
448
  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
449
  extras));
419
450
  };
@@ -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.18),
108
- withAlpha(accent, 0.32),
109
- withAlpha(text, 0.08),
110
- withAlpha(text, 0.14),
111
- withAlpha(text, 0.22),
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.2 : 1,
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/logo-component",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Animated wireframe sphere logo component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -26,7 +26,7 @@
26
26
  "react": "^18.0.0 || ^19.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@principal-ade/industry-theme": "^0.1.20",
29
+ "@principal-ade/industry-theme": "^0.1.22",
30
30
  "@storybook/addon-essentials": "^8.6.14",
31
31
  "@storybook/blocks": "^8.6.14",
32
32
  "@storybook/react": "^8.6.14",