Skip to content

Commit 60293ad

Browse files
committed
Add spotlight fill.
1 parent 025a87d commit 60293ad

14 files changed

Lines changed: 128 additions & 78 deletions

File tree

‎frontend/purestack.studio/components/landing/landing-band/landing-band.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Use backgrounds as decoration and keep meaningful image content in a normal imag
143143
</ApiProperty>
144144

145145
<ApiProperty anchor="landing-band-prop-variant" name="variant" valueType="RefOrValue&lt;ComponentVariant&gt;" defaultValue="surfaceAlt">
146-
<p>Visual treatment. Accepts solid, surface, surfaceAlt, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
146+
<p>Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
147147
</ApiProperty>
148148

149149
<ApiProperty anchor="landing-band-prop-variantMode" name="variantMode" valueType="RefOrValue&lt;ComponentVariantMode&gt;" defaultValue="stateless">

‎frontend/purestack.studio/components/layout/panel/panel.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Panel does not add an action or an accessible label. Give content sections a hea
137137
</ApiProperty>
138138

139139
<ApiProperty anchor="panel-prop-variant" name="variant" valueType="RefOrValue&lt;ComponentVariant&gt;" defaultValue="surface">
140-
<p>Visual treatment. Accepts solid, surface, surfaceAlt, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
140+
<p>Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.</p>
141141
</ApiProperty>
142142

143143
<ApiProperty anchor="panel-prop-variantMode" name="variantMode" valueType="RefOrValue&lt;ComponentVariantMode&gt;" defaultValue="stateless">

‎frontend/purestack.studio/guides/semantic-tones.mdx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ Each card below uses the same surface, border, text, padding, and radius classes
8080

8181
## Compare roles within one tone
8282

83-
A tone contains more than one background and text color. These three samples all select `accent`, but paint different roles from that palette:
83+
A tone contains more than one background and text color. These samples all select `accent`, but paint different roles from that palette:
8484

85-
<Grid columns="1" columnsMd="3" class="gap-3">
85+
<Grid columns="1" columnsMd="2" columnsLg="4" class="gap-3">
8686
<div class="tone--accent tone-fill-surface tone-border-surface tone-text-surface b-1 rounded-md p-3">
8787
<strong class="d-block mb-1">surface</strong>
8888
<span class="fs-sm">A regular content surface.</span>
@@ -95,6 +95,10 @@ A tone contains more than one background and text color. These three samples all
9595
<strong class="d-block mb-1">button</strong>
9696
<span class="fs-sm">The stronger action treatment.</span>
9797
</div>
98+
<div class="tone--accent tone-fill-spotlight tone-border-surface-alt tone-text-surface-alt b-1 rounded-md p-3">
99+
<strong class="d-block mb-1">spotlight</strong>
100+
<span class="fs-sm">A calm, lit field for feature bands.</span>
101+
</div>
98102
</Grid>
99103

100104
```mdx
@@ -109,10 +113,16 @@ A tone contains more than one background and text color. These three samples all
109113
<div class="tone--accent tone-fill-button tone-border-button tone-text-button b-1 rounded-md p-3">
110114
Button role
111115
</div>
116+
117+
<div class="tone--accent tone-fill-spotlight tone-border-surface-alt tone-text-surface-alt b-1 rounded-md p-3">
118+
Spotlight field
119+
</div>
112120
```
113121

114122
Keep fill, border, and text from the same role when you need a ready-made combination. Each role's colors are designed as a set within the active theme. The direct `tone-fill`, `tone-border`, and `tone-text` classes use the tone color itself; they are useful for accents, but they are not the same as a complete surface or button treatment.
115123

124+
`spotlight` is for large areas such as feature bands, callouts, and showcase panels. It is a deep field lit softly from the top-left corner, without the gloss and edge shading of surfaces and buttons, so it stays calm at any size. It has no interaction states and pairs with the alternate surface border and text classes. Components accept it as `variant="spotlight"`, for example `<Panel tone="accent" variant="spotlight">`.
125+
116126
## Tone-colored text and clipped fills
117127

118128
Use `tone-text` for the selected tone color. Use `tone-text-bg-button` when you want the button role's background treatment clipped into text. Both examples keep a neutral surrounding surface; the tone changes only for the label:

‎frontend/theme/studioSkinLight.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ function state(background: string, border: string, text: string) {
2020
return { background, bgcolor: background, border, text }
2121
}
2222

