@atlaskit/editor-plugin-interactivity 1.1.0 → 1.2.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 +17 -0
- package/README.md +46 -1
- package/dist/cjs/collections/bounded-list.js +42 -0
- package/dist/cjs/collections/bounded-map.js +42 -0
- package/dist/cjs/collector/interaction-group.js +31 -4
- package/dist/cjs/collector/interaction-tracker.js +207 -67
- package/dist/cjs/collector/interactivity-collector.js +45 -35
- package/dist/cjs/collector/long-animation-frame-observer.js +62 -0
- package/dist/cjs/collector/slow-interaction-list.js +297 -56
- package/dist/es2019/collections/bounded-list.js +24 -0
- package/dist/es2019/collections/bounded-map.js +25 -0
- package/dist/es2019/collector/interaction-group.js +28 -5
- package/dist/es2019/collector/interaction-tracker.js +198 -54
- package/dist/es2019/collector/interactivity-collector.js +30 -34
- package/dist/es2019/collector/long-animation-frame-observer.js +42 -0
- package/dist/es2019/collector/slow-interaction-list.js +251 -57
- package/dist/esm/collections/bounded-list.js +35 -0
- package/dist/esm/collections/bounded-map.js +35 -0
- package/dist/esm/collector/interaction-group.js +31 -5
- package/dist/esm/collector/interaction-tracker.js +207 -67
- package/dist/esm/collector/interactivity-collector.js +45 -35
- package/dist/esm/collector/long-animation-frame-observer.js +55 -0
- package/dist/esm/collector/slow-interaction-list.js +297 -56
- package/dist/types/analytics/interactivity-snapshot.d.ts +32 -1
- package/dist/types/collections/bounded-list.d.ts +9 -0
- package/dist/types/collections/bounded-map.d.ts +9 -0
- package/dist/types/collector/interaction-group.d.ts +18 -5
- package/dist/types/collector/interaction-tracker.d.ts +58 -9
- package/dist/types/collector/interactivity-collector.d.ts +3 -0
- package/dist/types/collector/long-animation-frame-observer.d.ts +28 -0
- package/dist/types/collector/slow-interaction-list.d.ts +44 -18
- package/package.json +3 -3
|
@@ -26,6 +26,7 @@ export declare class InteractivityCollector {
|
|
|
26
26
|
private readonly getObjectId;
|
|
27
27
|
private readonly getSessionMode;
|
|
28
28
|
private readonly interactionObserver;
|
|
29
|
+
private readonly longAnimationFrameObserver;
|
|
29
30
|
private readonly editorEvents;
|
|
30
31
|
private readonly snapshotScheduler;
|
|
31
32
|
private readonly lifecycleObserver;
|
|
@@ -85,6 +86,8 @@ export declare class InteractivityCollector {
|
|
|
85
86
|
* they were faster than its threshold — which is why a count alone moves the session on.
|
|
86
87
|
*/
|
|
87
88
|
private recordEditorEvent;
|
|
89
|
+
/** Long Animation Frames say where the latency of a slow interaction went. */
|
|
90
|
+
private recordFrames;
|
|
88
91
|
private recordEntries;
|
|
89
92
|
private takeSnapshot;
|
|
90
93
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type LongAnimationFrame = PerformanceEntry & {
|
|
2
|
+
scripts?: LongAnimationFrameScript[];
|
|
3
|
+
styleAndLayoutStart?: number;
|
|
4
|
+
};
|
|
5
|
+
export type LongAnimationFrameScript = {
|
|
6
|
+
duration: number;
|
|
7
|
+
forcedStyleAndLayoutDuration?: number;
|
|
8
|
+
invokerType?: string;
|
|
9
|
+
sourceFunctionName?: string;
|
|
10
|
+
sourceURL?: string;
|
|
11
|
+
startTime: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Reports the frames the browser took longer than 50 ms to render to `onFrames`. They are what says
|
|
15
|
+
* where the time of a slow interaction went — which script ran the longest while the user waited,
|
|
16
|
+
* and how much of the wait was style and layout — which Event Timing cannot answer.
|
|
17
|
+
*
|
|
18
|
+
* What they say about an interaction is `SlowInteractionList`'s to work out; this only observes.
|
|
19
|
+
*/
|
|
20
|
+
export declare class LongAnimationFrameObserver {
|
|
21
|
+
private readonly onFrames;
|
|
22
|
+
static isSupported(): boolean;
|
|
23
|
+
private observer;
|
|
24
|
+
constructor(onFrames: (frames: LongAnimationFrame[]) => void);
|
|
25
|
+
start(): void;
|
|
26
|
+
drain(): void;
|
|
27
|
+
stop(): void;
|
|
28
|
+
}
|
|
@@ -1,32 +1,59 @@
|
|
|
1
|
-
import type { SlowInteraction
|
|
2
|
-
import type { InteractionEntry } from './interaction-tracker';
|
|
3
|
-
|
|
4
|
-
type ObservedInteraction = {
|
|
5
|
-
entry: InteractionEntry;
|
|
6
|
-
group: SlowInteractionGroup;
|
|
7
|
-
interactionId: number;
|
|
8
|
-
/** The duration of the entry measuring the interaction at its slowest. */
|
|
9
|
-
latencyMs: number;
|
|
10
|
-
};
|
|
1
|
+
import type { SlowInteraction } from '../analytics/interactivity-snapshot';
|
|
2
|
+
import type { InteractionEntry, InteractionUpdate } from './interaction-tracker';
|
|
3
|
+
import type { LongAnimationFrame } from './long-animation-frame-observer';
|
|
11
4
|
/**
|
|
12
5
|
* The slowest interactions of one session, which is what the event's `slowest` records are.
|
|
13
6
|
*
|
|
7
|
+
* Interactions arrive from the tracker and frames from the Long Animation Frame observer, and this
|
|
8
|
+
* is where the two meet: a record says both how long the user waited and where that time went.
|
|
9
|
+
*
|
|
14
10
|
* A record is built from the entry that measured the interaction, as that entry arrives:
|
|
15
11
|
* `entry.target` is `null` once the element has left the document.
|
|
16
12
|
*/
|
|
17
13
|
export declare class SlowInteractionList {
|
|
18
14
|
/** Slowest first. */
|
|
19
15
|
private readonly records;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
|
|
16
|
+
private readonly frames;
|
|
17
|
+
/**
|
|
18
|
+
* Takes in what the tracker now says about an interaction, keeping it when it is one of the
|
|
19
|
+
* slowest of the session.
|
|
20
|
+
*
|
|
21
|
+
* @returns whether that changed what a snapshot would carry.
|
|
22
|
+
*/
|
|
23
|
+
trackInteractionUpdate(entry: InteractionEntry, update: InteractionUpdate): boolean;
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* Takes in the frames the browser has just reported and works out again what the frames say about
|
|
26
|
+
* every record — again, because the frames of one interaction can be reported in several batches
|
|
27
|
+
* and the first of them may hold neither its longest script nor all of its style and layout.
|
|
28
|
+
*
|
|
29
|
+
* @returns whether that changed what a snapshot would carry.
|
|
28
30
|
*/
|
|
31
|
+
trackLongAnimationFrames(frames: LongAnimationFrame[]): boolean;
|
|
32
|
+
snapshot(): SlowInteraction[] | undefined;
|
|
29
33
|
private toRecord;
|
|
34
|
+
private attribute;
|
|
35
|
+
/**
|
|
36
|
+
* What the frames say about an interaction, attributed the way `web-vitals` attributes INP: every
|
|
37
|
+
* frame overlapping the interaction counts, the script that counts is the one with the longest
|
|
38
|
+
* part inside it, and style and layout is summed across those frames.
|
|
39
|
+
*
|
|
40
|
+
* @returns nothing when no frame overlaps the interaction — the browser reports frames above
|
|
41
|
+
* 50 ms only.
|
|
42
|
+
*/
|
|
43
|
+
private attributionFor;
|
|
44
|
+
/**
|
|
45
|
+
* Style, layout and paint of the frame, which the browser reports as starting at 0 when the
|
|
46
|
+
* frame did none.
|
|
47
|
+
*/
|
|
48
|
+
private styleAndLayoutOf;
|
|
49
|
+
/** Which phase of the interaction the script ran in, by where it started. */
|
|
50
|
+
private subpartOf;
|
|
51
|
+
private truncated;
|
|
52
|
+
/**
|
|
53
|
+
* The file as the browser named it, content hash and all: that is what identifies the artefact
|
|
54
|
+
* and its source map, and a query can be grouped away downstream.
|
|
55
|
+
*/
|
|
56
|
+
private fileName;
|
|
30
57
|
/**
|
|
31
58
|
* Names the element an interaction happened on — `div[data-vc="x"] > p > span`, outermost first.
|
|
32
59
|
* The path climbs until an element carries an allow-listed attribute, because that is what says
|
|
@@ -35,4 +62,3 @@ export declare class SlowInteractionList {
|
|
|
35
62
|
private describeTarget;
|
|
36
63
|
private identifyingAttribute;
|
|
37
64
|
}
|
|
38
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-interactivity",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Interactivity plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@atlaskit/browser-apis": "^1.2.0",
|
|
23
|
-
"@atlaskit/editor-plugin-analytics": "^16.
|
|
23
|
+
"@atlaskit/editor-plugin-analytics": "^16.1.0",
|
|
24
24
|
"@atlaskit/editor-plugin-context-identifier": "^16.0.0",
|
|
25
25
|
"@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
|
|
26
26
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"bind-event-listener": "^3.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@atlaskit/editor-common": "^120.
|
|
31
|
+
"@atlaskit/editor-common": "^120.10.0",
|
|
32
32
|
"react": "^18.2.0 || ^19.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|