@atlaskit/react-ufo 4.15.16 → 4.15.18
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 +14 -0
- package/dist/cjs/vc/vc-observer-new/index.js +7 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy26_04/index.js +1 -3
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +60 -237
- package/dist/cjs/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +28 -31
- package/dist/es2019/vc/vc-observer-new/index.js +4 -0
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy26_04/index.js +1 -3
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +17 -131
- package/dist/es2019/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +19 -22
- package/dist/esm/vc/vc-observer-new/index.js +7 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy26_04/index.js +1 -3
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +60 -237
- package/dist/esm/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +28 -31
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.15.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4bd92b550a0c8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4bd92b550a0c8) -
|
|
8
|
+
Drop vc details data when raw data event is enabled
|
|
9
|
+
|
|
10
|
+
## 4.15.17
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`3171d275a7161`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3171d275a7161) -
|
|
15
|
+
FG cleanup - platform_ufo_detect_zero_dimension_rectangles
|
|
16
|
+
|
|
3
17
|
## 4.15.16
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -390,7 +390,7 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
|
|
|
390
390
|
case 40:
|
|
391
391
|
feVCCalculationEndTime = performance.now();
|
|
392
392
|
if (!(includeRawData && (0, _platformFeatureFlags.fg)('platform_ufo_enable_vc_raw_data'))) {
|
|
393
|
-
_context.next =
|
|
393
|
+
_context.next = 49;
|
|
394
394
|
break;
|
|
395
395
|
}
|
|
396
396
|
rawVCCalculationStartTime = performance.now();
|
|
@@ -404,14 +404,18 @@ var VCObserverNew = exports.default = /*#__PURE__*/function () {
|
|
|
404
404
|
});
|
|
405
405
|
case 46:
|
|
406
406
|
raw = _context.sent;
|
|
407
|
+
results.forEach(function (result) {
|
|
408
|
+
delete result.vcDetails;
|
|
409
|
+
delete result.ratios;
|
|
410
|
+
});
|
|
407
411
|
if (raw) {
|
|
408
412
|
raw.rawVCTime = Number((performance.now() - rawVCCalculationStartTime).toFixed(2));
|
|
409
413
|
raw.feVCTime = Number((feVCCalculationEndTime - feVCCalculationStartTime).toFixed(2));
|
|
410
414
|
results.push(raw);
|
|
411
415
|
}
|
|
412
|
-
case 48:
|
|
413
|
-
return _context.abrupt("return", results);
|
|
414
416
|
case 49:
|
|
417
|
+
return _context.abrupt("return", results);
|
|
418
|
+
case 50:
|
|
415
419
|
case "end":
|
|
416
420
|
return _context.stop();
|
|
417
421
|
}
|
|
@@ -22,9 +22,7 @@ var getConsideredEntryTypes = function getConsideredEntryTypes() {
|
|
|
22
22
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_remove_ssr_placeholder_in_ttvc_v4')) {
|
|
23
23
|
consideredEntryTypes.push('mutation:ssr-placeholder');
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
consideredEntryTypes.push('mutation:display-contents-children-attribute');
|
|
27
|
-
}
|
|
25
|
+
consideredEntryTypes.push('mutation:display-contents-children-attribute');
|
|
28
26
|
return consideredEntryTypes;
|
|
29
27
|
};
|
|
30
28
|
var getExcludedEntryTypes = function getExcludedEntryTypes() {
|
|
@@ -20,7 +20,6 @@ var _intersectionObserver = require("./intersection-observer");
|
|
|
20
20
|
var _mutationObserver = _interopRequireDefault(require("./mutation-observer"));
|
|
21
21
|
var _performanceObserver = _interopRequireDefault(require("./performance-observer"));
|
|
22
22
|
var _checkWithinComponent3 = _interopRequireWildcard(require("./utils/check-within-component"));
|
|
23
|
-
var _getMutatedElements = require("./utils/get-mutated-elements");
|
|
24
23
|
var _isElementVisible = require("./utils/is-element-visible");
|
|
25
24
|
var _isInVcIgnoreIfNoLayoutShiftMarker = _interopRequireDefault(require("./utils/is-in-vc-ignore-if-no-layout-shift-marker"));
|
|
26
25
|
var _isInputNameMutation = require("./utils/is-input-name-mutation");
|
|
@@ -30,31 +29,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
30
29
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
31
30
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
32
31
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
33
|
-
var createElementMutationsWatcher = function createElementMutationsWatcher(removedNodeRects) {
|
|
32
|
+
var createElementMutationsWatcher = function createElementMutationsWatcher(removedNodeRects, isWithinThirdPartySegment, hasSameDeletedNode, timestamp, isTargetReactRoot, getSSRState, getSSRPlaceholderHandler) {
|
|
34
33
|
return function (_ref) {
|
|
35
34
|
var target = _ref.target,
|
|
36
35
|
rect = _ref.rect;
|
|
37
|
-
var isInIgnoreLsMarker = (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(target);
|
|
38
|
-
if (!isInIgnoreLsMarker) {
|
|
39
|
-
return 'mutation:element';
|
|
40
|
-
}
|
|
41
|
-
var isRLLPlaceholder = _rllPlaceholders.RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
|
|
42
|
-
if (isRLLPlaceholder && isInIgnoreLsMarker) {
|
|
43
|
-
return 'mutation:rll-placeholder';
|
|
44
|
-
}
|
|
45
|
-
var wasDeleted = removedNodeRects.some(function (nr) {
|
|
46
|
-
return (0, _isSameRectDimensions.isSameRectDimensions)(nr, rect);
|
|
47
|
-
});
|
|
48
|
-
if (wasDeleted && isInIgnoreLsMarker) {
|
|
49
|
-
return 'mutation:element-replacement';
|
|
50
|
-
}
|
|
51
|
-
return 'mutation:element';
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(removedNodeRects, isWithinThirdPartySegment, hasSameDeletedNode, timestamp, isTargetReactRoot, getSSRState, getSSRPlaceholderHandler) {
|
|
55
|
-
return function (_ref2) {
|
|
56
|
-
var target = _ref2.target,
|
|
57
|
-
rect = _ref2.rect;
|
|
58
36
|
if (getSSRState) {
|
|
59
37
|
var ssrState = getSSRState();
|
|
60
38
|
var SSRStateEnum = {
|
|
@@ -118,18 +96,18 @@ var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(r
|
|
|
118
96
|
var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
119
97
|
// SSR context functions
|
|
120
98
|
|
|
121
|
-
function ViewportObserver(
|
|
99
|
+
function ViewportObserver(_ref2) {
|
|
122
100
|
var _this = this;
|
|
123
|
-
var onChange =
|
|
124
|
-
getSSRState =
|
|
125
|
-
getSSRPlaceholderHandler =
|
|
101
|
+
var onChange = _ref2.onChange,
|
|
102
|
+
getSSRState = _ref2.getSSRState,
|
|
103
|
+
getSSRPlaceholderHandler = _ref2.getSSRPlaceholderHandler;
|
|
126
104
|
(0, _classCallCheck2.default)(this, ViewportObserver);
|
|
127
|
-
(0, _defineProperty2.default)(this, "handleIntersectionEntry", function (
|
|
128
|
-
var target =
|
|
129
|
-
rect =
|
|
130
|
-
time =
|
|
131
|
-
type =
|
|
132
|
-
mutationData =
|
|
105
|
+
(0, _defineProperty2.default)(this, "handleIntersectionEntry", function (_ref3) {
|
|
106
|
+
var target = _ref3.target,
|
|
107
|
+
rect = _ref3.rect,
|
|
108
|
+
time = _ref3.time,
|
|
109
|
+
type = _ref3.type,
|
|
110
|
+
mutationData = _ref3.mutationData;
|
|
133
111
|
if (!target) {
|
|
134
112
|
return;
|
|
135
113
|
}
|
|
@@ -147,12 +125,12 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
147
125
|
});
|
|
148
126
|
});
|
|
149
127
|
(0, _defineProperty2.default)(this, "handleChildListMutation", /*#__PURE__*/function () {
|
|
150
|
-
var
|
|
128
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref4) {
|
|
151
129
|
var target, addedNodes, removedNodes, timestamp, removedNodeRects, targetNode, _iterator, _step, _loop;
|
|
152
|
-
return _regenerator.default.wrap(function _callee$(
|
|
153
|
-
while (1) switch (
|
|
130
|
+
return _regenerator.default.wrap(function _callee$(_context2) {
|
|
131
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
154
132
|
case 0:
|
|
155
|
-
target =
|
|
133
|
+
target = _ref4.target, addedNodes = _ref4.addedNodes, removedNodes = _ref4.removedNodes, timestamp = _ref4.timestamp;
|
|
156
134
|
removedNodeRects = removedNodes.map(function (ref) {
|
|
157
135
|
var n = ref.deref();
|
|
158
136
|
if (!n) {
|
|
@@ -162,24 +140,21 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
162
140
|
});
|
|
163
141
|
targetNode = target.deref();
|
|
164
142
|
_iterator = _createForOfIteratorHelper(addedNodes);
|
|
165
|
-
|
|
143
|
+
_context2.prev = 4;
|
|
166
144
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
167
|
-
var
|
|
168
|
-
|
|
169
|
-
|
|
145
|
+
var _this$getSSRState, _this$intersectionObs;
|
|
146
|
+
var addedNodeRef, addedNode, hasSameDeletedNode, _checkWithinComponent, isWithinThirdPartySegment, isTargetReactRoot;
|
|
147
|
+
return _regenerator.default.wrap(function _loop$(_context) {
|
|
148
|
+
while (1) switch (_context.prev = _context.next) {
|
|
170
149
|
case 0:
|
|
171
150
|
addedNodeRef = _step.value;
|
|
172
151
|
addedNode = addedNodeRef.deref();
|
|
173
152
|
if (addedNode) {
|
|
174
|
-
|
|
153
|
+
_context.next = 4;
|
|
175
154
|
break;
|
|
176
155
|
}
|
|
177
|
-
return
|
|
156
|
+
return _context.abrupt("return", 1);
|
|
178
157
|
case 4:
|
|
179
|
-
if (!(0, _platformFeatureFlags.fg)('platform_ufo_detect_zero_dimension_rectangles')) {
|
|
180
|
-
_context2.next = 11;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
158
|
hasSameDeletedNode = removedNodes.find(function (ref) {
|
|
184
159
|
var n = ref.deref();
|
|
185
160
|
if (!n || !addedNode) {
|
|
@@ -189,211 +164,59 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
189
164
|
});
|
|
190
165
|
_checkWithinComponent = (0, _checkWithinComponent3.default)(addedNode, 'UFOThirdPartySegment', _this.mapIs3pResult), isWithinThirdPartySegment = _checkWithinComponent.isWithin;
|
|
191
166
|
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);
|
|
192
|
-
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode,
|
|
193
|
-
|
|
194
|
-
break;
|
|
195
|
-
case 11:
|
|
196
|
-
_iterator2 = _createForOfIteratorHelper((0, _getMutatedElements.getMutatedElements)(addedNode));
|
|
197
|
-
_context2.prev = 12;
|
|
198
|
-
_loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
|
|
199
|
-
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;
|
|
200
|
-
return _regenerator.default.wrap(function _loop2$(_context) {
|
|
201
|
-
while (1) switch (_context.prev = _context.next) {
|
|
202
|
-
case 0:
|
|
203
|
-
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
204
|
-
if (!_this.getSSRState) {
|
|
205
|
-
_context.next = 16;
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
ssrState = _this.getSSRState();
|
|
209
|
-
SSRStateEnum = {
|
|
210
|
-
normal: 1,
|
|
211
|
-
waitingForFirstRender: 2,
|
|
212
|
-
ignoring: 3
|
|
213
|
-
};
|
|
214
|
-
if (!(ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
215
|
-
_context.next = 9;
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
ssrState.state = SSRStateEnum.ignoring;
|
|
219
|
-
if (ssrState.renderStop === -1) {
|
|
220
|
-
// arbitrary 500ms DOM update window
|
|
221
|
-
ssrState.renderStop = timestamp + 500;
|
|
222
|
-
}
|
|
223
|
-
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
|
|
224
|
-
return _context.abrupt("return", 0);
|
|
225
|
-
case 9:
|
|
226
|
-
if (!(ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
227
|
-
_context.next = 16;
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
if (!(timestamp <= ssrState.renderStop)) {
|
|
231
|
-
_context.next = 15;
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
(_this$intersectionObs3 = _this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.watchAndTag(element, 'ssr-hydration');
|
|
235
|
-
return _context.abrupt("return", 0);
|
|
236
|
-
case 15:
|
|
237
|
-
ssrState.state = SSRStateEnum.normal;
|
|
238
|
-
case 16:
|
|
239
|
-
if (!_this.getSSRPlaceholderHandler) {
|
|
240
|
-
_context.next = 30;
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
ssrPlaceholderHandler = _this.getSSRPlaceholderHandler();
|
|
244
|
-
if (!ssrPlaceholderHandler) {
|
|
245
|
-
_context.next = 30;
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
if (!(ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
249
|
-
_context.next = 23;
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
|
|
253
|
-
_context.next = 23;
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
(_this$intersectionObs4 = _this.intersectionObserver) === null || _this$intersectionObs4 === void 0 || _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
257
|
-
return _context.abrupt("return", 0);
|
|
258
|
-
case 23:
|
|
259
|
-
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
260
|
-
_context.next = 30;
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
_context.next = 26;
|
|
264
|
-
return ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
|
|
265
|
-
case 26:
|
|
266
|
-
result = _context.sent;
|
|
267
|
-
if (!(result !== false)) {
|
|
268
|
-
_context.next = 30;
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
|
-
(_this$intersectionObs5 = _this.intersectionObserver) === null || _this$intersectionObs5 === void 0 || _this$intersectionObs5.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
272
|
-
return _context.abrupt("return", 0);
|
|
273
|
-
case 30:
|
|
274
|
-
sameDeletedNode = removedNodes.find(function (ref) {
|
|
275
|
-
var n = ref.deref();
|
|
276
|
-
if (!n || !element) {
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
return n.isEqualNode(element);
|
|
280
|
-
});
|
|
281
|
-
isInIgnoreLsMarker = element instanceof HTMLElement ? (0, _isInVcIgnoreIfNoLayoutShiftMarker.default)(element) : false;
|
|
282
|
-
if (!(sameDeletedNode && isInIgnoreLsMarker)) {
|
|
283
|
-
_context.next = 35;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
(_this$intersectionObs6 = _this.intersectionObserver) === null || _this$intersectionObs6 === void 0 || _this$intersectionObs6.watchAndTag(element, 'mutation:remount');
|
|
287
|
-
return _context.abrupt("return", 0);
|
|
288
|
-
case 35:
|
|
289
|
-
if (!(0, _vcUtils.isContainedWithinMediaWrapper)(element)) {
|
|
290
|
-
_context.next = 38;
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
(_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(element, 'mutation:media');
|
|
294
|
-
return _context.abrupt("return", 0);
|
|
295
|
-
case 38:
|
|
296
|
-
_ref7 = element instanceof HTMLElement ? (0, _checkWithinComponent3.default)(element, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
297
|
-
isWithin: false
|
|
298
|
-
}, isWithinThirdPartySegment = _ref7.isWithin;
|
|
299
|
-
if (!isWithinThirdPartySegment) {
|
|
300
|
-
_context.next = 42;
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:third-party-element');
|
|
304
|
-
return _context.abrupt("return", 0);
|
|
305
|
-
case 42:
|
|
306
|
-
if (isDisplayContentsElementChildren) {
|
|
307
|
-
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
308
|
-
} else {
|
|
309
|
-
(_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
310
|
-
}
|
|
311
|
-
case 43:
|
|
312
|
-
case "end":
|
|
313
|
-
return _context.stop();
|
|
314
|
-
}
|
|
315
|
-
}, _loop2);
|
|
316
|
-
});
|
|
317
|
-
_iterator2.s();
|
|
318
|
-
case 15:
|
|
319
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
320
|
-
_context2.next = 22;
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
return _context2.delegateYield(_loop2(), "t0", 17);
|
|
324
|
-
case 17:
|
|
325
|
-
_ret = _context2.t0;
|
|
326
|
-
if (!(_ret === 0)) {
|
|
327
|
-
_context2.next = 20;
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
return _context2.abrupt("continue", 20);
|
|
331
|
-
case 20:
|
|
332
|
-
_context2.next = 15;
|
|
333
|
-
break;
|
|
334
|
-
case 22:
|
|
335
|
-
_context2.next = 27;
|
|
336
|
-
break;
|
|
337
|
-
case 24:
|
|
338
|
-
_context2.prev = 24;
|
|
339
|
-
_context2.t1 = _context2["catch"](12);
|
|
340
|
-
_iterator2.e(_context2.t1);
|
|
341
|
-
case 27:
|
|
342
|
-
_context2.prev = 27;
|
|
343
|
-
_iterator2.f();
|
|
344
|
-
return _context2.finish(27);
|
|
345
|
-
case 30:
|
|
167
|
+
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects, isWithinThirdPartySegment, !!hasSameDeletedNode, timestamp, isTargetReactRoot, _this.getSSRState, _this.getSSRPlaceholderHandler));
|
|
168
|
+
case 8:
|
|
346
169
|
case "end":
|
|
347
|
-
return
|
|
170
|
+
return _context.stop();
|
|
348
171
|
}
|
|
349
|
-
}, _loop
|
|
172
|
+
}, _loop);
|
|
350
173
|
});
|
|
351
174
|
_iterator.s();
|
|
352
175
|
case 7:
|
|
353
176
|
if ((_step = _iterator.n()).done) {
|
|
354
|
-
|
|
177
|
+
_context2.next = 13;
|
|
355
178
|
break;
|
|
356
179
|
}
|
|
357
|
-
return
|
|
180
|
+
return _context2.delegateYield(_loop(), "t0", 9);
|
|
358
181
|
case 9:
|
|
359
|
-
if (!
|
|
360
|
-
|
|
182
|
+
if (!_context2.t0) {
|
|
183
|
+
_context2.next = 11;
|
|
361
184
|
break;
|
|
362
185
|
}
|
|
363
|
-
return
|
|
186
|
+
return _context2.abrupt("continue", 11);
|
|
364
187
|
case 11:
|
|
365
|
-
|
|
188
|
+
_context2.next = 7;
|
|
366
189
|
break;
|
|
367
190
|
case 13:
|
|
368
|
-
|
|
191
|
+
_context2.next = 18;
|
|
369
192
|
break;
|
|
370
193
|
case 15:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
_iterator.e(
|
|
194
|
+
_context2.prev = 15;
|
|
195
|
+
_context2.t1 = _context2["catch"](4);
|
|
196
|
+
_iterator.e(_context2.t1);
|
|
374
197
|
case 18:
|
|
375
|
-
|
|
198
|
+
_context2.prev = 18;
|
|
376
199
|
_iterator.f();
|
|
377
|
-
return
|
|
200
|
+
return _context2.finish(18);
|
|
378
201
|
case 21:
|
|
379
202
|
case "end":
|
|
380
|
-
return
|
|
203
|
+
return _context2.stop();
|
|
381
204
|
}
|
|
382
205
|
}, _callee, null, [[4, 15, 18, 21]]);
|
|
383
206
|
}));
|
|
384
207
|
return function (_x) {
|
|
385
|
-
return
|
|
208
|
+
return _ref5.apply(this, arguments);
|
|
386
209
|
};
|
|
387
210
|
}());
|
|
388
|
-
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (
|
|
389
|
-
var _this$
|
|
390
|
-
var target =
|
|
391
|
-
attributeName =
|
|
392
|
-
oldValue =
|
|
393
|
-
newValue =
|
|
394
|
-
(_this$
|
|
395
|
-
var target =
|
|
396
|
-
rect =
|
|
211
|
+
(0, _defineProperty2.default)(this, "handleAttributeMutation", function (_ref6) {
|
|
212
|
+
var _this$intersectionObs2;
|
|
213
|
+
var target = _ref6.target,
|
|
214
|
+
attributeName = _ref6.attributeName,
|
|
215
|
+
oldValue = _ref6.oldValue,
|
|
216
|
+
newValue = _ref6.newValue;
|
|
217
|
+
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(target, function (_ref7) {
|
|
218
|
+
var target = _ref7.target,
|
|
219
|
+
rect = _ref7.rect;
|
|
397
220
|
if ((0, _vcUtils.isContainedWithinMediaWrapper)(target)) {
|
|
398
221
|
return {
|
|
399
222
|
type: 'mutation:media',
|
|
@@ -494,14 +317,14 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
494
317
|
};
|
|
495
318
|
});
|
|
496
319
|
});
|
|
497
|
-
(0, _defineProperty2.default)(this, "handleLayoutShift", function (
|
|
498
|
-
var time =
|
|
499
|
-
changedRects =
|
|
500
|
-
var
|
|
501
|
-
|
|
320
|
+
(0, _defineProperty2.default)(this, "handleLayoutShift", function (_ref8) {
|
|
321
|
+
var time = _ref8.time,
|
|
322
|
+
changedRects = _ref8.changedRects;
|
|
323
|
+
var _iterator2 = _createForOfIteratorHelper(changedRects),
|
|
324
|
+
_step2;
|
|
502
325
|
try {
|
|
503
|
-
for (
|
|
504
|
-
var changedRect =
|
|
326
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
327
|
+
var changedRect = _step2.value;
|
|
505
328
|
var target = changedRect.node;
|
|
506
329
|
if (target) {
|
|
507
330
|
var isSameCurrentAndPreviousRects = (0, _isSameRectDimensions.isSameRectDimensions)(changedRect.rect, changedRect.previousRect);
|
|
@@ -516,9 +339,9 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
516
339
|
}
|
|
517
340
|
}
|
|
518
341
|
} catch (err) {
|
|
519
|
-
|
|
342
|
+
_iterator2.e(err);
|
|
520
343
|
} finally {
|
|
521
|
-
|
|
344
|
+
_iterator2.f();
|
|
522
345
|
}
|
|
523
346
|
});
|
|
524
347
|
this.mapVisibleNodeRects = new WeakMap();
|
|
@@ -575,12 +398,12 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
575
398
|
}, {
|
|
576
399
|
key: "stop",
|
|
577
400
|
value: function stop() {
|
|
578
|
-
var _this$mutationObserve2, _this$
|
|
401
|
+
var _this$mutationObserve2, _this$intersectionObs3, _this$performanceObse2;
|
|
579
402
|
if (!this.isStarted) {
|
|
580
403
|
return;
|
|
581
404
|
}
|
|
582
405
|
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
|
|
583
|
-
(_this$
|
|
406
|
+
(_this$intersectionObs3 = this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.disconnect();
|
|
584
407
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
585
408
|
this.isStarted = false;
|
|
586
409
|
// Clean up caches when stopping
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createIntersectionObserver = createIntersectionObserver;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
var _isZeroDimensionRectangle = require("../utils/is-zero-dimension-rectangle");
|
|
9
8
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
10
9
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -27,40 +26,38 @@ function createIntersectionObserver(_ref) {
|
|
|
27
26
|
return;
|
|
28
27
|
}
|
|
29
28
|
var tagOrCallback = callbacksPerElement.get(entry.target);
|
|
30
|
-
if ((0,
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
var tagOrCallbackResult = typeof tagOrCallback === 'function' ? tagOrCallback(props) : tagOrCallback;
|
|
29
|
+
if ((0, _isZeroDimensionRectangle.isZeroDimensionRectangle)(entry.intersectionRect)) {
|
|
30
|
+
var zeroDimensionRectangleTagCallback = function zeroDimensionRectangleTagCallback(props) {
|
|
31
|
+
var tagOrCallbackResult = typeof tagOrCallback === 'function' ? tagOrCallback(props) : tagOrCallback;
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
// override as display-contents mutation
|
|
34
|
+
if (tagOrCallbackResult === 'mutation:element') {
|
|
35
|
+
return 'mutation:display-contents-children-element';
|
|
36
|
+
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
} catch (err) {
|
|
58
|
-
_iterator.e(err);
|
|
59
|
-
} finally {
|
|
60
|
-
_iterator.f();
|
|
38
|
+
// override as display-contents mutation
|
|
39
|
+
if (tagOrCallbackResult && typeof tagOrCallbackResult !== 'string' && tagOrCallbackResult.type === 'mutation:attribute') {
|
|
40
|
+
return {
|
|
41
|
+
type: 'mutation:display-contents-children-attribute',
|
|
42
|
+
mutationData: tagOrCallbackResult.mutationData
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return tagOrCallbackResult;
|
|
46
|
+
};
|
|
47
|
+
var _iterator = _createForOfIteratorHelper(entry.target.children),
|
|
48
|
+
_step;
|
|
49
|
+
try {
|
|
50
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
51
|
+
var child = _step.value;
|
|
52
|
+
observer.observe(child);
|
|
53
|
+
callbacksPerElement.set(child, zeroDimensionRectangleTagCallback);
|
|
61
54
|
}
|
|
62
|
-
|
|
55
|
+
} catch (err) {
|
|
56
|
+
_iterator.e(err);
|
|
57
|
+
} finally {
|
|
58
|
+
_iterator.f();
|
|
63
59
|
}
|
|
60
|
+
return;
|
|
64
61
|
}
|
|
65
62
|
if (!isValidEntry(entry)) {
|
|
66
63
|
return;
|
|
@@ -322,6 +322,10 @@ export default class VCObserverNew {
|
|
|
322
322
|
stopTime: stop,
|
|
323
323
|
isPageVisible
|
|
324
324
|
});
|
|
325
|
+
results.forEach(result => {
|
|
326
|
+
delete result.vcDetails;
|
|
327
|
+
delete result.ratios;
|
|
328
|
+
});
|
|
325
329
|
if (raw) {
|
|
326
330
|
raw.rawVCTime = Number((performance.now() - rawVCCalculationStartTime).toFixed(2));
|
|
327
331
|
raw.feVCTime = Number((feVCCalculationEndTime - feVCCalculationStartTime).toFixed(2));
|
|
@@ -6,9 +6,7 @@ const getConsideredEntryTypes = () => {
|
|
|
6
6
|
if (fg('platform_ufo_remove_ssr_placeholder_in_ttvc_v4')) {
|
|
7
7
|
consideredEntryTypes.push('mutation:ssr-placeholder');
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
consideredEntryTypes.push('mutation:display-contents-children-attribute');
|
|
11
|
-
}
|
|
9
|
+
consideredEntryTypes.push('mutation:display-contents-children-attribute');
|
|
12
10
|
return consideredEntryTypes;
|
|
13
11
|
};
|
|
14
12
|
const getExcludedEntryTypes = () => {
|