viewkitjs 0.21.0 → 0.22.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/MIGRATION.md +1 -1
  3. package/README.md +1 -1
  4. package/fields/dist/conventions.d.ts +15 -3
  5. package/fields/dist/conventions.js +25 -0
  6. package/fields/dist/design/category-colors.d.ts +12 -5
  7. package/fields/dist/design/category-colors.js +7 -7
  8. package/fields/dist/query/buckets.js +42 -35
  9. package/fields/dist/query/date.js +2 -13
  10. package/fields/docs/guides/conventions.md +1 -1
  11. package/fields/docs/guides/options.md +2 -1
  12. package/fields/docs/reference/design-category-colors.md +2 -2
  13. package/fields/docs/reference/fields.md +1 -1
  14. package/package.json +15 -1
  15. package/views/dist/atoms/tones.js +7 -7
  16. package/views/dist/contract.d.ts +288 -0
  17. package/views/dist/contract.js +96 -0
  18. package/views/dist/controls/button/button.d.ts +40 -0
  19. package/views/dist/controls/button/button.js +40 -0
  20. package/views/dist/controls/button/looks.d.ts +4 -0
  21. package/views/dist/controls/button/looks.js +20 -0
  22. package/views/dist/controls/button/map-button.d.ts +11 -0
  23. package/views/dist/controls/button/map-button.js +20 -0
  24. package/views/dist/controls/button/own-look.d.ts +59 -0
  25. package/views/dist/controls/button/own-look.js +33 -0
  26. package/views/dist/controls/button.css +530 -0
  27. package/views/dist/controls/controls.d.ts +5 -0
  28. package/views/dist/controls/controls.js +2 -0
  29. package/views/dist/controls/index.d.ts +11 -0
  30. package/views/dist/controls/index.js +6 -0
  31. package/views/dist/controls/smooth.css +101 -0
  32. package/views/dist/controls/spinner/looks.d.ts +4 -0
  33. package/views/dist/controls/spinner/looks.js +32 -0
  34. package/views/dist/controls/spinner/spinner.d.ts +23 -0
  35. package/views/dist/controls/spinner/spinner.js +16 -0
  36. package/views/dist/controls/spinner.css +147 -0
  37. package/views/dist/display/date.js +15 -2
  38. package/views/dist/looks/index.d.ts +2 -0
  39. package/views/dist/looks/index.js +2 -0
  40. package/views/dist/looks/looks.d.ts +2 -1
  41. package/views/dist/looks/pieces.js +3 -1
  42. package/views/dist/panels/react/views-row/FoldingViewRow.js +8 -8
  43. package/views/dist/styles.css +825 -56
  44. package/views/dist/styles.unlayered.css +842 -56
  45. package/views/docs/contract.md +131 -8
  46. package/views/docs/guides/the-provider.md +1 -1
  47. package/views/docs/index.md +1 -0
  48. package/views/docs/install.md +2 -0
  49. package/views/docs/reference/controls.md +36 -0
  50. package/views/docs/reference/looks.md +12 -2
  51. package/views/docs/reference/views.md +4 -1
@@ -250,9 +250,9 @@ declares both wherever a ground declares its own, so a part takes the states of
250
250
  The default atoms and the display also read `--vk-success`, `--vk-warning`, `--vk-info`,
251
251
  `--vk-label-blue`, `--vk-label-green`, `--vk-label-amber`, `--vk-label-red`, `--vk-label-purple`,
252
252
  `--vk-label-pink` and `--vk-label-teal` when the app declares them, each with a built-in fallback. The
253
- default Tag draws each hue as a pill, and the stylesheet draws fields' soft fills and the words on a filled
253
+ default Tag draws each hue as a pill, as does fields' chip map (`CATEGORY_COLOR_CLASSES`), and the stylesheet draws fields' soft fills and the words on a filled
254
254
  status, through the optional colours below (`<hue>` is each of the seven: blue, green, amber, red, purple,
255
- pink, teal). Each is optional: the stylesheet declares the Outright look's, and with `@source` the Tag's
255
+ pink, teal). Each is optional: the stylesheet declares the Outright look's, and with `@source` the pill's
256
256
  rungs fall back to the hue itself, so an app that declares only `--vk-label-<hue>` keeps its hue, and
257
257
  fields' names draw on the app's own theme.
258
258
 
@@ -263,10 +263,10 @@ fields' names draw on the app's own theme.
263
263
  | `--vk-info-subtlest` | an information wash (`bg-info-soft`) |
264
264
  | `--vk-fg-inverse` | words on a filled success, information or error |
265
265
  | `--vk-fg-warning-inverse` | words on a filled warning |
