@profullstack/css 0.2.0 → 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.
package/AGENTS.md CHANGED
@@ -8,7 +8,7 @@ This file is the short, stable interface guide for coding agents working in a pr
8
8
  2. Import `@profullstack/css` once from the app's global stylesheet.
9
9
  3. Build the page with semantic HTML and native controls first.
10
10
  4. Use only the layout classes, component classes, data attributes, and tokens listed in `css/manifest.json`.
11
- 5. Keep behavior in the app. This package styles markup; it does not ship JavaScript.
11
+ 5. Keep behavior in the app. This package styles markup; it does not ship JavaScript. `examples/examples.js` shows the few lines a scroller, tabs, toasts or a date picker need.
12
12
 
13
13
  ## Markup contract
14
14
 
@@ -34,6 +34,25 @@ This file is the short, stable interface guide for coding agents working in a pr
34
34
  - `[popover]` for a light surface opened by `<button popovertarget="id">`; add `data-anchor` (or `data-anchor="top|end"`) to place it next to that button.
35
35
  - Native controls, tables, details/summary, progress, meter, and dialog elements receive baseline styling. Open dialogs with `<button commandfor="id" command="show-modal">`; add `closedby="any"` for light dismiss.
36
36
 
37
+ ## Widgets layer
38
+
39
+ `css/widgets.css` (imported automatically) adds composed pieces. Use these names exactly:
40
+
41
+ - `.scroller` on a list of focusable items (`data-axis="block"` for vertical); wrap in `.scroller-frame` with `<button data-scroll="prev|next" tabindex="-1">` arrows that the app wires to `scrollBy()`.
42
+ - `.tile` on a link or button whose first child is the art; `data-shape="poster|square"`.
43
+ - `.icon-button` with an SVG and an `aria-label`; `data-count` draws a count bubble (repeat the count in the label).
44
+ - `.menu` (a `<ul>`) inside a `[popover]` or `<dialog>`; `<hr>` between groups, `<li><small>` group labels.
45
+ - `.media` rows (art, body, aside) with `.thumb` or `.avatar`; `.avatar-group`; `data-truncate` for one-line bodies.
46
+ - `table.calendar` for pickers (buttons with `aria-current="date"`, `aria-pressed="true"`, `td[data-in-range]`, `td[data-outside]`) and `table.calendar[data-view="month"]` with `.event` chips (`data-tone`).
47
+ - `.field-group` to join inputs, buttons and `<span>` add-ons.
48
+ - `input[type="color"]`, `.swatches` radios with `style="--swatch: #hex"` and an `aria-label`.
49
+ - `input[type="checkbox"][role="switch"]`, `.segmented` (labels wrapping radios), `[role="tablist"]` tabs.
50
+ - `.toasts` live region, `.steps`, `.skeleton`, `.stat` with `[data-trend="up|down"]`, `.ring` with `--value`.
51
+ - `nav.breadcrumbs`, `nav.pagination` (`aria-current="page"`), `.rating`, `label.dropzone`, `ol.timeline`, `.inbox`.
52
+ - `.cluster[data-justify="between|end|center"]`.
53
+
54
+ For TV apps set `data-input="tv"` on `<html>`. Make every item a real link or button so the D-pad can reach it.
55
+
37
56
  ## Platform layer
38
57
 
39
58
  `css/platform.css` (imported automatically) adds the newest CSS to the same markup: themed `<select>` pickers, auto-growing textareas, `:user-invalid` errors, animated `<details>`, dialog and popover entry animations, scroll lock under a modal, anchored popovers, native carousel controls, gap decorations, scroll reveal, cross-document view transitions, and optical text trimming in buttons and badges. Every feature is guarded by `@supports` or a media query, so do not add fallbacks or JavaScript for them. Set `--pf-corner-shape: squircle|bevel|scoop|notch` to reshape every surface.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 — 2026-12-02
