@zazz-ui/core 0.9.1 → 0.11.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 (127) hide show
  1. package/AUTHORING.md +21 -16
  2. package/CHANGELOG.md +144 -0
  3. package/README.md +3 -3
  4. package/dist/sri.json +89 -88
  5. package/dist/zazz.css +1 -1
  6. package/editor/zazz.css-data.json +8370 -1264
  7. package/editor/zazz.html-data.json +31 -41
  8. package/editor/zazz.language-data.json +516 -247
  9. package/editor/zazz.lint-data.json +654 -619
  10. package/package.json +2 -3
  11. package/src/base/_defaults.css +59 -40
  12. package/src/base/_layers.css +5 -2
  13. package/src/base/_properties-2xl.css +10 -0
  14. package/src/base/_properties-active.css +8 -0
  15. package/src/base/_properties-checked.css +8 -0
  16. package/src/base/_properties-current.css +8 -0
  17. package/src/base/_properties-disabled.css +8 -0
  18. package/src/base/_properties-focus-visible.css +8 -0
  19. package/src/base/_properties-focus-within.css +8 -0
  20. package/src/base/_properties-hover.css +8 -0
  21. package/src/base/_properties-lg.css +10 -0
  22. package/src/base/_properties-md.css +10 -0
  23. package/src/base/_properties-open.css +8 -0
  24. package/src/base/_properties-sm.css +10 -0
  25. package/src/base/_properties-starting.css +4 -0
  26. package/src/base/_properties-stuck.css +4 -0
  27. package/src/base/_properties-xl.css +10 -0
  28. package/src/base/_properties.css +55 -15
  29. package/src/base/_reset.css +8 -4
  30. package/src/base/_typography.css +26 -9
  31. package/src/base/_utilities-box.css +63 -59
  32. package/src/base/_utilities-color.css +55 -8
  33. package/src/base/_utilities-effects.css +8 -0
  34. package/src/base/_utilities-flow.css +28 -5
  35. package/src/base/_utilities-pseudo.css +4 -0
  36. package/src/base/_utilities-spacing.css +8 -8
  37. package/src/base/_utilities-sr.css +98 -0
  38. package/src/base/_utilities-tier-2xl.css +5 -0
  39. package/src/base/_utilities-tier-active.css +5 -1
  40. package/src/base/_utilities-tier-checked.css +5 -1
  41. package/src/base/_utilities-tier-current.css +5 -1
  42. package/src/base/_utilities-tier-disabled.css +5 -1
  43. package/src/base/_utilities-tier-focus-visible.css +5 -1
  44. package/src/base/_utilities-tier-focus-within.css +5 -1
  45. package/src/base/_utilities-tier-hover.css +5 -1
  46. package/src/base/_utilities-tier-lg.css +5 -0
  47. package/src/base/_utilities-tier-md.css +5 -0
  48. package/src/base/_utilities-tier-open.css +5 -1
  49. package/src/base/_utilities-tier-sm.css +5 -0
  50. package/src/base/_utilities-tier-starting.css +2 -0
  51. package/src/base/_utilities-tier-stuck.css +3 -0
  52. package/src/base/_utilities-tier-xl.css +5 -0
  53. package/src/base/_utilities-typography.css +263 -3
  54. package/src/base/_variables.css +151 -60
  55. package/src/base/kit-styling.d.ts.map +1 -1
  56. package/src/base/kit-styling.js +134 -128
  57. package/src/base/kit-styling.ts +134 -128
  58. package/src/base/utilities.d.ts +23 -8
  59. package/src/base/utilities.d.ts.map +1 -1
  60. package/src/base/utilities.js +78 -3
  61. package/src/base/utilities.ts +95 -11
  62. package/src/head.d.ts.map +1 -1
  63. package/src/head.js +4 -5
  64. package/src/head.ts +4 -5
  65. package/src/index.css +3 -2
  66. package/src/manifest.d.ts.map +1 -1
  67. package/src/manifest.js +13 -3
  68. package/src/manifest.ts +13 -3
  69. package/src/primitives/accordion/accordion.css +3 -0
  70. package/src/primitives/alert-dialog/alert-dialog.css +1 -1
  71. package/src/primitives/alert-dialog/alert-dialog.html +14 -14
  72. package/src/primitives/autocomplete/autocomplete.css +4 -2
  73. package/src/primitives/avatar/avatar.html +4 -6
  74. package/src/primitives/badge/badge.css +77 -56
  75. package/src/primitives/breadcrumbs/breadcrumbs.html +1 -7
  76. package/src/primitives/button/button.css +75 -60
  77. package/src/primitives/button-group/button-group.css +4 -0
  78. package/src/primitives/callout/callout.css +22 -43
  79. package/src/primitives/card/card-subgrid.html +2 -3
  80. package/src/primitives/card/card.css +4 -0
  81. package/src/primitives/card/card.html +2 -3
  82. package/src/primitives/checkbox/checkbox.css +13 -0
  83. package/src/primitives/combobox/combobox.css +25 -2
  84. package/src/primitives/command/command-actions.d.ts.map +1 -1
  85. package/src/primitives/command/command-actions.js +4 -9
  86. package/src/primitives/command/command-actions.ts +4 -9
  87. package/src/primitives/command/command-dialog.html +109 -107
  88. package/src/primitives/command/command.css +16 -8
  89. package/src/primitives/debug/audit-core.d.ts +1 -1
  90. package/src/primitives/debug/audit-core.d.ts.map +1 -1
  91. package/src/primitives/debug/audit-core.js +30 -3
  92. package/src/primitives/debug/audit-core.ts +40 -2
  93. package/src/primitives/dialog/dialog-with-form.html +1 -1
  94. package/src/primitives/dialog/dialog.css +111 -44
  95. package/src/primitives/fields/fields.css +11 -5
  96. package/src/primitives/group/group.css +18 -0
  97. package/src/primitives/group/group.html +26 -0
  98. package/src/primitives/input/input.css +16 -9
  99. package/src/primitives/input-group/input-group-password-group.html +1 -1
  100. package/src/primitives/input-group/input-group.css +19 -11
  101. package/src/primitives/kbd/kbd.css +4 -0
  102. package/src/primitives/lightbox/lightbox.css +17 -4
  103. package/src/primitives/lightbox/lightbox.html +2 -1
  104. package/src/primitives/menu/menu.css +3 -1
  105. package/src/primitives/meter/meter.css +10 -3
  106. package/src/primitives/mobile-menu/mobile-menu.css +17 -16
  107. package/src/primitives/mobile-menu/mobile-menu.html +4 -4
  108. package/src/primitives/navigation-menu/navigation-menu.css +8 -3
  109. package/src/primitives/navigation-menu/navigation-menu.html +2 -2
  110. package/src/primitives/otp/otp.css +7 -2
  111. package/src/primitives/password-group/password-group.css +20 -12
  112. package/src/primitives/password-group/password-group.html +1 -1
  113. package/src/primitives/popover/popover.css +29 -10
  114. package/src/primitives/progress/progress.css +5 -0
  115. package/src/primitives/radio/radio.css +15 -2
  116. package/src/primitives/scroll-fade/scroll-fade.css +1 -1
  117. package/src/primitives/select/select.css +42 -21
  118. package/src/primitives/slider/slider.css +11 -0
  119. package/src/primitives/switch/switch.css +67 -20
  120. package/src/primitives/tabs/tabs.css +20 -1
  121. package/src/primitives/textarea/textarea.css +19 -10
  122. package/src/primitives/toaster/toaster.css +8 -4
  123. package/src/primitives/toggle/toggle.css +37 -9
  124. package/src/primitives/toggle-group/toggle-group.css +4 -0
  125. package/src/primitives/tooltip/tooltip.css +44 -25
  126. package/src/primitives/utilities/pile.html +2 -3
  127. package/src/base/_switches.css +0 -148