266
- | `--vk-label-<hue>-soft` | the hue's pale ground: a category chip's fill (`bg-label-<hue>-soft`) |
267
- | `--vk-label-<hue>-fill` | the Tag's fill; undeclared, the hue 15% into `--vk-ground` |
268
- | `--vk-label-<hue>-edge` | the Tag's edge, drawn inside; undeclared, the hue 40% into `--vk-ground` |
269
- | `--vk-label-<hue>-strong` | the Tag's words; undeclared, the hue 60% into `--vk-fg` |
266
+ | `--vk-label-<hue>-soft` | the hue's pale ground, for a class of the app's own (`bg-label-<hue>-soft`) |
267
+ | `--vk-label-<hue>-fill` | the pill's fill; undeclared, the hue 15% into `--vk-ground` |
268
+ | `--vk-label-<hue>-edge` | the pill's edge, drawn inside; undeclared, the hue 40% into `--vk-ground` |
269
+ | `--vk-label-<hue>-strong` | the pill's words; undeclared, the hue 60% into `--vk-fg` |
270
270
 
271
271
  By name: `--vk-label-blue-soft`, `--vk-label-green-soft`, `--vk-label-amber-soft`, `--vk-label-red-soft`, `--vk-label-purple-soft`, `--vk-label-pink-soft`, `--vk-label-teal-soft`; `--vk-label-blue-fill`, `--vk-label-green-fill`, `--vk-label-amber-fill`, `--vk-label-red-fill`, `--vk-label-purple-fill`, `--vk-label-pink-fill`, `--vk-label-teal-fill`; `--vk-label-blue-edge`, `--vk-label-green-edge`, `--vk-label-amber-edge`, `--vk-label-red-edge`, `--vk-label-purple-edge`, `--vk-label-pink-edge`, `--vk-label-teal-edge`; `--vk-label-blue-strong`, `--vk-label-green-strong`, `--vk-label-amber-strong`, `--vk-label-red-strong`, `--vk-label-purple-strong`, `--vk-label-pink-strong`, `--vk-label-teal-strong`.
272
272
 
@@ -363,17 +363,135 @@ sideways) for itself. The stylesheet declares `--vk-t-<name>`, its own theme val
363
363
  dark (a shadow). They carry the prefix because they share the global namespace;
364
364
  an app neither sets nor reads them, and they may change in any release.
365
365
 
