@atlaskit/insm 2.0.15 → 3.0.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 +16 -0
- package/dist/cjs/api.js +0 -10
- package/dist/cjs/insm-session.js +2 -6
- package/dist/cjs/insm.js +0 -51
- package/dist/es2019/api.js +0 -10
- package/dist/es2019/insm-session.js +0 -6
- package/dist/es2019/insm.js +0 -45
- package/dist/esm/api.js +0 -10
- package/dist/esm/insm-session.js +2 -6
- package/dist/esm/insm.js +0 -51
- package/dist/types/api.d.ts +1 -1
- package/dist/types/insm.d.ts +0 -33
- package/package.json +1 -3
- package/dist/cjs/dom-element-count.js +0 -16
- package/dist/cjs/editor-dom-registry.js +0 -65
- package/dist/es2019/dom-element-count.js +0 -10
- package/dist/es2019/editor-dom-registry.js +0 -45
- package/dist/esm/dom-element-count.js +0 -10
- package/dist/esm/editor-dom-registry.js +0 -58
- package/dist/types/dom-element-count.d.ts +0 -8
- package/dist/types/editor-dom-registry.d.ts +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/insm
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`90991a68d675a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/90991a68d675a) -
|
|
8
|
+
Remove the `platform_editor_insm_dom_node_count` experiment, which will not be released. The insm
|
|
9
|
+
measured event no longer reports `editorDomSize`, and the editor no longer registers its content
|
|
10
|
+
DOM with insm.
|
|
11
|
+
|
|
12
|
+
Breaking: `insm.registerEditorDom` and `insm.unregisterEditorDom` are removed, so calls to them
|
|
13
|
+
fail to build.
|
|
14
|
+
|
|
15
|
+
Migration: there is no replacement — the apis existed only to provide the element measured for
|
|
16
|
+
`editorDomSize`. The editor's own `editorDomSize` attribute on its `inp` and `proseMirrorRendered`
|
|
17
|
+
events is unaffected.
|
|
18
|
+
|
|
3
19
|
## 2.0.15
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/api.js
CHANGED
|
@@ -35,16 +35,6 @@ var insm = exports.insm = {
|
|
|
35
35
|
initialisedInsm.endHeavyTask(heavyTaskName);
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
registerEditorDom: function registerEditorDom(editorDom) {
|
|
39
|
-
if (insmInitialised()) {
|
|
40
|
-
initialisedInsm.registerEditorDom(editorDom);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
unregisterEditorDom: function unregisterEditorDom(editorDom) {
|
|
44
|
-
if (insmInitialised()) {
|
|
45
|
-
initialisedInsm.unregisterEditorDom(editorDom);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
38
|
start: function start(experienceKey, experienceProperties) {
|
|
49
39
|
if (insmInitialised()) {
|
|
50
40
|
initialisedInsm.start(experienceKey, experienceProperties);
|
package/dist/cjs/insm-session.js
CHANGED
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _bowserUltralight = _interopRequireDefault(require("bowser-ultralight"));
|
|
12
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
12
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
13
|
var _insmPeriod = require("./insm-period");
|
|
15
14
|
var _LongAnimationFrameMeasurer = require("./session-measurers/LongAnimationFrameMeasurer");
|
|
@@ -205,14 +204,11 @@ var INSMSession = exports.INSMSession = /*#__PURE__*/function () {
|
|
|
205
204
|
var operationalEvent = {
|
|
206
205
|
actionSubject: 'insm',
|
|
207
206
|
action: 'measured',
|
|
208
|
-
attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(
|
|
207
|
+
attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this.staticProperties), evaluatedAddedProperties), {}, {
|
|
209
208
|
'event:population': this.insm.options.population,
|
|
210
209
|
experienceKey: this.experienceKey,
|
|
211
210
|
initial: this.experienceProperties.initial,
|
|
212
|
-
contentId: this.experienceProperties.contentId
|
|
213
|
-
}, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insm_dom_node_count') ? {
|
|
214
|
-
editorDomSize: this.insm.getEditorDomSize()
|
|
215
|
-
} : {}), {}, {
|
|
211
|
+
contentId: this.experienceProperties.contentId,
|
|
216
212
|
timing: {
|
|
217
213
|
startedAt: this.startedAt,
|
|
218
214
|
// Note: this will not match up with the periods sum of durations, as it includes
|
package/dist/cjs/insm.js
CHANGED
|
@@ -8,8 +8,6 @@ exports.INSM = 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 _domElementCount = require("./dom-element-count");
|
|
12
|
-
var _editorDomRegistry = require("./editor-dom-registry");
|
|
13
11
|
var _insmSession = require("./insm-session");
|
|
14
12
|
var _inp = require("./inp-measurers/inp");
|
|
15
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -23,11 +21,6 @@ var INSM = exports.INSM = /*#__PURE__*/function () {
|
|
|
23
21
|
* page session.
|
|
24
22
|
*/
|
|
25
23
|
(0, _defineProperty2.default)(this, "runningHeavyTasks", new Set());
|
|
26
|
-
/**
|
|
27
|
-
* The editor is tracked at the insm layer (rather than per session) as it can
|
|
28
|
-
* outlive, or be mounted after, the session it is measured by.
|
|
29
|
-
*/
|
|
30
|
-
(0, _defineProperty2.default)(this, "editorDomRegistry", new _editorDomRegistry.EditorDomRegistry());
|
|
31
24
|
this.periodMeasurers = [new _inp.INPTracker()];
|
|
32
25
|
this.options = options;
|
|
33
26
|
|
|
@@ -95,50 +88,6 @@ var INSM = exports.INSM = /*#__PURE__*/function () {
|
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
90
|
|
|
98
|
-
/**
|
|
99
|
-
* Registers the page editor's content DOM element (`editorView.dom`) with insm.
|
|
100
|
-
*
|
|
101
|
-
* insm does not locate the editor itself - the element is provided by the editor so
|
|
102
|
-
* that session events can report its DOM element count (`editorDomSize`).
|
|
103
|
-
*
|
|
104
|
-
* A session measures a page, so only the page's own editor should register. Secondary
|
|
105
|
-
* editors (inline comments, nested legacy content extensions) must not, as the
|
|
106
|
-
* reported size would then depend on which editor registered last.
|
|
107
|
-
*
|
|
108
|
-
* ```ts
|
|
109
|
-
* insm.registerEditorDom(editorView.dom);
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
}, {
|
|
113
|
-
key: "registerEditorDom",
|
|
114
|
-
value: function registerEditorDom(editorDom) {
|
|
115
|
-
this.editorDomRegistry.register(editorDom);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Unregisters the editor's content DOM element. This is expected to be called when
|
|
120
|
-
* the editor is destroyed.
|
|
121
|
-
*/
|
|
122
|
-
}, {
|
|
123
|
-
key: "unregisterEditorDom",
|
|
124
|
-
value: function unregisterEditorDom(editorDom) {
|
|
125
|
-
this.editorDomRegistry.unregister(editorDom);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The number of DOM elements inside the registered editor, used as a proxy for
|
|
130
|
-
* document complexity in performance events.
|
|
131
|
-
*
|
|
132
|
-
* Undefined when no editor is registered, or the registered one is no longer in
|
|
133
|
-
* the document.
|
|
134
|
-
*/
|
|
135
|
-
}, {
|
|
136
|
-
key: "getEditorDomSize",
|
|
137
|
-
value: function getEditorDomSize() {
|
|
138
|
-
var editorDom = this.editorDomRegistry.editorDom;
|
|
139
|
-
return editorDom ? (0, _domElementCount.countDomElements)(editorDom) : undefined;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
91
|
/**
|
|
143
92
|
* Call this when starting a new experience. This is expected to be wired to the product
|
|
144
93
|
* routing solution.
|
package/dist/es2019/api.js
CHANGED
|
@@ -28,16 +28,6 @@ export const insm = {
|
|
|
28
28
|
initialisedInsm.endHeavyTask(heavyTaskName);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
registerEditorDom(editorDom) {
|
|
32
|
-
if (insmInitialised()) {
|
|
33
|
-
initialisedInsm.registerEditorDom(editorDom);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
unregisterEditorDom(editorDom) {
|
|
37
|
-
if (insmInitialised()) {
|
|
38
|
-
initialisedInsm.unregisterEditorDom(editorDom);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
31
|
start(experienceKey, experienceProperties) {
|
|
42
32
|
if (insmInitialised()) {
|
|
43
33
|
initialisedInsm.start(experienceKey, experienceProperties);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import Bowser from 'bowser-ultralight';
|
|
3
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { PeriodTracking } from './insm-period';
|
|
6
5
|
import { LongAnimationFrameMeasurer } from './session-measurers/LongAnimationFrameMeasurer';
|
|
@@ -172,11 +171,6 @@ export class INSMSession {
|
|
|
172
171
|
experienceKey: this.experienceKey,
|
|
173
172
|
initial: this.experienceProperties.initial,
|
|
174
173
|
contentId: this.experienceProperties.contentId,
|
|
175
|
-
// The same measurement as the `editorDomSize` attribute on the editor's INP
|
|
176
|
-
// event, sampled from the registered editor when the session ends.
|
|
177
|
-
...(isExperimentEnabled('platform_editor_insm_dom_node_count') ? {
|
|
178
|
-
editorDomSize: this.insm.getEditorDomSize()
|
|
179
|
-
} : {}),
|
|
180
174
|
timing: {
|
|
181
175
|
startedAt: this.startedAt,
|
|
182
176
|
// Note: this will not match up with the periods sum of durations, as it includes
|
package/dist/es2019/insm.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { countDomElements } from './dom-element-count';
|
|
3
|
-
import { EditorDomRegistry } from './editor-dom-registry';
|
|
4
2
|
import { INSMSession } from './insm-session';
|
|
5
3
|
import { INPTracker } from './inp-measurers/inp';
|
|
6
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -12,11 +10,6 @@ export class INSM {
|
|
|
12
10
|
* page session.
|
|
13
11
|
*/
|
|
14
12
|
_defineProperty(this, "runningHeavyTasks", new Set());
|
|
15
|
-
/**
|
|
16
|
-
* The editor is tracked at the insm layer (rather than per session) as it can
|
|
17
|
-
* outlive, or be mounted after, the session it is measured by.
|
|
18
|
-
*/
|
|
19
|
-
_defineProperty(this, "editorDomRegistry", new EditorDomRegistry());
|
|
20
13
|
this.periodMeasurers = [new INPTracker()];
|
|
21
14
|
this.options = options;
|
|
22
15
|
|
|
@@ -78,44 +71,6 @@ export class INSM {
|
|
|
78
71
|
}
|
|
79
72
|
}
|
|
80
73
|
|
|
81
|
-
/**
|
|
82
|
-
* Registers the page editor's content DOM element (`editorView.dom`) with insm.
|
|
83
|
-
*
|
|
84
|
-
* insm does not locate the editor itself - the element is provided by the editor so
|
|
85
|
-
* that session events can report its DOM element count (`editorDomSize`).
|
|
86
|
-
*
|
|
87
|
-
* A session measures a page, so only the page's own editor should register. Secondary
|
|
88
|
-
* editors (inline comments, nested legacy content extensions) must not, as the
|
|
89
|
-
* reported size would then depend on which editor registered last.
|
|
90
|
-
*
|
|
91
|
-
* ```ts
|
|
92
|
-
* insm.registerEditorDom(editorView.dom);
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
registerEditorDom(editorDom) {
|
|
96
|
-
this.editorDomRegistry.register(editorDom);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Unregisters the editor's content DOM element. This is expected to be called when
|
|
101
|
-
* the editor is destroyed.
|
|
102
|
-
*/
|
|
103
|
-
unregisterEditorDom(editorDom) {
|
|
104
|
-
this.editorDomRegistry.unregister(editorDom);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The number of DOM elements inside the registered editor, used as a proxy for
|
|
109
|
-
* document complexity in performance events.
|
|
110
|
-
*
|
|
111
|
-
* Undefined when no editor is registered, or the registered one is no longer in
|
|
112
|
-
* the document.
|
|
113
|
-
*/
|
|
114
|
-
getEditorDomSize() {
|
|
115
|
-
const editorDom = this.editorDomRegistry.editorDom;
|
|
116
|
-
return editorDom ? countDomElements(editorDom) : undefined;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
74
|
/**
|
|
120
75
|
* Call this when starting a new experience. This is expected to be wired to the product
|
|
121
76
|
* routing solution.
|
package/dist/esm/api.js
CHANGED
|
@@ -28,16 +28,6 @@ export var insm = {
|
|
|
28
28
|
initialisedInsm.endHeavyTask(heavyTaskName);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
registerEditorDom: function registerEditorDom(editorDom) {
|
|
32
|
-
if (insmInitialised()) {
|
|
33
|
-
initialisedInsm.registerEditorDom(editorDom);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
unregisterEditorDom: function unregisterEditorDom(editorDom) {
|
|
37
|
-
if (insmInitialised()) {
|
|
38
|
-
initialisedInsm.unregisterEditorDom(editorDom);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
31
|
start: function start(experienceKey, experienceProperties) {
|
|
42
32
|
if (insmInitialised()) {
|
|
43
33
|
initialisedInsm.start(experienceKey, experienceProperties);
|
package/dist/esm/insm-session.js
CHANGED
|
@@ -7,7 +7,6 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
7
7
|
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; } }
|
|
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 Bowser from 'bowser-ultralight';
|
|
10
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
11
|
import { PeriodTracking } from './insm-period';
|
|
13
12
|
import { LongAnimationFrameMeasurer } from './session-measurers/LongAnimationFrameMeasurer';
|
|
@@ -199,14 +198,11 @@ export var INSMSession = /*#__PURE__*/function () {
|
|
|
199
198
|
var operationalEvent = {
|
|
200
199
|
actionSubject: 'insm',
|
|
201
200
|
action: 'measured',
|
|
202
|
-
attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread(
|
|
201
|
+
attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this.staticProperties), evaluatedAddedProperties), {}, {
|
|
203
202
|
'event:population': this.insm.options.population,
|
|
204
203
|
experienceKey: this.experienceKey,
|
|
205
204
|
initial: this.experienceProperties.initial,
|
|
206
|
-
contentId: this.experienceProperties.contentId
|
|
207
|
-
}, isExperimentEnabled('platform_editor_insm_dom_node_count') ? {
|
|
208
|
-
editorDomSize: this.insm.getEditorDomSize()
|
|
209
|
-
} : {}), {}, {
|
|
205
|
+
contentId: this.experienceProperties.contentId,
|
|
210
206
|
timing: {
|
|
211
207
|
startedAt: this.startedAt,
|
|
212
208
|
// Note: this will not match up with the periods sum of durations, as it includes
|
package/dist/esm/insm.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
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
|
-
import { countDomElements } from './dom-element-count';
|
|
5
|
-
import { EditorDomRegistry } from './editor-dom-registry';
|
|
6
4
|
import { INSMSession } from './insm-session';
|
|
7
5
|
import { INPTracker } from './inp-measurers/inp';
|
|
8
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -16,11 +14,6 @@ export var INSM = /*#__PURE__*/function () {
|
|
|
16
14
|
* page session.
|
|
17
15
|
*/
|
|
18
16
|
_defineProperty(this, "runningHeavyTasks", new Set());
|
|
19
|
-
/**
|
|
20
|
-
* The editor is tracked at the insm layer (rather than per session) as it can
|
|
21
|
-
* outlive, or be mounted after, the session it is measured by.
|
|
22
|
-
*/
|
|
23
|
-
_defineProperty(this, "editorDomRegistry", new EditorDomRegistry());
|
|
24
17
|
this.periodMeasurers = [new INPTracker()];
|
|
25
18
|
this.options = options;
|
|
26
19
|
|
|
@@ -88,50 +81,6 @@ export var INSM = /*#__PURE__*/function () {
|
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
|
|
91
|
-
/**
|
|
92
|
-
* Registers the page editor's content DOM element (`editorView.dom`) with insm.
|
|
93
|
-
*
|
|
94
|
-
* insm does not locate the editor itself - the element is provided by the editor so
|
|
95
|
-
* that session events can report its DOM element count (`editorDomSize`).
|
|
96
|
-
*
|
|
97
|
-
* A session measures a page, so only the page's own editor should register. Secondary
|
|
98
|
-
* editors (inline comments, nested legacy content extensions) must not, as the
|
|
99
|
-
* reported size would then depend on which editor registered last.
|
|
100
|
-
*
|
|
101
|
-
* ```ts
|
|
102
|
-
* insm.registerEditorDom(editorView.dom);
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
}, {
|
|
106
|
-
key: "registerEditorDom",
|
|
107
|
-
value: function registerEditorDom(editorDom) {
|
|
108
|
-
this.editorDomRegistry.register(editorDom);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Unregisters the editor's content DOM element. This is expected to be called when
|
|
113
|
-
* the editor is destroyed.
|
|
114
|
-
*/
|
|
115
|
-
}, {
|
|
116
|
-
key: "unregisterEditorDom",
|
|
117
|
-
value: function unregisterEditorDom(editorDom) {
|
|
118
|
-
this.editorDomRegistry.unregister(editorDom);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The number of DOM elements inside the registered editor, used as a proxy for
|
|
123
|
-
* document complexity in performance events.
|
|
124
|
-
*
|
|
125
|
-
* Undefined when no editor is registered, or the registered one is no longer in
|
|
126
|
-
* the document.
|
|
127
|
-
*/
|
|
128
|
-
}, {
|
|
129
|
-
key: "getEditorDomSize",
|
|
130
|
-
value: function getEditorDomSize() {
|
|
131
|
-
var editorDom = this.editorDomRegistry.editorDom;
|
|
132
|
-
return editorDom ? countDomElements(editorDom) : undefined;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
84
|
/**
|
|
136
85
|
* Call this when starting a new experience. This is expected to be wired to the product
|
|
137
86
|
* routing solution.
|
package/dist/types/api.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export declare function init(options: INSMOptions): void;
|
|
|
8
8
|
/**
|
|
9
9
|
* **In**teractivity **s**ession **m**onitoring
|
|
10
10
|
*/
|
|
11
|
-
export declare const insm: Pick<INSM, 'start' | 'stopEarly' | 'startHeavyTask' | 'endHeavyTask' | 'overrideExperienceKey'
|
|
11
|
+
export declare const insm: Pick<INSM, 'start' | 'stopEarly' | 'startHeavyTask' | 'endHeavyTask' | 'overrideExperienceKey'> & {
|
|
12
12
|
session: Pick<INSMSession, 'details' | 'startFeature' | 'endFeature' | 'addProperties' | 'setProperty'> | undefined;
|
|
13
13
|
};
|
package/dist/types/insm.d.ts
CHANGED
|
@@ -13,11 +13,6 @@ export declare class INSM {
|
|
|
13
13
|
* page session.
|
|
14
14
|
*/
|
|
15
15
|
runningHeavyTasks: Set<string>;
|
|
16
|
-
/**
|
|
17
|
-
* The editor is tracked at the insm layer (rather than per session) as it can
|
|
18
|
-
* outlive, or be mounted after, the session it is measured by.
|
|
19
|
-
*/
|
|
20
|
-
private editorDomRegistry;
|
|
21
16
|
constructor(options: INSMOptions);
|
|
22
17
|
/**
|
|
23
18
|
* Starts a heavy task in the currently running session.
|
|
@@ -32,34 +27,6 @@ export declare class INSM {
|
|
|
32
27
|
* Ends a heavy task in the currently running session
|
|
33
28
|
*/
|
|
34
29
|
endHeavyTask(heavyTaskName: string): void;
|
|
35
|
-
/**
|
|
36
|
-
* Registers the page editor's content DOM element (`editorView.dom`) with insm.
|
|
37
|
-
*
|
|
38
|
-
* insm does not locate the editor itself - the element is provided by the editor so
|
|
39
|
-
* that session events can report its DOM element count (`editorDomSize`).
|
|
40
|
-
*
|
|
41
|
-
* A session measures a page, so only the page's own editor should register. Secondary
|
|
42
|
-
* editors (inline comments, nested legacy content extensions) must not, as the
|
|
43
|
-
* reported size would then depend on which editor registered last.
|
|
44
|
-
*
|
|
45
|
-
* ```ts
|
|
46
|
-
* insm.registerEditorDom(editorView.dom);
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
registerEditorDom(editorDom: HTMLElement): void;
|
|
50
|
-
/**
|
|
51
|
-
* Unregisters the editor's content DOM element. This is expected to be called when
|
|
52
|
-
* the editor is destroyed.
|
|
53
|
-
*/
|
|
54
|
-
unregisterEditorDom(editorDom: HTMLElement): void;
|
|
55
|
-
/**
|
|
56
|
-
* The number of DOM elements inside the registered editor, used as a proxy for
|
|
57
|
-
* document complexity in performance events.
|
|
58
|
-
*
|
|
59
|
-
* Undefined when no editor is registered, or the registered one is no longer in
|
|
60
|
-
* the document.
|
|
61
|
-
*/
|
|
62
|
-
getEditorDomSize(): number | undefined;
|
|
63
30
|
/**
|
|
64
31
|
* Call this when starting a new experience. This is expected to be wired to the product
|
|
65
32
|
* routing solution.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/insm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "INSM tooling measures user-perceived interactivity of a page",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"atlaskit:src": "src/index.ts",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@atlaskit/analytics-listeners": "^11.1.0",
|
|
21
|
-
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
22
21
|
"@atlaskit/tmp-editor-statsig": "^161.0.0",
|
|
23
22
|
"@babel/runtime": "^7.0.0",
|
|
24
23
|
"bowser-ultralight": "^1.0.6"
|
|
@@ -27,7 +26,6 @@
|
|
|
27
26
|
"react": "^18.2.0 || ^19.2.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@atlassian/experiment-test-utils": "^0.2.0",
|
|
31
29
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
32
30
|
"react": "^19.2.0"
|
|
33
31
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.countDomElements = countDomElements;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the total number of DOM elements inside the given element.
|
|
9
|
-
*
|
|
10
|
-
* Uses the native `getElementsByTagName('*')`, which counts descendants iteratively in the
|
|
11
|
-
* browser engine -- intentionally not a recursive JS walk, so it can't overflow the stack on
|
|
12
|
-
* very large documents.
|
|
13
|
-
*/
|
|
14
|
-
function countDomElements(element) {
|
|
15
|
-
return element.getElementsByTagName('*').length;
|
|
16
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.EditorDomRegistry = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
/**
|
|
11
|
-
* Holds the page editor's content DOM.
|
|
12
|
-
*
|
|
13
|
-
* insm holds no reference to the editor, so the element is registered from the outside — it is
|
|
14
|
-
* the same `editorView.dom` element the editor measures for the `editorDomSize` attribute on
|
|
15
|
-
* its INP event.
|
|
16
|
-
*
|
|
17
|
-
* Only the page editor registers itself: an insm session measures a page, and secondary
|
|
18
|
-
* editors on the page (inline comments, nested legacy content extensions) would make the
|
|
19
|
-
* registration ambiguous.
|
|
20
|
-
*
|
|
21
|
-
* The element is held via a `WeakRef` so a destroyed editor's DOM can be collected even if
|
|
22
|
-
* `unregister` is never reached.
|
|
23
|
-
*/
|
|
24
|
-
var EditorDomRegistry = exports.EditorDomRegistry = /*#__PURE__*/function () {
|
|
25
|
-
function EditorDomRegistry() {
|
|
26
|
-
(0, _classCallCheck2.default)(this, EditorDomRegistry);
|
|
27
|
-
}
|
|
28
|
-
return (0, _createClass2.default)(EditorDomRegistry, [{
|
|
29
|
-
key: "register",
|
|
30
|
-
value:
|
|
31
|
-
/**
|
|
32
|
-
* Registers the page editor's content DOM element (`editorView.dom`).
|
|
33
|
-
*/
|
|
34
|
-
function register(editorDom) {
|
|
35
|
-
this.registered = new WeakRef(editorDom);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Unregisters an editor's content DOM element. Expected to be called when the editor is
|
|
40
|
-
* destroyed. Ignored when a different editor is currently registered, so an editor being
|
|
41
|
-
* torn down after its replacement registered does not clear the newer one.
|
|
42
|
-
*/
|
|
43
|
-
}, {
|
|
44
|
-
key: "unregister",
|
|
45
|
-
value: function unregister(editorDom) {
|
|
46
|
-
var _this$registered;
|
|
47
|
-
if (((_this$registered = this.registered) === null || _this$registered === void 0 ? void 0 : _this$registered.deref()) === editorDom) {
|
|
48
|
-
this.registered = undefined;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The registered editor's content DOM, or undefined when no editor is registered or the
|
|
54
|
-
* registered one is no longer in the document -- ie. an experience without a page editor,
|
|
55
|
-
* or a session which outlived the editor.
|
|
56
|
-
*/
|
|
57
|
-
}, {
|
|
58
|
-
key: "editorDom",
|
|
59
|
-
get: function get() {
|
|
60
|
-
var _this$registered2;
|
|
61
|
-
var editorDom = (_this$registered2 = this.registered) === null || _this$registered2 === void 0 ? void 0 : _this$registered2.deref();
|
|
62
|
-
return editorDom !== null && editorDom !== void 0 && editorDom.isConnected ? editorDom : undefined;
|
|
63
|
-
}
|
|
64
|
-
}]);
|
|
65
|
-
}();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the total number of DOM elements inside the given element.
|
|
3
|
-
*
|
|
4
|
-
* Uses the native `getElementsByTagName('*')`, which counts descendants iteratively in the
|
|
5
|
-
* browser engine -- intentionally not a recursive JS walk, so it can't overflow the stack on
|
|
6
|
-
* very large documents.
|
|
7
|
-
*/
|
|
8
|
-
export function countDomElements(element) {
|
|
9
|
-
return element.getElementsByTagName('*').length;
|
|
10
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Holds the page editor's content DOM.
|
|
3
|
-
*
|
|
4
|
-
* insm holds no reference to the editor, so the element is registered from the outside — it is
|
|
5
|
-
* the same `editorView.dom` element the editor measures for the `editorDomSize` attribute on
|
|
6
|
-
* its INP event.
|
|
7
|
-
*
|
|
8
|
-
* Only the page editor registers itself: an insm session measures a page, and secondary
|
|
9
|
-
* editors on the page (inline comments, nested legacy content extensions) would make the
|
|
10
|
-
* registration ambiguous.
|
|
11
|
-
*
|
|
12
|
-
* The element is held via a `WeakRef` so a destroyed editor's DOM can be collected even if
|
|
13
|
-
* `unregister` is never reached.
|
|
14
|
-
*/
|
|
15
|
-
export class EditorDomRegistry {
|
|
16
|
-
/**
|
|
17
|
-
* Registers the page editor's content DOM element (`editorView.dom`).
|
|
18
|
-
*/
|
|
19
|
-
register(editorDom) {
|
|
20
|
-
this.registered = new WeakRef(editorDom);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Unregisters an editor's content DOM element. Expected to be called when the editor is
|
|
25
|
-
* destroyed. Ignored when a different editor is currently registered, so an editor being
|
|
26
|
-
* torn down after its replacement registered does not clear the newer one.
|
|
27
|
-
*/
|
|
28
|
-
unregister(editorDom) {
|
|
29
|
-
var _this$registered;
|
|
30
|
-
if (((_this$registered = this.registered) === null || _this$registered === void 0 ? void 0 : _this$registered.deref()) === editorDom) {
|
|
31
|
-
this.registered = undefined;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The registered editor's content DOM, or undefined when no editor is registered or the
|
|
37
|
-
* registered one is no longer in the document -- ie. an experience without a page editor,
|
|
38
|
-
* or a session which outlived the editor.
|
|
39
|
-
*/
|
|
40
|
-
get editorDom() {
|
|
41
|
-
var _this$registered2;
|
|
42
|
-
const editorDom = (_this$registered2 = this.registered) === null || _this$registered2 === void 0 ? void 0 : _this$registered2.deref();
|
|
43
|
-
return editorDom !== null && editorDom !== void 0 && editorDom.isConnected ? editorDom : undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the total number of DOM elements inside the given element.
|
|
3
|
-
*
|
|
4
|
-
* Uses the native `getElementsByTagName('*')`, which counts descendants iteratively in the
|
|
5
|
-
* browser engine -- intentionally not a recursive JS walk, so it can't overflow the stack on
|
|
6
|
-
* very large documents.
|
|
7
|
-
*/
|
|
8
|
-
export function countDomElements(element) {
|
|
9
|
-
return element.getElementsByTagName('*').length;
|
|
10
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
/**
|
|
4
|
-
* Holds the page editor's content DOM.
|
|
5
|
-
*
|
|
6
|
-
* insm holds no reference to the editor, so the element is registered from the outside — it is
|
|
7
|
-
* the same `editorView.dom` element the editor measures for the `editorDomSize` attribute on
|
|
8
|
-
* its INP event.
|
|
9
|
-
*
|
|
10
|
-
* Only the page editor registers itself: an insm session measures a page, and secondary
|
|
11
|
-
* editors on the page (inline comments, nested legacy content extensions) would make the
|
|
12
|
-
* registration ambiguous.
|
|
13
|
-
*
|
|
14
|
-
* The element is held via a `WeakRef` so a destroyed editor's DOM can be collected even if
|
|
15
|
-
* `unregister` is never reached.
|
|
16
|
-
*/
|
|
17
|
-
export var EditorDomRegistry = /*#__PURE__*/function () {
|
|
18
|
-
function EditorDomRegistry() {
|
|
19
|
-
_classCallCheck(this, EditorDomRegistry);
|
|
20
|
-
}
|
|
21
|
-
return _createClass(EditorDomRegistry, [{
|
|
22
|
-
key: "register",
|
|
23
|
-
value:
|
|
24
|
-
/**
|
|
25
|
-
* Registers the page editor's content DOM element (`editorView.dom`).
|
|
26
|
-
*/
|
|
27
|
-
function register(editorDom) {
|
|
28
|
-
this.registered = new WeakRef(editorDom);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Unregisters an editor's content DOM element. Expected to be called when the editor is
|
|
33
|
-
* destroyed. Ignored when a different editor is currently registered, so an editor being
|
|
34
|
-
* torn down after its replacement registered does not clear the newer one.
|
|
35
|
-
*/
|
|
36
|
-
}, {
|
|
37
|
-
key: "unregister",
|
|
38
|
-
value: function unregister(editorDom) {
|
|
39
|
-
var _this$registered;
|
|
40
|
-
if (((_this$registered = this.registered) === null || _this$registered === void 0 ? void 0 : _this$registered.deref()) === editorDom) {
|
|
41
|
-
this.registered = undefined;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The registered editor's content DOM, or undefined when no editor is registered or the
|
|
47
|
-
* registered one is no longer in the document -- ie. an experience without a page editor,
|
|
48
|
-
* or a session which outlived the editor.
|
|
49
|
-
*/
|
|
50
|
-
}, {
|
|
51
|
-
key: "editorDom",
|
|
52
|
-
get: function get() {
|
|
53
|
-
var _this$registered2;
|
|
54
|
-
var editorDom = (_this$registered2 = this.registered) === null || _this$registered2 === void 0 ? void 0 : _this$registered2.deref();
|
|
55
|
-
return editorDom !== null && editorDom !== void 0 && editorDom.isConnected ? editorDom : undefined;
|
|
56
|
-
}
|
|
57
|
-
}]);
|
|
58
|
-
}();
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the total number of DOM elements inside the given element.
|
|
3
|
-
*
|
|
4
|
-
* Uses the native `getElementsByTagName('*')`, which counts descendants iteratively in the
|
|
5
|
-
* browser engine -- intentionally not a recursive JS walk, so it can't overflow the stack on
|
|
6
|
-
* very large documents.
|
|
7
|
-
*/
|
|
8
|
-
export declare function countDomElements(element: Element): number;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Holds the page editor's content DOM.
|
|
3
|
-
*
|
|
4
|
-
* insm holds no reference to the editor, so the element is registered from the outside — it is
|
|
5
|
-
* the same `editorView.dom` element the editor measures for the `editorDomSize` attribute on
|
|
6
|
-
* its INP event.
|
|
7
|
-
*
|
|
8
|
-
* Only the page editor registers itself: an insm session measures a page, and secondary
|
|
9
|
-
* editors on the page (inline comments, nested legacy content extensions) would make the
|
|
10
|
-
* registration ambiguous.
|
|
11
|
-
*
|
|
12
|
-
* The element is held via a `WeakRef` so a destroyed editor's DOM can be collected even if
|
|
13
|
-
* `unregister` is never reached.
|
|
14
|
-
*/
|
|
15
|
-
export declare class EditorDomRegistry {
|
|
16
|
-
private registered;
|
|
17
|
-
/**
|
|
18
|
-
* Registers the page editor's content DOM element (`editorView.dom`).
|
|
19
|
-
*/
|
|
20
|
-
register(editorDom: HTMLElement): void;
|
|
21
|
-
/**
|
|
22
|
-
* Unregisters an editor's content DOM element. Expected to be called when the editor is
|
|
23
|
-
* destroyed. Ignored when a different editor is currently registered, so an editor being
|
|
24
|
-
* torn down after its replacement registered does not clear the newer one.
|
|
25
|
-
*/
|
|
26
|
-
unregister(editorDom: HTMLElement): void;
|
|
27
|
-
/**
|
|
28
|
-
* The registered editor's content DOM, or undefined when no editor is registered or the
|
|
29
|
-
* registered one is no longer in the document -- ie. an experience without a page editor,
|
|
30
|
-
* or a session which outlived the editor.
|
|
31
|
-
*/
|
|
32
|
-
get editorDom(): HTMLElement | undefined;
|
|
33
|
-
}
|