@sigx/zero-daisyui 0.2.0-beta.3 → 0.2.0-beta.5

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 (58) hide show
  1. package/README.md +8 -0
  2. package/dist/components.d.ts +3 -2
  3. package/dist/css/components/button.css +6 -0
  4. package/dist/css/components/tabs.css +191 -19
  5. package/dist/css/index.css +197 -19
  6. package/dist/lynx/components/alert.css +1 -1
  7. package/dist/lynx/components/avatar.css +22 -7
  8. package/dist/lynx/components/badge.css +1 -1
  9. package/dist/lynx/components/button.css +6 -1
  10. package/dist/lynx/components/checkbox.css +25 -10
  11. package/dist/lynx/components/combobox.css +2 -2
  12. package/dist/lynx/components/countdown.css +1 -1
  13. package/dist/lynx/components/dialog.css +3 -3
  14. package/dist/lynx/components/divider.css +18 -19
  15. package/dist/lynx/components/drawer.css +2 -2
  16. package/dist/lynx/components/file-upload.css +18 -7
  17. package/dist/lynx/components/indicator.css +1 -1
  18. package/dist/lynx/components/input.css +2 -2
  19. package/dist/lynx/components/join.css +1 -1
  20. package/dist/lynx/components/kbd.css +1 -1
  21. package/dist/lynx/components/menu.css +1 -1
  22. package/dist/lynx/components/native-select.css +1 -1
  23. package/dist/lynx/components/number-input.css +2 -2
  24. package/dist/lynx/components/pagination.css +92 -23
  25. package/dist/lynx/components/popover.css +2 -2
  26. package/dist/lynx/components/progress.css +17 -25
  27. package/dist/lynx/components/radial-progress.css +22 -24
  28. package/dist/lynx/components/radio-group.css +26 -11
  29. package/dist/lynx/components/rating-group.css +19 -23
  30. package/dist/lynx/components/select.css +2 -2
  31. package/dist/lynx/components/slider.css +3 -0
  32. package/dist/lynx/components/spinner.css +22 -19
  33. package/dist/lynx/components/status.css +27 -20
  34. package/dist/lynx/components/steps.css +67 -18
  35. package/dist/lynx/components/switch.css +79 -37
  36. package/dist/lynx/components/table.css +51 -8
  37. package/dist/lynx/components/tabs.css +383 -21
  38. package/dist/lynx/components/textarea.css +1 -1
  39. package/dist/lynx/components/timeline.css +27 -20
  40. package/dist/lynx/components/toggle-group.css +2 -2
  41. package/dist/lynx/components/toggle.css +1 -1
  42. package/dist/lynx/components/tooltip.css +1 -1
  43. package/dist/lynx/index.css +952 -321
  44. package/dist/lynx/manifest.json +33 -7
  45. package/dist/manifest.json +31 -5
  46. package/dist/recipes.d.ts +28 -0
  47. package/dist/recipes.d.ts.map +1 -1
  48. package/dist/recipes.js +522 -80
  49. package/dist/recipes.js.map +1 -1
  50. package/dist/register.d.ts +2 -3
  51. package/dist/report.json +401 -44
  52. package/dist/tokens.d.ts +17 -5
  53. package/dist/tokens.d.ts.map +1 -1
  54. package/dist/tokens.js +22 -8
  55. package/dist/tokens.js.map +1 -1
  56. package/package.json +4 -4
  57. package/src/recipes.ts +527 -81
  58. package/src/tokens.ts +24 -8
package/dist/recipes.js CHANGED
@@ -162,6 +162,34 @@ const withPresence = (presence, styles) => ({
162
162
  selectors: mergeKeyed(presence.selectors, styles.selectors),
163
163
  at: Object.fromEntries([...new Set([...Object.keys(presence.at ?? {}), ...Object.keys(styles.at ?? {})])].map((key) => [key, withPresence(presence.at?.[key] ?? {}, styles.at?.[key] ?? {})])),
164
164
  });
