tailwindcss 3.2.7 → 3.3.1
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/CHANGELOG.md +55 -8
- package/lib/cli/build/index.js +7 -3
- package/lib/cli/build/plugin.js +28 -19
- package/lib/cli/build/watching.js +4 -2
- package/lib/cli/index.js +12 -21
- package/lib/cli/init/index.js +21 -6
- package/lib/corePluginList.js +4 -0
- package/lib/corePlugins.js +282 -26
- package/lib/css/preflight.css +2 -0
- package/lib/featureFlags.js +8 -1
- package/lib/lib/expandApplyAtRules.js +12 -1
- package/lib/lib/generateRules.js +14 -10
- package/lib/lib/getModuleDependencies.js +79 -33
- package/lib/lib/load-config.js +40 -0
- package/lib/lib/setupContextUtils.js +10 -2
- package/lib/lib/setupTrackingContext.js +4 -4
- package/lib/lib/sharedState.js +6 -1
- package/lib/oxide/cli/build/index.js +7 -3
- package/lib/oxide/cli/build/plugin.js +27 -18
- package/lib/oxide/cli/build/watching.js +1 -1
- package/lib/oxide/cli/index.js +10 -16
- package/lib/oxide/cli/init/index.js +19 -4
- package/lib/public/colors.js +44 -22
- package/lib/public/default-config.js +2 -2
- package/lib/public/default-theme.js +2 -2
- package/lib/public/load-config.js +10 -0
- package/lib/util/applyImportantSelector.js +37 -0
- package/lib/util/dataTypes.js +3 -0
- package/lib/util/formatVariantSelector.js +34 -32
- package/lib/util/getAllConfigs.js +2 -2
- package/lib/util/normalizeConfig.js +2 -3
- package/lib/util/pluginUtils.js +9 -2
- package/lib/util/resolveConfigPath.js +19 -7
- package/lib/util/splitAtTopLevelOnly.js +7 -1
- package/lib/util/validateConfig.js +11 -0
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +5 -4
- package/src/cli/build/index.js +7 -7
- package/src/cli/build/plugin.js +28 -23
- package/src/cli/build/watching.js +4 -2
- package/src/cli/index.js +8 -26
- package/src/cli/init/index.js +37 -8
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +184 -27
- package/src/css/preflight.css +2 -0
- package/src/featureFlags.js +7 -0
- package/src/lib/expandApplyAtRules.js +14 -1
- package/src/lib/generateRules.js +15 -5
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/load-config.ts +31 -0
- package/src/lib/setupContextUtils.js +9 -2
- package/src/lib/setupTrackingContext.js +4 -4
- package/src/lib/sharedState.js +15 -6
- package/src/oxide/cli/build/index.ts +7 -7
- package/src/oxide/cli/build/plugin.ts +28 -22
- package/src/oxide/cli/build/watching.ts +1 -1
- package/src/oxide/cli/index.ts +7 -15
- package/src/oxide/cli/init/index.ts +34 -7
- 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 +30 -0
- package/src/util/dataTypes.js +4 -0
- package/src/util/formatVariantSelector.js +36 -10
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/normalizeConfig.js +2 -1
- package/src/util/pluginUtils.js +10 -2
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +13 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +36 -1
- package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
- package/stubs/postcss.config.js +6 -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 +8 -7
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +31 -2
- package/lib/constants.js +0 -44
- package/src/constants.js +0 -17
- /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
package/lib/public/colors.js
CHANGED
|
@@ -34,7 +34,8 @@ const _default = {
|
|
|
34
34
|
600: "#475569",
|
|
35
35
|
700: "#334155",
|
|
36
36
|
800: "#1e293b",
|
|
37
|
-
900: "#0f172a"
|
|
37
|
+
900: "#0f172a",
|
|
38
|
+
950: "#020617"
|
|
38
39
|
},
|
|
39
40
|
gray: {
|
|
40
41
|
50: "#f9fafb",
|
|
@@ -46,7 +47,8 @@ const _default = {
|
|
|
46
47
|
600: "#4b5563",
|
|
47
48
|
700: "#374151",
|
|
48
49
|
800: "#1f2937",
|
|
49
|
-
900: "#111827"
|
|
50
|
+
900: "#111827",
|
|
51
|
+
950: "#030712"
|
|
50
52
|
},
|
|
51
53
|
zinc: {
|
|
52
54
|
50: "#fafafa",
|
|
@@ -58,7 +60,8 @@ const _default = {
|
|
|
58
60
|
600: "#52525b",
|
|
59
61
|
700: "#3f3f46",
|
|
60
62
|
800: "#27272a",
|
|
61
|
-
900: "#18181b"
|
|
63
|
+
900: "#18181b",
|
|
64
|
+
950: "#09090b"
|
|
62
65
|
},
|
|
63
66
|
neutral: {
|
|
64
67
|
50: "#fafafa",
|
|
@@ -70,7 +73,8 @@ const _default = {
|
|
|
70
73
|
600: "#525252",
|
|
71
74
|
700: "#404040",
|
|
72
75
|
800: "#262626",
|
|
73
|
-
900: "#171717"
|
|
76
|
+
900: "#171717",
|
|
77
|
+
950: "#0a0a0a"
|
|
74
78
|
},
|
|
75
79
|
stone: {
|
|
76
80
|
50: "#fafaf9",
|
|
@@ -82,7 +86,8 @@ const _default = {
|
|
|
82
86
|
600: "#57534e",
|
|
83
87
|
700: "#44403c",
|
|
84
88
|
800: "#292524",
|
|
85
|
-
900: "#1c1917"
|
|
89
|
+
900: "#1c1917",
|
|
90
|
+
950: "#0c0a09"
|
|
86
91
|
},
|
|
87
92
|
red: {
|
|
88
93
|
50: "#fef2f2",
|
|
@@ -94,7 +99,8 @@ const _default = {
|
|
|
94
99
|
600: "#dc2626",
|
|
95
100
|
700: "#b91c1c",
|
|
96
101
|
800: "#991b1b",
|
|
97
|
-
900: "#7f1d1d"
|
|
102
|
+
900: "#7f1d1d",
|
|
103
|
+
950: "#450a0a"
|
|
98
104
|
},
|
|
99
105
|
orange: {
|
|
100
106
|
50: "#fff7ed",
|
|
@@ -106,7 +112,8 @@ const _default = {
|
|
|
106
112
|
600: "#ea580c",
|
|
107
113
|
700: "#c2410c",
|
|
108
114
|
800: "#9a3412",
|
|
109
|
-
900: "#7c2d12"
|
|
115
|
+
900: "#7c2d12",
|
|
116
|
+
950: "#431407"
|
|
110
117
|
},
|
|
111
118
|
amber: {
|
|
112
119
|
50: "#fffbeb",
|
|
@@ -118,7 +125,8 @@ const _default = {
|
|
|
118
125
|
600: "#d97706",
|
|
119
126
|
700: "#b45309",
|
|
120
127
|
800: "#92400e",
|
|
121
|
-
900: "#78350f"
|
|
128
|
+
900: "#78350f",
|
|
129
|
+
950: "#451a03"
|
|
122
130
|
},
|
|
123
131
|
yellow: {
|
|
124
132
|
50: "#fefce8",
|
|
@@ -130,7 +138,8 @@ const _default = {
|
|
|
130
138
|
600: "#ca8a04",
|
|
131
139
|
700: "#a16207",
|
|
132
140
|
800: "#854d0e",
|
|
133
|
-
900: "#713f12"
|
|
141
|
+
900: "#713f12",
|
|
142
|
+
950: "#422006"
|
|
134
143
|
},
|
|
135
144
|
lime: {
|
|
136
145
|
50: "#f7fee7",
|
|
@@ -142,7 +151,8 @@ const _default = {
|
|
|
142
151
|
600: "#65a30d",
|
|
143
152
|
700: "#4d7c0f",
|
|
144
153
|
800: "#3f6212",
|
|
145
|
-
900: "#365314"
|
|
154
|
+
900: "#365314",
|
|
155
|
+
950: "#1a2e05"
|
|
146
156
|
},
|
|
147
157
|
green: {
|
|
148
158
|
50: "#f0fdf4",
|
|
@@ -154,7 +164,8 @@ const _default = {
|
|
|
154
164
|
600: "#16a34a",
|
|
155
165
|
700: "#15803d",
|
|
156
166
|
800: "#166534",
|
|
157
|
-
900: "#14532d"
|
|
167
|
+
900: "#14532d",
|
|
168
|
+
950: "#052e16"
|
|
158
169
|
},
|
|
159
170
|
emerald: {
|
|
160
171
|
50: "#ecfdf5",
|
|
@@ -166,7 +177,8 @@ const _default = {
|
|
|
166
177
|
600: "#059669",
|
|
167
178
|
700: "#047857",
|
|
168
179
|
800: "#065f46",
|
|
169
|
-
900: "#064e3b"
|
|
180
|
+
900: "#064e3b",
|
|
181
|
+
950: "#022c22"
|
|
170
182
|
},
|
|
171
183
|
teal: {
|
|
172
184
|
50: "#f0fdfa",
|
|
@@ -178,7 +190,8 @@ const _default = {
|
|
|
178
190
|
600: "#0d9488",
|
|
179
191
|
700: "#0f766e",
|
|
180
192
|
800: "#115e59",
|
|
181
|
-
900: "#134e4a"
|
|
193
|
+
900: "#134e4a",
|
|
194
|
+
950: "#042f2e"
|
|
182
195
|
},
|
|
183
196
|
cyan: {
|
|
184
197
|
50: "#ecfeff",
|
|
@@ -190,7 +203,8 @@ const _default = {
|
|
|
190
203
|
600: "#0891b2",
|
|
191
204
|
700: "#0e7490",
|
|
192
205
|
800: "#155e75",
|
|
193
|
-
900: "#164e63"
|
|
206
|
+
900: "#164e63",
|
|
207
|
+
950: "#083344"
|
|
194
208
|
},
|
|
195
209
|
sky: {
|
|
196
210
|
50: "#f0f9ff",
|
|
@@ -202,7 +216,8 @@ const _default = {
|
|
|
202
216
|
600: "#0284c7",
|
|
203
217
|
700: "#0369a1",
|
|
204
218
|
800: "#075985",
|
|
205
|
-
900: "#0c4a6e"
|
|
219
|
+
900: "#0c4a6e",
|
|
220
|
+
950: "#082f49"
|
|
206
221
|
},
|
|
207
222
|
blue: {
|
|
208
223
|
50: "#eff6ff",
|
|
@@ -214,7 +229,8 @@ const _default = {
|
|
|
214
229
|
600: "#2563eb",
|
|
215
230
|
700: "#1d4ed8",
|
|
216
231
|
800: "#1e40af",
|
|
217
|
-
900: "#1e3a8a"
|
|
232
|
+
900: "#1e3a8a",
|
|
233
|
+
950: "#172554"
|
|
218
234
|
},
|
|
219
235
|
indigo: {
|
|
220
236
|
50: "#eef2ff",
|
|
@@ -226,7 +242,8 @@ const _default = {
|
|
|
226
242
|
600: "#4f46e5",
|
|
227
243
|
700: "#4338ca",
|
|
228
244
|
800: "#3730a3",
|
|
229
|
-
900: "#312e81"
|
|
245
|
+
900: "#312e81",
|
|
246
|
+
950: "#1e1b4b"
|
|
230
247
|
},
|
|
231
248
|
violet: {
|
|
232
249
|
50: "#f5f3ff",
|
|
@@ -238,7 +255,8 @@ const _default = {
|
|
|
238
255
|
600: "#7c3aed",
|
|
239
256
|
700: "#6d28d9",
|
|
240
257
|
800: "#5b21b6",
|
|
241
|
-
900: "#4c1d95"
|
|
258
|
+
900: "#4c1d95",
|
|
259
|
+
950: "#2e1065"
|
|
242
260
|
},
|
|
243
261
|
purple: {
|
|
244
262
|
50: "#faf5ff",
|
|
@@ -250,7 +268,8 @@ const _default = {
|
|
|
250
268
|
600: "#9333ea",
|
|
251
269
|
700: "#7e22ce",
|
|
252
270
|
800: "#6b21a8",
|
|
253
|
-
900: "#581c87"
|
|
271
|
+
900: "#581c87",
|
|
272
|
+
950: "#3b0764"
|
|
254
273
|
},
|
|
255
274
|
fuchsia: {
|
|
256
275
|
50: "#fdf4ff",
|
|
@@ -262,7 +281,8 @@ const _default = {
|
|
|
262
281
|
600: "#c026d3",
|
|
263
282
|
700: "#a21caf",
|
|
264
283
|
800: "#86198f",
|
|
265
|
-
900: "#701a75"
|
|
284
|
+
900: "#701a75",
|
|
285
|
+
950: "#4a044e"
|
|
266
286
|
},
|
|
267
287
|
pink: {
|
|
268
288
|
50: "#fdf2f8",
|
|
@@ -274,7 +294,8 @@ const _default = {
|
|
|
274
294
|
600: "#db2777",
|
|
275
295
|
700: "#be185d",
|
|
276
296
|
800: "#9d174d",
|
|
277
|
-
900: "#831843"
|
|
297
|
+
900: "#831843",
|
|
298
|
+
950: "#500724"
|
|
278
299
|
},
|
|
279
300
|
rose: {
|
|
280
301
|
50: "#fff1f2",
|
|
@@ -286,7 +307,8 @@ const _default = {
|
|
|
286
307
|
600: "#e11d48",
|
|
287
308
|
700: "#be123c",
|
|
288
309
|
800: "#9f1239",
|
|
289
|
-
900: "#881337"
|
|
310
|
+
900: "#881337",
|
|
311
|
+
950: "#4c0519"
|
|
290
312
|
},
|
|
291
313
|
get lightBlue () {
|
|
292
314
|
warn({
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "default", {
|
|
|
7
7
|
get: ()=>_default
|
|
8
8
|
});
|
|
9
9
|
const _cloneDeep = require("../util/cloneDeep");
|
|
10
|
-
const
|
|
10
|
+
const _configFull = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/config.full"));
|
|
11
11
|
function _interopRequireDefault(obj) {
|
|
12
12
|
return obj && obj.__esModule ? obj : {
|
|
13
13
|
default: obj
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
const _default = (0, _cloneDeep.cloneDeep)(
|
|
16
|
+
const _default = (0, _cloneDeep.cloneDeep)(_configFull.default);
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "default", {
|
|
|
7
7
|
get: ()=>_default
|
|
8
8
|
});
|
|
9
9
|
const _cloneDeep = require("../util/cloneDeep");
|
|
10
|
-
const
|
|
10
|
+
const _configFull = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/config.full"));
|
|
11
11
|
function _interopRequireDefault(obj) {
|
|
12
12
|
return obj && obj.__esModule ? obj : {
|
|
13
13
|
default: obj
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
const _default = (0, _cloneDeep.cloneDeep)(
|
|
16
|
+
const _default = (0, _cloneDeep.cloneDeep)(_configFull.default.theme);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _loadConfig = require("../lib/load-config");
|
|
10
|
+
const _default = _loadConfig.loadConfig;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "applyImportantSelector", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>applyImportantSelector
|
|
8
|
+
});
|
|
9
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
10
|
+
const _formatVariantSelectorJs = require("./formatVariantSelector.js");
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function applyImportantSelector(selector, important) {
|
|
17
|
+
let sel = (0, _postcssSelectorParser.default)().astSync(selector);
|
|
18
|
+
sel.each((sel)=>{
|
|
19
|
+
// Wrap with :is if it's not already wrapped
|
|
20
|
+
let isWrapped = sel.nodes[0].type === "pseudo" && sel.nodes[0].value === ":is" && sel.nodes.every((node)=>node.type !== "combinator");
|
|
21
|
+
if (!isWrapped) {
|
|
22
|
+
sel.nodes = [
|
|
23
|
+
_postcssSelectorParser.default.pseudo({
|
|
24
|
+
value: ":is",
|
|
25
|
+
nodes: [
|
|
26
|
+
sel.clone()
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
let [pseudoElements] = (0, _formatVariantSelectorJs.collectPseudoElements)(sel);
|
|
32
|
+
if (pseudoElements.length > 0) {
|
|
33
|
+
sel.nodes.push(...pseudoElements.sort(_formatVariantSelectorJs.sortSelector));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return `${important} ${sel.toString()}`;
|
|
37
|
+
}
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -41,6 +41,9 @@ function isCSSFunction(value) {
|
|
|
41
41
|
const placeholder = "--tw-placeholder";
|
|
42
42
|
const placeholderRe = new RegExp(placeholder, "g");
|
|
43
43
|
function normalize(value, isRoot = true) {
|
|
44
|
+
if (value.startsWith("--")) {
|
|
45
|
+
return `var(${value})`;
|
|
46
|
+
}
|
|
44
47
|
// Keep raw strings if it starts with `url(`
|
|
45
48
|
if (value.includes("url(")) {
|
|
46
49
|
return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
|
|
@@ -12,7 +12,9 @@ _export(exports, {
|
|
|
12
12
|
formatVariantSelector: ()=>formatVariantSelector,
|
|
13
13
|
eliminateIrrelevantSelectors: ()=>eliminateIrrelevantSelectors,
|
|
14
14
|
finalizeSelector: ()=>finalizeSelector,
|
|
15
|
-
handleMergePseudo: ()=>handleMergePseudo
|
|
15
|
+
handleMergePseudo: ()=>handleMergePseudo,
|
|
16
|
+
collectPseudoElements: ()=>collectPseudoElements,
|
|
17
|
+
sortSelector: ()=>sortSelector
|
|
16
18
|
});
|
|
17
19
|
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
18
20
|
const _unesc = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser/dist/util/unesc"));
|
|
@@ -202,9 +204,9 @@ function finalizeSelector(current, formats, { context , candidate , base }) {
|
|
|
202
204
|
});
|
|
203
205
|
// Move pseudo elements to the end of the selector (if necessary)
|
|
204
206
|
selector.each((sel)=>{
|
|
205
|
-
let pseudoElements = collectPseudoElements(sel);
|
|
207
|
+
let [pseudoElements] = collectPseudoElements(sel);
|
|
206
208
|
if (pseudoElements.length > 0) {
|
|
207
|
-
sel.nodes.push(pseudoElements.sort(sortSelector));
|
|
209
|
+
sel.nodes.push(...pseudoElements.sort(sortSelector));
|
|
208
210
|
}
|
|
209
211
|
});
|
|
210
212
|
return selector.toString();
|
|
@@ -279,41 +281,38 @@ let pseudoElementExceptions = [
|
|
|
279
281
|
"::-webkit-scrollbar-corner",
|
|
280
282
|
"::-webkit-resizer"
|
|
281
283
|
];
|
|
282
|
-
|
|
283
|
-
* This will make sure to move pseudo's to the correct spot (the end for
|
|
284
|
-
* pseudo elements) because otherwise the selector will never work
|
|
285
|
-
* anyway.
|
|
286
|
-
*
|
|
287
|
-
* E.g.:
|
|
288
|
-
* - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
|
289
|
-
* - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
|
290
|
-
*
|
|
291
|
-
* `::before:hover` doesn't work, which means that we can make it work for you by flipping the order.
|
|
292
|
-
*
|
|
293
|
-
* @param {Selector} selector
|
|
294
|
-
**/ function collectPseudoElements(selector) {
|
|
284
|
+
function collectPseudoElements(selector, force = false) {
|
|
295
285
|
/** @type {Node[]} */ let nodes = [];
|
|
296
|
-
|
|
297
|
-
|
|
286
|
+
let seenPseudoElement = null;
|
|
287
|
+
for (let node of [
|
|
288
|
+
...selector.nodes
|
|
289
|
+
]){
|
|
290
|
+
if (isPseudoElement(node, force)) {
|
|
298
291
|
nodes.push(node);
|
|
299
292
|
selector.removeChild(node);
|
|
293
|
+
seenPseudoElement = node.value;
|
|
294
|
+
} else if (seenPseudoElement !== null) {
|
|
295
|
+
if (pseudoElementExceptions.includes(seenPseudoElement) && isPseudoClass(node, force)) {
|
|
296
|
+
nodes.push(node);
|
|
297
|
+
selector.removeChild(node);
|
|
298
|
+
} else {
|
|
299
|
+
seenPseudoElement = null;
|
|
300
|
+
}
|
|
300
301
|
}
|
|
301
302
|
if (node === null || node === void 0 ? void 0 : node.nodes) {
|
|
302
|
-
|
|
303
|
+
let hasPseudoElementRestrictions = node.type === "pseudo" && (node.value === ":is" || node.value === ":has");
|
|
304
|
+
let [collected, seenPseudoElementInSelector] = collectPseudoElements(node, force || hasPseudoElementRestrictions);
|
|
305
|
+
if (seenPseudoElementInSelector) {
|
|
306
|
+
seenPseudoElement = seenPseudoElementInSelector;
|
|
307
|
+
}
|
|
308
|
+
nodes.push(...collected);
|
|
303
309
|
}
|
|
304
310
|
}
|
|
305
|
-
return
|
|
311
|
+
return [
|
|
312
|
+
nodes,
|
|
313
|
+
seenPseudoElement
|
|
314
|
+
];
|
|
306
315
|
}
|
|
307
|
-
// This will make sure to move pseudo's to the correct spot (the end for
|
|
308
|
-
// pseudo elements) because otherwise the selector will never work
|
|
309
|
-
// anyway.
|
|
310
|
-
//
|
|
311
|
-
// E.g.:
|
|
312
|
-
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
|
313
|
-
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
|
314
|
-
//
|
|
315
|
-
// `::before:hover` doesn't work, which means that we can make it work
|
|
316
|
-
// for you by flipping the order.
|
|
317
316
|
function sortSelector(a, z) {
|
|
318
317
|
// Both nodes are non-pseudo's so we can safely ignore them and keep
|
|
319
318
|
// them in the same order.
|
|
@@ -334,8 +333,11 @@ function sortSelector(a, z) {
|
|
|
334
333
|
// ::file-selector-button) to the right.
|
|
335
334
|
return isPseudoElement(a) - isPseudoElement(z);
|
|
336
335
|
}
|
|
337
|
-
function isPseudoElement(node) {
|
|
336
|
+
function isPseudoElement(node, force = false) {
|
|
338
337
|
if (node.type !== "pseudo") return false;
|
|
339
|
-
if (pseudoElementExceptions.includes(node.value)) return false;
|
|
338
|
+
if (pseudoElementExceptions.includes(node.value) && !force) return false;
|
|
340
339
|
return node.value.startsWith("::") || pseudoElementsBC.includes(node.value);
|
|
341
340
|
}
|
|
341
|
+
function isPseudoClass(node, force) {
|
|
342
|
+
return node.type === "pseudo" && !isPseudoElement(node, force);
|
|
343
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "default", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>getAllConfigs
|
|
8
8
|
});
|
|
9
|
-
const
|
|
9
|
+
const _configFullJs = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/config.full.js"));
|
|
10
10
|
const _featureFlags = require("../featureFlags");
|
|
11
11
|
function _interopRequireDefault(obj) {
|
|
12
12
|
return obj && obj.__esModule ? obj : {
|
|
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) {
|
|
|
16
16
|
function getAllConfigs(config) {
|
|
17
17
|
var _config_presets;
|
|
18
18
|
const configs = ((_config_presets = config === null || config === void 0 ? void 0 : config.presets) !== null && _config_presets !== void 0 ? _config_presets : [
|
|
19
|
-
|
|
19
|
+
_configFullJs.default
|
|
20
20
|
]).slice().reverse().flatMap((preset)=>getAllConfigs(preset instanceof Function ? preset() : preset));
|
|
21
21
|
const features = {
|
|
22
22
|
// Add experimental configs here...
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "normalizeConfig", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>normalizeConfig
|
|
8
8
|
});
|
|
9
|
+
const _featureFlags = require("../featureFlags");
|
|
9
10
|
const _log = /*#__PURE__*/ _interopRequireWildcard(require("./log"));
|
|
10
11
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
12
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -191,13 +192,11 @@ function normalizeConfig(config) {
|
|
|
191
192
|
// Normalize the `content`
|
|
192
193
|
config.content = {
|
|
193
194
|
relative: (()=>{
|
|
194
|
-
var _config_future;
|
|
195
195
|
let { content } = config;
|
|
196
196
|
if (content === null || content === void 0 ? void 0 : content.relative) {
|
|
197
197
|
return content.relative;
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
return (_config_future_relativeContentPathsByDefault = (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future.relativeContentPathsByDefault) !== null && _config_future_relativeContentPathsByDefault !== void 0 ? _config_future_relativeContentPathsByDefault : false;
|
|
199
|
+
return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
|
|
201
200
|
})(),
|
|
202
201
|
files: (()=>{
|
|
203
202
|
let { content , purge } = config;
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -104,6 +104,13 @@ function parseColorFormat(value) {
|
|
|
104
104
|
}
|
|
105
105
|
return value;
|
|
106
106
|
}
|
|
107
|
+
function unwrapArbitraryModifier(modifier) {
|
|
108
|
+
modifier = modifier.slice(1, -1);
|
|
109
|
+
if (modifier.startsWith("--")) {
|
|
110
|
+
modifier = `var(${modifier})`;
|
|
111
|
+
}
|
|
112
|
+
return modifier;
|
|
113
|
+
}
|
|
107
114
|
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
108
115
|
var _options_values;
|
|
109
116
|
if (((_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[modifier]) !== undefined) {
|
|
@@ -122,7 +129,7 @@ function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
|
122
129
|
}
|
|
123
130
|
normalizedColor = parseColorFormat(normalizedColor);
|
|
124
131
|
if (isArbitraryValue(alpha)) {
|
|
125
|
-
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, alpha
|
|
132
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, unwrapArbitraryModifier(alpha));
|
|
126
133
|
}
|
|
127
134
|
if (((_tailwindConfig_theme = tailwindConfig.theme) === null || _tailwindConfig_theme === void 0 ? void 0 : (_tailwindConfig_theme_opacity = _tailwindConfig_theme.opacity) === null || _tailwindConfig_theme_opacity === void 0 ? void 0 : _tailwindConfig_theme_opacity[alpha]) === undefined) {
|
|
128
135
|
return undefined;
|
|
@@ -237,7 +244,7 @@ function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
|
|
|
237
244
|
if (configValue !== null) {
|
|
238
245
|
utilityModifier = configValue;
|
|
239
246
|
} else if (isArbitraryValue(utilityModifier)) {
|
|
240
|
-
utilityModifier = utilityModifier
|
|
247
|
+
utilityModifier = unwrapArbitraryModifier(utilityModifier);
|
|
241
248
|
}
|
|
242
249
|
}
|
|
243
250
|
}
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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: ()=>resolveConfigPath,
|
|
13
|
+
resolveDefaultConfigPath: ()=>resolveDefaultConfigPath
|
|
8
14
|
});
|
|
9
15
|
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
10
16
|
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
@@ -13,6 +19,12 @@ function _interopRequireDefault(obj) {
|
|
|
13
19
|
default: obj
|
|
14
20
|
};
|
|
15
21
|
}
|
|
22
|
+
const defaultConfigFiles = [
|
|
23
|
+
"./tailwind.config.js",
|
|
24
|
+
"./tailwind.config.cjs",
|
|
25
|
+
"./tailwind.config.mjs",
|
|
26
|
+
"./tailwind.config.ts"
|
|
27
|
+
];
|
|
16
28
|
function isObject(value) {
|
|
17
29
|
return typeof value === "object" && value !== null;
|
|
18
30
|
}
|
|
@@ -40,10 +52,10 @@ function resolveConfigPath(pathOrConfig) {
|
|
|
40
52
|
return _path.default.resolve(pathOrConfig);
|
|
41
53
|
}
|
|
42
54
|
// require('tailwindcss')
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
return resolveDefaultConfigPath();
|
|
56
|
+
}
|
|
57
|
+
function resolveDefaultConfigPath() {
|
|
58
|
+
for (const configFile of defaultConfigFiles){
|
|
47
59
|
try {
|
|
48
60
|
const configPath = _path.default.resolve(configFile);
|
|
49
61
|
_fs.default.accessSync(configPath);
|
|
@@ -24,14 +24,20 @@ function splitAtTopLevelOnly(input, separator) {
|
|
|
24
24
|
let stack = [];
|
|
25
25
|
let parts = [];
|
|
26
26
|
let lastPos = 0;
|
|
27
|
+
let isEscaped = false;
|
|
27
28
|
for(let idx = 0; idx < input.length; idx++){
|
|
28
29
|
let char = input[idx];
|
|
29
|
-
if (stack.length === 0 && char === separator[0]) {
|
|
30
|
+
if (stack.length === 0 && char === separator[0] && !isEscaped) {
|
|
30
31
|
if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
|
|
31
32
|
parts.push(input.slice(lastPos, idx));
|
|
32
33
|
lastPos = idx + separator.length;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
if (isEscaped) {
|
|
37
|
+
isEscaped = false;
|
|
38
|
+
} else if (char === "\\") {
|
|
39
|
+
isEscaped = true;
|
|
40
|
+
}
|
|
35
41
|
if (char === "(" || char === "[" || char === "{") {
|
|
36
42
|
stack.push(char);
|
|
37
43
|
} else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
|
|
@@ -20,5 +20,16 @@ function validateConfig(config) {
|
|
|
20
20
|
"https://tailwindcss.com/docs/content-configuration"
|
|
21
21
|
]);
|
|
22
22
|
}
|
|
23
|
+
// Warn if the line-clamp plugin is installed
|
|
24
|
+
try {
|
|
25
|
+
let plugin = require("@tailwindcss/line-clamp");
|
|
26
|
+
if (config.plugins.includes(plugin)) {
|
|
27
|
+
_log.default.warn("line-clamp-in-core", [
|
|
28
|
+
"As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.",
|
|
29
|
+
"Remove it from the `plugins` array in your configuration to eliminate this warning."
|
|
30
|
+
]);
|
|
31
|
+
config.plugins = config.plugins.filter((p)=>p !== plugin);
|
|
32
|
+
}
|
|
33
|
+
} catch {}
|
|
23
34
|
return config;
|
|
24
35
|
}
|
package/loadConfig.d.ts
ADDED
package/loadConfig.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"lib/*",
|
|
39
39
|
"peers/*",
|
|
40
40
|
"scripts/*.js",
|
|
41
|
-
"stubs
|
|
41
|
+
"stubs/*",
|
|
42
42
|
"nesting/*",
|
|
43
43
|
"types/**/*",
|
|
44
44
|
"*.d.ts",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
"arg": "^5.0.2",
|
|
74
74
|
"chokidar": "^3.5.3",
|
|
75
75
|
"color-name": "^1.1.4",
|
|
76
|
-
"detective": "^5.2.1",
|
|
77
76
|
"didyoumean": "^1.2.2",
|
|
78
77
|
"dlv": "^1.1.3",
|
|
79
78
|
"fast-glob": "^3.2.12",
|
|
80
79
|
"glob-parent": "^6.0.2",
|
|
81
80
|
"is-glob": "^4.0.3",
|
|
81
|
+
"jiti": "^1.17.2",
|
|
82
82
|
"lilconfig": "^2.0.6",
|
|
83
83
|
"micromatch": "^4.0.5",
|
|
84
84
|
"normalize-path": "^3.0.0",
|
|
@@ -92,7 +92,8 @@
|
|
|
92
92
|
"postcss-selector-parser": "^6.0.11",
|
|
93
93
|
"postcss-value-parser": "^4.2.0",
|
|
94
94
|
"quick-lru": "^5.1.1",
|
|
95
|
-
"resolve": "^1.22.1"
|
|
95
|
+
"resolve": "^1.22.1",
|
|
96
|
+
"sucrase": "^3.29.0"
|
|
96
97
|
},
|
|
97
98
|
"browserslist": [
|
|
98
99
|
"> 1%",
|
package/src/cli/build/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'fs'
|
|
4
4
|
import path from 'path'
|
|
5
|
+
import { resolveDefaultConfigPath } from '../../util/resolveConfigPath.js'
|
|
5
6
|
import { createProcessor } from './plugin.js'
|
|
6
7
|
|
|
7
|
-
export async function build(args
|
|
8
|
+
export async function build(args) {
|
|
8
9
|
let input = args['--input']
|
|
9
10
|
let shouldWatch = args['--watch']
|
|
10
11
|
|
|
@@ -25,11 +26,7 @@ export async function build(args, configs) {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
// TODO: Reference the @config path here if exists
|
|
28
|
-
let configPath = args['--config']
|
|
29
|
-
? args['--config']
|
|
30
|
-
: ((defaultPath) => (fs.existsSync(defaultPath) ? defaultPath : null))(
|
|
31
|
-
path.resolve(`./${configs.tailwind}`)
|
|
32
|
-
)
|
|
29
|
+
let configPath = args['--config'] ? args['--config'] : resolveDefaultConfigPath()
|
|
33
30
|
|
|
34
31
|
let processor = await createProcessor(args, configPath)
|
|
35
32
|
|
|
@@ -44,6 +41,9 @@ export async function build(args, configs) {
|
|
|
44
41
|
|
|
45
42
|
await processor.watch()
|
|
46
43
|
} else {
|
|
47
|
-
await processor.build()
|
|
44
|
+
await processor.build().catch((e) => {
|
|
45
|
+
console.error(e)
|
|
46
|
+
process.exit(1)
|
|
47
|
+
})
|
|
48
48
|
}
|
|
49
49
|
}
|