@profullstack/css 0.2.1 → 0.3.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.
@@ -103,6 +103,45 @@ Automatic upgrades need no markup: a single `<select>` gets a themed picker, a `
103
103
 
104
104
  Corner shape is one token: `:root { --pf-corner-shape: squircle; }` reshapes cards, buttons, inputs, dialogs, and popovers.
105
105
 
106
+ ## Widgets
107
+
108
+ The widgets layer covers the pieces apps keep rebuilding. Compose them from these names only.
109
+
110
+ ```html
111
+ <!-- App bar: icon buttons with counts open anchored popovers -->
112
+ <button type="button" class="icon-button" aria-label="Cart, 3 items" data-count="3" popovertarget="cart"><svg aria-hidden="true">…</svg></button>
113
+ <div id="cart" popover data-anchor>
114
+ <ul role="list" class="stack">
115
+ <li class="media"><span class="thumb">…</span><div><strong>Headphones</strong><small>Qty 1</small></div><span>$189</span></li>
116
+ </ul>
117
+ <a class="button" href="/checkout">Checkout</a>
118
+ </div>
119
+
120
+ <!-- Scroller with arrows; the app pages it with scrollBy() -->
121
+ <div class="scroller-frame">
122
+ <button type="button" data-scroll="prev" aria-label="Previous" tabindex="-1">‹</button>
123
+ <ul class="scroller" role="list" aria-label="Trending">
124
+ <li><a class="tile" href="/t/1" data-shape="poster"><img src="/p.jpg" alt=""><strong>Title</strong></a></li>
125
+ </ul>
126
+ <button type="button" data-scroll="next" aria-label="Next" tabindex="-1">›</button>
127
+ </div>
128
+
129
+ <!-- Date range: joined inputs plus a picker in a popover -->
130
+ <div class="field-group">
131
+ <input type="date" aria-label="Check in"><span>→</span><input type="date" aria-label="Check out">
132
+ <button type="button" popovertarget="stay" aria-label="Choose dates">📅</button>
133
+ </div>
134
+ <div id="stay" popover data-anchor><table class="calendar">…</table></div>
135
+
136
+ <!-- Color: native picker plus preset swatches -->
137
+ <div class="swatches" role="radiogroup" aria-label="Brand color">
138
+ <input type="radio" name="c" value="#126b55" style="--swatch: #126b55" aria-label="Teal" checked>
139
+ </div>
140
+ <input type="color" value="#126b55" aria-label="Custom color">
141
+ ```
142
+
143
+ TV apps: set `data-input="tv"` on `<html>`. Build shelves from `section > h2 + .scroller-frame` with `.tile` links; D-pad focus does the rest.
144
+
106
145
  ## Theme control
107
146
 
108
147
  The browser preference is the default. An app with a theme setting can write `data-theme="light"` or `data-theme="dark"` onto the root `<html>` element. The application owns persistence and the control; the stylesheet only provides the colors.
package/docs/index.html CHANGED
@@ -63,6 +63,8 @@
63
63
  <li><a href="#start">Quick start</a></li>
64
64
  <li><a href="#layout">Layout</a></li>
65
65
  <li><a href="#components">Components</a></li>
66
+ <li><a href="#widgets">Widgets</a></li>
67
+ <li><a href="#tv">TV mode</a></li>
66
68
  <li><a href="#themes">Themes</a></li>
67
69
  <li><a href="#customize">Customize</a></li>
68
70
  <li><a href="#agents">Agents</a></li>
@@ -71,7 +73,7 @@
71
73
 
72
74
  <article class="docs-content">
73
75
  <header class="stack" data-space="sm">
74
- <p class="eyebrow">Documentation / 0.1.0</p>
76
+ <p class="eyebrow">Documentation / 0.3.0</p>
75
77
  <h1>Make the browser do more.</h1>
76
78
  <p class="muted">A small stylesheet that starts with semantic HTML, gives it considered defaults, and makes its interface clear to the next person or agent who reads it.</p>
77
79
  </header>
@@ -130,6 +132,36 @@
130
132
  </div>
131
133
  </section>
132
134
 
135
+ <section class="docs-section" id="widgets">
136
+ <h2>Widgets</h2>
137
+ <p>The widgets layer styles the pieces apps keep rebuilding. It is still plain CSS: paging a scroller, switching a tab or picking a date is your app's code, and <code>examples/examples.js</code> shows each in a few lines.</p>
138
+ <div class="component-list">
139
+ <article class="card stack" data-space="sm"><h3>Icon buttons and menus</h3><p><code>.icon-button</code> with <code>data-count</code> for carts, inboxes and bells; <code>.menu</code> inside a popover for account and action menus.</p><div class="cluster"><button type="button" class="icon-button" aria-label="Cart, 3 items" data-count="3" popovertarget="docs-cart"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h2l2.4 12.2a2 2 0 0 0 2 1.6h8.2a2 2 0 0 0 2-1.6L21 7H6"/><circle cx="10" cy="20.5" r="1.3"/><circle cx="18" cy="20.5" r="1.3"/></svg></button><div id="docs-cart" popover data-anchor><ul class="menu"><li><small>Cart</small></li><li><a href="#widgets">Headphones<span class="badge">$189</span></a></li><li><a href="#widgets">Keyboard<span class="badge">$129</span></a></li><hr><li><a href="#widgets">Checkout</a></li></ul></div></div></article>
140
+ <article class="card stack" data-space="sm"><h3>Scrollers</h3><p><code>.scroller</code> on a list of focusable items, in a <code>.scroller-frame</code> with <code>data-scroll="prev|next"</code> arrows. Keyboard, touch and TV remotes scroll it by moving focus.</p><ul class="scroller" role="list" aria-label="Sample row" style="--pf-scroller-item: 6rem"><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">1</span><small>One</small></a></li><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">2</span><small>Two</small></a></li><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">3</span><small>Three</small></a></li><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">4</span><small>Four</small></a></li></ul></article>
141
+ <article class="card stack" data-space="sm"><h3>Dates</h3><p>Native date inputs match the theme. <code>table.calendar</code> is a picker or, with <code>data-view="month"</code>, a calendar display with <code>.event</code> chips; <code>.field-group</code> joins a range.</p><div class="field-group"><input type="date" aria-label="From" value="2026-12-18"><span>→</span><input type="date" aria-label="To" value="2026-12-23"></div></article>
142
+ <article class="card stack" data-space="sm"><h3>Color and controls</h3><p>A styled <code>input[type="color"]</code>, <code>.swatches</code> radios, <code>role="switch"</code>, <code>.segmented</code>, <code>.rating</code> and tabs.</p><div class="cluster"><input type="color" value="#126b55" aria-label="Color"><label><input type="checkbox" role="switch" checked>On</label><span class="ring" data-size="sm" style="--value: 72" role="img" aria-label="72 percent">72</span></div></article>
143
+ </div>
144
+ <p>Also included: <code>.media</code> rows, <code>.avatar</code>, <code>.toasts</code>, <code>.steps</code>, <code>.skeleton</code>, <code>.stat</code>, <code>.timeline</code>, <code>.breadcrumbs</code>, <code>.pagination</code>, <code>.dropzone</code> and a three-pane <code>.inbox</code>. See them together in <a href="../examples/widgets.html">widgets</a>, <a href="../examples/calendar.html">dates and calendars</a> and <a href="../examples/inbox.html">inbox</a>.</p>
145
+ </section>
146
+
147
+ <section class="docs-section" id="tv">
148
+ <h2>TV mode</h2>
149
+ <p>Set <code>data-input="tv"</code> on <code>&lt;html&gt;</code> for a 10-foot interface: larger type and targets, an overscan-safe inset, a loud focus ring that also shows on TV browsers without <code>:focus-visible</code>, zooming tiles and always-visible scroller arrows.</p>
150
+ <pre class="code-sample"><code>&lt;html data-input="tv" data-theme="dark"&gt;
151
+ …
152
+ &lt;section&gt;
153
+ &lt;h2&gt;Continue watching&lt;/h2&gt;
154
+ &lt;div class="scroller-frame"&gt;
155
+ &lt;button type="button" data-scroll="prev" aria-label="Back" tabindex="-1"&gt;‹&lt;/button&gt;
156
+ &lt;ul class="scroller" role="list"&gt;
157
+ &lt;li&gt;&lt;a class="tile" href="/watch/1"&gt;&lt;img src="/still.jpg" alt=""&gt;&lt;strong&gt;Night Shift&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
158
+ &lt;/ul&gt;
159
+ &lt;button type="button" data-scroll="next" aria-label="Forward" tabindex="-1"&gt;›&lt;/button&gt;
160
+ &lt;/div&gt;
161
+ &lt;/section&gt;</code></pre>
162
+ <p>TV browsers move focus with the D-pad on their own, so make every item a real link or button. Try <a href="../examples/tv.html">the TV example</a> with the arrow keys. The framework uses cascade layers, so a TV browser needs Chromium 99 or newer.</p>
163
+ </section>
164
+
133
165
  <section class="docs-section" id="themes">
134
166
  <h2>Color themes</h2>
135
167
  <p>Without an explicit choice, colors follow <code>prefers-color-scheme</code>. Set one attribute on the root element to choose a theme:</p>
@@ -0,0 +1,112 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Calendar — @profullstack/css</title>
7
+ <link rel="stylesheet" href="../css/profullstack.css">
8
+ <style>
9
+ .example-nav { border-bottom: 1px solid var(--pf-color-border); padding-block: 1rem; }
10
+ .example-nav .container { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
11
+ .example-nav a { text-decoration: none; }
12
+
13
+ .pickers { align-items: start; grid-template-columns: minmax(12rem, 1fr) minmax(19rem, 1.5fr) minmax(16rem, 19rem); }
14
+ @media (max-width: 70rem) { .pickers { grid-template-columns: minmax(0, 1fr); } }
15
+ .field-group svg, aside svg { block-size: 1.1rem; inline-size: 1.1rem; }
16
+ @media (max-width: 60rem) { main .grid[style] { grid-template-columns: minmax(0, 1fr) !important; } }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <header class="example-nav">
21
+ <div class="container"><a href="index.html"><strong>@profullstack/css</strong> examples</a><a href="../docs/index.html">Docs →</a></div>
22
+ </header>
23
+ <main class="container stack section" data-space="lg">
24
+ <header class="stack" data-space="sm">
25
+ <p class="eyebrow">Dates · 0.3</p>
26
+ <h1>Date pickers and calendars.</h1>
27
+ <p class="muted prose">Native date inputs styled to match, a picker and a range picker in anchored popovers, a full month calendar with events, and a day agenda. The calendar is a real <code>&lt;table&gt;</code>; today is <code>aria-current="date"</code>, chosen days <code>aria-pressed="true"</code>.</p>
28
+ </header>
29
+
30
+ <section class="stack" aria-labelledby="native-heading">
31
+ <h2 id="native-heading">Native inputs</h2>
32
+ <div class="grid" data-columns="4">
33
+ <div><label for="d1">Date</label><input id="d1" type="date" value="2026-12-02"></div>
34
+ <div><label for="d2">Time</label><input id="d2" type="time" value="09:30"></div>
35
+ <div><label for="d3">Date and time</label><input id="d3" type="datetime-local" value="2026-12-02T09:30"></div>
36
+ <div><label for="d4">Month</label><input id="d4" type="month" value="2026-12"></div>
37
+ </div>
38
+ </section>
39
+
40
+ <section class="stack" aria-labelledby="picker-heading">
41
+ <h2 id="picker-heading">Pickers</h2>
42
+ <div class="grid pickers">
43
+ <div class="stack" data-space="sm">
44
+ <label for="due">Due date</label>
45
+ <div class="field-group">
46
+ <input id="due" type="date" min="2026-12-02" value="2026-12-12">
47
+ <button type="button" popovertarget="due-picker" aria-label="Choose due date"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg></button>
48
+ </div>
49
+ <div id="due-picker" popover data-anchor><table class="calendar" data-pick="single" data-target="due"><caption>December 2026</caption><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody><tr><td data-outside></td><td data-outside></td><td><button type="button" data-date="2026-12-01" aria-label="Tuesday, December 1, 2026" disabled>1</button></td><td><button type="button" data-date="2026-12-02" aria-label="Wednesday, December 2, 2026" aria-current="date">2</button></td><td><button type="button" data-date="2026-12-03" aria-label="Thursday, December 3, 2026">3</button></td><td><button type="button" data-date="2026-12-04" aria-label="Friday, December 4, 2026">4</button></td><td><button type="button" data-date="2026-12-05" aria-label="Saturday, December 5, 2026">5</button></td></tr><tr><td><button type="button" data-date="2026-12-06" aria-label="Sunday, December 6, 2026">6</button></td><td><button type="button" data-date="2026-12-07" aria-label="Monday, December 7, 2026">7</button></td><td><button type="button" data-date="2026-12-08" aria-label="Tuesday, December 8, 2026">8</button></td><td><button type="button" data-date="2026-12-09" aria-label="Wednesday, December 9, 2026">9</button></td><td><button type="button" data-date="2026-12-10" aria-label="Thursday, December 10, 2026">10</button></td><td><button type="button" data-date="2026-12-11" aria-label="Friday, December 11, 2026">11</button></td><td><button type="button" data-date="2026-12-12" aria-label="Saturday, December 12, 2026" aria-pressed="true">12</button></td></tr><tr><td><button type="button" data-date="2026-12-13" aria-label="Sunday, December 13, 2026">13</button></td><td><button type="button" data-date="2026-12-14" aria-label="Monday, December 14, 2026">14</button></td><td><button type="button" data-date="2026-12-15" aria-label="Tuesday, December 15, 2026">15</button></td><td><button type="button" data-date="2026-12-16" aria-label="Wednesday, December 16, 2026">16</button></td><td><button type="button" data-date="2026-12-17" aria-label="Thursday, December 17, 2026">17</button></td><td><button type="button" data-date="2026-12-18" aria-label="Friday, December 18, 2026">18</button></td><td><button type="button" data-date="2026-12-19" aria-label="Saturday, December 19, 2026">19</button></td></tr><tr><td><button type="button" data-date="2026-12-20" aria-label="Sunday, December 20, 2026">20</button></td><td><button type="button" data-date="2026-12-21" aria-label="Monday, December 21, 2026">21</button></td><td><button type="button" data-date="2026-12-22" aria-label="Tuesday, December 22, 2026">22</button></td><td><button type="button" data-date="2026-12-23" aria-label="Wednesday, December 23, 2026">23</button></td><td><button type="button" data-date="2026-12-24" aria-label="Thursday, December 24, 2026">24</button></td><td><button type="button" data-date="2026-12-25" aria-label="Friday, December 25, 2026">25</button></td><td><button type="button" data-date="2026-12-26" aria-label="Saturday, December 26, 2026">26</button></td></tr><tr><td><button type="button" data-date="2026-12-27" aria-label="Sunday, December 27, 2026">27</button></td><td><button type="button" data-date="2026-12-28" aria-label="Monday, December 28, 2026">28</button></td><td><button type="button" data-date="2026-12-29" aria-label="Tuesday, December 29, 2026">29</button></td><td><button type="button" data-date="2026-12-30" aria-label="Wednesday, December 30, 2026">30</button></td><td><button type="button" data-date="2026-12-31" aria-label="Thursday, December 31, 2026">31</button></td><td data-outside></td><td data-outside></td></tr></tbody></table></div>
50
+ <small>Past days are disabled. Picking a day fills the input and closes the popover.</small>
51
+ </div>
52
+ <div class="stack" data-space="sm">
53
+ <span id="stay-label" style="font-weight: 580">Stay</span>
54
+ <div class="field-group" role="group" aria-labelledby="stay-label">
55
+ <input id="check-in" type="date" aria-label="Check in" value="2026-12-18">
56
+ <span>→</span>
57
+ <input id="check-out" type="date" aria-label="Check out" value="2026-12-23">
58
+ <button type="button" popovertarget="stay-picker" aria-label="Choose dates"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg></button>
59
+ </div>
60
+ <div id="stay-picker" popover data-anchor><table class="calendar" data-pick="range" data-target="check-in check-out"><caption>December 2026</caption><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody><tr><td data-outside></td><td data-outside></td><td><button type="button" data-date="2026-12-01" aria-label="Tuesday, December 1, 2026">1</button></td><td><button type="button" data-date="2026-12-02" aria-label="Wednesday, December 2, 2026" aria-current="date">2</button></td><td><button type="button" data-date="2026-12-03" aria-label="Thursday, December 3, 2026">3</button></td><td><button type="button" data-date="2026-12-04" aria-label="Friday, December 4, 2026">4</button></td><td><button type="button" data-date="2026-12-05" aria-label="Saturday, December 5, 2026">5</button></td></tr><tr><td><button type="button" data-date="2026-12-06" aria-label="Sunday, December 6, 2026">6</button></td><td><button type="button" data-date="2026-12-07" aria-label="Monday, December 7, 2026">7</button></td><td><button type="button" data-date="2026-12-08" aria-label="Tuesday, December 8, 2026">8</button></td><td><button type="button" data-date="2026-12-09" aria-label="Wednesday, December 9, 2026">9</button></td><td><button type="button" data-date="2026-12-10" aria-label="Thursday, December 10, 2026">10</button></td><td><button type="button" data-date="2026-12-11" aria-label="Friday, December 11, 2026">11</button></td><td><button type="button" data-date="2026-12-12" aria-label="Saturday, December 12, 2026">12</button></td></tr><tr><td><button type="button" data-date="2026-12-13" aria-label="Sunday, December 13, 2026">13</button></td><td><button type="button" data-date="2026-12-14" aria-label="Monday, December 14, 2026">14</button></td><td><button type="button" data-date="2026-12-15" aria-label="Tuesday, December 15, 2026">15</button></td><td><button type="button" data-date="2026-12-16" aria-label="Wednesday, December 16, 2026">16</button></td><td><button type="button" data-date="2026-12-17" aria-label="Thursday, December 17, 2026">17</button></td><td><button type="button" data-date="2026-12-18" aria-label="Friday, December 18, 2026" aria-pressed="true">18</button></td><td><button type="button" data-date="2026-12-19" aria-label="Saturday, December 19, 2026">19</button></td></tr><tr><td><button type="button" data-date="2026-12-20" aria-label="Sunday, December 20, 2026">20</button></td><td><button type="button" data-date="2026-12-21" aria-label="Monday, December 21, 2026">21</button></td><td><button type="button" data-date="2026-12-22" aria-label="Tuesday, December 22, 2026">22</button></td><td><button type="button" data-date="2026-12-23" aria-label="Wednesday, December 23, 2026" aria-pressed="true">23</button></td><td><button type="button" data-date="2026-12-24" aria-label="Thursday, December 24, 2026">24</button></td><td><button type="button" data-date="2026-12-25" aria-label="Friday, December 25, 2026">25</button></td><td><button type="button" data-date="2026-12-26" aria-label="Saturday, December 26, 2026">26</button></td></tr><tr><td><button type="button" data-date="2026-12-27" aria-label="Sunday, December 27, 2026">27</button></td><td><button type="button" data-date="2026-12-28" aria-label="Monday, December 28, 2026">28</button></td><td><button type="button" data-date="2026-12-29" aria-label="Tuesday, December 29, 2026">29</button></td><td><button type="button" data-date="2026-12-30" aria-label="Wednesday, December 30, 2026">30</button></td><td><button type="button" data-date="2026-12-31" aria-label="Thursday, December 31, 2026">31</button></td><td data-outside></td><td data-outside></td></tr></tbody></table></div>
61
+ <small>A range: first click is check-in, second is check-out; days between are shaded.</small>
62
+ </div>
63
+ <div class="card stack" data-space="sm">
64
+ <table class="calendar" data-pick="single" data-target="inline-date"><caption>January 2027</caption><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody><tr><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td><button type="button" data-date="2027-01-01" aria-label="Friday, January 1, 2027">1</button></td><td><button type="button" data-date="2027-01-02" aria-label="Saturday, January 2, 2027">2</button></td></tr><tr><td><button type="button" data-date="2027-01-03" aria-label="Sunday, January 3, 2027">3</button></td><td><button type="button" data-date="2027-01-04" aria-label="Monday, January 4, 2027">4</button></td><td><button type="button" data-date="2027-01-05" aria-label="Tuesday, January 5, 2027">5</button></td><td><button type="button" data-date="2027-01-06" aria-label="Wednesday, January 6, 2027">6</button></td><td><button type="button" data-date="2027-01-07" aria-label="Thursday, January 7, 2027">7</button></td><td><button type="button" data-date="2027-01-08" aria-label="Friday, January 8, 2027" aria-pressed="true">8</button></td><td><button type="button" data-date="2027-01-09" aria-label="Saturday, January 9, 2027">9</button></td></tr><tr><td><button type="button" data-date="2027-01-10" aria-label="Sunday, January 10, 2027">10</button></td><td><button type="button" data-date="2027-01-11" aria-label="Monday, January 11, 2027">11</button></td><td><button type="button" data-date="2027-01-12" aria-label="Tuesday, January 12, 2027">12</button></td><td><button type="button" data-date="2027-01-13" aria-label="Wednesday, January 13, 2027">13</button></td><td><button type="button" data-date="2027-01-14" aria-label="Thursday, January 14, 2027">14</button></td><td><button type="button" data-date="2027-01-15" aria-label="Friday, January 15, 2027">15</button></td><td><button type="button" data-date="2027-01-16" aria-label="Saturday, January 16, 2027">16</button></td></tr><tr><td><button type="button" data-date="2027-01-17" aria-label="Sunday, January 17, 2027">17</button></td><td><button type="button" data-date="2027-01-18" aria-label="Monday, January 18, 2027">18</button></td><td><button type="button" data-date="2027-01-19" aria-label="Tuesday, January 19, 2027">19</button></td><td><button type="button" data-date="2027-01-20" aria-label="Wednesday, January 20, 2027">20</button></td><td><button type="button" data-date="2027-01-21" aria-label="Thursday, January 21, 2027">21</button></td><td><button type="button" data-date="2027-01-22" aria-label="Friday, January 22, 2027">22</button></td><td><button type="button" data-date="2027-01-23" aria-label="Saturday, January 23, 2027">23</button></td></tr><tr><td><button type="button" data-date="2027-01-24" aria-label="Sunday, January 24, 2027">24</button></td><td><button type="button" data-date="2027-01-25" aria-label="Monday, January 25, 2027">25</button></td><td><button type="button" data-date="2027-01-26" aria-label="Tuesday, January 26, 2027">26</button></td><td><button type="button" data-date="2027-01-27" aria-label="Wednesday, January 27, 2027">27</button></td><td><button type="button" data-date="2027-01-28" aria-label="Thursday, January 28, 2027">28</button></td><td><button type="button" data-date="2027-01-29" aria-label="Friday, January 29, 2027">29</button></td><td><button type="button" data-date="2027-01-30" aria-label="Saturday, January 30, 2027">30</button></td></tr><tr><td><button type="button" data-date="2027-01-31" aria-label="Sunday, January 31, 2027">31</button></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td></tr></tbody></table>
65
+ <div class="cluster" data-justify="between"><label for="inline-date" style="margin: 0">Selected</label><input id="inline-date" type="date" value="2027-01-08" style="inline-size: auto"></div>
66
+ </div>
67
+ </div>
68
+ </section>
69
+
70
+ <section class="stack" aria-labelledby="month-heading">
71
+ <div class="cluster" data-justify="between">
72
+ <h2 id="month-heading"><span id="month-title">December 2026</span></h2>
73
+ <div class="cluster" style="gap: var(--pf-space-2)">
74
+ <div class="field-group">
75
+ <button type="button" aria-label="Previous month" data-toast="Month paging is app code: re-render the table."><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></button>
76
+ <button type="button" data-toast="Already showing today.">Today</button>
77
+ <button type="button" aria-label="Next month" data-toast="Month paging is app code: re-render the table."><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></button>
78
+ </div>
79
+ <div class="segmented" role="radiogroup" aria-label="Calendar view">
80
+ <label><input type="radio" name="view" checked>Month</label>
81
+ <label><input type="radio" name="view">Week</label>
82
+ <label><input type="radio" name="view">Day</label>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ <div class="grid" style="grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); align-items: start">
87
+ <table class="calendar" data-view="month" aria-labelledby="month-title"><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody>
88
+ <tr><td data-outside><time datetime="2026-11-29">29</time></td><td data-outside><time datetime="2026-11-30">30</time></td><td><time datetime="2026-12-01">1</time><a class="event" href="#e-1-0">Sprint planning</a></td><td><time datetime="2026-12-02" aria-current="date">2</time><a class="event" href="#e-2-0" data-tone="info">Design review</a><a class="event" href="#e-2-1">1:1 with Maya</a></td><td><time datetime="2026-12-03">3</time><a class="event" href="#e-3-0" data-tone="warning">Launch prep</a></td><td><time datetime="2026-12-04">4</time><a class="event" href="#e-4-0" data-tone="success">Ship v2.4</a></td><td><time datetime="2026-12-05">5</time></td></tr>
89
+ <tr><td><time datetime="2026-12-06">6</time></td><td><time datetime="2026-12-07">7</time></td><td><time datetime="2026-12-08">8</time><a class="event" href="#e-8-0" data-tone="accent">Board update</a></td><td><time datetime="2026-12-09">9</time><a class="event" href="#e-9-0" data-tone="info">Customer call</a></td><td><time datetime="2026-12-10">10</time><a class="event" href="#e-10-0" data-tone="danger">Security audit</a><a class="event" href="#e-10-1">Lunch & learn</a></td><td><time datetime="2026-12-11">11</time><a class="event" href="#e-11-0" data-tone="success">Payroll</a></td><td><time datetime="2026-12-12">12</time></td></tr>
90
+ <tr><td><time datetime="2026-12-13">13</time></td><td><time datetime="2026-12-14">14</time><a class="event" href="#e-14-0">Q4 planning</a></td><td><time datetime="2026-12-15">15</time><a class="event" href="#e-15-0" data-tone="info">Hiring loop</a><a class="event" href="#e-15-1">Retro</a><a class="event" href="#e-15-2" data-tone="accent">Team dinner</a></td><td><time datetime="2026-12-16">16</time></td><td><time datetime="2026-12-17">17</time><a class="event" href="#e-17-0" data-tone="warning">Release freeze</a></td><td><time datetime="2026-12-18">18</time><a class="event" href="#e-18-0" data-tone="accent">Holiday party</a></td><td><time datetime="2026-12-19">19</time></td></tr>
91
+ <tr><td><time datetime="2026-12-20">20</time></td><td><time datetime="2026-12-21">21</time></td><td><time datetime="2026-12-22">22</time><a class="event" href="#e-22-0" data-tone="danger">Year-end close</a></td><td><time datetime="2026-12-23">23</time></td><td><time datetime="2026-12-24">24</time><a class="event" href="#e-24-0">Office closed</a></td><td><time datetime="2026-12-25">25</time><a class="event" href="#e-25-0">Office closed</a></td><td><time datetime="2026-12-26">26</time></td></tr>
92
+ <tr><td><time datetime="2026-12-27">27</time></td><td><time datetime="2026-12-28">28</time></td><td><time datetime="2026-12-29">29</time></td><td><time datetime="2026-12-30">30</time></td><td><time datetime="2026-12-31">31</time><a class="event" href="#e-31-0" data-tone="success">Backups verified</a></td><td data-outside><time datetime="2027-01-01">1</time></td><td data-outside><time datetime="2027-01-02">2</time></td></tr>
93
+ </tbody></table>
94
+ <aside class="card stack" aria-labelledby="agenda-heading">
95
+ <h3 id="agenda-heading">Today · Wed, Dec 2</h3>
96
+ <ol class="timeline">
97
+ <li data-tone="info"><time datetime="2026-12-02T09:30">9:30</time><strong>Design review</strong><small class="muted">Figma · 45 min</small></li>
98
+ <li><time datetime="2026-12-02T11:00">11:00</time><strong>1:1 with Maya</strong><small class="muted">Room 4 · 30 min</small></li>
99
+ <li data-tone="success"><time datetime="2026-12-02T14:00">14:00</time><strong>Customer onboarding</strong><small class="muted">Zoom · 1 h</small></li>
100
+ <li data-tone="warning"><time datetime="2026-12-02T17:30">17:30</time><strong>Deploy window</strong><small class="muted">On call: Jordan</small></li>
101
+ </ol>
102
+ <button type="button" data-variant="secondary"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>New event</button>
103
+ </aside>
104
+ </div>
105
+ </section>
106
+ </main>
107
+
108
+ <ol class="toasts" role="status" aria-live="polite"></ol>
109
+ <script type="module" src="examples.js"></script>
110
+ </body>
111
+ </html>
112
+
@@ -0,0 +1,207 @@
1
+ // Behaviour for the example pages only.
2
+ //
3
+ // @profullstack/css ships no JavaScript: this file is the kind of app code a
4
+ // real page would carry, kept short so each piece can be copied on its own.
5
+ // Every block is independent and does nothing when its markup is absent.
6
+
7
+ const $$ = (selector, root = document) => [...root.querySelectorAll(selector)];
8
+ const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
9
+
10
+ // 1. Scroller arrows: page the row by most of its width, and disable an
11
+ // arrow at the matching end.
12
+ for (const frame of $$('.scroller-frame')) {
13
+ const scroller = frame.querySelector('.scroller');
14
+ if (!scroller) continue;
15
+ const prev = frame.querySelector('[data-scroll="prev"]');
16
+ const next = frame.querySelector('[data-scroll="next"]');
17
+ const vertical = scroller.dataset.axis === 'block';
18
+ const rtl = getComputedStyle(scroller).direction === 'rtl';
19
+ const behavior = reduceMotion ? 'auto' : 'smooth';
20
+
21
+ const page = (dir) => {
22
+ const amount = (vertical ? scroller.clientHeight : scroller.clientWidth) * 0.85 * dir;
23
+ scroller.scrollBy(vertical ? { top: amount, behavior } : { left: rtl ? -amount : amount, behavior });
24
+ };
25
+
26
+ const sync = () => {
27
+ const max = vertical ? scroller.scrollHeight - scroller.clientHeight : scroller.scrollWidth - scroller.clientWidth;
28
+ const pos = Math.abs(vertical ? scroller.scrollTop : scroller.scrollLeft);
29
+ if (prev) prev.disabled = pos <= 2;
30
+ if (next) next.disabled = pos >= max - 2;
31
+ };
32
+
33
+ prev?.addEventListener('click', () => page(-1));
34
+ next?.addEventListener('click', () => page(1));
35
+ scroller.addEventListener('scroll', sync, { passive: true });
36
+ new ResizeObserver(sync).observe(scroller);
37
+ sync();
38
+ }
39
+
40
+ // 2. Tabs: arrow keys move between tabs, the chosen tab shows its panel.
41
+ for (const list of $$('[role="tablist"]')) {
42
+ const tabs = $$('[role="tab"]', list);
43
+ const select = (tab, focus = false) => {
44
+ for (const t of tabs) {
45
+ const on = t === tab;
46
+ t.setAttribute('aria-selected', String(on));
47
+ t.tabIndex = on ? 0 : -1;
48
+ const panel = document.getElementById(t.getAttribute('aria-controls'));
49
+ if (panel) panel.hidden = !on;
50
+ }
51
+ if (focus) tab.focus();
52
+ };
53
+ list.addEventListener('click', (e) => {
54
+ const tab = e.target.closest('[role="tab"]');
55
+ if (tab) select(tab);
56
+ });
57
+ list.addEventListener('keydown', (e) => {
58
+ const i = tabs.indexOf(document.activeElement);
59
+ if (i < 0) return;
60
+ const to = { ArrowRight: i + 1, ArrowLeft: i - 1, Home: 0, End: tabs.length - 1 }[e.key];
61
+ if (to === undefined) return;
62
+ e.preventDefault();
63
+ select(tabs[(to + tabs.length) % tabs.length], true);
64
+ });
65
+ select(tabs.find((t) => t.getAttribute('aria-selected') === 'true') ?? tabs[0]);
66
+ }
67
+
68
+ // 3. Spatial navigation for <html data-input="tv">. TV browsers move focus
69
+ // with the D-pad themselves; this lets a keyboard's arrow keys do the
70
+ // same on a desktop so the page can be tried without a television.
71
+ if (document.documentElement.dataset.input === 'tv') {
72
+ const focusable = 'a[href], button:not(:disabled), input, select, textarea, [tabindex]:not([tabindex="-1"])';
73
+ const visible = (el) => {
74
+ const r = el.getBoundingClientRect();
75
+ return r.width > 0 && r.height > 0 && getComputedStyle(el).visibility !== 'hidden';
76
+ };
77
+ document.addEventListener('keydown', (e) => {
78
+ const dir = { ArrowRight: [1, 0], ArrowLeft: [-1, 0], ArrowDown: [0, 1], ArrowUp: [0, -1] }[e.key];
79
+ if (!dir || e.altKey || e.ctrlKey || e.metaKey) return;
80
+ const from = document.activeElement;
81
+ if (from?.matches('input:not([type="radio"]):not([type="checkbox"]), textarea, select')) return;
82
+ if (from?.closest('[role="tablist"]')) return;
83
+ const a = (from && from !== document.body ? from : document.body).getBoundingClientRect();
84
+ const ax = a.left + a.width / 2;
85
+ const ay = a.top + a.height / 2;
86
+ let best = null;
87
+ let bestScore = Infinity;
88
+ for (const el of $$(focusable)) {
89
+ if (el === from || el.tabIndex < 0 || !visible(el) || el.closest('[hidden], [inert]')) continue;
90
+ const b = el.getBoundingClientRect();
91
+ const dx = b.left + b.width / 2 - ax;
92
+ const dy = b.top + b.height / 2 - ay;
93
+ const along = dx * dir[0] + dy * dir[1];
94
+ if (along <= 4) continue;
95
+ const across = Math.abs(dir[0] ? dy : dx);
96
+ const score = along + across * 3;
97
+ if (score < bestScore) {
98
+ bestScore = score;
99
+ best = el;
100
+ }
101
+ }
102
+ if (!best) return;
103
+ e.preventDefault();
104
+ best.focus({ preventScroll: true });
105
+ best.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: reduceMotion ? 'auto' : 'smooth' });
106
+ });
107
+ }
108
+
109
+ // 4. Toasts: <button data-toast="Message" data-tone="success">.
110
+ const toasts = document.querySelector('.toasts');
111
+ for (const button of $$('[data-toast]')) {
112
+ button.addEventListener('click', () => {
113
+ if (!toasts) return;
114
+ const toast = document.createElement('li');
115
+ toast.className = 'alert';
116
+ if (button.dataset.tone) toast.dataset.tone = button.dataset.tone;
117
+ toast.textContent = button.dataset.toast;
118
+ toasts.append(toast);
119
+ setTimeout(() => toast.remove(), 4000);
120
+ });
121
+ }
122
+
123
+ // 5. Calendar pickers: <table class="calendar" data-pick="single|range"
124
+ // data-target="input-id">. Buttons carry data-date="YYYY-MM-DD".
125
+ for (const table of $$('table.calendar[data-pick]')) {
126
+ const range = table.dataset.pick === 'range';
127
+ const targets = (table.dataset.target ?? '').split(/\s+/).filter(Boolean).map((id) => document.getElementById(id));
128
+ let chosen = $$('button[aria-pressed="true"]', table).map((b) => b.dataset.date).sort();
129
+
130
+ const paint = () => {
131
+ const [start, end] = chosen;
132
+ for (const b of $$('button[data-date]', table)) {
133
+ const d = b.dataset.date;
134
+ b.setAttribute('aria-pressed', String(chosen.includes(d)));
135
+ const between = range && start && end && d > start && d < end;
136
+ b.parentElement.toggleAttribute('data-in-range', Boolean(between));
137
+ }
138
+ targets.forEach((input, i) => {
139
+ if (input) input.value = chosen[i] ?? '';
140
+ });
141
+ };
142
+
143
+ table.addEventListener('click', (e) => {
144
+ const b = e.target.closest('button[data-date]');
145
+ if (!b) return;
146
+ const d = b.dataset.date;
147
+ if (!range || chosen.length !== 1) chosen = [d];
148
+ else chosen = [chosen[0], d].sort();
149
+ paint();
150
+ const popover = table.closest('[popover]');
151
+ if (popover && (!range || chosen.length === 2)) popover.hidePopover();
152
+ });
153
+ paint();
154
+ }
155
+
156
+ // 6. Color picker: keep the swatches, the native input, the hex readout
157
+ // and the preview in step.
158
+ for (const picker of $$('[data-color-picker]')) {
159
+ const input = picker.querySelector('input[type="color"]');
160
+ const output = picker.querySelector('output');
161
+ const preview = picker.querySelector('[data-color-preview]');
162
+ const show = (value) => {
163
+ if (input) input.value = value;
164
+ if (output) output.value = value.toUpperCase();
165
+ if (preview) preview.style.setProperty('--pf-color-primary', value);
166
+ };
167
+ input?.addEventListener('input', () => {
168
+ show(input.value);
169
+ for (const radio of $$('.swatches input', picker)) radio.checked = radio.value === input.value;
170
+ });
171
+ for (const radio of $$('.swatches input', picker)) radio.addEventListener('change', () => show(radio.value));
172
+ if (input) show(input.value);
173
+ }
174
+
175
+ // 7. Quantity steppers in .field-group: buttons with data-step="-1|1".
176
+ for (const button of $$('.field-group [data-step]')) {
177
+ button.addEventListener('click', () => {
178
+ const input = button.parentElement.querySelector('input[type="number"]');
179
+ if (!input) return;
180
+ if (Number(button.dataset.step) > 0) input.stepUp();
181
+ else input.stepDown();
182
+ input.dispatchEvent(new Event('input', { bubbles: true }));
183
+ });
184
+ }
185
+
186
+ // 8. Theme switch: radios named "theme" set data-theme on <html>.
187
+ for (const radio of $$('input[name="theme"]')) {
188
+ radio.addEventListener('change', () => {
189
+ if (radio.value === 'system') delete document.documentElement.dataset.theme;
190
+ else document.documentElement.dataset.theme = radio.value;
191
+ });
192
+ }
193
+
194
+ // 9. Inbox: choosing a message marks it current and read.
195
+ for (const list of $$('.inbox > section')) {
196
+ list.addEventListener('click', (e) => {
197
+ const item = e.target.closest('.media');
198
+ if (!item) return;
199
+ e.preventDefault();
200
+ for (const other of $$('.media[aria-current]', list)) other.removeAttribute('aria-current');
201
+ item.setAttribute('aria-current', 'true');
202
+ item.removeAttribute('data-unread');
203
+ const subject = item.querySelector("[data-subject]")?.textContent;
204
+ const heading = list.parentElement.querySelector('article h2');
205
+ if (subject && heading) heading.textContent = subject;
206
+ });
207
+ }