@atlaskit/react-ufo 4.12.0 → 4.12.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,20 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.12.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`62fd2a70c6b2a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/62fd2a70c6b2a) -
8
+ FG cleanup - platform_ufo_vc_next_filter_ls_entries_same_rect
9
+
10
+ ## 4.12.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`eec573b4a7a6a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eec573b4a7a6a) -
15
+ Excluded data-test* data-file* and data-context\* attributes from media fy25_03 as they are non
16
+ visual change required internally for testing and supporting copy and paste functionality
17
+
3
18
  ## 4.12.0
4
19
 
5
20
  ### Minor Changes
@@ -19,12 +19,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
19
19
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
20
20
  var REVISION_NO = 'fy25.03';
21
21
  var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
22
- var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'window:event'];
23
-
24
- // in rolling this out, still include it in TTVC v3
25
- if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
26
- entryTypes.push('layout-shift:same-rect');
27
- }
22
+ var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'layout-shift:same-rect', 'window:event'];
28
23
 
29
24
  // If not exclude 3p elements from ttvc,
30
25
  // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
@@ -64,13 +59,20 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
64
59
  if (excludeSmartAnswersInSearch && (0, _isEntrySmartAnswersInSearch.isEntrySmartAnswersInSearch)(entry)) {
65
60
  return false;
66
61
  }
67
- if (entry.data.type === 'mutation:attribute') {
62
+ if (entry.data.type === 'mutation:media' && (0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix')) {
68
63
  var entryData = entry.data;
69
64
  var attributeName = entryData.attributeName;
70
- if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
65
+ if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt')) {
66
+ return false;
67
+ }
68
+ }
69
+ if (entry.data.type === 'mutation:attribute') {
70
+ var _entryData = entry.data;
71
+ var _attributeName = _entryData.attributeName;
72
+ if (!_attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(_attributeName)) {
71
73
  return false;
72
74
  }
73
- if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || attributeName === 'contenteditable' || attributeName === 'data-has-collab-initialised' || attributeName === 'translate' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName) || THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES.includes(attributeName) && (0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_extensions_from_ttvc')) {
75
+ if (_attributeName.startsWith('data-test') || _attributeName === 'data-aui-version' || _attributeName === 'data-testid' || _attributeName === 'data-vc' || _attributeName === 'data-ssr-placeholder' || _attributeName === 'data-ssr-placeholder-replace' || _attributeName === 'data-vc-nvs' || _attributeName === 'data-media-vc-wrapper' || _attributeName === 'data-renderer-start-pos' || _attributeName === 'data-table-local-id' || _attributeName === 'spellcheck' || _attributeName === 'data-auto-scrollable' || _attributeName === 'id' || _attributeName === 'tabindex' || _attributeName === 'data-is-ttvc-ready' || _attributeName === 'contenteditable' || _attributeName === 'data-has-collab-initialised' || _attributeName === 'translate' || NON_VISUAL_ARIA_ATTRIBUTES.includes(_attributeName) || THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES.includes(_attributeName) && (0, _platformFeatureFlags.fg)('platform_ufo_exclude_3p_extensions_from_ttvc')) {
74
76
  return false;
75
77
  }
76
78
  return true;
@@ -11,7 +11,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
11
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _vcUtils = require("../../vc-observer/media-wrapper/vc-utils");
16
15
  var _isDndStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation"));
17
16
  var _isNonVisualStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation"));
@@ -360,26 +359,15 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
360
359
  var changedRect = _step3.value;
361
360
  var target = changedRect.node;
362
361
  if (target) {
363
- if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
364
- var isSameCurrentAndPreviousRects = (0, _isSameRectDimensions.isSameRectDimensions)(changedRect.rect, changedRect.previousRect);
365
- _this.onChange({
366
- time: time,
367
- elementRef: new WeakRef(target),
368
- visible: true,
369
- rect: changedRect.rect,
370
- previousRect: changedRect.previousRect,
371
- type: isSameCurrentAndPreviousRects ? 'layout-shift:same-rect' : 'layout-shift'
372
- });
373
- } else {
374
- _this.onChange({
375
- time: time,
376
- elementRef: new WeakRef(target),
377
- visible: true,
378
- rect: changedRect.rect,
379
- previousRect: changedRect.previousRect,
380
- type: 'layout-shift'
381
- });
382
- }
362
+ var isSameCurrentAndPreviousRects = (0, _isSameRectDimensions.isSameRectDimensions)(changedRect.rect, changedRect.previousRect);
363
+ _this.onChange({
364
+ time: time,
365
+ elementRef: new WeakRef(target),
366
+ visible: true,
367
+ rect: changedRect.rect,
368
+ previousRect: changedRect.previousRect,
369
+ type: isSameCurrentAndPreviousRects ? 'layout-shift:same-rect' : 'layout-shift'
370
+ });
383
371
  }
384
372
  }
