@atlaskit/react-ufo 4.14.6 → 4.14.8

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.14.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`60636efa6fba9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/60636efa6fba9) -
8
+ exclude media mutation from ttvc if matching DnD style change, localId and contenteditable
9
+ attribute change, as they are non-visual changes
10
+
11
+ ## 4.14.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [`ae14db0f1f0c7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ae14db0f1f0c7) -
16
+ Add isDnDStyleMutation back to attribute change detection in vc observer
17
+
3
18
  ## 4.14.6
4
19
 
5
20
  ### Patch Changes
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.containsDnDMutationInStyle = containsDnDMutationInStyle;
6
7
  exports.default = void 0;
8
+ exports.isDnDStyleMutation = isDnDStyleMutation;
7
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
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; } } }; }
9
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; } }
@@ -52,6 +54,16 @@ function isDnDStyleMutation(_ref) {
52
54
  if (!(target instanceof Element)) {
53
55
  return false;
54
56
  }
57
+ return containsDnDMutationInStyle({
58
+ attributeName: attributeName,
59
+ oldValue: oldValue,
60
+ newValue: newValue
61
+ });
62
+ }
63
+ function containsDnDMutationInStyle(_ref2) {
64
+ var attributeName = _ref2.attributeName,
65
+ oldValue = _ref2.oldValue,
66
+ newValue = _ref2.newValue;
55
67
  if (attributeName !== 'style') {
56
68
  return false;
57
69
  }
@@ -11,6 +11,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
11
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
+ var _expVal = require("../../../expVal");
15
+ var _isDndStyleMutation = require("../../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation");
14
16
  var _abstractBaseVcCalculator = _interopRequireDefault(require("../abstract-base-vc-calculator"));
15
17
  var _isEntrySmartAnswersInSearch = require("../utils/is-entry-smart-answers-in-search");
16
18
  var _isViewportEntryData = _interopRequireDefault(require("../utils/is-viewport-entry-data"));
@@ -63,9 +65,20 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
63
65
  if (entry.data.type === 'mutation:media' && (0, _platformFeatureFlags.fg)('media-perf-uplift-mutation-fix')) {
64
66
  var entryData = entry.data;
65
67
  var attributeName = entryData.attributeName;
66
- if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt')) {
68
+ if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt' || (attributeName === 'localid' || attributeName === 'contenteditable' || attributeName === 'anchor-name') && (0, _expVal.expVal)('platform_editor_media_vc_fixes', 'isEnabled', false))) {
67
69
  return false;
68
70
  }
71
+
72
+ // special case for style attribute to ignore only anchor-name changes
73
+ if ((0, _expVal.expVal)('platform_editor_media_vc_fixes', 'isEnabled', false)) {
74
+ if ((0, _isDndStyleMutation.containsDnDMutationInStyle)({
75
+ attributeName: entryData.attributeName,
76
+ oldValue: entryData.oldValue,
77
+ newValue: entryData.newValue
78
+ })) {
79
+ return false;
80
+ }
81
+ }
69
82
  }
70
83
  if (entry.data.type === 'mutation:attribute') {
71
84
  var _entryData = entry.data;
@@ -13,6 +13,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
15
  var _vcUtils = require("../../vc-observer/media-wrapper/vc-utils");
16
+ var _isDndStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation"));
16
17
  var _isNonVisualStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation"));
17
18
  var _rllPlaceholders = require("../../vc-observer/observers/rll-placeholders");
18
19
  var _intersectionObserver = require("./intersection-observer");
@@ -317,6 +318,21 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
317
318
  };
318
319
  }
319
320
  }
