@atlaskit/editor-plugin-block-controls 34.0.3 → 34.0.4

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-block-controls
2
2
 
3
+ ## 34.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3c72b5a721bca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3c72b5a721bca) -
8
+ [EDITOR-9730] Behind `platform_editor_improve_inp_batch_3`, reduce mousemove cost when resolving
9
+ the hover side: use a single hit test instead of scanning all top-level blocks for the
10
+ right-margin target, and coalesce hover processing through requestAnimationFrame followed by a
11
+ timeout to give the browser an opportunity to update layout before reading current content
12
+ geometry. Coalesced processing uses the latest mouse event and plugin API together, skips
13
+ suppressed hover states, and finishes geometry classification before updating editing or hover
14
+ state.
15
+ - Updated dependencies
16
+
3
17
  ## 34.0.3
4
18
 
5
19
  ### Patch Changes
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.handleKeyDown = void 0;
7
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
7
8
  var _commands = require("./commands");
9
+ var _handleMouseMove = require("./handle-mouse-move");
8
10
  var _pmPlugin = require("./pm-plugin");
9
11
  var handleKeyDown = exports.handleKeyDown = function handleKeyDown(view, event) {
10
12
  // Check if this is a keyboard shortcut (Ctrl/Cmd + key)
@@ -22,6 +24,12 @@ var handleKeyDown = exports.handleKeyDown = function handleKeyDown(view, event)
22
24
  if (!isTypingKey) {
23
25
  return false;
24
26
  }
27
+
28
+ // With the experiment, a queued mousemove clears the typing state when it finally runs. Typing
29
+ // is newer than that move, so drop it, even if we are already editing.
30
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_3')) {
31
+ (0, _handleMouseMove.clearPendingHoverSide)(view);
32
+ }
25
33
  var state = (0, _pmPlugin.getInteractionTrackingState)(view.state);
26
34
 
27
35
  // if user hasnt started typing yet, start timer
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.handleMouseMove = exports.handleMouseLeave = exports.handleMouseEnter = void 0;
6
+ exports.handleMouseMove = exports.handleMouseLeave = exports.handleMouseEnter = exports.clearPendingHoverSide = void 0;
7
7
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
8
8
  var _handleMouseOver = require("../handle-mouse-over");
9
+ var _afterRenderScheduler = require("../utils/after-render-scheduler");
9
10
  var _commands = require("./commands");
10
11
  var _constants = require("./constants");
11
12
  var _pmPlugin = require("./pm-plugin");
@@ -24,9 +25,12 @@ var cancelScheduledProcessForView = function cancelScheduledProcessForView(view)
24
25
  rafIdByView.delete(view);
25
26
  }
26
27
  };
27
- var clearPendingHoverSide = function clearPendingHoverSide(view) {
28
+ var clearPendingHoverSide = exports.clearPendingHoverSide = function clearPendingHoverSide(view) {
28
29
  pendingByView.delete(view);
29
30
  cancelScheduledProcessForView(view);
31
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_3')) {
32
+ cancelHoverSideAfterRender(view);
33
+ }
30
34
  };
31
35
  var BLOCK_SELECTORS = '[data-node-anchor], [data-drag-handler-anchor-name]';
32
36
  var LEGACY_RIGHT_EDGE_SELECTOR = '[data-blocks-right-edge-button-container]';
