@atlaskit/editor-common 69.0.1 → 69.1.0
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/ui/Mention/mention-with-profilecard.js +4 -2
- package/dist/cjs/utils/browser.js +4 -0
- package/dist/cjs/utils/performance/measure-render.js +52 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +1 -1
- package/dist/es2019/utils/browser.js +4 -0
- package/dist/es2019/utils/performance/measure-render.js +52 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/Mention/mention-with-profilecard.js +1 -1
- package/dist/esm/utils/browser.js +4 -0
- package/dist/esm/utils/performance/measure-render.js +52 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/utils/browser.d.ts +1 -12
- package/dist/types/utils/performance/measure-render.d.ts +28 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 69.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2affe8adcfa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2affe8adcfa) - ED-14510: Generic feature flag to disable spellcheck via browser and version
|
|
8
|
+
- [`5020781d90a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5020781d90a) - [ux] ED-15099 added floatng toolbar copy button to Expand
|
|
9
|
+
- [`995991c4b11`](https://bitbucket.org/atlassian/atlassian-frontend/commits/995991c4b11) - [ux] ED-15108 added floating toolbar copy button to Layout
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`832e383140e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/832e383140e) - Import ProfileCardTrigger from specialized entrypoint for better tree-shaking
|
|
14
|
+
- [`04db970c32b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04db970c32b) - ED-14899 add attribute to render measurements and rework analytics events to prevent measurements done in background to resulting in misleading render durations.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 69.0.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -11,7 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
13
|
|
|
12
14
|
var _mention = require("@atlaskit/mention");
|
|
13
15
|
|
|
14
|
-
var
|
|
16
|
+
var _user = _interopRequireDefault(require("@atlaskit/profilecard/user"));
|
|
15
17
|
|
|
16
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
19
|
|
|
@@ -31,7 +33,7 @@ function MentionWithProfileCard(_ref) {
|
|
|
31
33
|
var actions = (0, _react.useMemo)(function () {
|
|
32
34
|
return profilecardProvider.getActions(id, text, accessLevel);
|
|
33
35
|
}, [accessLevel, id, profilecardProvider, text]);
|
|
34
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_user.default, {
|
|
35
37
|
cloudId: cloudId,
|
|
36
38
|
userId: id,
|
|
37
39
|
resourceClient: resourceClient,
|
|
@@ -9,12 +9,14 @@ var result = {
|
|
|
9
9
|
ie: false,
|
|
10
10
|
ie_version: 0,
|
|
11
11
|
gecko: false,
|
|
12
|
+
gecko_version: 0,
|
|
12
13
|
chrome: false,
|
|
13
14
|
chrome_version: 0,
|
|
14
15
|
android: false,
|
|
15
16
|
ios: false,
|
|
16
17
|
webkit: false,
|
|
17
18
|
safari: false,
|
|
19
|
+
safari_version: 0,
|
|
18
20
|
supportsIntersectionObserver: false,
|
|
19
21
|
supportsResizeObserver: false
|
|
20
22
|
};
|
|
@@ -27,12 +29,14 @@ if (typeof navigator !== 'undefined') {
|
|
|
27
29
|
var ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
|
|
28
30
|
result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
|
|
29
31
|
result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
|
|
32
|
+
result.gecko_version = parseInt((navigator.userAgent.match(/Firefox\/(\d+)/) || [])[1], 10);
|
|
30
33
|
result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
|
|
31
34
|
result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1], 10);
|
|
32
35
|
result.android = /Android \d/.test(navigator.userAgent);
|
|
33
36
|
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
|
34
37
|
result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
|
|
35
38
|
result.safari = Boolean(navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1);
|
|
39
|
+
result.safari_version = parseInt((navigator.userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10);
|
|
36
40
|
result.supportsIntersectionObserver = typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype;
|
|
37
41
|
result.supportsResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window && 'ResizeObserverEntry' in window;
|
|
38
42
|
}
|
|
@@ -20,7 +20,23 @@ var _isPerformanceApiAvailable = require("./is-performance-api-available");
|
|
|
20
20
|
* | javascript (framework) | style | layout | paint | composite | javascript | ...
|
|
21
21
|
* | startMark + scheduling rAF | | rAF callback, endMark
|
|
22
22
|
*/
|
|
23
|
-
function measureRender(
|
|
23
|
+
function measureRender(
|
|
24
|
+
/**
|
|
25
|
+
* Unique name for the measurement
|
|
26
|
+
*
|
|
27
|
+
* Important: if multiple measureRender events are fired at the same time
|
|
28
|
+
* with the same measure name -- the result will not be correct.
|
|
29
|
+
*/
|
|
30
|
+
measureName,
|
|
31
|
+
/**
|
|
32
|
+
* Call back fired when the measurement completes.
|
|
33
|
+
*
|
|
34
|
+
* Note: when this function is called when the Document.visibilityState is not
|
|
35
|
+
* visible -- the duration is likely to be misleading/inaccurate. This is due
|
|
36
|
+
* to the measurements use of the `requestAnimationFrame` api which only fires
|
|
37
|
+
* when the Document.visibilityState is visible.
|
|
38
|
+
*/
|
|
39
|
+
onMeasureComplete) {
|
|
24
40
|
if (!(0, _isPerformanceApiAvailable.isPerformanceAPIAvailable)()) {
|
|
25
41
|
return;
|
|
26
42
|
}
|
|
@@ -28,10 +44,29 @@ function measureRender(measureName, onMeasureComplete) {
|
|
|
28
44
|
var startMark = "[START]: ".concat(measureName);
|
|
29
45
|
var endMark = "[END]: ".concat(measureName);
|
|
30
46
|
var startTime = performance.now();
|
|
31
|
-
performance.mark(startMark);
|
|
47
|
+
performance.mark(startMark); // If an editor is rendered when the document is not visible -- the callback passed to
|
|
48
|
+
// requestAnimationFrame will not fire until the document becomes visible again.
|
|
49
|
+
//
|
|
50
|
+
// For the purposes of using performance measurement -- this behaviour means the events
|
|
51
|
+
// which have been fired in the background are not useful -- and lead to other events
|
|
52
|
+
// being hard to draw conclusions from.
|
|
53
|
+
//
|
|
54
|
+
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
55
|
+
// measurement has occured when the render was in the backgroun
|
|
56
|
+
|
|
57
|
+
var distortedDuration = document.visibilityState !== 'visible';
|
|
58
|
+
|
|
59
|
+
function handleVisibilityChange() {
|
|
60
|
+
if (document.visibilityState !== 'visible') {
|
|
61
|
+
distortedDuration = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
32
66
|
requestAnimationFrame(function () {
|
|
33
67
|
requestAnimationFrame(function () {
|
|
34
68
|
performance.mark(endMark);
|
|
69
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
35
70
|
var duration = performance.now() - startTime;
|
|
36
71
|
|
|
37
72
|
try {
|
|
@@ -39,12 +74,24 @@ function measureRender(measureName, onMeasureComplete) {
|
|
|
39
74
|
var entry = performance.getEntriesByName(measureName).pop();
|
|
40
75
|
|
|
41
76
|
if (!entry) {
|
|
42
|
-
onMeasureComplete(
|
|
77
|
+
onMeasureComplete({
|
|
78
|
+
duration: duration,
|
|
79
|
+
startTime: startTime,
|
|
80
|
+
distortedDuration: distortedDuration
|
|
81
|
+
});
|
|
43
82
|
} else {
|
|
44
|
-
onMeasureComplete(
|
|
83
|
+
onMeasureComplete({
|
|
84
|
+
duration: entry.duration,
|
|
85
|
+
startTime: entry.startTime,
|
|
86
|
+
distortedDuration: distortedDuration
|
|
87
|
+
});
|
|
45
88
|
}
|
|
46
89
|
} catch (e) {
|
|
47
|
-
onMeasureComplete(
|
|
90
|
+
onMeasureComplete({
|
|
91
|
+
duration: duration,
|
|
92
|
+
startTime: startTime,
|
|
93
|
+
distortedDuration: distortedDuration
|
|
94
|
+
});
|
|
48
95
|
}
|
|
49
96
|
|
|
50
97
|
performance.clearMeasures(measureName);
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { ResourcedMention } from '@atlaskit/mention';
|
|
3
|
-
import
|
|
3
|
+
import ProfileCardTrigger from '@atlaskit/profilecard/user';
|
|
4
4
|
export default function MentionWithProfileCard({
|
|
5
5
|
id,
|
|
6
6
|
text,
|
|
@@ -3,12 +3,14 @@ const result = {
|
|
|
3
3
|
ie: false,
|
|
4
4
|
ie_version: 0,
|
|
5
5
|
gecko: false,
|
|
6
|
+
gecko_version: 0,
|
|
6
7
|
chrome: false,
|
|
7
8
|
chrome_version: 0,
|
|
8
9
|
android: false,
|
|
9
10
|
ios: false,
|
|
10
11
|
webkit: false,
|
|
11
12
|
safari: false,
|
|
13
|
+
safari_version: 0,
|
|
12
14
|
supportsIntersectionObserver: false,
|
|
13
15
|
supportsResizeObserver: false
|
|
14
16
|
};
|
|
@@ -21,12 +23,14 @@ if (typeof navigator !== 'undefined') {
|
|
|
21
23
|
let ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
|
|
22
24
|
result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
|
|
23
25
|
result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
|
|
26
|
+
result.gecko_version = parseInt((navigator.userAgent.match(/Firefox\/(\d+)/) || [])[1], 10);
|
|
24
27
|
result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
|
|
25
28
|
result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1], 10);
|
|
26
29
|
result.android = /Android \d/.test(navigator.userAgent);
|
|
27
30
|
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
|
28
31
|
result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
|
|
29
32
|
result.safari = Boolean(navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1);
|
|
33
|
+
result.safari_version = parseInt((navigator.userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10);
|
|
30
34
|
result.supportsIntersectionObserver = typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype;
|
|
31
35
|
result.supportsResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window && 'ResizeObserverEntry' in window;
|
|
32
36
|
}
|
|
@@ -13,7 +13,23 @@ import { isPerformanceAPIAvailable } from './is-performance-api-available';
|
|
|
13
13
|
* | startMark + scheduling rAF | | rAF callback, endMark
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export function measureRender(
|
|
16
|
+
export function measureRender(
|
|
17
|
+
/**
|
|
18
|
+
* Unique name for the measurement
|
|
19
|
+
*
|
|
20
|
+
* Important: if multiple measureRender events are fired at the same time
|
|
21
|
+
* with the same measure name -- the result will not be correct.
|
|
22
|
+
*/
|
|
23
|
+
measureName,
|
|
24
|
+
/**
|
|
25
|
+
* Call back fired when the measurement completes.
|
|
26
|
+
*
|
|
27
|
+
* Note: when this function is called when the Document.visibilityState is not
|
|
28
|
+
* visible -- the duration is likely to be misleading/inaccurate. This is due
|
|
29
|
+
* to the measurements use of the `requestAnimationFrame` api which only fires
|
|
30
|
+
* when the Document.visibilityState is visible.
|
|
31
|
+
*/
|
|
32
|
+
onMeasureComplete) {
|
|
17
33
|
if (!isPerformanceAPIAvailable()) {
|
|
18
34
|
return;
|
|
19
35
|
}
|
|
@@ -21,10 +37,29 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
21
37
|
const startMark = `[START]: ${measureName}`;
|
|
22
38
|
const endMark = `[END]: ${measureName}`;
|
|
23
39
|
const startTime = performance.now();
|
|
24
|
-
performance.mark(startMark);
|
|
40
|
+
performance.mark(startMark); // If an editor is rendered when the document is not visible -- the callback passed to
|
|
41
|
+
// requestAnimationFrame will not fire until the document becomes visible again.
|
|
42
|
+
//
|
|
43
|
+
// For the purposes of using performance measurement -- this behaviour means the events
|
|
44
|
+
// which have been fired in the background are not useful -- and lead to other events
|
|
45
|
+
// being hard to draw conclusions from.
|
|
46
|
+
//
|
|
47
|
+
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
48
|
+
// measurement has occured when the render was in the backgroun
|
|
49
|
+
|
|
50
|
+
let distortedDuration = document.visibilityState !== 'visible';
|
|
51
|
+
|
|
52
|
+
function handleVisibilityChange() {
|
|
53
|
+
if (document.visibilityState !== 'visible') {
|
|
54
|
+
distortedDuration = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
25
59
|
requestAnimationFrame(() => {
|
|
26
60
|
requestAnimationFrame(() => {
|
|
27
61
|
performance.mark(endMark);
|
|
62
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
28
63
|
const duration = performance.now() - startTime;
|
|
29
64
|
|
|
30
65
|
try {
|
|
@@ -32,12 +67,24 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
32
67
|
const entry = performance.getEntriesByName(measureName).pop();
|
|
33
68
|
|
|
34
69
|
if (!entry) {
|
|
35
|
-
onMeasureComplete(
|
|
70
|
+
onMeasureComplete({
|
|
71
|
+
duration,
|
|
72
|
+
startTime,
|
|
73
|
+
distortedDuration
|
|
74
|
+
});
|
|
36
75
|
} else {
|
|
37
|
-
onMeasureComplete(
|
|
76
|
+
onMeasureComplete({
|
|
77
|
+
duration: entry.duration,
|
|
78
|
+
startTime: entry.startTime,
|
|
79
|
+
distortedDuration
|
|
80
|
+
});
|
|
38
81
|
}
|
|
39
82
|
} catch (e) {
|
|
40
|
-
onMeasureComplete(
|
|
83
|
+
onMeasureComplete({
|
|
84
|
+
duration,
|
|
85
|
+
startTime,
|
|
86
|
+
distortedDuration
|
|
87
|
+
});
|
|
41
88
|
}
|
|
42
89
|
|
|
43
90
|
performance.clearMeasures(measureName);
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { ResourcedMention } from '@atlaskit/mention';
|
|
3
|
-
import
|
|
3
|
+
import ProfileCardTrigger from '@atlaskit/profilecard/user';
|
|
4
4
|
export default function MentionWithProfileCard(_ref) {
|
|
5
5
|
var id = _ref.id,
|
|
6
6
|
text = _ref.text,
|
|
@@ -3,12 +3,14 @@ var result = {
|
|
|
3
3
|
ie: false,
|
|
4
4
|
ie_version: 0,
|
|
5
5
|
gecko: false,
|
|
6
|
+
gecko_version: 0,
|
|
6
7
|
chrome: false,
|
|
7
8
|
chrome_version: 0,
|
|
8
9
|
android: false,
|
|
9
10
|
ios: false,
|
|
10
11
|
webkit: false,
|
|
11
12
|
safari: false,
|
|
13
|
+
safari_version: 0,
|
|
12
14
|
supportsIntersectionObserver: false,
|
|
13
15
|
supportsResizeObserver: false
|
|
14
16
|
};
|
|
@@ -21,12 +23,14 @@ if (typeof navigator !== 'undefined') {
|
|
|
21
23
|
var ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
|
|
22
24
|
result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
|
|
23
25
|
result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
|
|
26
|
+
result.gecko_version = parseInt((navigator.userAgent.match(/Firefox\/(\d+)/) || [])[1], 10);
|
|
24
27
|
result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
|
|
25
28
|
result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1], 10);
|
|
26
29
|
result.android = /Android \d/.test(navigator.userAgent);
|
|
27
30
|
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
|
28
31
|
result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
|
|
29
32
|
result.safari = Boolean(navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1);
|
|
33
|
+
result.safari_version = parseInt((navigator.userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10);
|
|
30
34
|
result.supportsIntersectionObserver = typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype;
|
|
31
35
|
result.supportsResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window && 'ResizeObserverEntry' in window;
|
|
32
36
|
}
|
|
@@ -13,7 +13,23 @@ import { isPerformanceAPIAvailable } from './is-performance-api-available';
|
|
|
13
13
|
* | startMark + scheduling rAF | | rAF callback, endMark
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export function measureRender(
|
|
16
|
+
export function measureRender(
|
|
17
|
+
/**
|
|
18
|
+
* Unique name for the measurement
|
|
19
|
+
*
|
|
20
|
+
* Important: if multiple measureRender events are fired at the same time
|
|
21
|
+
* with the same measure name -- the result will not be correct.
|
|
22
|
+
*/
|
|
23
|
+
measureName,
|
|
24
|
+
/**
|
|
25
|
+
* Call back fired when the measurement completes.
|
|
26
|
+
*
|
|
27
|
+
* Note: when this function is called when the Document.visibilityState is not
|
|
28
|
+
* visible -- the duration is likely to be misleading/inaccurate. This is due
|
|
29
|
+
* to the measurements use of the `requestAnimationFrame` api which only fires
|
|
30
|
+
* when the Document.visibilityState is visible.
|
|
31
|
+
*/
|
|
32
|
+
onMeasureComplete) {
|
|
17
33
|
if (!isPerformanceAPIAvailable()) {
|
|
18
34
|
return;
|
|
19
35
|
}
|
|
@@ -21,10 +37,29 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
21
37
|
var startMark = "[START]: ".concat(measureName);
|
|
22
38
|
var endMark = "[END]: ".concat(measureName);
|
|
23
39
|
var startTime = performance.now();
|
|
24
|
-
performance.mark(startMark);
|
|
40
|
+
performance.mark(startMark); // If an editor is rendered when the document is not visible -- the callback passed to
|
|
41
|
+
// requestAnimationFrame will not fire until the document becomes visible again.
|
|
42
|
+
//
|
|
43
|
+
// For the purposes of using performance measurement -- this behaviour means the events
|
|
44
|
+
// which have been fired in the background are not useful -- and lead to other events
|
|
45
|
+
// being hard to draw conclusions from.
|
|
46
|
+
//
|
|
47
|
+
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
48
|
+
// measurement has occured when the render was in the backgroun
|
|
49
|
+
|
|
50
|
+
var distortedDuration = document.visibilityState !== 'visible';
|
|
51
|
+
|
|
52
|
+
function handleVisibilityChange() {
|
|
53
|
+
if (document.visibilityState !== 'visible') {
|
|
54
|
+
distortedDuration = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
25
59
|
requestAnimationFrame(function () {
|
|
26
60
|
requestAnimationFrame(function () {
|
|
27
61
|
performance.mark(endMark);
|
|
62
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
28
63
|
var duration = performance.now() - startTime;
|
|
29
64
|
|
|
30
65
|
try {
|
|
@@ -32,12 +67,24 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
32
67
|
var entry = performance.getEntriesByName(measureName).pop();
|
|
33
68
|
|
|
34
69
|
if (!entry) {
|
|
35
|
-
onMeasureComplete(
|
|
70
|
+
onMeasureComplete({
|
|
71
|
+
duration: duration,
|
|
72
|
+
startTime: startTime,
|
|
73
|
+
distortedDuration: distortedDuration
|
|
74
|
+
});
|
|
36
75
|
} else {
|
|
37
|
-
onMeasureComplete(
|
|
76
|
+
onMeasureComplete({
|
|
77
|
+
duration: entry.duration,
|
|
78
|
+
startTime: entry.startTime,
|
|
79
|
+
distortedDuration: distortedDuration
|
|
80
|
+
});
|
|
38
81
|
}
|
|
39
82
|
} catch (e) {
|
|
40
|
-
onMeasureComplete(
|
|
83
|
+
onMeasureComplete({
|
|
84
|
+
duration: duration,
|
|
85
|
+
startTime: startTime,
|
|
86
|
+
distortedDuration: distortedDuration
|
|
87
|
+
});
|
|
41
88
|
}
|
|
42
89
|
|
|
43
90
|
performance.clearMeasures(measureName);
|
package/dist/esm/version.json
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
declare const result: {
|
|
2
|
-
|
|
3
|
-
ie: boolean;
|
|
4
|
-
ie_version: number;
|
|
5
|
-
gecko: boolean;
|
|
6
|
-
chrome: boolean;
|
|
7
|
-
chrome_version: number;
|
|
8
|
-
android: boolean;
|
|
9
|
-
ios: boolean;
|
|
10
|
-
webkit: boolean;
|
|
11
|
-
safari: boolean;
|
|
12
|
-
supportsIntersectionObserver: boolean;
|
|
13
|
-
supportsResizeObserver: boolean;
|
|
2
|
+
[key: string]: any;
|
|
14
3
|
};
|
|
15
4
|
export default result;
|
|
@@ -11,4 +11,31 @@
|
|
|
11
11
|
* | javascript (framework) | style | layout | paint | composite | javascript | ...
|
|
12
12
|
* | startMark + scheduling rAF | | rAF callback, endMark
|
|
13
13
|
*/
|
|
14
|
-
export declare function measureRender(
|
|
14
|
+
export declare function measureRender(
|
|
15
|
+
/**
|
|
16
|
+
* Unique name for the measurement
|
|
17
|
+
*
|
|
18
|
+
* Important: if multiple measureRender events are fired at the same time
|
|
19
|
+
* with the same measure name -- the result will not be correct.
|
|
20
|
+
*/
|
|
21
|
+
measureName: string,
|
|
22
|
+
/**
|
|
23
|
+
* Call back fired when the measurement completes.
|
|
24
|
+
*
|
|
25
|
+
* Note: when this function is called when the Document.visibilityState is not
|
|
26
|
+
* visible -- the duration is likely to be misleading/inaccurate. This is due
|
|
27
|
+
* to the measurements use of the `requestAnimationFrame` api which only fires
|
|
28
|
+
* when the Document.visibilityState is visible.
|
|
29
|
+
*/
|
|
30
|
+
onMeasureComplete: ({ duration, startTime, distortedDuration, }: {
|
|
31
|
+
duration: number;
|
|
32
|
+
startTime: number;
|
|
33
|
+
/**
|
|
34
|
+
* Will be true when the measurement takes place in a background tab or some
|
|
35
|
+
* other case which results in the Document.visibilityState not being visible.
|
|
36
|
+
*
|
|
37
|
+
* When true -- the duration value is not useful to provide to consumers. See
|
|
38
|
+
* onMeasureComplete description for more details.
|
|
39
|
+
*/
|
|
40
|
+
distortedDuration: boolean;
|
|
41
|
+
}) => void): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "69.0
|
|
3
|
+
"version": "69.1.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@atlaskit/activity-provider": "^2.3.0",
|
|
47
|
-
"@atlaskit/adf-schema": "^23.
|
|
47
|
+
"@atlaskit/adf-schema": "^23.3.0",
|
|
48
48
|
"@atlaskit/adf-utils": "^17.1.0",
|
|
49
49
|
"@atlaskit/analytics-namespaced-context": "^6.5.0",
|
|
50
50
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"@atlaskit/codemod-utils": "^4.1.0",
|
|
53
53
|
"@atlaskit/editor-json-transformer": "^8.7.0",
|
|
54
54
|
"@atlaskit/editor-shared-styles": "^2.1.0",
|
|
55
|
-
"@atlaskit/emoji": "^65.
|
|
55
|
+
"@atlaskit/emoji": "^65.1.0",
|
|
56
56
|
"@atlaskit/icon": "^21.10.0",
|
|
57
57
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
58
|
-
"@atlaskit/media-card": "^74.
|
|
58
|
+
"@atlaskit/media-card": "^74.1.0",
|
|
59
59
|
"@atlaskit/media-client": "^17.1.0",
|
|
60
60
|
"@atlaskit/media-picker": "^63.0.0",
|
|
61
61
|
"@atlaskit/mention": "^21.0.0",
|
|
62
|
-
"@atlaskit/profilecard": "^16.
|
|
62
|
+
"@atlaskit/profilecard": "^16.11.0",
|
|
63
63
|
"@atlaskit/smart-card": "^21.0.0",
|
|
64
|
-
"@atlaskit/smart-user-picker": "^
|
|
64
|
+
"@atlaskit/smart-user-picker": "^6.0.0",
|
|
65
65
|
"@atlaskit/task-decision": "^17.4.0",
|
|
66
66
|
"@atlaskit/theme": "^12.1.0",
|
|
67
67
|
"@atlaskit/tokens": "^0.10.0",
|