366
+ ### The controls' tokens
367
+
368
+ ViewKit's default controls (`viewkitjs/views/controls`) read only these names, each optional: the ready stylesheet
369
+ declares every one at My preset's value, and an app declares one to change it. Each stands for one Outright token, which an
370
+ app on the Outright tokens declares it as. Sixteen are the contract's colours already. **How a new one is named**, so every
371
+ control that moves names the same way:
372
+
373
+ 1. A token already public keeps its name.
374
+ 2. A colour joins its family (`fg-`, the grounds, the fills, `border-`) in the family's words.
375
+ 3. A scale's name starts with the scale, a role's ends with it: `--vk-radius-md`, `--vk-shadow-key`, `--vk-font-size-sm`,
376
+ against `--vk-outline-radius`, `--vk-frozen-shadow-width`.
377
+ 4. Anything else is the prefix and the Outright token's own name.
378
+ 5. A scale step never falls back to a role's single name: each duration step is declared, and the grid's one `--vk-duration`
379
+ stays the grid's.
380
+ 6. No name repeats one the contract already gives a geometry, a layout or the grid's own machinery.
381
+
382
+ `--vk-fg-accent` is the brand's colour on words that aren't links; `--vk-fg-brand` stays the link's. The controls' own
383
+ machinery (the variables named for the button, the smooth corner, the spinner, the loading bar and the pressing room) is
384
+ private, set and read by a control alone.
385
+
386
+ | name | kind | the Outright token | default |
387
+ | ---- | ---- | ------------------ | ------- |
388
+ | `--vk-brand` | colour | `background-brand-bold` | `hsl(219 87% 54%)` · dark `hsl(219 87% 59.5%)` |
389
+ | `--vk-neutral` | colour | `background-neutral` | `hsl(0 0% 94%)` · dark `hsl(225 7% 11%)` |
390
+ | `--vk-neutral-hovered` | colour | `background-neutral-hovered` | `hsl(220 7% 90%)` · dark `hsl(225 7% 15%)` |
391
+ | `--vk-border` | colour | `border` | `hsl(220 7% 90%)` · dark `hsl(225 7% 15%)` |
392
+ | `--vk-border-bold` | colour | `border-bold` | `hsl(210 1% 82%)` · dark `hsl(210 2% 26.5%)` |
393
+ | `--vk-border-brand` | colour | `border-focused` | `hsl(219 90% 65.5%)` · dark `hsl(219 66% 47%)` |
394
+ | `--vk-border-subtle` | colour | `border-subtle` | `hsl(0 0% 94%)` · dark `hsl(225 7% 11%)` |
395
+ | `--vk-fg-brand` | colour | `link` | `hsl(219 87% 54%)` · dark `hsl(219 87% 59.5%)` |
396
+ | `--vk-ground` | colour | `surface` | `hsl(0 0% 100%)` · dark `hsl(210 6% 7%)` |
397
+ | `--vk-hovered` | colour | `surface-hovered` | `hsl(0 0% 96.5%)` · dark `hsl(210 4% 9.5%)` |
398
+ | `--vk-pressed` | colour | `surface-pressed` | `hsl(0 0% 94.5%)` · dark `hsl(225 7% 11%)` |
399
+ | `--vk-fg` | colour | `text` | `hsl(210 6% 7%)` · dark `hsl(210 8% 95%)` |
400
+ | `--vk-fg-on-brand` | colour | `text-brand-inverse` | `hsl(0 0% 100%)` · dark `hsl(210 8% 5%)` |
401
+ | `--vk-fg-inverse` | colour | `text-inverse` | `hsl(0 0% 100%)` · dark `hsl(210 8% 95%)` |
402
+ | `--vk-fg-subtle` | colour | `text-subtle` | `hsl(0 0% 35%)` · dark `hsl(258 4% 72%)` |
403
+ | `--vk-fg-subtlest` | colour | `text-subtlest` | `hsl(210 1% 53.5%)` · dark `hsl(210 3% 53%)` |
404
+ | `--vk-brand-hovered` | colour | `background-brand-bold-hovered` | `hsl(219 70% 46.5%)` · dark `hsl(219 95% 64%)` |
405
+ | `--vk-brand-pressed` | colour | `background-brand-bold-pressed` | `hsl(219 70% 38%)` · dark `hsl(219 100% 72.5%)` |
406
+ | `--vk-brand-subtler` | colour | `background-brand-subtler` | `hsl(218 100% 94%)` · dark `hsl(218 32% 14.5%)` |
407
+ | `--vk-brand-subtler-hovered` | colour | `background-brand-subtler-hovered` | `hsl(218 100% 89%)` · dark `hsl(219 46% 21%)` |
408
+ | `--vk-brand-subtler-pressed` | colour | `background-brand-subtler-pressed` | `hsl(218 97% 82%)` · dark `hsl(219 55% 29%)` |
409
+ | `--vk-danger-bold` | colour | `background-danger-bold` | `hsl(0 81% 58%)` |
410
+ | `--vk-danger-bold-hovered` | colour | `background-danger-bold-hovered` | `hsl(0 59% 49%)` · dark `hsl(3 90% 66.5%)` |
411
+ | `--vk-danger-bold-pressed` | colour | `background-danger-bold-pressed` | `hsl(0 59% 39%)` · dark `hsl(4 100% 75%)` |
412
+ | `--vk-info-bold` | colour | `background-information-bold` | `hsl(219 87% 54%)` · dark `hsl(219 87% 59.5%)` |
413
+ | `--vk-info-bold-hovered` | colour | `background-information-bold-hovered` | `hsl(219 70% 46.5%)` · dark `hsl(219 95% 64%)` |
414
+ | `--vk-info-bold-pressed` | colour | `background-information-bold-pressed` | `hsl(219 70% 38%)` · dark `hsl(219 100% 72.5%)` |
415
+ | `--vk-success-bold` | colour | `background-success-bold` | `hsl(158 98% 26%)` · dark `hsl(158 98% 34%)` |
416
+ | `--vk-success-bold-hovered` | colour | `background-success-bold-hovered` | `hsl(157 88% 24%)` · dark `hsl(150 45% 51.5%)` |
417
+ | `--vk-success-bold-pressed` | colour | `background-success-bold-pressed` | `hsl(156 87% 21%)` · dark `hsl(148 46% 62.5%)` |
418
+ | `--vk-warning-bold` | colour | `background-warning-bold` | `hsl(25 92% 41%)` |
419
+ | `--vk-warning-bold-hovered` | colour | `background-warning-bold-hovered` | `hsl(24 86% 35.5%)` · dark `hsl(21 66% 55%)` |
420
+ | `--vk-warning-bold-pressed` | colour | `background-warning-bold-pressed` | `hsl(23 85% 29%)` · dark `hsl(20 73% 65.5%)` |
421
+ | `--vk-brighten` | colour | `background-brighten` | `hsl(0 0% 100% / 0.09)` · dark `hsl(210 8% 95% / 0.09)` |
422
+ | `--vk-darken` | colour | `background-darken` | `hsl(214 30% 10% / 0.1)` · dark `hsl(0 0% 0% / 0.15)` |
423
+ | `--vk-border-input` | colour | `border-input` | `hsl(220 3% 86%)` · dark `hsl(220 4% 22%)` |
424
+ | `--vk-border-input-hovered` | colour | `border-input-hovered` | `hsl(210 1% 82%)` · dark `hsl(210 2% 26.5%)` |
425
+ | `--vk-raised` | colour | `surface-raised` | `hsl(0 0% 100%)` · dark `hsl(226 10% 10%)` |
426
+ | `--vk-raised-hovered` | colour | `surface-raised-hovered` | `hsl(220 3% 97%)` · dark `hsl(225 7% 15%)` |
427
+ | `--vk-overlay-hovered` | colour | `surface-overlay-hovered` | `hsl(220 3% 97%)` · dark `hsl(225 7% 15%)` |
428
+ | `--vk-overlay-pressed` | colour | `surface-overlay-pressed` | `hsl(0 0% 94%)` · dark `hsl(225 7% 15%)` |
429
+ | `--vk-overlay-card-pressed` | colour | `surface-overlay-card-pressed` | `hsl(220 7% 90%)` · dark `hsl(220 4% 22%)` |
430
+ | `--vk-fg-disabled` | colour | `text-disabled` | `hsl(210 1% 72%)` · dark `hsl(210 1% 37%)` |
431
+ | `--vk-fg-accent` | colour | `text-brand` | `hsl(219 87% 54%)` · dark `hsl(219 87% 59.5%)` |
432
+ | `--vk-border-width` | size | `border-width` | `1px` |
433
+ | `--vk-corner-smoothing` | size | `corner-smoothing` | `0.7` |
434
+ | `--vk-dot-size` | size | `dot-size` | `6px` |
435
+ | `--vk-duration-instant` | motion | `duration-instant` | `60ms` |
436
+ | `--vk-duration-fast` | motion | `duration-fast` | `150ms` |
437
+ | `--vk-duration-base` | motion | `duration-base` | `200ms` |
438
+ | `--vk-duration-slow` | motion | `duration-slow` | `300ms` |
439
+ | `--vk-ease-out` | motion | `ease-out` | `cubic-bezier(0, 0, 0.2, 1)` |
440
+ | `--vk-ease-in-out` | motion | `ease-in-out` | `cubic-bezier(0.4, 0, 0.2, 1)` |
441
+ | `--vk-ease-spring` | motion | `ease-spring` | `cubic-bezier(0.34, 1.56, 0.64, 1)` |
442
+ | `--vk-focus-width` | size | `focus-width` | `2px` |
443
+ | `--vk-focus-offset` | size | `focus-offset` | `2px` |
444
+ | `--vk-font-weight-medium` | size | `font-weight-medium` | `500` |
445
+ | `--vk-font-weight-semibold` | size | `font-weight-semibold` | `600` |
446
+ | `--vk-hover-lift` | motion | `hover-lift` | `1px` |
447
+ | `--vk-loading-dim` | motion | `loading-dim` | `0.55` |
448
+ | `--vk-press-scale` | motion | `press-scale` | `0.98` |
449
+ | `--vk-press-squash` | motion | `press-squash` | `1.025 0.92` |
450
+ | `--vk-press-travel` | motion | `press-travel` | `1px` |
451
+ | `--vk-press-travel-lg` | motion | `press-travel-lg` | `2px` |
452
+ | `--vk-progress-slide` | motion | `progress-slide` | `1400ms` |
453
+ | `--vk-radius-xs` | size | `radius-xs` | `2.5px` |
454
+ | `--vk-radius-sm` | size | `radius-sm` | `5px` |
455
+ | `--vk-radius-md` | size | `radius-md` | `7.5px` |
456
+ | `--vk-radius-lg` | size | `radius-lg` | `10px` |
457
+ | `--vk-radius-xl` | size | `radius-xl` | `15px` |
458
+ | `--vk-radius-2xl` | size | `radius-2xl` | `20px` |
459
+ | `--vk-radius-full` | size | `radius-full` | `9999px` |
460
+ | `--vk-shadow-key` | shadow | `shadow-key` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.24), inset 0 -1px 0 0 hsl(214 30% 10% / 0.18), 0 1px 0 0 hsl(214 30% 10% / 0.32), 0 1px 2px 0 hsl(214 30% 10% / 0.12)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.24), inset 0 -1px 0 0 hsl(0 0% 0% / 0.27), 0 1px 0 0 hsl(0 0% 0% / 0.5), 0 1px 2px 0 hsl(0 0% 0% / 0.18)` |
461
+ | `--vk-shadow-key-pressed` | shadow | `shadow-key-pressed` | `inset 0 1px 1.5px 0 hsl(214 30% 10% / 0.12)` · dark `inset 0 1px 1.5px 0 hsl(0 0% 0% / 0.18)` |
462
+ | `--vk-shadow-key-pressed-bold` | shadow | `shadow-key-pressed-bold` | `inset 0 1px 1.5px 0 hsl(214 30% 10% / 0.28)` · dark `inset 0 1px 1.5px 0 hsl(0 0% 0% / 0.42)` |
463
+ | `--vk-shadow-key-shallow` | shadow | `shadow-key-shallow` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.24), inset 0 -1px 0 0 hsl(214 30% 10% / 0.064)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.24), inset 0 -1px 0 0 hsl(0 0% 0% / 0.096)` |
464
+ | `--vk-shadow-key-soft` | shadow | `shadow-key-soft` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.3), inset 0 -1px 0 0 hsl(214 30% 10% / 0.088)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.3), inset 0 -1px 0 0 hsl(0 0% 0% / 0.132)` |
465
+ | `--vk-shadow-key-subtle` | shadow | `shadow-key-subtle` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.07), 0 1px 0 0 hsl(214 30% 10% / 0.088), 0 1px 2px 0 hsl(214 30% 10% / 0.04)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.07), 0 1px 0 0 hsl(0 0% 0% / 0.132), 0 1px 2px 0 hsl(0 0% 0% / 0.06)` |
466
+ | `--vk-shadow-key-subtle-raised` | shadow | `shadow-key-subtle-raised` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.07), 0 1px 0 0 hsl(214 30% 10% / 0.128), 0 1px 2px 0 hsl(214 30% 10% / 0.04)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.07), 0 1px 0 0 hsl(0 0% 0% / 0.192), 0 1px 2px 0 hsl(0 0% 0% / 0.06)` |
467
+ | `--vk-shadow-lift` | shadow | `shadow-lift` | `0 1px 2px 0 hsl(214 30% 10% / 0.104), 0 2px 6px -1px hsl(214 30% 10% / 0.064)` · dark `0 1px 2px 0 hsl(0 0% 0% / 0.156), 0 2px 6px -1px hsl(0 0% 0% / 0.096)` |
468
+ | `--vk-shadow-lift-raised` | shadow | `shadow-lift-raised` | `0 2px 4px -1px hsl(214 30% 10% / 0.104), 0 9px 20px -6px hsl(214 30% 10% / 0.136), 0 6px 18px -6px hsl(0 0% 100% / 0.1)` · dark `0 2px 4px -1px hsl(0 0% 0% / 0.156), 0 9px 20px -6px hsl(0 0% 0% / 0.204), 0 6px 18px -6px hsl(210 8% 95% / 0.1)` |
469
+ | `--vk-shadow-rim` | shadow | `shadow-rim` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.07)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.07)` |
470
+ | `--vk-shadow-rim-bold` | shadow | `shadow-rim-bold` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.22)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.22)` |
471
+ | `--vk-shadow-rim-bold-raised` | shadow | `shadow-rim-bold-raised` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.3)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.3)` |
472
+ | `--vk-shadow-rim-raised` | shadow | `shadow-rim-raised` | `inset 0 1px 0 0 hsl(0 0% 100% / 0.14)` · dark `inset 0 1px 0 0 hsl(210 8% 95% / 0.14)` |
473
+ | `--vk-spacing` | size | `spacing` | `4px` |
474
+ | `--vk-spinner-breath` | motion | `spinner-breath` | `1400ms` |
475
+ | `--vk-spinner-turn` | motion | `spinner-turn` | `2000ms` |
476
+ | `--vk-spinner-turn-reduced` | motion | `spinner-turn-reduced` | `3000ms` |
477
+ | `--vk-font-size-xs` | size | `text-xs` | `12px` |
478
+ | `--vk-font-size-sm` | size | `text-sm` | `14px` |
479
+ | `--vk-font-size-base` | size | `text-base` | `16px` |
480
+ | `--vk-font-size-lg` | size | `text-lg` | `18px` |
481
+
366
482
  ## Looks
