Home

tailwind-ctp-intellisense @3d57b3c9c86dfffbf8be7f567f13781837e3bb51 - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / src / class-names / runPlugin.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
import dlv from 'dlv'

export function runPlugin(plugin, params = {}) {
  const { config, browserslist, ...rest } = params

  const browserslistTarget =
    browserslist && browserslist.includes('ie 11') ? 'ie11' : 'relaxed'

  try {
    ;(plugin.handler || plugin)({
      addUtilities: () => {},
      addComponents: () => {},
      addBase: () => {},
      addVariant: () => {},
      e: (x) => x,
      prefix: (x) => x,
      theme: (path, defaultValue) => dlv(config, `theme.${path}`, defaultValue),
      variants: () => [],
      config: (path, defaultValue) => dlv(config, path, defaultValue),
      corePlugins: (path) => {
        if (Array.isArray(config.corePlugins)) {
          return config.corePlugins.includes(path)
        }
        return dlv(config, `corePlugins.${path}`, true)
      },
      target: (path) => {
        if (typeof config.target === 'string') {
          return config.target === 'browserslist'
            ? browserslistTarget
            : config.target
        }
        const [defaultTarget, targetOverrides] = dlv(config, 'target')
        const target = dlv(targetOverrides, path, defaultTarget)
        return target === 'browserslist' ? browserslistTarget : target
      },
      ...rest,
    })
  } catch (_) {}
}