@atlaskit/editor-plugin-show-diff 13.0.11 → 13.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +259 -23
- package/dist/cjs/pm-plugins/decorations/colorSchemes/schemes.js +21 -5
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +87 -105
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +124 -0
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +15 -12
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.js +37 -0
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +109 -59
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +67 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +30 -168
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +205 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +225 -0
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +247 -23
- package/dist/es2019/pm-plugins/decorations/colorSchemes/schemes.js +20 -4
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +85 -105
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +118 -0
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +15 -12
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.js +33 -0
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +82 -37
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +62 -0
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +15 -140
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +143 -0
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +200 -0
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +248 -23
- package/dist/esm/pm-plugins/decorations/colorSchemes/schemes.js +20 -4
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +87 -105
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +118 -0
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +15 -12
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.js +32 -0
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +109 -59
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +61 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +15 -153
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +198 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +218 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +78 -6
- package/dist/types/pm-plugins/decorations/colorSchemes/schemes.d.ts +3 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +13 -3
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +14 -0
- package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.d.ts +22 -0
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +26 -0
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +39 -0
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +40 -0
- package/package.json +4 -3
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style resolution for the `wrapBlockNodeView` nodeview decorations.
|
|
3
|
+
*
|
|
4
|
+
* Every exported resolver is a single gate: the `colorSchemeRegistry` + `factory.ts`
|
|
5
|
+
* implementation when `platform_editor_show_diff_color_scheme_refactor` is on, and the verbatim
|
|
6
|
+
* pre-refactor per-scheme constants from `./wrapBlockNodeViewStyles.legacy` when it is off. The two
|
|
7
|
+
* paths are built to emit identical style strings for both shipped schemes, so this is a kill
|
|
8
|
+
* switch for a refactor rather than a behaviour experiment.
|
|
9
|
+
*
|
|
10
|
+
* On cleanup (EDITOR-8281): drop the `isExperimentEnabled` dispatch and the `*Legacy` imports,
|
|
11
|
+
* keeping the `*Next` bodies.
|
|
12
|
+
*/
|
|
13
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
|
+
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
16
|
+
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtended, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
|
|
17
|
+
import { colorSchemeRegistry, standardScheme } from '../colorSchemes/schemes';
|
|
18
|
+
import { getChangedContentStyleLegacy, getChangedNodeStyleLegacy, getDeletedContentStyleLegacy, getDeletedContentStyleUnboundedLegacy, getInsertedContentStyleLegacy, hasRestingDeletedRingLegacy, resolveCellOverlayStyleLegacy, resolveNestedInsertedNodeStyleLegacy, resolveRemovedLozengeStyleLegacy } from './wrapBlockNodeViewStyles.legacy';
|
|
19
|
+
const DEFAULT_COLOR_SCHEME = 'standard';
|
|
20
|
+
const getColorScheme = colorScheme => colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : DEFAULT_COLOR_SCHEME];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Inserted content inside a multi-container or list node always uses the standard scheme, so a
|
|
24
|
+
* traditional diff shows purple here. Pre-existing: these call sites predate traditional.
|
|
25
|
+
* Preserved as-is; see EDITOR-8281.
|
|
26
|
+
*/
|
|
27
|
+
const nestedContentScheme = standardScheme;
|
|
28
|
+
const lozengeStyle = buildDeletedLozengeStyle();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Node-name classification shared by the style resolvers below and by the routing in
|
|
32
|
+
* `wrapBlockNodeView.ts`.
|
|
33
|
+
*/
|
|
34
|
+
export const isMultiContainerBlockNode = nodeName => {
|
|
35
|
+
return ['decisionList', 'layoutSection'].includes(nodeName);
|
|
36
|
+
};
|
|
37
|
+
export const isTextLikeBlockNode = nodeName => {
|
|
38
|
+
return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
|
|
39
|
+
};
|
|
40
|
+
const getChangedContentStyleNext = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => {
|
|
41
|
+
const colors = getColorScheme(colorScheme);
|
|
42
|
+
if (isExtendedEnabled(diffType) && isInserted) {
|
|
43
|
+
return buildInsertedInlineStyle(colors, isActive, hideAddedDiffsUnderline);
|
|
44
|
+
}
|
|
45
|
+
if (isActive) {
|
|
46
|
+
return buildDeletedInlineContentStyle(colors, 'active');
|
|
47
|
+
}
|
|
48
|
+
return buildDeletedInlineContentStyle(colors, expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? 'new' : 'default');
|
|
49
|
+
};
|
|
50
|
+
const getChangedNodeStyleNext = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => {
|
|
51
|
+
const colors = getColorScheme(colorScheme);
|
|
52
|
+
if (isExtendedEnabled(diffType) && isInserted) {
|
|
53
|
+
if (isMultiContainerBlockNode(nodeName)) {
|
|
54
|
+
return hideAddedDiffsUnderline ? buildInsertStyleInBlockExtendedNoUnderline(nestedContentScheme) : buildInsertStyleInBlockExtended(nestedContentScheme);
|
|
55
|
+
}
|
|
56
|
+
if (isTextLikeBlockNode(nodeName)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return buildInsertedBlockNodeStyle(colors, 'node', isActive);
|
|
60
|
+
}
|
|
61
|
+
switch (nodeName) {
|
|
62
|
+
case 'blockquote':
|
|
63
|
+
return buildDeletedQuoteNodeWithLozengeStyle(colors, isActive);
|
|
64
|
+
case 'expand':
|
|
65
|
+
case 'decisionList':
|
|
66
|
+
return buildDeletedWrappedBlockOutline(colors, {
|
|
67
|
+
isActive,
|
|
68
|
+
isRounded: false
|
|
69
|
+
});
|
|
70
|
+
case 'panel':
|
|
71
|
+
case 'codeBlock':
|
|
72
|
+
return buildDeletedWrappedBlockOutline(colors, {
|
|
73
|
+
isActive,
|
|
74
|
+
isRounded: true
|
|
75
|
+
});
|
|
76
|
+
default:
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const getDeletedContentStyleUnboundedNext = (colorScheme, isActive = false) => buildDeletedStrikethroughLine(getColorScheme(colorScheme), isActive);
|
|
81
|
+
const getInsertedContentStyleNext = (colorScheme, isActive = false, hideAddedDiffsUnderline = false) => buildInsertedInlineStyle(getColorScheme(colorScheme), isActive, hideAddedDiffsUnderline);
|
|
82
|
+
const getDeletedContentStyleNext = (colorScheme, isActive = false, diffType) => {
|
|
83
|
+
const colors = getColorScheme(colorScheme);
|
|
84
|
+
const base = buildDeletedInlineContentStyle(colors, isActive ? 'active' : 'new');
|
|
85
|
+
|
|
86
|
+
// glyphTint adds a background highlight and border-bottom over the tint; strikethrough does not.
|
|
87
|
+
const needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' && isExtendedEnabled(diffType);
|
|
88
|
+
return needsExtendedHighlight ? base + buildDeletedInlineContentStyleExtended(colors) : base;
|
|
89
|
+
};
|
|
90
|
+
const resolveCellOverlayStyleNext = ({
|
|
91
|
+
colorScheme,
|
|
92
|
+
isInserted,
|
|
93
|
+
isRoundedTable
|
|
94
|
+
}) => {
|
|
95
|
+
const colors = getColorScheme(colorScheme);
|
|
96
|
+
|
|
97
|
+
// Square added-cell overlays follow insertedNodeEmphasis: pressed background vs accent border.
|
|
98
|
+
const addedCellStyle = isRoundedTable ? buildAddedCellOverlayRoundedStyle(colors) : colors.insertedNodeEmphasis === 'stateful' ? buildAddedCellOverlayStyleNew(colors) : buildAddedCellOverlayStyle(colors);
|
|
99
|
+
const deletedCellStyle = isRoundedTable ? buildDeletedCellOverlayRoundedStyle(colors) : buildDeletedCellOverlayStyle(colors);
|
|
100
|
+
return isInserted ? addedCellStyle : deletedCellStyle;
|
|
101
|
+
};
|
|
102
|
+
const resolveRemovedLozengeStyleNext = (colorScheme, isActive) => isActive ? buildDeletedLozengeActiveStyle(getColorScheme(colorScheme)) : lozengeStyle;
|
|
103
|
+
const resolveNestedInsertedNodeStyleNext = () => buildInsertStyleNode(nestedContentScheme);
|
|
104
|
+
|
|
105
|
+
// Only 'stateful' schemes have a resting ring.
|
|
106
|
+
const hasRestingDeletedRingNext = colorScheme => getColorScheme(colorScheme).deletedNodeEmphasis === 'stateful';
|
|
107
|
+
|
|
108
|
+
/** Inline content style for a changed (inserted or deleted) block node. */
|
|
109
|
+
export const getChangedContentStyle = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline) : getChangedContentStyleLegacy(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
110
|
+
|
|
111
|
+
/** Node-specific style for a changed block node, or `undefined` when the node type has none. */
|
|
112
|
+
export const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) : getChangedNodeStyleLegacy(nodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
113
|
+
|
|
114
|
+
/** The positioned line drawn across deleted content spanning an unbounded range. */
|
|
115
|
+
export const getDeletedContentStyleUnbounded = (colorScheme, isActive = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleUnboundedNext(colorScheme, isActive) : getDeletedContentStyleUnboundedLegacy(colorScheme, isActive);
|
|
116
|
+
|
|
117
|
+
/** Inline style for inserted content. */
|
|
118
|
+
export const getInsertedContentStyle = (colorScheme, isActive = false, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getInsertedContentStyleNext(colorScheme, isActive, hideAddedDiffsUnderline) : getInsertedContentStyleLegacy(colorScheme, isActive, hideAddedDiffsUnderline);
|
|
119
|
+
|
|
120
|
+
/** Inline style for deleted content. */
|
|
121
|
+
export const getDeletedContentStyle = (colorScheme, isActive = false, diffType) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, diffType) : getDeletedContentStyleLegacy(colorScheme, isActive, diffType);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Overlay style for one added or deleted table cell. Invariant across the cells of a table, so the
|
|
125
|
+
* `querySelectorAll('td, th')` loop in `wrapBlockNodeView.ts` resolves it once.
|
|
126
|
+
*/
|
|
127
|
+
export const resolveCellOverlayStyle = args => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? resolveCellOverlayStyleNext(args) : resolveCellOverlayStyleLegacy(args);
|
|
128
|
+
|
|
129
|
+
/** Inner style for the "Removed" lozenge on a deleted block node. */
|
|
130
|
+
export const resolveRemovedLozengeStyle = (colorScheme, isActive) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? resolveRemovedLozengeStyleNext(colorScheme, isActive) : resolveRemovedLozengeStyleLegacy(colorScheme, isActive);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Style for inserted content nested inside a multi-container or list node — the `decisionList` and
|
|
134
|
+
* `taskList` `li`s and the `layoutSection` columns. Scheme-independent: see
|
|
135
|
+
* `nestedContentScheme` above.
|
|
136
|
+
*/
|
|
137
|
+
export const resolveNestedInsertedNodeStyle = () => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? resolveNestedInsertedNodeStyleNext() : resolveNestedInsertedNodeStyleLegacy();
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Whether the colour scheme draws a resting (non-active) ring on a deleted media/embed node, which
|
|
141
|
+
* is what the `show-diff-deleted-outline-new` class styles in editor-core's smartCardStyles.
|
|
142
|
+
*/
|
|
143
|
+
export const hasRestingDeletedRing = colorScheme => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? hasRestingDeletedRingNext(colorScheme) : hasRestingDeletedRingLegacy(colorScheme);
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-refactor code preserved for the OFF cohort of
|
|
3
|
+
* `platform_editor_show_diff_color_scheme_refactor`.
|
|
4
|
+
*
|
|
5
|
+
* These resolvers hold, verbatim, the per-scheme string-constant style decisions that
|
|
6
|
+
* `wrapBlockNodeView.ts` made before the `colorSchemeRegistry` + `factory.ts` migration — same
|
|
7
|
+
* branches, same ternaries, same order, same shim constants, same module-level constants.
|
|
8
|
+
*
|
|
9
|
+
* Do not modify. Delete this file at experiment cleanup, together with `colorSchemes/standard.ts`,
|
|
10
|
+
* `colorSchemes/traditional.ts` (EDITOR-8281).
|
|
11
|
+
*/
|
|
12
|
+
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
15
|
+
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from '../colorSchemes/standard';
|
|
16
|
+
import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayRoundedStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from '../colorSchemes/traditional';
|
|
17
|
+
const lozengeStyle = convertToInlineCss({
|
|
18
|
+
display: 'inline-flex',
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
position: 'static',
|
|
21
|
+
blockSize: 'min-content',
|
|
22
|
+
borderRadius: "var(--ds-radius-small, 4px)",
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
25
|
+
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
26
|
+
backgroundColor: "var(--ds-background-accent-gray-subtler, #DDDEE1)",
|
|
27
|
+
font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
28
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
29
|
+
textOverflow: 'ellipsis',
|
|
30
|
+
whiteSpace: 'nowrap',
|
|
31
|
+
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
32
|
+
});
|
|
33
|
+
const lozengeStyleActiveStandard = convertToInlineCss({
|
|
34
|
+
display: 'inline-flex',
|
|
35
|
+
boxSizing: 'border-box',
|
|
36
|
+
position: 'static',
|
|
37
|
+
blockSize: 'min-content',
|
|
38
|
+
borderRadius: "var(--ds-radius-small, 4px)",
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
41
|
+
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
42
|
+
backgroundColor: "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
43
|
+
font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
44
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
45
|
+
textOverflow: 'ellipsis',
|
|
46
|
+
whiteSpace: 'nowrap',
|
|
47
|
+
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
48
|
+
});
|
|
49
|
+
const lozengeStyleActiveTraditional = convertToInlineCss({
|
|
50
|
+
display: 'inline-flex',
|
|
51
|
+
boxSizing: 'border-box',
|
|
52
|
+
position: 'static',
|
|
53
|
+
blockSize: 'min-content',
|
|
54
|
+
borderRadius: "var(--ds-radius-small, 4px)",
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
57
|
+
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
58
|
+
backgroundColor: "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
59
|
+
font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
60
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
61
|
+
textOverflow: 'ellipsis',
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Frozen copies of the two node-name predicates `getChangedNodeStyle` branched on pre-refactor.
|
|
68
|
+
* The live copies are exported from `./wrapBlockNodeViewStyles`; these exist so this module stays
|
|
69
|
+
* self-contained (and so the OFF cohort keeps the exact pre-refactor classification) and go away
|
|
70
|
+
* with the rest of the file at cleanup.
|
|
71
|
+
*/
|
|
72
|
+
const isMultiContainerBlockNode = nodeName => {
|
|
73
|
+
return ['decisionList', 'layoutSection'].includes(nodeName);
|
|
74
|
+
};
|
|
75
|
+
const isTextLikeBlockNode = nodeName => {
|
|
76
|
+
return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** Pre-refactor inline content style for a changed (inserted or deleted) block node. */
|
|
80
|
+
export const getChangedContentStyleLegacy = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => {
|
|
81
|
+
if (isExtendedEnabled(diffType) && isInserted) {
|
|
82
|
+
if (colorScheme === 'traditional') {
|
|
83
|
+
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
84
|
+
}
|
|
85
|
+
return isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
86
|
+
}
|
|
87
|
+
if (colorScheme === 'traditional') {
|
|
88
|
+
return getDeletedTraditionalInlineStyle(isActive);
|
|
89
|
+
}
|
|
90
|
+
if (isActive) {
|
|
91
|
+
return deletedContentStyleActive;
|
|
92
|
+
}
|
|
93
|
+
return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNew : deletedContentStyle;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** Pre-refactor node-specific style for a changed block node. */
|
|
97
|
+
export const getChangedNodeStyleLegacy = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => {
|
|
98
|
+
const isTraditional = colorScheme === 'traditional';
|
|
99
|
+
if (isExtendedEnabled(diffType) && isInserted) {
|
|
100
|
+
if (isMultiContainerBlockNode(nodeName)) {
|
|
101
|
+
return hideAddedDiffsUnderline ? editingContentStyleInBlockExtendedNoUnderline : editingContentStyleInBlockExtended;
|
|
102
|
+
}
|
|
103
|
+
if (isTextLikeBlockNode(nodeName)) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
if (isTraditional) {
|
|
107
|
+
return isActive ? traditionalStyleNodeActive : traditionalStyleNodeNew;
|
|
108
|
+
}
|
|
109
|
+
return editingStyleNode;
|
|
110
|
+
}
|
|
111
|
+
switch (nodeName) {
|
|
112
|
+
case 'blockquote':
|
|
113
|
+
if (isTraditional) {
|
|
114
|
+
return isActive ? deletedTraditionalStyleQuoteNodeActive : deletedTraditionalStyleQuoteNode;
|
|
115
|
+
}
|
|
116
|
+
return isActive ? deletedStyleQuoteNodeWithLozengeActive : deletedStyleQuoteNodeWithLozenge;
|
|
117
|
+
case 'expand':
|
|
118
|
+
case 'decisionList':
|
|
119
|
+
if (isTraditional) {
|
|
120
|
+
return isActive ? deletedTraditionalBlockOutlineActive : deletedTraditionalBlockOutlineNew;
|
|
121
|
+
}
|
|
122
|
+
return isActive ? deletedBlockOutlineActive : deletedBlockOutline;
|
|
123
|
+
case 'panel':
|
|
124
|
+
case 'codeBlock':
|
|
125
|
+
if (isTraditional) {
|
|
126
|
+
return isActive ? deletedTraditionalBlockOutlineRoundedActive : deletedTraditionalBlockOutlineRoundedNew;
|
|
127
|
+
}
|
|
128
|
+
return isActive ? deletedBlockOutlineRoundedActive : deletedBlockOutlineRounded;
|
|
129
|
+
default:
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** Pre-refactor unbounded strikethrough line for deleted content. */
|
|
135
|
+
export const getDeletedContentStyleUnboundedLegacy = (colorScheme, isActive = false) => {
|
|
136
|
+
if (colorScheme === 'traditional' && isActive) {
|
|
137
|
+
return deletedTraditionalContentStyleUnboundedActive;
|
|
138
|
+
}
|
|
139
|
+
return colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** Pre-refactor inline style for inserted content. */
|
|
143
|
+
export const getInsertedContentStyleLegacy = (colorScheme, isActive = false, hideAddedDiffsUnderline = false) => {
|
|
144
|
+
if (colorScheme === 'traditional') {
|
|
145
|
+
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
146
|
+
}
|
|
147
|
+
if (isActive) {
|
|
148
|
+
return hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended;
|
|
149
|
+
}
|
|
150
|
+
return hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** Pre-refactor inline style for deleted content. */
|
|
154
|
+
export const getDeletedContentStyleLegacy = (colorScheme, isActive = false, diffType) => {
|
|
155
|
+
if (colorScheme === 'traditional') {
|
|
156
|
+
return getDeletedTraditionalInlineStyle(isActive);
|
|
157
|
+
}
|
|
158
|
+
if (isExtendedEnabled(diffType)) {
|
|
159
|
+
return (isActive ? deletedContentStyleActive : deletedContentStyleNew) + deletedInlineContentStyleExtended;
|
|
160
|
+
}
|
|
161
|
+
return isActive ? deletedContentStyleActive : deletedContentStyleNew;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Pre-refactor table-cell overlay style, as chosen inside the `querySelectorAll('td, th')` loop of
|
|
166
|
+
* `applyCellOverlayStyles`. The choice does not vary per cell, so hoisting it out of the loop is
|
|
167
|
+
* behaviour-preserving.
|
|
168
|
+
*
|
|
169
|
+
* NOTE: not interchangeable with the same-named resolver in
|
|
170
|
+
* `createChangedRowDecorationWidgets.styles.legacy.ts`. The two pre-refactor call sites disagreed
|
|
171
|
+
* for the traditional non-rounded added cell — the nodeview path (here) used
|
|
172
|
+
* `traditionalAddedCellOverlayStyleNew`, the row-widget path used `traditionalAddedCellOverlayStyle`.
|
|
173
|
+
* Preserved as-is.
|
|
174
|
+
*/
|
|
175
|
+
export const resolveCellOverlayStyleLegacy = ({
|
|
176
|
+
colorScheme,
|
|
177
|
+
isInserted,
|
|
178
|
+
isRoundedTable
|
|
179
|
+
}) => {
|
|
180
|
+
const isTraditional = colorScheme === 'traditional';
|
|
181
|
+
const deletedCellStyle = isTraditional ? isRoundedTable ? deletedTraditionalCellOverlayRoundedStyle : deletedTraditionalCellOverlayStyle : isRoundedTable ? deletedCellOverlayRoundedStyle : deletedCellOverlayStyle;
|
|
182
|
+
const addedCellStyle = isTraditional ? isRoundedTable ? traditionalAddedCellOverlayRoundedStyle : traditionalAddedCellOverlayStyleNew : isRoundedTable ? addedCellOverlayRoundedStyle : addedCellOverlayStyle;
|
|
183
|
+
return isInserted ? addedCellStyle : deletedCellStyle;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/** Pre-refactor inner style for the "Removed" lozenge on a deleted block node. */
|
|
187
|
+
export const resolveRemovedLozengeStyleLegacy = (colorScheme, isActive) => isActive && colorScheme === 'traditional' ? lozengeStyleActiveTraditional : isActive ? lozengeStyleActiveStandard : lozengeStyle;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Pre-refactor style for inserted content nested inside a multi-container or list node (the
|
|
191
|
+
* `decisionList` / `layoutSection` / `taskList` children). Always the standard scheme's node
|
|
192
|
+
* outline, in every colour scheme.
|
|
193
|
+
*/
|
|
194
|
+
export const resolveNestedInsertedNodeStyleLegacy = () => editingStyleNode;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Pre-refactor scheme predicate behind `maybeAddDeletedOutlineNewClass`. The `!isActive` half of
|
|
198
|
+
* the original condition stays at the call site in `wrapBlockNodeView.ts`.
|
|
199
|
+
*/
|
|
200
|
+
export const hasRestingDeletedRingLegacy = colorScheme => colorScheme === 'traditional';
|