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