tailwindcss 0.0.0-insiders.bbafc8e → 0.0.0-insiders.bbc2f3f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/README.md +16 -13
  2. package/dist/chunk-5C7JPVMO.mjs +10 -0
  3. package/dist/chunk-AZANAYY2.mjs +1 -0
  4. package/dist/chunk-V2K3XTS4.mjs +1 -0
  5. package/dist/colors-b_6i0Oi7.d.ts +295 -0
  6. package/dist/colors.d.mts +295 -0
  7. package/dist/colors.d.ts +5 -0
  8. package/dist/colors.js +1 -0
  9. package/dist/colors.mjs +1 -0
  10. package/dist/default-theme.d.mts +1147 -0
  11. package/dist/default-theme.d.ts +1147 -0
  12. package/dist/default-theme.js +1 -0
  13. package/dist/default-theme.mjs +1 -0
  14. package/dist/flatten-color-palette.d.mts +6 -0
  15. package/dist/flatten-color-palette.d.ts +6 -0
  16. package/dist/flatten-color-palette.js +1 -0
  17. package/dist/flatten-color-palette.mjs +1 -0
  18. package/dist/lib.d.mts +260 -0
  19. package/dist/lib.d.ts +3 -0
  20. package/dist/lib.js +33 -0
  21. package/dist/lib.mjs +24 -0
  22. package/dist/plugin.d.mts +11 -0
  23. package/dist/plugin.d.ts +104 -0
  24. package/dist/plugin.js +1 -0
  25. package/dist/plugin.mjs +1 -0
  26. package/dist/resolve-config-BIFUA2FY.d.ts +29 -0
  27. package/dist/resolve-config-QUZ9b-Gn.d.mts +190 -0
  28. package/dist/types-B254mqw1.d.mts +98 -0
  29. package/index.css +865 -0
  30. package/package.json +73 -95
  31. package/preflight.css +383 -0
  32. package/theme.css +453 -0
  33. package/CHANGELOG.md +0 -2084
  34. package/base.css +0 -1
  35. package/colors.js +0 -2
  36. package/components.css +0 -1
  37. package/defaultConfig.js +0 -2
  38. package/defaultTheme.js +0 -2
  39. package/lib/cli-peer-dependencies.js +0 -15
  40. package/lib/cli.js +0 -741
  41. package/lib/constants.js +0 -37
  42. package/lib/corePluginList.js +0 -178
  43. package/lib/corePlugins.js +0 -3587
  44. package/lib/css/LICENSE +0 -25
  45. package/lib/css/preflight.css +0 -367
  46. package/lib/featureFlags.js +0 -59
  47. package/lib/index.js +0 -41
  48. package/lib/lib/cacheInvalidation.js +0 -69
  49. package/lib/lib/collapseAdjacentRules.js +0 -54
  50. package/lib/lib/collapseDuplicateDeclarations.js +0 -80
  51. package/lib/lib/defaultExtractor.js +0 -44
  52. package/lib/lib/detectNesting.js +0 -34
  53. package/lib/lib/evaluateTailwindFunctions.js +0 -171
  54. package/lib/lib/expandApplyAtRules.js +0 -433
  55. package/lib/lib/expandTailwindAtRules.js +0 -262
  56. package/lib/lib/generateRules.js +0 -631
  57. package/lib/lib/getModuleDependencies.js +0 -48
  58. package/lib/lib/normalizeTailwindDirectives.js +0 -84
  59. package/lib/lib/partitionApplyAtRules.js +0 -53
  60. package/lib/lib/resolveDefaultsAtRules.js +0 -143
  61. package/lib/lib/setupContextUtils.js +0 -859
  62. package/lib/lib/setupTrackingContext.js +0 -171
  63. package/lib/lib/sharedState.js +0 -52
  64. package/lib/lib/substituteScreenAtRules.js +0 -27
  65. package/lib/postcss-plugins/nesting/README.md +0 -42
  66. package/lib/postcss-plugins/nesting/index.js +0 -17
  67. package/lib/postcss-plugins/nesting/plugin.js +0 -85
  68. package/lib/processTailwindFeatures.js +0 -59
  69. package/lib/public/colors.js +0 -329
  70. package/lib/public/create-plugin.js +0 -13
  71. package/lib/public/default-config.js +0 -14
  72. package/lib/public/default-theme.js +0 -14
  73. package/lib/public/resolve-config.js +0 -19
  74. package/lib/util/bigSign.js +0 -8
  75. package/lib/util/buildMediaQuery.js +0 -20
  76. package/lib/util/cloneDeep.js +0 -19
  77. package/lib/util/cloneNodes.js +0 -25
  78. package/lib/util/color.js +0 -99
  79. package/lib/util/configurePlugins.js +0 -18
  80. package/lib/util/createPlugin.js +0 -29
  81. package/lib/util/createUtilityPlugin.js +0 -49
  82. package/lib/util/dataTypes.js +0 -233
  83. package/lib/util/defaults.js +0 -22
  84. package/lib/util/escapeClassName.js +0 -19
  85. package/lib/util/escapeCommas.js +0 -8
  86. package/lib/util/flattenColorPalette.js +0 -17
  87. package/lib/util/formatVariantSelector.js +0 -186
  88. package/lib/util/getAllConfigs.js +0 -29
  89. package/lib/util/hashConfig.js +0 -16
  90. package/lib/util/isKeyframeRule.js +0 -8
  91. package/lib/util/isPlainObject.js +0 -12
  92. package/lib/util/isValidArbitraryValue.js +0 -64
  93. package/lib/util/log.js +0 -51
  94. package/lib/util/nameClass.js +0 -32
  95. package/lib/util/negateValue.js +0 -19
  96. package/lib/util/normalizeConfig.js +0 -240
  97. package/lib/util/normalizeScreens.js +0 -59
  98. package/lib/util/parseAnimationValue.js +0 -89
  99. package/lib/util/parseBoxShadowValue.js +0 -117
  100. package/lib/util/parseDependency.js +0 -63
  101. package/lib/util/parseObjectStyles.js +0 -31
  102. package/lib/util/pluginUtils.js +0 -179
  103. package/lib/util/prefixSelector.js +0 -20
  104. package/lib/util/resolveConfig.js +0 -255
  105. package/lib/util/resolveConfigPath.js +0 -51
  106. package/lib/util/responsive.js +0 -19
  107. package/lib/util/tap.js +0 -9
  108. package/lib/util/toColorValue.js +0 -8
  109. package/lib/util/toPath.js +0 -14
  110. package/lib/util/transformThemeValue.js +0 -59
  111. package/lib/util/withAlphaVariable.js +0 -67
  112. package/nesting/index.js +0 -2
  113. package/peers/index.js +0 -75077
  114. package/plugin.js +0 -2
  115. package/prettier.config.js +0 -19
  116. package/resolveConfig.js +0 -2
  117. package/screens.css +0 -1
  118. package/scripts/create-plugin-list.js +0 -10
  119. package/scripts/install-integrations.js +0 -27
  120. package/scripts/rebuildFixtures.js +0 -68
  121. package/src/cli-peer-dependencies.js +0 -9
  122. package/src/cli.js +0 -815
  123. package/src/constants.js +0 -17
  124. package/src/corePluginList.js +0 -1
  125. package/src/corePlugins.js +0 -2365
  126. package/src/css/LICENSE +0 -25
  127. package/src/css/preflight.css +0 -367
  128. package/src/featureFlags.js +0 -54
  129. package/src/index.js +0 -42
  130. package/src/lib/cacheInvalidation.js +0 -52
  131. package/src/lib/collapseAdjacentRules.js +0 -54
  132. package/src/lib/collapseDuplicateDeclarations.js +0 -93
  133. package/src/lib/defaultExtractor.js +0 -50
  134. package/src/lib/detectNesting.js +0 -39
  135. package/src/lib/evaluateTailwindFunctions.js +0 -198
  136. package/src/lib/expandApplyAtRules.js +0 -480
  137. package/src/lib/expandTailwindAtRules.js +0 -292
  138. package/src/lib/generateRules.js +0 -623
  139. package/src/lib/getModuleDependencies.js +0 -39
  140. package/src/lib/normalizeTailwindDirectives.js +0 -84
  141. package/src/lib/partitionApplyAtRules.js +0 -52
  142. package/src/lib/resolveDefaultsAtRules.js +0 -146
  143. package/src/lib/setupContextUtils.js +0 -883
  144. package/src/lib/setupTrackingContext.js +0 -183
  145. package/src/lib/sharedState.js +0 -48
  146. package/src/lib/substituteScreenAtRules.js +0 -19
  147. package/src/postcss-plugins/nesting/README.md +0 -42
  148. package/src/postcss-plugins/nesting/index.js +0 -13
  149. package/src/postcss-plugins/nesting/plugin.js +0 -80
  150. package/src/processTailwindFeatures.js +0 -58
  151. package/src/public/colors.js +0 -300
  152. package/src/public/create-plugin.js +0 -2
  153. package/src/public/default-config.js +0 -4
  154. package/src/public/default-theme.js +0 -4
  155. package/src/public/resolve-config.js +0 -7
  156. package/src/util/bigSign.js +0 -3
  157. package/src/util/buildMediaQuery.js +0 -20
  158. package/src/util/cloneDeep.js +0 -11
  159. package/src/util/cloneNodes.js +0 -24
  160. package/src/util/color.js +0 -69
  161. package/src/util/configurePlugins.js +0 -23
  162. package/src/util/createPlugin.js +0 -27
  163. package/src/util/createUtilityPlugin.js +0 -37
  164. package/src/util/dataTypes.js +0 -248
  165. package/src/util/defaults.js +0 -17
  166. package/src/util/escapeClassName.js +0 -8
  167. package/src/util/escapeCommas.js +0 -3
  168. package/src/util/flattenColorPalette.js +0 -13
  169. package/src/util/formatVariantSelector.js +0 -196
  170. package/src/util/getAllConfigs.js +0 -19
  171. package/src/util/hashConfig.js +0 -5
  172. package/src/util/isKeyframeRule.js +0 -3
  173. package/src/util/isPlainObject.js +0 -8
  174. package/src/util/isValidArbitraryValue.js +0 -61
  175. package/src/util/log.js +0 -29
  176. package/src/util/nameClass.js +0 -26
  177. package/src/util/negateValue.js +0 -16
  178. package/src/util/normalizeConfig.js +0 -270
  179. package/src/util/normalizeScreens.js +0 -45
  180. package/src/util/parseAnimationValue.js +0 -68
  181. package/src/util/parseBoxShadowValue.js +0 -119
  182. package/src/util/parseDependency.js +0 -49
  183. package/src/util/parseObjectStyles.js +0 -19
  184. package/src/util/pluginUtils.js +0 -192
  185. package/src/util/prefixSelector.js +0 -14
  186. package/src/util/resolveConfig.js +0 -269
  187. package/src/util/resolveConfigPath.js +0 -55
  188. package/src/util/responsive.js +0 -10
  189. package/src/util/tap.js +0 -4
  190. package/src/util/toColorValue.js +0 -3
  191. package/src/util/toPath.js +0 -26
  192. package/src/util/transformThemeValue.js +0 -52
  193. package/src/util/withAlphaVariable.js +0 -49
  194. package/stubs/defaultConfig.stub.js +0 -950
  195. package/stubs/defaultPostCssConfig.stub.js +0 -6
  196. package/stubs/simpleConfig.stub.js +0 -7
  197. package/tailwind.css +0 -5
  198. package/variants.css +0 -1
