Home

tailwind-ctp-intellisense @cb20c3bc86122beb02becf45bf19059592a64f98 - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / packages / tailwindcss-class-names / src / getVariants.js
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import semver from 'semver'
import dlv from 'dlv'

export default function getVariants({ config, version, postcss }) {
  let variants = ['responsive', 'hover']
  semver.gte(version, '0.3.0') && variants.push('focus', 'group-hover')
  semver.gte(version, '0.5.0') && variants.push('active')
  semver.gte(version, '0.7.0') && variants.push('focus-within')
  semver.gte(version, '1.0.0-beta.1') && variants.push('default')
  semver.gte(version, '1.1.0') &&
    variants.push('first', 'last', 'odd', 'even', 'disabled', 'visited')

  let plugins = config.plugins
  if (!Array.isArray(plugins)) {
    plugins = []
  }
  plugins.forEach((plugin) => {
    try {
      ;(plugin.handler || plugin)({
        addUtilities: () => {},
        addComponents: () => {},
        addBase: () => {},
        addVariant: (name) => {
          variants.push(name)
        },
        e: (x) => x,
        prefix: (x) => x,
        theme: (path, defaultValue) =>
          dlv(config, `theme.${path}`, defaultValue),
        variants: () => [],
        config: (path, defaultValue) => dlv(config, path, defaultValue),
        postcss,
      })
    } catch (_) {
      console.error(_)
    }
  })

  return variants
}