init
This commit is contained in:
+2695
File diff suppressed because it is too large
Load Diff
+33
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This function removes any uses of CSS variables used as an alpha channel
|
||||
*
|
||||
* This is required for selectors like `:visited` which do not allow
|
||||
* changes in opacity or external control using CSS variables.
|
||||
*
|
||||
* @param {import('postcss').Container} container
|
||||
* @param {string[]} toRemove
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "removeAlphaVariables", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return removeAlphaVariables;
|
||||
}
|
||||
});
|
||||
function removeAlphaVariables(container, toRemove) {
|
||||
container.walkDecls((decl)=>{
|
||||
if (toRemove.includes(decl.prop)) {
|
||||
decl.remove();
|
||||
return;
|
||||
}
|
||||
for (let varName of toRemove){
|
||||
if (decl.value.includes(`/ var(${varName})`)) {
|
||||
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
||||
} else if (decl.value.includes(`/ var(${varName}, 1)`)) {
|
||||
decl.value = decl.value.replace(`/ var(${varName}, 1)`, "");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
withAlphaValue: function() {
|
||||
return withAlphaValue;
|
||||
},
|
||||
default: function() {
|
||||
return withAlphaVariable;
|
||||
}
|
||||
});
|
||||
const _color = require("./color");
|
||||
function withAlphaValue(color, alphaValue, defaultValue) {
|
||||
if (typeof color === "function") {
|
||||
return color({
|
||||
opacityValue: alphaValue
|
||||
});
|
||||
}
|
||||
let parsed = (0, _color.parseColor)(color, {
|
||||
loose: true
|
||||
});
|
||||
if (parsed === null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return (0, _color.formatColor)({
|
||||
...parsed,
|
||||
alpha: alphaValue
|
||||
});
|
||||
}
|
||||
function withAlphaVariable({ color , property , variable }) {
|
||||
let properties = [].concat(property);
|
||||
if (typeof color === "function") {
|
||||
return {
|
||||
[variable]: "1",
|
||||
...Object.fromEntries(properties.map((p)=>{
|
||||
return [
|
||||
p,
|
||||
color({
|
||||
opacityVariable: variable,
|
||||
opacityValue: `var(${variable}, 1)`
|
||||
})
|
||||
];
|
||||
}))
|
||||
};
|
||||
}
|
||||
const parsed = (0, _color.parseColor)(color);
|
||||
if (parsed === null) {
|
||||
return Object.fromEntries(properties.map((p)=>[
|
||||
p,
|
||||
color
|
||||
]));
|
||||
}
|
||||
if (parsed.alpha !== undefined) {
|
||||
// Has an alpha value, return color as-is
|
||||
return Object.fromEntries(properties.map((p)=>[
|
||||
p,
|
||||
color
|
||||
]));
|
||||
}
|
||||
return {
|
||||
[variable]: "1",
|
||||
...Object.fromEntries(properties.map((p)=>{
|
||||
return [
|
||||
p,
|
||||
(0, _color.formatColor)({
|
||||
...parsed,
|
||||
alpha: `var(${variable}, 1)`
|
||||
})
|
||||
];
|
||||
}))
|
||||
};
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"name": "tailwindcss",
|
||||
"version": "3.4.15",
|
||||
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"types": "types/index.d.ts",
|
||||
"repository": "https://github.com/tailwindlabs/tailwindcss.git",
|
||||
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
|
||||
"homepage": "https://tailwindcss.com",
|
||||
"bin": {
|
||||
"tailwind": "lib/cli.js",
|
||||
"tailwindcss": "lib/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "npm run generate && rimraf lib",
|
||||
"build": "swc src --out-dir lib --copy-files",
|
||||
"postbuild": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js --define:process.env.CSS_TRANSFORMER_WASM=false",
|
||||
"rebuild-fixtures": "npm run build && node -r @swc/register scripts/rebuildFixtures.js",
|
||||
"style": "eslint .",
|
||||
"pretest": "npm run generate",
|
||||
"test": "jest",
|
||||
"test:integrations": "npm run test --prefix ./integrations",
|
||||
"install:integrations": "node scripts/install-integrations.js",
|
||||
"generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
|
||||
"generate:types": "node -r @swc/register scripts/generate-types.js",
|
||||
"generate": "npm run generate:plugin-list && npm run generate:types",
|
||||
"release-channel": "node ./scripts/release-channel.js",
|
||||
"release-notes": "node ./scripts/release-notes.js",
|
||||
"prepublishOnly": "npm install --force && npm run build"
|
||||
},
|
||||
"files": [
|
||||
"src/*",
|
||||
"cli/*",
|
||||
"lib/*",
|
||||
"peers/*",
|
||||
"scripts/*.js",
|
||||
"stubs/*",
|
||||
"nesting/*",
|
||||
"types/**/*",
|
||||
"*.d.ts",
|
||||
"*.css",
|
||||
"*.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@swc/cli": "0.1.62",
|
||||
"@swc/core": "1.3.55",
|
||||
"@swc/jest": "0.2.26",
|
||||
"@swc/register": "0.1.10",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"browserslist": "^4.24.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"cssnano": "^6.1.2",
|
||||
"esbuild": "^0.24.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^8.10.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-diff": "^29.7.0",
|
||||
"lightningcss": "1.27.0",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^5.0.10",
|
||||
"source-map-js": "^1.2.1",
|
||||
"turbo": "^1.13.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
"arg": "^5.0.2",
|
||||
"chokidar": "^3.6.0",
|
||||
"didyoumean": "^1.2.2",
|
||||
"dlv": "^1.1.3",
|
||||
"fast-glob": "^3.3.2",
|
||||
"glob-parent": "^6.0.2",
|
||||
"is-glob": "^4.0.3",
|
||||
"jiti": "^1.21.6",
|
||||
"lilconfig": "^2.1.0",
|
||||
"micromatch": "^4.0.8",
|
||||
"normalize-path": "^3.0.0",
|
||||
"object-hash": "^3.0.0",
|
||||
"picocolors": "^1.1.1",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss-import": "^15.1.0",
|
||||
"postcss-js": "^4.0.1",
|
||||
"postcss-load-config": "^4.0.2",
|
||||
"postcss-nested": "^6.2.0",
|
||||
"postcss-selector-parser": "^6.1.2",
|
||||
"resolve": "^1.22.8",
|
||||
"sucrase": "^3.35.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"not edge <= 18",
|
||||
"not ie 11",
|
||||
"not op_mini all"
|
||||
],
|
||||
"jest": {
|
||||
"testTimeout": 30000,
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest/customMatchers.js"
|
||||
],
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/integrations/",
|
||||
"/standalone-cli/",
|
||||
"\\.test\\.skip\\.js$"
|
||||
],
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!lightningcss)"
|
||||
],
|
||||
"transform": {
|
||||
"\\.js$": "@swc/jest",
|
||||
"\\.ts$": "@swc/jest"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
}
|
||||
+97990
File diff suppressed because one or more lines are too long
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* This function removes any uses of CSS variables used as an alpha channel
|
||||
*
|
||||
* This is required for selectors like `:visited` which do not allow
|
||||
* changes in opacity or external control using CSS variables.
|
||||
*
|
||||
* @param {import('postcss').Container} container
|
||||
* @param {string[]} toRemove
|
||||
*/
|
||||
export function removeAlphaVariables(container, toRemove) {
|
||||
container.walkDecls((decl) => {
|
||||
if (toRemove.includes(decl.prop)) {
|
||||
decl.remove()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
for (let varName of toRemove) {
|
||||
if (decl.value.includes(`/ var(${varName})`)) {
|
||||
decl.value = decl.value.replace(`/ var(${varName})`, '')
|
||||
} else if (decl.value.includes(`/ var(${varName}, 1)`)) {
|
||||
decl.value = decl.value.replace(`/ var(${varName}, 1)`, '')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import { parseColor, formatColor } from './color'
|
||||
|
||||
export function withAlphaValue(color, alphaValue, defaultValue) {
|
||||
if (typeof color === 'function') {
|
||||
return color({ opacityValue: alphaValue })
|
||||
}
|
||||
|
||||
let parsed = parseColor(color, { loose: true })
|
||||
|
||||
if (parsed === null) {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
return formatColor({ ...parsed, alpha: alphaValue })
|
||||
}
|
||||
|
||||
export default function withAlphaVariable({ color, property, variable }) {
|
||||
let properties = [].concat(property)
|
||||
if (typeof color === 'function') {
|
||||
return {
|
||||
[variable]: '1',
|
||||
...Object.fromEntries(
|
||||
properties.map((p) => {
|
||||
return [p, color({ opacityVariable: variable, opacityValue: `var(${variable}, 1)` })]
|
||||
})
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
const parsed = parseColor(color)
|
||||
|
||||
if (parsed === null) {
|
||||
return Object.fromEntries(properties.map((p) => [p, color]))
|
||||
}
|
||||
|
||||
if (parsed.alpha !== undefined) {
|
||||
// Has an alpha value, return color as-is
|
||||
return Object.fromEntries(properties.map((p) => [p, color]))
|
||||
}
|
||||
|
||||
return {
|
||||
[variable]: '1',
|
||||
...Object.fromEntries(
|
||||
properties.map((p) => {
|
||||
return [p, formatColor({ ...parsed, alpha: `var(${variable}, 1)` })]
|
||||
})
|
||||
),
|
||||
}
|
||||
}
|
||||
+376
@@ -0,0 +1,376 @@
|
||||
import type { CorePluginList } from './generated/corePluginList'
|
||||
import type { DefaultColors } from './generated/colors'
|
||||
|
||||
// Helpers
|
||||
type Expand<T> = T extends object
|
||||
? T extends infer O
|
||||
? { [K in keyof O]: Expand<O[K]> }
|
||||
: never
|
||||
: T
|
||||
type KeyValuePair<K extends keyof any = string, V = string> = Record<K, V>
|
||||
interface RecursiveKeyValuePair<K extends keyof any = string, V = string> {
|
||||
[key: string]: V | RecursiveKeyValuePair<K, V>
|
||||
}
|
||||
export type ResolvableTo<T> = T | ((utils: PluginUtils) => T)
|
||||
type CSSRuleObject = RecursiveKeyValuePair<string, null | string | string[]>
|
||||
|
||||
interface PluginUtils {
|
||||
colors: DefaultColors
|
||||
theme(path: string, defaultValue?: unknown): any
|
||||
breakpoints<I = Record<string, unknown>, O = I>(arg: I): O
|
||||
rgb(arg: string): (arg: Partial<{ opacityVariable: string; opacityValue: number }>) => string
|
||||
hsl(arg: string): (arg: Partial<{ opacityVariable: string; opacityValue: number }>) => string
|
||||
}
|
||||
|
||||
// Content related config
|
||||
type FilePath = string
|
||||
type RawFile = { raw: string; extension?: string }
|
||||
type ExtractorFn = (content: string) => string[]
|
||||
type TransformerFn = (content: string) => string
|
||||
type ContentConfig =
|
||||
| (FilePath | RawFile)[]
|
||||
| {
|
||||
files: (FilePath | RawFile)[]
|
||||
relative?: boolean
|
||||
extract?: ExtractorFn | { [extension: string]: ExtractorFn }
|
||||
transform?: TransformerFn | { [extension: string]: TransformerFn }
|
||||
}
|
||||
|
||||
// Important related config
|
||||
type ImportantConfig = boolean | string
|
||||
|
||||
// Prefix related config
|
||||
type PrefixConfig = string
|
||||
|
||||
// Separator related config
|
||||
type SeparatorConfig = string
|
||||
|
||||
// Safelist related config
|
||||
type SafelistConfig = string | { pattern: RegExp; variants?: string[] }
|
||||
|
||||
// Blocklist related config
|
||||
type BlocklistConfig = string
|
||||
|
||||
// Presets related config
|
||||
type PresetsConfig = Partial<Config>
|
||||
|
||||
// Future related config
|
||||
type FutureConfigValues =
|
||||
| 'hoverOnlyWhenSupported'
|
||||
| 'respectDefaultRingColorOpacity'
|
||||
| 'disableColorOpacityUtilitiesByDefault'
|
||||
| 'relativeContentPathsByDefault'
|
||||
type FutureConfig = Expand<'all' | Partial<Record<FutureConfigValues, boolean>>> | []
|
||||
|
||||
// Experimental related config
|
||||
type ExperimentalConfigValues = 'optimizeUniversalDefaults' | 'matchVariant'
|
||||
type ExperimentalConfig = Expand<'all' | Partial<Record<ExperimentalConfigValues, boolean>>> | []
|
||||
|
||||
// DarkMode related config
|
||||
type DarkModeConfig =
|
||||
// Use the `media` query strategy.
|
||||
| 'media'
|
||||
// Use the `class` strategy, which requires a `.dark` class on the `html`.
|
||||
| 'class'
|
||||
// Use the `class` strategy with a custom class instead of `.dark`.
|
||||
| ['class', string]
|
||||
// Use the `selector` strategy — same as `class` but uses `:where()` for more predicable behavior
|
||||
| 'selector'
|
||||
// Use the `selector` strategy with a custom selector instead of `.dark`.
|
||||
| ['selector', string]
|
||||
// Use the `variant` strategy, which allows you to completely customize the selector
|
||||
// It takes a string or an array of strings, which are passed directly to `addVariant()`
|
||||
| ['variant', string | string[]]
|
||||
|
||||
type Screen = { raw: string } | { min: string } | { max: string } | { min: string; max: string }
|
||||
type ScreensConfig = string[] | KeyValuePair<string, string | Screen | Screen[]>
|
||||
|
||||
// Theme related config
|
||||
export interface ThemeConfig {
|
||||
// Responsiveness
|
||||
screens: ResolvableTo<ScreensConfig>
|
||||
supports: ResolvableTo<Record<string, string>>
|
||||
data: ResolvableTo<Record<string, string>>
|
||||
|
||||
// Reusable base configs
|
||||
colors: ResolvableTo<RecursiveKeyValuePair>
|
||||
spacing: ResolvableTo<KeyValuePair>
|
||||
|
||||
// Components
|
||||
container: ResolvableTo<
|
||||
Partial<{
|
||||
screens: ScreensConfig
|
||||
center: boolean
|
||||
padding: string | Record<string, string>
|
||||
}>
|
||||
>
|
||||
|
||||
// Utilities
|
||||
inset: ThemeConfig['spacing']
|
||||
zIndex: ResolvableTo<KeyValuePair>
|
||||
order: ResolvableTo<KeyValuePair>
|
||||
gridColumn: ResolvableTo<KeyValuePair>
|
||||
gridColumnStart: ResolvableTo<KeyValuePair>
|
||||
gridColumnEnd: ResolvableTo<KeyValuePair>
|
||||
gridRow: ResolvableTo<KeyValuePair>
|
||||
gridRowStart: ResolvableTo<KeyValuePair>
|
||||
gridRowEnd: ResolvableTo<KeyValuePair>
|
||||
margin: ThemeConfig['spacing']
|
||||
aspectRatio: ResolvableTo<KeyValuePair>
|
||||
height: ThemeConfig['spacing']
|
||||
maxHeight: ThemeConfig['spacing']
|
||||
minHeight: ResolvableTo<KeyValuePair>
|
||||
width: ThemeConfig['spacing']
|
||||
maxWidth: ResolvableTo<KeyValuePair>
|
||||
minWidth: ResolvableTo<KeyValuePair>
|
||||
flex: ResolvableTo<KeyValuePair>
|
||||
flexShrink: ResolvableTo<KeyValuePair>
|
||||
flexGrow: ResolvableTo<KeyValuePair>
|
||||
flexBasis: ThemeConfig['spacing']
|
||||
borderSpacing: ThemeConfig['spacing']
|
||||
transformOrigin: ResolvableTo<KeyValuePair>
|
||||
translate: ThemeConfig['spacing']
|
||||
rotate: ResolvableTo<KeyValuePair>
|
||||
skew: ResolvableTo<KeyValuePair>
|
||||
scale: ResolvableTo<KeyValuePair>
|
||||
animation: ResolvableTo<KeyValuePair>
|
||||
keyframes: ResolvableTo<KeyValuePair<string, KeyValuePair<string, KeyValuePair>>>
|
||||
cursor: ResolvableTo<KeyValuePair>
|
||||
scrollMargin: ThemeConfig['spacing']
|
||||
scrollPadding: ThemeConfig['spacing']
|
||||
listStyleType: ResolvableTo<KeyValuePair>
|
||||
columns: ResolvableTo<KeyValuePair>
|
||||
gridAutoColumns: ResolvableTo<KeyValuePair>
|
||||
gridAutoRows: ResolvableTo<KeyValuePair>
|
||||
gridTemplateColumns: ResolvableTo<KeyValuePair>
|
||||
gridTemplateRows: ResolvableTo<KeyValuePair>
|
||||
gap: ThemeConfig['spacing']
|
||||
space: ThemeConfig['spacing']
|
||||
divideWidth: ThemeConfig['borderWidth']
|
||||
divideColor: ThemeConfig['borderColor']
|
||||
divideOpacity: ThemeConfig['borderOpacity']
|
||||
borderRadius: ResolvableTo<KeyValuePair>
|
||||
borderWidth: ResolvableTo<KeyValuePair>
|
||||
borderColor: ThemeConfig['colors']
|
||||
borderOpacity: ThemeConfig['opacity']
|
||||
backgroundColor: ThemeConfig['colors']
|
||||
backgroundOpacity: ThemeConfig['opacity']
|
||||
backgroundImage: ResolvableTo<KeyValuePair>
|
||||
gradientColorStops: ThemeConfig['colors']
|
||||
backgroundSize: ResolvableTo<KeyValuePair>
|
||||
backgroundPosition: ResolvableTo<KeyValuePair>
|
||||
fill: ThemeConfig['colors']
|
||||
stroke: ThemeConfig['colors']
|
||||
strokeWidth: ResolvableTo<KeyValuePair>
|
||||
objectPosition: ResolvableTo<KeyValuePair>
|
||||
padding: ThemeConfig['spacing']
|
||||
textIndent: ThemeConfig['spacing']
|
||||
fontFamily: ResolvableTo<
|
||||
KeyValuePair<
|
||||
string,
|
||||
| string
|
||||
| string[]
|
||||
| [
|
||||
fontFamily: string | string[],
|
||||
configuration: Partial<{
|
||||
fontFeatureSettings: string
|
||||
fontVariationSettings: string
|
||||
}>
|
||||
]
|
||||
>
|
||||
>
|
||||
fontSize: ResolvableTo<
|
||||
KeyValuePair<
|
||||
string,
|
||||
| string
|
||||
| [fontSize: string, lineHeight: string]
|
||||
| [
|
||||
fontSize: string,
|
||||
configuration: Partial<{
|
||||
lineHeight: string
|
||||
letterSpacing: string
|
||||
fontWeight: string | number
|
||||
}>
|
||||
]
|
||||
>
|
||||
>
|
||||
fontWeight: ResolvableTo<KeyValuePair>
|
||||
lineHeight: ResolvableTo<KeyValuePair>
|
||||
letterSpacing: ResolvableTo<KeyValuePair>
|
||||
textColor: ThemeConfig['colors']
|
||||
textOpacity: ThemeConfig['opacity']
|
||||
textDecorationColor: ThemeConfig['colors']
|
||||
textDecorationThickness: ResolvableTo<KeyValuePair>
|
||||
textUnderlineOffset: ResolvableTo<KeyValuePair>
|
||||
placeholderColor: ThemeConfig['colors']
|
||||
placeholderOpacity: ThemeConfig['opacity']
|
||||
caretColor: ThemeConfig['colors']
|
||||
accentColor: ThemeConfig['colors']
|
||||
opacity: ResolvableTo<KeyValuePair>
|
||||
boxShadow: ResolvableTo<KeyValuePair<string, string | string[]>>
|
||||
boxShadowColor: ThemeConfig['colors']
|
||||
outlineWidth: ResolvableTo<KeyValuePair>
|
||||
outlineOffset: ResolvableTo<KeyValuePair>
|
||||
outlineColor: ThemeConfig['colors']
|
||||
ringWidth: ResolvableTo<KeyValuePair>
|
||||
ringColor: ThemeConfig['colors']
|
||||
ringOpacity: ThemeConfig['opacity']
|
||||
ringOffsetWidth: ResolvableTo<KeyValuePair>
|
||||
ringOffsetColor: ThemeConfig['colors']
|
||||
blur: ResolvableTo<KeyValuePair>
|
||||
brightness: ResolvableTo<KeyValuePair>
|
||||
contrast: ResolvableTo<KeyValuePair>
|
||||
dropShadow: ResolvableTo<KeyValuePair<string, string | string[]>>
|
||||
grayscale: ResolvableTo<KeyValuePair>
|
||||
hueRotate: ResolvableTo<KeyValuePair>
|
||||
invert: ResolvableTo<KeyValuePair>
|
||||
saturate: ResolvableTo<KeyValuePair>
|
||||
sepia: ResolvableTo<KeyValuePair>
|
||||
backdropBlur: ThemeConfig['blur']
|
||||
backdropBrightness: ThemeConfig['brightness']
|
||||
backdropContrast: ThemeConfig['contrast']
|
||||
backdropGrayscale: ThemeConfig['grayscale']
|
||||
backdropHueRotate: ThemeConfig['hueRotate']
|
||||
backdropInvert: ThemeConfig['invert']
|
||||
backdropOpacity: ThemeConfig['opacity']
|
||||
backdropSaturate: ThemeConfig['saturate']
|
||||
backdropSepia: ThemeConfig['sepia']
|
||||
transitionProperty: ResolvableTo<KeyValuePair>
|
||||
transitionTimingFunction: ResolvableTo<KeyValuePair>
|
||||
transitionDelay: ResolvableTo<KeyValuePair>
|
||||
transitionDuration: ResolvableTo<KeyValuePair>
|
||||
willChange: ResolvableTo<KeyValuePair>
|
||||
content: ResolvableTo<KeyValuePair>
|
||||
}
|
||||
|
||||
interface CustomThemeConfig extends ThemeConfig {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
// Core plugins related config
|
||||
type CorePluginsConfig = CorePluginList[] | Expand<Partial<Record<CorePluginList, boolean>>>
|
||||
|
||||
// Plugins related config
|
||||
type ValueType =
|
||||
| 'any'
|
||||
| 'color'
|
||||
| 'url'
|
||||
| 'image'
|
||||
| 'length'
|
||||
| 'percentage'
|
||||
| 'position'
|
||||
| 'lookup'
|
||||
| 'generic-name'
|
||||
| 'family-name'
|
||||
| 'number'
|
||||
| 'line-width'
|
||||
| 'absolute-size'
|
||||
| 'relative-size'
|
||||
| 'shadow'
|
||||
export interface PluginAPI {
|
||||
// for registering new static utility styles
|
||||
addUtilities(
|
||||
utilities: CSSRuleObject | CSSRuleObject[],
|
||||
options?: Partial<{
|
||||
respectPrefix: boolean
|
||||
respectImportant: boolean
|
||||
}>
|
||||
): void
|
||||
// for registering new dynamic utility styles
|
||||
matchUtilities<T = string, U = string>(
|
||||
utilities: KeyValuePair<
|
||||
string,
|
||||
(value: T | string, extra: { modifier: U | string | null }) => CSSRuleObject | null
|
||||
>,
|
||||
options?: Partial<{
|
||||
respectPrefix: boolean
|
||||
respectImportant: boolean
|
||||
type: ValueType | ValueType[]
|
||||
values: KeyValuePair<string, T>
|
||||
modifiers: 'any' | KeyValuePair<string, U>
|
||||
supportsNegativeValues: boolean
|
||||
}>
|
||||
): void
|
||||
// for registering new static component styles
|
||||
addComponents(
|
||||
components: CSSRuleObject | CSSRuleObject[],
|
||||
options?: Partial<{
|
||||
respectPrefix: boolean
|
||||
respectImportant: boolean
|
||||
}>
|
||||
): void
|
||||
// for registering new dynamic component styles
|
||||
matchComponents<T = string, U = string>(
|
||||
components: KeyValuePair<
|
||||
string,
|
||||
(value: T | string, extra: { modifier: U | string | null }) => CSSRuleObject | null
|
||||
>,
|
||||
options?: Partial<{
|
||||
respectPrefix: boolean
|
||||
respectImportant: boolean
|
||||
type: ValueType | ValueType[]
|
||||
values: KeyValuePair<string, T>
|
||||
modifiers: 'any' | KeyValuePair<string, U>
|
||||
supportsNegativeValues: boolean
|
||||
}>
|
||||
): void
|
||||
// for registering new base styles
|
||||
addBase(base: CSSRuleObject | CSSRuleObject[]): void
|
||||
// for registering custom variants
|
||||
addVariant(name: string, definition: string | string[] | (() => string) | (() => string)[]): void
|
||||
matchVariant<T = string>(
|
||||
name: string,
|
||||
cb: (value: T | string, extra: { modifier: string | null }) => string | string[],
|
||||
options?: {
|
||||
values?: KeyValuePair<string, T>
|
||||
sort?(
|
||||
a: { value: T | string; modifier: string | null },
|
||||
b: { value: T | string; modifier: string | null }
|
||||
): number
|
||||
}
|
||||
): void
|
||||
// for looking up values in the user’s theme configuration
|
||||
theme: <TDefaultValue = Config['theme']>(
|
||||
path?: string,
|
||||
defaultValue?: TDefaultValue
|
||||
) => TDefaultValue
|
||||
// for looking up values in the user’s Tailwind configuration
|
||||
config: <TDefaultValue = Config>(path?: string, defaultValue?: TDefaultValue) => TDefaultValue
|
||||
// for checking if a core plugin is enabled
|
||||
corePlugins(path: string): boolean
|
||||
// for manually escaping strings meant to be used in class names
|
||||
e: (className: string) => string
|
||||
}
|
||||
export type PluginCreator = (api: PluginAPI) => void
|
||||
export type PluginsConfig = (
|
||||
| PluginCreator
|
||||
| { handler: PluginCreator; config?: Partial<Config> }
|
||||
| {
|
||||
(options: any): { handler: PluginCreator; config?: Partial<Config> }
|
||||
__isOptionsFunction: true
|
||||
}
|
||||
)[]
|
||||
|
||||
// Top level config related
|
||||
interface RequiredConfig {
|
||||
content: ContentConfig
|
||||
}
|
||||
|
||||
interface OptionalConfig {
|
||||
important: Partial<ImportantConfig>
|
||||
prefix: Partial<PrefixConfig>
|
||||
separator: Partial<SeparatorConfig>
|
||||
safelist: Array<SafelistConfig>
|
||||
blocklist: Array<BlocklistConfig>
|
||||
presets: Array<PresetsConfig>
|
||||
future: Partial<FutureConfig>
|
||||
experimental: Partial<ExperimentalConfig>
|
||||
darkMode: Partial<DarkModeConfig>
|
||||
theme: Partial<CustomThemeConfig & { extend: Partial<CustomThemeConfig> }>
|
||||
corePlugins: Partial<CorePluginsConfig>
|
||||
plugins: Partial<PluginsConfig>
|
||||
// Custom
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export type Config = RequiredConfig & Partial<OptionalConfig>
|
||||
Reference in New Issue
Block a user