gooee 0.52.0 → 1.0.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 (269) hide show
  1. package/README.md +10 -3
  2. package/package.json +6 -2
  3. package/scripts/add.js +181 -42
  4. package/src/base.css +3 -1
  5. package/src/components/Accordion/Accordion.module.css +7 -5
  6. package/src/components/Accordion/Accordion.tsx +13 -11
  7. package/src/components/Accordion/Accordion.vue +16 -15
  8. package/src/components/Accordion/AccordionItem.vue +8 -7
  9. package/src/components/Alert/Alert.module.css +9 -7
  10. package/src/components/Alert/Alert.tsx +25 -16
  11. package/src/components/Alert/Alert.vue +31 -27
  12. package/src/components/AlertDialog/AlertDialog.module.css +2 -0
  13. package/src/components/AlertDialog/AlertDialog.tsx +8 -7
  14. package/src/components/AlertDialog/AlertDialog.vue +25 -23
  15. package/src/components/AnimatedNumber/AnimatedNumber.module.css +5 -3
  16. package/src/components/AnimatedNumber/AnimatedNumber.tsx +6 -6
  17. package/src/components/AnimatedNumber/AnimatedNumber.vue +5 -5
  18. package/src/components/AspectRatio/AspectRatio.module.css +2 -0
  19. package/src/components/AspectRatio/AspectRatio.tsx +3 -3
  20. package/src/components/AspectRatio/AspectRatio.vue +5 -8
  21. package/src/components/Avatar/Avatar.module.css +10 -8
  22. package/src/components/Avatar/Avatar.tsx +4 -3
  23. package/src/components/Avatar/Avatar.vue +17 -19
  24. package/src/components/Avatar/index.ts +0 -2
  25. package/src/components/AvatarGroup/AvatarGroup.module.css +11 -9
  26. package/src/components/AvatarGroup/AvatarGroup.tsx +4 -4
  27. package/src/components/AvatarGroup/AvatarGroup.vue +13 -16
  28. package/src/components/Badge/Badge.module.css +6 -4
  29. package/src/components/Badge/Badge.tsx +3 -3
  30. package/src/components/Badge/Badge.vue +15 -14
  31. package/src/components/Breadcrumb/Breadcrumb.module.css +5 -3
  32. package/src/components/Breadcrumb/Breadcrumb.tsx +20 -12
  33. package/src/components/Breadcrumb/Breadcrumb.vue +33 -25
  34. package/src/components/Button/Button.module.css +16 -14
  35. package/src/components/Button/Button.tsx +6 -4
  36. package/src/components/Button/Button.vue +42 -33
  37. package/src/components/ButtonGroup/ButtonGroup.module.css +2 -0
  38. package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
  39. package/src/components/ButtonGroup/ButtonGroup.vue +9 -12
  40. package/src/components/Card/Card.module.css +6 -4
  41. package/src/components/Card/Card.tsx +6 -6
  42. package/src/components/Card/Card.vue +18 -21
  43. package/src/components/Center/Center.module.css +2 -0
  44. package/src/components/Center/Center.tsx +1 -1
  45. package/src/components/Center/Center.vue +18 -15
  46. package/src/components/Checkbox/Checkbox.module.css +10 -8
  47. package/src/components/Checkbox/Checkbox.tsx +7 -5
  48. package/src/components/Checkbox/Checkbox.vue +29 -31
  49. package/src/components/CheckboxGroup/CheckboxGroup.module.css +3 -1
  50. package/src/components/CheckboxGroup/CheckboxGroup.tsx +4 -4
  51. package/src/components/CheckboxGroup/CheckboxGroup.vue +33 -30
  52. package/src/components/Cluster/Cluster.module.css +2 -0
  53. package/src/components/Cluster/Cluster.tsx +1 -1
  54. package/src/components/Cluster/Cluster.vue +21 -17
  55. package/src/components/CodeBlock/CodeBlock.module.css +12 -10
  56. package/src/components/CodeBlock/CodeBlock.tsx +18 -10
  57. package/src/components/CodeBlock/CodeBlock.vue +30 -27
  58. package/src/components/CodeBlock/highlight.ts +1 -1
  59. package/src/components/Collapsible/Collapsible.module.css +7 -5
  60. package/src/components/Collapsible/Collapsible.tsx +7 -6
  61. package/src/components/Collapsible/Collapsible.vue +30 -26
  62. package/src/components/Container/Container.module.css +2 -0
  63. package/src/components/Container/Container.tsx +1 -1
  64. package/src/components/Container/Container.vue +13 -12
  65. package/src/components/CopyButton/CopyButton.module.css +20 -18
  66. package/src/components/CopyButton/CopyButton.tsx +21 -14
  67. package/src/components/CopyButton/CopyButton.vue +41 -31
  68. package/src/components/Dial/Dial.module.css +26 -11
  69. package/src/components/Dial/Dial.tsx +18 -18
  70. package/src/components/Dial/Dial.vue +57 -60
  71. package/src/components/Dialog/Dialog.module.css +4 -2
  72. package/src/components/Dialog/Dialog.tsx +22 -13
  73. package/src/components/Dialog/Dialog.vue +34 -30
  74. package/src/components/Divider/Divider.module.css +5 -3
  75. package/src/components/Divider/Divider.tsx +6 -4
  76. package/src/components/Divider/Divider.vue +13 -16
  77. package/src/components/DropdownMenu/DropdownMenu.module.css +8 -6
  78. package/src/components/DropdownMenu/DropdownMenu.tsx +11 -8
  79. package/src/components/DropdownMenu/DropdownMenu.vue +24 -27
  80. package/src/components/EmptyState/EmptyState.module.css +6 -4
  81. package/src/components/EmptyState/EmptyState.tsx +6 -6
  82. package/src/components/EmptyState/EmptyState.vue +14 -17
  83. package/src/components/Fab/Fab.module.css +19 -17
  84. package/src/components/Fab/Fab.tsx +11 -9
  85. package/src/components/Fab/Fab.vue +29 -26
  86. package/src/components/Fieldset/Fieldset.module.css +2 -0
  87. package/src/components/Fieldset/Fieldset.tsx +4 -3
  88. package/src/components/Fieldset/Fieldset.vue +4 -4
  89. package/src/components/FormField/FormField.module.css +5 -3
  90. package/src/components/FormField/FormField.tsx +7 -7
  91. package/src/components/FormField/FormField.vue +4 -4
  92. package/src/components/Grid/Grid.module.css +2 -0
  93. package/src/components/Grid/Grid.tsx +1 -1
  94. package/src/components/Grid/Grid.vue +25 -22
  95. package/src/components/HoldToConfirm/HoldToConfirm.module.css +13 -11
  96. package/src/components/HoldToConfirm/HoldToConfirm.tsx +11 -9
  97. package/src/components/HoldToConfirm/HoldToConfirm.vue +37 -32
  98. package/src/components/IconButton/IconButton.module.css +7 -5
  99. package/src/components/IconButton/IconButton.tsx +2 -1
  100. package/src/components/IconButton/IconButton.vue +15 -14
  101. package/src/components/Input/Input.module.css +12 -10
  102. package/src/components/Input/Input.tsx +9 -7
  103. package/src/components/Input/Input.vue +45 -35
  104. package/src/components/InputGroup/InputGroup.module.css +8 -6
  105. package/src/components/InputGroup/InputGroup.tsx +5 -4
  106. package/src/components/InputGroup/InputGroup.vue +41 -36
  107. package/src/components/Kbd/Kbd.module.css +9 -7
  108. package/src/components/Kbd/Kbd.tsx +1 -1
  109. package/src/components/Kbd/Kbd.vue +1 -1
  110. package/src/components/Link/Link.module.css +4 -2
  111. package/src/components/Link/Link.tsx +4 -3
  112. package/src/components/Link/Link.vue +13 -16
  113. package/src/components/LivePill/LivePill.module.css +39 -37
  114. package/src/components/LivePill/LivePill.tsx +11 -10
  115. package/src/components/LivePill/LivePill.vue +38 -40
  116. package/src/components/Meter/Meter.module.css +5 -3
  117. package/src/components/Meter/Meter.tsx +9 -8
  118. package/src/components/Meter/Meter.vue +52 -43
  119. package/src/components/MorphButton/MorphButton.module.css +11 -9
  120. package/src/components/MorphButton/MorphButton.tsx +20 -10
  121. package/src/components/MorphButton/MorphButton.vue +29 -25
  122. package/src/components/NumberInput/NumberInput.module.css +7 -5
  123. package/src/components/NumberInput/NumberInput.tsx +11 -8
  124. package/src/components/NumberInput/NumberInput.vue +69 -57
  125. package/src/components/Pagination/Pagination.module.css +147 -5
  126. package/src/components/Pagination/Pagination.tsx +216 -41
  127. package/src/components/Pagination/Pagination.vue +201 -36
  128. package/src/components/Pagination/labels.ts +38 -0
  129. package/src/components/PasswordInput/PasswordInput.module.css +10 -8
  130. package/src/components/PasswordInput/PasswordInput.tsx +15 -7
  131. package/src/components/PasswordInput/PasswordInput.vue +20 -16
  132. package/src/components/PasswordInput/index.ts +1 -1
  133. package/src/components/PickerWheel/DateWheel.vue +20 -12
  134. package/src/components/PickerWheel/PickerWheel.module.css +15 -6
  135. package/src/components/PickerWheel/PickerWheel.tsx +70 -44
  136. package/src/components/PickerWheel/PickerWheel.vue +39 -38
  137. package/src/components/PickerWheel/TimeWheel.vue +23 -21
  138. package/src/components/PickerWheel/WheelColumn.vue +7 -5
  139. package/src/components/Popover/Popover.module.css +5 -3
  140. package/src/components/Popover/Popover.tsx +17 -8
  141. package/src/components/Popover/Popover.vue +26 -25
  142. package/src/components/ProgressBar/ProgressBar.module.css +4 -2
  143. package/src/components/ProgressBar/ProgressBar.tsx +6 -5
  144. package/src/components/ProgressBar/ProgressBar.vue +28 -25
  145. package/src/components/Prose/Prose.module.css +5 -3
  146. package/src/components/Prose/Prose.tsx +1 -1
  147. package/src/components/Prose/Prose.vue +5 -8
  148. package/src/components/Radio/Radio.module.css +10 -8
  149. package/src/components/Radio/Radio.tsx +10 -8
  150. package/src/components/Radio/Radio.vue +8 -8
  151. package/src/components/Radio/RadioGroup.vue +33 -35
  152. package/src/components/Radio/radioContext.ts +12 -0
  153. package/src/components/Retime/Retime.vue +25 -22
  154. package/src/components/RulerScrubber/RulerScrubber.module.css +11 -2
  155. package/src/components/RulerScrubber/RulerScrubber.tsx +19 -18
  156. package/src/components/RulerScrubber/RulerScrubber.vue +50 -54
  157. package/src/components/ScrollArea/ScrollArea.module.css +17 -15
  158. package/src/components/ScrollArea/ScrollArea.tsx +5 -4
  159. package/src/components/ScrollArea/ScrollArea.vue +15 -17
  160. package/src/components/SearchInput/SearchInput.module.css +6 -4
  161. package/src/components/SearchInput/SearchInput.tsx +15 -8
  162. package/src/components/SearchInput/SearchInput.vue +20 -17
  163. package/src/components/SearchInput/index.ts +1 -1
  164. package/src/components/SegmentedControl/SegmentedControl.module.css +7 -5
  165. package/src/components/SegmentedControl/SegmentedControl.tsx +9 -5
  166. package/src/components/SegmentedControl/SegmentedControl.vue +25 -29
  167. package/src/components/Select/Select.module.css +19 -17
  168. package/src/components/Select/Select.tsx +30 -17
  169. package/src/components/Select/Select.vue +62 -57
  170. package/src/components/Sheet/Sheet.module.css +6 -4
  171. package/src/components/Sheet/Sheet.tsx +39 -29
  172. package/src/components/Sheet/Sheet.vue +46 -40
  173. package/src/components/Skeleton/Skeleton.module.css +4 -2
  174. package/src/components/Skeleton/Skeleton.tsx +3 -2
  175. package/src/components/Skeleton/Skeleton.vue +16 -18
  176. package/src/components/Slider/Slider.module.css +14 -12
  177. package/src/components/Slider/Slider.tsx +20 -9
  178. package/src/components/Slider/Slider.vue +47 -37
  179. package/src/components/Spinner/Spinner.module.css +2 -0
  180. package/src/components/Spinner/Spinner.tsx +3 -3
  181. package/src/components/Spinner/Spinner.vue +9 -12
  182. package/src/components/Split/Split.module.css +2 -0
  183. package/src/components/Split/Split.tsx +3 -3
  184. package/src/components/Split/Split.vue +19 -17
  185. package/src/components/SplitFlap/SplitFlap.module.css +9 -7
  186. package/src/components/SplitFlap/SplitFlap.tsx +2 -2
  187. package/src/components/SplitFlap/SplitFlap.vue +24 -21
  188. package/src/components/Stack/Stack.module.css +2 -0
  189. package/src/components/Stack/Stack.tsx +1 -1
  190. package/src/components/Stack/Stack.vue +13 -12
  191. package/src/components/SwipeDeck/SwipeDeck.module.css +13 -11
  192. package/src/components/SwipeDeck/SwipeDeck.tsx +23 -28
  193. package/src/components/SwipeDeck/SwipeDeck.vue +32 -38
  194. package/src/components/Switch/Switch.module.css +10 -8
  195. package/src/components/Switch/Switch.tsx +6 -5
  196. package/src/components/Switch/Switch.vue +22 -24
  197. package/src/components/Table/Table.module.css +24 -22
  198. package/src/components/Table/Table.tsx +27 -30
  199. package/src/components/Table/Table.vue +93 -79
  200. package/src/components/TableOfContents/TableOfContents.module.css +9 -7
  201. package/src/components/TableOfContents/TableOfContents.tsx +8 -8
  202. package/src/components/TableOfContents/TableOfContents.vue +20 -23
  203. package/src/components/Tabs/Tab.vue +3 -0
  204. package/src/components/Tabs/TabList.vue +2 -2
  205. package/src/components/Tabs/TabPanel.vue +2 -0
  206. package/src/components/Tabs/Tabs.module.css +4 -2
  207. package/src/components/Tabs/Tabs.tsx +10 -5
  208. package/src/components/Tabs/Tabs.vue +1 -1
  209. package/src/components/Tag/Tag.module.css +12 -10
  210. package/src/components/Tag/Tag.tsx +13 -15
  211. package/src/components/Tag/Tag.vue +12 -14
  212. package/src/components/Textarea/Textarea.module.css +8 -6
  213. package/src/components/Textarea/Textarea.tsx +4 -3
  214. package/src/components/Textarea/Textarea.vue +32 -34
  215. package/src/components/ThemeToggle/ThemeToggle.module.css +2 -0
  216. package/src/components/ThemeToggle/ThemeToggle.tsx +7 -7
  217. package/src/components/ThemeToggle/ThemeToggle.vue +24 -22
  218. package/src/components/Toast/Toast.module.css +17 -15
  219. package/src/components/Toast/Toast.tsx +51 -34
  220. package/src/components/Toast/Toast.vue +35 -24
  221. package/src/components/Toast/ToastItem.vue +17 -16
  222. package/src/components/Toggle/Toggle.module.css +11 -9
  223. package/src/components/Toggle/Toggle.tsx +3 -2
  224. package/src/components/Toggle/Toggle.vue +13 -15
  225. package/src/components/Tooltip/Tooltip.module.css +5 -3
  226. package/src/components/Tooltip/Tooltip.tsx +1 -0
  227. package/src/components/Tooltip/Tooltip.vue +13 -18
  228. package/src/components/VisuallyHidden/VisuallyHidden.module.css +2 -0
  229. package/src/components/VisuallyHidden/VisuallyHidden.tsx +1 -1
  230. package/src/components/VisuallyHidden/VisuallyHidden.vue +5 -8
  231. package/src/{internal → icons}/icons.module.css +4 -2
  232. package/src/{internal → icons}/icons.tsx +15 -16
  233. package/src/internal/FieldMessage.module.css +5 -3
  234. package/src/internal/FieldMessage.tsx +2 -2
  235. package/src/internal/FieldMessage.vue +2 -2
  236. package/src/internal/Roll.module.css +5 -3
  237. package/src/internal/feel.ts +12 -10
  238. package/src/internal/fling.ts +3 -3
  239. package/src/internal/liquid.ts +12 -10
  240. package/src/internal/liquidMatter.ts +1 -1
  241. package/src/internal/liquidMore.ts +7 -7
  242. package/src/internal/motion/checkbox.ts +4 -4
  243. package/src/internal/motion/fling.ts +19 -9
  244. package/src/internal/motion/holdToConfirm.ts +3 -3
  245. package/src/internal/motion/index.ts +8 -6
  246. package/src/internal/motion/liquid.ts +16 -4
  247. package/src/internal/motion/liquidMatter.ts +8 -6
  248. package/src/internal/motion/liquidMore.ts +44 -25
  249. package/src/internal/motion/livePill.ts +1 -1
  250. package/src/internal/motion/numberInput.ts +2 -2
  251. package/src/internal/motion/pickerWheel.ts +7 -4
  252. package/src/internal/motion/ruler.ts +1 -1
  253. package/src/internal/motion/scrollArea.ts +3 -3
  254. package/src/internal/motion/scrollFrame.ts +9 -7
  255. package/src/internal/motion/scrubber.ts +39 -20
  256. package/src/internal/motion/slider.ts +38 -4
  257. package/src/internal/motion/softPress.ts +10 -9
  258. package/src/internal/motion/splitFlap.ts +4 -4
  259. package/src/internal/motion/swipeDeck.ts +38 -7
  260. package/src/internal/motion/table.ts +3 -6
  261. package/src/internal/motion/themeIcon.ts +1 -1
  262. package/src/internal/motion/themeReveal.ts +1 -1
  263. package/src/internal/motion/toast.ts +3 -3
  264. package/src/internal/motion.ts +7 -8
  265. package/src/internal/scrollFrame.ts +3 -3
  266. package/src/internal/useScrub.ts +1 -15
  267. package/src/internal/vue/useScrub.ts +2 -6
  268. package/src/tokens.css +81 -421
  269. package/src/{internal/vueIcons.ts → icons/vue.ts} +5 -5
