@atlaskit/editor-plugin-show-diff 15.0.0 → 15.1.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 +35 -0
- package/afm-cc/tsconfig.json +0 -12
- package/afm-products/tsconfig.json +0 -12
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +131 -79
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +32 -0
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +87 -25
- package/dist/cjs/pm-plugins/decorations/createContributorTagWidget.js +27 -4
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +17 -3
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -3
- package/dist/cjs/pm-plugins/decorations/extractContributorTags.js +43 -14
- package/dist/cjs/pm-plugins/decorations/revealStyles.js +156 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +25 -5
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +4 -2
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -1
- package/dist/cjs/pm-plugins/main.js +28 -10
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +4 -0
- package/dist/cjs/pm-plugins/revealAnimation.js +524 -0
- package/dist/cjs/showDiffPlugin.js +42 -7
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +59 -9
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +30 -0
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +62 -4
- package/dist/es2019/pm-plugins/decorations/createContributorTagWidget.js +25 -3
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +18 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -3
- package/dist/es2019/pm-plugins/decorations/extractContributorTags.js +36 -9
- package/dist/es2019/pm-plugins/decorations/revealStyles.js +139 -0
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +25 -6
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +6 -3
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +5 -2
- package/dist/es2019/pm-plugins/main.js +28 -9
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +4 -0
- package/dist/es2019/pm-plugins/revealAnimation.js +495 -0
- package/dist/es2019/showDiffPlugin.js +37 -7
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +131 -79
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +30 -0
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +87 -25
- package/dist/esm/pm-plugins/decorations/createContributorTagWidget.js +27 -4
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +17 -3
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -3
- package/dist/esm/pm-plugins/decorations/extractContributorTags.js +43 -14
- package/dist/esm/pm-plugins/decorations/revealStyles.js +149 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +25 -5
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +4 -2
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -1
- package/dist/esm/pm-plugins/main.js +28 -10
- package/dist/esm/pm-plugins/resolveDiffContributors.js +4 -0
- package/dist/esm/pm-plugins/revealAnimation.js +518 -0
- package/dist/esm/showDiffPlugin.js +42 -7
- package/dist/types/entry-points/show-diff-plugin-type.d.ts +1 -1
- package/dist/types/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +24 -0
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +5 -1
- package/dist/types/pm-plugins/decorations/createContributorTagWidget.d.ts +9 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +3 -2
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +3 -2
- package/dist/types/pm-plugins/decorations/revealStyles.d.ts +49 -0
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -3
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +6 -1
- package/dist/types/pm-plugins/revealAnimation.d.ts +33 -0
- package/dist/types/showDiffPluginType.d.ts +29 -1
- package/package.json +10 -4
|
@@ -2,6 +2,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { DiffType } from '../../showDiffPluginType';
|
|
4
4
|
import type { ColorScheme } from './colorSchemes/types';
|
|
5
|
+
import { type ContributorTagMountContext } from './createContributorTagWidget';
|
|
5
6
|
/**
|
|
6
7
|
* Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
|
|
7
8
|
*
|
|
@@ -10,7 +11,8 @@ import type { ColorScheme } from './colorSchemes/types';
|
|
|
10
11
|
* @param isActive Whether this node is part of the currently active/focused change
|
|
11
12
|
* @returns Prosemirror node decoration or undefined
|
|
12
13
|
*/
|
|
13
|
-
export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, isActive, shouldHideDeleted, showIndicators, doc, diffType, }: {
|
|
14
|
+
export declare const createBlockChangedDecoration: ({ attributionKey, change, colorScheme, isInserted, isActive, shouldHideDeleted, showContributorTags, showIndicators, doc, diffType, tagMountContext, }: {
|
|
15
|
+
attributionKey?: string;
|
|
14
16
|
change: {
|
|
15
17
|
from: number;
|
|
16
18
|
name: string;
|
|
@@ -22,5 +24,7 @@ export declare const createBlockChangedDecoration: ({ change, colorScheme, isIns
|
|
|
22
24
|
isActive?: boolean;
|
|
23
25
|
isInserted?: boolean;
|
|
24
26
|
shouldHideDeleted?: boolean;
|
|
27
|
+
showContributorTags?: boolean;
|
|
25
28
|
showIndicators?: boolean;
|
|
29
|
+
tagMountContext?: ContributorTagMountContext;
|
|
26
30
|
}) => Decoration[];
|
|
@@ -42,13 +42,19 @@ export declare const createContributorTagHost: (diffId: string, mountContext?: C
|
|
|
42
42
|
mount: ContributorTagMount | undefined;
|
|
43
43
|
} | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* A widget hosting the contributor tag of one
|
|
46
|
-
*
|
|
45
|
+
* A widget hosting the contributor tag of one diff range, placed on the first character the range
|
|
46
|
+
* highlights — or, with `anchorAtRangeStart`, at `from` itself. Either way a host that would land
|
|
47
|
+
* inside a code block is hoisted out in front of it; see `resolveCodeBlockStart`.
|
|
47
48
|
*
|
|
48
49
|
* The tag is mounted in `toDOM` and taken down in `destroy`, so it lives exactly as long as the host
|
|
49
50
|
* element ProseMirror drew it into — see `mountContributorTag`.
|
|
50
51
|
*/
|
|
51
|
-
export declare const createContributorTagWidget: ({ doc, from, to, diffId, mountContext, }: {
|
|
52
|
+
export declare const createContributorTagWidget: ({ anchorAtRangeStart, doc, from, to, diffId, mountContext, }: {
|
|
53
|
+
/**
|
|
54
|
+
* Anchor the host at `from` instead of the range's first inline content, so a block range hosts
|
|
55
|
+
* its tag outside the node rather than inside its content DOM.
|
|
56
|
+
*/
|
|
57
|
+
anchorAtRangeStart?: boolean;
|
|
52
58
|
diffId: string;
|
|
53
59
|
doc: PMNode;
|
|
54
60
|
from: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { DiffType } from '../../showDiffPluginType';
|
|
3
|
+
import type { DiffType, RevealOptions } from '../../showDiffPluginType';
|
|
4
4
|
import type { ColorScheme } from './colorSchemes/types';
|
|
5
5
|
import { type ContributorTagMountContext } from './createContributorTagWidget';
|
|
6
6
|
import type { InlineAttrChangeNodeName } from './utils/getAttrChangeRanges';
|
|
@@ -14,7 +14,7 @@ export declare const getAtomicInlineChangedAttrs: (inlineNodeName: InlineAttrCha
|
|
|
14
14
|
* @param change Changeset "change" containing information about the change content + range
|
|
15
15
|
* @returns Prosemirror inline decoration
|
|
16
16
|
*/
|
|
17
|
-
export declare const createInlineChangedDecoration: ({ attributionKey, change, colorScheme, isActive, isInserted, isAtomicInlineNode, shouldHideDeleted, showContributorTags, showIndicators, doc, diffType, hideAddedDiffsUnderline, inlineNodeName, hasDeletedWidget, isDeletedWidgetBelow, tagMountContext, }: {
|
|
17
|
+
export declare const createInlineChangedDecoration: ({ attributionKey, change, colorScheme, isActive, isInserted, isAtomicInlineNode, shouldHideDeleted, showContributorTags, showIndicators, doc, diffType, hideAddedDiffsUnderline, inlineNodeName, hasDeletedWidget, isDeletedWidgetBelow, reveal, tagMountContext, }: {
|
|
18
18
|
attributionKey?: string;
|
|
19
19
|
change: {
|
|
20
20
|
fromB: number;
|
|
@@ -30,6 +30,7 @@ export declare const createInlineChangedDecoration: ({ attributionKey, change, c
|
|
|
30
30
|
isAtomicInlineNode?: boolean;
|
|
31
31
|
isDeletedWidgetBelow?: boolean;
|
|
32
32
|
isInserted?: boolean;
|
|
33
|
+
reveal?: RevealOptions;
|
|
33
34
|
shouldHideDeleted?: boolean;
|
|
34
35
|
showContributorTags?: boolean;
|
|
35
36
|
showIndicators?: boolean;
|
|
@@ -2,7 +2,7 @@ import type { Change } from 'prosemirror-changeset';
|
|
|
2
2
|
import type { IntlShape } from 'react-intl';
|
|
3
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { DiffType } from '../../showDiffPluginType';
|
|
5
|
+
import type { DiffType, RevealOptions } from '../../showDiffPluginType';
|
|
6
6
|
import type { NodeViewSerializer } from '../NodeViewSerializer';
|
|
7
7
|
import { type ContributorTagMountContext } from './createContributorTagWidget';
|
|
8
8
|
import type { ColorScheme } from './colorSchemes/types';
|
|
@@ -10,7 +10,7 @@ import type { ColorScheme } from './colorSchemes/types';
|
|
|
10
10
|
* This function is used to create a decoration widget to show content
|
|
11
11
|
* that is not in the current document.
|
|
12
12
|
*/
|
|
13
|
-
export declare const createNodeChangedDecorationWidget: ({ attributionKey, change, doc, nodeViewSerializer, colorScheme, newDoc, intl, activeIndexPos, isInserted, showContributorTags, showIndicators, placeBelow, diffType, hideAddedDiffsUnderline, tagMountContext, }: {
|
|
13
|
+
export declare const createNodeChangedDecorationWidget: ({ attributionKey, change, doc, nodeViewSerializer, colorScheme, newDoc, intl, activeIndexPos, isInserted, showContributorTags, showIndicators, placeBelow, diffType, hideAddedDiffsUnderline, reveal, tagMountContext, }: {
|
|
14
14
|
activeIndexPos?: {
|
|
15
15
|
from: number;
|
|
16
16
|
to: number;
|
|
@@ -26,6 +26,7 @@ export declare const createNodeChangedDecorationWidget: ({ attributionKey, chang
|
|
|
26
26
|
newDoc: PMNode;
|
|
27
27
|
nodeViewSerializer: NodeViewSerializer;
|
|
28
28
|
placeBelow?: boolean;
|
|
29
|
+
reveal?: RevealOptions;
|
|
29
30
|
showContributorTags?: boolean;
|
|
30
31
|
showIndicators?: boolean;
|
|
31
32
|
tagMountContext?: ContributorTagMountContext;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { RevealOptions } from '../../showDiffPluginType';
|
|
2
|
+
import type { ColorScheme } from './colorSchemes/types';
|
|
3
|
+
/**
|
|
4
|
+
* Painting strategy for reveal highlights. Highlights are `linear-gradient`s with animated
|
|
5
|
+
* `background-size` for the wipe effect. Colours live on elements as custom properties so the
|
|
6
|
+
* attribution palette works per-contributor.
|
|
7
|
+
*/
|
|
8
|
+
/** Marks an element as taking part in the reveal, and says which side it represents. */
|
|
9
|
+
export declare const REVEAL_ATTR = "data-show-diff-reveal";
|
|
10
|
+
export type RevealRole = 'added' | 'deleted';
|
|
11
|
+
/** Wipe colour, read by the animation as the gradient's colour stop. */
|
|
12
|
+
export declare const REVEAL_BG_VAR = "--show-diff-reveal-bg";
|
|
13
|
+
/** Underline colour, brought in on the same schedule as the highlight. */
|
|
14
|
+
export declare const REVEAL_BORDER_VAR = "--show-diff-reveal-border";
|
|
15
|
+
/** Convert a flat background colour into a wipeable gradient (zero width initially). */
|
|
16
|
+
export declare const buildWipeableBackground: (color: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve reveal attribute and style for a decoration. Returned style REPLACES the decoration's
|
|
19
|
+
* highlight (not an addition) so the animation has something to wipe. Gate resolved in showDiff
|
|
20
|
+
* command for single shared answer between decorations and animation.
|
|
21
|
+
*/
|
|
22
|
+
export declare const resolveRevealStyle: ({ colorScheme, hideAddedDiffsUnderline, includeDeletedTextStyle, isActive, isInserted, reveal, }: {
|
|
23
|
+
colorScheme: ColorScheme | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Mirrors the `showDiff` parameter of the same name. Must be threaded through: it decides
|
|
26
|
+
* whether the resting appearance has an underline, and so whether the reveal should bring one in.
|
|
27
|
+
*/
|
|
28
|
+
hideAddedDiffsUnderline?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to supply deleted content's grey text and strikethrough. False for the deleted-content
|
|
31
|
+
* widget, which already applies its own.
|
|
32
|
+
*/
|
|
33
|
+
includeDeletedTextStyle?: boolean;
|
|
34
|
+
isActive: boolean;
|
|
35
|
+
isInserted: boolean;
|
|
36
|
+
reveal: RevealOptions | undefined;
|
|
37
|
+
}) => {
|
|
38
|
+
role: RevealRole;
|
|
39
|
+
style: string;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/** Reveal style for imperatively-built elements (deleted-content widget wrappers). */
|
|
42
|
+
export declare const applyRevealToElement: ({ colorScheme, element, hideAddedDiffsUnderline, isActive, isInserted, reveal, }: {
|
|
43
|
+
colorScheme: ColorScheme | undefined;
|
|
44
|
+
element: HTMLElement;
|
|
45
|
+
hideAddedDiffsUnderline?: boolean;
|
|
46
|
+
isActive: boolean;
|
|
47
|
+
isInserted: boolean;
|
|
48
|
+
reveal: RevealOptions | undefined;
|
|
49
|
+
}) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { DiffType } from '../../../showDiffPluginType';
|
|
3
|
+
import type { DiffType, RevealOptions } from '../../../showDiffPluginType';
|
|
4
4
|
import type { ColorScheme } from '../colorSchemes/types';
|
|
5
5
|
/**
|
|
6
6
|
* Handles all block node rendering with appropriate deleted styling.
|
|
@@ -24,14 +24,15 @@ export declare const wrapBlockNodeView: ({ dom, nodeView, targetNode, colorSchem
|
|
|
24
24
|
* CSS backgrounds don't work when applied to a wrapper around a paragraph, so
|
|
25
25
|
* the wrapper needs to be injected inside the node around the child content.
|
|
26
26
|
*/
|
|
27
|
-
export declare const injectInnerWrapper: ({ node, colorScheme, isActive, isInserted, diffType, }: {
|
|
27
|
+
export declare const injectInnerWrapper: ({ node, colorScheme, isActive, isInserted, diffType, reveal, }: {
|
|
28
28
|
colorScheme?: ColorScheme;
|
|
29
29
|
diffType?: DiffType;
|
|
30
30
|
isActive?: boolean;
|
|
31
31
|
isInserted?: boolean;
|
|
32
32
|
node: HTMLElement;
|
|
33
|
+
reveal?: RevealOptions;
|
|
33
34
|
}) => HTMLElement;
|
|
34
35
|
/**
|
|
35
36
|
* Creates a styled span wrapper for inline content within a change decoration.
|
|
36
37
|
*/
|
|
37
|
-
export declare const createContentWrapper: (colorScheme?: ColorScheme, isActive?: boolean, isInserted?: boolean, diffType?: DiffType) => HTMLElement;
|
|
38
|
+
export declare const createContentWrapper: (colorScheme?: ColorScheme, isActive?: boolean, isInserted?: boolean, diffType?: DiffType, reveal?: RevealOptions) => HTMLElement;
|
|
@@ -15,7 +15,7 @@ export declare const getDeletedContentStyleUnbounded: (colorScheme?: ColorScheme
|
|
|
15
15
|
/** Inline style for inserted content. */
|
|
16
16
|
export declare const getInsertedContentStyle: (colorScheme?: ColorScheme, isActive?: boolean, hideAddedDiffsUnderline?: boolean) => string;
|
|
17
17
|
/** Inline style for deleted content. */
|
|
18
|
-
export declare const getDeletedContentStyle: (colorScheme?: ColorScheme, isActive?: boolean, diffType?: DiffType) => string;
|
|
18
|
+
export declare const getDeletedContentStyle: (colorScheme?: ColorScheme, isActive?: boolean, diffType?: DiffType, omitHighlight?: boolean) => string;
|
|
19
19
|
/**
|
|
20
20
|
* Overlay style for one added or deleted table cell. Invariant across the cells of a table, so the
|
|
21
21
|
* `querySelectorAll('td, th')` loop in `wrapBlockNodeView.ts` resolves it once.
|
|
@@ -8,7 +8,7 @@ export declare const getDeletedContentStyleUnboundedLegacy: (colorScheme?: Color
|
|
|
8
8
|
/** Pre-refactor inline style for inserted content. */
|
|
9
9
|
export declare const getInsertedContentStyleLegacy: (colorScheme?: ColorScheme, isActive?: boolean, hideAddedDiffsUnderline?: boolean) => string;
|
|
10
10
|
/** Pre-refactor inline style for deleted content. */
|
|
11
|
-
export declare const getDeletedContentStyleLegacy: (colorScheme?: ColorScheme, isActive?: boolean, diffType?: DiffType) => string;
|
|
11
|
+
export declare const getDeletedContentStyleLegacy: (colorScheme?: ColorScheme, isActive?: boolean, diffType?: DiffType, omitHighlight?: boolean) => string;
|
|
12
12
|
/**
|
|
13
13
|
* Pre-refactor table-cell overlay style, as chosen inside the `querySelectorAll('td, th')` loop of
|
|
14
14
|
* `applyCellOverlayStyles`. The choice does not vary per cell, so hoisting it out of the loop is
|
|
@@ -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, ShowDiffPlugin, SmartDiffThresholds } from '../showDiffPluginType';
|
|
9
|
+
import type { 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 = {
|
|
@@ -42,6 +42,11 @@ export type ShowDiffPluginState = {
|
|
|
42
42
|
isDisplayingChanges: boolean;
|
|
43
43
|
isInverted?: boolean;
|
|
44
44
|
originalDoc: PMNode | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Reveal choreography for the CURRENT paint only. Set from SHOW_DIFF meta and deliberately not
|
|
47
|
+
* inherited: a scroll-to-next or an unrelated repaint must not replay the animation.
|
|
48
|
+
*/
|
|
49
|
+
reveal?: RevealOptions;
|
|
45
50
|
/**
|
|
46
51
|
* When true, the view update handler should scroll to the first decoration
|
|
47
52
|
* and then reset this flag.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { RevealOptions } from '../showDiffPluginType';
|
|
3
|
+
/**
|
|
4
|
+
* Reveal animation timing. Phase A (0–0.6D): outgoing state fades in, agent highlight wipes out.
|
|
5
|
+
* Phase B (0.6D–D): all highlights wipe in. Uses Web Animations API for element reusability and
|
|
6
|
+
* per-reveal cancellation.
|
|
7
|
+
*/
|
|
8
|
+
/** Total choreography length when the caller does not specify one. */
|
|
9
|
+
export declare const REVEAL_DEFAULT_DURATION_MS = 950;
|
|
10
|
+
/**
|
|
11
|
+
* Stop any running reveal and drop it from plugin state.
|
|
12
|
+
*
|
|
13
|
+
* Clearing the state is what restores the resting appearance: revealing decorations paint their
|
|
14
|
+
* highlight at zero width, so the repaint that follows is what renders them normally again. Doing
|
|
15
|
+
* it in state rather than by writing styles onto the current elements means decorations rendered
|
|
16
|
+
* later are correct too — an imperative fix only reaches the elements that exist at that instant.
|
|
17
|
+
*/
|
|
18
|
+
export declare const cancelReveal: (editorView: EditorView) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Re-binds the reveal to the current decorations. Called on every repaint while a reveal is in
|
|
21
|
+
* flight, because a repaint silently destroys any animation attached to re-rendered DOM.
|
|
22
|
+
*/
|
|
23
|
+
export declare const rebindReveal: (editorView: EditorView, content: HTMLElement) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Start the reveal. Must be called BEFORE transaction dispatch (last moment outgoing DOM exists
|
|
26
|
+
* for capture). Incoming half animates a frame later, post-decoration-render.
|
|
27
|
+
*/
|
|
28
|
+
export declare const beginReveal: ({ editorView, onComplete, reveal, }: {
|
|
29
|
+
editorView: EditorView;
|
|
30
|
+
/** Drops the reveal from plugin state, so the next paint renders the resting style. */
|
|
31
|
+
onComplete: () => void;
|
|
32
|
+
reveal: RevealOptions;
|
|
33
|
+
}) => void;
|
|
@@ -105,6 +105,26 @@ export type DiffDescriptor = {
|
|
|
105
105
|
id: string;
|
|
106
106
|
type: 'inline' | 'block' | 'widget';
|
|
107
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* How the diff is revealed when it is painted.
|
|
110
|
+
*
|
|
111
|
+
* - `phased` — the two-phase choreography used when opening the diff from a clean "new state":
|
|
112
|
+
* the outgoing state cross-fades to the incoming one while the agent highlight wipes out to the
|
|
113
|
+
* right, then every highlight wipes back in from the left.
|
|
114
|
+
*
|
|
115
|
+
* Deliberately separate from {@link DiffType}: that describes how changes are computed and grouped,
|
|
116
|
+
* this describes how the result is presented over time. Folding one into the other would make every
|
|
117
|
+
* `DiffType` consumer — version history, track-changes, publish diff — care about presentation.
|
|
118
|
+
*/
|
|
119
|
+
export type RevealMode = 'phased';
|
|
120
|
+
export type RevealOptions = {
|
|
121
|
+
/**
|
|
122
|
+
* Total length of the choreography. Defaults to `REVEAL_DEFAULT_DURATION_MS`. Exposed because
|
|
123
|
+
* this is a design-tunable value; it should not be buried in a stylesheet.
|
|
124
|
+
*/
|
|
125
|
+
durationMs?: number;
|
|
126
|
+
mode: RevealMode;
|
|
127
|
+
};
|
|
108
128
|
export type DiffParams = {
|
|
109
129
|
/**
|
|
110
130
|
* Color scheme to use for displaying diffs.
|
|
@@ -142,6 +162,13 @@ export type PMDiffParams = {
|
|
|
142
162
|
inlineDeletedDiffPlacement?: InlineDeletedDiffPlacement;
|
|
143
163
|
isInverted?: boolean;
|
|
144
164
|
originalDoc: Node;
|
|
165
|
+
/**
|
|
166
|
+
* How this diff is revealed when painted. Omitted means paint immediately.
|
|
167
|
+
*
|
|
168
|
+
* Applies to THIS paint only — it is not inherited by later recalculations, so stepping
|
|
169
|
+
* through changes or a repaint cannot replay the choreography.
|
|
170
|
+
*/
|
|
171
|
+
reveal?: RevealOptions;
|
|
145
172
|
/**
|
|
146
173
|
* When true, the editor will scroll to bring the first diff decoration into view
|
|
147
174
|
* after the diff is shown.
|
|
@@ -167,7 +194,8 @@ export type PMDiffParams = {
|
|
|
167
194
|
*/
|
|
168
195
|
type PMDiffParamsWithAttribution = Omit<PMDiffParams, 'steps'> & {
|
|
169
196
|
/**
|
|
170
|
-
* Identities for the accounts named by the attributed steps.
|
|
197
|
+
* Identities for the accounts named by the attributed steps. Omitted profiles disable
|
|
198
|
+
* contributor tags without disabling attribution colours. An explicit empty array permits agent fallback tags. When supplied, and the contributor-tag
|
|
171
199
|
* gate is on, every attributed change the plugin can credit to one of them renders a tag.
|
|
172
200
|
* Complete entries only: a caller looking identities up (e.g. against a user directory) filters
|
|
173
201
|
* out the ones it could not resolve rather than passing partial entries through. Omitting an
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.1",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
33
33
|
"@atlaskit/primitives": "^22.5.0",
|
|
34
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^182.0.0",
|
|
35
35
|
"@atlaskit/tokens": "^16.11.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"@compiled/react": "^1.0.2",
|
|
@@ -56,19 +56,25 @@
|
|
|
56
56
|
"@atlassian/confluence-presets": "workspace:^",
|
|
57
57
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
58
58
|
"@atlassian/editor-ai-injected-editors": "^31.0.0",
|
|
59
|
-
"@atlassian/editor-plugin-ai": "^71.
|
|
59
|
+
"@atlassian/editor-plugin-ai": "^71.1.0",
|
|
60
60
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
61
61
|
"react": "^19.2.0",
|
|
62
62
|
"react-dom": "^19.2.0",
|
|
63
63
|
"react-intl": "^7.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@atlaskit/editor-common": "^121.
|
|
66
|
+
"@atlaskit/editor-common": "^121.1.0",
|
|
67
67
|
"react": "^18.2.0 || ^19.2.0",
|
|
68
68
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
69
69
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
70
70
|
},
|
|
71
71
|
"platform-feature-flags": {
|
|
72
|
+
"platform_editor_diff_reveal_animation": {
|
|
73
|
+
"type": "boolean"
|
|
74
|
+
},
|
|
75
|
+
"platform_editor_diff_hide_pure_deletions": {
|
|
76
|
+
"type": "boolean"
|
|
77
|
+
},
|
|
72
78
|
"platform_editor_ai_show_diff_patch_1": {
|
|
73
79
|
"type": "boolean"
|
|
74
80
|
},
|