4
+
5
+ Widgets layer and TV mode.
6
+
7
+ - Add `css/widgets.css` in a new `pf.widgets` cascade layer (after components, before platform), imported by default and exported as `@profullstack/css/widgets`.
8
+ - Scrollers: `.scroller` (horizontal or `data-axis="block"`) with scroll-driven edge fades, and `.scroller-frame` previous/next arrows that hide at each end.
9
+ - TV mode: `data-input="tv"` on `<html>` for 10-foot sizes, overscan-safe inset, loud `:focus` rings, zooming `.tile` focus and always-visible arrows.
10
+ - `.tile`, `.icon-button` with `data-count`, `.menu`, `.media`, `.thumb`, `.avatar`, `.avatar-group`.
11
+ - Dates: `table.calendar` pickers (today, chosen, range, outside days), `data-view="month"` display with `.event` chips, styled native date and time inputs, `.field-group` for ranges and add-ons.
12
+ - Color: styled `input[type="color"]` and `.swatches` radio groups.
13
+ - Switch (`role="switch"`), `.segmented`, ARIA tabs, `.toasts`, `.breadcrumbs`, `.pagination`, `.steps`, `.skeleton`, `.stat` with `data-trend`, `.ring`, `.rating`, `.dropzone`, `.timeline`, and a three-pane `.inbox`.
14
+ - `.cluster[data-justify]`.
15
+ - New examples: `widgets.html`, `tv.html`, `calendar.html`, `inbox.html`, with `examples/examples.js` for app behaviour (scroller paging, tabs, D-pad navigation, toasts, date picking, color picking). The package itself still ships no JavaScript.
16
+ - Manifest contract 1.2.0 (new components and an `inputModes.tv` entry).
17
+
18
+ ## 0.2.1 — 2026-12-02
19
+
20
+ - Docs: install from npm (`npm install @profullstack/css`) and link the hosted stylesheet; drop the pre-release local-checkout instructions.
21
+
3
22
  ## 0.2.0 — 2026-12-02
4
23
 
5
24
  Platform layer: the newest CSS on the same semantic markup, all progressive enhancement.
package/README.md CHANGED
@@ -33,6 +33,7 @@ Or use the stylesheet directly from a CDN:
33
33
  - CSS custom properties for product-level branding.
34
34
  - A machine-readable manifest and an `AGENTS.md` generation contract.
35
35
  - A platform layer with the newest CSS on the same markup: themed `<select>`, auto-growing textareas, animated `<details>` and dialogs, anchored popovers, a no-script carousel, gap rules, scroll reveal, view transitions, and squircle corners. Each one is progressive enhancement.
36
+ - A widgets layer: scrollers with previous/next arrows, a TV (10-foot) mode, cart and menu dropdowns, icon buttons with counts, calendars and date pickers, a color picker, switches, segmented controls, tabs, toasts, breadcrumbs, pagination, steps, stats, progress rings, ratings, drop zones, timelines and a three-pane inbox.
36
37
  - No JavaScript, build step, or runtime dependencies.
37
38
 
38
39
  ## Quick start
@@ -108,6 +109,36 @@ Available theme values: `light`, `dark`. Without an attribute, the user's system
108
109
 
109
110
  See `examples/platform.html` for all of them on one page.
110
111
 