385
373
  } catch (err) {
@@ -5,12 +5,7 @@ import isViewportEntryData from '../utils/is-viewport-entry-data';
5
5
  const ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
6
6
  const REVISION_NO = 'fy25.03';
7
7
  const getConsideredEntryTypes = include3p => {
8
- const entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'window:event'];
9
-
10
- // in rolling this out, still include it in TTVC v3
11
- if (fg('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
12
- entryTypes.push('layout-shift:same-rect');
13
- }
8
+ const entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'layout-shift:same-rect', 'window:event'];
14
9
 
15
10
  // If not exclude 3p elements from ttvc,
16
11
  // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
@@ -46,6 +41,13 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
46
41
  if (excludeSmartAnswersInSearch && isEntrySmartAnswersInSearch(entry)) {
47
42
  return false;
48
43
  }
44
+ if (entry.data.type === 'mutation:media' && fg('media-perf-uplift-mutation-fix')) {
45
+ const entryData = entry.data;
46
+ const attributeName = entryData.attributeName;
47
+ if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt')) {
48
+ return false;
49
+ }
50
+ }
49
51
  if (entry.data.type === 'mutation:attribute') {
50
52
  const entryData = entry.data;
51
53
  const attributeName = entryData.attributeName;
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
4
3
  import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
5
4
  import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
@@ -263,26 +262,15 @@ export default class ViewportObserver {
263
262
  for (const changedRect of changedRects) {
264
263
  const target = changedRect.node;
265
264
  if (target) {
266
- if (fg('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
267
- const isSameCurrentAndPreviousRects = isSameRectDimensions(changedRect.rect, changedRect.previousRect);
268
- this.onChange({
269
- time,
270
- elementRef: new WeakRef(target),
271
- visible: true,
272
- rect: changedRect.rect,
273
- previousRect: changedRect.previousRect,
274
- type: isSameCurrentAndPreviousRects ? 'layout-shift:same-rect' : 'layout-shift'
275
- });
276
- } else {
277
- this.onChange({
278
- time,
279
- elementRef: new WeakRef(target),
280
- visible: true,
281
- rect: changedRect.rect,
282
- previousRect: changedRect.previousRect,
283
- type: 'layout-shift'
284
- });
285
- }
265
+ const isSameCurrentAndPreviousRects = isSameRectDimensions(changedRect.rect, changedRect.previousRect);
266
+ this.onChange({
267
+ time,
268
+ elementRef: new WeakRef(target),
269
+ visible: true,
270
+ rect: changedRect.rect,
271
+ previousRect: changedRect.previousRect,
272
+ type: isSameCurrentAndPreviousRects ? 'layout-shift:same-rect' : 'layout-shift'
273
+ });
286
274
  }
287
275
  }
288
276
  });
@@ -12,12 +12,7 @@ import isViewportEntryData from '../utils/is-viewport-entry-data';
12
12
  var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
13
13
  var REVISION_NO = 'fy25.03';
14
14
  var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
15
- var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'window:event'];
16
-
17
- // in rolling this out, still include it in TTVC v3
18
- if (fg('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
19
- entryTypes.push('layout-shift:same-rect');
20
- }
15
+ var entryTypes = ['mutation:child-element', 'mutation:element', 'mutation:attribute', 'layout-shift', 'layout-shift:same-rect', 'window:event'];
21
16
 
22
17
  // If not exclude 3p elements from ttvc,
23
18
  // including the tags into the ConsideredEntryTypes so that it won't be ignored for TTVC calculation
@@ -57,13 +52,20 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
57
52
  if (excludeSmartAnswersInSearch && isEntrySmartAnswersInSearch(entry)) {
58
53
  return false;
59
54
  }
60
- if (entry.data.type === 'mutation:attribute') {
55
+ if (entry.data.type === 'mutation:media' && fg('media-perf-uplift-mutation-fix')) {
61
56
  var entryData = entry.data;
62
57
  var attributeName = entryData.attributeName;
63
- if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
58
+ if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt')) {
59
+ return false;
60
+ }
61
+ }
62
+ if (entry.data.type === 'mutation:attribute') {
63
+ var _entryData = entry.data;
64
+ var _attributeName = _entryData.attributeName;
65
+ if (!_attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(_attributeName)) {
64
66
  return false;
65
67
  }
66
- if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || attributeName === 'contenteditable' || attributeName === 'data-has-collab-initialised' || attributeName === 'translate' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName) || THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES.includes(attributeName) && fg('platform_ufo_exclude_3p_extensions_from_ttvc')) {
68
+ if (_attributeName.startsWith('data-test') || _attributeName === 'data-aui-version' || _attributeName === 'data-testid' || _attributeName === 'data-vc' || _attributeName === 'data-ssr-placeholder' || _attributeName === 'data-ssr-placeholder-replace' || _attributeName === 'data-vc-nvs' || _attributeName === 'data-media-vc-wrapper' || _attributeName === 'data-renderer-start-pos' || _attributeName === 'data-table-local-id' || _attributeName === 'spellcheck' || _attributeName === 'data-auto-scrollable' || _attributeName === 'id' || _attributeName === 'tabindex' || _attributeName === 'data-is-ttvc-ready' || _attributeName === 'contenteditable' || _attributeName === 'data-has-collab-initialised' || _attributeName === 'translate' || NON_VISUAL_ARIA_ATTRIBUTES.includes(_attributeName) || THIRD_PARTY_BROWSER_EXTENSION_ATTRIBUTES.includes(_attributeName) && fg('platform_ufo_exclude_3p_extensions_from_ttvc')) {
67
69
  return false;
68
70
  }
69
71
  return true;
@@ -6,7 +6,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  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; } } }; }
7
7
  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; } }
