@atlaskit/editor-plugin-show-diff 29.0.1 → 30.0.0
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 +25 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +7 -30
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +0 -39
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +3 -16
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +3 -6
- package/dist/cjs/pm-plugins/decorations/createReplacedCellDecorations.js +0 -2
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +4 -7
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +5 -24
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +2 -4
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +1 -5
- package/dist/cjs/pm-plugins/main.js +7 -26
- package/dist/cjs/showDiffPlugin.js +0 -43
- package/dist/cjs/showDiffPluginType.js +0 -12
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +7 -30
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +0 -37
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +1 -17
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +3 -6
- package/dist/es2019/pm-plugins/decorations/createReplacedCellDecorations.js +0 -2
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +4 -7
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +6 -24
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +3 -6
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -8
- package/dist/es2019/pm-plugins/main.js +7 -27
- package/dist/es2019/showDiffPlugin.js +0 -38
- package/dist/es2019/showDiffPluginType.js +0 -12
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +7 -30
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +0 -37
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +3 -16
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +3 -6
- package/dist/esm/pm-plugins/decorations/createReplacedCellDecorations.js +0 -2
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +4 -7
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +5 -24
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +2 -4
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +1 -5
- package/dist/esm/pm-plugins/main.js +7 -26
- package/dist/esm/showDiffPlugin.js +0 -43
- package/dist/esm/showDiffPluginType.js +0 -12
- package/dist/types/entry-points/show-diff-plugin-type.d.ts +1 -1
- package/dist/types/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +1 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +0 -24
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createReplacedCellDecorations.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +3 -6
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +2 -4
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -6
- package/dist/types/showDiffPluginType.d.ts +0 -27
- package/package.json +7 -13
- package/dist/cjs/pm-plugins/decorations/revealStyles.js +0 -160
- package/dist/cjs/pm-plugins/revealAnimation.js +0 -524
- package/dist/es2019/pm-plugins/decorations/revealStyles.js +0 -143
- package/dist/es2019/pm-plugins/revealAnimation.js +0 -495
- package/dist/esm/pm-plugins/decorations/revealStyles.js +0 -153
- package/dist/esm/pm-plugins/revealAnimation.js +0 -518
- package/dist/types/pm-plugins/decorations/revealStyles.d.ts +0 -49
- package/dist/types/pm-plugins/revealAnimation.d.ts +0 -33
|
@@ -336,26 +336,15 @@ export var isDeletedContentPlacedBelow = function isDeletedContentPlacedBelow(_r
|
|
|
336
336
|
};
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* The clean view ("new state") historically only suppressed a deleted side when the same change
|
|
343
|
-
* also carried an insertion. A PURE deletion — text removed with nothing put in its place — fell
|
|
344
|
-
* through and leaked struck-through text into a view that is supposed to show none. `smart` never
|
|
345
|
-
* showed this because it pairs a rewrite into a single change that always carries an insertion;
|
|
346
|
-
* `inline` emits delete-only changes, so it did.
|
|
347
|
-
*
|
|
348
|
-
* With the gate off this returns exactly what both callers computed before it existed.
|
|
349
|
-
*
|
|
350
|
-
* Umbrella experiment: within the AI streaming UX M1 population this behaviour is only enabled
|
|
351
|
-
* for the treatment cohort. Non-AI callers (track-changes, etc.) are not enrolled and default
|
|
352
|
-
* to `true`, preserving the pre-umbrella baseline.
|
|
339
|
+
* Shared by the widget-anchor calculation and the decoration push below so the two cannot drift.
|
|
340
|
+
* The clean view ("new state") only suppresses a deleted side when the same change also carries
|
|
341
|
+
* an insertion.
|
|
353
342
|
*/
|
|
354
343
|
var shouldHideDeletedSide = function shouldHideDeletedSide(_ref7) {
|
|
355
344
|
var change = _ref7.change,
|
|
356
345
|
hideDeletedDiffs = _ref7.hideDeletedDiffs,
|
|
357
346
|
isInverted = _ref7.isInverted;
|
|
358
|
-
return !isInverted && !!hideDeletedDiffs &&
|
|
347
|
+
return !isInverted && !!hideDeletedDiffs && change.inserted.length > 0;
|
|
359
348
|
};
|
|
360
349
|
var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8) {
|
|
361
350
|
var state = _ref8.state,
|
|
@@ -380,7 +369,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
380
369
|
deletedDiffPlacement = _ref8$deletedDiffPlac === void 0 ? 'top' : _ref8$deletedDiffPlac,
|
|
381
370
|
_ref8$inlineDeletedDi = _ref8.inlineDeletedDiffPlacement,
|
|
382
371
|
inlineDeletedDiffPlacement = _ref8$inlineDeletedDi === void 0 ? 'before' : _ref8$inlineDeletedDi,
|
|
383
|
-
reveal = _ref8.reveal,
|
|
384
372
|
tagMountContext = _ref8.tagMountContext;
|
|
385
373
|
var originalDoc = pluginState.originalDoc,
|
|
386
374
|
steps = pluginState.steps,
|
|
@@ -660,7 +648,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
660
648
|
diffId: showContributorTags ? "blank-line-".concat(pos) : undefined,
|
|
661
649
|
isActive: isActive,
|
|
662
650
|
pos: pos,
|
|
663
|
-
reveal: reveal,
|
|
664
651
|
side: -1,
|
|
665
652
|
tagMountContext: tagMountContext
|
|
666
653
|
}));
|
|
@@ -718,7 +705,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
718
705
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
719
706
|
isInserted: isInserted,
|
|
720
707
|
leftAnchorId: leftAnchorId,
|
|
721
|
-
reveal: reveal,
|
|
722
708
|
shouldHideDeleted: shouldHideDeleted,
|
|
723
709
|
showContributorTags: showContributorTags,
|
|
724
710
|
showIndicators: showIndicators,
|
|
@@ -756,7 +742,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
756
742
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
757
743
|
hasDeletedWidget: willRenderDeletedWidget,
|
|
758
744
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
759
|
-
reveal: reveal,
|
|
760
745
|
tagMountContext: tagMountContext
|
|
761
746
|
})));
|
|
762
747
|
}
|
|
@@ -780,7 +765,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
780
765
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
781
766
|
hasDeletedWidget: willRenderDeletedWidget,
|
|
782
767
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
783
|
-
reveal: reveal,
|
|
784
768
|
tagMountContext: tagMountContext
|
|
785
769
|
})));
|
|
786
770
|
}
|
|
@@ -817,7 +801,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
817
801
|
deletedColumns: deletedColumns,
|
|
818
802
|
// The deleted side has no inline decoration, so the widget carries the actor.
|
|
819
803
|
attributionKey: attributionKey,
|
|
820
|
-
reveal: reveal,
|
|
821
804
|
change: change,
|
|
822
805
|
doc: originalDoc,
|
|
823
806
|
nodeViewSerializer: nodeViewSerializer,
|
|
@@ -897,7 +880,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
897
880
|
doc: tr.doc,
|
|
898
881
|
isActive: isActive,
|
|
899
882
|
isInserted: true,
|
|
900
|
-
reveal: reveal,
|
|
901
883
|
showContributorTags: showContributorTags,
|
|
902
884
|
tagMountContext: tagMountContext
|
|
903
885
|
})));
|
|
@@ -1031,8 +1013,7 @@ function (_ref14, _ref15) {
|
|
|
1031
1013
|
showIndicators = _ref16$.showIndicators,
|
|
1032
1014
|
smartThresholds = _ref16$.smartThresholds,
|
|
1033
1015
|
deletedDiffPlacement = _ref16$.deletedDiffPlacement,
|
|
1034
|
-
inlineDeletedDiffPlacement = _ref16$.inlineDeletedDiffPlacement
|
|
1035
|
-
reveal = _ref16$.reveal;
|
|
1016
|
+
inlineDeletedDiffPlacement = _ref16$.inlineDeletedDiffPlacement;
|
|
1036
1017
|
var _ref17 = _slicedToArray(_ref15, 1),
|
|
1037
1018
|
_ref17$ = _ref17[0],
|
|
1038
1019
|
lastPluginState = _ref17$.pluginState,
|
|
@@ -1047,13 +1028,9 @@ function (_ref14, _ref15) {
|
|
|
1047
1028
|
lastShowIndicators = _ref17$.showIndicators,
|
|
1048
1029
|
lastSmartThresholds = _ref17$.smartThresholds,
|
|
1049
1030
|
lastDeletedDiffPlacement = _ref17$.deletedDiffPlacement,
|
|
1050
|
-
lastInlineDeletedDiffPlacement = _ref17$.inlineDeletedDiffPlacement
|
|
1051
|
-
lastReveal = _ref17$.reveal;
|
|
1031
|
+
lastInlineDeletedDiffPlacement = _ref17$.inlineDeletedDiffPlacement;
|
|
1052
1032
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
1053
1033
|
return (_ref18 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && isEqual(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && isEqual(pluginState.stepAttributions, lastPluginState.stepAttributions) &&
|
|
1054
1034
|
// Contributors can arrive after the first calculation; without this, tags never appear.
|
|
1055
|
-
isEqual(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement &&
|
|
1056
|
-
// Turning the reveal on or off changes the emitted styles, so a cached result from the
|
|
1057
|
-
// other setting would leave the diff painted in the wrong resting state.
|
|
1058
|
-
isEqual(reveal, lastReveal)) !== null && _ref18 !== void 0 ? _ref18 : false;
|
|
1035
|
+
isEqual(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement) !== null && _ref18 !== void 0 ? _ref18 : false;
|
|
1059
1036
|
});
|
|
@@ -854,43 +854,6 @@ export function buildInsertedInlineStyle(colors, isActive, hideAddedDiffsUnderli
|
|
|
854
854
|
return hideAddedDiffsUnderline ? buildInsertStyleExtendedNoUnderline(colors) : buildInsertStyleExtended(colors);
|
|
855
855
|
}
|
|
856
856
|
|
|
857
|
-
/**
|
|
858
|
-
* The colours `buildInsertedInlineStyle()` above would paint, for the reveal to animate towards.
|
|
859
|
-
*
|
|
860
|
-
* MUST mirror that function: the reveal replaces the flat highlight with a sized gradient, so a
|
|
861
|
-
* divergence here means the animation settles on a different colour than a static render produces.
|
|
862
|
-
* `revealStyles.ts` in the test package asserts the two agree across the isActive /
|
|
863
|
-
* hideAddedDiffsUnderline matrix.
|
|
864
|
-
*
|
|
865
|
-
* A transparent border is how "no underline" is expressed: the box still reserves the 2px so the
|
|
866
|
-
* text does not shift when the underline arrives.
|
|
867
|
-
*/
|
|
868
|
-
export function getInsertedInlineRevealColors(colors, isActive, hideAddedDiffsUnderline) {
|
|
869
|
-
return {
|
|
870
|
-
background: isActive ? bgSubtlerPressed(colors.insertActiveColor) : bgSubtlest(colors.insertColor),
|
|
871
|
-
border: hideAddedDiffsUnderline ? 'transparent' : borderAccent(colors.insertColor)
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
/**
|
|
876
|
-
* The colours `buildDeletedInlineContentStyleExtended()` paints, for the reveal to animate towards.
|
|
877
|
-
* Deleted content's highlight does not vary with the active state — only its text does, which the
|
|
878
|
-
* reveal keeps as-is.
|
|
879
|
-
*/
|
|
880
|
-
export function getDeletedInlineRevealColors(colors) {
|
|
881
|
-
// Nothing to wipe in where the resting state paints no highlight.
|
|
882
|
-
if (colors.deletedInlineHighlight === 'onEmphasis') {
|
|
883
|
-
return {
|
|
884
|
-
background: 'transparent',
|
|
885
|
-
border: 'transparent'
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
return {
|
|
889
|
-
background: bgSubtlest(colors.deleteColor),
|
|
890
|
-
border: borderAccent(colors.deleteColor)
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
|
|
894
857
|
/**
|
|
895
858
|
* Value for `DELETED_HIGHLIGHT_BG_VAR` while a change is hovered — the same tint an 'always' scheme
|
|
896
859
|
* paints at rest, so hovering restores the appearance rather than introducing a third one.
|
|
@@ -14,7 +14,6 @@ import { createInlineIndicatorAnchorWidgets } from './createAnchorDecorationWidg
|
|
|
14
14
|
import { createContributorTagWidget, isContributorTagWidgetEnabled } from './createContributorTagWidget';
|
|
15
15
|
import { getAtomicInlineNodeClassNameLegacy, resolveInlineChangedStyleLegacy } from './createInlineChangedDecoration.styles.legacy';
|
|
16
16
|
import { buildDiffDecorationSpec, scrollMarginTopStyle } from './decorationKeys';
|
|
17
|
-
import { REVEAL_ATTR, resolveRevealStyle } from './revealStyles';
|
|
18
17
|
var displayNoneStyle = convertToInlineCss({
|
|
19
18
|
display: 'none'
|
|
20
19
|
});
|
|
@@ -126,7 +125,6 @@ export var getAtomicInlineChangedAttrs = function getAtomicInlineChangedAttrs(in
|
|
|
126
125
|
*/
|
|
127
126
|
|
|
128
127
|
export var createInlineChangedDecoration = function createInlineChangedDecoration(_ref2) {
|
|
129
|
-
var _revealed$style;
|
|
130
128
|
var attributionKey = _ref2.attributionKey,
|
|
131
129
|
change = _ref2.change,
|
|
132
130
|
colorScheme = _ref2.colorScheme,
|
|
@@ -151,7 +149,6 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
151
149
|
hasDeletedWidget = _ref2$hasDeletedWidge === void 0 ? false : _ref2$hasDeletedWidge,
|
|
152
150
|
_ref2$isDeletedWidget = _ref2.isDeletedWidgetBelow,
|
|
153
151
|
isDeletedWidgetBelow = _ref2$isDeletedWidget === void 0 ? false : _ref2$isDeletedWidget,
|
|
154
|
-
reveal = _ref2.reveal,
|
|
155
152
|
tagMountContext = _ref2.tagMountContext;
|
|
156
153
|
// Derived from the range so it survives a recalculation: stepping to the next/previous change
|
|
157
154
|
// rebuilds decorations without touching the doc, and a fresh id would change the React key and the
|
|
@@ -176,17 +173,7 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
176
173
|
}))];
|
|
177
174
|
}
|
|
178
175
|
var colors = getColorScheme(colorScheme);
|
|
179
|
-
|
|
180
|
-
// The reveal withholds the static highlight so the wipe has something to reveal, so it supplies
|
|
181
|
-
// the whole style rather than adding to the usual one.
|
|
182
|
-
var revealed = resolveRevealStyle({
|
|
183
|
-
colorScheme: colorScheme,
|
|
184
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
185
|
-
isActive: isActive,
|
|
186
|
-
isInserted: isInserted,
|
|
187
|
-
reveal: reveal
|
|
188
|
-
});
|
|
189
|
-
var style = (_revealed$style = revealed === null || revealed === void 0 ? void 0 : revealed.style) !== null && _revealed$style !== void 0 ? _revealed$style : resolveInlineChangedStyle({
|
|
176
|
+
var style = resolveInlineChangedStyle({
|
|
190
177
|
colors: colors,
|
|
191
178
|
colorScheme: colorScheme,
|
|
192
179
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
@@ -217,13 +204,13 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
217
204
|
mountContext: tagMountContext
|
|
218
205
|
}) : undefined;
|
|
219
206
|
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('');
|
|
220
|
-
var decorations = [Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread(
|
|
207
|
+
var decorations = [Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread({
|
|
221
208
|
style: inlineStyle
|
|
222
209
|
}, atomicInlineAttrs && {
|
|
223
210
|
class: atomicInlineAttrs.className
|
|
224
211
|
}), deletedInlineNodeAttrs && {
|
|
225
212
|
class: deletedInlineNodeAttrs.className
|
|
226
|
-
}),
|
|
213
|
+
}), {}, {
|
|
227
214
|
'data-testid': 'show-diff-changed-decoration'
|
|
228
215
|
}, (showContributorTags || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
229
216
|
'data-diff-id': diffId
|
|
@@ -171,7 +171,6 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
171
171
|
placeBelow = _ref2$placeBelow === void 0 ? false : _ref2$placeBelow,
|
|
172
172
|
_ref2$hideAddedDiffsU = _ref2.hideAddedDiffsUnderline,
|
|
173
173
|
hideAddedDiffsUnderline = _ref2$hideAddedDiffsU === void 0 ? false : _ref2$hideAddedDiffsU,
|
|
174
|
-
reveal = _ref2.reveal,
|
|
175
174
|
tagMountContext = _ref2.tagMountContext,
|
|
176
175
|
deletedColumns = _ref2.deletedColumns;
|
|
177
176
|
var slice = doc.slice(change.fromA, change.toA);
|
|
@@ -202,7 +201,6 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
202
201
|
diffId: showContributorTags ? "widget-".concat(change.fromA, "-").concat(change.toA) : undefined,
|
|
203
202
|
isActive: isActive,
|
|
204
203
|
pos: safeInsertPos,
|
|
205
|
-
reveal: reveal,
|
|
206
204
|
side: placeBelow ? 1 : -1,
|
|
207
205
|
tagMountContext: tagMountContext
|
|
208
206
|
})];
|
|
@@ -439,7 +437,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
439
437
|
// view's styles.
|
|
440
438
|
dom.append(createAtomicInlineOutline(attrOnlyNodeName, nodeView, colorScheme));
|
|
441
439
|
} else {
|
|
442
|
-
var wrapper = createContentWrapper(colorScheme, isActive, isInserted
|
|
440
|
+
var wrapper = createContentWrapper(colorScheme, isActive, isInserted);
|
|
443
441
|
wrapper.append(nodeView);
|
|
444
442
|
dom.append(wrapper);
|
|
445
443
|
}
|
|
@@ -468,12 +466,11 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
468
466
|
node: fallbackNode,
|
|
469
467
|
colorScheme: colorScheme,
|
|
470
468
|
isActive: isActive,
|
|
471
|
-
isInserted: isInserted
|
|
472
|
-
reveal: reveal
|
|
469
|
+
isInserted: isInserted
|
|
473
470
|
});
|
|
474
471
|
dom.append(injectedNode);
|
|
475
472
|
} else {
|
|
476
|
-
var _wrapper2 = createContentWrapper(colorScheme, isActive, isInserted
|
|
473
|
+
var _wrapper2 = createContentWrapper(colorScheme, isActive, isInserted);
|
|
477
474
|
_wrapper2.append(fallbackNode);
|
|
478
475
|
dom.append(_wrapper2);
|
|
479
476
|
}
|
|
@@ -323,7 +323,6 @@ export var createReplacedCellDecorations = function createReplacedCellDecoration
|
|
|
323
323
|
isDeletedWidgetBelow = _ref5.isDeletedWidgetBelow,
|
|
324
324
|
isInserted = _ref5.isInserted,
|
|
325
325
|
leftAnchorId = _ref5.leftAnchorId,
|
|
326
|
-
reveal = _ref5.reveal,
|
|
327
326
|
shouldHideDeleted = _ref5.shouldHideDeleted,
|
|
328
327
|
showContributorTags = _ref5.showContributorTags,
|
|
329
328
|
showIndicators = _ref5.showIndicators,
|
|
@@ -371,7 +370,6 @@ export var createReplacedCellDecorations = function createReplacedCellDecoration
|
|
|
371
370
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
372
371
|
isInserted: isInserted,
|
|
373
372
|
leftAnchorId: leftAnchorId,
|
|
374
|
-
reveal: reveal,
|
|
375
373
|
shouldHideDeleted: hidesLiveCell,
|
|
376
374
|
showContributorTags: showContributorTags,
|
|
377
375
|
showIndicators: showIndicators,
|
|
@@ -22,7 +22,7 @@ export var RETURN_GLYPH = '⤶';
|
|
|
22
22
|
* in for the absent content keeps the deletion visible without inventing content that was not there.
|
|
23
23
|
*
|
|
24
24
|
* `createContentWrapper` supplies the highlight and the strikethrough line, so the glyph is styled
|
|
25
|
-
* exactly like any other run of deleted inline content, including the active
|
|
25
|
+
* exactly like any other run of deleted inline content, including the active state.
|
|
26
26
|
*
|
|
27
27
|
* Hidden from assistive technology: the glyph is a picture of a key, and read out it is announced as
|
|
28
28
|
* its Unicode name rather than as a removed line.
|
|
@@ -32,8 +32,7 @@ export var createDeletedLineBreakWidget = function createDeletedLineBreakWidget(
|
|
|
32
32
|
_ref$count = _ref.count,
|
|
33
33
|
count = _ref$count === void 0 ? 1 : _ref$count,
|
|
34
34
|
_ref$isActive = _ref.isActive,
|
|
35
|
-
isActive = _ref$isActive === void 0 ? false : _ref$isActive
|
|
36
|
-
reveal = _ref.reveal;
|
|
35
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive;
|
|
37
36
|
var dom = document.createElement('span');
|
|
38
37
|
// The testid deleted content is matched by, so the glyph is found wherever deleted content is.
|
|
39
38
|
dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
|
|
@@ -48,7 +47,7 @@ export var createDeletedLineBreakWidget = function createDeletedLineBreakWidget(
|
|
|
48
47
|
// deleted-content wrapper is styled as an inline run.
|
|
49
48
|
dom.append(dom.ownerDocument.createElement('br'));
|
|
50
49
|
}
|
|
51
|
-
var wrapper = createContentWrapper(colorScheme, isActive, false
|
|
50
|
+
var wrapper = createContentWrapper(colorScheme, isActive, false);
|
|
52
51
|
wrapper.append(dom.ownerDocument.createTextNode(RETURN_GLYPH));
|
|
53
52
|
dom.append(wrapper);
|
|
54
53
|
}
|
|
@@ -73,14 +72,12 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
73
72
|
_ref2$isActive = _ref2.isActive,
|
|
74
73
|
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
75
74
|
pos = _ref2.pos,
|
|
76
|
-
reveal = _ref2.reveal,
|
|
77
75
|
side = _ref2.side,
|
|
78
76
|
tagMountContext = _ref2.tagMountContext;
|
|
79
77
|
var dom = createDeletedLineBreakWidget({
|
|
80
78
|
colorScheme: colorScheme,
|
|
81
79
|
count: count,
|
|
82
|
-
isActive: isActive
|
|
83
|
-
reveal: reveal
|
|
80
|
+
isActive: isActive
|
|
84
81
|
});
|
|
85
82
|
var tagHost = attributionKey ? createContributorTagHost({
|
|
86
83
|
diffId: diffId,
|
|
@@ -7,7 +7,6 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
8
|
import { resolveBaseNodeName } from '../../utils/baseNodeName';
|
|
9
9
|
import { getAtomicInlineChangedAttrs } from '../createInlineChangedDecoration';
|
|
10
|
-
import { applyRevealToElement } from '../revealStyles';
|
|
11
10
|
import { isInlineAttrChangeNodeName } from './getAttrChangeRanges';
|
|
12
11
|
import { applyTableCellEdgeAttrs } from './tableCellEdgeAttrs';
|
|
13
12
|
import { getChangedContentStyle, getChangedNodeStyle, getDeletedContentStyle, getDeletedContentStyleUnbounded, getInsertedContentStyle, hasRestingDeletedRing, isMultiContainerBlockNode, isTextLikeBlockNode, resolveCellOverlayStyle, resolveDeletedNodeCSSVariables, resolveNestedInsertedNodeStyle, resolveRemovedLozengeStyle } from './wrapBlockNodeViewStyles';
|
|
@@ -635,17 +634,9 @@ export var injectInnerWrapper = function injectInnerWrapper(_ref12) {
|
|
|
635
634
|
var node = _ref12.node,
|
|
636
635
|
colorScheme = _ref12.colorScheme,
|
|
637
636
|
isActive = _ref12.isActive,
|
|
638
|
-
isInserted = _ref12.isInserted
|
|
639
|
-
reveal = _ref12.reveal;
|
|
637
|
+
isInserted = _ref12.isInserted;
|
|
640
638
|
var wrapper = document.createElement('span');
|
|
641
|
-
|
|
642
|
-
colorScheme: colorScheme,
|
|
643
|
-
element: wrapper,
|
|
644
|
-
isActive: isActive !== null && isActive !== void 0 ? isActive : false,
|
|
645
|
-
isInserted: isInserted !== null && isInserted !== void 0 ? isInserted : false,
|
|
646
|
-
reveal: reveal
|
|
647
|
-
});
|
|
648
|
-
wrapper.setAttribute('style', (isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive, Boolean(revealStyle))) + revealStyle);
|
|
639
|
+
wrapper.setAttribute('style', isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive));
|
|
649
640
|
_toConsumableArray(node.childNodes).forEach(function (child) {
|
|
650
641
|
var removedChild = node.removeChild(child);
|
|
651
642
|
wrapper.append(removedChild);
|
|
@@ -660,26 +651,16 @@ export var injectInnerWrapper = function injectInnerWrapper(_ref12) {
|
|
|
660
651
|
export var createContentWrapper = function createContentWrapper(colorScheme) {
|
|
661
652
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
662
653
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
663
|
-
var reveal = arguments.length > 3 ? arguments[3] : undefined;
|
|
664
654
|
var wrapper = document.createElement('span');
|
|
665
655
|
var baseStyle = convertToInlineCss({
|
|
666
656
|
position: 'relative',
|
|
667
657
|
width: 'fit-content'
|
|
668
658
|
});
|
|
669
|
-
|
|
670
|
-
// the animation can wipe it in instead.
|
|
671
|
-
var revealStyle = applyRevealToElement({
|
|
672
|
-
colorScheme: colorScheme,
|
|
673
|
-
element: wrapper,
|
|
674
|
-
isActive: isActive,
|
|
675
|
-
isInserted: isInserted,
|
|
676
|
-
reveal: reveal
|
|
677
|
-
});
|
|
678
|
-
var deletedStyle = getDeletedContentStyle(colorScheme, isActive, Boolean(revealStyle));
|
|
659
|
+
var deletedStyle = getDeletedContentStyle(colorScheme, isActive);
|
|
679
660
|
if (isInserted) {
|
|
680
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(getInsertedContentStyle(colorScheme, isActive))
|
|
661
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat(getInsertedContentStyle(colorScheme, isActive)));
|
|
681
662
|
} else {
|
|
682
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle)
|
|
663
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle));
|
|
683
664
|
var strikethrough = document.createElement('span');
|
|
684
665
|
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
685
666
|
wrapper.append(strikethrough);
|
|
@@ -103,12 +103,11 @@ var getInsertedContentStyleNext = function getInsertedContentStyleNext(colorSche
|
|
|
103
103
|
};
|
|
104
104
|
var getDeletedContentStyleNext = function getDeletedContentStyleNext(colorScheme) {
|
|
105
105
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
106
|
-
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
107
106
|
var colors = getColorScheme(colorScheme);
|
|
108
107
|
var base = buildDeletedInlineContentStyle(colors, isActive ? 'active' : 'new');
|
|
109
108
|
|
|
110
109
|
// glyphTint adds a background highlight and border-bottom over the tint; strikethrough does not.
|
|
111
|
-
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint'
|
|
110
|
+
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint';
|
|
112
111
|
return needsExtendedHighlight ? base + buildDeletedInlineContentStyleExtended(colors, isActive) : base;
|
|
113
112
|
};
|
|
114
113
|
var resolveCellOverlayStyleNext = function resolveCellOverlayStyleNext(_ref) {
|
|
@@ -167,8 +166,7 @@ export var getInsertedContentStyle = function getInsertedContentStyle(colorSchem
|
|
|
167
166
|
/** Inline style for deleted content. */
|
|
168
167
|
export var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
169
168
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
170
|
-
|
|
171
|
-
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, omitHighlight) : getDeletedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, omitHighlight);
|
|
169
|
+
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive) : getDeletedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive);
|
|
172
170
|
};
|
|
173
171
|
|
|
174
172
|
/**
|
|
@@ -166,14 +166,10 @@ export var getInsertedContentStyleLegacy = function getInsertedContentStyleLegac
|
|
|
166
166
|
/** Pre-refactor inline style for deleted content. */
|
|
167
167
|
export var getDeletedContentStyleLegacy = function getDeletedContentStyleLegacy(colorScheme) {
|
|
168
168
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
169
|
-
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
170
169
|
if (colorScheme === 'traditional') {
|
|
171
170
|
return getDeletedTraditionalInlineStyle(isActive);
|
|
172
171
|
}
|
|
173
|
-
|
|
174
|
-
return (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew()) + deletedInlineContentStyleExtended;
|
|
175
|
-
}
|
|
176
|
-
return isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew();
|
|
172
|
+
return (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew()) + deletedInlineContentStyleExtended;
|
|
177
173
|
};
|
|
178
174
|
|
|
179
175
|
/**
|
|
@@ -16,7 +16,6 @@ import { enforceCustomStepRegisters } from './enforceCustomStepRegisters';
|
|
|
16
16
|
import { getDefaultDiffType } from './getDefaultDiffType';
|
|
17
17
|
import { getScrollableDecorations } from './getScrollableDecorations';
|
|
18
18
|
import { NodeViewSerializer } from './NodeViewSerializer';
|
|
19
|
-
import { rebindReveal } from './revealAnimation';
|
|
20
19
|
import { scrollToDecoration } from './scrollToDiff';
|
|
21
20
|
export var showDiffPluginKey = new PluginKey('showDiffPlugin');
|
|
22
21
|
/**
|
|
@@ -86,21 +85,11 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
86
85
|
var meta = tr.getMeta(showDiffPluginKey);
|
|
87
86
|
var newPluginState = currentPluginState;
|
|
88
87
|
if (meta) {
|
|
89
|
-
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF'
|
|
90
|
-
var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9
|
|
91
|
-
|
|
92
|
-
// ordinary resting style. Without it the reveal stays in state indefinitely and the
|
|
93
|
-
// next unrelated repaint re-emits the hidden, zero-width highlight with no animation
|
|
94
|
-
// left to bring it in — the highlight simply vanishes.
|
|
95
|
-
newPluginState = meta.action === 'REVEAL_COMPLETE' ? _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
96
|
-
reveal: undefined
|
|
97
|
-
}) : _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
88
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
|
|
89
|
+
var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9;
|
|
90
|
+
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
98
91
|
isDisplayingChanges: true,
|
|
99
|
-
activeIndex: undefined
|
|
100
|
-
// Explicit rather than left to the spread: an absent key in `meta` would let
|
|
101
|
-
// the previous paint's choreography leak into this one, so closing the diff
|
|
102
|
-
// would animate too.
|
|
103
|
-
reveal: meta.reveal
|
|
92
|
+
activeIndex: undefined
|
|
104
93
|
});
|
|
105
94
|
// Calculate and store decorations in state
|
|
106
95
|
var _calculateDiffDecorat = calculateDiffDecorations({
|
|
@@ -119,10 +108,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
119
108
|
showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
|
|
120
109
|
smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
|
|
121
110
|
deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement,
|
|
122
|
-
inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement
|
|
123
|
-
// SHOW_DIFF only. The scroll-to-next recalculation further down deliberately
|
|
124
|
-
// omits this so stepping through changes cannot replay the choreography.
|
|
125
|
-
reveal: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.reveal
|
|
111
|
+
inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement
|
|
126
112
|
}),
|
|
127
113
|
contributorTags = _calculateDiffDecorat.contributorTags,
|
|
128
114
|
decorations = _calculateDiffDecorat.decorations,
|
|
@@ -137,7 +123,6 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
137
123
|
isDisplayingChanges: false,
|
|
138
124
|
activeIndex: undefined,
|
|
139
125
|
contributorTags: [],
|
|
140
|
-
reveal: undefined,
|
|
141
126
|
// Per-call override — do not let it leak into the next, unrelated `showDiff` call.
|
|
142
127
|
colorScheme: undefined,
|
|
143
128
|
/**
|
|
@@ -154,7 +139,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
154
139
|
// Update the active index in plugin state and recalculate decorations
|
|
155
140
|
var _decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc);
|
|
156
141
|
if (_decorations.length > 0) {
|
|
157
|
-
var _currentPluginState$a, _newPluginState$color2,
|
|
142
|
+
var _currentPluginState$a, _newPluginState$color2, _newPluginState0;
|
|
158
143
|
// Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
|
|
159
144
|
// This allows the UI to start with no selection and only highlight on first user interaction.
|
|
160
145
|
var nextIndex = (_currentPluginState$a = currentPluginState.activeIndex) !== null && _currentPluginState$a !== void 0 ? _currentPluginState$a : -1;
|
|
@@ -184,7 +169,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
184
169
|
state: newState,
|
|
185
170
|
pluginState: newPluginState,
|
|
186
171
|
nodeViewSerializer: nodeViewSerializer,
|
|
187
|
-
colorScheme: (_newPluginState$color2 = (
|
|
172
|
+
colorScheme: (_newPluginState$color2 = (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.colorScheme) !== null && _newPluginState$color2 !== void 0 ? _newPluginState$color2 : config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
188
173
|
intl: getIntl(),
|
|
189
174
|
activeIndexPos: newPluginState.activeIndexPos,
|
|
190
175
|
api: api,
|
|
@@ -241,10 +226,6 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
241
226
|
}
|
|
242
227
|
var pluginState = showDiffPluginKey.getState(view.state);
|
|
243
228
|
|
|
244
|
-
// A repaint rebuilds inline decorations, destroying any animation bound to them, so
|
|
245
|
-
// an in-flight reveal has to be re-attached to the new nodes. No-op when idle.
|
|
246
|
-
rebindReveal(view, view.dom);
|
|
247
|
-
|
|
248
229
|
// Scroll to the first decoration when scrollIntoView was requested.
|
|
249
230
|
// Use the same filtered/position-sorted list as the active-index path
|
|
250
231
|
// so "first" reliably means the topmost scrollable diff in the document.
|
|
@@ -4,14 +4,11 @@ var _excluded = ["stepsWithAttribution", "contributorProfiles", "showContributor
|
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
7
|
import { areAttributionColorGatesEnabled, resolveContributors } from './pm-plugins/decorations/colorSchemes/attributions';
|
|
10
8
|
import { getDeletedWidgets as _getDeletedWidgets } from './pm-plugins/getDeletedWidgets';
|
|
11
9
|
import { getScrollableDecorations } from './pm-plugins/getScrollableDecorations';
|
|
12
10
|
import { createPlugin, showDiffPluginKey } from './pm-plugins/main';
|
|
13
11
|
import { resolveDiffContributors } from './pm-plugins/resolveDiffContributors';
|
|
14
|
-
import { beginReveal, cancelReveal } from './pm-plugins/revealAnimation';
|
|
15
12
|
import { IndicatorBarContentComponent } from './ui/IndicatorBar/IndicatorBarContentComponent';
|
|
16
13
|
var normalizeShowDiffParams = function normalizeShowDiffParams(params) {
|
|
17
14
|
if (!params || !('stepsWithAttribution' in params)) {
|
|
@@ -40,25 +37,6 @@ var normalizeShowDiffParams = function normalizeShowDiffParams(params) {
|
|
|
40
37
|
})
|
|
41
38
|
});
|
|
42
39
|
};
|
|
43
|
-
var prefersReducedMotion = function prefersReducedMotion() {
|
|
44
|
-
return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Resolve reveal preconditions once here so decorations and animation share one answer. If
|
|
49
|
-
* decorations think a reveal is happening but animation doesn't, highlight paints hidden forever.
|
|
50
|
-
* All preconditions resolved here (not just gate) ensures "unable to animate" means "do not reveal".
|
|
51
|
-
*
|
|
52
|
-
* Umbrella experiment: within the AI streaming UX M1 population this behaviour is only enabled
|
|
53
|
-
* for the treatment cohort. Non-AI callers (track-changes, etc.) are not enrolled and default
|
|
54
|
-
* to `true`, preserving the pre-umbrella baseline.
|
|
55
|
-
*/
|
|
56
|
-
var resolveReveal = function resolveReveal(reveal, editorView) {
|
|
57
|
-
return (
|
|
58
|
-
// Gate first, so it is the primary switch and is always observable once a reveal is requested.
|
|
59
|
-
reveal && fg('platform_editor_diff_reveal_animation') && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && editorView && typeof window !== 'undefined' && !prefersReducedMotion() ? reveal : undefined
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
40
|
export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
63
41
|
var api = _ref3.api,
|
|
64
42
|
config = _ref3.config;
|
|
@@ -82,25 +60,7 @@ export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
82
60
|
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('viewingDiff')({
|
|
83
61
|
tr: tr
|
|
84
62
|
});
|
|
85
|
-
var reveal = resolveReveal(params === null || params === void 0 ? void 0 : params.reveal, editorView);
|
|
86
|
-
|
|
87
|
-
// Capture snapshot BEFORE transaction dispatch (last moment outgoing DOM exists).
|
|
88
|
-
if (reveal && editorView) {
|
|
89
|
-
var view = editorView;
|
|
90
|
-
beginReveal({
|
|
91
|
-
editorView: view,
|
|
92
|
-
reveal: reveal,
|
|
93
|
-
onComplete: function onComplete() {
|
|
94
|
-
// Repaint without the reveal so the decorations settle into their resting
|
|
95
|
-
// style. Kept out of history: this is presentation, not an edit.
|
|
96
|
-
view.dispatch(view.state.tr.setMeta(showDiffPluginKey, {
|
|
97
|
-
action: 'REVEAL_COMPLETE'
|
|
98
|
-
}).setMeta('addToHistory', false));
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
63
|
return tr.setMeta(showDiffPluginKey, _objectSpread(_objectSpread({}, normalizeShowDiffParams(params)), {}, {
|
|
103
|
-
reveal: reveal,
|
|
104
64
|
action: 'SHOW_DIFF'
|
|
105
65
|
}));
|
|
106
66
|
};
|
|
@@ -108,9 +68,6 @@ export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
108
68
|
hideDiff: function hideDiff(_ref5) {
|
|
109
69
|
var _api$userIntent2;
|
|
110
70
|
var tr = _ref5.tr;
|
|
111
|
-
if (editorView) {
|
|
112
|
-
cancelReveal(editorView);
|
|
113
|
-
}
|
|
114
71
|
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
115
72
|
tr: tr
|
|
116
73
|
});
|
|
@@ -77,18 +77,6 @@ export var ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = true;
|
|
|
77
77
|
// Re-export the canonical `SmartDiffThresholds` declaration (single source of truth) so the
|
|
78
78
|
// public plugin types stay in sync with the smart-diff implementation.
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* How the diff is revealed when it is painted.
|
|
82
|
-
*
|
|
83
|
-
* - `phased` — the two-phase choreography used when opening the diff from a clean "new state":
|
|
84
|
-
* the outgoing state cross-fades to the incoming one while the agent highlight wipes out to the
|
|
85
|
-
* right, then every highlight wipes back in from the left.
|
|
86
|
-
*
|
|
87
|
-
* Deliberately separate from {@link DiffType}: that describes how changes are computed and grouped,
|
|
88
|
-
* this describes how the result is presented over time. Folding one into the other would make every
|
|
89
|
-
* `DiffType` consumer — version history, track-changes, publish diff — care about presentation.
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
80
|
/**
|
|
93
81
|
* Attributed alternative to `PMDiffParams`. When agent colouring is enabled, changes are grouped
|
|
94
82
|
* by `userId`, with `agentId` used as a tie-breaker.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { ColorScheme, DeletedDiffPlacement, DeletedDiffWidget, DiffAgentBrand, DiffContributorProfile, DiffParams, DiffStepAttribution, DiffType, PMDiffParams,
|
|
1
|
+
export type { ColorScheme, DeletedDiffPlacement, DeletedDiffWidget, DiffAgentBrand, DiffContributorProfile, DiffParams, DiffStepAttribution, DiffType, PMDiffParams, ShowDiffParams, ShowDiffPlugin, SmartDiffThresholds, StepWithAttribution, } from '../showDiffPluginType';
|
|
2
2
|
export { DIFF_AGENT_BRANDS } from '../showDiffPluginType';
|
|
@@ -4,7 +4,7 @@ import type { IntlShape } from 'react-intl';
|
|
|
4
4
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
5
5
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import type { ColorScheme, ContributorTagModel, DeletedDiffPlacement, DiffDescriptor, DiffType, InlineDeletedDiffPlacement,
|
|
7
|
+
import type { ColorScheme, ContributorTagModel, DeletedDiffPlacement, DiffDescriptor, DiffType, InlineDeletedDiffPlacement, ShowDiffPlugin, SmartDiffThresholds } from '../../showDiffPluginType';
|
|
8
8
|
import type { ContributorTagMountContext } from '../decorations/createContributorTagWidget';
|
|
9
9
|
import type { ShowDiffPluginState } from '../main';
|
|
10
10
|
import type { NodeViewSerializer } from '../NodeViewSerializer';
|
|
@@ -48,7 +48,6 @@ export declare const calculateDiffDecorations: MemoizedFn<({ state, pluginState,
|
|
|
48
48
|
isInverted?: boolean;
|
|
49
49
|
nodeViewSerializer: NodeViewSerializer;
|
|
50
50
|
pluginState: Omit<ShowDiffPluginState, 'decorations'>;
|
|
51
|
-
reveal?: RevealOptions;
|
|
52
51
|
showIndicators?: boolean;
|
|
53
52
|
smartThresholds?: Partial<SmartDiffThresholds>;
|
|
54
53
|
state: EditorState;
|