@atlaskit/editor-common 107.22.1 → 107.23.1
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 +21 -0
- package/dist/cjs/ai-messages/ai-experience-application.js +5 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/PortalManager.js +72 -25
- package/dist/cjs/portal/common.js +3 -2
- package/dist/cjs/react-node-view/index.js +4 -3
- package/dist/cjs/selection-based-node-view/SelectionBasedNodeView.js +2 -2
- package/dist/cjs/toolbar/keys.js +2 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/ai-messages/ai-experience-application.js +5 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/PortalManager.js +54 -14
- package/dist/es2019/portal/common.js +3 -3
- package/dist/es2019/react-node-view/index.js +4 -3
- package/dist/es2019/selection-based-node-view/SelectionBasedNodeView.js +2 -2
- package/dist/es2019/toolbar/keys.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/ai-messages/ai-experience-application.js +5 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/PortalManager.js +72 -25
- package/dist/esm/portal/common.js +3 -2
- package/dist/esm/react-node-view/index.js +4 -3
- package/dist/esm/selection-based-node-view/SelectionBasedNodeView.js +2 -2
- package/dist/esm/toolbar/keys.js +2 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/ai-messages/ai-experience-application.d.ts +5 -0
- package/dist/types/portal/PortalManager.d.ts +10 -4
- package/dist/types/portal/common.d.ts +1 -1
- package/dist/types/react-node-view/index.d.ts +2 -1
- package/dist/types/selection-based-node-view/SelectionBasedNodeView.d.ts +1 -1
- package/dist/types-ts4.5/ai-messages/ai-experience-application.d.ts +5 -0
- package/dist/types-ts4.5/portal/PortalManager.d.ts +10 -4
- package/dist/types-ts4.5/portal/common.d.ts +1 -1
- package/dist/types-ts4.5/react-node-view/index.d.ts +2 -1
- package/dist/types-ts4.5/selection-based-node-view/SelectionBasedNodeView.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 107.23.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#200948](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/200948)
|
|
8
|
+
[`8dd9a944113d5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8dd9a944113d5) -
|
|
9
|
+
Introduced throttling for portals
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 107.23.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#200753](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/200753)
|
|
17
|
+
[`6188d265cbfbf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6188d265cbfbf) -
|
|
18
|
+
[EDITOR-1301] Update discard modal text
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 107.22.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -28,6 +28,11 @@ var aiExperienceApplicationMessages = exports.aiExperienceApplicationMessages =
|
|
|
28
28
|
defaultMessage: 'Do you want to discard your response?',
|
|
29
29
|
description: 'Message to confirm if the user wants to discard the generated response from Atlassian Intelligence.'
|
|
30
30
|
},
|
|
31
|
+
discardStreamingInDocumenntMessageResponse: {
|
|
32
|
+
id: 'fabric.editor.ai.experience.discardStreamingInDocumenntMessageResponse',
|
|
33
|
+
defaultMessage: 'Delete response?',
|
|
34
|
+
description: 'Message to confirm if the user wants to discard the generated response from Atlassian Intelligence in the document.'
|
|
35
|
+
},
|
|
31
36
|
loadingTitle: {
|
|
32
37
|
id: 'fabric.editor.ai.experience.loadingTitle',
|
|
33
38
|
defaultMessage: 'Generating',
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "107.
|
|
19
|
+
var packageVersion = "107.23.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// Ignored via go/ees007
|
|
@@ -9,11 +9,14 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
14
|
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; }
|
|
13
15
|
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) { (0, _defineProperty2.default)(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; }
|
|
14
16
|
var DEFAULT_INITIAL_BUCKETS = 50;
|
|
15
17
|
var DEFAULT_MAX_BUCKET_CAPACITY = 50;
|
|
16
18
|
var DEFAULT_SCALE_RATIO = 0.5;
|
|
19
|
+
var DEFAULT_THROTTLE_DELAY = 16; // ~60fps for smooth updates
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Creates an empty bucket object with a specified capacity. Each bucket is designed
|
|
@@ -38,7 +41,7 @@ function createEmptyBucket(capacity) {
|
|
|
38
41
|
* across "buckets" and updating these buckets as necessary to balance load and performance.
|
|
39
42
|
*
|
|
40
43
|
* @class PortalManager
|
|
41
|
-
* @typedef {
|
|
44
|
+
* @typedef {object} PortalManager
|
|
42
45
|
*
|
|
43
46
|
* @property {number} maxBucketCapacity - The maximum capacity of each bucket before a new bucket is created.
|
|
44
47
|
* @property {number} scaleRatio - The ratio to determine the number of new buckets to add when scaling up.
|
|
@@ -47,19 +50,24 @@ function createEmptyBucket(capacity) {
|
|
|
47
50
|
* @property {Map<React.Key, number>} portalToBucketMap - A map of React portal keys to their corresponding bucket indices.
|
|
48
51
|
* @property {PortalRendererUpdater|null} portalRendererUpdater - A function to trigger updates to the rendering of portals.
|
|
49
52
|
* @property {number} scaleCapacityThreshold - The threshold at which the buckets are scaled up to accommodate more portals.
|
|
53
|
+
* @property {Map<number, ReturnType<typeof throttle>>} throttledBucketUpdaters - A map of bucket IDs to their throttled update functions.
|
|
54
|
+
* @property {number} throttleDelay - The delay in milliseconds for throttling bucket updates.
|
|
50
55
|
*
|
|
51
56
|
* @param {number} [initialBuckets=DEFAULT_INITIAL_BUCKETS] - The initial number of buckets to create.
|
|
52
57
|
* @param {number} [maxBucketCapacity=DEFAULT_MAX_BUCKET_CAPACITY] - The maximum number of portals a single bucket can hold.
|
|
53
58
|
* @param {number} [scaleRatio=DEFAULT_SCALE_RATIO] - The ratio used to calculate the number of new buckets to add when scaling.
|
|
59
|
+
* @param {number} [throttleDelay=DEFAULT_THROTTLE_DELAY] - The delay in milliseconds for throttling updates.
|
|
54
60
|
*/
|
|
55
61
|
var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
56
62
|
function PortalManager() {
|
|
57
63
|
var initialBuckets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_INITIAL_BUCKETS;
|
|
58
64
|
var maxBucketCapacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_MAX_BUCKET_CAPACITY;
|
|
59
65
|
var scaleRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_SCALE_RATIO;
|
|
66
|
+
var throttleDelay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THROTTLE_DELAY;
|
|
60
67
|
(0, _classCallCheck2.default)(this, PortalManager);
|
|
61
68
|
this.maxBucketCapacity = maxBucketCapacity;
|
|
62
69
|
this.scaleRatio = scaleRatio;
|
|
70
|
+
this.throttleDelay = throttleDelay;
|
|
63
71
|
|
|
64
72
|
// Initialise buckets array by creating an array of length `initialBuckets` containing empty buckets
|
|
65
73
|
this.buckets = Array.from({
|
|
@@ -75,6 +83,7 @@ var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
|
75
83
|
}));
|
|
76
84
|
this.portalRendererUpdater = null;
|
|
77
85
|
this.scaleCapacityThreshold = maxBucketCapacity / 2;
|
|
86
|
+
this.throttledBucketUpdaters = new Map();
|
|
78
87
|
}
|
|
79
88
|
return (0, _createClass2.default)(PortalManager, [{
|
|
80
89
|
key: "getCurrentBucket",
|
|
@@ -112,6 +121,21 @@ var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
|
112
121
|
}
|
|
113
122
|
(_this$portalRendererU = this.portalRendererUpdater) === null || _this$portalRendererU === void 0 || _this$portalRendererU.call(this, this.buckets);
|
|
114
123
|
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "getOrCreateThrottledUpdater",
|
|
126
|
+
value: function getOrCreateThrottledUpdater(id) {
|
|
127
|
+
var _this = this;
|
|
128
|
+
if (!this.throttledBucketUpdaters.has(id)) {
|
|
129
|
+
var throttledUpdater = (0, _throttle.default)(function () {
|
|
130
|
+
var _this$buckets$id, _this$buckets$id$upda;
|
|
131
|
+
(_this$buckets$id = _this.buckets[id]) === null || _this$buckets$id === void 0 || (_this$buckets$id$upda = _this$buckets$id.updater) === null || _this$buckets$id$upda === void 0 || _this$buckets$id$upda.call(_this$buckets$id, function () {
|
|
132
|
+
return _objectSpread({}, _this.buckets[id].portals);
|
|
133
|
+
});
|
|
134
|
+
}, this.throttleDelay);
|
|
135
|
+
this.throttledBucketUpdaters.set(id, throttledUpdater);
|
|
136
|
+
}
|
|
137
|
+
return this.throttledBucketUpdaters.get(id);
|
|
138
|
+
}
|
|
115
139
|
}, {
|
|
116
140
|
key: "getBuckets",
|
|
117
141
|
value: function getBuckets() {
|
|
@@ -120,35 +144,52 @@ var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
|
120
144
|
}, {
|
|
121
145
|
key: "registerBucket",
|
|
122
146
|
value: function registerBucket(id, updater) {
|
|
123
|
-
var _this$buckets$id$
|
|
124
|
-
_this$buckets$
|
|
125
|
-
|
|
147
|
+
var _this$buckets$id$upda2,
|
|
148
|
+
_this$buckets$id2,
|
|
149
|
+
_this2 = this;
|
|
126
150
|
this.buckets[id].updater = updater;
|
|
127
|
-
(_this$buckets$id$
|
|
128
|
-
return _objectSpread({},
|
|
151
|
+
(_this$buckets$id$upda2 = (_this$buckets$id2 = this.buckets[id]).updater) === null || _this$buckets$id$upda2 === void 0 || _this$buckets$id$upda2.call(_this$buckets$id2, function () {
|
|
152
|
+
return _objectSpread({}, _this2.buckets[id].portals);
|
|
129
153
|
});
|
|
130
154
|
}
|
|
131
155
|
}, {
|
|
132
156
|
key: "unregisterBucket",
|
|
133
157
|
value: function unregisterBucket(id) {
|
|
134
158
|
this.buckets[id].updater = null;
|
|
159
|
+
// Clean up throttled updater when bucket is unregistered
|
|
160
|
+
if (this.throttledBucketUpdaters.has(id)) {
|
|
161
|
+
var _this$throttledBucket;
|
|
162
|
+
(_this$throttledBucket = this.throttledBucketUpdaters.get(id)) === null || _this$throttledBucket === void 0 || _this$throttledBucket.cancel();
|
|
163
|
+
this.throttledBucketUpdaters.delete(id);
|
|
164
|
+
}
|
|
135
165
|
}
|
|
136
166
|
}, {
|
|
137
167
|
key: "updateBuckets",
|
|
138
168
|
value: function updateBuckets(id) {
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
|
|
169
|
+
var _this3 = this;
|
|
170
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
171
|
+
if (immediate || !(0, _expValEquals.expValEquals)('platform_editor_debounce_portal_provider', 'isEnabled', true)) {
|
|
172
|
+
var _this$buckets$id$upda3, _this$buckets$id3;
|
|
173
|
+
// Cancel any pending throttled update and update immediately
|
|
174
|
+
if (this.throttledBucketUpdaters.has(id)) {
|
|
175
|
+
var _this$throttledBucket2;
|
|
176
|
+
(_this$throttledBucket2 = this.throttledBucketUpdaters.get(id)) === null || _this$throttledBucket2 === void 0 || _this$throttledBucket2.cancel();
|
|
177
|
+
}
|
|
178
|
+
(_this$buckets$id$upda3 = (_this$buckets$id3 = this.buckets[id]).updater) === null || _this$buckets$id$upda3 === void 0 || _this$buckets$id$upda3.call(_this$buckets$id3, function () {
|
|
179
|
+
return _objectSpread({}, _this3.buckets[id].portals);
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
var _this$getOrCreateThro;
|
|
183
|
+
// Use throttled update for smooth, regular updates
|
|
184
|
+
(_this$getOrCreateThro = this.getOrCreateThrottledUpdater(id)) === null || _this$getOrCreateThro === void 0 || _this$getOrCreateThro();
|
|
185
|
+
}
|
|
146
186
|
}
|
|
147
187
|
}, {
|
|
148
188
|
key: "registerPortal",
|
|
149
189
|
value: function registerPortal(key, portal) {
|
|
150
190
|
var _this$portalToBucketM,
|
|
151
|
-
|
|
191
|
+
_this4 = this;
|
|
192
|
+
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
152
193
|
this.createBucket();
|
|
153
194
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
154
195
|
this.buckets[this.getCurrentBucket()].capacity -= 1;
|
|
@@ -160,32 +201,32 @@ var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
|
160
201
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
161
202
|
this.buckets[id].portals[key] = portal;
|
|
162
203
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
163
|
-
this.updateBuckets(id);
|
|
204
|
+
this.updateBuckets(id, immediate);
|
|
164
205
|
}
|
|
165
206
|
|
|
166
207
|
//returns a function to unregister the portal
|
|
167
208
|
return function () {
|
|
168
209
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
169
|
-
delete
|
|
170
|
-
|
|
210
|
+
delete _this4.buckets[id].portals[key];
|
|
211
|
+
_this4.portalToBucketMap.delete(key);
|
|
171
212
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
172
|
-
|
|
213
|
+
_this4.buckets[id].capacity += 1;
|
|
173
214
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
174
|
-
if (
|
|
215
|
+
if (_this4.buckets[id].capacity > _this4.scaleCapacityThreshold) {
|
|
175
216
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
176
|
-
|
|
217
|
+
_this4.availableBuckets.add(id);
|
|
177
218
|
}
|
|
178
219
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
179
|
-
|
|
220
|
+
_this4.updateBuckets(id, immediate);
|
|
180
221
|
};
|
|
181
222
|
}
|
|
182
223
|
}, {
|
|
183
224
|
key: "registerPortalRenderer",
|
|
184
225
|
value: function registerPortalRenderer(updater) {
|
|
185
|
-
var
|
|
226
|
+
var _this5 = this;
|
|
186
227
|
if (!this.portalRendererUpdater) {
|
|
187
228
|
updater(function () {
|
|
188
|
-
return
|
|
229
|
+
return _this5.buckets;
|
|
189
230
|
});
|
|
190
231
|
}
|
|
191
232
|
this.portalRendererUpdater = updater;
|
|
@@ -203,12 +244,18 @@ var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
|
203
244
|
}, {
|
|
204
245
|
key: "destroy",
|
|
205
246
|
value: function destroy() {
|
|
206
|
-
var
|
|
247
|
+
var _this6 = this;
|
|
248
|
+
// Cancel all pending throttled updates
|
|
249
|
+
this.throttledBucketUpdaters.forEach(function (updater) {
|
|
250
|
+
updater.cancel();
|
|
251
|
+
});
|
|
252
|
+
this.throttledBucketUpdaters.clear();
|
|
253
|
+
|
|
207
254
|
// Iterate through each bucket and clear its portals and unset the updater function
|
|
208
255
|
this.buckets.forEach(function (bucket, id) {
|
|
209
256
|
bucket.portals = {}; // Clearing all portals from the bucket
|
|
210
257
|
bucket.updater = null; // Unsetting the bucket's updater function
|
|
211
|
-
|
|
258
|
+
_this6.availableBuckets.add(id); // Mark all buckets as available
|
|
212
259
|
});
|
|
213
260
|
this.portalToBucketMap.clear();
|
|
214
261
|
this.portalRendererUpdater = null;
|
|
@@ -80,15 +80,16 @@ var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProv
|
|
|
80
80
|
var portalsMap = new Map();
|
|
81
81
|
return {
|
|
82
82
|
render: function render(children, container, key, onBeforeReactDomRender) {
|
|
83
|
+
var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
83
84
|
if (typeof onBeforeReactDomRender === 'function') {
|
|
84
85
|
var portal = /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(PortalRenderWrapper, {
|
|
85
86
|
getChildren: children,
|
|
86
87
|
onBeforeRender: onBeforeReactDomRender
|
|
87
88
|
}), container, key);
|
|
88
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
89
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal, immediate));
|
|
89
90
|
} else {
|
|
90
91
|
var _portal = /*#__PURE__*/(0, _reactDom.createPortal)(children(), container, key);
|
|
91
|
-
portalsMap.set(key, portalManager.registerPortal(key, _portal));
|
|
92
|
+
portalsMap.set(key, portalManager.registerPortal(key, _portal, immediate));
|
|
92
93
|
}
|
|
93
94
|
},
|
|
94
95
|
remove: function remove(key) {
|
|
@@ -35,7 +35,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
35
35
|
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
36
36
|
// Ignored via go/ees005
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
reactComponent, viewShouldUpdate) {
|
|
38
|
+
reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal) {
|
|
39
39
|
var _this = this;
|
|
40
40
|
(0, _classCallCheck2.default)(this, ReactNodeView);
|
|
41
41
|
// Ignored via go/ees005
|
|
@@ -61,6 +61,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
61
61
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
62
62
|
this.eventDispatcher = eventDispatcher;
|
|
63
63
|
this.key = (0, _generateUniqueNodeKey.generateUniqueNodeKey)();
|
|
64
|
+
this.shouldRenderImmediatelyInPortal = shouldRenderImmediatelyInPortal || false;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
/**
|
|
@@ -131,10 +132,10 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
131
132
|
dispatchAnalyticsEvent: _this3.dispatchAnalyticsEvent
|
|
132
133
|
}, component());
|
|
133
134
|
};
|
|
134
|
-
|
|
135
|
+
this.portalProviderAPI.render(componentWithErrorBoundary,
|
|
135
136
|
// Ignored via go/ees005
|
|
136
137
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
137
|
-
this.
|
|
138
|
+
this.domRef, this.key, undefined, this.shouldRenderImmediatelyInPortal);
|
|
138
139
|
}
|
|
139
140
|
}, {
|
|
140
141
|
key: "createDomRef",
|
|
@@ -41,10 +41,10 @@ var SelectionBasedNodeView = exports.SelectionBasedNodeView = /*#__PURE__*/funct
|
|
|
41
41
|
function SelectionBasedNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
42
42
|
// Ignored via go/ees005
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
reactComponent, viewShouldUpdate) {
|
|
44
|
+
reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal) {
|
|
45
45
|
var _this;
|
|
46
46
|
(0, _classCallCheck2.default)(this, SelectionBasedNodeView);
|
|
47
|
-
_this = _callSuper(this, SelectionBasedNodeView, [node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate]);
|
|
47
|
+
_this = _callSuper(this, SelectionBasedNodeView, [node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal]);
|
|
48
48
|
(0, _defineProperty2.default)(_this, "isSelectedNode", false);
|
|
49
49
|
(0, _defineProperty2.default)(_this, "isNodeInsideSelection", function (from, to, pos, posEnd) {
|
|
50
50
|
var _this$getPositionsWit = _this.getPositionsWithDefault(pos, posEnd);
|
package/dist/cjs/toolbar/keys.js
CHANGED
|
@@ -253,8 +253,8 @@ var ALIGN_RIGHT_MENU_ITEM = exports.ALIGN_RIGHT_MENU_ITEM = {
|
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
/*
|
|
256
|
-
* Lists and indentation group
|
|
257
|
-
*/
|
|
256
|
+
* Lists and indentation group
|
|
257
|
+
*/
|
|
258
258
|
var LISTS_INDENTATION_GROUP = exports.LISTS_INDENTATION_GROUP = {
|
|
259
259
|
key: 'lists-indentation-group',
|
|
260
260
|
type: 'group'
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "107.
|
|
26
|
+
var packageVersion = "107.23.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -21,6 +21,11 @@ export const aiExperienceApplicationMessages = defineMessages({
|
|
|
21
21
|
defaultMessage: 'Do you want to discard your response?',
|
|
22
22
|
description: 'Message to confirm if the user wants to discard the generated response from Atlassian Intelligence.'
|
|
23
23
|
},
|
|
24
|
+
discardStreamingInDocumenntMessageResponse: {
|
|
25
|
+
id: 'fabric.editor.ai.experience.discardStreamingInDocumenntMessageResponse',
|
|
26
|
+
defaultMessage: 'Delete response?',
|
|
27
|
+
description: 'Message to confirm if the user wants to discard the generated response from Atlassian Intelligence in the document.'
|
|
28
|
+
},
|
|
24
29
|
loadingTitle: {
|
|
25
30
|
id: 'fabric.editor.ai.experience.loadingTitle',
|
|
26
31
|
defaultMessage: 'Generating',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "107.
|
|
4
|
+
const packageVersion = "107.23.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import throttle from 'lodash/throttle';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
1
3
|
const DEFAULT_INITIAL_BUCKETS = 50;
|
|
2
4
|
const DEFAULT_MAX_BUCKET_CAPACITY = 50;
|
|
3
5
|
const DEFAULT_SCALE_RATIO = 0.5;
|
|
6
|
+
const DEFAULT_THROTTLE_DELAY = 16; // ~60fps for smooth updates
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Creates an empty bucket object with a specified capacity. Each bucket is designed
|
|
@@ -25,7 +28,7 @@ function createEmptyBucket(capacity) {
|
|
|
25
28
|
* across "buckets" and updating these buckets as necessary to balance load and performance.
|
|
26
29
|
*
|
|
27
30
|
* @class PortalManager
|
|
28
|
-
* @typedef {
|
|
31
|
+
* @typedef {object} PortalManager
|
|
29
32
|
*
|
|
30
33
|
* @property {number} maxBucketCapacity - The maximum capacity of each bucket before a new bucket is created.
|
|
31
34
|
* @property {number} scaleRatio - The ratio to determine the number of new buckets to add when scaling up.
|
|
@@ -34,15 +37,19 @@ function createEmptyBucket(capacity) {
|
|
|
34
37
|
* @property {Map<React.Key, number>} portalToBucketMap - A map of React portal keys to their corresponding bucket indices.
|
|
35
38
|
* @property {PortalRendererUpdater|null} portalRendererUpdater - A function to trigger updates to the rendering of portals.
|
|
36
39
|
* @property {number} scaleCapacityThreshold - The threshold at which the buckets are scaled up to accommodate more portals.
|
|
40
|
+
* @property {Map<number, ReturnType<typeof throttle>>} throttledBucketUpdaters - A map of bucket IDs to their throttled update functions.
|
|
41
|
+
* @property {number} throttleDelay - The delay in milliseconds for throttling bucket updates.
|
|
37
42
|
*
|
|
38
43
|
* @param {number} [initialBuckets=DEFAULT_INITIAL_BUCKETS] - The initial number of buckets to create.
|
|
39
44
|
* @param {number} [maxBucketCapacity=DEFAULT_MAX_BUCKET_CAPACITY] - The maximum number of portals a single bucket can hold.
|
|
40
45
|
* @param {number} [scaleRatio=DEFAULT_SCALE_RATIO] - The ratio used to calculate the number of new buckets to add when scaling.
|
|
46
|
+
* @param {number} [throttleDelay=DEFAULT_THROTTLE_DELAY] - The delay in milliseconds for throttling updates.
|
|
41
47
|
*/
|
|
42
48
|
export class PortalManager {
|
|
43
|
-
constructor(initialBuckets = DEFAULT_INITIAL_BUCKETS, maxBucketCapacity = DEFAULT_MAX_BUCKET_CAPACITY, scaleRatio = DEFAULT_SCALE_RATIO) {
|
|
49
|
+
constructor(initialBuckets = DEFAULT_INITIAL_BUCKETS, maxBucketCapacity = DEFAULT_MAX_BUCKET_CAPACITY, scaleRatio = DEFAULT_SCALE_RATIO, throttleDelay = DEFAULT_THROTTLE_DELAY) {
|
|
44
50
|
this.maxBucketCapacity = maxBucketCapacity;
|
|
45
51
|
this.scaleRatio = scaleRatio;
|
|
52
|
+
this.throttleDelay = throttleDelay;
|
|
46
53
|
|
|
47
54
|
// Initialise buckets array by creating an array of length `initialBuckets` containing empty buckets
|
|
48
55
|
this.buckets = Array.from({
|
|
@@ -54,6 +61,7 @@ export class PortalManager {
|
|
|
54
61
|
}, (_, i) => i));
|
|
55
62
|
this.portalRendererUpdater = null;
|
|
56
63
|
this.scaleCapacityThreshold = maxBucketCapacity / 2;
|
|
64
|
+
this.throttledBucketUpdaters = new Map();
|
|
57
65
|
}
|
|
58
66
|
getCurrentBucket() {
|
|
59
67
|
return this.availableBuckets.values().next().value;
|
|
@@ -87,29 +95,55 @@ export class PortalManager {
|
|
|
87
95
|
}
|
|
88
96
|
(_this$portalRendererU = this.portalRendererUpdater) === null || _this$portalRendererU === void 0 ? void 0 : _this$portalRendererU.call(this, this.buckets);
|
|
89
97
|
}
|
|
98
|
+
getOrCreateThrottledUpdater(id) {
|
|
99
|
+
if (!this.throttledBucketUpdaters.has(id)) {
|
|
100
|
+
const throttledUpdater = throttle(() => {
|
|
101
|
+
var _this$buckets$id, _this$buckets$id$upda;
|
|
102
|
+
(_this$buckets$id = this.buckets[id]) === null || _this$buckets$id === void 0 ? void 0 : (_this$buckets$id$upda = _this$buckets$id.updater) === null || _this$buckets$id$upda === void 0 ? void 0 : _this$buckets$id$upda.call(_this$buckets$id, () => ({
|
|
103
|
+
...this.buckets[id].portals
|
|
104
|
+
}));
|
|
105
|
+
}, this.throttleDelay);
|
|
106
|
+
this.throttledBucketUpdaters.set(id, throttledUpdater);
|
|
107
|
+
}
|
|
108
|
+
return this.throttledBucketUpdaters.get(id);
|
|
109
|
+
}
|
|
90
110
|
getBuckets() {
|
|
91
111
|
return this.buckets;
|
|
92
112
|
}
|
|
93
113
|
registerBucket(id, updater) {
|
|
94
|
-
var _this$buckets$id$
|
|
114
|
+
var _this$buckets$id$upda2, _this$buckets$id2;
|
|
95
115
|
this.buckets[id].updater = updater;
|
|
96
|
-
(_this$buckets$id$
|
|
116
|
+
(_this$buckets$id$upda2 = (_this$buckets$id2 = this.buckets[id]).updater) === null || _this$buckets$id$upda2 === void 0 ? void 0 : _this$buckets$id$upda2.call(_this$buckets$id2, () => ({
|
|
97
117
|
...this.buckets[id].portals
|
|
98
118
|
}));
|
|
99
119
|
}
|
|
100
120
|
unregisterBucket(id) {
|
|
101
121
|
this.buckets[id].updater = null;
|
|
122
|
+
// Clean up throttled updater when bucket is unregistered
|
|
123
|
+
if (this.throttledBucketUpdaters.has(id)) {
|
|
124
|
+
var _this$throttledBucket;
|
|
125
|
+
(_this$throttledBucket = this.throttledBucketUpdaters.get(id)) === null || _this$throttledBucket === void 0 ? void 0 : _this$throttledBucket.cancel();
|
|
126
|
+
this.throttledBucketUpdaters.delete(id);
|
|
127
|
+
}
|
|
102
128
|
}
|
|
103
|
-
updateBuckets(id) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//
|
|
107
|
-
|
|
129
|
+
updateBuckets(id, immediate = false) {
|
|
130
|
+
if (immediate || !expValEquals('platform_editor_debounce_portal_provider', 'isEnabled', true)) {
|
|
131
|
+
var _this$buckets$id$upda3, _this$buckets$id3;
|
|
132
|
+
// Cancel any pending throttled update and update immediately
|
|
133
|
+
if (this.throttledBucketUpdaters.has(id)) {
|
|
134
|
+
var _this$throttledBucket2;
|
|
135
|
+
(_this$throttledBucket2 = this.throttledBucketUpdaters.get(id)) === null || _this$throttledBucket2 === void 0 ? void 0 : _this$throttledBucket2.cancel();
|
|
136
|
+
}
|
|
137
|
+
(_this$buckets$id$upda3 = (_this$buckets$id3 = this.buckets[id]).updater) === null || _this$buckets$id$upda3 === void 0 ? void 0 : _this$buckets$id$upda3.call(_this$buckets$id3, () => ({
|
|
108
138
|
...this.buckets[id].portals
|
|
109
|
-
};
|
|
110
|
-
}
|
|
139
|
+
}));
|
|
140
|
+
} else {
|
|
141
|
+
var _this$getOrCreateThro;
|
|
142
|
+
// Use throttled update for smooth, regular updates
|
|
143
|
+
(_this$getOrCreateThro = this.getOrCreateThrottledUpdater(id)) === null || _this$getOrCreateThro === void 0 ? void 0 : _this$getOrCreateThro();
|
|
144
|
+
}
|
|
111
145
|
}
|
|
112
|
-
registerPortal(key, portal) {
|
|
146
|
+
registerPortal(key, portal, immediate = false) {
|
|
113
147
|
var _this$portalToBucketM;
|
|
114
148
|
this.createBucket();
|
|
115
149
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
@@ -122,7 +156,7 @@ export class PortalManager {
|
|
|
122
156
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
123
157
|
this.buckets[id].portals[key] = portal;
|
|
124
158
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
125
|
-
this.updateBuckets(id);
|
|
159
|
+
this.updateBuckets(id, immediate);
|
|
126
160
|
}
|
|
127
161
|
|
|
128
162
|
//returns a function to unregister the portal
|
|
@@ -138,7 +172,7 @@ export class PortalManager {
|
|
|
138
172
|
this.availableBuckets.add(id);
|
|
139
173
|
}
|
|
140
174
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
141
|
-
this.updateBuckets(id);
|
|
175
|
+
this.updateBuckets(id, immediate);
|
|
142
176
|
};
|
|
143
177
|
}
|
|
144
178
|
registerPortalRenderer(updater) {
|
|
@@ -156,6 +190,12 @@ export class PortalManager {
|
|
|
156
190
|
* unregistering all buckets, and resetting internal state.
|
|
157
191
|
*/
|
|
158
192
|
destroy() {
|
|
193
|
+
// Cancel all pending throttled updates
|
|
194
|
+
this.throttledBucketUpdaters.forEach(updater => {
|
|
195
|
+
updater.cancel();
|
|
196
|
+
});
|
|
197
|
+
this.throttledBucketUpdaters.clear();
|
|
198
|
+
|
|
159
199
|
// Iterate through each bucket and clear its portals and unset the updater function
|
|
160
200
|
this.buckets.forEach((bucket, id) => {
|
|
161
201
|
bucket.portals = {}; // Clearing all portals from the bucket
|
|
@@ -61,16 +61,16 @@ PortalRenderWrapper.displayName = 'PortalRenderWrapper';
|
|
|
61
61
|
export const getPortalProviderAPI = portalManager => {
|
|
62
62
|
const portalsMap = new Map();
|
|
63
63
|
return {
|
|
64
|
-
render: (children, container, key, onBeforeReactDomRender) => {
|
|
64
|
+
render: (children, container, key, onBeforeReactDomRender, immediate = false) => {
|
|
65
65
|
if (typeof onBeforeReactDomRender === 'function') {
|
|
66
66
|
const portal = /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PortalRenderWrapper, {
|
|
67
67
|
getChildren: children,
|
|
68
68
|
onBeforeRender: onBeforeReactDomRender
|
|
69
69
|
}), container, key);
|
|
70
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
70
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal, immediate));
|
|
71
71
|
} else {
|
|
72
72
|
const portal = /*#__PURE__*/createPortal(children(), container, key);
|
|
73
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
73
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal, immediate));
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
remove: key => {
|
|
@@ -15,7 +15,7 @@ export default class ReactNodeView {
|
|
|
15
15
|
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
16
16
|
// Ignored via go/ees005
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
reactComponent, viewShouldUpdate) {
|
|
18
|
+
reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal) {
|
|
19
19
|
// Ignored via go/ees005
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
_defineProperty(this, "decorations", []);
|
|
@@ -37,6 +37,7 @@ export default class ReactNodeView {
|
|
|
37
37
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
38
38
|
this.eventDispatcher = eventDispatcher;
|
|
39
39
|
this.key = generateUniqueNodeKey();
|
|
40
|
+
this.shouldRenderImmediatelyInPortal = shouldRenderImmediatelyInPortal || false;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -101,10 +102,10 @@ export default class ReactNodeView {
|
|
|
101
102
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
|
|
102
103
|
}, component());
|
|
103
104
|
};
|
|
104
|
-
|
|
105
|
+
this.portalProviderAPI.render(componentWithErrorBoundary,
|
|
105
106
|
// Ignored via go/ees005
|
|
106
107
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
107
|
-
this.
|
|
108
|
+
this.domRef, this.key, undefined, this.shouldRenderImmediatelyInPortal);
|
|
108
109
|
}
|
|
109
110
|
createDomRef() {
|
|
110
111
|
if (!this.node.isInline) {
|
|
@@ -29,8 +29,8 @@ export class SelectionBasedNodeView extends ReactNodeView {
|
|
|
29
29
|
constructor(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
30
30
|
// Ignored via go/ees005
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
reactComponent, viewShouldUpdate) {
|
|
33
|
-
super(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate);
|
|
32
|
+
reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal) {
|
|
33
|
+
super(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal);
|
|
34
34
|
_defineProperty(this, "isSelectedNode", false);
|
|
35
35
|
_defineProperty(this, "isNodeInsideSelection", (from, to, pos, posEnd) => {
|
|
36
36
|
({
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "107.
|
|
16
|
+
const packageVersion = "107.23.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -21,6 +21,11 @@ export var aiExperienceApplicationMessages = defineMessages({
|
|
|
21
21
|
defaultMessage: 'Do you want to discard your response?',
|
|
22
22
|
description: 'Message to confirm if the user wants to discard the generated response from Atlassian Intelligence.'
|
|
23
23
|
},
|
|
24
|
+
discardStreamingInDocumenntMessageResponse: {
|
|
25
|
+
id: 'fabric.editor.ai.experience.discardStreamingInDocumenntMessageResponse',
|
|
26
|
+
defaultMessage: 'Delete response?',
|
|
27
|
+
description: 'Message to confirm if the user wants to discard the generated response from Atlassian Intelligence in the document.'
|
|
28
|
+
},
|
|
24
29
|
loadingTitle: {
|
|
25
30
|
id: 'fabric.editor.ai.experience.loadingTitle',
|
|
26
31
|
defaultMessage: 'Generating',
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "107.
|
|
10
|
+
var packageVersion = "107.23.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -4,9 +4,12 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
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
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 throttle from 'lodash/throttle';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
9
|
var DEFAULT_INITIAL_BUCKETS = 50;
|
|
8
10
|
var DEFAULT_MAX_BUCKET_CAPACITY = 50;
|
|
9
11
|
var DEFAULT_SCALE_RATIO = 0.5;
|
|
12
|
+
var DEFAULT_THROTTLE_DELAY = 16; // ~60fps for smooth updates
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Creates an empty bucket object with a specified capacity. Each bucket is designed
|
|
@@ -31,7 +34,7 @@ function createEmptyBucket(capacity) {
|
|
|
31
34
|
* across "buckets" and updating these buckets as necessary to balance load and performance.
|
|
32
35
|
*
|
|
33
36
|
* @class PortalManager
|
|
34
|
-
* @typedef {
|
|
37
|
+
* @typedef {object} PortalManager
|
|
35
38
|
*
|
|
36
39
|
* @property {number} maxBucketCapacity - The maximum capacity of each bucket before a new bucket is created.
|
|
37
40
|
* @property {number} scaleRatio - The ratio to determine the number of new buckets to add when scaling up.
|
|
@@ -40,19 +43,24 @@ function createEmptyBucket(capacity) {
|
|
|
40
43
|
* @property {Map<React.Key, number>} portalToBucketMap - A map of React portal keys to their corresponding bucket indices.
|
|
41
44
|
* @property {PortalRendererUpdater|null} portalRendererUpdater - A function to trigger updates to the rendering of portals.
|
|
42
45
|
* @property {number} scaleCapacityThreshold - The threshold at which the buckets are scaled up to accommodate more portals.
|
|
46
|
+
* @property {Map<number, ReturnType<typeof throttle>>} throttledBucketUpdaters - A map of bucket IDs to their throttled update functions.
|
|
47
|
+
* @property {number} throttleDelay - The delay in milliseconds for throttling bucket updates.
|
|
43
48
|
*
|
|
44
49
|
* @param {number} [initialBuckets=DEFAULT_INITIAL_BUCKETS] - The initial number of buckets to create.
|
|
45
50
|
* @param {number} [maxBucketCapacity=DEFAULT_MAX_BUCKET_CAPACITY] - The maximum number of portals a single bucket can hold.
|
|
46
51
|
* @param {number} [scaleRatio=DEFAULT_SCALE_RATIO] - The ratio used to calculate the number of new buckets to add when scaling.
|
|
52
|
+
* @param {number} [throttleDelay=DEFAULT_THROTTLE_DELAY] - The delay in milliseconds for throttling updates.
|
|
47
53
|
*/
|
|
48
54
|
export var PortalManager = /*#__PURE__*/function () {
|
|
49
55
|
function PortalManager() {
|
|
50
56
|
var initialBuckets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_INITIAL_BUCKETS;
|
|
51
57
|
var maxBucketCapacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_MAX_BUCKET_CAPACITY;
|
|
52
58
|
var scaleRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_SCALE_RATIO;
|
|
59
|
+
var throttleDelay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THROTTLE_DELAY;
|
|
53
60
|
_classCallCheck(this, PortalManager);
|
|
54
61
|
this.maxBucketCapacity = maxBucketCapacity;
|
|
55
62
|
this.scaleRatio = scaleRatio;
|
|
63
|
+
this.throttleDelay = throttleDelay;
|
|
56
64
|
|
|
57
65
|
// Initialise buckets array by creating an array of length `initialBuckets` containing empty buckets
|
|
58
66
|
this.buckets = Array.from({
|
|
@@ -68,6 +76,7 @@ export var PortalManager = /*#__PURE__*/function () {
|
|
|
68
76
|
}));
|
|
69
77
|
this.portalRendererUpdater = null;
|
|
70
78
|
this.scaleCapacityThreshold = maxBucketCapacity / 2;
|
|
79
|
+
this.throttledBucketUpdaters = new Map();
|
|
71
80
|
}
|
|
72
81
|
return _createClass(PortalManager, [{
|
|
73
82
|
key: "getCurrentBucket",
|
|
@@ -105,6 +114,21 @@ export var PortalManager = /*#__PURE__*/function () {
|
|
|
105
114
|
}
|
|
106
115
|
(_this$portalRendererU = this.portalRendererUpdater) === null || _this$portalRendererU === void 0 || _this$portalRendererU.call(this, this.buckets);
|
|
107
116
|
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "getOrCreateThrottledUpdater",
|
|
119
|
+
value: function getOrCreateThrottledUpdater(id) {
|
|
120
|
+
var _this = this;
|
|
121
|
+
if (!this.throttledBucketUpdaters.has(id)) {
|
|
122
|
+
var throttledUpdater = throttle(function () {
|
|
123
|
+
var _this$buckets$id, _this$buckets$id$upda;
|
|
124
|
+
(_this$buckets$id = _this.buckets[id]) === null || _this$buckets$id === void 0 || (_this$buckets$id$upda = _this$buckets$id.updater) === null || _this$buckets$id$upda === void 0 || _this$buckets$id$upda.call(_this$buckets$id, function () {
|
|
125
|
+
return _objectSpread({}, _this.buckets[id].portals);
|
|
126
|
+
});
|
|
127
|
+
}, this.throttleDelay);
|
|
128
|
+
this.throttledBucketUpdaters.set(id, throttledUpdater);
|
|
129
|
+
}
|
|
130
|
+
return this.throttledBucketUpdaters.get(id);
|
|
131
|
+
}
|
|
108
132
|
}, {
|
|
109
133
|
key: "getBuckets",
|
|
110
134
|
value: function getBuckets() {
|
|
@@ -113,35 +137,52 @@ export var PortalManager = /*#__PURE__*/function () {
|
|
|
113
137
|
}, {
|
|
114
138
|
key: "registerBucket",
|
|
115
139
|
value: function registerBucket(id, updater) {
|
|
116
|
-
var _this$buckets$id$
|
|
117
|
-
_this$buckets$
|
|
118
|
-
|
|
140
|
+
var _this$buckets$id$upda2,
|
|
141
|
+
_this$buckets$id2,
|
|
142
|
+
_this2 = this;
|
|
119
143
|
this.buckets[id].updater = updater;
|
|
120
|
-
(_this$buckets$id$
|
|
121
|
-
return _objectSpread({},
|
|
144
|
+
(_this$buckets$id$upda2 = (_this$buckets$id2 = this.buckets[id]).updater) === null || _this$buckets$id$upda2 === void 0 || _this$buckets$id$upda2.call(_this$buckets$id2, function () {
|
|
145
|
+
return _objectSpread({}, _this2.buckets[id].portals);
|
|
122
146
|
});
|
|
123
147
|
}
|
|
124
148
|
}, {
|
|
125
149
|
key: "unregisterBucket",
|
|
126
150
|
value: function unregisterBucket(id) {
|
|
127
151
|
this.buckets[id].updater = null;
|
|
152
|
+
// Clean up throttled updater when bucket is unregistered
|
|
153
|
+
if (this.throttledBucketUpdaters.has(id)) {
|
|
154
|
+
var _this$throttledBucket;
|
|
155
|
+
(_this$throttledBucket = this.throttledBucketUpdaters.get(id)) === null || _this$throttledBucket === void 0 || _this$throttledBucket.cancel();
|
|
156
|
+
this.throttledBucketUpdaters.delete(id);
|
|
157
|
+
}
|
|
128
158
|
}
|
|
129
159
|
}, {
|
|
130
160
|
key: "updateBuckets",
|
|
131
161
|
value: function updateBuckets(id) {
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
162
|
+
var _this3 = this;
|
|
163
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
164
|
+
if (immediate || !expValEquals('platform_editor_debounce_portal_provider', 'isEnabled', true)) {
|
|
165
|
+
var _this$buckets$id$upda3, _this$buckets$id3;
|
|
166
|
+
// Cancel any pending throttled update and update immediately
|
|
167
|
+
if (this.throttledBucketUpdaters.has(id)) {
|
|
168
|
+
var _this$throttledBucket2;
|
|
169
|
+
(_this$throttledBucket2 = this.throttledBucketUpdaters.get(id)) === null || _this$throttledBucket2 === void 0 || _this$throttledBucket2.cancel();
|
|
170
|
+
}
|
|
171
|
+
(_this$buckets$id$upda3 = (_this$buckets$id3 = this.buckets[id]).updater) === null || _this$buckets$id$upda3 === void 0 || _this$buckets$id$upda3.call(_this$buckets$id3, function () {
|
|
172
|
+
return _objectSpread({}, _this3.buckets[id].portals);
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
var _this$getOrCreateThro;
|
|
176
|
+
// Use throttled update for smooth, regular updates
|
|
177
|
+
(_this$getOrCreateThro = this.getOrCreateThrottledUpdater(id)) === null || _this$getOrCreateThro === void 0 || _this$getOrCreateThro();
|
|
178
|
+
}
|
|
139
179
|
}
|
|
140
180
|
}, {
|
|
141
181
|
key: "registerPortal",
|
|
142
182
|
value: function registerPortal(key, portal) {
|
|
143
183
|
var _this$portalToBucketM,
|
|
144
|
-
|
|
184
|
+
_this4 = this;
|
|
185
|
+
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
145
186
|
this.createBucket();
|
|
146
187
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
147
188
|
this.buckets[this.getCurrentBucket()].capacity -= 1;
|
|
@@ -153,32 +194,32 @@ export var PortalManager = /*#__PURE__*/function () {
|
|
|
153
194
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
154
195
|
this.buckets[id].portals[key] = portal;
|
|
155
196
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
156
|
-
this.updateBuckets(id);
|
|
197
|
+
this.updateBuckets(id, immediate);
|
|
157
198
|
}
|
|
158
199
|
|
|
159
200
|
//returns a function to unregister the portal
|
|
160
201
|
return function () {
|
|
161
202
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
162
|
-
delete
|
|
163
|
-
|
|
203
|
+
delete _this4.buckets[id].portals[key];
|
|
204
|
+
_this4.portalToBucketMap.delete(key);
|
|
164
205
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
165
|
-
|
|
206
|
+
_this4.buckets[id].capacity += 1;
|
|
166
207
|
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
167
|
-
if (
|
|
208
|
+
if (_this4.buckets[id].capacity > _this4.scaleCapacityThreshold) {
|
|
168
209
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
169
|
-
|
|
210
|
+
_this4.availableBuckets.add(id);
|
|
170
211
|
}
|
|
171
212
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
172
|
-
|
|
213
|
+
_this4.updateBuckets(id, immediate);
|
|
173
214
|
};
|
|
174
215
|
}
|
|
175
216
|
}, {
|
|
176
217
|
key: "registerPortalRenderer",
|
|
177
218
|
value: function registerPortalRenderer(updater) {
|
|
178
|
-
var
|
|
219
|
+
var _this5 = this;
|
|
179
220
|
if (!this.portalRendererUpdater) {
|
|
180
221
|
updater(function () {
|
|
181
|
-
return
|
|
222
|
+
return _this5.buckets;
|
|
182
223
|
});
|
|
183
224
|
}
|
|
184
225
|
this.portalRendererUpdater = updater;
|
|
@@ -196,12 +237,18 @@ export var PortalManager = /*#__PURE__*/function () {
|
|
|
196
237
|
}, {
|
|
197
238
|
key: "destroy",
|
|
198
239
|
value: function destroy() {
|
|
199
|
-
var
|
|
240
|
+
var _this6 = this;
|
|
241
|
+
// Cancel all pending throttled updates
|
|
242
|
+
this.throttledBucketUpdaters.forEach(function (updater) {
|
|
243
|
+
updater.cancel();
|
|
244
|
+
});
|
|
245
|
+
this.throttledBucketUpdaters.clear();
|
|
246
|
+
|
|
200
247
|
// Iterate through each bucket and clear its portals and unset the updater function
|
|
201
248
|
this.buckets.forEach(function (bucket, id) {
|
|
202
249
|
bucket.portals = {}; // Clearing all portals from the bucket
|
|
203
250
|
bucket.updater = null; // Unsetting the bucket's updater function
|
|
204
|
-
|
|
251
|
+
_this6.availableBuckets.add(id); // Mark all buckets as available
|
|
205
252
|
});
|
|
206
253
|
this.portalToBucketMap.clear();
|
|
207
254
|
this.portalRendererUpdater = null;
|
|
@@ -69,15 +69,16 @@ export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
|
69
69
|
var portalsMap = new Map();
|
|
70
70
|
return {
|
|
71
71
|
render: function render(children, container, key, onBeforeReactDomRender) {
|
|
72
|
+
var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
72
73
|
if (typeof onBeforeReactDomRender === 'function') {
|
|
73
74
|
var portal = /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PortalRenderWrapper, {
|
|
74
75
|
getChildren: children,
|
|
75
76
|
onBeforeRender: onBeforeReactDomRender
|
|
76
77
|
}), container, key);
|
|
77
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
78
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal, immediate));
|
|
78
79
|
} else {
|
|
79
80
|
var _portal = /*#__PURE__*/createPortal(children(), container, key);
|
|
80
|
-
portalsMap.set(key, portalManager.registerPortal(key, _portal));
|
|
81
|
+
portalsMap.set(key, portalManager.registerPortal(key, _portal, immediate));
|
|
81
82
|
}
|
|
82
83
|
},
|
|
83
84
|
remove: function remove(key) {
|
|
@@ -17,7 +17,7 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
17
17
|
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
18
18
|
// Ignored via go/ees005
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
reactComponent, viewShouldUpdate) {
|
|
20
|
+
reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal) {
|
|
21
21
|
var _this = this;
|
|
22
22
|
_classCallCheck(this, ReactNodeView);
|
|
23
23
|
// Ignored via go/ees005
|
|
@@ -43,6 +43,7 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
43
43
|
this._viewShouldUpdate = viewShouldUpdate;
|
|
44
44
|
this.eventDispatcher = eventDispatcher;
|
|
45
45
|
this.key = generateUniqueNodeKey();
|
|
46
|
+
this.shouldRenderImmediatelyInPortal = shouldRenderImmediatelyInPortal || false;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/**
|
|
@@ -113,10 +114,10 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
113
114
|
dispatchAnalyticsEvent: _this3.dispatchAnalyticsEvent
|
|
114
115
|
}, component());
|
|
115
116
|
};
|
|
116
|
-
|
|
117
|
+
this.portalProviderAPI.render(componentWithErrorBoundary,
|
|
117
118
|
// Ignored via go/ees005
|
|
118
119
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
119
|
-
this.
|
|
120
|
+
this.domRef, this.key, undefined, this.shouldRenderImmediatelyInPortal);
|
|
120
121
|
}
|
|
121
122
|
}, {
|
|
122
123
|
key: "createDomRef",
|
|
@@ -36,10 +36,10 @@ export var SelectionBasedNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
36
36
|
function SelectionBasedNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
37
37
|
// Ignored via go/ees005
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
reactComponent, viewShouldUpdate) {
|
|
39
|
+
reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal) {
|
|
40
40
|
var _this;
|
|
41
41
|
_classCallCheck(this, SelectionBasedNodeView);
|
|
42
|
-
_this = _callSuper(this, SelectionBasedNodeView, [node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate]);
|
|
42
|
+
_this = _callSuper(this, SelectionBasedNodeView, [node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, shouldRenderImmediatelyInPortal]);
|
|
43
43
|
_defineProperty(_this, "isSelectedNode", false);
|
|
44
44
|
_defineProperty(_this, "isNodeInsideSelection", function (from, to, pos, posEnd) {
|
|
45
45
|
var _this$getPositionsWit = _this.getPositionsWithDefault(pos, posEnd);
|
package/dist/esm/toolbar/keys.js
CHANGED
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "107.
|
|
23
|
+
var packageVersion = "107.23.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -19,6 +19,11 @@ export declare const aiExperienceApplicationMessages: {
|
|
|
19
19
|
defaultMessage: string;
|
|
20
20
|
description: string;
|
|
21
21
|
};
|
|
22
|
+
discardStreamingInDocumenntMessageResponse: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
22
27
|
loadingTitle: {
|
|
23
28
|
id: string;
|
|
24
29
|
defaultMessage: string;
|
|
@@ -11,7 +11,7 @@ type PortalBucketType = {
|
|
|
11
11
|
* across "buckets" and updating these buckets as necessary to balance load and performance.
|
|
12
12
|
*
|
|
13
13
|
* @class PortalManager
|
|
14
|
-
* @typedef {
|
|
14
|
+
* @typedef {object} PortalManager
|
|
15
15
|
*
|
|
16
16
|
* @property {number} maxBucketCapacity - The maximum capacity of each bucket before a new bucket is created.
|
|
17
17
|
* @property {number} scaleRatio - The ratio to determine the number of new buckets to add when scaling up.
|
|
@@ -20,10 +20,13 @@ type PortalBucketType = {
|
|
|
20
20
|
* @property {Map<React.Key, number>} portalToBucketMap - A map of React portal keys to their corresponding bucket indices.
|
|
21
21
|
* @property {PortalRendererUpdater|null} portalRendererUpdater - A function to trigger updates to the rendering of portals.
|
|
22
22
|
* @property {number} scaleCapacityThreshold - The threshold at which the buckets are scaled up to accommodate more portals.
|
|
23
|
+
* @property {Map<number, ReturnType<typeof throttle>>} throttledBucketUpdaters - A map of bucket IDs to their throttled update functions.
|
|
24
|
+
* @property {number} throttleDelay - The delay in milliseconds for throttling bucket updates.
|
|
23
25
|
*
|
|
24
26
|
* @param {number} [initialBuckets=DEFAULT_INITIAL_BUCKETS] - The initial number of buckets to create.
|
|
25
27
|
* @param {number} [maxBucketCapacity=DEFAULT_MAX_BUCKET_CAPACITY] - The maximum number of portals a single bucket can hold.
|
|
26
28
|
* @param {number} [scaleRatio=DEFAULT_SCALE_RATIO] - The ratio used to calculate the number of new buckets to add when scaling.
|
|
29
|
+
* @param {number} [throttleDelay=DEFAULT_THROTTLE_DELAY] - The delay in milliseconds for throttling updates.
|
|
27
30
|
*/
|
|
28
31
|
export declare class PortalManager {
|
|
29
32
|
private maxBucketCapacity;
|
|
@@ -33,14 +36,17 @@ export declare class PortalManager {
|
|
|
33
36
|
private portalToBucketMap;
|
|
34
37
|
private portalRendererUpdater;
|
|
35
38
|
private scaleCapacityThreshold;
|
|
36
|
-
|
|
39
|
+
private throttledBucketUpdaters;
|
|
40
|
+
private throttleDelay;
|
|
41
|
+
constructor(initialBuckets?: number, maxBucketCapacity?: number, scaleRatio?: number, throttleDelay?: number);
|
|
37
42
|
private getCurrentBucket;
|
|
38
43
|
private createBucket;
|
|
44
|
+
private getOrCreateThrottledUpdater;
|
|
39
45
|
getBuckets(): PortalBucketType[];
|
|
40
46
|
registerBucket(id: number, updater: PortalsBucketUpdater): void;
|
|
41
47
|
unregisterBucket(id: number): void;
|
|
42
|
-
updateBuckets(id: number): void;
|
|
43
|
-
registerPortal(key: string | number, portal: React.ReactPortal): () => void;
|
|
48
|
+
updateBuckets(id: number, immediate?: boolean): void;
|
|
49
|
+
registerPortal(key: string | number, portal: React.ReactPortal, immediate?: boolean): () => void;
|
|
44
50
|
registerPortalRenderer(updater: PortalRendererUpdater): void;
|
|
45
51
|
unregisterPortalRenderer(): void;
|
|
46
52
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PortalManager } from './PortalManager';
|
|
3
|
-
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, onBeforeReactDomRender?: () => void) => void;
|
|
3
|
+
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, onBeforeReactDomRender?: () => void, immediate?: boolean) => void;
|
|
4
4
|
type RemoveFn = (key: string) => void;
|
|
5
5
|
type DestoryFn = () => void;
|
|
6
6
|
export interface PortalProviderAPI {
|
|
@@ -21,7 +21,8 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
|
|
|
21
21
|
contentDOM: HTMLElement | null | undefined;
|
|
22
22
|
node: PMNode;
|
|
23
23
|
key: string;
|
|
24
|
-
|
|
24
|
+
shouldRenderImmediatelyInPortal: boolean;
|
|
25
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, viewShouldUpdate?: shouldUpdate, shouldRenderImmediatelyInPortal?: boolean);
|
|
25
26
|
/**
|
|
26
27
|
* This method exists to move initialization logic out of the constructor,
|
|
27
28
|
* so object can be initialized properly before calling render first time.
|
|
@@ -31,7 +31,7 @@ export declare class SelectionBasedNodeView<P = ReactComponentProps> extends Rea
|
|
|
31
31
|
protected isSelectedNode: boolean;
|
|
32
32
|
pos: number | undefined;
|
|
33
33
|
posEnd: number | undefined;
|
|
34
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, viewShouldUpdate?: shouldUpdate);
|
|
34
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, viewShouldUpdate?: shouldUpdate, shouldRenderImmediatelyInPortal?: boolean);
|
|
35
35
|
/**
|
|
36
36
|
* Update current node's start and end positions.
|
|
37
37
|
*
|
|
@@ -19,6 +19,11 @@ export declare const aiExperienceApplicationMessages: {
|
|
|
19
19
|
defaultMessage: string;
|
|
20
20
|
description: string;
|
|
21
21
|
};
|
|
22
|
+
discardStreamingInDocumenntMessageResponse: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
22
27
|
loadingTitle: {
|
|
23
28
|
id: string;
|
|
24
29
|
defaultMessage: string;
|
|
@@ -11,7 +11,7 @@ type PortalBucketType = {
|
|
|
11
11
|
* across "buckets" and updating these buckets as necessary to balance load and performance.
|
|
12
12
|
*
|
|
13
13
|
* @class PortalManager
|
|
14
|
-
* @typedef {
|
|
14
|
+
* @typedef {object} PortalManager
|
|
15
15
|
*
|
|
16
16
|
* @property {number} maxBucketCapacity - The maximum capacity of each bucket before a new bucket is created.
|
|
17
17
|
* @property {number} scaleRatio - The ratio to determine the number of new buckets to add when scaling up.
|
|
@@ -20,10 +20,13 @@ type PortalBucketType = {
|
|
|
20
20
|
* @property {Map<React.Key, number>} portalToBucketMap - A map of React portal keys to their corresponding bucket indices.
|
|
21
21
|
* @property {PortalRendererUpdater|null} portalRendererUpdater - A function to trigger updates to the rendering of portals.
|
|
22
22
|
* @property {number} scaleCapacityThreshold - The threshold at which the buckets are scaled up to accommodate more portals.
|
|
23
|
+
* @property {Map<number, ReturnType<typeof throttle>>} throttledBucketUpdaters - A map of bucket IDs to their throttled update functions.
|
|
24
|
+
* @property {number} throttleDelay - The delay in milliseconds for throttling bucket updates.
|
|
23
25
|
*
|
|
24
26
|
* @param {number} [initialBuckets=DEFAULT_INITIAL_BUCKETS] - The initial number of buckets to create.
|
|
25
27
|
* @param {number} [maxBucketCapacity=DEFAULT_MAX_BUCKET_CAPACITY] - The maximum number of portals a single bucket can hold.
|
|
26
28
|
* @param {number} [scaleRatio=DEFAULT_SCALE_RATIO] - The ratio used to calculate the number of new buckets to add when scaling.
|
|
29
|
+
* @param {number} [throttleDelay=DEFAULT_THROTTLE_DELAY] - The delay in milliseconds for throttling updates.
|
|
27
30
|
*/
|
|
28
31
|
export declare class PortalManager {
|
|
29
32
|
private maxBucketCapacity;
|
|
@@ -33,14 +36,17 @@ export declare class PortalManager {
|
|
|
33
36
|
private portalToBucketMap;
|
|
34
37
|
private portalRendererUpdater;
|
|
35
38
|
private scaleCapacityThreshold;
|
|
36
|
-
|
|
39
|
+
private throttledBucketUpdaters;
|
|
40
|
+
private throttleDelay;
|
|
41
|
+
constructor(initialBuckets?: number, maxBucketCapacity?: number, scaleRatio?: number, throttleDelay?: number);
|
|
37
42
|
private getCurrentBucket;
|
|
38
43
|
private createBucket;
|
|
44
|
+
private getOrCreateThrottledUpdater;
|
|
39
45
|
getBuckets(): PortalBucketType[];
|
|
40
46
|
registerBucket(id: number, updater: PortalsBucketUpdater): void;
|
|
41
47
|
unregisterBucket(id: number): void;
|
|
42
|
-
updateBuckets(id: number): void;
|
|
43
|
-
registerPortal(key: string | number, portal: React.ReactPortal): () => void;
|
|
48
|
+
updateBuckets(id: number, immediate?: boolean): void;
|
|
49
|
+
registerPortal(key: string | number, portal: React.ReactPortal, immediate?: boolean): () => void;
|
|
44
50
|
registerPortalRenderer(updater: PortalRendererUpdater): void;
|
|
45
51
|
unregisterPortalRenderer(): void;
|
|
46
52
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PortalManager } from './PortalManager';
|
|
3
|
-
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, onBeforeReactDomRender?: () => void) => void;
|
|
3
|
+
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, onBeforeReactDomRender?: () => void, immediate?: boolean) => void;
|
|
4
4
|
type RemoveFn = (key: string) => void;
|
|
5
5
|
type DestoryFn = () => void;
|
|
6
6
|
export interface PortalProviderAPI {
|
|
@@ -21,7 +21,8 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
|
|
|
21
21
|
contentDOM: HTMLElement | null | undefined;
|
|
22
22
|
node: PMNode;
|
|
23
23
|
key: string;
|
|
24
|
-
|
|
24
|
+
shouldRenderImmediatelyInPortal: boolean;
|
|
25
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, viewShouldUpdate?: shouldUpdate, shouldRenderImmediatelyInPortal?: boolean);
|
|
25
26
|
/**
|
|
26
27
|
* This method exists to move initialization logic out of the constructor,
|
|
27
28
|
* so object can be initialized properly before calling render first time.
|
|
@@ -31,7 +31,7 @@ export declare class SelectionBasedNodeView<P = ReactComponentProps> extends Rea
|
|
|
31
31
|
protected isSelectedNode: boolean;
|
|
32
32
|
pos: number | undefined;
|
|
33
33
|
posEnd: number | undefined;
|
|
34
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, viewShouldUpdate?: shouldUpdate);
|
|
34
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, viewShouldUpdate?: shouldUpdate, shouldRenderImmediatelyInPortal?: boolean);
|
|
35
35
|
/**
|
|
36
36
|
* Update current node's start and end positions.
|
|
37
37
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "107.
|
|
3
|
+
"version": "107.23.1",
|
|
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/"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"@atlaskit/editor-toolbar": "^0.2.0",
|
|
145
145
|
"@atlaskit/editor-toolbar-model": "^0.1.0",
|
|
146
146
|
"@atlaskit/emoji": "^69.3.0",
|
|
147
|
-
"@atlaskit/icon": "^27.
|
|
147
|
+
"@atlaskit/icon": "^27.12.0",
|
|
148
148
|
"@atlaskit/icon-object": "^7.2.0",
|
|
149
149
|
"@atlaskit/link": "^3.2.0",
|
|
150
150
|
"@atlaskit/link-datasource": "^4.19.0",
|
|
@@ -164,17 +164,17 @@
|
|
|
164
164
|
"@atlaskit/platform-feature-flags-react": "^0.2.0",
|
|
165
165
|
"@atlaskit/popper": "^7.1.0",
|
|
166
166
|
"@atlaskit/primitives": "^14.11.0",
|
|
167
|
-
"@atlaskit/profilecard": "^24.
|
|
167
|
+
"@atlaskit/profilecard": "^24.5.0",
|
|
168
168
|
"@atlaskit/react-ufo": "^4.2.0",
|
|
169
169
|
"@atlaskit/section-message": "^8.5.0",
|
|
170
|
-
"@atlaskit/smart-card": "^40.
|
|
170
|
+
"@atlaskit/smart-card": "^40.10.0",
|
|
171
171
|
"@atlaskit/smart-user-picker": "^8.1.0",
|
|
172
172
|
"@atlaskit/spinner": "^19.0.0",
|
|
173
173
|
"@atlaskit/status": "^3.0.0",
|
|
174
174
|
"@atlaskit/task-decision": "^19.2.0",
|
|
175
175
|
"@atlaskit/textfield": "^8.0.0",
|
|
176
176
|
"@atlaskit/theme": "^19.0.0",
|
|
177
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
177
|
+
"@atlaskit/tmp-editor-statsig": "^9.28.0",
|
|
178
178
|
"@atlaskit/tokens": "^6.0.0",
|
|
179
179
|
"@atlaskit/tooltip": "^20.4.0",
|
|
180
180
|
"@atlaskit/width-detector": "^5.0.0",
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
"devDependencies": {
|
|
215
215
|
"@af/visual-regression": "workspace:^",
|
|
216
216
|
"@atlaskit/media-core": "^37.0.0",
|
|
217
|
-
"@atlaskit/media-test-helpers": "^
|
|
217
|
+
"@atlaskit/media-test-helpers": "^38.0.0",
|
|
218
218
|
"@atlaskit/util-data-test": "^18.1.0",
|
|
219
219
|
"@atlaskit/visual-regression": "workspace:^",
|
|
220
220
|
"@testing-library/dom": "^10.1.0",
|