@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
|
@@ -15,37 +15,15 @@ import { createIntersectionObserver } from './intersection-observer';
|
|
|
15
15
|
import createMutationObserver from './mutation-observer';
|
|
16
16
|
import createPerformanceObserver from './performance-observer';
|
|
17
17
|
import checkWithinComponent, { cleanupCaches } from './utils/check-within-component';
|
|
18
|
-
import { getMutatedElements } from './utils/get-mutated-elements';
|
|
19
18
|
import { isElementVisible } from './utils/is-element-visible';
|
|
20
19
|
import isInVCIgnoreIfNoLayoutShiftMarker from './utils/is-in-vc-ignore-if-no-layout-shift-marker';
|
|
21
20
|
import { isInputNameMutation } from './utils/is-input-name-mutation';
|
|
22
21
|
import { isSameRectDimensions } from './utils/is-same-rect-dimensions';
|
|
23
22
|
import { isSameRectSize } from './utils/is-same-rect-size';
|
|
24
|
-
var createElementMutationsWatcher = function createElementMutationsWatcher(removedNodeRects) {
|
|
23
|
+
var createElementMutationsWatcher = function createElementMutationsWatcher(removedNodeRects, isWithinThirdPartySegment, hasSameDeletedNode, timestamp, isTargetReactRoot, getSSRState, getSSRPlaceholderHandler) {
|
|
25
24
|
return function (_ref) {
|
|
26
25
|
var target = _ref.target,
|
|
27
26
|
rect = _ref.rect;
|
|
28
|
-
var isInIgnoreLsMarker = isInVCIgnoreIfNoLayoutShiftMarker(target);
|
|
29
|
-
if (!isInIgnoreLsMarker) {
|
|
30
|
-
return 'mutation:element';
|
|
31
|
-
}
|
|
32
|
-
var isRLLPlaceholder = RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
|
|
33
|
-
if (isRLLPlaceholder && isInIgnoreLsMarker) {
|
|
34
|
-
return 'mutation:rll-placeholder';
|
|
35
|
-
}
|
|
36
|
-
var wasDeleted = removedNodeRects.some(function (nr) {
|
|
37
|
-
return isSameRectDimensions(nr, rect);
|
|
38
|
-
});
|
|
39
|
-
if (wasDeleted && isInIgnoreLsMarker) {
|
|
40
|
-
return 'mutation:element-replacement';
|
|
41
|
-
}
|
|
42
|
-
return 'mutation:element';
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(removedNodeRects, isWithinThirdPartySegment, hasSameDeletedNode, timestamp, isTargetReactRoot, getSSRState, getSSRPlaceholderHandler) {
|
|
46
|
-
return function (_ref2) {
|
|
47
|
-
var target = _ref2.target,
|
|
48
|
-
rect = _ref2.rect;
|
|
49
27
|
if (getSSRState) {
|
|
50
28
|
var ssrState = getSSRState();
|
|
51
29
|
var SSRStateEnum = {
|
|
@@ -109,18 +87,18 @@ var createElementMutationsWatcherV4 = function createElementMutationsWatcherV4(r
|
|
|
109
87
|
var ViewportObserver = /*#__PURE__*/function () {
|
|
110
88
|
// SSR context functions
|
|
111
89
|
|
|
112
|
-
function ViewportObserver(
|
|
90
|
+
function ViewportObserver(_ref2) {
|
|
113
91
|
var _this = this;
|
|
114
|
-
var onChange =
|
|
115
|
-
getSSRState =
|
|
116
|
-
getSSRPlaceholderHandler =
|
|
92
|
+
var onChange = _ref2.onChange,
|
|
93
|
+
getSSRState = _ref2.getSSRState,
|
|
94
|
+
getSSRPlaceholderHandler = _ref2.getSSRPlaceholderHandler;
|
|
117
95
|
_classCallCheck(this, ViewportObserver);
|
|
118
|
-
_defineProperty(this, "handleIntersectionEntry", function (
|
|
119
|
-
var target =
|
|
120
|
-
rect =
|
|
121
|
-
time =
|
|
122
|
-
type =
|
|
123
|
-
mutationData =
|
|
96
|
+
_defineProperty(this, "handleIntersectionEntry", function (_ref3) {
|
|
97
|
+
var target = _ref3.target,
|
|
98
|
+
rect = _ref3.rect,
|
|
99
|
+
time = _ref3.time,
|
|
100
|
+
type = _ref3.type,
|
|
101
|
+
mutationData = _ref3.mutationData;
|
|
124
102
|
if (!target) {
|
|
125
103
|
return;
|
|
126
104
|
}
|
|
@@ -138,12 +116,12 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
138
116
|
});
|
|
139
117
|
});
|
|
140
118
|
_defineProperty(this, "handleChildListMutation", /*#__PURE__*/function () {
|
|
141
|
-
var
|
|
119
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref4) {
|
|
142
120
|
var target, addedNodes, removedNodes, timestamp, removedNodeRects, targetNode, _iterator, _step, _loop;
|
|
143
|
-
return _regeneratorRuntime.wrap(function _callee$(
|
|
144
|
-
while (1) switch (
|
|
121
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
122
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
145
123
|
case 0:
|
|
146
|
-
target =
|
|
124
|
+
target = _ref4.target, addedNodes = _ref4.addedNodes, removedNodes = _ref4.removedNodes, timestamp = _ref4.timestamp;
|
|
147
125
|
removedNodeRects = removedNodes.map(function (ref) {
|
|
148
126
|
var n = ref.deref();
|
|
149
127
|
if (!n) {
|
|
@@ -153,24 +131,21 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
153
131
|
});
|
|
154
132
|
targetNode = target.deref();
|
|
155
133
|
_iterator = _createForOfIteratorHelper(addedNodes);
|
|
156
|
-
|
|
134
|
+
_context2.prev = 4;
|
|
157
135
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
136
|
+
var _this$getSSRState, _this$intersectionObs;
|
|
137
|
+
var addedNodeRef, addedNode, hasSameDeletedNode, _checkWithinComponent, isWithinThirdPartySegment, isTargetReactRoot;
|
|
138
|
+
return _regeneratorRuntime.wrap(function _loop$(_context) {
|
|
139
|
+
while (1) switch (_context.prev = _context.next) {
|
|
161
140
|
case 0:
|
|
162
141
|
addedNodeRef = _step.value;
|
|
163
142
|
addedNode = addedNodeRef.deref();
|
|
164
143
|
if (addedNode) {
|
|
165
|
-
|
|
144
|
+
_context.next = 4;
|
|
166
145
|
break;
|
|
167
146
|
}
|
|
168
|
-
return
|
|
147
|
+
return _context.abrupt("return", 1);
|
|
169
148
|
case 4:
|
|
170
|
-
if (!fg('platform_ufo_detect_zero_dimension_rectangles')) {
|
|
171
|
-
_context2.next = 11;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
149
|
hasSameDeletedNode = removedNodes.find(function (ref) {
|
|
175
150
|
var n = ref.deref();
|
|
176
151
|
if (!n || !addedNode) {
|
|
@@ -180,211 +155,59 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
180
155
|
});
|
|
181
156
|
_checkWithinComponent = checkWithinComponent(addedNode, 'UFOThirdPartySegment', _this.mapIs3pResult), isWithinThirdPartySegment = _checkWithinComponent.isWithin;
|
|
182
157
|
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);
|
|
183
|
-
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode,
|
|
184
|
-
|
|
185
|
-
break;
|
|
186
|
-
case 11:
|
|
187
|
-
_iterator2 = _createForOfIteratorHelper(getMutatedElements(addedNode));
|
|
188
|
-
_context2.prev = 12;
|
|
189
|
-
_loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
|
|
190
|
-
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;
|
|
191
|
-
return _regeneratorRuntime.wrap(function _loop2$(_context) {
|
|
192
|
-
while (1) switch (_context.prev = _context.next) {
|
|
193
|
-
case 0:
|
|
194
|
-
_step2$value = _step2.value, isDisplayContentsElementChildren = _step2$value.isDisplayContentsElementChildren, element = _step2$value.element;
|
|
195
|
-
if (!_this.getSSRState) {
|
|
196
|
-
_context.next = 16;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
ssrState = _this.getSSRState();
|
|
200
|
-
SSRStateEnum = {
|
|
201
|
-
normal: 1,
|
|
202
|
-
waitingForFirstRender: 2,
|
|
203
|
-
ignoring: 3
|
|
204
|
-
};
|
|
205
|
-
if (!(ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
206
|
-
_context.next = 9;
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
ssrState.state = SSRStateEnum.ignoring;
|
|
210
|
-
if (ssrState.renderStop === -1) {
|
|
211
|
-
// arbitrary 500ms DOM update window
|
|
212
|
-
ssrState.renderStop = timestamp + 500;
|
|
213
|
-
}
|
|
214
|
-
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
|
|
215
|
-
return _context.abrupt("return", 0);
|
|
216
|
-
case 9:
|
|
217
|
-
if (!(ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement)) {
|
|
218
|
-
_context.next = 16;
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
if (!(timestamp <= ssrState.renderStop)) {
|
|
222
|
-
_context.next = 15;
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
(_this$intersectionObs3 = _this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.watchAndTag(element, 'ssr-hydration');
|
|
226
|
-
return _context.abrupt("return", 0);
|
|
227
|
-
case 15:
|
|
228
|
-
ssrState.state = SSRStateEnum.normal;
|
|
229
|
-
case 16:
|
|
230
|
-
if (!_this.getSSRPlaceholderHandler) {
|
|
231
|
-
_context.next = 30;
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
ssrPlaceholderHandler = _this.getSSRPlaceholderHandler();
|
|
235
|
-
if (!ssrPlaceholderHandler) {
|
|
236
|
-
_context.next = 30;
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
if (!(ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
240
|
-
_context.next = 23;
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
if (!ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
|
|
244
|
-
_context.next = 23;
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
(_this$intersectionObs4 = _this.intersectionObserver) === null || _this$intersectionObs4 === void 0 || _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
248
|
-
return _context.abrupt("return", 0);
|
|
249
|
-
case 23:
|
|
250
|
-
if (!(ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element))) {
|
|
251
|
-
_context.next = 30;
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
_context.next = 26;
|
|
255
|
-
return ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
|
|
256
|
-
case 26:
|
|
257
|
-
result = _context.sent;
|
|
258
|
-
if (!(result !== false)) {
|
|
259
|
-
_context.next = 30;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
(_this$intersectionObs5 = _this.intersectionObserver) === null || _this$intersectionObs5 === void 0 || _this$intersectionObs5.watchAndTag(element, 'mutation:ssr-placeholder');
|
|
263
|
-
return _context.abrupt("return", 0);
|
|
264
|
-
case 30:
|
|
265
|
-
sameDeletedNode = removedNodes.find(function (ref) {
|
|
266
|
-
var n = ref.deref();
|
|
267
|
-
if (!n || !element) {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
return n.isEqualNode(element);
|
|
271
|
-
});
|
|
272
|
-
isInIgnoreLsMarker = element instanceof HTMLElement ? isInVCIgnoreIfNoLayoutShiftMarker(element) : false;
|
|
273
|
-
if (!(sameDeletedNode && isInIgnoreLsMarker)) {
|
|
274
|
-
_context.next = 35;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
(_this$intersectionObs6 = _this.intersectionObserver) === null || _this$intersectionObs6 === void 0 || _this$intersectionObs6.watchAndTag(element, 'mutation:remount');
|
|
278
|
-
return _context.abrupt("return", 0);
|
|
279
|
-
case 35:
|
|
280
|
-
if (!isContainedWithinMediaWrapper(element)) {
|
|
281
|
-
_context.next = 38;
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
(_this$intersectionObs7 = _this.intersectionObserver) === null || _this$intersectionObs7 === void 0 || _this$intersectionObs7.watchAndTag(element, 'mutation:media');
|
|
285
|
-
return _context.abrupt("return", 0);
|
|
286
|
-
case 38:
|
|
287
|
-
_ref7 = element instanceof HTMLElement ? checkWithinComponent(element, 'UFOThirdPartySegment', _this.mapIs3pResult) : {
|
|
288
|
-
isWithin: false
|
|
289
|
-
}, isWithinThirdPartySegment = _ref7.isWithin;
|
|
290
|
-
if (!isWithinThirdPartySegment) {
|
|
291
|
-
_context.next = 42;
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
(_this$intersectionObs8 = _this.intersectionObserver) === null || _this$intersectionObs8 === void 0 || _this$intersectionObs8.watchAndTag(element, 'mutation:third-party-element');
|
|
295
|
-
return _context.abrupt("return", 0);
|
|
296
|
-
case 42:
|
|
297
|
-
if (isDisplayContentsElementChildren) {
|
|
298
|
-
(_this$intersectionObs9 = _this.intersectionObserver) === null || _this$intersectionObs9 === void 0 || _this$intersectionObs9.watchAndTag(element, 'mutation:display-contents-children-element');
|
|
299
|
-
} else {
|
|
300
|
-
(_this$intersectionObs0 = _this.intersectionObserver) === null || _this$intersectionObs0 === void 0 || _this$intersectionObs0.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
|
|
301
|
-
}
|
|
302
|
-
case 43:
|
|
303
|
-
case "end":
|
|
304
|
-
return _context.stop();
|
|
305
|
-
}
|
|
306
|
-
}, _loop2);
|
|
307
|
-
});
|
|
308
|
-
_iterator2.s();
|
|
309
|
-
case 15:
|
|
310
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
311
|
-
_context2.next = 22;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
return _context2.delegateYield(_loop2(), "t0", 17);
|
|
315
|
-
case 17:
|
|
316
|
-
_ret = _context2.t0;
|
|
317
|
-
if (!(_ret === 0)) {
|
|
318
|
-
_context2.next = 20;
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
return _context2.abrupt("continue", 20);
|
|
322
|
-
case 20:
|
|
323
|
-
_context2.next = 15;
|
|
324
|
-
break;
|
|
325
|
-
case 22:
|
|
326
|
-
_context2.next = 27;
|
|
327
|
-
break;
|
|
328
|
-
case 24:
|
|
329
|
-
_context2.prev = 24;
|
|
330
|
-
_context2.t1 = _context2["catch"](12);
|
|
331
|
-
_iterator2.e(_context2.t1);
|
|
332
|
-
case 27:
|
|
333
|
-
_context2.prev = 27;
|
|
334
|
-
_iterator2.f();
|
|
335
|
-
return _context2.finish(27);
|
|
336
|
-
case 30:
|
|
158
|
+
(_this$intersectionObs = _this.intersectionObserver) === null || _this$intersectionObs === void 0 || _this$intersectionObs.watchAndTag(addedNode, createElementMutationsWatcher(removedNodeRects, isWithinThirdPartySegment, !!hasSameDeletedNode, timestamp, isTargetReactRoot, _this.getSSRState, _this.getSSRPlaceholderHandler));
|
|
159
|
+
case 8:
|
|
337
160
|
case "end":
|
|
338
|
-
return
|
|
161
|
+
return _context.stop();
|
|
339
162
|
}
|
|
340
|
-
}, _loop
|
|
163
|
+
}, _loop);
|
|
341
164
|
});
|
|
342
165
|
_iterator.s();
|
|
343
166
|
case 7:
|
|
344
167
|
if ((_step = _iterator.n()).done) {
|
|
345
|
-
|
|
168
|
+
_context2.next = 13;
|
|
346
169
|
break;
|
|
347
170
|
}
|
|
348
|
-
return
|
|
171
|
+
return _context2.delegateYield(_loop(), "t0", 9);
|
|
349
172
|
case 9:
|
|
350
|
-
if (!
|
|
351
|
-
|
|
173
|
+
if (!_context2.t0) {
|
|
174
|
+
_context2.next = 11;
|
|
352
175
|
break;
|
|
353
176
|
}
|
|
354
|
-
return
|
|
177
|
+
return _context2.abrupt("continue", 11);
|
|
355
178
|
case 11:
|
|
356
|
-
|
|
179
|
+
_context2.next = 7;
|
|
357
180
|
break;
|
|
358
181
|
case 13:
|
|
359
|
-
|
|
182
|
+
_context2.next = 18;
|
|
360
183
|
break;
|
|
361
184
|
case 15:
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
_iterator.e(
|
|
185
|
+
_context2.prev = 15;
|
|
186
|
+
_context2.t1 = _context2["catch"](4);
|
|
187
|
+
_iterator.e(_context2.t1);
|
|
365
188
|
case 18:
|
|
366
|
-
|
|
189
|
+
_context2.prev = 18;
|
|
367
190
|
_iterator.f();
|
|
368
|
-
return
|
|
191
|
+
return _context2.finish(18);
|
|
369
192
|
case 21:
|
|
370
193
|
case "end":
|
|
371
|
-
return
|
|
194
|
+
return _context2.stop();
|
|
372
195
|
}
|
|
373
196
|
}, _callee, null, [[4, 15, 18, 21]]);
|
|
374
197
|
}));
|
|
375
198
|
return function (_x) {
|
|
376
|
-
return
|
|
199
|
+
return _ref5.apply(this, arguments);
|
|
377
200
|
};
|
|
378
201
|
}());
|
|
379
|
-
_defineProperty(this, "handleAttributeMutation", function (
|
|
380
|
-
var _this$
|
|
381
|
-
var target =
|
|
382
|
-
attributeName =
|
|
383
|
-
oldValue =
|
|
384
|
-
newValue =
|
|
385
|
-
(_this$
|
|
386
|
-
var target =
|
|
387
|
-
rect =
|
|
202
|
+
_defineProperty(this, "handleAttributeMutation", function (_ref6) {
|
|
203
|
+
var _this$intersectionObs2;
|
|
204
|
+
var target = _ref6.target,
|
|
205
|
+
attributeName = _ref6.attributeName,
|
|
206
|
+
oldValue = _ref6.oldValue,
|
|
207
|
+
newValue = _ref6.newValue;
|
|
208
|
+
(_this$intersectionObs2 = _this.intersectionObserver) === null || _this$intersectionObs2 === void 0 || _this$intersectionObs2.watchAndTag(target, function (_ref7) {
|
|
209
|
+
var target = _ref7.target,
|
|
210
|
+
rect = _ref7.rect;
|
|
388
211
|
if (isContainedWithinMediaWrapper(target)) {
|
|
389
212
|
return {
|
|
390
213
|
type: 'mutation:media',
|
|
@@ -485,14 +308,14 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
485
308
|
};
|
|
486
309
|
});
|
|
487
310
|
});
|
|
488
|
-
_defineProperty(this, "handleLayoutShift", function (
|
|
489
|
-
var time =
|
|
490
|
-
changedRects =
|
|
491
|
-
var
|
|
492
|
-
|
|
311
|
+
_defineProperty(this, "handleLayoutShift", function (_ref8) {
|
|
312
|
+
var time = _ref8.time,
|
|
313
|
+
changedRects = _ref8.changedRects;
|
|
314
|
+
var _iterator2 = _createForOfIteratorHelper(changedRects),
|
|
315
|
+
_step2;
|
|
493
316
|
try {
|
|
494
|
-
for (
|
|
495
|
-
var changedRect =
|
|
317
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
318
|
+
var changedRect = _step2.value;
|
|
496
319
|
var target = changedRect.node;
|
|
497
320
|
if (target) {
|
|
498
321
|
var isSameCurrentAndPreviousRects = isSameRectDimensions(changedRect.rect, changedRect.previousRect);
|
|
@@ -507,9 +330,9 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
507
330
|
}
|
|
508
331
|
}
|
|
509
332
|
} catch (err) {
|
|
510
|
-
|
|
333
|
+
_iterator2.e(err);
|
|
511
334
|
} finally {
|
|
512
|
-
|
|
335
|
+
_iterator2.f();
|
|
513
336
|
}
|
|
514
337
|
});
|
|
515
338
|
this.mapVisibleNodeRects = new WeakMap();
|
|
@@ -566,12 +389,12 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
566
389
|
}, {
|
|
567
390
|
key: "stop",
|
|
568
391
|
value: function stop() {
|
|
569
|
-
var _this$mutationObserve2, _this$
|
|
392
|
+
var _this$mutationObserve2, _this$intersectionObs3, _this$performanceObse2;
|
|
570
393
|
if (!this.isStarted) {
|
|
571
394
|
return;
|
|
572
395
|
}
|
|
573
396
|
(_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 || _this$mutationObserve2.disconnect();
|
|
574
|
-
(_this$
|
|
397
|
+
(_this$intersectionObs3 = this.intersectionObserver) === null || _this$intersectionObs3 === void 0 || _this$intersectionObs3.disconnect();
|
|
575
398
|
(_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 || _this$performanceObse2.disconnect();
|
|
576
399
|
this.isStarted = false;
|
|
577
400
|
// Clean up caches when stopping
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
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; } } }; }
|
|
2
2
|
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; } }
|
|
3
3
|
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; }
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { isZeroDimensionRectangle } from '../utils/is-zero-dimension-rectangle';
|
|
6
5
|
function isValidEntry(entry) {
|
|
7
6
|
return entry.isIntersecting && entry.intersectionRect.width > 0 && entry.intersectionRect.height > 0;
|
|
@@ -21,40 +20,38 @@ export function createIntersectionObserver(_ref) {
|
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
var tagOrCallback = callbacksPerElement.get(entry.target);
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
var tagOrCallbackResult = typeof tagOrCallback === 'function' ? tagOrCallback(props) : tagOrCallback;
|
|
23
|
+
if (isZeroDimensionRectangle(entry.intersectionRect)) {
|
|
24
|
+
var zeroDimensionRectangleTagCallback = function zeroDimensionRectangleTagCallback(props) {
|
|
25
|
+
var tagOrCallbackResult = typeof tagOrCallback === 'function' ? tagOrCallback(props) : tagOrCallback;
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
// override as display-contents mutation
|
|
28
|
+
if (tagOrCallbackResult === 'mutation:element') {
|
|
29
|
+
return 'mutation:display-contents-children-element';
|
|
30
|
+
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
} catch (err) {
|
|
52
|
-
_iterator.e(err);
|
|
53
|
-
} finally {
|
|
54
|
-
_iterator.f();
|
|
32
|
+
// override as display-contents mutation
|
|
33
|
+
if (tagOrCallbackResult && typeof tagOrCallbackResult !== 'string' && tagOrCallbackResult.type === 'mutation:attribute') {
|
|
34
|
+
return {
|
|
35
|
+
type: 'mutation:display-contents-children-attribute',
|
|
36
|
+
mutationData: tagOrCallbackResult.mutationData
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return tagOrCallbackResult;
|
|
40
|
+
};
|
|
41
|
+
var _iterator = _createForOfIteratorHelper(entry.target.children),
|
|
42
|
+
_step;
|
|
43
|
+
try {
|
|
44
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
45
|
+
var child = _step.value;
|
|
46
|
+
observer.observe(child);
|
|
47
|
+
callbacksPerElement.set(child, zeroDimensionRectangleTagCallback);
|
|
55
48
|
}
|
|
56
|
-
|
|
49
|
+
} catch (err) {
|
|
50
|
+
_iterator.e(err);
|
|
51
|
+
} finally {
|
|
52
|
+
_iterator.f();
|
|
57
53
|
}
|
|
54
|
+
return;
|
|
58
55
|
}
|
|
59
56
|
if (!isValidEntry(entry)) {
|
|
60
57
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.18",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -194,9 +194,6 @@
|
|
|
194
194
|
"platform_ufo_enable_vc_raw_data": {
|
|
195
195
|
"type": "boolean"
|
|
196
196
|
},
|
|
197
|
-
"platform_ufo_detect_zero_dimension_rectangles": {
|
|
198
|
-
"type": "boolean"
|
|
199
|
-
},
|
|
200
197
|
"platform_ufo_enable_trimmed_payload": {
|
|
201
198
|
"type": "boolean"
|
|
202
199
|
},
|