@atlaskit/editor-plugin-show-diff 14.5.1 → 15.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 +34 -6
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +3 -9
- package/dist/cjs/pm-plugins/calculateDiff/smart/classifySmartChanges.js +1 -2
- package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +21 -4
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +6 -56
- package/dist/cjs/pm-plugins/decorations/colorSchemes/schemes.js +6 -20
- package/dist/cjs/pm-plugins/decorations/colorSchemes/types.js +4 -6
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +1 -2
- package/dist/cjs/pm-plugins/decorations/createContributorTagWidget.js +14 -29
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +1 -2
- package/dist/cjs/pm-plugins/decorations/utils/getAttrChangeRanges.js +2 -25
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +1 -2
- package/dist/cjs/pm-plugins/main.js +4 -4
- package/dist/cjs/showDiffPlugin.js +4 -5
- package/dist/cjs/ui/ContributorTag/buildContributorTagDom.js +122 -0
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +140 -0
- package/dist/cjs/ui/ContributorTag/contributorTagController.js +500 -0
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +46 -0
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +3 -5
- package/dist/es2019/pm-plugins/calculateDiff/smart/classifySmartChanges.js +1 -2
- package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +20 -3
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +6 -55
- package/dist/es2019/pm-plugins/decorations/colorSchemes/schemes.js +14 -26
- package/dist/es2019/pm-plugins/decorations/colorSchemes/types.js +4 -6
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +1 -2
- package/dist/es2019/pm-plugins/decorations/createContributorTagWidget.js +16 -30
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +1 -2
- package/dist/es2019/pm-plugins/decorations/utils/getAttrChangeRanges.js +2 -17
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +1 -2
- package/dist/es2019/pm-plugins/main.js +4 -4
- package/dist/es2019/showDiffPlugin.js +4 -5
- package/dist/es2019/ui/ContributorTag/buildContributorTagDom.js +110 -0
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +136 -0
- package/dist/es2019/ui/ContributorTag/contributorTagController.js +403 -0
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +40 -0
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +3 -9
- package/dist/esm/pm-plugins/calculateDiff/smart/classifySmartChanges.js +1 -2
- package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +21 -4
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +6 -57
- package/dist/esm/pm-plugins/decorations/colorSchemes/schemes.js +7 -20
- package/dist/esm/pm-plugins/decorations/colorSchemes/types.js +4 -6
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +1 -2
- package/dist/esm/pm-plugins/decorations/createContributorTagWidget.js +15 -30
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +1 -2
- package/dist/esm/pm-plugins/decorations/utils/getAttrChangeRanges.js +2 -25
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +1 -2
- package/dist/esm/pm-plugins/main.js +4 -4
- package/dist/esm/showDiffPlugin.js +4 -5
- package/dist/esm/ui/ContributorTag/buildContributorTagDom.js +115 -0
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +135 -0
- package/dist/esm/ui/ContributorTag/contributorTagController.js +493 -0
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +40 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/attributions.d.ts +3 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +2 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/schemes.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +13 -16
- package/dist/types/pm-plugins/decorations/createContributorTagWidget.d.ts +11 -9
- package/dist/types/pm-plugins/main.d.ts +1 -2
- package/dist/types/ui/ContributorTag/buildContributorTagDom.d.ts +25 -0
- package/dist/types/ui/ContributorTag/contributorAvatarRenderer.d.ts +22 -0
- package/dist/types/ui/ContributorTag/contributorTagController.d.ts +85 -0
- package/dist/types/ui/ContributorTag/contributorTagIcons.d.ts +12 -0
- package/package.json +9 -13
- package/dist/cjs/ui/ContributorTag/ContributorTag.compiled.css +0 -29
- package/dist/cjs/ui/ContributorTag/ContributorTag.js +0 -383
- package/dist/cjs/ui/ContributorTag/ContributorTagWidget.js +0 -50
- package/dist/es2019/ui/ContributorTag/ContributorTag.compiled.css +0 -29
- package/dist/es2019/ui/ContributorTag/ContributorTag.js +0 -312
- package/dist/es2019/ui/ContributorTag/ContributorTagWidget.js +0 -43
- package/dist/esm/ui/ContributorTag/ContributorTag.compiled.css +0 -29
- package/dist/esm/ui/ContributorTag/ContributorTag.js +0 -375
- package/dist/esm/ui/ContributorTag/ContributorTagWidget.js +0 -43
- package/dist/types/ui/ContributorTag/ContributorTag.d.ts +0 -37
- package/dist/types/ui/ContributorTag/ContributorTagWidget.d.ts +0 -22
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
/* ContributorTag.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import "./ContributorTag.compiled.css";
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
-
import { bindAll } from 'bind-event-listener';
|
|
8
|
-
import { useIntl } from 'react-intl';
|
|
9
|
-
import Avatar from '@atlaskit/avatar/avatar';
|
|
10
|
-
import { AvatarContent } from '@atlaskit/avatar/avatar-content';
|
|
11
|
-
import AiBotIcon from '@atlaskit/icon-lab/core/ai-bot';
|
|
12
|
-
import { RovoHexIcon } from '@atlaskit/logo/rovo-hex/icon';
|
|
13
|
-
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
14
|
-
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
15
|
-
import { getAccentTokens } from '../../pm-plugins/decorations/colorSchemes/factory';
|
|
16
|
-
import { colorSchemeRegistry } from '../../pm-plugins/decorations/colorSchemes/schemes';
|
|
17
|
-
import { contributorTagMessages } from './messages';
|
|
18
|
-
|
|
19
|
-
// Floor for the tag width (~one 16px avatar plus padding), so the highlight-width clamp below
|
|
20
|
-
// cannot collapse the box on a very short highlight.
|
|
21
|
-
const MIN_TAG_WIDTH = '28px';
|
|
22
|
-
const styles = {
|
|
23
|
-
constraint: "_1e0c1ule _kqswstnw _94n51osq _1e02idpf _1ul9idpf _1pbykb7n _uiztglyw",
|
|
24
|
-
tag: "_zulp1b66 _1reo15vq _18m915vq _2rko12b0 _11c8wadc _18zr1b66 _1rjcv77o _1e0c116y _4cvr1h6o _p12f1osq _1ul9idpf _1il9nqa1 _1doc1dm9 _16qs130s _o5721q9c _vchhusvi",
|
|
25
|
-
hidden: "_tzy4idpf _lcxvglyw",
|
|
26
|
-
visible: "_tzy4kb7n _lcxv1wug",
|
|
27
|
-
avatars: "_1e0c116y _4cvr1h6o _1o9zidpf",
|
|
28
|
-
leadingAvatar: "_1e0c116y _12l2r5cr",
|
|
29
|
-
name: "_1reo15vq _18m915vq _1e0c1ule _1ul9idpf _1bto1l2s _o5721q9c"
|
|
30
|
-
};
|
|
31
|
-
const getContributorName = (contributor, formatMessage) => {
|
|
32
|
-
var _contributor$name, _contributor$agentKin;
|
|
33
|
-
const name = (_contributor$name = contributor.name) === null || _contributor$name === void 0 ? void 0 : _contributor$name.trim();
|
|
34
|
-
if (name) {
|
|
35
|
-
return name;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// `agentKind` defaults to `'external'` per the plugin type contract; an unidentified external
|
|
39
|
-
// agent falls back to a generic label rather than rendering a nameless tag.
|
|
40
|
-
if (contributor.kind === 'agent' && ((_contributor$agentKin = contributor.agentKind) !== null && _contributor$agentKin !== void 0 ? _contributor$agentKin : 'external') === 'external') {
|
|
41
|
-
return formatMessage(contributorTagMessages.externalAgentName);
|
|
42
|
-
}
|
|
43
|
-
return '';
|
|
44
|
-
};
|
|
45
|
-
const ContributorAvatar = ({
|
|
46
|
-
contributor,
|
|
47
|
-
name,
|
|
48
|
-
ringColor,
|
|
49
|
-
stackIndex
|
|
50
|
-
}) => {
|
|
51
|
-
if (contributor.kind === 'user') {
|
|
52
|
-
return /*#__PURE__*/React.createElement(Avatar, {
|
|
53
|
-
appearance: "circle",
|
|
54
|
-
size: "xxsmall",
|
|
55
|
-
src: contributor.avatarUrl,
|
|
56
|
-
name: name,
|
|
57
|
-
stackIndex: stackIndex,
|
|
58
|
-
borderColor: ringColor
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return /*#__PURE__*/React.createElement(Avatar, {
|
|
62
|
-
appearance: "hexagon",
|
|
63
|
-
size: "xxsmall",
|
|
64
|
-
src: contributor.avatarUrl,
|
|
65
|
-
name: name,
|
|
66
|
-
stackIndex: stackIndex,
|
|
67
|
-
borderColor: ringColor
|
|
68
|
-
}, contributor.avatarUrl ? undefined : /*#__PURE__*/React.createElement(AvatarContent, null, contributor.agentKind === 'rovo' ? /*#__PURE__*/React.createElement(RovoHexIcon, {
|
|
69
|
-
size: "xxsmall",
|
|
70
|
-
label: ""
|
|
71
|
-
}) :
|
|
72
|
-
/*#__PURE__*/
|
|
73
|
-
// `small` (12px) fits inside the 16px hexagon.
|
|
74
|
-
React.createElement(AiBotIcon, {
|
|
75
|
-
label: "",
|
|
76
|
-
size: "small"
|
|
77
|
-
})));
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Resolves the tag's accent from the same scheme value and token maps the highlight used, so the two
|
|
81
|
-
* can never drift.
|
|
82
|
-
*/
|
|
83
|
-
const getTagAccent = ({
|
|
84
|
-
colorScheme,
|
|
85
|
-
isActive,
|
|
86
|
-
isInserted
|
|
87
|
-
}) => {
|
|
88
|
-
const colors = colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
|
|
89
|
-
const accent = isInserted ? isActive ? colors.insertActiveColor : colors.insertColor : isActive ? colors.deleteActiveColor : colors.deleteColor;
|
|
90
|
-
return getAccentTokens(accent);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/** The line the change starts on: topmost of its fragments, leftmost among those. */
|
|
94
|
-
const findChangeStartLine = highlights => {
|
|
95
|
-
let start;
|
|
96
|
-
for (const highlight of highlights) {
|
|
97
|
-
for (const rect of highlight.getClientRects()) {
|
|
98
|
-
if (!start || rect.top < start.top - 1 || Math.abs(rect.top - start.top) <= 1 && rect.left < start.left) {
|
|
99
|
-
start = rect;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return start;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Observes the highlight this tag describes, for what CSS here cannot see: its hover state (the
|
|
108
|
-
* highlight is a ProseMirror decoration in a different DOM subtree, so listeners are bound
|
|
109
|
-
* imperatively via `data-diff-id`) and the width the tag is clamped to.
|
|
110
|
-
*
|
|
111
|
-
* Deliberately not routed through plugin state: a transaction per pointer move would re-run the
|
|
112
|
-
* memoised decoration calculation.
|
|
113
|
-
*/
|
|
114
|
-
const useHighlightState = (diffId, highlightSelector, getEditorRoot) => {
|
|
115
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
116
|
-
const [maxWidthPx, setMaxWidthPx] = useState(undefined);
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
// Both queries are scoped to this editor's content root, so a tag can only ever bind to the
|
|
119
|
-
// decorations its own plugin instance rendered — another editor on the page, or one nested
|
|
120
|
-
// inside this one, cannot supply the geometry.
|
|
121
|
-
const editorRoot = getEditorRoot();
|
|
122
|
-
const highlights = editorRoot === null || editorRoot === void 0 ? void 0 : editorRoot.querySelectorAll(highlightSelector);
|
|
123
|
-
if (!editorRoot || !(highlights !== null && highlights !== void 0 && highlights.length)) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const elements = Array.from(highlights);
|
|
127
|
-
// The width comes from this tag's OWN decoration; sibling halves of the change are here for
|
|
128
|
-
// hover only.
|
|
129
|
-
const ownElements = Array.from(editorRoot.querySelectorAll(`[data-diff-id="${diffId}"]`));
|
|
130
|
-
const measure = () => {
|
|
131
|
-
var _findChangeStartLine;
|
|
132
|
-
// Counted by distinct line box, not by client rect: an inline node inside the change (a
|
|
133
|
-
// mention, emoji, date) splits the highlight into several rects on the same line, and
|
|
134
|
-
// treating that as a wrap would drop the width clamp on changes that never wrapped.
|
|
135
|
-
const lineTops = new Set();
|
|
136
|
-
for (const highlight of ownElements) {
|
|
137
|
-
for (const rect of highlight.getClientRects()) {
|
|
138
|
-
lineTops.add(Math.round(rect.top));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// A wrapped change's first line says nothing useful about how wide the tag may be.
|
|
143
|
-
const width = lineTops.size > 1 ? undefined : (_findChangeStartLine = findChangeStartLine(ownElements)) === null || _findChangeStartLine === void 0 ? void 0 : _findChangeStartLine.width;
|
|
144
|
-
setMaxWidthPx(width);
|
|
145
|
-
};
|
|
146
|
-
measure();
|
|
147
|
-
|
|
148
|
-
// An inline element cannot be observed itself (ResizeObserver skips boxes with no principal
|
|
149
|
-
// box), so the block it sits in is observed instead.
|
|
150
|
-
const resizeObserver = new ResizeObserver(measure);
|
|
151
|
-
for (const parent of new Set(ownElements.map(({
|
|
152
|
-
parentElement
|
|
153
|
-
}) => parentElement))) {
|
|
154
|
-
if (parent) {
|
|
155
|
-
resizeObserver.observe(parent);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// `bindAll` takes a single target, and a change can render more than one highlight.
|
|
160
|
-
const unbinds = elements.map(highlight => bindAll(highlight, [{
|
|
161
|
-
type: 'mouseenter',
|
|
162
|
-
listener: () => setIsHovered(true)
|
|
163
|
-
}, {
|
|
164
|
-
type: 'mouseleave',
|
|
165
|
-
listener: () => setIsHovered(false)
|
|
166
|
-
}]));
|
|
167
|
-
return () => {
|
|
168
|
-
resizeObserver.disconnect();
|
|
169
|
-
unbinds.forEach(unbind => unbind());
|
|
170
|
-
};
|
|
171
|
-
}, [diffId, getEditorRoot, highlightSelector]);
|
|
172
|
-
return {
|
|
173
|
-
isHovered,
|
|
174
|
-
maxWidthPx
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* A small tag naming who made one diff, rendered into the host widget its decoration places on the
|
|
180
|
-
* change's first character and positioned above it.
|
|
181
|
-
*/
|
|
182
|
-
export function ContributorTag({
|
|
183
|
-
colorScheme,
|
|
184
|
-
connectedContributor,
|
|
185
|
-
contributor,
|
|
186
|
-
diffId,
|
|
187
|
-
getEditorRoot,
|
|
188
|
-
isActive,
|
|
189
|
-
isInserted = true,
|
|
190
|
-
linkedDiffIds
|
|
191
|
-
}) {
|
|
192
|
-
const {
|
|
193
|
-
formatMessage
|
|
194
|
-
} = useIntl();
|
|
195
|
-
// A plain string, so the hook's effect is not re-run by a fresh array on every render.
|
|
196
|
-
const highlightSelector = [diffId, ...(linkedDiffIds !== null && linkedDiffIds !== void 0 ? linkedDiffIds : [])].map(id => `[data-diff-id="${id}"]`).join(', ');
|
|
197
|
-
const {
|
|
198
|
-
isHovered: isHighlightHovered,
|
|
199
|
-
maxWidthPx
|
|
200
|
-
} = useHighlightState(diffId, highlightSelector, getEditorRoot);
|
|
201
|
-
const accent = getTagAccent({
|
|
202
|
-
colorScheme,
|
|
203
|
-
isActive: Boolean(isActive),
|
|
204
|
-
isInserted
|
|
205
|
-
});
|
|
206
|
-
const nameRef = useRef(null);
|
|
207
|
-
const [isTruncated, setIsTruncated] = useState(false);
|
|
208
|
-
const [isHoveredOrFocused, setIsHoveredOrFocused] = useState(false);
|
|
209
|
-
const isConnectedPair = Boolean(connectedContributor);
|
|
210
|
-
const isPrimaryAgent = contributor.kind === 'agent';
|
|
211
|
-
const primaryName = getContributorName(contributor, formatMessage);
|
|
212
|
-
const secondaryName = connectedContributor ? getContributorName(connectedContributor, formatMessage) : '';
|
|
213
|
-
|
|
214
|
-
// Resolved by `kind` so a reverse `connectedTo` (an attributed user pointing at its agent)
|
|
215
|
-
// renders identically.
|
|
216
|
-
const agentName = isPrimaryAgent ? primaryName : secondaryName;
|
|
217
|
-
const userName = isPrimaryAgent ? secondaryName : primaryName;
|
|
218
|
-
const userContributor = isPrimaryAgent ? connectedContributor : contributor;
|
|
219
|
-
const agentContributor = isPrimaryAgent ? contributor : connectedContributor;
|
|
220
|
-
const displayName = isConnectedPair ? agentName || primaryName : primaryName;
|
|
221
|
-
const fullLabel = isConnectedPair ? formatMessage(contributorTagMessages.changedByConnected, {
|
|
222
|
-
agentName,
|
|
223
|
-
userName
|
|
224
|
-
}) : formatMessage(contributorTagMessages.changedBy, {
|
|
225
|
-
name: primaryName
|
|
226
|
-
});
|
|
227
|
-
const measureTruncation = useCallback(() => {
|
|
228
|
-
const element = nameRef.current;
|
|
229
|
-
if (element) {
|
|
230
|
-
setIsTruncated(element.scrollWidth > element.clientWidth);
|
|
231
|
-
}
|
|
232
|
-
}, []);
|
|
233
|
-
const isVisible = Boolean(isActive) || isHighlightHovered || isHoveredOrFocused;
|
|
234
|
-
|
|
235
|
-
// A connected pair only ever renders the agent name, so it always gets a tooltip; a single
|
|
236
|
-
// contributor only when its name is clipped.
|
|
237
|
-
const tooltipContent = isTruncated || isConnectedPair ? fullLabel : null;
|
|
238
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
239
|
-
style: {
|
|
240
|
-
// Clamped to the highlight's own width, floored at `MIN_TAG_WIDTH` so a one-character
|
|
241
|
-
// change still shows an avatar.
|
|
242
|
-
maxWidth: maxWidthPx === undefined ? undefined : `max(${Math.round(maxWidthPx)}px, ${MIN_TAG_WIDTH})`
|
|
243
|
-
},
|
|
244
|
-
className: ax([styles.constraint])
|
|
245
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
246
|
-
content: tooltipContent
|
|
247
|
-
// A tooltip below would cover the highlighted text the tag describes.
|
|
248
|
-
,
|
|
249
|
-
position: "top"
|
|
250
|
-
// The label is already exposed by the visually hidden text below.
|
|
251
|
-
,
|
|
252
|
-
isScreenReaderAnnouncementDisabled: true
|
|
253
|
-
}, tooltipProps => /*#__PURE__*/React.createElement("span", _extends({}, tooltipProps, {
|
|
254
|
-
"data-testid": "diff-contributor-tag"
|
|
255
|
-
// Deliberately no `aria-label`: it would be announced ahead of the element's
|
|
256
|
-
// contents, but design requires the contributor *after* the change — hence the
|
|
257
|
-
// visually hidden last child.
|
|
258
|
-
,
|
|
259
|
-
role: "note"
|
|
260
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex, @atlassian/a11y/no-noninteractive-tabindex
|
|
261
|
-
,
|
|
262
|
-
tabIndex: 0,
|
|
263
|
-
style: {
|
|
264
|
-
backgroundColor: accent.background,
|
|
265
|
-
borderBottomColor: accent.border
|
|
266
|
-
},
|
|
267
|
-
onMouseOver: event => {
|
|
268
|
-
tooltipProps.onMouseOver(event);
|
|
269
|
-
measureTruncation();
|
|
270
|
-
setIsHoveredOrFocused(true);
|
|
271
|
-
},
|
|
272
|
-
onMouseOut: event => {
|
|
273
|
-
tooltipProps.onMouseOut(event);
|
|
274
|
-
setIsHoveredOrFocused(false);
|
|
275
|
-
},
|
|
276
|
-
onFocus: event => {
|
|
277
|
-
tooltipProps.onFocus(event);
|
|
278
|
-
measureTruncation();
|
|
279
|
-
setIsHoveredOrFocused(true);
|
|
280
|
-
},
|
|
281
|
-
onBlur: event => {
|
|
282
|
-
tooltipProps.onBlur(event);
|
|
283
|
-
setIsHoveredOrFocused(false);
|
|
284
|
-
},
|
|
285
|
-
className: ax([styles.tag, isVisible ? styles.visible : styles.hidden])
|
|
286
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
287
|
-
className: ax([styles.avatars])
|
|
288
|
-
}, isConnectedPair && userContributor ? /*#__PURE__*/React.createElement("span", {
|
|
289
|
-
className: ax([styles.leadingAvatar])
|
|
290
|
-
}, /*#__PURE__*/React.createElement(ContributorAvatar, {
|
|
291
|
-
contributor: userContributor,
|
|
292
|
-
name: userName,
|
|
293
|
-
ringColor: accent.background,
|
|
294
|
-
stackIndex: 1
|
|
295
|
-
})) : null, isConnectedPair && agentContributor ? /*#__PURE__*/React.createElement(ContributorAvatar, {
|
|
296
|
-
contributor: agentContributor,
|
|
297
|
-
name: agentName,
|
|
298
|
-
ringColor: accent.background,
|
|
299
|
-
stackIndex: 0
|
|
300
|
-
}) : null, !isConnectedPair ? /*#__PURE__*/React.createElement(ContributorAvatar, {
|
|
301
|
-
contributor: contributor,
|
|
302
|
-
name: primaryName,
|
|
303
|
-
ringColor: accent.background
|
|
304
|
-
}) : null), /*#__PURE__*/React.createElement("span", {
|
|
305
|
-
"data-testid": "diff-contributor-tag-name",
|
|
306
|
-
ref: nameRef,
|
|
307
|
-
style: {
|
|
308
|
-
color: accent.text
|
|
309
|
-
},
|
|
310
|
-
className: ax([styles.name])
|
|
311
|
-
}, displayName), /*#__PURE__*/React.createElement(VisuallyHidden, null, fullLabel))));
|
|
312
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/* ContributorTagWidget.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
-
import { ContributorTag } from './ContributorTag';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* One contributor tag, mounted by its diff decoration into the host element that decoration draws
|
|
9
|
-
* (see `mountContributorTag`).
|
|
10
|
-
*
|
|
11
|
-
* The model is read from plugin state here rather than passed in, because ProseMirror skips `toDOM`
|
|
12
|
-
* for a widget it reuses: stepping to the next change republishes the tags without redrawing their
|
|
13
|
-
* hosts, so anything the tag needs to react to — `isActive` above all — has to arrive through a
|
|
14
|
-
* subscription of its own. Renders nothing when this diff has no tag, which is the case for the
|
|
15
|
-
* deleted half of a replacement: that half is folded into the inline tag.
|
|
16
|
-
*/
|
|
17
|
-
export const ContributorTagWidget = ({
|
|
18
|
-
api,
|
|
19
|
-
diffId,
|
|
20
|
-
getEditorRoot
|
|
21
|
-
}) => {
|
|
22
|
-
const {
|
|
23
|
-
model
|
|
24
|
-
} = useSharedPluginStateWithSelector(api, ['showDiff'], state => {
|
|
25
|
-
var _state$showDiffState, _state$showDiffState$;
|
|
26
|
-
return {
|
|
27
|
-
model: (_state$showDiffState = state.showDiffState) === null || _state$showDiffState === void 0 ? void 0 : (_state$showDiffState$ = _state$showDiffState.contributorTags) === null || _state$showDiffState$ === void 0 ? void 0 : _state$showDiffState$.find(tag => tag.diffId === diffId)
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
if (!model) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/React.createElement(ContributorTag, {
|
|
34
|
-
colorScheme: model.colorScheme,
|
|
35
|
-
connectedContributor: model.connectedContributor,
|
|
36
|
-
contributor: model.contributor,
|
|
37
|
-
diffId: model.diffId,
|
|
38
|
-
getEditorRoot: getEditorRoot,
|
|
39
|
-
isActive: model.isActive,
|
|
40
|
-
isInserted: model.isInserted,
|
|
41
|
-
linkedDiffIds: model.linkedDiffIds
|
|
42
|
-
});
|
|
43
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
-
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
|
-
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
4
|
-
._18zr1b66{padding-inline:var(--ds-space-050,4px)}
|
|
5
|
-
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
6
|
-
._12l2r5cr{margin-inline-end:var(--ds-space-negative-050,-4px)}
|
|
7
|
-
._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
8
|
-
._18m915vq{overflow-y:hidden}
|
|
9
|
-
._1bto1l2s{text-overflow:ellipsis}
|
|
10
|
-
._1doc1dm9{border-bottom-width:var(--ds-border-width-selected,2px)}
|
|
11
|
-
._1e02idpf{inset-inline-start:0}
|
|
12
|
-
._1e0c116y{display:inline-flex}
|
|
13
|
-
._1e0c1ule{display:block}
|
|
14
|
-
._1il9nqa1{border-bottom-style:solid}
|
|
15
|
-
._1o9zidpf{flex-shrink:0}
|
|
16
|
-
._1pbykb7n{z-index:1}
|
|
17
|
-
._1reo15vq{overflow-x:hidden}
|
|
18
|
-
._1ul9idpf{min-width:0}
|
|
19
|
-
._4cvr1h6o{align-items:center}
|
|
20
|
-
._94n51osq{bottom:100%}
|
|
21
|
-
._kqswstnw{position:absolute}
|
|
22
|
-
._lcxv1wug{pointer-events:auto}
|
|
23
|
-
._lcxvglyw{pointer-events:none}
|
|
24
|
-
._o5721q9c{white-space:nowrap}
|
|
25
|
-
._p12f1osq{max-width:100%}
|
|
26
|
-
._tzy4idpf{opacity:0}
|
|
27
|
-
._tzy4kb7n{opacity:1}
|
|
28
|
-
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
29
|
-
._vchhusvi{box-sizing:border-box}
|