@atlaskit/react-ufo 2.8.1 → 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 CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 2.8.1
4
12
 
5
13
  ### Patch Changes
@@ -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
  }();
@@ -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
  }
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.8.1",
3
+ "version": "2.8.2",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",