@@ -2,16 +2,13 @@
2
2
  import styles from './VisuallyHidden.module.css'
3
3
 
4
4
  // The Vue VisuallyHidden: the same look (VisuallyHidden.module.css) as the React one.
5
- withDefaults(
6
- defineProps<{
7
- /** Shows the content while something inside it has keyboard focus, such as a skip link. */
8
- focusable?: boolean
9
- }>(),
10
- { focusable: false },
11
- )
5
+ const { focusable = false } = defineProps<{
6
+ /** Shows the content while something inside it has keyboard focus, such as a skip link. */
7
+ focusable?: boolean
8
+ }>()
12
9
  defineSlots<{ default?: () => unknown }>()
13
10
  </script>
14
11
 
15
12
  <template>
16
- <span :class="focusable ? styles.focusable : styles.root"><slot /></span>
13
+ <span :class="focusable ? styles.focusable : styles.root" data-slot="visually-hidden"><slot /></span>
17
14
  </template>
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  /* Each icon's motion plays once when the control it sits in is pointed at or focused, or when the icon
2
3
  itself is. Nothing plays with reduced motion. Moves stay within about a tenth of the icon, so it never
3
4
  leaves its box. */
@@ -10,7 +11,7 @@
10
11
  :global(:is(a, button, label, summary, [role="button"], [role="menuitem"], [role="tab"], [role="option"], [role="link"])):is(:hover, :focus-visible) .icon,
