@atlaskit/react-ufo 5.0.2 → 5.0.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 +7 -0
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +12 -1
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +10 -1
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +12 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,13 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
22
22
|
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; } }
|
|
23
23
|
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; }
|
|
24
24
|
// Create comprehensive debug details including ignored entries
|
|
25
|
+
|
|
26
|
+
// Helper function for reporting ratios
|
|
27
|
+
function roundDecimal(value) {
|
|
28
|
+
var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
29
|
+
var factor = Math.pow(10, decimals);
|
|
30
|
+
return Math.round(value * factor) / factor;
|
|
31
|
+
}
|
|
25
32
|
var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
26
33
|
function AbstractVCCalculatorBase(revisionNo) {
|
|
27
34
|
(0, _classCallCheck2.default)(this, AbstractVCCalculatorBase);
|
|
@@ -72,7 +79,11 @@ var AbstractVCCalculatorBase = exports.default = /*#__PURE__*/function () {
|
|
|
72
79
|
elementName = _step2$value[0],
|
|
73
80
|
rect = _step2$value[1];
|
|
74
81
|
var elementArea = rect.width * rect.height;
|
|
75
|
-
|
|
82
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_round_vc_ratios')) {
|
|
83
|
+
ratios[elementName] = roundDecimal(elementArea / totalViewportArea);
|
|
84
|
+
} else {
|
|
85
|
+
ratios[elementName] = elementArea / totalViewportArea;
|
|
86
|
+
}
|
|
76
87
|
}
|
|
77
88
|
} catch (err) {
|
|
78
89
|
_iterator2.e(err);
|
|
@@ -5,6 +5,11 @@ import getViewportWidth from './utils/get-viewport-width';
|
|
|
5
5
|
|
|
6
6
|
// Create comprehensive debug details including ignored entries
|
|
7
7
|
|
|
8
|
+
// Helper function for reporting ratios
|
|
9
|
+
function roundDecimal(value, decimals = 3) {
|
|
10
|
+
const factor = Math.pow(10, decimals);
|
|
11
|
+
return Math.round(value * factor) / factor;
|
|
12
|
+
}
|
|
8
13
|
export default class AbstractVCCalculatorBase {
|
|
9
14
|
constructor(revisionNo) {
|
|
10
15
|
this.revisionNo = revisionNo;
|
|
@@ -35,7 +40,11 @@ export default class AbstractVCCalculatorBase {
|
|
|
35
40
|
}
|
|
36
41
|
for (const [elementName, rect] of elementRects) {
|
|
37
42
|
const elementArea = rect.width * rect.height;
|
|
38
|
-
|
|
43
|
+
if (fg('platform_ufo_round_vc_ratios')) {
|
|
44
|
+
ratios[elementName] = roundDecimal(elementArea / totalViewportArea);
|
|
45
|
+
} else {
|
|
46
|
+
ratios[elementName] = elementArea / totalViewportArea;
|
|
47
|
+
}
|
|
39
48
|
}
|
|
40
49
|
return ratios;
|
|
41
50
|
}
|
|
@@ -16,6 +16,13 @@ import getViewportHeight from './utils/get-viewport-height';
|
|
|
16
16
|
import getViewportWidth from './utils/get-viewport-width';
|
|
17
17
|
|
|
18
18
|
// Create comprehensive debug details including ignored entries
|
|
19
|
+
|
|
20
|
+
// Helper function for reporting ratios
|
|
21
|
+
function roundDecimal(value) {
|
|
22
|
+
var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
23
|
+
var factor = Math.pow(10, decimals);
|
|
24
|
+
return Math.round(value * factor) / factor;
|
|
25
|
+
}
|
|
19
26
|
var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
20
27
|
function AbstractVCCalculatorBase(revisionNo) {
|
|
21
28
|
_classCallCheck(this, AbstractVCCalculatorBase);
|
|
@@ -66,7 +73,11 @@ var AbstractVCCalculatorBase = /*#__PURE__*/function () {
|
|
|
66
73
|
elementName = _step2$value[0],
|
|
67
74
|
rect = _step2$value[1];
|
|
68
75
|
var elementArea = rect.width * rect.height;
|
|
69
|
-
|
|
76
|
+
if (fg('platform_ufo_round_vc_ratios')) {
|
|
77
|
+
ratios[elementName] = roundDecimal(elementArea / totalViewportArea);
|
|
78
|
+
} else {
|
|
79
|
+
ratios[elementName] = elementArea / totalViewportArea;
|
|
80
|
+
}
|
|
70
81
|
}
|
|
71
82
|
} catch (err) {
|
|
72
83
|
_iterator2.e(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -123,6 +123,9 @@
|
|
|
123
123
|
"platform_ufo_exclude_3p_elements_from_ttai": {
|
|
124
124
|
"type": "boolean"
|
|
125
125
|
},
|
|
126
|
+
"platform_ufo_round_vc_ratios": {
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
126
129
|
"platform_ufo_exclude_3p_elements_from_ttvc": {
|
|
127
130
|
"type": "boolean"
|
|
128
131
|
},
|