112
+ ## Widgets layer
113
+
114
+ `css/widgets.css` (imported by default, also `@profullstack/css/widgets`) styles composed pieces from the same tokens. It is still plain CSS: paging a scroller, switching tabs or picking a date is app code, and `examples/examples.js` shows each one in a few lines.
115
+
116
+ | Widget | Markup |
117
+ | --- | --- |
118
+ | Scroller with arrows | `.scroller-frame` > `button[data-scroll="prev"]`, `ul.scroller`, `button[data-scroll="next"]`; `data-axis="block"` for a column |
119
+ | Media tile | `a.tile[data-shape="poster\|square"]`, art first |
120
+ | TV mode | `<html data-input="tv">` |
121
+ | Icon button + count | `button.icon-button[data-count="3"][aria-label="Cart, 3 items"]` |
122
+ | Menu | `ul.menu` in a `[popover]` or `<dialog>` |
123
+ | List row | `.media` (art, body, aside), `.thumb`, `.avatar`, `.avatar-group` |
124
+ | Calendar | `table.calendar` (picker) or `table.calendar[data-view="month"]` with `.event` chips |
125
+ | Joined controls | `.field-group` (date ranges, steppers, URL add-ons) |
126
+ | Color | `input[type="color"]`, `.swatches` radios with `--swatch` |
127
+ | Switch | `input[type="checkbox"][role="switch"]` |
128
+ | Segmented | `.segmented[role="radiogroup"]` of labels wrapping radios |
129
+ | Tabs | `[role="tablist"]`, `[role="tab"][aria-selected]`, `[role="tabpanel"]` |
130
+ | Status | `.toasts`, `.steps`, `.skeleton`, `.stat` + `[data-trend]`, `.ring` with `--value` |
131
+ | Navigation | `nav.breadcrumbs`, `nav.pagination` |
132
+ | Input | `.rating` (radios, 5 to 1), `label.dropzone` around a file input |
133
+ | Feed | `ol.timeline` with `data-tone` |
134
+ | Inbox | `.inbox` > `nav`, `section`, `article` |
135
+
136
+ ### TV and remote controls
137
+
138
+ Set `data-input="tv"` on `<html>` for a 10-foot interface: larger type and targets, an overscan-safe inset, a loud `:focus` ring that also shows on TV browsers without `:focus-visible`, zooming tiles and always-visible scroller arrows. TV browsers move focus with the D-pad, so make every item a real link or button and keep the arrows at `tabindex="-1"`. `examples/tv.html` adds a short spatial-navigation script so the arrow keys behave like a remote on a desktop. The framework uses cascade layers, so TV browsers need Chromium 99 or newer.
139
+
140
+ See `examples/widgets.html`, `examples/tv.html`, `examples/calendar.html` and `examples/inbox.html`.
141
+
111
142
  ## Documentation
112
143
 
113
144
  - `docs/agent-guide.md` — complete generation and usage guide.
@@ -118,7 +149,7 @@ See `examples/platform.html` for all of them on one page.
118
149
 
119
150
  ## Scope
120
151
 
121
- This is a CSS foundation, not a component runtime. It styles native `<dialog>` and form controls but does not open dialogs, validate inputs, submit forms, or implement menus. Use semantic HTML and add application behavior where it belongs.
152
+ This is a CSS foundation, not a component runtime. It styles native `<dialog>` and form controls, menus, tabs, calendars and scrollers, but does not open dialogs, validate inputs, submit forms, switch tabs or page a scroller. Use semantic HTML and add application behavior where it belongs.
122
153
 
123
154
  ## License
124
155
 
package/css/manifest.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "name": "@profullstack/css",
4
- "contractVersion": "1.1.0",
4
+ "contractVersion": "1.2.0",
5
5
  "description": "A semantic-first CSS contract for people and code-generating agents.",
6
6
  "entrypoints": {
7
7
  "default": "@profullstack/css",
8
8
  "tokens": "@profullstack/css/tokens",
9
9
  "manifest": "@profullstack/css/manifest",
10
- "platform": "@profullstack/css/platform"
10
+ "platform": "@profullstack/css/platform",
11
+ "widgets": "@profullstack/css/widgets"
11
12
  },
12
13
  "agentGuide": "AGENTS.md",
13
14
  "principles": [
@@ -43,6 +44,14 @@
43
44
  "data-rules": [
44
45
  ""
45
46
  ]
47
+ },
48
+ "justify": {
49
+ "attribute": "data-justify",
50
+ "values": [
51
+ "between",
52
+ "end",
53
+ "center"
54
+ ]
46
55
  }
47
56
  },
48
57
  "grid": {
@@ -168,6 +177,201 @@
168
177
  },
169
178
  "rule": "Open with popovertarget or commandfor on a <button>. data-anchor places it next to that button (CSS anchor positioning) and flips when space runs out; otherwise it is centred.",
170
179
  "example": "<button type=\"button\" popovertarget=\"help\">Help</button><div id=\"help\" popover data-anchor>Short help.</div>"