11
12
  .icon:hover {
12
13
  animation-duration: var(--gooee-motion-slow);
13
- animation-timing-function: var(--gooee-ease-out);
14
+ animation-timing-function: var(--gooee-ease-morph);
14
15
  }
15
16
  :global(:is(a, button, label, summary, [role="button"], [role="menuitem"], [role="tab"], [role="option"], [role="link"])):is(:hover, :focus-visible) .icon[data-motion="nudge-r"],
16
17
  .icon[data-motion="nudge-r"]:hover { animation-name: nudge-r; }
@@ -39,7 +40,7 @@
39
40
  :global(:is(a, button, label, summary, [role="button"], [role="menuitem"], [role="tab"], [role="option"], [role="link"])):is(:hover, :focus-visible) .icon[data-motion="draw"] > *,
40
41
  .icon[data-motion="draw"]:hover > * {
41
42
  stroke-dasharray: 1;
42
- animation: draw var(--gooee-motion-slower) var(--gooee-ease-out);
43
+ animation: draw var(--gooee-motion-slower) var(--gooee-ease-morph);
43
44
  }
44
45
  }
45
46
 
@@ -72,3 +73,4 @@
72
73
  }
73
74
  /* Every name is local to this file, so a bundler's CSS modules (Turbopack too) rename them in step. */
