| 1 | import fs from 'fs'
|
|---|
| 2 | import * as path from 'path'
|
|---|
| 3 | import postcss from 'postcss'
|
|---|
| 4 | import createUtilityPlugin from './util/createUtilityPlugin'
|
|---|
| 5 | import buildMediaQuery from './util/buildMediaQuery'
|
|---|
| 6 | import escapeClassName from './util/escapeClassName'
|
|---|
| 7 | import parseAnimationValue from './util/parseAnimationValue'
|
|---|
| 8 | import flattenColorPalette from './util/flattenColorPalette'
|
|---|
| 9 | import withAlphaVariable, { withAlphaValue } from './util/withAlphaVariable'
|
|---|
| 10 | import toColorValue from './util/toColorValue'
|
|---|
| 11 | import isPlainObject from './util/isPlainObject'
|
|---|
| 12 | import transformThemeValue from './util/transformThemeValue'
|
|---|
| 13 | import { version as tailwindVersion } from '../package.json'
|
|---|
| 14 | import log from './util/log'
|
|---|
| 15 | import {
|
|---|
| 16 | normalizeScreens,
|
|---|
| 17 | isScreenSortable,
|
|---|
| 18 | compareScreens,
|
|---|
| 19 | toScreen,
|
|---|
| 20 | } from './util/normalizeScreens'
|
|---|
| 21 | import { formatBoxShadowValue, parseBoxShadowValue } from './util/parseBoxShadowValue'
|
|---|
| 22 | import { removeAlphaVariables } from './util/removeAlphaVariables'
|
|---|
| 23 | import { flagEnabled } from './featureFlags'
|
|---|
| 24 | import { normalize, normalizeAttributeSelectors } from './util/dataTypes'
|
|---|
| 25 | import { INTERNAL_FEATURES } from './lib/setupContextUtils'
|
|---|
| 26 |
|
|---|
| 27 | export let variantPlugins = {
|
|---|
| 28 | childVariant: ({ addVariant }) => {
|
|---|
| 29 | addVariant('*', '& > *')
|
|---|
| 30 | },
|
|---|
| 31 | pseudoElementVariants: ({ addVariant }) => {
|
|---|
| 32 | addVariant('first-letter', '&::first-letter')
|
|---|
| 33 | addVariant('first-line', '&::first-line')
|
|---|
| 34 |
|
|---|
| 35 | addVariant('marker', [
|
|---|
| 36 | ({ container }) => {
|
|---|
| 37 | removeAlphaVariables(container, ['--tw-text-opacity'])
|
|---|
| 38 |
|
|---|
| 39 | return '& *::marker'
|
|---|
| 40 | },
|
|---|
| 41 | ({ container }) => {
|
|---|
| 42 | removeAlphaVariables(container, ['--tw-text-opacity'])
|
|---|
| 43 |
|
|---|
| 44 | return '&::marker'
|
|---|
| 45 | },
|
|---|
| 46 | ])
|
|---|
| 47 |
|
|---|
| 48 | addVariant('selection', ['& *::selection', '&::selection'])
|
|---|
| 49 |
|
|---|
| 50 | addVariant('file', '&::file-selector-button')
|
|---|
| 51 |
|
|---|
| 52 | addVariant('placeholder', '&::placeholder')
|
|---|
| 53 |
|
|---|
| 54 | addVariant('backdrop', '&::backdrop')
|
|---|
| 55 |
|
|---|
| 56 | addVariant('before', ({ container }) => {
|
|---|
| 57 | container.walkRules((rule) => {
|
|---|
| 58 | let foundContent = false
|
|---|
| 59 | rule.walkDecls('content', () => {
|
|---|
| 60 | foundContent = true
|
|---|
| 61 | })
|
|---|
| 62 |
|
|---|
| 63 | if (!foundContent) {
|
|---|
| 64 | rule.prepend(postcss.decl({ prop: 'content', value: 'var(--tw-content)' }))
|
|---|
| 65 | }
|
|---|
| 66 | })
|
|---|
| 67 |
|
|---|
| 68 | return '&::before'
|
|---|
| 69 | })
|
|---|
| 70 |
|
|---|
| 71 | addVariant('after', ({ container }) => {
|
|---|
| 72 | container.walkRules((rule) => {
|
|---|
| 73 | let foundContent = false
|
|---|
| 74 | rule.walkDecls('content', () => {
|
|---|
| 75 | foundContent = true
|
|---|
| 76 | })
|
|---|
| 77 |
|
|---|
| 78 | if (!foundContent) {
|
|---|
| 79 | rule.prepend(postcss.decl({ prop: 'content', value: 'var(--tw-content)' }))
|
|---|
| 80 | }
|
|---|
| 81 | })
|
|---|
| 82 |
|
|---|
| 83 | return '&::after'
|
|---|
| 84 | })
|
|---|
| 85 | },
|
|---|
| 86 |
|
|---|
| 87 | pseudoClassVariants: ({ addVariant, matchVariant, config, prefix }) => {
|
|---|
| 88 | let pseudoVariants = [
|
|---|
| 89 | // Positional
|
|---|
| 90 | ['first', '&:first-child'],
|
|---|
| 91 | ['last', '&:last-child'],
|
|---|
| 92 | ['only', '&:only-child'],
|
|---|
| 93 | ['odd', '&:nth-child(odd)'],
|
|---|
| 94 | ['even', '&:nth-child(even)'],
|
|---|
| 95 | 'first-of-type',
|
|---|
| 96 | 'last-of-type',
|
|---|
| 97 | 'only-of-type',
|
|---|
| 98 |
|
|---|
| 99 | // State
|
|---|
| 100 | [
|
|---|
| 101 | 'visited',
|
|---|
| 102 | ({ container }) => {
|
|---|
| 103 | removeAlphaVariables(container, [
|
|---|
| 104 | '--tw-text-opacity',
|
|---|
| 105 | '--tw-border-opacity',
|
|---|
| 106 | '--tw-bg-opacity',
|
|---|
| 107 | ])
|
|---|
| 108 |
|
|---|
| 109 | return '&:visited'
|
|---|
| 110 | },
|
|---|
| 111 | ],
|
|---|
| 112 | 'target',
|
|---|
| 113 | ['open', '&[open]'],
|
|---|
| 114 |
|
|---|
| 115 | // Forms
|
|---|
| 116 | 'default',
|
|---|
| 117 | 'checked',
|
|---|
| 118 | 'indeterminate',
|
|---|
| 119 | 'placeholder-shown',
|
|---|
| 120 | 'autofill',
|
|---|
| 121 | 'optional',
|
|---|
| 122 | 'required',
|
|---|
| 123 | 'valid',
|
|---|
| 124 | 'invalid',
|
|---|
| 125 | 'in-range',
|
|---|
| 126 | 'out-of-range',
|
|---|
| 127 | 'read-only',
|
|---|
| 128 |
|
|---|
| 129 | // Content
|
|---|
| 130 | 'empty',
|
|---|
| 131 |
|
|---|
| 132 | // Interactive
|
|---|
| 133 | 'focus-within',
|
|---|
| 134 | [
|
|---|
| 135 | 'hover',
|
|---|
| 136 | !flagEnabled(config(), 'hoverOnlyWhenSupported')
|
|---|
| 137 | ? '&:hover'
|
|---|
| 138 | : '@media (hover: hover) and (pointer: fine) { &:hover }',
|
|---|
| 139 | ],
|
|---|
| 140 | 'focus',
|
|---|
| 141 | 'focus-visible',
|
|---|
| 142 | 'active',
|
|---|
| 143 | 'enabled',
|
|---|
| 144 | 'disabled',
|
|---|
| 145 | ].map((variant) => (Array.isArray(variant) ? variant : [variant, `&:${variant}`]))
|
|---|
| 146 |
|
|---|
| 147 | for (let [variantName, state] of pseudoVariants) {
|
|---|
| 148 | addVariant(variantName, (ctx) => {
|
|---|
| 149 | let result = typeof state === 'function' ? state(ctx) : state
|
|---|
| 150 |
|
|---|
| 151 | return result
|
|---|
| 152 | })
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | let variants = {
|
|---|
| 156 | group: (_, { modifier }) =>
|
|---|
| 157 | modifier
|
|---|
| 158 | ? [`:merge(${prefix('.group')}\\/${escapeClassName(modifier)})`, ' &']
|
|---|
| 159 | : [`:merge(${prefix('.group')})`, ' &'],
|
|---|
| 160 | peer: (_, { modifier }) =>
|
|---|
| 161 | modifier
|
|---|
| 162 | ? [`:merge(${prefix('.peer')}\\/${escapeClassName(modifier)})`, ' ~ &']
|
|---|
| 163 | : [`:merge(${prefix('.peer')})`, ' ~ &'],
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | for (let [name, fn] of Object.entries(variants)) {
|
|---|
| 167 | matchVariant(
|
|---|
| 168 | name,
|
|---|
| 169 | (value = '', extra) => {
|
|---|
| 170 | let result = normalize(typeof value === 'function' ? value(extra) : value)
|
|---|
| 171 | if (!result.includes('&')) result = '&' + result
|
|---|
| 172 |
|
|---|
| 173 | let [a, b] = fn('', extra)
|
|---|
| 174 |
|
|---|
| 175 | let start = null
|
|---|
| 176 | let end = null
|
|---|
| 177 | let quotes = 0
|
|---|
| 178 |
|
|---|
| 179 | for (let i = 0; i < result.length; ++i) {
|
|---|
| 180 | let c = result[i]
|
|---|
| 181 | if (c === '&') {
|
|---|
| 182 | start = i
|
|---|
| 183 | } else if (c === "'" || c === '"') {
|
|---|
| 184 | quotes += 1
|
|---|
| 185 | } else if (start !== null && c === ' ' && !quotes) {
|
|---|
| 186 | end = i
|
|---|
| 187 | }
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | if (start !== null && end === null) {
|
|---|
| 191 | end = result.length
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | // Basically this but can handle quotes:
|
|---|
| 195 | // result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
|
|---|
| 196 |
|
|---|
| 197 | return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end)
|
|---|
| 198 | },
|
|---|
| 199 | {
|
|---|
| 200 | values: Object.fromEntries(pseudoVariants),
|
|---|
| 201 | [INTERNAL_FEATURES]: {
|
|---|
| 202 | respectPrefix: false,
|
|---|
| 203 | },
|
|---|
| 204 | }
|
|---|
| 205 | )
|
|---|
| 206 | }
|
|---|
| 207 | },
|
|---|
| 208 |
|
|---|
| 209 | directionVariants: ({ addVariant }) => {
|
|---|
| 210 | addVariant('ltr', '&:where([dir="ltr"], [dir="ltr"] *)')
|
|---|
| 211 | addVariant('rtl', '&:where([dir="rtl"], [dir="rtl"] *)')
|
|---|
| 212 | },
|
|---|
| 213 |
|
|---|
| 214 | reducedMotionVariants: ({ addVariant }) => {
|
|---|
| 215 | addVariant('motion-safe', '@media (prefers-reduced-motion: no-preference)')
|
|---|
| 216 | addVariant('motion-reduce', '@media (prefers-reduced-motion: reduce)')
|
|---|
| 217 | },
|
|---|
| 218 |
|
|---|
| 219 | darkVariants: ({ config, addVariant }) => {
|
|---|
| 220 | let [mode, selector = '.dark'] = [].concat(config('darkMode', 'media'))
|
|---|
| 221 |
|
|---|
| 222 | if (mode === false) {
|
|---|
| 223 | mode = 'media'
|
|---|
| 224 | log.warn('darkmode-false', [
|
|---|
| 225 | 'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
|
|---|
| 226 | 'Change `darkMode` to `media` or remove it entirely.',
|
|---|
| 227 | 'https://tailwindcss.com/docs/upgrade-guide#remove-dark-mode-configuration',
|
|---|
| 228 | ])
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | if (mode === 'variant') {
|
|---|
| 232 | let formats
|
|---|
| 233 | if (Array.isArray(selector)) {
|
|---|
| 234 | formats = selector
|
|---|
| 235 | } else if (typeof selector === 'function') {
|
|---|
| 236 | formats = selector
|
|---|
| 237 | } else if (typeof selector === 'string') {
|
|---|
| 238 | formats = [selector]
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | // TODO: We could also add these warnings if the user passes a function that returns string | string[]
|
|---|
| 242 | // But this is an advanced enough use case that it's probably not necessary
|
|---|
| 243 | if (Array.isArray(formats)) {
|
|---|
| 244 | for (let format of formats) {
|
|---|
| 245 | if (format === '.dark') {
|
|---|
| 246 | mode = false
|
|---|
| 247 | log.warn('darkmode-variant-without-selector', [
|
|---|
| 248 | 'When using `variant` for `darkMode`, you must provide a selector.',
|
|---|
| 249 | 'Example: `darkMode: ["variant", ".your-selector &"]`',
|
|---|
| 250 | ])
|
|---|
| 251 | } else if (!format.includes('&')) {
|
|---|
| 252 | mode = false
|
|---|
| 253 | log.warn('darkmode-variant-without-ampersand', [
|
|---|
| 254 | 'When using `variant` for `darkMode`, your selector must contain `&`.',
|
|---|
| 255 | 'Example `darkMode: ["variant", ".your-selector &"]`',
|
|---|
| 256 | ])
|
|---|
| 257 | }
|
|---|
| 258 | }
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | selector = formats
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | if (mode === 'selector') {
|
|---|
| 265 | // New preferred behavior
|
|---|
| 266 | addVariant('dark', `&:where(${selector}, ${selector} *)`)
|
|---|
| 267 | } else if (mode === 'media') {
|
|---|
| 268 | addVariant('dark', '@media (prefers-color-scheme: dark)')
|
|---|
| 269 | } else if (mode === 'variant') {
|
|---|
| 270 | addVariant('dark', selector)
|
|---|
| 271 | } else if (mode === 'class') {
|
|---|
| 272 | // Old behavior
|
|---|
| 273 | addVariant('dark', `&:is(${selector} *)`)
|
|---|
| 274 | }
|
|---|
| 275 | },
|
|---|
| 276 |
|
|---|
| 277 | printVariant: ({ addVariant }) => {
|
|---|
| 278 | addVariant('print', '@media print')
|
|---|
| 279 | },
|
|---|
| 280 |
|
|---|
| 281 | screenVariants: ({ theme, addVariant, matchVariant }) => {
|
|---|
| 282 | let rawScreens = theme('screens') ?? {}
|
|---|
| 283 | let areSimpleScreens = Object.values(rawScreens).every((v) => typeof v === 'string')
|
|---|
| 284 | let screens = normalizeScreens(theme('screens'))
|
|---|
| 285 |
|
|---|
| 286 | /** @type {Set<string>} */
|
|---|
| 287 | let unitCache = new Set([])
|
|---|
| 288 |
|
|---|
| 289 | /** @param {string} value */
|
|---|
| 290 | function units(value) {
|
|---|
| 291 | return value.match(/(\D+)$/)?.[1] ?? '(none)'
|
|---|
| 292 | }
|
|---|
| 293 |
|
|---|
| 294 | /** @param {string} value */
|
|---|
| 295 | function recordUnits(value) {
|
|---|
| 296 | if (value !== undefined) {
|
|---|
| 297 | unitCache.add(units(value))
|
|---|
| 298 | }
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| 301 | /** @param {string} value */
|
|---|
| 302 | function canUseUnits(value) {
|
|---|
| 303 | recordUnits(value)
|
|---|
| 304 |
|
|---|
| 305 | // If the cache was empty it'll become 1 because we've just added the current unit
|
|---|
| 306 | // If the cache was not empty and the units are the same the size doesn't change
|
|---|
| 307 | // Otherwise, if the units are different from what is already known the size will always be > 1
|
|---|
| 308 | return unitCache.size === 1
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | for (const screen of screens) {
|
|---|
| 312 | for (const value of screen.values) {
|
|---|
| 313 | recordUnits(value.min)
|
|---|
| 314 | recordUnits(value.max)
|
|---|
| 315 | }
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | let screensUseConsistentUnits = unitCache.size <= 1
|
|---|
| 319 |
|
|---|
| 320 | /**
|
|---|
| 321 | * @typedef {import('./util/normalizeScreens').Screen} Screen
|
|---|
| 322 | */
|
|---|
| 323 |
|
|---|
| 324 | /**
|
|---|
| 325 | * @param {'min' | 'max'} type
|
|---|
| 326 | * @returns {Record<string, Screen>}
|
|---|
| 327 | */
|
|---|
| 328 | function buildScreenValues(type) {
|
|---|
| 329 | return Object.fromEntries(
|
|---|
| 330 | screens
|
|---|
| 331 | .filter((screen) => isScreenSortable(screen).result)
|
|---|
| 332 | .map((screen) => {
|
|---|
| 333 | let { min, max } = screen.values[0]
|
|---|
| 334 |
|
|---|
| 335 | if (type === 'min' && min !== undefined) {
|
|---|
| 336 | return screen
|
|---|
| 337 | } else if (type === 'min' && max !== undefined) {
|
|---|
| 338 | return { ...screen, not: !screen.not }
|
|---|
| 339 | } else if (type === 'max' && max !== undefined) {
|
|---|
| 340 | return screen
|
|---|
| 341 | } else if (type === 'max' && min !== undefined) {
|
|---|
| 342 | return { ...screen, not: !screen.not }
|
|---|
| 343 | }
|
|---|
| 344 | })
|
|---|
| 345 | .map((screen) => [screen.name, screen])
|
|---|
| 346 | )
|
|---|
| 347 | }
|
|---|
| 348 |
|
|---|
| 349 | /**
|
|---|
| 350 | * @param {'min' | 'max'} type
|
|---|
| 351 | * @returns {(a: { value: string | Screen }, z: { value: string | Screen }) => number}
|
|---|
| 352 | */
|
|---|
| 353 | function buildSort(type) {
|
|---|
| 354 | return (a, z) => compareScreens(type, a.value, z.value)
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | let maxSort = buildSort('max')
|
|---|
| 358 | let minSort = buildSort('min')
|
|---|
| 359 |
|
|---|
| 360 | /** @param {'min'|'max'} type */
|
|---|
| 361 | function buildScreenVariant(type) {
|
|---|
| 362 | return (value) => {
|
|---|
| 363 | if (!areSimpleScreens) {
|
|---|
| 364 | log.warn('complex-screen-config', [
|
|---|
| 365 | 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects.',
|
|---|
| 366 | ])
|
|---|
| 367 |
|
|---|
| 368 | return []
|
|---|
| 369 | } else if (!screensUseConsistentUnits) {
|
|---|
| 370 | log.warn('mixed-screen-units', [
|
|---|
| 371 | 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
|
|---|
| 372 | ])
|
|---|
| 373 |
|
|---|
| 374 | return []
|
|---|
| 375 | } else if (typeof value === 'string' && !canUseUnits(value)) {
|
|---|
| 376 | log.warn('minmax-have-mixed-units', [
|
|---|
| 377 | 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
|
|---|
| 378 | ])
|
|---|
| 379 |
|
|---|
| 380 | return []
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | return [`@media ${buildMediaQuery(toScreen(value, type))}`]
|
|---|
| 384 | }
|
|---|
| 385 | }
|
|---|
| 386 |
|
|---|
| 387 | matchVariant('max', buildScreenVariant('max'), {
|
|---|
| 388 | sort: maxSort,
|
|---|
| 389 | values: areSimpleScreens ? buildScreenValues('max') : {},
|
|---|
| 390 | })
|
|---|
| 391 |
|
|---|
| 392 | // screens and min-* are sorted together when they can be
|
|---|
| 393 | let id = 'min-screens'
|
|---|
| 394 | for (let screen of screens) {
|
|---|
| 395 | addVariant(screen.name, `@media ${buildMediaQuery(screen)}`, {
|
|---|
| 396 | id,
|
|---|
| 397 | sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
|
|---|
| 398 | value: screen,
|
|---|
| 399 | })
|
|---|
| 400 | }
|
|---|
| 401 |
|
|---|
| 402 | matchVariant('min', buildScreenVariant('min'), {
|
|---|
| 403 | id,
|
|---|
| 404 | sort: minSort,
|
|---|
| 405 | })
|
|---|
| 406 | },
|
|---|
| 407 |
|
|---|
| 408 | supportsVariants: ({ matchVariant, theme }) => {
|
|---|
| 409 | matchVariant(
|
|---|
| 410 | 'supports',
|
|---|
| 411 | (value = '') => {
|
|---|
| 412 | let check = value.startsWith('--') ? value : normalize(value)
|
|---|
| 413 | let isRaw = /^[\w-]*\s*\(/.test(check)
|
|---|
| 414 |
|
|---|
| 415 | // Chrome has a bug where `(condition1)or(condition2)` is not valid
|
|---|
| 416 | // But `(condition1) or (condition2)` is supported.
|
|---|
| 417 | check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check
|
|---|
| 418 |
|
|---|
| 419 | if (isRaw) {
|
|---|
| 420 | return `@supports ${check}`
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | if (!check.includes(':')) {
|
|---|
| 424 | check = `${check}: var(--tw)`
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | if (!(check.startsWith('(') && check.endsWith(')'))) {
|
|---|
| 428 | check = `(${check})`
|
|---|
| 429 | }
|
|---|
| 430 |
|
|---|
| 431 | return `@supports ${check}`
|
|---|
| 432 | },
|
|---|
| 433 | { values: theme('supports') ?? {} }
|
|---|
| 434 | )
|
|---|
| 435 | },
|
|---|
| 436 |
|
|---|
| 437 | hasVariants: ({ matchVariant, prefix }) => {
|
|---|
| 438 | matchVariant('has', (value) => `&:has(${normalize(value)})`, {
|
|---|
| 439 | values: {},
|
|---|
| 440 | [INTERNAL_FEATURES]: {
|
|---|
| 441 | respectPrefix: false,
|
|---|
| 442 | },
|
|---|
| 443 | })
|
|---|
| 444 |
|
|---|
| 445 | matchVariant(
|
|---|
| 446 | 'group-has',
|
|---|
| 447 | (value, { modifier }) =>
|
|---|
| 448 | modifier
|
|---|
| 449 | ? `:merge(${prefix('.group')}\\/${modifier}):has(${normalize(value)}) &`
|
|---|
| 450 | : `:merge(${prefix('.group')}):has(${normalize(value)}) &`,
|
|---|
| 451 | {
|
|---|
| 452 | values: {},
|
|---|
| 453 | [INTERNAL_FEATURES]: {
|
|---|
| 454 | respectPrefix: false,
|
|---|
| 455 | },
|
|---|
| 456 | }
|
|---|
| 457 | )
|
|---|
| 458 |
|
|---|
| 459 | matchVariant(
|
|---|
| 460 | 'peer-has',
|
|---|
| 461 | (value, { modifier }) =>
|
|---|
| 462 | modifier
|
|---|
| 463 | ? `:merge(${prefix('.peer')}\\/${modifier}):has(${normalize(value)}) ~ &`
|
|---|
| 464 | : `:merge(${prefix('.peer')}):has(${normalize(value)}) ~ &`,
|
|---|
| 465 | {
|
|---|
| 466 | values: {},
|
|---|
| 467 | [INTERNAL_FEATURES]: {
|
|---|
| 468 | respectPrefix: false,
|
|---|
| 469 | },
|
|---|
| 470 | }
|
|---|
| 471 | )
|
|---|
| 472 | },
|
|---|
| 473 |
|
|---|
| 474 | ariaVariants: ({ matchVariant, theme }) => {
|
|---|
| 475 | matchVariant('aria', (value) => `&[aria-${normalizeAttributeSelectors(normalize(value))}]`, {
|
|---|
| 476 | values: theme('aria') ?? {},
|
|---|
| 477 | })
|
|---|
| 478 | matchVariant(
|
|---|
| 479 | 'group-aria',
|
|---|
| 480 | (value, { modifier }) =>
|
|---|
| 481 | modifier
|
|---|
| 482 | ? `:merge(.group\\/${modifier})[aria-${normalizeAttributeSelectors(normalize(value))}] &`
|
|---|
| 483 | : `:merge(.group)[aria-${normalizeAttributeSelectors(normalize(value))}] &`,
|
|---|
| 484 | { values: theme('aria') ?? {} }
|
|---|
| 485 | )
|
|---|
| 486 | matchVariant(
|
|---|
| 487 | 'peer-aria',
|
|---|
| 488 | (value, { modifier }) =>
|
|---|
| 489 | modifier
|
|---|
| 490 | ? `:merge(.peer\\/${modifier})[aria-${normalizeAttributeSelectors(normalize(value))}] ~ &`
|
|---|
| 491 | : `:merge(.peer)[aria-${normalizeAttributeSelectors(normalize(value))}] ~ &`,
|
|---|
| 492 | { values: theme('aria') ?? {} }
|
|---|
| 493 | )
|
|---|
| 494 | },
|
|---|
| 495 |
|
|---|
| 496 | dataVariants: ({ matchVariant, theme }) => {
|
|---|
| 497 | matchVariant('data', (value) => `&[data-${normalizeAttributeSelectors(normalize(value))}]`, {
|
|---|
| 498 | values: theme('data') ?? {},
|
|---|
| 499 | })
|
|---|
| 500 | matchVariant(
|
|---|
| 501 | 'group-data',
|
|---|
| 502 | (value, { modifier }) =>
|
|---|
| 503 | modifier
|
|---|
| 504 | ? `:merge(.group\\/${modifier})[data-${normalizeAttributeSelectors(normalize(value))}] &`
|
|---|
| 505 | : `:merge(.group)[data-${normalizeAttributeSelectors(normalize(value))}] &`,
|
|---|
| 506 | { values: theme('data') ?? {} }
|
|---|
| 507 | )
|
|---|
| 508 | matchVariant(
|
|---|
| 509 | 'peer-data',
|
|---|
| 510 | (value, { modifier }) =>
|
|---|
| 511 | modifier
|
|---|
| 512 | ? `:merge(.peer\\/${modifier})[data-${normalizeAttributeSelectors(normalize(value))}] ~ &`
|
|---|
| 513 | : `:merge(.peer)[data-${normalizeAttributeSelectors(normalize(value))}] ~ &`,
|
|---|
| 514 | { values: theme('data') ?? {} }
|
|---|
| 515 | )
|
|---|
| 516 | },
|
|---|
| 517 |
|
|---|
| 518 | orientationVariants: ({ addVariant }) => {
|
|---|
| 519 | addVariant('portrait', '@media (orientation: portrait)')
|
|---|
| 520 | addVariant('landscape', '@media (orientation: landscape)')
|
|---|
| 521 | },
|
|---|
| 522 |
|
|---|
| 523 | prefersContrastVariants: ({ addVariant }) => {
|
|---|
| 524 | addVariant('contrast-more', '@media (prefers-contrast: more)')
|
|---|
| 525 | addVariant('contrast-less', '@media (prefers-contrast: less)')
|
|---|
| 526 | },
|
|---|
| 527 |
|
|---|
| 528 | forcedColorsVariants: ({ addVariant }) => {
|
|---|
| 529 | addVariant('forced-colors', '@media (forced-colors: active)')
|
|---|
| 530 | },
|
|---|
| 531 | }
|
|---|
| 532 |
|
|---|
| 533 | let cssTransformValue = [
|
|---|
| 534 | 'translate(var(--tw-translate-x), var(--tw-translate-y))',
|
|---|
| 535 | 'rotate(var(--tw-rotate))',
|
|---|
| 536 | 'skewX(var(--tw-skew-x))',
|
|---|
| 537 | 'skewY(var(--tw-skew-y))',
|
|---|
| 538 | 'scaleX(var(--tw-scale-x))',
|
|---|
| 539 | 'scaleY(var(--tw-scale-y))',
|
|---|
| 540 | ].join(' ')
|
|---|
| 541 |
|
|---|
| 542 | let cssFilterValue = [
|
|---|
| 543 | 'var(--tw-blur)',
|
|---|
| 544 | 'var(--tw-brightness)',
|
|---|
| 545 | 'var(--tw-contrast)',
|
|---|
| 546 | 'var(--tw-grayscale)',
|
|---|
| 547 | 'var(--tw-hue-rotate)',
|
|---|
| 548 | 'var(--tw-invert)',
|
|---|
| 549 | 'var(--tw-saturate)',
|
|---|
| 550 | 'var(--tw-sepia)',
|
|---|
| 551 | 'var(--tw-drop-shadow)',
|
|---|
| 552 | ].join(' ')
|
|---|
| 553 |
|
|---|
| 554 | let cssBackdropFilterValue = [
|
|---|
| 555 | 'var(--tw-backdrop-blur)',
|
|---|
| 556 | 'var(--tw-backdrop-brightness)',
|
|---|
| 557 | 'var(--tw-backdrop-contrast)',
|
|---|
| 558 | 'var(--tw-backdrop-grayscale)',
|
|---|
| 559 | 'var(--tw-backdrop-hue-rotate)',
|
|---|
| 560 | 'var(--tw-backdrop-invert)',
|
|---|
| 561 | 'var(--tw-backdrop-opacity)',
|
|---|
| 562 | 'var(--tw-backdrop-saturate)',
|
|---|
| 563 | 'var(--tw-backdrop-sepia)',
|
|---|
| 564 | ].join(' ')
|
|---|
| 565 |
|
|---|
| 566 | export let corePlugins = {
|
|---|
| 567 | preflight: ({ addBase }) => {
|
|---|
| 568 | let preflightStyles = postcss.parse(
|
|---|
| 569 | fs.readFileSync(path.join(__dirname, './css/preflight.css'), 'utf8')
|
|---|
| 570 | )
|
|---|
| 571 |
|
|---|
| 572 | addBase([
|
|---|
| 573 | postcss.comment({
|
|---|
| 574 | text: `! tailwindcss v${tailwindVersion} | MIT License | https://tailwindcss.com`,
|
|---|
| 575 | }),
|
|---|
| 576 | ...preflightStyles.nodes,
|
|---|
| 577 | ])
|
|---|
| 578 | },
|
|---|
| 579 |
|
|---|
| 580 | container: (() => {
|
|---|
| 581 | function extractMinWidths(breakpoints = []) {
|
|---|
| 582 | return breakpoints
|
|---|
| 583 | .flatMap((breakpoint) => breakpoint.values.map((breakpoint) => breakpoint.min))
|
|---|
| 584 | .filter((v) => v !== undefined)
|
|---|
| 585 | }
|
|---|
| 586 |
|
|---|
| 587 | function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|---|
| 588 | if (typeof paddings === 'undefined') {
|
|---|
| 589 | return []
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | if (!(typeof paddings === 'object' && paddings !== null)) {
|
|---|
| 593 | return [
|
|---|
| 594 | {
|
|---|
| 595 | screen: 'DEFAULT',
|
|---|
| 596 | minWidth: 0,
|
|---|
| 597 | padding: paddings,
|
|---|
| 598 | },
|
|---|
| 599 | ]
|
|---|
| 600 | }
|
|---|
| 601 |
|
|---|
| 602 | let mapping = []
|
|---|
| 603 |
|
|---|
| 604 | if (paddings.DEFAULT) {
|
|---|
| 605 | mapping.push({
|
|---|
| 606 | screen: 'DEFAULT',
|
|---|
| 607 | minWidth: 0,
|
|---|
| 608 | padding: paddings.DEFAULT,
|
|---|
| 609 | })
|
|---|
| 610 | }
|
|---|
| 611 |
|
|---|
| 612 | for (let minWidth of minWidths) {
|
|---|
| 613 | for (let screen of screens) {
|
|---|
| 614 | for (let { min } of screen.values) {
|
|---|
| 615 | if (min === minWidth) {
|
|---|
| 616 | mapping.push({ minWidth, padding: paddings[screen.name] })
|
|---|
| 617 | }
|
|---|
| 618 | }
|
|---|
| 619 | }
|
|---|
| 620 | }
|
|---|
| 621 |
|
|---|
| 622 | return mapping
|
|---|
| 623 | }
|
|---|
| 624 |
|
|---|
| 625 | return function ({ addComponents, theme }) {
|
|---|
| 626 | let screens = normalizeScreens(theme('container.screens', theme('screens')))
|
|---|
| 627 | let minWidths = extractMinWidths(screens)
|
|---|
| 628 | let paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'))
|
|---|
| 629 |
|
|---|
| 630 | let generatePaddingFor = (minWidth) => {
|
|---|
| 631 | let paddingConfig = paddings.find((padding) => padding.minWidth === minWidth)
|
|---|
| 632 |
|
|---|
| 633 | if (!paddingConfig) {
|
|---|
| 634 | return {}
|
|---|
| 635 | }
|
|---|
| 636 |
|
|---|
| 637 | return {
|
|---|
| 638 | paddingRight: paddingConfig.padding,
|
|---|
| 639 | paddingLeft: paddingConfig.padding,
|
|---|
| 640 | }
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | let atRules = Array.from(
|
|---|
| 644 | new Set(minWidths.slice().sort((a, z) => parseInt(a) - parseInt(z)))
|
|---|
| 645 | ).map((minWidth) => ({
|
|---|
| 646 | [`@media (min-width: ${minWidth})`]: {
|
|---|
| 647 | '.container': {
|
|---|
| 648 | 'max-width': minWidth,
|
|---|
| 649 | ...generatePaddingFor(minWidth),
|
|---|
| 650 | },
|
|---|
| 651 | },
|
|---|
| 652 | }))
|
|---|
| 653 |
|
|---|
| 654 | addComponents([
|
|---|
| 655 | {
|
|---|
| 656 | '.container': Object.assign(
|
|---|
| 657 | { width: '100%' },
|
|---|
| 658 | theme('container.center', false) ? { marginRight: 'auto', marginLeft: 'auto' } : {},
|
|---|
| 659 | generatePaddingFor(0)
|
|---|
| 660 | ),
|
|---|
| 661 | },
|
|---|
| 662 | ...atRules,
|
|---|
| 663 | ])
|
|---|
| 664 | }
|
|---|
| 665 | })(),
|
|---|
| 666 |
|
|---|
| 667 | accessibility: ({ addUtilities }) => {
|
|---|
| 668 | addUtilities({
|
|---|
| 669 | '.sr-only': {
|
|---|
| 670 | position: 'absolute',
|
|---|
| 671 | width: '1px',
|
|---|
| 672 | height: '1px',
|
|---|
| 673 | padding: '0',
|
|---|
| 674 | margin: '-1px',
|
|---|
| 675 | overflow: 'hidden',
|
|---|
| 676 | clip: 'rect(0, 0, 0, 0)',
|
|---|
| 677 | whiteSpace: 'nowrap',
|
|---|
| 678 | borderWidth: '0',
|
|---|
| 679 | },
|
|---|
| 680 | '.not-sr-only': {
|
|---|
| 681 | position: 'static',
|
|---|
| 682 | width: 'auto',
|
|---|
| 683 | height: 'auto',
|
|---|
| 684 | padding: '0',
|
|---|
| 685 | margin: '0',
|
|---|
| 686 | overflow: 'visible',
|
|---|
| 687 | clip: 'auto',
|
|---|
| 688 | whiteSpace: 'normal',
|
|---|
| 689 | },
|
|---|
| 690 | })
|
|---|
| 691 | },
|
|---|
| 692 |
|
|---|
| 693 | pointerEvents: ({ addUtilities }) => {
|
|---|
| 694 | addUtilities({
|
|---|
| 695 | '.pointer-events-none': { 'pointer-events': 'none' },
|
|---|
| 696 | '.pointer-events-auto': { 'pointer-events': 'auto' },
|
|---|
| 697 | })
|
|---|
| 698 | },
|
|---|
| 699 |
|
|---|
| 700 | visibility: ({ addUtilities }) => {
|
|---|
| 701 | addUtilities({
|
|---|
| 702 | '.visible': { visibility: 'visible' },
|
|---|
| 703 | '.invisible': { visibility: 'hidden' },
|
|---|
| 704 | '.collapse': { visibility: 'collapse' },
|
|---|
| 705 | })
|
|---|
| 706 | },
|
|---|
| 707 |
|
|---|
| 708 | position: ({ addUtilities }) => {
|
|---|
| 709 | addUtilities({
|
|---|
| 710 | '.static': { position: 'static' },
|
|---|
| 711 | '.fixed': { position: 'fixed' },
|
|---|
| 712 | '.absolute': { position: 'absolute' },
|
|---|
| 713 | '.relative': { position: 'relative' },
|
|---|
| 714 | '.sticky': { position: 'sticky' },
|
|---|
| 715 | })
|
|---|
| 716 | },
|
|---|
| 717 |
|
|---|
| 718 | inset: createUtilityPlugin(
|
|---|
| 719 | 'inset',
|
|---|
| 720 | [
|
|---|
| 721 | ['inset', ['inset']],
|
|---|
| 722 | [
|
|---|
| 723 | ['inset-x', ['left', 'right']],
|
|---|
| 724 | ['inset-y', ['top', 'bottom']],
|
|---|
| 725 | ],
|
|---|
| 726 | [
|
|---|
| 727 | ['start', ['inset-inline-start']],
|
|---|
| 728 | ['end', ['inset-inline-end']],
|
|---|
| 729 | ['top', ['top']],
|
|---|
| 730 | ['right', ['right']],
|
|---|
| 731 | ['bottom', ['bottom']],
|
|---|
| 732 | ['left', ['left']],
|
|---|
| 733 | ],
|
|---|
| 734 | ],
|
|---|
| 735 | { supportsNegativeValues: true }
|
|---|
| 736 | ),
|
|---|
| 737 |
|
|---|
| 738 | isolation: ({ addUtilities }) => {
|
|---|
| 739 | addUtilities({
|
|---|
| 740 | '.isolate': { isolation: 'isolate' },
|
|---|
| 741 | '.isolation-auto': { isolation: 'auto' },
|
|---|
| 742 | })
|
|---|
| 743 | },
|
|---|
| 744 |
|
|---|
| 745 | zIndex: createUtilityPlugin('zIndex', [['z', ['zIndex']]], { supportsNegativeValues: true }),
|
|---|
| 746 | order: createUtilityPlugin('order', undefined, { supportsNegativeValues: true }),
|
|---|
| 747 | gridColumn: createUtilityPlugin('gridColumn', [['col', ['gridColumn']]]),
|
|---|
| 748 | gridColumnStart: createUtilityPlugin('gridColumnStart', [['col-start', ['gridColumnStart']]], {
|
|---|
| 749 | supportsNegativeValues: true,
|
|---|
| 750 | }),
|
|---|
| 751 | gridColumnEnd: createUtilityPlugin('gridColumnEnd', [['col-end', ['gridColumnEnd']]], {
|
|---|
| 752 | supportsNegativeValues: true,
|
|---|
| 753 | }),
|
|---|
| 754 | gridRow: createUtilityPlugin('gridRow', [['row', ['gridRow']]]),
|
|---|
| 755 | gridRowStart: createUtilityPlugin('gridRowStart', [['row-start', ['gridRowStart']]], {
|
|---|
| 756 | supportsNegativeValues: true,
|
|---|
| 757 | }),
|
|---|
| 758 | gridRowEnd: createUtilityPlugin('gridRowEnd', [['row-end', ['gridRowEnd']]], {
|
|---|
| 759 | supportsNegativeValues: true,
|
|---|
| 760 | }),
|
|---|
| 761 |
|
|---|
| 762 | float: ({ addUtilities }) => {
|
|---|
| 763 | addUtilities({
|
|---|
| 764 | '.float-start': { float: 'inline-start' },
|
|---|
| 765 | '.float-end': { float: 'inline-end' },
|
|---|
| 766 | '.float-right': { float: 'right' },
|
|---|
| 767 | '.float-left': { float: 'left' },
|
|---|
| 768 | '.float-none': { float: 'none' },
|
|---|
| 769 | })
|
|---|
| 770 | },
|
|---|
| 771 |
|
|---|
| 772 | clear: ({ addUtilities }) => {
|
|---|
| 773 | addUtilities({
|
|---|
| 774 | '.clear-start': { clear: 'inline-start' },
|
|---|
| 775 | '.clear-end': { clear: 'inline-end' },
|
|---|
| 776 | '.clear-left': { clear: 'left' },
|
|---|
| 777 | '.clear-right': { clear: 'right' },
|
|---|
| 778 | '.clear-both': { clear: 'both' },
|
|---|
| 779 | '.clear-none': { clear: 'none' },
|
|---|
| 780 | })
|
|---|
| 781 | },
|
|---|
| 782 |
|
|---|
| 783 | margin: createUtilityPlugin(
|
|---|
| 784 | 'margin',
|
|---|
| 785 | [
|
|---|
| 786 | ['m', ['margin']],
|
|---|
| 787 | [
|
|---|
| 788 | ['mx', ['margin-left', 'margin-right']],
|
|---|
| 789 | ['my', ['margin-top', 'margin-bottom']],
|
|---|
| 790 | ],
|
|---|
| 791 | [
|
|---|
| 792 | ['ms', ['margin-inline-start']],
|
|---|
| 793 | ['me', ['margin-inline-end']],
|
|---|
| 794 | ['mt', ['margin-top']],
|
|---|
| 795 | ['mr', ['margin-right']],
|
|---|
| 796 | ['mb', ['margin-bottom']],
|
|---|
| 797 | ['ml', ['margin-left']],
|
|---|
| 798 | ],
|
|---|
| 799 | ],
|
|---|
| 800 | { supportsNegativeValues: true }
|
|---|
| 801 | ),
|
|---|
| 802 |
|
|---|
| 803 | boxSizing: ({ addUtilities }) => {
|
|---|
| 804 | addUtilities({
|
|---|
| 805 | '.box-border': { 'box-sizing': 'border-box' },
|
|---|
| 806 | '.box-content': { 'box-sizing': 'content-box' },
|
|---|
| 807 | })
|
|---|
| 808 | },
|
|---|
| 809 |
|
|---|
| 810 | lineClamp: ({ matchUtilities, addUtilities, theme }) => {
|
|---|
| 811 | matchUtilities(
|
|---|
| 812 | {
|
|---|
| 813 | 'line-clamp': (value) => ({
|
|---|
| 814 | overflow: 'hidden',
|
|---|
| 815 | display: '-webkit-box',
|
|---|
| 816 | '-webkit-box-orient': 'vertical',
|
|---|
| 817 | '-webkit-line-clamp': `${value}`,
|
|---|
| 818 | }),
|
|---|
| 819 | },
|
|---|
| 820 | { values: theme('lineClamp') }
|
|---|
| 821 | )
|
|---|
| 822 |
|
|---|
| 823 | addUtilities({
|
|---|
| 824 | '.line-clamp-none': {
|
|---|
| 825 | overflow: 'visible',
|
|---|
| 826 | display: 'block',
|
|---|
| 827 | '-webkit-box-orient': 'horizontal',
|
|---|
| 828 | '-webkit-line-clamp': 'none',
|
|---|
| 829 | },
|
|---|
| 830 | })
|
|---|
| 831 | },
|
|---|
| 832 |
|
|---|
| 833 | display: ({ addUtilities }) => {
|
|---|
| 834 | addUtilities({
|
|---|
| 835 | '.block': { display: 'block' },
|
|---|
| 836 | '.inline-block': { display: 'inline-block' },
|
|---|
| 837 | '.inline': { display: 'inline' },
|
|---|
| 838 | '.flex': { display: 'flex' },
|
|---|
| 839 | '.inline-flex': { display: 'inline-flex' },
|
|---|
| 840 | '.table': { display: 'table' },
|
|---|
| 841 | '.inline-table': { display: 'inline-table' },
|
|---|
| 842 | '.table-caption': { display: 'table-caption' },
|
|---|
| 843 | '.table-cell': { display: 'table-cell' },
|
|---|
| 844 | '.table-column': { display: 'table-column' },
|
|---|
| 845 | '.table-column-group': { display: 'table-column-group' },
|
|---|
| 846 | '.table-footer-group': { display: 'table-footer-group' },
|
|---|
| 847 | '.table-header-group': { display: 'table-header-group' },
|
|---|
| 848 | '.table-row-group': { display: 'table-row-group' },
|
|---|
| 849 | '.table-row': { display: 'table-row' },
|
|---|
| 850 | '.flow-root': { display: 'flow-root' },
|
|---|
| 851 | '.grid': { display: 'grid' },
|
|---|
| 852 | '.inline-grid': { display: 'inline-grid' },
|
|---|
| 853 | '.contents': { display: 'contents' },
|
|---|
| 854 | '.list-item': { display: 'list-item' },
|
|---|
| 855 | '.hidden': { display: 'none' },
|
|---|
| 856 | })
|
|---|
| 857 | },
|
|---|
| 858 |
|
|---|
| 859 | aspectRatio: createUtilityPlugin('aspectRatio', [['aspect', ['aspect-ratio']]]),
|
|---|
| 860 |
|
|---|
| 861 | size: createUtilityPlugin('size', [['size', ['width', 'height']]]),
|
|---|
| 862 |
|
|---|
| 863 | height: createUtilityPlugin('height', [['h', ['height']]]),
|
|---|
| 864 | maxHeight: createUtilityPlugin('maxHeight', [['max-h', ['maxHeight']]]),
|
|---|
| 865 | minHeight: createUtilityPlugin('minHeight', [['min-h', ['minHeight']]]),
|
|---|
| 866 |
|
|---|
| 867 | width: createUtilityPlugin('width', [['w', ['width']]]),
|
|---|
| 868 | minWidth: createUtilityPlugin('minWidth', [['min-w', ['minWidth']]]),
|
|---|
| 869 | maxWidth: createUtilityPlugin('maxWidth', [['max-w', ['maxWidth']]]),
|
|---|
| 870 |
|
|---|
| 871 | flex: createUtilityPlugin('flex'),
|
|---|
| 872 | flexShrink: createUtilityPlugin('flexShrink', [
|
|---|
| 873 | ['flex-shrink', ['flex-shrink']], // Deprecated
|
|---|
| 874 | ['shrink', ['flex-shrink']],
|
|---|
| 875 | ]),
|
|---|
| 876 | flexGrow: createUtilityPlugin('flexGrow', [
|
|---|
| 877 | ['flex-grow', ['flex-grow']], // Deprecated
|
|---|
| 878 | ['grow', ['flex-grow']],
|
|---|
| 879 | ]),
|
|---|
| 880 | flexBasis: createUtilityPlugin('flexBasis', [['basis', ['flex-basis']]]),
|
|---|
| 881 |
|
|---|
| 882 | tableLayout: ({ addUtilities }) => {
|
|---|
| 883 | addUtilities({
|
|---|
| 884 | '.table-auto': { 'table-layout': 'auto' },
|
|---|
| 885 | '.table-fixed': { 'table-layout': 'fixed' },
|
|---|
| 886 | })
|
|---|
| 887 | },
|
|---|
| 888 |
|
|---|
| 889 | captionSide: ({ addUtilities }) => {
|
|---|
| 890 | addUtilities({
|
|---|
| 891 | '.caption-top': { 'caption-side': 'top' },
|
|---|
| 892 | '.caption-bottom': { 'caption-side': 'bottom' },
|
|---|
| 893 | })
|
|---|
| 894 | },
|
|---|
| 895 |
|
|---|
| 896 | borderCollapse: ({ addUtilities }) => {
|
|---|
| 897 | addUtilities({
|
|---|
| 898 | '.border-collapse': { 'border-collapse': 'collapse' },
|
|---|
| 899 | '.border-separate': { 'border-collapse': 'separate' },
|
|---|
| 900 | })
|
|---|
| 901 | },
|
|---|
| 902 |
|
|---|
| 903 | borderSpacing: ({ addDefaults, matchUtilities, theme }) => {
|
|---|
| 904 | addDefaults('border-spacing', {
|
|---|
| 905 | '--tw-border-spacing-x': 0,
|
|---|
| 906 | '--tw-border-spacing-y': 0,
|
|---|
| 907 | })
|
|---|
| 908 |
|
|---|
| 909 | matchUtilities(
|
|---|
| 910 | {
|
|---|
| 911 | 'border-spacing': (value) => {
|
|---|
| 912 | return {
|
|---|
| 913 | '--tw-border-spacing-x': value,
|
|---|
| 914 | '--tw-border-spacing-y': value,
|
|---|
| 915 | '@defaults border-spacing': {},
|
|---|
| 916 | 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
|
|---|
| 917 | }
|
|---|
| 918 | },
|
|---|
| 919 | 'border-spacing-x': (value) => {
|
|---|
| 920 | return {
|
|---|
| 921 | '--tw-border-spacing-x': value,
|
|---|
| 922 | '@defaults border-spacing': {},
|
|---|
| 923 | 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
|
|---|
| 924 | }
|
|---|
| 925 | },
|
|---|
| 926 | 'border-spacing-y': (value) => {
|
|---|
| 927 | return {
|
|---|
| 928 | '--tw-border-spacing-y': value,
|
|---|
| 929 | '@defaults border-spacing': {},
|
|---|
| 930 | 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
|
|---|
| 931 | }
|
|---|
| 932 | },
|
|---|
| 933 | },
|
|---|
| 934 | { values: theme('borderSpacing') }
|
|---|
| 935 | )
|
|---|
| 936 | },
|
|---|
| 937 |
|
|---|
| 938 | transformOrigin: createUtilityPlugin('transformOrigin', [['origin', ['transformOrigin']]]),
|
|---|
| 939 | translate: createUtilityPlugin(
|
|---|
| 940 | 'translate',
|
|---|
| 941 | [
|
|---|
| 942 | [
|
|---|
| 943 | [
|
|---|
| 944 | 'translate-x',
|
|---|
| 945 | [['@defaults transform', {}], '--tw-translate-x', ['transform', cssTransformValue]],
|
|---|
| 946 | ],
|
|---|
| 947 | [
|
|---|
| 948 | 'translate-y',
|
|---|
| 949 | [['@defaults transform', {}], '--tw-translate-y', ['transform', cssTransformValue]],
|
|---|
| 950 | ],
|
|---|
| 951 | ],
|
|---|
| 952 | ],
|
|---|
| 953 | { supportsNegativeValues: true }
|
|---|
| 954 | ),
|
|---|
| 955 | rotate: createUtilityPlugin(
|
|---|
| 956 | 'rotate',
|
|---|
| 957 | [['rotate', [['@defaults transform', {}], '--tw-rotate', ['transform', cssTransformValue]]]],
|
|---|
| 958 | { supportsNegativeValues: true }
|
|---|
| 959 | ),
|
|---|
| 960 | skew: createUtilityPlugin(
|
|---|
| 961 | 'skew',
|
|---|
| 962 | [
|
|---|
| 963 | [
|
|---|
| 964 | ['skew-x', [['@defaults transform', {}], '--tw-skew-x', ['transform', cssTransformValue]]],
|
|---|
| 965 | ['skew-y', [['@defaults transform', {}], '--tw-skew-y', ['transform', cssTransformValue]]],
|
|---|
| 966 | ],
|
|---|
| 967 | ],
|
|---|
| 968 | { supportsNegativeValues: true }
|
|---|
| 969 | ),
|
|---|
| 970 | scale: createUtilityPlugin(
|
|---|
| 971 | 'scale',
|
|---|
| 972 | [
|
|---|
| 973 | [
|
|---|
| 974 | 'scale',
|
|---|
| 975 | [
|
|---|
| 976 | ['@defaults transform', {}],
|
|---|
| 977 | '--tw-scale-x',
|
|---|
| 978 | '--tw-scale-y',
|
|---|
| 979 | ['transform', cssTransformValue],
|
|---|
| 980 | ],
|
|---|
| 981 | ],
|
|---|
| 982 | [
|
|---|
| 983 | [
|
|---|
| 984 | 'scale-x',
|
|---|
| 985 | [['@defaults transform', {}], '--tw-scale-x', ['transform', cssTransformValue]],
|
|---|
| 986 | ],
|
|---|
| 987 | [
|
|---|
| 988 | 'scale-y',
|
|---|
| 989 | [['@defaults transform', {}], '--tw-scale-y', ['transform', cssTransformValue]],
|
|---|
| 990 | ],
|
|---|
| 991 | ],
|
|---|
| 992 | ],
|
|---|
| 993 | { supportsNegativeValues: true }
|
|---|
| 994 | ),
|
|---|
| 995 |
|
|---|
| 996 | transform: ({ addDefaults, addUtilities }) => {
|
|---|
| 997 | addDefaults('transform', {
|
|---|
| 998 | '--tw-translate-x': '0',
|
|---|
| 999 | '--tw-translate-y': '0',
|
|---|
| 1000 | '--tw-rotate': '0',
|
|---|
| 1001 | '--tw-skew-x': '0',
|
|---|
| 1002 | '--tw-skew-y': '0',
|
|---|
| 1003 | '--tw-scale-x': '1',
|
|---|
| 1004 | '--tw-scale-y': '1',
|
|---|
| 1005 | })
|
|---|
| 1006 |
|
|---|
| 1007 | addUtilities({
|
|---|
| 1008 | '.transform': { '@defaults transform': {}, transform: cssTransformValue },
|
|---|
| 1009 | '.transform-cpu': {
|
|---|
| 1010 | transform: cssTransformValue,
|
|---|
| 1011 | },
|
|---|
| 1012 | '.transform-gpu': {
|
|---|
| 1013 | transform: cssTransformValue.replace(
|
|---|
| 1014 | 'translate(var(--tw-translate-x), var(--tw-translate-y))',
|
|---|
| 1015 | 'translate3d(var(--tw-translate-x), var(--tw-translate-y), 0)'
|
|---|
| 1016 | ),
|
|---|
| 1017 | },
|
|---|
| 1018 | '.transform-none': { transform: 'none' },
|
|---|
| 1019 | })
|
|---|
| 1020 | },
|
|---|
| 1021 |
|
|---|
| 1022 | animation: ({ matchUtilities, theme, config }) => {
|
|---|
| 1023 | let prefixName = (name) => escapeClassName(config('prefix') + name)
|
|---|
| 1024 | let keyframes = Object.fromEntries(
|
|---|
| 1025 | Object.entries(theme('keyframes') ?? {}).map(([key, value]) => {
|
|---|
| 1026 | return [key, { [`@keyframes ${prefixName(key)}`]: value }]
|
|---|
| 1027 | })
|
|---|
| 1028 | )
|
|---|
| 1029 |
|
|---|
| 1030 | matchUtilities(
|
|---|
| 1031 | {
|
|---|
| 1032 | animate: (value) => {
|
|---|
| 1033 | let animations = parseAnimationValue(value)
|
|---|
| 1034 |
|
|---|
| 1035 | return [
|
|---|
| 1036 | ...animations.flatMap((animation) => keyframes[animation.name]),
|
|---|
| 1037 | {
|
|---|
| 1038 | animation: animations
|
|---|
| 1039 | .map(({ name, value }) => {
|
|---|
| 1040 | if (name === undefined || keyframes[name] === undefined) {
|
|---|
| 1041 | return value
|
|---|
| 1042 | }
|
|---|
| 1043 | return value.replace(name, prefixName(name))
|
|---|
| 1044 | })
|
|---|
| 1045 | .join(', '),
|
|---|
| 1046 | },
|
|---|
| 1047 | ]
|
|---|
| 1048 | },
|
|---|
| 1049 | },
|
|---|
| 1050 | { values: theme('animation') }
|
|---|
| 1051 | )
|
|---|
| 1052 | },
|
|---|
| 1053 |
|
|---|
| 1054 | cursor: createUtilityPlugin('cursor'),
|
|---|
| 1055 |
|
|---|
| 1056 | touchAction: ({ addDefaults, addUtilities }) => {
|
|---|
| 1057 | addDefaults('touch-action', {
|
|---|
| 1058 | '--tw-pan-x': ' ',
|
|---|
| 1059 | '--tw-pan-y': ' ',
|
|---|
| 1060 | '--tw-pinch-zoom': ' ',
|
|---|
| 1061 | })
|
|---|
| 1062 |
|
|---|
| 1063 | let cssTouchActionValue = 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
|
|---|
| 1064 |
|
|---|
| 1065 | addUtilities({
|
|---|
| 1066 | '.touch-auto': { 'touch-action': 'auto' },
|
|---|
| 1067 | '.touch-none': { 'touch-action': 'none' },
|
|---|
| 1068 | '.touch-pan-x': {
|
|---|
| 1069 | '@defaults touch-action': {},
|
|---|
| 1070 | '--tw-pan-x': 'pan-x',
|
|---|
| 1071 | 'touch-action': cssTouchActionValue,
|
|---|
| 1072 | },
|
|---|
| 1073 | '.touch-pan-left': {
|
|---|
| 1074 | '@defaults touch-action': {},
|
|---|
| 1075 | '--tw-pan-x': 'pan-left',
|
|---|
| 1076 | 'touch-action': cssTouchActionValue,
|
|---|
| 1077 | },
|
|---|
| 1078 | '.touch-pan-right': {
|
|---|
| 1079 | '@defaults touch-action': {},
|
|---|
| 1080 | '--tw-pan-x': 'pan-right',
|
|---|
| 1081 | 'touch-action': cssTouchActionValue,
|
|---|
| 1082 | },
|
|---|
| 1083 | '.touch-pan-y': {
|
|---|
| 1084 | '@defaults touch-action': {},
|
|---|
| 1085 | '--tw-pan-y': 'pan-y',
|
|---|
| 1086 | 'touch-action': cssTouchActionValue,
|
|---|
| 1087 | },
|
|---|
| 1088 | '.touch-pan-up': {
|
|---|
| 1089 | '@defaults touch-action': {},
|
|---|
| 1090 | '--tw-pan-y': 'pan-up',
|
|---|
| 1091 | 'touch-action': cssTouchActionValue,
|
|---|
| 1092 | },
|
|---|
| 1093 | '.touch-pan-down': {
|
|---|
| 1094 | '@defaults touch-action': {},
|
|---|
| 1095 | '--tw-pan-y': 'pan-down',
|
|---|
| 1096 | 'touch-action': cssTouchActionValue,
|
|---|
| 1097 | },
|
|---|
| 1098 | '.touch-pinch-zoom': {
|
|---|
| 1099 | '@defaults touch-action': {},
|
|---|
| 1100 | '--tw-pinch-zoom': 'pinch-zoom',
|
|---|
| 1101 | 'touch-action': cssTouchActionValue,
|
|---|
| 1102 | },
|
|---|
| 1103 | '.touch-manipulation': { 'touch-action': 'manipulation' },
|
|---|
| 1104 | })
|
|---|
| 1105 | },
|
|---|
| 1106 |
|
|---|
| 1107 | userSelect: ({ addUtilities }) => {
|
|---|
| 1108 | addUtilities({
|
|---|
| 1109 | '.select-none': { 'user-select': 'none' },
|
|---|
| 1110 | '.select-text': { 'user-select': 'text' },
|
|---|
| 1111 | '.select-all': { 'user-select': 'all' },
|
|---|
| 1112 | '.select-auto': { 'user-select': 'auto' },
|
|---|
| 1113 | })
|
|---|
| 1114 | },
|
|---|
| 1115 |
|
|---|
| 1116 | resize: ({ addUtilities }) => {
|
|---|
| 1117 | addUtilities({
|
|---|
| 1118 | '.resize-none': { resize: 'none' },
|
|---|
| 1119 | '.resize-y': { resize: 'vertical' },
|
|---|
| 1120 | '.resize-x': { resize: 'horizontal' },
|
|---|
| 1121 | '.resize': { resize: 'both' },
|
|---|
| 1122 | })
|
|---|
| 1123 | },
|
|---|
| 1124 |
|
|---|
| 1125 | scrollSnapType: ({ addDefaults, addUtilities }) => {
|
|---|
| 1126 | addDefaults('scroll-snap-type', {
|
|---|
| 1127 | '--tw-scroll-snap-strictness': 'proximity',
|
|---|
| 1128 | })
|
|---|
| 1129 |
|
|---|
| 1130 | addUtilities({
|
|---|
| 1131 | '.snap-none': { 'scroll-snap-type': 'none' },
|
|---|
| 1132 | '.snap-x': {
|
|---|
| 1133 | '@defaults scroll-snap-type': {},
|
|---|
| 1134 | 'scroll-snap-type': 'x var(--tw-scroll-snap-strictness)',
|
|---|
| 1135 | },
|
|---|
| 1136 | '.snap-y': {
|
|---|
| 1137 | '@defaults scroll-snap-type': {},
|
|---|
| 1138 | 'scroll-snap-type': 'y var(--tw-scroll-snap-strictness)',
|
|---|
| 1139 | },
|
|---|
| 1140 | '.snap-both': {
|
|---|
| 1141 | '@defaults scroll-snap-type': {},
|
|---|
| 1142 | 'scroll-snap-type': 'both var(--tw-scroll-snap-strictness)',
|
|---|
| 1143 | },
|
|---|
| 1144 | '.snap-mandatory': { '--tw-scroll-snap-strictness': 'mandatory' },
|
|---|
| 1145 | '.snap-proximity': { '--tw-scroll-snap-strictness': 'proximity' },
|
|---|
| 1146 | })
|
|---|
| 1147 | },
|
|---|
| 1148 |
|
|---|
| 1149 | scrollSnapAlign: ({ addUtilities }) => {
|
|---|
| 1150 | addUtilities({
|
|---|
| 1151 | '.snap-start': { 'scroll-snap-align': 'start' },
|
|---|
| 1152 | '.snap-end': { 'scroll-snap-align': 'end' },
|
|---|
| 1153 | '.snap-center': { 'scroll-snap-align': 'center' },
|
|---|
| 1154 | '.snap-align-none': { 'scroll-snap-align': 'none' },
|
|---|
| 1155 | })
|
|---|
| 1156 | },
|
|---|
| 1157 |
|
|---|
| 1158 | scrollSnapStop: ({ addUtilities }) => {
|
|---|
| 1159 | addUtilities({
|
|---|
| 1160 | '.snap-normal': { 'scroll-snap-stop': 'normal' },
|
|---|
| 1161 | '.snap-always': { 'scroll-snap-stop': 'always' },
|
|---|
| 1162 | })
|
|---|
| 1163 | },
|
|---|
| 1164 |
|
|---|
| 1165 | scrollMargin: createUtilityPlugin(
|
|---|
| 1166 | 'scrollMargin',
|
|---|
| 1167 | [
|
|---|
| 1168 | ['scroll-m', ['scroll-margin']],
|
|---|
| 1169 | [
|
|---|
| 1170 | ['scroll-mx', ['scroll-margin-left', 'scroll-margin-right']],
|
|---|
| 1171 | ['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
|
|---|
| 1172 | ],
|
|---|
| 1173 | [
|
|---|
| 1174 | ['scroll-ms', ['scroll-margin-inline-start']],
|
|---|
| 1175 | ['scroll-me', ['scroll-margin-inline-end']],
|
|---|
| 1176 | ['scroll-mt', ['scroll-margin-top']],
|
|---|
| 1177 | ['scroll-mr', ['scroll-margin-right']],
|
|---|
| 1178 | ['scroll-mb', ['scroll-margin-bottom']],
|
|---|
| 1179 | ['scroll-ml', ['scroll-margin-left']],
|
|---|
| 1180 | ],
|
|---|
| 1181 | ],
|
|---|
| 1182 | { supportsNegativeValues: true }
|
|---|
| 1183 | ),
|
|---|
| 1184 |
|
|---|
| 1185 | scrollPadding: createUtilityPlugin('scrollPadding', [
|
|---|
| 1186 | ['scroll-p', ['scroll-padding']],
|
|---|
| 1187 | [
|
|---|
| 1188 | ['scroll-px', ['scroll-padding-left', 'scroll-padding-right']],
|
|---|
| 1189 | ['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
|
|---|
| 1190 | ],
|
|---|
| 1191 | [
|
|---|
| 1192 | ['scroll-ps', ['scroll-padding-inline-start']],
|
|---|
| 1193 | ['scroll-pe', ['scroll-padding-inline-end']],
|
|---|
| 1194 | ['scroll-pt', ['scroll-padding-top']],
|
|---|
| 1195 | ['scroll-pr', ['scroll-padding-right']],
|
|---|
| 1196 | ['scroll-pb', ['scroll-padding-bottom']],
|
|---|
| 1197 | ['scroll-pl', ['scroll-padding-left']],
|
|---|
| 1198 | ],
|
|---|
| 1199 | ]),
|
|---|
| 1200 |
|
|---|
| 1201 | listStylePosition: ({ addUtilities }) => {
|
|---|
| 1202 | addUtilities({
|
|---|
| 1203 | '.list-inside': { 'list-style-position': 'inside' },
|
|---|
| 1204 | '.list-outside': { 'list-style-position': 'outside' },
|
|---|
| 1205 | })
|
|---|
| 1206 | },
|
|---|
| 1207 | listStyleType: createUtilityPlugin('listStyleType', [['list', ['listStyleType']]]),
|
|---|
| 1208 | listStyleImage: createUtilityPlugin('listStyleImage', [['list-image', ['listStyleImage']]]),
|
|---|
| 1209 |
|
|---|
| 1210 | appearance: ({ addUtilities }) => {
|
|---|
| 1211 | addUtilities({
|
|---|
| 1212 | '.appearance-none': { appearance: 'none' },
|
|---|
| 1213 | '.appearance-auto': { appearance: 'auto' },
|
|---|
| 1214 | })
|
|---|
| 1215 | },
|
|---|
| 1216 |
|
|---|
| 1217 | columns: createUtilityPlugin('columns', [['columns', ['columns']]]),
|
|---|
| 1218 |
|
|---|
| 1219 | breakBefore: ({ addUtilities }) => {
|
|---|
| 1220 | addUtilities({
|
|---|
| 1221 | '.break-before-auto': { 'break-before': 'auto' },
|
|---|
| 1222 | '.break-before-avoid': { 'break-before': 'avoid' },
|
|---|
| 1223 | '.break-before-all': { 'break-before': 'all' },
|
|---|
| 1224 | '.break-before-avoid-page': { 'break-before': 'avoid-page' },
|
|---|
| 1225 | '.break-before-page': { 'break-before': 'page' },
|
|---|
| 1226 | '.break-before-left': { 'break-before': 'left' },
|
|---|
| 1227 | '.break-before-right': { 'break-before': 'right' },
|
|---|
| 1228 | '.break-before-column': { 'break-before': 'column' },
|
|---|
| 1229 | })
|
|---|
| 1230 | },
|
|---|
| 1231 |
|
|---|
| 1232 | breakInside: ({ addUtilities }) => {
|
|---|
| 1233 | addUtilities({
|
|---|
| 1234 | '.break-inside-auto': { 'break-inside': 'auto' },
|
|---|
| 1235 | '.break-inside-avoid': { 'break-inside': 'avoid' },
|
|---|
| 1236 | '.break-inside-avoid-page': { 'break-inside': 'avoid-page' },
|
|---|
| 1237 | '.break-inside-avoid-column': { 'break-inside': 'avoid-column' },
|
|---|
| 1238 | })
|
|---|
| 1239 | },
|
|---|
| 1240 |
|
|---|
| 1241 | breakAfter: ({ addUtilities }) => {
|
|---|
| 1242 | addUtilities({
|
|---|
| 1243 | '.break-after-auto': { 'break-after': 'auto' },
|
|---|
| 1244 | '.break-after-avoid': { 'break-after': 'avoid' },
|
|---|
| 1245 | '.break-after-all': { 'break-after': 'all' },
|
|---|
| 1246 | '.break-after-avoid-page': { 'break-after': 'avoid-page' },
|
|---|
| 1247 | '.break-after-page': { 'break-after': 'page' },
|
|---|
| 1248 | '.break-after-left': { 'break-after': 'left' },
|
|---|
| 1249 | '.break-after-right': { 'break-after': 'right' },
|
|---|
| 1250 | '.break-after-column': { 'break-after': 'column' },
|
|---|
| 1251 | })
|
|---|
| 1252 | },
|
|---|
| 1253 |
|
|---|
| 1254 | gridAutoColumns: createUtilityPlugin('gridAutoColumns', [['auto-cols', ['gridAutoColumns']]]),
|
|---|
| 1255 |
|
|---|
| 1256 | gridAutoFlow: ({ addUtilities }) => {
|
|---|
| 1257 | addUtilities({
|
|---|
| 1258 | '.grid-flow-row': { gridAutoFlow: 'row' },
|
|---|
| 1259 | '.grid-flow-col': { gridAutoFlow: 'column' },
|
|---|
| 1260 | '.grid-flow-dense': { gridAutoFlow: 'dense' },
|
|---|
| 1261 | '.grid-flow-row-dense': { gridAutoFlow: 'row dense' },
|
|---|
| 1262 | '.grid-flow-col-dense': { gridAutoFlow: 'column dense' },
|
|---|
| 1263 | })
|
|---|
| 1264 | },
|
|---|
| 1265 |
|
|---|
| 1266 | gridAutoRows: createUtilityPlugin('gridAutoRows', [['auto-rows', ['gridAutoRows']]]),
|
|---|
| 1267 | gridTemplateColumns: createUtilityPlugin('gridTemplateColumns', [
|
|---|
| 1268 | ['grid-cols', ['gridTemplateColumns']],
|
|---|
| 1269 | ]),
|
|---|
| 1270 | gridTemplateRows: createUtilityPlugin('gridTemplateRows', [['grid-rows', ['gridTemplateRows']]]),
|
|---|
| 1271 |
|
|---|
| 1272 | flexDirection: ({ addUtilities }) => {
|
|---|
| 1273 | addUtilities({
|
|---|
| 1274 | '.flex-row': { 'flex-direction': 'row' },
|
|---|
| 1275 | '.flex-row-reverse': { 'flex-direction': 'row-reverse' },
|
|---|
| 1276 | '.flex-col': { 'flex-direction': 'column' },
|
|---|
| 1277 | '.flex-col-reverse': { 'flex-direction': 'column-reverse' },
|
|---|
| 1278 | })
|
|---|
| 1279 | },
|
|---|
| 1280 |
|
|---|
| 1281 | flexWrap: ({ addUtilities }) => {
|
|---|
| 1282 | addUtilities({
|
|---|
| 1283 | '.flex-wrap': { 'flex-wrap': 'wrap' },
|
|---|
| 1284 | '.flex-wrap-reverse': { 'flex-wrap': 'wrap-reverse' },
|
|---|
| 1285 | '.flex-nowrap': { 'flex-wrap': 'nowrap' },
|
|---|
| 1286 | })
|
|---|
| 1287 | },
|
|---|
| 1288 |
|
|---|
| 1289 | placeContent: ({ addUtilities }) => {
|
|---|
| 1290 | addUtilities({
|
|---|
| 1291 | '.place-content-center': { 'place-content': 'center' },
|
|---|
| 1292 | '.place-content-start': { 'place-content': 'start' },
|
|---|
| 1293 | '.place-content-end': { 'place-content': 'end' },
|
|---|
| 1294 | '.place-content-between': { 'place-content': 'space-between' },
|
|---|
| 1295 | '.place-content-around': { 'place-content': 'space-around' },
|
|---|
| 1296 | '.place-content-evenly': { 'place-content': 'space-evenly' },
|
|---|
| 1297 | '.place-content-baseline': { 'place-content': 'baseline' },
|
|---|
| 1298 | '.place-content-stretch': { 'place-content': 'stretch' },
|
|---|
| 1299 | })
|
|---|
| 1300 | },
|
|---|
| 1301 |
|
|---|
| 1302 | placeItems: ({ addUtilities }) => {
|
|---|
| 1303 | addUtilities({
|
|---|
| 1304 | '.place-items-start': { 'place-items': 'start' },
|
|---|
| 1305 | '.place-items-end': { 'place-items': 'end' },
|
|---|
| 1306 | '.place-items-center': { 'place-items': 'center' },
|
|---|
| 1307 | '.place-items-baseline': { 'place-items': 'baseline' },
|
|---|
| 1308 | '.place-items-stretch': { 'place-items': 'stretch' },
|
|---|
| 1309 | })
|
|---|
| 1310 | },
|
|---|
| 1311 |
|
|---|
| 1312 | alignContent: ({ addUtilities }) => {
|
|---|
| 1313 | addUtilities({
|
|---|
| 1314 | '.content-normal': { 'align-content': 'normal' },
|
|---|
| 1315 | '.content-center': { 'align-content': 'center' },
|
|---|
| 1316 | '.content-start': { 'align-content': 'flex-start' },
|
|---|
| 1317 | '.content-end': { 'align-content': 'flex-end' },
|
|---|
| 1318 | '.content-between': { 'align-content': 'space-between' },
|
|---|
| 1319 | '.content-around': { 'align-content': 'space-around' },
|
|---|
| 1320 | '.content-evenly': { 'align-content': 'space-evenly' },
|
|---|
| 1321 | '.content-baseline': { 'align-content': 'baseline' },
|
|---|
| 1322 | '.content-stretch': { 'align-content': 'stretch' },
|
|---|
| 1323 | })
|
|---|
| 1324 | },
|
|---|
| 1325 |
|
|---|
| 1326 | alignItems: ({ addUtilities }) => {
|
|---|
| 1327 | addUtilities({
|
|---|
| 1328 | '.items-start': { 'align-items': 'flex-start' },
|
|---|
| 1329 | '.items-end': { 'align-items': 'flex-end' },
|
|---|
| 1330 | '.items-center': { 'align-items': 'center' },
|
|---|
| 1331 | '.items-baseline': { 'align-items': 'baseline' },
|
|---|
| 1332 | '.items-stretch': { 'align-items': 'stretch' },
|
|---|
| 1333 | })
|
|---|
| 1334 | },
|
|---|
| 1335 |
|
|---|
| 1336 | justifyContent: ({ addUtilities }) => {
|
|---|
| 1337 | addUtilities({
|
|---|
| 1338 | '.justify-normal': { 'justify-content': 'normal' },
|
|---|
| 1339 | '.justify-start': { 'justify-content': 'flex-start' },
|
|---|
| 1340 | '.justify-end': { 'justify-content': 'flex-end' },
|
|---|
| 1341 | '.justify-center': { 'justify-content': 'center' },
|
|---|
| 1342 | '.justify-between': { 'justify-content': 'space-between' },
|
|---|
| 1343 | '.justify-around': { 'justify-content': 'space-around' },
|
|---|
| 1344 | '.justify-evenly': { 'justify-content': 'space-evenly' },
|
|---|
| 1345 | '.justify-stretch': { 'justify-content': 'stretch' },
|
|---|
| 1346 | })
|
|---|
| 1347 | },
|
|---|
| 1348 |
|
|---|
| 1349 | justifyItems: ({ addUtilities }) => {
|
|---|
| 1350 | addUtilities({
|
|---|
| 1351 | '.justify-items-start': { 'justify-items': 'start' },
|
|---|
| 1352 | '.justify-items-end': { 'justify-items': 'end' },
|
|---|
| 1353 | '.justify-items-center': { 'justify-items': 'center' },
|
|---|
| 1354 | '.justify-items-stretch': { 'justify-items': 'stretch' },
|
|---|
| 1355 | })
|
|---|
| 1356 | },
|
|---|
| 1357 |
|
|---|
| 1358 | gap: createUtilityPlugin('gap', [
|
|---|
| 1359 | ['gap', ['gap']],
|
|---|
| 1360 | [
|
|---|
| 1361 | ['gap-x', ['columnGap']],
|
|---|
| 1362 | ['gap-y', ['rowGap']],
|
|---|
| 1363 | ],
|
|---|
| 1364 | ]),
|
|---|
| 1365 |
|
|---|
| 1366 | space: ({ matchUtilities, addUtilities, theme }) => {
|
|---|
| 1367 | matchUtilities(
|
|---|
| 1368 | {
|
|---|
| 1369 | 'space-x': (value) => {
|
|---|
| 1370 | value = value === '0' ? '0px' : value
|
|---|
| 1371 |
|
|---|
| 1372 | return {
|
|---|
| 1373 | '& > :not([hidden]) ~ :not([hidden])': {
|
|---|
| 1374 | '--tw-space-x-reverse': '0',
|
|---|
| 1375 | 'margin-right': `calc(${value} * var(--tw-space-x-reverse))`,
|
|---|
| 1376 | 'margin-left': `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`,
|
|---|
| 1377 | },
|
|---|
| 1378 | }
|
|---|
| 1379 | },
|
|---|
| 1380 | 'space-y': (value) => {
|
|---|
| 1381 | value = value === '0' ? '0px' : value
|
|---|
| 1382 |
|
|---|
| 1383 | return {
|
|---|
| 1384 | '& > :not([hidden]) ~ :not([hidden])': {
|
|---|
| 1385 | '--tw-space-y-reverse': '0',
|
|---|
| 1386 | 'margin-top': `calc(${value} * calc(1 - var(--tw-space-y-reverse)))`,
|
|---|
| 1387 | 'margin-bottom': `calc(${value} * var(--tw-space-y-reverse))`,
|
|---|
| 1388 | },
|
|---|
| 1389 | }
|
|---|
| 1390 | },
|
|---|
| 1391 | },
|
|---|
| 1392 | { values: theme('space'), supportsNegativeValues: true }
|
|---|
| 1393 | )
|
|---|
| 1394 |
|
|---|
| 1395 | addUtilities({
|
|---|
| 1396 | '.space-y-reverse > :not([hidden]) ~ :not([hidden])': { '--tw-space-y-reverse': '1' },
|
|---|
| 1397 | '.space-x-reverse > :not([hidden]) ~ :not([hidden])': { '--tw-space-x-reverse': '1' },
|
|---|
| 1398 | })
|
|---|
| 1399 | },
|
|---|
| 1400 |
|
|---|
| 1401 | divideWidth: ({ matchUtilities, addUtilities, theme }) => {
|
|---|
| 1402 | matchUtilities(
|
|---|
| 1403 | {
|
|---|
| 1404 | 'divide-x': (value) => {
|
|---|
| 1405 | value = value === '0' ? '0px' : value
|
|---|
| 1406 |
|
|---|
| 1407 | return {
|
|---|
| 1408 | '& > :not([hidden]) ~ :not([hidden])': {
|
|---|
| 1409 | '@defaults border-width': {},
|
|---|
| 1410 | '--tw-divide-x-reverse': '0',
|
|---|
| 1411 | 'border-right-width': `calc(${value} * var(--tw-divide-x-reverse))`,
|
|---|
| 1412 | 'border-left-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
|
|---|
| 1413 | },
|
|---|
| 1414 | }
|
|---|
| 1415 | },
|
|---|
| 1416 | 'divide-y': (value) => {
|
|---|
| 1417 | value = value === '0' ? '0px' : value
|
|---|
| 1418 |
|
|---|
| 1419 | return {
|
|---|
| 1420 | '& > :not([hidden]) ~ :not([hidden])': {
|
|---|
| 1421 | '@defaults border-width': {},
|
|---|
| 1422 | '--tw-divide-y-reverse': '0',
|
|---|
| 1423 | 'border-top-width': `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`,
|
|---|
| 1424 | 'border-bottom-width': `calc(${value} * var(--tw-divide-y-reverse))`,
|
|---|
| 1425 | },
|
|---|
| 1426 | }
|
|---|
| 1427 | },
|
|---|
| 1428 | },
|
|---|
| 1429 | { values: theme('divideWidth'), type: ['line-width', 'length', 'any'] }
|
|---|
| 1430 | )
|
|---|
| 1431 |
|
|---|
| 1432 | addUtilities({
|
|---|
| 1433 | '.divide-y-reverse > :not([hidden]) ~ :not([hidden])': {
|
|---|
| 1434 | '@defaults border-width': {},
|
|---|
| 1435 | '--tw-divide-y-reverse': '1',
|
|---|
| 1436 | },
|
|---|
| 1437 | '.divide-x-reverse > :not([hidden]) ~ :not([hidden])': {
|
|---|
| 1438 | '@defaults border-width': {},
|
|---|
| 1439 | '--tw-divide-x-reverse': '1',
|
|---|
| 1440 | },
|
|---|
| 1441 | })
|
|---|
| 1442 | },
|
|---|
| 1443 |
|
|---|
| 1444 | divideStyle: ({ addUtilities }) => {
|
|---|
| 1445 | addUtilities({
|
|---|
| 1446 | '.divide-solid > :not([hidden]) ~ :not([hidden])': { 'border-style': 'solid' },
|
|---|
| 1447 | '.divide-dashed > :not([hidden]) ~ :not([hidden])': { 'border-style': 'dashed' },
|
|---|
| 1448 | '.divide-dotted > :not([hidden]) ~ :not([hidden])': { 'border-style': 'dotted' },
|
|---|
| 1449 | '.divide-double > :not([hidden]) ~ :not([hidden])': { 'border-style': 'double' },
|
|---|
| 1450 | '.divide-none > :not([hidden]) ~ :not([hidden])': { 'border-style': 'none' },
|
|---|
| 1451 | })
|
|---|
| 1452 | },
|
|---|
| 1453 |
|
|---|
| 1454 | divideColor: ({ matchUtilities, theme, corePlugins }) => {
|
|---|
| 1455 | matchUtilities(
|
|---|
| 1456 | {
|
|---|
| 1457 | divide: (value) => {
|
|---|
| 1458 | if (!corePlugins('divideOpacity')) {
|
|---|
| 1459 | return {
|
|---|
| 1460 | ['& > :not([hidden]) ~ :not([hidden])']: {
|
|---|
| 1461 | 'border-color': toColorValue(value),
|
|---|
| 1462 | },
|
|---|
| 1463 | }
|
|---|
| 1464 | }
|
|---|
| 1465 |
|
|---|
| 1466 | return {
|
|---|
| 1467 | ['& > :not([hidden]) ~ :not([hidden])']: withAlphaVariable({
|
|---|
| 1468 | color: value,
|
|---|
| 1469 | property: 'border-color',
|
|---|
| 1470 | variable: '--tw-divide-opacity',
|
|---|
| 1471 | }),
|
|---|
| 1472 | }
|
|---|
| 1473 | },
|
|---|
| 1474 | },
|
|---|
| 1475 | {
|
|---|
| 1476 | values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('divideColor'))),
|
|---|
| 1477 | type: ['color', 'any'],
|
|---|
| 1478 | }
|
|---|
| 1479 | )
|
|---|
| 1480 | },
|
|---|
| 1481 |
|
|---|
| 1482 | divideOpacity: ({ matchUtilities, theme }) => {
|
|---|
| 1483 | matchUtilities(
|
|---|
| 1484 | {
|
|---|
| 1485 | 'divide-opacity': (value) => {
|
|---|
| 1486 | return { [`& > :not([hidden]) ~ :not([hidden])`]: { '--tw-divide-opacity': value } }
|
|---|
| 1487 | },
|
|---|
| 1488 | },
|
|---|
| 1489 | { values: theme('divideOpacity') }
|
|---|
| 1490 | )
|
|---|
| 1491 | },
|
|---|
| 1492 |
|
|---|
| 1493 | placeSelf: ({ addUtilities }) => {
|
|---|
| 1494 | addUtilities({
|
|---|
| 1495 | '.place-self-auto': { 'place-self': 'auto' },
|
|---|
| 1496 | '.place-self-start': { 'place-self': 'start' },
|
|---|
| 1497 | '.place-self-end': { 'place-self': 'end' },
|
|---|
| 1498 | '.place-self-center': { 'place-self': 'center' },
|
|---|
| 1499 | '.place-self-stretch': { 'place-self': 'stretch' },
|
|---|
| 1500 | })
|
|---|
| 1501 | },
|
|---|
| 1502 |
|
|---|
| 1503 | alignSelf: ({ addUtilities }) => {
|
|---|
| 1504 | addUtilities({
|
|---|
| 1505 | '.self-auto': { 'align-self': 'auto' },
|
|---|
| 1506 | '.self-start': { 'align-self': 'flex-start' },
|
|---|
| 1507 | '.self-end': { 'align-self': 'flex-end' },
|
|---|
| 1508 | '.self-center': { 'align-self': 'center' },
|
|---|
| 1509 | '.self-stretch': { 'align-self': 'stretch' },
|
|---|
| 1510 | '.self-baseline': { 'align-self': 'baseline' },
|
|---|
| 1511 | })
|
|---|
| 1512 | },
|
|---|
| 1513 |
|
|---|
| 1514 | justifySelf: ({ addUtilities }) => {
|
|---|
| 1515 | addUtilities({
|
|---|
| 1516 | '.justify-self-auto': { 'justify-self': 'auto' },
|
|---|
| 1517 | '.justify-self-start': { 'justify-self': 'start' },
|
|---|
| 1518 | '.justify-self-end': { 'justify-self': 'end' },
|
|---|
| 1519 | '.justify-self-center': { 'justify-self': 'center' },
|
|---|
| 1520 | '.justify-self-stretch': { 'justify-self': 'stretch' },
|
|---|
| 1521 | })
|
|---|
| 1522 | },
|
|---|
| 1523 |
|
|---|
| 1524 | overflow: ({ addUtilities }) => {
|
|---|
| 1525 | addUtilities({
|
|---|
| 1526 | '.overflow-auto': { overflow: 'auto' },
|
|---|
| 1527 | '.overflow-hidden': { overflow: 'hidden' },
|
|---|
| 1528 | '.overflow-clip': { overflow: 'clip' },
|
|---|
| 1529 | '.overflow-visible': { overflow: 'visible' },
|
|---|
| 1530 | '.overflow-scroll': { overflow: 'scroll' },
|
|---|
| 1531 | '.overflow-x-auto': { 'overflow-x': 'auto' },
|
|---|
| 1532 | '.overflow-y-auto': { 'overflow-y': 'auto' },
|
|---|
| 1533 | '.overflow-x-hidden': { 'overflow-x': 'hidden' },
|
|---|
| 1534 | '.overflow-y-hidden': { 'overflow-y': 'hidden' },
|
|---|
| 1535 | '.overflow-x-clip': { 'overflow-x': 'clip' },
|
|---|
| 1536 | '.overflow-y-clip': { 'overflow-y': 'clip' },
|
|---|
| 1537 | '.overflow-x-visible': { 'overflow-x': 'visible' },
|
|---|
| 1538 | '.overflow-y-visible': { 'overflow-y': 'visible' },
|
|---|
| 1539 | '.overflow-x-scroll': { 'overflow-x': 'scroll' },
|
|---|
| 1540 | '.overflow-y-scroll': { 'overflow-y': 'scroll' },
|
|---|
| 1541 | })
|
|---|
| 1542 | },
|
|---|
| 1543 |
|
|---|
| 1544 | overscrollBehavior: ({ addUtilities }) => {
|
|---|
| 1545 | addUtilities({
|
|---|
| 1546 | '.overscroll-auto': { 'overscroll-behavior': 'auto' },
|
|---|
| 1547 | '.overscroll-contain': { 'overscroll-behavior': 'contain' },
|
|---|
| 1548 | '.overscroll-none': { 'overscroll-behavior': 'none' },
|
|---|
| 1549 | '.overscroll-y-auto': { 'overscroll-behavior-y': 'auto' },
|
|---|
| 1550 | '.overscroll-y-contain': { 'overscroll-behavior-y': 'contain' },
|
|---|
| 1551 | '.overscroll-y-none': { 'overscroll-behavior-y': 'none' },
|
|---|
| 1552 | '.overscroll-x-auto': { 'overscroll-behavior-x': 'auto' },
|
|---|
| 1553 | '.overscroll-x-contain': { 'overscroll-behavior-x': 'contain' },
|
|---|
| 1554 | '.overscroll-x-none': { 'overscroll-behavior-x': 'none' },
|
|---|
| 1555 | })
|
|---|
| 1556 | },
|
|---|
| 1557 |
|
|---|
| 1558 | scrollBehavior: ({ addUtilities }) => {
|
|---|
| 1559 | addUtilities({
|
|---|
| 1560 | '.scroll-auto': { 'scroll-behavior': 'auto' },
|
|---|
| 1561 | '.scroll-smooth': { 'scroll-behavior': 'smooth' },
|
|---|
| 1562 | })
|
|---|
| 1563 | },
|
|---|
| 1564 |
|
|---|
| 1565 | textOverflow: ({ addUtilities }) => {
|
|---|
| 1566 | addUtilities({
|
|---|
| 1567 | '.truncate': { overflow: 'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap' },
|
|---|
| 1568 | '.overflow-ellipsis': { 'text-overflow': 'ellipsis' }, // Deprecated
|
|---|
| 1569 | '.text-ellipsis': { 'text-overflow': 'ellipsis' },
|
|---|
| 1570 | '.text-clip': { 'text-overflow': 'clip' },
|
|---|
| 1571 | })
|
|---|
| 1572 | },
|
|---|
| 1573 |
|
|---|
| 1574 | hyphens: ({ addUtilities }) => {
|
|---|
| 1575 | addUtilities({
|
|---|
| 1576 | '.hyphens-none': { hyphens: 'none' },
|
|---|
| 1577 | '.hyphens-manual': { hyphens: 'manual' },
|
|---|
| 1578 | '.hyphens-auto': { hyphens: 'auto' },
|
|---|
| 1579 | })
|
|---|
| 1580 | },
|
|---|
| 1581 |
|
|---|
| 1582 | whitespace: ({ addUtilities }) => {
|
|---|
| 1583 | addUtilities({
|
|---|
| 1584 | '.whitespace-normal': { 'white-space': 'normal' },
|
|---|
| 1585 | '.whitespace-nowrap': { 'white-space': 'nowrap' },
|
|---|
| 1586 | '.whitespace-pre': { 'white-space': 'pre' },
|
|---|
| 1587 | '.whitespace-pre-line': { 'white-space': 'pre-line' },
|
|---|
| 1588 | '.whitespace-pre-wrap': { 'white-space': 'pre-wrap' },
|
|---|
| 1589 | '.whitespace-break-spaces': { 'white-space': 'break-spaces' },
|
|---|
| 1590 | })
|
|---|
| 1591 | },
|
|---|
| 1592 |
|
|---|
| 1593 | textWrap: ({ addUtilities }) => {
|
|---|
| 1594 | addUtilities({
|
|---|
| 1595 | '.text-wrap': { 'text-wrap': 'wrap' },
|
|---|
| 1596 | '.text-nowrap': { 'text-wrap': 'nowrap' },
|
|---|
| 1597 | '.text-balance': { 'text-wrap': 'balance' },
|
|---|
| 1598 | '.text-pretty': { 'text-wrap': 'pretty' },
|
|---|
| 1599 | })
|
|---|
| 1600 | },
|
|---|
| 1601 |
|
|---|
| 1602 | wordBreak: ({ addUtilities }) => {
|
|---|
| 1603 | addUtilities({
|
|---|
| 1604 | '.break-normal': { 'overflow-wrap': 'normal', 'word-break': 'normal' },
|
|---|
| 1605 | '.break-words': { 'overflow-wrap': 'break-word' },
|
|---|
| 1606 | '.break-all': { 'word-break': 'break-all' },
|
|---|
| 1607 | '.break-keep': { 'word-break': 'keep-all' },
|
|---|
| 1608 | })
|
|---|
| 1609 | },
|
|---|
| 1610 |
|
|---|
| 1611 | borderRadius: createUtilityPlugin('borderRadius', [
|
|---|
| 1612 | ['rounded', ['border-radius']],
|
|---|
| 1613 | [
|
|---|
| 1614 | ['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
|
|---|
| 1615 | ['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
|
|---|
| 1616 | ['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
|
|---|
| 1617 | ['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
|
|---|
| 1618 | ['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
|
|---|
| 1619 | ['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
|
|---|
| 1620 | ],
|
|---|
| 1621 | [
|
|---|
| 1622 | ['rounded-ss', ['border-start-start-radius']],
|
|---|
| 1623 | ['rounded-se', ['border-start-end-radius']],
|
|---|
| 1624 | ['rounded-ee', ['border-end-end-radius']],
|
|---|
| 1625 | ['rounded-es', ['border-end-start-radius']],
|
|---|
| 1626 | ['rounded-tl', ['border-top-left-radius']],
|
|---|
| 1627 | ['rounded-tr', ['border-top-right-radius']],
|
|---|
| 1628 | ['rounded-br', ['border-bottom-right-radius']],
|
|---|
| 1629 | ['rounded-bl', ['border-bottom-left-radius']],
|
|---|
| 1630 | ],
|
|---|
| 1631 | ]),
|
|---|
| 1632 |
|
|---|
| 1633 | borderWidth: createUtilityPlugin(
|
|---|
| 1634 | 'borderWidth',
|
|---|
| 1635 | [
|
|---|
| 1636 | ['border', [['@defaults border-width', {}], 'border-width']],
|
|---|
| 1637 | [
|
|---|
| 1638 | ['border-x', [['@defaults border-width', {}], 'border-left-width', 'border-right-width']],
|
|---|
| 1639 | ['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
|
|---|
| 1640 | ],
|
|---|
| 1641 | [
|
|---|
| 1642 | ['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
|
|---|
| 1643 | ['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
|
|---|
| 1644 | ['border-t', [['@defaults border-width', {}], 'border-top-width']],
|
|---|
| 1645 | ['border-r', [['@defaults border-width', {}], 'border-right-width']],
|
|---|
| 1646 | ['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
|
|---|
| 1647 | ['border-l', [['@defaults border-width', {}], 'border-left-width']],
|
|---|
| 1648 | ],
|
|---|
| 1649 | ],
|
|---|
| 1650 | { type: ['line-width', 'length'] }
|
|---|
| 1651 | ),
|
|---|
| 1652 |
|
|---|
| 1653 | borderStyle: ({ addUtilities }) => {
|
|---|
| 1654 | addUtilities({
|
|---|
| 1655 | '.border-solid': { 'border-style': 'solid' },
|
|---|
| 1656 | '.border-dashed': { 'border-style': 'dashed' },
|
|---|
| 1657 | '.border-dotted': { 'border-style': 'dotted' },
|
|---|
| 1658 | '.border-double': { 'border-style': 'double' },
|
|---|
| 1659 | '.border-hidden': { 'border-style': 'hidden' },
|
|---|
| 1660 | '.border-none': { 'border-style': 'none' },
|
|---|
| 1661 | })
|
|---|
| 1662 | },
|
|---|
| 1663 |
|
|---|
| 1664 | borderColor: ({ matchUtilities, theme, corePlugins }) => {
|
|---|
| 1665 | matchUtilities(
|
|---|
| 1666 | {
|
|---|
| 1667 | border: (value) => {
|
|---|
| 1668 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1669 | return {
|
|---|
| 1670 | 'border-color': toColorValue(value),
|
|---|
| 1671 | }
|
|---|
| 1672 | }
|
|---|
| 1673 |
|
|---|
| 1674 | return withAlphaVariable({
|
|---|
| 1675 | color: value,
|
|---|
| 1676 | property: 'border-color',
|
|---|
| 1677 | variable: '--tw-border-opacity',
|
|---|
| 1678 | })
|
|---|
| 1679 | },
|
|---|
| 1680 | },
|
|---|
| 1681 | {
|
|---|
| 1682 | values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
|
|---|
| 1683 | type: ['color', 'any'],
|
|---|
| 1684 | }
|
|---|
| 1685 | )
|
|---|
| 1686 |
|
|---|
| 1687 | matchUtilities(
|
|---|
| 1688 | {
|
|---|
| 1689 | 'border-x': (value) => {
|
|---|
| 1690 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1691 | return {
|
|---|
| 1692 | 'border-left-color': toColorValue(value),
|
|---|
| 1693 | 'border-right-color': toColorValue(value),
|
|---|
| 1694 | }
|
|---|
| 1695 | }
|
|---|
| 1696 |
|
|---|
| 1697 | return withAlphaVariable({
|
|---|
| 1698 | color: value,
|
|---|
| 1699 | property: ['border-left-color', 'border-right-color'],
|
|---|
| 1700 | variable: '--tw-border-opacity',
|
|---|
| 1701 | })
|
|---|
| 1702 | },
|
|---|
| 1703 | 'border-y': (value) => {
|
|---|
| 1704 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1705 | return {
|
|---|
| 1706 | 'border-top-color': toColorValue(value),
|
|---|
| 1707 | 'border-bottom-color': toColorValue(value),
|
|---|
| 1708 | }
|
|---|
| 1709 | }
|
|---|
| 1710 |
|
|---|
| 1711 | return withAlphaVariable({
|
|---|
| 1712 | color: value,
|
|---|
| 1713 | property: ['border-top-color', 'border-bottom-color'],
|
|---|
| 1714 | variable: '--tw-border-opacity',
|
|---|
| 1715 | })
|
|---|
| 1716 | },
|
|---|
| 1717 | },
|
|---|
| 1718 | {
|
|---|
| 1719 | values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
|
|---|
| 1720 | type: ['color', 'any'],
|
|---|
| 1721 | }
|
|---|
| 1722 | )
|
|---|
| 1723 |
|
|---|
| 1724 | matchUtilities(
|
|---|
| 1725 | {
|
|---|
| 1726 | 'border-s': (value) => {
|
|---|
| 1727 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1728 | return {
|
|---|
| 1729 | 'border-inline-start-color': toColorValue(value),
|
|---|
| 1730 | }
|
|---|
| 1731 | }
|
|---|
| 1732 |
|
|---|
| 1733 | return withAlphaVariable({
|
|---|
| 1734 | color: value,
|
|---|
| 1735 | property: 'border-inline-start-color',
|
|---|
| 1736 | variable: '--tw-border-opacity',
|
|---|
| 1737 | })
|
|---|
| 1738 | },
|
|---|
| 1739 | 'border-e': (value) => {
|
|---|
| 1740 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1741 | return {
|
|---|
| 1742 | 'border-inline-end-color': toColorValue(value),
|
|---|
| 1743 | }
|
|---|
| 1744 | }
|
|---|
| 1745 |
|
|---|
| 1746 | return withAlphaVariable({
|
|---|
| 1747 | color: value,
|
|---|
| 1748 | property: 'border-inline-end-color',
|
|---|
| 1749 | variable: '--tw-border-opacity',
|
|---|
| 1750 | })
|
|---|
| 1751 | },
|
|---|
| 1752 | 'border-t': (value) => {
|
|---|
| 1753 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1754 | return {
|
|---|
| 1755 | 'border-top-color': toColorValue(value),
|
|---|
| 1756 | }
|
|---|
| 1757 | }
|
|---|
| 1758 |
|
|---|
| 1759 | return withAlphaVariable({
|
|---|
| 1760 | color: value,
|
|---|
| 1761 | property: 'border-top-color',
|
|---|
| 1762 | variable: '--tw-border-opacity',
|
|---|
| 1763 | })
|
|---|
| 1764 | },
|
|---|
| 1765 | 'border-r': (value) => {
|
|---|
| 1766 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1767 | return {
|
|---|
| 1768 | 'border-right-color': toColorValue(value),
|
|---|
| 1769 | }
|
|---|
| 1770 | }
|
|---|
| 1771 |
|
|---|
| 1772 | return withAlphaVariable({
|
|---|
| 1773 | color: value,
|
|---|
| 1774 | property: 'border-right-color',
|
|---|
| 1775 | variable: '--tw-border-opacity',
|
|---|
| 1776 | })
|
|---|
| 1777 | },
|
|---|
| 1778 | 'border-b': (value) => {
|
|---|
| 1779 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1780 | return {
|
|---|
| 1781 | 'border-bottom-color': toColorValue(value),
|
|---|
| 1782 | }
|
|---|
| 1783 | }
|
|---|
| 1784 |
|
|---|
| 1785 | return withAlphaVariable({
|
|---|
| 1786 | color: value,
|
|---|
| 1787 | property: 'border-bottom-color',
|
|---|
| 1788 | variable: '--tw-border-opacity',
|
|---|
| 1789 | })
|
|---|
| 1790 | },
|
|---|
| 1791 | 'border-l': (value) => {
|
|---|
| 1792 | if (!corePlugins('borderOpacity')) {
|
|---|
| 1793 | return {
|
|---|
| 1794 | 'border-left-color': toColorValue(value),
|
|---|
| 1795 | }
|
|---|
| 1796 | }
|
|---|
| 1797 |
|
|---|
| 1798 | return withAlphaVariable({
|
|---|
| 1799 | color: value,
|
|---|
| 1800 | property: 'border-left-color',
|
|---|
| 1801 | variable: '--tw-border-opacity',
|
|---|
| 1802 | })
|
|---|
| 1803 | },
|
|---|
| 1804 | },
|
|---|
| 1805 | {
|
|---|
| 1806 | values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
|
|---|
| 1807 | type: ['color', 'any'],
|
|---|
| 1808 | }
|
|---|
| 1809 | )
|
|---|
| 1810 | },
|
|---|
| 1811 |
|
|---|
| 1812 | borderOpacity: createUtilityPlugin('borderOpacity', [
|
|---|
| 1813 | ['border-opacity', ['--tw-border-opacity']],
|
|---|
| 1814 | ]),
|
|---|
| 1815 |
|
|---|
| 1816 | backgroundColor: ({ matchUtilities, theme, corePlugins }) => {
|
|---|
| 1817 | matchUtilities(
|
|---|
| 1818 | {
|
|---|
| 1819 | bg: (value) => {
|
|---|
| 1820 | if (!corePlugins('backgroundOpacity')) {
|
|---|
| 1821 | return {
|
|---|
| 1822 | 'background-color': toColorValue(value),
|
|---|
| 1823 | }
|
|---|
| 1824 | }
|
|---|
| 1825 |
|
|---|
| 1826 | return withAlphaVariable({
|
|---|
| 1827 | color: value,
|
|---|
| 1828 | property: 'background-color',
|
|---|
| 1829 | variable: '--tw-bg-opacity',
|
|---|
| 1830 | })
|
|---|
| 1831 | },
|
|---|
| 1832 | },
|
|---|
| 1833 | { values: flattenColorPalette(theme('backgroundColor')), type: ['color', 'any'] }
|
|---|
| 1834 | )
|
|---|
| 1835 | },
|
|---|
| 1836 |
|
|---|
| 1837 | backgroundOpacity: createUtilityPlugin('backgroundOpacity', [
|
|---|
| 1838 | ['bg-opacity', ['--tw-bg-opacity']],
|
|---|
| 1839 | ]),
|
|---|
| 1840 | backgroundImage: createUtilityPlugin('backgroundImage', [['bg', ['background-image']]], {
|
|---|
| 1841 | type: ['lookup', 'image', 'url'],
|
|---|
| 1842 | }),
|
|---|
| 1843 | gradientColorStops: (() => {
|
|---|
| 1844 | function transparentTo(value) {
|
|---|
| 1845 | return withAlphaValue(value, 0, 'rgb(255 255 255 / 0)')
|
|---|
| 1846 | }
|
|---|
| 1847 |
|
|---|
| 1848 | return function ({ matchUtilities, theme, addDefaults }) {
|
|---|
| 1849 | addDefaults('gradient-color-stops', {
|
|---|
| 1850 | '--tw-gradient-from-position': ' ',
|
|---|
| 1851 | '--tw-gradient-via-position': ' ',
|
|---|
| 1852 | '--tw-gradient-to-position': ' ',
|
|---|
| 1853 | })
|
|---|
| 1854 |
|
|---|
| 1855 | let options = {
|
|---|
| 1856 | values: flattenColorPalette(theme('gradientColorStops')),
|
|---|
| 1857 | type: ['color', 'any'],
|
|---|
| 1858 | }
|
|---|
| 1859 |
|
|---|
| 1860 | let positionOptions = {
|
|---|
| 1861 | values: theme('gradientColorStopPositions'),
|
|---|
| 1862 | type: ['length', 'percentage'],
|
|---|
| 1863 | }
|
|---|
| 1864 |
|
|---|
| 1865 | matchUtilities(
|
|---|
| 1866 | {
|
|---|
| 1867 | from: (value) => {
|
|---|
| 1868 | let transparentToValue = transparentTo(value)
|
|---|
| 1869 |
|
|---|
| 1870 | return {
|
|---|
| 1871 | '@defaults gradient-color-stops': {},
|
|---|
| 1872 | '--tw-gradient-from': `${toColorValue(value)} var(--tw-gradient-from-position)`,
|
|---|
| 1873 | '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
|
|---|
| 1874 | '--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to)`,
|
|---|
| 1875 | }
|
|---|
| 1876 | },
|
|---|
| 1877 | },
|
|---|
| 1878 | options
|
|---|
| 1879 | )
|
|---|
| 1880 |
|
|---|
| 1881 | matchUtilities(
|
|---|
| 1882 | {
|
|---|
| 1883 | from: (value) => {
|
|---|
| 1884 | return {
|
|---|
| 1885 | '--tw-gradient-from-position': value,
|
|---|
| 1886 | }
|
|---|
| 1887 | },
|
|---|
| 1888 | },
|
|---|
| 1889 | positionOptions
|
|---|
| 1890 | )
|
|---|
| 1891 |
|
|---|
| 1892 | matchUtilities(
|
|---|
| 1893 | {
|
|---|
| 1894 | via: (value) => {
|
|---|
| 1895 | let transparentToValue = transparentTo(value)
|
|---|
| 1896 |
|
|---|
| 1897 | return {
|
|---|
| 1898 | '@defaults gradient-color-stops': {},
|
|---|
| 1899 | '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
|
|---|
| 1900 | '--tw-gradient-stops': `var(--tw-gradient-from), ${toColorValue(
|
|---|
| 1901 | value
|
|---|
| 1902 | )} var(--tw-gradient-via-position), var(--tw-gradient-to)`,
|
|---|
| 1903 | }
|
|---|
| 1904 | },
|
|---|
| 1905 | },
|
|---|
| 1906 | options
|
|---|
| 1907 | )
|
|---|
| 1908 |
|
|---|
| 1909 | matchUtilities(
|
|---|
| 1910 | {
|
|---|
| 1911 | via: (value) => {
|
|---|
| 1912 | return {
|
|---|
| 1913 | '--tw-gradient-via-position': value,
|
|---|
| 1914 | }
|
|---|
| 1915 | },
|
|---|
| 1916 | },
|
|---|
| 1917 | positionOptions
|
|---|
| 1918 | )
|
|---|
| 1919 |
|
|---|
| 1920 | matchUtilities(
|
|---|
| 1921 | {
|
|---|
| 1922 | to: (value) => ({
|
|---|
| 1923 | '@defaults gradient-color-stops': {},
|
|---|
| 1924 | '--tw-gradient-to': `${toColorValue(value)} var(--tw-gradient-to-position)`,
|
|---|
| 1925 | }),
|
|---|
| 1926 | },
|
|---|
| 1927 | options
|
|---|
| 1928 | )
|
|---|
| 1929 |
|
|---|
| 1930 | matchUtilities(
|
|---|
| 1931 | {
|
|---|
| 1932 | to: (value) => {
|
|---|
| 1933 | return {
|
|---|
| 1934 | '--tw-gradient-to-position': value,
|
|---|
| 1935 | }
|
|---|
| 1936 | },
|
|---|
| 1937 | },
|
|---|
| 1938 | positionOptions
|
|---|
| 1939 | )
|
|---|
| 1940 | }
|
|---|
| 1941 | })(),
|
|---|
| 1942 |
|
|---|
| 1943 | boxDecorationBreak: ({ addUtilities }) => {
|
|---|
| 1944 | addUtilities({
|
|---|
| 1945 | '.decoration-slice': { 'box-decoration-break': 'slice' }, // Deprecated
|
|---|
| 1946 | '.decoration-clone': { 'box-decoration-break': 'clone' }, // Deprecated
|
|---|
| 1947 | '.box-decoration-slice': { 'box-decoration-break': 'slice' },
|
|---|
| 1948 | '.box-decoration-clone': { 'box-decoration-break': 'clone' },
|
|---|
| 1949 | })
|
|---|
| 1950 | },
|
|---|
| 1951 |
|
|---|
| 1952 | backgroundSize: createUtilityPlugin('backgroundSize', [['bg', ['background-size']]], {
|
|---|
| 1953 | type: ['lookup', 'length', 'percentage', 'size'],
|
|---|
| 1954 | }),
|
|---|
| 1955 |
|
|---|
| 1956 | backgroundAttachment: ({ addUtilities }) => {
|
|---|
| 1957 | addUtilities({
|
|---|
| 1958 | '.bg-fixed': { 'background-attachment': 'fixed' },
|
|---|
| 1959 | '.bg-local': { 'background-attachment': 'local' },
|
|---|
| 1960 | '.bg-scroll': { 'background-attachment': 'scroll' },
|
|---|
| 1961 | })
|
|---|
| 1962 | },
|
|---|
| 1963 |
|
|---|
| 1964 | backgroundClip: ({ addUtilities }) => {
|
|---|
| 1965 | addUtilities({
|
|---|
| 1966 | '.bg-clip-border': { 'background-clip': 'border-box' },
|
|---|
| 1967 | '.bg-clip-padding': { 'background-clip': 'padding-box' },
|
|---|
| 1968 | '.bg-clip-content': { 'background-clip': 'content-box' },
|
|---|
| 1969 | '.bg-clip-text': { 'background-clip': 'text' },
|
|---|
| 1970 | })
|
|---|
| 1971 | },
|
|---|
| 1972 |
|
|---|
| 1973 | backgroundPosition: createUtilityPlugin('backgroundPosition', [['bg', ['background-position']]], {
|
|---|
| 1974 | type: ['lookup', ['position', { preferOnConflict: true }]],
|
|---|
| 1975 | }),
|
|---|
| 1976 |
|
|---|
| 1977 | backgroundRepeat: ({ addUtilities }) => {
|
|---|
| 1978 | addUtilities({
|
|---|
| 1979 | '.bg-repeat': { 'background-repeat': 'repeat' },
|
|---|
| 1980 | '.bg-no-repeat': { 'background-repeat': 'no-repeat' },
|
|---|
| 1981 | '.bg-repeat-x': { 'background-repeat': 'repeat-x' },
|
|---|
| 1982 | '.bg-repeat-y': { 'background-repeat': 'repeat-y' },
|
|---|
| 1983 | '.bg-repeat-round': { 'background-repeat': 'round' },
|
|---|
| 1984 | '.bg-repeat-space': { 'background-repeat': 'space' },
|
|---|
| 1985 | })
|
|---|
| 1986 | },
|
|---|
| 1987 |
|
|---|
| 1988 | backgroundOrigin: ({ addUtilities }) => {
|
|---|
| 1989 | addUtilities({
|
|---|
| 1990 | '.bg-origin-border': { 'background-origin': 'border-box' },
|
|---|
| 1991 | '.bg-origin-padding': { 'background-origin': 'padding-box' },
|
|---|
| 1992 | '.bg-origin-content': { 'background-origin': 'content-box' },
|
|---|
| 1993 | })
|
|---|
| 1994 | },
|
|---|
| 1995 |
|
|---|
| 1996 | fill: ({ matchUtilities, theme }) => {
|
|---|
| 1997 | matchUtilities(
|
|---|
| 1998 | {
|
|---|
| 1999 | fill: (value) => {
|
|---|
| 2000 | return { fill: toColorValue(value) }
|
|---|
| 2001 | },
|
|---|
| 2002 | },
|
|---|
| 2003 | { values: flattenColorPalette(theme('fill')), type: ['color', 'any'] }
|
|---|
| 2004 | )
|
|---|
| 2005 | },
|
|---|
| 2006 |
|
|---|
| 2007 | stroke: ({ matchUtilities, theme }) => {
|
|---|
| 2008 | matchUtilities(
|
|---|
| 2009 | {
|
|---|
| 2010 | stroke: (value) => {
|
|---|
| 2011 | return { stroke: toColorValue(value) }
|
|---|
| 2012 | },
|
|---|
| 2013 | },
|
|---|
| 2014 | { values: flattenColorPalette(theme('stroke')), type: ['color', 'url', 'any'] }
|
|---|
| 2015 | )
|
|---|
| 2016 | },
|
|---|
| 2017 |
|
|---|
| 2018 | strokeWidth: createUtilityPlugin('strokeWidth', [['stroke', ['stroke-width']]], {
|
|---|
| 2019 | type: ['length', 'number', 'percentage'],
|
|---|
| 2020 | }),
|
|---|
| 2021 |
|
|---|
| 2022 | objectFit: ({ addUtilities }) => {
|
|---|
| 2023 | addUtilities({
|
|---|
| 2024 | '.object-contain': { 'object-fit': 'contain' },
|
|---|
| 2025 | '.object-cover': { 'object-fit': 'cover' },
|
|---|
| 2026 | '.object-fill': { 'object-fit': 'fill' },
|
|---|
| 2027 | '.object-none': { 'object-fit': 'none' },
|
|---|
| 2028 | '.object-scale-down': { 'object-fit': 'scale-down' },
|
|---|
| 2029 | })
|
|---|
| 2030 | },
|
|---|
| 2031 | objectPosition: createUtilityPlugin('objectPosition', [['object', ['object-position']]]),
|
|---|
| 2032 |
|
|---|
| 2033 | padding: createUtilityPlugin('padding', [
|
|---|
| 2034 | ['p', ['padding']],
|
|---|
| 2035 | [
|
|---|
| 2036 | ['px', ['padding-left', 'padding-right']],
|
|---|
| 2037 | ['py', ['padding-top', 'padding-bottom']],
|
|---|
| 2038 | ],
|
|---|
| 2039 | [
|
|---|
| 2040 | ['ps', ['padding-inline-start']],
|
|---|
| 2041 | ['pe', ['padding-inline-end']],
|
|---|
| 2042 | ['pt', ['padding-top']],
|
|---|
| 2043 | ['pr', ['padding-right']],
|
|---|
| 2044 | ['pb', ['padding-bottom']],
|
|---|
| 2045 | ['pl', ['padding-left']],
|
|---|
| 2046 | ],
|
|---|
| 2047 | ]),
|
|---|
| 2048 |
|
|---|
| 2049 | textAlign: ({ addUtilities }) => {
|
|---|
| 2050 | addUtilities({
|
|---|
| 2051 | '.text-left': { 'text-align': 'left' },
|
|---|
| 2052 | '.text-center': { 'text-align': 'center' },
|
|---|
| 2053 | '.text-right': { 'text-align': 'right' },
|
|---|
| 2054 | '.text-justify': { 'text-align': 'justify' },
|
|---|
| 2055 | '.text-start': { 'text-align': 'start' },
|
|---|
| 2056 | '.text-end': { 'text-align': 'end' },
|
|---|
| 2057 | })
|
|---|
| 2058 | },
|
|---|
| 2059 |
|
|---|
| 2060 | textIndent: createUtilityPlugin('textIndent', [['indent', ['text-indent']]], {
|
|---|
| 2061 | supportsNegativeValues: true,
|
|---|
| 2062 | }),
|
|---|
| 2063 |
|
|---|
| 2064 | verticalAlign: ({ addUtilities, matchUtilities }) => {
|
|---|
| 2065 | addUtilities({
|
|---|
| 2066 | '.align-baseline': { 'vertical-align': 'baseline' },
|
|---|
| 2067 | '.align-top': { 'vertical-align': 'top' },
|
|---|
| 2068 | '.align-middle': { 'vertical-align': 'middle' },
|
|---|
| 2069 | '.align-bottom': { 'vertical-align': 'bottom' },
|
|---|
| 2070 | '.align-text-top': { 'vertical-align': 'text-top' },
|
|---|
| 2071 | '.align-text-bottom': { 'vertical-align': 'text-bottom' },
|
|---|
| 2072 | '.align-sub': { 'vertical-align': 'sub' },
|
|---|
| 2073 | '.align-super': { 'vertical-align': 'super' },
|
|---|
| 2074 | })
|
|---|
| 2075 |
|
|---|
| 2076 | matchUtilities({ align: (value) => ({ 'vertical-align': value }) })
|
|---|
| 2077 | },
|
|---|
| 2078 |
|
|---|
| 2079 | fontFamily: ({ matchUtilities, theme }) => {
|
|---|
| 2080 | matchUtilities(
|
|---|
| 2081 | {
|
|---|
| 2082 | font: (value) => {
|
|---|
| 2083 | let [families, options = {}] =
|
|---|
| 2084 | Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
|
|---|
| 2085 | let { fontFeatureSettings, fontVariationSettings } = options
|
|---|
| 2086 |
|
|---|
| 2087 | return {
|
|---|
| 2088 | 'font-family': Array.isArray(families) ? families.join(', ') : families,
|
|---|
| 2089 | ...(fontFeatureSettings === undefined
|
|---|
| 2090 | ? {}
|
|---|
| 2091 | : { 'font-feature-settings': fontFeatureSettings }),
|
|---|
| 2092 | ...(fontVariationSettings === undefined
|
|---|
| 2093 | ? {}
|
|---|
| 2094 | : { 'font-variation-settings': fontVariationSettings }),
|
|---|
| 2095 | }
|
|---|
| 2096 | },
|
|---|
| 2097 | },
|
|---|
| 2098 | {
|
|---|
| 2099 | values: theme('fontFamily'),
|
|---|
| 2100 | type: ['lookup', 'generic-name', 'family-name'],
|
|---|
| 2101 | }
|
|---|
| 2102 | )
|
|---|
| 2103 | },
|
|---|
| 2104 |
|
|---|
| 2105 | fontSize: ({ matchUtilities, theme }) => {
|
|---|
| 2106 | matchUtilities(
|
|---|
| 2107 | {
|
|---|
| 2108 | text: (value, { modifier }) => {
|
|---|
| 2109 | let [fontSize, options] = Array.isArray(value) ? value : [value]
|
|---|
| 2110 |
|
|---|
| 2111 | if (modifier) {
|
|---|
| 2112 | return {
|
|---|
| 2113 | 'font-size': fontSize,
|
|---|
| 2114 | 'line-height': modifier,
|
|---|
| 2115 | }
|
|---|
| 2116 | }
|
|---|
| 2117 |
|
|---|
| 2118 | let { lineHeight, letterSpacing, fontWeight } = isPlainObject(options)
|
|---|
| 2119 | ? options
|
|---|
| 2120 | : { lineHeight: options }
|
|---|
| 2121 |
|
|---|
| 2122 | return {
|
|---|
| 2123 | 'font-size': fontSize,
|
|---|
| 2124 | ...(lineHeight === undefined ? {} : { 'line-height': lineHeight }),
|
|---|
| 2125 | ...(letterSpacing === undefined ? {} : { 'letter-spacing': letterSpacing }),
|
|---|
| 2126 | ...(fontWeight === undefined ? {} : { 'font-weight': fontWeight }),
|
|---|
| 2127 | }
|
|---|
| 2128 | },
|
|---|
| 2129 | },
|
|---|
| 2130 | {
|
|---|
| 2131 | values: theme('fontSize'),
|
|---|
| 2132 | modifiers: theme('lineHeight'),
|
|---|
| 2133 | type: ['absolute-size', 'relative-size', 'length', 'percentage'],
|
|---|
| 2134 | }
|
|---|
| 2135 | )
|
|---|
| 2136 | },
|
|---|
| 2137 |
|
|---|
| 2138 | fontWeight: createUtilityPlugin('fontWeight', [['font', ['fontWeight']]], {
|
|---|
| 2139 | type: ['lookup', 'number', 'any'],
|
|---|
| 2140 | }),
|
|---|
| 2141 |
|
|---|
| 2142 | textTransform: ({ addUtilities }) => {
|
|---|
| 2143 | addUtilities({
|
|---|
| 2144 | '.uppercase': { 'text-transform': 'uppercase' },
|
|---|
| 2145 | '.lowercase': { 'text-transform': 'lowercase' },
|
|---|
| 2146 | '.capitalize': { 'text-transform': 'capitalize' },
|
|---|
| 2147 | '.normal-case': { 'text-transform': 'none' },
|
|---|
| 2148 | })
|
|---|
| 2149 | },
|
|---|
| 2150 |
|
|---|
| 2151 | fontStyle: ({ addUtilities }) => {
|
|---|
| 2152 | addUtilities({
|
|---|
| 2153 | '.italic': { 'font-style': 'italic' },
|
|---|
| 2154 | '.not-italic': { 'font-style': 'normal' },
|
|---|
| 2155 | })
|
|---|
| 2156 | },
|
|---|
| 2157 |
|
|---|
| 2158 | fontVariantNumeric: ({ addDefaults, addUtilities }) => {
|
|---|
| 2159 | let cssFontVariantNumericValue =
|
|---|
| 2160 | 'var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)'
|
|---|
| 2161 |
|
|---|
| 2162 | addDefaults('font-variant-numeric', {
|
|---|
| 2163 | '--tw-ordinal': ' ',
|
|---|
| 2164 | '--tw-slashed-zero': ' ',
|
|---|
| 2165 | '--tw-numeric-figure': ' ',
|
|---|
| 2166 | '--tw-numeric-spacing': ' ',
|
|---|
| 2167 | '--tw-numeric-fraction': ' ',
|
|---|
| 2168 | })
|
|---|
| 2169 |
|
|---|
| 2170 | addUtilities({
|
|---|
| 2171 | '.normal-nums': { 'font-variant-numeric': 'normal' },
|
|---|
| 2172 | '.ordinal': {
|
|---|
| 2173 | '@defaults font-variant-numeric': {},
|
|---|
| 2174 | '--tw-ordinal': 'ordinal',
|
|---|
| 2175 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2176 | },
|
|---|
| 2177 | '.slashed-zero': {
|
|---|
| 2178 | '@defaults font-variant-numeric': {},
|
|---|
| 2179 | '--tw-slashed-zero': 'slashed-zero',
|
|---|
| 2180 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2181 | },
|
|---|
| 2182 | '.lining-nums': {
|
|---|
| 2183 | '@defaults font-variant-numeric': {},
|
|---|
| 2184 | '--tw-numeric-figure': 'lining-nums',
|
|---|
| 2185 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2186 | },
|
|---|
| 2187 | '.oldstyle-nums': {
|
|---|
| 2188 | '@defaults font-variant-numeric': {},
|
|---|
| 2189 | '--tw-numeric-figure': 'oldstyle-nums',
|
|---|
| 2190 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2191 | },
|
|---|
| 2192 | '.proportional-nums': {
|
|---|
| 2193 | '@defaults font-variant-numeric': {},
|
|---|
| 2194 | '--tw-numeric-spacing': 'proportional-nums',
|
|---|
| 2195 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2196 | },
|
|---|
| 2197 | '.tabular-nums': {
|
|---|
| 2198 | '@defaults font-variant-numeric': {},
|
|---|
| 2199 | '--tw-numeric-spacing': 'tabular-nums',
|
|---|
| 2200 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2201 | },
|
|---|
| 2202 | '.diagonal-fractions': {
|
|---|
| 2203 | '@defaults font-variant-numeric': {},
|
|---|
| 2204 | '--tw-numeric-fraction': 'diagonal-fractions',
|
|---|
| 2205 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2206 | },
|
|---|
| 2207 | '.stacked-fractions': {
|
|---|
| 2208 | '@defaults font-variant-numeric': {},
|
|---|
| 2209 | '--tw-numeric-fraction': 'stacked-fractions',
|
|---|
| 2210 | 'font-variant-numeric': cssFontVariantNumericValue,
|
|---|
| 2211 | },
|
|---|
| 2212 | })
|
|---|
| 2213 | },
|
|---|
| 2214 |
|
|---|
| 2215 | lineHeight: createUtilityPlugin('lineHeight', [['leading', ['lineHeight']]]),
|
|---|
| 2216 | letterSpacing: createUtilityPlugin('letterSpacing', [['tracking', ['letterSpacing']]], {
|
|---|
| 2217 | supportsNegativeValues: true,
|
|---|
| 2218 | }),
|
|---|
| 2219 |
|
|---|
| 2220 | textColor: ({ matchUtilities, theme, corePlugins }) => {
|
|---|
| 2221 | matchUtilities(
|
|---|
| 2222 | {
|
|---|
| 2223 | text: (value) => {
|
|---|
| 2224 | if (!corePlugins('textOpacity')) {
|
|---|
| 2225 | return { color: toColorValue(value) }
|
|---|
| 2226 | }
|
|---|
| 2227 |
|
|---|
| 2228 | return withAlphaVariable({
|
|---|
| 2229 | color: value,
|
|---|
| 2230 | property: 'color',
|
|---|
| 2231 | variable: '--tw-text-opacity',
|
|---|
| 2232 | })
|
|---|
| 2233 | },
|
|---|
| 2234 | },
|
|---|
| 2235 | { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
|
|---|
| 2236 | )
|
|---|
| 2237 | },
|
|---|
| 2238 |
|
|---|
| 2239 | textOpacity: createUtilityPlugin('textOpacity', [['text-opacity', ['--tw-text-opacity']]]),
|
|---|
| 2240 |
|
|---|
| 2241 | textDecoration: ({ addUtilities }) => {
|
|---|
| 2242 | addUtilities({
|
|---|
| 2243 | '.underline': { 'text-decoration-line': 'underline' },
|
|---|
| 2244 | '.overline': { 'text-decoration-line': 'overline' },
|
|---|
| 2245 | '.line-through': { 'text-decoration-line': 'line-through' },
|
|---|
| 2246 | '.no-underline': { 'text-decoration-line': 'none' },
|
|---|
| 2247 | })
|
|---|
| 2248 | },
|
|---|
| 2249 |
|
|---|
| 2250 | textDecorationColor: ({ matchUtilities, theme }) => {
|
|---|
| 2251 | matchUtilities(
|
|---|
| 2252 | {
|
|---|
| 2253 | decoration: (value) => {
|
|---|
| 2254 | return { 'text-decoration-color': toColorValue(value) }
|
|---|
| 2255 | },
|
|---|
| 2256 | },
|
|---|
| 2257 | { values: flattenColorPalette(theme('textDecorationColor')), type: ['color', 'any'] }
|
|---|
| 2258 | )
|
|---|
| 2259 | },
|
|---|
| 2260 |
|
|---|
| 2261 | textDecorationStyle: ({ addUtilities }) => {
|
|---|
| 2262 | addUtilities({
|
|---|
| 2263 | '.decoration-solid': { 'text-decoration-style': 'solid' },
|
|---|
| 2264 | '.decoration-double': { 'text-decoration-style': 'double' },
|
|---|
| 2265 | '.decoration-dotted': { 'text-decoration-style': 'dotted' },
|
|---|
| 2266 | '.decoration-dashed': { 'text-decoration-style': 'dashed' },
|
|---|
| 2267 | '.decoration-wavy': { 'text-decoration-style': 'wavy' },
|
|---|
| 2268 | })
|
|---|
| 2269 | },
|
|---|
| 2270 |
|
|---|
| 2271 | textDecorationThickness: createUtilityPlugin(
|
|---|
| 2272 | 'textDecorationThickness',
|
|---|
| 2273 | [['decoration', ['text-decoration-thickness']]],
|
|---|
| 2274 | { type: ['length', 'percentage'] }
|
|---|
| 2275 | ),
|
|---|
| 2276 |
|
|---|
| 2277 | textUnderlineOffset: createUtilityPlugin(
|
|---|
| 2278 | 'textUnderlineOffset',
|
|---|
| 2279 | [['underline-offset', ['text-underline-offset']]],
|
|---|
| 2280 | { type: ['length', 'percentage', 'any'] }
|
|---|
| 2281 | ),
|
|---|
| 2282 |
|
|---|
| 2283 | fontSmoothing: ({ addUtilities }) => {
|
|---|
| 2284 | addUtilities({
|
|---|
| 2285 | '.antialiased': {
|
|---|
| 2286 | '-webkit-font-smoothing': 'antialiased',
|
|---|
| 2287 | '-moz-osx-font-smoothing': 'grayscale',
|
|---|
| 2288 | },
|
|---|
| 2289 | '.subpixel-antialiased': {
|
|---|
| 2290 | '-webkit-font-smoothing': 'auto',
|
|---|
| 2291 | '-moz-osx-font-smoothing': 'auto',
|
|---|
| 2292 | },
|
|---|
| 2293 | })
|
|---|
| 2294 | },
|
|---|
| 2295 |
|
|---|
| 2296 | placeholderColor: ({ matchUtilities, theme, corePlugins }) => {
|
|---|
| 2297 | matchUtilities(
|
|---|
| 2298 | {
|
|---|
| 2299 | placeholder: (value) => {
|
|---|
| 2300 | if (!corePlugins('placeholderOpacity')) {
|
|---|
| 2301 | return {
|
|---|
| 2302 | '&::placeholder': {
|
|---|
| 2303 | color: toColorValue(value),
|
|---|
| 2304 | },
|
|---|
| 2305 | }
|
|---|
| 2306 | }
|
|---|
| 2307 |
|
|---|
| 2308 | return {
|
|---|
| 2309 | '&::placeholder': withAlphaVariable({
|
|---|
| 2310 | color: value,
|
|---|
| 2311 | property: 'color',
|
|---|
| 2312 | variable: '--tw-placeholder-opacity',
|
|---|
| 2313 | }),
|
|---|
| 2314 | }
|
|---|
| 2315 | },
|
|---|
| 2316 | },
|
|---|
| 2317 | { values: flattenColorPalette(theme('placeholderColor')), type: ['color', 'any'] }
|
|---|
| 2318 | )
|
|---|
| 2319 | },
|
|---|
| 2320 |
|
|---|
| 2321 | placeholderOpacity: ({ matchUtilities, theme }) => {
|
|---|
| 2322 | matchUtilities(
|
|---|
| 2323 | {
|
|---|
| 2324 | 'placeholder-opacity': (value) => {
|
|---|
| 2325 | return { ['&::placeholder']: { '--tw-placeholder-opacity': value } }
|
|---|
| 2326 | },
|
|---|
| 2327 | },
|
|---|
| 2328 | { values: theme('placeholderOpacity') }
|
|---|
| 2329 | )
|
|---|
| 2330 | },
|
|---|
| 2331 |
|
|---|
| 2332 | caretColor: ({ matchUtilities, theme }) => {
|
|---|
| 2333 | matchUtilities(
|
|---|
| 2334 | {
|
|---|
| 2335 | caret: (value) => {
|
|---|
| 2336 | return { 'caret-color': toColorValue(value) }
|
|---|
| 2337 | },
|
|---|
| 2338 | },
|
|---|
| 2339 | { values: flattenColorPalette(theme('caretColor')), type: ['color', 'any'] }
|
|---|
| 2340 | )
|
|---|
| 2341 | },
|
|---|
| 2342 |
|
|---|
| 2343 | accentColor: ({ matchUtilities, theme }) => {
|
|---|
| 2344 | matchUtilities(
|
|---|
| 2345 | {
|
|---|
| 2346 | accent: (value) => {
|
|---|
| 2347 | return { 'accent-color': toColorValue(value) }
|
|---|
| 2348 | },
|
|---|
| 2349 | },
|
|---|
| 2350 | { values: flattenColorPalette(theme('accentColor')), type: ['color', 'any'] }
|
|---|
| 2351 | )
|
|---|
| 2352 | },
|
|---|
| 2353 |
|
|---|
| 2354 | opacity: createUtilityPlugin('opacity', [['opacity', ['opacity']]]),
|
|---|
| 2355 |
|
|---|
| 2356 | backgroundBlendMode: ({ addUtilities }) => {
|
|---|
| 2357 | addUtilities({
|
|---|
| 2358 | '.bg-blend-normal': { 'background-blend-mode': 'normal' },
|
|---|
| 2359 | '.bg-blend-multiply': { 'background-blend-mode': 'multiply' },
|
|---|
| 2360 | '.bg-blend-screen': { 'background-blend-mode': 'screen' },
|
|---|
| 2361 | '.bg-blend-overlay': { 'background-blend-mode': 'overlay' },
|
|---|
| 2362 | '.bg-blend-darken': { 'background-blend-mode': 'darken' },
|
|---|
| 2363 | '.bg-blend-lighten': { 'background-blend-mode': 'lighten' },
|
|---|
| 2364 | '.bg-blend-color-dodge': { 'background-blend-mode': 'color-dodge' },
|
|---|
| 2365 | '.bg-blend-color-burn': { 'background-blend-mode': 'color-burn' },
|
|---|
| 2366 | '.bg-blend-hard-light': { 'background-blend-mode': 'hard-light' },
|
|---|
| 2367 | '.bg-blend-soft-light': { 'background-blend-mode': 'soft-light' },
|
|---|
| 2368 | '.bg-blend-difference': { 'background-blend-mode': 'difference' },
|
|---|
| 2369 | '.bg-blend-exclusion': { 'background-blend-mode': 'exclusion' },
|
|---|
| 2370 | '.bg-blend-hue': { 'background-blend-mode': 'hue' },
|
|---|
| 2371 | '.bg-blend-saturation': { 'background-blend-mode': 'saturation' },
|
|---|
| 2372 | '.bg-blend-color': { 'background-blend-mode': 'color' },
|
|---|
| 2373 | '.bg-blend-luminosity': { 'background-blend-mode': 'luminosity' },
|
|---|
| 2374 | })
|
|---|
| 2375 | },
|
|---|
| 2376 |
|
|---|
| 2377 | mixBlendMode: ({ addUtilities }) => {
|
|---|
| 2378 | addUtilities({
|
|---|
| 2379 | '.mix-blend-normal': { 'mix-blend-mode': 'normal' },
|
|---|
| 2380 | '.mix-blend-multiply': { 'mix-blend-mode': 'multiply' },
|
|---|
| 2381 | '.mix-blend-screen': { 'mix-blend-mode': 'screen' },
|
|---|
| 2382 | '.mix-blend-overlay': { 'mix-blend-mode': 'overlay' },
|
|---|
| 2383 | '.mix-blend-darken': { 'mix-blend-mode': 'darken' },
|
|---|
| 2384 | '.mix-blend-lighten': { 'mix-blend-mode': 'lighten' },
|
|---|
| 2385 | '.mix-blend-color-dodge': { 'mix-blend-mode': 'color-dodge' },
|
|---|
| 2386 | '.mix-blend-color-burn': { 'mix-blend-mode': 'color-burn' },
|
|---|
| 2387 | '.mix-blend-hard-light': { 'mix-blend-mode': 'hard-light' },
|
|---|
| 2388 | '.mix-blend-soft-light': { 'mix-blend-mode': 'soft-light' },
|
|---|
| 2389 | '.mix-blend-difference': { 'mix-blend-mode': 'difference' },
|
|---|
| 2390 | '.mix-blend-exclusion': { 'mix-blend-mode': 'exclusion' },
|
|---|
| 2391 | '.mix-blend-hue': { 'mix-blend-mode': 'hue' },
|
|---|
| 2392 | '.mix-blend-saturation': { 'mix-blend-mode': 'saturation' },
|
|---|
| 2393 | '.mix-blend-color': { 'mix-blend-mode': 'color' },
|
|---|
| 2394 | '.mix-blend-luminosity': { 'mix-blend-mode': 'luminosity' },
|
|---|
| 2395 | '.mix-blend-plus-darker': { 'mix-blend-mode': 'plus-darker' },
|
|---|
| 2396 | '.mix-blend-plus-lighter': { 'mix-blend-mode': 'plus-lighter' },
|
|---|
| 2397 | })
|
|---|
| 2398 | },
|
|---|
| 2399 |
|
|---|
| 2400 | boxShadow: (() => {
|
|---|
| 2401 | let transformValue = transformThemeValue('boxShadow')
|
|---|
| 2402 | let defaultBoxShadow = [
|
|---|
| 2403 | `var(--tw-ring-offset-shadow, 0 0 #0000)`,
|
|---|
| 2404 | `var(--tw-ring-shadow, 0 0 #0000)`,
|
|---|
| 2405 | `var(--tw-shadow)`,
|
|---|
| 2406 | ].join(', ')
|
|---|
| 2407 |
|
|---|
| 2408 | return function ({ matchUtilities, addDefaults, theme }) {
|
|---|
| 2409 | addDefaults('box-shadow', {
|
|---|
| 2410 | '--tw-ring-offset-shadow': '0 0 #0000',
|
|---|
| 2411 | '--tw-ring-shadow': '0 0 #0000',
|
|---|
| 2412 | '--tw-shadow': '0 0 #0000',
|
|---|
| 2413 | '--tw-shadow-colored': '0 0 #0000',
|
|---|
| 2414 | })
|
|---|
| 2415 |
|
|---|
| 2416 | matchUtilities(
|
|---|
| 2417 | {
|
|---|
| 2418 | shadow: (value) => {
|
|---|
| 2419 | value = transformValue(value)
|
|---|
| 2420 |
|
|---|
| 2421 | let ast = parseBoxShadowValue(value)
|
|---|
| 2422 | for (let shadow of ast) {
|
|---|
| 2423 | // Don't override color if the whole shadow is a variable
|
|---|
| 2424 | if (!shadow.valid) {
|
|---|
| 2425 | continue
|
|---|
| 2426 | }
|
|---|
| 2427 |
|
|---|
| 2428 | shadow.color = 'var(--tw-shadow-color)'
|
|---|
| 2429 | }
|
|---|
| 2430 |
|
|---|
| 2431 | return {
|
|---|
| 2432 | '@defaults box-shadow': {},
|
|---|
| 2433 | '--tw-shadow': value === 'none' ? '0 0 #0000' : value,
|
|---|
| 2434 | '--tw-shadow-colored': value === 'none' ? '0 0 #0000' : formatBoxShadowValue(ast),
|
|---|
| 2435 | 'box-shadow': defaultBoxShadow,
|
|---|
| 2436 | }
|
|---|
| 2437 | },
|
|---|
| 2438 | },
|
|---|
| 2439 | { values: theme('boxShadow'), type: ['shadow'] }
|
|---|
| 2440 | )
|
|---|
| 2441 | }
|
|---|
| 2442 | })(),
|
|---|
| 2443 |
|
|---|
| 2444 | boxShadowColor: ({ matchUtilities, theme }) => {
|
|---|
| 2445 | matchUtilities(
|
|---|
| 2446 | {
|
|---|
| 2447 | shadow: (value) => {
|
|---|
| 2448 | return {
|
|---|
| 2449 | '--tw-shadow-color': toColorValue(value),
|
|---|
| 2450 | '--tw-shadow': 'var(--tw-shadow-colored)',
|
|---|
| 2451 | }
|
|---|
| 2452 | },
|
|---|
| 2453 | },
|
|---|
| 2454 | { values: flattenColorPalette(theme('boxShadowColor')), type: ['color', 'any'] }
|
|---|
| 2455 | )
|
|---|
| 2456 | },
|
|---|
| 2457 |
|
|---|
| 2458 | outlineStyle: ({ addUtilities }) => {
|
|---|
| 2459 | addUtilities({
|
|---|
| 2460 | '.outline-none': {
|
|---|
| 2461 | outline: '2px solid transparent',
|
|---|
| 2462 | 'outline-offset': '2px',
|
|---|
| 2463 | },
|
|---|
| 2464 | '.outline': { 'outline-style': 'solid' },
|
|---|
| 2465 | '.outline-dashed': { 'outline-style': 'dashed' },
|
|---|
| 2466 | '.outline-dotted': { 'outline-style': 'dotted' },
|
|---|
| 2467 | '.outline-double': { 'outline-style': 'double' },
|
|---|
| 2468 | })
|
|---|
| 2469 | },
|
|---|
| 2470 |
|
|---|
| 2471 | outlineWidth: createUtilityPlugin('outlineWidth', [['outline', ['outline-width']]], {
|
|---|
| 2472 | type: ['length', 'number', 'percentage'],
|
|---|
| 2473 | }),
|
|---|
| 2474 |
|
|---|
| 2475 | outlineOffset: createUtilityPlugin('outlineOffset', [['outline-offset', ['outline-offset']]], {
|
|---|
| 2476 | type: ['length', 'number', 'percentage', 'any'],
|
|---|
| 2477 | supportsNegativeValues: true,
|
|---|
| 2478 | }),
|
|---|
| 2479 |
|
|---|
| 2480 | outlineColor: ({ matchUtilities, theme }) => {
|
|---|
| 2481 | matchUtilities(
|
|---|
| 2482 | {
|
|---|
| 2483 | outline: (value) => {
|
|---|
| 2484 | return { 'outline-color': toColorValue(value) }
|
|---|
| 2485 | },
|
|---|
| 2486 | },
|
|---|
| 2487 | { values: flattenColorPalette(theme('outlineColor')), type: ['color', 'any'] }
|
|---|
| 2488 | )
|
|---|
| 2489 | },
|
|---|
| 2490 |
|
|---|
| 2491 | ringWidth: ({ matchUtilities, addDefaults, addUtilities, theme, config }) => {
|
|---|
| 2492 | let ringColorDefault = (() => {
|
|---|
| 2493 | if (flagEnabled(config(), 'respectDefaultRingColorOpacity')) {
|
|---|
| 2494 | return theme('ringColor.DEFAULT')
|
|---|
| 2495 | }
|
|---|
| 2496 |
|
|---|
| 2497 | let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
|
|---|
| 2498 |
|
|---|
| 2499 | if (!theme('ringColor')?.DEFAULT) {
|
|---|
| 2500 | return `rgb(147 197 253 / ${ringOpacityDefault})`
|
|---|
| 2501 | }
|
|---|
| 2502 |
|
|---|
| 2503 | return withAlphaValue(
|
|---|
| 2504 | theme('ringColor')?.DEFAULT,
|
|---|
| 2505 | ringOpacityDefault,
|
|---|
| 2506 | `rgb(147 197 253 / ${ringOpacityDefault})`
|
|---|
| 2507 | )
|
|---|
| 2508 | })()
|
|---|
| 2509 |
|
|---|
| 2510 | addDefaults('ring-width', {
|
|---|
| 2511 | '--tw-ring-inset': ' ',
|
|---|
| 2512 | '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
|
|---|
| 2513 | '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
|
|---|
| 2514 | '--tw-ring-color': ringColorDefault,
|
|---|
| 2515 | '--tw-ring-offset-shadow': '0 0 #0000',
|
|---|
| 2516 | '--tw-ring-shadow': '0 0 #0000',
|
|---|
| 2517 | '--tw-shadow': '0 0 #0000',
|
|---|
| 2518 | '--tw-shadow-colored': '0 0 #0000',
|
|---|
| 2519 | })
|
|---|
| 2520 |
|
|---|
| 2521 | matchUtilities(
|
|---|
| 2522 | {
|
|---|
| 2523 | ring: (value) => {
|
|---|
| 2524 | return {
|
|---|
| 2525 | '@defaults ring-width': {},
|
|---|
| 2526 | '--tw-ring-offset-shadow': `var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)`,
|
|---|
| 2527 | '--tw-ring-shadow': `var(--tw-ring-inset) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color)`,
|
|---|
| 2528 | 'box-shadow': [
|
|---|
| 2529 | `var(--tw-ring-offset-shadow)`,
|
|---|
| 2530 | `var(--tw-ring-shadow)`,
|
|---|
| 2531 | `var(--tw-shadow, 0 0 #0000)`,
|
|---|
| 2532 | ].join(', '),
|
|---|
| 2533 | }
|
|---|
| 2534 | },
|
|---|
| 2535 | },
|
|---|
| 2536 | { values: theme('ringWidth'), type: 'length' }
|
|---|
| 2537 | )
|
|---|
| 2538 |
|
|---|
| 2539 | addUtilities({
|
|---|
| 2540 | '.ring-inset': { '@defaults ring-width': {}, '--tw-ring-inset': 'inset' },
|
|---|
| 2541 | })
|
|---|
| 2542 | },
|
|---|
| 2543 |
|
|---|
| 2544 | ringColor: ({ matchUtilities, theme, corePlugins }) => {
|
|---|
| 2545 | matchUtilities(
|
|---|
| 2546 | {
|
|---|
| 2547 | ring: (value) => {
|
|---|
| 2548 | if (!corePlugins('ringOpacity')) {
|
|---|
| 2549 | return {
|
|---|
| 2550 | '--tw-ring-color': toColorValue(value),
|
|---|
| 2551 | }
|
|---|
| 2552 | }
|
|---|
| 2553 |
|
|---|
| 2554 | return withAlphaVariable({
|
|---|
| 2555 | color: value,
|
|---|
| 2556 | property: '--tw-ring-color',
|
|---|
| 2557 | variable: '--tw-ring-opacity',
|
|---|
| 2558 | })
|
|---|
| 2559 | },
|
|---|
| 2560 | },
|
|---|
| 2561 | {
|
|---|
| 2562 | values: Object.fromEntries(
|
|---|
| 2563 | Object.entries(flattenColorPalette(theme('ringColor'))).filter(
|
|---|
| 2564 | ([modifier]) => modifier !== 'DEFAULT'
|
|---|
| 2565 | )
|
|---|
| 2566 | ),
|
|---|
| 2567 | type: ['color', 'any'],
|
|---|
| 2568 | }
|
|---|
| 2569 | )
|
|---|
| 2570 | },
|
|---|
| 2571 |
|
|---|
| 2572 | ringOpacity: (helpers) => {
|
|---|
| 2573 | let { config } = helpers
|
|---|
| 2574 |
|
|---|
| 2575 | return createUtilityPlugin('ringOpacity', [['ring-opacity', ['--tw-ring-opacity']]], {
|
|---|
| 2576 | filterDefault: !flagEnabled(config(), 'respectDefaultRingColorOpacity'),
|
|---|
| 2577 | })(helpers)
|
|---|
| 2578 | },
|
|---|
| 2579 | ringOffsetWidth: createUtilityPlugin(
|
|---|
| 2580 | 'ringOffsetWidth',
|
|---|
| 2581 | [['ring-offset', ['--tw-ring-offset-width']]],
|
|---|
| 2582 | { type: 'length' }
|
|---|
| 2583 | ),
|
|---|
| 2584 |
|
|---|
| 2585 | ringOffsetColor: ({ matchUtilities, theme }) => {
|
|---|
| 2586 | matchUtilities(
|
|---|
| 2587 | {
|
|---|
| 2588 | 'ring-offset': (value) => {
|
|---|
| 2589 | return {
|
|---|
| 2590 | '--tw-ring-offset-color': toColorValue(value),
|
|---|
| 2591 | }
|
|---|
| 2592 | },
|
|---|
| 2593 | },
|
|---|
| 2594 | { values: flattenColorPalette(theme('ringOffsetColor')), type: ['color', 'any'] }
|
|---|
| 2595 | )
|
|---|
| 2596 | },
|
|---|
| 2597 |
|
|---|
| 2598 | blur: ({ matchUtilities, theme }) => {
|
|---|
| 2599 | matchUtilities(
|
|---|
| 2600 | {
|
|---|
| 2601 | blur: (value) => {
|
|---|
| 2602 | return {
|
|---|
| 2603 | '--tw-blur': value.trim() === '' ? ' ' : `blur(${value})`,
|
|---|
| 2604 | '@defaults filter': {},
|
|---|
| 2605 | filter: cssFilterValue,
|
|---|
| 2606 | }
|
|---|
| 2607 | },
|
|---|
| 2608 | },
|
|---|
| 2609 | { values: theme('blur') }
|
|---|
| 2610 | )
|
|---|
| 2611 | },
|
|---|
| 2612 |
|
|---|
| 2613 | brightness: ({ matchUtilities, theme }) => {
|
|---|
| 2614 | matchUtilities(
|
|---|
| 2615 | {
|
|---|
| 2616 | brightness: (value) => {
|
|---|
| 2617 | return {
|
|---|
| 2618 | '--tw-brightness': `brightness(${value})`,
|
|---|
| 2619 | '@defaults filter': {},
|
|---|
| 2620 | filter: cssFilterValue,
|
|---|
| 2621 | }
|
|---|
| 2622 | },
|
|---|
| 2623 | },
|
|---|
| 2624 | { values: theme('brightness') }
|
|---|
| 2625 | )
|
|---|
| 2626 | },
|
|---|
| 2627 |
|
|---|
| 2628 | contrast: ({ matchUtilities, theme }) => {
|
|---|
| 2629 | matchUtilities(
|
|---|
| 2630 | {
|
|---|
| 2631 | contrast: (value) => {
|
|---|
| 2632 | return {
|
|---|
| 2633 | '--tw-contrast': `contrast(${value})`,
|
|---|
| 2634 | '@defaults filter': {},
|
|---|
| 2635 | filter: cssFilterValue,
|
|---|
| 2636 | }
|
|---|
| 2637 | },
|
|---|
| 2638 | },
|
|---|
| 2639 | { values: theme('contrast') }
|
|---|
| 2640 | )
|
|---|
| 2641 | },
|
|---|
| 2642 |
|
|---|
| 2643 | dropShadow: ({ matchUtilities, theme }) => {
|
|---|
| 2644 | matchUtilities(
|
|---|
| 2645 | {
|
|---|
| 2646 | 'drop-shadow': (value) => {
|
|---|
| 2647 | return {
|
|---|
| 2648 | '--tw-drop-shadow': Array.isArray(value)
|
|---|
| 2649 | ? value.map((v) => `drop-shadow(${v})`).join(' ')
|
|---|
| 2650 | : `drop-shadow(${value})`,
|
|---|
| 2651 | '@defaults filter': {},
|
|---|
| 2652 | filter: cssFilterValue,
|
|---|
| 2653 | }
|
|---|
| 2654 | },
|
|---|
| 2655 | },
|
|---|
| 2656 | { values: theme('dropShadow') }
|
|---|
| 2657 | )
|
|---|
| 2658 | },
|
|---|
| 2659 |
|
|---|
| 2660 | grayscale: ({ matchUtilities, theme }) => {
|
|---|
| 2661 | matchUtilities(
|
|---|
| 2662 | {
|
|---|
| 2663 | grayscale: (value) => {
|
|---|
| 2664 | return {
|
|---|
| 2665 | '--tw-grayscale': `grayscale(${value})`,
|
|---|
| 2666 | '@defaults filter': {},
|
|---|
| 2667 | filter: cssFilterValue,
|
|---|
| 2668 | }
|
|---|
| 2669 | },
|
|---|
| 2670 | },
|
|---|
| 2671 | { values: theme('grayscale') }
|
|---|
| 2672 | )
|
|---|
| 2673 | },
|
|---|
| 2674 |
|
|---|
| 2675 | hueRotate: ({ matchUtilities, theme }) => {
|
|---|
| 2676 | matchUtilities(
|
|---|
| 2677 | {
|
|---|
| 2678 | 'hue-rotate': (value) => {
|
|---|
| 2679 | return {
|
|---|
| 2680 | '--tw-hue-rotate': `hue-rotate(${value})`,
|
|---|
| 2681 | '@defaults filter': {},
|
|---|
| 2682 | filter: cssFilterValue,
|
|---|
| 2683 | }
|
|---|
| 2684 | },
|
|---|
| 2685 | },
|
|---|
| 2686 | { values: theme('hueRotate'), supportsNegativeValues: true }
|
|---|
| 2687 | )
|
|---|
| 2688 | },
|
|---|
| 2689 |
|
|---|
| 2690 | invert: ({ matchUtilities, theme }) => {
|
|---|
| 2691 | matchUtilities(
|
|---|
| 2692 | {
|
|---|
| 2693 | invert: (value) => {
|
|---|
| 2694 | return {
|
|---|
| 2695 | '--tw-invert': `invert(${value})`,
|
|---|
| 2696 | '@defaults filter': {},
|
|---|
| 2697 | filter: cssFilterValue,
|
|---|
| 2698 | }
|
|---|
| 2699 | },
|
|---|
| 2700 | },
|
|---|
| 2701 | { values: theme('invert') }
|
|---|
| 2702 | )
|
|---|
| 2703 | },
|
|---|
| 2704 |
|
|---|
| 2705 | saturate: ({ matchUtilities, theme }) => {
|
|---|
| 2706 | matchUtilities(
|
|---|
| 2707 | {
|
|---|
| 2708 | saturate: (value) => {
|
|---|
| 2709 | return {
|
|---|
| 2710 | '--tw-saturate': `saturate(${value})`,
|
|---|
| 2711 | '@defaults filter': {},
|
|---|
| 2712 | filter: cssFilterValue,
|
|---|
| 2713 | }
|
|---|
| 2714 | },
|
|---|
| 2715 | },
|
|---|
| 2716 | { values: theme('saturate') }
|
|---|
| 2717 | )
|
|---|
| 2718 | },
|
|---|
| 2719 |
|
|---|
| 2720 | sepia: ({ matchUtilities, theme }) => {
|
|---|
| 2721 | matchUtilities(
|
|---|
| 2722 | {
|
|---|
| 2723 | sepia: (value) => {
|
|---|
| 2724 | return {
|
|---|
| 2725 | '--tw-sepia': `sepia(${value})`,
|
|---|
| 2726 | '@defaults filter': {},
|
|---|
| 2727 | filter: cssFilterValue,
|
|---|
| 2728 | }
|
|---|
| 2729 | },
|
|---|
| 2730 | },
|
|---|
| 2731 | { values: theme('sepia') }
|
|---|
| 2732 | )
|
|---|
| 2733 | },
|
|---|
| 2734 |
|
|---|
| 2735 | filter: ({ addDefaults, addUtilities }) => {
|
|---|
| 2736 | addDefaults('filter', {
|
|---|
| 2737 | '--tw-blur': ' ',
|
|---|
| 2738 | '--tw-brightness': ' ',
|
|---|
| 2739 | '--tw-contrast': ' ',
|
|---|
| 2740 | '--tw-grayscale': ' ',
|
|---|
| 2741 | '--tw-hue-rotate': ' ',
|
|---|
| 2742 | '--tw-invert': ' ',
|
|---|
| 2743 | '--tw-saturate': ' ',
|
|---|
| 2744 | '--tw-sepia': ' ',
|
|---|
| 2745 | '--tw-drop-shadow': ' ',
|
|---|
| 2746 | })
|
|---|
| 2747 | addUtilities({
|
|---|
| 2748 | '.filter': { '@defaults filter': {}, filter: cssFilterValue },
|
|---|
| 2749 | '.filter-none': { filter: 'none' },
|
|---|
| 2750 | })
|
|---|
| 2751 | },
|
|---|
| 2752 |
|
|---|
| 2753 | backdropBlur: ({ matchUtilities, theme }) => {
|
|---|
| 2754 | matchUtilities(
|
|---|
| 2755 | {
|
|---|
| 2756 | 'backdrop-blur': (value) => {
|
|---|
| 2757 | return {
|
|---|
| 2758 | '--tw-backdrop-blur': value.trim() === '' ? ' ' : `blur(${value})`,
|
|---|
| 2759 | '@defaults backdrop-filter': {},
|
|---|
| 2760 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2761 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2762 | }
|
|---|
| 2763 | },
|
|---|
| 2764 | },
|
|---|
| 2765 | { values: theme('backdropBlur') }
|
|---|
| 2766 | )
|
|---|
| 2767 | },
|
|---|
| 2768 |
|
|---|
| 2769 | backdropBrightness: ({ matchUtilities, theme }) => {
|
|---|
| 2770 | matchUtilities(
|
|---|
| 2771 | {
|
|---|
| 2772 | 'backdrop-brightness': (value) => {
|
|---|
| 2773 | return {
|
|---|
| 2774 | '--tw-backdrop-brightness': `brightness(${value})`,
|
|---|
| 2775 | '@defaults backdrop-filter': {},
|
|---|
| 2776 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2777 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2778 | }
|
|---|
| 2779 | },
|
|---|
| 2780 | },
|
|---|
| 2781 | { values: theme('backdropBrightness') }
|
|---|
| 2782 | )
|
|---|
| 2783 | },
|
|---|
| 2784 |
|
|---|
| 2785 | backdropContrast: ({ matchUtilities, theme }) => {
|
|---|
| 2786 | matchUtilities(
|
|---|
| 2787 | {
|
|---|
| 2788 | 'backdrop-contrast': (value) => {
|
|---|
| 2789 | return {
|
|---|
| 2790 | '--tw-backdrop-contrast': `contrast(${value})`,
|
|---|
| 2791 | '@defaults backdrop-filter': {},
|
|---|
| 2792 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2793 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2794 | }
|
|---|
| 2795 | },
|
|---|
| 2796 | },
|
|---|
| 2797 | { values: theme('backdropContrast') }
|
|---|
| 2798 | )
|
|---|
| 2799 | },
|
|---|
| 2800 |
|
|---|
| 2801 | backdropGrayscale: ({ matchUtilities, theme }) => {
|
|---|
| 2802 | matchUtilities(
|
|---|
| 2803 | {
|
|---|
| 2804 | 'backdrop-grayscale': (value) => {
|
|---|
| 2805 | return {
|
|---|
| 2806 | '--tw-backdrop-grayscale': `grayscale(${value})`,
|
|---|
| 2807 | '@defaults backdrop-filter': {},
|
|---|
| 2808 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2809 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2810 | }
|
|---|
| 2811 | },
|
|---|
| 2812 | },
|
|---|
| 2813 | { values: theme('backdropGrayscale') }
|
|---|
| 2814 | )
|
|---|
| 2815 | },
|
|---|
| 2816 |
|
|---|
| 2817 | backdropHueRotate: ({ matchUtilities, theme }) => {
|
|---|
| 2818 | matchUtilities(
|
|---|
| 2819 | {
|
|---|
| 2820 | 'backdrop-hue-rotate': (value) => {
|
|---|
| 2821 | return {
|
|---|
| 2822 | '--tw-backdrop-hue-rotate': `hue-rotate(${value})`,
|
|---|
| 2823 | '@defaults backdrop-filter': {},
|
|---|
| 2824 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2825 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2826 | }
|
|---|
| 2827 | },
|
|---|
| 2828 | },
|
|---|
| 2829 | { values: theme('backdropHueRotate'), supportsNegativeValues: true }
|
|---|
| 2830 | )
|
|---|
| 2831 | },
|
|---|
| 2832 |
|
|---|
| 2833 | backdropInvert: ({ matchUtilities, theme }) => {
|
|---|
| 2834 | matchUtilities(
|
|---|
| 2835 | {
|
|---|
| 2836 | 'backdrop-invert': (value) => {
|
|---|
| 2837 | return {
|
|---|
| 2838 | '--tw-backdrop-invert': `invert(${value})`,
|
|---|
| 2839 | '@defaults backdrop-filter': {},
|
|---|
| 2840 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2841 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2842 | }
|
|---|
| 2843 | },
|
|---|
| 2844 | },
|
|---|
| 2845 | { values: theme('backdropInvert') }
|
|---|
| 2846 | )
|
|---|
| 2847 | },
|
|---|
| 2848 |
|
|---|
| 2849 | backdropOpacity: ({ matchUtilities, theme }) => {
|
|---|
| 2850 | matchUtilities(
|
|---|
| 2851 | {
|
|---|
| 2852 | 'backdrop-opacity': (value) => {
|
|---|
| 2853 | return {
|
|---|
| 2854 | '--tw-backdrop-opacity': `opacity(${value})`,
|
|---|
| 2855 | '@defaults backdrop-filter': {},
|
|---|
| 2856 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2857 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2858 | }
|
|---|
| 2859 | },
|
|---|
| 2860 | },
|
|---|
| 2861 | { values: theme('backdropOpacity') }
|
|---|
| 2862 | )
|
|---|
| 2863 | },
|
|---|
| 2864 |
|
|---|
| 2865 | backdropSaturate: ({ matchUtilities, theme }) => {
|
|---|
| 2866 | matchUtilities(
|
|---|
| 2867 | {
|
|---|
| 2868 | 'backdrop-saturate': (value) => {
|
|---|
| 2869 | return {
|
|---|
| 2870 | '--tw-backdrop-saturate': `saturate(${value})`,
|
|---|
| 2871 | '@defaults backdrop-filter': {},
|
|---|
| 2872 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2873 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2874 | }
|
|---|
| 2875 | },
|
|---|
| 2876 | },
|
|---|
| 2877 | { values: theme('backdropSaturate') }
|
|---|
| 2878 | )
|
|---|
| 2879 | },
|
|---|
| 2880 |
|
|---|
| 2881 | backdropSepia: ({ matchUtilities, theme }) => {
|
|---|
| 2882 | matchUtilities(
|
|---|
| 2883 | {
|
|---|
| 2884 | 'backdrop-sepia': (value) => {
|
|---|
| 2885 | return {
|
|---|
| 2886 | '--tw-backdrop-sepia': `sepia(${value})`,
|
|---|
| 2887 | '@defaults backdrop-filter': {},
|
|---|
| 2888 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2889 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2890 | }
|
|---|
| 2891 | },
|
|---|
| 2892 | },
|
|---|
| 2893 | { values: theme('backdropSepia') }
|
|---|
| 2894 | )
|
|---|
| 2895 | },
|
|---|
| 2896 |
|
|---|
| 2897 | backdropFilter: ({ addDefaults, addUtilities }) => {
|
|---|
| 2898 | addDefaults('backdrop-filter', {
|
|---|
| 2899 | '--tw-backdrop-blur': ' ',
|
|---|
| 2900 | '--tw-backdrop-brightness': ' ',
|
|---|
| 2901 | '--tw-backdrop-contrast': ' ',
|
|---|
| 2902 | '--tw-backdrop-grayscale': ' ',
|
|---|
| 2903 | '--tw-backdrop-hue-rotate': ' ',
|
|---|
| 2904 | '--tw-backdrop-invert': ' ',
|
|---|
| 2905 | '--tw-backdrop-opacity': ' ',
|
|---|
| 2906 | '--tw-backdrop-saturate': ' ',
|
|---|
| 2907 | '--tw-backdrop-sepia': ' ',
|
|---|
| 2908 | })
|
|---|
| 2909 | addUtilities({
|
|---|
| 2910 | '.backdrop-filter': {
|
|---|
| 2911 | '@defaults backdrop-filter': {},
|
|---|
| 2912 | '-webkit-backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2913 | 'backdrop-filter': cssBackdropFilterValue,
|
|---|
| 2914 | },
|
|---|
| 2915 | '.backdrop-filter-none': {
|
|---|
| 2916 | '-webkit-backdrop-filter': 'none',
|
|---|
| 2917 | 'backdrop-filter': 'none',
|
|---|
| 2918 | },
|
|---|
| 2919 | })
|
|---|
| 2920 | },
|
|---|
| 2921 |
|
|---|
| 2922 | transitionProperty: ({ matchUtilities, theme }) => {
|
|---|
| 2923 | let defaultTimingFunction = theme('transitionTimingFunction.DEFAULT')
|
|---|
| 2924 | let defaultDuration = theme('transitionDuration.DEFAULT')
|
|---|
| 2925 |
|
|---|
| 2926 | matchUtilities(
|
|---|
| 2927 | {
|
|---|
| 2928 | transition: (value) => {
|
|---|
| 2929 | return {
|
|---|
| 2930 | 'transition-property': value,
|
|---|
| 2931 | ...(value === 'none'
|
|---|
| 2932 | ? {}
|
|---|
| 2933 | : {
|
|---|
| 2934 | 'transition-timing-function': defaultTimingFunction,
|
|---|
| 2935 | 'transition-duration': defaultDuration,
|
|---|
| 2936 | }),
|
|---|
| 2937 | }
|
|---|
| 2938 | },
|
|---|
| 2939 | },
|
|---|
| 2940 | { values: theme('transitionProperty') }
|
|---|
| 2941 | )
|
|---|
| 2942 | },
|
|---|
| 2943 |
|
|---|
| 2944 | transitionDelay: createUtilityPlugin('transitionDelay', [['delay', ['transitionDelay']]]),
|
|---|
| 2945 | transitionDuration: createUtilityPlugin(
|
|---|
| 2946 | 'transitionDuration',
|
|---|
| 2947 | [['duration', ['transitionDuration']]],
|
|---|
| 2948 | { filterDefault: true }
|
|---|
| 2949 | ),
|
|---|
| 2950 | transitionTimingFunction: createUtilityPlugin(
|
|---|
| 2951 | 'transitionTimingFunction',
|
|---|
| 2952 | [['ease', ['transitionTimingFunction']]],
|
|---|
| 2953 | { filterDefault: true }
|
|---|
| 2954 | ),
|
|---|
| 2955 | willChange: createUtilityPlugin('willChange', [['will-change', ['will-change']]]),
|
|---|
| 2956 | contain: ({ addDefaults, addUtilities }) => {
|
|---|
| 2957 | let cssContainValue =
|
|---|
| 2958 | 'var(--tw-contain-size) var(--tw-contain-layout) var(--tw-contain-paint) var(--tw-contain-style)'
|
|---|
| 2959 |
|
|---|
| 2960 | addDefaults('contain', {
|
|---|
| 2961 | '--tw-contain-size': ' ',
|
|---|
| 2962 | '--tw-contain-layout': ' ',
|
|---|
| 2963 | '--tw-contain-paint': ' ',
|
|---|
| 2964 | '--tw-contain-style': ' ',
|
|---|
| 2965 | })
|
|---|
| 2966 |
|
|---|
| 2967 | addUtilities({
|
|---|
| 2968 | '.contain-none': { contain: 'none' },
|
|---|
| 2969 | '.contain-content': { contain: 'content' },
|
|---|
| 2970 | '.contain-strict': { contain: 'strict' },
|
|---|
| 2971 | '.contain-size': {
|
|---|
| 2972 | '@defaults contain': {},
|
|---|
| 2973 | '--tw-contain-size': 'size',
|
|---|
| 2974 | contain: cssContainValue,
|
|---|
| 2975 | },
|
|---|
| 2976 | '.contain-inline-size': {
|
|---|
| 2977 | '@defaults contain': {},
|
|---|
| 2978 | '--tw-contain-size': 'inline-size',
|
|---|
| 2979 | contain: cssContainValue,
|
|---|
| 2980 | },
|
|---|
| 2981 | '.contain-layout': {
|
|---|
| 2982 | '@defaults contain': {},
|
|---|
| 2983 | '--tw-contain-layout': 'layout',
|
|---|
| 2984 | contain: cssContainValue,
|
|---|
| 2985 | },
|
|---|
| 2986 | '.contain-paint': {
|
|---|
| 2987 | '@defaults contain': {},
|
|---|
| 2988 | '--tw-contain-paint': 'paint',
|
|---|
| 2989 | contain: cssContainValue,
|
|---|
| 2990 | },
|
|---|
| 2991 | '.contain-style': {
|
|---|
| 2992 | '@defaults contain': {},
|
|---|
| 2993 | '--tw-contain-style': 'style',
|
|---|
| 2994 | contain: cssContainValue,
|
|---|
| 2995 | },
|
|---|
| 2996 | })
|
|---|
| 2997 | },
|
|---|
| 2998 | content: createUtilityPlugin('content', [
|
|---|
| 2999 | ['content', ['--tw-content', ['content', 'var(--tw-content)']]],
|
|---|
| 3000 | ]),
|
|---|
| 3001 | forcedColorAdjust: ({ addUtilities }) => {
|
|---|
| 3002 | addUtilities({
|
|---|
| 3003 | '.forced-color-adjust-auto': { 'forced-color-adjust': 'auto' },
|
|---|
| 3004 | '.forced-color-adjust-none': { 'forced-color-adjust': 'none' },
|
|---|
| 3005 | })
|
|---|
| 3006 | },
|
|---|
| 3007 | }
|
|---|