@spunto/brand-kit 0.8.0 → 0.10.0
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/package.json +1 -1
- package/src/home/check.ts +6 -0
- package/src/home/editions/desktop.json +386 -0
- package/src/home/editions/foyer.json +329 -0
- package/src/home/editions.ts +2 -2
- package/src/home/guide.ts +3 -2
- package/src/home/home.tsx +9 -3
- package/src/home/showcase/catalog.ts +67 -3
- package/src/home/showcase/desktop/desk.tsx +195 -0
- package/src/home/showcase/desktop/drive.tsx +71 -0
- package/src/home/showcase/desktop/handoff.tsx +94 -0
- package/src/home/showcase/desktop/launcher.tsx +161 -0
- package/src/home/showcase/desktop/parts.tsx +388 -0
- package/src/home/showcase/desktop/sample.ts +157 -0
- package/src/home/showcase/desktop/wall.tsx +85 -0
- package/src/home/showcase/foyer/book.tsx +149 -0
- package/src/home/showcase/foyer/pantry.tsx +159 -0
- package/src/home/showcase/foyer/parts.tsx +226 -0
- package/src/home/showcase/foyer/phone.tsx +256 -0
- package/src/home/showcase/foyer/sample.ts +174 -0
- package/src/home/showcase/foyer/week.tsx +204 -0
- package/src/home/showcase/stage.tsx +28 -12
- package/src/home/showcase/view.tsx +16 -0
- package/src/home/types.ts +3 -0
|
@@ -114,22 +114,24 @@ export function useStage(lengths: readonly number[], still: number) {
|
|
|
114
114
|
|
|
115
115
|
const vars = (v: Record<string, string | number>) => v as CSSProperties
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
/** `board`: the drawing's width in design pixels — 920 for an app's window, narrower for a phone (a hero's column).
|
|
118
|
+
`bare`: no panel around it, only the glow — a device that stands on the page by itself. */
|
|
119
|
+
export function Stage({ stageRef, colors, night, height, label, board = BOARD, bare, children }: { stageRef: RefObject<HTMLDivElement | null>; colors: StageColors; night: boolean; height: number; label: string; board?: number; bare?: boolean; children: ReactNode }) {
|
|
118
120
|
// On paper the screen sits in a panel of the product's field; on a field-coloured band, in a lighter pane of it.
|
|
119
|
-
const panel = night ? hexAlpha("#ffffff", 0.07) : colors.field
|
|
121
|
+
const panel = bare ? "transparent" : night ? hexAlpha("#ffffff", 0.07) : colors.field
|
|
120
122
|
return (
|
|
121
123
|
<div ref={stageRef} data-showcase-stage role="img" aria-label={label} style={{ position: "relative", containerType: "inline-size", ...vars({ "--p": 0.5 }) }}>
|
|
122
124
|
<div
|
|
123
125
|
aria-hidden
|
|
124
126
|
style={{
|
|
125
127
|
// Never taller than most of the screen it is read on: the board then sits centred in a wider panel.
|
|
126
|
-
...vars({ "--u": `clamp(${MIN_U}px, calc(100cqi / ${
|
|
128
|
+
...vars({ "--u": `clamp(${MIN_U}px, calc(100cqi / ${board}), calc(84vh / ${height}))` }),
|
|
127
129
|
position: "relative",
|
|
128
130
|
height: u(height),
|
|
129
131
|
overflow: "hidden",
|
|
130
132
|
borderRadius: 8,
|
|
131
133
|
background: panel,
|
|
132
|
-
border: night ? "1px solid rgba(255,255,255,0.12)" : "none",
|
|
134
|
+
border: night && !bare ? "1px solid rgba(255,255,255,0.12)" : "none",
|
|
133
135
|
color: INK,
|
|
134
136
|
fontFamily: FONT.sans,
|
|
135
137
|
fontSize: u(12),
|
|
@@ -143,7 +145,9 @@ export function Stage({ stageRef, colors, night, height, label, children }: { st
|
|
|
143
145
|
style={{
|
|
144
146
|
position: "absolute",
|
|
145
147
|
inset: "-20%",
|
|
146
|
-
background:
|
|
148
|
+
background: bare
|
|
149
|
+
? `radial-gradient(34% 38% at 50% 50%, ${hexAlpha(colors.signal, 0.3)}, transparent 72%)`
|
|
150
|
+
: `radial-gradient(42% 46% at 78% 22%, ${hexAlpha(colors.signal, night ? 0.2 : 0.34)}, transparent 70%), radial-gradient(40% 50% at 12% 92%, ${hexAlpha(colors.signal, night ? 0.1 : 0.16)}, transparent 70%)`,
|
|
147
151
|
transform: "translateY(calc((var(--p) - 0.5) * 12%))",
|
|
148
152
|
}}
|
|
149
153
|
/>
|
|
@@ -152,10 +156,10 @@ export function Stage({ stageRef, colors, night, height, label, children }: { st
|
|
|
152
156
|
position: "absolute",
|
|
153
157
|
top: 0,
|
|
154
158
|
left: 0,
|
|
155
|
-
width: u(
|
|
159
|
+
width: u(board),
|
|
156
160
|
height: "100%",
|
|
157
161
|
// Room to spare: centred. Too narrow: the scroll pans from the board's left edge to its right one.
|
|
158
|
-
transform: `translateX(calc(max(0px, 100cqi - ${u(
|
|
162
|
+
transform: `translateX(calc(max(0px, 100cqi - ${u(board)}) * 0.5 + min(0px, 100cqi - ${u(board)}) * clamp(0, (var(--p) - 0.32) * 2.8, 1)))`,
|
|
159
163
|
}}
|
|
160
164
|
>
|
|
161
165
|
{children}
|
|
@@ -226,8 +230,8 @@ export function Float({ x, y, w, depth, show = true, children, style }: { x: num
|
|
|
226
230
|
)
|
|
227
231
|
}
|
|
228
232
|
|
|
229
|
-
/** A dark card of code: a request, a payload. `lines` are printed as they are; one can be lit (`hot`)
|
|
230
|
-
export function CodeCard({ title, meta, lines, signal }: { title: string; meta?: string; lines: { text: string; hot?: boolean; hidden?: boolean }[]; signal: string }) {
|
|
233
|
+
/** A dark card of code: a request, a payload. `lines` are printed as they are; one can be lit (`hot`), held back (`hidden`) or said lower (`dim`: a comment). */
|
|
234
|
+
export function CodeCard({ title, meta, lines, signal }: { title: string; meta?: string; lines: { text: string; hot?: boolean; hidden?: boolean; dim?: boolean }[]; signal: string }) {
|
|
231
235
|
return (
|
|
232
236
|
<div style={{ background: "#151019", color: "#e9e4ec" }}>
|
|
233
237
|
<div style={{ display: "flex", alignItems: "center", gap: u(7), padding: `${u(8)} ${u(12)}`, borderBottom: "1px solid rgba(255,255,255,0.1)", fontSize: u(10.5), fontWeight: 600 }}>
|
|
@@ -244,7 +248,7 @@ export function CodeCard({ title, meta, lines, signal }: { title: string; meta?:
|
|
|
244
248
|
maxHeight: l.hidden ? 0 : u(18),
|
|
245
249
|
opacity: l.hidden ? 0 : 1,
|
|
246
250
|
background: l.hot ? hexAlpha(signal, 0.16) : "transparent",
|
|
247
|
-
color: l.hot ? signal : undefined,
|
|
251
|
+
color: l.hot ? signal : l.dim ? "rgba(255,255,255,0.5)" : undefined,
|
|
248
252
|
boxShadow: l.hot ? `inset ${u(2)} 0 0 ${signal}` : "none",
|
|
249
253
|
transition: "background 0.4s ease, color 0.4s ease, max-height 0.4s ease, opacity 0.4s ease",
|
|
250
254
|
}}
|
|
@@ -258,7 +262,7 @@ export function CodeCard({ title, meta, lines, signal }: { title: string; meta?:
|
|
|
258
262
|
}
|
|
259
263
|
|
|
260
264
|
/** The pointer. Positions are the window's design pixels. */
|
|
261
|
-
export function Cursor({ x, y, down, hidden, ms = 700 }: { x: number; y: number; down?: boolean; hidden?: boolean; ms?: number }) {
|
|
265
|
+
export function Cursor({ x, y, down, hidden, ms = 700, size = 17 }: { x: number; y: number; down?: boolean; hidden?: boolean; ms?: number; size?: number }) {
|
|
262
266
|
return (
|
|
263
267
|
<div
|
|
264
268
|
style={{
|
|
@@ -272,7 +276,7 @@ export function Cursor({ x, y, down, hidden, ms = 700 }: { x: number; y: number;
|
|
|
272
276
|
pointerEvents: "none",
|
|
273
277
|
}}
|
|
274
278
|
>
|
|
275
|
-
<svg viewBox="0 0 20 22" style={{ display: "block", width: u(
|
|
279
|
+
<svg viewBox="0 0 20 22" style={{ display: "block", width: u(size), height: u((size * 19) / 17), transform: down ? "scale(0.86)" : "none", transformOrigin: "0 0", transition: "transform 0.15s ease", filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.35))" }}>
|
|
276
280
|
<path d="M2 1.5v16l4.4-4 2.9 6.6 2.9-1.3-2.9-6.4h6.2z" fill="#111" stroke="#fff" strokeWidth="1.5" strokeLinejoin="round" />
|
|
277
281
|
</svg>
|
|
278
282
|
</div>
|
|
@@ -298,6 +302,18 @@ const ICON = {
|
|
|
298
302
|
check: "M5 12.5l4.5 4.5L19 7.5",
|
|
299
303
|
chevron: "M6 9l6 6l6-6",
|
|
300
304
|
columns: "M4 4h16v16H4zM9.5 4v16M14.5 4v16",
|
|
305
|
+
monitor: "M3 4h18v12H3zM8 20h8M12 16v4",
|
|
306
|
+
bot: "M12 8V4H8M5 8h14v12H5zM2 14h3M19 14h3M9.5 13v2M14.5 13v2",
|
|
307
|
+
clock: "M12 3a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM12 7v5l3 2",
|
|
308
|
+
layers: "M12 3l9 5l-9 5l-9-5zM3 13l9 5l9-5",
|
|
309
|
+
history: "M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5M12 7v5l3 2",
|
|
310
|
+
card: "M3 5h18v14H3zM3 10h18",
|
|
311
|
+
key: "M16 3a5 5 0 1 0 0 10a5 5 0 0 0 0-10zM12.5 11.5L4 20M7 17l2.5 2.5",
|
|
312
|
+
book: "M12 7v13M3 5h6a3 3 0 0 1 3 3a3 3 0 0 1 3-3h6v13h-6a3 3 0 0 0-3 2a3 3 0 0 0-3-2H3z",
|
|
313
|
+
external: "M14 4h6v6M20 4l-9 9M18 14v6H4V6h6",
|
|
314
|
+
search: "M11 4a7 7 0 1 0 0 14a7 7 0 0 0 0-14zM20 20l-3.5-3.5",
|
|
315
|
+
more: "M12 5h.01M12 12h.01M12 19h.01",
|
|
316
|
+
download: "M12 4v11M7 11l5 5l5-5M5 20h14",
|
|
301
317
|
} as const
|
|
302
318
|
|
|
303
319
|
export type IconId = keyof typeof ICON
|
|
@@ -8,6 +8,14 @@ import { BoardScreen } from "./cms/board"
|
|
|
8
8
|
import { PageScreen } from "./cms/page"
|
|
9
9
|
import { TableScreen } from "./cms/table"
|
|
10
10
|
import { ViewsScreen } from "./cms/views"
|
|
11
|
+
import { DriveScreen } from "./desktop/drive"
|
|
12
|
+
import { HandoffScreen } from "./desktop/handoff"
|
|
13
|
+
import { LauncherScreen } from "./desktop/launcher"
|
|
14
|
+
import { WallScreen } from "./desktop/wall"
|
|
15
|
+
import { BookScreen } from "./foyer/book"
|
|
16
|
+
import { PantryScreen } from "./foyer/pantry"
|
|
17
|
+
import { PhoneScreen } from "./foyer/phone"
|
|
18
|
+
import { WeekScreen } from "./foyer/week"
|
|
11
19
|
import type { StageColors } from "./stage"
|
|
12
20
|
|
|
13
21
|
/* The client half of a `showcase` section: the home (drawn on the server) hands a screen's id and what
|
|
@@ -20,6 +28,14 @@ const SCREENS: Record<ShowcaseScreenId, (props: ScreenProps) => ReactNode> = {
|
|
|
20
28
|
"cms-table": TableScreen,
|
|
21
29
|
"cms-page": PageScreen,
|
|
22
30
|
"cms-views": ViewsScreen,
|
|
31
|
+
"desktop-wall": WallScreen,
|
|
32
|
+
"desktop-drive": DriveScreen,
|
|
33
|
+
"desktop-handoff": HandoffScreen,
|
|
34
|
+
"desktop-launcher": LauncherScreen,
|
|
35
|
+
"foyer-phone": PhoneScreen,
|
|
36
|
+
"foyer-week": WeekScreen,
|
|
37
|
+
"foyer-pantry": PantryScreen,
|
|
38
|
+
"foyer-book": BookScreen,
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
export function ShowcaseScreen({ screen, locale, product, theme, palette, label }: { screen: ShowcaseScreenId; locale: "en" | "fr"; product: BrandProductId; theme: BrandTheme; palette?: BrandPalette; label: string }) {
|
package/src/home/types.ts
CHANGED
|
@@ -39,6 +39,9 @@ export type HomeSection =
|
|
|
39
39
|
illustration?: IllustrationId
|
|
40
40
|
/** A 3D module beside (split) or under (centered) the copy — or behind it (band). Takes the illustration's place. */
|
|
41
41
|
scene?: Module3DRef
|
|
42
|
+
/** A screen of the product, playing beside (split) or under (centered) the copy — a narrow one, drawn for a
|
|
43
|
+
column (`foyer-phone`). Takes the illustration's and the scene's place; not in a band. */
|
|
44
|
+
screen?: ShowcaseScreenId
|
|
42
45
|
})
|
|
43
46
|
| (Base & {
|
|
44
47
|
kind: "facts"
|