@atlaskit/editor-plugin-show-diff 17.0.2 → 17.1.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 +12 -0
- package/dist/cjs/entry-points/show-diff-plugin-type.js +12 -1
- package/dist/cjs/pm-plugins/NodeViewSerializer.js +1 -1
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +4 -4
- package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +14 -3
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +1 -1
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +2 -2
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +4 -3
- package/dist/cjs/showDiffPluginType.js +87 -1
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +22 -14
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +4 -0
- package/dist/es2019/entry-points/calculate-diff.js +1 -0
- package/dist/es2019/entry-points/show-diff-plugin-type.js +3 -0
- package/dist/es2019/entry-points/show-diff-plugin.js +1 -0
- package/dist/es2019/pm-plugins/NodeViewSerializer.js +1 -1
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +4 -4
- package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +12 -3
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +0 -1
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +1 -1
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +2 -2
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +3 -1
- package/dist/es2019/pm-plugins/scrollToDiff.js +1 -0
- package/dist/es2019/showDiffPluginType.js +85 -1
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +22 -14
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +4 -0
- package/dist/esm/entry-points/calculate-diff.js +1 -0
- package/dist/esm/entry-points/show-diff-plugin-type.js +3 -0
- package/dist/esm/entry-points/show-diff-plugin.js +1 -0
- package/dist/esm/pm-plugins/NodeViewSerializer.js +1 -1
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +4 -4
- package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +14 -3
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +0 -1
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +1 -1
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +2 -2
- package/dist/esm/pm-plugins/resolveDiffContributors.js +4 -3
- package/dist/esm/pm-plugins/scrollToDiff.js +1 -0
- package/dist/esm/showDiffPluginType.js +85 -1
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +22 -14
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +4 -0
- package/dist/types/entry-points/show-diff-plugin-type.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/attributions.d.ts +2 -2
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/utils/getAttrChangeRanges.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/utils/getMarkChangeRanges.d.ts +1 -1
- package/dist/types/showDiffPluginType.d.ts +6 -1
- package/dist/types/ui/ContributorTag/contributorTagIcons.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `'standard'` (purple insertions, default) and `'traditional'` (green/red) are the two
|
|
3
|
+
* plugin-configured schemes. The remaining accent names are the attribution palette used for
|
|
4
|
+
* per-contributor colouring (`stepsWithAttribution`) — callers of the imperative `showDiff`
|
|
5
|
+
* command (see `PMDiffParams.colorScheme`) can also pass one of these directly to match a
|
|
6
|
+
* specific contributor's colour outside of attribution mode, for example matching a Review
|
|
7
|
+
* moment diff to the streaming highlight of the agent that produced it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Attribution for a ProseMirror step.
|
|
12
|
+
*
|
|
13
|
+
* `userId` is the primary actor identity. `agentId` distinguishes multiple agents (or an agent
|
|
14
|
+
* from its user) when they share that user ID, with `agentType` used as a fallback when `agentId`
|
|
15
|
+
* is empty. `wasOffline` preserves additional provenance without affecting identity.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Keeps a step and its attribution coupled through mapping and filtering. */
|
|
19
|
+
|
|
20
|
+
/** Branded agent presentations supported by contributor tags. */
|
|
21
|
+
|
|
22
|
+
export const DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt']);
|
|
23
|
+
|
|
24
|
+
/** A complete identity for one of the accounts named by a step attribution. */
|
|
25
|
+
|
|
26
|
+
/** Agent presentation: branded, identified by profile, or a generic external agent. */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
|
|
30
|
+
* never re-exported from an entry point and not reachable from any public type. Same for
|
|
31
|
+
* `DiffContributors`.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** Where two contributors share an identity, the last wins. */
|
|
35
|
+
|
|
36
|
+
/** A contributor stripped of its attributions, as a tag presents it. Internal. */
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Everything a contributor tag renders, resolved by the plugin so the tag UI does no lookups.
|
|
40
|
+
* Declared here rather than beside `extractContributorTags` so the shared state below can name it
|
|
41
|
+
* without importing back out of this file. Internal, like `TagContributor`.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Where node/paragraph-level deleted content is rendered relative to the new (replacement)
|
|
46
|
+
* content in the `smart` diffType:
|
|
47
|
+
* - `'top'` (default): the deleted content is anchored above the new content.
|
|
48
|
+
* - `'bottom'`: the deleted content is anchored below the new content.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Where inline-level (and sentence-level) deleted content is rendered relative to the new
|
|
53
|
+
* (replacement) content in the `smart` diffType. This is independent of the node/paragraph-level
|
|
54
|
+
* `deletedDiffPlacement` option:
|
|
55
|
+
* - `'before'` (default): the deleted content is anchored before the new content.
|
|
56
|
+
* - `'after'`: the deleted content is anchored after the new content.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A rendered deleted-content widget: the DOM element show-diff renders for a piece of deleted
|
|
61
|
+
* content, together with the document position it is anchored at. Deleted content is rendered as
|
|
62
|
+
* widget decorations rather than document nodes, so this is how consumers recover the element and
|
|
63
|
+
* its position — via the `getDeletedWidgets` action — without reaching into the plugin's internal
|
|
64
|
+
* state.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
// Re-export the canonical `SmartDiffThresholds` declaration (single source of truth) so the
|
|
68
|
+
// public plugin types stay in sync with the smart-diff implementation.
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* How the diff is revealed when it is painted.
|
|
72
|
+
*
|
|
73
|
+
* - `phased` — the two-phase choreography used when opening the diff from a clean "new state":
|
|
74
|
+
* the outgoing state cross-fades to the incoming one while the agent highlight wipes out to the
|
|
75
|
+
* right, then every highlight wipes back in from the left.
|
|
76
|
+
*
|
|
77
|
+
* Deliberately separate from {@link DiffType}: that describes how changes are computed and grouped,
|
|
78
|
+
* this describes how the result is presented over time. Folding one into the other would make every
|
|
79
|
+
* `DiffType` consumer — version history, track-changes, publish diff — care about presentation.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Attributed alternative to `PMDiffParams`. When agent colouring is enabled, changes are grouped
|
|
84
|
+
* by `userId`, with `agentId` used as a tie-breaker.
|
|
85
|
+
*/
|
|
@@ -7,6 +7,7 @@ import { getContributorTagIcon } from './contributorTagIcons';
|
|
|
7
7
|
/** Agent kinds with a custom contributor-tag icon. */
|
|
8
8
|
const AGENT_KIND_ICONS = {
|
|
9
9
|
claude: 'claude',
|
|
10
|
+
chatgpt: 'chatgpt',
|
|
10
11
|
rovo: 'rovoHex'
|
|
11
12
|
};
|
|
12
13
|
|
|
@@ -87,7 +88,7 @@ export const contributorAvatarRenderer = ({
|
|
|
87
88
|
}
|
|
88
89
|
let image;
|
|
89
90
|
let unbindImageError;
|
|
90
|
-
const
|
|
91
|
+
const showContributorIcon = () => {
|
|
91
92
|
var _unbindImageError, _image, _AGENT_KIND_ICONS, _contributor$agentKin;
|
|
92
93
|
(_unbindImageError = unbindImageError) === null || _unbindImageError === void 0 ? void 0 : _unbindImageError();
|
|
93
94
|
unbindImageError = undefined;
|
|
@@ -103,20 +104,27 @@ export const contributorAvatarRenderer = ({
|
|
|
103
104
|
shape.appendChild(getContributorTagIcon((_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', doc));
|
|
104
105
|
};
|
|
105
106
|
if (contributor.avatarUrl) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
var _contributor$agentKin2;
|
|
108
|
+
// Known brands use their fixed glyph even when the profile also has an avatar URL.
|
|
109
|
+
const brandedAgentIcon = isAgent ? AGENT_KIND_ICONS[(_contributor$agentKin2 = contributor.agentKind) !== null && _contributor$agentKin2 !== void 0 ? _contributor$agentKin2 : 'external'] : undefined;
|
|
110
|
+
if (brandedAgentIcon) {
|
|
111
|
+
showContributorIcon();
|
|
112
|
+
} else {
|
|
113
|
+
image = doc.createElement('img');
|
|
114
|
+
image.alt = '';
|
|
115
|
+
image.decoding = 'async';
|
|
116
|
+
image.draggable = false;
|
|
117
|
+
image.loading = 'lazy';
|
|
118
|
+
image.setAttribute('style', imageStyle);
|
|
119
|
+
unbindImageError = bind(image, {
|
|
120
|
+
type: 'error',
|
|
121
|
+
listener: showContributorIcon
|
|
122
|
+
});
|
|
123
|
+
shape.appendChild(image);
|
|
124
|
+
image.src = contributor.avatarUrl;
|
|
125
|
+
}
|
|
118
126
|
} else {
|
|
119
|
-
|
|
127
|
+
showContributorIcon();
|
|
120
128
|
}
|
|
121
129
|
const setRingColor = nextRingColor => {
|
|
122
130
|
if (isAgent) {
|
|
@@ -27,9 +27,13 @@ const ROVO_HEX_ICON_SVG = `<svg width="16" height="16" viewBox="0 0 24 24" role=
|
|
|
27
27
|
|
|
28
28
|
/** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
|
|
29
29
|
const CLAUDE_ICON_SVG = `<svg width="12" height="12" viewBox="8 8 32 32" role="presentation" style="display:block"><path fill="#FFFFFF" d="M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z"/></svg>`;
|
|
30
|
+
|
|
31
|
+
/** ChatGPT Presence avatar from Confluence's `ChatGptPresenceIcon`, at 16px. */
|
|
32
|
+
const CHATGPT_ICON_SVG = '<svg width="16" height="16" viewBox="1 1.5328 16 16" overflow="visible" fill="none" role="presentation" style="display:block"><path d="M7.24707 0.973022C8.33116 0.344106 9.66865 0.342238 10.7539 0.969116L15.751 3.85583C16.8334 4.48117 17.5 5.63699 17.5 6.88708V12.1801C17.5 13.4301 16.8334 14.586 15.751 15.2113L10.751 18.1C9.66769 18.7258 8.33231 18.7258 7.24902 18.1L2.24902 15.2113C1.16658 14.586 0.5 13.4301 0.5 12.1801V6.90271C0.5 5.65489 1.1648 4.50153 2.24414 3.87537L7.24707 0.973022Z" fill="#14120B" stroke="#FFFFFF" stroke-width="1"/><svg x="4" y="4.53355" width="10" height="10" viewBox="10 12.0281 24 24" overflow="visible"><path d="M32.2119 21.2917C32.7552 19.256 32.2283 16.9938 30.6312 15.3967C29.0342 13.7997 26.7722 13.2728 24.7362 13.8161C23.2447 12.3277 21.0224 11.6529 18.8407 12.2376C16.6589 12.8221 15.0717 14.5177 14.5243 16.5524C12.4896 17.0999 10.794 18.6873 10.2094 20.8688C9.62493 23.0506 10.2996 25.2728 11.7881 26.7644C11.2448 28.8002 11.7718 31.0623 13.3688 32.6594C14.9658 34.2564 17.2278 34.7834 19.2638 34.2401C20.7553 35.7284 22.9778 36.4032 25.1593 35.8187C27.3411 35.2342 28.9283 33.5386 29.4757 31.5039C31.5105 30.9564 33.206 29.3691 33.7905 27.1874C34.3751 25.0058 33.7005 22.7834 32.2119 21.2919V21.2917ZM29.6507 16.3775C30.7329 17.4598 31.1792 18.937 30.9897 20.3453L25.9072 17.4108C25.6929 17.2871 25.4289 17.2871 25.2148 17.4108L19.2638 20.8466V18.5936C19.2638 18.4356 19.3485 18.2877 19.4854 18.2087L24.017 15.5924C25.8125 14.5895 28.1246 14.8514 29.6508 16.3775H29.6507ZM22 20.8685L24.7364 22.4483V25.608L22 27.1878L19.2636 25.608V22.4483L22 20.8685ZM15.7028 18.0636C15.732 16.0073 17.1149 14.1359 19.1997 13.5772C20.678 13.1811 22.1806 13.5333 23.3053 14.4014L18.2226 17.3357C18.0084 17.4594 17.8764 17.6881 17.8764 17.9353V24.8069L15.9253 23.6804C15.7885 23.6014 15.7028 23.454 15.7028 23.2959V18.0634V18.0636ZM11.549 21.2278C11.9451 19.7495 13.0014 18.6242 14.3156 18.0843V23.9532C14.3156 24.2004 14.4476 24.4291 14.6618 24.5528L20.6128 27.9886L18.6617 29.1151C18.5249 29.1941 18.3544 29.1946 18.2175 29.1156L13.6859 26.4993C11.9196 25.4459 10.9905 23.3124 11.549 21.2278ZM14.3494 31.6788C13.2671 30.5965 12.8208 29.1193 13.0103 27.7111L18.0928 30.6455C18.3071 30.7692 18.5711 30.7692 18.7852 30.6455L24.7362 27.2098V29.4626C24.7362 29.6207 24.6516 29.7682 24.5146 29.8477L19.983 32.4639C18.1875 33.4667 15.8754 33.2049 14.3492 31.6788H14.3494ZM28.2972 29.9927C28.268 32.049 26.8851 33.9205 24.8003 34.4791C23.322 34.8752 21.8194 34.523 20.6947 33.6549L25.7774 30.7205C25.9917 30.5969 26.1236 30.3682 26.1236 30.1209V23.2494L28.0747 24.3759C28.2115 24.4549 28.2972 24.6023 28.2972 24.7604V29.9929V29.9927ZM32.451 26.8285C32.0549 28.3068 30.9986 29.4321 29.6844 29.972V24.1031C29.6844 23.8559 29.5525 23.6272 29.3382 23.5035L23.3872 20.0678L25.3383 18.9412C25.4751 18.8622 25.6456 18.8617 25.7825 18.9407L30.314 21.5569C32.0804 22.6105 33.0095 24.7439 32.451 26.8285Z" fill="#FFFFFF"/></svg></svg>';
|
|
30
33
|
const markup = {
|
|
31
34
|
aiAgent: AI_AGENT_ICON_SVG,
|
|
32
35
|
aiBot: AI_BOT_ICON_SVG,
|
|
36
|
+
chatgpt: CHATGPT_ICON_SVG,
|
|
33
37
|
claude: CLAUDE_ICON_SVG,
|
|
34
38
|
person: PERSON_ICON_SVG,
|
|
35
39
|
rovoHex: ROVO_HEX_ICON_SVG
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
3
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Utilities for working with ProseMirror node views and DOM serialization within the
|
|
@@ -17,26 +17,26 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
17
17
|
import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
19
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
20
|
+
import { createAttributionColorMap, getAttributionKey, getAttributionKeyForChange, getColorSchemeForChange, isAttributionColoringEnabled, isContributorTagsEnabled } from '../decorations/colorSchemes/attributions';
|
|
20
21
|
import { createDocMarginAnchorWidget } from '../decorations/createAnchorDecorationWidgets';
|
|
21
22
|
import { createBlockChangedDecoration } from '../decorations/createBlockChangedDecoration';
|
|
22
23
|
import { createInlineChangedDecoration } from '../decorations/createInlineChangedDecoration';
|
|
23
24
|
import { createNodeChangedDecorationWidget } from '../decorations/createNodeChangedDecorationWidget';
|
|
24
|
-
import { createAttributionColorMap, getAttributionKey, getAttributionKeyForChange, getColorSchemeForChange, isAttributionColoringEnabled, isContributorTagsEnabled } from '../decorations/colorSchemes/attributions';
|
|
25
25
|
import { extractDiffDescriptors } from '../decorations/decorationKeys';
|
|
26
26
|
import { extractContributorTags } from '../decorations/extractContributorTags';
|
|
27
27
|
import { createDeletedLineBreakDecoration } from '../decorations/utils/createDeletedLineBreakWidget';
|
|
28
28
|
import { getAttrChangeRanges, stepIsValidAttrChange } from '../decorations/utils/getAttrChangeRanges';
|
|
29
|
-
import { createRemovedLozenge } from '../decorations/utils/wrapBlockNodeView';
|
|
30
29
|
import { getMarkChangeRanges } from '../decorations/utils/getMarkChangeRanges';
|
|
30
|
+
import { createRemovedLozenge } from '../decorations/utils/wrapBlockNodeView';
|
|
31
31
|
import { getScrollableDecorations } from '../getScrollableDecorations';
|
|
32
32
|
import { getDefaultDiffType, isExtendedEnabled } from '../isExtendedEnabled';
|
|
33
33
|
import { emptyTextBlockContentPositions } from '../utils/emptyTextBlocks';
|
|
34
34
|
import { diffBySteps } from './diffBySteps';
|
|
35
35
|
import { groupChangesByBlock } from './groupChangesByBlock';
|
|
36
|
+
import { CELL_CONTENT_OFFSET, groupDeletedColumnChanges } from './groupDeletedColumnChanges';
|
|
36
37
|
import { isMarkOnlyChange } from './isMarkOnlyChange';
|
|
37
38
|
import { isOpenTokenOnlyChange } from './isOpenTokenOnlyChange';
|
|
38
39
|
import { optimizeChanges } from './optimizeChanges';
|
|
39
|
-
import { CELL_CONTENT_OFFSET, groupDeletedColumnChanges } from './groupDeletedColumnChanges';
|
|
40
40
|
import { selectTokenEncoder } from './selectTokenEncoder';
|
|
41
41
|
import { collapseOverlappingChanges, simplifyChangesWithAttribution } from './simplifyChangesWithAttribution';
|
|
42
42
|
import { simplifySteps, simplifyStepsWithAttribution } from './simplifySteps';
|
|
@@ -506,7 +506,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
506
506
|
|
|
507
507
|
// Still colours-only: a tags-only diff keeps the plain colour scheme.
|
|
508
508
|
if (attributionColoringEnabled) {
|
|
509
|
-
attributionColors = createAttributionColorMap(simplifiedStepAttributions);
|
|
509
|
+
attributionColors = createAttributionColorMap(simplifiedStepAttributions, contributors);
|
|
510
510
|
}
|
|
511
511
|
} else {
|
|
512
512
|
var _changeset = ChangeSet.create(originalDoc, undefined, tokenEncoder).addSteps(steppedDoc, stepMaps, tr.doc);
|
|
@@ -11,6 +11,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
11
11
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles/utils';
|
|
12
12
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
14
|
+
import { DIFF_AGENT_BRANDS } from '../../../showDiffPluginType';
|
|
14
15
|
import { PARTICIPANT_COLOR_SCHEMES } from './types';
|
|
15
16
|
|
|
16
17
|
/** A contributor with both of its identities collapsed to internal attribution keys. */
|
|
@@ -89,6 +90,16 @@ export var getAttributionKey = function getAttributionKey(attribution) {
|
|
|
89
90
|
var _getAttributionIdenti;
|
|
90
91
|
return (_getAttributionIdenti = getAttributionIdentity(attribution)) === null || _getAttributionIdenti === void 0 ? void 0 : _getAttributionIdenti.key;
|
|
91
92
|
};
|
|
93
|
+
var isDiffAgentBrand = function isDiffAgentBrand(agentBrand) {
|
|
94
|
+
return agentBrand !== undefined && DIFF_AGENT_BRANDS.has(agentBrand);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** Prefers the resolved branded profile over the raw attribution agent type. */
|
|
98
|
+
var getAgentBrandForColor = function getAgentBrandForColor(attribution, contributors) {
|
|
99
|
+
var _contributors, _getAttributionKey;
|
|
100
|
+
var agentBrand = contributors === null || contributors === void 0 || (_contributors = contributors[(_getAttributionKey = getAttributionKey(attribution)) !== null && _getAttributionKey !== void 0 ? _getAttributionKey : '']) === null || _contributors === void 0 ? void 0 : _contributors.agentKind;
|
|
101
|
+
return isDiffAgentBrand(agentBrand) ? agentBrand : attribution === null || attribution === void 0 ? void 0 : attribution.agentType;
|
|
102
|
+
};
|
|
92
103
|
|
|
93
104
|
/**
|
|
94
105
|
* Public contributor list to internal key-addressed record. A contributor whose attribution carries
|
|
@@ -148,7 +159,7 @@ export var isContributorTagsEnabled = function isContributorTagsEnabled(stepAttr
|
|
|
148
159
|
return getAttributionKey(attribution) !== undefined;
|
|
149
160
|
})) && contributors !== undefined && Object.keys(contributors).length > 0;
|
|
150
161
|
};
|
|
151
|
-
export var createAttributionColorMap = function createAttributionColorMap(stepAttributions) {
|
|
162
|
+
export var createAttributionColorMap = function createAttributionColorMap(stepAttributions, contributors) {
|
|
152
163
|
var colors = new Map();
|
|
153
164
|
var allocatedColors = new Set();
|
|
154
165
|
|
|
@@ -163,7 +174,7 @@ export var createAttributionColorMap = function createAttributionColorMap(stepAt
|
|
|
163
174
|
if (!identity) {
|
|
164
175
|
continue;
|
|
165
176
|
}
|
|
166
|
-
var _getParticipantColor = getParticipantColor(identity.colorSeed, attribution
|
|
177
|
+
var _getParticipantColor = getParticipantColor(identity.colorSeed, getAgentBrandForColor(attribution, contributors)),
|
|
167
178
|
index = _getParticipantColor.index,
|
|
168
179
|
isFixed = _getParticipantColor.isFixed;
|
|
169
180
|
var color = HASHED_PARTICIPANT_COLOR_SCHEMES[index];
|
|
@@ -186,7 +197,7 @@ export var createAttributionColorMap = function createAttributionColorMap(stepAt
|
|
|
186
197
|
if (!_identity || colors.has(_identity.key)) {
|
|
187
198
|
continue;
|
|
188
199
|
}
|
|
189
|
-
var _getParticipantColor2 = getParticipantColor(_identity.colorSeed, _attribution
|
|
200
|
+
var _getParticipantColor2 = getParticipantColor(_identity.colorSeed, getAgentBrandForColor(_attribution, contributors)),
|
|
190
201
|
_index = _getParticipantColor2.index;
|
|
191
202
|
var hashedColor = getSlotColor(_index);
|
|
192
203
|
if (!hashedColor) {
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { agentBrandColorSchemes } from '@atlaskit/agent-color/agent-brand-color-schemes';
|
|
5
5
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
6
|
import { getStandardDeletedTextDecorationStyle } from './getStandardDeletedTextDecorationStyle';
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Hover highlight for deleted text under an 'onEmphasis' scheme. Inline styles cannot express
|
|
10
9
|
* `:hover`, so the resting style resolves its background from this property and
|
|
@@ -12,9 +12,9 @@ import { isTaggableBlockNode } from '../utils/taggableBlockNodes';
|
|
|
12
12
|
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildDeletedBlockNodeStyle, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildInsertedBlockNodeStyle } from './colorSchemes/factory';
|
|
13
13
|
import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
|
|
14
14
|
import { createBlockIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
|
|
15
|
+
import { getBlockNodeStyleLegacy, resolveCellOverlayStyleLegacy } from './createBlockChangedDecoration.styles.legacy';
|
|
15
16
|
import { createContributorTagWidget, isContributorTagWidgetEnabled } from './createContributorTagWidget';
|
|
16
17
|
import { AnchorTypeKey, buildDiffDecorationSpec, buildAnchorDecorationKey, scrollMarginTopStyle } from './decorationKeys';
|
|
17
|
-
import { getBlockNodeStyleLegacy, resolveCellOverlayStyleLegacy } from './createBlockChangedDecoration.styles.legacy';
|
|
18
18
|
var displayNoneStyle = convertToInlineCss({
|
|
19
19
|
display: 'none'
|
|
20
20
|
});
|
|
@@ -20,8 +20,8 @@ import { resolveCellOverlayStyleLegacy, resolveDeletedRowStyleLegacy } from './c
|
|
|
20
20
|
import { createContributorTagWidget, isContributorTagWidgetEnabled } from './createContributorTagWidget';
|
|
21
21
|
import { AnchorTypeKey, buildAnchorDecorationKey, buildDiffDecorationSpec, scrollMarginTopValue } from './decorationKeys';
|
|
22
22
|
import { findSafeInsertPos } from './utils/findSafeInsertPos';
|
|
23
|
-
import { createRemovedLozenge } from './utils/wrapBlockNodeView';
|
|
24
23
|
import { applyCellEdgeAttrs, getRowCellEdgeAttrs, getTableTopAndBottomCellEdgeAttrs } from './utils/tableCellEdgeAttrs';
|
|
24
|
+
import { createRemovedLozenge } from './utils/wrapBlockNodeView';
|
|
25
25
|
/**
|
|
26
26
|
* Extracts information about deleted table rows from a change
|
|
27
27
|
*/
|
|
@@ -6,10 +6,10 @@ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-e
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
8
|
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
9
|
-
import { applyRevealToElement } from '../revealStyles';
|
|
10
9
|
import { getAtomicInlineChangedAttrs } from '../createInlineChangedDecoration';
|
|
11
|
-
import {
|
|
10
|
+
import { applyRevealToElement } from '../revealStyles';
|
|
12
11
|
import { isInlineAttrChangeNodeName } from './getAttrChangeRanges';
|
|
12
|
+
import { applyTableCellEdgeAttrs } from './tableCellEdgeAttrs';
|
|
13
13
|
import { getChangedContentStyle, getChangedNodeStyle, getDeletedContentStyle, getDeletedContentStyleUnbounded, getInsertedContentStyle, hasRestingDeletedRing, isMultiContainerBlockNode, isTextLikeBlockNode, resolveCellOverlayStyle, resolveDeletedNodeCSSVariables, resolveNestedInsertedNodeStyle, resolveRemovedLozengeStyle } from './wrapBlockNodeViewStyles';
|
|
14
14
|
var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
15
15
|
switch (nodeName) {
|
|
@@ -91,12 +91,13 @@ var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
|
|
|
91
91
|
var agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
|
|
92
92
|
var agentProfile = agentId ? profilesByAccountId.get(agentId) : undefined;
|
|
93
93
|
if (agentProfile) {
|
|
94
|
-
return {
|
|
95
|
-
agentKind:
|
|
94
|
+
return _objectSpread(_objectSpread({}, agentProfile.agentBrand ? {
|
|
95
|
+
agentKind: agentProfile.agentBrand
|
|
96
|
+
} : {}), {}, {
|
|
96
97
|
avatarUrl: agentProfile.avatarUrl,
|
|
97
98
|
kind: 'agent',
|
|
98
99
|
name: agentProfile.name
|
|
99
|
-
};
|
|
100
|
+
});
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
// Unknown types keep an empty name for the tag's localised "External agent" label.
|
|
@@ -2,6 +2,7 @@ import { tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
|
2
2
|
import { getStickyHeaderHeight } from '@atlaskit/editor-common/table/get-sticky-header-height';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { isDiffDecoration, SCROLL_TARGET_MARGIN_CSS_PROPERTY } from './decorations/decorationKeys';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* Extra space above the scrolled-to element so it does not sit flush under the
|
|
7
8
|
* viewport edge (helps with sticky table headers, toolbars, etc.).
|
|
@@ -1 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `'standard'` (purple insertions, default) and `'traditional'` (green/red) are the two
|
|
3
|
+
* plugin-configured schemes. The remaining accent names are the attribution palette used for
|
|
4
|
+
* per-contributor colouring (`stepsWithAttribution`) — callers of the imperative `showDiff`
|
|
5
|
+
* command (see `PMDiffParams.colorScheme`) can also pass one of these directly to match a
|
|
6
|
+
* specific contributor's colour outside of attribution mode, for example matching a Review
|
|
7
|
+
* moment diff to the streaming highlight of the agent that produced it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Attribution for a ProseMirror step.
|
|
12
|
+
*
|
|
13
|
+
* `userId` is the primary actor identity. `agentId` distinguishes multiple agents (or an agent
|
|
14
|
+
* from its user) when they share that user ID, with `agentType` used as a fallback when `agentId`
|
|
15
|
+
* is empty. `wasOffline` preserves additional provenance without affecting identity.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Keeps a step and its attribution coupled through mapping and filtering. */
|
|
19
|
+
|
|
20
|
+
/** Branded agent presentations supported by contributor tags. */
|
|
21
|
+
|
|
22
|
+
export var DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt']);
|
|
23
|
+
|
|
24
|
+
/** A complete identity for one of the accounts named by a step attribution. */
|
|
25
|
+
|
|
26
|
+
/** Agent presentation: branded, identified by profile, or a generic external agent. */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
|
|
30
|
+
* never re-exported from an entry point and not reachable from any public type. Same for
|
|
31
|
+
* `DiffContributors`.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** Where two contributors share an identity, the last wins. */
|
|
35
|
+
|
|
36
|
+
/** A contributor stripped of its attributions, as a tag presents it. Internal. */
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Everything a contributor tag renders, resolved by the plugin so the tag UI does no lookups.
|
|
40
|
+
* Declared here rather than beside `extractContributorTags` so the shared state below can name it
|
|
41
|
+
* without importing back out of this file. Internal, like `TagContributor`.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Where node/paragraph-level deleted content is rendered relative to the new (replacement)
|
|
46
|
+
* content in the `smart` diffType:
|
|
47
|
+
* - `'top'` (default): the deleted content is anchored above the new content.
|
|
48
|
+
* - `'bottom'`: the deleted content is anchored below the new content.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Where inline-level (and sentence-level) deleted content is rendered relative to the new
|
|
53
|
+
* (replacement) content in the `smart` diffType. This is independent of the node/paragraph-level
|
|
54
|
+
* `deletedDiffPlacement` option:
|
|
55
|
+
* - `'before'` (default): the deleted content is anchored before the new content.
|
|
56
|
+
* - `'after'`: the deleted content is anchored after the new content.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A rendered deleted-content widget: the DOM element show-diff renders for a piece of deleted
|
|
61
|
+
* content, together with the document position it is anchored at. Deleted content is rendered as
|
|
62
|
+
* widget decorations rather than document nodes, so this is how consumers recover the element and
|
|
63
|
+
* its position — via the `getDeletedWidgets` action — without reaching into the plugin's internal
|
|
64
|
+
* state.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
// Re-export the canonical `SmartDiffThresholds` declaration (single source of truth) so the
|
|
68
|
+
// public plugin types stay in sync with the smart-diff implementation.
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* How the diff is revealed when it is painted.
|
|
72
|
+
*
|
|
73
|
+
* - `phased` — the two-phase choreography used when opening the diff from a clean "new state":
|
|
74
|
+
* the outgoing state cross-fades to the incoming one while the agent highlight wipes out to the
|
|
75
|
+
* right, then every highlight wipes back in from the left.
|
|
76
|
+
*
|
|
77
|
+
* Deliberately separate from {@link DiffType}: that describes how changes are computed and grouped,
|
|
78
|
+
* this describes how the result is presented over time. Folding one into the other would make every
|
|
79
|
+
* `DiffType` consumer — version history, track-changes, publish diff — care about presentation.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Attributed alternative to `PMDiffParams`. When agent colouring is enabled, changes are grouped
|
|
84
|
+
* by `userId`, with `agentId` used as a tie-breaker.
|
|
85
|
+
*/
|
|
@@ -7,6 +7,7 @@ import { getContributorTagIcon } from './contributorTagIcons';
|
|
|
7
7
|
/** Agent kinds with a custom contributor-tag icon. */
|
|
8
8
|
var AGENT_KIND_ICONS = {
|
|
9
9
|
claude: 'claude',
|
|
10
|
+
chatgpt: 'chatgpt',
|
|
10
11
|
rovo: 'rovoHex'
|
|
11
12
|
};
|
|
12
13
|
|
|
@@ -86,7 +87,7 @@ export var contributorAvatarRenderer = function contributorAvatarRenderer(_ref)
|
|
|
86
87
|
}
|
|
87
88
|
var image;
|
|
88
89
|
var unbindImageError;
|
|
89
|
-
var
|
|
90
|
+
var showContributorIcon = function showContributorIcon() {
|
|
90
91
|
var _unbindImageError, _image, _AGENT_KIND_ICONS, _contributor$agentKin;
|
|
91
92
|
(_unbindImageError = unbindImageError) === null || _unbindImageError === void 0 || _unbindImageError();
|
|
92
93
|
unbindImageError = undefined;
|
|
@@ -102,20 +103,27 @@ export var contributorAvatarRenderer = function contributorAvatarRenderer(_ref)
|
|
|
102
103
|
shape.appendChild(getContributorTagIcon((_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', doc));
|
|
103
104
|
};
|
|
104
105
|
if (contributor.avatarUrl) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
var _contributor$agentKin2;
|
|
107
|
+
// Known brands use their fixed glyph even when the profile also has an avatar URL.
|
|
108
|
+
var brandedAgentIcon = isAgent ? AGENT_KIND_ICONS[(_contributor$agentKin2 = contributor.agentKind) !== null && _contributor$agentKin2 !== void 0 ? _contributor$agentKin2 : 'external'] : undefined;
|
|
109
|
+
if (brandedAgentIcon) {
|
|
110
|
+
showContributorIcon();
|
|
111
|
+
} else {
|
|
112
|
+
image = doc.createElement('img');
|
|
113
|
+
image.alt = '';
|
|
114
|
+
image.decoding = 'async';
|
|
115
|
+
image.draggable = false;
|
|
116
|
+
image.loading = 'lazy';
|
|
117
|
+
image.setAttribute('style', imageStyle);
|
|
118
|
+
unbindImageError = bind(image, {
|
|
119
|
+
type: 'error',
|
|
120
|
+
listener: showContributorIcon
|
|
121
|
+
});
|
|
122
|
+
shape.appendChild(image);
|
|
123
|
+
image.src = contributor.avatarUrl;
|
|
124
|
+
}
|
|
117
125
|
} else {
|
|
118
|
-
|
|
126
|
+
showContributorIcon();
|
|
119
127
|
}
|
|
120
128
|
var setRingColor = function setRingColor(nextRingColor) {
|
|
121
129
|
if (isAgent) {
|
|
@@ -27,9 +27,13 @@ var ROVO_HEX_ICON_SVG = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" r
|
|
|
27
27
|
|
|
28
28
|
/** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
|
|
29
29
|
var CLAUDE_ICON_SVG = "<svg width=\"12\" height=\"12\" viewBox=\"8 8 32 32\" role=\"presentation\" style=\"display:block\"><path fill=\"#FFFFFF\" d=\"M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z\"/></svg>";
|
|
30
|
+
|
|
31
|
+
/** ChatGPT Presence avatar from Confluence's `ChatGptPresenceIcon`, at 16px. */
|
|
32
|
+
var CHATGPT_ICON_SVG = '<svg width="16" height="16" viewBox="1 1.5328 16 16" overflow="visible" fill="none" role="presentation" style="display:block"><path d="M7.24707 0.973022C8.33116 0.344106 9.66865 0.342238 10.7539 0.969116L15.751 3.85583C16.8334 4.48117 17.5 5.63699 17.5 6.88708V12.1801C17.5 13.4301 16.8334 14.586 15.751 15.2113L10.751 18.1C9.66769 18.7258 8.33231 18.7258 7.24902 18.1L2.24902 15.2113C1.16658 14.586 0.5 13.4301 0.5 12.1801V6.90271C0.5 5.65489 1.1648 4.50153 2.24414 3.87537L7.24707 0.973022Z" fill="#14120B" stroke="#FFFFFF" stroke-width="1"/><svg x="4" y="4.53355" width="10" height="10" viewBox="10 12.0281 24 24" overflow="visible"><path d="M32.2119 21.2917C32.7552 19.256 32.2283 16.9938 30.6312 15.3967C29.0342 13.7997 26.7722 13.2728 24.7362 13.8161C23.2447 12.3277 21.0224 11.6529 18.8407 12.2376C16.6589 12.8221 15.0717 14.5177 14.5243 16.5524C12.4896 17.0999 10.794 18.6873 10.2094 20.8688C9.62493 23.0506 10.2996 25.2728 11.7881 26.7644C11.2448 28.8002 11.7718 31.0623 13.3688 32.6594C14.9658 34.2564 17.2278 34.7834 19.2638 34.2401C20.7553 35.7284 22.9778 36.4032 25.1593 35.8187C27.3411 35.2342 28.9283 33.5386 29.4757 31.5039C31.5105 30.9564 33.206 29.3691 33.7905 27.1874C34.3751 25.0058 33.7005 22.7834 32.2119 21.2919V21.2917ZM29.6507 16.3775C30.7329 17.4598 31.1792 18.937 30.9897 20.3453L25.9072 17.4108C25.6929 17.2871 25.4289 17.2871 25.2148 17.4108L19.2638 20.8466V18.5936C19.2638 18.4356 19.3485 18.2877 19.4854 18.2087L24.017 15.5924C25.8125 14.5895 28.1246 14.8514 29.6508 16.3775H29.6507ZM22 20.8685L24.7364 22.4483V25.608L22 27.1878L19.2636 25.608V22.4483L22 20.8685ZM15.7028 18.0636C15.732 16.0073 17.1149 14.1359 19.1997 13.5772C20.678 13.1811 22.1806 13.5333 23.3053 14.4014L18.2226 17.3357C18.0084 17.4594 17.8764 17.6881 17.8764 17.9353V24.8069L15.9253 23.6804C15.7885 23.6014 15.7028 23.454 15.7028 23.2959V18.0634V18.0636ZM11.549 21.2278C11.9451 19.7495 13.0014 18.6242 14.3156 18.0843V23.9532C14.3156 24.2004 14.4476 24.4291 14.6618 24.5528L20.6128 27.9886L18.6617 29.1151C18.5249 29.1941 18.3544 29.1946 18.2175 29.1156L13.6859 26.4993C11.9196 25.4459 10.9905 23.3124 11.549 21.2278ZM14.3494 31.6788C13.2671 30.5965 12.8208 29.1193 13.0103 27.7111L18.0928 30.6455C18.3071 30.7692 18.5711 30.7692 18.7852 30.6455L24.7362 27.2098V29.4626C24.7362 29.6207 24.6516 29.7682 24.5146 29.8477L19.983 32.4639C18.1875 33.4667 15.8754 33.2049 14.3492 31.6788H14.3494ZM28.2972 29.9927C28.268 32.049 26.8851 33.9205 24.8003 34.4791C23.322 34.8752 21.8194 34.523 20.6947 33.6549L25.7774 30.7205C25.9917 30.5969 26.1236 30.3682 26.1236 30.1209V23.2494L28.0747 24.3759C28.2115 24.4549 28.2972 24.6023 28.2972 24.7604V29.9929V29.9927ZM32.451 26.8285C32.0549 28.3068 30.9986 29.4321 29.6844 29.972V24.1031C29.6844 23.8559 29.5525 23.6272 29.3382 23.5035L23.3872 20.0678L25.3383 18.9412C25.4751 18.8622 25.6456 18.8617 25.7825 18.9407L30.314 21.5569C32.0804 22.6105 33.0095 24.7439 32.451 26.8285Z" fill="#FFFFFF"/></svg></svg>';
|
|
30
33
|
var markup = {
|
|
31
34
|
aiAgent: AI_AGENT_ICON_SVG,
|
|
32
35
|
aiBot: AI_BOT_ICON_SVG,
|
|
36
|
+
chatgpt: CHATGPT_ICON_SVG,
|
|
33
37
|
claude: CLAUDE_ICON_SVG,
|
|
34
38
|
person: PERSON_ICON_SVG,
|
|
35
39
|
rovoHex: ROVO_HEX_ICON_SVG
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { ColorScheme, DeletedDiffPlacement, DeletedDiffWidget, DiffContributorProfile, DiffParams, DiffStepAttribution, DiffType, PMDiffParams, RevealMode, RevealOptions, ShowDiffParams, ShowDiffPlugin, SmartDiffThresholds, StepWithAttribution, } from '../showDiffPluginType';
|
|
1
|
+
export type { ColorScheme, DeletedDiffPlacement, DeletedDiffWidget, DiffAgentBrand, DiffContributorProfile, DiffParams, DiffStepAttribution, DiffType, PMDiffParams, RevealMode, RevealOptions, ShowDiffParams, ShowDiffPlugin, SmartDiffThresholds, StepWithAttribution, } from '../showDiffPluginType';
|
|
2
|
+
export { DIFF_AGENT_BRANDS } from '../showDiffPluginType';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Change } from 'prosemirror-changeset';
|
|
2
|
-
import type
|
|
2
|
+
import { type DiffContributors, type DiffStepAttribution, type TagContributor } from '../../../showDiffPluginType';
|
|
3
3
|
import { type AdsAccentColor, type ColorScheme } from './types';
|
|
4
4
|
export type DiffAttributionSpanData = DiffStepAttribution & {
|
|
5
5
|
stepIndex: number;
|
|
@@ -24,7 +24,7 @@ export declare const isAttributionColoringEnabled: (stepAttributions: Array<Diff
|
|
|
24
24
|
* a tag only has to name one.
|
|
25
25
|
*/
|
|
26
26
|
export declare const isContributorTagsEnabled: (stepAttributions: Array<DiffStepAttribution | undefined> | undefined, contributors: ResolvedDiffContributors | undefined) => boolean;
|
|
27
|
-
export declare const createAttributionColorMap: (stepAttributions: Array<DiffStepAttribution | undefined
|
|
27
|
+
export declare const createAttributionColorMap: (stepAttributions: Array<DiffStepAttribution | undefined>, contributors?: ResolvedDiffContributors) => Map<string, AdsAccentColor>;
|
|
28
28
|
/**
|
|
29
29
|
* The attribution key owning a change. Inline and step changes retain direct attribution spans, so
|
|
30
30
|
* resolve those first. Grouped and smart-classified changes can lose that data; for those, fall
|
|
@@ -4,8 +4,8 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { DiffType, RevealOptions } from '../../showDiffPluginType';
|
|
6
6
|
import type { NodeViewSerializer } from '../NodeViewSerializer';
|
|
7
|
-
import { type ContributorTagMountContext } from './createContributorTagWidget';
|
|
8
7
|
import type { ColorScheme } from './colorSchemes/types';
|
|
8
|
+
import { type ContributorTagMountContext } from './createContributorTagWidget';
|
|
9
9
|
/**
|
|
10
10
|
* This function is used to create a decoration widget to show content
|
|
11
11
|
* that is not in the current document.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
2
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform-override';
|
|
4
3
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
+
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform-override';
|
|
5
5
|
export type InlineAttrChangeNodeName = 'date' | 'emoji' | 'mention' | 'status';
|
|
6
6
|
type AttrChangeStep = AttrStep | SetAttrsStep;
|
|
7
7
|
export type AttrStepContext = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform-override';
|
|
2
1
|
import { type StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
+
import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform-override';
|
|
3
3
|
import type { DiffStepAttribution } from '../../../showDiffPluginType';
|
|
4
4
|
type StepRange = {
|
|
5
5
|
attributionKey?: string;
|
|
@@ -37,16 +37,21 @@ export type StepWithAttribution<TStep> = {
|
|
|
37
37
|
step: TStep;
|
|
38
38
|
stepAttribution?: DiffStepAttribution;
|
|
39
39
|
};
|
|
40
|
+
/** Branded agent presentations supported by contributor tags. */
|
|
41
|
+
export type DiffAgentBrand = 'rovo' | 'claude' | 'chatgpt';
|
|
42
|
+
export declare const DIFF_AGENT_BRANDS: ReadonlySet<DiffAgentBrand>;
|
|
40
43
|
/** A complete identity for one of the accounts named by a step attribution. */
|
|
41
44
|
export type DiffContributorProfile = {
|
|
42
45
|
/** Matched against the `userId` and `agentId` on step attributions. */
|
|
43
46
|
accountId: string;
|
|
47
|
+
/** Optional brand for an agent profile, supplied by the host product. */
|
|
48
|
+
agentBrand?: DiffAgentBrand;
|
|
44
49
|
avatarUrl?: string;
|
|
45
50
|
name: string;
|
|
46
51
|
};
|
|
47
52
|
type DiffContributorKind = 'user' | 'agent';
|
|
48
53
|
/** Agent presentation: branded, identified by profile, or a generic external agent. */
|
|
49
|
-
type DiffAgentKind =
|
|
54
|
+
type DiffAgentKind = DiffAgentBrand | 'identified' | 'external';
|
|
50
55
|
/**
|
|
51
56
|
* A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
|
|
52
57
|
* never re-exported from an entry point and not reachable from any public type. Same for
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* The Rovo hex is the `brand` appearance, whose `--rovo-*-color` variables resolve to `initial` in
|
|
9
9
|
* both themes — the fallbacks below are the rendered colours, so no theme observer is needed.
|
|
10
10
|
*/
|
|
11
|
-
export type ContributorTagIcon = 'aiAgent' | 'aiBot' | 'claude' | 'person' | 'rovoHex';
|
|
11
|
+
export type ContributorTagIcon = 'aiAgent' | 'aiBot' | 'chatgpt' | 'claude' | 'person' | 'rovoHex';
|
|
12
12
|
export declare const getContributorTagIcon: (icon: ContributorTagIcon, doc: Document) => DocumentFragment;
|