@readme/markdown 15.3.0 → 15.4.0
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/components/TailwindStyle/index.tsx +5 -2
- package/dist/components/TailwindStyle/index.d.ts +3 -1
- package/dist/main.js +10 -6
- package/dist/main.node.js +10 -6
- package/dist/main.node.js.map +1 -1
- package/dist/render-fixture.node.js +10 -6
- package/dist/render-fixture.node.js.map +1 -1
- package/dist/utils/tailwind-compiler.d.ts +13 -1
- package/package.json +1 -1
|
@@ -92693,7 +92693,7 @@ async function loadStylesheet(id, base) {
|
|
|
92693
92693
|
async function loadModule() {
|
|
92694
92694
|
throw new Error('The browser build does not support plugins or config files.');
|
|
92695
92695
|
}
|
|
92696
|
-
async function createCompiler({ darkModeDataAttribute }) {
|
|
92696
|
+
async function createCompiler({ darkModeDataAttribute, darkModeRootSelector, }) {
|
|
92697
92697
|
let css = `
|
|
92698
92698
|
@layer theme, base, components, utilities;
|
|
92699
92699
|
|
|
@@ -92701,9 +92701,12 @@ async function createCompiler({ darkModeDataAttribute }) {
|
|
|
92701
92701
|
@import "tailwindcss/utilities.css" layer(utilities);
|
|
92702
92702
|
`;
|
|
92703
92703
|
if (darkModeDataAttribute) {
|
|
92704
|
+
// Anchors `dark:` to `darkModeRootSelector`'s own attribute instead of any ancestor's,
|
|
92705
|
+
// when supplied — see the `darkModeRootSelector` param doc below for why there's no default.
|
|
92706
|
+
const root = darkModeRootSelector || '';
|
|
92704
92707
|
css += `
|
|
92705
92708
|
|
|
92706
|
-
@custom-variant dark (&:where([${darkModeDataAttribute}=dark], [${darkModeDataAttribute}=dark] *));`;
|
|
92709
|
+
@custom-variant dark (&:where(${root}[${darkModeDataAttribute}=dark], ${root}[${darkModeDataAttribute}=dark] *));`;
|
|
92707
92710
|
}
|
|
92708
92711
|
return Hu(css, {
|
|
92709
92712
|
base: '/',
|
|
@@ -92711,8 +92714,8 @@ async function createCompiler({ darkModeDataAttribute }) {
|
|
|
92711
92714
|
loadModule,
|
|
92712
92715
|
});
|
|
92713
92716
|
}
|
|
92714
|
-
async function tailwindCompiler(classes, { prefix, darkModeDataAttribute }) {
|
|
92715
|
-
const compiler = await createCompiler({ darkModeDataAttribute });
|
|
92717
|
+
async function tailwindCompiler(classes, { prefix, darkModeDataAttribute, darkModeRootSelector, }) {
|
|
92718
|
+
const compiler = await createCompiler({ darkModeDataAttribute, darkModeRootSelector });
|
|
92716
92719
|
const css = compiler.build(Array.from(classes));
|
|
92717
92720
|
return lib_postcss([postcss_prefix_selector_default()({ prefix })]).process(css, { from: undefined });
|
|
92718
92721
|
}
|
|
@@ -92727,7 +92730,7 @@ const traverse = (node, callback) => {
|
|
|
92727
92730
|
traverse(child, callback);
|
|
92728
92731
|
});
|
|
92729
92732
|
};
|
|
92730
|
-
const TailwindStyle = ({ children, darkModeDataAttribute }) => {
|
|
92733
|
+
const TailwindStyle = ({ children, darkModeDataAttribute, darkModeRootSelector }) => {
|
|
92731
92734
|
const [stylesheet, setStylesheet] = (0,external_react_.useState)('');
|
|
92732
92735
|
const classesSet = (0,external_react_.useRef)(new Set());
|
|
92733
92736
|
const ref = (0,external_react_.useRef)(null);
|
|
@@ -92751,6 +92754,7 @@ const TailwindStyle = ({ children, darkModeDataAttribute }) => {
|
|
|
92751
92754
|
const sheet = await tailwindCompiler(classes, {
|
|
92752
92755
|
prefix: `.${tailwindPrefix}`,
|
|
92753
92756
|
darkModeDataAttribute,
|
|
92757
|
+
darkModeRootSelector,
|
|
92754
92758
|
});
|
|
92755
92759
|
/* @note: don't insert an empty stylesheet */
|
|
92756
92760
|
if (sheet.css.match(/^@layer utilities;/m))
|
|
@@ -92758,7 +92762,7 @@ const TailwindStyle = ({ children, darkModeDataAttribute }) => {
|
|
|
92758
92762
|
setStylesheet(sheet.css);
|
|
92759
92763
|
};
|
|
92760
92764
|
run();
|
|
92761
|
-
}, [classes, darkModeDataAttribute]);
|
|
92765
|
+
}, [classes, darkModeDataAttribute, darkModeRootSelector]);
|
|
92762
92766
|
/*
|
|
92763
92767
|
* @note: execute once on load
|
|
92764
92768
|
*/
|