@atlaskit/react-ufo 4.7.3 → 4.7.5
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 +14 -0
- package/dist/cjs/config/index.js +17 -2
- package/dist/cjs/interaction-metrics/index.js +8 -2
- package/dist/cjs/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.js +115 -0
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +16 -0
- package/dist/es2019/config/index.js +15 -0
- package/dist/es2019/interaction-metrics/index.js +9 -3
- package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.js +80 -0
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +16 -0
- package/dist/esm/config/index.js +16 -2
- package/dist/esm/interaction-metrics/index.js +9 -3
- package/dist/esm/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.js +109 -0
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +16 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.d.ts +14 -0
- package/dist/types-ts4.5/config/index.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.d.ts +14 -0
- package/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1a2a53c0d8141`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1a2a53c0d8141) -
|
|
8
|
+
Ignore style mutations from adding drag and drop anchor names
|
|
9
|
+
|
|
10
|
+
## 4.7.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`5c0461336c286`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c0461336c286) -
|
|
15
|
+
Add config to set finish on transition
|
|
16
|
+
|
|
3
17
|
## 4.7.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/config/index.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.getDoNotAbortActivePressInteractionOnTransition = getDoNotAbortActivePre
|
|
|
13
13
|
exports.getEnabledVCRevisions = getEnabledVCRevisions;
|
|
14
14
|
exports.getExperimentalInteractionRate = getExperimentalInteractionRate;
|
|
15
15
|
exports.getExtraInteractionRate = getExtraInteractionRate;
|
|
16
|
+
exports.getFinishInteractionOnTransition = getFinishInteractionOnTransition;
|
|
16
17
|
exports.getInteractionRate = getInteractionRate;
|
|
17
18
|
exports.getInteractionTimeout = getInteractionTimeout;
|
|
18
19
|
exports.getMinorInteractions = getMinorInteractions;
|
|
@@ -340,14 +341,28 @@ function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
340
341
|
return undefined;
|
|
341
342
|
}
|
|
342
343
|
}
|
|
344
|
+
|
|
345
|
+
// Contains the list of interactions that do not abort on transitions
|
|
346
|
+
function getFinishInteractionOnTransition() {
|
|
347
|
+
try {
|
|
348
|
+
if (!config) {
|
|
349
|
+
return undefined;
|
|
350
|
+
}
|
|
351
|
+
var _config1 = config,
|
|
352
|
+
finishInteractionOnTransition = _config1.finishInteractionOnTransition;
|
|
353
|
+
return finishInteractionOnTransition;
|
|
354
|
+
} catch (e) {
|
|
355
|
+
return undefined;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
343
358
|
var CLEANUP_TIMEOUT = exports.CLEANUP_TIMEOUT = 60 * 1000;
|
|
344
359
|
function getInteractionTimeout(ufoName) {
|
|
345
360
|
try {
|
|
346
361
|
if (!config) {
|
|
347
362
|
return CLEANUP_TIMEOUT;
|
|
348
363
|
}
|
|
349
|
-
var
|
|
350
|
-
interactionTimeout =
|
|
364
|
+
var _config10 = config,
|
|
365
|
+
interactionTimeout = _config10.interactionTimeout;
|
|
351
366
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
352
367
|
return interactionTimeout[ufoName];
|
|
353
368
|
}
|
|
@@ -960,9 +960,15 @@ function abortByNewInteraction(interactionId, interactionName) {
|
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
function abortAll(abortReason, abortedByInteractionName) {
|
|
963
|
+
var activeInteraction = getActiveInteraction();
|
|
964
|
+
var finishInteractions = (0, _config.getFinishInteractionOnTransition)();
|
|
963
965
|
_constants.interactions.forEach(function (interaction, interactionId) {
|
|
964
|
-
var
|
|
965
|
-
|
|
966
|
+
var isActiveInteraction = activeInteraction === interaction;
|
|
967
|
+
var hasFinished = interaction.holdActive.size === 0;
|
|
968
|
+
if (isActiveInteraction && abortReason === 'transition' && interaction.type === 'press' && finishInteractions !== null && finishInteractions !== void 0 && finishInteractions.includes(interaction.ufoName) && (0, _platformFeatureFlags.fg)('platform_ufo_enable_finish_interaction_transition')) {
|
|
969
|
+
hasFinished = true;
|
|
970
|
+
}
|
|
971
|
+
if (!hasFinished) {
|
|
966
972
|
callCancelCallbacks(interaction);
|
|
967
973
|
interaction.abortReason = abortReason;
|
|
968
974
|
if (abortedByInteractionName != null) {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _featureFlagsAccessed = require("../../../../feature-flags-accessed");
|
|
11
|
+
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; } } }; }
|
|
12
|
+
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; } }
|
|
13
|
+
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; }
|
|
14
|
+
// copied from '@atlaskit/tmp-editor-statsig/expVal' to avoid circular dependency
|
|
15
|
+
var expVal = function expVal(experimentName, experimentParam, defaultValue) {
|
|
16
|
+
// If client is not initialized, we return the default value
|
|
17
|
+
if (!_featureGateJsClient.default.initializeCompleted()) {
|
|
18
|
+
return defaultValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils
|
|
22
|
+
var experimentValue = _featureGateJsClient.default.getExperimentValue(experimentName, experimentParam, defaultValue);
|
|
23
|
+
(0, _featureFlagsAccessed.addFeatureFlagAccessed)("".concat(experimentName, ":").concat(experimentParam), experimentValue);
|
|
24
|
+
return experimentValue;
|
|
25
|
+
};
|
|
26
|
+
var isDnDStyleChange = function isDnDStyleChange(style) {
|
|
27
|
+
return style.startsWith('anchor-name: --node-anchor');
|
|
28
|
+
};
|
|
29
|
+
var parseStyleSet = function parseStyleSet(style) {
|
|
30
|
+
if (!style) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
var set = new Set();
|
|
34
|
+
var _iterator = _createForOfIteratorHelper(style.split(';')),
|
|
35
|
+
_step;
|
|
36
|
+
try {
|
|
37
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
38
|
+
var part = _step.value;
|
|
39
|
+
var t = part.trim();
|
|
40
|
+
if (t) {
|
|
41
|
+
set.add(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
_iterator.e(err);
|
|
46
|
+
} finally {
|
|
47
|
+
_iterator.f();
|
|
48
|
+
}
|
|
49
|
+
return set;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
54
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
55
|
+
* This should be removed once DnD has been fixed.
|
|
56
|
+
* @param mutation - The mutation record to check
|
|
57
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
58
|
+
*/
|
|
59
|
+
function isDnDStyleMutation(_ref) {
|
|
60
|
+
var target = _ref.target,
|
|
61
|
+
attributeName = _ref.attributeName,
|
|
62
|
+
oldValue = _ref.oldValue,
|
|
63
|
+
newValue = _ref.newValue;
|
|
64
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (!expVal('platform_editor_tables_scaling_css', 'excludeDnD', false)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!(target instanceof Element)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (attributeName !== 'style') {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
var oldStyles = parseStyleSet(oldValue);
|
|
77
|
+
var newStyles = parseStyleSet(newValue);
|
|
78
|
+
var isDnDMutation = false;
|
|
79
|
+
var _iterator2 = _createForOfIteratorHelper(oldStyles !== null && oldStyles !== void 0 ? oldStyles : []),
|
|
80
|
+
_step2;
|
|
81
|
+
try {
|
|
82
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
83
|
+
var s = _step2.value;
|
|
84
|
+
if (!(newStyles !== null && newStyles !== void 0 && newStyles.has(s))) {
|
|
85
|
+
if (!isDnDStyleChange(s)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
isDnDMutation = true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch (err) {
|
|
92
|
+
_iterator2.e(err);
|
|
93
|
+
} finally {
|
|
94
|
+
_iterator2.f();
|
|
95
|
+
}
|
|
96
|
+
var _iterator3 = _createForOfIteratorHelper(newStyles !== null && newStyles !== void 0 ? newStyles : []),
|
|
97
|
+
_step3;
|
|
98
|
+
try {
|
|
99
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
100
|
+
var _s = _step3.value;
|
|
101
|
+
if (!(oldStyles !== null && oldStyles !== void 0 && oldStyles.has(_s))) {
|
|
102
|
+
if (!isDnDStyleChange(_s)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
isDnDMutation = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} catch (err) {
|
|
109
|
+
_iterator3.e(err);
|
|
110
|
+
} finally {
|
|
111
|
+
_iterator3.f();
|
|
112
|
+
}
|
|
113
|
+
return isDnDMutation;
|
|
114
|
+
}
|
|
115
|
+
var _default = exports.default = isDnDStyleMutation;
|
|
@@ -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");
|
|
@@ -320,6 +321,21 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
320
321
|
}
|
|
321
322
|
};
|
|
322
323
|
}
|
|
324
|
+
if ((0, _isDndStyleMutation.default)({
|
|
325
|
+
target: target,
|
|
326
|
+
attributeName: attributeName,
|
|
327
|
+
oldValue: oldValue,
|
|
328
|
+
newValue: newValue
|
|
329
|
+
})) {
|
|
330
|
+
return {
|
|
331
|
+
type: 'mutation:attribute:non-visual-style',
|
|
332
|
+
mutationData: {
|
|
333
|
+
attributeName: attributeName,
|
|
334
|
+
oldValue: oldValue,
|
|
335
|
+
newValue: newValue
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
323
339
|
if ((0, _isNonVisualStyleMutation.default)({
|
|
324
340
|
target: target,
|
|
325
341
|
attributeName: attributeName,
|
|
@@ -323,6 +323,21 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
323
323
|
return undefined;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
+
|
|
327
|
+
// Contains the list of interactions that do not abort on transitions
|
|
328
|
+
export function getFinishInteractionOnTransition() {
|
|
329
|
+
try {
|
|
330
|
+
if (!config) {
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
const {
|
|
334
|
+
finishInteractionOnTransition
|
|
335
|
+
} = config;
|
|
336
|
+
return finishInteractionOnTransition;
|
|
337
|
+
} catch (e) {
|
|
338
|
+
return undefined;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
326
341
|
export const CLEANUP_TIMEOUT = 60 * 1000;
|
|
327
342
|
export function getInteractionTimeout(ufoName) {
|
|
328
343
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v4 as createUUID } from 'uuid';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import coinflip from '../coinflip';
|
|
4
|
-
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
4
|
+
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getFinishInteractionOnTransition, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
5
5
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
6
6
|
import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
7
7
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
@@ -839,9 +839,15 @@ export function abortByNewInteraction(interactionId, interactionName) {
|
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
export function abortAll(abortReason, abortedByInteractionName) {
|
|
842
|
+
const activeInteraction = getActiveInteraction();
|
|
843
|
+
const finishInteractions = getFinishInteractionOnTransition();
|
|
842
844
|
interactions.forEach((interaction, interactionId) => {
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
+
const isActiveInteraction = activeInteraction === interaction;
|
|
846
|
+
let hasFinished = interaction.holdActive.size === 0;
|
|
847
|
+
if (isActiveInteraction && abortReason === 'transition' && interaction.type === 'press' && finishInteractions !== null && finishInteractions !== void 0 && finishInteractions.includes(interaction.ufoName) && fg('platform_ufo_enable_finish_interaction_transition')) {
|
|
848
|
+
hasFinished = true;
|
|
849
|
+
}
|
|
850
|
+
if (!hasFinished) {
|
|
845
851
|
callCancelCallbacks(interaction);
|
|
846
852
|
interaction.abortReason = abortReason;
|
|
847
853
|
if (abortedByInteractionName != null) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { addFeatureFlagAccessed } from '../../../../feature-flags-accessed';
|
|
4
|
+
|
|
5
|
+
// copied from '@atlaskit/tmp-editor-statsig/expVal' to avoid circular dependency
|
|
6
|
+
const expVal = (experimentName, experimentParam, defaultValue) => {
|
|
7
|
+
// If client is not initialized, we return the default value
|
|
8
|
+
if (!FeatureGates.initializeCompleted()) {
|
|
9
|
+
return defaultValue;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils
|
|
13
|
+
const experimentValue = FeatureGates.getExperimentValue(experimentName, experimentParam, defaultValue);
|
|
14
|
+
addFeatureFlagAccessed(`${experimentName}:${experimentParam}`, experimentValue);
|
|
15
|
+
return experimentValue;
|
|
16
|
+
};
|
|
17
|
+
const isDnDStyleChange = style => {
|
|
18
|
+
return style.startsWith('anchor-name: --node-anchor');
|
|
19
|
+
};
|
|
20
|
+
const parseStyleSet = style => {
|
|
21
|
+
if (!style) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const set = new Set();
|
|
25
|
+
for (const part of style.split(';')) {
|
|
26
|
+
const t = part.trim();
|
|
27
|
+
if (t) {
|
|
28
|
+
set.add(t);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return set;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
36
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
37
|
+
* This should be removed once DnD has been fixed.
|
|
38
|
+
* @param mutation - The mutation record to check
|
|
39
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
40
|
+
*/
|
|
41
|
+
function isDnDStyleMutation({
|
|
42
|
+
target,
|
|
43
|
+
attributeName,
|
|
44
|
+
oldValue,
|
|
45
|
+
newValue
|
|
46
|
+
}) {
|
|
47
|
+
if (!fg('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (!expVal('platform_editor_tables_scaling_css', 'excludeDnD', false)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (!(target instanceof Element)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (attributeName !== 'style') {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const oldStyles = parseStyleSet(oldValue);
|
|
60
|
+
const newStyles = parseStyleSet(newValue);
|
|
61
|
+
let isDnDMutation = false;
|
|
62
|
+
for (const s of oldStyles !== null && oldStyles !== void 0 ? oldStyles : []) {
|
|
63
|
+
if (!(newStyles !== null && newStyles !== void 0 && newStyles.has(s))) {
|
|
64
|
+
if (!isDnDStyleChange(s)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
isDnDMutation = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const s of newStyles !== null && newStyles !== void 0 ? newStyles : []) {
|
|
71
|
+
if (!(oldStyles !== null && oldStyles !== void 0 && oldStyles.has(s))) {
|
|
72
|
+
if (!isDnDStyleChange(s)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
isDnDMutation = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return isDnDMutation;
|
|
79
|
+
}
|
|
80
|
+
export default isDnDStyleMutation;
|
|
@@ -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';
|
|
@@ -223,6 +224,21 @@ export default class ViewportObserver {
|
|
|
223
224
|
}
|
|
224
225
|
};
|
|
225
226
|
}
|
|
227
|
+
if (isDnDStyleMutation({
|
|
228
|
+
target,
|
|
229
|
+
attributeName,
|
|
230
|
+
oldValue,
|
|
231
|
+
newValue
|
|
232
|
+
})) {
|
|
233
|
+
return {
|
|
234
|
+
type: 'mutation:attribute:non-visual-style',
|
|
235
|
+
mutationData: {
|
|
236
|
+
attributeName,
|
|
237
|
+
oldValue,
|
|
238
|
+
newValue
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
226
242
|
if (isNonVisualStyleMutation({
|
|
227
243
|
target,
|
|
228
244
|
attributeName,
|
package/dist/esm/config/index.js
CHANGED
|
@@ -315,14 +315,28 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
315
315
|
return undefined;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
+
|
|
319
|
+
// Contains the list of interactions that do not abort on transitions
|
|
320
|
+
export function getFinishInteractionOnTransition() {
|
|
321
|
+
try {
|
|
322
|
+
if (!config) {
|
|
323
|
+
return undefined;
|
|
324
|
+
}
|
|
325
|
+
var _config1 = config,
|
|
326
|
+
finishInteractionOnTransition = _config1.finishInteractionOnTransition;
|
|
327
|
+
return finishInteractionOnTransition;
|
|
328
|
+
} catch (e) {
|
|
329
|
+
return undefined;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
318
332
|
export var CLEANUP_TIMEOUT = 60 * 1000;
|
|
319
333
|
export function getInteractionTimeout(ufoName) {
|
|
320
334
|
try {
|
|
321
335
|
if (!config) {
|
|
322
336
|
return CLEANUP_TIMEOUT;
|
|
323
337
|
}
|
|
324
|
-
var
|
|
325
|
-
interactionTimeout =
|
|
338
|
+
var _config10 = config,
|
|
339
|
+
interactionTimeout = _config10.interactionTimeout;
|
|
326
340
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
327
341
|
return interactionTimeout[ufoName];
|
|
328
342
|
}
|
|
@@ -11,7 +11,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
11
11
|
import { v4 as createUUID } from 'uuid';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import coinflip from '../coinflip';
|
|
14
|
-
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
14
|
+
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getExtraInteractionRate, getFinishInteractionOnTransition, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
15
15
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
16
16
|
import { sanitizeUfoName, stringifyLabelStackFully } from '../create-payload/common/utils';
|
|
17
17
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
@@ -914,9 +914,15 @@ export function abortByNewInteraction(interactionId, interactionName) {
|
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
export function abortAll(abortReason, abortedByInteractionName) {
|
|
917
|
+
var activeInteraction = getActiveInteraction();
|
|
918
|
+
var finishInteractions = getFinishInteractionOnTransition();
|
|
917
919
|
interactions.forEach(function (interaction, interactionId) {
|
|
918
|
-
var
|
|
919
|
-
|
|
920
|
+
var isActiveInteraction = activeInteraction === interaction;
|
|
921
|
+
var hasFinished = interaction.holdActive.size === 0;
|
|
922
|
+
if (isActiveInteraction && abortReason === 'transition' && interaction.type === 'press' && finishInteractions !== null && finishInteractions !== void 0 && finishInteractions.includes(interaction.ufoName) && fg('platform_ufo_enable_finish_interaction_transition')) {
|
|
923
|
+
hasFinished = true;
|
|
924
|
+
}
|
|
925
|
+
if (!hasFinished) {
|
|
920
926
|
callCancelCallbacks(interaction);
|
|
921
927
|
interaction.abortReason = abortReason;
|
|
922
928
|
if (abortedByInteractionName != null) {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
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; } } }; }
|
|
2
|
+
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; } }
|
|
3
|
+
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; }
|
|
4
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { addFeatureFlagAccessed } from '../../../../feature-flags-accessed';
|
|
7
|
+
|
|
8
|
+
// copied from '@atlaskit/tmp-editor-statsig/expVal' to avoid circular dependency
|
|
9
|
+
var expVal = function expVal(experimentName, experimentParam, defaultValue) {
|
|
10
|
+
// If client is not initialized, we return the default value
|
|
11
|
+
if (!FeatureGates.initializeCompleted()) {
|
|
12
|
+
return defaultValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils
|
|
16
|
+
var experimentValue = FeatureGates.getExperimentValue(experimentName, experimentParam, defaultValue);
|
|
17
|
+
addFeatureFlagAccessed("".concat(experimentName, ":").concat(experimentParam), experimentValue);
|
|
18
|
+
return experimentValue;
|
|
19
|
+
};
|
|
20
|
+
var isDnDStyleChange = function isDnDStyleChange(style) {
|
|
21
|
+
return style.startsWith('anchor-name: --node-anchor');
|
|
22
|
+
};
|
|
23
|
+
var parseStyleSet = function parseStyleSet(style) {
|
|
24
|
+
if (!style) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
var set = new Set();
|
|
28
|
+
var _iterator = _createForOfIteratorHelper(style.split(';')),
|
|
29
|
+
_step;
|
|
30
|
+
try {
|
|
31
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
32
|
+
var part = _step.value;
|
|
33
|
+
var t = part.trim();
|
|
34
|
+
if (t) {
|
|
35
|
+
set.add(t);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
_iterator.e(err);
|
|
40
|
+
} finally {
|
|
41
|
+
_iterator.f();
|
|
42
|
+
}
|
|
43
|
+
return set;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
48
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
49
|
+
* This should be removed once DnD has been fixed.
|
|
50
|
+
* @param mutation - The mutation record to check
|
|
51
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
52
|
+
*/
|
|
53
|
+
function isDnDStyleMutation(_ref) {
|
|
54
|
+
var target = _ref.target,
|
|
55
|
+
attributeName = _ref.attributeName,
|
|
56
|
+
oldValue = _ref.oldValue,
|
|
57
|
+
newValue = _ref.newValue;
|
|
58
|
+
if (!fg('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (!expVal('platform_editor_tables_scaling_css', 'excludeDnD', false)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (!(target instanceof Element)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (attributeName !== 'style') {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
var oldStyles = parseStyleSet(oldValue);
|
|
71
|
+
var newStyles = parseStyleSet(newValue);
|
|
72
|
+
var isDnDMutation = false;
|
|
73
|
+
var _iterator2 = _createForOfIteratorHelper(oldStyles !== null && oldStyles !== void 0 ? oldStyles : []),
|
|
74
|
+
_step2;
|
|
75
|
+
try {
|
|
76
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
77
|
+
var s = _step2.value;
|
|
78
|
+
if (!(newStyles !== null && newStyles !== void 0 && newStyles.has(s))) {
|
|
79
|
+
if (!isDnDStyleChange(s)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
isDnDMutation = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
_iterator2.e(err);
|
|
87
|
+
} finally {
|
|
88
|
+
_iterator2.f();
|
|
89
|
+
}
|
|
90
|
+
var _iterator3 = _createForOfIteratorHelper(newStyles !== null && newStyles !== void 0 ? newStyles : []),
|
|
91
|
+
_step3;
|
|
92
|
+
try {
|
|
93
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
94
|
+
var _s = _step3.value;
|
|
95
|
+
if (!(oldStyles !== null && oldStyles !== void 0 && oldStyles.has(_s))) {
|
|
96
|
+
if (!isDnDStyleChange(_s)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
isDnDMutation = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
_iterator3.e(err);
|
|
104
|
+
} finally {
|
|
105
|
+
_iterator3.f();
|
|
106
|
+
}
|
|
107
|
+
return isDnDMutation;
|
|
108
|
+
}
|
|
109
|
+
export default isDnDStyleMutation;
|
|
@@ -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';
|
|
@@ -311,6 +312,21 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
311
312
|
}
|
|
312
313
|
};
|
|
313
314
|
}
|
|
315
|
+
if (isDnDStyleMutation({
|
|
316
|
+
target: target,
|
|
317
|
+
attributeName: attributeName,
|
|
318
|
+
oldValue: oldValue,
|
|
319
|
+
newValue: newValue
|
|
320
|
+
})) {
|
|
321
|
+
return {
|
|
322
|
+
type: 'mutation:attribute:non-visual-style',
|
|
323
|
+
mutationData: {
|
|
324
|
+
attributeName: attributeName,
|
|
325
|
+
oldValue: oldValue,
|
|
326
|
+
newValue: newValue
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
314
330
|
if (isNonVisualStyleMutation({
|
|
315
331
|
target: target,
|
|
316
332
|
attributeName: attributeName,
|
|
@@ -62,6 +62,7 @@ export type Config = {
|
|
|
62
62
|
readonly minorInteractions?: string[];
|
|
63
63
|
readonly doNotAbortActivePressInteraction?: string[];
|
|
64
64
|
readonly doNotAbortActivePressInteractionOnTransition?: string[];
|
|
65
|
+
readonly finishInteractionOnTransition?: string[];
|
|
65
66
|
readonly awaitBM3TTI?: string[];
|
|
66
67
|
readonly ufoNameOverrides?: UFONameOverride;
|
|
67
68
|
readonly namePrefix?: string;
|
|
@@ -169,6 +170,7 @@ export declare function getUfoNameOverrides(): UFONameOverride | undefined;
|
|
|
169
170
|
export declare function getMinorInteractions(): string[] | undefined;
|
|
170
171
|
export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
|
|
171
172
|
export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
|
|
173
|
+
export declare function getFinishInteractionOnTransition(): string[] | undefined;
|
|
172
174
|
export declare const CLEANUP_TIMEOUT: number;
|
|
173
175
|
export declare function getInteractionTimeout(ufoName: string): number;
|
|
174
176
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
3
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
4
|
+
* This should be removed once DnD has been fixed.
|
|
5
|
+
* @param mutation - The mutation record to check
|
|
6
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
7
|
+
*/
|
|
8
|
+
declare function isDnDStyleMutation({ target, attributeName, oldValue, newValue, }: {
|
|
9
|
+
target?: Node | null;
|
|
10
|
+
attributeName?: string | null;
|
|
11
|
+
oldValue?: string | undefined | null;
|
|
12
|
+
newValue?: string | undefined | null;
|
|
13
|
+
}): boolean;
|
|
14
|
+
export default isDnDStyleMutation;
|
|
@@ -62,6 +62,7 @@ export type Config = {
|
|
|
62
62
|
readonly minorInteractions?: string[];
|
|
63
63
|
readonly doNotAbortActivePressInteraction?: string[];
|
|
64
64
|
readonly doNotAbortActivePressInteractionOnTransition?: string[];
|
|
65
|
+
readonly finishInteractionOnTransition?: string[];
|
|
65
66
|
readonly awaitBM3TTI?: string[];
|
|
66
67
|
readonly ufoNameOverrides?: UFONameOverride;
|
|
67
68
|
readonly namePrefix?: string;
|
|
@@ -173,6 +174,7 @@ export declare function getUfoNameOverrides(): UFONameOverride | undefined;
|
|
|
173
174
|
export declare function getMinorInteractions(): string[] | undefined;
|
|
174
175
|
export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
|
|
175
176
|
export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
|
|
177
|
+
export declare function getFinishInteractionOnTransition(): string[] | undefined;
|
|
176
178
|
export declare const CLEANUP_TIMEOUT: number;
|
|
177
179
|
export declare function getInteractionTimeout(ufoName: string): number;
|
|
178
180
|
export {};
|
package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
3
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
4
|
+
* This should be removed once DnD has been fixed.
|
|
5
|
+
* @param mutation - The mutation record to check
|
|
6
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
7
|
+
*/
|
|
8
|
+
declare function isDnDStyleMutation({ target, attributeName, oldValue, newValue, }: {
|
|
9
|
+
target?: Node | null;
|
|
10
|
+
attributeName?: string | null;
|
|
11
|
+
oldValue?: string | undefined | null;
|
|
12
|
+
newValue?: string | undefined | null;
|
|
13
|
+
}): boolean;
|
|
14
|
+
export default isDnDStyleMutation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.5",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"atlaskit:src": "src/index.ts",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
30
|
+
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
30
31
|
"@atlaskit/interaction-context": "^3.0.0",
|
|
31
32
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
33
|
"@babel/runtime": "^7.0.0",
|
|
@@ -148,6 +149,12 @@
|
|
|
148
149
|
},
|
|
149
150
|
"platform_ufo_enable_late_mutation_label_stacks": {
|
|
150
151
|
"type": "boolean"
|
|
152
|
+
},
|
|
153
|
+
"platform_editor_exclude_dnd_anchor_name_from_ttvc": {
|
|
154
|
+
"type": "boolean"
|
|
155
|
+
},
|
|
156
|
+
"platform_ufo_enable_finish_interaction_transition": {
|
|
157
|
+
"type": "boolean"
|
|
151
158
|
}
|
|
152
159
|
}
|
|
153
160
|
}
|