@@ -79,6 +83,9 @@ var getRightMarginBoundary = function getRightMarginBoundary(view) {
79
83
  // Classify where the cursor sits in the right margin beside the block at its height, running the
80
84
  // block lookup once so the caller doesn't traverse the DOM twice per mousemove.
81
85
  var classifyRightMarginPosition = function classifyRightMarginPosition(view, event) {
86
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_3')) {
87
+ return classifyRightMarginPositionByHitTest(view, event);
88
+ }
82
89
  var found = findBlockAtY(view, event.clientY);
83
90
  if (!found) {
84
91
  return null;
@@ -188,6 +195,9 @@ var processHoverSide = function processHoverSide(view, api) {
188
195
  }
189
196
  };
190
197
  var handleMouseMove = exports.handleMouseMove = function handleMouseMove(view, event, rightSideControlsEnabled, api) {
198
+ if (rightSideControlsEnabled && event instanceof MouseEvent && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_3')) {
199
+ return handleMouseMoveAfterRender(view, event, api);
200
+ }
191
201
  var state = (0, _pmPlugin.getInteractionTrackingState)(view.state);
192
202
  // if user has stopped editing and moved their mouse, show block controls again
193
203
  if (state !== null && state !== void 0 && state.isEditing) {
@@ -219,4 +229,113 @@ var handleMouseLeave = exports.handleMouseLeave = function handleMouseLeave(view
219
229
  var handleMouseEnter = exports.handleMouseEnter = function handleMouseEnter(view) {
220
230
  (0, _commands.mouseEnter)(view);
221
231
  return false;
232
+ };
233
+
234
+ /* -------------------------------------------------------------------------------------------------
235
+ * EDITOR-9730: platform_editor_improve_inp_batch_3
236
+ *
237
+ * Everything below is the treatment path, reached through these gates only:
238
+ * - handleMouseMove -> handleMouseMoveAfterRender
239
+ * - classifyRightMarginPosition -> classifyRightMarginPositionByHitTest
240
+ * - clearPendingHoverSide -> cancelHoverSideAfterRender
241
+ * Clean-up when the experiment ships: delete this section, take the treatment branch at each gate
242
+ * (dropping findBlockAtY, getRootBlocks, the rAF bookkeeping and the legacy handleMouseMove body),
243
+ * and remove the gated calls in pm-plugin.ts and handle-key-down.ts.
244
+ * ---------------------------------------------------------------------------------------------- */
245
+
246
+ /** Per-view scheduler plus the latest plugin API to use when it runs. */
247
+ var afterRenderByView = new WeakMap();
248
+ var cancelHoverSideAfterRender = function cancelHoverSideAfterRender(view) {
249
+ var _afterRenderByView$ge;
250
+ (_afterRenderByView$ge = afterRenderByView.get(view)) === null || _afterRenderByView$ge === void 0 || _afterRenderByView$ge.scheduler.cancel();
251
+ };
252
+ var processHoverSideAfterRender = function processHoverSideAfterRender(view) {
253
+ var _getInteractionTracki;
254
+ var state = afterRenderByView.get(view);
255
+ if (!state || view.isDestroyed || !pendingByView.has(view)) {
256
+ return;
257
+ }
258
+ processHoverSide(view, state.api);
259
+
260
+ // The typing state is cleared last, after every read above has finished, so no layout read
261
+ // follows one of our own writes. Typing cancels pending work (see handle-key-down.ts), so this
262
+ // never undoes a newer keystroke.
263
+ if ((_getInteractionTracki = (0, _pmPlugin.getInteractionTrackingState)(view.state)) !== null && _getInteractionTracki !== void 0 && _getInteractionTracki.isEditing) {
264
+ (0, _commands.stopEditing)(view);
265
+ }
266
+ };
267
+ var handleMouseMoveAfterRender = function handleMouseMoveAfterRender(view, event, api) {
268
+ var win = view.dom.ownerDocument.defaultView;
269
+ if (!win) {
270
+ return false;
271
+ }
272
+ pendingByView.set(view, event);
273
+ var state = afterRenderByView.get(view);
274
+ if (!state) {
275
+ state = {
276
+ api: api,
277
+ scheduler: (0, _afterRenderScheduler.createAfterRenderScheduler)(win, function () {
278
+ return processHoverSideAfterRender(view);
279
+ })
280
+ };
281
+ afterRenderByView.set(view, state);
282
+ }
283
+ // The latest event and API win when several moves coalesce into one run.
284
+ state.api = api;
285
+ // Reads run after the next frame renders, giving the browser an opportunity to update layout
286
+ // first (other work can still dirty it).
287
+ state.scheduler.schedule();
288
+ return false;
289
+ };
290
+
291
+ // Walk up from a block to its top-level block (no block ancestor). Cost is bounded by nesting
292
+ // depth, matching getRootBlocks' filter without scanning the whole document.
293
+ var toRootBlock = function toRootBlock(block) {
294
+ var _root$parentElement;
295
+ var root = block;
296
+ var parent = (_root$parentElement = root.parentElement) === null || _root$parentElement === void 0 ? void 0 : _root$parentElement.closest(BLOCK_SELECTORS);
297
+ while (parent instanceof HTMLElement) {
298
+ var _root$parentElement2;
299
+ root = parent;
300
+ parent = (_root$parentElement2 = root.parentElement) === null || _root$parentElement2 === void 0 ? void 0 : _root$parentElement2.closest(BLOCK_SELECTORS);
301
+ }
302
+ return root;
303
+ };
304
+
305
+ // Right-margin lookup without the document-wide scan (EDITOR-9730): when the cursor is past the
306
+ // right edge of the editor content, hit-test once just inside that edge at the cursor's height and
307
+ // resolve the top-level block there.
308
+ //
309
+ // This still reads layout (getBoundingClientRect and elementFromPoint), so like findBlockAtY it
310
+ // forces a synchronous layout if layout is dirty when it runs. What changes is how much and when:
311
+ // one rect and one hit test instead of a rect per top-level block, and it runs in the
312
+ // after-render callback, where the browser has had an opportunity to update layout first.
313
+ var findRootBlockBesideCursor = function findRootBlockBesideCursor(view, event) {
314
+ var _root$elementFromPoin;
315
+ var contentRight = view.dom.getBoundingClientRect().right;
316
+ if (event.clientX <= contentRight) {
317
+ return null;
318
+ }
319
+ var root = view.root;
320
+ if (typeof root.elementFromPoint !== 'function') {
321
+ return null;
322
+ }
323
+ var block = (_root$elementFromPoin = root.elementFromPoint(contentRight - 1, event.clientY)) === null || _root$elementFromPoin === void 0 ? void 0 : _root$elementFromPoin.closest(BLOCK_SELECTORS);
324
+ if (!(block instanceof HTMLElement)) {
325
+ return null;
326
+ }
327
+ var rootBlock = toRootBlock(block);
328
+ return view.dom.contains(rootBlock) ? rootBlock : null;
329
+ };
330
+
331
+ // Same classification as the legacy path, with the block found by a hit test.
332
+ var classifyRightMarginPositionByHitTest = function classifyRightMarginPositionByHitTest(view, event) {
333
+ var block = findRootBlockBesideCursor(view, event);
334
+ if (!block) {
335
+ return null;
336
+ }
337
+ return {
338
+ type: 'active',
339
+ block: block
340
+ };
222
341
  };
@@ -224,6 +224,9 @@ var createInteractionTrackingPlugin = exports.createInteractionTrackingPlugin =
224
224
  var _unbindDocumentMouseM;
225
225
  cancelScheduledMouseLeave();
226
226
  (_unbindDocumentMouseM = unbindDocumentMouseMove) === null || _unbindDocumentMouseM === void 0 || _unbindDocumentMouseM();
227
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_3')) {
228
+ (0, _handleMouseMove.clearPendingHoverSide)(_view);
229
+ }
227
230
  }
228
231
  (_unbindMouseEnter = unbindMouseEnter) === null || _unbindMouseEnter === void 0 || _unbindMouseEnter();
229
232
  (_unbindMouseLeave = unbindMouseLeave) === null || _unbindMouseLeave === void 0 || _unbindMouseLeave();
@@ -14,6 +14,7 @@ var _handleSparseHoverTarget = require("./handle-sparse-hover-target");
14
14
  var _commands = require("./interaction-tracking/commands");
15
15
  var _handleMouseMove = require("./interaction-tracking/handle-mouse-move");
16
16
  var _pmPlugin = require("./interaction-tracking/pm-plugin");
17
+ var _afterRenderScheduler = require("./utils/after-render-scheduler");
17
18
  var _visibleBox = require("./utils/visible-box");
18
19
  var BLOCK_SELECTOR = '[data-prosemirror-node-block="true"]';
19
20
  var TABLE_STRUCTURE_NODES = new Set(['table', 'tableRow', 'tableCell', 'tableHeader']);
@@ -150,40 +151,6 @@ var classifyGutterHover = function classifyGutterHover(view, findGutterBlock, _r
150
151
  };
151
152
  };
152
153
 
153
- /**
154
- * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
155
- * Layout is clean then, so reading positions never forces a synchronous layout. Calls made while a
156
- * run is already scheduled are ignored.
157
- */
158
- var createAfterRenderScheduler = function createAfterRenderScheduler(win, callback) {
159
- var frame;
160
- var timeout;
161
- return {
162
- schedule: function schedule() {
163
- if (frame !== undefined || timeout !== undefined) {
164
- return;
165
- }
166
- frame = win.requestAnimationFrame(function () {
167
- frame = undefined;
168
- timeout = win.setTimeout(function () {
169
- timeout = undefined;
170
- callback();
171
- }, 0);
172
- });
173
- },
174
- cancel: function cancel() {
175
- if (frame !== undefined) {
176
- win.cancelAnimationFrame(frame);
177
- frame = undefined;
178
- }
179
- if (timeout !== undefined) {
180
- win.clearTimeout(timeout);
181
- timeout = undefined;
182
- }
183
- }
184
- };
185
- };
186
-
187
154
  /**
188
155
  * Keeps interaction tracking in step with gutter hover, as the legacy hover zones did. They sat
189
156
  * inside the block tree, so hovering one cleared the typing state, counted as inside the editor even
@@ -256,7 +223,7 @@ var bindSparseGutterHover = exports.bindSparseGutterHover = function bindSparseG
256
223
  }
257
224
  syncInteractionTracking(pointer.event, hover.kind === 'block');
258
225
  };
259
- var scheduler = createAfterRenderScheduler(win, handlePendingPointer);
226
+ var scheduler = (0, _afterRenderScheduler.createAfterRenderScheduler)(win, handlePendingPointer);
260
227
  var queueGutterEvent = function queueGutterEvent(event, reachedNewElement) {
261
228
  var _pending;
262
229
  pending = {
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createAfterRenderScheduler = void 0;
7
+ /**
8
+ * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
9
+ * Deferring position reads gives the browser an opportunity to update layout first; other work
10
+ * can still invalidate layout before the callback. Calls made while a run is scheduled are ignored.
11
+ */
12
+ var createAfterRenderScheduler = exports.createAfterRenderScheduler = function createAfterRenderScheduler(win, callback) {
13
+ var frame;
14
+ var timeout;
15
+ return {
16
+ schedule: function schedule() {
17
+ if (frame !== undefined || timeout !== undefined) {
18
+ return;
19
+ }
20
+ frame = win.requestAnimationFrame(function () {
21
+ frame = undefined;
22
+ timeout = win.setTimeout(function () {
23
+ timeout = undefined;
24
+ callback();
25
+ }, 0);
26
+ });
27
+ },
28
+ cancel: function cancel() {
29
+ if (frame !== undefined) {
30
+ win.cancelAnimationFrame(frame);
31
+ frame = undefined;
32
+ }
33
+ if (timeout !== undefined) {
34
+ win.clearTimeout(timeout);
35
+ timeout = undefined;
36
+ }
37
+ }
38
+ };
39
+ };
@@ -1,4 +1,6 @@
1
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
1
2
  import { startEditing } from './commands';
3
+ import { clearPendingHoverSide } from './handle-mouse-move';
2
4
  import { getInteractionTrackingState } from './pm-plugin';
3
5
  export const handleKeyDown = (view, event) => {
4
6
  // Check if this is a keyboard shortcut (Ctrl/Cmd + key)
@@ -16,6 +18,12 @@ export const handleKeyDown = (view, event) => {
16
18
  if (!isTypingKey) {
17
19
  return false;
18
20
  }
21
+
22
+ // With the experiment, a queued mousemove clears the typing state when it finally runs. Typing
23
+ // is newer than that move, so drop it, even if we are already editing.
24
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
25
+ clearPendingHoverSide(view);
26
+ }
19
27
  const state = getInteractionTrackingState(view.state);
20
28
 
21
29
  // if user hasnt started typing yet, start timer
@@ -1,5 +1,6 @@
1
1
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
2
  import { handleMouseOver } from '../handle-mouse-over';
3
+ import { createAfterRenderScheduler } from '../utils/after-render-scheduler';
3
4
  import { clearHoverSide, mouseEnter, mouseLeave, setHoverSide, stopEditing } from './commands';
4
5
  import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
5
6
  import { getInteractionTrackingState } from './pm-plugin';
@@ -16,9 +17,12 @@ const cancelScheduledProcessForView = view => {
16
17
  rafIdByView.delete(view);
17
18
  }
18
19
  };
19
- const clearPendingHoverSide = view => {
20
+ export const clearPendingHoverSide = view => {
20
21
  pendingByView.delete(view);
21
22
  cancelScheduledProcessForView(view);
23
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
24
+ cancelHoverSideAfterRender(view);
25
+ }
22
26
  };
23
27
  const BLOCK_SELECTORS = '[data-node-anchor], [data-drag-handler-anchor-name]';
24
28
  const LEGACY_RIGHT_EDGE_SELECTOR = '[data-blocks-right-edge-button-container]';
@@ -56,6 +60,9 @@ const getRightMarginBoundary = view => {
56
60
  // Classify where the cursor sits in the right margin beside the block at its height, running the
57
61
  // block lookup once so the caller doesn't traverse the DOM twice per mousemove.
58
62
  const classifyRightMarginPosition = (view, event) => {
63
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
64
+ return classifyRightMarginPositionByHitTest(view, event);
65
+ }
59
66
  const found = findBlockAtY(view, event.clientY);
60
67
  if (!found) {
61
68
  return null;
@@ -166,6 +173,9 @@ const processHoverSide = (view, api) => {
166
173
  }
167
174
  };
168
175
  export const handleMouseMove = (view, event, rightSideControlsEnabled, api) => {
176
+ if (rightSideControlsEnabled && event instanceof MouseEvent && isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
177
+ return handleMouseMoveAfterRender(view, event, api);
178
+ }
169
179
  const state = getInteractionTrackingState(view.state);
170
180
  // if user has stopped editing and moved their mouse, show block controls again
171
181
  if (state !== null && state !== void 0 && state.isEditing) {
@@ -197,4 +207,111 @@ export const handleMouseLeave = (view, rightSideControlsEnabled) => {
197
207
  export const handleMouseEnter = view => {
198
208
  mouseEnter(view);
199
209
  return false;
210
+ };
211
+
212
+ /* -------------------------------------------------------------------------------------------------
213
+ * EDITOR-9730: platform_editor_improve_inp_batch_3
214
+ *
215
+ * Everything below is the treatment path, reached through these gates only:
216
+ * - handleMouseMove -> handleMouseMoveAfterRender
217
+ * - classifyRightMarginPosition -> classifyRightMarginPositionByHitTest
218
+ * - clearPendingHoverSide -> cancelHoverSideAfterRender
219
+ * Clean-up when the experiment ships: delete this section, take the treatment branch at each gate
220
+ * (dropping findBlockAtY, getRootBlocks, the rAF bookkeeping and the legacy handleMouseMove body),
221
+ * and remove the gated calls in pm-plugin.ts and handle-key-down.ts.
222
+ * ---------------------------------------------------------------------------------------------- */
223
+
224
+ /** Per-view scheduler plus the latest plugin API to use when it runs. */
225
+ const afterRenderByView = new WeakMap();
226
+ const cancelHoverSideAfterRender = view => {
227
+ var _afterRenderByView$ge;
228
+ (_afterRenderByView$ge = afterRenderByView.get(view)) === null || _afterRenderByView$ge === void 0 ? void 0 : _afterRenderByView$ge.scheduler.cancel();
229
+ };
230
+ const processHoverSideAfterRender = view => {
231
+ var _getInteractionTracki;
232
+ const state = afterRenderByView.get(view);
233
+ if (!state || view.isDestroyed || !pendingByView.has(view)) {
234
+ return;
235
+ }
236
+ processHoverSide(view, state.api);
237
+
238
+ // The typing state is cleared last, after every read above has finished, so no layout read
239
+ // follows one of our own writes. Typing cancels pending work (see handle-key-down.ts), so this
240
+ // never undoes a newer keystroke.
241
+ if ((_getInteractionTracki = getInteractionTrackingState(view.state)) !== null && _getInteractionTracki !== void 0 && _getInteractionTracki.isEditing) {
242
+ stopEditing(view);
243
+ }
244
+ };
245
+ const handleMouseMoveAfterRender = (view, event, api) => {
246
+ const win = view.dom.ownerDocument.defaultView;
247
+ if (!win) {
248
+ return false;
249
+ }
250
+ pendingByView.set(view, event);
251
+ let state = afterRenderByView.get(view);
252
+ if (!state) {
253
+ state = {
254
+ api,
255
+ scheduler: createAfterRenderScheduler(win, () => processHoverSideAfterRender(view))
256
+ };
257
+ afterRenderByView.set(view, state);
258
+ }
259
+ // The latest event and API win when several moves coalesce into one run.
260
+ state.api = api;
261
+ // Reads run after the next frame renders, giving the browser an opportunity to update layout
262
+ // first (other work can still dirty it).
263
+ state.scheduler.schedule();
264
+ return false;
265
+ };
266
+
267
+ // Walk up from a block to its top-level block (no block ancestor). Cost is bounded by nesting
268
+ // depth, matching getRootBlocks' filter without scanning the whole document.
269
+ const toRootBlock = block => {
270
+ var _root$parentElement;
271
+ let root = block;
272
+ let parent = (_root$parentElement = root.parentElement) === null || _root$parentElement === void 0 ? void 0 : _root$parentElement.closest(BLOCK_SELECTORS);
273
+ while (parent instanceof HTMLElement) {
274
+ var _root$parentElement2;
275
+ root = parent;
276
+ parent = (_root$parentElement2 = root.parentElement) === null || _root$parentElement2 === void 0 ? void 0 : _root$parentElement2.closest(BLOCK_SELECTORS);
277
+ }
278
+ return root;
279
+ };
280
+
281
+ // Right-margin lookup without the document-wide scan (EDITOR-9730): when the cursor is past the
282
+ // right edge of the editor content, hit-test once just inside that edge at the cursor's height and
283
+ // resolve the top-level block there.
284
+ //
285
+ // This still reads layout (getBoundingClientRect and elementFromPoint), so like findBlockAtY it
286
+ // forces a synchronous layout if layout is dirty when it runs. What changes is how much and when:
287
+ // one rect and one hit test instead of a rect per top-level block, and it runs in the
288
+ // after-render callback, where the browser has had an opportunity to update layout first.
289
+ const findRootBlockBesideCursor = (view, event) => {
290
+ var _root$elementFromPoin;
291
+ const contentRight = view.dom.getBoundingClientRect().right;
292
+ if (event.clientX <= contentRight) {
293
+ return null;
294
+ }
295
+ const root = view.root;
296
+ if (typeof root.elementFromPoint !== 'function') {
297
+ return null;
298
+ }
299
+ const block = (_root$elementFromPoin = root.elementFromPoint(contentRight - 1, event.clientY)) === null || _root$elementFromPoin === void 0 ? void 0 : _root$elementFromPoin.closest(BLOCK_SELECTORS);
300
+ if (!(block instanceof HTMLElement)) {
301
+ return null;
302
+ }
303
+ const rootBlock = toRootBlock(block);
304
+ return view.dom.contains(rootBlock) ? rootBlock : null;
305
+ };
306
+
307
+ // Same classification as the legacy path, with the block found by a hit test.
308
+ const classifyRightMarginPositionByHitTest = (view, event) => {
309
+ const block = findRootBlockBesideCursor(view, event);
310
+ if (!block) {
311
+ return null;
312
+ }
313
+ return {
314
+ type: 'active',
315
+ block
316
+ };
200
317
  };
@@ -5,7 +5,7 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
5
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
6
  import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
7
7
  import { handleKeyDown } from './handle-key-down';
8
- import { handleMouseEnter, handleMouseLeave, handleMouseMove } from './handle-mouse-move';
8
+ import { clearPendingHoverSide, handleMouseEnter, handleMouseLeave, handleMouseMove } from './handle-mouse-move';
9
9
 
10
10
  /** Elements that extend the editor hover area (block controls, right-edge button, etc.) */
11
11
  const LEGACY_BLOCK_CONTROLS_HOVER_AREA_SELECTOR = '[data-blocks-right-edge-button-container], [data-blocks-drag-handle-container], [data-testid="block-ctrl-drag-handle"], [data-testid="block-ctrl-drag-handle-container"], [data-testid="block-ctrl-decorator-widget"], [data-testid="block-ctrl-quick-insert-button"]';
@@ -210,6 +210,9 @@ export const createInteractionTrackingPlugin = (rightSideControlsEnabled = false
210
210
  var _unbindDocumentMouseM;
211
211
  cancelScheduledMouseLeave();
212
212
  (_unbindDocumentMouseM = unbindDocumentMouseMove) === null || _unbindDocumentMouseM === void 0 ? void 0 : _unbindDocumentMouseM();
213
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
214
+ clearPendingHoverSide(view);
215
+ }
213
216
  }
214
217
  (_unbindMouseEnter = unbindMouseEnter) === null || _unbindMouseEnter === void 0 ? void 0 : _unbindMouseEnter();
215
218
  (_unbindMouseLeave = unbindMouseLeave) === null || _unbindMouseLeave === void 0 ? void 0 : _unbindMouseLeave();
@@ -8,6 +8,7 @@ import { handleSparseHoverTarget, isSparseHoverSuppressed } from './handle-spars
8
8
  import { mouseEnter, setHoverSide, stopEditing } from './interaction-tracking/commands';
9
9
  import { handleMouseLeave } from './interaction-tracking/handle-mouse-move';
10
10
  import { getInteractionTrackingState } from './interaction-tracking/pm-plugin';
11
+ import { createAfterRenderScheduler } from './utils/after-render-scheduler';
11
12
  import { getVisibleBox } from './utils/visible-box';
12
13
  const BLOCK_SELECTOR = '[data-prosemirror-node-block="true"]';
13
14
  const TABLE_STRUCTURE_NODES = new Set(['table', 'tableRow', 'tableCell', 'tableHeader']);
@@ -139,40 +140,6 @@ const classifyGutterHover = (view, findGutterBlock, {
139
140
  };
140
141
  };
141
142
 
142
- /**
143
- * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
144
- * Layout is clean then, so reading positions never forces a synchronous layout. Calls made while a
145
- * run is already scheduled are ignored.
146
- */
147
- const createAfterRenderScheduler = (win, callback) => {
148
- let frame;
149
- let timeout;
150
- return {
151
- schedule: () => {
152
- if (frame !== undefined || timeout !== undefined) {
153
- return;
154
- }
155
- frame = win.requestAnimationFrame(() => {
156
- frame = undefined;
157
- timeout = win.setTimeout(() => {
158
- timeout = undefined;
159
- callback();
160
- }, 0);
161
- });
162
- },
163
- cancel: () => {
164
- if (frame !== undefined) {
165
- win.cancelAnimationFrame(frame);
166
- frame = undefined;
167
- }
168
- if (timeout !== undefined) {
169
- win.clearTimeout(timeout);
170
- timeout = undefined;
171
- }
172
- }
173
- };
174
- };
175
-
176
143
  /**
177
144
  * Keeps interaction tracking in step with gutter hover, as the legacy hover zones did. They sat
178
145
  * inside the block tree, so hovering one cleared the typing state, counted as inside the editor even
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
3
+ * Deferring position reads gives the browser an opportunity to update layout first; other work
4
+ * can still invalidate layout before the callback. Calls made while a run is scheduled are ignored.
5
+ */
6
+ export const createAfterRenderScheduler = (win, callback) => {
7
+ let frame;
8
+ let timeout;
9
+ return {
10
+ schedule: () => {
11
+ if (frame !== undefined || timeout !== undefined) {
12
+ return;
13
+ }
14
+ frame = win.requestAnimationFrame(() => {
15
+ frame = undefined;
16
+ timeout = win.setTimeout(() => {
17
+ timeout = undefined;
18
+ callback();
19
+ }, 0);
20
+ });
21
+ },
22
+ cancel: () => {
23
+ if (frame !== undefined) {
24
+ win.cancelAnimationFrame(frame);
25
+ frame = undefined;
26
+ }
27
+ if (timeout !== undefined) {
28
+ win.clearTimeout(timeout);
29
+ timeout = undefined;
30
+ }
31
+ }
32
+ };
33
+ };
@@ -1,4 +1,6 @@
1
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
1
2
  import { startEditing } from './commands';
3
+ import { clearPendingHoverSide } from './handle-mouse-move';
2
4
  import { getInteractionTrackingState } from './pm-plugin';
3
5
  export var handleKeyDown = function handleKeyDown(view, event) {
4
6
  // Check if this is a keyboard shortcut (Ctrl/Cmd + key)
@@ -16,6 +18,12 @@ export var handleKeyDown = function handleKeyDown(view, event) {
16
18
  if (!isTypingKey) {
17
19
  return false;
18
20
  }
21
+
22
+ // With the experiment, a queued mousemove clears the typing state when it finally runs. Typing
23
+ // is newer than that move, so drop it, even if we are already editing.
24
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
25
+ clearPendingHoverSide(view);
26
+ }
19
27
  var state = getInteractionTrackingState(view.state);
20
28
 
21
29
  // if user hasnt started typing yet, start timer
@@ -3,6 +3,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
3
3
  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; }
4
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
5
  import { handleMouseOver } from '../handle-mouse-over';
6
+ import { createAfterRenderScheduler } from '../utils/after-render-scheduler';
6
7
  import { clearHoverSide, mouseEnter, mouseLeave, setHoverSide, stopEditing } from './commands';
7
8
  import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
8
9
  import { getInteractionTrackingState } from './pm-plugin';
@@ -19,9 +20,12 @@ var cancelScheduledProcessForView = function cancelScheduledProcessForView(view)
19
20
  rafIdByView.delete(view);
20
21
  }
21
22
  };
22
- var clearPendingHoverSide = function clearPendingHoverSide(view) {
23
+ export var clearPendingHoverSide = function clearPendingHoverSide(view) {
23
24
  pendingByView.delete(view);
24
25
  cancelScheduledProcessForView(view);
26
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
27
+ cancelHoverSideAfterRender(view);
28
+ }
25
29
  };
26
30
  var BLOCK_SELECTORS = '[data-node-anchor], [data-drag-handler-anchor-name]';
27
31
  var LEGACY_RIGHT_EDGE_SELECTOR = '[data-blocks-right-edge-button-container]';
@@ -74,6 +78,9 @@ var getRightMarginBoundary = function getRightMarginBoundary(view) {
74
78
  // Classify where the cursor sits in the right margin beside the block at its height, running the
75
79
  // block lookup once so the caller doesn't traverse the DOM twice per mousemove.
76
80
  var classifyRightMarginPosition = function classifyRightMarginPosition(view, event) {
81
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
82
+ return classifyRightMarginPositionByHitTest(view, event);
83
+ }
77
84
  var found = findBlockAtY(view, event.clientY);
78
85
  if (!found) {
79
86
  return null;
@@ -183,6 +190,9 @@ var processHoverSide = function processHoverSide(view, api) {
183
190
  }
184
191
  };
185
192
  export var handleMouseMove = function handleMouseMove(view, event, rightSideControlsEnabled, api) {
193
+ if (rightSideControlsEnabled && event instanceof MouseEvent && isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
194
+ return handleMouseMoveAfterRender(view, event, api);
195
+ }
186
196
  var state = getInteractionTrackingState(view.state);
187
197
  // if user has stopped editing and moved their mouse, show block controls again
188
198
  if (state !== null && state !== void 0 && state.isEditing) {
@@ -214,4 +224,113 @@ export var handleMouseLeave = function handleMouseLeave(view, rightSideControlsE
214
224
  export var handleMouseEnter = function handleMouseEnter(view) {
215
225
  mouseEnter(view);
216
226
  return false;
227
+ };
228
+
229
+ /* -------------------------------------------------------------------------------------------------
230
+ * EDITOR-9730: platform_editor_improve_inp_batch_3
231
+ *
232
+ * Everything below is the treatment path, reached through these gates only:
233
+ * - handleMouseMove -> handleMouseMoveAfterRender
234
+ * - classifyRightMarginPosition -> classifyRightMarginPositionByHitTest
235
+ * - clearPendingHoverSide -> cancelHoverSideAfterRender
236
+ * Clean-up when the experiment ships: delete this section, take the treatment branch at each gate
237
+ * (dropping findBlockAtY, getRootBlocks, the rAF bookkeeping and the legacy handleMouseMove body),
238
+ * and remove the gated calls in pm-plugin.ts and handle-key-down.ts.
239
+ * ---------------------------------------------------------------------------------------------- */
240
+
241
+ /** Per-view scheduler plus the latest plugin API to use when it runs. */
242
+ var afterRenderByView = new WeakMap();
243
+ var cancelHoverSideAfterRender = function cancelHoverSideAfterRender(view) {
244
+ var _afterRenderByView$ge;
245
+ (_afterRenderByView$ge = afterRenderByView.get(view)) === null || _afterRenderByView$ge === void 0 || _afterRenderByView$ge.scheduler.cancel();
246
+ };
247
+ var processHoverSideAfterRender = function processHoverSideAfterRender(view) {
248
+ var _getInteractionTracki;
249
+ var state = afterRenderByView.get(view);
250
+ if (!state || view.isDestroyed || !pendingByView.has(view)) {
251
+ return;
252
+ }
253
+ processHoverSide(view, state.api);
254
+
255
+ // The typing state is cleared last, after every read above has finished, so no layout read
256
+ // follows one of our own writes. Typing cancels pending work (see handle-key-down.ts), so this
257
+ // never undoes a newer keystroke.
258
+ if ((_getInteractionTracki = getInteractionTrackingState(view.state)) !== null && _getInteractionTracki !== void 0 && _getInteractionTracki.isEditing) {
259
+ stopEditing(view);
260
+ }
261
+ };
262
+ var handleMouseMoveAfterRender = function handleMouseMoveAfterRender(view, event, api) {
263
+ var win = view.dom.ownerDocument.defaultView;
264
+ if (!win) {
265
+ return false;
266
+ }
267
+ pendingByView.set(view, event);
268
+ var state = afterRenderByView.get(view);
269
+ if (!state) {
270
+ state = {
271
+ api: api,
272
+ scheduler: createAfterRenderScheduler(win, function () {
273
+ return processHoverSideAfterRender(view);
274
+ })
275
+ };
276
+ afterRenderByView.set(view, state);
277
+ }
278
+ // The latest event and API win when several moves coalesce into one run.
279
+ state.api = api;
280
+ // Reads run after the next frame renders, giving the browser an opportunity to update layout
281
+ // first (other work can still dirty it).
282
+ state.scheduler.schedule();
283
+ return false;
284
+ };
285
+
286
+ // Walk up from a block to its top-level block (no block ancestor). Cost is bounded by nesting
287
+ // depth, matching getRootBlocks' filter without scanning the whole document.
288
+ var toRootBlock = function toRootBlock(block) {
289
+ var _root$parentElement;
290
+ var root = block;
291
+ var parent = (_root$parentElement = root.parentElement) === null || _root$parentElement === void 0 ? void 0 : _root$parentElement.closest(BLOCK_SELECTORS);
292
+ while (parent instanceof HTMLElement) {
293
+ var _root$parentElement2;
294
+ root = parent;
295
+ parent = (_root$parentElement2 = root.parentElement) === null || _root$parentElement2 === void 0 ? void 0 : _root$parentElement2.closest(BLOCK_SELECTORS);
296
+ }
297
+ return root;
298
+ };
299
+
300
+ // Right-margin lookup without the document-wide scan (EDITOR-9730): when the cursor is past the
301
+ // right edge of the editor content, hit-test once just inside that edge at the cursor's height and
302
+ // resolve the top-level block there.
303
+ //
304
+ // This still reads layout (getBoundingClientRect and elementFromPoint), so like findBlockAtY it
305
+ // forces a synchronous layout if layout is dirty when it runs. What changes is how much and when:
306
+ // one rect and one hit test instead of a rect per top-level block, and it runs in the
307
+ // after-render callback, where the browser has had an opportunity to update layout first.
308
+ var findRootBlockBesideCursor = function findRootBlockBesideCursor(view, event) {
309
+ var _root$elementFromPoin;
310
+ var contentRight = view.dom.getBoundingClientRect().right;
311
+ if (event.clientX <= contentRight) {
312
+ return null;
313
+ }
314
+ var root = view.root;
315
+ if (typeof root.elementFromPoint !== 'function') {
316
+ return null;
317
+ }
318
+ var block = (_root$elementFromPoin = root.elementFromPoint(contentRight - 1, event.clientY)) === null || _root$elementFromPoin === void 0 ? void 0 : _root$elementFromPoin.closest(BLOCK_SELECTORS);
319
+ if (!(block instanceof HTMLElement)) {
320
+ return null;
321
+ }
322
+ var rootBlock = toRootBlock(block);
323
+ return view.dom.contains(rootBlock) ? rootBlock : null;
324
+ };
325
+
326
+ // Same classification as the legacy path, with the block found by a hit test.
327
+ var classifyRightMarginPositionByHitTest = function classifyRightMarginPositionByHitTest(view, event) {
328
+ var block = findRootBlockBesideCursor(view, event);
329
+ if (!block) {
330
+ return null;
331
+ }
332
+ return {
333
+ type: 'active',
334
+ block: block
335
+ };
217
336
  };
@@ -8,7 +8,7 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
9
  import { RIGHT_MARGIN_ROVO_GAP_PX } from './constants';
10
10
  import { handleKeyDown } from './handle-key-down';
11
- import { handleMouseEnter, handleMouseLeave, handleMouseMove } from './handle-mouse-move';
11
+ import { clearPendingHoverSide, handleMouseEnter, handleMouseLeave, handleMouseMove } from './handle-mouse-move';
12
12
 
13
13
  /** Elements that extend the editor hover area (block controls, right-edge button, etc.) */
14
14
  var LEGACY_BLOCK_CONTROLS_HOVER_AREA_SELECTOR = '[data-blocks-right-edge-button-container], [data-blocks-drag-handle-container], [data-testid="block-ctrl-drag-handle"], [data-testid="block-ctrl-drag-handle-container"], [data-testid="block-ctrl-decorator-widget"], [data-testid="block-ctrl-quick-insert-button"]';
@@ -218,6 +218,9 @@ export var createInteractionTrackingPlugin = function createInteractionTrackingP
218
218
  var _unbindDocumentMouseM;
219
219
  cancelScheduledMouseLeave();
220
220
  (_unbindDocumentMouseM = unbindDocumentMouseMove) === null || _unbindDocumentMouseM === void 0 || _unbindDocumentMouseM();
221
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_3')) {
222
+ clearPendingHoverSide(_view);
223
+ }
221
224
  }
222
225
  (_unbindMouseEnter = unbindMouseEnter) === null || _unbindMouseEnter === void 0 || _unbindMouseEnter();
223
226
  (_unbindMouseLeave = unbindMouseLeave) === null || _unbindMouseLeave === void 0 || _unbindMouseLeave();
@@ -8,6 +8,7 @@ import { handleSparseHoverTarget, isSparseHoverSuppressed } from './handle-spars
8
8
  import { mouseEnter, setHoverSide, stopEditing } from './interaction-tracking/commands';
9
9
  import { handleMouseLeave } from './interaction-tracking/handle-mouse-move';
10
10
  import { getInteractionTrackingState } from './interaction-tracking/pm-plugin';
11
+ import { createAfterRenderScheduler } from './utils/after-render-scheduler';
11
12
  import { getVisibleBox } from './utils/visible-box';
12
13
  var BLOCK_SELECTOR = '[data-prosemirror-node-block="true"]';
13
14
  var TABLE_STRUCTURE_NODES = new Set(['table', 'tableRow', 'tableCell', 'tableHeader']);
@@ -144,40 +145,6 @@ var classifyGutterHover = function classifyGutterHover(view, findGutterBlock, _r
144
145
  };
145
146
  };
146
147
 
147
- /**
148
- * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
149
- * Layout is clean then, so reading positions never forces a synchronous layout. Calls made while a
150
- * run is already scheduled are ignored.
151
- */
152
- var createAfterRenderScheduler = function createAfterRenderScheduler(win, callback) {
153
- var frame;
154
- var timeout;
155
- return {
156
- schedule: function schedule() {
157
- if (frame !== undefined || timeout !== undefined) {
158
- return;
159
- }
160
- frame = win.requestAnimationFrame(function () {
161
- frame = undefined;
162
- timeout = win.setTimeout(function () {
163
- timeout = undefined;
164
- callback();
165
- }, 0);
166
- });
167
- },
168
- cancel: function cancel() {
169
- if (frame !== undefined) {
170
- win.cancelAnimationFrame(frame);
171
- frame = undefined;
172
- }
173
- if (timeout !== undefined) {
174
- win.clearTimeout(timeout);
175
- timeout = undefined;
176
- }
177
- }
178
- };
179
- };
180
-
181
148
  /**
182
149
  * Keeps interaction tracking in step with gutter hover, as the legacy hover zones did. They sat
183
150
  * inside the block tree, so hovering one cleared the typing state, counted as inside the editor even
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
3
+ * Deferring position reads gives the browser an opportunity to update layout first; other work
4
+ * can still invalidate layout before the callback. Calls made while a run is scheduled are ignored.
5
+ */
6
+ export var createAfterRenderScheduler = function createAfterRenderScheduler(win, callback) {
7
+ var frame;
8
+ var timeout;
9
+ return {
10
+ schedule: function schedule() {
11
+ if (frame !== undefined || timeout !== undefined) {
12
+ return;
13
+ }
14
+ frame = win.requestAnimationFrame(function () {
15
+ frame = undefined;
16
+ timeout = win.setTimeout(function () {
17
+ timeout = undefined;
18
+ callback();
19
+ }, 0);
20
+ });
21
+ },
22
+ cancel: function cancel() {
23
+ if (frame !== undefined) {
24
+ win.cancelAnimationFrame(frame);
25
+ frame = undefined;
26
+ }
27
+ if (timeout !== undefined) {
28
+ win.clearTimeout(timeout);
29
+ timeout = undefined;
30
+ }
31
+ }
32
+ };
33
+ };
@@ -1,6 +1,7 @@
1
1
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { BlockControlsPlugin } from '../../blockControlsPluginType';
4
+ export declare const clearPendingHoverSide: (view: EditorView) => void;
4
5
  export declare const handleMouseMove: (view: EditorView, event: Event, rightSideControlsEnabled?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>) => boolean;
5
6
  export declare const handleMouseLeave: (view: EditorView, rightSideControlsEnabled?: boolean) => boolean;
6
7
  export declare const handleMouseEnter: (view: EditorView) => boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Runs `callback` once after the next frame renders (`requestAnimationFrame`, then `setTimeout`).
3
+ * Deferring position reads gives the browser an opportunity to update layout first; other work
4
+ * can still invalidate layout before the callback. Calls made while a run is scheduled are ignored.
5
+ */
6
+ export declare const createAfterRenderScheduler: (win: Window, callback: () => void) => {
7
+ cancel: () => void;
8
+ schedule: () => void;
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "34.0.3",
3
+ "version": "34.0.4",
4
4
  "description": "Block controls plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/editor-plugin-metrics": "^34.0.0",
41
41
  "@atlaskit/editor-plugin-quick-insert": "^33.0.0",
42
42
  "@atlaskit/editor-plugin-selection": "^33.0.0",
43
- "@atlaskit/editor-plugin-show-diff": "^33.0.0",
43
+ "@atlaskit/editor-plugin-show-diff": "^33.1.0",
44
44
  "@atlaskit/editor-plugin-toolbar": "^30.0.0",
45
45
  "@atlaskit/editor-plugin-type-ahead": "^34.0.0",
46
46
  "@atlaskit/editor-plugin-ui-control-registry": "^27.0.0",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^11.1.1"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^137.2.0",
75
+ "@atlaskit/editor-common": "^137.4.0",
76
76
  "react": "^18.2.0 || ^19.2.0",
77
77
  "react-dom": "^18.2.0 || ^19.2.0",
78
78
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "devDependencies": {
99
99
  "@af/editor-examples-helpers": "workspace:^",
100
- "@atlaskit/editor-common": "^137.2.0",
100
+ "@atlaskit/editor-common": "^137.4.0",
101
101
  "@atlaskit/editor-plugins": "^17.0.0",
102
102
  "@atlaskit/synchrony-test-helpers": "workspace:^",
103
103
  "@atlassian/structured-docs-types": "workspace:^",