@readme/markdown 9.0.1 → 9.0.2
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 +8 -6
- package/dist/main.js +4 -4
- package/dist/main.node.js +4 -4
- package/dist/main.node.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ const traverse = (node: Node, callback: (element: Node) => void) => {
|
|
|
14
14
|
const TailwindStyle = ({ children }: React.PropsWithChildren<unknown>) => {
|
|
15
15
|
const [stylesheet, setStylesheet] = useState('');
|
|
16
16
|
const classes = useRef(new Set<string>());
|
|
17
|
-
const ref = useRef<
|
|
17
|
+
const ref = useRef<HTMLStyleElement>(null);
|
|
18
18
|
|
|
19
19
|
const addClasses = useCallback((element: Node) => {
|
|
20
20
|
if (!(element instanceof HTMLElement)) return;
|
|
@@ -41,7 +41,7 @@ const TailwindStyle = ({ children }: React.PropsWithChildren<unknown>) => {
|
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (!ref.current) return;
|
|
43
43
|
|
|
44
|
-
ref.current.querySelectorAll(`.${tailwindPrefix}`).forEach(child => traverse(child, addClasses));
|
|
44
|
+
ref.current.parentElement.querySelectorAll(`.${tailwindPrefix}`).forEach(child => traverse(child, addClasses));
|
|
45
45
|
updateStylesheet();
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -75,7 +75,7 @@ const TailwindStyle = ({ children }: React.PropsWithChildren<unknown>) => {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
-
observer.observe(ref.current, {
|
|
78
|
+
observer.observe(ref.current.parentElement, {
|
|
79
79
|
subtree: true,
|
|
80
80
|
childList: true,
|
|
81
81
|
attributes: true,
|
|
@@ -87,10 +87,12 @@ const TailwindStyle = ({ children }: React.PropsWithChildren<unknown>) => {
|
|
|
87
87
|
}, [addClasses, updateStylesheet]);
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
|
-
|
|
91
|
-
<style data-tailwind-stylesheet>
|
|
90
|
+
<>
|
|
91
|
+
<style ref={ref} data-tailwind-stylesheet>
|
|
92
|
+
{stylesheet}
|
|
93
|
+
</style>
|
|
92
94
|
{children}
|
|
93
|
-
|
|
95
|
+
</>
|
|
94
96
|
);
|
|
95
97
|
};
|
|
96
98
|
|
package/dist/main.js
CHANGED
|
@@ -18776,7 +18776,7 @@ const TailwindStyle = ({ children }) => {
|
|
|
18776
18776
|
(0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
|
|
18777
18777
|
if (!ref.current)
|
|
18778
18778
|
return;
|
|
18779
|
-
ref.current.querySelectorAll(`.${tailwindPrefix}`).forEach(child => traverse(child, addClasses));
|
|
18779
|
+
ref.current.parentElement.querySelectorAll(`.${tailwindPrefix}`).forEach(child => traverse(child, addClasses));
|
|
18780
18780
|
updateStylesheet();
|
|
18781
18781
|
});
|
|
18782
18782
|
/*
|
|
@@ -18807,7 +18807,7 @@ const TailwindStyle = ({ children }) => {
|
|
|
18807
18807
|
}
|
|
18808
18808
|
});
|
|
18809
18809
|
});
|
|
18810
|
-
observer.observe(ref.current, {
|
|
18810
|
+
observer.observe(ref.current.parentElement, {
|
|
18811
18811
|
subtree: true,
|
|
18812
18812
|
childList: true,
|
|
18813
18813
|
attributes: true,
|
|
@@ -18816,8 +18816,8 @@ const TailwindStyle = ({ children }) => {
|
|
|
18816
18816
|
// eslint-disable-next-line consistent-return
|
|
18817
18817
|
return () => observer.disconnect();
|
|
18818
18818
|
}, [addClasses, updateStylesheet]);
|
|
18819
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(
|
|
18820
|
-
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("style", { "data-tailwind-stylesheet": true }, stylesheet),
|
|
18819
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement((external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default()).Fragment, null,
|
|
18820
|
+
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("style", { ref: ref, "data-tailwind-stylesheet": true }, stylesheet),
|
|
18821
18821
|
children));
|
|
18822
18822
|
};
|
|
18823
18823
|
/* harmony default export */ const components_TailwindStyle = (TailwindStyle);
|
package/dist/main.node.js
CHANGED
|
@@ -21805,7 +21805,7 @@ const TailwindStyle = ({ children }) => {
|
|
|
21805
21805
|
(0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
|
|
21806
21806
|
if (!ref.current)
|
|
21807
21807
|
return;
|
|
21808
|
-
ref.current.querySelectorAll(`.${tailwindPrefix}`).forEach(child => traverse(child, addClasses));
|
|
21808
|
+
ref.current.parentElement.querySelectorAll(`.${tailwindPrefix}`).forEach(child => traverse(child, addClasses));
|
|
21809
21809
|
updateStylesheet();
|
|
21810
21810
|
});
|
|
21811
21811
|
/*
|
|
@@ -21836,7 +21836,7 @@ const TailwindStyle = ({ children }) => {
|
|
|
21836
21836
|
}
|
|
21837
21837
|
});
|
|
21838
21838
|
});
|
|
21839
|
-
observer.observe(ref.current, {
|
|
21839
|
+
observer.observe(ref.current.parentElement, {
|
|
21840
21840
|
subtree: true,
|
|
21841
21841
|
childList: true,
|
|
21842
21842
|
attributes: true,
|
|
@@ -21845,8 +21845,8 @@ const TailwindStyle = ({ children }) => {
|
|
|
21845
21845
|
// eslint-disable-next-line consistent-return
|
|
21846
21846
|
return () => observer.disconnect();
|
|
21847
21847
|
}, [addClasses, updateStylesheet]);
|
|
21848
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(
|
|
21849
|
-
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("style", { "data-tailwind-stylesheet": true }, stylesheet),
|
|
21848
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement((external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default()).Fragment, null,
|
|
21849
|
+
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("style", { ref: ref, "data-tailwind-stylesheet": true }, stylesheet),
|
|
21850
21850
|
children));
|
|
21851
21851
|
};
|
|
21852
21852
|
/* harmony default export */ const components_TailwindStyle = (TailwindStyle);
|