180
+ },
181
+ "scroller": {
182
+ "class": "scroller",
183
+ "attributes": {
184
+ "data-axis": [
185
+ "block"
186
+ ]
187
+ },
188
+ "customProperties": [
189
+ "--pf-scroller-item",
190
+ "--pf-scroller-height",
191
+ "--pf-scroller-inset"
192
+ ],
193
+ "frame": "Wrap in .scroller-frame with <button data-scroll=\"prev\"> and <button data-scroll=\"next\"> (tabindex=\"-1\"); the app pages the scroller with scrollBy() and disables an arrow at its end.",
194
+ "example": "<div class=\"scroller-frame\"><button type=\"button\" data-scroll=\"prev\" aria-label=\"Previous\" tabindex=\"-1\">‹</button><ul class=\"scroller\" role=\"list\" aria-label=\"Products\"><li><a class=\"tile\" href=\"/p/1\"><img src=\"/p1.jpg\" alt=\"\"><strong>Item</strong></a></li></ul><button type=\"button\" data-scroll=\"next\" aria-label=\"Next\" tabindex=\"-1\">›</button></div>",
195
+ "behavior": "Keyboard, D-pad and touch scroll it natively by moving focus between focusable items. Edges fade where scroll-driven animations exist."
196
+ },
197
+ "tile": {
198
+ "class": "tile",
199
+ "attributes": {
200
+ "data-shape": [
201
+ "poster",
202
+ "square"
203
+ ]
204
+ },
205
+ "rule": "A focusable <a> or <button>; its first child is the art (img or span), then a title and meta. The art zooms and rings on focus.",
206
+ "example": "<a class=\"tile\" href=\"/watch/1\" data-shape=\"poster\"><img src=\"/poster.jpg\" alt=\"\"><strong>Title</strong><small>S1 · E2</small></a>"
207
+ },
208
+ "iconButton": {
209
+ "class": "icon-button",
210
+ "attributes": {
211
+ "data-count": "number shown as a bubble; also put it in aria-label"
212
+ },
213
+ "example": "<button type=\"button\" class=\"icon-button\" aria-label=\"Cart, 3 items\" data-count=\"3\" popovertarget=\"cart\"><svg aria-hidden=\"true\">…</svg></button>"
214
+ },
215
+ "menu": {
216
+ "class": "menu",
217
+ "rule": "A <ul class=\"menu\"> of <li><a>, <li><button> or <li><label>; <hr> separates groups, <li><small> labels a group, <kbd> or .badge sits at the row end, aria-current marks the active item. Usually inside [popover] or <dialog>.",
218
+ "example": "<div id=\"account\" popover data-anchor><ul class=\"menu\"><li><a href=\"/settings\">Settings<kbd>⌘,</kbd></a></li><hr><li><button type=\"button\" data-variant=\"danger\">Sign out</button></li></ul></div>"
219
+ },
220
+ "media": {
221
+ "class": "media",
222
+ "attributes": {
223
+ "data-truncate": "one line per body line"
224
+ },
225
+ "rule": "Three children: art (.thumb or .avatar), body, aside. Cart lines, messages, notifications, results.",
226
+ "example": "<li class=\"media\"><span class=\"thumb\">…</span><div><strong>Studio headphones</strong><small>Qty 1</small></div><span>$189</span></li>"
227
+ },
228
+ "thumb": {
229
+ "class": "thumb",
230
+ "rule": "Square image or icon box for .media rows."
231
+ },
232
+ "avatar": {
233
+ "class": "avatar",
234
+ "attributes": {
235
+ "data-size": [
236
+ "sm",
237
+ "lg"
238
+ ]
239
+ },
240
+ "group": "avatar-group",
241
+ "example": "<span class=\"avatar\">AE</span>"
242
+ },
243
+ "calendar": {
244
+ "element": "table",
245
+ "class": "calendar",
246
+ "attributes": {
247
+ "data-view": [
248
+ "month"
249
+ ],
250
+ "cell": {
251
+ "aria-current=\"date\"": "today",
252
+ "aria-pressed=\"true\"": "chosen day",
253
+ "data-in-range": "on <td> between range ends",
254
+ "data-outside": "on <td> outside the month"
255
+ }
256
+ },
257
+ "rule": "A picker puts a <button> in each day cell; the app sets aria-pressed and fills the input. data-view=\"month\" is a display: each <td> holds a <time> and .event chips.",
258
+ "example": "<table class=\"calendar\"><caption>December 2026</caption><thead><tr><th scope=\"col\"><abbr title=\"Sunday\">Su</abbr></th>…</tr></thead><tbody><tr><td><button type=\"button\" aria-current=\"date\">2</button></td>…</tr></tbody></table>"
259
+ },
260
+ "event": {
261
+ "class": "event",
262
+ "tones": [
263
+ "info",
264
+ "success",
265
+ "warning",
266
+ "danger",
267
+ "accent"
268
+ ],
269
+ "example": "<a class=\"event\" href=\"/e/1\" data-tone=\"info\">Design review</a>"
270
+ },
271
+ "fieldGroup": {
272
+ "class": "field-group",
273
+ "rule": "Joins inputs, selects, buttons and <span> add-ons into one control: date ranges, quantity steppers, URL prefixes, input plus picker button.",
274
+ "example": "<div class=\"field-group\"><span>https://</span><input aria-label=\"Subdomain\"><span>.example.com</span></div>"
275
+ },
276
+ "color": {
277
+ "nativeElements": [
278
+ "input[type=color]"
279
+ ],
280
+ "swatches": "A .swatches group of <input type=\"radio\" style=\"--swatch: #hex\" aria-label=\"Name\">; selection is native.",
281
+ "example": "<div class=\"swatches\" role=\"radiogroup\" aria-label=\"Brand color\"><input type=\"radio\" name=\"c\" value=\"#126b55\" style=\"--swatch: #126b55\" aria-label=\"Teal\" checked></div>"
282
+ },
283
+ "switch": {
284
+ "element": "input[type=checkbox][role=switch]",
285
+ "example": "<label><input type=\"checkbox\" role=\"switch\" checked>Email notifications</label>"
286
+ },
287
+ "segmented": {
288
+ "class": "segmented",
289
+ "rule": "role=\"radiogroup\" with an aria-label; each <label> wraps its radio.",
290
+ "example": "<div class=\"segmented\" role=\"radiogroup\" aria-label=\"View\"><label><input type=\"radio\" name=\"v\" checked>Month</label><label><input type=\"radio\" name=\"v\">Week</label></div>"
291
+ },
292
+ "tabs": {
293
+ "roles": [
294
+ "tablist",
295
+ "tab",
296
+ "tabpanel"
297
+ ],
298
+ "rule": "Buttons with role=\"tab\", aria-selected and aria-controls; the app switches aria-selected and the panels' hidden attribute."
299
+ },
300
+ "toasts": {
301
+ "class": "toasts",
302
+ "rule": "A fixed <ol class=\"toasts\" role=\"status\"> live region; the app appends .alert items and removes them."
303
+ },
304
+ "breadcrumbs": {
305
+ "class": "breadcrumbs",
306
+ "example": "<nav class=\"breadcrumbs\" aria-label=\"Breadcrumb\"><ol><li><a href=\"/\">Home</a></li><li><a href=\"/shop\" aria-current=\"page\">Shop</a></li></ol></nav>"
307
+ },
308
+ "pagination": {
309
+ "class": "pagination",
310
+ "example": "<nav class=\"pagination\" aria-label=\"Pages\"><ul><li><a href=\"?p=1\" aria-current=\"page\">1</a></li><li><a href=\"?p=2\">2</a></li><li><span>…</span></li></ul></nav>"
311
+ },
312
+ "steps": {
313
+ "class": "steps",
314
+ "attributes": {
315
+ "data-state": [
316
+ "done"
317
+ ],
318
+ "aria-current": "step"
319
+ },
320
+ "example": "<ol class=\"steps\"><li data-state=\"done\">Cart</li><li aria-current=\"step\">Payment</li><li>Review</li></ol>"
321
+ },
322
+ "skeleton": {
323
+ "class": "skeleton",
324
+ "rule": "Placeholder shimmer; mark the loading region aria-busy=\"true\"."
325
+ },
326
+ "stat": {
327
+ "class": "stat",
328
+ "rule": "Label, <strong> number, optional [data-trend=\"up|down\"] delta.",
329
+ "example": "<div class=\"stat\"><span>Revenue</span><strong>$48.2k</strong><span data-trend=\"up\">12%</span></div>"
330
+ },
331
+ "ring": {
332
+ "class": "ring",
333
+ "customProperties": [
334
+ "--value"
335
+ ],
336
+ "attributes": {
337
+ "data-size": [
338
+ "sm",
339
+ "lg"
340
+ ],
341
+ "data-tone": [
342
+ "success",
343
+ "warning",
344
+ "danger"
345
+ ]
346
+ },
347
+ "example": "<span class=\"ring\" style=\"--value: 72\" role=\"img\" aria-label=\"72 percent\">72%</span>"
348
+ },
349
+ "rating": {
350
+ "class": "rating",
351
+ "rule": "Radios in reverse order (5 down to 1), each with an aria-label.",
352
+ "example": "<fieldset class=\"rating\" aria-label=\"Rating\"><input type=\"radio\" name=\"r\" value=\"5\" aria-label=\"5 stars\">…</fieldset>"
353
+ },
354
+ "dropzone": {
355
+ "class": "dropzone",
356
+ "rule": "A <label class=\"dropzone\"> wrapping <input type=\"file\">; click and drag-and-drop are native."
357
+ },
358
+ "timeline": {
359
+ "class": "timeline",
360
+ "tones": [
361
+ "info",
362
+ "success",
363
+ "warning",
364
+ "danger",
365
+ "accent"
366
+ ],
367
+ "example": "<ol class=\"timeline\"><li data-tone=\"success\"><time datetime=\"2026-12-02T09:12\">9:12</time><strong>Deploy succeeded</strong></li></ol>"
368
+ },
369
+ "inbox": {
370
+ "class": "inbox",
371
+ "customProperties": [
372
+ "--pf-inbox-height"
373
+ ],
374
+ "rule": "Three children: <nav> (folders, a .menu), <section> (header plus a list of a.media with data-unread or aria-current=\"true\"), <article> (reading pane). Collapses under 64rem and stacks under 44rem."
171
375
  }
