@livepreso/content-react 0.3.3 → 0.3.4
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.json +12 -0
- package/CHANGELOG.md +8 -1
- package/lib/hooks/use-modes.js +1 -21
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livepreso/content-react",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.3.4",
|
|
6
|
+
"tag": "@livepreso/content-react_v0.3.4",
|
|
7
|
+
"date": "Sun, 14 Jan 2024 21:06:16 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Remove observer in use-modes due to render loops"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.3.3",
|
|
6
18
|
"tag": "@livepreso/content-react_v0.3.3",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @livepreso/content-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sun, 14 Jan 2024 21:06:16 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.3.4
|
|
6
|
+
Sun, 14 Jan 2024 21:06:16 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Remove observer in use-modes due to render loops
|
|
4
11
|
|
|
5
12
|
## 0.3.3
|
|
6
13
|
Thu, 21 Dec 2023 00:50:30 GMT
|
package/lib/hooks/use-modes.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function getModes() {
|
|
1
|
+
export function useModes() {
|
|
4
2
|
const bodyClasses = [...document.body.classList];
|
|
5
3
|
|
|
6
4
|
const isMaster = bodyClasses.includes("master");
|
|
@@ -33,21 +31,3 @@ function getModes() {
|
|
|
33
31
|
isPresomanager,
|
|
34
32
|
};
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
export function useModes() {
|
|
38
|
-
const [modes, setModes] = useState(getModes());
|
|
39
|
-
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
const observer = new MutationObserver(() => {
|
|
42
|
-
setModes(getModes());
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
observer.observe(document.body, {
|
|
46
|
-
attributes: ["classList"],
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return () => observer.disconnect();
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
return modes;
|
|
53
|
-
}
|