74
75
  @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
76
+ }
@@ -69,26 +69,12 @@ export const ErrorIcon = (p: IconProps) => (
69
69
  <path d="M9.5 9.5l5 5M14.5 9.5l-5 5" />
70
70
  </Svg>
71
71
  )
72
- export const EyeIcon = (p: IconProps) => (
73
- <Svg m="blink" {...p}>
74
- <path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z" />
75
- <circle cx="12" cy="12" r="2.75" />
76
- </Svg>
77
- )
78
- export const CodeIcon = (p: IconProps) => <Svg m="draw" {...p}><path d="M8.5 7.5L4 12l4.5 4.5M15.5 7.5L20 12l-4.5 4.5" /></Svg>
79
72
  export const SearchIcon = (p: IconProps) => (
80
73
  <Svg m="wiggle" {...p}>
81
74
  <circle cx="11" cy="11" r="6.5" />
82
75
  <path d="M16 16l4 4" />
83
76
  </Svg>
84
77
  )
85
- export const SunIcon = (p: IconProps) => (
86
- <Svg m="turn" {...p}>
87
- <circle cx="12" cy="12" r="4" />
88
- <path d="M12 2.5v2M12 19.5v2M4.6 4.6l1.4 1.4M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4L6 18M18 6l1.4-1.4" />
89
- </Svg>
90
- )
91
- export const MoonIcon = (p: IconProps) => <Svg m="wiggle" {...p}><path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z" /></Svg>
92
78
  export const PlusIcon = (p: IconProps) => <Svg m="pop" {...p}><path d="M12 5v14M5 12h14" /></Svg>
93
79
  export const MinusIcon = (p: IconProps) => <Svg m="pop" {...p}><path d="M5 12h14" /></Svg>
94
80
  export const MenuIcon = (p: IconProps) => <Svg m="draw" {...p}><path d="M4 7h16M4 12h16M4 17h10" /></Svg>
@@ -195,7 +181,21 @@ export const GripIcon = (p: IconProps) => (
195
181
  </Svg>
196
182
  )
197
183
  export const FilterIcon = (p: IconProps) => <Svg m="draw" {...p}><path d="M4.5 6h15l-5.75 7v5.5l-3.5-2V13z" /></Svg>
