@atlaskit/editor-plugin-show-diff 17.1.3 → 17.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +55 -9
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +17 -2
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +52 -8
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +19 -2
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +52 -8
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +18 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +13 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 17.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 17.1.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`5a4cb407816ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5a4cb407816ac) -
|
|
14
|
+
[ux] Strike out a deleted status lozenge in a suggestion diff, behind
|
|
15
|
+
`platform_editor_ai_show_diff_patch_2`. Its `line-through` was not propagated into the
|
|
16
|
+
`display: inline-flex` lozenge and painted beneath its background, so the status showed only the
|
|
17
|
+
deleted highlight.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 17.1.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.DELETED_HIGHLIGHT_BORDER_VAR = exports.DELETED_HIGHLIGHT_BG_VAR = void 0;
|
|
7
|
+
exports.DELETED_INLINE_NODE_STRIKE_VAR = exports.DELETED_HIGHLIGHT_BORDER_VAR = exports.DELETED_HIGHLIGHT_BG_VAR = void 0;
|
|
8
8
|
exports.buildAddedCellOverlayRoundedStyle = buildAddedCellOverlayRoundedStyle;
|
|
9
9
|
exports.buildAddedCellOverlayStyle = buildAddedCellOverlayStyle;
|
|
10
10
|
exports.buildAddedCellOverlayStyleNew = buildAddedCellOverlayStyleNew;
|
|
@@ -29,6 +29,7 @@ exports.buildDeletedDecorationMarkerVariableNew = buildDeletedDecorationMarkerVa
|
|
|
29
29
|
exports.buildDeletedDecorationMarkerVariableSimple = buildDeletedDecorationMarkerVariableSimple;
|
|
30
30
|
exports.buildDeletedInlineContentStyle = buildDeletedInlineContentStyle;
|
|
31
31
|
exports.buildDeletedInlineContentStyleExtended = buildDeletedInlineContentStyleExtended;
|
|
32
|
+
exports.buildDeletedInlineNodeCSSVariables = buildDeletedInlineNodeCSSVariables;
|
|
32
33
|
exports.buildDeletedInlineStyle = buildDeletedInlineStyle;
|
|
33
34
|
exports.buildDeletedInlineStyleStandard = buildDeletedInlineStyleStandard;
|
|
34
35
|
exports.buildDeletedInlineStyleUnbounded = buildDeletedInlineStyleUnbounded;
|
|
@@ -37,6 +38,7 @@ exports.buildDeletedLozengeStyle = buildDeletedLozengeStyle;
|
|
|
37
38
|
exports.buildDeletedNodeCSSVariables = buildDeletedNodeCSSVariables;
|
|
38
39
|
exports.buildDeletedQuoteNodeWithLozengeStyle = buildDeletedQuoteNodeWithLozengeStyle;
|
|
39
40
|
exports.buildDeletedRowStyle = buildDeletedRowStyle;
|
|
41
|
+
exports.buildDeletedStrikeLineBorder = buildDeletedStrikeLineBorder;
|
|
40
42
|
exports.buildDeletedStrikethroughLine = buildDeletedStrikethroughLine;
|
|
41
43
|
exports.buildDeletedStyleQuoteNode = buildDeletedStyleQuoteNode;
|
|
42
44
|
exports.buildDeletedStyleQuoteNodeActive = buildDeletedStyleQuoteNodeActive;
|
|
@@ -75,6 +77,7 @@ exports.getInsertedInlineRevealColors = getInsertedInlineRevealColors;
|
|
|
75
77
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
76
78
|
var _agentBrandColorSchemes = require("@atlaskit/agent-color/agent-brand-color-schemes");
|
|
77
79
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
80
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
78
81
|
var _getStandardDeletedTextDecorationStyle = require("./getStandardDeletedTextDecorationStyle");
|
|
79
82
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
80
83
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -93,6 +96,13 @@ var DELETED_HIGHLIGHT_BG_VAR = exports.DELETED_HIGHLIGHT_BG_VAR = '--show-diff-d
|
|
|
93
96
|
*/
|
|
94
97
|
var DELETED_HIGHLIGHT_BORDER_VAR = exports.DELETED_HIGHLIGHT_BORDER_VAR = '--show-diff-deleted-highlight-border';
|
|
95
98
|
|
|
99
|
+
/**
|
|
100
|
+
* `border-top` for the strike editor-core redraws on a deleted status lozenge. Carries the whole
|
|
101
|
+
* shorthand, not just the colour, so the line stays identical to the one the widget path draws —
|
|
102
|
+
* including its 2px active weight — without editor-core restating either.
|
|
103
|
+
*/
|
|
104
|
+
var DELETED_INLINE_NODE_STRIKE_VAR = exports.DELETED_INLINE_NODE_STRIKE_VAR = '--show-diff-deleted-inline-node-strike';
|
|
105
|
+
|
|
96
106
|
// token() is a build-time transform needing static literals, so pre-compute every colour's
|
|
97
107
|
// tokens here and index by name at runtime.
|
|
98
108
|
|
|
@@ -390,6 +400,31 @@ function buildDeletedInlineStyle(colors, isActive) {
|
|
|
390
400
|
return isActive ? (0, _lazyNodeView.convertToInlineCss)(deletedInlineStyleActiveBase(colors)) : (0, _lazyNodeView.convertToInlineCss)(deletedInlineStyleBase(colors));
|
|
391
401
|
}
|
|
392
402
|
|
|
403
|
+
/**
|
|
404
|
+
* The strike line's own `border-top` — the only thing that varies between the variants below, and
|
|
405
|
+
* the single source editor-core reads through `DELETED_INLINE_NODE_STRIKE_VAR`.
|
|
406
|
+
*/
|
|
407
|
+
function buildDeletedStrikeLineBorder(colors, isActive) {
|
|
408
|
+
if (colors.deletedNodeEmphasis !== 'stateful') {
|
|
409
|
+
var _colors$deleteTextCol2;
|
|
410
|
+
return "1px solid ".concat(textAccent((_colors$deleteTextCol2 = colors.deleteTextColor) !== null && _colors$deleteTextCol2 !== void 0 ? _colors$deleteTextCol2 : colors.deleteColor));
|
|
411
|
+
}
|
|
412
|
+
return "".concat(isActive ? '2px' : '1px', " solid ").concat(borderAccent(colors.deleteColor));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/** Geometry shared by every strikethrough line, so only the border ever differs. */
|
|
416
|
+
var deletedStrikeLine = function deletedStrikeLine(border) {
|
|
417
|
+
return (0, _lazyNodeView.convertToInlineCss)({
|
|
418
|
+
position: 'absolute',
|
|
419
|
+
top: '50%',
|
|
420
|
+
width: '100%',
|
|
421
|
+
display: 'inline-block',
|
|
422
|
+
borderTop: border,
|
|
423
|
+
pointerEvents: 'none',
|
|
424
|
+
zIndex: 1
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
|
|
393
428
|
/** Strikethrough line (unbounded span) for deleted content — default state. */
|
|
394
429
|
function buildDeletedContentStyleUnbounded(colors) {
|
|
395
430
|
return (0, _lazyNodeView.convertToInlineCss)({
|
|
@@ -420,13 +455,13 @@ function buildDeletedContentStyleUnboundedActive(colors) {
|
|
|
420
455
|
|
|
421
456
|
/** Unbounded strikethrough overlay for deleted inline content (absolute positioned line). */
|
|
422
457
|
function buildDeletedInlineStyleUnbounded(colors) {
|
|
423
|
-
var _colors$
|
|
458
|
+
var _colors$deleteTextCol3;
|
|
424
459
|
return (0, _lazyNodeView.convertToInlineCss)({
|
|
425
460
|
position: 'absolute',
|
|
426
461
|
top: '50%',
|
|
427
462
|
width: '100%',
|
|
428
463
|
display: 'inline-block',
|
|
429
|
-
borderTop: "1px solid ".concat(textAccent((_colors$
|
|
464
|
+
borderTop: "1px solid ".concat(textAccent((_colors$deleteTextCol3 = colors.deleteTextColor) !== null && _colors$deleteTextCol3 !== void 0 ? _colors$deleteTextCol3 : colors.deleteColor)),
|
|
430
465
|
pointerEvents: 'none',
|
|
431
466
|
zIndex: 1
|
|
432
467
|
});
|
|
@@ -537,10 +572,10 @@ function buildDeletedBlockOutlineRoundedNew(colors) {
|
|
|
537
572
|
|
|
538
573
|
/** Table row style for deleted rows. */
|
|
539
574
|
function buildDeletedRowStyle(colors) {
|
|
540
|
-
var _colors$
|
|
575
|
+
var _colors$deleteTextCol4;
|
|
541
576
|
// Each branch emits exactly the CSS the pre-factory shim did for its scheme.
|
|
542
577
|
return colors.deletedRowTreatment === 'textTint' ? (0, _lazyNodeView.convertToInlineCss)(_objectSpread(_objectSpread({
|
|
543
|
-
color: textAccent((_colors$
|
|
578
|
+
color: textAccent((_colors$deleteTextCol4 = colors.deleteTextColor) !== null && _colors$deleteTextCol4 !== void 0 ? _colors$deleteTextCol4 : colors.deleteColor)
|
|
544
579
|
}, (0, _getStandardDeletedTextDecorationStyle.getStandardDeletedTextDecorationStyle)()), {}, {
|
|
545
580
|
opacity: 0.6,
|
|
546
581
|
display: 'table-row'
|
|
@@ -744,19 +779,19 @@ function deletedGlyphOpacity(colors, state) {
|
|
|
744
779
|
|
|
745
780
|
/** 'glyphTint' deleted inline style — tints the glyph itself via `color:`. */
|
|
746
781
|
function buildDeletedInlineStyleStandard(colors, state) {
|
|
747
|
-
var _colors$
|
|
782
|
+
var _colors$deleteTextCol6;
|
|
748
783
|
if (state === 'active') {
|
|
749
|
-
var _colors$
|
|
784
|
+
var _colors$deleteTextCol5;
|
|
750
785
|
return (0, _lazyNodeView.convertToInlineCss)(_objectSpread(_objectSpread({
|
|
751
786
|
color: colors.deleteTextColor ? textAccent(colors.deleteTextColor) : "var(--ds-text, #292A2E)"
|
|
752
787
|
}, (0, _getStandardDeletedTextDecorationStyle.getStandardDeletedTextDecorationStyle)()), {}, {
|
|
753
|
-
textDecorationColor: textAccent((_colors$
|
|
788
|
+
textDecorationColor: textAccent((_colors$deleteTextCol5 = colors.deleteTextColor) !== null && _colors$deleteTextCol5 !== void 0 ? _colors$deleteTextCol5 : colors.deleteColor),
|
|
754
789
|
position: 'relative',
|
|
755
790
|
opacity: deletedGlyphOpacity(colors, state)
|
|
756
791
|
}));
|
|
757
792
|
}
|
|
758
793
|
return (0, _lazyNodeView.convertToInlineCss)(_objectSpread(_objectSpread({
|
|
759
|
-
color: textAccent((_colors$
|
|
794
|
+
color: textAccent((_colors$deleteTextCol6 = colors.deleteTextColor) !== null && _colors$deleteTextCol6 !== void 0 ? _colors$deleteTextCol6 : colors.deleteColor)
|
|
760
795
|
}, (0, _getStandardDeletedTextDecorationStyle.getStandardDeletedTextDecorationStyle)()), {}, {
|
|
761
796
|
position: 'relative',
|
|
762
797
|
opacity: deletedGlyphOpacity(colors, state)
|
|
@@ -956,6 +991,12 @@ function buildDeletedInlineContentStyle(colors, state) {
|
|
|
956
991
|
* 1px to 2px when active and tints with the border accent; 'static' uses the text accent always.
|
|
957
992
|
*/
|
|
958
993
|
function buildDeletedStrikethroughLine(colors, isActive) {
|
|
994
|
+
// Gated because this is a live widget-path render, even though the two branches are built to
|
|
995
|
+
// return the same string — the shared helper only exists so the lozenge strike cannot drift
|
|
996
|
+
// from this one.
|
|
997
|
+
if ((0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) {
|
|
998
|
+
return deletedStrikeLine(buildDeletedStrikeLineBorder(colors, isActive));
|
|
999
|
+
}
|
|
959
1000
|
if (colors.deletedNodeEmphasis !== 'stateful') {
|
|
960
1001
|
return buildDeletedInlineStyleUnbounded(colors);
|
|
961
1002
|
}
|
|
@@ -1130,6 +1171,11 @@ function buildAtomicInlineChangedCSSVariables(colors) {
|
|
|
1130
1171
|
});
|
|
1131
1172
|
}
|
|
1132
1173
|
|
|
1174
|
+
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
1175
|
+
function buildDeletedInlineNodeCSSVariables(colors, isActive) {
|
|
1176
|
+
return (0, _lazyNodeView.convertToInlineCss)((0, _defineProperty2.default)({}, DELETED_INLINE_NODE_STRIKE_VAR, buildDeletedStrikeLineBorder(colors, isActive)));
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1133
1179
|
/**
|
|
1134
1180
|
* Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`.
|
|
1135
1181
|
* Emitted by `wrapBlockNodeView` alongside `show-diff-deleted-node-vars` — the class is named for
|
|
@@ -53,6 +53,12 @@ var getColorScheme = function getColorScheme(colorScheme) {
|
|
|
53
53
|
* Class names for an atomic inline node decoration (date, emoji, mention, status). Scheme-agnostic
|
|
54
54
|
* — `buildAtomicInlineChangedCSSVariables()` supplies the colour inline on the same element.
|
|
55
55
|
*/
|
|
56
|
+
/**
|
|
57
|
+
* Lets editor-core redraw the strike on a deleted status: `line-through` from an ancestor paints
|
|
58
|
+
* behind the lozenge's own background (EDITOR-9123). Not needed for deleted-content widgets —
|
|
59
|
+
* `createContentWrapper` appends a real positioned line.
|
|
60
|
+
*/
|
|
61
|
+
var DELETED_INLINE_NODE_CLASS = 'show-diff-deleted-inline-node';
|
|
56
62
|
var getAtomicInlineNodeClassName = function getAtomicInlineNodeClassName(inlineNodeName) {
|
|
57
63
|
var classNames = ['show-diff-atomic-inline-changed'];
|
|
58
64
|
if (inlineNodeName) {
|
|
@@ -203,6 +209,13 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
203
209
|
var isAtomicInlineInsertion = isAtomicInlineNode && isInserted;
|
|
204
210
|
var atomicInlineAttrs = isAtomicInlineInsertion ? resolveAtomicInlineAttrs(inlineNodeName, colorScheme, colors) : undefined;
|
|
205
211
|
|
|
212
|
+
// Every deletion: an inverted diff carries no `isAtomicInlineNode`, so editor-core's selectors do
|
|
213
|
+
// the matching.
|
|
214
|
+
var deletedInlineNodeAttrs = !isInserted && (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? {
|
|
215
|
+
className: DELETED_INLINE_NODE_CLASS,
|
|
216
|
+
styleSuffix: (0, _factory.buildDeletedInlineNodeCSSVariables)(colors, isActive)
|
|
217
|
+
} : undefined;
|
|
218
|
+
|
|
206
219
|
// Built from the raw change range, not the indicator anchors resolved below: a tag lines up with
|
|
207
220
|
// the changed text, while the bar's anchors are held on a block boundary when a deleted widget
|
|
208
221
|
// renders beside them.
|
|
@@ -216,11 +229,13 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
216
229
|
diffId: diffId,
|
|
217
230
|
mountContext: tagMountContext
|
|
218
231
|
}) : undefined;
|
|
219
|
-
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? _decorationKeys.scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
220
|
-
var decorations = [_view.Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread({
|
|
232
|
+
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? _decorationKeys.scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
233
|
+
var decorations = [_view.Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
221
234
|
style: inlineStyle
|
|
222
235
|
}, atomicInlineAttrs && {
|
|
223
236
|
class: atomicInlineAttrs.className
|
|
237
|
+
}), deletedInlineNodeAttrs && {
|
|
238
|
+
class: deletedInlineNodeAttrs.className
|
|
224
239
|
}), revealed && (0, _defineProperty2.default)({}, _revealStyles.REVEAL_ATTR, revealed.role)), {}, {
|
|
225
240
|
'data-testid': 'show-diff-changed-decoration'
|
|
226
241
|
}, (showContributorTags || (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) && {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { agentBrandColorSchemes } from '@atlaskit/agent-color/agent-brand-color-schemes';
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
import { getStandardDeletedTextDecorationStyle } from './getStandardDeletedTextDecorationStyle';
|
|
4
5
|
/**
|
|
5
6
|
* Hover highlight for deleted text under an 'onEmphasis' scheme. Inline styles cannot express
|
|
@@ -16,6 +17,13 @@ export const DELETED_HIGHLIGHT_BG_VAR = '--show-diff-deleted-highlight-bg';
|
|
|
16
17
|
*/
|
|
17
18
|
export const DELETED_HIGHLIGHT_BORDER_VAR = '--show-diff-deleted-highlight-border';
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* `border-top` for the strike editor-core redraws on a deleted status lozenge. Carries the whole
|
|
22
|
+
* shorthand, not just the colour, so the line stays identical to the one the widget path draws —
|
|
23
|
+
* including its 2px active weight — without editor-core restating either.
|
|
24
|
+
*/
|
|
25
|
+
export const DELETED_INLINE_NODE_STRIKE_VAR = '--show-diff-deleted-inline-node-strike';
|
|
26
|
+
|
|
19
27
|
// token() is a build-time transform needing static literals, so pre-compute every colour's
|
|
20
28
|
// tokens here and index by name at runtime.
|
|
21
29
|
|
|
@@ -312,6 +320,29 @@ export function buildDeletedInlineStyle(colors, isActive) {
|
|
|
312
320
|
return isActive ? convertToInlineCss(deletedInlineStyleActiveBase(colors)) : convertToInlineCss(deletedInlineStyleBase(colors));
|
|
313
321
|
}
|
|
314
322
|
|
|
323
|
+
/**
|
|
324
|
+
* The strike line's own `border-top` — the only thing that varies between the variants below, and
|
|
325
|
+
* the single source editor-core reads through `DELETED_INLINE_NODE_STRIKE_VAR`.
|
|
326
|
+
*/
|
|
327
|
+
export function buildDeletedStrikeLineBorder(colors, isActive) {
|
|
328
|
+
if (colors.deletedNodeEmphasis !== 'stateful') {
|
|
329
|
+
var _colors$deleteTextCol2;
|
|
330
|
+
return `1px solid ${textAccent((_colors$deleteTextCol2 = colors.deleteTextColor) !== null && _colors$deleteTextCol2 !== void 0 ? _colors$deleteTextCol2 : colors.deleteColor)}`;
|
|
331
|
+
}
|
|
332
|
+
return `${isActive ? '2px' : '1px'} solid ${borderAccent(colors.deleteColor)}`;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Geometry shared by every strikethrough line, so only the border ever differs. */
|
|
336
|
+
const deletedStrikeLine = border => convertToInlineCss({
|
|
337
|
+
position: 'absolute',
|
|
338
|
+
top: '50%',
|
|
339
|
+
width: '100%',
|
|
340
|
+
display: 'inline-block',
|
|
341
|
+
borderTop: border,
|
|
342
|
+
pointerEvents: 'none',
|
|
343
|
+
zIndex: 1
|
|
344
|
+
});
|
|
345
|
+
|
|
315
346
|
/** Strikethrough line (unbounded span) for deleted content — default state. */
|
|
316
347
|
export function buildDeletedContentStyleUnbounded(colors) {
|
|
317
348
|
return convertToInlineCss({
|
|
@@ -342,13 +373,13 @@ export function buildDeletedContentStyleUnboundedActive(colors) {
|
|
|
342
373
|
|
|
343
374
|
/** Unbounded strikethrough overlay for deleted inline content (absolute positioned line). */
|
|
344
375
|
export function buildDeletedInlineStyleUnbounded(colors) {
|
|
345
|
-
var _colors$
|
|
376
|
+
var _colors$deleteTextCol3;
|
|
346
377
|
return convertToInlineCss({
|
|
347
378
|
position: 'absolute',
|
|
348
379
|
top: '50%',
|
|
349
380
|
width: '100%',
|
|
350
381
|
display: 'inline-block',
|
|
351
|
-
borderTop: `1px solid ${textAccent((_colors$
|
|
382
|
+
borderTop: `1px solid ${textAccent((_colors$deleteTextCol3 = colors.deleteTextColor) !== null && _colors$deleteTextCol3 !== void 0 ? _colors$deleteTextCol3 : colors.deleteColor)}`,
|
|
352
383
|
pointerEvents: 'none',
|
|
353
384
|
zIndex: 1
|
|
354
385
|
});
|
|
@@ -459,10 +490,10 @@ export function buildDeletedBlockOutlineRoundedNew(colors) {
|
|
|
459
490
|
|
|
460
491
|
/** Table row style for deleted rows. */
|
|
461
492
|
export function buildDeletedRowStyle(colors) {
|
|
462
|
-
var _colors$
|
|
493
|
+
var _colors$deleteTextCol4;
|
|
463
494
|
// Each branch emits exactly the CSS the pre-factory shim did for its scheme.
|
|
464
495
|
return colors.deletedRowTreatment === 'textTint' ? convertToInlineCss({
|
|
465
|
-
color: textAccent((_colors$
|
|
496
|
+
color: textAccent((_colors$deleteTextCol4 = colors.deleteTextColor) !== null && _colors$deleteTextCol4 !== void 0 ? _colors$deleteTextCol4 : colors.deleteColor),
|
|
466
497
|
...getStandardDeletedTextDecorationStyle(),
|
|
467
498
|
opacity: 0.6,
|
|
468
499
|
display: 'table-row'
|
|
@@ -666,19 +697,19 @@ function deletedGlyphOpacity(colors, state) {
|
|
|
666
697
|
|
|
667
698
|
/** 'glyphTint' deleted inline style — tints the glyph itself via `color:`. */
|
|
668
699
|
export function buildDeletedInlineStyleStandard(colors, state) {
|
|
669
|
-
var _colors$
|
|
700
|
+
var _colors$deleteTextCol6;
|
|
670
701
|
if (state === 'active') {
|
|
671
|
-
var _colors$
|
|
702
|
+
var _colors$deleteTextCol5;
|
|
672
703
|
return convertToInlineCss({
|
|
673
704
|
color: colors.deleteTextColor ? textAccent(colors.deleteTextColor) : "var(--ds-text, #292A2E)",
|
|
674
705
|
...getStandardDeletedTextDecorationStyle(),
|
|
675
|
-
textDecorationColor: textAccent((_colors$
|
|
706
|
+
textDecorationColor: textAccent((_colors$deleteTextCol5 = colors.deleteTextColor) !== null && _colors$deleteTextCol5 !== void 0 ? _colors$deleteTextCol5 : colors.deleteColor),
|
|
676
707
|
position: 'relative',
|
|
677
708
|
opacity: deletedGlyphOpacity(colors, state)
|
|
678
709
|
});
|
|
679
710
|
}
|
|
680
711
|
return convertToInlineCss({
|
|
681
|
-
color: textAccent((_colors$
|
|
712
|
+
color: textAccent((_colors$deleteTextCol6 = colors.deleteTextColor) !== null && _colors$deleteTextCol6 !== void 0 ? _colors$deleteTextCol6 : colors.deleteColor),
|
|
682
713
|
...getStandardDeletedTextDecorationStyle(),
|
|
683
714
|
position: 'relative',
|
|
684
715
|
opacity: deletedGlyphOpacity(colors, state)
|
|
@@ -880,6 +911,12 @@ export function buildDeletedInlineContentStyle(colors, state) {
|
|
|
880
911
|
* 1px to 2px when active and tints with the border accent; 'static' uses the text accent always.
|
|
881
912
|
*/
|
|
882
913
|
export function buildDeletedStrikethroughLine(colors, isActive) {
|
|
914
|
+
// Gated because this is a live widget-path render, even though the two branches are built to
|
|
915
|
+
// return the same string — the shared helper only exists so the lozenge strike cannot drift
|
|
916
|
+
// from this one.
|
|
917
|
+
if (fg('platform_editor_ai_show_diff_patch_2')) {
|
|
918
|
+
return deletedStrikeLine(buildDeletedStrikeLineBorder(colors, isActive));
|
|
919
|
+
}
|
|
883
920
|
if (colors.deletedNodeEmphasis !== 'stateful') {
|
|
884
921
|
return buildDeletedInlineStyleUnbounded(colors);
|
|
885
922
|
}
|
|
@@ -1055,6 +1092,13 @@ export function buildAtomicInlineChangedCSSVariables(colors) {
|
|
|
1055
1092
|
});
|
|
1056
1093
|
}
|
|
1057
1094
|
|
|
1095
|
+
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
1096
|
+
export function buildDeletedInlineNodeCSSVariables(colors, isActive) {
|
|
1097
|
+
return convertToInlineCss({
|
|
1098
|
+
[DELETED_INLINE_NODE_STRIKE_VAR]: buildDeletedStrikeLineBorder(colors, isActive)
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1058
1102
|
/**
|
|
1059
1103
|
* Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`.
|
|
1060
1104
|
* Emitted by `wrapBlockNodeView` alongside `show-diff-deleted-node-vars` — the class is named for
|
|
@@ -5,7 +5,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
5
5
|
import { CONTRIBUTOR_TAG_Z_INDEX } from '../../ui/ContributorTag/buildContributorTagDom';
|
|
6
6
|
import { isExtendedEnabled } from '../isExtendedEnabled';
|
|
7
7
|
import { isEmptyParagraphSlice } from '../utils/isEmptyParagraphSlice';
|
|
8
|
-
import { buildAtomicInlineChangedCSSVariables, buildDeletedInlineContentStyleExtended, buildDeletedInlineStyle, buildDeletedInlineStyleStandard, buildInsertStyle, buildInsertStyleActive, buildInsertStyleExtended, buildInsertStyleExtendedActive, buildInsertStyleExtendedNoUnderline, buildInsertStyleExtendedNoUnderlineActive } from './colorSchemes/factory';
|
|
8
|
+
import { buildAtomicInlineChangedCSSVariables, buildDeletedInlineContentStyleExtended, buildDeletedInlineNodeCSSVariables, buildDeletedInlineStyle, buildDeletedInlineStyleStandard, buildInsertStyle, buildInsertStyleActive, buildInsertStyleExtended, buildInsertStyleExtendedActive, buildInsertStyleExtendedNoUnderline, buildInsertStyleExtendedNoUnderlineActive } from './colorSchemes/factory';
|
|
9
9
|
import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
|
|
10
10
|
import { createInlineIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
|
|
11
11
|
import { createContributorTagWidget, isContributorTagWidgetEnabled } from './createContributorTagWidget';
|
|
@@ -40,6 +40,12 @@ const getColorScheme = colorScheme => colorSchemeRegistry[colorScheme !== null &
|
|
|
40
40
|
* Class names for an atomic inline node decoration (date, emoji, mention, status). Scheme-agnostic
|
|
41
41
|
* — `buildAtomicInlineChangedCSSVariables()` supplies the colour inline on the same element.
|
|
42
42
|
*/
|
|
43
|
+
/**
|
|
44
|
+
* Lets editor-core redraw the strike on a deleted status: `line-through` from an ancestor paints
|
|
45
|
+
* behind the lozenge's own background (EDITOR-9123). Not needed for deleted-content widgets —
|
|
46
|
+
* `createContentWrapper` appends a real positioned line.
|
|
47
|
+
*/
|
|
48
|
+
const DELETED_INLINE_NODE_CLASS = 'show-diff-deleted-inline-node';
|
|
43
49
|
const getAtomicInlineNodeClassName = inlineNodeName => {
|
|
44
50
|
const classNames = ['show-diff-atomic-inline-changed'];
|
|
45
51
|
if (inlineNodeName) {
|
|
@@ -178,6 +184,13 @@ export const createInlineChangedDecoration = ({
|
|
|
178
184
|
const isAtomicInlineInsertion = isAtomicInlineNode && isInserted;
|
|
179
185
|
const atomicInlineAttrs = isAtomicInlineInsertion ? resolveAtomicInlineAttrs(inlineNodeName, colorScheme, colors) : undefined;
|
|
180
186
|
|
|
187
|
+
// Every deletion: an inverted diff carries no `isAtomicInlineNode`, so editor-core's selectors do
|
|
188
|
+
// the matching.
|
|
189
|
+
const deletedInlineNodeAttrs = !isInserted && fg('platform_editor_ai_show_diff_patch_2') ? {
|
|
190
|
+
className: DELETED_INLINE_NODE_CLASS,
|
|
191
|
+
styleSuffix: buildDeletedInlineNodeCSSVariables(colors, isActive)
|
|
192
|
+
} : undefined;
|
|
193
|
+
|
|
181
194
|
// Built from the raw change range, not the indicator anchors resolved below: a tag lines up with
|
|
182
195
|
// the changed text, while the bar's anchors are held on a block boundary when a deleted widget
|
|
183
196
|
// renders beside them.
|
|
@@ -191,12 +204,16 @@ export const createInlineChangedDecoration = ({
|
|
|
191
204
|
diffId,
|
|
192
205
|
mountContext: tagMountContext
|
|
193
206
|
}) : undefined;
|
|
194
|
-
const inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, fg('platform_editor_ai_show_diff_patch_1') ? scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
207
|
+
const inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, fg('platform_editor_ai_show_diff_patch_1') ? scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
195
208
|
const decorations = [Decoration.inline(change.fromB, change.toB, {
|
|
196
209
|
style: inlineStyle,
|
|
197
210
|
...(atomicInlineAttrs && {
|
|
198
211
|
class: atomicInlineAttrs.className
|
|
199
212
|
}),
|
|
213
|
+
// Mutually exclusive with the above: atomic-inline attrs are insertion-only.
|
|
214
|
+
...(deletedInlineNodeAttrs && {
|
|
215
|
+
class: deletedInlineNodeAttrs.className
|
|
216
|
+
}),
|
|
200
217
|
...(revealed && {
|
|
201
218
|
[REVEAL_ATTR]: revealed.role
|
|
202
219
|
}),
|
|
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { agentBrandColorSchemes } from '@atlaskit/agent-color/agent-brand-color-schemes';
|
|
5
5
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
7
|
import { getStandardDeletedTextDecorationStyle } from './getStandardDeletedTextDecorationStyle';
|
|
7
8
|
/**
|
|
8
9
|
* Hover highlight for deleted text under an 'onEmphasis' scheme. Inline styles cannot express
|
|
@@ -19,6 +20,13 @@ export var DELETED_HIGHLIGHT_BG_VAR = '--show-diff-deleted-highlight-bg';
|
|
|
19
20
|
*/
|
|
20
21
|
export var DELETED_HIGHLIGHT_BORDER_VAR = '--show-diff-deleted-highlight-border';
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* `border-top` for the strike editor-core redraws on a deleted status lozenge. Carries the whole
|
|
25
|
+
* shorthand, not just the colour, so the line stays identical to the one the widget path draws —
|
|
26
|
+
* including its 2px active weight — without editor-core restating either.
|
|
27
|
+
*/
|
|
28
|
+
export var DELETED_INLINE_NODE_STRIKE_VAR = '--show-diff-deleted-inline-node-strike';
|
|
29
|
+
|
|
22
30
|
// token() is a build-time transform needing static literals, so pre-compute every colour's
|
|
23
31
|
// tokens here and index by name at runtime.
|
|
24
32
|
|
|
@@ -316,6 +324,31 @@ export function buildDeletedInlineStyle(colors, isActive) {
|
|
|
316
324
|
return isActive ? convertToInlineCss(deletedInlineStyleActiveBase(colors)) : convertToInlineCss(deletedInlineStyleBase(colors));
|
|
317
325
|
}
|
|
318
326
|
|
|
327
|
+
/**
|
|
328
|
+
* The strike line's own `border-top` — the only thing that varies between the variants below, and
|
|
329
|
+
* the single source editor-core reads through `DELETED_INLINE_NODE_STRIKE_VAR`.
|
|
330
|
+
*/
|
|
331
|
+
export function buildDeletedStrikeLineBorder(colors, isActive) {
|
|
332
|
+
if (colors.deletedNodeEmphasis !== 'stateful') {
|
|
333
|
+
var _colors$deleteTextCol2;
|
|
334
|
+
return "1px solid ".concat(textAccent((_colors$deleteTextCol2 = colors.deleteTextColor) !== null && _colors$deleteTextCol2 !== void 0 ? _colors$deleteTextCol2 : colors.deleteColor));
|
|
335
|
+
}
|
|
336
|
+
return "".concat(isActive ? '2px' : '1px', " solid ").concat(borderAccent(colors.deleteColor));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** Geometry shared by every strikethrough line, so only the border ever differs. */
|
|
340
|
+
var deletedStrikeLine = function deletedStrikeLine(border) {
|
|
341
|
+
return convertToInlineCss({
|
|
342
|
+
position: 'absolute',
|
|
343
|
+
top: '50%',
|
|
344
|
+
width: '100%',
|
|
345
|
+
display: 'inline-block',
|
|
346
|
+
borderTop: border,
|
|
347
|
+
pointerEvents: 'none',
|
|
348
|
+
zIndex: 1
|
|
349
|
+
});
|
|
350
|
+
};
|
|
351
|
+
|
|
319
352
|
/** Strikethrough line (unbounded span) for deleted content — default state. */
|
|
320
353
|
export function buildDeletedContentStyleUnbounded(colors) {
|
|
321
354
|
return convertToInlineCss({
|
|
@@ -346,13 +379,13 @@ export function buildDeletedContentStyleUnboundedActive(colors) {
|
|
|
346
379
|
|
|
347
380
|
/** Unbounded strikethrough overlay for deleted inline content (absolute positioned line). */
|
|
348
381
|
export function buildDeletedInlineStyleUnbounded(colors) {
|
|
349
|
-
var _colors$
|
|
382
|
+
var _colors$deleteTextCol3;
|
|
350
383
|
return convertToInlineCss({
|
|
351
384
|
position: 'absolute',
|
|
352
385
|
top: '50%',
|
|
353
386
|
width: '100%',
|
|
354
387
|
display: 'inline-block',
|
|
355
|
-
borderTop: "1px solid ".concat(textAccent((_colors$
|
|
388
|
+
borderTop: "1px solid ".concat(textAccent((_colors$deleteTextCol3 = colors.deleteTextColor) !== null && _colors$deleteTextCol3 !== void 0 ? _colors$deleteTextCol3 : colors.deleteColor)),
|
|
356
389
|
pointerEvents: 'none',
|
|
357
390
|
zIndex: 1
|
|
358
391
|
});
|
|
@@ -463,10 +496,10 @@ export function buildDeletedBlockOutlineRoundedNew(colors) {
|
|
|
463
496
|
|
|
464
497
|
/** Table row style for deleted rows. */
|
|
465
498
|
export function buildDeletedRowStyle(colors) {
|
|
466
|
-
var _colors$
|
|
499
|
+
var _colors$deleteTextCol4;
|
|
467
500
|
// Each branch emits exactly the CSS the pre-factory shim did for its scheme.
|
|
468
501
|
return colors.deletedRowTreatment === 'textTint' ? convertToInlineCss(_objectSpread(_objectSpread({
|
|
469
|
-
color: textAccent((_colors$
|
|
502
|
+
color: textAccent((_colors$deleteTextCol4 = colors.deleteTextColor) !== null && _colors$deleteTextCol4 !== void 0 ? _colors$deleteTextCol4 : colors.deleteColor)
|
|
470
503
|
}, getStandardDeletedTextDecorationStyle()), {}, {
|
|
471
504
|
opacity: 0.6,
|
|
472
505
|
display: 'table-row'
|
|
@@ -670,19 +703,19 @@ function deletedGlyphOpacity(colors, state) {
|
|
|
670
703
|
|
|
671
704
|
/** 'glyphTint' deleted inline style — tints the glyph itself via `color:`. */
|
|
672
705
|
export function buildDeletedInlineStyleStandard(colors, state) {
|
|
673
|
-
var _colors$
|
|
706
|
+
var _colors$deleteTextCol6;
|
|
674
707
|
if (state === 'active') {
|
|
675
|
-
var _colors$
|
|
708
|
+
var _colors$deleteTextCol5;
|
|
676
709
|
return convertToInlineCss(_objectSpread(_objectSpread({
|
|
677
710
|
color: colors.deleteTextColor ? textAccent(colors.deleteTextColor) : "var(--ds-text, #292A2E)"
|
|
678
711
|
}, getStandardDeletedTextDecorationStyle()), {}, {
|
|
679
|
-
textDecorationColor: textAccent((_colors$
|
|
712
|
+
textDecorationColor: textAccent((_colors$deleteTextCol5 = colors.deleteTextColor) !== null && _colors$deleteTextCol5 !== void 0 ? _colors$deleteTextCol5 : colors.deleteColor),
|
|
680
713
|
position: 'relative',
|
|
681
714
|
opacity: deletedGlyphOpacity(colors, state)
|
|
682
715
|
}));
|
|
683
716
|
}
|
|
684
717
|
return convertToInlineCss(_objectSpread(_objectSpread({
|
|
685
|
-
color: textAccent((_colors$
|
|
718
|
+
color: textAccent((_colors$deleteTextCol6 = colors.deleteTextColor) !== null && _colors$deleteTextCol6 !== void 0 ? _colors$deleteTextCol6 : colors.deleteColor)
|
|
686
719
|
}, getStandardDeletedTextDecorationStyle()), {}, {
|
|
687
720
|
position: 'relative',
|
|
688
721
|
opacity: deletedGlyphOpacity(colors, state)
|
|
@@ -882,6 +915,12 @@ export function buildDeletedInlineContentStyle(colors, state) {
|
|
|
882
915
|
* 1px to 2px when active and tints with the border accent; 'static' uses the text accent always.
|
|
883
916
|
*/
|
|
884
917
|
export function buildDeletedStrikethroughLine(colors, isActive) {
|
|
918
|
+
// Gated because this is a live widget-path render, even though the two branches are built to
|
|
919
|
+
// return the same string — the shared helper only exists so the lozenge strike cannot drift
|
|
920
|
+
// from this one.
|
|
921
|
+
if (fg('platform_editor_ai_show_diff_patch_2')) {
|
|
922
|
+
return deletedStrikeLine(buildDeletedStrikeLineBorder(colors, isActive));
|
|
923
|
+
}
|
|
885
924
|
if (colors.deletedNodeEmphasis !== 'stateful') {
|
|
886
925
|
return buildDeletedInlineStyleUnbounded(colors);
|
|
887
926
|
}
|
|
@@ -1056,6 +1095,11 @@ export function buildAtomicInlineChangedCSSVariables(colors) {
|
|
|
1056
1095
|
});
|
|
1057
1096
|
}
|
|
1058
1097
|
|
|
1098
|
+
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
1099
|
+
export function buildDeletedInlineNodeCSSVariables(colors, isActive) {
|
|
1100
|
+
return convertToInlineCss(_defineProperty({}, DELETED_INLINE_NODE_STRIKE_VAR, buildDeletedStrikeLineBorder(colors, isActive)));
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1059
1103
|
/**
|
|
1060
1104
|
* Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`.
|
|
1061
1105
|
* Emitted by `wrapBlockNodeView` alongside `show-diff-deleted-node-vars` — the class is named for
|
|
@@ -9,7 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
9
9
|
import { CONTRIBUTOR_TAG_Z_INDEX } from '../../ui/ContributorTag/buildContributorTagDom';
|
|
10
10
|
import { isExtendedEnabled } from '../isExtendedEnabled';
|
|
11
11
|
import { isEmptyParagraphSlice } from '../utils/isEmptyParagraphSlice';
|
|
12
|
-
import { buildAtomicInlineChangedCSSVariables, buildDeletedInlineContentStyleExtended, buildDeletedInlineStyle, buildDeletedInlineStyleStandard, buildInsertStyle, buildInsertStyleActive, buildInsertStyleExtended, buildInsertStyleExtendedActive, buildInsertStyleExtendedNoUnderline, buildInsertStyleExtendedNoUnderlineActive } from './colorSchemes/factory';
|
|
12
|
+
import { buildAtomicInlineChangedCSSVariables, buildDeletedInlineContentStyleExtended, buildDeletedInlineNodeCSSVariables, buildDeletedInlineStyle, buildDeletedInlineStyleStandard, buildInsertStyle, buildInsertStyleActive, buildInsertStyleExtended, buildInsertStyleExtendedActive, buildInsertStyleExtendedNoUnderline, buildInsertStyleExtendedNoUnderlineActive } from './colorSchemes/factory';
|
|
13
13
|
import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
|
|
14
14
|
import { createInlineIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
|
|
15
15
|
import { createContributorTagWidget, isContributorTagWidgetEnabled } from './createContributorTagWidget';
|
|
@@ -46,6 +46,12 @@ var getColorScheme = function getColorScheme(colorScheme) {
|
|
|
46
46
|
* Class names for an atomic inline node decoration (date, emoji, mention, status). Scheme-agnostic
|
|
47
47
|
* — `buildAtomicInlineChangedCSSVariables()` supplies the colour inline on the same element.
|
|
48
48
|
*/
|
|
49
|
+
/**
|
|
50
|
+
* Lets editor-core redraw the strike on a deleted status: `line-through` from an ancestor paints
|
|
51
|
+
* behind the lozenge's own background (EDITOR-9123). Not needed for deleted-content widgets —
|
|
52
|
+
* `createContentWrapper` appends a real positioned line.
|
|
53
|
+
*/
|
|
54
|
+
var DELETED_INLINE_NODE_CLASS = 'show-diff-deleted-inline-node';
|
|
49
55
|
var getAtomicInlineNodeClassName = function getAtomicInlineNodeClassName(inlineNodeName) {
|
|
50
56
|
var classNames = ['show-diff-atomic-inline-changed'];
|
|
51
57
|
if (inlineNodeName) {
|
|
@@ -196,6 +202,13 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
196
202
|
var isAtomicInlineInsertion = isAtomicInlineNode && isInserted;
|
|
197
203
|
var atomicInlineAttrs = isAtomicInlineInsertion ? resolveAtomicInlineAttrs(inlineNodeName, colorScheme, colors) : undefined;
|
|
198
204
|
|
|
205
|
+
// Every deletion: an inverted diff carries no `isAtomicInlineNode`, so editor-core's selectors do
|
|
206
|
+
// the matching.
|
|
207
|
+
var deletedInlineNodeAttrs = !isInserted && fg('platform_editor_ai_show_diff_patch_2') ? {
|
|
208
|
+
className: DELETED_INLINE_NODE_CLASS,
|
|
209
|
+
styleSuffix: buildDeletedInlineNodeCSSVariables(colors, isActive)
|
|
210
|
+
} : undefined;
|
|
211
|
+
|
|
199
212
|
// Built from the raw change range, not the indicator anchors resolved below: a tag lines up with
|
|
200
213
|
// the changed text, while the bar's anchors are held on a block boundary when a deleted widget
|
|
201
214
|
// renders beside them.
|
|
@@ -209,11 +222,13 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
209
222
|
diffId: diffId,
|
|
210
223
|
mountContext: tagMountContext
|
|
211
224
|
}) : undefined;
|
|
212
|
-
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, fg('platform_editor_ai_show_diff_patch_1') ? scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
213
|
-
var decorations = [Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread({
|
|
225
|
+
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, fg('platform_editor_ai_show_diff_patch_1') ? scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
226
|
+
var decorations = [Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
214
227
|
style: inlineStyle
|
|
215
228
|
}, atomicInlineAttrs && {
|
|
216
229
|
class: atomicInlineAttrs.className
|
|
230
|
+
}), deletedInlineNodeAttrs && {
|
|
231
|
+
class: deletedInlineNodeAttrs.className
|
|
217
232
|
}), revealed && _defineProperty({}, REVEAL_ATTR, revealed.role)), {}, {
|
|
218
233
|
'data-testid': 'show-diff-changed-decoration'
|
|
219
234
|
}, (showContributorTags || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
@@ -12,6 +12,12 @@ export declare const DELETED_HIGHLIGHT_BG_VAR = "--show-diff-deleted-highlight-b
|
|
|
12
12
|
* 'underline' scheme can darken the border without darkening the tint behind it.
|
|
13
13
|
*/
|
|
14
14
|
export declare const DELETED_HIGHLIGHT_BORDER_VAR = "--show-diff-deleted-highlight-border";
|
|
15
|
+
/**
|
|
16
|
+
* `border-top` for the strike editor-core redraws on a deleted status lozenge. Carries the whole
|
|
17
|
+
* shorthand, not just the colour, so the line stays identical to the one the widget path draws —
|
|
18
|
+
* including its 2px active weight — without editor-core restating either.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DELETED_INLINE_NODE_STRIKE_VAR = "--show-diff-deleted-inline-node-strike";
|
|
15
21
|
/** Contributor tags use a bold fill with a contrasting foreground, including branded schemes. */
|
|
16
22
|
export declare function getAccentTokens(color: AccentColor): {
|
|
17
23
|
background: string;
|
|
@@ -39,6 +45,11 @@ export declare function buildInsertStyleInBlockExtendedNoUnderline(_colors: Diff
|
|
|
39
45
|
export declare function buildInsertStyleActive(colors: DiffColorScheme): string;
|
|
40
46
|
/** Strikethrough for removed inline / widget content (non-marker decorations). */
|
|
41
47
|
export declare function buildDeletedInlineStyle(colors: DiffColorScheme, isActive: boolean): string;
|
|
48
|
+
/**
|
|
49
|
+
* The strike line's own `border-top` — the only thing that varies between the variants below, and
|
|
50
|
+
* the single source editor-core reads through `DELETED_INLINE_NODE_STRIKE_VAR`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildDeletedStrikeLineBorder(colors: DiffColorScheme, isActive: boolean): string;
|
|
42
53
|
/** Strikethrough line (unbounded span) for deleted content — default state. */
|
|
43
54
|
export declare function buildDeletedContentStyleUnbounded(colors: DiffColorScheme): string;
|
|
44
55
|
/** Strikethrough line (unbounded span) for deleted content — active state. */
|
|
@@ -218,6 +229,8 @@ export declare function buildDeletedWrappedBlockOutline(colors: DiffColorScheme,
|
|
|
218
229
|
* inline it beats the stylesheet's fallback, making the plugin the only source of the colour.
|
|
219
230
|
*/
|
|
220
231
|
export declare function buildAtomicInlineChangedCSSVariables(colors: DiffColorScheme): string;
|
|
232
|
+
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
233
|
+
export declare function buildDeletedInlineNodeCSSVariables(colors: DiffColorScheme, isActive: boolean): string;
|
|
221
234
|
/**
|
|
222
235
|
* Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`.
|
|
223
236
|
* Emitted by `wrapBlockNodeView` alongside `show-diff-deleted-node-vars` — the class is named for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.5",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"atlaskit:src": "src/index.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/adf-schema": "^57.
|
|
28
|
+
"@atlaskit/adf-schema": "^57.6.0",
|
|
29
29
|
"@atlaskit/agent-color": "^0.2.0",
|
|
30
30
|
"@atlaskit/avatar": "^28.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
41
41
|
"@atlaskit/primitives": "^22.5.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^202.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^18.2.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react-intl": "^7.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^123.
|
|
74
|
+
"@atlaskit/editor-common": "^123.5.0",
|
|
75
75
|
"react": "^18.2.0 || ^19.2.0",
|
|
76
76
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|