@delacour/react-native-ui 0.4.1-alpha.20261021072908 → 0.4.1-alpha.20261021114607

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 (174) hide show
  1. package/package.json +1 -1
  2. package/src/{lib/cn.parity.test.ts → cn.parity.test.ts} +3 -3
  3. package/src/components/accordion/AGENTS.md +2 -2
  4. package/src/components/accordion/accordion.variants.test.ts +1 -3
  5. package/src/components/accordion/accordion.variants.ts +4 -6
  6. package/src/components/alert/AGENTS.md +1 -1
  7. package/src/components/alert/alert-glyphs.ts +1 -1
  8. package/src/components/alert/alert.variants.test.ts +2 -3
  9. package/src/components/alert/alert.variants.ts +1 -2
  10. package/src/components/animated-badge/AGENTS.md +1 -1
  11. package/src/components/animated-badge/animated-badge-glyph.tsx +1 -1
  12. package/src/components/attachment/AGENTS.md +1 -1
  13. package/src/components/attachment/attachment.utils.ts +1 -1
  14. package/src/components/avatar/avatar.utils.ts +1 -1
  15. package/src/components/badge/AGENTS.md +1 -1
  16. package/src/components/badge/badge.variants.ts +2 -3
  17. package/src/components/bottom-sheet/AGENTS.md +1 -1
  18. package/src/components/breadcrumb/AGENTS.md +1 -1
  19. package/src/components/breadcrumb/breadcrumb.variants.test.ts +1 -4
  20. package/src/components/button/AGENTS.md +3 -3
  21. package/src/components/button/button-group-separator.tsx +1 -1
  22. package/src/components/button/button.variants.ts +11 -12
  23. package/src/components/card/AGENTS.md +1 -1
  24. package/src/components/card/card.variants.ts +1 -2
  25. package/src/components/carousel/carousel.variants.ts +1 -2
  26. package/src/components/chart/chart.variants.ts +4 -5
  27. package/src/components/checkbox/AGENTS.md +8 -9
  28. package/src/components/checkbox/checkbox.variants.ts +12 -14
  29. package/src/components/chip/chip.variants.ts +2 -2
  30. package/src/components/circular-text/circular-text.variants.ts +1 -1
  31. package/src/components/collapsible/AGENTS.md +2 -4
  32. package/src/components/collapsible/collapsible.variants.test.ts +1 -4
  33. package/src/components/collapsible/collapsible.variants.ts +1 -1
  34. package/src/components/color-picker/color-picker.color.ts +1 -1
  35. package/src/components/combobox/combobox.filter.ts +1 -1
  36. package/src/components/combobox/combobox.variants.ts +2 -3
  37. package/src/components/compare/AGENTS.md +1 -1
  38. package/src/components/context-menu/context-menu.variants.ts +1 -1
  39. package/src/components/date-time-picker/date-time-picker.value.ts +1 -1
  40. package/src/components/dialog/AGENTS.md +2 -2
  41. package/src/components/dialog/dialog.variants.ts +1 -1
  42. package/src/components/direction/AGENTS.md +3 -1
  43. package/src/components/direction/direction.variants.ts +2 -2
  44. package/src/components/drawer/AGENTS.md +3 -2
  45. package/src/components/empty-state/empty-state.variants.ts +1 -2
  46. package/src/components/fab/AGENTS.md +1 -1
  47. package/src/components/feedback/AGENTS.md +4 -4
  48. package/src/components/feedback/feedback.variants.ts +3 -3
  49. package/src/components/field/AGENTS.md +4 -4
  50. package/src/components/field/field.variants.ts +6 -8
  51. package/src/components/flip-card/AGENTS.md +2 -3
  52. package/src/components/frame/frame.variants.ts +1 -2
  53. package/src/components/grid-item/grid-item.layout.ts +1 -2
  54. package/src/components/icon/AGENTS.md +1 -1
  55. package/src/components/icon/icon.variants.ts +2 -3
  56. package/src/components/image-viewer/AGENTS.md +1 -1
  57. package/src/components/image-viewer/image-viewer.variants.ts +1 -2
  58. package/src/components/input/AGENTS.md +5 -6
  59. package/src/components/input/input-group.tsx +1 -2
  60. package/src/components/input/input.tsx +1 -1
  61. package/src/components/input/input.variants.ts +15 -15
  62. package/src/components/item/AGENTS.md +4 -3
  63. package/src/components/item/item.variants.ts +2 -2
  64. package/src/components/label/AGENTS.md +3 -3
  65. package/src/components/label/label.variants.ts +5 -5
  66. package/src/components/list-group/list-group.variants.ts +2 -2
  67. package/src/components/map/AGENTS.md +4 -4
  68. package/src/components/markdown-editor/AGENTS.md +1 -1
  69. package/src/components/marquee/AGENTS.md +1 -1
  70. package/src/components/menu/menu.variants.ts +1 -1
  71. package/src/components/message-scroller/message-scroller.utils.ts +2 -2
  72. package/src/components/number-input/AGENTS.md +1 -1
  73. package/src/components/number-input/number-input.format.ts +2 -2
  74. package/src/components/number-input/number-input.variants.ts +2 -2
  75. package/src/components/number-input/use-step-repeat.ts +1 -1
  76. package/src/components/otp-input/otp-input.logic.ts +1 -1
  77. package/src/components/otp-input/otp-input.variants.ts +3 -3
  78. package/src/components/overlay/AGENTS.md +1 -1
  79. package/src/components/page-header/page-header.utils.ts +1 -2
  80. package/src/components/pagination/pagination.variants.test.ts +1 -5
  81. package/src/components/planner/planner-dates.ts +1 -1
  82. package/src/components/popover/AGENTS.md +1 -1
  83. package/src/components/popover/popover.position.ts +1 -2
  84. package/src/components/post/AGENTS.md +3 -2
  85. package/src/components/post/post.utils.ts +2 -2
  86. package/src/components/post/post.variants.ts +2 -2
  87. package/src/components/pressable/pressable.variants.ts +4 -4
  88. package/src/components/progress/progress.variants.ts +2 -2
  89. package/src/components/provider/AGENTS.md +1 -1
  90. package/src/components/qr-code/AGENTS.md +5 -5
  91. package/src/components/qr-code/qr-code.constants.ts +1 -1
  92. package/src/components/qr-code/qr-code.path.ts +2 -2
  93. package/src/components/qr-code/qr-code.tables.ts +2 -2
  94. package/src/components/qr-code/qr-code.variants.ts +2 -2
  95. package/src/components/questionnaire/AGENTS.md +1 -1
  96. package/src/components/questionnaire/questionnaire.logic.ts +1 -1
  97. package/src/components/radio/AGENTS.md +6 -7
  98. package/src/components/radio/radio-indicator.tsx +2 -2
  99. package/src/components/radio/radio.tsx +1 -1
  100. package/src/components/radio/radio.variants.test.ts +1 -4
  101. package/src/components/radio/radio.variants.ts +6 -6
  102. package/src/components/rating/AGENTS.md +2 -2
  103. package/src/components/screen/AGENTS.md +1 -1
  104. package/src/components/screen/screen.variants.ts +9 -9
  105. package/src/components/scroll-canvas/AGENTS.md +1 -1
  106. package/src/components/scroll-canvas/scroll-canvas.variants.ts +2 -2
  107. package/src/components/scroll-fade/AGENTS.md +1 -1
  108. package/src/components/scroll-header/AGENTS.md +2 -2
  109. package/src/components/scroll-text/AGENTS.md +1 -1
  110. package/src/components/search-bar/search-bar.debounce.ts +2 -2
  111. package/src/components/search-bar/search-bar.variants.ts +2 -2
  112. package/src/components/section-progress/AGENTS.md +2 -2
  113. package/src/components/select/AGENTS.md +2 -1
  114. package/src/components/select/select.variants.ts +5 -5
  115. package/src/components/separator/AGENTS.md +1 -1
  116. package/src/components/separator/separator.tsx +3 -3
  117. package/src/components/signature/AGENTS.md +1 -1
  118. package/src/components/signature/signature.stroke.ts +1 -1
  119. package/src/components/skeleton/AGENTS.md +1 -1
  120. package/src/components/sketch/AGENTS.md +2 -2
  121. package/src/components/sketch/sketch.paths.ts +2 -2
  122. package/src/components/slider/AGENTS.md +2 -2
  123. package/src/components/slider/slider-fill.tsx +3 -3
  124. package/src/components/slider/slider.variants.ts +7 -7
  125. package/src/components/sortable/sortable.variants.test.ts +1 -4
  126. package/src/components/spinner/AGENTS.md +1 -1
  127. package/src/components/spinner/spinner.variants.ts +3 -3
  128. package/src/components/splitter/AGENTS.md +5 -6
  129. package/src/components/splitter/splitter.math.ts +1 -1
  130. package/src/components/steps/AGENTS.md +2 -2
  131. package/src/components/steps/steps.variants.test.ts +1 -5
  132. package/src/components/steps/steps.variants.ts +1 -1
  133. package/src/components/support/AGENTS.md +3 -2
  134. package/src/components/surface/surface.variants.test.ts +2 -3
  135. package/src/components/surface/surface.variants.ts +1 -1
  136. package/src/components/switch/AGENTS.md +1 -2
  137. package/src/components/switch/switch.tsx +2 -3
  138. package/src/components/switch/switch.variants.test.ts +1 -5
  139. package/src/components/switch/switch.variants.ts +5 -5
  140. package/src/components/tabs/AGENTS.md +2 -2
  141. package/src/components/tabs/tabs-label.tsx +1 -1
  142. package/src/components/tabs/tabs.variants.ts +2 -2
  143. package/src/components/tag-input/AGENTS.md +1 -1
  144. package/src/components/tag-input/tag-input.logic.ts +2 -2
  145. package/src/components/tag-input/tag-input.variants.ts +2 -2
  146. package/src/components/text/text.tsx +2 -2
  147. package/src/components/text/text.variants.ts +3 -3
  148. package/src/components/text-animation/AGENTS.md +4 -4
  149. package/src/components/textarea/AGENTS.md +2 -2
  150. package/src/components/textarea/textarea.variants.test.ts +1 -4
  151. package/src/components/textarea/textarea.variants.ts +6 -7
  152. package/src/components/theme-selector/theme-selector.logic.ts +1 -1
  153. package/src/components/theme-selector/theme-selector.variants.ts +1 -1
  154. package/src/components/time-picker/time-picker.time.ts +1 -1
  155. package/src/components/time-picker/time-picker.variants.ts +2 -2
  156. package/src/components/toast/AGENTS.md +2 -2
  157. package/src/components/toast/toast.timer.ts +1 -2
  158. package/src/components/toggle-button/toggle-button.variants.ts +3 -3
  159. package/src/components/tooltip/AGENTS.md +2 -2
  160. package/src/components/tree/tree.variants.test.ts +1 -4
  161. package/src/components/tree/tree.variants.ts +1 -1
  162. package/src/hooks/use-keyboard-state-sync.tsx +1 -1
  163. package/src/hooks/use-navigation-theme.ts +1 -1
  164. package/src/lib/cn.ts +1 -1
  165. package/src/lib/color.ts +2 -2
  166. package/src/lib/keyboard-animation.ts +2 -3
  167. package/src/lib/navigation-theme.ts +2 -3
  168. package/src/lib/paging.ts +1 -1
  169. package/src/lib/scroll-edges.ts +1 -1
  170. package/src/lib/scroll-maths.ts +2 -2
  171. package/src/lib/wrap-text-children.ts +1 -1
  172. package/src/styles/theme-tokens.test.ts +9 -2
  173. package/src/styles/theme.css +4 -5
  174. package/src/styles/tokens.css +1 -1