367
483
 
368
484
  A piece's looks are declared beside the piece and listed in `LOOKS` (`viewkitjs/views/looks`). An option is a closed set
369
- of values with a default; a look is a named set of picks, one value for every option, its first the piece's own. An app
485
+ of values with a default; a look is a named set of picks, one value for every option. Nothing picked wears each option's
486
+ default, My preset's pick, which no look need match whole. An app
370
487
  wears a set of picks as data attributes on a frame round the piece, `data-<piece>-<option>="<value>"` (`lookAttrs`), which
371
488
  the piece's look stylesheet reads, and the piece's code reads the same picks back (`lookWorn`, `lookWornOf`); a pick its
372
489
  option doesn't have wears the default. **Public:** a piece's id, its options' ids, their values' ids and its looks' ids,
373
490
  renamed only with a codemod, since apps save picks by them. Not public: the words (`name`), which a later version may
374
491
  reword. Only options live in the shape: what a piece takes from an app's own design beyond its options stays outside it.
375
492
 
376
- Today one piece declares looks, the grid (`GRID_LOOKS`): 25 options and two looks, `attio` and `portal`. Fourteen of its
493
+ The Button (`BUTTON_LOOKS`: seven options, four looks) and the Spinner (`SPINNER_LOOKS`: six options, thirteen looks) declare
494
+ theirs beside them in the controls part; their look stylesheets are the controls' own. The grid (`GRID_LOOKS`): 25 options and two looks, `attio` and `portal`. Fourteen of its
377
495
  options are read by the grid's code (`GRID_LOOK_READ`): eleven become the props it is handed (`gridLookProps`), and three
