@atlaskit/react-ufo 4.14.0 → 4.14.1
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 +7 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +27 -33
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +2 -12
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +131 -273
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +27 -33
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +2 -13
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +39 -132
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +27 -33
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +2 -13
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +129 -271
- package/package.json +1 -7
|
@@ -18,7 +18,7 @@ var _rllPlaceholders = require("../../vc-observer/observers/rll-placeholders");
|
|
|
18
18
|
var _intersectionObserver = require("./intersection-observer");
|
|
19
19
|
var _mutationObserver = _interopRequireDefault(require("./mutation-observer"));
|
|
20
20
|
var _performanceObserver = _interopRequireDefault(require("./performance-observer"));
|
|
21
|
-
var
|
|
21
|
+
var _checkWithinComponent2 = _interopRequireWildcard(require("./utils/check-within-component"));
|
|
22
22
|
var _getMutatedElements = require("./utils/get-mutated-elements");
|
|
23
23
|
var _isElementVisible = require("./utils/is-element-visible");
|
|
24
24
|
var _isInVcIgnoreIfNoLayoutShiftMarker = _interopRequireDefault(require("./utils/is-in-vc-ignore-if-no-layout-shift-marker"));
|
|
@@ -82,9 +82,9 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
82
82
|
});
|
|
83
83
|
(0, _defineProperty2.default)(this, "handleChildListMutation", /*#__PURE__*/function () {
|
|
84
84
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref4) {
|
|
85
|
-
var target, addedNodes, removedNodes, timestamp, removedNodeRects, targetNode, _iterator, _step, _loop, _ret;
|
|
86
|
-
return _regenerator.default.wrap(function _callee$(
|
|
87
|
-
while (1) switch (
|
|
85
|
+
var target, addedNodes, removedNodes, timestamp, removedNodeRects, targetNode, _iterator, _step, addedNodeRef, addedNode, _iterator2, _step2, _loop, _ret;
|
|
86
|
+
return _regenerator.default.wrap(function _callee$(_context2) {
|
|
87
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
88
88
|
case 0:
|
|
89
89
|
target = _ref4.target, addedNodes = _ref4.addedNodes, removedNodes = _ref4.removedNodes, timestamp = _ref4.timestamp;
|
|
90
90
|
removedNodeRects = removedNodes.map(function (ref) {
|
|
@@ -96,179 +96,31 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
96
96
|
});
|
|
97
97
|
targetNode = target.deref();
|
|
98
98
|
_iterator = _createForOfIteratorHelper(addedNodes);
|
|
99
|
-
|
|
99
|
+
_context2.prev = 4;
|
|
100
|
+
_iterator.s();
|
|
101
|
+
case 6:
|
|
102
|
+
if ((_step = _iterator.n()).done) {
|
|
103
|
+
_context2.next = 32;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
addedNodeRef = _step.value;
|
|
107
|
+
addedNode = addedNodeRef.deref();
|
|
108
|
+
if (addedNode) {
|
|
109
|
+
_context2.next = 11;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return _context2.abrupt("continue", 30);
|
|
113
|
+
case 11:
|
|
114
|
+
_iterator2 = _createForOfIteratorHelper((0, _getMutatedElements.getMutatedElements)(addedNode));
|
|
115
|
+
_context2.prev = 12;
|
|
100
116
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
101
|
-
var
|
|
102
|
-
return _regenerator.default.wrap(function _loop$(
|
|
103
|
-
while (1) switch (
|
|
117
|
+
var _step2$value, isDisplayContentsElementChildren, element, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _ref6, isWithinThirdPartySegment, _this$intersectionObs7, _this$intersectionObs8, _this$intersectionObs9;
|
|
118
|
+
return _regenerator.default.wrap(function _loop$(_context) {
|
|
119
|
+
while (1) switch (_context.prev = _context.next) {
|
|
104
120
|
case 0:
|
|
105
|
-
|
|
106
|
-
addedNode = addedNodeRef.deref();
|
|
107
|
-
if (addedNode) {
|
|
108
|
-
_context2.next = 4;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
return _context2.abrupt("return", 0);
|
|
112
|
-
case 4:
|
|
113
|
-
if (!(0, _platformFeatureFlags.fg)('platform_ufo_ssr_placeholders_for_display_contents')) {
|
|
114
|
-
_context2.next = 26;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
_iterator2 = _createForOfIteratorHelper((0, _getMutatedElements.getMutatedElements)(addedNode));
|
|
118
|
-
_context2.prev = 6;
|
|
119
|
-
_loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
|
|
120
|
-
var _step2$value, isDisplayContentsElementChildren, element, ssrState, SSRStateEnum, _this$intersectionObs, _this$intersectionObs2, ssrPlaceholderHandler, _this$intersectionObs3, result, _this$intersectionObs4, sameDeletedNode, isInIgnoreLsMarker, _this$intersectionObs5, _this$intersectionObs6, _ref6, isWithinThirdPartySegment, _this$intersectionObs7, _this$intersectionObs8, _this$intersectionObs9;
|
|
121
|
-
return _regenerator.default.wrap(function _loop2$(_context) {
|
|
122
|
-
while (1) switch (_context.prev = _context.next) {
|
|
123
|
-
case 0:
|
|
124
|
-
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
125
|
-
if (!_this.getSSRState) {
|
|
126
|
-
_context.next = 16;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
ssrState = _this.getSSRState();
|
|
130
|
-
SSRStateEnum = {
|
|
131
|
-
normal: 1,
|
|
132
|
-
waitingForFirstRender: 2,
|
|
133
|
-
ignoring: 3
|
|
134
|
-
};
|
|
135
|
-
if (!(ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
136
|
-
_context.next = 9;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
ssrState.state = SSRStateEnum.ignoring;
|
|
140
|
-
if (ssrState.renderStop === -1) {
|
|
141
|
-
// arbitrary 500ms DOM update window
|
|
142
|
-
ssrState.renderStop = timestamp + 500;
|
|
143
|
-
}
|
|
144
|
-
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(element, 'ssr-hydration');
|
|
145
|
-
return _context.abrupt("return", 0);
|
|
146
|
-
case 9:
|
|
147
|
-
if (!(ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
148
|
-
_context.next = 16;
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
if (!(timestamp <= ssrState.renderStop)) {
|
|
152
|
-
_context.next = 15;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
|
|
156
|
-
return _context.abrupt("return", 0);
|
|
157
|
-
case 15:
|
|
158
|
-
ssrState.state = SSRStateEnum.normal;
|
|
159
|
-
case 16:
|
|
160
|
-
if (!_this.getSSRPlaceholderHandler) {
|
|
161
|
-
_context.next = 30;
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
ssrPlaceholderHandler = _this.getSSRPlaceholderHandler();
|
|
165
|
-
if (!ssrPlaceholderHandler) {
|
|
166
|
-
_context.next = 30;
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
if (!(ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
170
|
-
_context.next = 23;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
|
|
174
|
-
_context.next = 23;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
(_this$intersectionObs3 = _this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
178
|
-
return _context.abrupt("return", 0);
|
|
179
|
-
case 23:
|
|
180
|
-
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
181
|
-
_context.next = 30;
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
_context.next = 26;
|
|
185
|
-
return ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
|
|
186
|
-
case 26:
|
|
187
|
-
result = _context.sent;
|
|
188
|
-
if (!(result !== false)) {
|
|
189
|
-
_context.next = 30;
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
(_this$intersectionObs4 = _this.intersectionObserver) === null || _this$intersectionObs4 === void 0 || _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
193
|
-
return _context.abrupt("return", 0);
|
|
194
|
-
case 30:
|
|
195
|
-
sameDeletedNode = removedNodes.find(function (ref) {
|
|
196
|
-
var n = ref.deref();
|
|
197
|
-
if (!n || !element) {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
return n.isEqualNode(element);
|
|
201
|
-
});
|
|
202
|
-
isInIgnoreLsMarker = element instanceof HTMLElement ? (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(element) : false;
|
|
203
|
-
if (!(sameDeletedNode && isInIgnoreLsMarker)) {
|
|
204
|
-
_context.next = 35;
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
(_this$intersectionObs5 = _this.intersectionObserver) === null || _this$intersectionObs5 === void 0 || _this$intersectionObs5.watchAndTag(element, 'mutation:remount');
|
|
208
|
-
return _context.abrupt("return", 0);
|
|
209
|
-
case 35:
|
|
210
|
-
if (!(0, _vcUtils.isContainedWithinMediaWrapper)(element)) {
|
|
211
|
-
_context.next = 38;
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
(_this$intersectionObs6 = _this.intersectionObserver) === null || _this$intersectionObs6 === void 0 || _this$intersectionObs6.watchAndTag(element, 'mutation:media');
|
|
215
|
-
return _context.abrupt("return", 0);
|
|
216
|
-
case 38:
|
|
217
|
-
_ref6 = element instanceof HTMLElement ? (0, _checkWithinComponent3.default)(element, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
218
|
-
isWithin: false
|
|
219
|
-
}, isWithinThirdPartySegment = _ref6.isWithin;
|
|
220
|
-
if (!isWithinThirdPartySegment) {
|
|
221
|
-
_context.next = 42;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
(_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(element, 'mutation:third-party-element');
|
|
225
|
-
return _context.abrupt("return", 0);
|
|
226
|
-
case 42:
|
|
227
|
-
if (isDisplayContentsElementChildren) {
|
|
228
|
-
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
229
|
-
} else {
|
|
230
|
-
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
231
|
-
}
|
|
232
|
-
case 43:
|
|
233
|
-
case "end":
|
|
234
|
-
return _context.stop();
|
|
235
|
-
}
|
|
236
|
-
}, _loop2);
|
|
237
|
-
});
|
|
238
|
-
_iterator2.s();
|
|
239
|
-
case 9:
|
|
240
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
241
|
-
_context2.next = 16;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
return _context2.delegateYield(_loop2(), "t0", 11);
|
|
245
|
-
case 11:
|
|
246
|
-
_ret2 = _context2.t0;
|
|
247
|
-
if (!(_ret2 === 0)) {
|
|
248
|
-
_context2.next = 14;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
return _context2.abrupt("continue", 14);
|
|
252
|
-
case 14:
|
|
253
|
-
_context2.next = 9;
|
|
254
|
-
break;
|
|
255
|
-
case 16:
|
|
256
|
-
_context2.next = 21;
|
|
257
|
-
break;
|
|
258
|
-
case 18:
|
|
259
|
-
_context2.prev = 18;
|
|
260
|
-
_context2.t1 = _context2["catch"](6);
|
|
261
|
-
_iterator2.e(_context2.t1);
|
|
262
|
-
case 21:
|
|
263
|
-
_context2.prev = 21;
|
|
264
|
-
_iterator2.f();
|
|
265
|
-
return _context2.finish(21);
|
|
266
|
-
case 24:
|
|
267
|
-
_context2.next = 69;
|
|
268
|
-
break;
|
|
269
|
-
case 26:
|
|
121
|
+
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
270
122
|
if (!_this.getSSRState) {
|
|
271
|
-
|
|
123
|
+
_context.next = 16;
|
|
272
124
|
break;
|
|
273
125
|
}
|
|
274
126
|
ssrState = _this.getSSRState();
|
|
@@ -278,7 +130,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
278
130
|
ignoring: 3
|
|
279
131
|
};
|
|
280
132
|
if (!(ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
281
|
-
|
|
133
|
+
_context.next = 9;
|
|
282
134
|
break;
|
|
283
135
|
}
|
|
284
136
|
ssrState.state = SSRStateEnum.ignoring;
|
|
@@ -286,153 +138,159 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
286
138
|
// arbitrary 500ms DOM update window
|
|
287
139
|
ssrState.renderStop = timestamp + 500;
|
|
288
140
|
}
|
|
289
|
-
(_this$
|
|
290
|
-
return
|
|
291
|
-
case
|
|
141
|
+
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(element, 'ssr-hydration');
|
|
142
|
+
return _context.abrupt("return", 0);
|
|
143
|
+
case 9:
|
|
292
144
|
if (!(ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
293
|
-
|
|
145
|
+
_context.next = 16;
|
|
294
146
|
break;
|
|
295
147
|
}
|
|
296
148
|
if (!(timestamp <= ssrState.renderStop)) {
|
|
297
|
-
|
|
149
|
+
_context.next = 15;
|
|
298
150
|
break;
|
|
299
151
|
}
|
|
300
|
-
(_this$
|
|
301
|
-
return
|
|
302
|
-
case
|
|
152
|
+
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
|
|
153
|
+
return _context.abrupt("return", 0);
|
|
154
|
+
case 15:
|
|
303
155
|
ssrState.state = SSRStateEnum.normal;
|
|
304
|
-
case
|
|
156
|
+
case 16:
|
|
305
157
|
if (!_this.getSSRPlaceholderHandler) {
|
|
306
|
-
|
|
158
|
+
_context.next = 30;
|
|
307
159
|
break;
|
|
308
160
|
}
|
|
309
161
|
ssrPlaceholderHandler = _this.getSSRPlaceholderHandler();
|
|
310
162
|
if (!ssrPlaceholderHandler) {
|
|
311
|
-
|
|
163
|
+
_context.next = 30;
|
|
312
164
|
break;
|
|
313
165
|
}
|
|
314
|
-
if (!(ssrPlaceholderHandler.isPlaceholder(
|
|
315
|
-
|
|
166
|
+
if (!(ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
167
|
+
_context.next = 23;
|
|
316
168
|
break;
|
|
317
169
|
}
|
|
318
|
-
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(
|
|
319
|
-
|
|
170
|
+
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
|
|
171
|
+
_context.next = 23;
|
|
320
172
|
break;
|
|
321
173
|
}
|
|
322
|
-
(_this$
|
|
323
|
-
return
|
|
324
|
-
case
|
|
325
|
-
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(
|
|
326
|
-
|
|
174
|
+
(_this$intersectionObs3 = _this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
175
|
+
return _context.abrupt("return", 0);
|
|
176
|
+
case 23:
|
|
177
|
+
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
178
|
+
_context.next = 30;
|
|
327
179
|
break;
|
|
328
180
|
}
|
|
329
|
-
|
|
330
|
-
return ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(
|
|
331
|
-
case
|
|
332
|
-
result =
|
|
181
|
+
_context.next = 26;
|
|
182
|
+
return ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
|
|
183
|
+
case 26:
|
|
184
|
+
result = _context.sent;
|
|
333
185
|
if (!(result !== false)) {
|
|
334
|
-
|
|
186
|
+
_context.next = 30;
|
|
335
187
|
break;
|
|
336
188
|
}
|
|
337
|
-
(_this$
|
|
338
|
-
return
|
|
339
|
-
case
|
|
189
|
+
(_this$intersectionObs4 = _this.intersectionObserver) === null || _this$intersectionObs4 === void 0 || _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
190
|
+
return _context.abrupt("return", 0);
|
|
191
|
+
case 30:
|
|
340
192
|
sameDeletedNode = removedNodes.find(function (ref) {
|
|
341
193
|
var n = ref.deref();
|
|
342
|
-
if (!n || !
|
|
194
|
+
if (!n || !element) {
|
|
343
195
|
return false;
|
|
344
196
|
}
|
|
345
|
-
return n.isEqualNode(
|
|
197
|
+
return n.isEqualNode(element);
|
|
346
198
|
});
|
|
347
|
-
isInIgnoreLsMarker = (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(
|
|
199
|
+
isInIgnoreLsMarker = element instanceof HTMLElement ? (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(element) : false;
|
|
348
200
|
if (!(sameDeletedNode && isInIgnoreLsMarker)) {
|
|
349
|
-
|
|
201
|
+
_context.next = 35;
|
|
350
202
|
break;
|
|
351
203
|
}
|
|
352
|
-
(_this$
|
|
353
|
-
return
|
|
354
|
-
case
|
|
355
|
-
if (!(0, _vcUtils.isContainedWithinMediaWrapper)(
|
|
356
|
-
|
|
204
|
+
(_this$intersectionObs5 = _this.intersectionObserver) === null || _this$intersectionObs5 === void 0 || _this$intersectionObs5.watchAndTag(element, 'mutation:remount');
|
|
205
|
+
return _context.abrupt("return", 0);
|
|
206
|
+
case 35:
|
|
207
|
+
if (!(0, _vcUtils.isContainedWithinMediaWrapper)(element)) {
|
|
208
|
+
_context.next = 38;
|
|
357
209
|
break;
|
|
358
210
|
}
|
|
359
|
-
(_this$
|
|
360
|
-
return
|
|
361
|
-
case
|
|
362
|
-
|
|
211
|
+
(_this$intersectionObs6 = _this.intersectionObserver) === null || _this$intersectionObs6 === void 0 || _this$intersectionObs6.watchAndTag(element, 'mutation:media');
|
|
212
|
+
return _context.abrupt("return", 0);
|
|
213
|
+
case 38:
|
|
214
|
+
_ref6 = element instanceof HTMLElement ? (0, _checkWithinComponent2.default)(element, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
215
|
+
isWithin: false
|
|
216
|
+
}, isWithinThirdPartySegment = _ref6.isWithin;
|
|
363
217
|
if (!isWithinThirdPartySegment) {
|
|
364
|
-
|
|
218
|
+
_context.next = 42;
|
|
365
219
|
break;
|
|
366
220
|
}
|
|
367
|
-
(_this$
|
|
368
|
-
return
|
|
369
|
-
case
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
if (isDisplayContentsElementChildren) {
|
|
375
|
-
(_this$intersectionObs15 = _this.intersectionObserver) === null || _this$intersectionObs15 === void 0 || _this$intersectionObs15.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
376
|
-
} else {
|
|
377
|
-
(_this$intersectionObs16 = _this.intersectionObserver) === null || _this$intersectionObs16 === void 0 || _this$intersectionObs16.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
} catch (err) {
|
|
381
|
-
_iterator3.e(err);
|
|
382
|
-
} finally {
|
|
383
|
-
_iterator3.f();
|
|
221
|
+
(_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(element, 'mutation:third-party-element');
|
|
222
|
+
return _context.abrupt("return", 0);
|
|
223
|
+
case 42:
|
|
224
|
+
if (isDisplayContentsElementChildren) {
|
|
225
|
+
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
226
|
+
} else {
|
|
227
|
+
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
384
228
|
}
|
|
385
|
-
case
|
|
229
|
+
case 43:
|
|
386
230
|
case "end":
|
|
387
|
-
return
|
|
231
|
+
return _context.stop();
|
|
388
232
|
}
|
|
389
|
-
}, _loop
|
|
233
|
+
}, _loop);
|
|
390
234
|
});
|
|
391
|
-
|
|
392
|
-
case
|
|
393
|
-
if ((
|
|
394
|
-
|
|
235
|
+
_iterator2.s();
|
|
236
|
+
case 15:
|
|
237
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
238
|
+
_context2.next = 22;
|
|
395
239
|
break;
|
|
396
240
|
}
|
|
397
|
-
return
|
|
398
|
-
case
|
|
399
|
-
_ret =
|
|
241
|
+
return _context2.delegateYield(_loop(), "t0", 17);
|
|
242
|
+
case 17:
|
|
243
|
+
_ret = _context2.t0;
|
|
400
244
|
if (!(_ret === 0)) {
|
|
401
|
-
|
|
245
|
+
_context2.next = 20;
|
|
402
246
|
break;
|
|
403
247
|
}
|
|
404
|
-
return
|
|
405
|
-
case
|
|
406
|
-
|
|
248
|
+
return _context2.abrupt("continue", 20);
|
|
249
|
+
case 20:
|
|
250
|
+
_context2.next = 15;
|
|
407
251
|
break;
|
|
408
|
-
case
|
|
409
|
-
|
|
252
|
+
case 22:
|
|
253
|
+
_context2.next = 27;
|
|
410
254
|
break;
|
|
411
|
-
case
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
case
|
|
416
|
-
|
|
255
|
+
case 24:
|
|
256
|
+
_context2.prev = 24;
|
|
257
|
+
_context2.t1 = _context2["catch"](12);
|
|
258
|
+
_iterator2.e(_context2.t1);
|
|
259
|
+
case 27:
|
|
260
|
+
_context2.prev = 27;
|
|
261
|
+
_iterator2.f();
|
|
262
|
+
return _context2.finish(27);
|
|
263
|
+
case 30:
|
|
264
|
+
_context2.next = 6;
|
|
265
|
+
break;
|
|
266
|
+
case 32:
|
|
267
|
+
_context2.next = 37;
|
|
268
|
+
break;
|
|
269
|
+
case 34:
|
|
270
|
+
_context2.prev = 34;
|
|
271
|
+
_context2.t2 = _context2["catch"](4);
|
|
272
|
+
_iterator.e(_context2.t2);
|
|
273
|
+
case 37:
|
|
274
|
+
_context2.prev = 37;
|
|
417
275
|
_iterator.f();
|
|
418
|
-
return
|
|
419
|
-
case
|
|
276
|
+
return _context2.finish(37);
|
|
277
|
+
case 40:
|
|
420
278
|
case "end":
|
|
421
|
-
return
|
|
279
|
+
return _context2.stop();
|
|
422
280
|
}
|
|
423
|
-
}, _callee, null, [[4,
|
|
281
|
+
}, _callee, null, [[4, 34, 37, 40], [12, 24, 27, 30]]);
|
|
424
282
|
}));
|
|
425
283
|
return function (_x) {
|
|
426
284
|
return _ref5.apply(this, arguments);
|
|
427
285
|
};
|
|
428
286
|
}());
|
|
429
287
|
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (_ref7) {
|
|
430
|
-
var _this$
|
|
288
|
+
var _this$intersectionObs0;
|
|
431
289
|
var target = _ref7.target,
|
|
432
290
|
attributeName = _ref7.attributeName,
|
|
433
291
|
oldValue = _ref7.oldValue,
|
|
434
292
|
newValue = _ref7.newValue;
|
|
435
|
-
(_this$
|
|
293
|
+
(_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(target, function (_ref8) {
|
|
436
294
|
var target = _ref8.target,
|
|
437
295
|
rect = _ref8.rect;
|
|
438
296
|
if ((0, _vcUtils.isContainedWithinMediaWrapper)(target)) {
|
|
@@ -446,8 +304,8 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
446
304
|
};
|
|
447
305
|
}
|
|
448
306
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_attribute_changes')) {
|
|
449
|
-
var
|
|
450
|
-
isWithinThirdPartySegment =
|
|
307
|
+
var _checkWithinComponent = (0, _checkWithinComponent2.default)(target, 'UFOThirdPartySegment', _this.mapIs3pResult),
|
|
308
|
+
isWithinThirdPartySegment = _checkWithinComponent.isWithin;
|
|
451
309
|
if (isWithinThirdPartySegment) {
|
|
452
310
|
return {
|
|
453
311
|
type: 'mutation:third-party-attribute',
|
|
@@ -508,11 +366,11 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
508
366
|
(0, _defineProperty2.default)(this, "handleLayoutShift", function (_ref9) {
|
|
509
367
|
var time = _ref9.time,
|
|
510
368
|
changedRects = _ref9.changedRects;
|
|
511
|
-
var
|
|
512
|
-
|
|
369
|
+
var _iterator3 = _createForOfIteratorHelper(changedRects),
|
|
370
|
+
_step3;
|
|
513
371
|
try {
|
|
514
|
-
for (
|
|
515
|
-
var changedRect =
|
|
372
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
373
|
+
var changedRect = _step3.value;
|
|
516
374
|
var target = changedRect.node;
|
|
517
375
|
if (target) {
|
|
518
376
|
var isSameCurrentAndPreviousRects = (0, _isSameRectDimensions.isSameRectDimensions)(changedRect.rect, changedRect.previousRect);
|
|
@@ -527,9 +385,9 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
527
385
|
}
|
|
528
386
|
}
|
|
529
387
|
} catch (err) {
|
|
530
|
-
|
|
388
|
+
_iterator3.e(err);
|
|
531
389
|
} finally {
|
|
532
|
-
|
|
390
|
+
_iterator3.f();
|
|
533
391
|
}
|
|
534
392
|
});
|
|
535
393
|
this.mapVisibleNodeRects = new WeakMap();
|
|
@@ -586,16 +444,16 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
586
444
|
}, {
|
|
587
445
|
key: "stop",
|
|
588
446
|
value: function stop() {
|
|
589
|
-
var _this$mutationObserve2, _this$
|
|
447
|
+
var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
|
|
590
448
|
if (!this.isStarted) {
|
|
591
449
|
return;
|
|
592
450
|
}
|
|
593
451
|
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
|
|
594
|
-
(_this$
|
|
452
|
+
(_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 || _this$intersectionObs1.disconnect();
|
|
595
453
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
596
454
|
this.isStarted = false;
|
|
597
455
|
// Clean up caches when stopping
|
|
598
|
-
(0,
|
|
456
|
+
(0, _checkWithinComponent2.cleanupCaches)(this.mapIs3pResult);
|
|
599
457
|
}
|
|
600
458
|
}]);
|
|
601
459
|
}();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
const ANCESTOR_LOOKUP_LIMIT = 10;
|
|
4
3
|
const PAGE_LAYOUT_ID = 'page-layout.root';
|
|
5
4
|
export class SSRPlaceholderHandlers {
|
|
@@ -247,45 +246,40 @@ export class SSRPlaceholderHandlers {
|
|
|
247
246
|
* by collecting dimensions from their children instead
|
|
248
247
|
*/
|
|
249
248
|
getEffectiveBoundingRect(el) {
|
|
250
|
-
const
|
|
249
|
+
const computedStyle = window.getComputedStyle(el);
|
|
251
250
|
|
|
252
|
-
//
|
|
253
|
-
if (
|
|
254
|
-
const
|
|
251
|
+
// If element has display: contents, collect bounding rect from children
|
|
252
|
+
if (computedStyle.display === 'contents') {
|
|
253
|
+
const children = Array.from(el.children);
|
|
254
|
+
if (children.length === 0) {
|
|
255
|
+
// No children, return zero rect
|
|
256
|
+
return new DOMRect(0, 0, 0, 0);
|
|
257
|
+
}
|
|
255
258
|
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
// Calculate union of all children's bounding rects
|
|
260
|
+
let minX = Infinity;
|
|
261
|
+
let minY = Infinity;
|
|
262
|
+
let maxX = -Infinity;
|
|
263
|
+
let maxY = -Infinity;
|
|
264
|
+
children.forEach(child => {
|
|
265
|
+
const childRect = child.getBoundingClientRect();
|
|
266
|
+
// Skip children with zero dimensions (likely also display: contents)
|
|
267
|
+
if (childRect.width > 0 || childRect.height > 0) {
|
|
268
|
+
minX = Math.min(minX, childRect.left);
|
|
269
|
+
minY = Math.min(minY, childRect.top);
|
|
270
|
+
maxX = Math.max(maxX, childRect.right);
|
|
271
|
+
maxY = Math.max(maxY, childRect.bottom);
|
|
262
272
|
}
|
|
273
|
+
});
|
|
263
274
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
let maxX = -Infinity;
|
|
268
|
-
let maxY = -Infinity;
|
|
269
|
-
children.forEach(child => {
|
|
270
|
-
const childRect = child.getBoundingClientRect();
|
|
271
|
-
// Skip children with zero dimensions (likely also display: contents)
|
|
272
|
-
if (childRect.width > 0 || childRect.height > 0) {
|
|
273
|
-
minX = Math.min(minX, childRect.left);
|
|
274
|
-
minY = Math.min(minY, childRect.top);
|
|
275
|
-
maxX = Math.max(maxX, childRect.right);
|
|
276
|
-
maxY = Math.max(maxY, childRect.bottom);
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// If no children with dimensions found, return zero rect
|
|
281
|
-
if (minX === Infinity) {
|
|
282
|
-
return new DOMRect(0, 0, 0, 0);
|
|
283
|
-
}
|
|
284
|
-
return new DOMRect(minX, minY, maxX - minX, maxY - minY);
|
|
275
|
+
// If no children with dimensions found, return zero rect
|
|
276
|
+
if (minX === Infinity) {
|
|
277
|
+
return new DOMRect(0, 0, 0, 0);
|
|
285
278
|
}
|
|
279
|
+
return new DOMRect(minX, minY, maxX - minX, maxY - minY);
|
|
286
280
|
}
|
|
287
281
|
|
|
288
|
-
// Normal element
|
|
282
|
+
// Normal element, return its bounding rect
|
|
289
283
|
return el.getBoundingClientRect();
|
|
290
284
|
}
|
|
291
285
|
isDummyRect(rect) {
|