tailwindcss 0.0.0-insiders.d3e754a → 0.0.0-insiders.d3f2221
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.
- package/README.md +13 -9
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +4 -0
- package/index.css +5 -0
- package/lib/cli/build/index.js +57 -0
- package/lib/cli/build/plugin.js +431 -0
- package/lib/cli/build/utils.js +88 -0
- package/lib/cli/build/watching.js +182 -0
- package/lib/cli/help/index.js +73 -0
- package/lib/cli/index.js +231 -0
- package/lib/cli/init/index.js +63 -0
- package/lib/cli.js +1 -739
- package/lib/corePluginList.js +13 -3
- package/lib/corePlugins.js +1094 -478
- package/lib/css/preflight.css +17 -4
- package/lib/featureFlags.js +49 -23
- package/lib/index.js +1 -29
- package/lib/lib/cacheInvalidation.js +92 -0
- package/lib/lib/collapseAdjacentRules.js +12 -5
- package/lib/lib/collapseDuplicateDeclarations.js +12 -7
- package/lib/lib/content.js +207 -0
- package/lib/lib/defaultExtractor.js +217 -33
- package/lib/lib/detectNesting.js +15 -4
- package/lib/lib/evaluateTailwindFunctions.js +104 -37
- package/lib/lib/expandApplyAtRules.js +312 -211
- package/lib/lib/expandTailwindAtRules.js +149 -96
- package/lib/lib/findAtConfigPath.js +46 -0
- package/lib/lib/generateRules.js +437 -188
- package/lib/lib/getModuleDependencies.js +88 -37
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +9 -19
- package/lib/lib/offsets.js +306 -0
- package/lib/lib/partitionApplyAtRules.js +11 -6
- package/lib/lib/regex.js +74 -0
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +80 -58
- package/lib/lib/setupContextUtils.js +683 -270
- package/lib/lib/setupTrackingContext.js +63 -67
- package/lib/lib/sharedState.js +39 -10
- package/lib/lib/substituteScreenAtRules.js +13 -9
- package/lib/plugin.js +164 -0
- package/lib/postcss-plugins/nesting/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +10 -6
- package/lib/postcss-plugins/nesting/plugin.js +15 -11
- package/lib/processTailwindFeatures.js +33 -28
- package/lib/public/colors.js +55 -29
- package/lib/public/create-plugin.js +9 -5
- package/lib/public/default-config.js +10 -6
- package/lib/public/default-theme.js +10 -6
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +11 -6
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +6 -1
- package/lib/util/buildMediaQuery.js +12 -5
- package/lib/util/cloneDeep.js +8 -5
- package/lib/util/cloneNodes.js +11 -2
- package/lib/util/color.js +59 -42
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +7 -2
- package/lib/util/createPlugin.js +8 -5
- package/lib/util/createUtilityPlugin.js +15 -11
- package/lib/util/dataTypes.js +172 -47
- package/lib/util/defaults.js +12 -7
- package/lib/util/escapeClassName.js +13 -8
- package/lib/util/escapeCommas.js +6 -1
- package/lib/util/flattenColorPalette.js +9 -8
- package/lib/util/formatVariantSelector.js +230 -151
- package/lib/util/getAllConfigs.js +34 -12
- package/lib/util/hashConfig.js +9 -4
- package/lib/util/isKeyframeRule.js +6 -1
- package/lib/util/isPlainObject.js +6 -1
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +15 -5
- package/lib/util/log.js +36 -9
- package/lib/util/nameClass.js +24 -7
- package/lib/util/negateValue.js +23 -6
- package/lib/util/normalizeConfig.js +142 -69
- package/lib/util/normalizeScreens.js +124 -5
- package/lib/util/parseAnimationValue.js +8 -4
- package/lib/util/parseBoxShadowValue.js +16 -45
- package/lib/util/parseDependency.js +38 -54
- package/lib/util/parseGlob.js +36 -0
- package/lib/util/parseObjectStyles.js +14 -9
- package/lib/util/pluginUtils.js +146 -51
- package/lib/util/prefixSelector.js +29 -10
- package/lib/util/pseudoElements.js +209 -0
- package/lib/util/removeAlphaVariables.js +31 -0
- package/lib/util/resolveConfig.js +100 -73
- package/lib/util/resolveConfigPath.js +27 -8
- package/lib/util/responsive.js +10 -5
- package/lib/util/splitAtTopLevelOnly.js +51 -0
- package/lib/util/tap.js +6 -1
- package/lib/util/toColorValue.js +6 -1
- package/lib/util/toPath.js +20 -2
- package/lib/util/transformThemeValue.js +21 -7
- package/lib/util/validateConfig.js +48 -0
- package/lib/util/validateFormalSyntax.js +26 -0
- package/lib/util/withAlphaVariable.js +24 -12
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +58 -53
- package/plugin.d.ts +11 -0
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/index.js +53 -0
- package/src/cli/build/plugin.js +469 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +229 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +217 -0
- package/src/cli/init/index.js +79 -0
- package/src/cli.js +1 -813
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +636 -117
- package/src/css/preflight.css +17 -4
- package/src/featureFlags.js +13 -3
- package/src/index.js +1 -28
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +5 -1
- package/src/lib/content.js +240 -0
- package/src/lib/defaultExtractor.js +192 -35
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +82 -8
- package/src/lib/expandApplyAtRules.js +322 -189
- package/src/lib/expandTailwindAtRules.js +87 -60
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +428 -128
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/load-config.ts +31 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/offsets.js +373 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/resolveDefaultsAtRules.js +53 -36
- package/src/lib/setupContextUtils.js +608 -157
- package/src/lib/setupTrackingContext.js +44 -58
- package/src/lib/sharedState.js +14 -4
- package/src/plugin.js +133 -0
- package/src/postcss-plugins/nesting/README.md +2 -2
- package/src/processTailwindFeatures.js +3 -2
- package/src/public/colors.js +22 -0
- package/src/public/default-config.js +1 -1
- package/src/public/default-theme.js +2 -2
- package/src/public/load-config.js +2 -0
- package/src/util/applyImportantSelector.js +27 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +5 -1
- package/src/util/color.js +39 -20
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +115 -23
- package/src/util/formatVariantSelector.js +265 -144
- package/src/util/getAllConfigs.js +21 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +25 -1
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +78 -20
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +3 -50
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +118 -23
- package/src/util/prefixSelector.js +29 -10
- package/src/util/pseudoElements.js +167 -0
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -32
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +52 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +36 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +224 -172
- package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
- package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
- package/stubs/postcss.config.js +5 -0
- package/stubs/tailwind.config.cjs +2 -0
- package/stubs/tailwind.config.js +2 -0
- package/stubs/tailwind.config.ts +3 -0
- package/types/config.d.ts +369 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +298 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +378 -0
- package/types/index.d.ts +7 -0
- package/CHANGELOG.md +0 -2075
- package/lib/cli-peer-dependencies.js +0 -15
- package/lib/constants.js +0 -37
- package/peers/index.js +0 -75077
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli-peer-dependencies.js +0 -9
- package/src/constants.js +0 -17
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ // There are some pseudo-elements that may or may not be:
|
|
2
|
+
// **Actionable**
|
|
3
|
+
// Zero or more user-action pseudo-classes may be attached to the pseudo-element itself
|
|
4
|
+
// structural-pseudo-classes are NOT allowed but we don't make
|
|
5
|
+
// The spec is not clear on whether this is allowed or not — but in practice it is.
|
|
6
|
+
// **Terminal**
|
|
7
|
+
// It MUST be placed at the end of a selector
|
|
8
|
+
//
|
|
9
|
+
// This is the required in the spec. However, some pseudo elements are not "terminal" because
|
|
10
|
+
// they represent a "boundary piercing" that is compiled out by a build step.
|
|
11
|
+
// **Jumpable**
|
|
12
|
+
// Any terminal element may "jump" over combinators when moving to the end of the selector
|
|
13
|
+
//
|
|
14
|
+
// This is a backwards-compat quirk of pseudo element variants from earlier versions of Tailwind CSS.
|
|
15
|
+
/** @typedef {'terminal' | 'actionable' | 'jumpable'} PseudoProperty */ /** @type {Record<string, PseudoProperty[]>} */ "use strict";
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "movePseudos", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function() {
|
|
22
|
+
return movePseudos;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
let elementProperties = {
|
|
26
|
+
// Pseudo elements from the spec
|
|
27
|
+
'::after': [
|
|
28
|
+
'terminal',
|
|
29
|
+
'jumpable'
|
|
30
|
+
],
|
|
31
|
+
'::backdrop': [
|
|
32
|
+
'terminal',
|
|
33
|
+
'jumpable'
|
|
34
|
+
],
|
|
35
|
+
'::before': [
|
|
36
|
+
'terminal',
|
|
37
|
+
'jumpable'
|
|
38
|
+
],
|
|
39
|
+
'::cue': [
|
|
40
|
+
'terminal'
|
|
41
|
+
],
|
|
42
|
+
'::cue-region': [
|
|
43
|
+
'terminal'
|
|
44
|
+
],
|
|
45
|
+
'::first-letter': [
|
|
46
|
+
'terminal',
|
|
47
|
+
'jumpable'
|
|
48
|
+
],
|
|
49
|
+
'::first-line': [
|
|
50
|
+
'terminal',
|
|
51
|
+
'jumpable'
|
|
52
|
+
],
|
|
53
|
+
'::grammar-error': [
|
|
54
|
+
'terminal'
|
|
55
|
+
],
|
|
56
|
+
'::marker': [
|
|
57
|
+
'terminal',
|
|
58
|
+
'jumpable'
|
|
59
|
+
],
|
|
60
|
+
'::part': [
|
|
61
|
+
'terminal',
|
|
62
|
+
'actionable'
|
|
63
|
+
],
|
|
64
|
+
'::placeholder': [
|
|
65
|
+
'terminal',
|
|
66
|
+
'jumpable'
|
|
67
|
+
],
|
|
68
|
+
'::selection': [
|
|
69
|
+
'terminal',
|
|
70
|
+
'jumpable'
|
|
71
|
+
],
|
|
72
|
+
'::slotted': [
|
|
73
|
+
'terminal'
|
|
74
|
+
],
|
|
75
|
+
'::spelling-error': [
|
|
76
|
+
'terminal'
|
|
77
|
+
],
|
|
78
|
+
'::target-text': [
|
|
79
|
+
'terminal'
|
|
80
|
+
],
|
|
81
|
+
// Pseudo elements from the spec with special rules
|
|
82
|
+
'::file-selector-button': [
|
|
83
|
+
'terminal',
|
|
84
|
+
'actionable'
|
|
85
|
+
],
|
|
86
|
+
// Library-specific pseudo elements used by component libraries
|
|
87
|
+
// These are Shadow DOM-like
|
|
88
|
+
'::deep': [
|
|
89
|
+
'actionable'
|
|
90
|
+
],
|
|
91
|
+
'::v-deep': [
|
|
92
|
+
'actionable'
|
|
93
|
+
],
|
|
94
|
+
'::ng-deep': [
|
|
95
|
+
'actionable'
|
|
96
|
+
],
|
|
97
|
+
// Note: As a rule, double colons (::) should be used instead of a single colon
|
|
98
|
+
// (:). This distinguishes pseudo-classes from pseudo-elements. However, since
|
|
99
|
+
// this distinction was not present in older versions of the W3C spec, most
|
|
100
|
+
// browsers support both syntaxes for the original pseudo-elements.
|
|
101
|
+
':after': [
|
|
102
|
+
'terminal',
|
|
103
|
+
'jumpable'
|
|
104
|
+
],
|
|
105
|
+
':before': [
|
|
106
|
+
'terminal',
|
|
107
|
+
'jumpable'
|
|
108
|
+
],
|
|
109
|
+
':first-letter': [
|
|
110
|
+
'terminal',
|
|
111
|
+
'jumpable'
|
|
112
|
+
],
|
|
113
|
+
':first-line': [
|
|
114
|
+
'terminal',
|
|
115
|
+
'jumpable'
|
|
116
|
+
],
|
|
117
|
+
// The default value is used when the pseudo-element is not recognized
|
|
118
|
+
// Because it's not recognized, we don't know if it's terminal or not
|
|
119
|
+
// So we assume it can be moved AND can have user-action pseudo classes attached to it
|
|
120
|
+
__default__: [
|
|
121
|
+
'terminal',
|
|
122
|
+
'actionable'
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
function movePseudos(sel) {
|
|
126
|
+
let [pseudos] = movablePseudos(sel);
|
|
127
|
+
// Remove all pseudo elements from their respective selectors
|
|
128
|
+
pseudos.forEach(([sel, pseudo])=>sel.removeChild(pseudo));
|
|
129
|
+
// Re-add them to the end of the selector in the correct order.
|
|
130
|
+
// This moves terminal pseudo elements to the end of the
|
|
131
|
+
// selector otherwise the selector will not be valid.
|
|
132
|
+
//
|
|
133
|
+
// Examples:
|
|
134
|
+
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
|
135
|
+
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
|
136
|
+
//
|
|
137
|
+
// The selector `::before:hover` does not work but we
|
|
138
|
+
// can make it work for you by flipping the order.
|
|
139
|
+
sel.nodes.push(...pseudos.map(([, pseudo])=>pseudo));
|
|
140
|
+
return sel;
|
|
141
|
+
}
|
|
142
|
+
/** @typedef {[sel: Selector, pseudo: Pseudo, attachedTo: Pseudo | null]} MovablePseudo */ /** @typedef {[pseudos: MovablePseudo[], lastSeenElement: Pseudo | null]} MovablePseudosResult */ /**
|
|
143
|
+
* @param {Selector} sel
|
|
144
|
+
* @returns {MovablePseudosResult}
|
|
145
|
+
*/ function movablePseudos(sel) {
|
|
146
|
+
/** @type {MovablePseudo[]} */ let buffer = [];
|
|
147
|
+
/** @type {Pseudo | null} */ let lastSeenElement = null;
|
|
148
|
+
for (let node of sel.nodes){
|
|
149
|
+
if (node.type === 'combinator') {
|
|
150
|
+
buffer = buffer.filter(([, node])=>propertiesForPseudo(node).includes('jumpable'));
|
|
151
|
+
lastSeenElement = null;
|
|
152
|
+
} else if (node.type === 'pseudo') {
|
|
153
|
+
if (isMovablePseudoElement(node)) {
|
|
154
|
+
lastSeenElement = node;
|
|
155
|
+
buffer.push([
|
|
156
|
+
sel,
|
|
157
|
+
node,
|
|
158
|
+
null
|
|
159
|
+
]);
|
|
160
|
+
} else if (lastSeenElement && isAttachablePseudoClass(node, lastSeenElement)) {
|
|
161
|
+
buffer.push([
|
|
162
|
+
sel,
|
|
163
|
+
node,
|
|
164
|
+
lastSeenElement
|
|
165
|
+
]);
|
|
166
|
+
} else {
|
|
167
|
+
lastSeenElement = null;
|
|
168
|
+
}
|
|
169
|
+
var _node_nodes;
|
|
170
|
+
for (let sub of (_node_nodes = node.nodes) !== null && _node_nodes !== void 0 ? _node_nodes : []){
|
|
171
|
+
let [movable, lastSeenElementInSub] = movablePseudos(sub);
|
|
172
|
+
lastSeenElement = lastSeenElementInSub || lastSeenElement;
|
|
173
|
+
buffer.push(...movable);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return [
|
|
178
|
+
buffer,
|
|
179
|
+
lastSeenElement
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* @param {Node} node
|
|
184
|
+
* @returns {boolean}
|
|
185
|
+
*/ function isPseudoElement(node) {
|
|
186
|
+
return node.value.startsWith('::') || elementProperties[node.value] !== undefined;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @param {Node} node
|
|
190
|
+
* @returns {boolean}
|
|
191
|
+
*/ function isMovablePseudoElement(node) {
|
|
192
|
+
return isPseudoElement(node) && propertiesForPseudo(node).includes('terminal');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @param {Node} node
|
|
196
|
+
* @param {Pseudo} pseudo
|
|
197
|
+
* @returns {boolean}
|
|
198
|
+
*/ function isAttachablePseudoClass(node, pseudo) {
|
|
199
|
+
if (node.type !== 'pseudo') return false;
|
|
200
|
+
if (isPseudoElement(node)) return false;
|
|
201
|
+
return propertiesForPseudo(pseudo).includes('actionable');
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @param {Pseudo} pseudo
|
|
205
|
+
* @returns {PseudoProperty[]}
|
|
206
|
+
*/ function propertiesForPseudo(pseudo) {
|
|
207
|
+
var _elementProperties_pseudo_value;
|
|
208
|
+
return (_elementProperties_pseudo_value = elementProperties[pseudo.value]) !== null && _elementProperties_pseudo_value !== void 0 ? _elementProperties_pseudo_value : elementProperties.__default__;
|
|
209
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function removes any uses of CSS variables used as an alpha channel
|
|
3
|
+
*
|
|
4
|
+
* This is required for selectors like `:visited` which do not allow
|
|
5
|
+
* changes in opacity or external control using CSS variables.
|
|
6
|
+
*
|
|
7
|
+
* @param {import('postcss').Container} container
|
|
8
|
+
* @param {string[]} toRemove
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "removeAlphaVariables", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return removeAlphaVariables;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function removeAlphaVariables(container, toRemove) {
|
|
20
|
+
container.walkDecls((decl)=>{
|
|
21
|
+
if (toRemove.includes(decl.prop)) {
|
|
22
|
+
decl.remove();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
for (let varName of toRemove){
|
|
26
|
+
if (decl.value.includes(`/ var(${varName})`)) {
|
|
27
|
+
decl.value = decl.value.replace(`/ var(${varName})`, '');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -2,18 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return resolveConfig;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _negateValue = /*#__PURE__*/ _interop_require_default(require("./negateValue"));
|
|
12
|
+
const _corePluginList = /*#__PURE__*/ _interop_require_default(require("../corePluginList"));
|
|
13
|
+
const _configurePlugins = /*#__PURE__*/ _interop_require_default(require("./configurePlugins"));
|
|
14
|
+
const _colors = /*#__PURE__*/ _interop_require_default(require("../public/colors"));
|
|
15
|
+
const _defaults = require("./defaults");
|
|
16
|
+
const _toPath = require("./toPath");
|
|
17
|
+
const _normalizeConfig = require("./normalizeConfig");
|
|
18
|
+
const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("./isPlainObject"));
|
|
19
|
+
const _cloneDeep = require("./cloneDeep");
|
|
20
|
+
const _pluginUtils = require("./pluginUtils");
|
|
21
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
22
|
+
const _toColorValue = /*#__PURE__*/ _interop_require_default(require("./toColorValue"));
|
|
23
|
+
function _interop_require_default(obj) {
|
|
17
24
|
return obj && obj.__esModule ? obj : {
|
|
18
25
|
default: obj
|
|
19
26
|
};
|
|
@@ -21,17 +28,14 @@ function _interopRequireDefault(obj) {
|
|
|
21
28
|
function isFunction(input) {
|
|
22
29
|
return typeof input === 'function';
|
|
23
30
|
}
|
|
24
|
-
function isObject(input) {
|
|
25
|
-
return typeof input === 'object' && input !== null;
|
|
26
|
-
}
|
|
27
31
|
function mergeWith(target, ...sources) {
|
|
28
32
|
let customizer = sources.pop();
|
|
29
33
|
for (let source of sources){
|
|
30
34
|
for(let k in source){
|
|
31
35
|
let merged = customizer(target[k], source[k]);
|
|
32
36
|
if (merged === undefined) {
|
|
33
|
-
if (
|
|
34
|
-
target[k] = mergeWith(target[k], source[k], customizer);
|
|
37
|
+
if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
|
|
38
|
+
target[k] = mergeWith({}, target[k], source[k], customizer);
|
|
35
39
|
} else {
|
|
36
40
|
target[k] = source[k];
|
|
37
41
|
}
|
|
@@ -46,9 +50,8 @@ const configUtils = {
|
|
|
46
50
|
colors: _colors.default,
|
|
47
51
|
negative (scale) {
|
|
48
52
|
// TODO: Log that this function isn't really needed anymore?
|
|
49
|
-
return Object.keys(scale).filter((key)=>scale[key] !== '0'
|
|
50
|
-
|
|
51
|
-
let negativeValue = (0, _negateValue).default(scale[key]);
|
|
53
|
+
return Object.keys(scale).filter((key)=>scale[key] !== '0').reduce((negativeScale, key)=>{
|
|
54
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
52
55
|
if (negativeValue !== undefined) {
|
|
53
56
|
negativeScale[`-${key}`] = negativeValue;
|
|
54
57
|
}
|
|
@@ -56,19 +59,17 @@ const configUtils = {
|
|
|
56
59
|
}, {});
|
|
57
60
|
},
|
|
58
61
|
breakpoints (screens) {
|
|
59
|
-
return Object.keys(screens).filter((key)=>typeof screens[key] === 'string'
|
|
60
|
-
).reduce((breakpoints, key)=>({
|
|
62
|
+
return Object.keys(screens).filter((key)=>typeof screens[key] === 'string').reduce((breakpoints, key)=>({
|
|
61
63
|
...breakpoints,
|
|
62
64
|
[`screen-${key}`]: screens[key]
|
|
63
|
-
})
|
|
64
|
-
, {});
|
|
65
|
+
}), {});
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
function value(valueToResolve, ...args) {
|
|
68
69
|
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
|
|
69
70
|
}
|
|
70
71
|
function collectExtends(items) {
|
|
71
|
-
return items.reduce((merged, { extend
|
|
72
|
+
return items.reduce((merged, { extend })=>{
|
|
72
73
|
return mergeWith(merged, extend, (mergedValue, extendValue)=>{
|
|
73
74
|
if (mergedValue === undefined) {
|
|
74
75
|
return [
|
|
@@ -90,33 +91,32 @@ function collectExtends(items) {
|
|
|
90
91
|
}
|
|
91
92
|
function mergeThemes(themes) {
|
|
92
93
|
return {
|
|
93
|
-
...themes.reduce((merged, theme)=>(0, _defaults
|
|
94
|
-
, {}),
|
|
94
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
95
95
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
96
96
|
// into arrays instead of objects so they aren't overridden.
|
|
97
97
|
extend: collectExtends(themes)
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function mergeExtensionCustomizer(merged,
|
|
100
|
+
function mergeExtensionCustomizer(merged, value) {
|
|
101
101
|
// When we have an array of objects, we do want to merge it
|
|
102
|
-
if (Array.isArray(merged) &&
|
|
103
|
-
return merged.concat(
|
|
102
|
+
if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
|
|
103
|
+
return merged.concat(value);
|
|
104
104
|
}
|
|
105
105
|
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
106
|
-
if (Array.isArray(
|
|
106
|
+
if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
|
|
107
107
|
return [
|
|
108
108
|
merged,
|
|
109
|
-
...
|
|
109
|
+
...value
|
|
110
110
|
];
|
|
111
111
|
}
|
|
112
112
|
// Override arrays (for example for font-families, box-shadows, ...)
|
|
113
|
-
if (Array.isArray(
|
|
114
|
-
return
|
|
113
|
+
if (Array.isArray(value)) {
|
|
114
|
+
return value;
|
|
115
115
|
}
|
|
116
116
|
// Execute default behaviour
|
|
117
117
|
return undefined;
|
|
118
118
|
}
|
|
119
|
-
function mergeExtensions({ extend
|
|
119
|
+
function mergeExtensions({ extend, ...theme }) {
|
|
120
120
|
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
121
121
|
// The `extend` property is an array, so we need to check if it contains any functions
|
|
122
122
|
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
@@ -125,60 +125,87 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
125
125
|
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
126
126
|
themeValue,
|
|
127
127
|
...extensions
|
|
128
|
-
].map((e)=>value(e, resolveThemePath, utils)
|
|
129
|
-
), mergeExtensionCustomizer)
|
|
130
|
-
;
|
|
128
|
+
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
131
129
|
});
|
|
132
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* @param {string} key
|
|
134
|
+
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
135
|
+
*/ function* toPaths(key) {
|
|
136
|
+
let path = (0, _toPath.toPath)(key);
|
|
137
|
+
if (path.length === 0) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
yield path;
|
|
141
|
+
if (Array.isArray(key)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
|
145
|
+
let matches = key.match(pattern);
|
|
146
|
+
if (matches !== null) {
|
|
147
|
+
let [, prefix, alpha] = matches;
|
|
148
|
+
let newPath = (0, _toPath.toPath)(prefix);
|
|
149
|
+
newPath.alpha = alpha;
|
|
150
|
+
yield newPath;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
133
153
|
function resolveFunctionKeys(object) {
|
|
154
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
134
155
|
const resolvePath = (key, defaultValue)=>{
|
|
135
|
-
const path
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
for (const path of toPaths(key)){
|
|
157
|
+
let index = 0;
|
|
158
|
+
let val = object;
|
|
159
|
+
while(val !== undefined && val !== null && index < path.length){
|
|
160
|
+
val = val[path[index++]];
|
|
161
|
+
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
|
|
162
|
+
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
|
163
|
+
}
|
|
164
|
+
if (val !== undefined) {
|
|
165
|
+
if (path.alpha !== undefined) {
|
|
166
|
+
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
|
167
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
|
168
|
+
}
|
|
169
|
+
if ((0, _isPlainObject.default)(val)) {
|
|
170
|
+
return (0, _cloneDeep.cloneDeep)(val);
|
|
171
|
+
}
|
|
172
|
+
return val;
|
|
173
|
+
}
|
|
147
174
|
}
|
|
148
|
-
return
|
|
175
|
+
return defaultValue;
|
|
149
176
|
};
|
|
150
|
-
resolvePath
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
177
|
+
Object.assign(resolvePath, {
|
|
178
|
+
theme: resolvePath,
|
|
179
|
+
...configUtils
|
|
180
|
+
});
|
|
154
181
|
return Object.keys(object).reduce((resolved, key)=>{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
158
|
-
};
|
|
182
|
+
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
|
183
|
+
return resolved;
|
|
159
184
|
}, {});
|
|
160
185
|
}
|
|
161
186
|
function extractPluginConfigs(configs) {
|
|
162
187
|
let allConfigs = [];
|
|
163
188
|
configs.forEach((config)=>{
|
|
189
|
+
var _config;
|
|
164
190
|
allConfigs = [
|
|
165
191
|
...allConfigs,
|
|
166
192
|
config
|
|
167
193
|
];
|
|
168
|
-
var
|
|
169
|
-
const plugins = (
|
|
194
|
+
var _config_plugins;
|
|
195
|
+
const plugins = (_config_plugins = (_config = config) === null || _config === void 0 ? void 0 : _config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [];
|
|
170
196
|
if (plugins.length === 0) {
|
|
171
197
|
return;
|
|
172
198
|
}
|
|
173
199
|
plugins.forEach((plugin)=>{
|
|
200
|
+
var _plugin;
|
|
174
201
|
if (plugin.__isOptionsFunction) {
|
|
175
202
|
plugin = plugin();
|
|
176
203
|
}
|
|
177
|
-
var
|
|
204
|
+
var _plugin_config;
|
|
178
205
|
allConfigs = [
|
|
179
206
|
...allConfigs,
|
|
180
207
|
...extractPluginConfigs([
|
|
181
|
-
(
|
|
208
|
+
(_plugin_config = (_plugin = plugin) === null || _plugin === void 0 ? void 0 : _plugin.config) !== null && _plugin_config !== void 0 ? _plugin_config : {}
|
|
182
209
|
])
|
|
183
210
|
];
|
|
184
211
|
});
|
|
@@ -194,7 +221,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
|
|
194
221
|
corePlugins: resolved
|
|
195
222
|
});
|
|
196
223
|
}
|
|
197
|
-
return (0, _configurePlugins
|
|
224
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
198
225
|
}, _corePluginList.default);
|
|
199
226
|
return result;
|
|
200
227
|
}
|
|
@@ -215,19 +242,19 @@ function resolveConfig(configs) {
|
|
|
215
242
|
{
|
|
216
243
|
prefix: '',
|
|
217
244
|
important: false,
|
|
218
|
-
separator: ':'
|
|
219
|
-
|
|
220
|
-
},
|
|
245
|
+
separator: ':'
|
|
246
|
+
}
|
|
221
247
|
];
|
|
222
|
-
var
|
|
223
|
-
return (0, _normalizeConfig
|
|
248
|
+
var _t_theme, _c_plugins;
|
|
249
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
224
250
|
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
225
|
-
|
|
251
|
+
var _t;
|
|
252
|
+
return (_t_theme = (_t = t) === null || _t === void 0 ? void 0 : _t.theme) !== null && _t_theme !== void 0 ? _t_theme : {};
|
|
226
253
|
})))),
|
|
227
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
|
|
228
|
-
)),
|
|
254
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
229
255
|
plugins: resolvePluginLists(configs.map((c)=>{
|
|
230
|
-
|
|
256
|
+
var _c;
|
|
257
|
+
return (_c_plugins = (_c = c) === null || _c === void 0 ? void 0 : _c.plugins) !== null && _c_plugins !== void 0 ? _c_plugins : [];
|
|
231
258
|
}))
|
|
232
259
|
}, ...allConfigs));
|
|
233
260
|
}
|
|
@@ -2,14 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
default: function() {
|
|
13
|
+
return resolveConfigPath;
|
|
14
|
+
},
|
|
15
|
+
resolveDefaultConfigPath: function() {
|
|
16
|
+
return resolveDefaultConfigPath;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
20
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
9
22
|
return obj && obj.__esModule ? obj : {
|
|
10
23
|
default: obj
|
|
11
24
|
};
|
|
12
25
|
}
|
|
26
|
+
const defaultConfigFiles = [
|
|
27
|
+
'./tailwind.config.js',
|
|
28
|
+
'./tailwind.config.cjs',
|
|
29
|
+
'./tailwind.config.mjs',
|
|
30
|
+
'./tailwind.config.ts'
|
|
31
|
+
];
|
|
13
32
|
function isObject(value) {
|
|
14
33
|
return typeof value === 'object' && value !== null;
|
|
15
34
|
}
|
|
@@ -37,10 +56,10 @@ function resolveConfigPath(pathOrConfig) {
|
|
|
37
56
|
return _path.default.resolve(pathOrConfig);
|
|
38
57
|
}
|
|
39
58
|
// require('tailwindcss')
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
return resolveDefaultConfigPath();
|
|
60
|
+
}
|
|
61
|
+
function resolveDefaultConfigPath() {
|
|
62
|
+
for (const configFile of defaultConfigFiles){
|
|
44
63
|
try {
|
|
45
64
|
const configPath = _path.default.resolve(configFile);
|
|
46
65
|
_fs.default.accessSync(configPath);
|
package/lib/util/responsive.js
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return responsive;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
12
|
+
const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("./cloneNodes"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
9
14
|
return obj && obj.__esModule ? obj : {
|
|
10
15
|
default: obj
|
|
11
16
|
};
|
|
@@ -13,7 +18,7 @@ function _interopRequireDefault(obj) {
|
|
|
13
18
|
function responsive(rules) {
|
|
14
19
|
return _postcss.default.atRule({
|
|
15
20
|
name: 'responsive'
|
|
16
|
-
}).append((0, _cloneNodes
|
|
21
|
+
}).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [
|
|
17
22
|
rules
|
|
18
23
|
]));
|
|
19
24
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This splits a string on a top-level character.
|
|
3
|
+
*
|
|
4
|
+
* Regex doesn't support recursion (at least not the JS-flavored version).
|
|
5
|
+
* So we have to use a tiny state machine to keep track of paren placement.
|
|
6
|
+
*
|
|
7
|
+
* Expected behavior using commas:
|
|
8
|
+
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
|
|
9
|
+
* ─┬─ ┬ ┬ ┬
|
|
10
|
+
* x x x ╰──────── Split because top-level
|
|
11
|
+
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
|
|
12
|
+
*
|
|
13
|
+
* @param {string} input
|
|
14
|
+
* @param {string} separator
|
|
15
|
+
*/ "use strict";
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "splitAtTopLevelOnly", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function() {
|
|
22
|
+
return splitAtTopLevelOnly;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function splitAtTopLevelOnly(input, separator) {
|
|
26
|
+
let stack = [];
|
|
27
|
+
let parts = [];
|
|
28
|
+
let lastPos = 0;
|
|
29
|
+
let isEscaped = false;
|
|
30
|
+
for(let idx = 0; idx < input.length; idx++){
|
|
31
|
+
let char = input[idx];
|
|
32
|
+
if (stack.length === 0 && char === separator[0] && !isEscaped) {
|
|
33
|
+
if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
|
|
34
|
+
parts.push(input.slice(lastPos, idx));
|
|
35
|
+
lastPos = idx + separator.length;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (isEscaped) {
|
|
39
|
+
isEscaped = false;
|
|
40
|
+
} else if (char === '\\') {
|
|
41
|
+
isEscaped = true;
|
|
42
|
+
}
|
|
43
|
+
if (char === '(' || char === '[' || char === '{') {
|
|
44
|
+
stack.push(char);
|
|
45
|
+
} else if (char === ')' && stack[stack.length - 1] === '(' || char === ']' && stack[stack.length - 1] === '[' || char === '}' && stack[stack.length - 1] === '{') {
|
|
46
|
+
stack.pop();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
parts.push(input.slice(lastPos));
|
|
50
|
+
return parts;
|
|
51
|
+
}
|
package/lib/util/tap.js
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "tap", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return tap;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
6
11
|
function tap(value, mutator) {
|
|
7
12
|
mutator(value);
|
|
8
13
|
return value;
|