378
496
  the app wires itself, `more` (pages under `GridTable`'s `pages`), `figures` (the footer's words, through the provider's
379
497
  messages) and `wait` (`RowsWait` in the components map). The other eleven are its look stylesheet's, which ships later.
@@ -392,6 +510,11 @@ on a focus that bubbles up from within, and where yours checks `:focus-visible`,
392
510
  grid's editors and menus use, each in Base UI's shape, and an adapter on Radix and one on Base UI
393
511
  both fill every one.
394
512
 
513
+ **Defaults for an app that hands none:** `CONTROLS`, from `viewkitjs/views/controls`, holds ViewKit's default controls,
514
+ the Outright kit's, on Base UI: today the `Button`. An app spreads it first and its own after
515
+ (`components={{ ...CONTROLS, ...own }}`), so whatever it hands wins. That door alone needs `@base-ui/react`, an optional
516
+ peer; the provider and every other door import neither library, so an app that hands every control never installs it.
517
+
395
518
  `Button` · `Popover` · `Tooltip` · `Checkbox` · `Menu` · `Collapse` · `Sheet` · `AppIcon` · `Markdown`
396
519
 
397
520
  `Button`: `ViewsButtonProps`, its children, `onClick`, `disabled`, `variant`, `size`, `type`, a class, `aria-label` and `title`, and, for the grid's own buttons when the provider's `gridButtons` is `button`, a `ref`, `tabIndex`, `aria-haspopup`, `aria-expanded`, `data-slot` and `data-open`, each forwarded to your element. A command cell's ▾ and trigger, under `gridButtons` too, and the selection chip, when the provider's `selectionBar`'s `chip` is `button`, are handed only the props named first, the chip also `data-slot`. A field row's own buttons, when the provider's `fieldRowButtons` is `button`, are handed `type`, `variant`, `size`, `className`, `aria-label`, `disabled` and `onClick` (the ▾ and the verb trigger no `onClick`: the menu opens on them), Show more also `data-slot`, and the edit target also a ref and `aria-disabled` while its write is pending, each forwarded to your element. The panels' own buttons, when the provider's `panelButtons` is `button`, are handed `type`, `variant` (`ghost`, `outline` or `secondary`), `size`, `className` and their children, each with what it needs of `onClick`, `disabled`, `aria-label`, `title`, a ref, `aria-haspopup`, `aria-expanded`, `aria-pressed`, `role`, `aria-selected`, `aria-disabled` and `aria-describedby` (a button that can't be used, described by why), `data-slot`, `data-state="open"` or `data-state="closed"` and `data-vs-row="true"`, each forwarded to your element.
