@principal-ai/logo-component 0.1.22 → 0.1.24
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/FileCityBotAvatar.d.ts +31 -0
- package/dist/FileCityBotAvatar.js +161 -0
- package/dist/FileCityLogo.d.ts +35 -1
- package/dist/FileCityLogo.js +39 -6
- package/dist/FileCityLogoAnimated.d.ts +13 -0
- package/dist/FileCityLogoAnimated.js +235 -5
- 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/botAvatarLayout.d.ts +205 -0
- package/dist/botAvatarLayout.js +353 -0
- package/dist/esm/FileCityBotAvatar.js +124 -0
- package/dist/esm/FileCityLogo.js +39 -6
- package/dist/esm/FileCityLogoAnimated.js +235 -5
- package/dist/esm/TrailCityBanner.js +353 -0
- package/dist/esm/TrailCityProgress.js +120 -0
- package/dist/esm/TrailMarketingBanner.js +458 -0
- package/dist/esm/botAvatarLayout.js +348 -0
- package/dist/esm/index.js +5 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +5 -0
- package/dist/index.js +13 -1
- package/package.json +4 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Theme } from '@principal-ade/industry-theme';
|
|
3
|
+
import { type BotAvatarLayoutOptions } from './botAvatarLayout';
|
|
4
|
+
export interface FileCityBotAvatarProps extends BotAvatarLayoutOptions {
|
|
5
|
+
/** Rendered width and height in px. Default 44. */
|
|
6
|
+
size?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Optional theme — fills `color` / `background` when they aren't passed.
|
|
9
|
+
* The Bot's own colour still comes from `primary` (or its `seed`).
|
|
10
|
+
*/
|
|
11
|
+
theme?: Theme;
|
|
12
|
+
/**
|
|
13
|
+
* Bring the face to life: the eyes blink, `thinking` pulses its mouth dots
|
|
14
|
+
* and `talking` moves its mouth. Off by default; ignored for letters and
|
|
15
|
+
* when the viewer prefers reduced motion.
|
|
16
|
+
*/
|
|
17
|
+
animated?: boolean;
|
|
18
|
+
/** Fill the panel behind the grid. `false` lets the features float on the surface. Default true. */
|
|
19
|
+
panel?: boolean;
|
|
20
|
+
/** Trace the panel edge with a hairline. Default false. */
|
|
21
|
+
hairline?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A Bot's avatar in the brand's "file city" language: the same top-down grid
|
|
27
|
+
* of file squares as {@link FileCityLogo}, on a denser 7×7 grid, where the
|
|
28
|
+
* lit files either spell the Bot's initial(s) or form a face whose
|
|
29
|
+
* `expression` and `look` can follow what the Bot is doing.
|
|
30
|
+
*/
|
|
31
|
+
export declare const FileCityBotAvatar: React.FC<FileCityBotAvatarProps>;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.FileCityBotAvatar = void 0;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
const botAvatarLayout_1 = require("./botAvatarLayout");
|
|
50
|
+
const ANIMATION_CSS = `
|
|
51
|
+
@keyframes fcba-blink { 0%, 90%, 100% { transform: scaleY(1); } 94%, 96% { transform: scaleY(0.14); } }
|
|
52
|
+
@keyframes fcba-dot { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
|
|
53
|
+
@keyframes fcba-talk { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.45); } }
|
|
54
|
+
.fcba-eye { transform-box: fill-box; transform-origin: 50% 100%; animation: fcba-blink 4.6s infinite; }
|
|
55
|
+
.fcba-dot { animation: fcba-dot 1.2s infinite; }
|
|
56
|
+
.fcba-talk { transform-box: fill-box; transform-origin: 50% 100%; animation: fcba-talk 0.42s ease-in-out infinite; }
|
|
57
|
+
@media (prefers-reduced-motion: reduce) { .fcba-eye, .fcba-dot, .fcba-talk { animation: none; } }
|
|
58
|
+
`;
|
|
59
|
+
const renderCell = (cell, extra) => (react_1.default.createElement("rect", Object.assign({ 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 }, extra)));
|
|
60
|
+
/**
|
|
61
|
+
* A brow, centred on the origin: a bar whose thickness can slope from one end
|
|
62
|
+
* to the other. The corners are rounded by drawing the outline inset by the
|
|
63
|
+
* corner radius and stroking it back out with round joins.
|
|
64
|
+
*/
|
|
65
|
+
const BrowShape = ({ brow, paint }) => {
|
|
66
|
+
const [hLeft, hRight] = brow.side === 'left'
|
|
67
|
+
? [brow.heightOuter, brow.heightInner]
|
|
68
|
+
: [brow.heightInner, brow.heightOuter];
|
|
69
|
+
const r = Math.min(brow.rx, hLeft / 2, hRight / 2);
|
|
70
|
+
const x = brow.width / 2 - r;
|
|
71
|
+
const yL = hLeft / 2 - r;
|
|
72
|
+
const yR = hRight / 2 - r;
|
|
73
|
+
return (react_1.default.createElement("polygon", { points: `${-x},${-yL} ${x},${-yR} ${x},${yR} ${-x},${yL}`, fill: paint, stroke: paint, strokeWidth: r * 2, strokeLinejoin: "round" }));
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A Bot's avatar in the brand's "file city" language: the same top-down grid
|
|
77
|
+
* of file squares as {@link FileCityLogo}, on a denser 7×7 grid, where the
|
|
78
|
+
* lit files either spell the Bot's initial(s) or form a face whose
|
|
79
|
+
* `expression` and `look` can follow what the Bot is doing.
|
|
80
|
+
*/
|
|
81
|
+
const FileCityBotAvatar = (_a) => {
|
|
82
|
+
var _b, _c, _d, _e;
|
|
83
|
+
var { size = 44, theme, animated = false, panel = true, hairline: showHairline = false, className, style } = _a, options = __rest(_a, ["size", "theme", "animated", "panel", "hairline", "className", "style"]);
|
|
84
|
+
const uid = (0, react_1.useId)().replace(/:/g, '');
|
|
85
|
+
const layout = (0, botAvatarLayout_1.computeBotAvatarLayout)(Object.assign(Object.assign({}, options), { color: (_b = options.color) !== null && _b !== void 0 ? _b : theme === null || theme === void 0 ? void 0 : theme.colors.text, background: (_d = (_c = options.background) !== null && _c !== void 0 ? _c : 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 }));
|
|
86
|
+
const { cells, view, radius, bgColor, baseColor, expression } = layout;
|
|
87
|
+
const animate = animated && layout.variant === 'face';
|
|
88
|
+
// Offset each Bot's blink so a list of avatars doesn't blink in unison.
|
|
89
|
+
const seedSum = Array.from((_e = options.seed) !== null && _e !== void 0 ? _e : '').reduce((sum, ch) => sum + ch.charCodeAt(0), 0);
|
|
90
|
+
const blinkDelay = `-${((seedSum * 0.37) % 4.6).toFixed(2)}s`;
|
|
91
|
+
const hairline = 0.75;
|
|
92
|
+
return (react_1.default.createElement("svg", { width: size, height: size, viewBox: `0 0 ${view} ${view}`, xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": layout.label, className: className, style: Object.assign({ display: 'block', flexShrink: 0 }, style) },
|
|
93
|
+
react_1.default.createElement("defs", null,
|
|
94
|
+
react_1.default.createElement("clipPath", { id: `fcba-${uid}` },
|
|
95
|
+
react_1.default.createElement("rect", { x: 0, y: 0, width: view, height: view, rx: radius })),
|
|
96
|
+
animate && react_1.default.createElement("style", null, ANIMATION_CSS),
|
|
97
|
+
layout.brows
|
|
98
|
+
.filter((brow) => brow.fillInner !== brow.fillOuter)
|
|
99
|
+
.map((brow) => (
|
|
100
|
+
// Runs along the bar; the inner end is the one nearest the other eye.
|
|
101
|
+
react_1.default.createElement("linearGradient", { key: brow.side, id: `fcba-brow-${brow.side}-${uid}`, gradientUnits: "userSpaceOnUse", x1: -brow.width / 2, y1: 0, x2: brow.width / 2, y2: 0 },
|
|
102
|
+
react_1.default.createElement("stop", { offset: "0%", stopColor: brow.side === 'left' ? brow.fillOuter : brow.fillInner }),
|
|
103
|
+
react_1.default.createElement("stop", { offset: "100%", stopColor: brow.side === 'left' ? brow.fillInner : brow.fillOuter }))))),
|
|
104
|
+
react_1.default.createElement("g", { clipPath: `url(#fcba-${uid})` },
|
|
105
|
+
panel && react_1.default.createElement("rect", { x: 0, y: 0, width: view, height: view, fill: bgColor }),
|
|
106
|
+
cells.map((cell) => renderCell(cell)),
|
|
107
|
+
layout.eyes.map((eye) => {
|
|
108
|
+
// Closed eyes don't blink; a wink keeps its closed eye shut.
|
|
109
|
+
const blinks = animate && !eye.closed;
|
|
110
|
+
return (
|
|
111
|
+
// The eye is one block. Its position lives on the group so that a
|
|
112
|
+
// change of `look` slides the whole eye, and the blink squashes
|
|
113
|
+
// the block inside it.
|
|
114
|
+
react_1.default.createElement("g", { key: eye.side, transform: `translate(${eye.x} ${eye.y})`, style: animate
|
|
115
|
+
? {
|
|
116
|
+
transform: `translate(${eye.x}px, ${eye.y}px)`,
|
|
117
|
+
transition: 'transform 0.24s cubic-bezier(0.3, 1.3, 0.5, 1)',
|
|
118
|
+
}
|
|
119
|
+
: undefined },
|
|
120
|
+
react_1.default.createElement("rect", { x: 0, y: 0, width: eye.width, height: eye.height, rx: eye.rx, fill: eye.fill, className: blinks ? 'fcba-eye' : undefined, style: Object.assign(Object.assign({}, (blinks ? { animationDelay: blinkDelay } : {})), (animate ? { transition: 'height 0.18s ease-out' } : {})) })));
|
|
121
|
+
}),
|
|
122
|
+
layout.brows.map((brow) => {
|
|
123
|
+
// Both brows stay mounted so they can rise, tilt and fade.
|
|
124
|
+
if (!animate && !brow.visible)
|
|
125
|
+
return null;
|
|
126
|
+
return (react_1.default.createElement("g", { key: brow.side, transform: `translate(${brow.cx} ${brow.cy}) rotate(${brow.rotate})`, opacity: brow.visible ? 1 : 0, style: animate
|
|
127
|
+
? {
|
|
128
|
+
transform: `translate(${brow.cx}px, ${brow.cy}px) rotate(${brow.rotate}deg)`,
|
|
129
|
+
transition: 'transform 0.26s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.18s ease-out',
|
|
130
|
+
}
|
|
131
|
+
: undefined },
|
|
132
|
+
react_1.default.createElement(BrowShape, { brow: brow, paint: brow.fillInner !== brow.fillOuter
|
|
133
|
+
? `url(#fcba-brow-${brow.side}-${uid})`
|
|
134
|
+
: brow.fill })));
|
|
135
|
+
}),
|
|
136
|
+
layout.mouth.map((file) => {
|
|
137
|
+
// All five mouth files stay mounted; an expression change slides
|
|
138
|
+
// each to its new place and fades the unused ones out.
|
|
139
|
+
if (!animate && !file.visible)
|
|
140
|
+
return null;
|
|
141
|
+
const motion = expression === 'talking' ? 'fcba-talk' : expression === 'thinking' ? 'fcba-dot' : undefined;
|
|
142
|
+
return (react_1.default.createElement("g", { key: file.index, transform: `translate(${file.x} ${file.y})`, opacity: file.visible ? 1 : 0, style: animate
|
|
143
|
+
? {
|
|
144
|
+
transform: `translate(${file.x}px, ${file.y}px)`,
|
|
145
|
+
transition: 'transform 0.26s cubic-bezier(0.3, 1.3, 0.5, 1), opacity 0.18s ease-out',
|
|
146
|
+
}
|
|
147
|
+
: undefined },
|
|
148
|
+
react_1.default.createElement("rect", { x: 0, y: 0, width: file.width, height: file.height, rx: file.rx, fill: file.fill, className: animate && file.visible ? motion : undefined, style: animate
|
|
149
|
+
? {
|
|
150
|
+
transition: 'height 0.2s ease-out',
|
|
151
|
+
animationDelay: motion === 'fcba-dot'
|
|
152
|
+
? `${file.index * 0.1}s`
|
|
153
|
+
: motion === 'fcba-talk'
|
|
154
|
+
? `${(file.index % 2) * 0.09}s`
|
|
155
|
+
: undefined,
|
|
156
|
+
}
|
|
157
|
+
: undefined })));
|
|
158
|
+
})),
|
|
159
|
+
panel && showHairline && react_1.default.createElement("rect", { x: hairline / 2, y: hairline / 2, width: view - hairline, height: view - hairline, rx: Math.max(0, radius - hairline / 2), fill: "none", stroke: `${baseColor.length === 7 ? baseColor : '#f8fafc'}24`, strokeWidth: hairline })));
|
|
160
|
+
};
|
|
161
|
+
exports.FileCityBotAvatar = FileCityBotAvatar;
|
package/dist/FileCityLogo.d.ts
CHANGED
|
@@ -30,6 +30,27 @@ export interface GlossConfig {
|
|
|
30
30
|
}
|
|
31
31
|
/** `true` = faint top sheen (defaults), an object = tuned sheen, `false` = flat. */
|
|
32
32
|
export type GlossOption = boolean | GlossConfig;
|
|
33
|
+
/** Which corner the dev-build ribbon banner crosses. */
|
|
34
|
+
export type RibbonCorner = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
35
|
+
/**
|
|
36
|
+
* A macOS-style "dev build" ribbon — the diagonal banner Xcode / `fastlane
|
|
37
|
+
* badge` stamp across an app icon's corner to mark an alpha/beta/dev build.
|
|
38
|
+
* The band is drawn inside the panel clip, so its ends are trimmed flush
|
|
39
|
+
* with the rounded icon edge (the native "clipped to the squircle" look).
|
|
40
|
+
*/
|
|
41
|
+
export interface DevRibbonConfig {
|
|
42
|
+
/** Banner text. Default `'dev'`. Rendered upper-cased, like the OS does. */
|
|
43
|
+
text?: string;
|
|
44
|
+
/** Corner the banner crosses. Default `'bottom-right'`. */
|
|
45
|
+
corner?: RibbonCorner;
|
|
46
|
+
/** Band fill. Defaults to the primary color. */
|
|
47
|
+
color?: string;
|
|
48
|
+
/** Text color. Default `'#ffffff'`. */
|
|
49
|
+
textColor?: string;
|
|
50
|
+
}
|
|
51
|
+
/** `false` (default) = no ribbon; `true` = a `dev` band in the primary
|
|
52
|
+
* color across the bottom-right corner; an object tunes text / corner / colors. */
|
|
53
|
+
export type DevRibbonOption = boolean | DevRibbonConfig;
|
|
33
54
|
export interface FileCityLogoProps {
|
|
34
55
|
width?: number;
|
|
35
56
|
height?: number;
|
|
@@ -114,6 +135,14 @@ export interface FileCityLogoProps {
|
|
|
114
135
|
* is nudged one column left to clear room for the card.
|
|
115
136
|
*/
|
|
116
137
|
aiCard?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Stamp a macOS-style "dev build" ribbon — a diagonal banner clipped to
|
|
140
|
+
* the icon's rounded corner, the way Xcode / `fastlane badge` mark
|
|
141
|
+
* alpha/beta/dev builds. `true` is a `dev` band across the bottom-right
|
|
142
|
+
* corner in the primary color; pass a {@link DevRibbonConfig} to set the
|
|
143
|
+
* text, corner, or colors.
|
|
144
|
+
*/
|
|
145
|
+
devRibbon?: DevRibbonOption;
|
|
117
146
|
opacity?: number;
|
|
118
147
|
}
|
|
119
148
|
/**
|
|
@@ -147,6 +176,8 @@ export interface FileCityLayout {
|
|
|
147
176
|
cells: FileCityCell[];
|
|
148
177
|
/** Overlay nodes (trail path/dots, AI card) drawn above the grid. */
|
|
149
178
|
extras: React.ReactNode[];
|
|
179
|
+
/** Dev-build ribbon node, drawn above everything inside the panel clip. */
|
|
180
|
+
ribbon: React.ReactNode | null;
|
|
150
181
|
bgColor: string;
|
|
151
182
|
baseColor: string;
|
|
152
183
|
rounded: boolean;
|
|
@@ -159,7 +190,7 @@ export interface FileCityLayout {
|
|
|
159
190
|
* mark from the public props. Pure — no hooks — so both the static and
|
|
160
191
|
* animated components can build their SVG from the identical cell list.
|
|
161
192
|
*/
|
|
162
|
-
export declare function computeFileCityLayout({ mark, primary, accent, color, background, theme, cells, highlight, trail, gradient, rounded, margin, aiCard, opacity, gloss, squareRadius, }: FileCityLogoProps): FileCityLayout;
|
|
193
|
+
export declare function computeFileCityLayout({ mark, primary, accent, color, background, theme, cells, highlight, trail, gradient, rounded, margin, aiCard, opacity, gloss, squareRadius, devRibbon, }: FileCityLogoProps): FileCityLayout;
|
|
163
194
|
/** Accessible label for a given mark, shared by both components. */
|
|
164
195
|
export declare function fileCityLabel(mark: FileCityMark): string;
|
|
165
196
|
/**
|
|
@@ -176,6 +207,9 @@ export declare const FileCityPanel: React.FC<{
|
|
|
176
207
|
opacity: number;
|
|
177
208
|
label: string;
|
|
178
209
|
gloss?: GlossOption;
|
|
210
|
+
/** Dev-build ribbon, drawn above the children and gloss but inside the
|
|
211
|
+
* panel clip so its ends trim flush with the rounded edge. */
|
|
212
|
+
ribbon?: React.ReactNode;
|
|
179
213
|
children: React.ReactNode;
|
|
180
214
|
}>;
|
|
181
215
|
/**
|
package/dist/FileCityLogo.js
CHANGED
|
@@ -127,6 +127,37 @@ function mix(a, b, t) {
|
|
|
127
127
|
.padStart(2, '0');
|
|
128
128
|
return `#${ch(0)}${ch(1)}${ch(2)}`;
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Build the dev-build ribbon node, or `null` when disabled. A horizontal
|
|
132
|
+
* band rect + centered label, both rotated about a point inset from the
|
|
133
|
+
* chosen corner so the band runs parallel to that corner's diagonal. The
|
|
134
|
+
* rect is far longer than the panel; the panel's clip trims its ends flush
|
|
135
|
+
* with the rounded edge, giving the native "ribbon clipped to the icon" look.
|
|
136
|
+
*/
|
|
137
|
+
function buildDevRibbon(option, primaryColor) {
|
|
138
|
+
if (!option)
|
|
139
|
+
return null;
|
|
140
|
+
const cfg = Object.assign({ text: 'dev', corner: 'bottom-right', color: primaryColor, textColor: '#ffffff' }, (option === true ? {} : option));
|
|
141
|
+
const label = cfg.text.toUpperCase();
|
|
142
|
+
// Center of the band, inset `D` from the corner along each axis, and the
|
|
143
|
+
// rotation that lays it parallel to the corner's diagonal. With the panel
|
|
144
|
+
// rounded, the band reads as a banner across the corner; its outward end
|
|
145
|
+
// is clipped by the squircle edge.
|
|
146
|
+
const D = 16; // band-center inset from the corner
|
|
147
|
+
const THICK = 22; // band thickness
|
|
148
|
+
const LEN = VIEW * 2; // overhang, trimmed by the panel clip
|
|
149
|
+
const CORNERS = {
|
|
150
|
+
'bottom-right': { cx: VIEW - D, cy: VIEW - D, rot: -45 },
|
|
151
|
+
'bottom-left': { cx: D, cy: VIEW - D, rot: 45 },
|
|
152
|
+
'top-right': { cx: VIEW - D, cy: D, rot: 45 },
|
|
153
|
+
'top-left': { cx: D, cy: D, rot: -45 },
|
|
154
|
+
};
|
|
155
|
+
const { cx, cy, rot } = CORNERS[cfg.corner];
|
|
156
|
+
const fontSize = THICK * 0.5;
|
|
157
|
+
return (react_1.default.createElement("g", { key: "dev-ribbon", transform: `rotate(${rot} ${cx} ${cy})`, style: { pointerEvents: 'none' } },
|
|
158
|
+
react_1.default.createElement("rect", { x: cx - LEN / 2, y: cy - THICK / 2, width: LEN, height: THICK, fill: cfg.color, stroke: withAlpha('#000000', 0.18), strokeWidth: 0.6 }),
|
|
159
|
+
react_1.default.createElement("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "central", fontFamily: "system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif", fontWeight: 700, fontSize: fontSize, letterSpacing: "0.14em", fill: cfg.textColor }, label)));
|
|
160
|
+
}
|
|
130
161
|
/**
|
|
131
162
|
* Compute the full layout (cells + overlays + palette) for a file-city
|
|
132
163
|
* mark from the public props. Pure — no hooks — so both the static and
|
|
@@ -136,7 +167,7 @@ function computeFileCityLayout({ mark = 'P', primary, accent, color, background,
|
|
|
136
167
|
// Slight global translucency gives the mark a faded "film" quality and
|
|
137
168
|
// keeps the muted city from competing with the P. Restored after a
|
|
138
169
|
// brief de-haze experiment that made the city too present.
|
|
139
|
-
opacity = 0.9, gloss = false, squareRadius = 0, }) {
|
|
170
|
+
opacity = 0.9, gloss = false, squareRadius = 0, devRibbon = false, }) {
|
|
140
171
|
var _a, _b, _c, _d, _e;
|
|
141
172
|
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';
|
|
142
173
|
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;
|
|
@@ -425,7 +456,8 @@ opacity = 0.9, gloss = false, squareRadius = 0, }) {
|
|
|
425
456
|
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 }));
|
|
426
457
|
});
|
|
427
458
|
}
|
|
428
|
-
|
|
459
|
+
const ribbon = buildDevRibbon(devRibbon, primaryColor);
|
|
460
|
+
return { cells: cellsOut, extras, ribbon, bgColor, baseColor, rounded, opacity, mark, gloss };
|
|
429
461
|
}
|
|
430
462
|
/** Accessible label for a given mark, shared by both components. */
|
|
431
463
|
function fileCityLabel(mark) {
|
|
@@ -438,7 +470,7 @@ function fileCityLabel(mark) {
|
|
|
438
470
|
* rounded background panel (clipping its children) and the edge hairline.
|
|
439
471
|
* `children` are the grid + overlays drawn inside the clip.
|
|
440
472
|
*/
|
|
441
|
-
const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, gloss = false, children }) => {
|
|
473
|
+
const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, label, gloss = false, ribbon = null, children }) => {
|
|
442
474
|
const uid = (0, react_1.useId)().replace(/:/g, '');
|
|
443
475
|
// Normalize the gloss option → a config (or null when flat). `true`
|
|
444
476
|
// means "use all defaults"; an object overrides individual fields.
|
|
@@ -474,7 +506,8 @@ const FileCityPanel = ({ width, height, bgColor, baseColor, rounded, opacity, la
|
|
|
474
506
|
children,
|
|
475
507
|
g && (react_1.default.createElement("g", { style: { pointerEvents: 'none' } },
|
|
476
508
|
react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-top-${uid})` }),
|
|
477
|
-
g.glint && (react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-spec-${uid})` }))))
|
|
509
|
+
g.glint && (react_1.default.createElement("rect", { x: 0, y: 0, width: VIEW, height: VIEW, fill: `url(#gloss-spec-${uid})` })))),
|
|
510
|
+
ribbon),
|
|
478
511
|
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 })));
|
|
479
512
|
};
|
|
480
513
|
exports.FileCityPanel = FileCityPanel;
|
|
@@ -487,8 +520,8 @@ exports.FileCityPanel = FileCityPanel;
|
|
|
487
520
|
*/
|
|
488
521
|
const FileCityLogo = (props) => {
|
|
489
522
|
const { width = 150, height = 150 } = props;
|
|
490
|
-
const { cells, extras, bgColor, baseColor, rounded, opacity, mark, gloss } = computeFileCityLayout(props);
|
|
491
|
-
return (react_1.default.createElement(exports.FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, label: fileCityLabel(mark) },
|
|
523
|
+
const { cells, extras, ribbon, bgColor, baseColor, rounded, opacity, mark, gloss } = computeFileCityLayout(props);
|
|
524
|
+
return (react_1.default.createElement(exports.FileCityPanel, { width: width, height: height, bgColor: bgColor, baseColor: baseColor, rounded: rounded, opacity: opacity, gloss: gloss, ribbon: ribbon, label: fileCityLabel(mark) },
|
|
492
525
|
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 }))),
|
|
493
526
|
extras));
|
|
494
527
|
};
|
|
@@ -33,6 +33,19 @@ export interface FileCityLogoAnimatedProps extends FileCityLogoProps {
|
|
|
33
33
|
playKey?: string | number;
|
|
34
34
|
/** Called once the heatmap has fully resolved. */
|
|
35
35
|
onComplete?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Bring a face into the animation — the same eyes-and-mouth as
|
|
38
|
+
* `FileCityBotAvatar`, in the logo's own colours.
|
|
39
|
+
* - `'watch'`: a pair of eyes is there from the start, following each
|
|
40
|
+
* group of files as it lights up; when the P is complete the eyes'
|
|
41
|
+
* files slide into the P and the sheen plays.
|
|
42
|
+
* - `'wake'`: the build plays as usual; then, in place of the sheen, the
|
|
43
|
+
* P's files slide into a face that smiles, blinks and winks, and slide
|
|
44
|
+
* back.
|
|
45
|
+
* Only applies to the plain centred `mark="P"` (at any `margin`). Default
|
|
46
|
+
* `'none'`.
|
|
47
|
+
*/
|
|
48
|
+
face?: 'none' | 'watch' | 'wake';
|
|
36
49
|
}
|
|
37
50
|
/**
|
|
38
51
|
* Animated file-city mark: the squares accumulate like a heatmap. Each tick
|