@atlaskit/editor-core 234.3.0 → 234.3.2

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/create-editor/editorNativeAnchorSupportPlugin.js +2 -7
  3. package/dist/cjs/presets/universal.js +1 -4
  4. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-compiled.compiled.css +0 -1
  5. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-compiled.js +3 -2
  6. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea-emotion.js +1 -25
  7. package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.compiled.css +1 -0
  8. package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.js +2 -1
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/es2019/create-editor/editorNativeAnchorSupportPlugin.js +2 -7
  11. package/dist/es2019/presets/universal.js +1 -4
  12. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-compiled.compiled.css +0 -1
  13. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-compiled.js +3 -2
  14. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea-emotion.js +1 -25
  15. package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.compiled.css +1 -0
  16. package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.js +2 -1
  17. package/dist/es2019/version-wrapper.js +1 -1
  18. package/dist/esm/create-editor/editorNativeAnchorSupportPlugin.js +2 -7
  19. package/dist/esm/presets/universal.js +1 -4
  20. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-compiled.compiled.css +0 -1
  21. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-compiled.js +3 -2
  22. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea-emotion.js +1 -25
  23. package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.compiled.css +1 -0
  24. package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.js +2 -1
  25. package/dist/esm/version-wrapper.js +1 -1
  26. package/package.json +6 -6
  27. package/dist/cjs/utils/performance/outlier.js +0 -16
  28. package/dist/cjs/utils/performance/percentile.js +0 -22
  29. package/dist/cjs/utils/performance/plugin-performance-observer.js +0 -131
  30. package/dist/cjs/utils/performance/plugin-performance-report.js +0 -190
  31. package/dist/cjs/utils/performance/simple-measure-to-entries.js +0 -101
  32. package/dist/es2019/utils/performance/outlier.js +0 -10
  33. package/dist/es2019/utils/performance/percentile.js +0 -14
  34. package/dist/es2019/utils/performance/plugin-performance-observer.js +0 -88
  35. package/dist/es2019/utils/performance/plugin-performance-report.js +0 -133
  36. package/dist/es2019/utils/performance/simple-measure-to-entries.js +0 -83
  37. package/dist/esm/utils/performance/outlier.js +0 -10
  38. package/dist/esm/utils/performance/percentile.js +0 -16
  39. package/dist/esm/utils/performance/plugin-performance-observer.js +0 -124
  40. package/dist/esm/utils/performance/plugin-performance-report.js +0 -183
  41. package/dist/esm/utils/performance/simple-measure-to-entries.js +0 -94
  42. package/dist/types/utils/performance/outlier.d.ts +0 -1
  43. package/dist/types/utils/performance/percentile.d.ts +0 -1
  44. package/dist/types/utils/performance/plugin-performance-observer.d.ts +0 -23
  45. package/dist/types/utils/performance/plugin-performance-report.d.ts +0 -47
  46. package/dist/types/utils/performance/simple-measure-to-entries.d.ts +0 -28
