@atlaskit/editor-plugin-show-diff 29.0.2 → 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 +19 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 30.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`113b5bcc64f0c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/113b5bcc64f0c) -
|
|
8
|
+
Remove the platform_editor_diff_reveal_animation feature gate and the unused diff reveal
|
|
9
|
+
animation. Removes the `RevealMode` and `RevealOptions` types and the `PMDiffParams` `reveal`
|
|
10
|
+
option.
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`ded1801d8ed0c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ded1801d8ed0c) -
|
|
15
|
+
Remove the platform_editor_diff_hide_pure_deletions feature gate. The clean diff view keeps its
|
|
16
|
+
existing behaviour.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 29.0.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -343,26 +343,15 @@ var isDeletedContentPlacedBelow = exports.isDeletedContentPlacedBelow = function
|
|
|
343
343
|
};
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* The clean view ("new state") historically only suppressed a deleted side when the same change
|
|
350
|
-
* also carried an insertion. A PURE deletion — text removed with nothing put in its place — fell
|
|
351
|
-
* through and leaked struck-through text into a view that is supposed to show none. `smart` never
|
|
352
|
-
* showed this because it pairs a rewrite into a single change that always carries an insertion;
|
|
353
|
-
* `inline` emits delete-only changes, so it did.
|
|
354
|
-
*
|
|
355
|
-
* With the gate off this returns exactly what both callers computed before it existed.
|
|
356
|
-
*
|
|
357
|
-
* Umbrella experiment: within the AI streaming UX M1 population this behaviour is only enabled
|
|
358
|
-
* for the treatment cohort. Non-AI callers (track-changes, etc.) are not enrolled and default
|
|
359
|
-
* to `true`, preserving the pre-umbrella baseline.
|
|
346
|
+
* Shared by the widget-anchor calculation and the decoration push below so the two cannot drift.
|
|
347
|
+
* The clean view ("new state") only suppresses a deleted side when the same change also carries
|
|
348
|
+
* an insertion.
|
|
360
349
|
*/
|
|
361
350
|
var shouldHideDeletedSide = function shouldHideDeletedSide(_ref7) {
|
|
362
351
|
var change = _ref7.change,
|
|
363
352
|
hideDeletedDiffs = _ref7.hideDeletedDiffs,
|
|
364
353
|
isInverted = _ref7.isInverted;
|
|
365
|
-
return !isInverted && !!hideDeletedDiffs &&
|
|
354
|
+
return !isInverted && !!hideDeletedDiffs && change.inserted.length > 0;
|
|
366
355
|
};
|
|
367
356
|
var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8) {
|
|
368
357
|
var state = _ref8.state,
|
|
@@ -387,7 +376,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
387
376
|
deletedDiffPlacement = _ref8$deletedDiffPlac === void 0 ? 'top' : _ref8$deletedDiffPlac,
|
|
388
377
|
_ref8$inlineDeletedDi = _ref8.inlineDeletedDiffPlacement,
|
|
389
378
|
inlineDeletedDiffPlacement = _ref8$inlineDeletedDi === void 0 ? 'before' : _ref8$inlineDeletedDi,
|
|
390
|
-
reveal = _ref8.reveal,
|
|
391
379
|
tagMountContext = _ref8.tagMountContext;
|
|
392
380
|
var originalDoc = pluginState.originalDoc,
|
|
393
381
|
steps = pluginState.steps,
|
|
@@ -667,7 +655,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
667
655
|
diffId: showContributorTags ? "blank-line-".concat(pos) : undefined,
|
|
668
656
|
isActive: isActive,
|
|
669
657
|
pos: pos,
|
|
670
|
-
reveal: reveal,
|
|
671
658
|
side: -1,
|
|
672
659
|
tagMountContext: tagMountContext
|
|
673
660
|
}));
|
|
@@ -725,7 +712,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
725
712
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
726
713
|
isInserted: isInserted,
|
|
727
714
|
leftAnchorId: leftAnchorId,
|
|
728
|
-
reveal: reveal,
|
|
729
715
|
shouldHideDeleted: shouldHideDeleted,
|
|
730
716
|
showContributorTags: showContributorTags,
|
|
731
717
|
showIndicators: showIndicators,
|
|
@@ -763,7 +749,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
763
749
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
764
750
|
hasDeletedWidget: willRenderDeletedWidget,
|
|
765
751
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
766
|
-
reveal: reveal,
|
|
767
752
|
tagMountContext: tagMountContext
|
|
768
753
|
})));
|
|
769
754
|
}
|
|
@@ -787,7 +772,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
787
772
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
788
773
|
hasDeletedWidget: willRenderDeletedWidget,
|
|
789
774
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
790
|
-
reveal: reveal,
|
|
791
775
|
tagMountContext: tagMountContext
|
|
792
776
|
})));
|
|
793
777
|
}
|
|
@@ -824,7 +808,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
824
808
|
deletedColumns: deletedColumns,
|
|
825
809
|
// The deleted side has no inline decoration, so the widget carries the actor.
|
|
826
810
|
attributionKey: attributionKey,
|
|
827
|
-
reveal: reveal,
|
|
828
811
|
change: change,
|
|
829
812
|
doc: originalDoc,
|
|
830
813
|
nodeViewSerializer: nodeViewSerializer,
|
|
@@ -904,7 +887,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
904
887
|
doc: tr.doc,
|
|
905
888
|
isActive: isActive,
|
|
906
889
|
isInserted: true,
|
|
907
|
-
reveal: reveal,
|
|
908
890
|
showContributorTags: showContributorTags,
|
|
909
891
|
tagMountContext: tagMountContext
|
|
910
892
|
})));
|
|
@@ -1038,8 +1020,7 @@ function (_ref14, _ref15) {
|
|
|
1038
1020
|
showIndicators = _ref16$.showIndicators,
|
|
1039
1021
|
smartThresholds = _ref16$.smartThresholds,
|
|
1040
1022
|
deletedDiffPlacement = _ref16$.deletedDiffPlacement,
|
|
1041
|
-
inlineDeletedDiffPlacement = _ref16$.inlineDeletedDiffPlacement
|
|
1042
|
-
reveal = _ref16$.reveal;
|
|
1023
|
+
inlineDeletedDiffPlacement = _ref16$.inlineDeletedDiffPlacement;
|
|
1043
1024
|
var _ref17 = (0, _slicedToArray2.default)(_ref15, 1),
|
|
1044
1025
|
_ref17$ = _ref17[0],
|
|
1045
1026
|
lastPluginState = _ref17$.pluginState,
|
|
@@ -1054,13 +1035,9 @@ function (_ref14, _ref15) {
|
|
|
1054
1035
|
lastShowIndicators = _ref17$.showIndicators,
|
|
1055
1036
|
lastSmartThresholds = _ref17$.smartThresholds,
|
|
1056
1037
|
lastDeletedDiffPlacement = _ref17$.deletedDiffPlacement,
|
|
1057
|
-
lastInlineDeletedDiffPlacement = _ref17$.inlineDeletedDiffPlacement
|
|
1058
|
-
lastReveal = _ref17$.reveal;
|
|
1038
|
+
lastInlineDeletedDiffPlacement = _ref17$.inlineDeletedDiffPlacement;
|
|
1059
1039
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
1060
1040
|
return (_ref18 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && (0, _isEqual.default)(pluginState.stepAttributions, lastPluginState.stepAttributions) &&
|
|
1061
1041
|
// Contributors can arrive after the first calculation; without this, tags never appear.
|
|
1062
|
-
(0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement &&
|
|
1063
|
-
// Turning the reveal on or off changes the emitted styles, so a cached result from the
|
|
1064
|
-
// other setting would leave the diff painted in the wrong resting state.
|
|
1065
|
-
(0, _isEqual.default)(reveal, lastReveal)) !== null && _ref18 !== void 0 ? _ref18 : false;
|
|
1042
|
+
(0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement) !== null && _ref18 !== void 0 ? _ref18 : false;
|
|
1066
1043
|
});
|
|
@@ -73,8 +73,6 @@ exports.getAccentBorderColor = getAccentBorderColor;
|
|
|
73
73
|
exports.getAccentTokens = getAccentTokens;
|
|
74
74
|
exports.getDeletedHighlightHoverBorderColor = getDeletedHighlightHoverBorderColor;
|
|
75
75
|
exports.getDeletedHighlightHoverColor = getDeletedHighlightHoverColor;
|
|
76
|
-
exports.getDeletedInlineRevealColors = getDeletedInlineRevealColors;
|
|
77
|
-
exports.getInsertedInlineRevealColors = getInsertedInlineRevealColors;
|
|
78
76
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
79
77
|
var _agentBrandColorSchemes = require("@atlaskit/agent-color/agent-brand-color-schemes");
|
|
80
78
|
var _cssHelper = require("@atlaskit/editor-common/css-helper");
|
|
@@ -931,43 +929,6 @@ function buildInsertedInlineStyle(colors, isActive, hideAddedDiffsUnderline) {
|
|
|
931
929
|
return hideAddedDiffsUnderline ? buildInsertStyleExtendedNoUnderline(colors) : buildInsertStyleExtended(colors);
|
|
932
930
|
}
|
|
933
931
|
|
|
934
|
-
/**
|
|
935
|
-
* The colours `buildInsertedInlineStyle()` above would paint, for the reveal to animate towards.
|
|
936
|
-
*
|
|
937
|
-
* MUST mirror that function: the reveal replaces the flat highlight with a sized gradient, so a
|
|
938
|
-
* divergence here means the animation settles on a different colour than a static render produces.
|
|
939
|
-
* `revealStyles.ts` in the test package asserts the two agree across the isActive /
|
|
940
|
-
* hideAddedDiffsUnderline matrix.
|
|
941
|
-
*
|
|
942
|
-
* A transparent border is how "no underline" is expressed: the box still reserves the 2px so the
|
|
943
|
-
* text does not shift when the underline arrives.
|
|
944
|
-
*/
|
|
945
|
-
function getInsertedInlineRevealColors(colors, isActive, hideAddedDiffsUnderline) {
|
|
946
|
-
return {
|
|
947
|
-
background: isActive ? bgSubtlerPressed(colors.insertActiveColor) : bgSubtlest(colors.insertColor),
|
|
948
|
-
border: hideAddedDiffsUnderline ? 'transparent' : borderAccent(colors.insertColor)
|
|
949
|
-
};
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* The colours `buildDeletedInlineContentStyleExtended()` paints, for the reveal to animate towards.
|
|
954
|
-
* Deleted content's highlight does not vary with the active state — only its text does, which the
|
|
955
|
-
* reveal keeps as-is.
|
|
956
|
-
*/
|
|
957
|
-
function getDeletedInlineRevealColors(colors) {
|
|
958
|
-
// Nothing to wipe in where the resting state paints no highlight.
|
|
959
|
-
if (colors.deletedInlineHighlight === 'onEmphasis') {
|
|
960
|
-
return {
|
|
961
|
-
background: 'transparent',
|
|
962
|
-
border: 'transparent'
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
return {
|
|
966
|
-
background: bgSubtlest(colors.deleteColor),
|
|
967
|
-
border: borderAccent(colors.deleteColor)
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
|
|
971
932
|
/**
|
|
972
933
|
* Value for `DELETED_HIGHLIGHT_BG_VAR` while a change is hovered — the same tint an 'always' scheme
|
|
973
934
|
* paints at rest, so hovering restores the appearance rather than introducing a third one.
|
|
@@ -19,7 +19,6 @@ var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
|
|
|
19
19
|
var _createContributorTagWidget = require("./createContributorTagWidget");
|
|
20
20
|
var _createInlineChangedDecorationStyles = require("./createInlineChangedDecoration.styles.legacy");
|
|
21
21
|
var _decorationKeys = require("./decorationKeys");
|
|
22
|
-
var _revealStyles = require("./revealStyles");
|
|
23
22
|
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; }
|
|
24
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
24
|
var displayNoneStyle = (0, _cssHelper.convertToInlineCss)({
|
|
@@ -133,7 +132,6 @@ var getAtomicInlineChangedAttrs = exports.getAtomicInlineChangedAttrs = function
|
|
|
133
132
|
*/
|
|
134
133
|
|
|
135
134
|
var createInlineChangedDecoration = exports.createInlineChangedDecoration = function createInlineChangedDecoration(_ref2) {
|
|
136
|
-
var _revealed$style;
|
|
137
135
|
var attributionKey = _ref2.attributionKey,
|
|
138
136
|
change = _ref2.change,
|
|
139
137
|
colorScheme = _ref2.colorScheme,
|
|
@@ -158,7 +156,6 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
158
156
|
hasDeletedWidget = _ref2$hasDeletedWidge === void 0 ? false : _ref2$hasDeletedWidge,
|
|
159
157
|
_ref2$isDeletedWidget = _ref2.isDeletedWidgetBelow,
|
|
160
158
|
isDeletedWidgetBelow = _ref2$isDeletedWidget === void 0 ? false : _ref2$isDeletedWidget,
|
|
161
|
-
reveal = _ref2.reveal,
|
|
162
159
|
tagMountContext = _ref2.tagMountContext;
|
|
163
160
|
// Derived from the range so it survives a recalculation: stepping to the next/previous change
|
|
164
161
|
// rebuilds decorations without touching the doc, and a fresh id would change the React key and the
|
|
@@ -183,17 +180,7 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
183
180
|
}))];
|
|
184
181
|
}
|
|
185
182
|
var colors = getColorScheme(colorScheme);
|
|
186
|
-
|
|
187
|
-
// The reveal withholds the static highlight so the wipe has something to reveal, so it supplies
|
|
188
|
-
// the whole style rather than adding to the usual one.
|
|
189
|
-
var revealed = (0, _revealStyles.resolveRevealStyle)({
|
|
190
|
-
colorScheme: colorScheme,
|
|
191
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
192
|
-
isActive: isActive,
|
|
193
|
-
isInserted: isInserted,
|
|
194
|
-
reveal: reveal
|
|
195
|
-
});
|
|
196
|
-
var style = (_revealed$style = revealed === null || revealed === void 0 ? void 0 : revealed.style) !== null && _revealed$style !== void 0 ? _revealed$style : resolveInlineChangedStyle({
|
|
183
|
+
var style = resolveInlineChangedStyle({
|
|
197
184
|
colors: colors,
|
|
198
185
|
colorScheme: colorScheme,
|
|
199
186
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
@@ -224,13 +211,13 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
224
211
|
mountContext: tagMountContext
|
|
225
212
|
}) : undefined;
|
|
226
213
|
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? _decorationKeys.scrollMarginTopStyle : undefined].filter(Boolean).join('');
|
|
227
|
-
var decorations = [_view.Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread(
|
|
214
|
+
var decorations = [_view.Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread({
|
|
228
215
|
style: inlineStyle
|
|
229
216
|
}, atomicInlineAttrs && {
|
|
230
217
|
class: atomicInlineAttrs.className
|
|
231
218
|
}), deletedInlineNodeAttrs && {
|
|
232
219
|
class: deletedInlineNodeAttrs.className
|
|
233
|
-
}),
|
|
220
|
+
}), {}, {
|
|
234
221
|
'data-testid': 'show-diff-changed-decoration'
|
|
235
222
|
}, (showContributorTags || (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) && {
|
|
236
223
|
'data-diff-id': diffId
|
|
@@ -177,7 +177,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
177
177
|
placeBelow = _ref2$placeBelow === void 0 ? false : _ref2$placeBelow,
|
|
178
178
|
_ref2$hideAddedDiffsU = _ref2.hideAddedDiffsUnderline,
|
|
179
179
|
hideAddedDiffsUnderline = _ref2$hideAddedDiffsU === void 0 ? false : _ref2$hideAddedDiffsU,
|
|
180
|
-
reveal = _ref2.reveal,
|
|
181
180
|
tagMountContext = _ref2.tagMountContext,
|
|
182
181
|
deletedColumns = _ref2.deletedColumns;
|
|
183
182
|
var slice = doc.slice(change.fromA, change.toA);
|
|
@@ -208,7 +207,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
208
207
|
diffId: showContributorTags ? "widget-".concat(change.fromA, "-").concat(change.toA) : undefined,
|
|
209
208
|
isActive: isActive,
|
|
210
209
|
pos: safeInsertPos,
|
|
211
|
-
reveal: reveal,
|
|
212
210
|
side: placeBelow ? 1 : -1,
|
|
213
211
|
tagMountContext: tagMountContext
|
|
214
212
|
})];
|
|
@@ -445,7 +443,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
445
443
|
// view's styles.
|
|
446
444
|
dom.append(createAtomicInlineOutline(attrOnlyNodeName, nodeView, colorScheme));
|
|
447
445
|
} else {
|
|
448
|
-
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted
|
|
446
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted);
|
|
449
447
|
wrapper.append(nodeView);
|
|
450
448
|
dom.append(wrapper);
|
|
451
449
|
}
|
|
@@ -474,12 +472,11 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
474
472
|
node: fallbackNode,
|
|
475
473
|
colorScheme: colorScheme,
|
|
476
474
|
isActive: isActive,
|
|
477
|
-
isInserted: isInserted
|
|
478
|
-
reveal: reveal
|
|
475
|
+
isInserted: isInserted
|
|
479
476
|
});
|
|
480
477
|
dom.append(injectedNode);
|
|
481
478
|
} else {
|
|
482
|
-
var _wrapper2 = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted
|
|
479
|
+
var _wrapper2 = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted);
|
|
483
480
|
_wrapper2.append(fallbackNode);
|
|
484
481
|
dom.append(_wrapper2);
|
|
485
482
|
}
|
|
@@ -330,7 +330,6 @@ var createReplacedCellDecorations = exports.createReplacedCellDecorations = func
|
|
|
330
330
|
isDeletedWidgetBelow = _ref5.isDeletedWidgetBelow,
|
|
331
331
|
isInserted = _ref5.isInserted,
|
|
332
332
|
leftAnchorId = _ref5.leftAnchorId,
|
|
333
|
-
reveal = _ref5.reveal,
|
|
334
333
|
shouldHideDeleted = _ref5.shouldHideDeleted,
|
|
335
334
|
showContributorTags = _ref5.showContributorTags,
|
|
336
335
|
showIndicators = _ref5.showIndicators,
|
|
@@ -378,7 +377,6 @@ var createReplacedCellDecorations = exports.createReplacedCellDecorations = func
|
|
|
378
377
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
379
378
|
isInserted: isInserted,
|
|
380
379
|
leftAnchorId: leftAnchorId,
|
|
381
|
-
reveal: reveal,
|
|
382
380
|
shouldHideDeleted: hidesLiveCell,
|
|
383
381
|
showContributorTags: showContributorTags,
|
|
384
382
|
showIndicators: showIndicators,
|
|
@@ -28,7 +28,7 @@ var RETURN_GLYPH = exports.RETURN_GLYPH = '⤶';
|
|
|
28
28
|
* in for the absent content keeps the deletion visible without inventing content that was not there.
|
|
29
29
|
*
|
|
30
30
|
* `createContentWrapper` supplies the highlight and the strikethrough line, so the glyph is styled
|
|
31
|
-
* exactly like any other run of deleted inline content, including the active
|
|
31
|
+
* exactly like any other run of deleted inline content, including the active state.
|
|
32
32
|
*
|
|
33
33
|
* Hidden from assistive technology: the glyph is a picture of a key, and read out it is announced as
|
|
34
34
|
* its Unicode name rather than as a removed line.
|
|
@@ -38,8 +38,7 @@ var createDeletedLineBreakWidget = exports.createDeletedLineBreakWidget = functi
|
|
|
38
38
|
_ref$count = _ref.count,
|
|
39
39
|
count = _ref$count === void 0 ? 1 : _ref$count,
|
|
40
40
|
_ref$isActive = _ref.isActive,
|
|
41
|
-
isActive = _ref$isActive === void 0 ? false : _ref$isActive
|
|
42
|
-
reveal = _ref.reveal;
|
|
41
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive;
|
|
43
42
|
var dom = document.createElement('span');
|
|
44
43
|
// The testid deleted content is matched by, so the glyph is found wherever deleted content is.
|
|
45
44
|
dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
|
|
@@ -54,7 +53,7 @@ var createDeletedLineBreakWidget = exports.createDeletedLineBreakWidget = functi
|
|
|
54
53
|
// deleted-content wrapper is styled as an inline run.
|
|
55
54
|
dom.append(dom.ownerDocument.createElement('br'));
|
|
56
55
|
}
|
|
57
|
-
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, false
|
|
56
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, false);
|
|
58
57
|
wrapper.append(dom.ownerDocument.createTextNode(RETURN_GLYPH));
|
|
59
58
|
dom.append(wrapper);
|
|
60
59
|
}
|
|
@@ -79,14 +78,12 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
79
78
|
_ref2$isActive = _ref2.isActive,
|
|
80
79
|
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
81
80
|
pos = _ref2.pos,
|
|
82
|
-
reveal = _ref2.reveal,
|
|
83
81
|
side = _ref2.side,
|
|
84
82
|
tagMountContext = _ref2.tagMountContext;
|
|
85
83
|
var dom = createDeletedLineBreakWidget({
|
|
86
84
|
colorScheme: colorScheme,
|
|
87
85
|
count: count,
|
|
88
|
-
isActive: isActive
|
|
89
|
-
reveal: reveal
|
|
86
|
+
isActive: isActive
|
|
90
87
|
});
|
|
91
88
|
var tagHost = attributionKey ? (0, _createContributorTagWidget.createContributorTagHost)({
|
|
92
89
|
diffId: diffId,
|
|
@@ -14,7 +14,6 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
|
14
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
15
|
var _baseNodeName = require("../../utils/baseNodeName");
|
|
16
16
|
var _createInlineChangedDecoration = require("../createInlineChangedDecoration");
|
|
17
|
-
var _revealStyles = require("../revealStyles");
|
|
18
17
|
var _getAttrChangeRanges = require("./getAttrChangeRanges");
|
|
19
18
|
var _tableCellEdgeAttrs = require("./tableCellEdgeAttrs");
|
|
20
19
|
var _wrapBlockNodeViewStyles = require("./wrapBlockNodeViewStyles");
|
|
@@ -642,17 +641,9 @@ var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrappe
|
|
|
642
641
|
var node = _ref12.node,
|
|
643
642
|
colorScheme = _ref12.colorScheme,
|
|
644
643
|
isActive = _ref12.isActive,
|
|
645
|
-
isInserted = _ref12.isInserted
|
|
646
|
-
reveal = _ref12.reveal;
|
|
644
|
+
isInserted = _ref12.isInserted;
|
|
647
645
|
var wrapper = document.createElement('span');
|
|
648
|
-
|
|
649
|
-
colorScheme: colorScheme,
|
|
650
|
-
element: wrapper,
|
|
651
|
-
isActive: isActive !== null && isActive !== void 0 ? isActive : false,
|
|
652
|
-
isInserted: isInserted !== null && isInserted !== void 0 ? isInserted : false,
|
|
653
|
-
reveal: reveal
|
|
654
|
-
});
|
|
655
|
-
wrapper.setAttribute('style', (isInserted ? (0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, Boolean(revealStyle))) + revealStyle);
|
|
646
|
+
wrapper.setAttribute('style', isInserted ? (0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive));
|
|
656
647
|
(0, _toConsumableArray2.default)(node.childNodes).forEach(function (child) {
|
|
657
648
|
var removedChild = node.removeChild(child);
|
|
658
649
|
wrapper.append(removedChild);
|
|
@@ -667,26 +658,16 @@ var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrappe
|
|
|
667
658
|
var createContentWrapper = exports.createContentWrapper = function createContentWrapper(colorScheme) {
|
|
668
659
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
669
660
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
670
|
-
var reveal = arguments.length > 3 ? arguments[3] : undefined;
|
|
671
661
|
var wrapper = document.createElement('span');
|
|
672
662
|
var baseStyle = (0, _cssHelper.convertToInlineCss)({
|
|
673
663
|
position: 'relative',
|
|
674
664
|
width: 'fit-content'
|
|
675
665
|
});
|
|
676
|
-
|
|
677
|
-
// the animation can wipe it in instead.
|
|
678
|
-
var revealStyle = (0, _revealStyles.applyRevealToElement)({
|
|
679
|
-
colorScheme: colorScheme,
|
|
680
|
-
element: wrapper,
|
|
681
|
-
isActive: isActive,
|
|
682
|
-
isInserted: isInserted,
|
|
683
|
-
reveal: reveal
|
|
684
|
-
});
|
|
685
|
-
var deletedStyle = (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, Boolean(revealStyle));
|
|
666
|
+
var deletedStyle = (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive);
|
|
686
667
|
if (isInserted) {
|
|
687
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive))
|
|
668
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive)));
|
|
688
669
|
} else {
|
|
689
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle)
|
|
670
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle));
|
|
690
671
|
var strikethrough = document.createElement('span');
|
|
691
672
|
strikethrough.setAttribute('style', (0, _wrapBlockNodeViewStyles.getDeletedContentStyleUnbounded)(colorScheme, isActive));
|
|
692
673
|
wrapper.append(strikethrough);
|
|
@@ -109,12 +109,11 @@ var getInsertedContentStyleNext = function getInsertedContentStyleNext(colorSche
|
|
|
109
109
|
};
|
|
110
110
|
var getDeletedContentStyleNext = function getDeletedContentStyleNext(colorScheme) {
|
|
111
111
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
112
|
-
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
113
112
|
var colors = getColorScheme(colorScheme);
|
|
114
113
|
var base = (0, _factory.buildDeletedInlineContentStyle)(colors, isActive ? 'active' : 'new');
|
|
115
114
|
|
|
116
115
|
// glyphTint adds a background highlight and border-bottom over the tint; strikethrough does not.
|
|
117
|
-
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint'
|
|
116
|
+
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint';
|
|
118
117
|
return needsExtendedHighlight ? base + (0, _factory.buildDeletedInlineContentStyleExtended)(colors, isActive) : base;
|
|
119
118
|
};
|
|
120
119
|
var resolveCellOverlayStyleNext = function resolveCellOverlayStyleNext(_ref) {
|
|
@@ -173,8 +172,7 @@ var getInsertedContentStyle = exports.getInsertedContentStyle = function getInse
|
|
|
173
172
|
/** Inline style for deleted content. */
|
|
174
173
|
var getDeletedContentStyle = exports.getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
175
174
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
176
|
-
|
|
177
|
-
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, omitHighlight) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme), isActive, omitHighlight);
|
|
175
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme), isActive);
|
|
178
176
|
};
|
|
179
177
|
|
|
180
178
|
/**
|
|
@@ -173,14 +173,10 @@ var getInsertedContentStyleLegacy = exports.getInsertedContentStyleLegacy = func
|
|
|
173
173
|
/** Pre-refactor inline style for deleted content. */
|
|
174
174
|
var getDeletedContentStyleLegacy = exports.getDeletedContentStyleLegacy = function getDeletedContentStyleLegacy(colorScheme) {
|
|
175
175
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
176
|
-
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
177
176
|
if (colorScheme === 'traditional') {
|
|
178
177
|
return (0, _traditional.getDeletedTraditionalInlineStyle)(isActive);
|
|
179
178
|
}
|
|
180
|
-
|
|
181
|
-
return (isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyleNew)()) + _standard.deletedInlineContentStyleExtended;
|
|
182
|
-
}
|
|
183
|
-
return isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
179
|
+
return (isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyleNew)()) + _standard.deletedInlineContentStyleExtended;
|
|
184
180
|
};
|
|
185
181
|
|
|
186
182
|
/**
|
|
@@ -21,7 +21,6 @@ var _enforceCustomStepRegisters = require("./enforceCustomStepRegisters");
|
|
|
21
21
|
var _getDefaultDiffType = require("./getDefaultDiffType");
|
|
22
22
|
var _getScrollableDecorations = require("./getScrollableDecorations");
|
|
23
23
|
var _NodeViewSerializer = require("./NodeViewSerializer");
|
|
24
|
-
var _revealAnimation = require("./revealAnimation");
|
|
25
24
|
var _scrollToDiff = require("./scrollToDiff");
|
|
26
25
|
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; }
|
|
27
26
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -93,21 +92,11 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
93
92
|
var meta = tr.getMeta(showDiffPluginKey);
|
|
94
93
|
var newPluginState = currentPluginState;
|
|
95
94
|
if (meta) {
|
|
96
|
-
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF'
|
|
97
|
-
var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9
|
|
98
|
-
|
|
99
|
-
// ordinary resting style. Without it the reveal stays in state indefinitely and the
|
|
100
|
-
// next unrelated repaint re-emits the hidden, zero-width highlight with no animation
|
|
101
|
-
// left to bring it in — the highlight simply vanishes.
|
|
102
|
-
newPluginState = meta.action === 'REVEAL_COMPLETE' ? _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
103
|
-
reveal: undefined
|
|
104
|
-
}) : _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
95
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
|
|
96
|
+
var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9;
|
|
97
|
+
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
105
98
|
isDisplayingChanges: true,
|
|
106
|
-
activeIndex: undefined
|
|
107
|
-
// Explicit rather than left to the spread: an absent key in `meta` would let
|
|
108
|
-
// the previous paint's choreography leak into this one, so closing the diff
|
|
109
|
-
// would animate too.
|
|
110
|
-
reveal: meta.reveal
|
|
99
|
+
activeIndex: undefined
|
|
111
100
|
});
|
|
112
101
|
// Calculate and store decorations in state
|
|
113
102
|
var _calculateDiffDecorat = (0, _calculateDiffDecorations.calculateDiffDecorations)({
|
|
@@ -126,10 +115,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
126
115
|
showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
|
|
127
116
|
smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
|
|
128
117
|
deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement,
|
|
129
|
-
inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement
|
|
130
|
-
// SHOW_DIFF only. The scroll-to-next recalculation further down deliberately
|
|
131
|
-
// omits this so stepping through changes cannot replay the choreography.
|
|
132
|
-
reveal: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.reveal
|
|
118
|
+
inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement
|
|
133
119
|
}),
|
|
134
120
|
contributorTags = _calculateDiffDecorat.contributorTags,
|
|
135
121
|
decorations = _calculateDiffDecorat.decorations,
|
|
@@ -144,7 +130,6 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
144
130
|
isDisplayingChanges: false,
|
|
145
131
|
activeIndex: undefined,
|
|
146
132
|
contributorTags: [],
|
|
147
|
-
reveal: undefined,
|
|
148
133
|
// Per-call override — do not let it leak into the next, unrelated `showDiff` call.
|
|
149
134
|
colorScheme: undefined,
|
|
150
135
|
/**
|
|
@@ -161,7 +146,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
161
146
|
// Update the active index in plugin state and recalculate decorations
|
|
162
147
|
var _decorations = (0, _getScrollableDecorations.getScrollableDecorations)(currentPluginState.decorations, newState.doc);
|
|
163
148
|
if (_decorations.length > 0) {
|
|
164
|
-
var _currentPluginState$a, _newPluginState$color2,
|
|
149
|
+
var _currentPluginState$a, _newPluginState$color2, _newPluginState0;
|
|
165
150
|
// Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
|
|
166
151
|
// This allows the UI to start with no selection and only highlight on first user interaction.
|
|
167
152
|
var nextIndex = (_currentPluginState$a = currentPluginState.activeIndex) !== null && _currentPluginState$a !== void 0 ? _currentPluginState$a : -1;
|
|
@@ -191,7 +176,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
191
176
|
state: newState,
|
|
192
177
|
pluginState: newPluginState,
|
|
193
178
|
nodeViewSerializer: nodeViewSerializer,
|
|
194
|
-
colorScheme: (_newPluginState$color2 = (
|
|
179
|
+
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,
|
|
195
180
|
intl: getIntl(),
|
|
196
181
|
activeIndexPos: newPluginState.activeIndexPos,
|
|
197
182
|
api: api,
|
|
@@ -248,10 +233,6 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
248
233
|
}
|
|
249
234
|
var pluginState = showDiffPluginKey.getState(view.state);
|
|
250
235
|
|
|
251
|
-
// A repaint rebuilds inline decorations, destroying any animation bound to them, so
|
|
252
|
-
// an in-flight reveal has to be re-attached to the new nodes. No-op when idle.
|
|
253
|
-
(0, _revealAnimation.rebindReveal)(view, view.dom);
|
|
254
|
-
|
|
255
236
|
// Scroll to the first decoration when scrollIntoView was requested.
|
|
256
237
|
// Use the same filtered/position-sorted list as the active-index path
|
|
257
238
|
// so "first" reliably means the topmost scrollable diff in the document.
|
|
@@ -8,14 +8,11 @@ exports.showDiffPlugin = void 0;
|
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
|
|
12
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
11
|
var _attributions = require("./pm-plugins/decorations/colorSchemes/attributions");
|
|
14
12
|
var _getDeletedWidgets2 = require("./pm-plugins/getDeletedWidgets");
|
|
15
13
|
var _getScrollableDecorations = require("./pm-plugins/getScrollableDecorations");
|
|
16
14
|
var _main = require("./pm-plugins/main");
|
|
17
15
|
var _resolveDiffContributors = require("./pm-plugins/resolveDiffContributors");
|
|
18
|
-
var _revealAnimation = require("./pm-plugins/revealAnimation");
|
|
19
16
|
var _IndicatorBarContentComponent = require("./ui/IndicatorBar/IndicatorBarContentComponent");
|
|
20
17
|
var _excluded = ["stepsWithAttribution", "contributorProfiles", "showContributorTags"];
|
|
21
18
|
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; }
|
|
@@ -47,25 +44,6 @@ var normalizeShowDiffParams = function normalizeShowDiffParams(params) {
|
|
|
47
44
|
})
|
|
48
45
|
});
|
|
49
46
|
};
|
|
50
|
-
var prefersReducedMotion = function prefersReducedMotion() {
|
|
51
|
-
return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Resolve reveal preconditions once here so decorations and animation share one answer. If
|
|
56
|
-
* decorations think a reveal is happening but animation doesn't, highlight paints hidden forever.
|
|
57
|
-
* All preconditions resolved here (not just gate) ensures "unable to animate" means "do not reveal".
|
|
58
|
-
*
|
|
59
|
-
* Umbrella experiment: within the AI streaming UX M1 population this behaviour is only enabled
|
|
60
|
-
* for the treatment cohort. Non-AI callers (track-changes, etc.) are not enrolled and default
|
|
61
|
-
* to `true`, preserving the pre-umbrella baseline.
|
|
62
|
-
*/
|
|
63
|
-
var resolveReveal = function resolveReveal(reveal, editorView) {
|
|
64
|
-
return (
|
|
65
|
-
// Gate first, so it is the primary switch and is always observable once a reveal is requested.
|
|
66
|
-
reveal && (0, _fg.fg)('platform_editor_diff_reveal_animation') && (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && editorView && typeof window !== 'undefined' && !prefersReducedMotion() ? reveal : undefined
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
47
|
var showDiffPlugin = exports.showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
70
48
|
var api = _ref3.api,
|
|
71
49
|
config = _ref3.config;
|
|
@@ -89,25 +67,7 @@ var showDiffPlugin = exports.showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
89
67
|
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('viewingDiff')({
|
|
90
68
|
tr: tr
|
|
91
69
|
});
|
|
92
|
-
var reveal = resolveReveal(params === null || params === void 0 ? void 0 : params.reveal, editorView);
|
|
93
|
-
|
|
94
|
-
// Capture snapshot BEFORE transaction dispatch (last moment outgoing DOM exists).
|
|
95
|
-
if (reveal && editorView) {
|
|
96
|
-
var view = editorView;
|
|
97
|
-
(0, _revealAnimation.beginReveal)({
|
|
98
|
-
editorView: view,
|
|
99
|
-
reveal: reveal,
|
|
100
|
-
onComplete: function onComplete() {
|
|
101
|
-
// Repaint without the reveal so the decorations settle into their resting
|
|
102
|
-
// style. Kept out of history: this is presentation, not an edit.
|
|
103
|
-
view.dispatch(view.state.tr.setMeta(_main.showDiffPluginKey, {
|
|
104
|
-
action: 'REVEAL_COMPLETE'
|
|
105
|
-
}).setMeta('addToHistory', false));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
70
|
return tr.setMeta(_main.showDiffPluginKey, _objectSpread(_objectSpread({}, normalizeShowDiffParams(params)), {}, {
|
|
110
|
-
reveal: reveal,
|
|
111
71
|
action: 'SHOW_DIFF'
|
|
112
72
|
}));
|
|
113
73
|
};
|
|
@@ -115,9 +75,6 @@ var showDiffPlugin = exports.showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
115
75
|
hideDiff: function hideDiff(_ref5) {
|
|
116
76
|
var _api$userIntent2;
|
|
117
77
|
var tr = _ref5.tr;
|
|
118
|
-
if (editorView) {
|
|
119
|
-
(0, _revealAnimation.cancelReveal)(editorView);
|
|
120
|
-
}
|
|
121
78
|
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
122
79
|
tr: tr
|
|
123
80
|
});
|
|
@@ -83,18 +83,6 @@ var ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = exports.ASSERT_DIFF_AGENT_BRANDS_A
|
|
|
83
83
|
// Re-export the canonical `SmartDiffThresholds` declaration (single source of truth) so the
|
|
84
84
|
// public plugin types stay in sync with the smart-diff implementation.
|
|
85
85
|
|
|
86
|
-
/**
|
|
87
|
-
* How the diff is revealed when it is painted.
|
|
88
|
-
*
|
|
89
|
-
* - `phased` — the two-phase choreography used when opening the diff from a clean "new state":
|
|
90
|
-
* the outgoing state cross-fades to the incoming one while the agent highlight wipes out to the
|
|
91
|
-
* right, then every highlight wipes back in from the left.
|
|
92
|
-
*
|
|
93
|
-
* Deliberately separate from {@link DiffType}: that describes how changes are computed and grouped,
|
|
94
|
-
* this describes how the result is presented over time. Folding one into the other would make every
|
|
95
|
-
* `DiffType` consumer — version history, track-changes, publish diff — care about presentation.
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
86
|
/**
|
|
99
87
|
* Attributed alternative to `PMDiffParams`. When agent colouring is enabled, changes are grouped
|
|
100
88
|
* by `userId`, with `agentId` used as a tie-breaker.
|