@cntrl-site/sdk-nextjs 1.8.18-alpha.2 → 1.8.19
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/cntrl-site-sdk-nextjs-1.8.18.tgz +0 -0
- package/cntrl-site-sdk-nextjs-1.8.19.tgz +0 -0
- package/lib/components/items/FileItem/PlayIcon.js +8 -0
- package/lib/components/items/FileItem/VideoItem.js +59 -5
- package/lib/interactions/InteractionsRegistry.js +5 -111
- package/lib/interactions/ItemInteractionCtrl.js +1 -1
- package/lib/provider/InteractionsContext.js +0 -36
- package/package.json +2 -2
- package/src/components/ScrollPlaybackVideo.tsx +1 -1
- package/src/components/items/FileItem/PlayIcon.tsx +17 -0
- package/src/components/items/FileItem/VideoItem.tsx +62 -2
- package/src/interactions/InteractionsRegistry.ts +9 -106
- package/src/interactions/ItemInteractionCtrl.ts +3 -4
- package/src/interactions/types.ts +4 -4
- package/src/provider/InteractionsContext.tsx +1 -40
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlayIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const PlayIcon = ({ className, onClick }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("svg", { height: "32px", version: "1.1", viewBox: "0 0 32 32", width: "32px", className: className, onClick: onClick, children: (0, jsx_runtime_1.jsx)("g", { id: "play_x5F_alt", children: (0, jsx_runtime_1.jsx)("path", { fill: "#4E4E50", d: "M16,0C7.164,0,0,7.164,0,16s7.164,16,16,16s16-7.164,16-16S24.836,0,16,0z M10,24V8l16.008,8L10,24z " }) }) }));
|
|
7
|
+
};
|
|
8
|
+
exports.PlayIcon = PlayIcon;
|
|
@@ -20,6 +20,7 @@ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromIte
|
|
|
20
20
|
const useVideoFx_1 = require("../../../utils/effects/useVideoFx");
|
|
21
21
|
const useElementRect_1 = require("../../../utils/useElementRect");
|
|
22
22
|
const useItemFXData_1 = require("../../../common/useItemFXData");
|
|
23
|
+
const PlayIcon_1 = require("./PlayIcon");
|
|
23
24
|
const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
24
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
25
26
|
const id = (0, react_1.useId)();
|
|
@@ -30,6 +31,8 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
30
31
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
31
32
|
const videoRef = (0, react_1.useRef)(null);
|
|
32
33
|
const fxCanvas = (0, react_1.useRef)(null);
|
|
34
|
+
const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
|
|
35
|
+
const [isEventTriggered, setIsEventTriggered] = (0, react_1.useState)(false);
|
|
33
36
|
const { url, hasGLEffect } = item.commonParams;
|
|
34
37
|
const isInitialRef = (0, react_1.useRef)(true);
|
|
35
38
|
const area = layoutId ? item.area[layoutId] : null;
|
|
@@ -69,11 +72,45 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
69
72
|
(0, react_1.useEffect)(() => {
|
|
70
73
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
71
74
|
}, [isInteractive, onVisibilityChange]);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const playVideo = () => {
|
|
76
|
+
if (videoRef.current) {
|
|
77
|
+
videoRef.current.play();
|
|
78
|
+
setIsEventTriggered(true);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
(0, react_1.useEffect)(() => {
|
|
82
|
+
if (!isEventTriggered || !ref)
|
|
83
|
+
return;
|
|
84
|
+
const intersectionObserver = new IntersectionObserver((entries) => {
|
|
85
|
+
entries.forEach((entry) => {
|
|
86
|
+
if (!videoRef.current)
|
|
87
|
+
return;
|
|
88
|
+
if (entry.isIntersecting) {
|
|
89
|
+
videoRef.current.play();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
videoRef.current.pause();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
intersectionObserver.observe(ref);
|
|
97
|
+
return () => {
|
|
98
|
+
intersectionObserver.disconnect();
|
|
99
|
+
};
|
|
100
|
+
}, [isEventTriggered, ref]);
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_l = item.link) === null || _l === void 0 ? void 0 : _l.url, target: (_m = item.link) === null || _m === void 0 ? void 0 : _m.target, children: [(0, jsx_runtime_1.jsxs)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg) translateZ(0)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { transition: (_o = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _o !== void 0 ? _o : 'none' }), children: [!isPlaying && ((0, jsx_runtime_1.jsx)("div", { className: `play-btn-wrapper-${item.id}`, children: (0, jsx_runtime_1.jsx)(PlayIcon_1.PlayIcon, { className: `play-btn-${item.id}`, onClick: playVideo }) })), hasScrollPlayback
|
|
102
|
+
? ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.commonParams.url, playbackParams: scrollPlayback, style: inlineStyles, className: `video video-playback-wrapper video-${item.id}` }))
|
|
103
|
+
: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: hasGLEffect && isFXAllowed
|
|
104
|
+
? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `video-canvas video-${item.id}`, width: rectWidth, height: rectHeight }))
|
|
105
|
+
: ((0, jsx_runtime_1.jsx)("video", { poster: (_p = item.commonParams.coverUrl) !== null && _p !== void 0 ? _p : '', ref: videoRef, controls: true, onPlay: () => {
|
|
106
|
+
setIsPlaying(true);
|
|
107
|
+
console.log('play');
|
|
108
|
+
}, onPause: () => {
|
|
109
|
+
setIsPlaying(false);
|
|
110
|
+
console.log('pause');
|
|
111
|
+
}, onEnded: () => {
|
|
112
|
+
console.log('ended');
|
|
113
|
+
}, loop: true, playsInline: true, className: `video video-${item.id}`, style: inlineStyles, children: (0, jsx_runtime_1.jsx)("source", { src: item.commonParams.url }) })) }))] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
77
114
|
.video-wrapper-${item.id} {
|
|
78
115
|
position: absolute;
|
|
79
116
|
overflow: hidden;
|
|
@@ -82,6 +119,23 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
82
119
|
box-sizing: border-box;
|
|
83
120
|
opacity: ${opacity};
|
|
84
121
|
}
|
|
122
|
+
.play-btn-wrapper-${item.id} {
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: 0;
|
|
125
|
+
left: 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
display: flex;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
align-items: center;
|
|
130
|
+
height: 100%;
|
|
131
|
+
}
|
|
132
|
+
.play-btn-${item.id} {
|
|
133
|
+
width: 100px;
|
|
134
|
+
position: relative;
|
|
135
|
+
z-index: 1;
|
|
136
|
+
pointer-events: auto;
|
|
137
|
+
height: 100px;
|
|
138
|
+
}
|
|
85
139
|
.video {
|
|
86
140
|
width: 100%;
|
|
87
141
|
height: 100%;
|
|
@@ -29,6 +29,7 @@ class InteractionsRegistry {
|
|
|
29
29
|
}
|
|
30
30
|
return map;
|
|
31
31
|
}, {});
|
|
32
|
+
const itemStages = this.getDefaultItemStages();
|
|
32
33
|
const stateItemsIdsMap = activeStatesIds.reduce((map, stateId) => {
|
|
33
34
|
map[stateId] = this.items
|
|
34
35
|
.filter((item) => {
|
|
@@ -41,10 +42,9 @@ class InteractionsRegistry {
|
|
|
41
42
|
return map;
|
|
42
43
|
}, {});
|
|
43
44
|
this.interactions = interactions;
|
|
45
|
+
this.itemsStages = itemStages;
|
|
44
46
|
this.stateItemsIdsMap = stateItemsIdsMap;
|
|
45
47
|
this.interactionStateMap = interactionStateMap;
|
|
46
|
-
const itemStages = this.getDefaultItemStages();
|
|
47
|
-
this.itemsStages = itemStages;
|
|
48
48
|
}
|
|
49
49
|
register(itemId, ctrl) {
|
|
50
50
|
this.ctrls.set(itemId, ctrl);
|
|
@@ -93,8 +93,6 @@ class InteractionsRegistry {
|
|
|
93
93
|
for (const interaction of this.interactions) {
|
|
94
94
|
const { triggers } = interaction;
|
|
95
95
|
for (const trigger of triggers) {
|
|
96
|
-
if (!('itemId' in trigger))
|
|
97
|
-
continue;
|
|
98
96
|
if (trigger.itemId !== itemId)
|
|
99
97
|
continue;
|
|
100
98
|
if (activeStates.includes(trigger.from)) {
|
|
@@ -104,112 +102,12 @@ class InteractionsRegistry {
|
|
|
104
102
|
}
|
|
105
103
|
return available;
|
|
106
104
|
}
|
|
107
|
-
|
|
108
|
-
var _a, _b;
|
|
109
|
-
const timestamp = Date.now();
|
|
110
|
-
for (const interaction of this.interactions) {
|
|
111
|
-
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
112
|
-
const matchingTrigger = interaction.triggers.find(trigger => 'position' in trigger && trigger.position === 0 && trigger.from === currentStateId);
|
|
113
|
-
if (!matchingTrigger)
|
|
114
|
-
continue;
|
|
115
|
-
const activeStateId = this.getActiveInteractionState(interaction.id);
|
|
116
|
-
const isNewStateActive = matchingTrigger.to === activeStateId;
|
|
117
|
-
this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
|
|
118
|
-
const transitioningItems = (_a = this.stateItemsIdsMap[activeStateId]) !== null && _a !== void 0 ? _a : [];
|
|
119
|
-
const state = interaction.states.find((state) => state.id === matchingTrigger.to);
|
|
120
|
-
const actions = (_b = state === null || state === void 0 ? void 0 : state.actions) !== null && _b !== void 0 ? _b : [];
|
|
121
|
-
for (const action of actions) {
|
|
122
|
-
const ctrl = this.ctrls.get(action.itemId);
|
|
123
|
-
if (!ctrl)
|
|
124
|
-
continue;
|
|
125
|
-
ctrl.receiveAction(action.type);
|
|
126
|
-
}
|
|
127
|
-
this.itemsStages = this.itemsStages.map((stage) => {
|
|
128
|
-
if (stage.interactionId !== interaction.id)
|
|
129
|
-
return stage;
|
|
130
|
-
return {
|
|
131
|
-
itemId: stage.itemId,
|
|
132
|
-
interactionId: stage.interactionId,
|
|
133
|
-
type: 'transitioning',
|
|
134
|
-
from: stage.type === 'transitioning' ? stage.to : stage.stateId,
|
|
135
|
-
to: matchingTrigger.to,
|
|
136
|
-
direction: isNewStateActive ? 'in' : 'out',
|
|
137
|
-
updated: timestamp
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
const itemsToNotify = new Set(transitioningItems);
|
|
141
|
-
for (const trigger of interaction.triggers) {
|
|
142
|
-
if (!('itemId' in trigger))
|
|
143
|
-
continue;
|
|
144
|
-
itemsToNotify.add(trigger.itemId);
|
|
145
|
-
}
|
|
146
|
-
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
147
|
-
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
notifyScroll(position) {
|
|
151
|
-
var _a, _b, _c;
|
|
152
|
-
const timestamp = Date.now();
|
|
153
|
-
for (const interaction of this.interactions) {
|
|
154
|
-
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
155
|
-
const activeStateId = (_a = interaction.states.find((state) => state.id !== interaction.startStateId)) === null || _a === void 0 ? void 0 : _a.id;
|
|
156
|
-
const matchingTrigger = interaction.triggers.find((trigger) => {
|
|
157
|
-
if (!('position' in trigger) || trigger.position === 0)
|
|
158
|
-
return false;
|
|
159
|
-
const triggerPosition = trigger.position * window.innerWidth;
|
|
160
|
-
const isScrolledPastTrigger = triggerPosition < position;
|
|
161
|
-
if (!isScrolledPastTrigger && !trigger.isReverse)
|
|
162
|
-
return false;
|
|
163
|
-
const stateId = isScrolledPastTrigger ? trigger.from : trigger.to;
|
|
164
|
-
return stateId === currentStateId;
|
|
165
|
-
});
|
|
166
|
-
if (!matchingTrigger || !('position' in matchingTrigger) || !activeStateId)
|
|
167
|
-
continue;
|
|
168
|
-
const triggerPosition = matchingTrigger.position * window.innerWidth;
|
|
169
|
-
const isScrolledPastTrigger = triggerPosition < position;
|
|
170
|
-
const targetStateId = isScrolledPastTrigger ? matchingTrigger.to : matchingTrigger.from;
|
|
171
|
-
this.setCurrentStateForInteraction(interaction.id, targetStateId);
|
|
172
|
-
const transitioningItems = (_b = this.stateItemsIdsMap[activeStateId]) !== null && _b !== void 0 ? _b : [];
|
|
173
|
-
const state = interaction.states.find((state) => state.id === targetStateId);
|
|
174
|
-
const actions = (_c = state === null || state === void 0 ? void 0 : state.actions) !== null && _c !== void 0 ? _c : [];
|
|
175
|
-
for (const action of actions) {
|
|
176
|
-
const ctrl = this.ctrls.get(action.itemId);
|
|
177
|
-
if (!ctrl)
|
|
178
|
-
continue;
|
|
179
|
-
ctrl.receiveAction(action.type);
|
|
180
|
-
}
|
|
181
|
-
const itemsStages = this.itemsStages.map((stage) => {
|
|
182
|
-
if (stage.interactionId !== interaction.id)
|
|
183
|
-
return stage;
|
|
184
|
-
const newStage = {
|
|
185
|
-
itemId: stage.itemId,
|
|
186
|
-
interactionId: stage.interactionId,
|
|
187
|
-
type: 'transitioning',
|
|
188
|
-
from: stage.type === 'transitioning' ? stage.to : stage.stateId,
|
|
189
|
-
to: targetStateId,
|
|
190
|
-
direction: targetStateId === activeStateId ? 'in' : 'out',
|
|
191
|
-
updated: timestamp
|
|
192
|
-
};
|
|
193
|
-
return newStage;
|
|
194
|
-
});
|
|
195
|
-
this.itemsStages = itemsStages;
|
|
196
|
-
const itemsToNotify = new Set(transitioningItems);
|
|
197
|
-
for (const trigger of interaction.triggers) {
|
|
198
|
-
if (!('itemId' in trigger))
|
|
199
|
-
continue;
|
|
200
|
-
itemsToNotify.add(trigger.itemId);
|
|
201
|
-
}
|
|
202
|
-
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
203
|
-
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
notifyItemTrigger(itemId, triggerType) {
|
|
105
|
+
notifyTrigger(itemId, triggerType) {
|
|
207
106
|
var _a, _b;
|
|
208
107
|
const timestamp = Date.now();
|
|
209
108
|
for (const interaction of this.interactions) {
|
|
210
109
|
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
211
|
-
const matchingTrigger = interaction.triggers.find((trigger) =>
|
|
212
|
-
&& trigger.itemId === itemId
|
|
110
|
+
const matchingTrigger = interaction.triggers.find((trigger) => trigger.itemId === itemId
|
|
213
111
|
&& trigger.from === currentStateId
|
|
214
112
|
&& trigger.type === triggerType);
|
|
215
113
|
if (!matchingTrigger)
|
|
@@ -241,8 +139,6 @@ class InteractionsRegistry {
|
|
|
241
139
|
});
|
|
242
140
|
const itemsToNotify = new Set(transitioningItems);
|
|
243
141
|
for (const trigger of interaction.triggers) {
|
|
244
|
-
if (!('itemId' in trigger))
|
|
245
|
-
continue;
|
|
246
142
|
itemsToNotify.add(trigger.itemId);
|
|
247
143
|
}
|
|
248
144
|
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
@@ -327,7 +223,6 @@ class InteractionsRegistry {
|
|
|
327
223
|
return allItems;
|
|
328
224
|
}
|
|
329
225
|
getDefaultItemStages() {
|
|
330
|
-
var _a;
|
|
331
226
|
const timestamp = Date.now();
|
|
332
227
|
const { items } = this;
|
|
333
228
|
const stages = [];
|
|
@@ -344,8 +239,7 @@ class InteractionsRegistry {
|
|
|
344
239
|
interactionId,
|
|
345
240
|
type: 'active',
|
|
346
241
|
isStartState: true,
|
|
347
|
-
updated: timestamp
|
|
348
|
-
stateId: (_a = this.interactions.find((interaction) => interaction.id === interactionId)) === null || _a === void 0 ? void 0 : _a.startStateId
|
|
242
|
+
updated: timestamp
|
|
349
243
|
});
|
|
350
244
|
}
|
|
351
245
|
}
|
|
@@ -5,50 +5,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const InteractionsRegistry_1 = require("../interactions/InteractionsRegistry");
|
|
7
7
|
const useCurrentLayout_1 = require("../common/useCurrentLayout");
|
|
8
|
-
const ArticleRectContext_1 = require("./ArticleRectContext");
|
|
9
8
|
exports.InteractionsContext = (0, react_1.createContext)(undefined);
|
|
10
9
|
const InteractionsProvider = ({ article, children }) => {
|
|
11
10
|
const { layoutId } = (0, useCurrentLayout_1.useCurrentLayout)();
|
|
12
|
-
const articleRectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
|
|
13
11
|
const registry = (0, react_1.useMemo)(() => {
|
|
14
12
|
if (!layoutId)
|
|
15
13
|
return;
|
|
16
14
|
return new InteractionsRegistry_1.InteractionsRegistry(article, layoutId);
|
|
17
15
|
}, [layoutId]);
|
|
18
|
-
(0, react_1.useEffect)(() => {
|
|
19
|
-
if (!registry || !articleRectObserver)
|
|
20
|
-
return;
|
|
21
|
-
const handleScroll = () => {
|
|
22
|
-
const scrollY = window.scrollY;
|
|
23
|
-
registry.notifyScroll(scrollY);
|
|
24
|
-
};
|
|
25
|
-
return articleRectObserver.on('scroll', handleScroll);
|
|
26
|
-
}, [registry, articleRectObserver]);
|
|
27
|
-
const notifyLoad = (0, react_1.useCallback)(() => {
|
|
28
|
-
if (!registry)
|
|
29
|
-
return;
|
|
30
|
-
requestAnimationFrame(() => {
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
registry.notifyLoad();
|
|
33
|
-
}, 0);
|
|
34
|
-
});
|
|
35
|
-
}, [registry]);
|
|
36
|
-
(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);
|
|
44
|
-
}, [notifyLoad]);
|
|
45
|
-
(0, react_1.useEffect)(() => {
|
|
46
|
-
const log = () => {
|
|
47
|
-
console.log('load');
|
|
48
|
-
};
|
|
49
|
-
window.addEventListener('load', log);
|
|
50
|
-
return () => window.removeEventListener('load', log);
|
|
51
|
-
}, []);
|
|
52
16
|
return ((0, jsx_runtime_1.jsx)(exports.InteractionsContext.Provider, { value: registry, children: children }));
|
|
53
17
|
};
|
|
54
18
|
exports.InteractionsProvider = InteractionsProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntrl-site/sdk-nextjs",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.19",
|
|
4
4
|
"description": "SDK for Next.js",
|
|
5
5
|
"author": "arsen@momdesign.nyc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@antfu/eslint-config": "^3.8.0",
|
|
32
32
|
"@cntrl-site/color": "^1.0.0",
|
|
33
33
|
"@cntrl-site/effects": "^1.4.0",
|
|
34
|
-
"@cntrl-site/sdk": "^1.22.
|
|
34
|
+
"@cntrl-site/sdk": "^1.22.16",
|
|
35
35
|
"@types/vimeo__player": "^2.18.0",
|
|
36
36
|
"@vimeo/player": "^2.25.0",
|
|
37
37
|
"html-react-parser": "^3.0.1",
|
|
@@ -24,7 +24,7 @@ export const ScrollPlaybackVideo: FC<Props> = ({ sectionId, src, playbackParams,
|
|
|
24
24
|
const scrollPos = articleRectObserver.getSectionScroll(sectionId);
|
|
25
25
|
const time = rangeMap(scrollPos, playbackParams.from, playbackParams.to, 0, 1, true);
|
|
26
26
|
setTime(toFixed(time));
|
|
27
|
-
})
|
|
27
|
+
})
|
|
28
28
|
}, [playbackParams?.from, playbackParams?.to, time]);
|
|
29
29
|
|
|
30
30
|
const scrollVideoManager = useMemo<ScrollPlaybackVideoManager | null>(() => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
className?: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const PlayIcon: FC<Props> = ({ className, onClick }) => {
|
|
9
|
+
return (
|
|
10
|
+
<svg height="32px" version="1.1" viewBox="0 0 32 32" width="32px" className={className} onClick={onClick}>
|
|
11
|
+
<g id="play_x5F_alt">
|
|
12
|
+
<path fill="#4E4E50" d="M16,0C7.164,0,0,7.164,0,16s7.164,16,16,16s16-7.164,16-16S24.836,0,16,0z M10,24V8l16.008,8L10,24z " />
|
|
13
|
+
</g>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
@@ -14,6 +14,7 @@ import { getStyleFromItemStateAndParams } from '../../../utils/getStyleFromItemS
|
|
|
14
14
|
import { useVideoFx } from '../../../utils/effects/useVideoFx';
|
|
15
15
|
import { useElementRect } from '../../../utils/useElementRect';
|
|
16
16
|
import { useItemFXData } from '../../../common/useItemFXData';
|
|
17
|
+
import { PlayIcon } from './PlayIcon';
|
|
17
18
|
|
|
18
19
|
export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
19
20
|
const id = useId();
|
|
@@ -30,6 +31,8 @@ export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize
|
|
|
30
31
|
const [ref, setRef] = useState<HTMLDivElement | null>(null);
|
|
31
32
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
|
32
33
|
const fxCanvas = useRef<HTMLCanvasElement | null>(null);
|
|
34
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
35
|
+
const [isEventTriggered, setIsEventTriggered] = useState(false);
|
|
33
36
|
const { url, hasGLEffect } = item.commonParams;
|
|
34
37
|
const isInitialRef = useRef(true);
|
|
35
38
|
const area = layoutId ? item.area[layoutId] : null;
|
|
@@ -80,6 +83,31 @@ export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize
|
|
|
80
83
|
onVisibilityChange?.(isInteractive);
|
|
81
84
|
}, [isInteractive, onVisibilityChange]);
|
|
82
85
|
|
|
86
|
+
const playVideo = () => {
|
|
87
|
+
if (videoRef.current) {
|
|
88
|
+
videoRef.current.play();
|
|
89
|
+
setIsEventTriggered(true);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!isEventTriggered || !ref) return;
|
|
95
|
+
const intersectionObserver = new IntersectionObserver((entries) => {
|
|
96
|
+
entries.forEach((entry) => {
|
|
97
|
+
if (!videoRef.current) return;
|
|
98
|
+
if (entry.isIntersecting) {
|
|
99
|
+
videoRef.current.play();
|
|
100
|
+
} else {
|
|
101
|
+
videoRef.current.pause();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
intersectionObserver.observe(ref);
|
|
106
|
+
return () => {
|
|
107
|
+
intersectionObserver.disconnect();
|
|
108
|
+
};
|
|
109
|
+
}, [isEventTriggered, ref]);
|
|
110
|
+
|
|
83
111
|
return (
|
|
84
112
|
<LinkWrapper url={item.link?.url} target={item.link?.target}>
|
|
85
113
|
<div
|
|
@@ -92,6 +120,11 @@ export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize
|
|
|
92
120
|
transition: wrapperStateParams?.transition ?? 'none'
|
|
93
121
|
}}
|
|
94
122
|
>
|
|
123
|
+
{!isPlaying && (
|
|
124
|
+
<div className={`play-btn-wrapper-${item.id}`}>
|
|
125
|
+
<PlayIcon className={`play-btn-${item.id}`} onClick={playVideo} />
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
95
128
|
{hasScrollPlayback
|
|
96
129
|
? (
|
|
97
130
|
<ScrollPlaybackVideo
|
|
@@ -118,8 +151,18 @@ export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize
|
|
|
118
151
|
<video
|
|
119
152
|
poster={item.commonParams.coverUrl ?? ''}
|
|
120
153
|
ref={videoRef}
|
|
121
|
-
|
|
122
|
-
|
|
154
|
+
controls={true}
|
|
155
|
+
onPlay={() => {
|
|
156
|
+
setIsPlaying(true);
|
|
157
|
+
console.log('play');
|
|
158
|
+
}}
|
|
159
|
+
onPause={() => {
|
|
160
|
+
setIsPlaying(false);
|
|
161
|
+
console.log('pause');
|
|
162
|
+
}}
|
|
163
|
+
onEnded={() => {
|
|
164
|
+
console.log('ended');
|
|
165
|
+
}}
|
|
123
166
|
loop
|
|
124
167
|
playsInline
|
|
125
168
|
className={`video video-${item.id}`}
|
|
@@ -141,6 +184,23 @@ export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize
|
|
|
141
184
|
box-sizing: border-box;
|
|
142
185
|
opacity: ${opacity};
|
|
143
186
|
}
|
|
187
|
+
.play-btn-wrapper-${item.id} {
|
|
188
|
+
position: absolute;
|
|
189
|
+
top: 0;
|
|
190
|
+
left: 0;
|
|
191
|
+
width: 100%;
|
|
192
|
+
display: flex;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
align-items: center;
|
|
195
|
+
height: 100%;
|
|
196
|
+
}
|
|
197
|
+
.play-btn-${item.id} {
|
|
198
|
+
width: 100px;
|
|
199
|
+
position: relative;
|
|
200
|
+
z-index: 1;
|
|
201
|
+
pointer-events: auto;
|
|
202
|
+
height: 100px;
|
|
203
|
+
}
|
|
144
204
|
.video {
|
|
145
205
|
width: 100%;
|
|
146
206
|
height: 100%;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Article,
|
|
4
4
|
ArticleItemType,
|
|
5
5
|
Interaction,
|
|
6
|
-
|
|
6
|
+
InteractionTrigger,
|
|
7
7
|
ItemAny,
|
|
8
8
|
} from '@cntrl-site/sdk';
|
|
9
9
|
import { isItemType } from '../utils/isItemType';
|
|
@@ -39,6 +39,7 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
39
39
|
}
|
|
40
40
|
return map;
|
|
41
41
|
}, {});
|
|
42
|
+
const itemStages = this.getDefaultItemStages();
|
|
42
43
|
const stateItemsIdsMap = activeStatesIds.reduce<StateItemsIdsMap>((map, stateId) => {
|
|
43
44
|
map[stateId] = this.items
|
|
44
45
|
.filter((item) => {
|
|
@@ -50,10 +51,9 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
50
51
|
return map;
|
|
51
52
|
}, {});
|
|
52
53
|
this.interactions = interactions;
|
|
54
|
+
this.itemsStages = itemStages;
|
|
53
55
|
this.stateItemsIdsMap = stateItemsIdsMap;
|
|
54
56
|
this.interactionStateMap = interactionStateMap;
|
|
55
|
-
const itemStages = this.getDefaultItemStages();
|
|
56
|
-
this.itemsStages = itemStages;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
register(itemId: ItemId, ctrl: ItemInteractionCtrl) {
|
|
@@ -96,13 +96,12 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
96
96
|
return itemStyles;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
getItemAvailableTriggers(itemId: string): Set<
|
|
100
|
-
const available = new Set<
|
|
99
|
+
getItemAvailableTriggers(itemId: string): Set<InteractionTrigger['type']> {
|
|
100
|
+
const available = new Set<InteractionTrigger['type']>();
|
|
101
101
|
const activeStates = Object.values(this.interactionStateMap);
|
|
102
102
|
for (const interaction of this.interactions) {
|
|
103
103
|
const { triggers } = interaction;
|
|
104
104
|
for (const trigger of triggers) {
|
|
105
|
-
if (!('itemId' in trigger)) continue;
|
|
106
105
|
if (trigger.itemId !== itemId) continue;
|
|
107
106
|
if (activeStates.includes(trigger.from)) {
|
|
108
107
|
available.add(trigger.type);
|
|
@@ -112,106 +111,12 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
112
111
|
return available;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
const timestamp = Date.now();
|
|
117
|
-
for (const interaction of this.interactions) {
|
|
118
|
-
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
119
|
-
const matchingTrigger = interaction.triggers.find(trigger =>
|
|
120
|
-
'position' in trigger && trigger.position === 0 && trigger.from === currentStateId
|
|
121
|
-
);
|
|
122
|
-
if (!matchingTrigger) continue;
|
|
123
|
-
const activeStateId = this.getActiveInteractionState(interaction.id);
|
|
124
|
-
const isNewStateActive = matchingTrigger.to === activeStateId;
|
|
125
|
-
this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
|
|
126
|
-
const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
|
|
127
|
-
const state = interaction.states.find((state) => state.id === matchingTrigger.to);
|
|
128
|
-
const actions = state?.actions ?? [];
|
|
129
|
-
for (const action of actions) {
|
|
130
|
-
const ctrl = this.ctrls.get(action.itemId);
|
|
131
|
-
if (!ctrl) continue;
|
|
132
|
-
ctrl.receiveAction(action.type);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
this.itemsStages = this.itemsStages.map((stage) => {
|
|
136
|
-
if (stage.interactionId !== interaction.id) return stage;
|
|
137
|
-
return {
|
|
138
|
-
itemId: stage.itemId,
|
|
139
|
-
interactionId: stage.interactionId,
|
|
140
|
-
type: 'transitioning',
|
|
141
|
-
from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
|
|
142
|
-
to: matchingTrigger.to,
|
|
143
|
-
direction: isNewStateActive ? 'in' : 'out',
|
|
144
|
-
updated: timestamp
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const itemsToNotify = new Set<ItemId>(transitioningItems);
|
|
149
|
-
for (const trigger of interaction.triggers) {
|
|
150
|
-
if (!('itemId' in trigger)) continue;
|
|
151
|
-
itemsToNotify.add(trigger.itemId);
|
|
152
|
-
}
|
|
153
|
-
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
154
|
-
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
notifyScroll(position: number) {
|
|
159
|
-
const timestamp = Date.now();
|
|
160
|
-
for (const interaction of this.interactions) {
|
|
161
|
-
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
162
|
-
const activeStateId = interaction.states.find((state) => state.id !== interaction.startStateId)?.id;
|
|
163
|
-
const matchingTrigger = interaction.triggers.find((trigger) => {
|
|
164
|
-
if (!('position' in trigger) || trigger.position === 0) return false;
|
|
165
|
-
const triggerPosition = trigger.position * window.innerWidth;
|
|
166
|
-
const isScrolledPastTrigger = triggerPosition < position;
|
|
167
|
-
if (!isScrolledPastTrigger && !trigger.isReverse) return false;
|
|
168
|
-
const stateId = isScrolledPastTrigger ? trigger.from : trigger.to;
|
|
169
|
-
return stateId === currentStateId;
|
|
170
|
-
});
|
|
171
|
-
if (!matchingTrigger || !('position' in matchingTrigger) || !activeStateId) continue;
|
|
172
|
-
const triggerPosition = matchingTrigger.position * window.innerWidth;
|
|
173
|
-
const isScrolledPastTrigger = triggerPosition < position;
|
|
174
|
-
const targetStateId = isScrolledPastTrigger ? matchingTrigger.to : matchingTrigger.from;
|
|
175
|
-
this.setCurrentStateForInteraction(interaction.id, targetStateId);
|
|
176
|
-
const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
|
|
177
|
-
const state = interaction.states.find((state) => state.id === targetStateId);
|
|
178
|
-
const actions = state?.actions ?? [];
|
|
179
|
-
for (const action of actions) {
|
|
180
|
-
const ctrl = this.ctrls.get(action.itemId);
|
|
181
|
-
if (!ctrl) continue;
|
|
182
|
-
ctrl.receiveAction(action.type);
|
|
183
|
-
}
|
|
184
|
-
const itemsStages = this.itemsStages.map((stage) => {
|
|
185
|
-
if (stage.interactionId !== interaction.id) return stage;
|
|
186
|
-
const newStage = {
|
|
187
|
-
itemId: stage.itemId,
|
|
188
|
-
interactionId: stage.interactionId,
|
|
189
|
-
type: 'transitioning' as const,
|
|
190
|
-
from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
|
|
191
|
-
to: targetStateId,
|
|
192
|
-
direction: targetStateId === activeStateId ? 'in' as const : 'out' as const,
|
|
193
|
-
updated: timestamp
|
|
194
|
-
};
|
|
195
|
-
return newStage;
|
|
196
|
-
});
|
|
197
|
-
this.itemsStages = itemsStages;
|
|
198
|
-
const itemsToNotify = new Set<ItemId>(transitioningItems);
|
|
199
|
-
for (const trigger of interaction.triggers) {
|
|
200
|
-
if (!('itemId' in trigger)) continue;
|
|
201
|
-
itemsToNotify.add(trigger.itemId);
|
|
202
|
-
}
|
|
203
|
-
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
204
|
-
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
notifyItemTrigger(itemId: string, triggerType: TriggerType): void {
|
|
114
|
+
notifyTrigger(itemId: string, triggerType: TriggerType): void {
|
|
209
115
|
const timestamp = Date.now();
|
|
210
116
|
for (const interaction of this.interactions) {
|
|
211
117
|
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
212
118
|
const matchingTrigger = interaction.triggers.find((trigger) =>
|
|
213
|
-
|
|
214
|
-
&& trigger.itemId === itemId
|
|
119
|
+
trigger.itemId === itemId
|
|
215
120
|
&& trigger.from === currentStateId
|
|
216
121
|
&& trigger.type === triggerType
|
|
217
122
|
);
|
|
@@ -241,7 +146,6 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
241
146
|
});
|
|
242
147
|
const itemsToNotify = new Set<ItemId>(transitioningItems);
|
|
243
148
|
for (const trigger of interaction.triggers) {
|
|
244
|
-
if (!('itemId' in trigger)) continue;
|
|
245
149
|
itemsToNotify.add(trigger.itemId);
|
|
246
150
|
}
|
|
247
151
|
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
@@ -344,8 +248,7 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
344
248
|
interactionId,
|
|
345
249
|
type: 'active',
|
|
346
250
|
isStartState: true,
|
|
347
|
-
updated: timestamp
|
|
348
|
-
stateId: this.interactions.find((interaction) => interaction.id === interactionId)?.startStateId
|
|
251
|
+
updated: timestamp
|
|
349
252
|
});
|
|
350
253
|
}
|
|
351
254
|
}
|
|
@@ -366,7 +269,7 @@ type TransitioningStage = {
|
|
|
366
269
|
type ActiveStage = { type: 'active'; itemId: string; interactionId: string; stateId?: string; isStartState: boolean; updated: number; };
|
|
367
270
|
type InteractionStateMap = Record<InteractionId, StateId>;
|
|
368
271
|
type StateItemsIdsMap = Record<StateId, ItemId[]>;
|
|
369
|
-
type TriggerType =
|
|
272
|
+
type TriggerType = InteractionTrigger['type'];
|
|
370
273
|
type InteractionId = string;
|
|
371
274
|
type StateId = string;
|
|
372
275
|
type ItemId = string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { InteractionsRegistryPort, ItemInteractionCtrl } from './types';
|
|
2
2
|
import { getTransition } from './getTransition';
|
|
3
3
|
import { getStyleKeysFromCSSProperty } from './CSSPropertyNameMap';
|
|
4
|
-
import {
|
|
4
|
+
import { InteractionTrigger } from '@cntrl-site/sdk';
|
|
5
5
|
|
|
6
6
|
export class ItemInteractionController implements ItemInteractionCtrl {
|
|
7
7
|
private transitionsInProgress: Set<string> = new Set();
|
|
8
8
|
private actionReceiver: ((type: 'play' | 'pause') => void) | undefined;
|
|
9
|
-
|
|
10
9
|
constructor(
|
|
11
10
|
private itemId: string,
|
|
12
11
|
private registry: InteractionsRegistryPort,
|
|
@@ -30,13 +29,13 @@ export class ItemInteractionController implements ItemInteractionCtrl {
|
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
getHasTrigger(itemId: string, triggerType:
|
|
32
|
+
getHasTrigger(itemId: string, triggerType: InteractionTrigger['type']): boolean {
|
|
34
33
|
const triggers = this.registry.getItemAvailableTriggers(itemId);
|
|
35
34
|
return triggers.has(triggerType);
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
sendTrigger(type: 'click' | 'hover-in' | 'hover-out') {
|
|
39
|
-
this.registry.
|
|
38
|
+
this.registry.notifyTrigger(this.itemId, type);
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
receiveAction(type: 'play' | 'pause') {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ArticleItemType,
|
|
1
|
+
import { ArticleItemType, InteractionTrigger, ItemState } from '@cntrl-site/sdk';
|
|
2
2
|
|
|
3
3
|
export interface ItemInteractionCtrl {
|
|
4
4
|
getState(keys: string[]): StateCSSInfo;
|
|
5
|
-
getHasTrigger(itemId: string, triggerType:
|
|
5
|
+
getHasTrigger(itemId: string, triggerType: InteractionTrigger['type']): boolean;
|
|
6
6
|
sendTrigger(type: 'click' | 'hover-in' | 'hover-out'): void;
|
|
7
7
|
handleTransitionEnd?: (styleKey: string) => void;
|
|
8
8
|
handleTransitionStart?: (styleKeys: string[]) => void;
|
|
@@ -14,8 +14,8 @@ export interface ItemInteractionCtrl {
|
|
|
14
14
|
export interface InteractionsRegistryPort {
|
|
15
15
|
register(itemId: string, ctrl: ItemInteractionCtrl): void;
|
|
16
16
|
getStatePropsForItem(itemId: string): StateProps;
|
|
17
|
-
getItemAvailableTriggers(itemId: string): Set<
|
|
18
|
-
|
|
17
|
+
getItemAvailableTriggers(itemId: string): Set<InteractionTrigger['type']>;
|
|
18
|
+
notifyTrigger(itemId: string, type: TriggerType): void;
|
|
19
19
|
notifyTransitionEnd(itemId: string): void;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { createContext, FC, PropsWithChildren,
|
|
1
|
+
import { createContext, FC, PropsWithChildren, useContext, useMemo } from 'react';
|
|
2
2
|
import { InteractionsRegistry } from '../interactions/InteractionsRegistry';
|
|
3
3
|
import { Article } from '@cntrl-site/sdk';
|
|
4
4
|
import { useCurrentLayout } from '../common/useCurrentLayout';
|
|
5
|
-
import { ArticleRectContext } from './ArticleRectContext';
|
|
6
5
|
|
|
7
6
|
export const InteractionsContext = createContext<InteractionsRegistry | undefined>(undefined);
|
|
8
7
|
|
|
@@ -12,48 +11,10 @@ interface Props {
|
|
|
12
11
|
|
|
13
12
|
export const InteractionsProvider: FC<PropsWithChildren<Props>> = ({ article, children }) => {
|
|
14
13
|
const { layoutId } = useCurrentLayout();
|
|
15
|
-
const articleRectObserver = useContext(ArticleRectContext);
|
|
16
14
|
const registry = useMemo(() => {
|
|
17
15
|
if (!layoutId) return;
|
|
18
16
|
return new InteractionsRegistry(article, layoutId);
|
|
19
17
|
}, [layoutId]);
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!registry || !articleRectObserver) return;
|
|
23
|
-
const handleScroll = () => {
|
|
24
|
-
const scrollY = window.scrollY;
|
|
25
|
-
registry.notifyScroll(scrollY);
|
|
26
|
-
};
|
|
27
|
-
return articleRectObserver.on('scroll', handleScroll);
|
|
28
|
-
}, [registry, articleRectObserver]);
|
|
29
|
-
|
|
30
|
-
const notifyLoad = useCallback(() => {
|
|
31
|
-
if (!registry) return;
|
|
32
|
-
requestAnimationFrame(() => {
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
registry.notifyLoad();
|
|
35
|
-
}, 0);
|
|
36
|
-
});
|
|
37
|
-
}, [registry]);
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (document.readyState === 'complete') {
|
|
41
|
-
notifyLoad();
|
|
42
|
-
} else {
|
|
43
|
-
window.addEventListener('load', notifyLoad);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return () => window.removeEventListener('load', notifyLoad);
|
|
47
|
-
}, [notifyLoad]);
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
const log = () => {
|
|
51
|
-
console.log('load');
|
|
52
|
-
};
|
|
53
|
-
window.addEventListener('load', log);
|
|
54
|
-
return () => window.removeEventListener('load', log);
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
57
18
|
return (
|
|
58
19
|
<InteractionsContext.Provider value={registry}>
|
|
59
20
|
{children}
|