@atlaskit/react-ufo 5.0.12 → 5.0.13
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 +7 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +0 -3
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +0 -3
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +0 -3
- package/package.json +1 -4
- package/dist/cjs/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +0 -68
- package/dist/es2019/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +0 -45
- package/dist/esm/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.js +0 -61
- package/dist/types/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.d.ts +0 -6
- package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/utils/get-mutated-elements.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 5.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3f0729c82ac47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3f0729c82ac47) -
|
|
8
|
+
FG cleanup - platform_ufo_disable_vcnext_observations, remove getMutatedElements fn
|
|
9
|
+
|
|
3
10
|
## 5.0.12
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -349,9 +349,6 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
349
349
|
}, {
|
|
350
350
|
key: "getEffectiveBoundingRect",
|
|
351
351
|
value: function getEffectiveBoundingRect(el) {
|
|
352
|
-
if ((0, _platformFeatureFlags.fg)('platform_ufo_disable_vcnext_observations')) {
|
|
353
|
-
return el.getBoundingClientRect();
|
|
354
|
-
}
|
|
355
352
|
var computedStyle = window.getComputedStyle(el);
|
|
356
353
|
|
|
357
354
|
// If element has display: contents, collect bounding rect from children
|
|
@@ -296,9 +296,6 @@ export class SSRPlaceholderHandlers {
|
|
|
296
296
|
* by collecting dimensions from their children instead
|
|
297
297
|
*/
|
|
298
298
|
getEffectiveBoundingRect(el) {
|
|
299
|
-
if (fg('platform_ufo_disable_vcnext_observations')) {
|
|
300
|
-
return el.getBoundingClientRect();
|
|
301
|
-
}
|
|
302
299
|
const computedStyle = window.getComputedStyle(el);
|
|
303
300
|
|
|
304
301
|
// If element has display: contents, collect bounding rect from children
|
|
@@ -342,9 +342,6 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
342
342
|
}, {
|
|
343
343
|
key: "getEffectiveBoundingRect",
|
|
344
344
|
value: function getEffectiveBoundingRect(el) {
|
|
345
|
-
if (fg('platform_ufo_disable_vcnext_observations')) {
|
|
346
|
-
return el.getBoundingClientRect();
|
|
347
|
-
}
|
|
348
345
|
var computedStyle = window.getComputedStyle(el);
|
|
349
346
|
|
|
350
347
|
// If element has display: contents, collect bounding rect from children
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.13",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -115,9 +115,6 @@
|
|
|
115
115
|
"platform_ufo_critical_metrics_payload": {
|
|
116
116
|
"type": "boolean"
|
|
117
117
|
},
|
|
118
|
-
"platform_ufo_disable_vcnext_observations": {
|
|
119
|
-
"type": "boolean"
|
|
120
|
-
},
|
|
121
118
|
"platform_ufo_exclude_3p_elements_from_ttai": {
|
|
122
119
|
"type": "boolean"
|
|
123
120
|
},
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getMutatedElements = getMutatedElements;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
-
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; } } }; }
|
|
11
|
-
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; } }
|
|
12
|
-
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; }
|
|
13
|
-
function isElementStyledWithDisplayContents(element) {
|
|
14
|
-
var _window2;
|
|
15
|
-
// To minimise calling `getComputedStyle`, we are making an assumption that if an element is from the Entrypoints framework, then it will have `display: contents` styling
|
|
16
|
-
// as per https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/e4ccf437262ef4c0fd3c651ffb7ad4770b15aed4/jira/src/packages/platform/entry-points/entry-point-placeholder/src/index.tsx#lines-136
|
|
17
|
-
if ((0, _platformFeatureFlags.fg)('platform_ufo_detect_entrypoint_parent')) {
|
|
18
|
-
var _window;
|
|
19
|
-
if (element.hasAttribute('data-ep-placeholder-id')) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return ((_window = window) === null || _window === void 0 || (_window = _window.getComputedStyle(element)) === null || _window === void 0 ? void 0 : _window.display) === 'contents';
|
|
23
|
-
}
|
|
24
|
-
return ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(element)) === null || _window2 === void 0 ? void 0 : _window2.display) === 'contents';
|
|
25
|
-
}
|
|
26
|
-
var MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED = 3;
|
|
27
|
-
function getMutatedElements(element) {
|
|
28
|
-
var depthLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
29
|
-
if ((0, _platformFeatureFlags.fg)('platform_ufo_disable_vcnext_observations')) {
|
|
30
|
-
return [{
|
|
31
|
-
element: element,
|
|
32
|
-
isDisplayContentsElementChildren: false
|
|
33
|
-
}];
|
|
34
|
-
}
|
|
35
|
-
if (isElementStyledWithDisplayContents(element)) {
|
|
36
|
-
var mutatedElements = [];
|
|
37
|
-
var nestedDisplayContentsElementChildren = [];
|
|
38
|
-
var _iterator = _createForOfIteratorHelper(element.children),
|
|
39
|
-
_step;
|
|
40
|
-
try {
|
|
41
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
42
|
-
var child = _step.value;
|
|
43
|
-
if (isElementStyledWithDisplayContents(child)) {
|
|
44
|
-
nestedDisplayContentsElementChildren.push(child);
|
|
45
|
-
}
|
|
46
|
-
mutatedElements.push({
|
|
47
|
-
element: child,
|
|
48
|
-
isDisplayContentsElementChildren: true
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
} catch (err) {
|
|
52
|
-
_iterator.e(err);
|
|
53
|
-
} finally {
|
|
54
|
-
_iterator.f();
|
|
55
|
-
}
|
|
56
|
-
if (depthLevel < MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED && nestedDisplayContentsElementChildren.length > 0) {
|
|
57
|
-
return [].concat(mutatedElements, (0, _toConsumableArray2.default)(nestedDisplayContentsElementChildren.map(function (element) {
|
|
58
|
-
return getMutatedElements(element, depthLevel + 1);
|
|
59
|
-
}).flat()));
|
|
60
|
-
}
|
|
61
|
-
return mutatedElements;
|
|
62
|
-
} else {
|
|
63
|
-
return [{
|
|
64
|
-
element: element,
|
|
65
|
-
isDisplayContentsElementChildren: false
|
|
66
|
-
}];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
function isElementStyledWithDisplayContents(element) {
|
|
3
|
-
var _window2, _window2$getComputedS;
|
|
4
|
-
// To minimise calling `getComputedStyle`, we are making an assumption that if an element is from the Entrypoints framework, then it will have `display: contents` styling
|
|
5
|
-
// as per https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/e4ccf437262ef4c0fd3c651ffb7ad4770b15aed4/jira/src/packages/platform/entry-points/entry-point-placeholder/src/index.tsx#lines-136
|
|
6
|
-
if (fg('platform_ufo_detect_entrypoint_parent')) {
|
|
7
|
-
var _window, _window$getComputedSt;
|
|
8
|
-
if (element.hasAttribute('data-ep-placeholder-id')) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$getComputedSt = _window.getComputedStyle(element)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.display) === 'contents';
|
|
12
|
-
}
|
|
13
|
-
return ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$getComputedS = _window2.getComputedStyle(element)) === null || _window2$getComputedS === void 0 ? void 0 : _window2$getComputedS.display) === 'contents';
|
|
14
|
-
}
|
|
15
|
-
const MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED = 3;
|
|
16
|
-
export function getMutatedElements(element, depthLevel = 0) {
|
|
17
|
-
if (fg('platform_ufo_disable_vcnext_observations')) {
|
|
18
|
-
return [{
|
|
19
|
-
element,
|
|
20
|
-
isDisplayContentsElementChildren: false
|
|
21
|
-
}];
|
|
22
|
-
}
|
|
23
|
-
if (isElementStyledWithDisplayContents(element)) {
|
|
24
|
-
const mutatedElements = [];
|
|
25
|
-
const nestedDisplayContentsElementChildren = [];
|
|
26
|
-
for (const child of element.children) {
|
|
27
|
-
if (isElementStyledWithDisplayContents(child)) {
|
|
28
|
-
nestedDisplayContentsElementChildren.push(child);
|
|
29
|
-
}
|
|
30
|
-
mutatedElements.push({
|
|
31
|
-
element: child,
|
|
32
|
-
isDisplayContentsElementChildren: true
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (depthLevel < MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED && nestedDisplayContentsElementChildren.length > 0) {
|
|
36
|
-
return [...mutatedElements, ...nestedDisplayContentsElementChildren.map(element => getMutatedElements(element, depthLevel + 1)).flat()];
|
|
37
|
-
}
|
|
38
|
-
return mutatedElements;
|
|
39
|
-
} else {
|
|
40
|
-
return [{
|
|
41
|
-
element,
|
|
42
|
-
isDisplayContentsElementChildren: false
|
|
43
|
-
}];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
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; } } }; }
|
|
3
|
-
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; } }
|
|
4
|
-
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; }
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
function isElementStyledWithDisplayContents(element) {
|
|
7
|
-
var _window2;
|
|
8
|
-
// To minimise calling `getComputedStyle`, we are making an assumption that if an element is from the Entrypoints framework, then it will have `display: contents` styling
|
|
9
|
-
// as per https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/e4ccf437262ef4c0fd3c651ffb7ad4770b15aed4/jira/src/packages/platform/entry-points/entry-point-placeholder/src/index.tsx#lines-136
|
|
10
|
-
if (fg('platform_ufo_detect_entrypoint_parent')) {
|
|
11
|
-
var _window;
|
|
12
|
-
if (element.hasAttribute('data-ep-placeholder-id')) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return ((_window = window) === null || _window === void 0 || (_window = _window.getComputedStyle(element)) === null || _window === void 0 ? void 0 : _window.display) === 'contents';
|
|
16
|
-
}
|
|
17
|
-
return ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(element)) === null || _window2 === void 0 ? void 0 : _window2.display) === 'contents';
|
|
18
|
-
}
|
|
19
|
-
var MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED = 3;
|
|
20
|
-
export function getMutatedElements(element) {
|
|
21
|
-
var depthLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
22
|
-
if (fg('platform_ufo_disable_vcnext_observations')) {
|
|
23
|
-
return [{
|
|
24
|
-
element: element,
|
|
25
|
-
isDisplayContentsElementChildren: false
|
|
26
|
-
}];
|
|
27
|
-
}
|
|
28
|
-
if (isElementStyledWithDisplayContents(element)) {
|
|
29
|
-
var mutatedElements = [];
|
|
30
|
-
var nestedDisplayContentsElementChildren = [];
|
|
31
|
-
var _iterator = _createForOfIteratorHelper(element.children),
|
|
32
|
-
_step;
|
|
33
|
-
try {
|
|
34
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
35
|
-
var child = _step.value;
|
|
36
|
-
if (isElementStyledWithDisplayContents(child)) {
|
|
37
|
-
nestedDisplayContentsElementChildren.push(child);
|
|
38
|
-
}
|
|
39
|
-
mutatedElements.push({
|
|
40
|
-
element: child,
|
|
41
|
-
isDisplayContentsElementChildren: true
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
} catch (err) {
|
|
45
|
-
_iterator.e(err);
|
|
46
|
-
} finally {
|
|
47
|
-
_iterator.f();
|
|
48
|
-
}
|
|
49
|
-
if (depthLevel < MAX_NESTED_LEVELS_OF_DISPLAY_CONTENT_ELEMENTS_HANDLED && nestedDisplayContentsElementChildren.length > 0) {
|
|
50
|
-
return [].concat(mutatedElements, _toConsumableArray(nestedDisplayContentsElementChildren.map(function (element) {
|
|
51
|
-
return getMutatedElements(element, depthLevel + 1);
|
|
52
|
-
}).flat()));
|
|
53
|
-
}
|
|
54
|
-
return mutatedElements;
|
|
55
|
-
} else {
|
|
56
|
-
return [{
|
|
57
|
-
element: element,
|
|
58
|
-
isDisplayContentsElementChildren: false
|
|
59
|
-
}];
|
|
60
|
-
}
|
|
61
|
-
}
|