@@ -1,192 +0,0 @@
1
- import selectorParser from 'postcss-selector-parser'
2
- import escapeCommas from './escapeCommas'
3
- import { withAlphaValue } from './withAlphaVariable'
4
- import {
5
- normalize,
6
- length,
7
- number,
8
- percentage,
9
- url,
10
- color as validateColor,
11
- genericName,
12
- familyName,
13
- image,
14
- absoluteSize,
15
- relativeSize,
16
- position,
17
- lineWidth,
18
- shadow,
19
- } from './dataTypes'
20
- import negateValue from './negateValue'
21
-
22
- export function updateAllClasses(selectors, updateClass) {
23
- let parser = selectorParser((selectors) => {
24
- selectors.walkClasses((sel) => {
25
- let updatedClass = updateClass(sel.value)
26
- sel.value = updatedClass
27
- if (sel.raws && sel.raws.value) {
28
- sel.raws.value = escapeCommas(sel.raws.value)
29
- }
30
- })
31
- })
32
-
33
- let result = parser.processSync(selectors)
34
-
35
- return result
36
- }
37
-
38
- function resolveArbitraryValue(modifier, validate) {
39
- if (!isArbitraryValue(modifier)) {
40
- return undefined
41
- }
42
-
43
- let value = modifier.slice(1, -1)
44
-
45
- if (!validate(value)) {
46
- return undefined
47
- }
48
-
49
- return normalize(value)
50
- }
51
-
52
- function asNegativeValue(modifier, lookup = {}, validate) {
53
- let positiveValue = lookup[modifier]
54
-
55
- if (positiveValue !== undefined) {
56
- return negateValue(positiveValue)
57
- }
58
-
59
- if (isArbitraryValue(modifier)) {
60
- let resolved = resolveArbitraryValue(modifier, validate)
61
-
62
- if (resolved === undefined) {
63
- return undefined
64
- }
65
-
66
- return negateValue(resolved)
67
- }
68
- }
69
-
70
- export function asValue(modifier, options = {}, { validate = () => true } = {}) {
71
- let value = options.values?.[modifier]
72
-
73
- if (value !== undefined) {
74
- return value
75
- }
76
-
77
- if (options.supportsNegativeValues && modifier.startsWith('-')) {
78
- return asNegativeValue(modifier.slice(1), options.values, validate)
79
- }
80
-
81
- return resolveArbitraryValue(modifier, validate)
82
- }
83
-
84
- function isArbitraryValue(input) {
85
- return input.startsWith('[') && input.endsWith(']')
86
- }
87
-
88
- function splitAlpha(modifier) {
89
- let slashIdx = modifier.lastIndexOf('/')
90
-
91
- if (slashIdx === -1 || slashIdx === modifier.length - 1) {
92
- return [modifier]
93
- }
94
-
95
- return [modifier.slice(0, slashIdx), modifier.slice(slashIdx + 1)]
96
- }
97
-
98
- export function asColor(modifier, options = {}, { tailwindConfig = {} } = {}) {
99
- if (options.values?.[modifier] !== undefined) {
100
- return options.values?.[modifier]
101
- }
102
-
103
- let [color, alpha] = splitAlpha(modifier)
104
-
105
- if (alpha !== undefined) {
106
- let normalizedColor =
107
- options.values?.[color] ?? (isArbitraryValue(color) ? color.slice(1, -1) : undefined)
108
-
109
- if (normalizedColor === undefined) {
110
- return undefined
111
- }
112
-
113
- if (isArbitraryValue(alpha)) {
114
- return withAlphaValue(normalizedColor, alpha.slice(1, -1))
115
- }
116
-
117
- if (tailwindConfig.theme?.opacity?.[alpha] === undefined) {
118
- return undefined
119
- }
120
-
121
- return withAlphaValue(normalizedColor, tailwindConfig.theme.opacity[alpha])
122
- }
123
-
124
- return asValue(modifier, options, { validate: validateColor })
125
- }
126
-
127
- export function asLookupValue(modifier, options = {}) {
128
- return options.values?.[modifier]
129
- }
130
-
131
- function guess(validate) {
132
- return (modifier, options) => {
133
- return asValue(modifier, options, { validate })
134
- }
135
- }
136
-
137
- let typeMap = {
138
- any: asValue,
139
- color: asColor,
140
- url: guess(url),
141
- image: guess(image),
142
- length: guess(length),
143
- percentage: guess(percentage),
144
- position: guess(position),
145
- lookup: asLookupValue,
146
- 'generic-name': guess(genericName),
147
- 'family-name': guess(familyName),
148
- number: guess(number),
149
- 'line-width': guess(lineWidth),
150
- 'absolute-size': guess(absoluteSize),
151
- 'relative-size': guess(relativeSize),
152
- shadow: guess(shadow),
153
- }
154
-
155
- let supportedTypes = Object.keys(typeMap)
156
-
157
- function splitAtFirst(input, delim) {
158
- let idx = input.indexOf(delim)
159
- if (idx === -1) return [undefined, input]
160
- return [input.slice(0, idx), input.slice(idx + 1)]
161
- }
162
-
163
- export function coerceValue(types, modifier, options, tailwindConfig) {
164
- if (isArbitraryValue(modifier)) {
165
- let arbitraryValue = modifier.slice(1, -1)
166
- let [explicitType, value] = splitAtFirst(arbitraryValue, ':')
167
-
168
- // It could be that this resolves to `url(https` which is not a valid
169
- // identifier. We currently only support "simple" words with dashes or
170
- // underscores. E.g.: family-name
171
- if (!/^[\w-_]+$/g.test(explicitType)) {
172
- value = arbitraryValue
173
- }
174
-
175
- //
176
- else if (explicitType !== undefined && !supportedTypes.includes(explicitType)) {
177
- return []
178
- }
179
-
180
- if (value.length > 0 && supportedTypes.includes(explicitType)) {
181
- return [asValue(`[${value}]`, options), explicitType]
182
- }
183
- }
184
-
185
- // Find first matching type
186
- for (let type of [].concat(types)) {
187
- let result = typeMap[type](modifier, options, { tailwindConfig })
188
- if (result !== undefined) return [result, type]
189
- }
190
-
191
- return []
192
- }
@@ -1,14 +0,0 @@
1
- import parser from 'postcss-selector-parser'
2
-
3
- export default function (prefix, selector, prependNegative = false) {
4
- return parser((selectors) => {
5
- selectors.walkClasses((classSelector) => {
6
- let baseClass = classSelector.value
7
- let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith('-')
8
-
9
- classSelector.value = shouldPlaceNegativeBeforePrefix
10
- ? `-${prefix}${baseClass.slice(1)}`
11
- : `${prefix}${baseClass}`
12
- })
13
- }).processSync(selector)
14
- }
@@ -1,269 +0,0 @@
1
- import negateValue from './negateValue'
2
- import corePluginList from '../corePluginList'
3
- import configurePlugins from './configurePlugins'
4
- import defaultConfig from '../../stubs/defaultConfig.stub'
5
- import colors from '../public/colors'
6
- import { defaults } from './defaults'
7
- import { toPath } from './toPath'
8
- import { normalizeConfig } from './normalizeConfig'
9
- import isPlainObject from './isPlainObject'
10
- import { cloneDeep } from './cloneDeep'
11
-
12
- function isFunction(input) {
13
- return typeof input === 'function'
14
- }
15
-
16
- function isObject(input) {
17
- return typeof input === 'object' && input !== null
18
- }
19
-
20
- function mergeWith(target, ...sources) {
21
- let customizer = sources.pop()
22
-
23
- for (let source of sources) {
24
- for (let k in source) {
25
- let merged = customizer(target[k], source[k])
26
-
27
- if (merged === undefined) {
28
- if (isObject(target[k]) && isObject(source[k])) {
29
- target[k] = mergeWith(target[k], source[k], customizer)
30
- } else {
31
- target[k] = source[k]
32
- }
33
- } else {
34
- target[k] = merged
35
- }
36
- }
37
- }
38
-
39
- return target
40
- }
41
-
42
- const configUtils = {
43
- colors,
44
- negative(scale) {
45
- // TODO: Log that this function isn't really needed anymore?
46
- return Object.keys(scale)
47
- .filter((key) => scale[key] !== '0')
48
- .reduce((negativeScale, key) => {
49
- let negativeValue = negateValue(scale[key])
50
-
51
- if (negativeValue !== undefined) {
52
- negativeScale[`-${key}`] = negativeValue
53
- }
54
-
55
- return negativeScale
56
- }, {})
57
- },
58
- breakpoints(screens) {
59
- return Object.keys(screens)
60
- .filter((key) => typeof screens[key] === 'string')
61
- .reduce(
62
- (breakpoints, key) => ({
63
- ...breakpoints,
64
- [`screen-${key}`]: screens[key],
65
- }),
66
- {}
67
- )
68
- },
69
- rgb(property) {
70
- if (!property.startsWith('--')) {
71
- throw new Error(
72
- 'The rgb() helper requires a custom property name to be passed as the first argument.'
73
- )
74
- }
75
-
76
- return ({ opacityValue }) => {
77
- if (opacityValue === undefined || opacityValue === 1) {
78
- return `rgb(var(${property}) / 1.0)`
79
- }
80
-
81
- return `rgb(var(${property}) / ${opacityValue})`
82
- }
83
- },
84
- hsl(property) {
85
- if (!property.startsWith('--')) {
86
- throw new Error(
87
- 'The hsl() helper requires a custom property name to be passed as the first argument.'
88
- )
89
- }
90
-
91
- return ({ opacityValue }) => {
92
- if (opacityValue === undefined || opacityValue === 1) {
93
- return `hsl(var(${property}) / 1)`
94
- }
95
-
96
- return `hsl(var(${property}) / ${opacityValue})`
97
- }
98
- },
99
- }
100
-
101
- function value(valueToResolve, ...args) {
102
- return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve
103
- }
104
-
105
- function collectExtends(items) {
106
- return items.reduce((merged, { extend }) => {
107
- return mergeWith(merged, extend, (mergedValue, extendValue) => {
108
- if (mergedValue === undefined) {
109
- return [extendValue]
110
- }
111
-
112
- if (Array.isArray(mergedValue)) {
113
- return [extendValue, ...mergedValue]
114
- }
115
-
116
- return [extendValue, mergedValue]
117
- })
118
- }, {})
119
- }
120
-
121
- function mergeThemes(themes) {
122
- return {
123
- ...themes.reduce((merged, theme) => defaults(merged, theme), {}),
124
-
125
- // In order to resolve n config objects, we combine all of their `extend` properties
126
- // into arrays instead of objects so they aren't overridden.
127
- extend: collectExtends(themes),
128
- }
129
- }
130
-
131
- function mergeExtensionCustomizer(merged, value) {
132
- // When we have an array of objects, we do want to merge it
133
- if (Array.isArray(merged) && isObject(merged[0])) {
134
- return merged.concat(value)
135
- }
136
-
137
- // When the incoming value is an array, and the existing config is an object, prepend the existing object
138
- if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
139
- return [merged, ...value]
140
- }
141
-
142
- // Override arrays (for example for font-families, box-shadows, ...)
143
- if (Array.isArray(value)) {
144
- return value
145
- }
146
-
147
- // Execute default behaviour
148
- return undefined
149
- }
150
-
151
- function mergeExtensions({ extend, ...theme }) {
152
- return mergeWith(theme, extend, (themeValue, extensions) => {
153
- // The `extend` property is an array, so we need to check if it contains any functions
154
- if (!isFunction(themeValue) && !extensions.some(isFunction)) {
155
- return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer)
156
- }
157
-
158
- return (resolveThemePath, utils) =>
159
- mergeWith(
160
- {},
161
- ...[themeValue, ...extensions].map((e) => value(e, resolveThemePath, utils)),
162
- mergeExtensionCustomizer
163
- )
164
- })
165
- }
166
-
167
- function resolveFunctionKeys(object) {
168
- const resolvePath = (key, defaultValue) => {
169
- const path = toPath(key)
170
-
171
- let index = 0
172
- let val = object
173
-
174
- while (val !== undefined && val !== null && index < path.length) {
175
- val = val[path[index++]]
176
- val = isFunction(val) ? val(resolvePath, configUtils) : val
177
- }
178
-
179
- if (val === undefined) {
180
- return defaultValue
181
- }
182
-
183
- if (isPlainObject(val)) {
184
- return cloneDeep(val)
185
- }
186
-
187
- return val
188
- }
189
-
190
- resolvePath.theme = resolvePath
191
-
192
- for (let key in configUtils) {
193
- resolvePath[key] = configUtils[key]
194
- }
195
-
196
- return Object.keys(object).reduce((resolved, key) => {
197
- return {
198
- ...resolved,
199
- [key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key],
200
- }
201
- }, {})
202
- }
203
-
204
- function extractPluginConfigs(configs) {
205
- let allConfigs = []
206
-
207
- configs.forEach((config) => {
208
- allConfigs = [...allConfigs, config]
209
-
210
- const plugins = config?.plugins ?? []
211
-
212
- if (plugins.length === 0) {
213
- return
214
- }
215
-
216
- plugins.forEach((plugin) => {
217
- if (plugin.__isOptionsFunction) {
218
- plugin = plugin()
219
- }
220
- allConfigs = [...allConfigs, ...extractPluginConfigs([plugin?.config ?? {}])]
221
- })
222
- })
223
-
224
- return allConfigs
225
- }
226
-
227
- function resolveCorePlugins(corePluginConfigs) {
228
- const result = [...corePluginConfigs].reduceRight((resolved, corePluginConfig) => {
229
- if (isFunction(corePluginConfig)) {
230
- return corePluginConfig({ corePlugins: resolved })
231
- }
232
- return configurePlugins(corePluginConfig, resolved)
233
- }, corePluginList)
234
-
235
- return result
236
- }
237
-
238
- function resolvePluginLists(pluginLists) {
239
- const result = [...pluginLists].reduceRight((resolved, pluginList) => {
240
- return [...resolved, ...pluginList]
241
- }, [])
242
-
243
- return result
244
- }
245
-
246
- export default function resolveConfig(configs) {
247
- let allConfigs = [
248
- ...extractPluginConfigs(configs),
249
- {
250
- prefix: '',
251
- important: false,
252
- separator: ':',
253
- variantOrder: defaultConfig.variantOrder,
254
- },
255
- ]
256
-
257
- return normalizeConfig(
258
- defaults(
259
- {
260
- theme: resolveFunctionKeys(
261
- mergeExtensions(mergeThemes(allConfigs.map((t) => t?.theme ?? {})))
262
- ),
263
- corePlugins: resolveCorePlugins(allConfigs.map((c) => c.corePlugins)),
264
- plugins: resolvePluginLists(configs.map((c) => c?.plugins ?? [])),
265
- },
266
- ...allConfigs
267
- )
268
- )
269
- }
@@ -1,55 +0,0 @@
1
- import fs from 'fs'
2
- import path from 'path'
3
-
4
- function isObject(value) {
5
- return typeof value === 'object' && value !== null
6
- }
7
-
8
- function isEmpty(obj) {
9
- return Object.keys(obj).length === 0
10
- }
11
-
12
- function isString(value) {
13
- return typeof value === 'string' || value instanceof String
14
- }
15
-
16
- export default function resolveConfigPath(pathOrConfig) {
17
- // require('tailwindcss')({ theme: ..., variants: ... })
18
- if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
19
- return null
20
- }
21
-
22
- // require('tailwindcss')({ config: 'custom-config.js' })
23
- if (
24
- isObject(pathOrConfig) &&
25
- pathOrConfig.config !== undefined &&
26
- isString(pathOrConfig.config)
27
- ) {
28
- return path.resolve(pathOrConfig.config)
29
- }
30
-
31
- // require('tailwindcss')({ config: { theme: ..., variants: ... } })
32
- if (
33
- isObject(pathOrConfig) &&
34
- pathOrConfig.config !== undefined &&
35
- isObject(pathOrConfig.config)
36
- ) {
37
- return null
38
- }
39
-
40
- // require('tailwindcss')('custom-config.js')
41
- if (isString(pathOrConfig)) {
42
- return path.resolve(pathOrConfig)
43
- }
44
-
45
- // require('tailwindcss')
46
- for (const configFile of ['./tailwind.config.js', './tailwind.config.cjs']) {
47
- try {
48
- const configPath = path.resolve(configFile)
49
- fs.accessSync(configPath)
50
- return configPath
51
- } catch (err) {}
52
- }
53
-
54
- return null
55
- }
@@ -1,10 +0,0 @@
1
- import postcss from 'postcss'
2
- import cloneNodes from './cloneNodes'
3
-
4
- export default function responsive(rules) {
5
- return postcss
6
- .atRule({
7
- name: 'responsive',
8
- })
9
- .append(cloneNodes(Array.isArray(rules) ? rules : [rules]))
10
- }
package/src/util/tap.js DELETED
@@ -1,4 +0,0 @@
1
- export function tap(value, mutator) {
2
- mutator(value)
3
- return value
4
- }
@@ -1,3 +0,0 @@
1
- export default function toColorValue(maybeFunction) {
2
- return typeof maybeFunction === 'function' ? maybeFunction({}) : maybeFunction
3
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * Parse a path string into an array of path segments.
3
- *
4
- * Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
5
- *
6
- * Example:
7
- * a -> ['a]
8
- * a.b.c -> ['a', 'b', 'c']
9
- * a[b].c -> ['a', 'b', 'c']
10
- * a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
11
- * a[b][c][d] -> ['a', 'b', 'c', 'd']
12
- *
13
- * @param {string|string[]} path
14
- **/
15
- export function toPath(path) {
16
- if (Array.isArray(path)) return path
17
-
18
- let openBrackets = path.split('[').length - 1
19
- let closedBrackets = path.split(']').length - 1
20
-
21
- if (openBrackets !== closedBrackets) {
22
- throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`)
23
- }
24
-
25
- return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean)
26
- }
@@ -1,52 +0,0 @@
1
- import postcss from 'postcss'
2
-
3
- export default function transformThemeValue(themeSection) {
4
- if (['fontSize', 'outline'].includes(themeSection)) {
5
- return (value) => {
6
- if (typeof value === 'function') value = value({})
7
- if (Array.isArray(value)) value = value[0]
8
-
9
- return value
10
- }
11
- }
12
-
13
- if (
14
- [
15
- 'fontFamily',
16
- 'boxShadow',
17
- 'transitionProperty',
18
- 'transitionDuration',
19
- 'transitionDelay',
20
- 'transitionTimingFunction',
21
- 'backgroundImage',
22
- 'backgroundSize',
23
- 'backgroundColor',
24
- 'cursor',
25
- 'animation',
26
- ].includes(themeSection)
27
- ) {
28
- return (value) => {
29
- if (typeof value === 'function') value = value({})
30
- if (Array.isArray(value)) value = value.join(', ')
31
-
32
- return value
33
- }
34
- }
35
-
36
- // For backwards compatibility reasons, before we switched to underscores
37
- // instead of commas for arbitrary values.
38
- if (['gridTemplateColumns', 'gridTemplateRows', 'objectPosition'].includes(themeSection)) {
39
- return (value) => {
40
- if (typeof value === 'function') value = value({})
41
- if (typeof value === 'string') value = postcss.list.comma(value).join(' ')
42
-
43
- return value
44
- }
45
- }
46
-
47
- return (value) => {
48
- if (typeof value === 'function') value = value({})
49
-
50
- return value
51
- }
52
- }
@@ -1,49 +0,0 @@
1
- import { parseColor, formatColor } from './color'
2
-
3
- export function withAlphaValue(color, alphaValue, defaultValue) {
4
- if (typeof color === 'function') {
5
- return color({ opacityValue: alphaValue })
6
- }
7
-
8
- let parsed = parseColor(color)
9
-
10
- if (parsed === null) {
11
- return defaultValue
12
- }
13
-
14
- return formatColor({ ...parsed, alpha: alphaValue })
15
- }
16
-
17
- export default function withAlphaVariable({ color, property, variable }) {
18
- let properties = [].concat(property)
19
- if (typeof color === 'function') {
20
- return {
21
- [variable]: '1',
22
- ...Object.fromEntries(
23
- properties.map((p) => {
24
- return [p, color({ opacityVariable: variable, opacityValue: `var(${variable})` })]
25
- })
26
- ),
27
- }
28
- }
29
-
30
- const parsed = parseColor(color)
31
-
32
- if (parsed === null) {
33
- return Object.fromEntries(properties.map((p) => [p, color]))
34
- }
35
-
36
- if (parsed.alpha !== undefined) {
37
- // Has an alpha value, return color as-is
38
- return Object.fromEntries(properties.map((p) => [p, color]))
39
- }
40
-
41
- return {
42
- [variable]: '1',
43
- ...Object.fromEntries(
44
- properties.map((p) => {
45
- return [p, formatColor({ ...parsed, alpha: `var(${variable})` })]
46
- })
47
- ),
48
- }
49
- }