( matchUtilities: PluginAPI["matchUtilities"], addUtilities: PluginAPI["addUtilities"], theme: (path: keyof ThemeConfig) => Record<string, string> )
| 28 | }; |
| 29 | |
| 30 | export function addModifiers( |
| 31 | matchUtilities: PluginAPI["matchUtilities"], |
| 32 | addUtilities: PluginAPI["addUtilities"], |
| 33 | theme: (path: keyof ThemeConfig) => Record<string, string> |
| 34 | ) { |
| 35 | // duration |
| 36 | matchUtilities( |
| 37 | { |
| 38 | "motion-duration": (value: string, { modifier }: UtilityOptions) => { |
| 39 | switch (modifier) { |
| 40 | case "scale": |
| 41 | return { "--motion-scale-duration": value } as CSSRuleObject; |
| 42 | case "translate": |
| 43 | return { "--motion-translate-duration": value }; |
| 44 | case "rotate": |
| 45 | return { "--motion-rotate-duration": value }; |
| 46 | case "blur": |
| 47 | case "grayscale": |
| 48 | return { "--motion-filter-duration": value }; |
| 49 | case "opacity": |
| 50 | return { "--motion-opacity-duration": value }; |
| 51 | case "background": |
| 52 | return { "--motion-background-color-duration": value }; |
| 53 | case "text": |
| 54 | return { "--motion-text-color-duration": value }; |
| 55 | default: |
| 56 | return { |
| 57 | "--motion-duration": value, |
| 58 | }; |
| 59 | } |
| 60 | }, |
| 61 | }, |
| 62 | { |
| 63 | values: theme("motionDuration"), |
| 64 | modifiers: { |
| 65 | scale: "scale", |
| 66 | translate: "translate", |
| 67 | rotate: "rotate", |
| 68 | blur: "blur", |
| 69 | grayscale: "grayscale", |
| 70 | opacity: "opacity", |
| 71 | background: "background", |
| 72 | text: "text", |
| 73 | }, |
| 74 | } |
| 75 | ); |
| 76 | |
| 77 | // delay |
| 78 | matchUtilities( |
| 79 | { |
| 80 | "motion-delay": (value: string, { modifier }: UtilityOptions) => { |
| 81 | switch (modifier) { |
| 82 | case "scale": |
| 83 | return { "--motion-scale-delay": value } as CSSRuleObject; |
| 84 | case "translate": |
| 85 | return { "--motion-translate-delay": value }; |
| 86 | case "rotate": |
| 87 | return { "--motion-rotate-delay": value }; |
no outgoing calls
no test coverage detected
searching dependent graphs…