gooee 0.51.1 → 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
@@ -1,5 +1,5 @@
1
1
  import { clamp, pull, speedTracker } from '../feel'
2
- import { easing, readMotionMs } from '../motion'
2
+ import { easing, motionMs } from '../motion'
3
3
  import { release } from './fling'
4
4
 
5
5
  // A stack of cards: the top one is thrown to either side to decide. The part keeps the decisions as its
@@ -9,12 +9,43 @@ import { release } from './fling'
9
9
  export type DeckSide = -1 | 1
10
10
  export type DeckDir = 'start' | 'end'
11
11
 
12
+ /** SwipeDeck's text, shared by React and Vue. */
13
+ export type SwipeDeckLabels = {
14
+ /** The two button words, for the start side then the end side. */
15
+ actions: [string, string]
16
+ /** What screen readers say was done, start then end, such as "Passed" and "Saved". */
17
+ decided: [string, string]
18
+ /** Screen reader name of the undo button. */
19
+ undo: string
20
+ /** Shown when every card has been decided. */
21
+ empty: string
22
+ /** What screen readers call the deck. */
23
+ deck: string
24
+ /** Said after a decision, about the card now on top. */
25
+ next: (index: number, total: number, name: string) => string
26
+ /** Said after the last card is decided. */
27
+ last: string
28
+ /** Said when undo brings a card back. */
29
+ undone: (name: string, index: number, total: number) => string
30
+ }
31
+
32
+ export const defaultSwipeDeckLabels: SwipeDeckLabels = {
33
+ actions: ['Pass', 'Save'],
34
+ decided: ['Passed', 'Saved'],
35
+ undo: 'Undo the last decision',
36
+ empty: 'That was the last card.',
37
+ deck: 'card deck',
38
+ next: (index, total, name) => `Card ${index} of ${total}: ${name}.`,
39
+ last: 'No more cards.',
40
+ undone: (name, index, total) => `Brought back: ${name}. Card ${index} of ${total}.`,
41
+ }
42
+
12
43
  /** What a drag needs from a pointer event: native and React events both have these. */
13
44
  type Press = { clientX: number; clientY: number; pointerId: number; pointerType: string; button: number; timeStamp: number; currentTarget: EventTarget | null }
14
45
 
15
46
  // A press is a drag only once it moves this far sideways, so a tap on a card's own button stays a tap.
16
47
  const SLOP = 8
17
- // The throw rule: past --gooee-deck-throw of the card's width, or a flick this fast that has moved at least FLICK_MIN.
48
+ // The throw rule: past --gooee-swipe-deck-throw of the card's width, or a flick this fast that has moved at least FLICK_MIN.
18
49
  const FLICK = 600
19
50
  const FLICK_MIN = 40
20
51
  const TILT = 0.06
