@atlaskit/react-ufo 2.5.2 → 2.5.3

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,14 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 2.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#179859](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179859)
8
+ [`3685feff446c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3685feff446c1) -
9
+ Use getBoundingClientRect instead of value from intersectionObserver for the purpose of checking
10
+ layout shift for SSR placeholders.
11
+
3
12
  ## 2.5.2
4
13
 
5
14
  ### Patch Changes
@@ -8,6 +8,7 @@ exports.SSRPlaceholderHandlers = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var EQUALITY_THRESHOLD = 0.1;
12
13
  var ANCESTOR_LOOKUP_LIMIT = 10;
13
14
  var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/function () {
@@ -35,8 +36,16 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
35
36
  return;
36
37
  }
37
38
  var rect = _this.staticPlaceholders.get(staticKey);
38
- var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
39
- _resolve(hasSameSizePosition);
39
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_ssr_ttvc_use_target_rect')) {
40
+ requestAnimationFrame(function () {
41
+ var targetRect = target.getBoundingClientRect();
42
+ var hasSameSizePosition = _this.hasSameSizePosition(rect, targetRect);
43
+ _resolve(hasSameSizePosition);
44
+ });
45
+ } else {
46
+ var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
47
+ _resolve(hasSameSizePosition);
48
+ }
40
49
  _this.callbacks.delete(staticKey);
41
50
  }
42
51
  } else {
@@ -46,8 +55,16 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
46
55
  return;
47
56
  }
48
57
  var _rect = _this.staticPlaceholders.get(key);
49
- var _hasSameSizePosition = _this.hasSameSizePosition(_rect, boundingClientRect);
50
- _resolve2(_hasSameSizePosition);
58
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_ssr_ttvc_use_target_rect')) {
59
+ requestAnimationFrame(function () {
60
+ var targetRect = target.getBoundingClientRect();
61
+ var hasSameSizePosition = _this.hasSameSizePosition(_rect, targetRect);
62
+ _resolve2(hasSameSizePosition);
63
+ });
64
+ } else {
65
+ var _hasSameSizePosition = _this.hasSameSizePosition(_rect, boundingClientRect);
66
+ _resolve2(_hasSameSizePosition);
67
+ }
51
68
  _this.staticPlaceholders.delete(staticKey);
52
69
  _this.reactValidateCallbacks.delete(staticKey);
53
70
  }
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  const EQUALITY_THRESHOLD = 0.1;
3
4
  const ANCESTOR_LOOKUP_LIMIT = 10;
4
5
  export class SSRPlaceholderHandlers {
@@ -25,8 +26,16 @@ export class SSRPlaceholderHandlers {
25
26
  return;
26
27
  }
27
28
  const rect = this.staticPlaceholders.get(staticKey);
28
- const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
29
- resolve(hasSameSizePosition);
29
+ if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
30
+ requestAnimationFrame(() => {
31
+ const targetRect = target.getBoundingClientRect();
32
+ const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
33
+ resolve(hasSameSizePosition);
34
+ });
35
+ } else {
36
+ const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
37
+ resolve(hasSameSizePosition);
38
+ }
30
39
  this.callbacks.delete(staticKey);
31
40
  }
32
41
  } else {
@@ -36,8 +45,16 @@ export class SSRPlaceholderHandlers {
36
45
  return;
37
46
  }
38
47
  const rect = this.staticPlaceholders.get(key);
39
- const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
40
- resolve(hasSameSizePosition);
48
+ if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
49
+ requestAnimationFrame(() => {
50
+ const targetRect = target.getBoundingClientRect();
51
+ const hasSameSizePosition = this.hasSameSizePosition(rect, targetRect);
52
+ resolve(hasSameSizePosition);
53
+ });
54
+ } else {
55
+ const hasSameSizePosition = this.hasSameSizePosition(rect, boundingClientRect);
56
+ resolve(hasSameSizePosition);
57
+ }
41
58
  this.staticPlaceholders.delete(staticKey);
42
59
  this.reactValidateCallbacks.delete(staticKey);
43
60
  }
@@ -1,6 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  var EQUALITY_THRESHOLD = 0.1;
5
6
  var ANCESTOR_LOOKUP_LIMIT = 10;
6
7
  export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
@@ -28,8 +29,16 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
28
29
  return;
29
30
  }
30
31
  var rect = _this.staticPlaceholders.get(staticKey);
31
- var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
32
- _resolve(hasSameSizePosition);
32
+ if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
33
+ requestAnimationFrame(function () {
34
+ var targetRect = target.getBoundingClientRect();
35
+ var hasSameSizePosition = _this.hasSameSizePosition(rect, targetRect);
36
+ _resolve(hasSameSizePosition);
37
+ });
38
+ } else {
39
+ var hasSameSizePosition = _this.hasSameSizePosition(rect, boundingClientRect);
40
+ _resolve(hasSameSizePosition);
41
+ }
33
42
  _this.callbacks.delete(staticKey);
34
43
  }
35
44
  } else {
@@ -39,8 +48,16 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
39
48
  return;
40
49
  }
41
50
  var _rect = _this.staticPlaceholders.get(key);
42
- var _hasSameSizePosition = _this.hasSameSizePosition(_rect, boundingClientRect);
43
- _resolve2(_hasSameSizePosition);
51
+ if (fg('platform_ufo_ssr_ttvc_use_target_rect')) {
52
+ requestAnimationFrame(function () {
53
+ var targetRect = target.getBoundingClientRect();
54
+ var hasSameSizePosition = _this.hasSameSizePosition(_rect, targetRect);
55
+ _resolve2(hasSameSizePosition);
56
+ });
57
+ } else {
58
+ var _hasSameSizePosition = _this.hasSameSizePosition(_rect, boundingClientRect);
59
+ _resolve2(_hasSameSizePosition);
60
+ }
44
61
  _this.staticPlaceholders.delete(staticKey);
45
62
  _this.reactValidateCallbacks.delete(staticKey);
46
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -129,6 +129,9 @@
129
129
  "platform_editor_ed-25937_ignore_mutations_for_ttvc": {
130
130
  "type": "boolean"
131
131
  },
132
+ "platform_ufo_ssr_ttvc_use_target_rect": {
133
+ "type": "boolean"
134
+ },
132
135
  "platform-ufo-invisible-element-vc-calculations": {
133
136
  "type": "boolean"
134
137
  },