Skip to content

Commit 025a87d

Browse files
committed
Any element can now keep the light or dark palette.
1 parent df11aa5 commit 025a87d

8 files changed

Lines changed: 745 additions & 935 deletions

File tree

‎frontend/purestack.studio/components/layout/section-header/section-header.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Choose heading levels in order. Visual size and heading semantics are independen
9898
<a href="#section-header-prop-subtitle">subtitle</a>
9999
<a href="#section-header-prop-footnote">footnote</a>
100100
<a href="#section-header-prop-titleTag">titleTag</a>
101+
<a href="#section-header-prop-titleId">titleId</a>
101102
<a href="#section-header-prop-eyebrowClass">eyebrowClass</a>
102103
<a href="#section-header-prop-titleClass">titleClass</a>
103104
<a href="#section-header-prop-subtitleClass">subtitleClass</a>
@@ -124,6 +125,10 @@ Choose heading levels in order. Visual size and heading semantics are independen
124125
<p>Heading element. Accepts h1–h6, p, div or span; invalid values fall back to h2. Match the surrounding document hierarchy.</p>
125126
</ApiProperty>
126127

128+
<ApiProperty anchor="section-header-prop-titleId" name="titleId" valueType="RefOrValue&lt;string&gt;" defaultValue="not set">
129+
<p>Id on the title element. Reference it from the surrounding section with aria-labelledby.</p>
130+
</ApiProperty>
131+
127132
<ApiProperty anchor="section-header-prop-eyebrowClass" name="eyebrowClass" valueType="RefOrValue&lt;string&gt;" defaultValue="not set">
128133
<p>Additional classes on the eyebrow element. Use existing typography and spacing utilities.</p>
129134
</ApiProperty>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,30 @@ Tone selection applies to descendants through current-palette CSS variables. A n
177177

178178
The inner `text-eyebrow` also reads the current palette, so its subtle text color changes with `tone--success`. This is why tone classes are useful for composing a small visual system instead of setting each color separately.
179179

180+
## Keep a region in one theme mode
181+
182+
Tones follow the page theme, so a neutral card is light in the light theme and dark in the dark theme. Add `theme--dark` or `theme--light` to keep a region in one mode while the page switches. The region gets that mode's full palette from the same skin and presets, and tone classes inside it work as usual. Here a dark product frame holds a light card in both themes:
183+
184+
<div class="theme--dark tone--accent tone-fill-surface-alt tone-border-surface-alt tone-text-surface-alt b-1 rounded-lg p-3">
185+
<span class="text-eyebrow">Project view</span>
186+
<div class="theme--light tone-fill-surface tone-border-surface tone-text-surface b-1 rounded-md p-3">
187+
<strong class="d-block">Autumn launch</strong>
188+
<span class="text-subtle fs-sm">Light card, dark frame, in either theme.</span>
189+
</div>
190+
</div>
191+
192+
```mdx
193+
<div class="theme--dark tone--accent tone-fill-surface-alt tone-border-surface-alt tone-text-surface-alt b-1 rounded-lg p-3">
194+
<span class="text-eyebrow">Project view</span>
195+
<div class="theme--light tone-fill-surface tone-border-surface tone-text-surface b-1 rounded-md p-3">
196+
<strong class="d-block">Autumn launch</strong>
197+
<span class="text-subtle fs-sm">Light card, dark frame, in either theme.</span>
198+
</div>
199+
</div>
200+
```
201+
202+
A `theme--*` region starts from the neutral tone of its mode and resets the inherited text color. Put `tone--*` on the same element or on a descendant. Rules that must win inside a region should rely on specificity, not on an outer `@scope`, because the region becomes the nearest theme scope.
203+
180204
## Hover, active, and disabled states
181205

182206
Surface and button paint roles have state variants. Hover or press the first control; compare it with the disabled control. The `-all` suffix includes the rest, hover, active, and disabled treatments for that role.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface SectionHeader {
1313
subtitle?: RefOrValue<string>
1414
footnote?: RefOrValue<string>
1515
titleTag?: RefOrValue<string>
16+
titleId?: RefOrValue<string>
1617
eyebrowClass?: RefOrValue<string>
1718
titleClass?: RefOrValue<string>
1819
subtitleClass?: RefOrValue<string>
@@ -26,6 +27,7 @@ const sectionHeaderTemplate = html`<div class="section-header">
2627
</div>
2728
<div
2829
:is="resolvedTitleTag"
30+
:id="titleId"
2931
class="text-title"
3032
:class="titleClass"
3133
r-if="title"
@@ -49,6 +51,7 @@ function defineSectionHeaderComponent() {
4951
'subtitle',
5052
'footnote',
5153
'titleTag',
54+
'titleId',
5255
'eyebrowClass',
5356
'titleClass',
5457
'subtitleClass',

0 commit comments

Comments
 (0)