165
+ /**
166
+ * daisy's three tab flavors (#377): `tabs-border` — daisy's own default look,
167
+ * an underline under the active tab — plus `tabs-lift` (bordered tab lifting
168
+ * out of a baseline) and `tabs-box` (list on a base-200 surface, active tab a
169
+ * raised base-100 pill). All three ported from daisyUI 5.5.19
170
+ * `components/tab.css`.
171
+ *
172
+ * The base holds only flavor-neutral structure. Every flavor's chrome —
173
+ * including the box surface this recipe used to keep in `parts` — lives in
174
+ * its own `variant` entry, because the web emitter twins the DEFAULT value's
175
+ * rules as `:not([data-variant])`: a default that leaned on base styles would
176
+ * leak them into the other two flavors, and the box chrome in base is exactly
177
+ * what `variant="border"` must not inherit.
178
+ *
179
+ * Sizing goes through a `--tab-py`/`--tab-px` pair rather than a literal
180
+ * `padding` per size — daisy's own mechanism (`--tab-p`/`--tab-paddings` in
181
+ * tab.css). It is what lets `lift` move `var(--border)` between border and
182
+ * padding without restating the size ramp per flavor: axis rules all target
183
+ * the same part with equal specificity, so a `lift` padding literal would
184
+ * either lose to or beat the size axis by source order alone.
185
+ *
186
+ * variant × color: `color` paints the active tab's INK (`roleInk`, not the
187
+ * raw role — #210: raw roles are fill colours with no contrast floor as ink).
188
+ * `border`'s underline and `lift`'s label follow it via `currentColor`;
189
+ * `box` is the one flavor where daisy fills the active pill with the role
190
+ * (`checked:bg-primary checked:text-primary-content` in its docs), so a
191
+ * compound per role restores the fill+`-content` pair there.
192
+ */
165
193
  export const tabs = {
166
194
  component: 'tabs',
167
195
  parts: {
@@ -172,10 +200,6 @@ export const tabs = {
172
200
  base: {
173
201
  display: 'inline-flex',
174
202
  alignSelf: 'flex-start',
175
- padding: 'var(--space-xs)',
176
- gap: 'var(--space-xs)',
177
- background: 'var(--color-base-200)',
178
- borderRadius: 'var(--radius-field)',
179
203
  },
180
204
  },
181
205
  tab: {
@@ -183,21 +207,31 @@ export const tabs = {
183
207
  appearance: 'none',
184
208
  border: 'none',
185
209
  background: 'transparent',
186
- padding: 'var(--space-sm) var(--space-xl)',
210
+ '--tab-py': 'var(--space-sm)',
211
+ '--tab-px': 'var(--space-xl)',
212
+ // daisy's per-size underline/corner cap: `--tab-radius-min`
213
+ // in tab.css, `calc(.75rem - var(--border))` at md. Declared
214
+ // here (not in `lift`, its only reader) so the size axis can
215
+ // override it — a definition inside the variant entry would
216
+ // beat the size rules on source order.
217
+ '--tab-radius-min': 'calc(0.75rem - var(--border))',
218
+ padding: 'var(--tab-py) var(--tab-px)',
187
219
  fontSize: 'var(--text-sm)',
188
220
  fontWeight: 'var(--weight-semibold)',
189
221
  color: 'color-mix(in oklab, var(--color-base-content) 60%, transparent)',
190
- borderRadius: 'calc(var(--radius-field) - 0.25rem)',
191
222
  cursor: 'pointer',
223
+ // For the flavors' ::before marks (border's underline, lift's
224
+ // corner shoulders) — daisy's base `.tab` is `position:
225
+ // relative` for the same reason.
226
+ position: 'relative',
192
227
  transition: 'background var(--duration-normal) var(--ease-standard), color var(--duration-normal) var(--ease-standard)',
193
228
  },
194
229
  states: {
195
230
  hover: { color: 'var(--color-base-content)' },
196
- active: {
197
- background: 'var(--color-base-100)',
198
- color: 'var(--color-base-content)',
199
- boxShadow: 'var(--shadow-sm)',
200
- },
231
+ // Full-strength ink is the one active mark all three flavors
232
+ // share; each flavor's own chrome (underline, lift, pill)
233
+ // lives in its `variant` entry.
234
+ active: { color: 'var(--color-base-content)' },
201
235
  inactive: {},
202
236
  disabled: { opacity: 'var(--disabled-opacity)', cursor: 'not-allowed' },
203
237
  ...focusRing,
@@ -210,38 +244,240 @@ export const tabs = {
210
244
  },
211
245
  variants: {
212
246
  size: {
213
- xs: { tab: { base: { fontSize: 'var(--text-xs)', padding: 'var(--space-2xs) var(--space-md)' } } },
214
- sm: { tab: { base: { fontSize: 'var(--text-xs)', padding: 'var(--space-xs) var(--space-lg)' } } },
247
+ xs: { tab: { base: { fontSize: 'var(--text-xs)', '--tab-py': 'var(--space-2xs)', '--tab-px': 'var(--space-md)', '--tab-radius-min': 'calc(0.5rem - var(--border))' } } },
248
+ sm: { tab: { base: { fontSize: 'var(--text-xs)', '--tab-py': 'var(--space-xs)', '--tab-px': 'var(--space-lg)', '--tab-radius-min': 'calc(0.5rem - var(--border))' } } },
215
249
  // `md` is the un-attributed render: the base already IS the
216
250
  // middle step, so restating it here would be a second copy free
217
251
  // to drift. An empty entry emits no rule and keeps the base.
218
252
  md: {},
219
- lg: { tab: { base: { fontSize: 'var(--text-md)', padding: 'var(--space-md) var(--space-2xl)' } } },
220
- xl: { tab: { base: { fontSize: 'var(--text-lg)', padding: 'var(--space-lg) var(--space-2xl)' } } },
253
+ lg: { tab: { base: { fontSize: 'var(--text-md)', '--tab-py': 'var(--space-md)', '--tab-px': 'var(--space-2xl)', '--tab-radius-min': 'calc(1.5rem - var(--border))' } } },
254
+ xl: { tab: { base: { fontSize: 'var(--text-lg)', '--tab-py': 'var(--space-lg)', '--tab-px': 'var(--space-2xl)', '--tab-radius-min': 'calc(2rem - var(--border))' } } },
221
255
  },
222
256
  // Every role, not just primary. `data-color` passes through whatever a
223
257
  // consumer sets, so a one-role axis made `<Tabs.Root color="success">`
224
258
  // type-check, emit the attribute, and match nothing — the tab just
225
259
  // stayed primary with no diagnostic anywhere.
260
+ //
261
+ // The role lands as the active tab's INK — `border`'s underline and
262
+ // everything drawn `currentColor` follow it for free. `box` refines
263
+ // this per role through `compoundVariants` below (fill + `-content`).
226
264
  color: Object.fromEntries(ROLES.map((c) => [
227
265
  c,
228
266
  {
229
267
  tab: {
268
+ states: {
269
+ active: { color: roleInk(c) },
270
+ },
271
+ },
272
+ },
273
+ ])),
274
+ variant: {
275
+ // daisy `.tabs-border`: an always-present ::before bar under each
276
+ // tab — transparent at rest (daisy reaches transparent through an
277
+ // invalid-at-computed-value-time 4-value custom property; the
278
+ // rendered result is the same), currentColor + a 3px top border
279
+ // when active. The border is daisy's forced-colors survival for a
280
+ // background-painted mark, kept verbatim so the bar's geometry
281
+ // matches daisy's exactly.
282
+ border: {
283
+ tab: {
284
+ base: { borderRadius: 'var(--radius-field)' },
285
+ selectors: {
286
+ '&::before': {
287
+ content: '""',
288
+ position: 'absolute',
289
+ bottom: '0',
290
+ insetInlineStart: '10%',
291
+ width: '80%',
292
+ // daisy renders under Tailwind preflight, whose
293
+ // `*,::before,::after { box-sizing: border-box }`
294
+ // makes the active `border-top: 3px` swallow the
295
+ // 3px height rather than stack on it. zero ships
296
+ // no such reset, so the bar carries the one
297
+ // declaration itself — without it the active
298
+ // underline doubles to 6px (review catch).
299
+ boxSizing: 'border-box',
300
+ height: '3px',
301
+ borderRadius: 'var(--radius-field)',
302
+ backgroundColor: 'transparent',
303
+ transition: 'background-color var(--duration-normal) var(--ease-standard)',
304
+ },
305
+ '&[data-state="active"]:not([data-disabled])::before': {
306
+ backgroundColor: 'currentColor',
307
+ borderTop: '3px solid',
308
+ },
309
+ },
310
+ },
311
+ },
312
+ // daisy `.tabs-lift`: every tab sits on a base-300 baseline; the
313
+ // active one swaps that bottom hairline for top/side borders, a
314
+ // base-100 fill, rounded top corners, and the radial-gradient
315
+ // "shoulders" that curve its bottom corners outward into the
316
+ // baseline. Widths and paddings trade `var(--border)` exactly as
317
+ // daisy's `--tab-border`/`--tab-paddings` do, so activating a tab
318
+ // never changes its box size.
319
+ lift: {
320
+ tab: {
321
+ base: {
322
+ '--tab-radius-limit': 'min(var(--radius-field), var(--tab-radius-min))',
323
+ borderStartStartRadius: 'var(--tab-radius-limit)',
324
+ borderStartEndRadius: 'var(--tab-radius-limit)',
325
+ borderWidth: '0 0 var(--border) 0',
326
+ borderStyle: 'solid',
327
+ borderColor: 'var(--color-base-300)',
328
+ padding: 'calc(var(--tab-py) + var(--border)) var(--tab-px) var(--tab-py)',
329
+ },
230
330
  states: {
231
331
  active: {
232
- background: `var(--color-${c})`,
233
- color: `var(--color-${c}-content)`,
332
+ background: 'var(--color-base-100)',
333
+ borderWidth: 'var(--border) var(--border) 0 var(--border)',
334
+ padding: 'var(--tab-py) calc(var(--tab-px) - var(--border)) calc(var(--tab-py) + var(--border))',
335
+ },
336
+ },
337
+ selectors: {
338
+ '&[data-state="active"]::before': {
339
+ // daisy's `--tab-radius-grad` stop list:
340
+ // transparent inside the corner arc, a base-300
341
+ // ring of the border's width, base-100 outside.
342
+ // Declared here rather than on the tab: every
343
+ // shoulder rule below styles this same
344
+ // pseudo-element, so they all read it — and on
345
+ // lynx it drops with the ::before selector
346
+ // instead of surviving as a dead declaration.
347
+ '--tab-grad': '#0000 calc(69% - var(--border)), var(--color-base-300) calc(69% - var(--border) + 0.25px), var(--color-base-300) 69%, var(--color-base-100) calc(69% + 0.25px)',
348
+ content: '""',
349
+ position: 'absolute',
350
+ zIndex: '1',
351
+ bottom: '0',
352
+ // daisy centres the shoulders through the flex
353
+ // static position; an explicit symmetric overhang
354
+ // of one corner radius per side is the same
355
+ // geometry without needing the tab to be a flex
356
+ // container.
357
+ insetInlineStart: 'calc(var(--tab-radius-limit) * -1)',
358
+ width: 'calc(100% + var(--tab-radius-limit) * 2)',
359
+ height: 'var(--tab-radius-limit)',
360
+ backgroundImage: 'radial-gradient(circle at top left, var(--tab-grad)), radial-gradient(circle at top right, var(--tab-grad))',
361
+ backgroundPosition: 'top left, top right',
362
+ backgroundSize: 'var(--tab-radius-limit) var(--tab-radius-limit)',
363
+ backgroundRepeat: 'no-repeat',
364
+ },
365
+ // No shoulder past the row's edges — daisy's
366
+ // `--radius-start: none` / `--radius-end: none` on
367
+ // first/last, both suppressed for an only tab.
368
+ '&[data-state="active"]:first-child::before': {
369
+ backgroundImage: 'none, radial-gradient(circle at top right, var(--tab-grad))',
370
+ },
371
+ '&[data-state="active"]:last-child::before': {
372
+ backgroundImage: 'radial-gradient(circle at top left, var(--tab-grad)), none',
373
+ },
374
+ '&[data-state="active"]:only-child::before': {
375
+ backgroundImage: 'none',
376
+ },
377
+ // The gradients' corners are physical; when one side
378
+ // is suppressed the image is asymmetric, so RTL needs
379
+ // daisy's mirror on exactly the first/last tabs.
380
+ [`&[data-state="active"]:first-child${rtl}::before`]: {
381
+ transform: 'rotateY(180deg)',
382
+ },
383
+ [`&[data-state="active"]:last-child${rtl}::before`]: {
384
+ transform: 'rotateY(180deg)',
234
385
  },
235
386
  },
236
387
  },
237
388
  },
238
- ])),
389
+ // daisy `.tabs-box`: the styles this recipe shipped as its only
390
+ // look, moved verbatim out of `parts` — list on a padded base-200
391
+ // surface, active tab a raised base-100 pill.
392
+ box: {
393
+ list: {
394
+ base: {
395
+ padding: 'var(--space-xs)',
396
+ gap: 'var(--space-xs)',
397
+ background: 'var(--color-base-200)',
398
+ borderRadius: 'var(--radius-field)',
399
+ },
400
+ },
401
+ tab: {
402
+ base: { borderRadius: 'calc(var(--radius-field) - 0.25rem)' },
403
+ states: {
404
+ active: {
405
+ background: 'var(--color-base-100)',
406
+ boxShadow: 'var(--shadow-sm)',
407
+ },
408
+ },
409
+ },
410
+ },
411
+ },
412
+ },
413
+ // box × color: daisy's box flavor fills the active pill with the role and
414
+ // flips the label to `-content` — the fill+pair form is contrast-safe by
415
+ // construction, so the raw role is right here (unlike the ink the single-
416
+ // axis rule paints). Emitted after the single-axis rules, so it wins the
417
+ // `color` tie on source order.
418
+ compoundVariants: ROLES.map((c) => ({
419
+ match: { variant: 'box', color: c },
420
+ parts: {
421
+ tab: {
422
+ states: {
423
+ active: {
424
+ background: `var(--color-${c})`,
425
+ color: `var(--color-${c}-content)`,
426
+ },
427
+ },
428
+ },
429
+ },
430
+ })),
431
+ // `md: {}` emits nothing — it states the size default for the manifest
432
+ // (signalxjs/lynx#1070). `border` is daisy's own default tab look, and a
433
+ // DELIBERATE web visual change (#377): the un-attributed render used to
434
+ // be the box pill. Deliberately no `color` default: the un-attributed
435
+ // active ink is base-content, outside the color vocabulary.
436
+ defaultVariants: { size: 'md', variant: 'border' },
437
+ targets: {
438
+ lynx: {
439
+ parts: {
440
+ // The default active ink — base-content, exactly what the
441
+ // shared `states.active.color` paints. One class, so any
442
+ // color-axis definition below (host + two classes, baked per
443
+ // theme) wins on specificity.
444
+ tab: { base: { '--tab-active-ink': 'var(--color-base-content)' } },
445
+ },
446
+ variants: {
447
+ // `currentColor` never resolves on lynx (measured on device
448
+ // on both platforms, signalxjs/lynx#1079 — the underline was
449
+ // transparent everywhere), so the color axis restates its
450
+ // active ink as a plain custom property. `roleInk` reads
451
+ // theme colors through color-mix(), which the emitter bakes
452
+ // once per theme — the same per-color/per-theme literal the
453
+ // active `color:` rules already land as.
454
+ color: Object.fromEntries(ROLES.map((c) => [c, { tab: { base: { '--tab-active-ink': roleInk(c) } } }])),
455
+ variant: {
456
+ // The underline is a ::before on the web, which lynx
457
+ // drops — redrawn as a real bottom border on the tab
458
+ // itself (transparent at rest so activation never moves
459
+ // the row). The active ink rides `--tab-active-ink`
460
+ // above — a plain var() chain, device-proven — instead
461
+ // of `currentColor`, which lynx never resolves.
462
+ border: {
463
+ tab: {
464
+ base: { borderBottom: '3px solid transparent' },
465
+ states: { active: { borderBottomColor: 'var(--tab-active-ink)' } },
466
+ },
467
+ },
468
+ // `min()` does not exist on lynx (signalxjs/lynx#1066) and
469
+ // the shared `--tab-radius-limit` would drop, leaving its
470
+ // readers dangling — the uncapped field radius is the
471
+ // closest expressible value.
472
+ lift: {
473
+ tab: {
474
+ base: { '--tab-radius-limit': 'var(--radius-field)' },
475
+ },
476
+ },
477
+ },
478
+ },
479
+ },
239
480
  },
240
- // Size only: `md: {}` emits nothing, so this changes no CSS — it states
241
- // the default for the manifest (signalxjs/lynx#1070). Deliberately no
242
- // `color` default: the un-attributed active tab is a neutral base-100
243
- // pill, which is outside the color vocabulary.
244
- defaultVariants: { size: 'md' },
245
481
  };
