@atlaskit/editor-plugin-show-diff 16.0.11 → 16.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +30 -4
  3. package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +52 -6
  4. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -1
  5. package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +1 -1
  6. package/dist/cjs/ui/ContributorTag/contributorTagController.js +39 -17
  7. package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +8 -0
  8. package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +28 -4
  9. package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +52 -7
  10. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -1
  11. package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +1 -1
  12. package/dist/es2019/ui/ContributorTag/contributorTagController.js +23 -10
  13. package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +8 -0
  14. package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +30 -4
  15. package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +53 -7
  16. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -1
  17. package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +1 -1
  18. package/dist/esm/ui/ContributorTag/contributorTagController.js +39 -17
  19. package/dist/esm/ui/ContributorTag/contributorTagIcons.js +8 -0
  20. package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +2 -1
  21. package/dist/types/ui/ContributorTag/contributorTagController.d.ts +1 -0
  22. package/dist/types/ui/ContributorTag/contributorTagIcons.d.ts +1 -1
  23. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 16.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7d1a41f1575e5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7d1a41f1575e5) -
8
+ Reserve red for deletions in show-diff attribution: an actor hashing to a red palette slot now
9
+ takes the next colour instead. Gated on confluence_ncs_step_diffing_version_history and
10
+ platform_editor_show_diff_color_scheme_refactor.
11
+ - [`19e336d422584`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/19e336d422584) -
12
+ Fix whole-row table replacements rendering no diff for the new content.
13
+ `createChangedRowDecorationWidgets` only handled row deletions, so a `replaceNode` on a `tableRow`
14
+ (as AI suggested edits emits) left the reviewer with just the removed side — or an empty row in
15
+ the clean view.
16
+
17
+ Also give the changed-row widget an indicator anchor, so the indicator bar spans both the proposed
18
+ and replaced rows instead of only the row being changed. This affects row deletions too, whose
19
+ deleted-row bar previously had no anchor to resolve against.
20
+
21
+ Both behind `platform_editor_ai_show_diff_patch_1`.
22
+
23
+ - Updated dependencies
24
+
25
+ ## 16.0.12
26
+
27
+ ### Patch Changes
28
+
29
+ - [`c3d0cc90fb8a8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c3d0cc90fb8a8) -
30
+ [ux] A contributor tag that has been clicked no longer stays visible after the pointer has left
31
+ the change it captions. Behind `confluence_ncs_step_diffing_version_history`.
32
+ - [`e6656f3612782`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e6656f3612782) -
33
+ Use the shared agent icon for external diff contributors.
34
+ - Updated dependencies
35
+
3
36
  ## 16.0.11
4
37
 
5
38
  ### Patch Changes
@@ -25,15 +25,40 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
25
25
 
26
26
  /** Maps the shared 18-slot telepointer palette onto the ten bolder diff colours. */
27
27
  var HASHED_PARTICIPANT_COLOR_SCHEMES = [].concat((0, _toConsumableArray2.default)(_types.PARTICIPANT_COLOR_SCHEMES), ['blue', 'red', 'orange', 'yellow', 'green', 'teal', 'purple', 'magenta']);
28
+
29
+ /**
30
+ * Red means "deleted" in both public schemes, so it never identifies an actor. Reserving it here
31
+ * covers every path into an attribution colour; `createAttributionColorMap` is the only caller, and
32
+ * it is gated on `confluence_ncs_step_diffing_version_history` plus
33
+ * `platform_editor_show_diff_color_scheme_refactor`.
34
+ */
35
+ var RESERVED_ATTRIBUTION_COLORS = new Set(['red']);
36
+ var isAssignable = function isAssignable(color) {
37
+ return !RESERVED_ATTRIBUTION_COLORS.has(color);
38
+ };
39
+
40
+ /** Projects a telepointer slot onto its diff hue, advancing past a hue reserved for deletion. */
41
+ var getSlotColor = function getSlotColor(index) {
42
+ for (var offset = 0; offset < HASHED_PARTICIPANT_COLOR_SCHEMES.length; offset++) {
43
+ var color = HASHED_PARTICIPANT_COLOR_SCHEMES[(index + offset) % HASHED_PARTICIPANT_COLOR_SCHEMES.length];
44
+ if (color && isAssignable(color)) {
45
+ return color;
46
+ }
47
+ }
48
+ return undefined;
49
+ };
28
50
  var getAvailableColor = function getAvailableColor(hashedColor, allocatedColors) {
51
+ var _PARTICIPANT_COLOR_SC;
29
52
  var startIndex = _types.PARTICIPANT_COLOR_SCHEMES.indexOf(hashedColor);
30
53
  for (var offset = 0; offset < _types.PARTICIPANT_COLOR_SCHEMES.length; offset++) {
31
54
  var color = _types.PARTICIPANT_COLOR_SCHEMES[(startIndex + offset) % _types.PARTICIPANT_COLOR_SCHEMES.length];
32
- if (color && !allocatedColors.has(color)) {
55
+ if (color && isAssignable(color) && !allocatedColors.has(color)) {
33
56
  return color;
34
57
  }
35
58
  }
36
- return hashedColor;
59
+
60
+ // Every assignable hue is taken, so a duplicate is unavoidable — but never the reserved hue.
61
+ return isAssignable(hashedColor) ? hashedColor : (_PARTICIPANT_COLOR_SC = _types.PARTICIPANT_COLOR_SCHEMES.find(isAssignable)) !== null && _PARTICIPANT_COLOR_SC !== void 0 ? _PARTICIPANT_COLOR_SC : hashedColor;
37
62
  };
38
63
 
39
64
  /**
@@ -133,7 +158,8 @@ var createAttributionColorMap = exports.createAttributionColorMap = function cre
133
158
  var colors = new Map();
134
159
  var allocatedColors = new Set();
135
160
 
136
- // Reserve shared brand colours before hashing other actors, regardless of step order.
161
+ // Reserve shared brand colours before hashing other actors, regardless of step order. A brand
162
+ // slot is pinned deliberately, so it is taken verbatim rather than through `getSlotColor`.
137
163
  var _iterator2 = _createForOfIteratorHelper(stepAttributions),
138
164
  _step2;
139
165
  try {
@@ -168,7 +194,7 @@ var createAttributionColorMap = exports.createAttributionColorMap = function cre
168
194
  }
169
195
  var _getParticipantColor2 = (0, _utils.getParticipantColor)(_identity.colorSeed, _attribution === null || _attribution === void 0 ? void 0 : _attribution.agentType),
170
196
  _index = _getParticipantColor2.index;
171
- var hashedColor = HASHED_PARTICIPANT_COLOR_SCHEMES[_index];
197
+ var hashedColor = getSlotColor(_index);
172
198
  if (!hashedColor) {
173
199
  continue;
174
200
  }
@@ -12,10 +12,12 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _view = require("@atlaskit/editor-prosemirror/view");
13
13
  var _tableMap = require("@atlaskit/editor-tables/table-map");
14
14
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
15
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
15
16
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
17
  var _isExtendedEnabled = require("../isExtendedEnabled");
17
18
  var _factory = require("./colorSchemes/factory");
18
19
  var _schemes = require("./colorSchemes/schemes");
20
+ var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
19
21
  var _createChangedRowDecorationWidgetsStyles = require("./createChangedRowDecorationWidgets.styles.legacy");
20
22
  var _decorationKeys = require("./decorationKeys");
21
23
  var _findSafeInsertPos = require("./utils/findSafeInsertPos");
@@ -54,8 +56,14 @@ var extractChangedRows = function extractChangedRows(_ref) {
54
56
  return changedRows;
55
57
  }
56
58
  var newTableMap = _tableMap.TableMap.get(tableNew.node);
59
+ // A row DELETION makes the table shorter. An in-place whole-row REPLACEMENT (`replaceNode` on a
60
+ // `tableRow`, which AI suggested edits emits) leaves the row count untouched — and this helper
61
+ // was written for deletions only, so it used to discard every replacement and the changed row's
62
+ // content was never rendered anywhere. The reviewer was left with just the removed side.
63
+ var isRowDeletion = oldTableMap.height > newTableMap.height;
64
+ var handleRowReplacement = oldTableMap.height === newTableMap.height && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1');
57
65
  // If no rows were changed, return empty
58
- if (oldTableMap.height <= newTableMap.height ||
66
+ if (!(isRowDeletion || handleRowReplacement) ||
59
67
  // For now ignore if there are column deletions as well
60
68
  oldTableMap.width !== newTableMap.width) {
61
69
  return changedRows;
@@ -99,6 +107,15 @@ var extractChangedRows = function extractChangedRows(_ref) {
99
107
 
100
108
  // Filter changes that never truly got deleted
101
109
  return changedRows.filter(function (changedRow) {
110
+ // A replacement leaves every sibling row in place, so asking "does this row still exist
111
+ // ANYWHERE in the new table?" can drop a genuinely rewritten row that happens to match a
112
+ // sibling. Compare it against the row at the same index instead. Deletions must keep the
113
+ // whole-table `some()`: their indices shift, so an index comparison would let every
114
+ // surviving row through and draw a widget for each one.
115
+ if (handleRowReplacement) {
116
+ var counterpart = tableNew.node.maybeChild(changedRow.rowIndex);
117
+ return !counterpart || !(0, _document.areNodesEqualIgnoreAttrs)(counterpart, changedRow.rowNode);
118
+ }
102
119
  return !tableNew.node.children.some(function (newRow) {
103
120
  return (0, _document.areNodesEqualIgnoreAttrs)(newRow, changedRow.rowNode);
104
121
  });
@@ -142,7 +159,10 @@ var createChangedRowDOM = function createChangedRowDOM(rowNode, cellEdgeAttrs, n
142
159
  if (!(0, _isExtendedEnabled.isExtendedEnabled)(diffType) || !isInserted) {
143
160
  tr.setAttribute('style', (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? (0, _factory.buildDeletedRowStyle)(colors) : (0, _createChangedRowDecorationWidgetsStyles.resolveDeletedRowStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme)));
144
161
  }
145
- tr.setAttribute('data-testid', 'show-diff-deleted-row');
162
+ // Mirrors the strikethrough condition above: under the extended experience an `isInserted` row
163
+ // is ADDED content, so it must not claim the "deleted" testid — page models match that as
164
+ // removed content (same reasoning as `createTableCellContentWidgets`).
165
+ tr.setAttribute('data-testid', (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? 'show-diff-changed-row' : 'show-diff-deleted-row');
146
166
 
147
167
  // Serialize each cell in the row
148
168
  var cellIndex = 0;
@@ -222,7 +242,9 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
222
242
  colorScheme = _ref3.colorScheme,
223
243
  _ref3$isInserted = _ref3.isInserted,
224
244
  isInserted = _ref3$isInserted === void 0 ? false : _ref3$isInserted,
225
- diffType = _ref3.diffType;
245
+ diffType = _ref3.diffType,
246
+ _ref3$showIndicators = _ref3.showIndicators,
247
+ showIndicators = _ref3$showIndicators === void 0 ? false : _ref3$showIndicators;
226
248
  // First, expand the changes to include complete deleted rows
227
249
  var changedRows = expandDiffForChangedRows({
228
250
  changes: changes.filter(function (change) {
@@ -232,7 +254,7 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
232
254
  newDoc: newDoc,
233
255
  diffType: diffType
234
256
  });
235
- return changedRows.map(function (changedRow) {
257
+ return changedRows.flatMap(function (changedRow) {
236
258
  var rowDOM = createChangedRowDOM(changedRow.rowNode, changedRow.cellEdgeAttrs, nodeViewSerializer, colorScheme, isInserted, diffType);
237
259
 
238
260
  // Find safe insertion position for the deleted row
@@ -240,13 +262,37 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
240
262
  // -1 to find the first safe position from the table
241
263
  originalDoc.slice(changedRow.fromA, changedRow.toA));
242
264
  var diffId = crypto.randomUUID();
243
- return _view.Decoration.widget(safeInsertPos, rowDOM, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)({
265
+ var decorations = [];
266
+
267
+ // `IndicatorBarContentComponent` renders a bar for every widget descriptor and anchors its
268
+ // top and bottom to `anchor-<diffId>`. Without an element carrying that anchor name the bar
269
+ // is still created but can never resolve a position, so it silently does not render and the
270
+ // bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
271
+ // property on its own widget DOM for non-table content; this path returns before reaching it.
272
+ if (showIndicators && (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1')) {
273
+ rowDOM.style.setProperty('anchor-name', "--".concat((0, _decorationKeys.buildAnchorDecorationKey)({
274
+ diffId: diffId
275
+ })));
276
+
277
+ // A table's content can extend past the doc margin, so the bar also needs a left anchor
278
+ // measured against the table itself or it is clipped once the table is resized.
279
+ var leftAnchor = (0, _createAnchorDecorationWidgets.createLeftAnchorWidget)({
280
+ doc: newDoc,
281
+ from: safeInsertPos,
282
+ diffId: diffId
283
+ });
284
+ if (leftAnchor) {
285
+ decorations.push(leftAnchor);
286
+ }
287
+ }
288
+ decorations.push(_view.Decoration.widget(safeInsertPos, rowDOM, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)({
244
289
  colorScheme: colorScheme,
245
290
  decorationType: 'widget',
246
291
  diffId: diffId,
247
292
  isActive: false,
248
293
  isInserted: isInserted,
249
294
  diffType: diffType
250
- })));
295
+ }))));
296
+ return decorations;
251
297
  });
252
298
  };
@@ -172,7 +172,10 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
172
172
  nodeViewSerializer: nodeViewSerializer,
173
173
  colorScheme: colorScheme,
174
174
  isInserted: isInserted,
175
- diffType: diffType
175
+ diffType: diffType,
176
+ // Needed for the row's own indicator anchor; this path returns before the
177
+ // `anchor-name` assignment further down.
178
+ showIndicators: showIndicators
176
179
  });
177
180
  }
178
181
  var serializer = nodeViewSerializer;
@@ -104,7 +104,7 @@ var contributorAvatarRenderer = exports.contributorAvatarRenderer = function con
104
104
  shape.appendChild(fallback);
105
105
  return;
106
106
  }
107
- shape.appendChild((0, _contributorTagIcons.getContributorTagIcon)((_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiBot', doc));
107
+ shape.appendChild((0, _contributorTagIcons.getContributorTagIcon)((_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiAgent', doc));
108
108
  };
109
109
  if (contributor.avatarUrl) {
110
110
  image = doc.createElement('img');
@@ -40,6 +40,18 @@ var setRevealed = function setRevealed(tag, isVisible) {
40
40
  tag.toggleAttribute(_buildContributorTagDom.CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE, isVisible);
41
41
  };
42
42
 
43
+ /**
44
+ * Whether the browser is showing this focus, which is the same question its focus ring answers — see
45
+ * the `:focus-visible` rule in `contributorTagStyles`.
46
+ *
47
+ * Clicking the tag focuses it, so a tag held up by focus alone stayed on screen after the pointer had
48
+ * left, until something else took focus (EDITOR-9046). Measured in Chromium: a click leaves this
49
+ * `false` and `Tab` leaves it `true`, so the keyboard focus stop is unaffected.
50
+ */
51
+ var isFocusVisible = function isFocusVisible(tag) {
52
+ return tag.matches(':focus-visible');
53
+ };
54
+
43
55
  /**
44
56
  * Whether flipping the tag's state will actually run a transition on it.
45
57
  *
@@ -252,6 +264,7 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
252
264
  }, {
253
265
  key: "bindTag",
254
266
  value: function bindTag(_ref4) {
267
+ var _this3 = this;
255
268
  var tag = _ref4.tag;
256
269
  // `mouseover`/`mouseout` rather than the enter/leave pair, because they are what fire as the
257
270
  // pointer moves between the tag's own children. Both are keyed on the tag, so those moves add
@@ -262,9 +275,13 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
262
275
  }, {
263
276
  type: 'mouseout',
264
277
  listener: this.trackRevealSource(tag, false)
265
- }, {
278
+ },
279
+ // Only a focus the browser is showing holds the tag up — see `isFocusVisible`.
280
+ {
266
281
  type: 'focus',
267
- listener: this.trackRevealSource(FOCUS_SOURCE, true)
282
+ listener: function listener() {
283
+ return _this3.setRevealSource(FOCUS_SOURCE, isFocusVisible(tag));
284
+ }
268
285
  }, {
269
286
  type: 'blur',
270
287
  listener: this.trackRevealSource(FOCUS_SOURCE, false)
@@ -275,21 +292,26 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
275
292
  }, {
276
293
  key: "trackRevealSource",
277
294
  value: function trackRevealSource(source, isRevealing) {
278
- var _this3 = this;
295
+ var _this4 = this;
279
296
  return function () {
280
- if (isRevealing) {
281
- _this3.revealSources.add(source);
282
- } else {
283
- _this3.revealSources.delete(source);
284
- }
285
- _this3.applyVisibility();
297
+ return _this4.setRevealSource(source, isRevealing);
286
298
  };
287
299
  }
300
+ }, {
301
+ key: "setRevealSource",
302
+ value: function setRevealSource(source, isRevealing) {
303
+ if (isRevealing) {
304
+ this.revealSources.add(source);
305
+ } else {
306
+ this.revealSources.delete(source);
307
+ }
308
+ this.applyVisibility();
309
+ }
288
310
  }, {
289
311
  key: "renderAvatars",
290
312
  value: function renderAvatars(model) {
291
313
  var _this$dom,
292
- _this4 = this;
314
+ _this5 = this;
293
315
  var _ref5 = (_this$dom = this.dom) !== null && _this$dom !== void 0 ? _this$dom : {},
294
316
  container = _ref5.avatars;
295
317
  if (!container) {
@@ -333,7 +355,7 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
333
355
  avatar.element.style.setProperty('margin-inline-end', "var(--ds-space-negative-050, -4px)");
334
356
  }
335
357
  container.appendChild(avatar.element);
336
- _this4.avatars.push(avatar);
358
+ _this5.avatars.push(avatar);
337
359
  });
338
360
  }
339
361
  }, {
@@ -484,7 +506,7 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
484
506
  key: "syncHighlightBindings",
485
507
  value: function syncHighlightBindings(model) {
486
508
  var _model$linkedDiffIds,
487
- _this5 = this;
509
+ _this6 = this;
488
510
  var diffId = this.options.diffId;
489
511
  var selector = [diffId].concat((0, _toConsumableArray2.default)((_model$linkedDiffIds = model.linkedDiffIds) !== null && _model$linkedDiffIds !== void 0 ? _model$linkedDiffIds : [])).map(function (id) {
490
512
  return "[data-diff-id=\"".concat(id, "\"]");
@@ -499,8 +521,8 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
499
521
  // not be in the document yet. A microtask lands once that pass has finished.
500
522
  var pendingBind = ++this.bindToken;
501
523
  queueMicrotask(function () {
502
- if (!_this5.isDestroyed && pendingBind === _this5.bindToken) {
503
- _this5.bindHighlightState(selector);
524
+ if (!_this6.isDestroyed && pendingBind === _this6.bindToken) {
525
+ _this6.bindHighlightState(selector);
504
526
  }
505
527
  });
506
528
  }
@@ -508,7 +530,7 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
508
530
  key: "bindHighlightState",
509
531
  value: function bindHighlightState(selector) {
510
532
  var _this$options$getEdit,
511
- _this6 = this;
533
+ _this7 = this;
512
534
  // Scoped to this editor's content root, so a tag can only ever bind to the decorations its own
513
535
  // plugin instance rendered — another editor on the page, or one nested inside this one, cannot
514
536
  // reveal this tag.
@@ -524,10 +546,10 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
524
546
  this.unbindHighlights = this.highlightElements.map(function (highlight) {
525
547
  return (0, _bindEventListener.bindAll)(highlight, [{
526
548
  type: 'mouseenter',
527
- listener: _this6.trackRevealSource(highlight, true)
549
+ listener: _this7.trackRevealSource(highlight, true)
528
550
  }, {
529
551
  type: 'mouseleave',
530
- listener: _this6.trackRevealSource(highlight, false)
552
+ listener: _this7.trackRevealSource(highlight, false)
531
553
  }]);
532
554
  });
533
555
  // The pointer may already be over a highlight by the time this binds, a draw pass after it
@@ -21,12 +21,20 @@ var PERSON_ICON_SVG = "<svg width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0
21
21
  /** `@atlaskit/icon-lab/core/ai-bot`, at 12px so it fits inside the 16px hexagon. */
22
22
  var AI_BOT_ICON_SVG = "<svg width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 16 16\" role=\"presentation\" style=\"display:block\"><path fill=\"currentcolor\" d=\"M13 5.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5V13a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5zm-6.5 2v3H5v-3zm4.5 0v3H9.5v-3zm3.5 1H16V10h-1.5v3a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-3H0V8.5h1.5v-3a2 2 0 0 1 2-2h3.75v-2H4V0h4a.75.75 0 0 1 .75.75V3.5h3.75a2 2 0 0 1 2 2z\"/></svg>";
23
23
 
24
+ /**
25
+ * The glyph from `@atlaskit/icon/core/ai-agent`, at 12px so it fits inside the 16px hexagon.
26
+ * The icon package only exposes this as a React component; this tag is otherwise imperative DOM,
27
+ * so keep the generated glyph here rather than introducing a React render boundary.
28
+ */
29
+ var AI_AGENT_ICON_SVG = "<svg width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 16 16\" role=\"presentation\" style=\"display:block\"><path fill=\"currentcolor\" fill-rule=\"evenodd\" d=\"M6.971.493a2 2 0 0 1 2.058 0l5 3A2 2 0 0 1 15 5.208v5.584a2 2 0 0 1-.971 1.715l-5 3a2 2 0 0 1-2.058 0l-5-3A2 2 0 0 1 1 10.792V5.208a2 2 0 0 1 .971-1.715zm1.286 1.286a.5.5 0 0 0-.514 0l-5 3a.5.5 0 0 0-.243.429v5.584a.5.5 0 0 0 .243.429l1.098.66a4.25 4.25 0 1 1 8.318 0l1.098-.66a.5.5 0 0 0 .243-.429V5.208a.5.5 0 0 0-.243-.429zM8 8.25a2.75 2.75 0 1 0 0 5.5 2.75 2.75 0 0 0 0-5.5\" clip-rule=\"evenodd\"/></svg>";
30
+
24
31
  /** `RovoHexIcon` from `@atlaskit/logo/rovo-hex/icon`, at the 16px `xxsmall` renders. */
25
32
  var ROVO_HEX_ICON_SVG = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" role=\"presentation\" style=\"display:block\"><path fill=\"#1868db\" fill-rule=\"evenodd\" d=\"m13.227 16.789-7.154 4.169-3.403-1.96a2.72 2.72 0 0 1-1.362-2.355V7.366c0-.973.518-1.87 1.361-2.354l6.044-3.487-.038.114a3.6 3.6 0 0 0-.172 1.088v9.278c0 1.274.68 2.45 1.786 3.085z\" clip-rule=\"evenodd\"/><path fill=\"#6a9a23\" fill-rule=\"evenodd\" d=\"m11.296 15.671-7.193 4.153 6.607 3.812a2.73 2.73 0 0 0 2.676.026l.048-.033a2.73 2.73 0 0 0 1.232-1.525 2.7 2.7 0 0 0 .127-.822v-3.594z\" clip-rule=\"evenodd\"/><path fill=\"#af59e1\" fill-rule=\"evenodd\" d=\"m21.477 5.003-4.404-2.539-5.904 4.89 2.69 1.556a3.56 3.56 0 0 1 1.785 3.086v9.277a3.6 3.6 0 0 1-.21 1.202l6.044-3.486a2.71 2.71 0 0 0 1.362-2.355V7.357c0-.97-.521-1.87-1.363-2.354\" clip-rule=\"evenodd\"/><path fill=\"#fca700\" fill-rule=\"evenodd\" d=\"M12.74 8.266 9.353 6.312V2.718c0-.283.044-.56.127-.821A2.73 2.73 0 0 1 10.71.372V.37a.4.4 0 0 0 .048-.033 2.73 2.73 0 0 1 2.676.026l6.499 3.75z\" clip-rule=\"evenodd\"/></svg>";
26
33
 
27
34
  /** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
28
35
  var CLAUDE_ICON_SVG = "<svg width=\"12\" height=\"12\" viewBox=\"8 8 32 32\" role=\"presentation\" style=\"display:block\"><path fill=\"#FFFFFF\" d=\"M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z\"/></svg>";
29
36
  var markup = {
37
+ aiAgent: AI_AGENT_ICON_SVG,
30
38
  aiBot: AI_BOT_ICON_SVG,
31
39
  claude: CLAUDE_ICON_SVG,
32
40
  person: PERSON_ICON_SVG,
@@ -9,15 +9,38 @@ import { PARTICIPANT_COLOR_SCHEMES } from './types';
9
9
 
10
10
  /** Maps the shared 18-slot telepointer palette onto the ten bolder diff colours. */
11
11
  const HASHED_PARTICIPANT_COLOR_SCHEMES = [...PARTICIPANT_COLOR_SCHEMES, 'blue', 'red', 'orange', 'yellow', 'green', 'teal', 'purple', 'magenta'];
12
+
13
+ /**
14
+ * Red means "deleted" in both public schemes, so it never identifies an actor. Reserving it here
15
+ * covers every path into an attribution colour; `createAttributionColorMap` is the only caller, and
16
+ * it is gated on `confluence_ncs_step_diffing_version_history` plus
17
+ * `platform_editor_show_diff_color_scheme_refactor`.
18
+ */
19
+ const RESERVED_ATTRIBUTION_COLORS = new Set(['red']);
20
+ const isAssignable = color => !RESERVED_ATTRIBUTION_COLORS.has(color);
21
+
22
+ /** Projects a telepointer slot onto its diff hue, advancing past a hue reserved for deletion. */
23
+ const getSlotColor = index => {
24
+ for (let offset = 0; offset < HASHED_PARTICIPANT_COLOR_SCHEMES.length; offset++) {
25
+ const color = HASHED_PARTICIPANT_COLOR_SCHEMES[(index + offset) % HASHED_PARTICIPANT_COLOR_SCHEMES.length];
26
+ if (color && isAssignable(color)) {
27
+ return color;
28
+ }
29
+ }
30
+ return undefined;
31
+ };
12
32
  const getAvailableColor = (hashedColor, allocatedColors) => {
33
+ var _PARTICIPANT_COLOR_SC;
13
34
  const startIndex = PARTICIPANT_COLOR_SCHEMES.indexOf(hashedColor);
14
35
  for (let offset = 0; offset < PARTICIPANT_COLOR_SCHEMES.length; offset++) {
15
36
  const color = PARTICIPANT_COLOR_SCHEMES[(startIndex + offset) % PARTICIPANT_COLOR_SCHEMES.length];
16
- if (color && !allocatedColors.has(color)) {
37
+ if (color && isAssignable(color) && !allocatedColors.has(color)) {
17
38
  return color;
18
39
  }
19
40
  }
20
- return hashedColor;
41
+
42
+ // Every assignable hue is taken, so a duplicate is unavoidable — but never the reserved hue.
43
+ return isAssignable(hashedColor) ? hashedColor : (_PARTICIPANT_COLOR_SC = PARTICIPANT_COLOR_SCHEMES.find(isAssignable)) !== null && _PARTICIPANT_COLOR_SC !== void 0 ? _PARTICIPANT_COLOR_SC : hashedColor;
21
44
  };
22
45
 
23
46
  /**
@@ -104,7 +127,8 @@ export const createAttributionColorMap = stepAttributions => {
104
127
  const colors = new Map();
105
128
  const allocatedColors = new Set();
106
129
 
107
- // Reserve shared brand colours before hashing other actors, regardless of step order.
130
+ // Reserve shared brand colours before hashing other actors, regardless of step order. A brand
131
+ // slot is pinned deliberately, so it is taken verbatim rather than through `getSlotColor`.
108
132
  for (const attribution of stepAttributions) {
109
133
  const identity = getAttributionIdentity(attribution);
110
134
  if (!identity) {
@@ -128,7 +152,7 @@ export const createAttributionColorMap = stepAttributions => {
128
152
  const {
129
153
  index
130
154
  } = getParticipantColor(identity.colorSeed, attribution === null || attribution === void 0 ? void 0 : attribution.agentType);
131
- const hashedColor = HASHED_PARTICIPANT_COLOR_SCHEMES[index];
155
+ const hashedColor = getSlotColor(index);
132
156
  if (!hashedColor) {
133
157
  continue;
134
158
  }
@@ -3,12 +3,14 @@ import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
5
5
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { isExtendedEnabled } from '../isExtendedEnabled';
8
9
  import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedRowStyle } from './colorSchemes/factory';
9
10
  import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
11
+ import { createLeftAnchorWidget } from './createAnchorDecorationWidgets';
10
12
  import { resolveCellOverlayStyleLegacy, resolveDeletedRowStyleLegacy } from './createChangedRowDecorationWidgets.styles.legacy';
11
- import { buildDiffDecorationSpec } from './decorationKeys';
13
+ import { buildAnchorDecorationKey, buildDiffDecorationSpec } from './decorationKeys';
12
14
  import { findSafeInsertPos } from './utils/findSafeInsertPos';
13
15
  import { applyCellEdgeAttrs, getRowCellEdgeAttrs, getTableTopAndBottomCellEdgeAttrs } from './utils/tableCellEdgeAttrs';
14
16
  /**
@@ -37,8 +39,14 @@ const extractChangedRows = ({
37
39
  return changedRows;
38
40
  }
39
41
  const newTableMap = TableMap.get(tableNew.node);
42
+ // A row DELETION makes the table shorter. An in-place whole-row REPLACEMENT (`replaceNode` on a
43
+ // `tableRow`, which AI suggested edits emits) leaves the row count untouched — and this helper
44
+ // was written for deletions only, so it used to discard every replacement and the changed row's
45
+ // content was never rendered anywhere. The reviewer was left with just the removed side.
46
+ const isRowDeletion = oldTableMap.height > newTableMap.height;
47
+ const handleRowReplacement = oldTableMap.height === newTableMap.height && fg('platform_editor_ai_show_diff_patch_1');
40
48
  // If no rows were changed, return empty
41
- if (oldTableMap.height <= newTableMap.height ||
49
+ if (!(isRowDeletion || handleRowReplacement) ||
42
50
  // For now ignore if there are column deletions as well
43
51
  oldTableMap.width !== newTableMap.width) {
44
52
  return changedRows;
@@ -80,6 +88,15 @@ const extractChangedRows = ({
80
88
 
81
89
  // Filter changes that never truly got deleted
82
90
  return changedRows.filter(changedRow => {
91
+ // A replacement leaves every sibling row in place, so asking "does this row still exist
92
+ // ANYWHERE in the new table?" can drop a genuinely rewritten row that happens to match a
93
+ // sibling. Compare it against the row at the same index instead. Deletions must keep the
94
+ // whole-table `some()`: their indices shift, so an index comparison would let every
95
+ // surviving row through and draw a widget for each one.
96
+ if (handleRowReplacement) {
97
+ const counterpart = tableNew.node.maybeChild(changedRow.rowIndex);
98
+ return !counterpart || !areNodesEqualIgnoreAttrs(counterpart, changedRow.rowNode);
99
+ }
83
100
  return !tableNew.node.children.some(newRow => areNodesEqualIgnoreAttrs(newRow, changedRow.rowNode));
84
101
  });
85
102
  };
@@ -121,7 +138,10 @@ const createChangedRowDOM = (rowNode, cellEdgeAttrs, nodeViewSerializer, colorSc
121
138
  if (!isExtendedEnabled(diffType) || !isInserted) {
122
139
  tr.setAttribute('style', isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? buildDeletedRowStyle(colors) : resolveDeletedRowStyleLegacy(getLegacyColorScheme(colorScheme)));
123
140
  }
124
- tr.setAttribute('data-testid', 'show-diff-deleted-row');
141
+ // Mirrors the strikethrough condition above: under the extended experience an `isInserted` row
142
+ // is ADDED content, so it must not claim the "deleted" testid — page models match that as
143
+ // removed content (same reasoning as `createTableCellContentWidgets`).
144
+ tr.setAttribute('data-testid', isExtendedEnabled(diffType) && isInserted && fg('platform_editor_ai_show_diff_patch_1') ? 'show-diff-changed-row' : 'show-diff-deleted-row');
125
145
 
126
146
  // Serialize each cell in the row
127
147
  let cellIndex = 0;
@@ -192,7 +212,8 @@ export const createChangedRowDecorationWidgets = ({
192
212
  nodeViewSerializer,
193
213
  colorScheme,
194
214
  isInserted = false,
195
- diffType
215
+ diffType,
216
+ showIndicators = false
196
217
  }) => {
197
218
  // First, expand the changes to include complete deleted rows
198
219
  const changedRows = expandDiffForChangedRows({
@@ -201,7 +222,7 @@ export const createChangedRowDecorationWidgets = ({
201
222
  newDoc,
202
223
  diffType
203
224
  });
204
- return changedRows.map(changedRow => {
225
+ return changedRows.flatMap(changedRow => {
205
226
  const rowDOM = createChangedRowDOM(changedRow.rowNode, changedRow.cellEdgeAttrs, nodeViewSerializer, colorScheme, isInserted, diffType);
206
227
 
207
228
  // Find safe insertion position for the deleted row
@@ -209,7 +230,30 @@ export const createChangedRowDecorationWidgets = ({
209
230
  // -1 to find the first safe position from the table
210
231
  originalDoc.slice(changedRow.fromA, changedRow.toA));
211
232
  const diffId = crypto.randomUUID();
212
- return Decoration.widget(safeInsertPos, rowDOM, {
233
+ const decorations = [];
234
+
235
+ // `IndicatorBarContentComponent` renders a bar for every widget descriptor and anchors its
236
+ // top and bottom to `anchor-<diffId>`. Without an element carrying that anchor name the bar
237
+ // is still created but can never resolve a position, so it silently does not render and the
238
+ // bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
239
+ // property on its own widget DOM for non-table content; this path returns before reaching it.
240
+ if (showIndicators && isExtendedEnabled(diffType) && fg('platform_editor_ai_show_diff_patch_1')) {
241
+ rowDOM.style.setProperty('anchor-name', `--${buildAnchorDecorationKey({
242
+ diffId
243
+ })}`);
244
+
245
+ // A table's content can extend past the doc margin, so the bar also needs a left anchor
246
+ // measured against the table itself or it is clipped once the table is resized.
247
+ const leftAnchor = createLeftAnchorWidget({
248
+ doc: newDoc,
249
+ from: safeInsertPos,
250
+ diffId
251
+ });
252
+ if (leftAnchor) {
253
+ decorations.push(leftAnchor);
254
+ }
255
+ }
256
+ decorations.push(Decoration.widget(safeInsertPos, rowDOM, {
213
257
  ...buildDiffDecorationSpec({
214
258
  colorScheme,
215
259
  decorationType: 'widget',
@@ -218,6 +262,7 @@ export const createChangedRowDecorationWidgets = ({
218
262
  isInserted,
219
263
  diffType
220
264
  })
221
- });
265
+ }));
266
+ return decorations;
222
267
  });
223
268
  };
@@ -156,7 +156,10 @@ export const createNodeChangedDecorationWidget = ({
156
156
  nodeViewSerializer,
157
157
  colorScheme,
158
158
  isInserted,
159
- diffType
159
+ diffType,
160
+ // Needed for the row's own indicator anchor; this path returns before the
161
+ // `anchor-name` assignment further down.
162
+ showIndicators
160
163
  });
161
164
  }
162
165
  const serializer = nodeViewSerializer;
@@ -100,7 +100,7 @@ export const contributorAvatarRenderer = ({
100
100
  shape.appendChild(fallback);
101
101
  return;
102
102
  }
103
- shape.appendChild(getContributorTagIcon((_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiBot', doc));
103
+ shape.appendChild(getContributorTagIcon((_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiAgent', doc));
104
104
  };
105
105
  if (contributor.avatarUrl) {
106
106
  image = doc.createElement('img');
@@ -31,6 +31,16 @@ const setRevealed = (tag, isVisible) => {
31
31
  tag.toggleAttribute(CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE, isVisible);
32
32
  };
33
33
 
34
+ /**
35
+ * Whether the browser is showing this focus, which is the same question its focus ring answers — see
36
+ * the `:focus-visible` rule in `contributorTagStyles`.
37
+ *
38
+ * Clicking the tag focuses it, so a tag held up by focus alone stayed on screen after the pointer had
39
+ * left, until something else took focus (EDITOR-9046). Measured in Chromium: a click leaves this
40
+ * `false` and `Tab` leaves it `true`, so the keyboard focus stop is unaffected.
41
+ */
42
+ const isFocusVisible = tag => tag.matches(':focus-visible');
43
+
34
44
  /**
35
45
  * Whether flipping the tag's state will actually run a transition on it.
36
46
  *
@@ -235,9 +245,11 @@ export class ContributorTagController {
235
245
  }, {
236
246
  type: 'mouseout',
237
247
  listener: this.trackRevealSource(tag, false)
238
- }, {
248
+ },
249
+ // Only a focus the browser is showing holds the tag up — see `isFocusVisible`.
250
+ {
239
251
  type: 'focus',
240
- listener: this.trackRevealSource(FOCUS_SOURCE, true)
252
+ listener: () => this.setRevealSource(FOCUS_SOURCE, isFocusVisible(tag))
241
253
  }, {
242
254
  type: 'blur',
243
255
  listener: this.trackRevealSource(FOCUS_SOURCE, false)
@@ -246,14 +258,15 @@ export class ContributorTagController {
246
258
 
247
259
  /** One listener shape for every reveal source, so all of them land in the same set. */
248
260
  trackRevealSource(source, isRevealing) {
249
- return () => {
250
- if (isRevealing) {
251
- this.revealSources.add(source);
252
- } else {
253
- this.revealSources.delete(source);
254
- }
255
- this.applyVisibility();
256
- };
261
+ return () => this.setRevealSource(source, isRevealing);
262
+ }
263
+ setRevealSource(source, isRevealing) {
264
+ if (isRevealing) {
265
+ this.revealSources.add(source);
266
+ } else {
267
+ this.revealSources.delete(source);
268
+ }
269
+ this.applyVisibility();
257
270
  }
258
271
  renderAvatars(model) {
259
272
  var _this$dom;
@@ -15,12 +15,20 @@ const PERSON_ICON_SVG = `<svg width="16" height="16" fill="none" viewBox="0 0 16
15
15
  /** `@atlaskit/icon-lab/core/ai-bot`, at 12px so it fits inside the 16px hexagon. */
16
16
  const AI_BOT_ICON_SVG = `<svg width="12" height="12" fill="none" viewBox="0 0 16 16" role="presentation" style="display:block"><path fill="currentcolor" d="M13 5.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5V13a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5zm-6.5 2v3H5v-3zm4.5 0v3H9.5v-3zm3.5 1H16V10h-1.5v3a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-3H0V8.5h1.5v-3a2 2 0 0 1 2-2h3.75v-2H4V0h4a.75.75 0 0 1 .75.75V3.5h3.75a2 2 0 0 1 2 2z"/></svg>`;
17
17
 
18
+ /**
19
+ * The glyph from `@atlaskit/icon/core/ai-agent`, at 12px so it fits inside the 16px hexagon.
20
+ * The icon package only exposes this as a React component; this tag is otherwise imperative DOM,
21
+ * so keep the generated glyph here rather than introducing a React render boundary.
22
+ */
23
+ const AI_AGENT_ICON_SVG = `<svg width="12" height="12" fill="none" viewBox="0 0 16 16" role="presentation" style="display:block"><path fill="currentcolor" fill-rule="evenodd" d="M6.971.493a2 2 0 0 1 2.058 0l5 3A2 2 0 0 1 15 5.208v5.584a2 2 0 0 1-.971 1.715l-5 3a2 2 0 0 1-2.058 0l-5-3A2 2 0 0 1 1 10.792V5.208a2 2 0 0 1 .971-1.715zm1.286 1.286a.5.5 0 0 0-.514 0l-5 3a.5.5 0 0 0-.243.429v5.584a.5.5 0 0 0 .243.429l1.098.66a4.25 4.25 0 1 1 8.318 0l1.098-.66a.5.5 0 0 0 .243-.429V5.208a.5.5 0 0 0-.243-.429zM8 8.25a2.75 2.75 0 1 0 0 5.5 2.75 2.75 0 0 0 0-5.5" clip-rule="evenodd"/></svg>`;
24
+
18
25
  /** `RovoHexIcon` from `@atlaskit/logo/rovo-hex/icon`, at the 16px `xxsmall` renders. */
19
26
  const ROVO_HEX_ICON_SVG = `<svg width="16" height="16" viewBox="0 0 24 24" role="presentation" style="display:block"><path fill="#1868db" fill-rule="evenodd" d="m13.227 16.789-7.154 4.169-3.403-1.96a2.72 2.72 0 0 1-1.362-2.355V7.366c0-.973.518-1.87 1.361-2.354l6.044-3.487-.038.114a3.6 3.6 0 0 0-.172 1.088v9.278c0 1.274.68 2.45 1.786 3.085z" clip-rule="evenodd"/><path fill="#6a9a23" fill-rule="evenodd" d="m11.296 15.671-7.193 4.153 6.607 3.812a2.73 2.73 0 0 0 2.676.026l.048-.033a2.73 2.73 0 0 0 1.232-1.525 2.7 2.7 0 0 0 .127-.822v-3.594z" clip-rule="evenodd"/><path fill="#af59e1" fill-rule="evenodd" d="m21.477 5.003-4.404-2.539-5.904 4.89 2.69 1.556a3.56 3.56 0 0 1 1.785 3.086v9.277a3.6 3.6 0 0 1-.21 1.202l6.044-3.486a2.71 2.71 0 0 0 1.362-2.355V7.357c0-.97-.521-1.87-1.363-2.354" clip-rule="evenodd"/><path fill="#fca700" fill-rule="evenodd" d="M12.74 8.266 9.353 6.312V2.718c0-.283.044-.56.127-.821A2.73 2.73 0 0 1 10.71.372V.37a.4.4 0 0 0 .048-.033 2.73 2.73 0 0 1 2.676.026l6.499 3.75z" clip-rule="evenodd"/></svg>`;
20
27
 
21
28
  /** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
22
29
  const CLAUDE_ICON_SVG = `<svg width="12" height="12" viewBox="8 8 32 32" role="presentation" style="display:block"><path fill="#FFFFFF" d="M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z"/></svg>`;
23
30
  const markup = {
31
+ aiAgent: AI_AGENT_ICON_SVG,
24
32
  aiBot: AI_BOT_ICON_SVG,
25
33
  claude: CLAUDE_ICON_SVG,
26
34
  person: PERSON_ICON_SVG,
@@ -19,15 +19,40 @@ import { PARTICIPANT_COLOR_SCHEMES } from './types';
19
19
 
20
20
  /** Maps the shared 18-slot telepointer palette onto the ten bolder diff colours. */
21
21
  var HASHED_PARTICIPANT_COLOR_SCHEMES = [].concat(_toConsumableArray(PARTICIPANT_COLOR_SCHEMES), ['blue', 'red', 'orange', 'yellow', 'green', 'teal', 'purple', 'magenta']);
22
+
23
+ /**
24
+ * Red means "deleted" in both public schemes, so it never identifies an actor. Reserving it here
25
+ * covers every path into an attribution colour; `createAttributionColorMap` is the only caller, and
26
+ * it is gated on `confluence_ncs_step_diffing_version_history` plus
27
+ * `platform_editor_show_diff_color_scheme_refactor`.
28
+ */
29
+ var RESERVED_ATTRIBUTION_COLORS = new Set(['red']);
30
+ var isAssignable = function isAssignable(color) {
31
+ return !RESERVED_ATTRIBUTION_COLORS.has(color);
32
+ };
33
+
34
+ /** Projects a telepointer slot onto its diff hue, advancing past a hue reserved for deletion. */
35
+ var getSlotColor = function getSlotColor(index) {
36
+ for (var offset = 0; offset < HASHED_PARTICIPANT_COLOR_SCHEMES.length; offset++) {
37
+ var color = HASHED_PARTICIPANT_COLOR_SCHEMES[(index + offset) % HASHED_PARTICIPANT_COLOR_SCHEMES.length];
38
+ if (color && isAssignable(color)) {
39
+ return color;
40
+ }
41
+ }
42
+ return undefined;
43
+ };
22
44
  var getAvailableColor = function getAvailableColor(hashedColor, allocatedColors) {
45
+ var _PARTICIPANT_COLOR_SC;
23
46
  var startIndex = PARTICIPANT_COLOR_SCHEMES.indexOf(hashedColor);
24
47
  for (var offset = 0; offset < PARTICIPANT_COLOR_SCHEMES.length; offset++) {
25
48
  var color = PARTICIPANT_COLOR_SCHEMES[(startIndex + offset) % PARTICIPANT_COLOR_SCHEMES.length];
26
- if (color && !allocatedColors.has(color)) {
49
+ if (color && isAssignable(color) && !allocatedColors.has(color)) {
27
50
  return color;
28
51
  }
29
52
  }
30
- return hashedColor;
53
+
54
+ // Every assignable hue is taken, so a duplicate is unavoidable — but never the reserved hue.
55
+ return isAssignable(hashedColor) ? hashedColor : (_PARTICIPANT_COLOR_SC = PARTICIPANT_COLOR_SCHEMES.find(isAssignable)) !== null && _PARTICIPANT_COLOR_SC !== void 0 ? _PARTICIPANT_COLOR_SC : hashedColor;
31
56
  };
32
57
 
33
58
  /**
@@ -127,7 +152,8 @@ export var createAttributionColorMap = function createAttributionColorMap(stepAt
127
152
  var colors = new Map();
128
153
  var allocatedColors = new Set();
129
154
 
130
- // Reserve shared brand colours before hashing other actors, regardless of step order.
155
+ // Reserve shared brand colours before hashing other actors, regardless of step order. A brand
156
+ // slot is pinned deliberately, so it is taken verbatim rather than through `getSlotColor`.
131
157
  var _iterator2 = _createForOfIteratorHelper(stepAttributions),
132
158
  _step2;
133
159
  try {
@@ -162,7 +188,7 @@ export var createAttributionColorMap = function createAttributionColorMap(stepAt
162
188
  }
163
189
  var _getParticipantColor2 = getParticipantColor(_identity.colorSeed, _attribution === null || _attribution === void 0 ? void 0 : _attribution.agentType),
164
190
  _index = _getParticipantColor2.index;
165
- var hashedColor = HASHED_PARTICIPANT_COLOR_SCHEMES[_index];
191
+ var hashedColor = getSlotColor(_index);
166
192
  if (!hashedColor) {
167
193
  continue;
168
194
  }
@@ -10,12 +10,14 @@ import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
11
11
  import { TableMap } from '@atlaskit/editor-tables/table-map';
12
12
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
13
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
13
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
15
  import { isExtendedEnabled } from '../isExtendedEnabled';
15
16
  import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedRowStyle } from './colorSchemes/factory';
16
17
  import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
18
+ import { createLeftAnchorWidget } from './createAnchorDecorationWidgets';
17
19
  import { resolveCellOverlayStyleLegacy, resolveDeletedRowStyleLegacy } from './createChangedRowDecorationWidgets.styles.legacy';
18
- import { buildDiffDecorationSpec } from './decorationKeys';
20
+ import { buildAnchorDecorationKey, buildDiffDecorationSpec } from './decorationKeys';
19
21
  import { findSafeInsertPos } from './utils/findSafeInsertPos';
20
22
  import { applyCellEdgeAttrs, getRowCellEdgeAttrs, getTableTopAndBottomCellEdgeAttrs } from './utils/tableCellEdgeAttrs';
21
23
  /**
@@ -47,8 +49,14 @@ var extractChangedRows = function extractChangedRows(_ref) {
47
49
  return changedRows;
48
50
  }
49
51
  var newTableMap = TableMap.get(tableNew.node);
52
+ // A row DELETION makes the table shorter. An in-place whole-row REPLACEMENT (`replaceNode` on a
53
+ // `tableRow`, which AI suggested edits emits) leaves the row count untouched — and this helper
54
+ // was written for deletions only, so it used to discard every replacement and the changed row's
55
+ // content was never rendered anywhere. The reviewer was left with just the removed side.
56
+ var isRowDeletion = oldTableMap.height > newTableMap.height;
57
+ var handleRowReplacement = oldTableMap.height === newTableMap.height && fg('platform_editor_ai_show_diff_patch_1');
50
58
  // If no rows were changed, return empty
51
- if (oldTableMap.height <= newTableMap.height ||
59
+ if (!(isRowDeletion || handleRowReplacement) ||
52
60
  // For now ignore if there are column deletions as well
53
61
  oldTableMap.width !== newTableMap.width) {
54
62
  return changedRows;
@@ -92,6 +100,15 @@ var extractChangedRows = function extractChangedRows(_ref) {
92
100
 
93
101
  // Filter changes that never truly got deleted
94
102
  return changedRows.filter(function (changedRow) {
103
+ // A replacement leaves every sibling row in place, so asking "does this row still exist
104
+ // ANYWHERE in the new table?" can drop a genuinely rewritten row that happens to match a
105
+ // sibling. Compare it against the row at the same index instead. Deletions must keep the
106
+ // whole-table `some()`: their indices shift, so an index comparison would let every
107
+ // surviving row through and draw a widget for each one.
108
+ if (handleRowReplacement) {
109
+ var counterpart = tableNew.node.maybeChild(changedRow.rowIndex);
110
+ return !counterpart || !areNodesEqualIgnoreAttrs(counterpart, changedRow.rowNode);
111
+ }
95
112
  return !tableNew.node.children.some(function (newRow) {
96
113
  return areNodesEqualIgnoreAttrs(newRow, changedRow.rowNode);
97
114
  });
@@ -135,7 +152,10 @@ var createChangedRowDOM = function createChangedRowDOM(rowNode, cellEdgeAttrs, n
135
152
  if (!isExtendedEnabled(diffType) || !isInserted) {
136
153
  tr.setAttribute('style', isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? buildDeletedRowStyle(colors) : resolveDeletedRowStyleLegacy(getLegacyColorScheme(colorScheme)));
137
154
  }
138
- tr.setAttribute('data-testid', 'show-diff-deleted-row');
155
+ // Mirrors the strikethrough condition above: under the extended experience an `isInserted` row
156
+ // is ADDED content, so it must not claim the "deleted" testid — page models match that as
157
+ // removed content (same reasoning as `createTableCellContentWidgets`).
158
+ tr.setAttribute('data-testid', isExtendedEnabled(diffType) && isInserted && fg('platform_editor_ai_show_diff_patch_1') ? 'show-diff-changed-row' : 'show-diff-deleted-row');
139
159
 
140
160
  // Serialize each cell in the row
141
161
  var cellIndex = 0;
@@ -215,7 +235,9 @@ export var createChangedRowDecorationWidgets = function createChangedRowDecorati
215
235
  colorScheme = _ref3.colorScheme,
216
236
  _ref3$isInserted = _ref3.isInserted,
217
237
  isInserted = _ref3$isInserted === void 0 ? false : _ref3$isInserted,
218
- diffType = _ref3.diffType;
238
+ diffType = _ref3.diffType,
239
+ _ref3$showIndicators = _ref3.showIndicators,
240
+ showIndicators = _ref3$showIndicators === void 0 ? false : _ref3$showIndicators;
219
241
  // First, expand the changes to include complete deleted rows
220
242
  var changedRows = expandDiffForChangedRows({
221
243
  changes: changes.filter(function (change) {
@@ -225,7 +247,7 @@ export var createChangedRowDecorationWidgets = function createChangedRowDecorati
225
247
  newDoc: newDoc,
226
248
  diffType: diffType
227
249
  });
228
- return changedRows.map(function (changedRow) {
250
+ return changedRows.flatMap(function (changedRow) {
229
251
  var rowDOM = createChangedRowDOM(changedRow.rowNode, changedRow.cellEdgeAttrs, nodeViewSerializer, colorScheme, isInserted, diffType);
230
252
 
231
253
  // Find safe insertion position for the deleted row
@@ -233,13 +255,37 @@ export var createChangedRowDecorationWidgets = function createChangedRowDecorati
233
255
  // -1 to find the first safe position from the table
234
256
  originalDoc.slice(changedRow.fromA, changedRow.toA));
235
257
  var diffId = crypto.randomUUID();
236
- return Decoration.widget(safeInsertPos, rowDOM, _objectSpread({}, buildDiffDecorationSpec({
258
+ var decorations = [];
259
+
260
+ // `IndicatorBarContentComponent` renders a bar for every widget descriptor and anchors its
261
+ // top and bottom to `anchor-<diffId>`. Without an element carrying that anchor name the bar
262
+ // is still created but can never resolve a position, so it silently does not render and the
263
+ // bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
264
+ // property on its own widget DOM for non-table content; this path returns before reaching it.
265
+ if (showIndicators && isExtendedEnabled(diffType) && fg('platform_editor_ai_show_diff_patch_1')) {
266
+ rowDOM.style.setProperty('anchor-name', "--".concat(buildAnchorDecorationKey({
267
+ diffId: diffId
268
+ })));
269
+
270
+ // A table's content can extend past the doc margin, so the bar also needs a left anchor
271
+ // measured against the table itself or it is clipped once the table is resized.
272
+ var leftAnchor = createLeftAnchorWidget({
273
+ doc: newDoc,
274
+ from: safeInsertPos,
275
+ diffId: diffId
276
+ });
277
+ if (leftAnchor) {
278
+ decorations.push(leftAnchor);
279
+ }
280
+ }
281
+ decorations.push(Decoration.widget(safeInsertPos, rowDOM, _objectSpread({}, buildDiffDecorationSpec({
237
282
  colorScheme: colorScheme,
238
283
  decorationType: 'widget',
239
284
  diffId: diffId,
240
285
  isActive: false,
241
286
  isInserted: isInserted,
242
287
  diffType: diffType
243
- })));
288
+ }))));
289
+ return decorations;
244
290
  });
245
291
  };
@@ -165,7 +165,10 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
165
165
  nodeViewSerializer: nodeViewSerializer,
166
166
  colorScheme: colorScheme,
167
167
  isInserted: isInserted,
168
- diffType: diffType
168
+ diffType: diffType,
169
+ // Needed for the row's own indicator anchor; this path returns before the
170
+ // `anchor-name` assignment further down.
171
+ showIndicators: showIndicators
169
172
  });
170
173
  }
171
174
  var serializer = nodeViewSerializer;
@@ -99,7 +99,7 @@ export var contributorAvatarRenderer = function contributorAvatarRenderer(_ref)
99
99
  shape.appendChild(fallback);
100
100
  return;
101
101
  }
102
- shape.appendChild(getContributorTagIcon((_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiBot', doc));
102
+ shape.appendChild(getContributorTagIcon((_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiAgent', doc));
103
103
  };
104
104
  if (contributor.avatarUrl) {
105
105
  image = doc.createElement('img');
@@ -33,6 +33,18 @@ var setRevealed = function setRevealed(tag, isVisible) {
33
33
  tag.toggleAttribute(CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE, isVisible);
34
34
  };
35
35
 
36
+ /**
37
+ * Whether the browser is showing this focus, which is the same question its focus ring answers — see
38
+ * the `:focus-visible` rule in `contributorTagStyles`.
39
+ *
40
+ * Clicking the tag focuses it, so a tag held up by focus alone stayed on screen after the pointer had
41
+ * left, until something else took focus (EDITOR-9046). Measured in Chromium: a click leaves this
42
+ * `false` and `Tab` leaves it `true`, so the keyboard focus stop is unaffected.
43
+ */
44
+ var isFocusVisible = function isFocusVisible(tag) {
45
+ return tag.matches(':focus-visible');
46
+ };
47
+
36
48
  /**
37
49
  * Whether flipping the tag's state will actually run a transition on it.
38
50
  *
@@ -245,6 +257,7 @@ export var ContributorTagController = /*#__PURE__*/function () {
245
257
  }, {
246
258
  key: "bindTag",
247
259
  value: function bindTag(_ref4) {
260
+ var _this3 = this;
248
261
  var tag = _ref4.tag;
249
262
  // `mouseover`/`mouseout` rather than the enter/leave pair, because they are what fire as the
250
263
  // pointer moves between the tag's own children. Both are keyed on the tag, so those moves add
@@ -255,9 +268,13 @@ export var ContributorTagController = /*#__PURE__*/function () {
255
268
  }, {
256
269
  type: 'mouseout',
257
270
  listener: this.trackRevealSource(tag, false)
258
- }, {
271
+ },
272
+ // Only a focus the browser is showing holds the tag up — see `isFocusVisible`.
273
+ {
259
274
  type: 'focus',
260
- listener: this.trackRevealSource(FOCUS_SOURCE, true)
275
+ listener: function listener() {
276
+ return _this3.setRevealSource(FOCUS_SOURCE, isFocusVisible(tag));
277
+ }
261
278
  }, {
262
279
  type: 'blur',
263
280
  listener: this.trackRevealSource(FOCUS_SOURCE, false)
@@ -268,21 +285,26 @@ export var ContributorTagController = /*#__PURE__*/function () {
268
285
  }, {
269
286
  key: "trackRevealSource",
270
287
  value: function trackRevealSource(source, isRevealing) {
271
- var _this3 = this;
288
+ var _this4 = this;
272
289
  return function () {
273
- if (isRevealing) {
274
- _this3.revealSources.add(source);
275
- } else {
276
- _this3.revealSources.delete(source);
277
- }
278
- _this3.applyVisibility();
290
+ return _this4.setRevealSource(source, isRevealing);
279
291
  };
280
292
  }
293
+ }, {
294
+ key: "setRevealSource",
295
+ value: function setRevealSource(source, isRevealing) {
296
+ if (isRevealing) {
297
+ this.revealSources.add(source);
298
+ } else {
299
+ this.revealSources.delete(source);
300
+ }
301
+ this.applyVisibility();
302
+ }
281
303
  }, {
282
304
  key: "renderAvatars",
283
305
  value: function renderAvatars(model) {
284
306
  var _this$dom,
285
- _this4 = this;
307
+ _this5 = this;
286
308
  var _ref5 = (_this$dom = this.dom) !== null && _this$dom !== void 0 ? _this$dom : {},
287
309
  container = _ref5.avatars;
288
310
  if (!container) {
@@ -326,7 +348,7 @@ export var ContributorTagController = /*#__PURE__*/function () {
326
348
  avatar.element.style.setProperty('margin-inline-end', "var(--ds-space-negative-050, -4px)");
327
349
  }
328
350
  container.appendChild(avatar.element);
329
- _this4.avatars.push(avatar);
351
+ _this5.avatars.push(avatar);
330
352
  });
331
353
  }
332
354
  }, {
@@ -477,7 +499,7 @@ export var ContributorTagController = /*#__PURE__*/function () {
477
499
  key: "syncHighlightBindings",
478
500
  value: function syncHighlightBindings(model) {
479
501
  var _model$linkedDiffIds,
480
- _this5 = this;
502
+ _this6 = this;
481
503
  var diffId = this.options.diffId;
482
504
  var selector = [diffId].concat(_toConsumableArray((_model$linkedDiffIds = model.linkedDiffIds) !== null && _model$linkedDiffIds !== void 0 ? _model$linkedDiffIds : [])).map(function (id) {
483
505
  return "[data-diff-id=\"".concat(id, "\"]");
@@ -492,8 +514,8 @@ export var ContributorTagController = /*#__PURE__*/function () {
492
514
  // not be in the document yet. A microtask lands once that pass has finished.
493
515
  var pendingBind = ++this.bindToken;
494
516
  queueMicrotask(function () {
495
- if (!_this5.isDestroyed && pendingBind === _this5.bindToken) {
496
- _this5.bindHighlightState(selector);
517
+ if (!_this6.isDestroyed && pendingBind === _this6.bindToken) {
518
+ _this6.bindHighlightState(selector);
497
519
  }
498
520
  });
499
521
  }
@@ -501,7 +523,7 @@ export var ContributorTagController = /*#__PURE__*/function () {
501
523
  key: "bindHighlightState",
502
524
  value: function bindHighlightState(selector) {
503
525
  var _this$options$getEdit,
504
- _this6 = this;
526
+ _this7 = this;
505
527
  // Scoped to this editor's content root, so a tag can only ever bind to the decorations its own
506
528
  // plugin instance rendered — another editor on the page, or one nested inside this one, cannot
507
529
  // reveal this tag.
@@ -517,10 +539,10 @@ export var ContributorTagController = /*#__PURE__*/function () {
517
539
  this.unbindHighlights = this.highlightElements.map(function (highlight) {
518
540
  return bindAll(highlight, [{
519
541
  type: 'mouseenter',
520
- listener: _this6.trackRevealSource(highlight, true)
542
+ listener: _this7.trackRevealSource(highlight, true)
521
543
  }, {
522
544
  type: 'mouseleave',
523
- listener: _this6.trackRevealSource(highlight, false)
545
+ listener: _this7.trackRevealSource(highlight, false)
524
546
  }]);
525
547
  });
526
548
  // The pointer may already be over a highlight by the time this binds, a draw pass after it
@@ -15,12 +15,20 @@ var PERSON_ICON_SVG = "<svg width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0
15
15
  /** `@atlaskit/icon-lab/core/ai-bot`, at 12px so it fits inside the 16px hexagon. */
16
16
  var AI_BOT_ICON_SVG = "<svg width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 16 16\" role=\"presentation\" style=\"display:block\"><path fill=\"currentcolor\" d=\"M13 5.5a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5V13a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5zm-6.5 2v3H5v-3zm4.5 0v3H9.5v-3zm3.5 1H16V10h-1.5v3a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-3H0V8.5h1.5v-3a2 2 0 0 1 2-2h3.75v-2H4V0h4a.75.75 0 0 1 .75.75V3.5h3.75a2 2 0 0 1 2 2z\"/></svg>";
17
17
 
18
+ /**
19
+ * The glyph from `@atlaskit/icon/core/ai-agent`, at 12px so it fits inside the 16px hexagon.
20
+ * The icon package only exposes this as a React component; this tag is otherwise imperative DOM,
21
+ * so keep the generated glyph here rather than introducing a React render boundary.
22
+ */
23
+ var AI_AGENT_ICON_SVG = "<svg width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 16 16\" role=\"presentation\" style=\"display:block\"><path fill=\"currentcolor\" fill-rule=\"evenodd\" d=\"M6.971.493a2 2 0 0 1 2.058 0l5 3A2 2 0 0 1 15 5.208v5.584a2 2 0 0 1-.971 1.715l-5 3a2 2 0 0 1-2.058 0l-5-3A2 2 0 0 1 1 10.792V5.208a2 2 0 0 1 .971-1.715zm1.286 1.286a.5.5 0 0 0-.514 0l-5 3a.5.5 0 0 0-.243.429v5.584a.5.5 0 0 0 .243.429l1.098.66a4.25 4.25 0 1 1 8.318 0l1.098-.66a.5.5 0 0 0 .243-.429V5.208a.5.5 0 0 0-.243-.429zM8 8.25a2.75 2.75 0 1 0 0 5.5 2.75 2.75 0 0 0 0-5.5\" clip-rule=\"evenodd\"/></svg>";
24
+
18
25
  /** `RovoHexIcon` from `@atlaskit/logo/rovo-hex/icon`, at the 16px `xxsmall` renders. */
19
26
  var ROVO_HEX_ICON_SVG = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" role=\"presentation\" style=\"display:block\"><path fill=\"#1868db\" fill-rule=\"evenodd\" d=\"m13.227 16.789-7.154 4.169-3.403-1.96a2.72 2.72 0 0 1-1.362-2.355V7.366c0-.973.518-1.87 1.361-2.354l6.044-3.487-.038.114a3.6 3.6 0 0 0-.172 1.088v9.278c0 1.274.68 2.45 1.786 3.085z\" clip-rule=\"evenodd\"/><path fill=\"#6a9a23\" fill-rule=\"evenodd\" d=\"m11.296 15.671-7.193 4.153 6.607 3.812a2.73 2.73 0 0 0 2.676.026l.048-.033a2.73 2.73 0 0 0 1.232-1.525 2.7 2.7 0 0 0 .127-.822v-3.594z\" clip-rule=\"evenodd\"/><path fill=\"#af59e1\" fill-rule=\"evenodd\" d=\"m21.477 5.003-4.404-2.539-5.904 4.89 2.69 1.556a3.56 3.56 0 0 1 1.785 3.086v9.277a3.6 3.6 0 0 1-.21 1.202l6.044-3.486a2.71 2.71 0 0 0 1.362-2.355V7.357c0-.97-.521-1.87-1.363-2.354\" clip-rule=\"evenodd\"/><path fill=\"#fca700\" fill-rule=\"evenodd\" d=\"M12.74 8.266 9.353 6.312V2.718c0-.283.044-.56.127-.821A2.73 2.73 0 0 1 10.71.372V.37a.4.4 0 0 0 .048-.033 2.73 2.73 0 0 1 2.676.026l6.499 3.75z\" clip-rule=\"evenodd\"/></svg>";
20
27
 
21
28
  /** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
22
29
  var CLAUDE_ICON_SVG = "<svg width=\"12\" height=\"12\" viewBox=\"8 8 32 32\" role=\"presentation\" style=\"display:block\"><path fill=\"#FFFFFF\" d=\"M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z\"/></svg>";
23
30
  var markup = {
31
+ aiAgent: AI_AGENT_ICON_SVG,
24
32
  aiBot: AI_BOT_ICON_SVG,
25
33
  claude: CLAUDE_ICON_SVG,
26
34
  person: PERSON_ICON_SVG,
@@ -8,7 +8,7 @@ type SimpleChange = Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
8
8
  /**
9
9
  * Main function to handle deleted rows - computes diff and creates decorations
10
10
  */
11
- export declare const createChangedRowDecorationWidgets: ({ changes, originalDoc, newDoc, nodeViewSerializer, colorScheme, isInserted, diffType, }: {
11
+ export declare const createChangedRowDecorationWidgets: ({ changes, originalDoc, newDoc, nodeViewSerializer, colorScheme, isInserted, diffType, showIndicators, }: {
12
12
  changes: SimpleChange[];
13
13
  colorScheme?: ColorScheme;
14
14
  diffType?: DiffType;
@@ -16,5 +16,6 @@ export declare const createChangedRowDecorationWidgets: ({ changes, originalDoc,
16
16
  newDoc: PMNode;
17
17
  nodeViewSerializer: NodeViewSerializer;
18
18
  originalDoc: PMNode;
19
+ showIndicators?: boolean;
19
20
  }) => Decoration[];
20
21
  export {};
@@ -75,6 +75,7 @@ export declare class ContributorTagController {
75
75
  private bindTag;
76
76
  /** One listener shape for every reveal source, so all of them land in the same set. */
77
77
  private trackRevealSource;
78
+ private setRevealSource;
78
79
  private renderAvatars;
79
80
  private renderLabels;
80
81
  private accentOf;
@@ -8,5 +8,5 @@
8
8
  * The Rovo hex is the `brand` appearance, whose `--rovo-*-color` variables resolve to `initial` in
9
9
  * both themes — the fallbacks below are the rendered colours, so no theme observer is needed.
10
10
  */
11
- export type ContributorTagIcon = 'aiBot' | 'claude' | 'person' | 'rovoHex';
11
+ export type ContributorTagIcon = 'aiAgent' | 'aiBot' | 'claude' | 'person' | 'rovoHex';
12
12
  export declare const getContributorTagIcon: (icon: ContributorTagIcon, doc: Document) => DocumentFragment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "16.0.11",
3
+ "version": "16.0.13",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/platform-feature-experiments": "^0.3.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
34
34
  "@atlaskit/primitives": "^22.5.0",
35
- "@atlaskit/tmp-editor-statsig": "^195.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^196.0.0",
36
36
  "@atlaskit/tokens": "^17.0.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "@compiled/react": "^1.0.2",
@@ -64,7 +64,7 @@
64
64
  "react-intl": "^7.0.0"
65
65
  },
66
66
  "peerDependencies": {
67
- "@atlaskit/editor-common": "^122.6.0",
67
+ "@atlaskit/editor-common": "^122.8.0",
68
68
  "react": "^18.2.0 || ^19.2.0",
69
69
  "react-dom": "^18.2.0 || ^19.2.0",
70
70
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"