@atlaskit/react-ufo 3.4.9 → 3.4.10
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 +8 -0
- package/dist/cjs/vc/vc-observer/observers/index.js +16 -2
- package/dist/cjs/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/dist/es2019/vc/vc-observer/observers/index.js +16 -2
- package/dist/es2019/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/dist/esm/vc/vc-observer/observers/index.js +16 -2
- package/dist/esm/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 3.4.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#134112](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134112)
|
|
8
|
+
[`b993bf17b9c1b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b993bf17b9c1b) -
|
|
9
|
+
Ignore same value attribute mutation
|
|
10
|
+
|
|
3
11
|
## 3.4.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -211,13 +211,27 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
|
|
|
211
211
|
});
|
|
212
212
|
} else if (mutation.type === 'attributes') {
|
|
213
213
|
if (mutation.target instanceof HTMLElement) {
|
|
214
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
214
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
215
|
+
var _mutation$oldValue;
|
|
216
|
+
/*
|
|
217
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
218
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
219
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
220
|
+
and whether or not they are the same doesn't really matter.
|
|
221
|
+
And Custom elements should work the same way as MutationObserver."
|
|
222
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
223
|
+
*/
|
|
224
|
+
var oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
225
|
+
var newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
226
|
+
if (oldValue !== newValue) {
|
|
227
|
+
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
215
230
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
216
231
|
}
|
|
217
232
|
}
|
|
218
233
|
}
|
|
219
234
|
});
|
|
220
|
-
_this2.measureStop();
|
|
221
235
|
}) : null;
|
|
222
236
|
}
|
|
223
237
|
}, {
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createMutationObserver;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
7
8
|
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; } } }; }
|
|
8
9
|
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; } }
|
|
9
10
|
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; }
|
|
@@ -27,11 +28,32 @@ function createMutationObserver(_ref) {
|
|
|
27
28
|
continue;
|
|
28
29
|
}
|
|
29
30
|
if (mut.type === 'attributes') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
32
|
+
var _mut$oldValue;
|
|
33
|
+
/*
|
|
34
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
35
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
36
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
37
|
+
and whether or not they are the same doesn't really matter.
|
|
38
|
+
And Custom elements should work the same way as MutationObserver."
|
|
39
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
40
|
+
*/
|
|
41
|
+
var oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
|
|
42
|
+
var newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
|
|
43
|
+
if (oldValue !== newValue) {
|
|
44
|
+
var _mut$attributeName;
|
|
45
|
+
onAttributeMutation({
|
|
46
|
+
target: mut.target,
|
|
47
|
+
attributeName: (_mut$attributeName = mut.attributeName) !== null && _mut$attributeName !== void 0 ? _mut$attributeName : 'unknown'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
var _mut$attributeName2;
|
|
52
|
+
onAttributeMutation({
|
|
53
|
+
target: mut.target,
|
|
54
|
+
attributeName: (_mut$attributeName2 = mut.attributeName) !== null && _mut$attributeName2 !== void 0 ? _mut$attributeName2 : 'unknown'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
35
57
|
continue;
|
|
36
58
|
} else if (mut.type === 'childList') {
|
|
37
59
|
var _mut$addedNodes, _mut$removedNodes;
|
|
@@ -183,13 +183,27 @@ export class Observers {
|
|
|
183
183
|
});
|
|
184
184
|
} else if (mutation.type === 'attributes') {
|
|
185
185
|
if (mutation.target instanceof HTMLElement) {
|
|
186
|
-
if (fg('
|
|
186
|
+
if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
187
|
+
var _mutation$oldValue;
|
|
188
|
+
/*
|
|
189
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
190
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
191
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
192
|
+
and whether or not they are the same doesn't really matter.
|
|
193
|
+
And Custom elements should work the same way as MutationObserver."
|
|
194
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
195
|
+
*/
|
|
196
|
+
const oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
197
|
+
const newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
198
|
+
if (oldValue !== newValue) {
|
|
199
|
+
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
187
202
|
this.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
188
203
|
}
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
206
|
});
|
|
192
|
-
this.measureStop();
|
|
193
207
|
}) : null;
|
|
194
208
|
}
|
|
195
209
|
getElementName(element) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
export default function createMutationObserver({
|
|
2
3
|
onAttributeMutation,
|
|
3
4
|
onChildListMutation,
|
|
@@ -15,11 +16,32 @@ export default function createMutationObserver({
|
|
|
15
16
|
continue;
|
|
16
17
|
}
|
|
17
18
|
if (mut.type === 'attributes') {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
20
|
+
var _mut$oldValue;
|
|
21
|
+
/*
|
|
22
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
23
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
24
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
25
|
+
and whether or not they are the same doesn't really matter.
|
|
26
|
+
And Custom elements should work the same way as MutationObserver."
|
|
27
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
28
|
+
*/
|
|
29
|
+
const oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
|
|
30
|
+
const newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
|
|
31
|
+
if (oldValue !== newValue) {
|
|
32
|
+
var _mut$attributeName;
|
|
33
|
+
onAttributeMutation({
|
|
34
|
+
target: mut.target,
|
|
35
|
+
attributeName: (_mut$attributeName = mut.attributeName) !== null && _mut$attributeName !== void 0 ? _mut$attributeName : 'unknown'
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
var _mut$attributeName2;
|
|
40
|
+
onAttributeMutation({
|
|
41
|
+
target: mut.target,
|
|
42
|
+
attributeName: (_mut$attributeName2 = mut.attributeName) !== null && _mut$attributeName2 !== void 0 ? _mut$attributeName2 : 'unknown'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
23
45
|
continue;
|
|
24
46
|
} else if (mut.type === 'childList') {
|
|
25
47
|
var _mut$addedNodes, _mut$removedNodes;
|
|
@@ -204,13 +204,27 @@ export var Observers = /*#__PURE__*/function () {
|
|
|
204
204
|
});
|
|
205
205
|
} else if (mutation.type === 'attributes') {
|
|
206
206
|
if (mutation.target instanceof HTMLElement) {
|
|
207
|
-
if (fg('
|
|
207
|
+
if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
208
|
+
var _mutation$oldValue;
|
|
209
|
+
/*
|
|
210
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
211
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
212
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
213
|
+
and whether or not they are the same doesn't really matter.
|
|
214
|
+
And Custom elements should work the same way as MutationObserver."
|
|
215
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
216
|
+
*/
|
|
217
|
+
var oldValue = (_mutation$oldValue = mutation.oldValue) !== null && _mutation$oldValue !== void 0 ? _mutation$oldValue : undefined;
|
|
218
|
+
var newValue = mutation.attributeName ? mutation.target.getAttribute(mutation.attributeName) : undefined;
|
|
219
|
+
if (oldValue !== newValue) {
|
|
220
|
+
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
208
223
|
_this2.observeElement(mutation.target, mutation, 'attr', ignoreReason);
|
|
209
224
|
}
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
227
|
});
|
|
213
|
-
_this2.measureStop();
|
|
214
228
|
}) : null;
|
|
215
229
|
}
|
|
216
230
|
}, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
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
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
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 { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
export default function createMutationObserver(_ref) {
|
|
5
6
|
var onAttributeMutation = _ref.onAttributeMutation,
|
|
6
7
|
onChildListMutation = _ref.onChildListMutation,
|
|
@@ -21,11 +22,32 @@ export default function createMutationObserver(_ref) {
|
|
|
21
22
|
continue;
|
|
22
23
|
}
|
|
23
24
|
if (mut.type === 'attributes') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
|
|
26
|
+
var _mut$oldValue;
|
|
27
|
+
/*
|
|
28
|
+
"MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
|
|
29
|
+
I think it might have been something along the lines that for consistency every setAttribute call should create a record.
|
|
30
|
+
Conceptually there is after all a mutation: there is an old value replaced with a new one,
|
|
31
|
+
and whether or not they are the same doesn't really matter.
|
|
32
|
+
And Custom elements should work the same way as MutationObserver."
|
|
33
|
+
https://github.com/whatwg/dom/issues/520#issuecomment-336574796
|
|
34
|
+
*/
|
|
35
|
+
var oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
|
|
36
|
+
var newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
|
|
37
|
+
if (oldValue !== newValue) {
|
|
38
|
+
var _mut$attributeName;
|
|
39
|
+
onAttributeMutation({
|
|
40
|
+
target: mut.target,
|
|
41
|
+
attributeName: (_mut$attributeName = mut.attributeName) !== null && _mut$attributeName !== void 0 ? _mut$attributeName : 'unknown'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
var _mut$attributeName2;
|
|
46
|
+
onAttributeMutation({
|
|
47
|
+
target: mut.target,
|
|
48
|
+
attributeName: (_mut$attributeName2 = mut.attributeName) !== null && _mut$attributeName2 !== void 0 ? _mut$attributeName2 : 'unknown'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
29
51
|
continue;
|
|
30
52
|
} else if (mut.type === 'childList') {
|
|
31
53
|
var _mut$addedNodes, _mut$removedNodes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -186,6 +186,9 @@
|
|
|
186
186
|
},
|
|
187
187
|
"platform_ufo_ssr_placeholder_round_rect_size_check": {
|
|
188
188
|
"type": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"platform_ufo_vc_ignore_same_value_mutation": {
|
|
191
|
+
"type": "boolean"
|
|
189
192
|
}
|
|
190
193
|
}
|
|
191
194
|
}
|