@@ -87,7 +87,7 @@ The shapes are Base UI's, and the types promise three things:
87
87
  - **An `anchor`, not a trigger child.** The popover and the menu open at an element, a ref to one, or a point (a right-click). Nothing is wrapped.
88
88
  - **No `asChild`.** The tooltip is the one slot that wraps, and it takes the element it wraps as `children`.
89
89
 
90
- So an app on Base UI wraps its own copies thinly, and an app on Radix maps the difference in its adapter. The package ships none of these primitives and depends on neither library.
90
+ So an app on Base UI wraps its own copies thinly, and an app on Radix maps the difference in its adapter. The package's own defaults are `CONTROLS`, from `viewkitjs/views/controls`, on Base UI, an optional peer: spread it first and your own controls after. Every other door depends on neither library.
91
91
 
92
92
  ### An adapter over Radix
93
93
 
@@ -52,5 +52,6 @@ One page per door. Each lists every name the door exports.
52
52
  - [`viewkitjs/views/selection`](reference/selection.md): a list's selection
53
53
  - [`viewkitjs/views/grid`](reference/grid.md): the grid, its props and the helpers a host shares with it
54
54
  - [`viewkitjs/views/looks`](reference/looks.md): a piece's options and looks, and the helpers that wear one ([guide](guides/looks.md))
55
+ - [`viewkitjs/views/controls`](reference/controls.md): ViewKit's default controls on Base UI, the Button and the Spinner, and `CONTROLS` for the components map
55
56
  - [`viewkitjs/views/panels`](reference/panels.md): what a list's panels read and say, built from its settings, and the toolbar's arrangement, with no React
56
57
  - [`viewkitjs/views/panels/react`](reference/panels-react.md): the panels as they draw, the toolbar's frame, its parts and the ready toolbar
@@ -10,6 +10,8 @@
10
10
  `@dnd-kit/utilities` are optional peers for the panels' parts that drag (the views row's pills, the sort's rules, the
11
11
  Columns list, the group order), which the door loads with `import()` as it loads: install them if your app renders one. The drawn
12
12
  panels' door (`viewkitjs/views/panels/react`) itself loads without them. ESM only, Node 20 or later.
13
+ `@base-ui/react` (1.6 or later) is an optional peer too: install it only to take ViewKit's default controls
14
+ (`CONTROLS`, from `viewkitjs/views/controls`) for the ones your components map leaves out.
13
15
 
14
16
  2. **Import the stylesheet.** One line gives the rendering its whole look, with no Tailwind needed:
15
17
 