@@ -1,183 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import { outlier } from './outlier';
8
- import { EVENT_NAME_ON_CHANGE, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED } from './track-transactions';
9
- export var PluginPerformanceReport = /*#__PURE__*/function () {
10
- function PluginPerformanceReport(entry) {
11
- var _this = this;
12
- _classCallCheck(this, PluginPerformanceReport);
13
- _defineProperty(this, "count", 0);
14
- _defineProperty(this, "pluginNames", []);
15
- _defineProperty(this, "nodes", {});
16
- _defineProperty(this, "extensionNodes", {});
17
- _defineProperty(this, "nodesDuration", 0);
18
- _defineProperty(this, "plugins", {});
19
- _defineProperty(this, "slowPlugins", {});
20
- _defineProperty(this, "options", {
21
- samplingRate: 100,
22
- slowThreshold: 300,
23
- outlierThreshold: 30,
24
- outlierFactor: 3
25
- });
26
- _defineProperty(this, "isChild", function (child) {
27
- return child.startTime >= _this.entry.startTime && child.startTime + child.duration <= _this.entry.startTime + _this.entry.duration;
28
- });
29
- this.entry = entry;
30
- }
31
- return _createClass(PluginPerformanceReport, [{
32
- key: "getEntryByName",
33
- value: function getEntryByName(entryList, name) {
34
- return entryList.getEntriesByName(name).find(this.isChild);
35
- }
36
- }, {
37
- key: "getMethodSum",
38
- value: function getMethodSum(methods) {
39
- return Object.values(methods).reduce(function (a, b) {
40
- return a + b;
41
- }, 0);
42
- }
43
- }, {
44
- key: "greaterEquals",
45
- value: function greaterEquals(a, b) {
46
- return typeof b === 'number' ? a >= b : false;
47
- }
48
- }, {
49
- key: "hasOutlierMethods",
50
- value: function hasOutlierMethods(methods, outliers) {
51
- return this.greaterEquals(methods.stateApply, outliers.stateApplyOutlier) || this.greaterEquals(methods.viewUpdate, outliers.viewUpdateOutlier);
52
- }
53
- }, {
54
- key: "trigger",
55
- get: function get() {
56
- if (this.entry.duration > this.options.slowThreshold) {
57
- return 'slow';
58
- } else if (this.hasSlowPlugins && this.entry.duration > this.options.outlierThreshold) {
59
- return 'distribution';
60
- } else if (this.count > 0 && this.count % this.options.samplingRate === 0) {
61
- return 'sample';
62
- } else {
63
- return 'none';
64
- }
65
- }
66
- }, {
67
- key: "hasSlowPlugins",
68
- get: function get() {
69
- return Object.keys(this.slowPlugins).length > 0;
70
- }
71
- }, {
72
- key: "withEntryList",
73
- value: function withEntryList(entryList) {
74
- this.entryList = entryList;
75
- this.stateApplied = this.getEntryByName(entryList, EVENT_NAME_STATE_APPLY);
76
- this.viewUpdated = this.getEntryByName(entryList, EVENT_NAME_UPDATE_STATE);
77
- this.onChangeCalled = this.getEntryByName(entryList, EVENT_NAME_ON_CHANGE);
78
- this.onEditorViewStateUpdatedCalled = this.getEntryByName(entryList, EVENT_NAME_VIEW_STATE_UPDATED);
79
- this.withPlugins(this.pluginNames);
80
- return this;
81
- }
82
- }, {
83
- key: "withPlugins",
84
- value: function withPlugins(pluginNames) {
85
- var _this2 = this;
86
- var emptyEntry = {
87
- duration: 0
88
- };
89
- this.pluginNames = pluginNames;
90
- this.plugins = pluginNames.reduce(function (acc, name) {
91
- var pluginApplied = _this2.entryList ? _this2.getEntryByName(_this2.entryList, "\uD83E\uDD89".concat(name, "::apply")) || emptyEntry : emptyEntry;
92
- var pluginViewUpdated = _this2.entryList ? _this2.getEntryByName(_this2.entryList, "\uD83E\uDD89".concat(name, "::view::update")) || emptyEntry : emptyEntry;
93
- var pluginOnEditorViewStateUpdated = _this2.entryList ? _this2.getEntryByName(_this2.entryList, "\uD83E\uDD89".concat(name, "::onEditorViewStateUpdated")) || emptyEntry : emptyEntry;
94
- acc[name] = {
95
- stateApply: pluginApplied.duration,
96
- viewUpdate: pluginViewUpdated.duration,
97
- onEditorViewStateUpdated: pluginOnEditorViewStateUpdated.duration
98
- };
99
- return acc;
100
- }, {});
101
- if (this.stateApplied && pluginNames.length > 0) {
102
- var pluginEntries = Object.entries(this.plugins);
103
- var stateApplyOutlier = outlier(pluginEntries.map(function (_ref) {
104
- var _ref2 = _slicedToArray(_ref, 2),
105
- stateApply = _ref2[1].stateApply;
106
- return stateApply;
107
- }), this.options.outlierFactor);
108
- var viewUpdateOutlier = outlier(pluginEntries.map(function (_ref3) {
109
- var _ref4 = _slicedToArray(_ref3, 2),
110
- viewUpdate = _ref4[1].viewUpdate;
111
- return viewUpdate;
112
- }), this.options.outlierFactor);
113
- var budget = this.options.outlierThreshold / pluginEntries.length;
114
-
115
- /**
116
- * Consider plugin methods slow that are
117
- * statistically significantly slower than peers
118
- * AND where the sum of methods for a plugin is slower than 16.7ms / plugins.length
119
- */
120
- var pluginIsOutlier = function pluginIsOutlier(_ref5) {
121
- var _ref6 = _slicedToArray(_ref5, 2),
122
- methods = _ref6[1];
123
- return _this2.getMethodSum(methods) > budget && _this2.hasOutlierMethods(methods, {
124
- stateApplyOutlier: stateApplyOutlier,
125
- viewUpdateOutlier: viewUpdateOutlier
126
- });
127
- };
128
- this.slowPlugins = pluginEntries.filter(pluginIsOutlier).reduce(function (acc, _ref7) {
129
- var _ref8 = _slicedToArray(_ref7, 2),
130
- n = _ref8[0],
131
- d = _ref8[1];
132
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, n, d));
133
- }, {});
134
- }
135
- return this;
136
- }
137
- }, {
138
- key: "withNodes",
139
- value: function withNodes(nodesCount) {
140
- var nodesDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
141
- this.nodes = nodesCount.nodeCount;
142
- this.extensionNodes = nodesCount.extensionNodeCount;
143
- this.nodesDuration = nodesDuration;
144
- return this;
145
- }
146
- }, {
147
- key: "withCount",
148
- value: function withCount(count) {
149
- this.count = count;
150
- return this;
151
- }
152
- }, {
153
- key: "withOptions",
154
- value: function withOptions(options) {
155
- Object.assign(this.options, options);
156
- return this;
157
- }
158
- }, {
159
- key: "toJSON",
160
- value: function toJSON() {
161
- return {
162
- trigger: this.trigger,
163
- duration: this.entry.duration,
164
- nodes: this.nodes,
165
- extensionNodes: this.extensionNodes,
166
- plugins: this.plugins,
167
- slowPlugins: this.slowPlugins,
168
- stepDurations: {
169
- stateApply: this.stateApplied ? this.stateApplied.duration : 0,
170
- viewUpdate: this.viewUpdated ? this.viewUpdated.duration : 0,
171
- onChange: this.onChangeCalled ? this.onChangeCalled.duration : 0,
172
- onEditorViewStateUpdated: this.onEditorViewStateUpdatedCalled ? this.onEditorViewStateUpdatedCalled.duration : 0,
173
- countNodes: this.nodesDuration
174
- }
175
- };
176
- }
177
- }], [{
178
- key: "fromEntry",
179
- value: function fromEntry(entry) {
180
- return new PluginPerformanceReport(entry);
181
- }
182
- }]);
183
- }();
@@ -1,94 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_ON_CHANGE, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED } from './track-transactions';
6
- var EVENT_NAMES = [EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE, EVENT_NAME_DISPATCH_TRANSACTION];
7
-
8
- /**
9
- * A class that logs and collates measurement entries until
10
- * EVENT_NAME_DISPATCHTRANSACTION is detected.
11
- *
12
- * At that point, it will group together all the entries
13
- * logged and fire a callback with all entries packaged
14
- * into a PerformanceObserverEntryList.
15
- *
16
- * We are able to make use of this method as the measurements
17
- * which occur during dispatchTransactions are synchronous.
18
- */
19
- export var SimpleMeasurementLogger = /*#__PURE__*/_createClass(function SimpleMeasurementLogger() {
20
- var _this = this;
21
- _classCallCheck(this, SimpleMeasurementLogger);
22
- _defineProperty(this, "currentBatch", []);
23
- _defineProperty(this, "pluginNameCache", new Set());
24
- _defineProperty(this, "setPluginNames", function (names) {
25
- _this.pluginNameCache = new Set(names);
26
- });
27
- _defineProperty(this, "setOnObservation", function (callback) {
28
- _this.observationCallback = callback;
29
- });
30
- _defineProperty(this, "createPerformanceEntry", function (reading) {
31
- return {
32
- entryType: 'mark',
33
- name: reading.name,
34
- startTime: reading.startTime,
35
- duration: reading.duration,
36
- toJSON: function toJSON() {
37
- return JSON.stringify({
38
- entryType: 'mark',
39
- name: reading.name,
40
- startTime: reading.startTime,
41
- duration: reading.duration
42
- });
43
- }
44
- };
45
- });
46
- _defineProperty(this, "convertToEntryList", function (batch) {
47
- return {
48
- getEntries: function getEntries() {
49
- return batch;
50
- },
51
- // We ignore type because we only store type of mark in batch
52
- getEntriesByName: function getEntriesByName(name, type) {
53
- return batch.filter(function (entry) {
54
- return entry.name === name;
55
- });
56
- },
57
- getEntriesByType: function getEntriesByType(type) {
58
- return batch;
59
- }
60
- };
61
- });
62
- _defineProperty(this, "observed", function (reading) {
63
- // Given that this is only used for tracking transactions and
64
- // transactions are synchronous, we can assume that anything measured
65
- // between EVENT_NAME_DISPATCHTRANSACTION is encapsulated.
66
- var name = reading.name;
67
-
68
- // Transaction tracking event are prefixed with Owl emoji
69
- if (name.startsWith('🦉')) {
70
- var _name$split$;
71
- // check if its logging InstrumentedPlugin.state.apply()
72
- var pluginName = ((_name$split$ = name.split(':')[0]) === null || _name$split$ === void 0 ? void 0 : _name$split$.split('🦉')[1]) || '';
73
- var isPluginApply = _this.pluginNameCache.has(pluginName);
74
- var isTransactionMeasurement = EVENT_NAMES.includes(name);
75
- if (!isTransactionMeasurement && process.env.NODE_ENV === 'development') {
76
- // eslint-disable-next-line no-console
77
- console.warn("SimpleMeasurementLogger: unknown transaction event name '".concat(name, "'"));
78
- }
79
- if (isPluginApply || isTransactionMeasurement) {
80
- _this.currentBatch.push(_this.createPerformanceEntry(reading));
81
- }
82
- }
83
-
84
- // Trigger a report
85
- if (name === EVENT_NAME_DISPATCH_TRANSACTION) {
86
- // convert the batch into a bunch of entries
87
- if (_this.observationCallback) {
88
- var _entries = _this.convertToEntryList(_toConsumableArray(_this.currentBatch));
89
- _this.observationCallback(_entries);
90
- }
91
- _this.currentBatch = [];
92
- }
93
- });
94
- });
@@ -1 +0,0 @@
1
- export declare const outlier: (input: number[], factor: number) => number | undefined;
@@ -1 +0,0 @@
1
- export declare const percentile: (input: number[], fraction: number) => number | undefined;
@@ -1,23 +0,0 @@
1
- import type { PluginPerformanceReportData } from '@atlaskit/editor-common/analytics';
2
- import type { NodesCount, PluginPerformanceReportOptions } from './plugin-performance-report';
3
- import type { TransactionTracker } from './track-transactions';
4
- export declare class PluginPerformanceObserver implements PerformanceObserver {
5
- private callback;
6
- private getNodeCounts;
7
- private getPlugins;
8
- private getOptions;
9
- private reportCount;
10
- private simpleObserver;
11
- private observer;
12
- private getTransactionTracker?;
13
- constructor(callback: (report: PluginPerformanceReportData) => void);
14
- private get isSimpleTracking();
15
- withNodeCounts(getNodeCounts: () => NodesCount): this;
16
- withPlugins(getPlugins: () => string[]): this;
17
- withOptions(getOptions: () => Partial<PluginPerformanceReportOptions>): this;
18
- withTransactionTracker(getTransactionTracker: () => TransactionTracker): this;
19
- private onObserveration;
20
- observe(): void;
21
- disconnect(): void;
22
- takeRecords(): PerformanceEntryList;
23
- }
@@ -1,47 +0,0 @@
1
- import type { NodeCount, PluginPerformanceReportData } from '@atlaskit/editor-common/analytics';
2
- export interface OutlierReport {
3
- stateApplyOutlier: number | undefined;
4
- viewUpdateOutlier: number | undefined;
5
- }
6
- export interface PluginPerformanceReportOptions {
7
- outlierFactor: number;
8
- outlierThreshold: number;
9
- samplingRate: number;
10
- slowThreshold: number;
11
- usePerformanceMarks?: boolean;
12
- }
13
- export type NodesCount = {
14
- extensionNodeCount: NodeCount;
15
- nodeCount: NodeCount;
16
- };
17
- export declare class PluginPerformanceReport {
18
- private entry;
19
- private count;
20
- private pluginNames;
21
- private entryList?;
22
- private stateApplied?;
23
- private viewUpdated?;
24
- private onChangeCalled?;
25
- private onEditorViewStateUpdatedCalled?;
26
- private nodes;
27
- private extensionNodes;
28
- private nodesDuration;
29
- private plugins;
30
- private slowPlugins;
31
- private options;
32
- private constructor();
33
- static fromEntry(entry: PerformanceEntry): PluginPerformanceReport;
34
- private isChild;
35
- private getEntryByName;
36
- private getMethodSum;
37
- private greaterEquals;
38
- private hasOutlierMethods;
39
- get trigger(): 'none' | 'slow' | 'distribution' | 'sample';
40
- get hasSlowPlugins(): boolean;
41
- withEntryList(entryList: PerformanceObserverEntryList): this;
42
- withPlugins(pluginNames: string[]): this;
43
- withNodes(nodesCount: NodesCount, nodesDuration?: number): this;
44
- withCount(count: number): this;
45
- withOptions(options: Partial<PluginPerformanceReportOptions>): this;
46
- toJSON(): PluginPerformanceReportData;
47
- }
@@ -1,28 +0,0 @@
1
- interface Reading {
2
- duration: number;
3
- name: string;
4
- startTime: number;
5
- }
6
- type ObservationCallback = (entries: PerformanceObserverEntryList) => void;
7
- /**
8
- * A class that logs and collates measurement entries until
9
- * EVENT_NAME_DISPATCHTRANSACTION is detected.
10
- *
11
- * At that point, it will group together all the entries
12
- * logged and fire a callback with all entries packaged
13
- * into a PerformanceObserverEntryList.
14
- *
15
- * We are able to make use of this method as the measurements
16
- * which occur during dispatchTransactions are synchronous.
17
- */
18
- export declare class SimpleMeasurementLogger {
19
- private currentBatch;
20
- private pluginNameCache;
21
- private observationCallback?;
22
- setPluginNames: (names: string[]) => void;
23
- setOnObservation: (callback: ObservationCallback) => void;
24
- private createPerformanceEntry;
25
- private convertToEntryList;
26
- observed: (reading: Reading) => void;
27
- }
28
- export {};