@atlaskit/editor-plugin-show-diff 19.0.3 → 20.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 +17 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +57 -93
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -26
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +7 -22
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/cjs/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/cjs/pm-plugins/getDefaultDiffType.js +10 -0
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +5 -15
- package/dist/cjs/pm-plugins/main.js +45 -53
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/cjs/showDiffPlugin.js +14 -24
- package/dist/cjs/showDiffPluginType.js +1 -1
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/cjs/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +67 -105
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +11 -23
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +8 -18
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -54
- package/dist/es2019/pm-plugins/decorations/decorationKeys.js +6 -16
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +2 -7
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +53 -125
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +11 -12
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -7
- package/dist/es2019/pm-plugins/getDefaultDiffType.js +2 -0
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +6 -19
- package/dist/es2019/pm-plugins/main.js +49 -65
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +18 -3
- package/dist/es2019/showDiffPlugin.js +12 -24
- package/dist/es2019/showDiffPluginType.js +1 -1
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/es2019/ui/ContributorTag/contributorTagController.js +30 -2
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +56 -92
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/esm/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/esm/pm-plugins/getDefaultDiffType.js +4 -0
- package/dist/esm/pm-plugins/getScrollableDecorations.js +6 -16
- package/dist/esm/pm-plugins/main.js +44 -52
- package/dist/esm/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/esm/showDiffPlugin.js +14 -24
- package/dist/esm/showDiffPluginType.js +1 -1
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/esm/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +0 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/decorationKeys.d.ts +5 -8
- package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +3 -5
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -6
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +3 -4
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +4 -4
- package/dist/types/pm-plugins/getDefaultDiffType.d.ts +2 -0
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -2
- package/dist/types/pm-plugins/main.d.ts +0 -1
- package/dist/types/showDiffPluginType.d.ts +1 -3
- package/docs/smart-diff-design.md +13 -29
- package/package.json +11 -11
- package/dist/cjs/pm-plugins/isExtendedEnabled.js +0 -23
- package/dist/es2019/pm-plugins/isExtendedEnabled.js +0 -13
- package/dist/esm/pm-plugins/isExtendedEnabled.js +0 -17
- package/dist/types/pm-plugins/isExtendedEnabled.d.ts +0 -12
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
-
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
14
13
|
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, getStandardDeletedContentStyleActive, getStandardDeletedContentStyleNew, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from '../colorSchemes/standard';
|
|
15
14
|
import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayRoundedStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from '../colorSchemes/traditional';
|
|
16
15
|
var lozengeStyle = convertToInlineCss({
|
|
@@ -79,9 +78,8 @@ var isTextLikeBlockNode = function isTextLikeBlockNode(nodeName) {
|
|
|
79
78
|
export var getChangedContentStyleLegacy = function getChangedContentStyleLegacy(colorScheme) {
|
|
80
79
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
81
80
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
if (isExtendedEnabled(diffType) && isInserted) {
|
|
81
|
+
var hideAddedDiffsUnderline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
82
|
+
if (isInserted) {
|
|
85
83
|
if (colorScheme === 'traditional') {
|
|
86
84
|
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
87
85
|
}
|
|
@@ -100,10 +98,9 @@ export var getChangedContentStyleLegacy = function getChangedContentStyleLegacy(
|
|
|
100
98
|
export var getChangedNodeStyleLegacy = function getChangedNodeStyleLegacy(nodeName, colorScheme) {
|
|
101
99
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
102
100
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
103
|
-
var
|
|
104
|
-
var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
101
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
105
102
|
var isTraditional = colorScheme === 'traditional';
|
|
106
|
-
if (
|
|
103
|
+
if (isInserted) {
|
|
107
104
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
108
105
|
return hideAddedDiffsUnderline || fg('platform_editor_ai_show_diff_patch_1') ? editingContentStyleInBlockExtendedNoUnderline : editingContentStyleInBlockExtended;
|
|
109
106
|
}
|
|
@@ -163,12 +160,11 @@ export var getInsertedContentStyleLegacy = function getInsertedContentStyleLegac
|
|
|
163
160
|
/** Pre-refactor inline style for deleted content. */
|
|
164
161
|
export var getDeletedContentStyleLegacy = function getDeletedContentStyleLegacy(colorScheme) {
|
|
165
162
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
166
|
-
var
|
|
167
|
-
var omitHighlight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
163
|
+
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
168
164
|
if (colorScheme === 'traditional') {
|
|
169
165
|
return getDeletedTraditionalInlineStyle(isActive);
|
|
170
166
|
}
|
|
171
|
-
if (
|
|
167
|
+
if (!omitHighlight) {
|
|
172
168
|
return (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew()) + deletedInlineContentStyleExtended;
|
|
173
169
|
}
|
|
174
170
|
return isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew();
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
3
|
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
4
|
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
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
|
-
import {
|
|
9
|
-
import { isExtendedEnabled } from './isExtendedEnabled';
|
|
7
|
+
import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* True if `fragment` contains at least one inline node (text, hardBreak, emoji, mention, etc.).
|
|
@@ -41,9 +39,6 @@ export function isInlineDiffDecorationRenderableInDoc(doc, from, to) {
|
|
|
41
39
|
function isRangeFullyInside(range1Start, range1End, range2Start, range2End) {
|
|
42
40
|
return range2Start <= range1Start && range1End <= range2End;
|
|
43
41
|
}
|
|
44
|
-
function specHasDiffKeyPrefix(spec, keyPrefix) {
|
|
45
|
-
return Boolean(spec && _typeof(spec) === 'object' && 'key' in spec && typeof spec.key === 'string' && spec.key.startsWith(keyPrefix));
|
|
46
|
-
}
|
|
47
42
|
|
|
48
43
|
/**
|
|
49
44
|
* Where a decoration paints relative to others at the same position: negative before the node at
|
|
@@ -177,26 +172,21 @@ function groupTouchingDecorations(decorations, isInlineDecoration) {
|
|
|
177
172
|
* @param doc - Current document; when set, diff-inline ranges are validated against this doc
|
|
178
173
|
* @returns Array of scrollable decorations, sorted and deduplicated
|
|
179
174
|
*/
|
|
180
|
-
export var getScrollableDecorations = function getScrollableDecorations(set, doc
|
|
175
|
+
export var getScrollableDecorations = function getScrollableDecorations(set, doc) {
|
|
181
176
|
if (!set) {
|
|
182
177
|
return [];
|
|
183
178
|
}
|
|
184
179
|
var isBlockDecoration = function isBlockDecoration(decoration) {
|
|
185
|
-
|
|
186
|
-
return isExtendedEnabled(diffType) ? isDiffDecoration(decoration) && decoration.spec.decorationType === 'block' : (_decoration$spec$key$ = (_decoration$spec = decoration.spec) === null || _decoration$spec === void 0 || (_decoration$spec = _decoration$spec.key) === null || _decoration$spec === void 0 ? void 0 : _decoration$spec.startsWith(DiffDecorationKey.block)) !== null && _decoration$spec$key$ !== void 0 ? _decoration$spec$key$ : false;
|
|
180
|
+
return isDiffDecoration(decoration) && decoration.spec.decorationType === 'block';
|
|
187
181
|
};
|
|
188
182
|
var isInlineDecoration = function isInlineDecoration(decoration) {
|
|
189
|
-
|
|
190
|
-
return isExtendedEnabled(diffType) ? isDiffDecoration(decoration) && decoration.spec.decorationType === 'inline' : (_decoration$spec$key$2 = (_decoration$spec2 = decoration.spec) === null || _decoration$spec2 === void 0 || (_decoration$spec2 = _decoration$spec2.key) === null || _decoration$spec2 === void 0 ? void 0 : _decoration$spec2.startsWith(DiffDecorationKey.inline)) !== null && _decoration$spec$key$2 !== void 0 ? _decoration$spec$key$2 : false;
|
|
183
|
+
return isDiffDecoration(decoration) && decoration.spec.decorationType === 'inline';
|
|
191
184
|
};
|
|
192
185
|
var isWidgetDecoration = function isWidgetDecoration(decoration) {
|
|
193
|
-
|
|
194
|
-
return isExtendedEnabled(diffType) ? isDiffDecoration(decoration) && decoration.spec.decorationType === 'widget' : (_decoration$spec$key$3 = (_decoration$spec3 = decoration.spec) === null || _decoration$spec3 === void 0 || (_decoration$spec3 = _decoration$spec3.key) === null || _decoration$spec3 === void 0 ? void 0 : _decoration$spec3.startsWith(DiffDecorationKey.widget)) !== null && _decoration$spec$key$3 !== void 0 ? _decoration$spec$key$3 : false;
|
|
186
|
+
return isDiffDecoration(decoration) && decoration.spec.decorationType === 'widget';
|
|
195
187
|
};
|
|
196
188
|
var seenBlockKeys = new Set();
|
|
197
|
-
var allDecorations =
|
|
198
|
-
return specHasDiffKeyPrefix(spec, DiffDecorationKey.inline) || specHasDiffKeyPrefix(spec, DiffDecorationKey.widget) || specHasDiffKeyPrefix(spec, DiffDecorationKey.block);
|
|
199
|
-
});
|
|
189
|
+
var allDecorations = set.find(undefined, undefined, isDiffDecorationSpec);
|
|
200
190
|
|
|
201
191
|
// First pass: filter out listItem blocks and deduplicates blocks
|
|
202
192
|
var filtered = allDecorations.filter(function (dec) {
|
|
@@ -11,8 +11,8 @@ import { getActiveDiffAnnouncement } from '../ui/DiffNavigation/announceActiveDi
|
|
|
11
11
|
import { calculateDiffDecorations } from './calculateDiff/calculateDiffDecorations';
|
|
12
12
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
|
|
13
13
|
import { enforceCustomStepRegisters } from './enforceCustomStepRegisters';
|
|
14
|
+
import { getDefaultDiffType } from './getDefaultDiffType';
|
|
14
15
|
import { getScrollableDecorations } from './getScrollableDecorations';
|
|
15
|
-
import { getDefaultDiffType, isExtendedEnabled } from './isExtendedEnabled';
|
|
16
16
|
import { NodeViewSerializer } from './NodeViewSerializer';
|
|
17
17
|
import { rebindReveal } from './revealAnimation';
|
|
18
18
|
import { scrollToDecoration } from './scrollToDiff';
|
|
@@ -66,28 +66,26 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
66
66
|
state: {
|
|
67
67
|
init: function init(_, _state) {
|
|
68
68
|
// We do initial setup after we setup the editor view
|
|
69
|
-
|
|
70
|
-
return _objectSpread({
|
|
69
|
+
return {
|
|
71
70
|
steps: [],
|
|
72
71
|
stepAttributions: [],
|
|
73
72
|
originalDoc: undefined,
|
|
74
73
|
decorations: DecorationSet.empty,
|
|
75
|
-
isDisplayingChanges: false
|
|
76
|
-
}, isExtendedEnabled(defaultDiffType) ? {
|
|
74
|
+
isDisplayingChanges: false,
|
|
77
75
|
isInverted: false,
|
|
78
|
-
diffType:
|
|
76
|
+
diffType: getDefaultDiffType(),
|
|
79
77
|
hideDeletedDiffs: false,
|
|
80
78
|
hideAddedDiffsUnderline: false,
|
|
81
79
|
showIndicators: false,
|
|
82
80
|
diffDescriptors: []
|
|
83
|
-
}
|
|
81
|
+
};
|
|
84
82
|
},
|
|
85
83
|
apply: function apply(tr, currentPluginState, oldState, newState) {
|
|
86
84
|
var meta = tr.getMeta(showDiffPluginKey);
|
|
87
85
|
var newPluginState = currentPluginState;
|
|
88
86
|
if (meta) {
|
|
89
87
|
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'REVEAL_COMPLETE') {
|
|
90
|
-
var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0
|
|
88
|
+
var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0;
|
|
91
89
|
// REVEAL_COMPLETE repaints with the reveal dropped, so the decorations render their
|
|
92
90
|
// ordinary resting style. Without it the reveal stays in state indefinitely and the
|
|
93
91
|
// next unrelated repaint re-emits the hidden, zero-width highlight with no animation
|
|
@@ -103,7 +101,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
103
101
|
reveal: meta.reveal
|
|
104
102
|
});
|
|
105
103
|
// Calculate and store decorations in state
|
|
106
|
-
var _calculateDiffDecorat = calculateDiffDecorations(
|
|
104
|
+
var _calculateDiffDecorat = calculateDiffDecorations({
|
|
107
105
|
state: newState,
|
|
108
106
|
pluginState: newPluginState,
|
|
109
107
|
nodeViewSerializer: nodeViewSerializer,
|
|
@@ -111,29 +109,26 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
111
109
|
intl: getIntl(),
|
|
112
110
|
activeIndexPos: newPluginState.activeIndexPos,
|
|
113
111
|
api: api,
|
|
114
|
-
tagMountContext: tagMountContext
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
inlineDeletedDiffPlacement: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.inlineDeletedDiffPlacement,
|
|
112
|
+
tagMountContext: tagMountContext,
|
|
113
|
+
isInverted: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.isInverted,
|
|
114
|
+
diffType: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.diffType,
|
|
115
|
+
hideDeletedDiffs: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.hideDeletedDiffs,
|
|
116
|
+
hideAddedDiffsUnderline: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideAddedDiffsUnderline,
|
|
117
|
+
showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
|
|
118
|
+
smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
|
|
119
|
+
deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement,
|
|
120
|
+
inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement,
|
|
124
121
|
// SHOW_DIFF only. The scroll-to-next recalculation further down deliberately
|
|
125
122
|
// omits this so stepping through changes cannot replay the choreography.
|
|
126
|
-
reveal: (
|
|
127
|
-
}
|
|
123
|
+
reveal: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.reveal
|
|
124
|
+
}),
|
|
128
125
|
contributorTags = _calculateDiffDecorat.contributorTags,
|
|
129
126
|
decorations = _calculateDiffDecorat.decorations,
|
|
130
127
|
diffDescriptors = _calculateDiffDecorat.diffDescriptors;
|
|
131
128
|
// Update the decorations and their ids
|
|
132
129
|
newPluginState.decorations = decorations;
|
|
133
130
|
newPluginState.contributorTags = contributorTags;
|
|
134
|
-
|
|
135
|
-
newPluginState.diffDescriptors = diffDescriptors;
|
|
136
|
-
}
|
|
131
|
+
newPluginState.diffDescriptors = diffDescriptors;
|
|
137
132
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
|
|
138
133
|
newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
|
|
139
134
|
decorations: DecorationSet.empty,
|
|
@@ -142,20 +137,22 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
142
137
|
contributorTags: [],
|
|
143
138
|
reveal: undefined,
|
|
144
139
|
// Per-call override — do not let it leak into the next, unrelated `showDiff` call.
|
|
145
|
-
colorScheme: undefined
|
|
146
|
-
|
|
140
|
+
colorScheme: undefined,
|
|
141
|
+
/**
|
|
142
|
+
* Reset isInverted & diffType state when hiding diffs
|
|
143
|
+
* Otherwise this should persist for the diff-showing session
|
|
144
|
+
*/
|
|
147
145
|
isInverted: false,
|
|
148
146
|
diffType: getDefaultDiffType(),
|
|
149
147
|
hideDeletedDiffs: false,
|
|
150
148
|
hideAddedDiffsUnderline: false,
|
|
151
149
|
diffDescriptors: []
|
|
152
|
-
}
|
|
150
|
+
});
|
|
153
151
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') {
|
|
154
|
-
var _newPluginState11;
|
|
155
152
|
// Update the active index in plugin state and recalculate decorations
|
|
156
|
-
var _decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc
|
|
153
|
+
var _decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc);
|
|
157
154
|
if (_decorations.length > 0) {
|
|
158
|
-
var _currentPluginState$a, _newPluginState$color2,
|
|
155
|
+
var _currentPluginState$a, _newPluginState$color2, _newPluginState1;
|
|
159
156
|
// Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
|
|
160
157
|
// This allows the UI to start with no selection and only highlight on first user interaction.
|
|
161
158
|
var nextIndex = (_currentPluginState$a = currentPluginState.activeIndex) !== null && _currentPluginState$a !== void 0 ? _currentPluginState$a : -1;
|
|
@@ -179,16 +176,15 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
179
176
|
} : undefined
|
|
180
177
|
});
|
|
181
178
|
// Recalculate decorations with the new active index
|
|
182
|
-
var _calculateDiffDecorat2 = calculateDiffDecorations(
|
|
179
|
+
var _calculateDiffDecorat2 = calculateDiffDecorations({
|
|
183
180
|
state: newState,
|
|
184
181
|
pluginState: newPluginState,
|
|
185
182
|
nodeViewSerializer: nodeViewSerializer,
|
|
186
|
-
colorScheme: (_newPluginState$color2 = (
|
|
183
|
+
colorScheme: (_newPluginState$color2 = (_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.colorScheme) !== null && _newPluginState$color2 !== void 0 ? _newPluginState$color2 : config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
187
184
|
intl: getIntl(),
|
|
188
185
|
activeIndexPos: newPluginState.activeIndexPos,
|
|
189
186
|
api: api,
|
|
190
|
-
tagMountContext: tagMountContext
|
|
191
|
-
}, isExtendedEnabled(newPluginState.diffType) ? {
|
|
187
|
+
tagMountContext: tagMountContext,
|
|
192
188
|
isInverted: newPluginState.isInverted,
|
|
193
189
|
diffType: newPluginState.diffType,
|
|
194
190
|
hideDeletedDiffs: newPluginState.hideDeletedDiffs,
|
|
@@ -197,15 +193,13 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
197
193
|
smartThresholds: newPluginState.smartThresholds,
|
|
198
194
|
deletedDiffPlacement: newPluginState.deletedDiffPlacement,
|
|
199
195
|
inlineDeletedDiffPlacement: newPluginState.inlineDeletedDiffPlacement
|
|
200
|
-
}
|
|
196
|
+
}),
|
|
201
197
|
updatedContributorTags = _calculateDiffDecorat2.contributorTags,
|
|
202
198
|
updatedDecorations = _calculateDiffDecorat2.decorations,
|
|
203
199
|
updatedDiffDescriptors = _calculateDiffDecorat2.diffDescriptors;
|
|
204
200
|
newPluginState.decorations = updatedDecorations;
|
|
205
201
|
newPluginState.contributorTags = updatedContributorTags;
|
|
206
|
-
|
|
207
|
-
newPluginState.diffDescriptors = updatedDiffDescriptors;
|
|
208
|
-
}
|
|
202
|
+
newPluginState.diffDescriptors = updatedDiffDescriptors;
|
|
209
203
|
}
|
|
210
204
|
} else {
|
|
211
205
|
newPluginState = _objectSpread(_objectSpread({}, currentPluginState), meta);
|
|
@@ -250,10 +244,10 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
250
244
|
// Scroll to the first decoration when scrollIntoView was requested.
|
|
251
245
|
// Use the same filtered/position-sorted list as the active-index path
|
|
252
246
|
// so "first" reliably means the topmost scrollable diff in the document.
|
|
253
|
-
if (pluginState !== null && pluginState !== void 0 && pluginState.scrollIntoView
|
|
247
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.scrollIntoView) {
|
|
254
248
|
var _cancelPendingScrollT;
|
|
255
249
|
(_cancelPendingScrollT = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT === void 0 || _cancelPendingScrollT();
|
|
256
|
-
cancelPendingScrollToDecoration = scrollToDecoration(view, getScrollableDecorations(pluginState.decorations, view.state.doc
|
|
250
|
+
cancelPendingScrollToDecoration = scrollToDecoration(view, getScrollableDecorations(pluginState.decorations, view.state.doc), undefined, api);
|
|
257
251
|
|
|
258
252
|
// Reset the flag so we don't scroll again on subsequent updates
|
|
259
253
|
view.dispatch(view.state.tr.setMeta(showDiffPluginKey, {
|
|
@@ -267,7 +261,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
267
261
|
if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
|
|
268
262
|
var _cancelPendingScrollT2;
|
|
269
263
|
(_cancelPendingScrollT2 = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT2 === void 0 || _cancelPendingScrollT2();
|
|
270
|
-
var scrollableDecorations = getScrollableDecorations(pluginState.decorations, view.state.doc
|
|
264
|
+
var scrollableDecorations = getScrollableDecorations(pluginState.decorations, view.state.doc);
|
|
271
265
|
var activeDecoration = scrollableDecorations[pluginState.activeIndex];
|
|
272
266
|
if (activeDecoration) {
|
|
273
267
|
// EDITOR-7926: use editor-common's command instead of the expand plugin API to
|
|
@@ -280,17 +274,15 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
280
274
|
// screen-reader user gets silence. Announced through the live region rather than by
|
|
281
275
|
// focusing the change, since the "next change" control has to stay focused to be
|
|
282
276
|
// pressed again. After the scroll above, so the announcement never precedes it.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(announcement);
|
|
293
|
-
}
|
|
277
|
+
var announcement = getActiveDiffAnnouncement({
|
|
278
|
+
activeIndex: pluginState.activeIndex,
|
|
279
|
+
contributorTags: pluginState.contributorTags,
|
|
280
|
+
decorations: scrollableDecorations,
|
|
281
|
+
intl: getIntl()
|
|
282
|
+
});
|
|
283
|
+
if (announcement) {
|
|
284
|
+
var _api$accessibilityUti;
|
|
285
|
+
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(announcement);
|
|
294
286
|
}
|
|
295
287
|
}
|
|
296
288
|
},
|
|
@@ -16,9 +16,19 @@ var ROVO_AGENT_TYPES = new Set(['convo-ai', 'rovo_chat']);
|
|
|
16
16
|
var SHOW_DIFF_AGENT_BRANDS = {
|
|
17
17
|
'agent-brand-claude': 'claude',
|
|
18
18
|
'agent-brand-chatgpt': 'chatgpt',
|
|
19
|
+
'agent-brand-figma': 'figma',
|
|
20
|
+
'agent-brand-lovable': 'lovable',
|
|
21
|
+
'agent-brand-replit': 'replit',
|
|
19
22
|
'agent-brand-rovo': 'rovo'
|
|
20
23
|
};
|
|
21
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Brands that prefer the account's real avatar over their fixed glyph when the invoking profile
|
|
27
|
+
* has one. Claude/ChatGPT/Rovo intentionally keep their fixed glyph always (see `AGENT_KIND_ICONS`
|
|
28
|
+
* in `contributorAvatarRenderer.ts`).
|
|
29
|
+
*/
|
|
30
|
+
var AVATAR_ELIGIBLE_BRANDS = new Set(['figma', 'lovable', 'replit']);
|
|
31
|
+
|
|
22
32
|
/** Known external agent types emitted by Confluence's agent identification service that carry
|
|
23
33
|
* no `@atlaskit/agent-color` brand — a generic labelled fallback. */
|
|
24
34
|
var EXTERNAL_AGENT_NAMES = {
|
|
@@ -59,19 +69,23 @@ var resolveUser = function resolveUser(userId, profilesByAccountId) {
|
|
|
59
69
|
var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
|
|
60
70
|
var _attribution$agentTyp2, _attribution$agentId2;
|
|
61
71
|
var agentType = (_attribution$agentTyp2 = attribution.agentType) === null || _attribution$agentTyp2 === void 0 ? void 0 : _attribution$agentTyp2.trim().toLowerCase();
|
|
72
|
+
// `agentType` may be a named id (e.g. `mcp_lovable_agent`) or a display name (e.g. `lovable`).
|
|
62
73
|
var brand = agentType ? getThirdPartyAgentColor({
|
|
74
|
+
agentNamedId: agentType,
|
|
63
75
|
agentName: agentType
|
|
64
76
|
}) : undefined;
|
|
65
77
|
var diffBrand = brand ? SHOW_DIFF_AGENT_BRANDS[brand.scheme] : undefined;
|
|
78
|
+
var agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
|
|
79
|
+
var agentProfile = agentId ? profilesByAccountId.get(agentId) : undefined;
|
|
66
80
|
if (diffBrand && brand) {
|
|
67
|
-
return {
|
|
81
|
+
return _objectSpread({
|
|
68
82
|
agentKind: diffBrand,
|
|
69
83
|
kind: 'agent',
|
|
70
84
|
name: brand.name
|
|
71
|
-
}
|
|
85
|
+
}, AVATAR_ELIGIBLE_BRANDS.has(diffBrand) && agentProfile !== null && agentProfile !== void 0 && agentProfile.avatarUrl ? {
|
|
86
|
+
avatarUrl: agentProfile.avatarUrl
|
|
87
|
+
} : {});
|
|
72
88
|
}
|
|
73
|
-
var agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
|
|
74
|
-
var agentProfile = agentId ? profilesByAccountId.get(agentId) : undefined;
|
|
75
89
|
if (agentProfile) {
|
|
76
90
|
return _objectSpread(_objectSpread({}, agentProfile.agentBrand ? {
|
|
77
91
|
agentKind: agentProfile.agentBrand
|
|
@@ -6,7 +6,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { areAttributionColorGatesEnabled, resolveContributors } from './pm-plugins/decorations/colorSchemes/attributions';
|
|
11
10
|
import { getDeletedWidgets as _getDeletedWidgets } from './pm-plugins/getDeletedWidgets';
|
|
12
11
|
import { getScrollableDecorations } from './pm-plugins/getScrollableDecorations';
|
|
@@ -75,13 +74,11 @@ export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
75
74
|
commands: {
|
|
76
75
|
showDiff: function showDiff(params) {
|
|
77
76
|
return function (_ref4) {
|
|
77
|
+
var _api$userIntent;
|
|
78
78
|
var tr = _ref4.tr;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
tr: tr
|
|
83
|
-
});
|
|
84
|
-
}
|
|
79
|
+
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('viewingDiff')({
|
|
80
|
+
tr: tr
|
|
81
|
+
});
|
|
85
82
|
var reveal = resolveReveal(params === null || params === void 0 ? void 0 : params.reveal, editorView);
|
|
86
83
|
|
|
87
84
|
// Capture snapshot BEFORE transaction dispatch (last moment outgoing DOM exists).
|
|
@@ -106,16 +103,14 @@ export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
106
103
|
};
|
|
107
104
|
},
|
|
108
105
|
hideDiff: function hideDiff(_ref5) {
|
|
106
|
+
var _api$userIntent2;
|
|
109
107
|
var tr = _ref5.tr;
|
|
110
108
|
if (editorView) {
|
|
111
109
|
cancelReveal(editorView);
|
|
112
110
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
tr: tr
|
|
117
|
-
});
|
|
118
|
-
}
|
|
111
|
+
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
112
|
+
tr: tr
|
|
113
|
+
});
|
|
119
114
|
return tr.setMeta(showDiffPluginKey, {
|
|
120
115
|
steps: [],
|
|
121
116
|
stepAttributions: [],
|
|
@@ -148,9 +143,6 @@ export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
148
143
|
}];
|
|
149
144
|
},
|
|
150
145
|
contentComponent: function contentComponent() {
|
|
151
|
-
if (!expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
146
|
// Rendered here sharing decoration anchor span DOM context (tags mount separately).
|
|
155
147
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IndicatorBarContentComponent, {
|
|
156
148
|
api: api
|
|
@@ -158,24 +150,22 @@ export var showDiffPlugin = function showDiffPlugin(_ref3) {
|
|
|
158
150
|
},
|
|
159
151
|
getSharedState: function getSharedState(editorState) {
|
|
160
152
|
if (!editorState) {
|
|
161
|
-
return
|
|
153
|
+
return {
|
|
162
154
|
isDisplayingChanges: false,
|
|
163
|
-
activeIndex: undefined
|
|
164
|
-
}, expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) ? {
|
|
155
|
+
activeIndex: undefined,
|
|
165
156
|
diffDescriptors: []
|
|
166
|
-
}
|
|
157
|
+
};
|
|
167
158
|
}
|
|
168
159
|
var pluginState = showDiffPluginKey.getState(editorState);
|
|
169
160
|
var decorationCount = getScrollableDecorations(pluginState === null || pluginState === void 0 ? void 0 : pluginState.decorations, editorState.doc);
|
|
170
|
-
return
|
|
161
|
+
return {
|
|
171
162
|
isDisplayingChanges: decorationCount.length > 0,
|
|
172
163
|
activeIndex: pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex,
|
|
173
|
-
numberOfChanges: decorationCount.length
|
|
174
|
-
}, expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) ? {
|
|
164
|
+
numberOfChanges: decorationCount.length,
|
|
175
165
|
contributorTags: pluginState === null || pluginState === void 0 ? void 0 : pluginState.contributorTags,
|
|
176
166
|
diffDescriptors: pluginState === null || pluginState === void 0 ? void 0 : pluginState.diffDescriptors,
|
|
177
167
|
showIndicators: pluginState === null || pluginState === void 0 ? void 0 : pluginState.showIndicators
|
|
178
|
-
}
|
|
168
|
+
};
|
|
179
169
|
}
|
|
180
170
|
};
|
|
181
171
|
};
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
/** Branded agent presentations supported by contributor tags. */
|
|
21
21
|
|
|
22
|
-
export var DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt']);
|
|
22
|
+
export var DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit']);
|
|
23
23
|
|
|
24
24
|
/** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
|
|
25
25
|
|
|
@@ -5,11 +5,11 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
5
5
|
import { getContributorTagIcon } from './contributorTagIcons';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Agent kinds with a custom contributor-tag icon.
|
|
9
|
-
* `
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Agent kinds with a custom contributor-tag icon. Figma/Lovable/Replit have no entry here — they
|
|
9
|
+
* always render the real avatar `resolveDiffContributors` supplies, falling back to the generic
|
|
10
|
+
* `aiAgent` glyph (see `showContributorIcon`) on load failure. The declared type stays the wider
|
|
11
|
+
* `TagContributor['agentKind']` so indexing below (with `'identified' | 'external'` in play too)
|
|
12
|
+
* stays safely partial.
|
|
13
13
|
*/
|
|
14
14
|
var AGENT_KIND_ICONS = {
|
|
15
15
|
claude: 'claude',
|
|
@@ -17,6 +17,14 @@ var AGENT_KIND_ICONS = {
|
|
|
17
17
|
rovo: 'rovoHex'
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Brands that always render their fixed glyph, even when the contributor also carries an
|
|
22
|
+
* `avatarUrl`. Figma/Lovable/Replit are excluded here and use the real avatar when
|
|
23
|
+
* `resolveDiffContributors` supplies one, falling back to the generic `aiAgent` glyph on load
|
|
24
|
+
* failure.
|
|
25
|
+
*/
|
|
26
|
+
var FIXED_GLYPH_AGENT_KINDS = new Set(['claude', 'chatgpt', 'rovo']);
|
|
27
|
+
|
|
20
28
|
/** The size `@atlaskit/avatar`'s `xxsmall` rendered at. */
|
|
21
29
|
var AVATAR_SIZE = AVATAR_SIZES.xxsmall;
|
|
22
30
|
/** `xxsmall` also carried a `space.025` margin — the same 2px — which is where the ring is painted. */
|
|
@@ -107,13 +115,15 @@ export var contributorAvatarRenderer = function contributorAvatarRenderer(_ref)
|
|
|
107
115
|
shape.appendChild(fallback);
|
|
108
116
|
return;
|
|
109
117
|
}
|
|
110
|
-
|
|
118
|
+
var icon = (_AGENT_KIND_ICONS = AGENT_KIND_ICONS[(_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external']) !== null && _AGENT_KIND_ICONS !== void 0 ? _AGENT_KIND_ICONS : 'aiAgent';
|
|
119
|
+
shape.appendChild(getContributorTagIcon(icon, doc));
|
|
111
120
|
};
|
|
112
121
|
if (contributor.avatarUrl) {
|
|
113
122
|
var _contributor$agentKin2;
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
// Claude/ChatGPT/Rovo always use their fixed glyph, even when the profile also has an
|
|
124
|
+
// avatar URL. Other agents (e.g. Figma/Lovable/Replit) and users prefer the real avatar.
|
|
125
|
+
var usesFixedGlyph = isAgent && FIXED_GLYPH_AGENT_KINDS.has((_contributor$agentKin2 = contributor.agentKind) !== null && _contributor$agentKin2 !== void 0 ? _contributor$agentKin2 : 'external');
|
|
126
|
+
if (usesFixedGlyph) {
|
|
117
127
|
showContributorIcon();
|
|
118
128
|
} else {
|
|
119
129
|
image = doc.createElement('img');
|
|
@@ -29,9 +29,18 @@ var getTagAccent = function getTagAccent(_ref) {
|
|
|
29
29
|
var chatgptBrandColor = getThirdPartyAgentColor({
|
|
30
30
|
agentName: 'chatgpt'
|
|
31
31
|
});
|
|
32
|
+
var figmaBrandColor = getThirdPartyAgentColor({
|
|
33
|
+
agentName: 'figma'
|
|
34
|
+
});
|
|
35
|
+
var lovableBrandColor = getThirdPartyAgentColor({
|
|
36
|
+
agentName: 'lovable'
|
|
37
|
+
});
|
|
38
|
+
var replitBrandColor = getThirdPartyAgentColor({
|
|
39
|
+
agentName: 'replit'
|
|
40
|
+
});
|
|
32
41
|
|
|
33
42
|
/** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
|
|
34
|
-
var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({
|
|
43
|
+
var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
35
44
|
rovo: {
|
|
36
45
|
background: "var(--ds-background-neutral-bold, #292A2E)",
|
|
37
46
|
text: "var(--ds-text-inverse, #FFFFFF)"
|
|
@@ -41,6 +50,21 @@ var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({
|
|
|
41
50
|
background: chatgptBrandColor.bold,
|
|
42
51
|
text: chatgptBrandColor.boldText
|
|
43
52
|
}
|
|
53
|
+
} : {}), figmaBrandColor ? {
|
|
54
|
+
figma: {
|
|
55
|
+
background: figmaBrandColor.bold,
|
|
56
|
+
text: figmaBrandColor.boldText
|
|
57
|
+
}
|
|
58
|
+
} : {}), lovableBrandColor ? {
|
|
59
|
+
lovable: {
|
|
60
|
+
background: lovableBrandColor.bold,
|
|
61
|
+
text: lovableBrandColor.boldText
|
|
62
|
+
}
|
|
63
|
+
} : {}), replitBrandColor ? {
|
|
64
|
+
replit: {
|
|
65
|
+
background: replitBrandColor.bold,
|
|
66
|
+
text: replitBrandColor.boldText
|
|
67
|
+
}
|
|
44
68
|
} : {});
|
|
45
69
|
|
|
46
70
|
/**
|
|
@@ -365,8 +389,9 @@ export var ContributorTagController = /*#__PURE__*/function () {
|
|
|
365
389
|
stackIndex: stackIndex
|
|
366
390
|
});
|
|
367
391
|
if (index < stack.length - 1) {
|
|
368
|
-
//
|
|
369
|
-
|
|
392
|
+
// Sits the leading avatar of a connected pair flush against the one behind it, with
|
|
393
|
+
// no overlap and no extra gap.
|
|
394
|
+
avatar.element.style.setProperty('margin-inline-end', '0');
|
|
370
395
|
}
|
|
371
396
|
container.appendChild(avatar.element);
|
|
372
397
|
_this5.avatars.push(avatar);
|