@@ -7,7 +7,7 @@
7
7
  * where it can, the span of the declaration it is about (offsets into the
8
8
  * `style` attribute) and a suggested rewrite.
9
9
  */
10
- import { BORDER_SHORTHANDS, BOX_SHADOW_COMPOSITE, SHORTHAND_OF, DISPLAY_SHORTHANDS, GRADIENT_TYPES, UTILITIES, PSEUDO_ONLY, FONT_WEIGHT_NAMES, STUCK_STATE, STATES, parseUtilityName, tiersOf, } from "../../base/utilities.js";
10
+ import { BORDER_SHORTHANDS, BOX_SHADOW_COMPOSITE, SHORTHAND_OF, DISPLAY_PILE, RETIRED_TOKENS, DISPLAY_SHORTHANDS, GRADIENT_TYPES, UTILITIES, PSEUDO_ONLY, FONT_WEIGHT_NAMES, STUCK_STATE, STATES, parseUtilityName, tiersOf, } from "../../base/utilities.js";
11
11
  export const RULE_IDS = [
12
12
  "unknown-utility",
13
13
  "pseudo-form",
@@ -26,6 +26,7 @@ export const RULE_IDS = [
26
26
  "whitespace-before-colon",
27
27
  "whitespace-after-colon",
28
28
  "attribute-outside-identity",
29
+ "retired-token",
29
30
  "field-id-or-name",
30
31
  "persist",
31
32
  ];
@@ -47,7 +48,8 @@ const FUNCTION = /^(calc|clamp|min|max|var|env|round|mod|rem|abs|sign)\(/;
47
48
  function gatedValue(utility, value) {
48
49
  return ((utility.keywords ?? []).includes(value) ||
49
50
  value in (utility.aliases ?? {}) ||
50
- (utility.name === "display" && value in DISPLAY_SHORTHANDS) ||
51
+ (utility.name === "display" && (value in DISPLAY_SHORTHANDS || value === DISPLAY_PILE)) ||
52
+ (utility.emit === "text-wrap" && value === "truncate") ||
51
53
  (utility.name === "bg" && value === "none") ||
52
54
  (utility.name === "position" && value === "sticky"));
53
55
  }
@@ -149,6 +151,18 @@ export function auditNode(node, context) {
149
151
  bases.add((parsed.side ? `${parsed.side}-` : "") + parsed.name);
150
152
  }
151
153
  const tokens = (node.getAttribute("data-ui") ?? "").split(/\s+/).filter(Boolean);
154
+ for (const token of tokens) {
155
+ const replacement = RETIRED_TOKENS[token];
156
+ if (replacement) {
157
+ found.push({
158
+ rule: "retired-token",
159
+ message: `\`data-ui="${token}"\` is gone: \`data-ui\` holds identities only. Use ${replacement}.`,
160
+ attribute: "data-ui",
161
+ });
162
+ }
163
+ }
164
+ const sticky = parsedPairs.some(([parsed, , declaration]) => parsed.name === STUCK_STATE.modifier ||
165
+ (parsed.name === "position" && declaration.value === "sticky"));
152
166
  for (const [parsed, name, declaration] of parsedPairs) {
153
167
  const { value, span } = declaration;
154
168
  const warn = (rule, message, suggestion) => found.push({ rule, message, span, ...(suggestion ? { suggestion } : {}) });
@@ -197,6 +211,13 @@ export function auditNode(node, context) {
197
211
  }
198
212
  if (!parsed.side && gatedValue(utility, value))
199
213
  spacing();
214
+ // only --container-type keeps the scroll-state type beside its own, and only
215
+ // beside a size type: the kit cannot read a part of a raw shorthand
216
+ if (sticky &&
217
+ (utility.name === "container" ||
218
+ (utility.name === "container-type" && /normal|scroll-state/.test(value)))) {
219
+ warn("scroll-state", `\`${name}: ${value}\` replaces this sticky element's container type, so its stuck state stops working. Use \`--container-name\` with \`--container-type: inline-size\`.`);
220
+ }
200
221
  const baseName = (parsed.side ? `${parsed.side}-` : "") + utility.name;
201
222
  if (parsed.group && parsed.tier === "stuck") {
202
223
  warn("scroll-state", `\`${name}\` has no group form: the sticky container is the trigger, so write \`--${utility.name}--stuck\` inside it.`);
@@ -217,6 +238,9 @@ export function auditNode(node, context) {
217
238
  warn("group-needs-state", `\`${name}\` needs a state tier: group utilities take \`--group-${utility.name}--<state>\`.`);
218
239
  continue;
219
240
  }
241
+ if (utility.emit === "divide" && value !== "none" && !isBorderValue(value, context.isColor)) {
242
+ warn("border-value", `\`${name}: ${value}\` is not one color, number, length, or \`none\`.`);
243
+ }
220
244
  if (utility.emit === "border" && !isBorderValue(value, context.isColor)) {
221
245
  warn("border-value", `\`${name}: ${value}\` is not one color, number, or length; it draws a 1px transparent border. Use \`--border: 2\`, \`--border: var(--color-primary)\`, or set \`--border-style\` separately.`);
222
246
  }
@@ -255,6 +279,8 @@ export function auditNode(node, context) {
255
279
  // element through another utility or a token, and are not checked here
256
280
  const composite = BOX_SHADOW_COMPOSITE.includes(utility.name);
257
281
  const feedsComposite = !composite && (utility.emit === "none" || utility.emit === "px");
282
+ // each of these declares its own property or resolves on its own gate
283
+ const standalone = utility.emit === "direct" || utility.emit === "divide";
258
284
  // a tier alone works where the kit reads the utility through its own chain,
259
285
  // or where the tier-only rule (`@layer defaults`) applies: a no-base utility
260
286
  // whose property no kit rule above that layer sets on this element
@@ -266,7 +292,8 @@ export function auditNode(node, context) {
266
292
  !bases.has(baseName) &&
267
293
  !borderBase &&
268
294
  !shorthandBase &&
269
- !feedsComposite) {
295
+ !feedsComposite &&
296
+ !standalone) {
270
297
  warn("tier-without-base", `\`${name}\` has no base \`--${baseName}\`; the tier only overrides a base.`);
271
298
  }
272
299
  continue;
@@ -13,6 +13,8 @@ import {
13
13
  BORDER_SHORTHANDS,
14
14
  BOX_SHADOW_COMPOSITE,
15
15
  SHORTHAND_OF,
16
+ DISPLAY_PILE,
17
+ RETIRED_TOKENS,
16
18
  DISPLAY_SHORTHANDS,
17
19
  GRADIENT_TYPES,
18
20
  UTILITIES,
@@ -45,6 +47,7 @@ export type RuleId =
45
47
  | "whitespace-before-colon"
46
48
  | "whitespace-after-colon"
47
49
  | "attribute-outside-identity"
50
+ | "retired-token"
48
51
  | "field-id-or-name"
49
52
  | "persist";
50
53
 
@@ -66,6 +69,7 @@ export const RULE_IDS: readonly RuleId[] = [
66
69
  "whitespace-before-colon",
67
70
  "whitespace-after-colon",
68
71
  "attribute-outside-identity",
72
+ "retired-token",
69
73
  "field-id-or-name",
70
74
  "persist",
71
75
  ];
@@ -148,7 +152,8 @@ function gatedValue(utility: Utility, value: string): boolean {
148
152
  return (
149
153
  (utility.keywords ?? []).includes(value) ||
150
154
  value in (utility.aliases ?? {}) ||
151
- (utility.name === "display" && value in DISPLAY_SHORTHANDS) ||
155
+ (utility.name === "display" && (value in DISPLAY_SHORTHANDS || value === DISPLAY_PILE)) ||
156
+ (utility.emit === "text-wrap" && value === "truncate") ||
152
157
  (utility.name === "bg" && value === "none") ||
153
158
  (utility.name === "position" && value === "sticky")
154
159
  );
@@ -266,6 +271,21 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
266
271
  if (!parsed.tier) bases.add((parsed.side ? `${parsed.side}-` : "") + parsed.name);
267
272
  }
268
273
  const tokens = (node.getAttribute("data-ui") ?? "").split(/\s+/).filter(Boolean);
274
+ for (const token of tokens) {
275
+ const replacement = RETIRED_TOKENS[token];
276
+ if (replacement) {
277
+ found.push({
278
+ rule: "retired-token",
279
+ message: `\`data-ui="${token}"\` is gone: \`data-ui\` holds identities only. Use ${replacement}.`,
280
+ attribute: "data-ui",
281
+ });
282
+ }
283
+ }
284
+ const sticky = parsedPairs.some(
285
+ ([parsed, , declaration]) =>
286
+ parsed.name === STUCK_STATE.modifier ||
287
+ (parsed.name === "position" && declaration.value === "sticky"),
288
+ );
269
289
  for (const [parsed, name, declaration] of parsedPairs) {
270
290
  const { value, span } = declaration;
271
291
  const warn = (rule: RuleId, message: string, suggestion?: Suggestion) =>
@@ -326,6 +346,18 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
326
346
  continue;
327
347
  }
328
348
  if (!parsed.side && gatedValue(utility, value)) spacing();
349
+ // only --container-type keeps the scroll-state type beside its own, and only
350
+ // beside a size type: the kit cannot read a part of a raw shorthand
351
+ if (
352
+ sticky &&
353
+ (utility.name === "container" ||
354
+ (utility.name === "container-type" && /normal|scroll-state/.test(value)))
355
+ ) {
356
+ warn(
357
+ "scroll-state",
358
+ `\`${name}: ${value}\` replaces this sticky element's container type, so its stuck state stops working. Use \`--container-name\` with \`--container-type: inline-size\`.`,
359
+ );
360
+ }
329
361
  const baseName = (parsed.side ? `${parsed.side}-` : "") + utility.name;
330
362
  if (parsed.group && parsed.tier === "stuck") {
331
363
  warn(
@@ -358,6 +390,9 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
358
390
  );
359
391
  continue;
360
392
  }
393
+ if (utility.emit === "divide" && value !== "none" && !isBorderValue(value, context.isColor)) {
394
+ warn("border-value", `\`${name}: ${value}\` is not one color, number, length, or \`none\`.`);
395
+ }
361
396
  if (utility.emit === "border" && !isBorderValue(value, context.isColor)) {
362
397
  warn(
363
398
  "border-value",
@@ -410,6 +445,8 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
410
445
  // element through another utility or a token, and are not checked here
411
446
  const composite = (BOX_SHADOW_COMPOSITE as readonly string[]).includes(utility.name);
412
447
  const feedsComposite = !composite && (utility.emit === "none" || utility.emit === "px");
448
+ // each of these declares its own property or resolves on its own gate
449
+ const standalone = utility.emit === "direct" || utility.emit === "divide";
413
450
  // a tier alone works where the kit reads the utility through its own chain,
414
451
  // or where the tier-only rule (`@layer defaults`) applies: a no-base utility
415
452
  // whose property no kit rule above that layer sets on this element
@@ -425,7 +462,8 @@ export function auditNode(node: AuditNode, context: AuditContext): Finding[] {
425
462
  !bases.has(baseName) &&
426
463
  !borderBase &&
427
464
  !shorthandBase &&
428
- !feedsComposite
465
+ !feedsComposite &&
466
+ !standalone
429
467
  ) {
430
468
  warn(
431
469
  "tier-without-base",
@@ -52,7 +52,7 @@
52
52
  method="dialog"
53
53
  >
54
54
  <fieldset data-ui="field-group">
55
- <legend data-ui="sr-only">Contact</legend>
55
+ <legend style="--sr: only">Contact</legend>
56
56
  <div
57
57
  style="
58
58
  --display: grid;
@@ -9,14 +9,18 @@
9
9
  * is open (WebKit ignores overscroll-behavior on boxes that do not overflow)
10
10
  * @uses @starting-style + allow-discrete — open/close opacity, transform, overlay
11
11
  * @uses anchor-name, container-type — layout hooks for sized variants
12
- * @tokens --ui-dialog-* (@layer variables; --ui-dialog-h defaults to a keyword, so it is read
13
- * raw: a --h length, or a tier carrying a length, applies; a scale
14
- * number applies only as a base utility)
12
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
13
+ * rounded corners
14
+ * @tokens --ui-dialog-* (@layer variables; --ui-dialog-h defaults to a keyword, so the hook
15
+ * is read raw and takes a length or keyword; a --h utility or tier takes a scale
16
+ * number or a length; a keyword tier needs a base --h, or it renders as auto)
15
17
  * @presets data-dialog-size="sm | md | lg | xl | 2xl | full | bleed" (the layout bands; sm when absent)
16
- * @uses @media (width < 40rem) + @container style(--ui-dialog-mobile-size) — below the sm
17
- * band every dialog takes the hook's size (layout-bleed by default) over its preset;
18
- * style queries are Firefox 151+, Chrome 111+, Safari 18+, an older engine keeps the preset
19
- * @consumedby alert-dialog.css, mobile-menu.css
18
+ * @uses @media (width < 40rem) and (not (hover: hover)) + @container style(--ui-dialog-mobile-size)
19
+ * — below the sm band on a touch screen every dialog takes the hook's size (layout-bleed
20
+ * by default) over its preset; a narrow window with a mouse keeps the preset; style
21
+ * queries are Firefox 151+, Chrome 111+, Safari 18+, an older engine keeps the preset
22
+ * @uses env(safe-area-inset-bottom) — the full-height content slot clears the home indicator
23
+ * @consumedby alert-dialog.css, command.css, lightbox.css, mobile-menu.css
20
24
  */
21
25
 
22
26
  @layer variables {
@@ -24,11 +28,13 @@
24
28
  --ui-dialog-backdrop-color: var(--color-shade-900);
25
29
  --ui-dialog-transition-duration: var(--default-transition-duration);
26
30
  --ui-dialog-transition-timing-function: var(--default-transition-timing-function);
27
- --ui-dialog-backdrop-transition-duration: calc(var(--ui-dialog-transition-duration) - 100ms);
28
- --ui-dialog-backdrop-transition-timing-function: ease;
31
+ --ui-dialog-backdrop-transition-duration: calc(var(--ui-dialog-transition-duration) / 2);
32
+ --ui-dialog-backdrop-transition-timing-function: var(--bezier-easing);
29
33
  --ui-dialog-backdrop-filter: none;
30
34
  --ui-dialog-shadow: var(--shadow-lg);
31
- --ui-dialog-border: 1px solid var(--color-border);
35
+ --ui-dialog-border-width: 1px;
36
+ --ui-dialog-border-style: solid;
37
+ --ui-dialog-border-color: var(--color-border);
32
38
  /* the sm band, the default size */
33
39
  --ui-dialog-w: min(var(--layout-sm), 100% - var(--gutters) * 2);
34
40
  /* below the sm band, the size every dialog takes: layout-bleed (edge to edge, no page
@@ -53,6 +59,7 @@
53
59
  --ui-dialog-bg: var(--color-card);
54
60
  --ui-dialog-text: var(--color-card-foreground);
55
61
  --ui-dialog-radius: var(--radius-lg);
62
+ --ui-dialog-corner-shape: var(--radius-corner-shape);
56
63
  }
57
64
  }
58
65
 
@@ -64,15 +71,17 @@
64
71
 
65
72
  /* Spring-eased open/close */
66
73
  :where(dialog) {
74
+ isolation: isolate;
67
75
  margin: auto;
68
76
  max-inline-size: calc(100% - var(--space-md));
69
77
  max-block-size: calc(100% - var(--space-md));
70
- border: var(--ui-dialog-border);
78
+ border: var(--ui-dialog-border-width) var(--ui-dialog-border-style)
79
+ var(--ui-dialog-border-color);
71
80
  contain: layout style;
72
81
  opacity: var(--ui-dialog-opacity--start);
73
82
  box-shadow: var(--ui-dialog-shadow);
74
83
  overscroll-behavior: contain;
75
- overflow: auto;
84
+ overflow: hidden;
76
85
  transform: translate3d(var(--ui-dialog-translate--start)) scale(var(--ui-dialog-scale--start));
77
86
  transition:
78
87
  opacity var(--ui-dialog-transition-duration) var(--ui-dialog-transition-timing-function),
@@ -99,16 +108,17 @@
99
108
  }
100
109
  }
101
110
 
102
- /* Backdrop fades via a discrete transition */
111
+ /* Backdrop fades via a discrete transition. Twice the viewport tall: with the
112
+ software keyboard up, iOS shows the page below the rect fixed boxes fill, and a
113
+ fixed box past the viewport edge creates no scroll. */
103
114
  :where(dialog)::backdrop {
104
115
  position: fixed;
105
116
  inline-size: 100%;
106
117
  block-size: 100%;
107
118
  inset: 0;
108
- z-index: 1000;
109
119
  opacity: 0;
110
120
  overscroll-behavior: contain;
111
- overflow: auto;
121
+ overflow: clip;
112
122
  background-color: var(--ui-dialog-backdrop-color);
113
123
  backdrop-filter: var(--ui-dialog-backdrop-filter);
114
124
  transition: opacity var(--ui-dialog-backdrop-transition-duration)
@@ -140,6 +150,10 @@
140
150
  inherits: false;
141
151
  }
142
152
 
153
+ @property --_dialog-h-typed {
154
+ syntax: "*";
155
+ inherits: false;
156
+ }
143
157
  @property --_dialog-h {
144
158
  syntax: "*";
145
159
  inherits: false;
@@ -165,7 +179,14 @@
165
179
  --_w-len: var(--_w-resolved, var(--_dialog-w, var(--ui-dialog-w)));
166
180
  --_w-num: var(--_w-resolved, var(--_dialog-w, var(--ui-dialog-w)));
167
181
  inline-size: calc(var(--_w-len) + var(--_w-num) * var(--spacing));
168
- block-size: var(--_h-resolved, var(--_dialog-h, var(--ui-dialog-h)));
182
+ /* The typed pair can't carry the hook's keyword. sign() adds nothing to the sum:
183
+ its var() leaves --_dialog-h-typed unset without a --h, so the chain reaches the hook */
184
+ --_h-len: var(--_h-resolved);
185
+ --_h-num: var(--_h-resolved);
186
+ --_dialog-h-typed: calc(
187
+ var(--_h-len) + var(--_h-num) * var(--spacing) + 0px * sign(var(--_h-resolved))
188
+ );
189
+ block-size: var(--_dialog-h-typed, var(--_dialog-h, var(--ui-dialog-h)));
169
190
  background-color: var(--_bg-resolved, var(--ui-dialog-bg));
170
191
  color: var(--_text-resolved, var(--ui-dialog-text));
171
192
  box-shadow: var(--_shadow-resolved, var(--_dialog-shadow, var(--ui-dialog-shadow)));
@@ -174,12 +195,15 @@
174
195
  border-radius: calc(
175
196
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
176
197
  );
198
+ corner-shape: var(--_corner-shape-resolved, var(--ui-dialog-corner-shape));
177
199
 
178
200
  anchor-name: --ui-dialog-root;
179
201
  container-type: inline-size;
180
202
  container-name: dialog;
181
203
  font-size: var(--font-size-md);
182
204
  isolation: isolate;
205
+ overflow: auto;
206
+ overscroll-behavior: contain;
183
207
  }
184
208
 
185
209
  /* A one-row grid, so the content slot is capped by the dialog's height rather than
@@ -216,9 +240,8 @@
216
240
  grid-template-rows: auto minmax(0, 1fr) auto;
217
241
  position: relative;
218
242
  min-block-size: 0;
219
- /* a centred grid item sizes to its content; the cap is what hands the body its scroll */
220
243
  max-block-size: 100%;
221
- overflow: clip;
244
+ overscroll-behavior: contain;
222
245
  }
223
246
 
224
247
  :where([data-ui~="dialog"]) [data-dialog-slot~="header"] {
@@ -229,32 +252,46 @@
229
252
  padding-block-start: var(--space-sm);
230
253
  }
231
254
 
232
- :where([data-ui~="dialog"]) [data-dialog-slot~="header"]::after {
233
- content: "";
234
- display: block;
235
- position: absolute;
236
- inset-block-start: 100%;
237
- inline-size: 100%;
238
- block-size: var(--space-md);
239
- background: linear-gradient(to top, transparent, var(--ui-dialog-bg));
240
- }
241
-
242
255
  :where([data-ui~="dialog"]) [data-dialog-slot~="body"] {
256
+ --_scroll-fade-gradient: linear-gradient(
257
+ to bottom,
258
+ transparent 0,
259
+ #000 var(--_scroll-fade-start),
260
+ #000 calc(100% - var(--_scroll-fade-end)),
261
+ transparent 100%
262
+ );
263
+
243
264
  grid-row: 2;
244
265
  display: grid;
245
266
  padding-inline: var(--space-sm);
246
267
  padding-block: var(--space-md);
247
- min-block-size: 0;
248
- min-block-size: var(--space-xl);
249
- overflow-x: clip;
268
+ min-block-size: fit-content;
269
+ max-block-size: 100%;
270
+ overscroll-behavior: contain;
250
271
  overflow-y: auto;
251
- scrollbar-gutter: stable both-edges;
272
+
273
+ -webkit-mask-image: var(--ui-scroll-fade-mask, var(--_scroll-fade-gradient));
274
+ mask-image: var(--ui-scroll-fade-mask, var(--_scroll-fade-gradient));
275
+ -webkit-mask-composite: source-in;
276
+ mask-composite: intersect;
277
+ -webkit-mask-repeat: no-repeat;
278
+ mask-repeat: no-repeat;
279
+
280
+ @supports (animation-timeline: scroll()) {
281
+ animation:
282
+ ui-scroll-fade-reveal-start 1ms ease-in-out,
283
+ ui-scroll-fade-reveal-end 1ms ease-in-out;
284
+ }
285
+
286
+ @supports not (animation-timeline: scroll()) {
287
+ --_scroll-fade-start: var(--ui-scroll-fade-size);
288
+ --_scroll-fade-end: var(--ui-scroll-fade-size);
289
+ }
252
290
  }
253
291
 
254
292
  :where([data-ui~="dialog"]) [data-dialog-slot~="footer"] {
255
293
  grid-row: 3;
256
294
  block-size: fit-content;
257
- position: sticky;
258
295
  inset-block-end: 0;
259
296
  display: flex;
260
297
  justify-content: flex-end;
@@ -293,12 +330,12 @@
293
330
  }
294
331
 
295
332
  :where([data-ui~="dialog"][data-dialog-size="bleed"]) {
296
- --_dialog-w: 100vi;
297
- --_dialog-h: 100svh;
333
+ --_dialog-w: 100dvi;
334
+ --_dialog-h: 100dvb;
298
335
  --_dialog-radius: 0;
299
336
  --_dialog-shadow: none;
300
- max-inline-size: 100vi;
301
- max-block-size: 100svh;
337
+ max-inline-size: 100dvi;
338
+ max-block-size: 100dvb;
302
339
  }
303
340
 
304
341
  /* Below the sm band the viewport is a phone, and every dialog takes --ui-dialog-mobile-size
@@ -307,21 +344,51 @@
307
344
  for the site, or on one dialog's parent for that dialog alone. A viewport query, not a
308
345
  container one, because a top-layer dialog is sized by the viewport. Style queries are
309
346
  Firefox 151+; an older engine keeps the preset. */
310
- @media (width < 40rem) {
347
+ @media (width < 40rem) and (not (hover: hover)) {
311
348
  @container style(--ui-dialog-mobile-size: layout-bleed) {
349
+ /* Not :where(): the viewport decides the height here, over a consumer's own cap
350
+ on the same element (command's list max-block-size loads later at equal
351
+ specificity). Utilities still win through the layer order. */
352
+ [data-ui~="dialog"] [data-dialog-slot~="content"] {
353
+ place-content: start stretch;
354
+ block-size: 100%;
355
+ padding-block-end: env(safe-area-inset-bottom, 0px);
356
+ }
357
+
358
+ [data-ui~="dialog"] [data-dialog-slot~="body"] {
359
+ block-size: 100%;
360
+ max-block-size: 100%;
361
+ margin-block-end: auto;
362
+ }
363
+
312
364
  :where([data-ui~="dialog"]) {
313
- --_dialog-w: 100vi;
314
- --_dialog-h: 100svh;
365
+ --ui-dialog-border-color: transparent;
366
+
367
+ --_dialog-w: 100dvi;
368
+ --_dialog-h: 100dvb;
315
369
  --_dialog-radius: 0;
316
- --_dialog-shadow: none;
317
- max-inline-size: 100vi;
318
- max-block-size: 100svh;
370
+
371
+ margin: 0;
372
+ max-inline-size: 100dvi;
373
+ max-block-size: 100dvb;
374
+ overflow: scroll;
375
+ overscroll-behavior: contain;
376
+ container: none;
377
+ }
378
+
379
+ :where(dialog)::backdrop {
380
+ inline-size: 100dvi;
381
+ block-size: 100dvb;
382
+ inset: 0;
383
+ opacity: 0;
384
+ overscroll-behavior: contain;
385
+ overflow: clip;
319
386
  }
320
387
  }
321
388
 
322
389
  @container style(--ui-dialog-mobile-size: layout-full) {
323
390
  :where([data-ui~="dialog"]) {
324
- --_dialog-w: calc(100% - var(--gutters) * 2);
391
+ --_dialog-w: calc(100dvi - var(--gutters) * 2);
325
392
  }
326
393
  }
327
394
  }
@@ -8,13 +8,16 @@
8
8
  * @uses @starting-style + visibility allow-discrete: hint <-> error swap
9
9
  * @uses @supports (-webkit-touch-callout: none): iOS-only 16px field text,
10
10
  * so a focused control does not zoom the page
11
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
12
+ * rounded corners
11
13
  * @tokens --ui-field-*, --ui-field-group-* (Tier 3 owner; @layer variables)
12
14
  * @consumedby input.css, textarea.css, select.css, input-group.css,
13
- * password-group.css, otp.css, radio.css, checkbox.css,
15
+ * password-group.css, otp.css, radio.css, checkbox.css, switch.css,
14
16
  * autocomplete.css, combobox.css, command.css,
15
17
  * button.css (metrics: h/radius/px/icon/ring/border width+style; not font-size
16
18
  * or leading, so the iOS 16px rule below reaches text controls only),
17
- * toggle.css (via button.css), tabs.css (same metrics), badge.css (border/ring)
19
+ * toggle.css (via button.css), tabs.css (same metrics), badge.css (border/ring),
20
+ * menu.css (option gap)
18
21
  *
19
22
  * Identities: data-ui="field" (label + control + description wrapper),
20
23
  * data-ui="field-group" (fieldset; data-ui="radio-group" shares its rules).
@@ -44,6 +47,7 @@
44
47
  --ui-field-label-text: inherit;
45
48
  --ui-field-ring-color: var(--color-ring);
46
49
  --ui-field-radius: var(--radius-md);
50
+ --ui-field-corner-shape: var(--radius-corner-shape);
47
51
  --ui-field-inset-child-radius: var(--radius-sm);
48
52
  --ui-field-h: calc(var(--spacing) * 8);
49
53
  --ui-field-font-size: var(--font-size-sm);
@@ -71,6 +75,7 @@
71
75
  --ui-field-group-m: 0;
72
76
  --ui-field-group-gap: var(--space-xs);
73
77
  --ui-field-group-radius: var(--radius-lg);
78
+ --ui-field-group-corner-shape: var(--ui-field-corner-shape);
74
79
  }
75
80
 
76
81
  /* iOS zooms the page to any focused control that renders under 16px, so a
@@ -170,7 +175,7 @@
170
175
  }
171
176
 
172
177
  :where([data-ui~="field"]) [data-field-slot~="error"] {
173
- color: var(--color-destructive);
178
+ color: var(--color-destructive-foreground);
174
179
  opacity: 0;
175
180
  translate: var(--ui-field-hint-translate--start);
176
181
  visibility: hidden;
@@ -202,11 +207,11 @@
202
207
  }
203
208
 
204
209
  :where([data-ui~="field"]:has(:user-invalid)) [data-field-slot~="label"] {
205
- --ui-field-label-text: var(--color-destructive);
210
+ --ui-field-label-text: var(--color-destructive-foreground);
206
211
  }
207
212
 
208
213
  :where([data-ui~="field"]:has(:user-invalid)) ::placeholder {
209
- --placeholder-color: var(--color-destructive);
214
+ --placeholder-color: var(--color-destructive-foreground);
210
215
  }
211
216
 
212
217
  /* ---------------------------------------------------------------------------
@@ -231,6 +236,7 @@
231
236
  border-radius: calc(
232
237
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
233
238
  );
239
+ corner-shape: var(--_corner-shape-resolved, var(--ui-field-group-corner-shape));
234
240
  --_p-len: var(--_p-resolved, var(--ui-field-group-p));
235
241
  --_p-num: var(--_p-resolved, var(--ui-field-group-p));
236
242
  padding: calc(var(--_p-len) + var(--_p-num) * var(--spacing));
@@ -0,0 +1,18 @@
1
+ /**
2
+ * group.css: Group (ui-group | [data-ui~="group"]), the ancestor whose state
3
+ * its descendants' `--group-*` utilities follow (`--group-bg--hover`)
4
+ *
5
+ * @layer components
6
+ * @requires _layers.css
7
+ *
8
+ * The state selectors live in the generated tier setters. This file only gives
9
+ * the tag a display: the attribute form sits on a link, a button, a list item,
10
+ * and keeps what its host has. A custom element never matches `:disabled`, so
11
+ * `<ui-group>` takes `aria-disabled="true"` (with a role that allows it).
12
+ */
13
+
14
+ @layer ui.components {
15
+ :where(ui-group) {
16
+ display: block;
17
+ }
18
+ }
@@ -0,0 +1,26 @@
1
+ <ui-group
2
+ style="
3
+ --display: block;
4
+ --p: 4;
5
+ --border: 1;
6
+ --radius: 2;
7
+ "
8
+ >
9
+ <p
10
+ style="
11
+ --font-weight: strong;
12
+ --text: var(--color-foreground);
13
+ --group-text--hover: var(--color-primary);
14
+ "
15
+ >
16
+ Hover anywhere on this card
17
+ </p>
18
+ <p
19
+ style="
20
+ --opacity: 0.7;
21
+ --group-opacity--hover: 1;
22
+ "
23
+ >
24
+ The text follows the group's state, not its own.
25
+ </p>
26
+ </ui-group>
@@ -7,6 +7,9 @@
7
7
  * @uses mask — calendar icon (not background-image, for color: currentColor)
8
8
  * @uses @supports (-webkit-touch-callout: none) — iOS-only width fix for temporal
9
9
  * inputs (webkit.org/b/301648)
10
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
11
+ * rounded corners
12
+ * @uses --_touch-min (touch screens) — the field grows to the touch floor
10
13
  * @tokens --ui-input-* (@layer variables; surface colors and height read the
11
14
  * --ui-field-* family directly)
12
15
  */
@@ -23,11 +26,13 @@
23
26
  --ui-input-border-style: var(--ui-field-border-style);
24
27
  --ui-input-border-color: var(--ui-field-border-color);
25
28
  --ui-input-radius: var(--ui-field-radius);
29
+ --ui-input-corner-shape: var(--ui-field-corner-shape);
26
30
 
27
31
  --ui-input-calendar-picker-color: currentColor;
28
32
  --ui-input-calendar-picker-icon-size: calc(var(--spacing) * 4);
29
33
  --ui-input-calendar-picker-size: calc(var(--spacing) * 6);
30
34
  --ui-input-calendar-picker-radius: var(--ui-field-inset-child-radius);
35
+ --ui-input-calendar-picker-corner-shape: var(--ui-field-corner-shape);
31
36
  --ui-input-calendar-picker-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Crect width='256' height='256' fill='none'/%3E%3Crect x='40' y='40' width='176' height='176' rx='8' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='176' y1='24' x2='176' y2='56' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='80' y1='24' x2='80' y2='56' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cline x1='40' y1='88' x2='216' y2='88' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3C/svg%3E");
32
37
  }
33
38
  }
@@ -51,7 +56,7 @@
51
56
  min-inline-size: calc(var(--_min-w-len) + var(--_min-w-num) * var(--spacing));
52
57
  --_h-len: var(--_h-resolved, var(--ui-field-h));
53
58
  --_h-num: var(--_h-resolved, var(--ui-field-h));
54
- block-size: calc(var(--_h-len) + var(--_h-num) * var(--spacing));
59
+ block-size: max(calc(var(--_h-len) + var(--_h-num) * var(--spacing)), var(--_touch-min));
55
60
  --_pl-len: var(--_pl-resolved, var(--ui-input-pl));
56
61
  --_pl-num: var(--_pl-resolved, var(--ui-input-pl));
57
62
  padding-inline-start: calc(var(--_pl-len) + var(--_pl-num) * var(--spacing));
@@ -72,6 +77,7 @@
72
77
  border-radius: calc(
73
78
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
74
79
  );
80
+ corner-shape: var(--_corner-shape-resolved, var(--ui-input-corner-shape));
75
81
 
76
82
  /* The ring is published to --_focus-shadow so a --shadow utility keeps
77
83
  it; the transparent outline twin keeps focus visible in forced-colors */
@@ -147,6 +153,7 @@
147
153
  inline-size: var(--ui-input-calendar-picker-size);
148
154
  block-size: var(--ui-input-calendar-picker-size);
149
155
  border-radius: var(--ui-input-calendar-picker-radius);
156
+ corner-shape: var(--ui-input-calendar-picker-corner-shape);
150
157
 
151
158
  transition:
152
159
  opacity var(--default-transition-duration) var(--default-transition-timing-function),
@@ -175,13 +182,13 @@
175
182
  }
176
183
 
177
184
  :where([data-ui~="input"]):user-invalid {
178
- --ui-field-bg: color-mix(in oklch, var(--color-destructive) 5%, var(--color-input));
179
- --ui-field-bg--hover: color-mix(in oklch, var(--color-destructive) 10%, var(--color-input));
180
- --ui-field-border-color: var(--color-destructive);
181
- --ui-field-border-color--hover: var(--color-destructive);
182
- --ui-field-border-color--focus-within: var(--color-destructive);
183
- --ui-field-ring-color: var(--color-destructive);
184
-
185
- border-color: var(--color-destructive);
185
+ --ui-field-bg: var(--color-destructive);
186
+ --ui-field-bg--hover: oklch(from var(--color-destructive) calc(l - 0.025) c h);
187
+ --ui-field-border-color: var(--color-destructive-foreground);
188
+ --ui-field-border-color--hover: var(--color-destructive-foreground);
189
+ --ui-field-border-color--focus-within: var(--color-destructive-foreground);
190
+ --ui-field-ring-color: var(--color-destructive-foreground);
191
+
192
+ border-color: var(--color-destructive-foreground);
186
193
  }
187
194
  }