@atlaskit/editor-plugin-show-diff 16.0.6 → 16.0.8

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 (29) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +6 -0
  3. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +2 -0
  4. package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +2 -0
  5. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -0
  6. package/dist/cjs/pm-plugins/decorations/decorationKeys.js +10 -5
  7. package/dist/cjs/ui/IndicatorBar/IndicatorBar.compiled.css +0 -1
  8. package/dist/cjs/ui/IndicatorBar/IndicatorBar.js +13 -2
  9. package/dist/cjs/ui/IndicatorBar/IndicatorBarContentComponent.js +6 -0
  10. package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +5 -0
  11. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +2 -0
  12. package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +2 -0
  13. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -0
  14. package/dist/es2019/pm-plugins/decorations/decorationKeys.js +9 -3
  15. package/dist/es2019/ui/IndicatorBar/IndicatorBar.compiled.css +0 -1
  16. package/dist/es2019/ui/IndicatorBar/IndicatorBar.js +13 -2
  17. package/dist/es2019/ui/IndicatorBar/IndicatorBarContentComponent.js +6 -0
  18. package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +5 -0
  19. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +2 -0
  20. package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +2 -0
  21. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -0
  22. package/dist/esm/pm-plugins/decorations/decorationKeys.js +10 -5
  23. package/dist/esm/ui/IndicatorBar/IndicatorBar.compiled.css +0 -1
  24. package/dist/esm/ui/IndicatorBar/IndicatorBar.js +13 -2
  25. package/dist/esm/ui/IndicatorBar/IndicatorBarContentComponent.js +6 -0
  26. package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +2 -0
  27. package/dist/types/showDiffPluginType.d.ts +2 -0
  28. package/dist/types/ui/IndicatorBar/IndicatorBar.d.ts +4 -1
  29. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 16.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7c955f7988148`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c955f7988148) -
8
+ Match show-diff indicator bars to contributor colors using theme-aware ADS border tokens.
9
+ - Updated dependencies
10
+
11
+ ## 16.0.7
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 16.0.6
4
18
 
5
19
  ### Patch Changes
@@ -66,6 +66,7 @@ exports.buildInsertStyleRuleNodeActive = buildInsertStyleRuleNodeActive;
66
66
  exports.buildInsertStyleRuleNodeNew = buildInsertStyleRuleNodeNew;
67
67
  exports.buildInsertedBlockNodeStyle = buildInsertedBlockNodeStyle;
68
68
  exports.buildInsertedInlineStyle = buildInsertedInlineStyle;
69
+ exports.getAccentBorderColor = getAccentBorderColor;
69
70
  exports.getAccentTokens = getAccentTokens;
70
71
  exports.getDeletedHighlightHoverBorderColor = getDeletedHighlightHoverBorderColor;
71
72
  exports.getDeletedHighlightHoverColor = getDeletedHighlightHoverColor;
@@ -227,6 +228,11 @@ function getAccentTokens(color) {
227
228
  };
228
229
  }
229
230
 
231
+ /** Border token for a contributor accent, used by the diff indicator. */
232
+ function getAccentBorderColor(color) {
233
+ return borderAccent(color);
234
+ }
235
+
230
236
  /** Ring colour for an active (scroll-target) deleted block outline. */
231
237
  function deletedBlockOutlineActiveRing(colors) {
232
238
  return colors.deletedBlockOutlineActiveEmphasis === 'border' ? borderAccent(colors.deleteActiveColor) : bgSubtlerPressed(colors.deleteActiveColor);
@@ -202,9 +202,11 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
202
202
  return [_view.Decoration.node(change.from, change.to, {
203
203
  style: displayNoneStyle
204
204
  }, (0, _decorationKeys.buildDiffDecorationSpec)({
205
+ colorScheme: colorScheme,
205
206
  decorationType: 'block',
206
207
  diffId: diffId,
207
208
  isActive: isActive,
209
+ isInserted: isInserted,
208
210
  nodeName: change.name,
209
211
  diffType: diffType
210
212
  }))];
@@ -241,9 +241,11 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
241
241
  originalDoc.slice(changedRow.fromA, changedRow.toA));
242
242
  var diffId = crypto.randomUUID();
243
243
  return _view.Decoration.widget(safeInsertPos, rowDOM, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)({
244
+ colorScheme: colorScheme,
244
245
  decorationType: 'widget',
245
246
  diffId: diffId,
246
247
  isActive: false,
248
+ isInserted: isInserted,
247
249
  diffType: diffType
248
250
  })));
249
251
  });
@@ -84,8 +84,10 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
84
84
  // Skip findSafeInsertPos: it walks forward to a schema-valid cell-insert point
85
85
  // and pushes the widget into the next cell. `targetPos` is the correct spot.
86
86
  decorations.push(_view.Decoration.widget(targetPos, dom, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)(_objectSpread({
87
+ colorScheme: colorScheme,
87
88
  decorationType: 'widget',
88
89
  diffId: crypto.randomUUID(),
90
+ isInserted: isInserted,
89
91
  diffType: diffType
90
92
  }, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
91
93
  side: -1
@@ -428,8 +430,10 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
428
430
  defaultSpacer.style.display = 'block';
429
431
  defaultSpacer.style.marginTop = "var(--ds-space-100, 8px)";
430
432
  decorations.push(_view.Decoration.widget(safeInsertPos, defaultSpacer, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)({
433
+ colorScheme: colorScheme,
431
434
  decorationType: 'widget',
432
435
  diffId: crypto.randomUUID(),
436
+ isInserted: isInserted,
433
437
  diffType: diffType
434
438
  }))));
435
439
  }
@@ -89,9 +89,9 @@ var buildDiffDecorationSpec = exports.buildDiffDecorationSpec = function buildDi
89
89
  attributionKey: attributionKey
90
90
  } : {}), attributionKey && isActive !== undefined ? {
91
91
  isActive: isActive
92
- } : {}), attributionKey && isInserted !== undefined ? {
92
+ } : {}), isInserted !== undefined ? {
93
93
  isInserted: isInserted
94
- } : {}), attributionKey && colorScheme ? {
94
+ } : {}), colorScheme ? {
95
95
  colorScheme: colorScheme
96
96
  } : {}), nodeName ? {
97
97
  nodeName: nodeName
@@ -147,9 +147,14 @@ var isDiffDecoration = exports.isDiffDecoration = function isDiffDecoration(deco
147
147
  var extractDiffDescriptors = exports.extractDiffDescriptors = function extractDiffDescriptors(decorations) {
148
148
  return decorations.find(undefined, undefined, isDiffDecorationSpec).filter(isDiffDecoration).map(function (_ref5) {
149
149
  var spec = _ref5.spec;
150
- return {
151
- id: spec.diffId,
150
+ return _objectSpread(_objectSpread(_objectSpread({}, spec.colorScheme ? {
151
+ colorScheme: spec.colorScheme
152
+ } : {}), {}, {
153
+ id: spec.diffId
154
+ }, spec.isInserted !== undefined ? {
155
+ isInserted: spec.isInserted
156
+ } : {}), {}, {
152
157
  type: spec.decorationType
153
- };
158
+ });
154
159
  });
155
160
  };
@@ -2,7 +2,6 @@
2
2
  ._18u0mgjw{margin-left:var(--ds-space-negative-200,-1pc)}
3
3
  ._19pk196n{margin-top:var(--ds-space-negative-075,-6px)}
4
4
  ._1bsb1l7b{width:3px}
5
- ._bfhkvbh5{background-color:var(--ds-border-information,#357de8)}
6
5
  ._kqswstnw{position:absolute}
7
6
  ._lcxvglyw{pointer-events:none}
8
7
  ._otyr196n{margin-bottom:var(--ds-space-negative-075,-6px)}
@@ -9,25 +9,36 @@ exports.IndicatorBar = IndicatorBar;
9
9
  require("./IndicatorBar.compiled.css");
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _runtime = require("@compiled/react/runtime");
12
+ var _factory = require("../../pm-plugins/decorations/colorSchemes/factory");
13
+ var _schemes = require("../../pm-plugins/decorations/colorSchemes/schemes");
12
14
  var _decorationKeys = require("../../pm-plugins/decorations/decorationKeys");
13
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
16
  var barStyles = null;
17
+ var getIndicatorColor = function getIndicatorColor(colorScheme, isInserted) {
18
+ if (colorScheme === undefined || colorScheme === 'standard' || colorScheme === 'traditional' || isInserted === undefined) {
19
+ return "var(--ds-border-information, #357DE8)";
20
+ }
21
+ return (0, _factory.getAccentBorderColor)(_schemes.colorSchemeRegistry[colorScheme][isInserted ? 'insertColor' : 'deleteColor']);
22
+ };
15
23
  function IndicatorBar(_ref) {
16
24
  var anchorTop = _ref.anchorTop,
17
25
  anchorBottom = _ref.anchorBottom,
18
26
  anchorLeft = _ref.anchorLeft,
19
- anchorLeftFallback = _ref.anchorLeftFallback;
27
+ anchorLeftFallback = _ref.anchorLeftFallback,
28
+ colorScheme = _ref.colorScheme,
29
+ isInserted = _ref.isInserted;
20
30
  var leftAnchors = [anchorLeft, anchorLeftFallback, _decorationKeys.AnchorDocMarginKey].filter(Boolean).map(function (anchor) {
21
31
  return "anchor(--".concat(anchor, " left)");
22
32
  }).join(', ');
23
33
  return /*#__PURE__*/React.createElement("span", {
24
34
  "data-testid": "diff-indicator-bar",
25
35
  style: {
36
+ backgroundColor: getIndicatorColor(colorScheme, isInserted),
26
37
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
27
38
  left: "min(".concat(leftAnchors, ")"),
28
39
  top: "anchor(--".concat(anchorTop, " top)"),
29
40
  bottom: "anchor(--".concat(anchorBottom, " bottom)")
30
41
  },
31
- className: (0, _runtime.ax)(["_2rko1rr0 _kqswstnw _1bsb1l7b _bfhkvbh5 _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n"])
42
+ className: (0, _runtime.ax)(["_2rko1rr0 _kqswstnw _1bsb1l7b _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n"])
32
43
  });
33
44
  }
@@ -17,6 +17,8 @@ var renderIndicatorBar = function renderIndicatorBar(descriptor) {
17
17
  {
18
18
  return /*#__PURE__*/_react.default.createElement(_IndicatorBar.IndicatorBar, {
19
19
  key: descriptor.id,
20
+ colorScheme: descriptor.colorScheme,
21
+ isInserted: descriptor.isInserted,
20
22
  anchorTop: (0, _decorationKeys.buildAnchorDecorationKey)({
21
23
  diffId: descriptor.id,
22
24
  anchorType: _decorationKeys.AnchorTypeKey.from
@@ -41,6 +43,8 @@ var renderIndicatorBar = function renderIndicatorBar(descriptor) {
41
43
  });
42
44
  return /*#__PURE__*/_react.default.createElement(_IndicatorBar.IndicatorBar, {
43
45
  key: descriptor.id,
46
+ colorScheme: descriptor.colorScheme,
47
+ isInserted: descriptor.isInserted,
44
48
  anchorTop: blockAnchor,
45
49
  anchorBottom: blockAnchor,
46
50
  anchorLeft: (0, _decorationKeys.buildAnchorDecorationKey)({
@@ -53,6 +57,8 @@ var renderIndicatorBar = function renderIndicatorBar(descriptor) {
53
57
  {
54
58
  return /*#__PURE__*/_react.default.createElement(_IndicatorBar.IndicatorBar, {
55
59
  key: descriptor.id,
60
+ colorScheme: descriptor.colorScheme,
61
+ isInserted: descriptor.isInserted,
56
62
  anchorTop: (0, _decorationKeys.buildAnchorDecorationKey)({
57
63
  diffId: descriptor.id
58
64
  }),
@@ -152,6 +152,11 @@ export function getAccentTokens(color) {
152
152
  };
153
153
  }
154
154
 
155
+ /** Border token for a contributor accent, used by the diff indicator. */
156
+ export function getAccentBorderColor(color) {
157
+ return borderAccent(color);
158
+ }
159
+
155
160
  /** Ring colour for an active (scroll-target) deleted block outline. */
156
161
  function deletedBlockOutlineActiveRing(colors) {
157
162
  return colors.deletedBlockOutlineActiveEmphasis === 'border' ? borderAccent(colors.deleteActiveColor) : bgSubtlerPressed(colors.deleteActiveColor);
@@ -182,9 +182,11 @@ export const createBlockChangedDecoration = ({
182
182
  return [Decoration.node(change.from, change.to, {
183
183
  style: displayNoneStyle
184
184
  }, buildDiffDecorationSpec({
185
+ colorScheme,
185
186
  decorationType: 'block',
186
187
  diffId,
187
188
  isActive,
189
+ isInserted,
188
190
  nodeName: change.name,
189
191
  diffType
190
192
  }))];
@@ -211,9 +211,11 @@ export const createChangedRowDecorationWidgets = ({
211
211
  const diffId = crypto.randomUUID();
212
212
  return Decoration.widget(safeInsertPos, rowDOM, {
213
213
  ...buildDiffDecorationSpec({
214
+ colorScheme,
214
215
  decorationType: 'widget',
215
216
  diffId,
216
217
  isActive: false,
218
+ isInserted,
217
219
  diffType
218
220
  })
219
221
  });
@@ -74,8 +74,10 @@ const createTableCellContentWidgets = ({
74
74
  // and pushes the widget into the next cell. `targetPos` is the correct spot.
75
75
  decorations.push(Decoration.widget(targetPos, dom, {
76
76
  ...buildDiffDecorationSpec({
77
+ colorScheme,
77
78
  decorationType: 'widget',
78
79
  diffId: crypto.randomUUID(),
80
+ isInserted,
79
81
  diffType,
80
82
  ...(isExtendedEnabled(diffType) && {
81
83
  side: -1
@@ -414,8 +416,10 @@ export const createNodeChangedDecorationWidget = ({
414
416
  defaultSpacer.style.marginTop = "var(--ds-space-100, 8px)";
415
417
  decorations.push(Decoration.widget(safeInsertPos, defaultSpacer, {
416
418
  ...buildDiffDecorationSpec({
419
+ colorScheme,
417
420
  decorationType: 'widget',
418
421
  diffId: crypto.randomUUID(),
422
+ isInserted,
419
423
  diffType
420
424
  })
421
425
  }));
@@ -77,14 +77,14 @@ export const buildDiffDecorationSpec = ({
77
77
  ...(attributionKey ? {
78
78
  attributionKey
79
79
  } : {}),
80
- // Only alongside an attribution key, so the spec shape is unchanged when the gate is off.
80
+ // Active state is only needed by contributor tags, so keep it alongside an attribution key.
81
81
  ...(attributionKey && isActive !== undefined ? {
82
82
  isActive
83
83
  } : {}),
84
- ...(attributionKey && isInserted !== undefined ? {
84
+ ...(isInserted !== undefined ? {
85
85
  isInserted
86
86
  } : {}),
87
- ...(attributionKey && colorScheme ? {
87
+ ...(colorScheme ? {
88
88
  colorScheme
89
89
  } : {}),
90
90
  ...(nodeName ? {
@@ -138,7 +138,13 @@ export const extractDiffDescriptors = decorations => decorations.find(undefined,
138
138
  spec
139
139
  }) => {
140
140
  return {
141
+ ...(spec.colorScheme ? {
142
+ colorScheme: spec.colorScheme
143
+ } : {}),
141
144
  id: spec.diffId,
145
+ ...(spec.isInserted !== undefined ? {
146
+ isInserted: spec.isInserted
147
+ } : {}),
142
148
  type: spec.decorationType
143
149
  };
144
150
  });
@@ -2,7 +2,6 @@
2
2
  ._18u0mgjw{margin-left:var(--ds-space-negative-200,-1pc)}
3
3
  ._19pk196n{margin-top:var(--ds-space-negative-075,-6px)}
4
4
  ._1bsb1l7b{width:3px}
5
- ._bfhkvbh5{background-color:var(--ds-border-information,#357de8)}
6
5
  ._kqswstnw{position:absolute}
7
6
  ._lcxvglyw{pointer-events:none}
8
7
  ._otyr196n{margin-bottom:var(--ds-space-negative-075,-6px)}
@@ -2,23 +2,34 @@
2
2
  import "./IndicatorBar.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
+ import { getAccentBorderColor } from '../../pm-plugins/decorations/colorSchemes/factory';
6
+ import { colorSchemeRegistry } from '../../pm-plugins/decorations/colorSchemes/schemes';
5
7
  import { AnchorDocMarginKey } from '../../pm-plugins/decorations/decorationKeys';
6
8
  const barStyles = null;
9
+ const getIndicatorColor = (colorScheme, isInserted) => {
10
+ if (colorScheme === undefined || colorScheme === 'standard' || colorScheme === 'traditional' || isInserted === undefined) {
11
+ return "var(--ds-border-information, #357DE8)";
12
+ }
13
+ return getAccentBorderColor(colorSchemeRegistry[colorScheme][isInserted ? 'insertColor' : 'deleteColor']);
14
+ };
7
15
  export function IndicatorBar({
8
16
  anchorTop,
9
17
  anchorBottom,
10
18
  anchorLeft,
11
- anchorLeftFallback
19
+ anchorLeftFallback,
20
+ colorScheme,
21
+ isInserted
12
22
  }) {
13
23
  const leftAnchors = [anchorLeft, anchorLeftFallback, AnchorDocMarginKey].filter(Boolean).map(anchor => `anchor(--${anchor} left)`).join(', ');
14
24
  return /*#__PURE__*/React.createElement("span", {
15
25
  "data-testid": "diff-indicator-bar",
16
26
  style: {
27
+ backgroundColor: getIndicatorColor(colorScheme, isInserted),
17
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
18
29
  left: `min(${leftAnchors})`,
19
30
  top: `anchor(--${anchorTop} top)`,
20
31
  bottom: `anchor(--${anchorBottom} bottom)`
21
32
  },
22
- className: ax(["_2rko1rr0 _kqswstnw _1bsb1l7b _bfhkvbh5 _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n"])
33
+ className: ax(["_2rko1rr0 _kqswstnw _1bsb1l7b _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n"])
23
34
  });
24
35
  }
@@ -10,6 +10,8 @@ const renderIndicatorBar = descriptor => {
10
10
  {
11
11
  return /*#__PURE__*/React.createElement(IndicatorBar, {
12
12
  key: descriptor.id,
13
+ colorScheme: descriptor.colorScheme,
14
+ isInserted: descriptor.isInserted,
13
15
  anchorTop: buildAnchorDecorationKey({
14
16
  diffId: descriptor.id,
15
17
  anchorType: AnchorTypeKey.from
@@ -34,6 +36,8 @@ const renderIndicatorBar = descriptor => {
34
36
  });
35
37
  return /*#__PURE__*/React.createElement(IndicatorBar, {
36
38
  key: descriptor.id,
39
+ colorScheme: descriptor.colorScheme,
40
+ isInserted: descriptor.isInserted,
37
41
  anchorTop: blockAnchor,
38
42
  anchorBottom: blockAnchor,
39
43
  anchorLeft: buildAnchorDecorationKey({
@@ -46,6 +50,8 @@ const renderIndicatorBar = descriptor => {
46
50
  {
47
51
  return /*#__PURE__*/React.createElement(IndicatorBar, {
48
52
  key: descriptor.id,
53
+ colorScheme: descriptor.colorScheme,
54
+ isInserted: descriptor.isInserted,
49
55
  anchorTop: buildAnchorDecorationKey({
50
56
  diffId: descriptor.id
51
57
  }),
@@ -155,6 +155,11 @@ export function getAccentTokens(color) {
155
155
  };
156
156
  }
157
157
 
158
+ /** Border token for a contributor accent, used by the diff indicator. */
159
+ export function getAccentBorderColor(color) {
160
+ return borderAccent(color);
161
+ }
162
+
158
163
  /** Ring colour for an active (scroll-target) deleted block outline. */
159
164
  function deletedBlockOutlineActiveRing(colors) {
160
165
  return colors.deletedBlockOutlineActiveEmphasis === 'border' ? borderAccent(colors.deleteActiveColor) : bgSubtlerPressed(colors.deleteActiveColor);
@@ -195,9 +195,11 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
195
195
  return [Decoration.node(change.from, change.to, {
196
196
  style: displayNoneStyle
197
197
  }, buildDiffDecorationSpec({
198
+ colorScheme: colorScheme,
198
199
  decorationType: 'block',
199
200
  diffId: diffId,
200
201
  isActive: isActive,
202
+ isInserted: isInserted,
201
203
  nodeName: change.name,
202
204
  diffType: diffType
203
205
  }))];
@@ -234,9 +234,11 @@ export var createChangedRowDecorationWidgets = function createChangedRowDecorati
234
234
  originalDoc.slice(changedRow.fromA, changedRow.toA));
235
235
  var diffId = crypto.randomUUID();
236
236
  return Decoration.widget(safeInsertPos, rowDOM, _objectSpread({}, buildDiffDecorationSpec({
237
+ colorScheme: colorScheme,
237
238
  decorationType: 'widget',
238
239
  diffId: diffId,
239
240
  isActive: false,
241
+ isInserted: isInserted,
240
242
  diffType: diffType
241
243
  })));
242
244
  });
@@ -77,8 +77,10 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
77
77
  // Skip findSafeInsertPos: it walks forward to a schema-valid cell-insert point
78
78
  // and pushes the widget into the next cell. `targetPos` is the correct spot.
79
79
  decorations.push(Decoration.widget(targetPos, dom, _objectSpread({}, buildDiffDecorationSpec(_objectSpread({
80
+ colorScheme: colorScheme,
80
81
  decorationType: 'widget',
81
82
  diffId: crypto.randomUUID(),
83
+ isInserted: isInserted,
82
84
  diffType: diffType
83
85
  }, isExtendedEnabled(diffType) && {
84
86
  side: -1
@@ -421,8 +423,10 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
421
423
  defaultSpacer.style.display = 'block';
422
424
  defaultSpacer.style.marginTop = "var(--ds-space-100, 8px)";
423
425
  decorations.push(Decoration.widget(safeInsertPos, defaultSpacer, _objectSpread({}, buildDiffDecorationSpec({
426
+ colorScheme: colorScheme,
424
427
  decorationType: 'widget',
425
428
  diffId: crypto.randomUUID(),
429
+ isInserted: isInserted,
426
430
  diffType: diffType
427
431
  }))));
428
432
  }
@@ -80,9 +80,9 @@ export var buildDiffDecorationSpec = function buildDiffDecorationSpec(_ref3) {
80
80
  attributionKey: attributionKey
81
81
  } : {}), attributionKey && isActive !== undefined ? {
82
82
  isActive: isActive
83
- } : {}), attributionKey && isInserted !== undefined ? {
83
+ } : {}), isInserted !== undefined ? {
84
84
  isInserted: isInserted
85
- } : {}), attributionKey && colorScheme ? {
85
+ } : {}), colorScheme ? {
86
86
  colorScheme: colorScheme
87
87
  } : {}), nodeName ? {
88
88
  nodeName: nodeName
@@ -138,9 +138,14 @@ export var isDiffDecoration = function isDiffDecoration(decoration) {
138
138
  export var extractDiffDescriptors = function extractDiffDescriptors(decorations) {
139
139
  return decorations.find(undefined, undefined, isDiffDecorationSpec).filter(isDiffDecoration).map(function (_ref5) {
140
140
  var spec = _ref5.spec;
141
- return {
142
- id: spec.diffId,
141
+ return _objectSpread(_objectSpread(_objectSpread({}, spec.colorScheme ? {
142
+ colorScheme: spec.colorScheme
143
+ } : {}), {}, {
144
+ id: spec.diffId
145
+ }, spec.isInserted !== undefined ? {
146
+ isInserted: spec.isInserted
147
+ } : {}), {}, {
143
148
  type: spec.decorationType
144
- };
149
+ });
145
150
  });
146
151
  };
@@ -2,7 +2,6 @@
2
2
  ._18u0mgjw{margin-left:var(--ds-space-negative-200,-1pc)}
3
3
  ._19pk196n{margin-top:var(--ds-space-negative-075,-6px)}
4
4
  ._1bsb1l7b{width:3px}
5
- ._bfhkvbh5{background-color:var(--ds-border-information,#357de8)}
6
5
  ._kqswstnw{position:absolute}
7
6
  ._lcxvglyw{pointer-events:none}
8
7
  ._otyr196n{margin-bottom:var(--ds-space-negative-075,-6px)}
@@ -2,24 +2,35 @@
2
2
  import "./IndicatorBar.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
+ import { getAccentBorderColor } from '../../pm-plugins/decorations/colorSchemes/factory';
6
+ import { colorSchemeRegistry } from '../../pm-plugins/decorations/colorSchemes/schemes';
5
7
  import { AnchorDocMarginKey } from '../../pm-plugins/decorations/decorationKeys';
6
8
  var barStyles = null;
9
+ var getIndicatorColor = function getIndicatorColor(colorScheme, isInserted) {
10
+ if (colorScheme === undefined || colorScheme === 'standard' || colorScheme === 'traditional' || isInserted === undefined) {
11
+ return "var(--ds-border-information, #357DE8)";
12
+ }
13
+ return getAccentBorderColor(colorSchemeRegistry[colorScheme][isInserted ? 'insertColor' : 'deleteColor']);
14
+ };
7
15
  export function IndicatorBar(_ref) {
8
16
  var anchorTop = _ref.anchorTop,
9
17
  anchorBottom = _ref.anchorBottom,
10
18
  anchorLeft = _ref.anchorLeft,
11
- anchorLeftFallback = _ref.anchorLeftFallback;
19
+ anchorLeftFallback = _ref.anchorLeftFallback,
20
+ colorScheme = _ref.colorScheme,
21
+ isInserted = _ref.isInserted;
12
22
  var leftAnchors = [anchorLeft, anchorLeftFallback, AnchorDocMarginKey].filter(Boolean).map(function (anchor) {
13
23
  return "anchor(--".concat(anchor, " left)");
14
24
  }).join(', ');
15
25
  return /*#__PURE__*/React.createElement("span", {
16
26
  "data-testid": "diff-indicator-bar",
17
27
  style: {
28
+ backgroundColor: getIndicatorColor(colorScheme, isInserted),
18
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
19
30
  left: "min(".concat(leftAnchors, ")"),
20
31
  top: "anchor(--".concat(anchorTop, " top)"),
21
32
  bottom: "anchor(--".concat(anchorBottom, " bottom)")
22
33
  },
23
- className: ax(["_2rko1rr0 _kqswstnw _1bsb1l7b _bfhkvbh5 _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n"])
34
+ className: ax(["_2rko1rr0 _kqswstnw _1bsb1l7b _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n"])
24
35
  });
25
36
  }
@@ -10,6 +10,8 @@ var renderIndicatorBar = function renderIndicatorBar(descriptor) {
10
10
  {
11
11
  return /*#__PURE__*/React.createElement(IndicatorBar, {
12
12
  key: descriptor.id,
13
+ colorScheme: descriptor.colorScheme,
14
+ isInserted: descriptor.isInserted,
13
15
  anchorTop: buildAnchorDecorationKey({
14
16
  diffId: descriptor.id,
15
17
  anchorType: AnchorTypeKey.from
@@ -34,6 +36,8 @@ var renderIndicatorBar = function renderIndicatorBar(descriptor) {
34
36
  });
35
37
  return /*#__PURE__*/React.createElement(IndicatorBar, {
36
38
  key: descriptor.id,
39
+ colorScheme: descriptor.colorScheme,
40
+ isInserted: descriptor.isInserted,
37
41
  anchorTop: blockAnchor,
38
42
  anchorBottom: blockAnchor,
39
43
  anchorLeft: buildAnchorDecorationKey({
@@ -46,6 +50,8 @@ var renderIndicatorBar = function renderIndicatorBar(descriptor) {
46
50
  {
47
51
  return /*#__PURE__*/React.createElement(IndicatorBar, {
48
52
  key: descriptor.id,
53
+ colorScheme: descriptor.colorScheme,
54
+ isInserted: descriptor.isInserted,
49
55
  anchorTop: buildAnchorDecorationKey({
50
56
  diffId: descriptor.id
51
57
  }),
@@ -24,6 +24,8 @@ export declare function getAccentTokens(color: AdsAccentColor): {
24
24
  background: string;
25
25
  text: string;
26
26
  };
27
+ /** Border token for a contributor accent, used by the diff indicator. */
28
+ export declare function getAccentBorderColor(color: AdsAccentColor): string;
27
29
  /** Inline inserted content — default state. */
28
30
  export declare function buildInsertStyle(colors: DiffColorScheme): string;
29
31
  /** Inline insert style for content within a block node (no background, underline only). */
@@ -103,7 +103,9 @@ export type DeletedDiffWidget = {
103
103
  };
104
104
  export type SmartDiffThresholds = SmartDiffThresholdsInternal;
105
105
  export type DiffDescriptor = {
106
+ colorScheme?: ColorScheme;
106
107
  id: string;
108
+ isInserted?: boolean;
107
109
  type: 'inline' | 'block' | 'widget';
108
110
  };
109
111
  /**
@@ -2,9 +2,12 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- export declare function IndicatorBar({ anchorTop, anchorBottom, anchorLeft, anchorLeftFallback, }: {
5
+ import type { ColorScheme } from '../../pm-plugins/decorations/colorSchemes/types';
6
+ export declare function IndicatorBar({ anchorTop, anchorBottom, anchorLeft, anchorLeftFallback, colorScheme, isInserted, }: {
6
7
  anchorBottom: string;
7
8
  anchorLeft: string;
8
9
  anchorLeftFallback?: string;
9
10
  anchorTop: string;
11
+ colorScheme?: ColorScheme;
12
+ isInserted?: boolean;
10
13
  }): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "16.0.6",
3
+ "version": "16.0.8",
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": "^192.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^193.0.0",
36
36
  "@atlaskit/tokens": "^16.12.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.3.0",
67
+ "@atlaskit/editor-common": "^122.4.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"