246
482
  /**
247
483
  * The disclosure size ramp collapsible and accordion share (#321): the same
@@ -377,46 +613,21 @@ export const switchRecipe = {
377
613
  },
378
614
  },
379
615
  control: {
380
- base: {
381
- // The knob slides because the grid's leading column GROWS:
382
- // `0fr 1fr 1fr` → `1fr 1fr 0fr`, with the knob parked in
383
- // column 2. That is daisy's own mechanism, and unlike a
384
- // `translateX` it is RTL-correct for free.
385
- display: 'inline-grid',
386
- gridTemplateColumns: '0fr 1fr 1fr',
387
- placeContent: 'center',
388
- position: 'relative',
389
- verticalAlign: 'middle',
390
- flexShrink: '0',
391
- boxSizing: 'border-box',
392
- width: 'calc((var(--switch-size) * 2) - (var(--border) + var(--switch-p)) * 2)',
393
- height: 'var(--switch-size)',
394
- padding: 'var(--switch-p)',
395
- // daisy's radius formula: the selector radius GROWN by the
396
- // padding and the border so the knob's own corner and the
397
- // track's stay concentric, each clamped at 3× the token so a
398
- // square-cornered theme (cyberpunk, wireframe) stays square.
399
- '--switch-radius-max': 'calc(var(--radius-selector) + var(--radius-selector) + var(--radius-selector))',
400
- borderRadius: 'calc(var(--radius-selector) + min(var(--switch-p), var(--switch-radius-max)) + min(var(--border), var(--switch-radius-max)))',
401
- border: 'var(--border) solid currentColor',
402
- color: 'var(--switch-ink)',
403
- boxShadow: '0 1px color-mix(in oklab, currentColor calc(var(--depth) * 10%), #0000) inset',
404
- userSelect: 'none',
405
- transition: 'color var(--duration-slow) var(--ease-standard), '
406
- + 'background-color var(--duration-normal) var(--ease-standard), '
407
- + 'grid-template-columns var(--duration-normal) var(--ease-standard)',
408
- },
616
+ // The track's whole box lives in `targets`: the web mechanism is
617
+ // an inline-grid whose leading column grows, spelled with grid
618
+ // and `min()` — both measured unresolvable by lynx's engine
619
+ // (signalxjs/lynx#1066), so the lynx section lays the same
620
+ // geometry out with flex + calc() instead. Whole blocks move
621
+ // (not single declarations) so the merged web view keeps its
622
+ // declaration order and the web goldens stay byte-identical.
409
623
  states: {
410
624
  // daisy's checked toggle empties its track to base-100 and paints
411
625
  // the KNOB with the accent — so the checked knob's contrast is
412
626
  // accent-on-base-100, not accent-content-on-accent. Same
413
627
  // trade-off as the checkbox's unchecked outline: 1.11:1 at worst
414
628
  // (sunset/`neutral`), 7.68 at best, daisy's own numbers.
415
- checked: {
416
- gridTemplateColumns: '1fr 1fr 0fr',
417
- color: 'var(--switch-accent)',
418
- backgroundColor: 'var(--color-base-100)',
419
- },
629
+ // Both targets restate the paint in their own spelling below.
630
+ checked: {},
420
631
  unchecked: {},
421
632
  // `invalid` is semantic: it stays error under every colour
422
633
  // variant. Stated as a longhand because the track's border is
@@ -428,24 +639,9 @@ export const switchRecipe = {
428
639
  },
429
640
  },
430
641
  thumb: {
431
- base: {
432
- // daisy's `.toggle:before`: a square knob that fills its grid
433
- // cell and takes the UNGROWN selector radius, so it is a
434
- // rounded square in daisy's rounded-square themes and a circle
435
- // only where the theme says so.
436
- gridRowStart: '1',
437
- gridColumnStart: '2',
438
- aspectRatio: '1',
439
- width: '100%',
440
- height: '100%',
441
- borderRadius: 'var(--radius-selector)',
442
- backgroundColor: 'currentColor',
443
- backgroundSize: 'auto, calc(var(--noise) * 100%)',
444
- backgroundImage: 'none, var(--fx-noise)',
445
- boxShadow: '0 -1px var(--depth-shade) inset, 0 8px 0 -4px var(--depth-sheen) inset, '
446
- + '0 1px color-mix(in oklab, currentColor calc(var(--depth) * 10%), #0000)',
447
- transition: 'background-color var(--duration-instant) var(--ease-standard)',
448
- },
642
+ // Like `control`, the knob's box is per-target: the web knob fills
643
+ // its grid cell, the lynx knob is an explicit calc() square that
644
+ // `translateX`es — see `targets` below.
449
645
  states: {
450
646
  checked: {},
451
647
  unchecked: {},
@@ -475,6 +671,146 @@ export const switchRecipe = {
475
671
  // control and its text. Declared rather than left implicit so the
476
672
  // delegation reads as a decision.
477
673
  skipStates: { root: ['focus-visible'] },
674
+ // ONE design decision, two spellings. The web track is daisy's own
675
+ // mechanism — an inline-grid whose leading column grows (`0fr 1fr 1fr` →
676
+ // `1fr 1fr 0fr`) with a min()-clamped radius — and lynx's engine resolves
677
+ // neither grid nor the comparison functions (measured on device,
678
+ // signalxjs/lynx#1066; the emitter refuses min()/max()/clamp() on that
679
+ // evidence). So the whole box moves here per target: the web section is
680
+ // the original spelling verbatim, the lynx section rebuilds the same
681
+ // geometry with flex + calc() and slides the knob with `translateX`.
682
+ targets: {
683
+ web: {
684
+ parts: {
685
+ control: {
686
+ base: {
687
+ // The knob slides because the grid's leading column GROWS:
688
+ // `0fr 1fr 1fr` → `1fr 1fr 0fr`, with the knob parked in
689
+ // column 2. That is daisy's own mechanism, and unlike a
690
+ // `translateX` it is RTL-correct for free.
691
+ display: 'inline-grid',
692
+ gridTemplateColumns: '0fr 1fr 1fr',
693
+ placeContent: 'center',
694
+ position: 'relative',
695
+ verticalAlign: 'middle',
696
+ flexShrink: '0',
697
+ boxSizing: 'border-box',
698
+ width: 'calc((var(--switch-size) * 2) - (var(--border) + var(--switch-p)) * 2)',
699
+ height: 'var(--switch-size)',
700
+ padding: 'var(--switch-p)',
701
+ // daisy's radius formula: the selector radius GROWN by the
702
+ // padding and the border so the knob's own corner and the
703
+ // track's stay concentric, each clamped at 3× the token so a
704
+ // square-cornered theme (cyberpunk, wireframe) stays square.
705
+ '--switch-radius-max': 'calc(var(--radius-selector) + var(--radius-selector) + var(--radius-selector))',
706
+ borderRadius: 'calc(var(--radius-selector) + min(var(--switch-p), var(--switch-radius-max)) + min(var(--border), var(--switch-radius-max)))',
707
+ border: 'var(--border) solid currentColor',
708
+ color: 'var(--switch-ink)',
709
+ boxShadow: '0 1px color-mix(in oklab, currentColor calc(var(--depth) * 10%), #0000) inset',
710
+ userSelect: 'none',
711
+ transition: 'color var(--duration-slow) var(--ease-standard), '
712
+ + 'background-color var(--duration-normal) var(--ease-standard), '
713
+ + 'grid-template-columns var(--duration-normal) var(--ease-standard)',
714
+ },
715
+ states: {
716
+ checked: {
717
+ gridTemplateColumns: '1fr 1fr 0fr',
718
+ color: 'var(--switch-accent)',
719
+ backgroundColor: 'var(--color-base-100)',
720
+ },
721
+ },
722
+ },
723
+ thumb: {
724
+ base: {
725
+ // daisy's `.toggle:before`: a square knob that fills its grid
726
+ // cell and takes the UNGROWN selector radius, so it is a
727
+ // rounded square in daisy's rounded-square themes and a circle
728
+ // only where the theme says so.
729
+ gridRowStart: '1',
730
+ gridColumnStart: '2',
731
+ aspectRatio: '1',
732
+ width: '100%',
733
+ height: '100%',
734
+ borderRadius: 'var(--radius-selector)',
735
+ backgroundColor: 'currentColor',
736
+ backgroundSize: 'auto, calc(var(--noise) * 100%)',
737
+ backgroundImage: 'none, var(--fx-noise)',
738
+ boxShadow: '0 -1px var(--depth-shade) inset, 0 8px 0 -4px var(--depth-sheen) inset, '
739
+ + '0 1px color-mix(in oklab, currentColor calc(var(--depth) * 10%), #0000)',
740
+ transition: 'background-color var(--duration-instant) var(--ease-standard)',
741
+ },
742
+ },
743
+ },
744
+ },
745
+ lynx: {
746
+ parts: {
747
+ root: {
748
+ // `inline-flex` has no lynx projection; restated as plain
749
+ // flex with the direction explicit (lynx does not default
750
+ // it the way a browser does).
751
+ base: { display: 'flex', flexDirection: 'row', alignItems: 'center' },
752
+ },
753
+ control: {
754
+ base: {
755
+ display: 'flex',
756
+ alignItems: 'center',
757
+ flexShrink: '0',
758
+ boxSizing: 'border-box',
759
+ // Same geometry as the web track: daisy's derived
760
+ // width, ONE `--switch-size` driving everything.
761
+ width: 'calc((var(--switch-size) * 2) - (var(--border) + var(--switch-p)) * 2)',
762
+ height: 'var(--switch-size)',
763
+ padding: 'var(--switch-p)',
764
+ // The radius formula minus its min() clamps: exact for
765
+ // every shipped theme (the clamp only bites when the
766
+ // padding or border exceeds 3× the selector radius,
767
+ // i.e. near-square themes this package does not ship).
768
+ borderRadius: 'calc(var(--radius-selector) + var(--switch-p) + var(--border))',
769
+ // No currentColor on this target — the ink is named
770
+ // directly, and `checked` moves border + fill below.
771
+ border: 'var(--border) solid var(--switch-ink)',
772
+ userSelect: 'none',
773
+ transition: 'border-color var(--duration-slow) var(--ease-standard), '
774
+ + 'background-color var(--duration-normal) var(--ease-standard)',
775
+ },
776
+ states: {
777
+ checked: {
778
+ borderColor: 'var(--switch-accent)',
779
+ backgroundColor: 'var(--color-base-100)',
780
+ },
781
+ },
782
+ },
783
+ thumb: {
784
+ base: {
785
+ // The web knob fills its square grid cell; here the
786
+ // same square is explicit: track height minus border
787
+ // and padding on both sides.
788
+ width: 'calc(var(--switch-size) - (var(--border) + var(--switch-p)) * 2)',
789
+ height: 'calc(var(--switch-size) - (var(--border) + var(--switch-p)) * 2)',
790
+ borderRadius: 'var(--radius-selector)',
791
+ backgroundColor: 'var(--switch-ink)',
792
+ transition: 'transform var(--duration-normal) var(--ease-standard), '
793
+ + 'background-color var(--duration-instant) var(--ease-standard)',
794
+ },
795
+ states: {
796
+ // The knob's travel is exactly one knob-width: the
797
+ // content box is two knobs wide, and the knob starts
798
+ // at the near end. `translateX` is measured working
799
+ // on lynx. The axis is PHYSICAL where the web's
800
+ // growing grid column was logical — an RTL layout
801
+ // would need a direction-aware multiplier, but the
802
+ // lynx grammar carries no direction hook yet and the
803
+ // runtime does not stamp one; revisit with the RTL
804
+ // plumbing rather than guessing at it here.
805
+ checked: {
806
+ backgroundColor: 'var(--switch-accent)',
807
+ transform: 'translateX(calc(var(--switch-size) - (var(--border) + var(--switch-p)) * 2))',
808
+ },
809
+ },
810
+ },
811
+ },
812
+ },
813
+ },
478
814
  };
479
815
  // --------------------------------------------------------------------------
480
816
  // 2. checkbox — the three clip-paths, the fallback helper, then the recipe
@@ -1106,6 +1442,29 @@ export const checkbox = {
1106
1442
  // control and its text. Declared rather than left implicit so the
1107
1443
  // delegation reads as a decision.
1108
1444
  skipStates: { root: ['focus-visible'] },
1445
+ // `currentColor` never resolves on lynx (measured on device on both
1446
+ // platforms, signalxjs/lynx#1079), so the tick shipped invisible and the
1447
+ // ring's color-mix-over-currentColor fallback dropped the whole border.
1448
+ // Both restated with the named accents the web spellings resolve to —
1449
+ // plain var() chains, the switch's device-proven #380 mechanism.
1450
+ targets: {
1451
+ lynx: {
1452
+ parts: {
1453
+ control: {
1454
+ // The web fallback (`color-mix(in oklab, … currentColor …)`)
1455
+ // exists for consumers that unset the accent; this package
1456
+ // always defines it, so the plain accent IS the ring.
1457
+ base: { border: 'var(--border) solid var(--checkbox-accent)' },
1458
+ },
1459
+ indicator: {
1460
+ // The tick's fill: the control's `color:` names
1461
+ // `--checkbox-on-accent`, and `currentColor` was that
1462
+ // ink by inheritance — spend it directly.
1463
+ base: { backgroundColor: 'var(--checkbox-on-accent)' },
1464
+ },
1465
+ },
1466
+ },
1467
+ },
1109
1468
  };
1110
1469
  // --------------------------------------------------------------------------
1111
1470
  // 3. radioGroup — replace the whole export
@@ -1221,6 +1580,25 @@ export const radioGroup = {
1221
1580
  // wraps it. Declared rather than left implicit so the delegation reads
1222
1581
  // as a decision.
1223
1582
  skipStates: { item: ['focus-visible'] },
1583
+ // `currentColor` never resolves on lynx (measured on device on both
1584
+ // platforms, signalxjs/lynx#1079), so the checked ring and dot shipped
1585
+ // invisible, and the unchecked ring's color-mix-over-currentColor
1586
+ // fallback dropped the whole border. All three restated with the accent
1587
+ // the control's own `color:` names — plain var() chains, the switch's
1588
+ // device-proven #380 mechanism.
1589
+ targets: {
1590
+ lynx: {
1591
+ parts: {
1592
+ 'item-control': {
1593
+ base: { border: 'var(--border) solid var(--radio-accent)' },
1594
+ states: { checked: { borderColor: 'var(--radio-accent)' } },
1595
+ },
1596
+ 'item-indicator': {
1597
+ states: { checked: { backgroundColor: 'var(--radio-accent)' } },
1598
+ },
1599
+ },
1600
+ },
1601
+ },
1224
1602
  };
1225
1603
  // --------------------------------------------------------------------------
1226
1604
  // 4. progress — replace the whole export (only the two radius lines move)
@@ -1439,6 +1817,50 @@ export const slider = {
1439
1817
  // declared for the manifest (signalxjs/lynx#1070).
1440
1818
  defaultVariants: { color: 'primary', size: 'md' },
1441
1819
  skipStates: { root: ['invalid', 'focus-visible'] },
1820
+ // ONE design decision, two paints. On the web the accent reaches the
1821
+ // screen twice: the native control is UA-drawn behind `accent-color`, and
1822
+ // the composed range/thumb deepen the accent with `color-mix()`. Lynx
1823
+ // renders neither spelling — `accent-color` styles a native
1824
+ // `<input type=range>` lynx does not have, and the emitter drops
1825
+ // `color-mix()` as unresolvable — so the compiled range and thumb shipped
1826
+ // with no paint at all: grey track, invisible fill, invisible knob
1827
+ // (measured on device, signalxjs/lynx#1075). The geometry all survives
1828
+ // (the sizes are direct calc(), proven working); paint is the only gap,
1829
+ // so this section only restates paint, in lynx-expressible spellings.
1830
+ targets: {
1831
+ lynx: {
1832
+ parts: {
1833
+ range: {
1834
+ // The web fill deepens the accent 90/10 toward
1835
+ // base-content (`progressFill`'s recipe); the plain
1836
+ // accent — a var() chain, proven working on device — is
1837
+ // the closest lynx-expressible equivalent.
1838
+ base: { background: 'var(--slider-accent)' },
1839
+ },
1840
+ thumb: {
1841
+ // daisy's real range thumb, ported from daisyUI 5
1842
+ // `range.css` `::-webkit-slider-thumb`. The source reads
1843
+ // `background-color: var(--range-thumb)` +
1844
+ // `border: var(--range-p) solid` in the range's
1845
+ // currentColor; here each resolves to its value —
1846
+ // `--range-thumb` defaults to `var(--color-base-100)`,
1847
+ // `--range-p` is daisy's literal `.25rem` (deliberately
1848
+ // not the theme's size token), and the border ink is the
1849
+ // accent (currentColor on a daisy `.range-*` IS the
1850
+ // accent role) — because on lynx a named value is a
1851
+ // var-chain fewer to resolve. daisy paints the progress
1852
+ // fill itself as a 100cqw box-shadow thrown off this
1853
+ // thumb — a native-input trick with no lynx equivalent;
1854
+ // the composed `.zx-slider__range` box above IS that
1855
+ // fill here, so the knob only needs its own two paints.
1856
+ base: {
1857
+ background: 'var(--color-base-100)',
1858
+ border: '0.25rem solid var(--slider-accent)',
1859
+ },
1860
+ },
1861
+ },
1862
+ },
1863
+ },
1442
1864
  };
1443
1865
  export const accordion = {
1444
1866
  component: 'accordion',
@@ -1652,6 +2074,21 @@ export const select = {
1652
2074
  // so the twins restate it; declared for the manifest (signalxjs/lynx#1070).
1653
2075
  defaultVariants: { color: 'primary', size: 'md' },
1654
2076
  };
2077
+ /**
2078
+ * daisy's BUTTON ramp — `.btn`'s fixed height per size step, in `--size-field`
2079
+ * units, exactly as daisyUI 5 ships it (`components/button.css`: `.btn-xs`
2080
+ * `--size: calc(var(--size-field, .25rem) * 6)` through `.btn-xl` `* 14`,
2081
+ * `.btn`/`.btn-md` `* 10` — 1.5 / 2 / 2.5 / 3 / 3.5rem at the default
2082
+ * `--size-field: 0.25rem`).
2083
+ *
2084
+ * Its own table, not `FIELD_STEPS`: this repo's field ramp sits one step
2085
+ * higher than daisy's (md = 12 units, 3rem), and restating the button off it
2086
+ * would bake that offset into a second component. The button states daisy's
2087
+ * own numbers; #376 is exactly what happened while it had no height at all —
2088
+ * padding alone rendered md at ~30px against daisy's 40px.
2089
+ */
2090
+ const BTN_STEPS = { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 };
2091
+ const btnHeight = (step) => `calc(var(--size-field) * ${BTN_STEPS[step]})`;
1655
2092
  export const button = {
1656
2093
  component: 'button',
1657
2094
  // The two axes meet here instead of multiplying. `color` sets the accent
@@ -1787,12 +2224,17 @@ export const button = {
1787
2224
  },
1788
2225
  },
