@cntrl-site/sdk-nextjs 1.8.18-alpha.2 → 1.8.18-alpha.3

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.
Binary file
Binary file
Binary file
@@ -50,10 +50,11 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
50
50
  const itemScale = (0, useItemScale_1.useItemScale)(item, sectionId);
51
51
  const interactionCtrl = (0, useItemInteractionCtrl_1.useItemInteractionCtrl)(item.id);
52
52
  const triggers = (0, useItemTriggers_1.useItemTriggers)(interactionCtrl);
53
+ console.log(interactionCtrl);
53
54
  const [position, setPosition] = (0, react_1.useState)({ x: 0, y: 0 });
54
55
  const [isDraggingActive, setIsDraggingActive] = (0, react_1.useState)(false);
55
56
  const wrapperStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['top', 'left']);
56
- const innerStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['width', 'height', 'scale', 'top', 'left']);
57
+ const innerStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['width', 'height', 'scale']);
57
58
  const { width, height, top, left } = (0, useItemArea_1.useItemArea)(item, sectionId, {
58
59
  top: (_b = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _b === void 0 ? void 0 : _b.top,
59
60
  left: (_c = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _c === void 0 ? void 0 : _c.left,
@@ -27,20 +27,10 @@ const InteractionsProvider = ({ article, children }) => {
27
27
  const notifyLoad = (0, react_1.useCallback)(() => {
28
28
  if (!registry)
29
29
  return;
30
- requestAnimationFrame(() => {
31
- setTimeout(() => {
32
- registry.notifyLoad();
33
- }, 0);
34
- });
30
+ registry.notifyLoad();
35
31
  }, [registry]);
36
32
  (0, react_1.useEffect)(() => {
37
- if (document.readyState === 'complete') {
38
- notifyLoad();
39
- }
40
- else {
41
- window.addEventListener('load', notifyLoad);
42
- }
43
- return () => window.removeEventListener('load', notifyLoad);
33
+ notifyLoad();
44
34
  }, [notifyLoad]);
45
35
  (0, react_1.useEffect)(() => {
46
36
  const log = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.8.18-alpha.2",
3
+ "version": "1.8.18-alpha.3",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -80,10 +80,11 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isP
80
80
  const itemScale = useItemScale(item, sectionId);
81
81
  const interactionCtrl = useItemInteractionCtrl(item.id);
82
82
  const triggers = useItemTriggers(interactionCtrl);
83
+ console.log(interactionCtrl);
83
84
  const [position, setPosition] = useState({ x: 0, y: 0 });
84
85
  const [isDraggingActive, setIsDraggingActive] = useState(false);
85
86
  const wrapperStateProps = interactionCtrl?.getState(['top', 'left']);
86
- const innerStateProps = interactionCtrl?.getState(['width', 'height', 'scale', 'top', 'left']);
87
+ const innerStateProps = interactionCtrl?.getState(['width', 'height', 'scale']);
87
88
  const { width, height, top, left } = useItemArea(item, sectionId, {
88
89
  top: wrapperStateProps?.styles?.top as number,
89
90
  left: wrapperStateProps?.styles?.left as number,
@@ -29,21 +29,11 @@ export const InteractionsProvider: FC<PropsWithChildren<Props>> = ({ article, ch
29
29
 
30
30
  const notifyLoad = useCallback(() => {
31
31
  if (!registry) return;
32
- requestAnimationFrame(() => {
33
- setTimeout(() => {
34
- registry.notifyLoad();
35
- }, 0);
36
- });
32
+ registry.notifyLoad();
37
33
  }, [registry]);
38
34
 
39
35
  useEffect(() => {
40
- if (document.readyState === 'complete') {
41
- notifyLoad();
42
- } else {
43
- window.addEventListener('load', notifyLoad);
44
- }
45
-
46
- return () => window.removeEventListener('load', notifyLoad);
36
+ notifyLoad();
47
37
  }, [notifyLoad]);
48
38
 
49
39
  useEffect(() => {