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
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  .root {
2
3
  /* The row is the pill plus the card's inner padding, so the label keeps its pixels as the card grows round it. */
3
4
  --pill-pad: calc(var(--gooee-space-6) - (var(--gooee-hit-min) - round(nearest, var(--gooee-text-sm) * var(--gooee-leading-normal-ratio), 4px)) / 2);
@@ -59,26 +60,26 @@
59
60
 
60
61
  /* Shut, it closes fast and falls away. Open, the surface pours out of the pill on the liquid curve. */
61
62
  .shell[data-measured] {
62
- transition: clip-path var(--gooee-motion-fast) var(--gooee-ease-in);
63
+ transition: clip-path var(--gooee-motion-fast) var(--gooee-ease-morph);
63
64
  }
64
65
 
65
- .shell[data-open] {
66
+ .shell[data-state='open'] {
66
67
  z-index: 1;
67
68
  clip-path: inset(0 0 0 0 round var(--gooee-radius-sheet));
68
- transition: clip-path var(--gooee-motion-liquid) var(--gooee-ease-liquid);
69
+ transition: clip-path var(--gooee-motion-morph) var(--gooee-ease-morph);
69
70
  }
70
71
 
71
72
  /* Shut, the card's own edge can sit on the pill's bottom edge and double its outline there. */
72
- .shell:not([data-open]) {
73
+ .shell[data-state='closed'] {
73
74
  box-shadow: none;
74
75
  }
75
76
 
76
77
  /* Before it is measured (the first paint of a server page), only the pill's words show. */
77
- .shell:not([data-measured]):not([data-open]) {
78
+ .shell:not([data-measured])[data-state='closed'] {
78
79
  visibility: hidden;
79
80
  }
80
81
 
81
- .shell:not([data-measured]):not([data-open]) :is(.button, .lead) {
82
+ .shell:not([data-measured])[data-state='closed'] :is(.button, .lead) {
82
83
  visibility: visible;
83
84
  }
84
85
 
@@ -145,16 +146,16 @@
145
146
  border-radius: inherit;
146
147
  box-shadow: inset 0 0 0 var(--gooee-line) var(--pill-edge);
147
148
  pointer-events: none;
148
- transition: box-shadow var(--gooee-motion-fast) var(--gooee-ease-out);
149
+ transition: box-shadow var(--gooee-motion-fast) var(--gooee-ease-morph);
149
150
  }
150
151
 
151
152
  .button:focus-visible {
152
- outline: var(--gooee-line-focus) solid var(--gooee-color-accent);
153
- outline-offset: calc(var(--gooee-line-focus) * -2);
153
+ outline: var(--gooee-focus-width) solid var(--gooee-color-accent);
154
+ outline-offset: calc(var(--gooee-focus-width) * -2);
154
155
  }
155
156
 
156
157
  /* Open, the pill stops being a chip: its outline goes, and its words read as the card's last row. */
157
- .shell[data-open] .button::after {
158
+ .shell[data-state='open'] .button::after {
158
159
  box-shadow: inset 0 0 0 var(--gooee-line) transparent;
159
160
  }
160
161
 
@@ -174,16 +175,16 @@
174
175
  .body {
175
176
  padding: var(--gooee-space-2) var(--gooee-space-6) var(--gooee-space-6);
176
177
  opacity: 0;
177
- transition: opacity var(--gooee-motion-instant) var(--gooee-ease-in);
178
+ transition: opacity var(--gooee-motion-instant) var(--gooee-ease-morph);
178
179
  }
179
180
 
180
181
  .root[data-placement='bottom'] .body {
181
182
  padding: var(--gooee-space-6) var(--gooee-space-6) var(--gooee-space-2);
182
183
  }
183
184
 
184
- .shell[data-open] .body {
185
+ .shell[data-state='open'] .body {
185
186
  opacity: 1;
186
- transition: opacity var(--gooee-motion-base) var(--gooee-ease-out) var(--gooee-motion-fast);
187
+ transition: opacity var(--gooee-motion-base) var(--gooee-ease-morph) var(--gooee-motion-fast);
187
188
  }
188
189
 
189
190
  .sr {
@@ -215,7 +216,7 @@
215
216
  border-radius: var(--card-r);
216
217
  }
217
218
 
218
- .root[data-ring] .shell[data-open] {
219
+ .root[data-ring] .shell[data-state='open'] {
219
220
  clip-path: inset(0 0 0 0 round var(--card-r));
220
221
  }
221
222
 
@@ -235,7 +236,7 @@
235
236
  translate: -50% 0;
236
237
  }
237
238
 
238
- .root[data-ring][data-align='center'] .shell[data-open] .row {
239
+ .root[data-ring][data-align='center'] .shell[data-state='open'] .row {
239
240
  left: var(--card-in);
240
241
  translate: none;
241
242
  }
@@ -249,19 +250,19 @@
249
250
  }
250
251
 
251
252
  /* Open, the button is the ring: a 44px target that folds the card back. */
252
- .root[data-ring] .shell[data-open] .row {
253
+ .root[data-ring] .shell[data-state='open'] .row {
253
254
  inset-inline-start: var(--card-in);
254
255
  }
255
256
 
256
- .root[data-ring][data-placement='top'] .shell[data-open] .row {
257
+ .root[data-ring][data-placement='top'] .shell[data-state='open'] .row {
257
258
  top: var(--card-in);
258
259
  }
259
260
 
260
- .root[data-ring][data-placement='bottom'] .shell[data-open] .row {
261
+ .root[data-ring][data-placement='bottom'] .shell[data-state='open'] .row {
261
262
  bottom: var(--card-in);
262
263
  }
263
264
 
264
- .root[data-ring] .shell[data-open] .button {
265
+ .root[data-ring] .shell[data-state='open'] .button {
265
266
  inline-size: var(--ring-l);
266
267
  }
267
268
 
@@ -274,12 +275,12 @@
274
275
 
275
276
  .root[data-ring] .face {
276
277
  padding-inline: var(--gooee-space-3) var(--gooee-space-6);
277
- transition: opacity var(--gooee-motion-base) var(--gooee-ease-out) var(--gooee-motion-fast);
278
+ transition: opacity var(--gooee-motion-base) var(--gooee-ease-morph) var(--gooee-motion-fast);
278
279
  }
279
280
 
280
- .root[data-ring] .shell[data-open] .face {
281
+ .root[data-ring] .shell[data-state='open'] .face {
281
282
  opacity: 0;
282
- transition: opacity var(--gooee-motion-instant) var(--gooee-ease-in);
283
+ transition: opacity var(--gooee-motion-instant) var(--gooee-ease-morph);
283
284
  }
284
285
 
285
286
  .lead {
@@ -295,19 +296,19 @@
295
296
  translate: var(--ring-x, 0) var(--ring-y, 0);
296
297
  transform-origin: 0 0;
297
298
  transition:
298
- scale var(--gooee-motion-fast) var(--gooee-ease-in),
299
- translate var(--gooee-motion-fast) var(--gooee-ease-in);
299
+ scale var(--gooee-motion-fast) var(--gooee-ease-morph),
300
+ translate var(--gooee-motion-fast) var(--gooee-ease-morph);
300
301
  }
301
302
 
302
- .shell[data-open] .lead {
303
+ .shell[data-state='open'] .lead {
303
304
  scale: 1;
304
305
  translate: 0 0;
305
306
  transition:
306
- scale var(--gooee-motion-liquid) var(--gooee-ease-liquid),
307
- translate var(--gooee-motion-liquid) var(--gooee-ease-liquid);
307
+ scale var(--gooee-motion-morph) var(--gooee-ease-morph),
308
+ translate var(--gooee-motion-morph) var(--gooee-ease-morph);
308
309
  }
309
310
 
310
- .lead[data-state='stopped'] {
311
+ .lead[data-status='stopped'] {
311
312
  --ring-ink: var(--gooee-color-danger);
312
313
  }
313
314
 
@@ -326,19 +327,19 @@
326
327
  .track,
327
328
  .arc {
328
329
  stroke-width: 5.5;
329
- transition: stroke-width var(--gooee-motion-fast) var(--gooee-ease-in);
330
+ transition: stroke-width var(--gooee-motion-fast) var(--gooee-ease-morph);
330
331
  }
331
332
 
332
- .shell[data-open] :is(.track, .arc) {
333
+ .shell[data-state='open'] :is(.track, .arc) {
333
334
  stroke-width: 4;
334
- transition: stroke-width var(--gooee-motion-liquid) var(--gooee-ease-liquid);
335
+ transition: stroke-width var(--gooee-motion-morph) var(--gooee-ease-morph);
335
336
  }
336
337
 
337
338
  .track {
338
339
  stroke: var(--pill-line);
339
340
  }
340
341
 
341
- .lead[data-state='stopped'] .track {
342
+ .lead[data-status='stopped'] .track {
342
343
  stroke: var(--ring-ink);
343
344
  }
344
345
 
@@ -346,8 +347,8 @@
346
347
  stroke: var(--ring-ink);
347
348
  stroke-linecap: round;
348
349
  transition:
349
- stroke-width var(--gooee-motion-fast) var(--gooee-ease-in),
350
- stroke-dasharray var(--gooee-motion-slow) var(--gooee-ease-out);
350
+ stroke-width var(--gooee-motion-fast) var(--gooee-ease-morph),
351
+ stroke-dasharray var(--gooee-motion-slow) var(--gooee-ease-morph);
351
352
  }
352
353
 
353
354
  .mark {
@@ -374,12 +375,12 @@
374
375
  letter-spacing: -0.02em;
375
376
  line-height: var(--gooee-leading-none);
376
377
  opacity: 0;
377
- transition: opacity var(--gooee-motion-instant) var(--gooee-ease-in);
378
+ transition: opacity var(--gooee-motion-instant) var(--gooee-ease-morph);
378
379
  }
379
380
 
380
- .shell[data-open] .pct {
381
+ .shell[data-state='open'] .pct {
381
382
  opacity: 1;
382
- transition: opacity var(--gooee-motion-base) var(--gooee-ease-out) var(--gooee-motion-fast);
383
+ transition: opacity var(--gooee-motion-base) var(--gooee-ease-morph) var(--gooee-motion-fast);
383
384
  }
384
385
 
385
386
  .root[data-ring] .body {
@@ -387,3 +388,4 @@
387
388
  align-self: start;
388
389
  padding: 0;
389
390
  }
391
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useEffect, useLayoutEffect, useRef, useState, type ComponentPropsWithRef, type CSSProperties, type ReactNode } from 'react'
4
4
  import { cx } from '../../internal/cx'
5
- import { CheckIcon } from '../../internal/icons'
5
+ import { CheckIcon } from '../../icons/icons'
6
6
  import { focusInCard, measurePill, pillAlertTimer, pillOutside, pillVars } from '../../internal/motion/livePill'
7
7
  import { useControllable } from '../../internal/useControllable'
8
8
  import styles from './LivePill.module.css'
@@ -131,11 +131,12 @@ export function LivePill({
131
131
  const vars = { ...pillVars(shut, rowH, ringAt), ...style } as CSSProperties
132
132
 
133
133
  return (
134
- <div className={cx(styles.root, className)} data-placement={placement} data-align={align} data-ring={ring || undefined} data-fixed={fixed || undefined} style={vars} {...rest}>
134
+ <div data-slot="live-pill" className={cx(styles.root, className)} data-placement={placement} data-align={align} data-ring={ring || undefined} data-fixed={fixed || undefined} style={vars} {...rest}>
135
135
  <div
136
136
  ref={shell}
137
+ data-slot="live-pill-shell"
137
138
  className={styles.shell}
138
- data-open={open || undefined}
139
+ data-state={open ? 'open' : 'closed'}
139
140
  data-measured={shut ? '' : undefined}
140
141
  data-tone={tone}
141
142
  onKeyDown={(e) => {
@@ -151,29 +152,29 @@ export function LivePill({
151
152
  }}
152
153
  >
153
154
  {ring && (
154
- <span ref={lead} className={styles.lead} data-state={state} aria-hidden="true">
155
+ <span ref={lead} data-slot="live-pill-ring" className={styles.lead} data-status={state} aria-hidden="true">
155
156
  <svg className={styles.ring} viewBox="0 0 44 44">
156
157
  <circle className={styles.track} cx="22" cy="22" r="20" />
157
158
  <circle className={styles.arc} cx="22" cy="22" r="20" pathLength={100} strokeDasharray={`${state ? 100 : (p ?? 0) * 100} 100`} />
158
159
  </svg>
159
160
  {state === 'done' ? (
160
- <CheckIcon className={styles.mark} />
161
+ <CheckIcon data-slot="live-pill-mark" className={styles.mark} />
161
162
  ) : state === 'stopped' ? (
162
- <svg className={styles.mark} viewBox="0 0 24 24">
163
+ <svg data-slot="live-pill-mark" className={styles.mark} viewBox="0 0 24 24">
163
164
  <path d="M12 7v6M12 17v.01" />
164
165
  </svg>
165
166
  ) : (
166
- <span className={styles.pct}>{Math.round((p ?? 0) * 100)}%</span>
167
+ <span data-slot="live-pill-percent" className={styles.pct}>{Math.round((p ?? 0) * 100)}%</span>
167
168
  )}
168
169
  </span>
169
170
  )}
170
171
  <div className={styles.row}>
171
- <button ref={button} type="button" className={styles.button} aria-expanded={open} aria-label={label} onClick={() => (open ? close(false) : setOpen(true))}>
172
+ <button ref={button} type="button" data-slot="live-pill-trigger" className={styles.button} aria-expanded={open} aria-label={label} onClick={() => (open ? close(false) : setOpen(true))}>
172
173
  {ring && <span ref={slot} className={styles.slot} />}
173
- <span className={styles.face}>{compact}</span>
174
+ <span data-slot="live-pill-compact" className={styles.face}>{compact}</span>
174
175
  </button>
175
176
  </div>
176
- <div className={styles.body} inert={!open} aria-hidden={!open || undefined}>
177
+ <div data-slot="live-pill-content" className={styles.body} inert={!open} aria-hidden={!open || undefined}>
177
178
  {children}
178
179
  </div>
179
180
  </div>
@@ -1,36 +1,33 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onBeforeUnmount, onMounted, ref, watch, watchEffect } from 'vue'
3
3
  import { focusInCard, measurePill, pillAlertTimer, pillOutside, pillVars } from '../../internal/motion/livePill'
4
- import { CheckIcon } from '../../internal/vueIcons'
4
+ import { CheckIcon } from '../../icons/vue'
5
5
  import styles from './LivePill.module.css'
6
6
 
7
7
  // The Vue LivePill: the same look (LivePill.module.css) and grow-from-its-spot card (motion/livePill.ts) as the
8
8
  // React one. Other attributes, such as a class or style, go to the root.
9
- const props = withDefaults(
10
- defineProps<{
11
- /** Screen reader name of the pill: start with the words it shows, then the rest of the state, such as "City map 63%, download". People using voice control say what they see. */
12
- label: string
13
- /** Where it sits. At the bottom it is in thumb reach and grows up; at the top it grows down. */
14
- placement?: 'bottom' | 'top'
15
- /** "center" keeps the pill in the middle of its row, like a status bar. "start" puts it at the row's start edge, and the card grows from there. */
16
- align?: 'center' | 'start'
17
- /** Pins it to the screen edge, clear of the safe area. Leave off to place it yourself. */
18
- fixed?: boolean
19
- /** From 0 to 1: a ring at the pill's start shows it. Open, the ring grows on its spot with the percent inside. */
20
- progress?: number
21
- /** "done" closes the ring into a tick (also at progress 1). "stopped" turns it red with a mark; say why in the words. */
22
- status?: 'done' | 'stopped'
23
- /** "paper" is a light pill with an outline; "ink" is a solid dark one. */
24
- tone?: 'paper' | 'ink'
25
- /** News for screen readers, said once each time it changes, such as "Download paused". Never a ticking number. */
26
- news?: string
27
- /** News that opens the pill by itself, such as "Rider is at your door". Said once, and the pill shrinks back after alertMs. */
28
- alert?: string
29
- /** How long an alert keeps it open, in ms. A hand or focus on the pill holds it open. */
30
- alertMs?: number
31
- }>(),
32
- { placement: 'bottom', align: 'center', tone: 'paper', alertMs: 5000 },
33
- )
9
+ const { placement = 'bottom', align = 'center', progress, status, tone = 'paper', news, alert, alertMs = 5000 } = defineProps<{
10
+ /** Screen reader name of the pill: start with the words it shows, then the rest of the state, such as "City map 63%, download". People using voice control say what they see. */
11
+ label: string
12
+ /** Where it sits. At the bottom it is in thumb reach and grows up; at the top it grows down. */
13
+ placement?: 'bottom' | 'top'
14
+ /** "center" keeps the pill in the middle of its row, like a status bar. "start" puts it at the row's start edge, and the card grows from there. */
15
+ align?: 'center' | 'start'
16
+ /** Pins it to the screen edge, clear of the safe area. Leave off to place it yourself. */
17
+ fixed?: boolean
18
+ /** From 0 to 1: a ring at the pill's start shows it. Open, the ring grows on its spot with the percent inside. */
19
+ progress?: number
20
+ /** "done" closes the ring into a tick (also at progress 1). "stopped" turns it red with a mark; say why in the words. */
21
+ status?: 'done' | 'stopped'
22
+ /** "paper" is a light pill with an outline; "ink" is a solid dark one. */
23
+ tone?: 'paper' | 'ink'
24
+ /** News for screen readers, said once each time it changes, such as "Download paused". Never a ticking number. */
25
+ news?: string
26
+ /** News that opens the pill by itself, such as "Rider is at your door". Said once, and the pill shrinks back after alertMs. */
27
+ alert?: string
28
+ /** How long an alert keeps it open, in ms. A hand or focus on the pill holds it open. */
29
+ alertMs?: number
30
+ }>()
34
31
  /** Whether it is open. Use v-model:open, or leave it out and the pill keeps its own state. */
35
32
  const open = defineModel<boolean>('open', { default: false })
36
33
  /** compact: what the small pill shows; it stays on its spot when the pill opens. default: what the open card shows. */
@@ -54,11 +51,11 @@ const close = (refocus: boolean) => {
54
51
  }
55
52
 
56
53
  watch(
57
- () => props.news,
54
+ () => news,
58
55
  (news) => news && (said.value = news),
59
56
  )
60
57
  watch(
61
- () => props.alert,
58
+ () => alert,
62
59
  (alert) => {
63
60
  if (!alert) return
64
61
  said.value = alert
@@ -92,14 +89,14 @@ onMounted(() => {
92
89
  stops.push(
93
90
  watchEffect((onCleanup) => {
94
91
  if (!open.value || !byAlert.value || held.value) return
95
- onCleanup(pillAlertTimer(props.alertMs, () => close(focusInCard(shell.value, button.value))))
92
+ onCleanup(pillAlertTimer(alertMs, () => close(focusInCard(shell.value, button.value))))
96
93
  }),
97
94
  )
98
95
  })
99
96
  onBeforeUnmount(() => stops.forEach((stop) => stop()))
100
97
 
101
- const p = computed(() => (props.progress === undefined ? undefined : Math.min(1, Math.max(0, props.progress))))
102
- const state = computed(() => props.status ?? (p.value === 1 ? 'done' : undefined))
98
+ const p = computed(() => (progress === undefined ? undefined : Math.min(1, Math.max(0, progress))))
99
+ const state = computed(() => status ?? (p.value === 1 ? 'done' : undefined))
103
100
  const ring = computed(() => p.value !== undefined || state.value !== undefined)
104
101
 
105
102
  const onKeydown = (e: KeyboardEvent) => {
@@ -113,11 +110,12 @@ const onFocusout = (e: FocusEvent) => {
113
110
  </script>
114
111
 
115
112
  <template>
116
- <div :class="styles.root" :data-placement="placement" :data-align="align" :data-ring="ring || undefined" :data-fixed="fixed || undefined" :style="pillVars(shut, rowH, ringAt)">
113
+ <div data-slot="live-pill" :class="styles.root" :data-placement="placement" :data-align="align" :data-ring="ring || undefined" :data-fixed="fixed || undefined" :style="pillVars(shut, rowH, ringAt)">
117
114
  <div
118
115
  ref="shell"
116
+ data-slot="live-pill-shell"
119
117
  :class="styles.shell"
120
- :data-open="open || undefined"
118
+ :data-state="open ? 'open' : 'closed'"
121
119
  :data-measured="shut ? '' : undefined"
122
120
  :data-tone="tone"
123
121
  @keydown="onKeydown"
@@ -126,24 +124,24 @@ const onFocusout = (e: FocusEvent) => {
126
124
  @focusin="held = true"
127
125
  @focusout="onFocusout"
128
126
  >
129
- <span v-if="ring" ref="lead" :class="styles.lead" :data-state="state" aria-hidden="true">
127
+ <span v-if="ring" ref="lead" data-slot="live-pill-ring" :class="styles.lead" :data-status="state" aria-hidden="true">
130
128
  <svg :class="styles.ring" viewBox="0 0 44 44">
131
129
  <circle :class="styles.track" cx="22" cy="22" r="20" />
132
130
  <circle :class="styles.arc" cx="22" cy="22" r="20" :pathLength="100" :stroke-dasharray="`${state ? 100 : (p ?? 0) * 100} 100`" />
133
131
  </svg>
134
- <CheckIcon v-if="state === 'done'" :class="styles.mark" />
135
- <svg v-else-if="state === 'stopped'" :class="styles.mark" viewBox="0 0 24 24">
132
+ <CheckIcon v-if="state === 'done'" data-slot="live-pill-mark" :class="styles.mark" />
133
+ <svg v-else-if="state === 'stopped'" data-slot="live-pill-mark" :class="styles.mark" viewBox="0 0 24 24">
136
134
  <path d="M12 7v6M12 17v.01" />
137
135
  </svg>
138
- <span v-else :class="styles.pct">{{ Math.round((p ?? 0) * 100) }}%</span>
136
+ <span v-else data-slot="live-pill-percent" :class="styles.pct">{{ Math.round((p ?? 0) * 100) }}%</span>
139
137
  </span>
140
138
  <div :class="styles.row">
141
- <button ref="button" type="button" :class="styles.button" :aria-expanded="open" :aria-label="label" @click="open ? close(false) : (open = true)">
139
+ <button ref="button" type="button" data-slot="live-pill-trigger" :class="styles.button" :aria-expanded="open" :aria-label="label" @click="open ? close(false) : (open = true)">
142
140
  <span v-if="ring" ref="slot" :class="styles.slot" />
143
- <span :class="styles.face"><slot name="compact" /></span>
141
+ <span data-slot="live-pill-compact" :class="styles.face"><slot name="compact" /></span>
144
142
  </button>
145
143
  </div>
146
- <div :class="styles.body" :inert="!open" :aria-hidden="!open || undefined">
144
+ <div data-slot="live-pill-content" :class="styles.body" :inert="!open" :aria-hidden="!open || undefined">
147
145
  <slot />
148
146
  </div>
149
147
  </div>
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  .root {
2
3
  --tone: var(--gooee-color-accent);
3
4
  display: flex;
@@ -67,8 +68,8 @@
67
68
  background: var(--tone);
68
69
  transform-origin: left center;
69
70
  transition:
70
- transform var(--gooee-motion-slower) var(--gooee-ease-out),
71
- background-color var(--gooee-motion-base) var(--gooee-ease-out);
71
+ transform var(--gooee-motion-slower) var(--gooee-ease-morph),
72
+ background-color var(--gooee-motion-base) var(--gooee-ease-morph);
72
73
  }
73
74
 
74
75
  /* A notch where the low and high ranges begin, cut through the bar in the page colour. */
@@ -76,7 +77,7 @@
76
77
  position: absolute;
77
78
  top: 0;
78
79
  bottom: 0;
79
- width: var(--gooee-line-focus);
80
+ width: var(--gooee-focus-width);
80
81
  background: var(--gooee-color-surface);
81
82
  transform: translateX(-50%);
82
83
  }
@@ -89,3 +90,4 @@
89
90
  clip-path: inset(50%);
90
91
  white-space: nowrap;
91
92
  }
93
+ }
@@ -1,6 +1,6 @@
1
1
  import { useId } from 'react'
2
2
  import { cx } from '../../internal/cx'
3
- import { CheckCircleIcon, ErrorIcon, WarningIcon } from '../../internal/icons'
3
+ import { CheckCircleIcon, ErrorIcon, WarningIcon } from '../../icons/icons'
4
4
  import styles from './Meter.module.css'
5
5
 
6
6
  export type MeterTone = 'good' | 'fair' | 'poor'
@@ -77,14 +77,14 @@ export function Meter({
77
77
  const Icon = tone && icons[tone]
78
78
  const marks = [low, high].filter((n): n is number => n !== undefined && n > min && n < max)
79
79
  return (
80
- <div className={cx(styles.root, className)} data-tone={tone}>
80
+ <div data-slot="meter" className={cx(styles.root, className)} data-tone={tone}>
81
81
  <div className={styles.head}>
82
- <span id={id} className={cx(styles.label, hideLabel && styles.srOnly)}>{label}</span>
82
+ <span id={id} data-slot="meter-label" className={cx(styles.label, hideLabel && styles.srOnly)}>{label}</span>
83
83
  <span className={styles.reading} aria-hidden="true">
84
- {showValue && <span className={styles.value}>{text}</span>}
84
+ {showValue && <span data-slot="meter-value" className={styles.value}>{text}</span>}
85
85
  {Icon && (
86
- <span className={styles.tone}>
87
- <Icon className={styles.icon} />
86
+ <span data-slot="meter-tone" className={styles.tone}>
87
+ <Icon data-slot="meter-icon" className={styles.icon} />
88
88
  {labels[tone]}
89
89
  </span>
90
90
  )}
@@ -97,11 +97,12 @@ export function Meter({
97
97
  aria-valuemax={max}
98
98
  aria-valuenow={now}
99
99
  aria-valuetext={tone ? `${text}, ${labels[tone]}` : text}
100
+ data-slot="meter-track"
100
101
  className={cx(styles.track, styles[size])}
101
102
  >
102
- <span className={styles.fill} style={{ transform: `scaleX(${at(now)})` }} />
103
+ <span data-slot="meter-fill" className={styles.fill} style={{ transform: `scaleX(${at(now)})` }} />
103
104
  {marks.map((n) => (
104
- <span key={n} className={styles.mark} style={{ left: `${at(n) * 100}%` }} />
105
+ <span key={n} data-slot="meter-mark" className={styles.mark} style={{ left: `${at(n) * 100}%` }} />
105
106
  ))}
106
107
  </div>
107
108
  </div>
@@ -1,41 +1,49 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useId } from 'vue'
3
- import { CheckCircleIcon, ErrorIcon, WarningIcon } from '../../internal/vueIcons'
3
+ import { CheckCircleIcon, ErrorIcon, WarningIcon } from '../../icons/vue'
4
4
  import styles from './Meter.module.css'
5
5
 
6
6
  // The Vue Meter: the same look (Meter.module.css) and tones as the React one.
7
7
  export type MeterTone = 'good' | 'fair' | 'poor'
8
8
  export type MeterLabels = Record<MeterTone, string>
9
9
 
10
- const props = withDefaults(
11
- defineProps<{
12
- /** Says what is measured. Shown above the bar and read by screen readers. */
13
- label: string
14
- /** The measurement, from min to max. */
15
- value: number
16
- /** Lowest possible value. */
17
- min?: number
18
- /** Highest possible value. */
19
- max?: number
20
- /** Top of the low range, as in the HTML meter. Set low or high to turn the tones on. */
21
- low?: number
22
- /** Bottom of the high range, as in the HTML meter. */
23
- high?: number
24
- /** The best value. The range it falls in is good, the next is fair, the far one poor. Left out, it is the middle. */
25
- optimum?: number
26
- /** Shown and spoken instead of the percentage, such as "72 GB of 100 GB". */
27
- valueText?: string
28
- /** Shows the value next to the label. */
29
- showValue?: boolean
30
- /** Hides the label visually but keeps it for screen readers. */
31
- hideLabel?: boolean
32
- /** Thickness of the bar. */
33
- size?: 'sm' | 'md'
34
- /** Words for each tone, shown with its icon and spoken with the value. Missing keys use the English defaults. */
35
- labels?: Partial<MeterLabels>
36
- }>(),
37
- { min: 0, max: 100, showValue: true, size: 'md' },
38
- )
10
+ const {
11
+ value,
12
+ min = 0,
13
+ max = 100,
14
+ low,
15
+ high,
16
+ optimum,
17
+ valueText,
18
+ showValue = true,
19
+ size = 'md',
20
+ labels,
21
+ } = defineProps<{
22
+ /** Says what is measured. Shown above the bar and read by screen readers. */
23
+ label: string
24
+ /** The measurement, from min to max. */
25
+ value: number
26
+ /** Lowest possible value. */
27
+ min?: number
28
+ /** Highest possible value. */
29
+ max?: number
30
+ /** Top of the low range, as in the HTML meter. Set low or high to turn the tones on. */
31
+ low?: number
32
+ /** Bottom of the high range, as in the HTML meter. */
33
+ high?: number
34
+ /** The best value. The range it falls in is good, the next is fair, the far one poor. Left out, it is the middle. */
35
+ optimum?: number
36
+ /** Shown and spoken instead of the percentage, such as "72 GB of 100 GB". */
37
+ valueText?: string
38
+ /** Shows the value next to the label. */
39
+ showValue?: boolean
40
+ /** Hides the label visually but keeps it for screen readers. */
41
+ hideLabel?: boolean
42
+ /** Thickness of the bar. */
43
+ size?: 'sm' | 'md'
44
+ /** Words for each tone, shown with its icon and spoken with the value. Missing keys use the English defaults. */
45
+ labels?: Partial<MeterLabels>
46
+ }>()
39
47
 
40
48
  const defaultLabels: MeterLabels = { good: 'Good', fair: 'Fair', poor: 'Poor' }
41
49
  const icons = { good: CheckCircleIcon, fair: WarningIcon, poor: ErrorIcon }
@@ -52,22 +60,22 @@ function toneOf(value: number, min: number, max: number, low?: number, high?: nu
52
60
  }
53
61
 
54
62
  const id = useId()
55
- const words = computed(() => ({ ...defaultLabels, ...props.labels }))
56
- const now = computed(() => clamp(props.value, props.min, props.max))
57
- const at = (n: number) => (clamp(n, props.min, props.max) - props.min) / (props.max - props.min || 1)
58
- const tone = computed(() => toneOf(now.value, props.min, props.max, props.low, props.high, props.optimum))
59
- const text = computed(() => props.valueText ?? `${Math.round(at(now.value) * 100)}%`)
60
- const marks = computed(() => [props.low, props.high].filter((n): n is number => n !== undefined && n > props.min && n < props.max))
63
+ const words = computed(() => ({ ...defaultLabels, ...labels }))
64
+ const now = computed(() => clamp(value, min, max))
65
+ const at = (n: number) => (clamp(n, min, max) - min) / (max - min || 1)
66
+ const tone = computed(() => toneOf(now.value, min, max, low, high, optimum))
67
+ const text = computed(() => valueText ?? `${Math.round(at(now.value) * 100)}%`)
68
+ const marks = computed(() => [low, high].filter((n): n is number => n !== undefined && n > min && n < max))
61
69
  </script>
62
70
 
63
71
  <template>
64
- <div :class="styles.root" :data-tone="tone">
72
+ <div data-slot="meter" :class="styles.root" :data-tone="tone">
65
73
  <div :class="styles.head">
66
- <span :id="id" :class="[styles.label, hideLabel && styles.srOnly]">{{ label }}</span>
74
+ <span :id="id" data-slot="meter-label" :class="[styles.label, hideLabel && styles.srOnly]">{{ label }}</span>
67
75
  <span :class="styles.reading" aria-hidden="true">
68
- <span v-if="showValue" :class="styles.value">{{ text }}</span>
69
- <span v-if="tone" :class="styles.tone">
70
- <component :is="icons[tone]" :class="styles.icon" />
76
+ <span v-if="showValue" data-slot="meter-value" :class="styles.value">{{ text }}</span>
77
+ <span v-if="tone" data-slot="meter-tone" :class="styles.tone">
78
+ <component :is="icons[tone]" data-slot="meter-icon" :class="styles.icon" />
71
79
  {{ words[tone] }}
72
80
  </span>
73
81
  </span>
@@ -79,10 +87,11 @@ const marks = computed(() => [props.low, props.high].filter((n): n is number =>
79
87
  :aria-valuemax="max"
80
88
  :aria-valuenow="now"
81
89
  :aria-valuetext="tone ? `${text}, ${words[tone]}` : text"
90
+ data-slot="meter-track"
82
91
  :class="[styles.track, styles[size]]"
83
92
  >
84
- <span :class="styles.fill" :style="{ transform: `scaleX(${at(now)})` }" />
85
- <span v-for="n in marks" :key="n" :class="styles.mark" :style="{ left: `${at(n) * 100}%` }" />
93
+ <span data-slot="meter-fill" :class="styles.fill" :style="{ transform: `scaleX(${at(now)})` }" />
94
+ <span v-for="n in marks" :key="n" data-slot="meter-mark" :class="styles.mark" :style="{ left: `${at(n) * 100}%` }" />
86
95
  </div>
87
96
  </div>
88
97
  </template>