tailwindcss 0.0.0-oxide-insiders.4d2d870 → 0.0.0-oxide-insiders.266f029
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.
|
@@ -10,6 +10,7 @@ const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
|
10
10
|
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
11
11
|
const _generateRules = require("./generateRules");
|
|
12
12
|
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
|
|
13
|
+
const _applyImportantSelector = require("../util/applyImportantSelector");
|
|
13
14
|
function _interopRequireDefault(obj) {
|
|
14
15
|
return obj && obj.__esModule ? obj : {
|
|
15
16
|
default: obj
|
|
@@ -481,7 +482,7 @@ function processApply(root, context, localCache) {
|
|
|
481
482
|
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
|
|
482
483
|
// And then re-add it if it was removed
|
|
483
484
|
if (importantSelector && parentSelector !== parent.selector) {
|
|
484
|
-
rule.selector =
|
|
485
|
+
rule.selector = (0, _applyImportantSelector.applyImportantSelector)(rule.selector, importantSelector);
|
|
485
486
|
}
|
|
486
487
|
rule.walkDecls((d)=>{
|
|
487
488
|
d.important = meta.important || important;
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -28,6 +28,7 @@ const _setupContextUtils = require("./setupContextUtils");
|
|
|
28
28
|
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
|
|
29
29
|
const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
|
30
30
|
const _featureFlags = require("../featureFlags");
|
|
31
|
+
const _applyImportantSelector = require("../util/applyImportantSelector");
|
|
31
32
|
function _interopRequireDefault(obj) {
|
|
32
33
|
return obj && obj.__esModule ? obj : {
|
|
33
34
|
default: obj
|
|
@@ -823,7 +824,7 @@ function getImportantStrategy(important) {
|
|
|
823
824
|
return;
|
|
824
825
|
}
|
|
825
826
|
rule.selectors = rule.selectors.map((selector)=>{
|
|
826
|
-
return
|
|
827
|
+
return (0, _applyImportantSelector.applyImportantSelector)(selector, important);
|
|
827
828
|
});
|
|
828
829
|
};
|
|
829
830
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
|
10
|
+
function applyImportantSelector(selector, important) {
|
|
11
|
+
let matches = /^(.*?)(:before|:after|::[\w-]+)(\)*)$/g.exec(selector);
|
|
12
|
+
if (!matches) return `${important} ${wrapWithIs(selector)}`;
|
|
13
|
+
let [, before, pseudo, brackets] = matches;
|
|
14
|
+
return `${important} ${wrapWithIs(before + brackets)}${pseudo}`;
|
|
15
|
+
}
|
|
16
|
+
function wrapWithIs(selector) {
|
|
17
|
+
let parts = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(selector, " ");
|
|
18
|
+
if (parts.length === 1 && parts[0].startsWith(":is(") && parts[0].endsWith(")")) {
|
|
19
|
+
return selector;
|
|
20
|
+
}
|
|
21
|
+
return `:is(${selector})`;
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-oxide-insiders.
|
|
3
|
+
"version": "0.0.0-oxide-insiders.266f029",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"postcss": "^8.0.9"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@tailwindcss/oxide": "0.0.0-oxide-insiders.
|
|
73
|
+
"@tailwindcss/oxide": "0.0.0-oxide-insiders.266f029",
|
|
74
74
|
"arg": "^5.0.2",
|
|
75
75
|
"browserslist": "^4.21.5",
|
|
76
76
|
"chokidar": "^3.5.3",
|
|
@@ -3,6 +3,7 @@ import parser from 'postcss-selector-parser'
|
|
|
3
3
|
|
|
4
4
|
import { resolveMatches } from './generateRules'
|
|
5
5
|
import escapeClassName from '../util/escapeClassName'
|
|
6
|
+
import { applyImportantSelector } from '../util/applyImportantSelector'
|
|
6
7
|
|
|
7
8
|
/** @typedef {Map<string, [any, import('postcss').Rule[]]>} ApplyCache */
|
|
8
9
|
|
|
@@ -555,7 +556,7 @@ function processApply(root, context, localCache) {
|
|
|
555
556
|
|
|
556
557
|
// And then re-add it if it was removed
|
|
557
558
|
if (importantSelector && parentSelector !== parent.selector) {
|
|
558
|
-
rule.selector =
|
|
559
|
+
rule.selector = applyImportantSelector(rule.selector, importantSelector)
|
|
559
560
|
}
|
|
560
561
|
|
|
561
562
|
rule.walkDecls((d) => {
|
package/src/lib/generateRules.js
CHANGED
|
@@ -17,6 +17,7 @@ import { isValidVariantFormatString, parseVariant } from './setupContextUtils'
|
|
|
17
17
|
import isValidArbitraryValue from '../util/isSyntacticallyValidPropertyValue'
|
|
18
18
|
import { splitAtTopLevelOnly } from '../util/splitAtTopLevelOnly.js'
|
|
19
19
|
import { flagEnabled } from '../featureFlags'
|
|
20
|
+
import { applyImportantSelector } from '../util/applyImportantSelector'
|
|
20
21
|
|
|
21
22
|
let classNameParser = selectorParser((selectors) => {
|
|
22
23
|
return selectors.first.filter(({ type }) => type === 'class').pop().value
|
|
@@ -868,7 +869,7 @@ function getImportantStrategy(important) {
|
|
|
868
869
|
}
|
|
869
870
|
|
|
870
871
|
rule.selectors = rule.selectors.map((selector) => {
|
|
871
|
-
return
|
|
872
|
+
return applyImportantSelector(selector, important)
|
|
872
873
|
})
|
|
873
874
|
}
|
|
874
875
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { splitAtTopLevelOnly } from './splitAtTopLevelOnly'
|
|
2
|
+
|
|
3
|
+
export function applyImportantSelector(selector, important) {
|
|
4
|
+
let matches = /^(.*?)(:before|:after|::[\w-]+)(\)*)$/g.exec(selector)
|
|
5
|
+
if (!matches) return `${important} ${wrapWithIs(selector)}`
|
|
6
|
+
|
|
7
|
+
let [, before, pseudo, brackets] = matches
|
|
8
|
+
return `${important} ${wrapWithIs(before + brackets)}${pseudo}`
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function wrapWithIs(selector) {
|
|
12
|
+
let parts = splitAtTopLevelOnly(selector, ' ')
|
|
13
|
+
|
|
14
|
+
if (parts.length === 1 && parts[0].startsWith(':is(') && parts[0].endsWith(')')) {
|
|
15
|
+
return selector
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return `:is(${selector})`
|
|
19
|
+
}
|