1789
2226
  },
2227
+ // daisy sizes a btn by fixed height (`--size`), not by padding: each
2228
+ // step states its `BTN_STEPS` height and keeps the padding/font ramps
2229
+ // for inline air; the root's flex centering absorbs the block axis.
2230
+ // The `<button>` element is UA `border-box`, so the stated height is
2231
+ // the rendered height, border included — as in daisy.
1790
2232
  size: {
1791
- xs: { root: { base: { padding: 'var(--space-2xs) var(--space-xs)', fontSize: 'var(--text-xs)' } } },
1792
- sm: { root: { base: { padding: 'var(--space-xs) var(--space-sm)', fontSize: 'var(--text-sm)' } } },
1793
- md: { root: { base: { padding: 'var(--space-sm) var(--space-lg)', fontSize: 'var(--text-md)' } } },
1794
- lg: { root: { base: { padding: 'var(--space-md) var(--space-xl)', fontSize: 'var(--text-lg)' } } },
1795
- xl: { root: { base: { padding: 'var(--space-lg) var(--space-2xl)', fontSize: 'var(--text-xl)' } } },
2233
+ xs: { root: { base: { height: btnHeight('xs'), padding: 'var(--space-2xs) var(--space-xs)', fontSize: 'var(--text-xs)' } } },
2234
+ sm: { root: { base: { height: btnHeight('sm'), padding: 'var(--space-xs) var(--space-sm)', fontSize: 'var(--text-sm)' } } },
2235
+ md: { root: { base: { height: btnHeight('md'), padding: 'var(--space-sm) var(--space-lg)', fontSize: 'var(--text-md)' } } },
2236
+ lg: { root: { base: { height: btnHeight('lg'), padding: 'var(--space-md) var(--space-xl)', fontSize: 'var(--text-lg)' } } },
2237
+ xl: { root: { base: { height: btnHeight('xl'), padding: 'var(--space-lg) var(--space-2xl)', fontSize: 'var(--text-xl)' } } },
1796
2238
  },
1797
2239
  },
1798
2240
  /**