8
8
  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; }
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
11
10
  import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
12
11
  import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
@@ -351,26 +350,15 @@ var ViewportObserver = /*#__PURE__*/function () {
351
350
  var changedRect = _step3.value;
352
351
  var target = changedRect.node;
353
352
  if (target) {
354
- if (fg('platform_ufo_vc_next_filter_ls_entries_same_rect')) {
355
- var isSameCurrentAndPreviousRects = isSameRectDimensions(changedRect.rect, changedRect.previousRect);
356
- _this.onChange({
357
- time: time,
358
- elementRef: new WeakRef(target),
359
- visible: true,
360
- rect: changedRect.rect,
361
- previousRect: changedRect.previousRect,
362
- type: isSameCurrentAndPreviousRects ? 'layout-shift:same-rect' : 'layout-shift'
363
- });
364
- } else {
365
- _this.onChange({
366
- time: time,
367
- elementRef: new WeakRef(target),
368
- visible: true,
369
- rect: changedRect.rect,
370
- previousRect: changedRect.previousRect,
371
- type: 'layout-shift'
372
- });
373
- }
353
+ var isSameCurrentAndPreviousRects = isSameRectDimensions(changedRect.rect, changedRect.previousRect);
354
+ _this.onChange({
355
+ time: time,
356
+ elementRef: new WeakRef(target),
357
+ visible: true,
358
+ rect: changedRect.rect,
359
+ previousRect: changedRect.previousRect,
360
+ type: isSameCurrentAndPreviousRects ? 'layout-shift:same-rect' : 'layout-shift'
361
+ });
374
362
  }
375
363
  }
376
364
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.12.0",
3
+ "version": "4.12.2",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -85,9 +85,6 @@
85
85
  "platform_ufo_canvas_heatmap_full_precision": {
86
86
  "type": "boolean"
87
87
  },
88
- "platform_ufo_vc_next_filter_ls_entries_same_rect": {
89
- "type": "boolean"
90
- },
91
88
  "platform_ufo_enable_media_for_ttvc_v3": {
92
89
  "type": "boolean"
93
90
  },
@@ -162,6 +159,9 @@
162
159
  },
163
160
  "platform_ufo_drop_prior_fg_interactions": {
164
161
  "type": "boolean"
162
+ },
163
+ "media-perf-uplift-mutation-fix": {
164
+ "type": "boolean"
165
165
  }
166
166
  }
167
167
  }