172
376
  },
173
377
  "tokens": {
@@ -206,7 +410,8 @@
206
410
  "runtimeDependencies": [],
207
411
  "motionPreference": "Respects prefers-reduced-motion.",
208
412
  "focus": "Provides visible :focus-visible outlines.",
209
- "progressiveEnhancement": "Every platform-layer feature is guarded by @supports or a media query; unsupported browsers get the 0.1 baseline."
413
+ "progressiveEnhancement": "Every platform-layer feature is guarded by @supports or a media query; unsupported browsers get the 0.1 baseline.",
414
+ "appBehavior": "Paging scrollers, switching tabs, picking calendar days and showing toasts are app code; examples/examples.js shows each in a few lines."
210
415
  },
211
416
  "motion": {
212
417
  "reveal": {
@@ -219,5 +424,11 @@
219
424
  "purpose": "Children fade up as they scroll into view, staggered by sibling-index(). Off under prefers-reduced-motion."
220
425
  },
221
426
  "viewTransitions": "Same-origin page navigations cross-fade (@view-transition). Disable with @view-transition { navigation: none; } in app CSS."
427
+ },
428
+ "inputModes": {
429
+ "tv": {
430
+ "attribute": "data-input=\"tv\" on <html>",
431
+ "effect": "10-foot sizes, overscan-safe page inset, loud :focus rings (works without :focus-visible), zooming .tile focus, always-visible scroller arrows, highlighted shelf heading. TV browsers move focus with the D-pad; give every item a real link or button."
432
+ }
222
433
  }
223
434
  }
@@ -1,6 +1,7 @@
1
- @layer pf.tokens, pf.reset, pf.base, pf.layout, pf.components, pf.platform, pf.utilities;
1
+ @layer pf.tokens, pf.reset, pf.base, pf.layout, pf.components, pf.widgets, pf.platform, pf.utilities;
2
2
 
3
3
  @import url("./tokens.css");
4
+ @import url("./widgets.css");
4
5
  @import url("./platform.css");
5
6
 
6
7
  @layer pf.reset {