@@ -0,0 +1,36 @@
1
+ # `viewkitjs/views/controls`
2
+
3
+ Import from `viewkitjs/views/controls` to draw ViewKit's default controls: the Outright kit's Button and Spinner, on Base UI. It is the one door that needs `@base-ui/react`, an optional peer (`^1.6.0`): an app that hands every control in its components map never imports it and never installs Base UI. Guide: [the components map](../contract.md#the-components-map).
4
+
5
+ ## The defaults
6
+
7
+ - `CONTROLS` — the components map's defaults, for each control an app leaves out: today `Button`. An app spreads it first and its own controls after, `components={{ ...CONTROLS, ...own }}`. Its `Button` draws ViewKit's buttons (`variant`, `size`) as the kit's Button's kinds and sizes, and stands a glyph handed before the words as the Button's icon.
8
+ - `leadingGlyph` — `leadingGlyph(children, glyphs)`: a glyph before a button's words (an svg, or one of the app's icons in `glyphs`) as `{ icon, label }`; a glyph alone, or another component, stays `{ label }`.
9
+
10
+ ## The Button
11
+
12
+ - `Button` — what a person presses to make something happen, on Base UI's button: `kind`, `size`, `shape`, `loading` (a spinner over the label, which keeps its width; a press does nothing), `icon` and `iconEnd`, and `look`, its own look. Drawn as a link (`render={<a href=… />}`, `nativeButton={false}`) it stays a link. An icon-only one needs an `aria-label`.
13
+ - `ButtonProps` — its props: Base UI's button's, with those above.
14
+ - `ButtonKind` — `primary`, `outline` (the default), `soft`, `quiet`, `danger`, `information`, `success`, `warning`, `link`, `text`.
15
+ - `ButtonSize` — `2xs`, `xs`, `sm`, `md` (the default), `lg`, `44`, and the measured sizes `20`, `22`, `26`, `20x24`, `32x44`, `40x44`, `line`.
16
+ - `ButtonShape` — `default`, `icon` (square), `round`.
17
+ - `buttonClass` — `buttonClass(kind?, size?, shape?)`: its class names, for an element drawn as a Button.
18
+ - `ButtonGroup` — Buttons joined in a row or a column, the corners between them square and the edges shared.
19
+ - `ButtonGroupText` — words inside a group: a unit, a count.
20
+ - `ButtonGroupSeparator` — a line between two Buttons of a group that have no edge of their own.
21
+ - `ButtonOwnLook` — a Button's own look, set on one Button: its radius, words, colour, icons, room, hover, open and pressed states and the rest, each an attribute on the Button beside `data-button-own`. It may change before 1.0.
22
+ - `buttonOwnOptions` — each own option, the attribute it sets and its values.
23
+ - `buttonOwnAttrs` — `buttonOwnAttrs(look)`: the attributes of an own look.
24
+
25
+ ## The Spinner
26
+
27
+ - `Spinner` — something on its way, in the colour of the words beside it, at `size` px, said to screen readers by `label` (empty when what it stands in for says it). Every kind is in its drawing; the frame's `data-spinner-*` picks one.
28
+ - `SpinnerProps` — its props.
29
+ - `LoadingBar` — a thin bar along the top of what is loading again, which stays where it is, dimmed and out of reach, until it is in.
30
+ - `LoadingBarProps` — its props.
31
+
32
+ ## The stylesheets
33
+
34
+ The ready stylesheet (`viewkitjs/views/styles.css`) carries the controls, every token they read declared at the Outright look's value ([the controls' tokens](../contract.md#the-controls-tokens)). An app on the Outright tokens imports them one by one instead, in this order, and declares each token as its own: `viewkitjs/views/controls/smooth.css` (the smooth corner every control's outline stands on), `viewkitjs/views/controls/button.css`, `viewkitjs/views/controls/spinner.css`. Their options and looks are on [`viewkitjs/views/looks`](looks.md).
35
+
36
+ The class names (`o-button`, `o-spinner` and the rest) and the selectors other pieces use to style a Button they hold stay as the Outright kit named them until those pieces move into ViewKit; they are not public.
@@ -4,7 +4,7 @@ Import from `viewkitjs/views/looks` to pick a piece's look by name: each piece's
4
4
 
5
5
  ## The shape
6
6
 
7
- - `PieceLooks` — a piece's options and looks: `id` (the piece's, the middle of its attributes' names), `name`, `options` (`LookOption`s, in the order a picker shows them) and `looks` (`Look`s, the first the one worn when nothing is picked).
7
+ - `PieceLooks` — a piece's options and looks: `id` (the piece's, the middle of its attributes' names), `name`, `options` (`LookOption`s, in the order a picker shows them) and `looks` (`Look`s). Nothing picked wears each option's `def`, My preset's pick, which no look need match whole.
8
8
  - `LookOption` — one option: `id`, `name`, `def` (the value worn when nothing is picked, or when the pick is a value it doesn't have), `values` (`LookValue`s), and optionally `device` (a `LookDevice`), `kind` (`"steps"` for an ordered scale, `"list"` for a long list), `unless` (an option and a value, or several, under which this one means nothing) and `demo: false` (it changes nothing a whole list draws, so a list-wide picker may leave it out).
9
9
  - `LookValue` — one value an option can hold: `id` and `name`.
10
10
  - `Look` — a named set of picks: `id`, `name`, `picks` (one value for every option) and optionally `device`.
@@ -17,7 +17,17 @@ Import from `viewkitjs/views/looks` to pick a piece's look by name: each piece's
17
17
  - `lookPicks` — `lookPicks(piece, id)`: a look's picks by its id, or `undefined` for an id the piece has no look by.
18
18
  - `lookWorn` — `lookWorn(piece, picks, ids)`: the named options' values from a set of picks, each its default when missing or unknown.
19
19
  - `lookWornOf` — `lookWornOf(piece, element, ids)`: the same, read from the closest frame round `element` carrying each option's attribute; with `null`, or outside any frame, the defaults.
20
- - `LOOKS` — every piece that declares looks, in a list, each found by its `id`. Today, the grid.
20
+ - `LOOKS` — every piece that declares looks, in a list, each found by its `id`: the grid, the Button and the Spinner.
21
+
22
+ ## The controls'
23
+
24
+ The default controls' options and looks (the controls themselves: [`viewkitjs/views/controls`](controls.md)), each worn
25
+ on a frame round the controls as `data-button-*` and `data-spinner-*`, which the controls' stylesheets read.
26
+
27
+ - `BUTTON_LOOKS` — the Button's: 7 options (`radius`, a scale from `xs` to `full`; `smoothing`; `depth`; `hover`; `press`; `soft`; `weight`) and four looks, `classic` (every option's default), `keycap`, `pill` and `soft-lift`.
28
+ - `ButtonLookOptionId` — the Button's option ids.
29
+ - `SPINNER_LOOKS` — the Spinner's: 6 options (`kind`, `breath`, `line`, `track`, `bars`, `loading`, the four in the middle meaning nothing under some kinds) and thirteen looks, from `arc` to `pulse`.
30
+ - `SpinnerLookOptionId` — the Spinner's option ids.
21
31
 
22
32
  ## The grid's
23
33
 
@@ -26,6 +26,9 @@ Guide: [the provider](../guides/the-provider.md).
26
26
  - `VK_INTERNAL_FAMILIES` — the grid's internal variable families, a prefix with one variable per key after it: `--vk-col-w-<id>`, one column's resolved width, set on the grid's root for every visible column. Not public, like `VK_INTERNAL`.
27
27
  - `VK_INTERNAL_MARKS` — the display's own marks, set and read by ViewKit alone: `vk-fit` on a cell fitting its values and `vk-fit-value` on each value's box, which its measure reads. Not public, like `VK_INTERNAL`: your app neither sets, reads nor styles them, and they may change in any release.
28
28
  - `VkInternalMark` — one member of `VK_INTERNAL_MARKS`.
29
+ - `VK_CONTROL_TOKENS` — every name ViewKit's default controls (`viewkitjs/views/controls`) read, each with its `kind` (`colour`, `shadow`, `size` or `motion`): all optional, the ready stylesheet declaring each at the Outright look's value, and each standing for the Outright token [the controls' tokens](../contract.md#the-controls-tokens) names.
30
+ - `VkControlToken` — one name of `VK_CONTROL_TOKENS`.
31
+ - `VK_CONTROL_PRIVATE_FAMILIES` — the prefixes of the controls' own machinery, set and read by a control alone: not public, and your app neither sets nor reads them.
29
32
  - `COMPONENT_NAMES` — the primitives your app hands in through the provider: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon` and `Markdown` ([the components map](../contract.md#the-components-map)).
30
33
  - `ComponentName` — one member of `COMPONENT_NAMES`.
31
34
  - `OPTIONAL_COMPONENT_NAMES` — the primitives your app may leave out: `Input` (a plain default), `Command` (reached without one, it throws an error naming it), `Picker` (without one, the lists draw from `Command`), `LinksBody` (without one, the set editor of a relation whose field declares `links` opens `Picker`, else its own list), `Calendar` (reached without one, it throws an error naming it), `DateBody` (without one, the date editor draws its own around `Calendar`), `PartsBody` (without one, the name, place and range editors draw their own boxes), `ValuesBody` (without one, the value list editor draws its own rows), `TextBody` (without one, the text editors draw their own box) and `NumberBody` (without one, the number editors draw their own box), `SortBody` (without one, the sort pill opens ViewKit's own sort editor), `FilterBody` (without one, an advanced filter's pill and the phone's Filter open ViewKit's own filter editor), `FieldsBody` (without one, ViewKit's own sort and filter field lists), `FilterPartBody` (without one, a filter rule's way and value open ViewKit's ways menu and value body), `RowsWait` (without one, a grid waiting for new rows draws Loading in place of its body), `QuickFiltersBody` (without one, the quick filters' button opens ViewKit's own quick-filters panel), `ViewsListBody` (without one, the view picker opens ViewKit's own list of views), `GroupBody` (without one, Customize's Group opens ViewKit's own group pages), `CustomizeBody` (without one, Options opens ViewKit's own Customize) and `SearchField` (without one, the toolbar's search draws its own field) ([the components map](../contract.md#the-components-map)).
@@ -430,7 +433,7 @@ Each rule is data, an operator and its values, so the same rule is judged in mem
430
433
  - `dateFilterDates` — how many days a date operator takes: none, one or two.
431
434
  - `dateFilterOperatorLabel` — a date operator's name in the host's words.
432
435
  - `isDateRuleActive` — says whether a date rule filters: a relative rule needs its direction and unit, the others their days.
433
- - `dateRuleLabel` — a date rule's summary, its days written in the host's locale, or the word for any.
436
+ - `dateRuleLabel` — a date rule's summary, its days written in the host's locale with their month's word in its `language`, or the word for any.
434
437
  - `matchesDateRule` — judges a value against a date rule by its calendar day in the host's time zone; a relative rule is resolved against the current moment each time, so it moves with the clock.
435
438
  - `resolveRelativeWindow` — the inclusive window of days a relative rule means today: this is the calendar period holding today, with weeks running Monday to Sunday; past and next run back or forward one unit from today.
436
439
  - `valueDayKey` — the calendar day a stored date or instant means, in the host's time zone; a bare day is already a day and is never read as a UTC instant. Null for an empty or unreadable value.