@atlaskit/react-ufo 4.15.4 → 4.15.5
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.md +9 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +7 -0
- package/dist/cjs/vc/vc-observer-new/metric-calculator/vcnext/index.js +4 -1
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +290 -191
- package/dist/cjs/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +45 -2
- package/dist/cjs/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +15 -4
- package/dist/cjs/vc/vc-observer-new/viewport-observer/utils/is-zero-dimension-rectangle.js +9 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +5 -0
- package/dist/es2019/vc/vc-observer-new/metric-calculator/vcnext/index.js +4 -1
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +158 -81
- package/dist/es2019/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +33 -2
- package/dist/es2019/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +15 -4
- package/dist/es2019/vc/vc-observer-new/viewport-observer/utils/is-zero-dimension-rectangle.js +3 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +7 -0
- package/dist/esm/vc/vc-observer-new/metric-calculator/vcnext/index.js +4 -1
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +288 -189
- package/dist/esm/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +45 -2
- package/dist/esm/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +15 -4
- package/dist/esm/vc/vc-observer-new/viewport-observer/utils/is-zero-dimension-rectangle.js +3 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/types.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/viewport-observer/utils/is-zero-dimension-rectangle.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/utils/is-zero-dimension-rectangle.d.ts +1 -0
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.15.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`80ea06acdd0ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/80ea06acdd0ac) -
|
|
8
|
+
Add entrypoints framework detection for TTVC observer
|
|
9
|
+
- [`c4c9659ad7ccd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4c9659ad7ccd) -
|
|
10
|
+
refactor display:contents element detection
|
|
11
|
+
|
|
3
12
|
## 4.15.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -273,6 +273,13 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "validateReactComponentMatchToPlaceholderV4",
|
|
278
|
+
value: function validateReactComponentMatchToPlaceholderV4(el) {
|
|
279
|
+
el = this.findNearestPlaceholderContainerIfIgnored(el);
|
|
280
|
+
var id = this.getPlaceholderReplacementId(el);
|
|
281
|
+
return this.staticPlaceholders.has(id);
|
|
282
|
+
}
|
|
276
283
|
}, {
|
|
277
284
|
key: "hasSameSizePosition",
|
|
278
285
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
@@ -23,7 +23,10 @@ var getConsideredEntryTypes = function getConsideredEntryTypes() {
|
|
|
23
23
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_remove_ssr_placeholder_in_ttvc_v4')) {
|
|
24
24
|
consideredEntryTypes.push('mutation:ssr-placeholder');
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_detect_zero_dimension_rectangles')) {
|
|
27
|
+
consideredEntryTypes.push('mutation:display-contents-children-attribute');
|
|
28
|
+
}
|
|
29
|
+
return consideredEntryTypes;
|
|
27
30
|
};
|
|
28
31
|
var getExcludedEntryTypes = function getExcludedEntryTypes() {
|
|
29
32
|
var excludedEntryTypes = ['layout-shift:same-rect'];
|
|
@@ -19,7 +19,7 @@ var _rllPlaceholders = require("../../vc-observer/observers/rll-placeholders");
|
|
|
19
19
|
var _intersectionObserver = require("./intersection-observer");
|
|
20
20
|
var _mutationObserver = _interopRequireDefault(require("./mutation-observer"));
|
|
21
21
|
var _performanceObserver = _interopRequireDefault(require("./performance-observer"));
|
|
22
|
-
var
|
|
22
|
+
var _checkWithinComponent3 = _interopRequireWildcard(require("./utils/check-within-component"));
|
|
23
23
|
var _getMutatedElements = require("./utils/get-mutated-elements");
|
|
24
24
|
var _isElementVisible = require("./utils/is-element-visible");
|
|
25
25
|
var _isInVcIgnoreIfNoLayoutShiftMarker = _interopRequireDefault(require("./utils/is-in-vc-ignore-if-no-layout-shift-marker"));
|
|
@@ -50,21 +50,85 @@ var createElementMutationsWatcher = function createElementMutationsWatcher(remov
|
|
|
50
50
|
return 'mutation:element';
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
+
var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(removedNodeRects, isWithinThirdPartySegment, hasSameDeletedNode, timestamp, isTargetReactRoot, getSSRState, getSSRPlaceholderHandler) {
|
|
54
|
+
return function (_ref2) {
|
|
55
|
+
var target = _ref2.target,
|
|
56
|
+
rect = _ref2.rect;
|
|
57
|
+
if (getSSRState) {
|
|
58
|
+
var ssrState = getSSRState();
|
|
59
|
+
var SSRStateEnum = {
|
|
60
|
+
normal: 1,
|
|
61
|
+
waitingForFirstRender: 2,
|
|
62
|
+
ignoring: 3
|
|
63
|
+
};
|
|
64
|
+
if (ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && isTargetReactRoot) {
|
|
65
|
+
ssrState.state = SSRStateEnum.ignoring;
|
|
66
|
+
if (ssrState.renderStop === -1) {
|
|
67
|
+
// arbitrary 500ms DOM update window
|
|
68
|
+
ssrState.renderStop = timestamp + 500;
|
|
69
|
+
}
|
|
70
|
+
return 'ssr-hydration';
|
|
71
|
+
}
|
|
72
|
+
if (ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && isTargetReactRoot) {
|
|
73
|
+
if (timestamp <= ssrState.renderStop) {
|
|
74
|
+
return 'ssr-hydration';
|
|
75
|
+
} else {
|
|
76
|
+
ssrState.state = SSRStateEnum.normal;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (getSSRPlaceholderHandler) {
|
|
81
|
+
var ssrPlaceholderHandler = getSSRPlaceholderHandler();
|
|
82
|
+
if (ssrPlaceholderHandler) {
|
|
83
|
+
if ((ssrPlaceholderHandler.isPlaceholder(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(target)) {
|
|
84
|
+
return 'mutation:ssr-placeholder';
|
|
85
|
+
}
|
|
86
|
+
if ((ssrPlaceholderHandler.isPlaceholderReplacement(target) || ssrPlaceholderHandler.isPlaceholderIgnored(target)) && ssrPlaceholderHandler.validateReactComponentMatchToPlaceholderV4(target)) {
|
|
87
|
+
return 'mutation:ssr-placeholder';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (hasSameDeletedNode && (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(target)) {
|
|
92
|
+
return 'mutation:remount';
|
|
93
|
+
}
|
|
94
|
+
if ((0, _vcUtils.isContainedWithinMediaWrapper)(target)) {
|
|
95
|
+
return 'mutation:media';
|
|
96
|
+
}
|
|
97
|
+
if (isWithinThirdPartySegment) {
|
|
98
|
+
return 'mutation:third-party-element';
|
|
99
|
+
}
|
|
100
|
+
var isInIgnoreLsMarker = (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(target);
|
|
101
|
+
if (!isInIgnoreLsMarker) {
|
|
102
|
+
return 'mutation:element';
|
|
103
|
+
}
|
|
104
|
+
var isRLLPlaceholder = _rllPlaceholders.RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
|
|
105
|
+
if (isRLLPlaceholder && isInIgnoreLsMarker) {
|
|
106
|
+
return 'mutation:rll-placeholder';
|
|
107
|
+
}
|
|
108
|
+
var wasDeleted = removedNodeRects.some(function (nr) {
|
|
109
|
+
return (0, _isSameRectDimensions.isSameRectDimensions)(nr, rect);
|
|
110
|
+
});
|
|
111
|
+
if (wasDeleted && isInIgnoreLsMarker) {
|
|
112
|
+
return 'mutation:element-replacement';
|
|
113
|
+
}
|
|
114
|
+
return 'mutation:element';
|
|
115
|
+
};
|
|
116
|
+
};
|
|
53
117
|
var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
54
118
|
// SSR context functions
|
|
55
119
|
|
|
56
|
-
function ViewportObserver(
|
|
120
|
+
function ViewportObserver(_ref3) {
|
|
57
121
|
var _this = this;
|
|
58
|
-
var onChange =
|
|
59
|
-
getSSRState =
|
|
60
|
-
getSSRPlaceholderHandler =
|
|
122
|
+
var onChange = _ref3.onChange,
|
|
123
|
+
getSSRState = _ref3.getSSRState,
|
|
124
|
+
getSSRPlaceholderHandler = _ref3.getSSRPlaceholderHandler;
|
|
61
125
|
(0, _classCallCheck2.default)(this, ViewportObserver);
|
|
62
|
-
(0, _defineProperty2.default)(this, "handleIntersectionEntry", function (
|
|
63
|
-
var target =
|
|
64
|
-
rect =
|
|
65
|
-
time =
|
|
66
|
-
type =
|
|
67
|
-
mutationData =
|
|
126
|
+
(0, _defineProperty2.default)(this, "handleIntersectionEntry", function (_ref4) {
|
|
127
|
+
var target = _ref4.target,
|
|
128
|
+
rect = _ref4.rect,
|
|
129
|
+
time = _ref4.time,
|
|
130
|
+
type = _ref4.type,
|
|
131
|
+
mutationData = _ref4.mutationData;
|
|
68
132
|
if (!target) {
|
|
69
133
|
return;
|
|
70
134
|
}
|
|
@@ -82,12 +146,12 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
82
146
|
});
|
|
83
147
|
});
|
|
84
148
|
(0, _defineProperty2.default)(this, "handleChildListMutation", /*#__PURE__*/function () {
|
|
85
|
-
var
|
|
86
|
-
var target, addedNodes, removedNodes, timestamp, removedNodeRects, targetNode, _iterator, _step,
|
|
87
|
-
return _regenerator.default.wrap(function _callee$(
|
|
88
|
-
while (1) switch (
|
|
149
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref5) {
|
|
150
|
+
var target, addedNodes, removedNodes, timestamp, removedNodeRects, targetNode, _iterator, _step, _loop;
|
|
151
|
+
return _regenerator.default.wrap(function _callee$(_context3) {
|
|
152
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
89
153
|
case 0:
|
|
90
|
-
target =
|
|
154
|
+
target = _ref5.target, addedNodes = _ref5.addedNodes, removedNodes = _ref5.removedNodes, timestamp = _ref5.timestamp;
|
|
91
155
|
removedNodeRects = removedNodes.map(function (ref) {
|
|
92
156
|
var n = ref.deref();
|
|
93
157
|
if (!n) {
|
|
@@ -97,203 +161,238 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
97
161
|
});
|
|
98
162
|
targetNode = target.deref();
|
|
99
163
|
_iterator = _createForOfIteratorHelper(addedNodes);
|
|
100
|
-
|
|
101
|
-
_iterator.s();
|
|
102
|
-
case 6:
|
|
103
|
-
if ((_step = _iterator.n()).done) {
|
|
104
|
-
_context2.next = 32;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
addedNodeRef = _step.value;
|
|
108
|
-
addedNode = addedNodeRef.deref();
|
|
109
|
-
if (addedNode) {
|
|
110
|
-
_context2.next = 11;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
return _context2.abrupt("continue", 30);
|
|
114
|
-
case 11:
|
|
115
|
-
_iterator2 = _createForOfIteratorHelper((0, _getMutatedElements.getMutatedElements)(addedNode));
|
|
116
|
-
_context2.prev = 12;
|
|
164
|
+
_context3.prev = 4;
|
|
117
165
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
118
|
-
var
|
|
119
|
-
return _regenerator.default.wrap(function _loop$(
|
|
120
|
-
while (1) switch (
|
|
166
|
+
var addedNodeRef, addedNode, _this$getSSRState, _this$intersectionObs, hasSameDeletedNode, _checkWithinComponent, isWithinThirdPartySegment, isTargetReactRoot, _iterator2, _step2, _loop2, _ret;
|
|
167
|
+
return _regenerator.default.wrap(function _loop$(_context2) {
|
|
168
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
121
169
|
case 0:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
ssrState = _this.getSSRState();
|
|
128
|
-
SSRStateEnum = {
|
|
129
|
-
normal: 1,
|
|
130
|
-
waitingForFirstRender: 2,
|
|
131
|
-
ignoring: 3
|
|
132
|
-
};
|
|
133
|
-
if (!(ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
134
|
-
_context.next = 9;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
ssrState.state = SSRStateEnum.ignoring;
|
|
138
|
-
if (ssrState.renderStop === -1) {
|
|
139
|
-
// arbitrary 500ms DOM update window
|
|
140
|
-
ssrState.renderStop = timestamp + 500;
|
|
141
|
-
}
|
|
142
|
-
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(element, 'ssr-hydration');
|
|
143
|
-
return _context.abrupt("return", 0);
|
|
144
|
-
case 9:
|
|
145
|
-
if (!(ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
146
|
-
_context.next = 16;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
if (!(timestamp <= ssrState.renderStop)) {
|
|
150
|
-
_context.next = 15;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
|
|
154
|
-
return _context.abrupt("return", 0);
|
|
155
|
-
case 15:
|
|
156
|
-
ssrState.state = SSRStateEnum.normal;
|
|
157
|
-
case 16:
|
|
158
|
-
if (!_this.getSSRPlaceholderHandler) {
|
|
159
|
-
_context.next = 30;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
ssrPlaceholderHandler = _this.getSSRPlaceholderHandler();
|
|
163
|
-
if (!ssrPlaceholderHandler) {
|
|
164
|
-
_context.next = 30;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
if (!(ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
168
|
-
_context.next = 23;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
|
|
172
|
-
_context.next = 23;
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
(_this$intersectionObs3 = _this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
176
|
-
return _context.abrupt("return", 0);
|
|
177
|
-
case 23:
|
|
178
|
-
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
179
|
-
_context.next = 30;
|
|
170
|
+
addedNodeRef = _step.value;
|
|
171
|
+
addedNode = addedNodeRef.deref();
|
|
172
|
+
if (addedNode) {
|
|
173
|
+
_context2.next = 4;
|
|
180
174
|
break;
|
|
181
175
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (!(result !== false)) {
|
|
187
|
-
_context.next = 30;
|
|
176
|
+
return _context2.abrupt("return", 1);
|
|
177
|
+
case 4:
|
|
178
|
+
if (!(0, _platformFeatureFlags.fg)('platform_ufo_detect_zero_dimension_rectangles')) {
|
|
179
|
+
_context2.next = 11;
|
|
188
180
|
break;
|
|
189
181
|
}
|
|
190
|
-
|
|
191
|
-
return _context.abrupt("return", 0);
|
|
192
|
-
case 30:
|
|
193
|
-
sameDeletedNode = removedNodes.find(function (ref) {
|
|
182
|
+
hasSameDeletedNode = removedNodes.find(function (ref) {
|
|
194
183
|
var n = ref.deref();
|
|
195
|
-
if (!n || !
|
|
184
|
+
if (!n || !addedNode) {
|
|
196
185
|
return false;
|
|
197
186
|
}
|
|
198
|
-
return n.isEqualNode(
|
|
187
|
+
return n.isEqualNode(addedNode);
|
|
199
188
|
});
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
189
|
+
_checkWithinComponent = (0, _checkWithinComponent3.default)(addedNode, 'UFOThirdPartySegment', _this.mapIs3pResult), isWithinThirdPartySegment = _checkWithinComponent.isWithin;
|
|
190
|
+
isTargetReactRoot = targetNode === ((_this$getSSRState = _this.getSSRState) === null || _this$getSSRState === void 0 || (_this$getSSRState = _this$getSSRState.call(_this)) === null || _this$getSSRState === void 0 ? void 0 : _this$getSSRState.reactRootElement);
|
|
191
|
+
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode, createElementMutationsWatcherV4(removedNodeRects, isWithinThirdPartySegment, !!hasSameDeletedNode, timestamp, isTargetReactRoot, _this.getSSRState, _this.getSSRPlaceholderHandler));
|
|
192
|
+
_context2.next = 30;
|
|
193
|
+
break;
|
|
194
|
+
case 11:
|
|
195
|
+
_iterator2 = _createForOfIteratorHelper((0, _getMutatedElements.getMutatedElements)(addedNode));
|
|
196
|
+
_context2.prev = 12;
|
|
197
|
+
_loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
|
|
198
|
+
var _step2$value, isDisplayContentsElementChildren, element, ssrState, SSRStateEnum, _this$intersectionObs2, _this$intersectionObs3, ssrPlaceholderHandler, _this$intersectionObs4, result, _this$intersectionObs5, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs6, _this$intersectionObs7, _ref7, isWithinThirdPartySegment, _this$intersectionObs8, _this$intersectionObs9, _this$intersectionObs0;
|
|
199
|
+
return _regenerator.default.wrap(function _loop2$(_context) {
|
|
200
|
+
while (1) switch (_context.prev = _context.next) {
|
|
201
|
+
case 0:
|
|
202
|
+
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
203
|
+
if (!_this.getSSRState) {
|
|
204
|
+
_context.next = 16;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
ssrState = _this.getSSRState();
|
|
208
|
+
SSRStateEnum = {
|
|
209
|
+
normal: 1,
|
|
210
|
+
waitingForFirstRender: 2,
|
|
211
|
+
ignoring: 3
|
|
212
|
+
};
|
|
213
|
+
if (!(ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
214
|
+
_context.next = 9;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
ssrState.state = SSRStateEnum.ignoring;
|
|
218
|
+
if (ssrState.renderStop === -1) {
|
|
219
|
+
// arbitrary 500ms DOM update window
|
|
220
|
+
ssrState.renderStop = timestamp + 500;
|
|
221
|
+
}
|
|
222
|
+
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
|
|
223
|
+
return _context.abrupt("return", 0);
|
|
224
|
+
case 9:
|
|
225
|
+
if (!(ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
226
|
+
_context.next = 16;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (!(timestamp <= ssrState.renderStop)) {
|
|
230
|
+
_context.next = 15;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
(_this$intersectionObs3 = _this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.watchAndTag(element, 'ssr-hydration');
|
|
234
|
+
return _context.abrupt("return", 0);
|
|
235
|
+
case 15:
|
|
236
|
+
ssrState.state = SSRStateEnum.normal;
|
|
237
|
+
case 16:
|
|
238
|
+
if (!_this.getSSRPlaceholderHandler) {
|
|
239
|
+
_context.next = 30;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
ssrPlaceholderHandler = _this.getSSRPlaceholderHandler();
|
|
243
|
+
if (!ssrPlaceholderHandler) {
|
|
244
|
+
_context.next = 30;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
if (!(ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
248
|
+
_context.next = 23;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
|
|
252
|
+
_context.next = 23;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
(_this$intersectionObs4 = _this.intersectionObserver) === null || _this$intersectionObs4 === void 0 || _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
256
|
+
return _context.abrupt("return", 0);
|
|
257
|
+
case 23:
|
|
258
|
+
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
259
|
+
_context.next = 30;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
_context.next = 26;
|
|
263
|
+
return ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
|
|
264
|
+
case 26:
|
|
265
|
+
result = _context.sent;
|
|
266
|
+
if (!(result !== false)) {
|
|
267
|
+
_context.next = 30;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
(_this$intersectionObs5 = _this.intersectionObserver) === null || _this$intersectionObs5 === void 0 || _this$intersectionObs5.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
271
|
+
return _context.abrupt("return", 0);
|
|
272
|
+
case 30:
|
|
273
|
+
sameDeletedNode = removedNodes.find(function (ref) {
|
|
274
|
+
var n = ref.deref();
|
|
275
|
+
if (!n || !element) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
return n.isEqualNode(element);
|
|
279
|
+
});
|
|
280
|
+
isInIgnoreLsMarker = element instanceof HTMLElement ? (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(element) : false;
|
|
281
|
+
if (!(sameDeletedNode && isInIgnoreLsMarker)) {
|
|
282
|
+
_context.next = 35;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
(_this$intersectionObs6 = _this.intersectionObserver) === null || _this$intersectionObs6 === void 0 || _this$intersectionObs6.watchAndTag(element, 'mutation:remount');
|
|
286
|
+
return _context.abrupt("return", 0);
|
|
287
|
+
case 35:
|
|
288
|
+
if (!(0, _vcUtils.isContainedWithinMediaWrapper)(element)) {
|
|
289
|
+
_context.next = 38;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
(_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(element, 'mutation:media');
|
|
293
|
+
return _context.abrupt("return", 0);
|
|
294
|
+
case 38:
|
|
295
|
+
_ref7 = element instanceof HTMLElement ? (0, _checkWithinComponent3.default)(element, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
296
|
+
isWithin: false
|
|
297
|
+
}, isWithinThirdPartySegment = _ref7.isWithin;
|
|
298
|
+
if (!isWithinThirdPartySegment) {
|
|
299
|
+
_context.next = 42;
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:third-party-element');
|
|
303
|
+
return _context.abrupt("return", 0);
|
|
304
|
+
case 42:
|
|
305
|
+
if (isDisplayContentsElementChildren) {
|
|
306
|
+
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
307
|
+
} else {
|
|
308
|
+
(_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
309
|
+
}
|
|
310
|
+
case 43:
|
|
311
|
+
case "end":
|
|
312
|
+
return _context.stop();
|
|
313
|
+
}
|
|
314
|
+
}, _loop2);
|
|
315
|
+
});
|
|
316
|
+
_iterator2.s();
|
|
317
|
+
case 15:
|
|
318
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
319
|
+
_context2.next = 22;
|
|
210
320
|
break;
|
|
211
321
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}, isWithinThirdPartySegment = _ref6.isWithin;
|
|
218
|
-
if (!isWithinThirdPartySegment) {
|
|
219
|
-
_context.next = 42;
|
|
322
|
+
return _context2.delegateYield(_loop2(), "t0", 17);
|
|
323
|
+
case 17:
|
|
324
|
+
_ret = _context2.t0;
|
|
325
|
+
if (!(_ret === 0)) {
|
|
326
|
+
_context2.next = 20;
|
|
220
327
|
break;
|
|
221
328
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
329
|
+
return _context2.abrupt("continue", 20);
|
|
330
|
+
case 20:
|
|
331
|
+
_context2.next = 15;
|
|
332
|
+
break;
|
|
333
|
+
case 22:
|
|
334
|
+
_context2.next = 27;
|
|
335
|
+
break;
|
|
336
|
+
case 24:
|
|
337
|
+
_context2.prev = 24;
|
|
338
|
+
_context2.t1 = _context2["catch"](12);
|
|
339
|
+
_iterator2.e(_context2.t1);
|
|
340
|
+
case 27:
|
|
341
|
+
_context2.prev = 27;
|
|
342
|
+
_iterator2.f();
|
|
343
|
+
return _context2.finish(27);
|
|
344
|
+
case 30:
|
|
231
345
|
case "end":
|
|
232
|
-
return
|
|
346
|
+
return _context2.stop();
|
|
233
347
|
}
|
|
234
|
-
}, _loop);
|
|
348
|
+
}, _loop, null, [[12, 24, 27, 30]]);
|
|
235
349
|
});
|
|
236
|
-
|
|
237
|
-
case
|
|
238
|
-
if ((
|
|
239
|
-
|
|
350
|
+
_iterator.s();
|
|
351
|
+
case 7:
|
|
352
|
+
if ((_step = _iterator.n()).done) {
|
|
353
|
+
_context3.next = 13;
|
|
240
354
|
break;
|
|
241
355
|
}
|
|
242
|
-
return
|
|
243
|
-
case
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
_context2.next = 20;
|
|
356
|
+
return _context3.delegateYield(_loop(), "t0", 9);
|
|
357
|
+
case 9:
|
|
358
|
+
if (!_context3.t0) {
|
|
359
|
+
_context3.next = 11;
|
|
247
360
|
break;
|
|
248
361
|
}
|
|
249
|
-
return
|
|
250
|
-
case
|
|
251
|
-
|
|
252
|
-
break;
|
|
253
|
-
case 22:
|
|
254
|
-
_context2.next = 27;
|
|
255
|
-
break;
|
|
256
|
-
case 24:
|
|
257
|
-
_context2.prev = 24;
|
|
258
|
-
_context2.t1 = _context2["catch"](12);
|
|
259
|
-
_iterator2.e(_context2.t1);
|
|
260
|
-
case 27:
|
|
261
|
-
_context2.prev = 27;
|
|
262
|
-
_iterator2.f();
|
|
263
|
-
return _context2.finish(27);
|
|
264
|
-
case 30:
|
|
265
|
-
_context2.next = 6;
|
|
362
|
+
return _context3.abrupt("continue", 11);
|
|
363
|
+
case 11:
|
|
364
|
+
_context3.next = 7;
|
|
266
365
|
break;
|
|
267
|
-
case
|
|
268
|
-
|
|
366
|
+
case 13:
|
|
367
|
+
_context3.next = 18;
|
|
269
368
|
break;
|
|
270
|
-
case
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
_iterator.e(
|
|
274
|
-
case
|
|
275
|
-
|
|
369
|
+
case 15:
|
|
370
|
+
_context3.prev = 15;
|
|
371
|
+
_context3.t1 = _context3["catch"](4);
|
|
372
|
+
_iterator.e(_context3.t1);
|
|
373
|
+
case 18:
|
|
374
|
+
_context3.prev = 18;
|
|
276
375
|
_iterator.f();
|
|
277
|
-
return
|
|
278
|
-
case
|
|
376
|
+
return _context3.finish(18);
|
|
377
|
+
case 21:
|
|
279
378
|
case "end":
|
|
280
|
-
return
|
|
379
|
+
return _context3.stop();
|
|
281
380
|
}
|
|
282
|
-
}, _callee, null, [[4,
|
|
381
|
+
}, _callee, null, [[4, 15, 18, 21]]);
|
|
283
382
|
}));
|
|
284
383
|
return function (_x) {
|
|
285
|
-
return
|
|
384
|
+
return _ref6.apply(this, arguments);
|
|
286
385
|
};
|
|
287
386
|
}());
|
|
288
|
-
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (
|
|
289
|
-
var _this$
|
|
290
|
-
var target =
|
|
291
|
-
attributeName =
|
|
292
|
-
oldValue =
|
|
293
|
-
newValue =
|
|
294
|
-
(_this$
|
|
295
|
-
var target =
|
|
296
|
-
rect =
|
|
387
|
+
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (_ref8) {
|
|
388
|
+
var _this$intersectionObs1;
|
|
389
|
+
var target = _ref8.target,
|
|
390
|
+
attributeName = _ref8.attributeName,
|
|
391
|
+
oldValue = _ref8.oldValue,
|
|
392
|
+
newValue = _ref8.newValue;
|
|
393
|
+
(_this$intersectionObs1 = _this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.watchAndTag(target, function (_ref9) {
|
|
394
|
+
var target = _ref9.target,
|
|
395
|
+
rect = _ref9.rect;
|
|
297
396
|
if ((0, _vcUtils.isContainedWithinMediaWrapper)(target)) {
|
|
298
397
|
return {
|
|
299
398
|
type: 'mutation:media',
|
|
@@ -305,8 +404,8 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
305
404
|
};
|
|
306
405
|
}
|
|
307
406
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_attribute_changes')) {
|
|
308
|
-
var
|
|
309
|
-
isWithinThirdPartySegment =
|
|
407
|
+
var _checkWithinComponent2 = (0, _checkWithinComponent3.default)(target, 'UFOThirdPartySegment', _this.mapIs3pResult),
|
|
408
|
+
isWithinThirdPartySegment = _checkWithinComponent2.isWithin;
|
|
310
409
|
if (isWithinThirdPartySegment) {
|
|
311
410
|
return {
|
|
312
411
|
type: 'mutation:third-party-attribute',
|
|
@@ -379,9 +478,9 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
379
478
|
};
|
|
380
479
|
});
|
|
381
480
|
});
|
|
382
|
-
(0, _defineProperty2.default)(this, "handleLayoutShift", function (
|
|
383
|
-
var time =
|
|
384
|
-
changedRects =
|
|
481
|
+
(0, _defineProperty2.default)(this, "handleLayoutShift", function (_ref0) {
|
|
482
|
+
var time = _ref0.time,
|
|
483
|
+
changedRects = _ref0.changedRects;
|
|
385
484
|
var _iterator3 = _createForOfIteratorHelper(changedRects),
|
|
386
485
|
_step3;
|
|
387
486
|
try {
|
|
@@ -460,16 +559,16 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
460
559
|
}, {
|
|
461
560
|
key: "stop",
|
|
462
561
|
value: function stop() {
|
|
463
|
-
var _this$mutationObserve2, _this$
|
|
562
|
+
var _this$mutationObserve2, _this$intersectionObs10, _this$performanceObse2;
|
|
464
563
|
if (!this.isStarted) {
|
|
465
564
|
return;
|
|
466
565
|
}
|
|
467
566
|
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
|
|
468
|
-
(_this$
|
|
567
|
+
(_this$intersectionObs10 = this.intersectionObserver) === null || _this$intersectionObs10 === void 0 || _this$intersectionObs10.disconnect();
|
|
469
568
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
470
569
|
this.isStarted = false;
|
|
471
570
|
// Clean up caches when stopping
|
|
472
|
-
(0,
|
|
571
|
+
(0, _checkWithinComponent3.cleanupCaches)(this.mapIs3pResult);
|
|
473
572
|
}
|
|
474
573
|
}]);
|
|
475
574
|
}();
|