@atlaskit/editor-plugin-show-diff 28.0.3 → 29.0.1
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 +36 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +10 -3
- package/dist/cjs/pm-plugins/calculateDiff/normalizeTextNodes.js +23 -0
- package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +18 -31
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +17 -65
- package/dist/cjs/showDiffPlugin.js +4 -1
- package/dist/cjs/showDiffPluginType.js +2 -3
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +14 -43
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +1 -9
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +10 -3
- package/dist/es2019/pm-plugins/calculateDiff/normalizeTextNodes.js +16 -0
- package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +20 -31
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +17 -67
- package/dist/es2019/showDiffPlugin.js +2 -0
- package/dist/es2019/showDiffPluginType.js +2 -3
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +14 -43
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +1 -9
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +10 -3
- package/dist/esm/pm-plugins/calculateDiff/normalizeTextNodes.js +19 -0
- package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +18 -31
- package/dist/esm/pm-plugins/resolveDiffContributors.js +17 -66
- package/dist/esm/showDiffPlugin.js +4 -1
- package/dist/esm/showDiffPluginType.js +2 -3
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +14 -43
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +1 -9
- package/dist/types/pm-plugins/calculateDiff/normalizeTextNodes.d.ts +8 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/attributions.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -0
- package/dist/types/showDiffPluginType.d.ts +6 -5
- package/dist/types/ui/ContributorTag/contributorTagIcons.d.ts +2 -2
- package/package.json +7 -7
|
@@ -6,12 +6,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
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; }
|
|
7
7
|
import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
|
|
8
8
|
import { getAttributionKey } from './decorations/colorSchemes/attributions';
|
|
9
|
-
|
|
10
|
-
/** A brand name, so a literal rather than a translated message. */
|
|
11
|
-
var ROVO_AGENT_NAME = 'Rovo';
|
|
12
|
-
|
|
13
|
-
/** `agentType` values that render as "Rovo" rather than as a generic external agent. */
|
|
14
|
-
var ROVO_AGENT_TYPES = new Set(['convo-ai', 'rovo_chat']);
|
|
15
9
|
/** `@atlaskit/agent-color` brands show-diff renders with a dedicated presentation. */
|
|
16
10
|
var SHOW_DIFF_AGENT_BRANDS = {
|
|
17
11
|
'agent-brand-claude': 'claude',
|
|
@@ -29,29 +23,6 @@ var SHOW_DIFF_AGENT_BRANDS = {
|
|
|
29
23
|
'agent-brand-antigravity': 'antigravity',
|
|
30
24
|
'agent-brand-copilot': 'copilot'
|
|
31
25
|
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Brands that prefer the account's real avatar over their fixed glyph when the invoking profile
|
|
35
|
-
* has one. Brands with a fixed glyph (Claude, ChatGPT, Amplitude, Cortex, Databricks, Gemini, Manus,
|
|
36
|
-
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in `contributorAvatarRenderer.ts`).
|
|
37
|
-
*/
|
|
38
|
-
var AVATAR_ELIGIBLE_BRANDS = new Set(['antigravity', 'copilot', 'figma', 'lovable', 'replit', 'rovo']);
|
|
39
|
-
|
|
40
|
-
/** Known external agent types emitted by Confluence's agent identification service that carry
|
|
41
|
-
* no `@atlaskit/agent-color` brand — a generic labelled fallback. */
|
|
42
|
-
var EXTERNAL_AGENT_NAMES = {
|
|
43
|
-
vscode: 'VS Code',
|
|
44
|
-
hermes: 'Hermes',
|
|
45
|
-
runlayer: 'Runlayer',
|
|
46
|
-
zed: 'Zed',
|
|
47
|
-
ampcode: 'Ampcode',
|
|
48
|
-
devin_cli: 'Devin CLI',
|
|
49
|
-
pi_agent: 'Pi Agent'
|
|
50
|
-
};
|
|
51
|
-
var hasAgentIdentity = function hasAgentIdentity(attribution) {
|
|
52
|
-
var _attribution$agentId, _attribution$agentTyp;
|
|
53
|
-
return Boolean(((_attribution$agentId = attribution.agentId) === null || _attribution$agentId === void 0 ? void 0 : _attribution$agentId.trim()) || ((_attribution$agentTyp = attribution.agentType) === null || _attribution$agentTyp === void 0 ? void 0 : _attribution$agentTyp.trim()));
|
|
54
|
-
};
|
|
55
26
|
var toProfilesByAccountId = function toProfilesByAccountId(profiles) {
|
|
56
27
|
var profilesByAccountId = new Map();
|
|
57
28
|
profiles === null || profiles === void 0 || profiles.forEach(function (profile) {
|
|
@@ -72,50 +43,30 @@ var resolveUser = function resolveUser(userId, profilesByAccountId) {
|
|
|
72
43
|
} : undefined;
|
|
73
44
|
};
|
|
74
45
|
|
|
75
|
-
/** Resolve branding
|
|
46
|
+
/** Resolve branding from named metadata or the account profile. */
|
|
76
47
|
var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
|
|
77
|
-
var _attribution$
|
|
78
|
-
var
|
|
79
|
-
// `agentType` may be a named id (e.g. `mcp_lovable_agent`) or a display name (e.g. `lovable`).
|
|
80
|
-
var brand = agentType ? getThirdPartyAgentColor({
|
|
81
|
-
agentNamedId: agentType,
|
|
82
|
-
agentName: agentType
|
|
83
|
-
}) : undefined;
|
|
84
|
-
var diffBrand = brand ? SHOW_DIFF_AGENT_BRANDS[brand.scheme] : undefined;
|
|
85
|
-
var agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
|
|
48
|
+
var _attribution$agentId, _agentProfile$agentBr;
|
|
49
|
+
var agentId = (_attribution$agentId = attribution.agentId) === null || _attribution$agentId === void 0 ? void 0 : _attribution$agentId.trim();
|
|
86
50
|
var agentProfile = agentId ? profilesByAccountId.get(agentId) : undefined;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (agentProfile) {
|
|
97
|
-
return _objectSpread(_objectSpread({}, agentProfile.agentBrand ? {
|
|
98
|
-
agentKind: agentProfile.agentBrand
|
|
51
|
+
var brand = getThirdPartyAgentColor({
|
|
52
|
+
agentNamedId: attribution.agentNamedId,
|
|
53
|
+
agentName: agentProfile === null || agentProfile === void 0 ? void 0 : agentProfile.name
|
|
54
|
+
});
|
|
55
|
+
var agentBrand = (_agentProfile$agentBr = agentProfile === null || agentProfile === void 0 ? void 0 : agentProfile.agentBrand) !== null && _agentProfile$agentBr !== void 0 ? _agentProfile$agentBr : brand ? SHOW_DIFF_AGENT_BRANDS[brand.scheme] : undefined;
|
|
56
|
+
if (agentProfile || agentBrand) {
|
|
57
|
+
var _ref, _agentProfile$name;
|
|
58
|
+
return _objectSpread(_objectSpread({}, agentBrand ? {
|
|
59
|
+
agentKind: agentBrand
|
|
99
60
|
} : {}), {}, {
|
|
100
|
-
avatarUrl: agentProfile.avatarUrl,
|
|
61
|
+
avatarUrl: agentProfile === null || agentProfile === void 0 ? void 0 : agentProfile.avatarUrl,
|
|
101
62
|
kind: 'agent',
|
|
102
|
-
name: agentProfile.name
|
|
63
|
+
name: (_ref = (_agentProfile$name = agentProfile === null || agentProfile === void 0 ? void 0 : agentProfile.name) !== null && _agentProfile$name !== void 0 ? _agentProfile$name : brand === null || brand === void 0 ? void 0 : brand.name) !== null && _ref !== void 0 ? _ref : ''
|
|
103
64
|
});
|
|
104
65
|
}
|
|
105
|
-
|
|
106
|
-
// Unknown types keep an empty name for the tag's localised "External agent" label.
|
|
107
|
-
if (agentType && ROVO_AGENT_TYPES.has(agentType)) {
|
|
108
|
-
return {
|
|
109
|
-
agentKind: 'rovo',
|
|
110
|
-
kind: 'agent',
|
|
111
|
-
name: ROVO_AGENT_NAME
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
var externalName = agentType ? EXTERNAL_AGENT_NAMES[agentType] : undefined;
|
|
115
66
|
return {
|
|
116
67
|
agentKind: 'external',
|
|
117
68
|
kind: 'agent',
|
|
118
|
-
name:
|
|
69
|
+
name: ''
|
|
119
70
|
};
|
|
120
71
|
};
|
|
121
72
|
|
|
@@ -138,7 +89,7 @@ export var resolveDiffContributors = function resolveDiffContributors(stepsWithA
|
|
|
138
89
|
_step;
|
|
139
90
|
try {
|
|
140
91
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
141
|
-
var _stepAttribution$user;
|
|
92
|
+
var _stepAttribution$user, _stepAttribution$agen;
|
|
142
93
|
var stepAttribution = _step.value.stepAttribution;
|
|
143
94
|
// An attribution naming nobody (e.g. one carrying only `wasOffline`) has nobody to credit.
|
|
144
95
|
var actor = stepAttribution ? getAttributionKey(stepAttribution) : undefined;
|
|
@@ -146,7 +97,7 @@ export var resolveDiffContributors = function resolveDiffContributors(stepsWithA
|
|
|
146
97
|
continue;
|
|
147
98
|
}
|
|
148
99
|
var userId = (_stepAttribution$user = stepAttribution.userId) === null || _stepAttribution$user === void 0 ? void 0 : _stepAttribution$user.trim();
|
|
149
|
-
if (
|
|
100
|
+
if ((_stepAttribution$agen = stepAttribution.agentId) !== null && _stepAttribution$agen !== void 0 && _stepAttribution$agen.trim()) {
|
|
150
101
|
var agent = resolveAgent(stepAttribution, profilesByAccountId);
|
|
151
102
|
if (!userId) {
|
|
152
103
|
// Agent mode: the agent acted on its own, so it is credited on its own.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _excluded = ["stepsWithAttribution", "contributorProfiles"];
|
|
3
|
+
var _excluded = ["stepsWithAttribution", "contributorProfiles", "showContributorTags"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import React from 'react';
|
|
@@ -23,8 +23,11 @@ var normalizeShowDiffParams = function normalizeShowDiffParams(params) {
|
|
|
23
23
|
}
|
|
24
24
|
var stepsWithAttribution = params.stepsWithAttribution,
|
|
25
25
|
contributorProfiles = params.contributorProfiles,
|
|
26
|
+
_params$showContribut = params.showContributorTags,
|
|
27
|
+
showContributorTags = _params$showContribut === void 0 ? true : _params$showContribut,
|
|
26
28
|
rest = _objectWithoutProperties(params, _excluded);
|
|
27
29
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
30
|
+
showContributorTags: showContributorTags,
|
|
28
31
|
// Resolve at boundary to keep contributor model and attribution format internal.
|
|
29
32
|
contributors: areAttributionColorGatesEnabled() ? resolveContributors(resolveDiffContributors(stepsWithAttribution, contributorProfiles)) : undefined,
|
|
30
33
|
steps: stepsWithAttribution.map(function (_ref) {
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
* Attribution for a ProseMirror step.
|
|
12
12
|
*
|
|
13
13
|
* `userId` is the primary actor identity. `agentId` distinguishes multiple agents (or an agent
|
|
14
|
-
* from its user) when they share that user ID
|
|
15
|
-
*
|
|
16
|
-
* overrides. `wasOffline` preserves additional provenance without affecting identity.
|
|
14
|
+
* from its user) when they share that user ID. `agentNamedId` carries a stable external
|
|
15
|
+
* configuration reference for presentation overrides. `wasOffline` preserves additional provenance without affecting identity.
|
|
17
16
|
*/
|
|
18
17
|
|
|
19
18
|
/** Keeps a step and its attribution coupled through mapping and filtering. */
|
|
@@ -4,26 +4,6 @@ import { BORDER_WIDTH } from '@atlaskit/avatar/constants/default';
|
|
|
4
4
|
import { convertToInlineCss } from '@atlaskit/editor-common/css-helper';
|
|
5
5
|
import { getContributorTagIcon } from './contributorTagIcons';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Agent kinds with a custom contributor-tag icon, used as a fallback glyph when no `avatarUrl` is
|
|
9
|
-
* available or its image fails to load (see `showContributorIcon`). Rovo/Figma/Lovable/Replit have
|
|
10
|
-
* no entry here — they fall back to the generic `aiAgent` glyph. The declared type stays the wider
|
|
11
|
-
* `TagContributor['agentKind']` so indexing below (with `'identified' | 'external'` in play too)
|
|
12
|
-
* stays safely partial.
|
|
13
|
-
*/
|
|
14
|
-
var AGENT_KIND_ICONS = {
|
|
15
|
-
claude: 'claude',
|
|
16
|
-
chatgpt: 'chatgpt'
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Brands that always render their fixed glyph, even when the contributor also carries an
|
|
21
|
-
* `avatarUrl`. Rovo/Figma/Lovable/Replit are excluded here and use the real avatar when
|
|
22
|
-
* `resolveDiffContributors` supplies one, falling back to the generic `aiAgent` glyph on load
|
|
23
|
-
* failure.
|
|
24
|
-
*/
|
|
25
|
-
var FIXED_GLYPH_AGENT_KINDS = new Set(['claude', 'chatgpt']);
|
|
26
|
-
|
|
27
7
|
/** The size `@atlaskit/avatar`'s `xxsmall` rendered at. */
|
|
28
8
|
var AVATAR_SIZE = AVATAR_SIZES.xxsmall;
|
|
29
9
|
/** `xxsmall` also carried a `space.025` margin — the same 2px — which is where the ring is painted. */
|
|
@@ -124,7 +104,7 @@ export var contributorAvatarRenderer = function contributorAvatarRenderer(_ref)
|
|
|
124
104
|
var image;
|
|
125
105
|
var unbindImageError;
|
|
126
106
|
var showContributorIcon = function showContributorIcon() {
|
|
127
|
-
var _unbindImageError, _image
|
|
107
|
+
var _unbindImageError, _image;
|
|
128
108
|
(_unbindImageError = unbindImageError) === null || _unbindImageError === void 0 || _unbindImageError();
|
|
129
109
|
unbindImageError = undefined;
|
|
130
110
|
(_image = image) === null || _image === void 0 || _image.remove();
|
|
@@ -136,30 +116,21 @@ export var contributorAvatarRenderer = function contributorAvatarRenderer(_ref)
|
|
|
136
116
|
shape.appendChild(fallback);
|
|
137
117
|
return;
|
|
138
118
|
}
|
|
139
|
-
|
|
140
|
-
shape.appendChild(getContributorTagIcon(icon, doc));
|
|
119
|
+
shape.appendChild(getContributorTagIcon('aiAgent', doc));
|
|
141
120
|
};
|
|
142
121
|
if (contributor.avatarUrl) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
image.setAttribute('style', imageStyle);
|
|
156
|
-
unbindImageError = bind(image, {
|
|
157
|
-
type: 'error',
|
|
158
|
-
listener: showContributorIcon
|
|
159
|
-
});
|
|
160
|
-
shape.appendChild(image);
|
|
161
|
-
image.src = contributor.avatarUrl;
|
|
162
|
-
}
|
|
122
|
+
image = doc.createElement('img');
|
|
123
|
+
image.alt = '';
|
|
124
|
+
image.decoding = 'async';
|
|
125
|
+
image.draggable = false;
|
|
126
|
+
image.loading = 'lazy';
|
|
127
|
+
image.setAttribute('style', imageStyle);
|
|
128
|
+
unbindImageError = bind(image, {
|
|
129
|
+
type: 'error',
|
|
130
|
+
listener: showContributorIcon
|
|
131
|
+
});
|
|
132
|
+
shape.appendChild(image);
|
|
133
|
+
image.src = contributor.avatarUrl;
|
|
163
134
|
} else {
|
|
164
135
|
showContributorIcon();
|
|
165
136
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The icons a contributor tag can draw, as inline SVG.
|
|
3
3
|
*
|
|
4
|
-
* Neither `@atlaskit/icon
|
|
4
|
+
* Neither `@atlaskit/icon` nor `@atlaskit/icon-lab` exposes a raw-SVG entry
|
|
5
5
|
* point, so the markup is copied here rather than kept as a React island for these glyphs. Keep in
|
|
6
6
|
* sync with the sources named on each constant.
|
|
7
7
|
*/
|
|
@@ -18,17 +18,9 @@ var AI_BOT_ICON_SVG = "<svg width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0
|
|
|
18
18
|
* so keep the generated glyph here rather than introducing a React render boundary.
|
|
19
19
|
*/
|
|
20
20
|
var AI_AGENT_ICON_SVG = "<svg width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 16 16\" role=\"presentation\" style=\"display:block\"><path fill=\"currentcolor\" fill-rule=\"evenodd\" d=\"M6.971.493a2 2 0 0 1 2.058 0l5 3A2 2 0 0 1 15 5.208v5.584a2 2 0 0 1-.971 1.715l-5 3a2 2 0 0 1-2.058 0l-5-3A2 2 0 0 1 1 10.792V5.208a2 2 0 0 1 .971-1.715zm1.286 1.286a.5.5 0 0 0-.514 0l-5 3a.5.5 0 0 0-.243.429v5.584a.5.5 0 0 0 .243.429l1.098.66a4.25 4.25 0 1 1 8.318 0l1.098-.66a.5.5 0 0 0 .243-.429V5.208a.5.5 0 0 0-.243-.429zM8 8.25a2.75 2.75 0 1 0 0 5.5 2.75 2.75 0 0 0 0-5.5\" clip-rule=\"evenodd\"/></svg>";
|
|
21
|
-
|
|
22
|
-
/** Claude hexagon lockup from the brand asset: the hexagon and knot glyph both baked in. */
|
|
23
|
-
var CLAUDE_ICON_SVG = "<svg width=\"16\" height=\"18\" viewBox=\"0 0 16 18\" fill=\"none\" role=\"presentation\" style=\"display:block\"><path fill=\"#D97757\" d=\"M14.5007 3.28903L9.50384 0.402344C8.5736 -0.13506 7.42701 -0.134016 6.49774 0.405082L1.49458 3.30759C0.569434 3.8443 0 4.83297 0 5.90253V11.1804C0 12.2519 0.571497 13.2421 1.49931 13.7781L6.49931 16.6666C7.42787 17.203 8.57213 17.203 9.50069 16.6666L14.5007 13.7781C15.4285 13.2421 16 12.2519 16 11.1804V5.88671C16 4.8152 15.4285 3.82504 14.5007 3.28903Z\"/><path fill=\"#FAF9F6\" d=\"M5.19791 10.055L7.0123 9.03681L7.04267 8.94806L7.0123 8.89907H6.92357L6.62 8.88034L5.58321 8.85232L4.68418 8.815L3.81317 8.76826L3.59367 8.72158L3.38818 8.4507L3.4092 8.31526L3.59367 8.1915L3.85754 8.21485L4.44133 8.25455L5.317 8.31526L5.95216 8.35262L6.89321 8.4507H7.04267L7.06368 8.38999L7.0123 8.35262L6.97261 8.31526L6.06658 7.70112L5.08582 7.05196L4.5721 6.67834L4.29422 6.48919L4.15411 6.31172L4.09339 5.92409L4.34559 5.64621L4.68418 5.66956L4.77058 5.69291L5.11384 5.95678L5.84708 6.52422L6.80448 7.22943L6.94459 7.34618L7.00063 7.30649L7.00763 7.27846L6.94459 7.17338L6.42385 6.23233L5.86809 5.27492L5.62057 4.87795L5.55519 4.63977C5.53183 4.54169 5.51549 4.45996 5.51549 4.35956L5.80271 3.96959L5.9615 3.91821L6.34446 3.96959L6.50558 4.10969L6.74377 4.65378L7.12907 5.51077L7.72686 6.676L7.90199 7.0216L7.99539 7.34152L8.0304 7.43959H8.09113V7.38354L8.14018 6.72737L8.23124 5.92175L8.31999 4.88496L8.35032 4.59307L8.49511 4.24279L8.78232 4.05365L9.00649 4.16107L9.19098 4.42494L9.16533 4.5954L9.05555 5.30762L8.84073 6.42381L8.70062 7.17105H8.78232L8.87574 7.07764L9.25401 6.57559L9.88922 5.78165L10.1694 5.4664L10.4963 5.11847L10.7065 4.95267H11.1035L11.3953 5.38701L11.2646 5.83535L10.8559 6.35375L10.5173 6.79276L10.0316 7.4466L9.72807 7.96966L9.7561 8.0117L9.82849 8.00469L10.926 7.77118L11.5191 7.66376L12.2266 7.54233L12.5466 7.69178L12.5816 7.84356L12.4555 8.15414L11.6989 8.34095L10.8116 8.51842L9.48985 8.83136L9.4735 8.84303L9.49223 8.86637L10.0877 8.92241L10.3422 8.93639H10.9657L12.1262 9.02283L12.4298 9.2236L12.612 9.46881L12.5816 9.6556L12.1146 9.89382L11.4841 9.74434L10.013 9.3941L9.50858 9.26797H9.43849V9.31004L9.85882 9.721L10.6294 10.4169L11.5938 11.3136L11.6429 11.5354L11.5191 11.7106L11.3884 11.6918L10.5407 11.0544L10.2137 10.7672L9.4735 10.1436H9.42451V10.209L9.59495 10.4589L10.4963 11.8133L10.543 12.2289L10.4776 12.3644L10.2441 12.4461L9.98726 12.3994L9.45952 11.6592L8.91544 10.8255L8.47645 10.0783L8.42271 10.1086L8.16352 12.8991L8.04207 13.0416L7.76188 13.149L7.52837 12.9715L7.40461 12.6843L7.52837 12.1168L7.67781 11.3766L7.79925 10.7881L7.90899 10.0573L7.97438 9.81443L7.96971 9.79808L7.916 9.80507L7.36491 10.5617L6.5266 11.6942L5.86342 12.4041L5.70463 12.4671L5.42909 12.3247L5.45477 12.0702L5.60889 11.8436L6.5266 10.6761L7.08002 9.95217L7.4373 9.53421L7.43497 9.47349H7.41395L4.97607 11.0567L4.54174 11.1127L4.35493 10.9376L4.37828 10.6504L4.46702 10.557L5.20024 10.0526L5.19791 10.055Z\"/></svg>";
|
|
24
|
-
|
|
25
|
-
/** ChatGPT hexagon lockup from the brand asset: the hexagon and knot glyph both baked in. */
|
|
26
|
-
var CHATGPT_ICON_SVG = "<svg width=\"16\" height=\"18\" viewBox=\"0 0 16 18\" fill=\"none\" role=\"presentation\" style=\"display:block\"><path fill=\"#14120B\" d=\"M14.5007 3.289L9.50384 0.402314C8.5736 -0.13509 7.42701 -0.134047 6.49774 0.405051L1.49458 3.30756C0.569434 3.84427 0 4.83294 0 5.9025V11.1804C0 12.2519 0.571497 13.2421 1.49931 13.7781L6.49931 16.6666C7.42787 17.203 8.57213 17.203 9.50069 16.6666L14.5007 13.7781C15.4285 13.2421 16 12.2519 16 11.1804V5.88668C16 4.81517 15.4285 3.82501 14.5007 3.289Z\"/><path fill=\"white\" d=\"M12.255 7.39338C12.4813 6.54514 12.2618 5.60258 11.5963 4.93713C10.9309 4.2717 9.9884 4.05217 9.1401 4.27852C8.51863 3.65837 7.59268 3.37721 6.68362 3.62082C5.77456 3.86436 5.11322 4.57087 4.88512 5.41867C4.03733 5.64676 3.33082 6.30819 3.08727 7.21717C2.84372 8.12623 3.12482 9.05218 3.74503 9.67365C3.51868 10.5219 3.73823 11.4645 4.40366 12.1299C5.06909 12.7953 6.01159 13.0149 6.85992 12.7885C7.48137 13.4087 8.4074 13.6898 9.31638 13.4463C10.2254 13.2027 10.8868 12.4962 11.1149 11.6485C11.9627 11.4203 12.6692 10.7589 12.9127 9.84993C13.1563 8.94089 12.8752 8.01491 12.255 7.39347V7.39338ZM11.1878 5.34578C11.6387 5.79673 11.8247 6.41226 11.7457 6.99902L9.62799 5.77632C9.53872 5.72478 9.42871 5.72478 9.3395 5.77632L6.85992 7.20789V6.26917C6.85992 6.20333 6.89519 6.1417 6.95226 6.10877L8.84042 5.01867C9.58854 4.60079 10.5519 4.7099 11.1878 5.34578H11.1878ZM8.00001 7.21703L9.14016 7.87529V9.19183L8.00001 9.85009L6.85984 9.19183V7.87529L8.00001 7.21703ZM5.37616 6.04832C5.38831 5.19153 5.96453 4.41177 6.83319 4.17899C7.44917 4.01397 8.07524 4.16069 8.54389 4.52241L6.42609 5.74505C6.33682 5.79656 6.28184 5.89186 6.28184 5.99489V8.85803L5.4689 8.38867C5.41189 8.35573 5.37616 8.29433 5.37616 8.22846V6.04826V6.04832ZM3.64542 7.36674C3.81044 6.75079 4.25056 6.28191 4.79817 6.05694V8.50232C4.79817 8.60534 4.85315 8.70061 4.94241 8.75216L7.42202 10.1837L6.60904 10.6531C6.55203 10.686 6.48098 10.6862 6.42397 10.6533L4.53581 9.56321C3.79984 9.12427 3.41272 8.23534 3.64542 7.36674ZM4.81224 11.7213C4.36129 11.2704 4.17534 10.6549 4.25429 10.0681L6.37201 11.2908C6.4613 11.3423 6.57129 11.3423 6.6605 11.2908L9.1401 9.85923V10.7979C9.1401 10.8638 9.10483 10.9254 9.04774 10.9584L7.15958 12.0485C6.41145 12.4663 5.44809 12.3572 4.81215 11.7213H4.81224ZM10.6238 11.0188C10.6117 11.8756 10.0355 12.6554 9.1668 12.8881C8.55083 13.0532 7.92476 12.9064 7.45613 12.5447L9.57391 11.322C9.6632 11.2705 9.71816 11.1753 9.71816 11.0722V8.20906L10.5311 8.67845C10.5881 8.71139 10.6238 8.77279 10.6238 8.83866V11.0189V11.0188ZM12.3546 9.70035C12.1896 10.3163 11.7494 10.7852 11.2018 11.0101V8.5648C11.2018 8.46178 11.1469 8.36648 11.0576 8.31496L8.57798 6.88339L9.39095 6.41401C9.44796 6.38107 9.51902 6.38085 9.57603 6.41378L11.4642 7.50388C12.2002 7.94285 12.5873 8.83178 12.3546 9.70035Z\"/></svg>";
|
|
27
21
|
var markup = {
|
|
28
22
|
aiAgent: AI_AGENT_ICON_SVG,
|
|
29
23
|
aiBot: AI_BOT_ICON_SVG,
|
|
30
|
-
chatgpt: CHATGPT_ICON_SVG,
|
|
31
|
-
claude: CLAUDE_ICON_SVG,
|
|
32
24
|
person: PERSON_ICON_SVG
|
|
33
25
|
};
|
|
34
26
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a copy of `node` in which adjacent text nodes with identical marks are joined, the same
|
|
4
|
+
* normalisation ProseMirror applies whenever it rebuilds a node's content. A document parsed straight
|
|
5
|
+
* from ADF keeps such split runs, so two documents with identical content and positions can still
|
|
6
|
+
* differ in child count.
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalizeTextNodes: (node: PMNode) => PMNode;
|
|
@@ -10,7 +10,7 @@ export type ResolvedDiffContributor = TagContributor & {
|
|
|
10
10
|
};
|
|
11
11
|
/** Contributors addressed by attribution key. The key format is internal. */
|
|
12
12
|
export type ResolvedDiffContributors = Record<string, ResolvedDiffContributor>;
|
|
13
|
-
/** `userId` is primary; `agentId
|
|
13
|
+
/** `userId` is primary; `agentId` separates agents sharing that user. */
|
|
14
14
|
export declare const getAttributionKey: (attribution: DiffStepAttribution | undefined) => string | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Public contributor list to internal key-addressed record. A contributor whose attribution carries
|
|
@@ -25,14 +25,12 @@ export type DiffType = 'inline' | 'block' | 'step' | 'smart';
|
|
|
25
25
|
* Attribution for a ProseMirror step.
|
|
26
26
|
*
|
|
27
27
|
* `userId` is the primary actor identity. `agentId` distinguishes multiple agents (or an agent
|
|
28
|
-
* from its user) when they share that user ID
|
|
29
|
-
*
|
|
30
|
-
* overrides. `wasOffline` preserves additional provenance without affecting identity.
|
|
28
|
+
* from its user) when they share that user ID. `agentNamedId` carries a stable external
|
|
29
|
+
* configuration reference for presentation overrides. `wasOffline` preserves additional provenance without affecting identity.
|
|
31
30
|
*/
|
|
32
31
|
export type DiffStepAttribution = {
|
|
33
32
|
agentId?: string;
|
|
34
33
|
agentNamedId?: string;
|
|
35
|
-
agentType?: string;
|
|
36
34
|
userId?: string;
|
|
37
35
|
wasOffline?: boolean;
|
|
38
36
|
};
|
|
@@ -234,13 +232,16 @@ type PMDiffParamsWithAttribution = Omit<PMDiffParams, 'steps'> & {
|
|
|
234
232
|
/**
|
|
235
233
|
* Identities for the accounts named by the attributed steps. Omitted profiles disable
|
|
236
234
|
* contributor tags without disabling attribution colours. An explicit empty array permits agent fallback tags. When supplied, and the contributor-tag
|
|
237
|
-
* gate is on, every attributed change the plugin can credit to one of them renders a tag
|
|
235
|
+
* gate is on, every attributed change the plugin can credit to one of them renders a tag
|
|
236
|
+
* unless `showContributorTags` is false.
|
|
238
237
|
* Complete entries only: a caller looking identities up (e.g. against a user directory) filters
|
|
239
238
|
* out the ones it could not resolve rather than passing partial entries through. Omitting an
|
|
240
239
|
* account is meaningful — a user the plugin cannot name drops every tag, while an agent falls
|
|
241
240
|
* back to its own presentation.
|
|
242
241
|
*/
|
|
243
242
|
contributorProfiles?: readonly DiffContributorProfile[];
|
|
243
|
+
/** Set false to use profile colours without rendering contributor tags. Defaults to true. */
|
|
244
|
+
showContributorTags?: boolean;
|
|
244
245
|
steps?: never;
|
|
245
246
|
stepsWithAttribution: Array<StepWithAttribution<Step>>;
|
|
246
247
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The icons a contributor tag can draw, as inline SVG.
|
|
3
3
|
*
|
|
4
|
-
* Neither `@atlaskit/icon
|
|
4
|
+
* Neither `@atlaskit/icon` nor `@atlaskit/icon-lab` exposes a raw-SVG entry
|
|
5
5
|
* point, so the markup is copied here rather than kept as a React island for these glyphs. Keep in
|
|
6
6
|
* sync with the sources named on each constant.
|
|
7
7
|
*/
|
|
8
|
-
export type ContributorTagIcon = 'aiAgent' | 'aiBot' | '
|
|
8
|
+
export type ContributorTagIcon = 'aiAgent' | 'aiBot' | 'person';
|
|
9
9
|
export declare const getContributorTagIcon: (icon: ContributorTagIcon, doc: Document) => DocumentFragment;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "29.0.1",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
41
41
|
"@atlaskit/primitives": "^22.6.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^248.
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^248.1.0",
|
|
43
43
|
"@atlaskit/tokens": "^20.8.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.2",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
"@atlaskit/button": "^25.6.0",
|
|
54
54
|
"@atlaskit/css": "^1.1.0",
|
|
55
55
|
"@atlaskit/dropdown-menu": "^21.0.0",
|
|
56
|
-
"@atlaskit/editor-core": "^
|
|
56
|
+
"@atlaskit/editor-core": "^242.0.0",
|
|
57
57
|
"@atlaskit/editor-json-transformer": "^10.0.0",
|
|
58
58
|
"@atlaskit/editor-plugins": "^16.2.0",
|
|
59
59
|
"@atlaskit/form": "^18.3.0",
|
|
60
60
|
"@atlaskit/section-message": "^10.2.0",
|
|
61
|
-
"@atlaskit/textarea": "^10.
|
|
62
|
-
"@atlaskit/textfield": "^10.
|
|
61
|
+
"@atlaskit/textarea": "^10.3.0",
|
|
62
|
+
"@atlaskit/textfield": "^10.3.0",
|
|
63
63
|
"@atlaskit/util-data-test": "^19.1.0",
|
|
64
64
|
"@atlassian/confluence-presets": "workspace:^",
|
|
65
65
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
66
|
-
"@atlassian/editor-ai-injected-editors": "^
|
|
66
|
+
"@atlassian/editor-ai-injected-editors": "^46.0.0",
|
|
67
67
|
"@atlassian/editor-plugin-ai": "^84.0.0",
|
|
68
68
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
69
69
|
"react": "^19.2.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react-intl": "^7.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^134.
|
|
74
|
+
"@atlaskit/editor-common": "^134.2.0",
|
|
75
75
|
"react": "^18.2.0 || ^19.2.0",
|
|
76
76
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|