@atlaskit/react-ufo 2.8.1 → 2.9.0
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 +16 -0
- package/dist/cjs/vc/vc-observer/observers/index.js +12 -6
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +7 -2
- package/dist/es2019/vc/vc-observer/observers/index.js +12 -6
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +5 -2
- package/dist/esm/vc/vc-observer/observers/index.js +12 -6
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +7 -2
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#101686](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101686)
|
|
8
|
+
[`e26a94f833e02`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e26a94f833e02) -
|
|
9
|
+
Add fallback error handling for check element visibility VC calculation logic
|
|
10
|
+
|
|
11
|
+
## 2.8.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#101605](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101605)
|
|
16
|
+
[`26580d858329c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/26580d858329c) -
|
|
17
|
+
Adjust logic on when to apply getBoundingClientRect check for target rect - handle dummy rect
|
|
18
|
+
|
|
3
19
|
## 2.8.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -19,6 +19,17 @@ var state = {
|
|
|
19
19
|
waitingForFirstRender: 2,
|
|
20
20
|
ignoring: 3
|
|
21
21
|
};
|
|
22
|
+
function isElementVisible(target) {
|
|
23
|
+
if (!target || typeof target.checkVisibility !== 'function') {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
var isVisible = target.checkVisibility({
|
|
27
|
+
contentVisibilityAuto: true,
|
|
28
|
+
opacityProperty: true,
|
|
29
|
+
visibilityProperty: true
|
|
30
|
+
});
|
|
31
|
+
return isVisible;
|
|
32
|
+
}
|
|
22
33
|
function isInsideEditorContainer(target) {
|
|
23
34
|
if (!target || typeof target.closest !== 'function') {
|
|
24
35
|
return false;
|
|
@@ -255,12 +266,7 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
255
266
|
return;
|
|
256
267
|
}
|
|
257
268
|
if ((0, _platformFeatureFlags.fg)('platform-ufo-invisible-element-vc-calculations')) {
|
|
258
|
-
|
|
259
|
-
contentVisibilityAuto: true,
|
|
260
|
-
opacityProperty: true,
|
|
261
|
-
visibilityProperty: true
|
|
262
|
-
});
|
|
263
|
-
if (!isVisible) {
|
|
269
|
+
if (!isElementVisible(target)) {
|
|
264
270
|
data.ignoreReason = 'not-visible';
|
|
265
271
|
}
|
|
266
272
|
}
|
|
@@ -38,7 +38,7 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
38
38
|
var rect = _this.staticPlaceholders.get(staticKey);
|
|
39
39
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
40
40
|
var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
|
|
41
|
-
if (hasSameSizePosition) {
|
|
41
|
+
if (hasSameSizePosition || _this.isDummyRect(rect)) {
|
|
42
42
|
_resolve(hasSameSizePosition);
|
|
43
43
|
} else {
|
|
44
44
|
requestAnimationFrame(function () {
|
|
@@ -62,7 +62,7 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
62
62
|
var _rect = _this.staticPlaceholders.get(key);
|
|
63
63
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
64
64
|
var _hasSameSizePosition2 = _this.hasSameSizePosition(_rect, boundingClientRect);
|
|
65
|
-
if (_hasSameSizePosition2) {
|
|
65
|
+
if (_hasSameSizePosition2 || _this.isDummyRect(_rect)) {
|
|
66
66
|
_resolve2(_hasSameSizePosition2);
|
|
67
67
|
} else {
|
|
68
68
|
requestAnimationFrame(function () {
|
|
@@ -203,5 +203,10 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
203
203
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
204
204
|
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
205
205
|
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "isDummyRect",
|
|
208
|
+
value: function isDummyRect(rect) {
|
|
209
|
+
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
210
|
+
}
|
|
206
211
|
}]);
|
|
207
212
|
}();
|
|
@@ -8,6 +8,17 @@ const state = {
|
|
|
8
8
|
waitingForFirstRender: 2,
|
|
9
9
|
ignoring: 3
|
|
10
10
|
};
|
|
11
|
+
function isElementVisible(target) {
|
|
12
|
+
if (!target || typeof target.checkVisibility !== 'function') {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
const isVisible = target.checkVisibility({
|
|
16
|
+
contentVisibilityAuto: true,
|
|
17
|
+
opacityProperty: true,
|
|
18
|
+
visibilityProperty: true
|
|
19
|
+
});
|
|
20
|
+
return isVisible;
|
|
21
|
+
}
|
|
11
22
|
function isInsideEditorContainer(target) {
|
|
12
23
|
if (!target || typeof target.closest !== 'function') {
|
|
13
24
|
return false;
|
|
@@ -223,12 +234,7 @@ export class Observers {
|
|
|
223
234
|
return;
|
|
224
235
|
}
|
|
225
236
|
if (fg('platform-ufo-invisible-element-vc-calculations')) {
|
|
226
|
-
|
|
227
|
-
contentVisibilityAuto: true,
|
|
228
|
-
opacityProperty: true,
|
|
229
|
-
visibilityProperty: true
|
|
230
|
-
});
|
|
231
|
-
if (!isVisible) {
|
|
237
|
+
if (!isElementVisible(target)) {
|
|
232
238
|
data.ignoreReason = 'not-visible';
|
|
233
239
|
}
|
|
234
240
|
}
|
|
@@ -28,7 +28,7 @@ export class SSRPlaceholderHandlers {
|
|
|
28
28
|
const rect = this.staticPlaceholders.get(staticKey);
|
|
29
29
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
30
30
|
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
31
|
-
if (hasSameSizePosition) {
|
|
31
|
+
if (hasSameSizePosition || this.isDummyRect(rect)) {
|
|
32
32
|
resolve(hasSameSizePosition);
|
|
33
33
|
} else {
|
|
34
34
|
requestAnimationFrame(() => {
|
|
@@ -52,7 +52,7 @@ export class SSRPlaceholderHandlers {
|
|
|
52
52
|
const rect = this.staticPlaceholders.get(key);
|
|
53
53
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
54
54
|
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
55
|
-
if (hasSameSizePosition) {
|
|
55
|
+
if (hasSameSizePosition || this.isDummyRect(rect)) {
|
|
56
56
|
resolve(hasSameSizePosition);
|
|
57
57
|
} else {
|
|
58
58
|
requestAnimationFrame(() => {
|
|
@@ -168,4 +168,7 @@ export class SSRPlaceholderHandlers {
|
|
|
168
168
|
hasSameSizePosition(rect, boundingClientRect) {
|
|
169
169
|
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
170
170
|
}
|
|
171
|
+
isDummyRect(rect) {
|
|
172
|
+
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
173
|
+
}
|
|
171
174
|
}
|
|
@@ -12,6 +12,17 @@ var state = {
|
|
|
12
12
|
waitingForFirstRender: 2,
|
|
13
13
|
ignoring: 3
|
|
14
14
|
};
|
|
15
|
+
function isElementVisible(target) {
|
|
16
|
+
if (!target || typeof target.checkVisibility !== 'function') {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
var isVisible = target.checkVisibility({
|
|
20
|
+
contentVisibilityAuto: true,
|
|
21
|
+
opacityProperty: true,
|
|
22
|
+
visibilityProperty: true
|
|
23
|
+
});
|
|
24
|
+
return isVisible;
|
|
25
|
+
}
|
|
15
26
|
function isInsideEditorContainer(target) {
|
|
16
27
|
if (!target || typeof target.closest !== 'function') {
|
|
17
28
|
return false;
|
|
@@ -248,12 +259,7 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
248
259
|
return;
|
|
249
260
|
}
|
|
250
261
|
if (fg('platform-ufo-invisible-element-vc-calculations')) {
|
|
251
|
-
|
|
252
|
-
contentVisibilityAuto: true,
|
|
253
|
-
opacityProperty: true,
|
|
254
|
-
visibilityProperty: true
|
|
255
|
-
});
|
|
256
|
-
if (!isVisible) {
|
|
262
|
+
if (!isElementVisible(target)) {
|
|
257
263
|
data.ignoreReason = 'not-visible';
|
|
258
264
|
}
|
|
259
265
|
}
|
|
@@ -31,7 +31,7 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
31
31
|
var rect = _this.staticPlaceholders.get(staticKey);
|
|
32
32
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
33
33
|
var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
|
|
34
|
-
if (hasSameSizePosition) {
|
|
34
|
+
if (hasSameSizePosition || _this.isDummyRect(rect)) {
|
|
35
35
|
_resolve(hasSameSizePosition);
|
|
36
36
|
} else {
|
|
37
37
|
requestAnimationFrame(function () {
|
|
@@ -55,7 +55,7 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
55
55
|
var _rect = _this.staticPlaceholders.get(key);
|
|
56
56
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
57
57
|
var _hasSameSizePosition2 = _this.hasSameSizePosition(_rect, boundingClientRect);
|
|
58
|
-
if (_hasSameSizePosition2) {
|
|
58
|
+
if (_hasSameSizePosition2 || _this.isDummyRect(_rect)) {
|
|
59
59
|
_resolve2(_hasSameSizePosition2);
|
|
60
60
|
} else {
|
|
61
61
|
requestAnimationFrame(function () {
|
|
@@ -196,5 +196,10 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
196
196
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
197
197
|
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
198
198
|
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "isDummyRect",
|
|
201
|
+
value: function isDummyRect(rect) {
|
|
202
|
+
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
203
|
+
}
|
|
199
204
|
}]);
|
|
200
205
|
}();
|
|
@@ -20,6 +20,7 @@ export declare class SSRPlaceholderHandlers {
|
|
|
20
20
|
getSize(el: HTMLElement): Promise<Rect>;
|
|
21
21
|
validateReactComponentMatchToPlaceholder(el: HTMLElement): Promise<unknown>;
|
|
22
22
|
hasSameSizePosition(rect: Rect | undefined, boundingClientRect: DOMRectReadOnly): boolean;
|
|
23
|
+
isDummyRect(rect: Rect | undefined): boolean;
|
|
23
24
|
intersectionObserverCallback: ({ target, boundingClientRect }: IntersectionObserverEntry) => void;
|
|
24
25
|
}
|
|
25
26
|
export {};
|
|
@@ -20,6 +20,7 @@ export declare class SSRPlaceholderHandlers {
|
|
|
20
20
|
getSize(el: HTMLElement): Promise<Rect>;
|
|
21
21
|
validateReactComponentMatchToPlaceholder(el: HTMLElement): Promise<unknown>;
|
|
22
22
|
hasSameSizePosition(rect: Rect | undefined, boundingClientRect: DOMRectReadOnly): boolean;
|
|
23
|
+
isDummyRect(rect: Rect | undefined): boolean;
|
|
23
24
|
intersectionObserverCallback: ({ target, boundingClientRect }: IntersectionObserverEntry) => void;
|
|
24
25
|
}
|
|
25
26
|
export {};
|