@livepreso/content-react 0.3.7 → 0.3.8

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "../../content/content-react": "../../content/content-react:bddeBDvUeJPa+NT4hb6TbJCKyl7AZrKwScnaAaM2sGc=:",
2
+ "../../content/content-react": "../../content/content-react:NqGkXPM43/K6D7T3XLbV5Ej0Y3f363/umU3YZtBBCIw=:",
3
3
  "/@babel/helper-annotate-as-pure/7.16.7": "sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==",
4
4
  "/@babel/helper-module-imports/7.16.7": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==",
5
5
  "/@babel/helper-plugin-utils/7.16.7": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==",
package/CHANGELOG.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "@livepreso/content-react",
3
3
  "entries": [
4
+ {
5
+ "version": "0.3.8",
6
+ "tag": "@livepreso/content-react_v0.3.8",
7
+ "date": "Wed, 24 Jul 2024 06:53:26 GMT",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Update latest"
12
+ }
13
+ ],
14
+ "dependency": [
15
+ {
16
+ "comment": "Updating dependency \"@livepreso/content-base\" from `~1.1.4` to `~1.1.5`"
17
+ }
18
+ ]
19
+ }
20
+ },
4
21
  {
5
22
  "version": "0.3.7",
6
23
  "tag": "@livepreso/content-react_v0.3.7",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Change Log - @livepreso/content-react
2
2
 
3
- This log was last generated on Fri, 03 May 2024 00:56:03 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 24 Jul 2024 06:53:26 GMT and should not be manually modified.
4
+
5
+ ## 0.3.8
6
+ Wed, 24 Jul 2024 06:53:26 GMT
7
+
8
+ ### Patches
9
+
10
+ - Update latest
4
11
 
5
12
  ## 0.3.7
6
13
  Fri, 03 May 2024 00:56:03 GMT
@@ -1,33 +1,35 @@
1
1
  export function useModes() {
2
- const bodyClasses = [...document.body.classList];
2
+ const bodyClasses = [...document.body.classList];
3
3
 
4
- const isMaster = bodyClasses.includes("master");
5
- const isClient = bodyClasses.includes("client");
6
- const isOnline = bodyClasses.includes("online");
7
- const isScreenshot = bodyClasses.includes("screenshot");
8
- const isReadOnly = bodyClasses.includes("preso-readonly");
9
- const isThumbnailScreenshot = bodyClasses.includes("screenshot-thumbnail");
10
- const isPdfScreenshot = bodyClasses.includes("screenshot-full");
11
- const isShareOnline = bodyClasses.includes("share_online");
12
- const isPreview = bodyClasses.includes("preview");
13
- const isPresent = bodyClasses.includes("present");
14
- const isReview = bodyClasses.includes("review");
15
- const isPresomanager = bodyClasses.includes("edit-mode");
16
- const isRemote = isOnline && isClient && !isShareOnline;
4
+ const isMaster = bodyClasses.includes('master');
5
+ const isClient = bodyClasses.includes('client');
6
+ const isOnline = bodyClasses.includes('online');
7
+ const isScreenshot = bodyClasses.includes('screenshot');
8
+ const isReadOnly = bodyClasses.includes('preso-readonly');
9
+ const isThumbnailScreenshot = bodyClasses.includes('screenshot-thumbnail');
10
+ const isPdfScreenshot = bodyClasses.includes('screenshot-full');
11
+ const isShareOnline = bodyClasses.includes('share_online');
12
+ const isPreview = bodyClasses.includes('preview');
13
+ const isPresent = bodyClasses.includes('present');
14
+ const isReview = bodyClasses.includes('review');
15
+ const isPresomanager = bodyClasses.includes('edit-mode');
16
+ const isRemote = isOnline && isClient && !isShareOnline;
17
+ const isCdk = typeof window.__cdk_version__ !== 'undefined';
17
18
 
18
- return {
19
- isMaster,
20
- isClient,
21
- isOnline,
22
- isRemote,
23
- isScreenshot,
24
- isReadOnly,
25
- isShareOnline,
26
- isThumbnailScreenshot,
27
- isPdfScreenshot,
28
- isPreview,
29
- isPresent,
30
- isReview,
31
- isPresomanager,
32
- };
19
+ return {
20
+ isMaster,
21
+ isClient,
22
+ isOnline,
23
+ isRemote,
24
+ isScreenshot,
25
+ isReadOnly,
26
+ isShareOnline,
27
+ isThumbnailScreenshot,
28
+ isPdfScreenshot,
29
+ isPreview,
30
+ isPresent,
31
+ isReview,
32
+ isPresomanager,
33
+ isCdk,
34
+ };
33
35
  }
@@ -1,62 +1,61 @@
1
+ import { useEffect, useState } from "react";
2
+
1
3
  import isPlainObject from "lodash.isplainobject";
2
- import { useEffect } from "react";
3
- import { useSharedState } from "./index.js";
4
4
 
5
5
  function getValueFromContext(context, path, defaultValue) {
6
- if (path) {
7
- return Bridge.Context.get(path, defaultValue);
8
- }
6
+ if (path) {
7
+ return Bridge.Context.get(path, defaultValue);
8
+ }
9
9
 
10
- return context;
10
+ return context;
11
11
  }
12
12
 
13
13
  export function useSlideContext(contextPath = null, defaultValue = null) {
14
- let persist = false;
15
- let path = contextPath;
16
-
17
- const value = getValueFromContext(
18
- window.Bridge.Context.getDict(),
19
- path,
20
- defaultValue
21
- );
22
- const [context, setContextState] = useSharedState(value);
23
-
24
- // You could pass in an object, so that you can set whether
25
- // the saves are persistent or not.
26
- if (isPlainObject(contextPath)) {
27
- path = contextPath.path || null;
28
- persist = contextPath.save || false;
29
- }
30
-
31
- function setContext(key, data) {
32
- let setPath = key;
33
- let setData = data;
34
-
35
- if (path) {
36
- if (data) {
37
- setPath = `${path}.${key}`;
38
- } else {
39
- setPath = path;
40
- setData = key;
41
- }
42
- }
43
-
44
- Bridge.Context.set(setPath, setData, persist);
45
-
46
- const value = getValueFromContext(
47
- Bridge.Context.getDict(),
48
- path,
49
- defaultValue
50
- );
51
- setContextState(value);
52
- }
53
-
54
- useEffect(() => {
55
- if (context !== value) {
56
- Bridge.Context.set(path, context, persist);
57
- }
58
- }, [context]);
59
-
60
- return [context, setContext];
14
+ let persist = false;
15
+ let path = contextPath;
16
+
17
+ const value = getValueFromContext(
18
+ window.Bridge.Context.getDict(),
19
+ path,
20
+ defaultValue,
21
+ );
22
+ const [context, setContextState] = useState(value);
23
+
24
+ // You could pass in an object, so that you can set whether
25
+ // the saves are persistent or not.
26
+ if (isPlainObject(contextPath)) {
27
+ path = contextPath.path || null;
28
+ persist = contextPath.save || false;
29
+ }
30
+
31
+ function setContext(key, data) {
32
+ let setPath = key;
33
+ let setData = data;
34
+
35
+ if (path) {
36
+ if (data) {
37
+ setPath = `${path}.${key}`;
38
+ } else {
39
+ setPath = path;
40
+ setData = key;
41
+ }
42
+ }
43
+
44
+ Bridge.Context.set(setPath, setData, persist);
45
+
46
+ const value = getValueFromContext(
47
+ Bridge.Context.getDict(),
48
+ path,
49
+ defaultValue,
50
+ );
51
+ setContextState(value);
52
+ }
53
+
54
+ useEffect(() => {
55
+ if (context !== value) {
56
+ Bridge.Context.set(path, context, persist);
57
+ }
58
+ }, [context]);
59
+
60
+ return [context, setContext];
61
61
  }
62
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livepreso/content-react",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "react": "~18.2.0",
19
19
  "react-dom": "~18.2.0",
20
- "@livepreso/content-base": "~1.1.4",
20
+ "@livepreso/content-base": "~1.1.5",
21
21
  "ulog": "~2.0.0-beta.18",
22
22
  "lodash.get": "~4.4.2",
23
23
  "lodash.isplainobject": "~4.0.6",