198
-
184
+ export const PaperclipIcon = (p: IconProps) => <Svg m="draw" {...p}><path d="M19 11.5l-7.25 7.25a4.6 4.6 0 0 1-6.5-6.5L12.5 5a3 3 0 0 1 4.25 4.25l-7 7a1.5 1.5 0 0 1-2.1-2.1l6.6-6.65" /></Svg>
185
+ export const EyeIcon = (p: IconProps) => (
186
+ <Svg m="blink" {...p}>
187
+ <path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z" />
188
+ <circle cx="12" cy="12" r="2.75" />
189
+ </Svg>
190
+ )
191
+ export const CodeIcon = (p: IconProps) => <Svg m="draw" {...p}><path d="M8.5 7.5L4 12l4.5 4.5M15.5 7.5L20 12l-4.5 4.5" /></Svg>
192
+ export const SunIcon = (p: IconProps) => (
193
+ <Svg m="turn" {...p}>
194
+ <circle cx="12" cy="12" r="4" />
195
+ <path d="M12 2.5v2M12 19.5v2M4.6 4.6l1.4 1.4M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4L6 18M18 6l1.4-1.4" />
196
+ </Svg>
197
+ )
198
+ export const MoonIcon = (p: IconProps) => <Svg m="wiggle" {...p}><path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z" /></Svg>
199
199
  export const BookIcon = (p: IconProps) => (
200
200
  <Svg m="bounce" {...p}>
201
201
  <path d="M12 6.5C10.5 5.3 8.2 4.75 4 4.75v13.5c4.2 0 6.5.55 8 1.75 1.5-1.2 3.8-1.75 8-1.75V4.75c-4.2 0-6.5.55-8 1.75z" />
@@ -298,7 +298,6 @@ export const LinkIcon = (p: IconProps) => (
298
298
  <path d="M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1" />
299
299
  </Svg>
300
300
  )
301
- export const PaperclipIcon = (p: IconProps) => <Svg m="draw" {...p}><path d="M19 11.5l-7.25 7.25a4.6 4.6 0 0 1-6.5-6.5L12.5 5a3 3 0 0 1 4.25 4.25l-7 7a1.5 1.5 0 0 1-2.1-2.1l6.6-6.65" /></Svg>
302
301
  export const UploadIcon = (p: IconProps) => (
303
302
  <Svg m="nudge-u" {...p}>
304
303
  <path d="M12 15V4M7.5 8.5L12 4l4.5 4.5" />
@@ -1,12 +1,13 @@
1
+ @layer gooee.components {
1
2
  .collapse {
2
3
  display: grid;
3
4
  grid-template-rows: 0fr;
4
5
  opacity: 0;
5
6
  transform: translateY(calc(var(--gooee-shift-sm) * -1));
6
7
  transition:
7
- grid-template-rows var(--gooee-motion-base) var(--gooee-ease-out),
8
- opacity var(--gooee-motion-base) var(--gooee-ease-out),
9
- transform var(--gooee-motion-base) var(--gooee-ease-out);
8
+ grid-template-rows var(--gooee-motion-base) var(--gooee-ease-morph),
9
+ opacity var(--gooee-motion-base) var(--gooee-ease-morph),
10
+ transform var(--gooee-motion-base) var(--gooee-ease-morph);
10
11
  }
11
12
 
12
13
  .open {
@@ -47,3 +48,4 @@
47
48
  stroke-width: 1.75;
48
49
  stroke-linecap: round;
49
50
  }
51
+ }
@@ -21,7 +21,7 @@ export function FieldMessage({ helpId, errorId, help, error }: Props) {
21
21
  {help && (
22
22
  <div className={cx(styles.collapse, !hasError && styles.open)}>
23
23
  <div className={styles.inner}>
24
- <p id={helpId} className={styles.help}>{help}</p>
24
+ <p id={helpId} data-slot="field-help" className={styles.help}>{help}</p>
25
25
  </div>
26
26
  </div>
27
27
  )}
@@ -29,7 +29,7 @@ export function FieldMessage({ helpId, errorId, help, error }: Props) {
29
29
  <div className={styles.inner}>
30
30
  {shown ? (
31
31
  // Hidden from screen readers while it closes, so only the live error is read.
32
- <p id={hasError ? errorId : undefined} className={styles.error} aria-hidden={hasError ? undefined : true}>
32
+ <p id={hasError ? errorId : undefined} data-slot="field-error" className={styles.error} aria-hidden={hasError ? undefined : true}>
33
33
  <svg viewBox="0 0 16 16" aria-hidden="true" className={styles.mark}>
34
34
  <circle cx="8" cy="8" r="7" />
35
35
  <path d="M8 4.5v4.25M8 11v.01" />
@@ -24,13 +24,13 @@ const shown = computed(() => (hasError.value ? props.error : lastError.value))
24
24
  <template>
25
25
  <div v-if="help" :class="[styles.collapse, !hasError && styles.open]">
26
26
  <div :class="styles.inner">
27
- <p :id="helpId" :class="styles.help">{{ help }}</p>
27
+ <p :id="helpId" data-slot="field-help" :class="styles.help">{{ help }}</p>
28
28
  </div>
29
29
  </div>
30
30
  <div :class="[styles.collapse, hasError && styles.open]" aria-live="polite">
31
31
  <div :class="styles.inner">
32
32
  <!-- Hidden from screen readers while it closes, so only the live error is read. -->
33
- <p v-if="shown" :id="hasError ? errorId : undefined" :class="styles.error" :aria-hidden="hasError ? undefined : true">
33
+ <p v-if="shown" :id="hasError ? errorId : undefined" data-slot="field-error" :class="styles.error" :aria-hidden="hasError ? undefined : true">
34
34
  <svg viewBox="0 0 16 16" aria-hidden="true" :class="styles.mark">
35
35
  <circle cx="8" cy="8" r="7" />
36
36
  <path d="M8 4.5v4.25M8 11v.01" />
@@ -1,15 +1,16 @@
1
+ @layer gooee.components {
1
2
  .roll {
2
3
  display: inline-grid;
3
4
  overflow: hidden;
4
5
  /* Room for descenders inside the clip, given back below so the line keeps its height. */
5
- padding-block-end: var(--gooee-rise-room);
6
- margin-block-end: calc(var(--gooee-rise-room) * -1);
6
+ padding-block-end: var(--gooee-text-rise-room, round(up, 0.14em, 4px));
7
+ margin-block-end: calc(var(--gooee-text-rise-room, round(up, 0.14em, 4px)) * -1);
7
8
  font-variant-numeric: tabular-nums;
8
9
  }
9
10
 
10
11
  .in {
11
12
  grid-area: 1 / 1;
12
- animation: rollUp var(--gooee-motion-fast) var(--gooee-ease-out);
13
+ animation: rollUp var(--gooee-motion-fast) var(--gooee-ease-morph);
13
14
  }
14
15
 
15
16
  .in[data-dir='down'] {
@@ -29,3 +30,4 @@
29
30
  opacity: 0;
30
31
  }
31
32
  }
33
+ }
@@ -83,7 +83,7 @@ export function bezier([x1, y1, x2, y2]: Curve) {
83
83
  }
84
84
  }
85
85
 
86
- export type MorphOptions = {
86
+ export type MorphToOptions = {
87
87
  from: number
88
88
  to: number
89
89
  /** Units per second at the start. Toward `to`, a let-go carries on at the hand's speed, so the move takes less time. */
@@ -96,12 +96,12 @@ export type MorphOptions = {
96
96
  onDone?: () => void
97
97
  }
98
98
 
99
- /** Runs from `from` to `to` on the curve and stops there. Returns a stop function. */
100
- export function morphTo({ from, to, velocity = 0, duration, curve = MORPH, onFrame, onDone }: MorphOptions) {
99
+ /** Runs from `from` to `to` on the curve and stops there. `stop` halts it where it is. */
100
+ export function morphTo({ from, to, velocity = 0, duration, curve = MORPH, onFrame, onDone }: MorphToOptions) {
101
101
  if (!duration || from === to) {
102
102
  onFrame(to)
103
103
  onDone?.()
104
- return () => {}
104
+ return { stop: () => {} }
105
105
  }
106
106
  const D = to - from
107
107
  // The curve starts at y1 / x1 times its average speed. A let-go toward `to` shortens the move until
@@ -126,13 +126,15 @@ export function morphTo({ from, to, velocity = 0, duration, curve = MORPH, onFra
126
126
  onFrame(from + D * ease(t))
127
127
  raf = requestAnimationFrame(step)
128
128
  })
129
- return () => {
130
- cancelAnimationFrame(raf)
131
- clearTimeout(backstop)
129
+ return {
130
+ stop() {
131
+ cancelAnimationFrame(raf)
132
+ clearTimeout(backstop)
133
+ },
132
134
  }
133
135
  }
134
136
 
135
- export type GlideOptions = Omit<MorphOptions, 'to' | 'onDone'> & {
137
+ export type GlideOptions = Omit<MorphToOptions, 'to' | 'onDone'> & {
136
138
  /** Where it comes to rest, given where the coast would end. */
137
139
  land: (end: number) => number
138
140
  /** How far a flick carries: its speed times this, in seconds. 0 lands under the hand. */
@@ -155,7 +157,7 @@ export function glide({ from, velocity = 0, land, coast = 0.2, maxSpeed = Infini
155
157
  }
156
158
  const v = clamp(velocity, -maxSpeed, maxSpeed)
157
159
  const to = land(from + v * coast)
158
- return { to, stop: morphTo({ from, to, velocity: v, duration, curve, onFrame, onDone: () => onDone?.(to) }) }
160
+ return { to, stop: morphTo({ from, to, velocity: v, duration, curve, onFrame, onDone: () => onDone?.(to) }).stop }
159
161
  }
160
162
 
161
163
  /** A number that moves toward a target on the curve, over `time()` ms from where it is. A time of 0 jumps. */
@@ -171,7 +173,7 @@ export function follow({ value = 0, time, curve, onFrame }: { value?: number; ti
171
173
  if (target === to) return
172
174
  to = target
173
175
  stop()
174
- stop = morphTo({ from: at, to, duration: time(), curve, onFrame: (v) => onFrame((at = v)) })
176
+ stop = morphTo({ from: at, to, duration: time(), curve, onFrame: (v) => onFrame((at = v)) }).stop
175
177
  },
176
178
  stop() {
177
179
  stop()
@@ -7,10 +7,10 @@ export { rubber, speedTracker, release }
7
7
  /** React's hold on createFling (motion/fling.ts): the panel's ref and its open state. */
8
8
  export function useFling(ref: RefObject<HTMLElement | null>, open: boolean, axis: 'x' | 'y') {
9
9
  const core = useRef<ReturnType<typeof createFling>>(null)
10
- core.current ??= createFling(() => ref.current, axis)
10
+ core.current ??= createFling(() => ref.current, { axis })
11
11
  const fling = core.current
12
12
 
13
- useEffect(() => () => fling.stop(), [fling])
13
+ useEffect(() => () => fling.destroy(), [fling])
14
14
  useEffect(() => {
15
15
  if (open) fling.opened()
16
16
  else fling.closed()
@@ -31,7 +31,7 @@ export function useDragClose(ref: RefObject<HTMLElement | null>, open: boolean,
31
31
  })
32
32
  const drag = core.current
33
33
 
34
- useEffect(() => () => drag.fling.stop(), [drag])
34
+ useEffect(() => () => drag.destroy(), [drag])
35
35
  useEffect(() => {
36
36
  if (open) drag.fling.opened()
37
37
  else drag.fling.closed()
@@ -1,20 +1,22 @@
1
1
  import { useLayoutEffect, useRef, type RefObject } from 'react'
2
- import { createDialogMorph, createLiquid, createStretch, type LiquidOrigin as Origin, type StretchBox } from './motion/liquid'
2
+ import { createDialogMorph, createMorph, createStretch, type MorphOrigin, type StretchBox } from './motion/liquid'
3
3
 
4
4
  export { startShape, stretch, type StretchBox } from './motion/liquid'
5
5
 
6
6
  /** What the panel grows from: the opener's ref, or a function that finds the opener or a rectangle at open time. */
7
- export type LiquidOrigin = RefObject<HTMLElement | null> | (() => HTMLElement | DOMRect | null)
7
+ export type MorphOriginRef = RefObject<HTMLElement | null> | (() => HTMLElement | DOMRect | null)
8
8
 
9
- /** React's hold on createLiquid (motion/liquid.ts): grows when `state` turns open (once `ready`), folds when it turns closed. */
10
- export function useLiquid(panel: RefObject<HTMLElement | null>, origin: LiquidOrigin, state: 'open' | 'closed', ready: boolean) {
9
+ /** React's hold on createMorph (motion/liquid.ts): grows when `state` turns open (once `ready`), folds when it turns closed. */
10
+ export function useLiquid(panel: RefObject<HTMLElement | null>, origin: MorphOriginRef, state: 'open' | 'closed', ready: boolean) {
11
11
  const from = useRef(origin)
12
12
  from.current = origin
13
- const liquid = useRef<ReturnType<typeof createLiquid>>(null)
14
- liquid.current ??= createLiquid(() => panel.current, (() => {
15
- const o = from.current
16
- return typeof o === 'function' ? o() : o.current
17
- }) satisfies Origin)
13
+ const liquid = useRef<ReturnType<typeof createMorph>>(null)
14
+ liquid.current ??= createMorph(() => panel.current, {
15
+ origin: (() => {
16
+ const o = from.current
17
+ return typeof o === 'function' ? o() : o.current
18
+ }) satisfies MorphOrigin,
19
+ })
18
20
  useLayoutEffect(() => {
19
21
  if (ready) liquid.current!.play(state)
20
22
  // Plays once per open and once per close; the origin is read fresh each time.
@@ -51,7 +53,7 @@ export function useStretch(
51
53
  const fmt = useRef(place)
52
54
  fmt.current = place
53
55
  const run = useRef<ReturnType<typeof createStretch>>(null)
54
- run.current ??= createStretch(() => el.current, (b) => fmt.current(b), axis)
56
+ run.current ??= createStretch(() => el.current, { place: (b) => fmt.current(b), axis })
55
57
  useLayoutEffect(() => {
56
58
  run.current!.update(box, choice, ready)
57
59
  // Keyed on the choice and the box; `place` is a pure formatter.
@@ -17,7 +17,7 @@ export function useFlow(
17
17
  const inkRef = useRef(ink)
18
18
  inkRef.current = ink
19
19
  const flow = useRef<ReturnType<typeof createFlow>>(null)
20
- flow.current ??= createFlow(() => host.current, () => mark.current, { cls, line, ink: (d) => inkRef.current?.(d) })
20
+ flow.current ??= createFlow(() => mark.current, { host: () => host.current, className: cls, line, ink: (d) => inkRef.current?.(d) })
21
21
  useLayoutEffect(() => {
22
22
  flow.current!.update(place, choice, ready)
23
23
  // Keyed on the choice and the place; the rest is read when it runs.
@@ -1,23 +1,23 @@
1
1
  import { useEffect, type RefObject } from 'react'
2
- import { bead, edgeFlow } from './motion/liquidMore'
2
+ import { createBead, createEdgeFlow } from './motion/liquidMore'
3
3
 
4
4
  export { type Cup, cupLevel, cupPath, type Pour, pour, edgeLoops, type CheckMorph, checkLoops, type CopyState, copyRun, type CopyRun, beadLoops } from './motion/liquidMore'
5
5
 
6
- /** React's hold on edgeFlow (motion/liquidMore.ts): the field's focus edge flows round from where it was pressed. */
7
- export function useEdgeFlow(target: RefObject<HTMLElement | null>, host: RefObject<HTMLElement | null>, on: string, cls: string) {
6
+ /** React's hold on createEdgeFlow (motion/liquidMore.ts): the field's focus edge flows round from where it was pressed. */
7
+ export function useEdgeFlow(target: RefObject<HTMLElement | null>, host: RefObject<HTMLElement | null>, when: string, cls: string) {
8
8
  useEffect(() => {
9
9
  const el = target.current
10
10
  const root = host.current
11
11
  if (!el || !root) return
12
- return edgeFlow(el, root, on, cls)
13
- }, [target, host, on, cls])
12
+ return createEdgeFlow(el, { root, when, className: cls }).destroy
13
+ }, [target, host, when, cls])
14
14
  }
15
15
 
16
- /** React's hold on bead (motion/liquidMore.ts): the menu's hover fill follows focus from item to item. */
16
+ /** React's hold on createBead (motion/liquidMore.ts): the menu's hover fill follows focus from item to item. */
17
17
  export function useBead(panel: RefObject<HTMLElement | null>, on: boolean, cls: string) {
18
18
  useEffect(() => {
19
19
  const root = panel.current
20
20
  if (!root || !on) return
21
- return bead(root, cls)
21
+ return createBead(root, { className: cls }).destroy
22
22
  }, [panel, on, cls])
23
23
  }
@@ -1,6 +1,6 @@
1
1
  import { pour, type Pour } from './liquidMore'
2
2
 
3
- export type CheckState = 'off' | 'on' | 'mixed'
3
+ export type CheckState = 'unchecked' | 'checked' | 'indeterminate'
4
4
 
5
5
  /**
6
6
  * A checkbox's cup fill: ink pours in from the side that was pressed (a key fills it evenly from below),
@@ -21,15 +21,15 @@ export function createCheckboxPour(box: () => HTMLElement | null, cls: string, s
21
21
  set(state: CheckState) {
22
22
  const prev = was
23
23
  was = state
24
- const filled = state !== 'off'
25
- if ((prev !== 'off') === filled) return
24
+ const filled = state !== 'unchecked'
25
+ if ((prev !== 'unchecked') === filled) return
26
26
  const el = box()
27
27
  const at = pressedAt
28
28
  pressedAt = null
29
29
  if (!el) return
30
30
  const r = el.getBoundingClientRect()
31
31
  const side = at && performance.now() - at.t < 1000 ? Math.max(-1, Math.min(1, (at.x - r.left - r.width / 2) / (r.width / 2))) : 0
32
- const mark = el.querySelector<SVGPathElement>(prev === 'mixed' || state === 'mixed' ? '[data-mark="dash"]' : '[data-mark="tick"]')
32
+ const mark = el.querySelector<SVGPathElement>(prev === 'indeterminate' || state === 'indeterminate' ? '[data-mark="dash"]' : '[data-mark="tick"]')
33
33
  run = pour(el, mark, filled ? 1 : 0, side, cls, run)
34
34
  },
35
35
  destroy() {
@@ -1,5 +1,5 @@
1
1
  import { morphTo, rubber, speedTracker } from '../feel'
2
- import { morphCurve, readMotionMs } from '../motion'
2
+ import { morphCurve, motionMs } from '../motion'
3
3
 
4
4
  /** An element, or a function that returns it, for frameworks that hand it over later (a React ref). */
5
5
  export type Target = HTMLElement | (() => HTMLElement | null)
@@ -14,16 +14,21 @@ export type PointerLike = Pick<PointerEvent, 'clientY' | 'pointerId' | 'pointerT
14
14
  * reduced motion (0ms) jumps. Returns a stop function.
15
15
  */
16
16
  export function release(from: number, to: number, velocity: number, onFrame: (value: number) => void, onDone?: () => void) {
17
- return morphTo({ from, to, velocity, duration: readMotionMs('morph-out'), curve: morphCurve(), onFrame, onDone })
17
+ return morphTo({ from, to, velocity, duration: motionMs('morph-out'), curve: morphCurve(), onFrame, onDone }).stop
18
+ }
19
+
20
+ export type FlingOptions = {
21
+ /** The axis the hand drags along. */
22
+ axis: 'x' | 'y'
18
23
  }
19
24
 
20
25
  /**
21
26
  * A panel that the hand drags along one axis and lets go of. `fling` glides it to a place at the hand's
22
27
  * speed. While it runs, data-fluid on the panel turns its CSS motion off; once it closes on the way out,
23
28
  * the CSS close keyframes stay off too, so they do not start over. Call `opened` and `closed` as the
24
- * panel opens and closes.
29
+ * panel opens and closes. `stop` halts a glide where it is; `destroy` when the panel goes.
25
30
  */
26
- export function createFling(target: Target, axis: 'x' | 'y') {
31
+ export function createFling(target: Target, { axis }: FlingOptions) {
27
32
  let at = 0
28
33
  let to = 0
29
34
  let stop = () => {}
@@ -50,6 +55,7 @@ export function createFling(target: Target, axis: 'x' | 'y') {
50
55
  })
51
56
  },
52
57
  stop: () => stop(),
58
+ destroy: () => stop(),
53
59
  // Opened again, even mid-close on the same panel: it starts at rest, not where the old glide was going.
54
60
  opened() {
55
61
  stop()
@@ -83,10 +89,11 @@ export type DragCloseOptions = {
83
89
  /**
84
90
  * A bottom sheet the hand drags down to close. Feed it the pointer events of the part it is held by, or
85
91
  * call `listen` on that part. A let-go past a third of its height, or a flick down, closes it; any other
86
- * let-go glides it back.
92
+ * let-go glides it back. `destroy` stops listening and stops the glide.
87
93
  */
88
94
  export function createDragClose(target: Target, { onClose, isOpen, can = () => true }: DragCloseOptions) {
89
- const fling = createFling(target, 'y')
95
+ const fling = createFling(target, { axis: 'y' })
96
+ let ac = new AbortController()
90
97
  let drag: { y: number; dy: number; pointer: number; speed: ReturnType<typeof speedTracker> } | null = null
91
98
 
92
99
  const down = (e: PointerLike) => {
@@ -133,15 +140,18 @@ export function createDragClose(target: Target, { onClose, isOpen, can = () => t
133
140
  down,
134
141
  move,
135
142
  up,
136
- /** Listens on the part it is held by. Returns a function that stops listening. */
143
+ /** Listens on the part it is held by, until `destroy`. */
137
144
  listen(handle: HTMLElement) {
138
- const ac = new AbortController()
139
145
  const opts = { signal: ac.signal }
140
146
  handle.addEventListener('pointerdown', down, opts)
141
147
  handle.addEventListener('pointermove', move, opts)
142
148
  handle.addEventListener('pointerup', up, opts)
143
149
  handle.addEventListener('pointercancel', up, opts)
144
- return () => ac.abort()
150
+ },
151
+ destroy() {
152
+ ac.abort()
153
+ ac = new AbortController()
154
+ fling.destroy()
145
155
  },
146
156
  }
147
157
  }
@@ -1,6 +1,6 @@
1
1
  import { bezier } from '../feel'
2
2
  import { body, boxPath, lerp, loopsPath, pincher, seg, trace, type Box } from '../liquidPath'
3
- import { morphCurve, readMotionMs } from '../motion'
3
+ import { morphCurve, motionMs } from '../motion'
4
4
  import { frames, layer, morphEase, motionFor } from './liquidMatter'
5
5
 
6
6
  // The hold to confirm button's motion: the burning line on its edge and the cancel drop that buds out of it.
@@ -23,7 +23,7 @@ export const GUARD = 500
23
23
  */
24
24
  export function bud(row: HTMLElement, shell: HTMLElement, x: HTMLElement, way: 'in' | 'out', cls: string) {
25
25
  // 400ms both ways: the drop is small, and at the morph's 600ms the cancel button felt late to arrive.
26
- const ms = motionFor('reveal')
26
+ const ms = motionFor('morph-out')
27
27
  if (!ms) return null
28
28
  const box = (el: HTMLElement): Box => {
29
29
  const r = el.getBoundingClientRect(),
@@ -132,7 +132,7 @@ export function createFuse(run: () => SVGPathElement | null) {
132
132
  const rewind = () => {
133
133
  stop()
134
134
  const from = p
135
- const length = readMotionMs('fast')
135
+ const length = motionMs('fast')
136
136
  if (!length || !from) return paint(0)
137
137
  const ease = bezier(morphCurve())
138
138
  const t0 = performance.now()
@@ -1,20 +1,22 @@
1
1
  // gooee-motion: the motion of Gooee UI's parts, with no framework. Timing comes from the --gooee-*
2
2
  // tokens (gooee-tokens), so load those too; reduced motion sets them to 0 and every move jumps.
3
+ // Each create* function takes its element (or a function that returns it) and one options object. It
4
+ // returns plain methods, and destroy() cleans up.
3
5
 
4
6
  // Panels that grow out of what opened them, and highlights that stretch to a new choice.
5
- export { createLiquid, createDialogMorph, createStretch, stretch, startShape, type LiquidOrigin, type StretchBox } from './liquid'
7
+ export { createMorph, createDialogMorph, createStretch, type MorphOrigin, type MorphOptions, type StretchBox, type StretchOptions } from './liquid'
6
8
  // A highlight that flows to a new choice on a neck that thins and breaks.
7
9
  export { createFlow, type FlowOptions, type Place } from './liquidMatter'
8
10
  // A field's focus edge that flows round from the press, and a menu's hover bead.
9
- export { edgeFlow, bead } from './liquidMore'
11
+ export { createEdgeFlow, createBead, type EdgeFlowOptions, type BeadOptions } from './liquidMore'
10
12
  // A button whose edge dents under the finger.
11
13
  export { createSoftPress, type SoftLook, type SoftPressOptions } from './softPress'
12
14
  // Panels the hand drags and lets go of, and a sheet dragged down to close.
13
- export { createFling, createDragClose, release, type Fling, type DragCloseOptions, type Target } from './fling'
15
+ export { createFling, createDragClose, type Fling, type FlingOptions, type DragCloseOptions, type Target } from './fling'
14
16
  // A value turned by drag, keys and wheel that coasts and lands on a mark.
15
17
  export { createScrubber, type ScrubberOptions } from './scrubber'
16
18
  // One frame loop for everything that follows the page's scroll.
17
- export { onScrollFrame, bandProgress, easeToward, type ScrollFrame, type ScrollReader } from './scrollFrame'
19
+ export { createScrollFrame, bandProgress, easeToward, type ScrollFrame, type ScrollReader } from './scrollFrame'
18
20
  // The motion maths underneath: the morph curve, glides and follows.
19
- export { MORPH, bezier, morphTo, glide, follow, rubber, speedTracker, type Curve, type MorphOptions, type GlideOptions } from '../feel'
20
- export { motionMs, readMotionMs, easing, morphCurve, prefersReducedMotion, type MotionToken } from '../motion'
21
+ export { bezier, morphTo, glide, follow, rubber, speedTracker, type Curve, type MorphToOptions, type GlideOptions } from '../feel'
22
+ export { motionMs, easing, morphCurve, prefersReducedMotion, type MotionToken } from '../motion'
@@ -11,7 +11,12 @@ import { easing, morphCurve, motionMs, prefersReducedMotion } from '../motion'
11
11
  // runs instead.
12
12
 
13
13
  /** What the panel grows from: the opener element, or one found at open time, or a rectangle (such as the point of a right click). */
14
- export type LiquidOrigin = HTMLElement | DOMRect | (() => HTMLElement | DOMRect | null)
14
+ export type MorphOrigin = HTMLElement | DOMRect | (() => HTMLElement | DOMRect | null)
15
+
16
+ export type MorphOptions = {
17
+ /** Read fresh at each play. */
18
+ origin: MorphOrigin
19
+ }
15
20
 
16
21
  type El = HTMLElement | (() => HTMLElement | null)
17
22
  const get = (t: El) => (typeof t === 'function' ? t() : t)
@@ -101,7 +106,7 @@ function clipMorph(p: HTMLElement, found: HTMLElement | DOMRect, state: 'open' |
101
106
  * enter and exit animation down. Keep the panel in the page for --gooee-motion-morph-out after a close,
102
107
  * so the fold lands as it goes. The origin is read fresh each time.
103
108
  */
104
- export function createLiquid(panel: El, origin: LiquidOrigin) {
109
+ export function createMorph(panel: El, { origin }: MorphOptions) {
105
110
  let run: Animation | null = null
106
111
  return {
107
112
  play(state: 'open' | 'closed') {
@@ -205,12 +210,19 @@ export function stretch(node: HTMLElement, from: StretchBox, to: StretchBox, pla
205
210
  run.finished.then(done, done)
206
211
  }
207
212
 
213
+ export type StretchOptions = {
214
+ /** Turns a box into the highlight's transform. */
215
+ place: (b: StretchBox) => string
216
+ /** Along one row, or one column with 'y'. */
217
+ axis?: 'x' | 'y'
218
+ }
219
+
208
220
  /**
209
221
  * Liquid highlight: when the choice changes, the highlight stretches toward it (see stretch). Call
210
222
  * `update` with the highlight's box and the choice behind it whenever either may have changed; it runs
211
- * only on a change of choice, and a resize simply follows. Along one row, or one column with axis 'y'.
223
+ * only on a change of choice, and a resize simply follows.
212
224
  */
213
- export function createStretch(el: El, place: (b: StretchBox) => string, axis: 'x' | 'y' = 'x') {
225
+ export function createStretch(el: El, { place, axis = 'x' }: StretchOptions) {
214
226
  let last: { box: StretchBox; choice: unknown } | null = null
215
227
  let moved: HTMLElement | null = null
216
228
  return {
@@ -92,20 +92,22 @@ export function frames(ms: number, draw: (u: number, now: number) => void, done:
92
92
  /** A highlight's place in its row: its start edge and its width. */
93
93
  export type Place = { x: number; w: number }
94
94
 
95
+ type El = HTMLElement | (() => HTMLElement | null)
96
+ const get = (t: El) => (typeof t === 'function' ? t() : t)
97
+
95
98
  type Flow = { front: Box; rest: Box; stop: () => void; svg: SVGSVGElement; pin: ReturnType<typeof pincher> }
96
99
 
97
100
  export type FlowOptions = {
101
+ /** Where the liquid layer goes while it moves: the row the highlight sits in. */
102
+ host: El
98
103
  /** The liquid layer's class. */
99
- cls: string
104
+ className: string
100
105
  /** A thin underline, which only splits and joins. */
101
106
  line?: boolean
102
107
  /** Gets the drawn outline each frame (null at the end), for text that changes colour under the liquid. */
103
108
  ink?: (outline: string | null) => void
104
109
  }
105
110
 
106
- type El = HTMLElement | (() => HTMLElement | null)
107
- const get = (t: El) => (typeof t === 'function' ? t() : t)
108
-
109
111
  /**
110
112
  * Flow: when the choice changes, the highlight `mark` runs to the new place on a neck that thins and
111
113
  * breaks, and what is left drains after it and joins by 60% of the move (liquidPath flowScene). While
@@ -113,7 +115,7 @@ const get = (t: El) => (typeof t === 'function' ? t() : t)
113
115
  * caught half way starts from the shape on screen. Call `update` whenever the choice or its place
114
116
  * changes, and `destroy` when the part goes.
115
117
  */
116
- export function createFlow(host: El, mark: El, { cls, line = false, ink }: FlowOptions) {
118
+ export function createFlow(mark: El, { host, className, line = false, ink }: FlowOptions) {
117
119
  let last: { place: Place; choice: unknown } | null = null
118
120
  let run: Flow | null = null
119
121
  const end = () => {
@@ -153,7 +155,7 @@ export function createFlow(host: El, mark: El, { cls, line = false, ink }: FlowO
153
155
  let f = run
154
156
  if (f) f.stop()
155
157
  else {
156
- const { svg, paths } = layer(root, cls, m.nextSibling)
158
+ const { svg, paths } = layer(root, className, m.nextSibling)
157
159
  const look = getComputedStyle(m)
158
160
  const { shadows, ring } = shadowOf(m)
159
161
  paths[0].style.fill = look.backgroundColor