@@ -312,7 +312,7 @@ const ACCESSIBILITY_ACTIONS = [{ name: "activate" }] as const;
312
312
  * content layers. Reordering here rather than asking the caller to is the
313
313
  * difference between an anatomy that documents itself and one that has a gotcha.
314
314
  *
315
- * {@link hasThumbChild} is the decision and is pure, so `bun test` reaches it.
315
+ * {@link hasThumbChild} is the decision and is pure, so a unit test reaches it.
316
316
  *
317
317
  * Lives here rather than with the parts: it is the root that arranges its own
318
318
  * children, and importing it from a part would close a cycle. See AGENTS.md.
@@ -344,8 +344,7 @@ function withThumb(children: ReactNode): ReactNode {
344
344
  * the check no longer rests on identity.
345
345
  *
346
346
  * `displayName` is what it rests on instead. Rule 12 requires every component in
347
- * this package to carry one, `display-name.test.ts` enforces that they are
348
- * present and unique, and it survives every rewrite above because it is a
347
+ * this package to carry one, present and unique, and it survives every rewrite above because it is a
349
348
  * property assigned to the function rather than the function itself. Read off
350
349
  * the element's own `type`, which is a function today and would be an object if
351
350
  * this part were ever wrapped in `memo`.
@@ -1,7 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { readFileSync } from "node:fs";
3
- import { join } from "node:path";
4
- import { declarationCount } from "../../styles/theme-tokens.test";
2
+ import { declarationCount, TOKENS_CSS } from "../../styles/theme-tokens.test";
5
3
  import { ICON_SIZES } from "../icon/icon.variants";
6
4
  import {
7
5
  hasThumbChild,
@@ -34,8 +32,6 @@ import {
34
32
  switchVariants,
35
33
  } from "./switch.variants";
36
34
 
37
- const TOKENS_CSS = readFileSync(join(import.meta.dirname, "../../styles/tokens.css"), "utf-8");
38
-
39
35
  /** The minimum a touch target may be, in points. Apple's number, and Android's. */
40
36
  const MINIMUM_TARGET = 44;
41
37
 
@@ -269,7 +269,7 @@ export const SWITCH_INVALID_CONTENT_TEXT_CLASS = "text-destructive-foreground";
269
269
  * No slot worn by a `View` carries `text-*`; a glyph's colour is a token handed
270
270
  * to an `IconDefaultsProvider`. See AGENTS.md rule 1.
271
271
  *
272
- * Free of React Native imports so it stays unit-testable — `bun test` cannot
272
+ * Free of React Native imports so it stays unit-testable — a bare JS runtime cannot
273
273
  * parse React Native's Flow-typed source. See AGENTS.md.
274
274
  */
275
275
  export const switchVariants = tv({
@@ -361,7 +361,7 @@ export type SwitchAxes = {
361
361
  * A `Field` reaches the two *state* axes only. It cannot acquire a paint axis by
362
362
  * accident, and a test pins that.
363
363
  *
364
- * Pure, so the whole matrix is reachable from `bun test`. See AGENTS.md.
364
+ * Pure, so the whole matrix is unit-testable. See AGENTS.md.
365
365
  */
366
366
  export function resolveSwitchAxes({ own, field }: { own?: SwitchOwnAxes; field?: SwitchFieldAxes | null }): SwitchAxes {
367
367
  return {
@@ -406,7 +406,7 @@ export function resolveSwitchThumbTokens({ color, isInvalid }: { color: SwitchCo
406
406
  * wrote none wants the default rather than an empty capsule.
407
407
  *
408
408
  * Takes an array of "is this child a thumb" rather than the children themselves,
409
- * so it stays free of React and reachable from `bun test` — the trade
409
+ * so it stays free of React and unit-testable — the trade
410
410
  * `resolveIndicatorPlacement` already makes.
411
411
  */
412
412
  export function hasThumbChild(isThumb: readonly boolean[]): boolean {
@@ -454,7 +454,7 @@ export function switchTravel({
454
454
  * happens to be declared first, and a tidy-up that reorders the file crashes the
455
455
  * UI thread. See AGENTS.md under **Slider**.
456
456
  *
457
- * Pure, so `bun test` reaches the whole matrix.
457
+ * Pure, so a unit test reaches the whole matrix.
458
458
  */
459
459
  export function resolveSwitchRelease({
460
460
  progress,
@@ -492,7 +492,7 @@ export type SwitchContentPlacement = "start" | "end";
492
492
  * an `IconDefaultsProvider` and a `TextClassProvider` respectively take — the
493
493
  * asymmetry AGENTS.md's **Theming** section sets out.
494
494
  *
495
- * Pure, so `bun test` reaches the whole matrix.
495
+ * Pure, so a unit test reaches the whole matrix.
496
496
  */
497
497
  export function resolveSwitchContentTreatment({
498
498
  color,
@@ -195,12 +195,12 @@ A row of tabs and the panels they switch between. Compound root plus `Tabs.List`
195
195
  because all three write that one value.
196
196
  [`Checkbox`](../checkbox/AGENTS.md)'s animated border makes the same trade for
197
197
  the same reason: a colour that travels cannot be a class.
198
- `resolveTabSelectedness` is the ramp, and it is pure, so `bun test` reaches it.
198
+ `resolveTabSelectedness` is the ramp, and it is pure, so a unit test reaches it.
199
199
  - **The `label` slot therefore names no colour at all, and a test enforces that.**
200
200
  Two sources for one colour is how a class and a style end up disagreeing for a
201
201
  frame on every commit. `TABS_FOREGROUND_TOKEN` is the whole matrix now, swept
202
202
  for distinctness and asserted present in both themes — the decision stayed
203
- reachable from `bun test`, it just moved from class strings to token names.
203
+ unit-testable, it just moved from class strings to token names.
204
204
  - **`visualIndex` survives for the things that cannot fade.** A composed `Icon`
205
205
  takes its colour as a resolved *value* rather than a style, so it has no way to
206
206
  be half way between two; it swaps at the midpoint, with a hysteresis band
@@ -24,7 +24,7 @@ export type { TabsLabelProps };
24
24
  * covers a finger dragging, a flick and a plain tap without knowing which is
25
25
  * happening, because all three write the same value. `Checkbox`'s border makes
26
26
  * the same trade: a colour that travels cannot be a class, so it interpolates
27
- * between two tokens and the decision stays in a pure map `bun test` can sweep.
27
+ * between two tokens and the decision stays in a pure map a unit test can sweep.
28
28
  *
29
29
  * The `label` slot therefore carries **no** colour. Two sources for one colour is
30
30
  * how a class and a style end up disagreeing for a frame on every commit.
@@ -44,7 +44,7 @@ export const TABS_LABEL_TEXT_SIZE: Record<TabsSize, TextSize> = { sm: "sm", md:
44
44
  * This is the **only** place either colour is named. The label crossfades between
45
45
  * them on the UI thread and a composed `Icon` takes one of them as a resolved
46
46
  * value, and neither of those can be a class — so the `label` slot carries no
47
- * colour at all and this map is what `bun test` sweeps instead. `Checkbox`'s
47
+ * colour at all and this map is what a unit test sweeps instead. `Checkbox`'s
48
48
  * animated border makes the same trade for the same reason.
49
49
  */
50
50
  export const TABS_FOREGROUND_TOKEN: Record<TabsVariant, { selected: string; unselected: string }> = {
@@ -583,7 +583,7 @@ export function resolveScrollOffset(state: {
583
583
  * `shrink-0` is what stops flex shrinking eight overflowing panels to an eighth
584
584
  * each.
585
585
  *
586
- * Free of React Native imports so it stays unit-testable — `bun test` cannot parse
586
+ * Free of React Native imports so it stays unit-testable — a bare JS runtime cannot parse
587
587
  * React Native's Flow-typed source. See AGENTS.md.
588
588
  */
589
589
  export const tabsVariants = tv({
@@ -26,7 +26,7 @@ list.
26
26
  - **Every decision is in `tag-input.logic.ts`, and the root only wires it to
27
27
  events.** Splitting, trimming, the four rejection reasons, what Backspace and
28
28
  blur do, the counter and the haptic throttle are pure functions, so the whole
29
- behaviour is reachable from `bun test` where no renderer is. A rule added
29
+ behaviour is unit-testable where no renderer is. A rule added
30
30
  inline in `tag-input.tsx` is a rule nothing checks.
31
31
  - **The box is `Input.Group`'s, at its multiline floor.** `resolveTagInputBoxClass`
32
32
  calls `resolveInputGroupClass` with `isMultiline: true` — a minimum height and
@@ -4,8 +4,8 @@ import type { TagInputBlurBehavior, TagInputRejection, TagInputRejectReason } fr
4
4
  * The pure half of `TagInput`: parsing typed and pasted text into tags, the
5
5
  * rules a tag has to pass, and the two-press Backspace.
6
6
  *
7
- * Free of React and React Native imports so every decision here is reachable
8
- * from `bun test` — the component only wires these to events. See AGENTS.md.
7
+ * Free of React and React Native imports so every decision here is unit-testable
8
+ * — the component only wires these to events. See AGENTS.md.
9
9
  */
10
10
 
11
11
  /** The rules a single tag is checked against. */
@@ -15,7 +15,7 @@ import {
15
15
  *
16
16
  * A step down from the field's own size, so a row of chips fits inside the
17
17
  * field's floor rather than pushing it taller: the first tag added must not
18
- * make the box jump. `tag-input.variants.test.ts` adds the heights up.
18
+ * make the box jump. The heights must add up.
19
19
  */
20
20
  export const TAG_INPUT_CHIP_SIZE: Record<InputSize, ChipSize> = { sm: "sm", md: "sm", lg: "md" };
21
21
 
@@ -71,7 +71,7 @@ export const tagInputVariants = tv({
71
71
  * height a minimum and the content top-aligned, the rule `Input` applies to a
72
72
  * field that grows — with the vertical padding tightened to fit a chip row.
73
73
  *
74
- * Pure, so the parity with `Input` is reachable from `bun test`.
74
+ * Pure, so the parity with `Input` is unit-testable.
75
75
  */
76
76
  export function resolveTagInputBoxClass({
77
77
  className,
@@ -188,7 +188,7 @@ TextLink.displayName = "DelacourUI.Text.Link";
188
188
  *
189
189
  * @example
190
190
  * <View className="rounded-lg bg-muted p-3">
191
- * <Text.Code className="bg-transparent" size="sm">bun run gen-exports</Text.Code>
191
+ * <Text.Code className="bg-transparent" size="sm">npm run build</Text.Code>
192
192
  * </View>
193
193
  */
194
194
  function TextCode(props: TextPresetProps): ReactElement {
@@ -220,7 +220,7 @@ TextCode.displayName = "DelacourUI.Text.Code";
220
220
  *
221
221
  * @example
222
222
  * <Text.Paragraph>
223
- * Run <Text.Code>bun test</Text.Code> before you <Text.Strong>commit</Text.Strong>.
223
+ * Run <Text.Code>npm test</Text.Code> before you <Text.Strong>commit</Text.Strong>.
224
224
  * </Text.Paragraph>
225
225
  *
226
226
  * @example
@@ -117,7 +117,7 @@ export const TEXT_MAX_FONT_SIZE_MULTIPLIER = 1.4;
117
117
  * `--text-paragraph--line-height` *pair* in `tokens.css` and register the
118
118
  * bespoke name in `tokens.ts` — one utility carrying both.
119
119
  *
120
- * Free of React Native imports so it stays unit-testable — `bun test` cannot
120
+ * Free of React Native imports so it stays unit-testable — a bare JS runtime cannot
121
121
  * parse React Native's Flow-typed source. See AGENTS.md.
122
122
  */
123
123
  export const textVariants = tv({
@@ -222,7 +222,7 @@ export function isInlineTextVariant(variant: TextVariant): boolean {
222
222
  * rather than a guess, which is what makes skipping the provider safe.
223
223
  *
224
224
  * Deliberately typed on `unknown` rather than `ReactNode`: keeping this module
225
- * free of even a type import is what lets `bun test` reach it.
225
+ * free of even a type import is what lets a unit test reach it.
226
226
  */
227
227
  export function canNestText(children: unknown): boolean {
228
228
  return typeof children !== "string" && typeof children !== "number";
@@ -253,7 +253,7 @@ export function canNestText(children: unknown): boolean {
253
253
  * composed into a `Button` matches it without being told to. See
254
254
  * `resolveIconSizeClass`.
255
255
  *
256
- * Pure, so the whole ladder is reachable from `bun test`. See AGENTS.md.
256
+ * Pure, so the whole ladder is unit-testable. See AGENTS.md.
257
257
  */
258
258
  export function resolveTextClass({
259
259
  align,
@@ -174,10 +174,10 @@ a follow-up after the media components merge, not something to do on this branch
174
174
 
175
175
  ## Preview media — a follow-up
176
176
 
177
- No demo carries `meta.capture` yet: `demos.test.ts` requires a manifest entry and
178
- both themes' media for every captured demo, and those come only from
179
- `bun run previews`, which the lead runs after the media components merge. When it
180
- does, capture `reveal-words` (`hero`, `align: "stretch"`), `reveal-characters`,
177
+ No demo carries `meta.capture` yet: a captured demo needs a manifest entry and
178
+ both themes' media<!-- registry:omit -->, which come only from
179
+ `bun run previews` (`demos.test.ts` checks this), run by the lead after the media components merge<!-- /registry:omit -->. When it
180
+ is added, capture `reveal-words` (`hero`, `align: "stretch"`), `reveal-characters`,
181
181
  `typing` (`align: "stretch"`), `rotating`, `counting` and `rolling` — every one a
182
182
  clip, since each is motion; `counting` and `rolling` need a flow that taps their
183
183
  `-next` button. `orders` stays gallery-only.
@@ -33,8 +33,8 @@ A multiline text field, sized in rows. One component, no parts: it renders an
33
33
  a small three-row field and a large one are both three rows.
34
34
  - **Every number the height counts is pinned to the class that draws it.** The
35
35
  line height is set by a `leading-*` class in `textareaVariants`' `field` slot,
36
- and the padding is `Input`'s multiline `py-*`. `textarea.variants.test.ts`
37
- resolves both classes and fails if either disagrees with its number — a
36
+ and the padding is `Input`'s multiline `py-*`. Both classes are resolved and must
37
+ agree with the number — a
38
38
  retune of `Input`'s padding would otherwise mis-size every textarea by a few
39
39
  points, silently, with the last line clipped at the bottom edge.
40
40
  - **A paragraph gets paragraph leading.** `Input` sets `leading-tight` because
@@ -1,6 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { readFileSync } from "node:fs";
3
- import { join } from "node:path";
2
+ import { TOKENS_CSS } from "../../styles/theme-tokens.test";
4
3
  import { INPUT_SIZES, inputVariants, resolveInputFieldClass } from "../input/input.variants";
5
4
  import {
6
5
  resolveTextareaCount,
@@ -16,8 +15,6 @@ import {
16
15
  textareaVariants,
17
16
  } from "./textarea.variants";
18
17
 
19
- const TOKENS_CSS = readFileSync(join(import.meta.dirname, "../../styles/tokens.css"), "utf-8");
20
-
21
18
  /** Points behind a `--text-input-*` token in `tokens.css`. */
22
19
  function inputTextPoints(size: string): number {
23
20
  const match = TOKENS_CSS.match(new RegExp(`--text-input-${size}:\\s*([\\d.]+)px;`));
@@ -14,8 +14,7 @@ export const TEXTAREA_DEFAULT_MAX_ROWS = 10;
14
14
  * A paragraph needs more leading than the one line `Input` sets `leading-tight`
15
15
  * for, and a row count only becomes a height once the height of a line is a
16
16
  * number. So the number lives here, and the `leading-*` class that sets it lives
17
- * in {@link textareaVariants} beside it; `textarea.variants.test.ts` reads the
18
- * class back and fails if the two ever disagree.
17
+ * in {@link textareaVariants} beside it; the two must never disagree.
19
18
  */
20
19
  export const TEXTAREA_LINE_HEIGHTS: Record<InputSize, number> = { sm: 20, md: 24, lg: 28 };
21
20
 
@@ -75,7 +74,7 @@ export type TextareaVariantProps = VariantProps<typeof textareaVariants>;
75
74
  * the `leading-tight` that slot sets rather than sitting beside it — and a
76
75
  * caller's className, merged last here, still wins over both.
77
76
  *
78
- * Pure, so it is reachable from `bun test`. See AGENTS.md.
77
+ * Pure, so it is unit-testable. See AGENTS.md.
79
78
  */
80
79
  export function resolveTextareaFieldClass({ size, className }: { size: InputSize; className?: string }): string {
81
80
  return textareaVariants({ size }).field({ className });
@@ -93,7 +92,7 @@ function wholeRows(value: number | undefined, fallback: number): number {
93
92
  * A ceiling below the floor is lifted up to it — otherwise a growing field
94
93
  * would shrink as it grew.
95
94
  *
96
- * Pure, so it is reachable from `bun test`. See AGENTS.md.
95
+ * Pure, so it is unit-testable. See AGENTS.md.
97
96
  */
98
97
  export function resolveTextareaRows({ rows, maxRows }: { rows?: number; maxRows?: number }): {
99
98
  rows: number;
@@ -111,7 +110,7 @@ export function resolveTextareaRows({ rows, maxRows }: { rows?: number; maxRows?
111
110
  * padding — around every section at once, so a grouped field is its lines and
112
111
  * nothing else. Adding the box back gives exactly the lone height.
113
112
  *
114
- * Pure, so it is reachable from `bun test`. See AGENTS.md.
113
+ * Pure, so it is unit-testable. See AGENTS.md.
115
114
  */
116
115
  export function resolveTextareaRowsHeight({
117
116
  rows,
@@ -138,7 +137,7 @@ export function resolveTextareaRowsHeight({
138
137
  * own multiline `TextInput` sizes itself to its content — no measuring pass, so
139
138
  * no frame drawn at the old height after a line is added.
140
139
  *
141
- * Pure, so it is reachable from `bun test`. See AGENTS.md.
140
+ * Pure, so it is unit-testable. See AGENTS.md.
142
141
  */
143
142
  export function resolveTextareaHeightStyle({
144
143
  size,
@@ -178,7 +177,7 @@ export type TextareaCount = {
178
177
  * can never see, and the count has to say something at the moment typing stops
179
178
  * working. A controlled value set past the limit in code still reads as at it.
180
179
  *
181
- * Pure, so it is reachable from `bun test`. See AGENTS.md.
180
+ * Pure, so it is unit-testable. See AGENTS.md.
182
181
  */
183
182
  export function resolveTextareaCount({ length, maxLength }: { length: number; maxLength: number }): TextareaCount {
184
183
  const isAtLimit = length >= maxLength;
@@ -2,7 +2,7 @@
2
2
  * The pure decisions behind `ThemeSelector`: which mode is selected, what a
3
3
  * press changes, what a stored string restores to and which options to draw.
4
4
  *
5
- * Imports neither React Native nor Uniwind, so `bun test` reaches all of it.
5
+ * Imports neither React Native nor Uniwind, so a unit test reaches all of it.
6
6
  * `use-theme-selection.ts` is the one file that binds these to the live theme.
7
7
  * See AGENTS.md.
8
8
  */
@@ -64,7 +64,7 @@ export type ThemeSelectorGroupProps = {
64
64
  * selected option does nothing rather than clearing it. `segmented` is an
65
65
  * attached run; `cards` is detached, so each tile keeps its own corners.
66
66
  *
67
- * Pure, so the whole matrix is reachable from `bun test`.
67
+ * Pure, so the whole matrix is unit-testable.
68
68
  */
69
69
  export function resolveGroupProps(variant: ThemeSelectorVariant): ThemeSelectorGroupProps {
70
70
  return {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A time of day, and everything a picker needs to reason about one.
3
3
  *
4
- * Pure: no React, no React Native, so `bun test` reaches every function here and
4
+ * Pure: no React, no React Native, so a unit test reaches every function here and
5
5
  * a picker in another folder (`date-time-picker`) can import this module as a
6
6
  * leaf without pulling the `TimePicker` component in with it.
7
7
  *
@@ -101,7 +101,7 @@ export type TimePickerVariantProps = VariantProps<typeof timePickerVariants>;
101
101
  * scale comes from this file's `value` slot instead, which names the same
102
102
  * `text-input-*` token.
103
103
  *
104
- * Pure, so the whole matrix is reachable from `bun test`.
104
+ * Pure, so the whole matrix is unit-testable.
105
105
  */
106
106
  export function resolveTimePickerTriggerClass({
107
107
  className,
@@ -212,7 +212,7 @@ function closestIndex(rows: readonly TimeWheelRow[], value: number): number {
212
212
  * period — 12, 1 … 11 — and each row carries its stored hour, so moving the
213
213
  * hour wheel never flips AM and PM. The period column is two rows.
214
214
  *
215
- * Pure: every rule the wheel follows is reachable from `bun test`.
215
+ * Pure: every rule the wheel follows is unit-testable.
216
216
  */
217
217
  export function resolveTimeWheelColumns({
218
218
  time,
@@ -121,13 +121,13 @@ once, it draws the store) and `<Toast>` (the card, compound, also usable inside
121
121
 
122
122
  ## Testing
123
123
 
124
- `bun test` reaches the reducer, the store's batching, the api (including `promise` both ways), the
124
+ A unit test reaches the reducer, the store's batching, the api (including `promise` both ways), the
125
125
  clock and every resolver. Motion, gestures, insets, the keyboard and announcements are verified on a
126
126
  simulator through `/toast`.
127
127
 
128
128
  ## Preview capture
129
129
 
130
- The bodies are in `apps/playground/e2e/previews/toast.e2e.ts`; the captured demos are:
130
+ The <!-- registry:omit -->bodies are in `apps/playground/e2e/previews/toast.e2e.ts`; the <!-- /registry:omit -->captured demos are:
131
131
 
132
132
  | Demo | `capture` |
133
133
  | --- | --- |
@@ -3,8 +3,7 @@
3
3
  *
4
4
  * `startedAt` is `null` while paused; `remaining` is what was left when it last
5
5
  * stopped. Every function returns a new value and reads the time it is given,
6
- * so pause and resume are exact and the whole clock is reachable from
7
- * `bun test`. The viewport turns `toastTimerRemaining` into one `setTimeout`
6
+ * so pause and resume are exact and the whole clock is unit-testable. The viewport turns `toastTimerRemaining` into one `setTimeout`
8
7
  * per run and clears it on every pause.
9
8
  *
10
9
  * A duration of `0` means "until hidden" and is stored as an infinite
@@ -79,7 +79,7 @@ export const toggleButtonVariants = tv({
79
79
  /**
80
80
  * The `Button` variant a toggle draws with right now.
81
81
  *
82
- * Pure, so the whole matrix is reachable from `bun test`. See AGENTS.md.
82
+ * Pure, so the whole matrix is unit-testable. See AGENTS.md.
83
83
  */
84
84
  export function resolveToggleButtonVariant(variant: ToggleButtonVariant, isSelected: boolean): ButtonVariant {
85
85
  return TOGGLE_BUTTON_APPEARANCE[variant][isSelected ? "on" : "off"];
@@ -102,7 +102,7 @@ export function resolveToggleButtonVariant(variant: ToggleButtonVariant, isSelec
102
102
  * A controlled `single` group handed several values collapses to the one pressed
103
103
  * rather than carrying the others along.
104
104
  *
105
- * Pure, so the whole matrix is reachable from `bun test`. See AGENTS.md.
105
+ * Pure, so the whole matrix is unit-testable. See AGENTS.md.
106
106
  */
107
107
  export function resolveToggleSelection({
108
108
  current,
@@ -145,7 +145,7 @@ export type ToggleButtonAccessibility =
145
145
  *
146
146
  * `null` is "not in a group".
147
147
  *
148
- * Pure, so the whole matrix is reachable from `bun test`. See AGENTS.md.
148
+ * Pure, so the whole matrix is unit-testable. See AGENTS.md.
149
149
  */
150
150
  export function resolveToggleButtonAccessibility(
151
151
  selectionMode: ToggleButtonSelectionMode | null,
@@ -122,10 +122,10 @@ card corner, which is larger than the inverted chip's `rounded-md`, so it clears
122
122
 
123
123
  ## Testing
124
124
 
125
- `bun test` reaches the variants and the three resolvers. Positioning is Popover's and tested there.
125
+ A unit test reaches the variants and the three resolvers. Positioning is Popover's and tested there.
126
126
  Everything else — the long press and its haptic, the button's tap surviving it, the timer, an
127
127
  outside tap closing it and still landing, one-at-a-time, VoiceOver reading `label` — is verified on
128
128
  a simulator through `apps/playground`'s `/tooltip` gallery.
129
129
 
130
- Preview media: the bodies are in `apps/playground/e2e/previews/tooltip.e2e.ts`, and the captured
130
+ Preview media: <!-- registry:omit -->the bodies are in `apps/playground/e2e/previews/tooltip.e2e.ts`, and <!-- /registry:omit -->the captured
131
131
  demos carry `{ flow: true, frame: "device" }`, `icon-buttons` as the hero.
@@ -1,6 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { readFileSync } from "node:fs";
3
- import { join } from "node:path";
2
+ import { THEME_CSS } from "../../styles/theme-tokens.test";
4
3
  import { COLLAPSIBLE_SPRING } from "../collapsible/collapsible.variants";
5
4
  import { ICON_SIZES } from "../icon/icon.variants";
6
5
  import { TEXT_SIZES } from "../text/text.variants";
@@ -34,8 +33,6 @@ import {
34
33
  treeVariants,
35
34
  } from "./tree.variants";
36
35
 
37
- const THEME_CSS = readFileSync(join(import.meta.dirname, "../../styles/theme.css"), "utf-8");
38
-
39
36
  /** Tailwind's own spacing scale, in points. `w-6` is twenty-four. */
40
37
  const SPACING_STEP_PX = 4;
41
38
 
@@ -267,7 +267,7 @@ export function resolveTreeAccessibilityAction(actionName: string, isExpanded: b
267
267
  * so the whole tree mirrors under right-to-left.
268
268
  *
269
269
  * No slot worn by a `View` carries `text-*` (rule 1). Free of React Native imports
270
- * so it stays reachable from `bun test`.
270
+ * so it stays unit-testable.
271
271
  */
272
272
  export const treeVariants = tv({
273
273
  slots: {
@@ -6,7 +6,7 @@ import { scheduleOnUI } from "react-native-worklets";
6
6
  import { shouldResetKeyboardAnimation } from "../lib/keyboard-animation";
7
7
 
8
8
  // Re-exported so the pure decision is reachable beside the hook that acts on
9
- // it; it lives in `lib` only because `bun test` cannot follow this module's
9
+ // it; it lives in `lib` only because a plain unit test cannot follow this module's
10
10
  // React Native imports.
11
11
  export { shouldResetKeyboardAnimation } from "../lib/keyboard-animation";
12
12
 
@@ -4,7 +4,7 @@ import { NAVIGATION_THEME_TOKENS, type NavigationTheme, omitUnresolvedColors } f
4
4
  import { useThemeColor } from "./use-theme-color";
5
5
 
6
6
  // Re-exported so the mapping is reachable beside the hook that reads it; it
7
- // lives in `lib` only because `bun test` cannot follow this module's React
7
+ // lives in `lib` only because a plain unit test cannot follow this module's React
8
8
  // Native imports.
9
9
  export {
10
10
  NAVIGATION_THEME_TOKENS,
package/src/lib/cn.ts CHANGED
@@ -16,7 +16,7 @@ import { TW_MERGE_CONFIG } from "../styles/tokens";
16
16
  * `cn("h-button-md", "h-12")` returns *both* classes: they each resolve to a
17
17
  * height, uniwind applies whichever it saw last, and a caller's override works
18
18
  * or does not depending on class order. Nothing throws, so the failure is
19
- * silent — which is why `cn.test.ts` asserts every token here.
19
+ * silent — which is why every token here must be asserted.
20
20
  *
21
21
  * `tv()` needs the same treatment for its own merger — see `lib/tv.ts`.
22
22
  */
package/src/lib/color.ts CHANGED
@@ -27,8 +27,8 @@ const LEGACY_PREFIX = "--color-";
27
27
  * caller wrote before this package took shadcn's names, and left alone it would
28
28
  * miss silently on every render.
29
29
  *
30
- * Pure, and separate from `useThemeColor` so it is reachable from `bun test` —
31
- * the hook imports `uniwind`, which Bun's transpiler cannot parse. See AGENTS.md.
30
+ * Pure, and separate from `useThemeColor` so it is unit-testable —
31
+ * the hook imports `uniwind`, whose source a bare JS runtime cannot parse. See AGENTS.md.
32
32
  */
33
33
  export function themeVariableName(token: string): string {
34
34
  if (token.startsWith(LEGACY_PREFIX)) return `--${token.slice(LEGACY_PREFIX.length)}`;
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * Whether `KeyboardProvider`'s shared animation values are provably stale.
3
3
  *
4
- * Lives here, free of React Native imports, so the decision is reachable from
5
- * `bun test` — `hooks/use-keyboard-state-sync` cannot be, since Bun's
6
- * transpiler cannot parse React Native's Flow-typed source. See AGENTS.md.
4
+ * Lives here, free of React Native imports, so the decision is unit-testable —
5
+ * `hooks/use-keyboard-state-sync` cannot be, since a bare JS runtime cannot parse React Native's Flow-typed source. See AGENTS.md.
7
6
  *
8
7
  * `hasFocusedInput` MUST come from React Native's own focus registry
9
8
  * (`TextInput.State.currentlyFocusedInput()`), never from
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * React Navigation's colour slots, mapped to this library's semantic tokens.
3
3
  *
4
- * Lives here, free of React Native imports, so the mapping is reachable from
5
- * `bun test` — `hooks/use-navigation-theme` cannot be, since Bun's transpiler
6
- * cannot parse React Native's Flow-typed source. See AGENTS.md.
4
+ * Lives here, free of React Native imports, so the mapping is unit-testable —
5
+ * `hooks/use-navigation-theme` cannot be, since a bare JS runtime cannot parse React Native's Flow-typed source. See AGENTS.md.
7
6
  *
8
7
  * A slot pointing at a token no theme emits would resolve to `undefined`, be
9
8
  * dropped, and silently leave React Navigation's own light default in place —
package/src/lib/paging.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * why the rubber band is written out again inside {@link resolvePanPosition}
15
15
  * rather than called. Module constants are plain numbers and are captured fine.
16
16
  *
17
- * Pure: no React, no React Native, no Reanimated — `bun test` reaches all of it.
17
+ * Pure: no React, no React Native, no Reanimated — a unit test reaches all of it.
18
18
  */
19
19
 
20
20
  /** The furthest a rubber band ever gives past an end, in slides. */
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Every function is a self-contained worklet, for the reason `scroll-maths.ts`
8
8
  * gives: a helper called from inside a worklet can be missing from its closure
9
- * on the UI thread. Free of React Native imports, so `bun test` reaches it all.
9
+ * on the UI thread. Free of React Native imports, so a unit test reaches it all.
10
10
  */
11
11
 
12
12
  import type { ScrollEdge, ScrollOrientation } from "./scroll-maths";
@@ -5,10 +5,10 @@
5
5
  * **Every function here is a self-contained worklet.** A module-scope helper
6
6
  * called from inside a worklet can be missing from that worklet's closure on
7
7
  * the UI thread, which surfaces as `undefined is not a function` mid-scroll and
8
- * is invisible to `bun test`. So each function writes its own clamp inline and
8
+ * is invisible to a unit test. So each function writes its own clamp inline and
9
9
  * none of them calls another — do not "tidy" the repetition into a helper.
10
10
  *
11
- * Free of React Native imports, so the whole table is reachable from `bun test`.
11
+ * Free of React Native imports, so the whole table is unit-testable.
12
12
  */
13
13
 
14
14
  /** The axis a scrollable moves along. */
@@ -27,7 +27,7 @@ export type WrapTextChildrenOptions = {
27
27
  * With `asChild` the children are returned untouched — see
28
28
  * {@link WrapTextChildrenOptions.asChild}.
29
29
  *
30
- * Free of React Native imports, so `bun test` reaches it.
30
+ * Free of React Native imports, so it is unit-testable.
31
31
  */
32
32
  export function wrapTextChildren(
33
33
  children: ReactNode,
@@ -9,8 +9,15 @@ import { join } from "node:path";
9
9
  * It lives in a `.test.ts` on purpose. Nine suites need to know what the
10
10
  * palette declares, and nine hand-rolled regexes drifted from each other and
11
11
  * from the file. It also reads from disk, so it could never ship to a React
12
- * Native app — and the registry builder skips `*.test.ts`, which keeps it out
13
- * of what `delacour add styles` copies. See `packages/cli/src/registry/classify.ts`.
12
+ * Native app — and the registry ships a `*.test.ts` only in an item's `tests`,
13
+ * which `delacour add` copies only under `--tests`. See
14
+ * `packages/cli/src/registry/classify.ts`.
15
+ *
16
+ * It is also the one place a suite gets `theme.css` or `tokens.css` from. A
17
+ * copied test lands wherever the consumer keeps that folder, so a read of
18
+ * `../../styles/theme.css` names a file that is not there; an import of
19
+ * `THEME_CSS` is rewritten with the copy and still resolves. The registry
20
+ * builder fails on the first kind.
14
21
  *
15
22
  * Import it from a sibling suite:
16
23
  *
@@ -76,8 +76,8 @@
76
76
  /*
77
77
  * The neutral ramp shadcn ships today, in both themes: five greys, not
78
78
  * five hues. It is what a fresh `shadcn init` writes and what the
79
- * default preset on /theme resolves to — `emit.test.ts` holds the
80
- * two equal. An accent recolours all five.
79
+ * default preset on /theme resolves to — the
80
+ * two must stay equal. An accent recolours all five.
81
81
  */
82
82
  --chart-1: oklch(0.87 0 0);
83
83
  --chart-2: oklch(0.556 0 0);
@@ -325,7 +325,7 @@
325
325
  * step. None of these are light/dark dependent; a corner does not change
326
326
  * shape at dusk.
327
327
  *
328
- * `styles/geometry.test.ts` asserts this block and `tokens.css` agree,
328
+ * This block and `tokens.css` must agree,
329
329
  * because two hand-maintained copies of one number always drift.
330
330
  */
331
331
  @variant native {
@@ -379,8 +379,7 @@
379
379
  * reach it.
380
380
  *
381
381
  * A name added to a `@variant` block and forgotten here is declared but
382
- * unreachable — no `bg-*` will exist for it. `styles/theme-tokens.test.ts`
383
- * fails on the gap.
382
+ * unreachable — no `bg-*` will exist for it. Keep the two in step.
384
383
  */
385
384
  @theme inline {
386
385
  --color-background: var(--background);