pds-dev-kit-web-test 2.7.610 → 2.7.612
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/dist/src/sub/DynamicLayout/DynamicLayout.js +3 -4
- package/dist/src/sub/DynamicLayout/components/EditModeSectionMatcher/EditModeSectionMatcher.js +1 -18
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useIntersectionObserver.js +0 -8
- package/package.json +2 -1
- package/dist/src/sub/DynamicLayout/IntersectionObserverContext.d.ts +0 -15
- package/dist/src/sub/DynamicLayout/IntersectionObserverContext.js +0 -96
|
@@ -24,7 +24,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
24
24
|
var EditModeSectionMatcher_1 = require("./components/EditModeSectionMatcher");
|
|
25
25
|
var SectionMatcher_1 = require("./components/SectionMatcher");
|
|
26
26
|
var dynamicLayoutContext_1 = require("./dynamicLayoutContext");
|
|
27
|
-
var IntersectionObserverContext_1 = require("./IntersectionObserverContext");
|
|
28
27
|
function DynamicLayout(_a) {
|
|
29
28
|
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents, shortcutKeyMode = _a.shortcutKeyMode, dynamicLayoutRef = _a.dynamicLayoutRef, zoomScale = _a.zoomScale, queryData = _a.queryData, placementRestriction = _a.placementRestriction;
|
|
30
29
|
var filteredSortedSection = __spreadArray([], sections, true).filter(function (section) {
|
|
@@ -44,7 +43,7 @@ function DynamicLayout(_a) {
|
|
|
44
43
|
.sort(function (a, b) { return a.order - b.order; });
|
|
45
44
|
var iframeSection = filteredSortedSection.find(function (section) { return section.manifest.schema === 'EXP_IFRAME' && section.display; });
|
|
46
45
|
var editorType = 'DYNAMIC_LAYOUT_EDITOR';
|
|
47
|
-
return ((0, jsx_runtime_1.
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(dynamicLayoutContext_1.dynamicLayoutContext.Provider, __assign({ value: {
|
|
48
47
|
device: device,
|
|
49
48
|
mode: mode,
|
|
50
49
|
isPreview: isPreview,
|
|
@@ -57,7 +56,7 @@ function DynamicLayout(_a) {
|
|
|
57
56
|
queryData: queryData,
|
|
58
57
|
placementRestriction: placementRestriction,
|
|
59
58
|
editorType: editorType
|
|
60
|
-
} }, { children:
|
|
61
|
-
|
|
59
|
+
} }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { dynamicLayoutRef: dynamicLayoutRef, editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection })), mode !== 'EDIT' &&
|
|
60
|
+
(iframeSection ? ((0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, iframeSection), iframeSection.id)) : (filteredSortedSection.map(function (section) { return (0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, section), section.id); })))] })));
|
|
62
61
|
}
|
|
63
62
|
exports.default = DynamicLayout;
|
package/dist/src/sub/DynamicLayout/components/EditModeSectionMatcher/EditModeSectionMatcher.js
CHANGED
|
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
29
29
|
var react_1 = require("react");
|
|
30
|
-
var dynamicLayoutContext_1 = require("../../../DynamicLayout/dynamicLayoutContext");
|
|
31
30
|
var sections_1 = require("../../../DynamicLayout/sections");
|
|
32
31
|
var SectionBox_1 = __importDefault(require("./SectionBox"));
|
|
33
32
|
function EditModeSectionMatcher(_a) {
|
|
@@ -53,25 +52,9 @@ function EditModeSectionMatcher(_a) {
|
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
54
|
}, [selectedSectionRef]);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: iframeSection ? ((0, jsx_runtime_1.jsx)(SectionBox_1.default, __assign({ isIframeSection: true, isEditing: editingSectionId === iframeSection.id, scrollIntoThisSection: iframeSection.id === scrollDownTargetSectionId, onClick: function () { return onClickEditSection(iframeSection); } }, { children: (0, jsx_runtime_1.jsx)(
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: iframeSection ? ((0, jsx_runtime_1.jsx)(SectionBox_1.default, __assign({ isIframeSection: true, isEditing: editingSectionId === iframeSection.id, scrollIntoThisSection: iframeSection.id === scrollDownTargetSectionId, onClick: function () { return onClickEditSection(iframeSection); } }, { children: (0, jsx_runtime_1.jsx)(DesignedSectionsMatcher, __assign({}, iframeSection)) }), iframeSection.id)) : (filteredSortedSection.map(function (section) { return ((0, jsx_runtime_1.jsx)(SectionBox_1.default, __assign({ isEditing: editingSectionId === section.id, scrollIntoThisSection: section.id === scrollDownTargetSectionId, onClick: function () { return onClickEditSection(section); } }, { children: section.type === 'CUSTOM' ? ((0, jsx_runtime_1.jsx)(sections_1.CustomSection, __assign({}, section, { ref: editingSectionId === section.id ? refCallback : null }))) : ((0, jsx_runtime_1.jsx)(DesignedSectionsMatcher, __assign({}, section))) }), section.id)); })) }));
|
|
57
56
|
}
|
|
58
57
|
exports.default = EditModeSectionMatcher;
|
|
59
|
-
function ContextWrapper(_a) {
|
|
60
|
-
var children = _a.children, isEditing = _a.isEditing;
|
|
61
|
-
var contextValue = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext);
|
|
62
|
-
if (isEditing) {
|
|
63
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
64
|
-
}
|
|
65
|
-
// Temporary performance test: Do not render non-editing sections
|
|
66
|
-
return null;
|
|
67
|
-
/*
|
|
68
|
-
return (
|
|
69
|
-
<dynamicLayoutContext.Provider value={{ ...contextValue, mode: 'PREVIEW' }}>
|
|
70
|
-
{children}
|
|
71
|
-
</dynamicLayoutContext.Provider>
|
|
72
|
-
);
|
|
73
|
-
*/
|
|
74
|
-
}
|
|
75
58
|
function DesignedSectionsMatcher(_a) {
|
|
76
59
|
var props = __rest(_a, []);
|
|
77
60
|
var schema = props.manifest.schema;
|
|
@@ -51,7 +51,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
-
var
|
|
54
|
+
var publ_echo_test_1 = require("publ-echo-test");
|
|
55
55
|
var group_1 = require("publ-echo/dist/lib/GridLayoutEditor/group");
|
|
56
56
|
var renderHelpers_1 = require("publ-echo/dist/lib/GridLayoutEditor/utils/renderHelpers");
|
|
57
57
|
var react_1 = __importStar(require("react"));
|
|
@@ -67,7 +67,7 @@ var clsx_1 = require("./newUtils/clsx");
|
|
|
67
67
|
var group_2 = require("./newUtils/group");
|
|
68
68
|
var util_1 = require("./util");
|
|
69
69
|
var parseSectionPadding_1 = __importDefault(require("./util/layoutPropParsers/parseSectionPadding"));
|
|
70
|
-
var Responsive = (0,
|
|
70
|
+
var Responsive = (0, publ_echo_test_1.WidthProvider)(publ_echo_test_1.ResponsiveGridEditor);
|
|
71
71
|
var GRID_CELL_MIN = 24;
|
|
72
72
|
var DESKTOP_GRID_COLS = 24;
|
|
73
73
|
var MOBILE_GRID_COLS = 8;
|
|
@@ -11,11 +11,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useIntersectionObserver = void 0;
|
|
13
13
|
var react_1 = require("react");
|
|
14
|
-
var IntersectionObserverContext_1 = require("../../../IntersectionObserverContext");
|
|
15
14
|
function useIntersectionObserver(elementRef, _a, deps) {
|
|
16
15
|
var _b = _a.threshold, threshold = _b === void 0 ? 0 : _b, _c = _a.root, root = _c === void 0 ? null : _c, _d = _a.rootMargin, rootMargin = _d === void 0 ? '0%' : _d, _e = _a.freezeOnceVisible, freezeOnceVisible = _e === void 0 ? false : _e;
|
|
17
16
|
var _f = (0, react_1.useState)(), entry = _f[0], setEntry = _f[1];
|
|
18
|
-
var context = (0, IntersectionObserverContext_1.useIntersectionObserverContext)();
|
|
19
17
|
var frozen = (entry === null || entry === void 0 ? void 0 : entry.isIntersecting) && freezeOnceVisible;
|
|
20
18
|
(0, react_1.useLayoutEffect)(function () {
|
|
21
19
|
var updateEntry = function (_a) {
|
|
@@ -28,12 +26,6 @@ function useIntersectionObserver(elementRef, _a, deps) {
|
|
|
28
26
|
return;
|
|
29
27
|
}
|
|
30
28
|
var observerParams = { threshold: threshold, root: root, rootMargin: rootMargin };
|
|
31
|
-
if (context) {
|
|
32
|
-
context.observe(node, updateEntry, observerParams);
|
|
33
|
-
return function () {
|
|
34
|
-
context.unobserve(node, observerParams);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
29
|
var observer = new IntersectionObserver(updateEntry, observerParams);
|
|
38
30
|
observer.observe(node);
|
|
39
31
|
return function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pds-dev-kit-web-test",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.612",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"lottie-react": "^2.3.1",
|
|
26
26
|
"nuka-carousel": "^4.8.4",
|
|
27
27
|
"publ-echo": "^0.0.133",
|
|
28
|
+
"publ-echo-test": "^0.0.400",
|
|
28
29
|
"react-hook-form": "^7.28.1",
|
|
29
30
|
"react-i18next": "^11.12.0",
|
|
30
31
|
"react-router-dom": "^5.2.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type ObservationOptions = {
|
|
3
|
-
root?: Element | Document | null;
|
|
4
|
-
rootMargin?: string;
|
|
5
|
-
threshold?: number | number[];
|
|
6
|
-
};
|
|
7
|
-
type IntersectionObserverContextType = {
|
|
8
|
-
observe: (element: Element, callback: IntersectionObserverCallback, options?: ObservationOptions) => void;
|
|
9
|
-
unobserve: (element: Element, options?: ObservationOptions) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare const useIntersectionObserverContext: () => IntersectionObserverContextType | null;
|
|
12
|
-
export declare function IntersectionObserverProvider({ children }: {
|
|
13
|
-
children: React.ReactNode;
|
|
14
|
-
}): JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.IntersectionObserverProvider = exports.useIntersectionObserverContext = void 0;
|
|
15
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
var react_1 = require("react");
|
|
17
|
-
var IntersectionObserverContext = (0, react_1.createContext)(null);
|
|
18
|
-
var useIntersectionObserverContext = function () { return (0, react_1.useContext)(IntersectionObserverContext); };
|
|
19
|
-
exports.useIntersectionObserverContext = useIntersectionObserverContext;
|
|
20
|
-
function IntersectionObserverProvider(_a) {
|
|
21
|
-
var children = _a.children;
|
|
22
|
-
// Map of options hash -> IntersectionObserver instance
|
|
23
|
-
var observers = (0, react_1.useRef)(new Map());
|
|
24
|
-
// Map of options hash -> Map of Element -> Callback
|
|
25
|
-
var callbacks = (0, react_1.useRef)(new Map());
|
|
26
|
-
var getOptionsHash = function (options) {
|
|
27
|
-
var _a = options || {}, _b = _a.root, root = _b === void 0 ? null : _b, _c = _a.rootMargin, rootMargin = _c === void 0 ? '0px' : _c, _d = _a.threshold, threshold = _d === void 0 ? 0 : _d;
|
|
28
|
-
// Note: 'root' element reference cannot be easily hashed if it's not null/window.
|
|
29
|
-
// Ideally we assume root is usually viewport (null). If root is an element, this simplistic hashing might fail if we have multiple roots.
|
|
30
|
-
// For this specific use case (DynamicLayout), root is usually viewport.
|
|
31
|
-
// If specific root handling is needed, we need a better way to map it.
|
|
32
|
-
// For now, let's treat root object as 'null' in hash if it is object, or use a WeakMap if strictness is needed.
|
|
33
|
-
// However, typical usage here is viewport.
|
|
34
|
-
return JSON.stringify({
|
|
35
|
-
root: root ? 'element' : 'null',
|
|
36
|
-
rootMargin: rootMargin,
|
|
37
|
-
threshold: threshold
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var observe = function (element, callback, options) {
|
|
41
|
-
var hash = getOptionsHash(options);
|
|
42
|
-
if (!observers.current.has(hash)) {
|
|
43
|
-
var observerCallback = function (entries, observer) {
|
|
44
|
-
var hashCallbacks = callbacks.current.get(hash);
|
|
45
|
-
if (!hashCallbacks)
|
|
46
|
-
return;
|
|
47
|
-
entries.forEach(function (entry) {
|
|
48
|
-
var cb = hashCallbacks.get(entry.target);
|
|
49
|
-
if (cb) {
|
|
50
|
-
cb([entry], observer);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
var newObserver = new IntersectionObserver(observerCallback, options);
|
|
55
|
-
observers.current.set(hash, newObserver);
|
|
56
|
-
callbacks.current.set(hash, new Map());
|
|
57
|
-
}
|
|
58
|
-
var observer = observers.current.get(hash);
|
|
59
|
-
var hashCallbacks = callbacks.current.get(hash);
|
|
60
|
-
if (!hashCallbacks.has(element)) {
|
|
61
|
-
hashCallbacks.set(element, callback);
|
|
62
|
-
observer.observe(element);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var unobserve = function (element, options) {
|
|
66
|
-
var hash = getOptionsHash(options);
|
|
67
|
-
var observer = observers.current.get(hash);
|
|
68
|
-
var hashCallbacks = callbacks.current.get(hash);
|
|
69
|
-
if (observer && hashCallbacks) {
|
|
70
|
-
if (hashCallbacks.has(element)) {
|
|
71
|
-
hashCallbacks.delete(element);
|
|
72
|
-
observer.unobserve(element);
|
|
73
|
-
}
|
|
74
|
-
// Optional: Cleanup observer if no elements
|
|
75
|
-
if (hashCallbacks.size === 0) {
|
|
76
|
-
observer.disconnect();
|
|
77
|
-
observers.current.delete(hash);
|
|
78
|
-
callbacks.current.delete(hash);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var value = (0, react_1.useMemo)(function () { return ({
|
|
83
|
-
observe: observe,
|
|
84
|
-
unobserve: unobserve
|
|
85
|
-
}); }, []);
|
|
86
|
-
(0, react_1.useEffect)(function () {
|
|
87
|
-
return function () {
|
|
88
|
-
// Cleanup all observers on unmount
|
|
89
|
-
observers.current.forEach(function (observer) { return observer.disconnect(); });
|
|
90
|
-
observers.current.clear();
|
|
91
|
-
callbacks.current.clear();
|
|
92
|
-
};
|
|
93
|
-
}, []);
|
|
94
|
-
return ((0, jsx_runtime_1.jsx)(IntersectionObserverContext.Provider, __assign({ value: value }, { children: children })));
|
|
95
|
-
}
|
|
96
|
-
exports.IntersectionObserverProvider = IntersectionObserverProvider;
|