@atlaskit/react-ufo 2.8.0 → 2.8.2
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/ssr-placeholders/index.js +28 -13
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +21 -8
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +28 -13
- 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.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#101605](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101605)
|
|
8
|
+
[`26580d858329c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/26580d858329c) -
|
|
9
|
+
Adjust logic on when to apply getBoundingClientRect check for target rect - handle dummy rect
|
|
10
|
+
|
|
11
|
+
## 2.8.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#98925](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98925)
|
|
16
|
+
[`4c9eae0d55227`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4c9eae0d55227) -
|
|
17
|
+
Adjust logic on when to apply getBoundingClientRect check for target rect
|
|
18
|
+
|
|
3
19
|
## 2.8.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -37,14 +37,19 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
37
37
|
}
|
|
38
38
|
var rect = _this.staticPlaceholders.get(staticKey);
|
|
39
39
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var hasSameSizePosition = _this.hasSameSizePosition(rect, targetRect);
|
|
40
|
+
var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
|
|
41
|
+
if (hasSameSizePosition || _this.isDummyRect(rect)) {
|
|
43
42
|
_resolve(hasSameSizePosition);
|
|
44
|
-
}
|
|
43
|
+
} else {
|
|
44
|
+
requestAnimationFrame(function () {
|
|
45
|
+
var targetRect = target.getBoundingClientRect();
|
|
46
|
+
var hasSameSizePosition = _this.hasSameSizePosition(rect, targetRect);
|
|
47
|
+
_resolve(hasSameSizePosition);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
45
50
|
} else {
|
|
46
|
-
var
|
|
47
|
-
_resolve(
|
|
51
|
+
var _hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
|
|
52
|
+
_resolve(_hasSameSizePosition);
|
|
48
53
|
}
|
|
49
54
|
_this.callbacks.delete(staticKey);
|
|
50
55
|
}
|
|
@@ -56,14 +61,19 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
56
61
|
}
|
|
57
62
|
var _rect = _this.staticPlaceholders.get(key);
|
|
58
63
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
var _hasSameSizePosition2 = _this.hasSameSizePosition(_rect, boundingClientRect);
|
|
65
|
+
if (_hasSameSizePosition2 || _this.isDummyRect(_rect)) {
|
|
66
|
+
_resolve2(_hasSameSizePosition2);
|
|
67
|
+
} else {
|
|
68
|
+
requestAnimationFrame(function () {
|
|
69
|
+
var targetRect = target.getBoundingClientRect();
|
|
70
|
+
var hasSameSizePosition = _this.hasSameSizePosition(_rect, targetRect);
|
|
71
|
+
_resolve2(hasSameSizePosition);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
64
74
|
} else {
|
|
65
|
-
var
|
|
66
|
-
_resolve2(
|
|
75
|
+
var _hasSameSizePosition3 = _this.hasSameSizePosition(_rect, boundingClientRect);
|
|
76
|
+
_resolve2(_hasSameSizePosition3);
|
|
67
77
|
}
|
|
68
78
|
_this.staticPlaceholders.delete(staticKey);
|
|
69
79
|
_this.reactValidateCallbacks.delete(staticKey);
|
|
@@ -193,5 +203,10 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
193
203
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
194
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;
|
|
195
205
|
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "isDummyRect",
|
|
208
|
+
value: function isDummyRect(rect) {
|
|
209
|
+
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
210
|
+
}
|
|
196
211
|
}]);
|
|
197
212
|
}();
|
|
@@ -27,11 +27,16 @@ export class SSRPlaceholderHandlers {
|
|
|
27
27
|
}
|
|
28
28
|
const rect = this.staticPlaceholders.get(staticKey);
|
|
29
29
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
|
|
30
|
+
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
31
|
+
if (hasSameSizePosition || this.isDummyRect(rect)) {
|
|
33
32
|
resolve(hasSameSizePosition);
|
|
34
|
-
}
|
|
33
|
+
} else {
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
const targetRect = target.getBoundingClientRect();
|
|
36
|
+
const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
|
|
37
|
+
resolve(hasSameSizePosition);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
35
40
|
} else {
|
|
36
41
|
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
37
42
|
resolve(hasSameSizePosition);
|
|
@@ -46,11 +51,16 @@ export class SSRPlaceholderHandlers {
|
|
|
46
51
|
}
|
|
47
52
|
const rect = this.staticPlaceholders.get(key);
|
|
48
53
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
|
|
54
|
+
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
55
|
+
if (hasSameSizePosition || this.isDummyRect(rect)) {
|
|
52
56
|
resolve(hasSameSizePosition);
|
|
53
|
-
}
|
|
57
|
+
} else {
|
|
58
|
+
requestAnimationFrame(() => {
|
|
59
|
+
const targetRect = target.getBoundingClientRect();
|
|
60
|
+
const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
|
|
61
|
+
resolve(hasSameSizePosition);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
54
64
|
} else {
|
|
55
65
|
const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
|
|
56
66
|
resolve(hasSameSizePosition);
|
|
@@ -158,4 +168,7 @@ export class SSRPlaceholderHandlers {
|
|
|
158
168
|
hasSameSizePosition(rect, boundingClientRect) {
|
|
159
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;
|
|
160
170
|
}
|
|
171
|
+
isDummyRect(rect) {
|
|
172
|
+
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
173
|
+
}
|
|
161
174
|
}
|
|
@@ -30,14 +30,19 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
30
30
|
}
|
|
31
31
|
var rect = _this.staticPlaceholders.get(staticKey);
|
|
32
32
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var hasSameSizePosition = _this.hasSameSizePosition(rect, targetRect);
|
|
33
|
+
var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
|
|
34
|
+
if (hasSameSizePosition || _this.isDummyRect(rect)) {
|
|
36
35
|
_resolve(hasSameSizePosition);
|
|
37
|
-
}
|
|
36
|
+
} else {
|
|
37
|
+
requestAnimationFrame(function () {
|
|
38
|
+
var targetRect = target.getBoundingClientRect();
|
|
39
|
+
var hasSameSizePosition = _this.hasSameSizePosition(rect, targetRect);
|
|
40
|
+
_resolve(hasSameSizePosition);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
38
43
|
} else {
|
|
39
|
-
var
|
|
40
|
-
_resolve(
|
|
44
|
+
var _hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
|
|
45
|
+
_resolve(_hasSameSizePosition);
|
|
41
46
|
}
|
|
42
47
|
_this.callbacks.delete(staticKey);
|
|
43
48
|
}
|
|
@@ -49,14 +54,19 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
49
54
|
}
|
|
50
55
|
var _rect = _this.staticPlaceholders.get(key);
|
|
51
56
|
if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
var _hasSameSizePosition2 = _this.hasSameSizePosition(_rect, boundingClientRect);
|
|
58
|
+
if (_hasSameSizePosition2 || _this.isDummyRect(_rect)) {
|
|
59
|
+
_resolve2(_hasSameSizePosition2);
|
|
60
|
+
} else {
|
|
61
|
+
requestAnimationFrame(function () {
|
|
62
|
+
var targetRect = target.getBoundingClientRect();
|
|
63
|
+
var hasSameSizePosition = _this.hasSameSizePosition(_rect, targetRect);
|
|
64
|
+
_resolve2(hasSameSizePosition);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
57
67
|
} else {
|
|
58
|
-
var
|
|
59
|
-
_resolve2(
|
|
68
|
+
var _hasSameSizePosition3 = _this.hasSameSizePosition(_rect, boundingClientRect);
|
|
69
|
+
_resolve2(_hasSameSizePosition3);
|
|
60
70
|
}
|
|
61
71
|
_this.staticPlaceholders.delete(staticKey);
|
|
62
72
|
_this.reactValidateCallbacks.delete(staticKey);
|
|
@@ -186,5 +196,10 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
186
196
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
187
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;
|
|
188
198
|
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "isDummyRect",
|
|
201
|
+
value: function isDummyRect(rect) {
|
|
202
|
+
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
203
|
+
}
|
|
189
204
|
}]);
|
|
190
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 {};
|