321
+ if ((0, _isDndStyleMutation.default)({
322
+ target: target,
323
+ attributeName: attributeName,
324
+ oldValue: oldValue,
325
+ newValue: newValue
326
+ })) {
327
+ return {
328
+ type: 'mutation:attribute:non-visual-style',
329
+ mutationData: {
330
+ attributeName: attributeName,
331
+ oldValue: oldValue,
332
+ newValue: newValue
333
+ }
334
+ };
335
+ }
320
336
  if ((0, _isNonVisualStyleMutation.default)({
321
337
  target: target,
322
338
  attributeName: attributeName,
@@ -35,6 +35,17 @@ function isDnDStyleMutation({
35
35
  if (!(target instanceof Element)) {
36
36
  return false;
37
37
  }
38
+ return containsDnDMutationInStyle({
39
+ attributeName,
40
+ oldValue,
41
+ newValue
42
+ });
43
+ }
44
+ function containsDnDMutationInStyle({
45
+ attributeName,
46
+ oldValue,
47
+ newValue
48
+ }) {
38
49
  if (attributeName !== 'style') {
39
50
  return false;
40
51
  }
@@ -59,4 +70,5 @@ function isDnDStyleMutation({
59
70
  }
60
71
  return isDnDMutation;
61
72
  }
62
- export default isDnDStyleMutation;
73
+ export default isDnDStyleMutation;
74
+ export { isDnDStyleMutation, containsDnDMutationInStyle };
@@ -1,4 +1,6 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { expVal } from '../../../expVal';
3
+ import { containsDnDMutationInStyle } from '../../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
2
4
  import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
3
5
  import { isEntrySmartAnswersInSearch } from '../utils/is-entry-smart-answers-in-search';
4
6
  import isViewportEntryData from '../utils/is-viewport-entry-data';
@@ -45,9 +47,20 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
45
47
  if (entry.data.type === 'mutation:media' && fg('media-perf-uplift-mutation-fix')) {
46
48
  const entryData = entry.data;
47
49
  const attributeName = entryData.attributeName;
48
- if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt')) {
50
+ if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt' || (attributeName === 'localid' || attributeName === 'contenteditable' || attributeName === 'anchor-name') && expVal('platform_editor_media_vc_fixes', 'isEnabled', false))) {
49
51
  return false;
50
52
  }
53
+
54
+ // special case for style attribute to ignore only anchor-name changes
55
+ if (expVal('platform_editor_media_vc_fixes', 'isEnabled', false)) {
56
+ if (containsDnDMutationInStyle({
57
+ attributeName: entryData.attributeName,
58
+ oldValue: entryData.oldValue,
59
+ newValue: entryData.newValue
60
+ })) {
61
+ return false;
62
+ }
63
+ }
51
64
  }
52
65
  if (entry.data.type === 'mutation:attribute') {
53
66
  const entryData = entry.data;
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
4
+ import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
4
5
  import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
5
6
  import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
6
7
  import { createIntersectionObserver } from './intersection-observer';
@@ -210,6 +211,21 @@ export default class ViewportObserver {
210
211
  };
211
212
  }
212
213
  }
214
+ if (isDnDStyleMutation({
215
+ target,
216
+ attributeName,
217
+ oldValue,
218
+ newValue
219
+ })) {
220
+ return {
221
+ type: 'mutation:attribute:non-visual-style',
222
+ mutationData: {
223
+ attributeName,
224
+ oldValue,
225
+ newValue
226
+ }
227
+ };
228
+ }
213
229
  if (isNonVisualStyleMutation({
214
230
  target,
215
231
  attributeName,
@@ -46,6 +46,16 @@ function isDnDStyleMutation(_ref) {
46
46
  if (!(target instanceof Element)) {
47
47
  return false;
48
48
  }
49
+ return containsDnDMutationInStyle({
50
+ attributeName: attributeName,
51
+ oldValue: oldValue,
52
+ newValue: newValue
53
+ });
54
+ }
55
+ function containsDnDMutationInStyle(_ref2) {
56
+ var attributeName = _ref2.attributeName,
57
+ oldValue = _ref2.oldValue,
58
+ newValue = _ref2.newValue;
49
59
  if (attributeName !== 'style') {
50
60
  return false;
51
61
  }
@@ -88,4 +98,5 @@ function isDnDStyleMutation(_ref) {
88
98
  }
89
99
  return isDnDMutation;
90
100
  }
91
- export default isDnDStyleMutation;
101
+ export default isDnDStyleMutation;
102
+ export { isDnDStyleMutation, containsDnDMutationInStyle };
@@ -6,6 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
7
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { expVal } from '../../../expVal';
10
+ import { containsDnDMutationInStyle } from '../../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
9
11
  import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
10
12
  import { isEntrySmartAnswersInSearch } from '../utils/is-entry-smart-answers-in-search';
11
13
  import isViewportEntryData from '../utils/is-viewport-entry-data';
@@ -56,9 +58,20 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
56
58
  if (entry.data.type === 'mutation:media' && fg('media-perf-uplift-mutation-fix')) {
57
59
  var entryData = entry.data;
58
60
  var attributeName = entryData.attributeName;
59
- if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt')) {
61
+ if (attributeName && (/data-(test|file|context)-\S+/g.test(attributeName) || attributeName === 'alt' || (attributeName === 'localid' || attributeName === 'contenteditable' || attributeName === 'anchor-name') && expVal('platform_editor_media_vc_fixes', 'isEnabled', false))) {
60
62
  return false;
61
63
  }
64
+
65
+ // special case for style attribute to ignore only anchor-name changes
66
+ if (expVal('platform_editor_media_vc_fixes', 'isEnabled', false)) {
67
+ if (containsDnDMutationInStyle({
68
+ attributeName: entryData.attributeName,
69
+ oldValue: entryData.oldValue,
70
+ newValue: entryData.newValue
71
+ })) {
72
+ return false;
73
+ }
74
+ }
62
75
  }
63
76
  if (entry.data.type === 'mutation:attribute') {
64
77
  var _entryData = entry.data;
@@ -8,6 +8,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
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
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
11
+ import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
11
12
  import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
12
13
  import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
13
14
  import { createIntersectionObserver } from './intersection-observer';
@@ -308,6 +309,21 @@ var ViewportObserver = /*#__PURE__*/function () {
308
309
  };
309
310
  }
310
311
  }
312
+ if (isDnDStyleMutation({
313
+ target: target,
314
+ attributeName: attributeName,
315
+ oldValue: oldValue,
316
+ newValue: newValue
317
+ })) {
318
+ return {
319
+ type: 'mutation:attribute:non-visual-style',
320
+ mutationData: {
321
+ attributeName: attributeName,
322
+ oldValue: oldValue,
323
+ newValue: newValue
324
+ }
325
+ };
326
+ }
311
327
  if (isNonVisualStyleMutation({
312
328
  target: target,
313
329
  attributeName: attributeName,
@@ -11,4 +11,10 @@ declare function isDnDStyleMutation({ target, attributeName, oldValue, newValue,
11
11
  oldValue?: string | undefined | null;
12
12
  newValue?: string | undefined | null;
13
13
  }): boolean;
14
+ declare function containsDnDMutationInStyle({ attributeName, oldValue, newValue, }: {
15
+ attributeName?: string | null;
16
+ oldValue?: string | undefined | null;
17
+ newValue?: string | undefined | null;
18
+ }): boolean;
14
19
  export default isDnDStyleMutation;
20
+ export { isDnDStyleMutation, containsDnDMutationInStyle };
@@ -11,4 +11,10 @@ declare function isDnDStyleMutation({ target, attributeName, oldValue, newValue,
11
11
  oldValue?: string | undefined | null;
12
12
  newValue?: string | undefined | null;
13
13
  }): boolean;
14
+ declare function containsDnDMutationInStyle({ attributeName, oldValue, newValue, }: {
15
+ attributeName?: string | null;
16
+ oldValue?: string | undefined | null;
17
+ newValue?: string | undefined | null;
18
+ }): boolean;
14
19
  export default isDnDStyleMutation;
20
+ export { isDnDStyleMutation, containsDnDMutationInStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.14.6",
3
+ "version": "4.14.8",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",