@@ -58,7 +89,7 @@ export function createSwipeDeck(o: SwipeDeckOptions) {
58
89
  const physical = (dir: DeckDir): DeckSide => ((dir === 'end') !== rtl() ? 1 : -1)
59
90
  const widthOf = () => o.top()?.offsetWidth || o.deck()?.offsetWidth || 300
60
91
  const line = () => widthOf() * share
61
- const reduced = () => readMotionMs('morph-out') === 0
92
+ const reduced = () => motionMs('morph-out') === 0
62
93
 
63
94
  const paint = (x: number) => {
64
95
  at = x
@@ -106,7 +137,7 @@ export function createSwipeDeck(o: SwipeDeckOptions) {
106
137
  busy = true
107
138
  stop()
108
139
  if (reduced()) {
109
- const anim = el.animate({ opacity: [1, 0] }, { duration: readMotionMs('base'), easing: easing('out'), fill: 'forwards' })
140
+ const anim = el.animate({ opacity: [1, 0] }, { duration: motionMs('base'), easing: easing('morph'), fill: 'forwards' })
110
141
  let ended = false
111
142
  const end = () => {
112
143
  if (ended) return
@@ -157,10 +188,10 @@ export function createSwipeDeck(o: SwipeDeckOptions) {
157
188
  named,
158
189
  physical,
159
190
  fly,
160
- /** Reads the throw line from --gooee-deck-throw. Call once the deck is in the page. */
191
+ /** Reads the throw line from --gooee-swipe-deck-throw. Call once the deck is in the page. */
161
192
  mount() {
162
193
  const root = o.root()
163
- share = (root ? parseFloat(getComputedStyle(root).getPropertyValue('--gooee-deck-throw')) || 0 : 0) || share
194
+ share = (root ? parseFloat(getComputedStyle(root).getPropertyValue('--gooee-swipe-deck-throw')) || 0 : 0) || share
164
195
  },
165
196
  destroy: () => stop(),
166
197
  /** Asks to bring the last card back from `side`. False while a card is moving: then nothing changes. */
@@ -179,7 +210,7 @@ export function createSwipeDeck(o: SwipeDeckOptions) {
179
210
  undoing = null
180
211
  if (!el) return playQueue()
181
212
  if (reduced()) {
182
- const anim = el.animate({ opacity: [0, 1] }, { duration: readMotionMs('base'), easing: easing('out') })
213
+ const anim = el.animate({ opacity: [0, 1] }, { duration: motionMs('base'), easing: easing('morph') })
183
214
  let ended = false
184
215
  anim.finished.then(
185
216
  () => !ended && playQueue(),
@@ -58,13 +58,10 @@ export function revealCell(el: HTMLElement, target: EventTarget | null) {
58
58
  else if (r.right > box.right) el.scrollLeft += r.right - box.right
59
59
  }
60
60
 
61
- /**
62
- * FLIP: rows glide from their last place to the new one. When the groups themselves changed (`regrouped`),
63
- * they snap there with the spring, so the table visibly splits apart and closes up again. Returns the new places.
64
- */
65
- export function flipRows(table: HTMLElement, last: Map<string, number>, regrouped: boolean) {
61
+ /** FLIP: rows glide from their last place to the new one. Returns the new places. */
62
+ export function flipRows(table: HTMLElement, last: Map<string, number>) {
66
63
  const duration = motionMs('slow')
67
- const ease = easing(regrouped ? 'spring' : 'out')
64
+ const ease = easing('morph')
68
65
  const now = new Map<string, number>()
69
66
  table.querySelectorAll<HTMLElement>('tbody [data-row-id]').forEach((tr) => {
70
67
  const rid = tr.dataset.rowId!
@@ -62,7 +62,7 @@ export function createThemeIcon(body: () => SVGPathElement | null, start: number
62
62
  cancelAnimationFrame(raf)
63
63
  if (!el) return
64
64
  const from = shown
65
- const length = motionMs('reveal')
65
+ const length = motionMs('morph-out')
66
66
  if (from === to || !length || prefersReducedMotion()) {
67
67
  shown = to
68
68
  draw(el, to)
@@ -33,7 +33,7 @@ function radiusFor(share: number, x: number, y: number, reach: number) {
33
33
  */
34
34
  export function themeReveal(origin: Element | null, applyNow: () => void | Promise<void>) {
35
35
  const root = document.documentElement
36
- const ms = motionMs('reveal')
36
+ const ms = motionMs('morph-out')
37
37
  if (prefersReducedMotion() || !ms) return void applyNow()
38
38
  running?.skipTransition()
39
39
  root.dataset.gooeeThemeSwitch = ''
@@ -6,7 +6,7 @@ import { castShadow, frames, layer, morphEase, motionFor, shadowOf } from './liq
6
6
  // The toast stack, the same in every framework: where each toast sits, how long it stays, the throw
7
7
  // that sends it away, and the drop it buds out of.
8
8
 
9
- export type ToastVariant = 'default' | 'success' | 'error' | 'info' | 'loading'
9
+ export type ToastTone = 'neutral' | 'info' | 'success' | 'danger'
10
10
  export type ToastOrigin = HTMLElement | { x: number; y: number }
11
11
  export type ToastLeaving = false | 'down' | 'left' | 'right'
12
12
 
@@ -25,7 +25,7 @@ export function toastSay(prev: string, opts: { title?: string; description?: str
25
25
  }
26
26
 
27
27
  /** Where each toast sits, newest first, and how tall the stack is. */
28
- export function toastLayout<T extends { id: number; leaving: ToastLeaving }>(items: T[], heights: Record<number, number>, expanded: boolean, visible: number) {
28
+ export function toastLayout<T extends { id: number; leaving: ToastLeaving }>(items: T[], heights: Record<number, number>, expanded: boolean, max: number) {
29
29
  const live = items.filter((t) => !t.leaving)
30
30
  const order = [...items].reverse()
31
31
  let offset = 0
@@ -37,7 +37,7 @@ export function toastLayout<T extends { id: number; leaving: ToastLeaving }>(ite
37
37
  return { t, index, y }
38
38
  })
39
39
  const frontHeight = live.length ? (heights[live[live.length - 1].id] ?? 64) : 0
40
- const stackHeight = expanded ? offset : frontHeight + Math.min(live.length - 1, visible - 1) * TOAST_PEEK
40
+ const stackHeight = expanded ? offset : frontHeight + Math.min(live.length - 1, max - 1) * TOAST_PEEK
41
41
  return { layout, live: live.length, frontHeight, height: live.length ? stackHeight : 0 }
42
42
  }
43
43
 
@@ -1,13 +1,11 @@
1
1
  import { MORPH, type Curve } from './feel'
2
2
 
3
- export type MotionToken = 'instant' | 'fast' | 'base' | 'slow' | 'slower' | 'liquid' | 'morph' | 'morph-out' | 'reveal' | 'fling' | 'delay-tooltip'
3
+ export type MotionToken = 'instant' | 'fast' | 'base' | 'slow' | 'slower' | 'morph' | 'morph-out' | 'stagger' | 'delay-tooltip'
4
4
 
5
- // Reads a duration token at run time, so reduced motion (0ms) and Retime's speed are honoured by JS
6
- // timers too.
7
- export function readMotionMs(name: string): number {
5
+ /** A duration custom property in ms, read at run time. For a part's own token; the shared ones go through motionMs. */
6
+ export function durationOf(property: string): number {
8
7
  if (typeof window === 'undefined') return 0
9
- const style = getComputedStyle(document.documentElement)
10
- const raw = style.getPropertyValue(`--gooee-motion-${name}`).trim()
8
+ const raw = getComputedStyle(document.documentElement).getPropertyValue(property).trim()
11
9
  if (!raw) return 0
12
10
  const match = raw.match(/(-?[\d.]+)(ms|s)\b/)
13
11
  if (!match) return 0
@@ -17,11 +15,12 @@ export function readMotionMs(name: string): number {
17
15
  return times ? base * parseFloat(times[1]) : base
18
16
  }
19
17
 
18
+ /** A --gooee-motion-* token in ms, read at run time, so reduced motion (0ms) and Retime reach JS timers too. */
20
19
  export function motionMs(token: MotionToken): number {
21
- return readMotionMs(token)
20
+ return durationOf(`--gooee-motion-${token}`)
22
21
  }
23
22
 
24
- export function easing(name: 'out' | 'in' | 'in-out' | 'spring' | 'bounce' | 'liquid' | 'morph'): string {
23
+ export function easing(name: 'morph' | 'in-out' | 'linear'): string {
25
24
  if (typeof window === 'undefined') return 'ease'
26
25
  return getComputedStyle(document.documentElement).getPropertyValue(`--gooee-ease-${name}`).trim() || 'ease'
27
26
  }
@@ -1,9 +1,9 @@
1
1
  import { useLayoutEffect, useRef } from 'react'
2
- import { onScrollFrame, type ScrollReader } from './motion/scrollFrame'
2
+ import { createScrollFrame, type ScrollReader } from './motion/scrollFrame'
3
3
 
4
4
  export { bandProgress, easeToward, readScrollTokens, scrollTokens, type ScrollFrame, type ScrollReader, type ScrollTokens } from './motion/scrollFrame'
5
5
 
6
- /** React's hold on onScrollFrame (motion/scrollFrame.ts): calls the latest `read` on mount and every frame while the page moves. */
6
+ /** React's hold on createScrollFrame (motion/scrollFrame.ts): calls the latest `read` on mount and every frame while the page moves. */
7
7
  export function useScrollFrame(read: ScrollReader, active = true) {
8
8
  const ref = useRef(read)
9
9
  useLayoutEffect(() => {
@@ -11,6 +11,6 @@ export function useScrollFrame(read: ScrollReader, active = true) {
11
11
  })
12
12
  useLayoutEffect(() => {
13
13
  if (!active) return
14
- return onScrollFrame((f) => ref.current(f))
14
+ return createScrollFrame((f) => ref.current(f)).destroy
15
15
  }, [active])
16
16
  }
@@ -22,8 +22,7 @@ export function useScrub(o: UseScrubOptions) {
22
22
  const wheels = !!o.wheel
23
23
  useEffect(() => {
24
24
  const el = ref.current
25
- if (!el || !wheels) return
26
- return s.wheelOn(el)
25
+ if (el && wheels) s.listenWheel(el)
27
26
  }, [s, wheels])
28
27
  useEffect(() => () => s.destroy(), [s])
29
28
 
@@ -40,16 +39,3 @@ export function useScrub(o: UseScrubOptions) {
40
39
  }
41
40
 
42
41
  export { ink, sideways, tokenNumber } from './motion/scrubLook'
43
-
44
- /** Calls `fn` each time `value` changes (by `key`), but not for the value it starts with. */
45
- export function useOnChange<T>(value: T, fn: ((value: T) => void) | undefined, key = String(value)) {
46
- const latest = useRef(fn)
47
- latest.current = fn
48
- const seen = useRef(key)
49
- useEffect(() => {
50
- if (seen.current === key) return
51
- seen.current = key
52
- latest.current?.(value)
53
- // eslint-disable-next-line react-hooks/exhaustive-deps
54
- }, [key])
55
- }
@@ -18,14 +18,10 @@ export function useScrub(options: () => UseScrubOptions) {
18
18
  // when it came to rest.
19
19
  watch([() => options().value, moving], () => s.sync(options().value), { flush: 'post' })
20
20
 
21
- let stopWheel = () => {}
22
21
  onMounted(() => {
23
- if (el.value && options().wheel) stopWheel = s.wheelOn(el.value)
24
- })
25
- onBeforeUnmount(() => {
26
- stopWheel()
27
- s.destroy()
22
+ if (el.value && options().wheel) s.listenWheel(el.value)
28
23
  })
24
+ onBeforeUnmount(() => s.destroy())
29
25
 
30
26
  return {
31
27
  el,