@atlaskit/editor-plugin-show-diff 16.0.17 → 16.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 16.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`8c4837792f18f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c4837792f18f) -
8
+ Add a per-call colorScheme override to the showDiff command, so callers can paint a diff in a
9
+ specific colour scheme without changing the plugin's configured default.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 16.0.17
4
16
 
5
17
  ### Patch Changes
@@ -32,6 +32,9 @@
32
32
  {
33
33
  "path": "../../editor-plugin-analytics/afm-products/tsconfig.json"
34
34
  },
35
+ {
36
+ "path": "../../editor-plugin-limited-mode/afm-products/tsconfig.json"
37
+ },
35
38
  {
36
39
  "path": "../../editor-plugin-user-intent/afm-products/tsconfig.json"
37
40
  },
@@ -94,7 +94,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
94
94
  var newPluginState = currentPluginState;
95
95
  if (meta) {
96
96
  if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'REVEAL_COMPLETE') {
97
- var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0, _newPluginState1;
97
+ var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0, _newPluginState1, _newPluginState10;
98
98
  // REVEAL_COMPLETE repaints with the reveal dropped, so the decorations render their
99
99
  // ordinary resting style. Without it the reveal stays in state indefinitely and the
100
100
  // next unrelated repaint re-emits the hidden, zero-width highlight with no animation
@@ -114,23 +114,23 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
114
114
  state: newState,
115
115
  pluginState: newPluginState,
116
116
  nodeViewSerializer: nodeViewSerializer,
117
- colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
117
+ colorScheme: (_newPluginState$color = (_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.colorScheme) !== null && _newPluginState$color !== void 0 ? _newPluginState$color : config === null || config === void 0 ? void 0 : config.colorScheme,
118
118
  intl: getIntl(),
119
119
  activeIndexPos: newPluginState.activeIndexPos,
120
120
  api: api,
121
121
  tagMountContext: tagMountContext
122
- }, (0, _isExtendedEnabled.isExtendedEnabled)((_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.diffType) ? {
123
- isInverted: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.isInverted,
124
- diffType: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.diffType,
125
- hideDeletedDiffs: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.hideDeletedDiffs,
126
- hideAddedDiffsUnderline: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideAddedDiffsUnderline,
127
- showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
128
- smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
129
- deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement,
130
- inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement,
122
+ }, (0, _isExtendedEnabled.isExtendedEnabled)((_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.diffType) ? {
123
+ isInverted: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.isInverted,
124
+ diffType: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.diffType,
125
+ hideDeletedDiffs: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideDeletedDiffs,
126
+ hideAddedDiffsUnderline: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.hideAddedDiffsUnderline,
127
+ showIndicators: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.showIndicators,
128
+ smartThresholds: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.smartThresholds,
129
+ deletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.deletedDiffPlacement,
130
+ inlineDeletedDiffPlacement: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.inlineDeletedDiffPlacement,
131
131
  // SHOW_DIFF only. The scroll-to-next recalculation further down deliberately
132
132
  // omits this so stepping through changes cannot replay the choreography.
133
- reveal: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.reveal
133
+ reveal: (_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.reveal
134
134
  } : {})),
135
135
  contributorTags = _calculateDiffDecorat.contributorTags,
136
136
  decorations = _calculateDiffDecorat.decorations,
@@ -138,7 +138,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
138
138
  // Update the decorations and their ids
139
139
  newPluginState.decorations = decorations;
140
140
  newPluginState.contributorTags = contributorTags;
141
- if ((0, _isExtendedEnabled.isExtendedEnabled)((_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.diffType)) {
141
+ if ((0, _isExtendedEnabled.isExtendedEnabled)((_newPluginState10 = newPluginState) === null || _newPluginState10 === void 0 ? void 0 : _newPluginState10.diffType)) {
142
142
  newPluginState.diffDescriptors = diffDescriptors;
143
143
  }
144
144
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
@@ -147,7 +147,9 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
147
147
  isDisplayingChanges: false,
148
148
  activeIndex: undefined,
149
149
  contributorTags: [],
150
- reveal: undefined
150
+ reveal: undefined,
151
+ // Per-call override — do not let it leak into the next, unrelated `showDiff` call.
152
+ colorScheme: undefined
151
153
  }, (0, _isExtendedEnabled.isExtendedEnabled)(currentPluginState.diffType) ? {
152
154
  isInverted: false,
153
155
  diffType: (0, _isExtendedEnabled.getDefaultDiffType)(),
@@ -156,11 +158,11 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
156
158
  diffDescriptors: []
157
159
  } : {});
158
160
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') {
159
- var _newPluginState10;
161
+ var _newPluginState11;
160
162
  // Update the active index in plugin state and recalculate decorations
161
- var _decorations = (0, _getScrollableDecorations.getScrollableDecorations)(currentPluginState.decorations, newState.doc, (_newPluginState10 = newPluginState) === null || _newPluginState10 === void 0 ? void 0 : _newPluginState10.diffType);
163
+ var _decorations = (0, _getScrollableDecorations.getScrollableDecorations)(currentPluginState.decorations, newState.doc, (_newPluginState11 = newPluginState) === null || _newPluginState11 === void 0 ? void 0 : _newPluginState11.diffType);
162
164
  if (_decorations.length > 0) {
163
- var _currentPluginState$a;
165
+ var _currentPluginState$a, _newPluginState$color2, _newPluginState12;
164
166
  // Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
165
167
  // This allows the UI to start with no selection and only highlight on first user interaction.
166
168
  var nextIndex = (_currentPluginState$a = currentPluginState.activeIndex) !== null && _currentPluginState$a !== void 0 ? _currentPluginState$a : -1;
@@ -188,7 +190,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
188
190
  state: newState,
189
191
  pluginState: newPluginState,
190
192
  nodeViewSerializer: nodeViewSerializer,
191
- colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
193
+ colorScheme: (_newPluginState$color2 = (_newPluginState12 = newPluginState) === null || _newPluginState12 === void 0 ? void 0 : _newPluginState12.colorScheme) !== null && _newPluginState$color2 !== void 0 ? _newPluginState$color2 : config === null || config === void 0 ? void 0 : config.colorScheme,
192
194
  intl: getIntl(),
193
195
  activeIndexPos: newPluginState.activeIndexPos,
194
196
  api: api,
@@ -83,7 +83,7 @@ export const createPlugin = (config, getIntl, api, onEditorView) => {
83
83
  let newPluginState = currentPluginState;
84
84
  if (meta) {
85
85
  if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'REVEAL_COMPLETE') {
86
- var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0, _newPluginState1;
86
+ var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0, _newPluginState1, _newPluginState10;
87
87
  // REVEAL_COMPLETE repaints with the reveal dropped, so the decorations render their
88
88
  // ordinary resting style. Without it the reveal stays in state indefinitely and the
89
89
  // next unrelated repaint re-emits the hidden, zero-width highlight with no animation
@@ -110,29 +110,29 @@ export const createPlugin = (config, getIntl, api, onEditorView) => {
110
110
  state: newState,
111
111
  pluginState: newPluginState,
112
112
  nodeViewSerializer,
113
- colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
113
+ colorScheme: (_newPluginState$color = (_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.colorScheme) !== null && _newPluginState$color !== void 0 ? _newPluginState$color : config === null || config === void 0 ? void 0 : config.colorScheme,
114
114
  intl: getIntl(),
115
115
  activeIndexPos: newPluginState.activeIndexPos,
116
116
  api,
117
117
  tagMountContext,
118
- ...(isExtendedEnabled((_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.diffType) ? {
119
- isInverted: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.isInverted,
120
- diffType: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.diffType,
121
- hideDeletedDiffs: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.hideDeletedDiffs,
122
- hideAddedDiffsUnderline: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideAddedDiffsUnderline,
123
- showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
124
- smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
125
- deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement,
126
- inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement,
118
+ ...(isExtendedEnabled((_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.diffType) ? {
119
+ isInverted: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.isInverted,
120
+ diffType: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.diffType,
121
+ hideDeletedDiffs: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideDeletedDiffs,
122
+ hideAddedDiffsUnderline: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.hideAddedDiffsUnderline,
123
+ showIndicators: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.showIndicators,
124
+ smartThresholds: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.smartThresholds,
125
+ deletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.deletedDiffPlacement,
126
+ inlineDeletedDiffPlacement: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.inlineDeletedDiffPlacement,
127
127
  // SHOW_DIFF only. The scroll-to-next recalculation further down deliberately
128
128
  // omits this so stepping through changes cannot replay the choreography.
129
- reveal: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.reveal
129
+ reveal: (_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.reveal
130
130
  } : {})
131
131
  });
132
132
  // Update the decorations and their ids
133
133
  newPluginState.decorations = decorations;
134
134
  newPluginState.contributorTags = contributorTags;
135
- if (isExtendedEnabled((_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.diffType)) {
135
+ if (isExtendedEnabled((_newPluginState10 = newPluginState) === null || _newPluginState10 === void 0 ? void 0 : _newPluginState10.diffType)) {
136
136
  newPluginState.diffDescriptors = diffDescriptors;
137
137
  }
138
138
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
@@ -144,6 +144,8 @@ export const createPlugin = (config, getIntl, api, onEditorView) => {
144
144
  activeIndex: undefined,
145
145
  contributorTags: [],
146
146
  reveal: undefined,
147
+ // Per-call override — do not let it leak into the next, unrelated `showDiff` call.
148
+ colorScheme: undefined,
147
149
  /**
148
150
  * Reset isInverted & diffType state when hiding diffs
149
151
  * Otherwise this should persist for the diff-showing session
@@ -157,11 +159,11 @@ export const createPlugin = (config, getIntl, api, onEditorView) => {
157
159
  } : {})
158
160
  };
159
161
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') {
160
- var _newPluginState10;
162
+ var _newPluginState11;
161
163
  // Update the active index in plugin state and recalculate decorations
162
- const decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc, (_newPluginState10 = newPluginState) === null || _newPluginState10 === void 0 ? void 0 : _newPluginState10.diffType);
164
+ const decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc, (_newPluginState11 = newPluginState) === null || _newPluginState11 === void 0 ? void 0 : _newPluginState11.diffType);
163
165
  if (decorations.length > 0) {
164
- var _currentPluginState$a;
166
+ var _currentPluginState$a, _newPluginState$color2, _newPluginState12;
165
167
  // Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
166
168
  // This allows the UI to start with no selection and only highlight on first user interaction.
167
169
  let nextIndex = (_currentPluginState$a = currentPluginState.activeIndex) !== null && _currentPluginState$a !== void 0 ? _currentPluginState$a : -1;
@@ -194,7 +196,7 @@ export const createPlugin = (config, getIntl, api, onEditorView) => {
194
196
  state: newState,
195
197
  pluginState: newPluginState,
196
198
  nodeViewSerializer,
197
- colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
199
+ colorScheme: (_newPluginState$color2 = (_newPluginState12 = newPluginState) === null || _newPluginState12 === void 0 ? void 0 : _newPluginState12.colorScheme) !== null && _newPluginState$color2 !== void 0 ? _newPluginState$color2 : config === null || config === void 0 ? void 0 : config.colorScheme,
198
200
  intl: getIntl(),
199
201
  activeIndexPos: newPluginState.activeIndexPos,
200
202
  api,
@@ -87,7 +87,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
87
87
  var newPluginState = currentPluginState;
88
88
  if (meta) {
89
89
  if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'REVEAL_COMPLETE') {
90
- var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0, _newPluginState1;
90
+ var _newPluginState$color, _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9, _newPluginState0, _newPluginState1, _newPluginState10;
91
91
  // REVEAL_COMPLETE repaints with the reveal dropped, so the decorations render their
92
92
  // ordinary resting style. Without it the reveal stays in state indefinitely and the
93
93
  // next unrelated repaint re-emits the hidden, zero-width highlight with no animation
@@ -107,23 +107,23 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
107
107
  state: newState,
108
108
  pluginState: newPluginState,
109
109
  nodeViewSerializer: nodeViewSerializer,
110
- colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
110
+ colorScheme: (_newPluginState$color = (_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.colorScheme) !== null && _newPluginState$color !== void 0 ? _newPluginState$color : config === null || config === void 0 ? void 0 : config.colorScheme,
111
111
  intl: getIntl(),
112
112
  activeIndexPos: newPluginState.activeIndexPos,
113
113
  api: api,
114
114
  tagMountContext: tagMountContext
115
- }, isExtendedEnabled((_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.diffType) ? {
116
- isInverted: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.isInverted,
117
- diffType: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.diffType,
118
- hideDeletedDiffs: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.hideDeletedDiffs,
119
- hideAddedDiffsUnderline: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideAddedDiffsUnderline,
120
- showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
121
- smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
122
- deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement,
123
- inlineDeletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.inlineDeletedDiffPlacement,
115
+ }, isExtendedEnabled((_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.diffType) ? {
116
+ isInverted: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.isInverted,
117
+ diffType: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.diffType,
118
+ hideDeletedDiffs: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideDeletedDiffs,
119
+ hideAddedDiffsUnderline: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.hideAddedDiffsUnderline,
120
+ showIndicators: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.showIndicators,
121
+ smartThresholds: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.smartThresholds,
122
+ deletedDiffPlacement: (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.deletedDiffPlacement,
123
+ inlineDeletedDiffPlacement: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.inlineDeletedDiffPlacement,
124
124
  // SHOW_DIFF only. The scroll-to-next recalculation further down deliberately
125
125
  // omits this so stepping through changes cannot replay the choreography.
126
- reveal: (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.reveal
126
+ reveal: (_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.reveal
127
127
  } : {})),
128
128
  contributorTags = _calculateDiffDecorat.contributorTags,
129
129
  decorations = _calculateDiffDecorat.decorations,
@@ -131,7 +131,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
131
131
  // Update the decorations and their ids
132
132
  newPluginState.decorations = decorations;
133
133
  newPluginState.contributorTags = contributorTags;
134
- if (isExtendedEnabled((_newPluginState1 = newPluginState) === null || _newPluginState1 === void 0 ? void 0 : _newPluginState1.diffType)) {
134
+ if (isExtendedEnabled((_newPluginState10 = newPluginState) === null || _newPluginState10 === void 0 ? void 0 : _newPluginState10.diffType)) {
135
135
  newPluginState.diffDescriptors = diffDescriptors;
136
136
  }
137
137
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
@@ -140,7 +140,9 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
140
140
  isDisplayingChanges: false,
141
141
  activeIndex: undefined,
142
142
  contributorTags: [],
143
- reveal: undefined
143
+ reveal: undefined,
144
+ // Per-call override — do not let it leak into the next, unrelated `showDiff` call.
145
+ colorScheme: undefined
144
146
  }, isExtendedEnabled(currentPluginState.diffType) ? {
145
147
  isInverted: false,
146
148
  diffType: getDefaultDiffType(),
@@ -149,11 +151,11 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
149
151
  diffDescriptors: []
150
152
  } : {});
151
153
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') {
152
- var _newPluginState10;
154
+ var _newPluginState11;
153
155
  // Update the active index in plugin state and recalculate decorations
154
- var _decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc, (_newPluginState10 = newPluginState) === null || _newPluginState10 === void 0 ? void 0 : _newPluginState10.diffType);
156
+ var _decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc, (_newPluginState11 = newPluginState) === null || _newPluginState11 === void 0 ? void 0 : _newPluginState11.diffType);
155
157
  if (_decorations.length > 0) {
156
- var _currentPluginState$a;
158
+ var _currentPluginState$a, _newPluginState$color2, _newPluginState12;
157
159
  // Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
158
160
  // This allows the UI to start with no selection and only highlight on first user interaction.
159
161
  var nextIndex = (_currentPluginState$a = currentPluginState.activeIndex) !== null && _currentPluginState$a !== void 0 ? _currentPluginState$a : -1;
@@ -181,7 +183,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
181
183
  state: newState,
182
184
  pluginState: newPluginState,
183
185
  nodeViewSerializer: nodeViewSerializer,
184
- colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
186
+ colorScheme: (_newPluginState$color2 = (_newPluginState12 = newPluginState) === null || _newPluginState12 === void 0 ? void 0 : _newPluginState12.colorScheme) !== null && _newPluginState$color2 !== void 0 ? _newPluginState$color2 : config === null || config === void 0 ? void 0 : config.colorScheme,
185
187
  intl: getIntl(),
186
188
  activeIndexPos: newPluginState.activeIndexPos,
187
189
  api: api,
@@ -1 +1 @@
1
- export type { DeletedDiffPlacement, DeletedDiffWidget, DiffContributorProfile, DiffParams, DiffStepAttribution, DiffType, PMDiffParams, RevealMode, RevealOptions, ShowDiffParams, ShowDiffPlugin, SmartDiffThresholds, StepWithAttribution, } from '../showDiffPluginType';
1
+ export type { ColorScheme, DeletedDiffPlacement, DeletedDiffWidget, DiffContributorProfile, DiffParams, DiffStepAttribution, DiffType, PMDiffParams, RevealMode, RevealOptions, ShowDiffParams, ShowDiffPlugin, SmartDiffThresholds, StepWithAttribution, } from '../showDiffPluginType';
@@ -1,6 +1,6 @@
1
1
  import type { Change } from 'prosemirror-changeset';
2
2
  import type { DiffContributors, DiffStepAttribution, TagContributor } from '../../../showDiffPluginType';
3
- import { type AdsAccentColor, type ColorScheme, type PublicColorScheme } from './types';
3
+ import { type AdsAccentColor, type ColorScheme } from './types';
4
4
  export type DiffAttributionSpanData = DiffStepAttribution & {
5
5
  stepIndex: number;
6
6
  };
@@ -31,4 +31,4 @@ export declare const createAttributionColorMap: (stepAttributions: Array<DiffSte
31
31
  * back to the latest overlapping attributed step.
32
32
  */
33
33
  export declare const getAttributionKeyForChange: (change: Change, attributedChanges: Change[]) => string | undefined;
34
- export declare const getColorSchemeForChange: (change: Change, attributedChanges: Change[], attributionColors: Map<string, AdsAccentColor>, fallback: PublicColorScheme | undefined) => ColorScheme | undefined;
34
+ export declare const getColorSchemeForChange: (change: Change, attributedChanges: Change[], attributionColors: Map<string, AdsAccentColor>, fallback: ColorScheme | undefined) => ColorScheme | undefined;
@@ -6,7 +6,7 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform-override';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
- import type { ContributorTagModel, DeletedDiffPlacement, DiffDescriptor, DiffParams, DiffStepAttribution, DiffType, InlineDeletedDiffPlacement, RevealOptions, ShowDiffPlugin, SmartDiffThresholds } from '../showDiffPluginType';
9
+ import type { ColorScheme, ContributorTagModel, DeletedDiffPlacement, DiffDescriptor, DiffParams, DiffStepAttribution, DiffType, InlineDeletedDiffPlacement, RevealOptions, ShowDiffPlugin, SmartDiffThresholds } from '../showDiffPluginType';
10
10
  import type { ResolvedDiffContributors } from './decorations/colorSchemes/attributions';
11
11
  export declare const showDiffPluginKey: PluginKey<ShowDiffPluginState>;
12
12
  export type ShowDiffPluginState = {
@@ -15,6 +15,12 @@ export type ShowDiffPluginState = {
15
15
  from: number;
16
16
  to: number;
17
17
  };
18
+ /**
19
+ * Per-call override, set via SHOW_DIFF meta. Falls back to the plugin's configured
20
+ * `DiffParams.colorScheme` (see `createPlugin`'s `config` argument) when unset, and persists
21
+ * across `SCROLL_TO_NEXT`/`SCROLL_TO_PREVIOUS` repaints of the same diff. Reset on HIDE_DIFF.
22
+ */
23
+ colorScheme?: ColorScheme;
18
24
  /** Set via SHOW_DIFF meta, after `normalizeShowDiffParams` has keyed the public list. */
19
25
  contributors?: ResolvedDiffContributors;
20
26
  /** Resolved per calculation, never set via meta. */
@@ -8,8 +8,16 @@ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
8
8
  import type { Node } from '@atlaskit/editor-prosemirror/model';
9
9
  import type { Step } from '@atlaskit/editor-prosemirror/transform-override';
10
10
  import type { SmartDiffThresholds as SmartDiffThresholdsInternal } from './pm-plugins/calculateDiff/smart/thresholds';
11
- import type { ColorScheme as ResolvedColorScheme, PublicColorScheme } from './pm-plugins/decorations/colorSchemes/types';
12
- export type ColorScheme = PublicColorScheme;
11
+ import type { ColorScheme as ResolvedColorScheme } from './pm-plugins/decorations/colorSchemes/types';
12
+ /**
13
+ * `'standard'` (purple insertions, default) and `'traditional'` (green/red) are the two
14
+ * plugin-configured schemes. The remaining accent names are the attribution palette used for
15
+ * per-contributor colouring (`stepsWithAttribution`) — callers of the imperative `showDiff`
16
+ * command (see `PMDiffParams.colorScheme`) can also pass one of these directly to match a
17
+ * specific contributor's colour outside of attribution mode, for example matching a Review
18
+ * moment diff to the streaming highlight of the agent that produced it.
19
+ */
20
+ export type ColorScheme = ResolvedColorScheme;
13
21
  export type DiffType = 'inline' | 'block' | 'step' | 'smart';
14
22
  /**
15
23
  * Attribution for a ProseMirror step.
@@ -143,6 +151,13 @@ export type DiffParams = {
143
151
  steps: StepJson[];
144
152
  };
145
153
  export type PMDiffParams = {
154
+ /**
155
+ * Overrides the colour scheme for this repaint only. Unset falls back to the plugin's
156
+ * configured `DiffParams.colorScheme` (ultimately `'standard'`, purple). Persists across
157
+ * `SCROLL_TO_NEXT`/`SCROLL_TO_PREVIOUS` repaints of the same diff, and resets when the diff
158
+ * is hidden.
159
+ */
160
+ colorScheme?: ColorScheme;
146
161
  /**
147
162
  * For the `smart` diffType, where node/paragraph-level deleted content is rendered relative to
148
163
  * the new content. Defaults to `'top'`. Ignored for other diff types.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "16.0.17",
3
+ "version": "16.1.0",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "sideEffects": false,
21
21
  "atlaskit:src": "src/index.ts",
22
22
  "dependencies": {
23
- "@atlaskit/adf-schema": "^57.4.0",
23
+ "@atlaskit/adf-schema": "^57.5.0",
24
24
  "@atlaskit/avatar": "^28.0.0",
25
25
  "@atlaskit/custom-steps": "^1.1.0",
26
26
  "@atlaskit/editor-plugin-accessibility-utils": "^18.0.0",
@@ -33,7 +33,7 @@
33
33
  "@atlaskit/platform-feature-experiments": "^0.3.0",
34
34
  "@atlaskit/platform-feature-flags": "^2.2.0",
35
35
  "@atlaskit/primitives": "^22.5.0",
36
- "@atlaskit/tmp-editor-statsig": "^197.0.0",
36
+ "@atlaskit/tmp-editor-statsig": "^198.0.0",
37
37
  "@atlaskit/tokens": "^17.0.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "@compiled/react": "^1.0.2",
@@ -58,14 +58,14 @@
58
58
  "@atlassian/confluence-presets": "workspace:^",
59
59
  "@atlassian/content-reconciliation": "^0.1.3506",
60
60
  "@atlassian/editor-ai-injected-editors": "^32.0.0",
61
- "@atlassian/editor-plugin-ai": "^72.2.0",
61
+ "@atlassian/editor-plugin-ai": "^72.3.0",
62
62
  "@atlassian/structured-docs-types": "workspace:^",
63
63
  "react": "^19.2.0",
64
64
  "react-dom": "^19.2.0",
65
65
  "react-intl": "^7.0.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@atlaskit/editor-common": "^122.9.0",
68
+ "@atlaskit/editor-common": "^122.10.0",
69
69
  "react": "^18.2.0 || ^19.2.0",
70
70
  "react-dom": "^18.2.0 || ^19.2.0",
71
71
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"