23+
function spotlight(lit: string, deep: string) {
24+
return `radial-gradient(circle at 8% 0%, #ffffff66 0%, transparent 38%), linear-gradient(135deg, ${lit} 0%, ${deep} 75%)`
25+
}
26+
2327
function createLightTone(colors: LightToneColors): StudioTone {
2428
const {
2529
ink,
@@ -36,6 +40,7 @@ function createLightTone(colors: LightToneColors): StudioTone {
3640
return {
3741
tone: fill,
3842
canvas: tint,
43+
spotlight: spotlight(tint, tintActive),
3944
canvascolor: tint,
4045
overlay: '#14291e40',
4146
text: { default: ink, subtle: muted },
@@ -72,6 +77,7 @@ export function createStudioLightPalette(): ThemePalette {
7277
const neutral: StudioTone = {
7378
tone: '#51695b',
7479
canvas: '#f6f8f4',
80+
spotlight: spotlight('#ffffff', '#e4ede3'),
7581
canvascolor: '#f6f8f4',
7682
overlay: '#14291e40',
7783
text: { default: '#1c2d24', subtle: '#57695e' },

‎packages/ts-components/src/standard/componentVariant.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type ComponentVariant =
66
| 'solid'
77
| 'surface'
88
| 'surfaceAlt'
9+
| 'spotlight'
910
| 'outlineFill'
1011
| 'outline'
1112
| 'subtle'
@@ -40,6 +41,8 @@ const STATELESS_COMPONENT_VARIANT_CLASSES: Record<ComponentVariant, string> = {
4041
'b-1 rounded-md tone-fill-surface tone-border-surface tone-text-surface',
4142
surfaceAlt:
4243
'b-1 rounded-md tone-fill-surface-alt tone-border-surface-alt tone-text-surface-alt',
44+
spotlight:
45+
'b-1 rounded-md tone-fill-spotlight tone-border-surface-alt tone-text-surface-alt',
4346
outlineFill: 'b-2 rounded-md tone-border-button tone-text',
4447
outline: 'b-2 rounded-md tone-text',
4548
subtle: 'b-0 rounded-md tone-text',

‎packages/ts-ssg/sample-content/home.css‎

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,16 @@
11
/*
22
* Waypoint landing page.
33
*
4-
* Structure lives in index.mdx: Grid, Flex, SectionHeader, BtnLink, Badge, and
5-
* Icon with utility classes. This file adds only what the theme cannot know:
6-
* the Waypoint brand, the display type, the fluid rhythm, and the illustrated
7-
* product views.
4+
* Structure and color live in index.mdx: Grid, Flex, Panel, SectionHeader,
5+
* BtnLink, Badge, and Icon with tone and utility classes, so the page follows
6+
* the site theme and its presets. This file adds only sizes and rhythm the
7+
* utility scale does not cover yet.
88
*
9-
* Brand colors are tone scopes. Each one sets the same --ps-current-* variables
10-
* a tone--* class sets, so utilities such as tone-text, text-subtle, b-subtle,
11-
* and the BtnLink variants render in Waypoint colors.
9+
* Rules nest under .waypoint-home for specificity rather than @scope, so they
10+
* still apply inside theme--light and theme--dark regions.
1211
*/
1312

1413
.waypoint-home {
15-
/* Night: the dark product views, the same in both themes. */
16-
.wp-night {
17-
--ps-current-tone: #8fd7df;
18-
--ps-current-text-default: #fff;
19-
--ps-current-text-subtle: #c4dbe5;
20-
--ps-current-border-subtle: rgba(210, 236, 248, 0.14);
21-
--ps-current-border-default: rgba(195, 225, 240, 0.22);
22-
color: var(--ps-current-text-default);
23-
}
24-
25-
/* Paper: light cards laid over the night views. */
26-
.wp-paper {
27-
--ps-current-text-default: #183449;
28-
--ps-current-text-subtle: #637b8a;
29-
--ps-current-border-subtle: #e1e9ef;
30-
--ps-current-border-default: #dce6ed;
31-
background: #f5f9fb;
32-
color: var(--ps-current-text-default);
33-
}
34-
3514
:where(h1, h2, h3, p) {
3615
margin: 0;
3716
}
@@ -359,16 +338,10 @@
359338

360339
/* Weekly brief. */
361340
.wp-brief {
362-
gap: clamp(2rem, 6vw, 6rem);
363341
padding: 1.5rem;
364-
border-radius: 1.35rem;
365-
background:
366-
radial-gradient(
367-
circle at 8% 0%,
368-
rgba(94, 170, 196, 0.23),
369-
transparent 37%
370-
),
371-
linear-gradient(135deg, #173d54, #0c2a3e 75%);
342+
}
343+
.wp-brief-grid {
344+
gap: clamp(2rem, 6vw, 6rem);
372345
}
373346
.wp-brief-title {
374347
max-width: 12ch;
@@ -387,17 +360,11 @@
387360
.wp-brief-link {
388361
gap: 1rem;
389362
margin-top: 2rem;
390-
color: #a8e6e7;
391363
font-size: 0.9rem;
392364
font-weight: 750;
393365
}
394366
.wp-brief-paper {
395367
padding: clamp(1.4rem, 3vw, 2.5rem);
396-
border-radius: 0.95rem;
397-
box-shadow: 0 25px 50px rgba(0, 17, 30, 0.25);
398-
}
399-
.wp-paper-label {
400-
color: #6a8697;
401368
}
402369
.wp-paper-top {
403370
gap: 0.4rem;
@@ -431,22 +398,13 @@
431398
height: 0.55rem;
432399
margin-top: 0.28rem;
433400
}
434-
.wp-dot-done {
435-
background: #33a582;
436-
}
437-
.wp-dot-open {
438-
background: #d2a460;
439-
}
440401
.wp-paper-footer {
441402
gap: 0.5rem;
442403
margin-top: 0.4rem;
443404
padding-top: 1rem;
444405
letter-spacing: 0.1em;
445406
font-size: 0.59rem;
446407
}
447-
.wp-paper-footer strong {
448-
color: #2a6171;
449-
}
450408

451409
/* Page destinations and closing action. */
452410
.wp-explore {

‎packages/ts-ssg/sample-content/index.mdx‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,29 @@ nav:
9898
<Grid container="a" href="/journal/weekly-review/" columns="2rem minmax(0, 1fr) 1.2rem" alignItems="start" class="wp-step bb-1 b-subtle"><span class="wp-step-number tone-text">03</span><Flex container="span" direction="column" class="wp-step-copy"><strong>Share the learning</strong><small>Turn the week's work into a short, useful story for everyone.</small></Flex><Icon name="lucide:arrow-up-right" class="wp-arrow tone-text" aria-hidden="true"/></Grid>
9999
</div>
100100
</Grid>
101-
<Grid container="section" columns="1" columnsMd="minmax(0, 0.85fr) minmax(0, 1.15fr)" alignItems="center" class="wp-brief wp-night overflow-hidden" aria-labelledby="wp-brief-title">
102-
<SectionHeader
103-
eyebrow="The Friday brief"
104-
title="An update people will actually read."
105-
titleId="wp-brief-title"
106-
subtitle="Share what moved, what needs a decision, and where the team goes next. The example workspace keeps the details close when someone wants to go deeper."
107-
eyebrowClass="wp-eyebrow"
108-
titleClass="wp-brief-title"
109-
subtitleClass="wp-brief-lead"
110-
>
111-
<a href="/workspace/" class="wp-brief-link wp-inline-link d-inline-flex underline-hover">Explore the example workspace <Icon name="lucide:arrow-up-right" aria-hidden="true"/></a>
112-
</SectionHeader>
113-
<div class="wp-brief-paper wp-paper">
114-
<Flex direction="column" directionSm="row" justify="between" class="wp-paper-top wp-micro wp-paper-label bb-1 b-default"><span>WEEK 06 / AUTUMN LAUNCH</span><span>FRIDAY BRIEF</span></Flex>
115-
<h3>A good week of progress.</h3>
116-
<p class="wp-paper-summary text-subtle">The design handoff is complete. The help center draft is ready for final review.</p>
117-
<Flex align="start" class="wp-paper-line bt-1 b-subtle"><span class="wp-paper-dot wp-dot-done rounded-pill" aria-hidden="true"></span><Flex direction="column" class="gap-1"><strong>Moved forward</strong><span class="text-subtle mb-0">Release checklist prepared for review</span></Flex></Flex>
118-
<Flex align="start" class="wp-paper-line bt-1 b-subtle"><span class="wp-paper-dot wp-dot-open rounded-pill" aria-hidden="true"></span><Flex direction="column" class="gap-1"><strong>Needs a decision</strong><span class="text-subtle mb-0">Confirm the release date after accessibility sign-off</span></Flex></Flex>
119-
<Flex justify="between" class="wp-paper-footer wp-micro wp-paper-label bt-1 b-default">NEXT REVIEW <strong>FRIDAY, 10:00</strong></Flex>
120-
</div>
121-
</Grid>
101+
<Panel tone="accent" variant="spotlight" class="wp-brief theme--dark rounded-lg" aria-labelledby="wp-brief-title">
102+
<Grid columns="1" columnsMd="minmax(0, 0.85fr) minmax(0, 1.15fr)" alignItems="center" class="wp-brief-grid">
103+
<SectionHeader
104+
eyebrow="The Friday brief"
105+
title="An update people will actually read."
106+
titleId="wp-brief-title"
107+
subtitle="Share what moved, what needs a decision, and where the team goes next. The example workspace keeps the details close when someone wants to go deeper."
108+
eyebrowClass="wp-eyebrow"
109+
titleClass="wp-brief-title"
110+
subtitleClass="wp-brief-lead"
111+
>
112+
<a href="/workspace/" class="wp-brief-link wp-inline-link d-inline-flex tone-text underline-hover">Explore the example workspace <Icon name="lucide:arrow-up-right" aria-hidden="true"/></a>
113+
</SectionHeader>
114+
<Panel tone="neutral" variant="spotlight" class="wp-brief-paper theme--light rounded-lg">
115+
<Flex direction="column" directionSm="row" justify="between" class="wp-paper-top wp-micro text-subtle mb-0 bb-1 b-default"><span>WEEK 06 / AUTUMN LAUNCH</span><span>FRIDAY BRIEF</span></Flex>
116+
<h3>A good week of progress.</h3>
117+
<p class="wp-paper-summary text-subtle">The design handoff is complete. The help center draft is ready for final review.</p>
118+
<Flex align="start" class="wp-paper-line bt-1 b-subtle"><span class="wp-paper-dot tone--success tone-fill-button rounded-pill" aria-hidden="true"></span><Flex direction="column" class="gap-1"><strong>Moved forward</strong><span class="text-subtle mb-0">Release checklist prepared for review</span></Flex></Flex>
119+
<Flex align="start" class="wp-paper-line bt-1 b-subtle"><span class="wp-paper-dot tone--warning tone-fill-button rounded-pill" aria-hidden="true"></span><Flex direction="column" class="gap-1"><strong>Needs a decision</strong><span class="text-subtle mb-0">Confirm the release date after accessibility sign-off</span></Flex></Flex>
120+
<Flex justify="between" class="wp-paper-footer wp-micro text-subtle mb-0 bt-1 b-default">NEXT REVIEW <strong class="tone--accent tone-text">FRIDAY, 10:00</strong></Flex>
121+
</Panel>
122+
</Grid>
123+
</Panel>
122124
<section class="wp-explore" aria-labelledby="wp-explore-title">
123125
<Flex direction="column" directionMd="row" align="start" alignMd="end" justify="between" class="gap-6 mb-6">
124126
<SectionHeader

‎packages/ts-style/src/semanticPresets.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ function createFills(
162162
background: current.canvas,
163163
},
164164
},
165+
'tone-fill-spotlight': {
166+
rest: {
167+
background: current.spotlight,
168+
},
169+
},
165170
'tone-fill-surface': {
166171
all: true,
167172
rest: {

‎packages/ts-style/src/semanticTone.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function createCurrentPalette(
116116
return {
117117
tone: tokens.tone,
118118
canvas: tokens.canvas,
119+
spotlight: tokens.spotlight,
119120
canvascolor: tokens.canvascolor,
120121
overlay: tokens.overlay,
121122
surface: {

‎packages/ts-style/src/skins/standard/chrome.ts‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,52 @@ function layered(layers: string[]) {
2929
return layers.filter(Boolean).join(', ')
3030
}
3131

32+
function luminance(hex: string) {
33+
const { r, g, b } = hexToRgba(hex)
34+
return 0.2126 * r + 0.7152 * g + 0.0722 * b
35+
}
36+
37+
function mix(from: string, to: string, amount: number) {
38+
const a = hexToRgba(from)
39+
const b = hexToRgba(to)
40+
const channel = (x: number, y: number) =>
41+
Math.round(x + (y - x) * amount)
42+
.toString(16)
43+
.padStart(2, '0')
44+
return `#${channel(a.r, b.r)}${channel(a.g, b.g)}${channel(a.b, b.b)}`
45+
}
46+
47+
export type SpotlightColors = {
48+
surface: string
49+
surfaceAlt: string
50+
button: string
51+
}
52+
53+
/**
54+
* A deep field lit from one corner, for feature bands and showcase panels.
55+
* Unlike surfaces it has no gloss, hotspot, or edge shading, so large areas
56+
* stay calm. The field runs from a lit edge down into the alternate surface.
57+
* Light comes from the button color when it is brighter than the surface, so
58+
* dark fields keep their hue, and from white on light fields.
59+
*/
60+
export function createSpotlight(
61+
{ surface, surfaceAlt, button }: SpotlightColors,
62+
options: ChromeOptions = {},
63+
) {
64+
const lighting = clamp(options.lighting ?? 0.72, 0, 1.5)
65+
const light = luminance(button) > luminance(surface) ? button : '#ffffff'
66+
return layered([
67+
radialAt('8% 0%', [
68+
[rgba(mix(light, '#ffffff', 0.4), 0.7 * lighting), '0%'],
69+
['transparent', '38%'],
70+
]),
71+
linear('135deg', [
72+
[mix(surface, light, 0.35), '0%'],
73+
[mix(surface, surfaceAlt, 0.3), '75%'],
74+
]),
75+
])
76+
}
77+
3278
export function createChrome(
3379
kind: ChromeKind,
3480
scale: ToneScale,

0 commit comments

Comments
 (0)