@atlaskit/react-ufo 3.4.8 → 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 +16 -0
- package/dist/cjs/vc/vc-observer/observers/index.js +16 -2
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +3 -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/observers/ssr-placeholders/index.js +3 -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/observers/ssr-placeholders/index.js +3 -2
- package/dist/esm/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +27 -5
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -0
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
11
|
+
## 3.4.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#134300](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134300)
|
|
16
|
+
[`5fb9bf529d095`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5fb9bf529d095) -
|
|
17
|
+
SSR placeholder rectangle size comparison to ignore decimal places
|
|
18
|
+
|
|
3
19
|
## 3.4.8
|
|
4
20
|
|
|
5
21
|
### 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
|
}, {
|
|
@@ -8,7 +8,7 @@ exports.SSRPlaceholderHandlers = 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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var ANCESTOR_LOOKUP_LIMIT = 10;
|
|
13
13
|
var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
14
14
|
function SSRPlaceholderHandlers() {
|
|
@@ -18,6 +18,7 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
18
18
|
(0, _defineProperty2.default)(this, "callbacks", new Map());
|
|
19
19
|
(0, _defineProperty2.default)(this, "getSizeCallbacks", new Map());
|
|
20
20
|
(0, _defineProperty2.default)(this, "reactValidateCallbacks", new Map());
|
|
21
|
+
(0, _defineProperty2.default)(this, "EQUALITY_THRESHOLD", (0, _platformFeatureFlags.fg)('platform_ufo_ssr_placeholder_round_rect_size_check') ? 1 : 0.1);
|
|
21
22
|
(0, _defineProperty2.default)(this, "intersectionObserverCallback", function (_ref) {
|
|
22
23
|
var _this$intersectionObs;
|
|
23
24
|
var target = _ref.target,
|
|
@@ -197,7 +198,7 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
|
|
|
197
198
|
}, {
|
|
198
199
|
key: "hasSameSizePosition",
|
|
199
200
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
200
|
-
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
201
|
+
return rect && Math.abs(rect.x - boundingClientRect.x) < this.EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < this.EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < this.EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < this.EQUALITY_THRESHOLD || false;
|
|
201
202
|
}
|
|
202
203
|
}, {
|
|
203
204
|
key: "isDummyRect",
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
const ANCESTOR_LOOKUP_LIMIT = 10;
|
|
4
4
|
export class SSRPlaceholderHandlers {
|
|
5
5
|
constructor() {
|
|
@@ -7,6 +7,7 @@ export class SSRPlaceholderHandlers {
|
|
|
7
7
|
_defineProperty(this, "callbacks", new Map());
|
|
8
8
|
_defineProperty(this, "getSizeCallbacks", new Map());
|
|
9
9
|
_defineProperty(this, "reactValidateCallbacks", new Map());
|
|
10
|
+
_defineProperty(this, "EQUALITY_THRESHOLD", fg('platform_ufo_ssr_placeholder_round_rect_size_check') ? 1 : 0.1);
|
|
10
11
|
_defineProperty(this, "intersectionObserverCallback", ({
|
|
11
12
|
target,
|
|
12
13
|
boundingClientRect
|
|
@@ -162,7 +163,7 @@ export class SSRPlaceholderHandlers {
|
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
hasSameSizePosition(rect, boundingClientRect) {
|
|
165
|
-
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
166
|
+
return rect && Math.abs(rect.x - boundingClientRect.x) < this.EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < this.EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < this.EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < this.EQUALITY_THRESHOLD || false;
|
|
166
167
|
}
|
|
167
168
|
isDummyRect(rect) {
|
|
168
169
|
return rect && rect.width < 0 && rect.height < 0 || false;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
var ANCESTOR_LOOKUP_LIMIT = 10;
|
|
6
6
|
export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
7
7
|
function SSRPlaceholderHandlers() {
|
|
@@ -11,6 +11,7 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
11
11
|
_defineProperty(this, "callbacks", new Map());
|
|
12
12
|
_defineProperty(this, "getSizeCallbacks", new Map());
|
|
13
13
|
_defineProperty(this, "reactValidateCallbacks", new Map());
|
|
14
|
+
_defineProperty(this, "EQUALITY_THRESHOLD", fg('platform_ufo_ssr_placeholder_round_rect_size_check') ? 1 : 0.1);
|
|
14
15
|
_defineProperty(this, "intersectionObserverCallback", function (_ref) {
|
|
15
16
|
var _this$intersectionObs;
|
|
16
17
|
var target = _ref.target,
|
|
@@ -190,7 +191,7 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
|
|
|
190
191
|
}, {
|
|
191
192
|
key: "hasSameSizePosition",
|
|
192
193
|
value: function hasSameSizePosition(rect, boundingClientRect) {
|
|
193
|
-
return rect && Math.abs(rect.x - boundingClientRect.x) < EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < EQUALITY_THRESHOLD || false;
|
|
194
|
+
return rect && Math.abs(rect.x - boundingClientRect.x) < this.EQUALITY_THRESHOLD && Math.abs(rect.y - boundingClientRect.y) < this.EQUALITY_THRESHOLD && Math.abs(rect.width - boundingClientRect.width) < this.EQUALITY_THRESHOLD && Math.abs(rect.height - boundingClientRect.height) < this.EQUALITY_THRESHOLD || false;
|
|
194
195
|
}
|
|
195
196
|
}, {
|
|
196
197
|
key: "isDummyRect",
|
|
@@ -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",
|
|
@@ -183,6 +183,12 @@
|
|
|
183
183
|
},
|
|
184
184
|
"ufo_payload_use_idle_callback": {
|
|
185
185
|
"type": "boolean"
|
|
186
|
+
},
|
|
187
|
+
"platform_ufo_ssr_placeholder_round_rect_size_check": {
|
|
188
|
+
"type": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"platform_ufo_vc_ignore_same_value_mutation": {
|
|
191
|
+
"type": "boolean"
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
}
|