@atlaskit/react-ufo 3.4.12 → 3.4.14
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/create-payload/utils/get-vc-metrics.js +2 -2
- package/dist/cjs/vc/vc-observer/index.js +13 -4
- package/dist/cjs/vc/vc-observer/observers/index.js +7 -0
- package/dist/cjs/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +35 -0
- package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +1 -1
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +13 -0
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -1
- package/dist/es2019/vc/vc-observer/index.js +5 -4
- package/dist/es2019/vc/vc-observer/observers/index.js +7 -0
- package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +31 -0
- package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +1 -1
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +13 -0
- package/dist/esm/create-payload/utils/get-vc-metrics.js +2 -2
- package/dist/esm/vc/vc-observer/index.js +13 -4
- package/dist/esm/vc/vc-observer/observers/index.js +7 -0
- package/dist/esm/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +30 -0
- package/dist/esm/vc/vc-observer/revisions/fy25_02.js +1 -1
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +13 -0
- package/dist/types/common/vc/types.d.ts +1 -1
- package/dist/types/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +14 -0
- package/dist/types/vc/vc-observer-new/types.d.ts +1 -1
- package/dist/types-ts4.5/common/vc/types.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +14 -0
- package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -1
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 3.4.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136647](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136647)
|
|
8
|
+
[`9d50aee5de4c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d50aee5de4c6) -
|
|
9
|
+
Fix bug on ufo:vc:dom that would include element selector that is ignored
|
|
10
|
+
|
|
11
|
+
## 3.4.13
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#136326](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136326)
|
|
16
|
+
[`df5ce1960f52f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/df5ce1960f52f) -
|
|
17
|
+
add null check for vc90 result
|
|
18
|
+
|
|
3
19
|
## 3.4.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -23,7 +23,7 @@ function getVCMetrics(_x) {
|
|
|
23
23
|
function _getVCMetrics() {
|
|
24
24
|
_getVCMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction) {
|
|
25
25
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
|
|
26
|
-
var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, ttvcV2Revision, VC;
|
|
26
|
+
var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, _result$ufoVcRev, ttvcV2Revision, VC;
|
|
27
27
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
@@ -74,7 +74,7 @@ function _getVCMetrics() {
|
|
|
74
74
|
_context.next = 26;
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
|
-
ttvcV2Revision =
|
|
77
|
+
ttvcV2Revision = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
78
78
|
var revision = _ref.revision;
|
|
79
79
|
return revision === 'fy25.02';
|
|
80
80
|
});
|
|
@@ -663,6 +663,7 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
663
663
|
|
|
664
664
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
665
665
|
var isCalcSpeedIndexEnabled = (0, _platformFeatureFlags.fg)('ufo-calc-speed-index');
|
|
666
|
+
var isFilterIgnoredItemsEnabled = (0, _platformFeatureFlags.fg)('platform_ufo_vc_filter_ignored_items');
|
|
666
667
|
entries.reduce(function () {
|
|
667
668
|
var acc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
668
669
|
var v = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -677,9 +678,13 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
677
678
|
VCObserver.VCParts.forEach(function (key) {
|
|
678
679
|
var value = parseInt(key, 10);
|
|
679
680
|
if ((VC[key] === null || VC[key] === undefined) && VCRatio >= value / 100) {
|
|
680
|
-
var _componentsLog$time;
|
|
681
|
+
var _componentsLog$time, _componentsLog$time2;
|
|
681
682
|
VC[key] = time;
|
|
682
|
-
VCBox[key] = (0, _toConsumableArray2.default)(new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.
|
|
683
|
+
VCBox[key] = isFilterIgnoredItemsEnabled ? (0, _toConsumableArray2.default)(new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.filter(function (v) {
|
|
684
|
+
return !v.ignoreReason;
|
|
685
|
+
}).map(function (v) {
|
|
686
|
+
return v.targetName;
|
|
687
|
+
}))) : (0, _toConsumableArray2.default)(new Set((_componentsLog$time2 = componentsLog[time]) === null || _componentsLog$time2 === void 0 ? void 0 : _componentsLog$time2.map(function (v) {
|
|
683
688
|
return v.targetName;
|
|
684
689
|
})));
|
|
685
690
|
}
|
|
@@ -687,13 +692,17 @@ var VCObserver = exports.VCObserver = /*#__PURE__*/function () {
|
|
|
687
692
|
return VCRatio;
|
|
688
693
|
}, 0);
|
|
689
694
|
var VCEntries = entries.reduce(function (acc, _ref16, i) {
|
|
690
|
-
var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
|
|
695
|
+
var _acc$abs, _componentsLog$timest, _componentsLog$timest2, _acc$rel$vc, _acc$rel;
|
|
691
696
|
var _ref17 = (0, _slicedToArray2.default)(_ref16, 2),
|
|
692
697
|
timestamp = _ref17[0],
|
|
693
698
|
entryPainted = _ref17[1];
|
|
694
699
|
var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
695
700
|
var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
|
|
696
|
-
var logEntry = (0, _toConsumableArray2.default)(new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.
|
|
701
|
+
var logEntry = isFilterIgnoredItemsEnabled ? (0, _toConsumableArray2.default)(new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.filter(function (v) {
|
|
702
|
+
return !v.ignoreReason;
|
|
703
|
+
}).map(function (v) {
|
|
704
|
+
return v.targetName;
|
|
705
|
+
}))) : (0, _toConsumableArray2.default)(new Set((_componentsLog$timest2 = componentsLog[timestamp]) === null || _componentsLog$timest2 === void 0 ? void 0 : _componentsLog$timest2.map(function (v) {
|
|
697
706
|
return v.targetName;
|
|
698
707
|
})));
|
|
699
708
|
var ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
|
|
@@ -12,6 +12,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
12
12
|
var _config = require("../../../config");
|
|
13
13
|
var _vcUtils = require("../media-wrapper/vc-utils");
|
|
14
14
|
var _editorLnv = require("./editor-lnv");
|
|
15
|
+
var _isNonVisualStyleMutation = _interopRequireDefault(require("./non-visual-styles/is-non-visual-style-mutation"));
|
|
15
16
|
var _ssrPlaceholders = require("./ssr-placeholders");
|
|
16
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -224,9 +225,15 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
224
225
|
var oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
225
226
|
var newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
226
227
|
if (oldValue !== newValue) {
|
|
228
|
+
if ((0, _isNonVisualStyleMutation.default)(mutation)) {
|
|
229
|
+
ignoreReason = 'non-visual-style';
|
|
230
|
+
}
|
|
227
231
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
228
232
|
}
|
|
229
233
|
} else {
|
|
234
|
+
if ((0, _isNonVisualStyleMutation.default)(mutation)) {
|
|
235
|
+
ignoreReason = 'non-visual-style';
|
|
236
|
+
}
|
|
230
237
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
231
238
|
}
|
|
232
239
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = isNonVisualStyleMutation;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a mutation record represents a non-visual style change
|
|
10
|
+
* @param mutation - The mutation record to check
|
|
11
|
+
* @returns boolean indicating if this is a non-visual style mutation
|
|
12
|
+
*
|
|
13
|
+
* A mutation is considered non-visual if:
|
|
14
|
+
* - The target has data- vc-nvs="true" attribute
|
|
15
|
+
* - The changed attribute is either 'class' or 'style'
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function isNonVisualStyleMutation(_ref) {
|
|
19
|
+
var target = _ref.target,
|
|
20
|
+
attributeName = _ref.attributeName;
|
|
21
|
+
var isNonVisualStyleMutationEnabled = (0, _platformFeatureFlags.fg)('platform_ufo_non_visual_style_mutation');
|
|
22
|
+
if (!isNonVisualStyleMutationEnabled) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (!(target instanceof Element)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (attributeName !== 'class' && attributeName !== 'style') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (target.getAttribute('data-vc-nvs') !== 'true') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
@@ -27,7 +27,7 @@ var FY25_02Classifier = exports.FY25_02Classifier = /*#__PURE__*/function (_FY25
|
|
|
27
27
|
filter: function filter(_ref) {
|
|
28
28
|
var type = _ref.type,
|
|
29
29
|
ignoreReason = _ref.ignoreReason;
|
|
30
|
-
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible'));
|
|
30
|
+
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible')) && ignoreReason !== 'non-visual-style';
|
|
31
31
|
}
|
|
32
32
|
}]);
|
|
33
33
|
(0, _defineProperty2.default)(_this, "removedFilters", []);
|
|
@@ -8,6 +8,7 @@ exports.default = 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 _vcUtils = require("../../vc-observer/media-wrapper/vc-utils");
|
|
11
|
+
var _isNonVisualStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation"));
|
|
11
12
|
var _intersectionObserver = require("./intersection-observer");
|
|
12
13
|
var _mutationObserver = _interopRequireDefault(require("./mutation-observer"));
|
|
13
14
|
var _performanceObserver = _interopRequireDefault(require("./performance-observer"));
|
|
@@ -127,6 +128,18 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
127
128
|
}
|
|
128
129
|
};
|
|
129
130
|
}
|
|
131
|
+
if ((0, _isNonVisualStyleMutation.default)({
|
|
132
|
+
target: target,
|
|
133
|
+
attributeName: attributeName,
|
|
134
|
+
type: 'attributes'
|
|
135
|
+
})) {
|
|
136
|
+
return {
|
|
137
|
+
type: 'mutation:attribute:non-visual-style',
|
|
138
|
+
mutationData: {
|
|
139
|
+
attributeName: attributeName
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
130
143
|
var lastElementRect = _this.mapVisibleNodeRects.get(target);
|
|
131
144
|
if (lastElementRect && sameRectSize(rect, lastElementRect)) {
|
|
132
145
|
return {
|
|
@@ -40,7 +40,8 @@ export default async function getVCMetrics(interaction) {
|
|
|
40
40
|
}
|
|
41
41
|
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
42
42
|
if (fg('platform_ufo_disable_ttvc_v1')) {
|
|
43
|
-
|
|
43
|
+
var _result$ufoVcRev;
|
|
44
|
+
const ttvcV2Revision = result === null || result === void 0 ? void 0 : (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(({
|
|
44
45
|
revision
|
|
45
46
|
}) => revision === 'fy25.02');
|
|
46
47
|
if (!(ttvcV2Revision !== null && ttvcV2Revision !== void 0 && ttvcV2Revision.clean)) {
|
|
@@ -563,6 +563,7 @@ export class VCObserver {
|
|
|
563
563
|
|
|
564
564
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
565
565
|
const isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
|
|
566
|
+
const isFilterIgnoredItemsEnabled = fg('platform_ufo_vc_filter_ignored_items');
|
|
566
567
|
entries.reduce((acc = 0, v) => {
|
|
567
568
|
const currRatio = v[1] / totalPainted;
|
|
568
569
|
let VCRatio = currRatio + acc;
|
|
@@ -575,18 +576,18 @@ export class VCObserver {
|
|
|
575
576
|
VCObserver.VCParts.forEach(key => {
|
|
576
577
|
const value = parseInt(key, 10);
|
|
577
578
|
if ((VC[key] === null || VC[key] === undefined) && VCRatio >= value / 100) {
|
|
578
|
-
var _componentsLog$time;
|
|
579
|
+
var _componentsLog$time, _componentsLog$time2;
|
|
579
580
|
VC[key] = time;
|
|
580
|
-
VCBox[key] = [...new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.map(v => v.targetName))];
|
|
581
|
+
VCBox[key] = isFilterIgnoredItemsEnabled ? [...new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.filter(v => !v.ignoreReason).map(v => v.targetName))] : [...new Set((_componentsLog$time2 = componentsLog[time]) === null || _componentsLog$time2 === void 0 ? void 0 : _componentsLog$time2.map(v => v.targetName))];
|
|
581
582
|
}
|
|
582
583
|
});
|
|
583
584
|
return VCRatio;
|
|
584
585
|
}, 0);
|
|
585
586
|
const VCEntries = entries.reduce((acc, [timestamp, entryPainted], i) => {
|
|
586
|
-
var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
|
|
587
|
+
var _acc$abs, _componentsLog$timest, _componentsLog$timest2, _acc$rel$vc, _acc$rel;
|
|
587
588
|
const currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
588
589
|
const currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
|
|
589
|
-
const logEntry = [...new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(v => v.targetName))];
|
|
590
|
+
const logEntry = isFilterIgnoredItemsEnabled ? [...new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.filter(v => !v.ignoreReason).map(v => v.targetName))] : [...new Set((_componentsLog$timest2 = componentsLog[timestamp]) === null || _componentsLog$timest2 === void 0 ? void 0 : _componentsLog$timest2.map(v => v.targetName))];
|
|
590
591
|
const ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
|
|
591
592
|
if (isCalcSpeedIndexEnabled) {
|
|
592
593
|
const speedIndex = timestamp * ratioDelta;
|
|
@@ -3,6 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { shouldHandleEditorLnv } from '../../../config';
|
|
4
4
|
import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
|
|
5
5
|
import { EditorLnvHandler } from './editor-lnv';
|
|
6
|
+
import isNonVisualStyleMutation from './non-visual-styles/is-non-visual-style-mutation';
|
|
6
7
|
import { SSRPlaceholderHandlers } from './ssr-placeholders';
|
|
7
8
|
const state = {
|
|
8
9
|
normal: 1,
|
|
@@ -196,9 +197,15 @@ export class Observers {
|
|
|
196
197
|
const oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
197
198
|
const newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
198
199
|
if (oldValue !== newValue) {
|
|
200
|
+
if (isNonVisualStyleMutation(mutation)) {
|
|
201
|
+
ignoreReason = 'non-visual-style';
|
|
202
|
+
}
|
|
199
203
|
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
200
204
|
}
|
|
201
205
|
} else {
|
|
206
|
+
if (isNonVisualStyleMutation(mutation)) {
|
|
207
|
+
ignoreReason = 'non-visual-style';
|
|
208
|
+
}
|
|
202
209
|
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
203
210
|
}
|
|
204
211
|
}
|
package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a mutation record represents a non-visual style change
|
|
5
|
+
* @param mutation - The mutation record to check
|
|
6
|
+
* @returns boolean indicating if this is a non-visual style mutation
|
|
7
|
+
*
|
|
8
|
+
* A mutation is considered non-visual if:
|
|
9
|
+
* - The target has data- vc-nvs="true" attribute
|
|
10
|
+
* - The changed attribute is either 'class' or 'style'
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default function isNonVisualStyleMutation({
|
|
14
|
+
target,
|
|
15
|
+
attributeName
|
|
16
|
+
}) {
|
|
17
|
+
const isNonVisualStyleMutationEnabled = fg('platform_ufo_non_visual_style_mutation');
|
|
18
|
+
if (!isNonVisualStyleMutationEnabled) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (!(target instanceof Element)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (attributeName !== 'class' && attributeName !== 'style') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (target.getAttribute('data-vc-nvs') !== 'true') {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
@@ -25,7 +25,7 @@ export class FY25_02Classifier extends FY25_01Classifier {
|
|
|
25
25
|
type,
|
|
26
26
|
ignoreReason
|
|
27
27
|
}) => {
|
|
28
|
-
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible'));
|
|
28
|
+
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible')) && ignoreReason !== 'non-visual-style';
|
|
29
29
|
}
|
|
30
30
|
}]);
|
|
31
31
|
_defineProperty(this, "removedFilters", []);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
2
|
+
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
2
3
|
import { createIntersectionObserver } from './intersection-observer';
|
|
3
4
|
import createMutationObserver from './mutation-observer';
|
|
4
5
|
import createPerformanceObserver from './performance-observer';
|
|
@@ -113,6 +114,18 @@ export default class ViewportObserver {
|
|
|
113
114
|
}
|
|
114
115
|
};
|
|
115
116
|
}
|
|
117
|
+
if (isNonVisualStyleMutation({
|
|
118
|
+
target,
|
|
119
|
+
attributeName,
|
|
120
|
+
type: 'attributes'
|
|
121
|
+
})) {
|
|
122
|
+
return {
|
|
123
|
+
type: 'mutation:attribute:non-visual-style',
|
|
124
|
+
mutationData: {
|
|
125
|
+
attributeName
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
116
129
|
const lastElementRect = this.mapVisibleNodeRects.get(target);
|
|
117
130
|
if (lastElementRect && sameRectSize(rect, lastElementRect)) {
|
|
118
131
|
return {
|
|
@@ -16,7 +16,7 @@ export default function getVCMetrics(_x) {
|
|
|
16
16
|
function _getVCMetrics() {
|
|
17
17
|
_getVCMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction) {
|
|
18
18
|
var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _config$experimentalI;
|
|
19
|
-
var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, ttvcV2Revision, VC;
|
|
19
|
+
var config, interactionStatus, pageVisibilityUpToTTAI, isSSREnabled, ssr, tti, prefix, result, _result$ufoVcRev, ttvcV2Revision, VC;
|
|
20
20
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
@@ -67,7 +67,7 @@ function _getVCMetrics() {
|
|
|
67
67
|
_context.next = 26;
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
|
-
ttvcV2Revision =
|
|
70
|
+
ttvcV2Revision = result === null || result === void 0 || (_result$ufoVcRev = result['ufo:vc:rev']) === null || _result$ufoVcRev === void 0 ? void 0 : _result$ufoVcRev.find(function (_ref) {
|
|
71
71
|
var revision = _ref.revision;
|
|
72
72
|
return revision === 'fy25.02';
|
|
73
73
|
});
|
|
@@ -656,6 +656,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
656
656
|
|
|
657
657
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
658
658
|
var isCalcSpeedIndexEnabled = fg('ufo-calc-speed-index');
|
|
659
|
+
var isFilterIgnoredItemsEnabled = fg('platform_ufo_vc_filter_ignored_items');
|
|
659
660
|
entries.reduce(function () {
|
|
660
661
|
var acc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
661
662
|
var v = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -670,9 +671,13 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
670
671
|
VCObserver.VCParts.forEach(function (key) {
|
|
671
672
|
var value = parseInt(key, 10);
|
|
672
673
|
if ((VC[key] === null || VC[key] === undefined) && VCRatio >= value / 100) {
|
|
673
|
-
var _componentsLog$time;
|
|
674
|
+
var _componentsLog$time, _componentsLog$time2;
|
|
674
675
|
VC[key] = time;
|
|
675
|
-
VCBox[key] = _toConsumableArray(new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.
|
|
676
|
+
VCBox[key] = isFilterIgnoredItemsEnabled ? _toConsumableArray(new Set((_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.filter(function (v) {
|
|
677
|
+
return !v.ignoreReason;
|
|
678
|
+
}).map(function (v) {
|
|
679
|
+
return v.targetName;
|
|
680
|
+
}))) : _toConsumableArray(new Set((_componentsLog$time2 = componentsLog[time]) === null || _componentsLog$time2 === void 0 ? void 0 : _componentsLog$time2.map(function (v) {
|
|
676
681
|
return v.targetName;
|
|
677
682
|
})));
|
|
678
683
|
}
|
|
@@ -680,13 +685,17 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
680
685
|
return VCRatio;
|
|
681
686
|
}, 0);
|
|
682
687
|
var VCEntries = entries.reduce(function (acc, _ref16, i) {
|
|
683
|
-
var _acc$abs, _componentsLog$timest, _acc$rel$vc, _acc$rel;
|
|
688
|
+
var _acc$abs, _componentsLog$timest, _componentsLog$timest2, _acc$rel$vc, _acc$rel;
|
|
684
689
|
var _ref17 = _slicedToArray(_ref16, 2),
|
|
685
690
|
timestamp = _ref17[0],
|
|
686
691
|
entryPainted = _ref17[1];
|
|
687
692
|
var currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
688
693
|
var currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
|
|
689
|
-
var logEntry = _toConsumableArray(new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.
|
|
694
|
+
var logEntry = isFilterIgnoredItemsEnabled ? _toConsumableArray(new Set((_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.filter(function (v) {
|
|
695
|
+
return !v.ignoreReason;
|
|
696
|
+
}).map(function (v) {
|
|
697
|
+
return v.targetName;
|
|
698
|
+
}))) : _toConsumableArray(new Set((_componentsLog$timest2 = componentsLog[timestamp]) === null || _componentsLog$timest2 === void 0 ? void 0 : _componentsLog$timest2.map(function (v) {
|
|
690
699
|
return v.targetName;
|
|
691
700
|
})));
|
|
692
701
|
var ratioDelta = (currentlyPaintedRatio - ((_acc$rel$vc = (_acc$rel = acc.rel[i - 1]) === null || _acc$rel === void 0 ? void 0 : _acc$rel.vc) !== null && _acc$rel$vc !== void 0 ? _acc$rel$vc : 0)) / 100;
|
|
@@ -7,6 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
7
7
|
import { shouldHandleEditorLnv } from '../../../config';
|
|
8
8
|
import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
|
|
9
9
|
import { EditorLnvHandler } from './editor-lnv';
|
|
10
|
+
import isNonVisualStyleMutation from './non-visual-styles/is-non-visual-style-mutation';
|
|
10
11
|
import { SSRPlaceholderHandlers } from './ssr-placeholders';
|
|
11
12
|
var state = {
|
|
12
13
|
normal: 1,
|
|
@@ -217,9 +218,15 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
217
218
|
var oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
218
219
|
var newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
219
220
|
if (oldValue !== newValue) {
|
|
221
|
+
if (isNonVisualStyleMutation(mutation)) {
|
|
222
|
+
ignoreReason = 'non-visual-style';
|
|
223
|
+
}
|
|
220
224
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
221
225
|
}
|
|
222
226
|
} else {
|
|
227
|
+
if (isNonVisualStyleMutation(mutation)) {
|
|
228
|
+
ignoreReason = 'non-visual-style';
|
|
229
|
+
}
|
|
223
230
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
224
231
|
}
|
|
225
232
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a mutation record represents a non-visual style change
|
|
5
|
+
* @param mutation - The mutation record to check
|
|
6
|
+
* @returns boolean indicating if this is a non-visual style mutation
|
|
7
|
+
*
|
|
8
|
+
* A mutation is considered non-visual if:
|
|
9
|
+
* - The target has data- vc-nvs="true" attribute
|
|
10
|
+
* - The changed attribute is either 'class' or 'style'
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default function isNonVisualStyleMutation(_ref) {
|
|
14
|
+
var target = _ref.target,
|
|
15
|
+
attributeName = _ref.attributeName;
|
|
16
|
+
var isNonVisualStyleMutationEnabled = fg('platform_ufo_non_visual_style_mutation');
|
|
17
|
+
if (!isNonVisualStyleMutationEnabled) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (!(target instanceof Element)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (attributeName !== 'class' && attributeName !== 'style') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (target.getAttribute('data-vc-nvs') !== 'true') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
@@ -20,7 +20,7 @@ export var FY25_02Classifier = /*#__PURE__*/function (_FY25_01Classifier) {
|
|
|
20
20
|
filter: function filter(_ref) {
|
|
21
21
|
var type = _ref.type,
|
|
22
22
|
ignoreReason = _ref.ignoreReason;
|
|
23
|
-
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible'));
|
|
23
|
+
return !(ignoreReason !== null && ignoreReason !== void 0 && ignoreReason.includes('not-visible')) && ignoreReason !== 'non-visual-style';
|
|
24
24
|
}
|
|
25
25
|
}]);
|
|
26
26
|
_defineProperty(_this, "removedFilters", []);
|
|
@@ -4,6 +4,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
4
4
|
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; } }
|
|
5
5
|
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; }
|
|
6
6
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
7
|
+
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
7
8
|
import { createIntersectionObserver } from './intersection-observer';
|
|
8
9
|
import createMutationObserver from './mutation-observer';
|
|
9
10
|
import createPerformanceObserver from './performance-observer';
|
|
@@ -120,6 +121,18 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
123
|
}
|
|
124
|
+
if (isNonVisualStyleMutation({
|
|
125
|
+
target: target,
|
|
126
|
+
attributeName: attributeName,
|
|
127
|
+
type: 'attributes'
|
|
128
|
+
})) {
|
|
129
|
+
return {
|
|
130
|
+
type: 'mutation:attribute:non-visual-style',
|
|
131
|
+
mutationData: {
|
|
132
|
+
attributeName: attributeName
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
123
136
|
var lastElementRect = _this.mapVisibleNodeRects.get(target);
|
|
124
137
|
if (lastElementRect && sameRectSize(rect, lastElementRect)) {
|
|
125
138
|
return {
|
|
@@ -37,7 +37,7 @@ export type VCEntryType = {
|
|
|
37
37
|
vc: number;
|
|
38
38
|
elements: string[];
|
|
39
39
|
};
|
|
40
|
-
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'editor-container-mutation' | '';
|
|
40
|
+
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'editor-container-mutation' | 'non-visual-style' | '';
|
|
41
41
|
export type ComponentsLogEntry = {
|
|
42
42
|
targetName: string;
|
|
43
43
|
__debug__element: WeakRef<Element> | null;
|
package/dist/types/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a mutation record represents a non-visual style change
|
|
3
|
+
* @param mutation - The mutation record to check
|
|
4
|
+
* @returns boolean indicating if this is a non-visual style mutation
|
|
5
|
+
*
|
|
6
|
+
* A mutation is considered non-visual if:
|
|
7
|
+
* - The target has data- vc-nvs="true" attribute
|
|
8
|
+
* - The changed attribute is either 'class' or 'style'
|
|
9
|
+
*/
|
|
10
|
+
export default function isNonVisualStyleMutation({ target, attributeName, }: {
|
|
11
|
+
type: string;
|
|
12
|
+
target?: Node | null;
|
|
13
|
+
attributeName?: string | null;
|
|
14
|
+
}): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ObservedWindowEvent } from './window-event-observer';
|
|
2
|
-
export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute' | 'mutation:media' | 'layout-shift' | 'window:event' | 'unknown';
|
|
2
|
+
export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute:non-visual-style' | 'mutation:attribute' | 'mutation:media' | 'layout-shift' | 'window:event' | 'unknown';
|
|
3
3
|
export type ViewportEntryData = {
|
|
4
4
|
readonly elementName: string;
|
|
5
5
|
readonly rect: DOMRect;
|
|
@@ -37,7 +37,7 @@ export type VCEntryType = {
|
|
|
37
37
|
vc: number;
|
|
38
38
|
elements: string[];
|
|
39
39
|
};
|
|
40
|
-
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'editor-container-mutation' | '';
|
|
40
|
+
export type VCIgnoreReason = 'image' | 'ssr-hydration' | 'editor-lazy-node-view' | 'not-visible' | 'editor-container-mutation' | 'non-visual-style' | '';
|
|
41
41
|
export type ComponentsLogEntry = {
|
|
42
42
|
targetName: string;
|
|
43
43
|
__debug__element: WeakRef<Element> | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a mutation record represents a non-visual style change
|
|
3
|
+
* @param mutation - The mutation record to check
|
|
4
|
+
* @returns boolean indicating if this is a non-visual style mutation
|
|
5
|
+
*
|
|
6
|
+
* A mutation is considered non-visual if:
|
|
7
|
+
* - The target has data- vc-nvs="true" attribute
|
|
8
|
+
* - The changed attribute is either 'class' or 'style'
|
|
9
|
+
*/
|
|
10
|
+
export default function isNonVisualStyleMutation({ target, attributeName, }: {
|
|
11
|
+
type: string;
|
|
12
|
+
target?: Node | null;
|
|
13
|
+
attributeName?: string | null;
|
|
14
|
+
}): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ObservedWindowEvent } from './window-event-observer';
|
|
2
|
-
export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute' | 'mutation:media' | 'layout-shift' | 'window:event' | 'unknown';
|
|
2
|
+
export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute:non-visual-style' | 'mutation:attribute' | 'mutation:media' | 'layout-shift' | 'window:event' | 'unknown';
|
|
3
3
|
export type ViewportEntryData = {
|
|
4
4
|
readonly elementName: string;
|
|
5
5
|
readonly rect: DOMRect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.14",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -183,6 +183,12 @@
|
|
|
183
183
|
},
|
|
184
184
|
"platform_ufo_disable_ttvc_v1": {
|
|
185
185
|
"type": "boolean"
|
|
186
|
+
},
|
|
187
|
+
"platform_ufo_non_visual_style_mutation": {
|
|
188
|
+
"type": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"platform_ufo_vc_filter_ignored_items": {
|
|
191
|
+
"type": "boolean"
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
}
|