@atlaskit/editor-plugin-show-diff
Version:
ShowDiff plugin for @atlaskit/editor-core
34 lines (33 loc) • 1.75 kB
TypeScript
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
import type { RevealOptions } from '../showDiffPluginType';
/**
* Reveal animation timing. Phase A (0–0.6D): outgoing state fades in, agent highlight wipes out.
* Phase B (0.6D–D): all highlights wipe in. Uses Web Animations API for element reusability and
* per-reveal cancellation.
*/
/** Total choreography length when the caller does not specify one. */
export declare const REVEAL_DEFAULT_DURATION_MS = 950;
/**
* Stop any running reveal and drop it from plugin state.
*
* Clearing the state is what restores the resting appearance: revealing decorations paint their
* highlight at zero width, so the repaint that follows is what renders them normally again. Doing
* it in state rather than by writing styles onto the current elements means decorations rendered
* later are correct too — an imperative fix only reaches the elements that exist at that instant.
*/
export declare const cancelReveal: (editorView: EditorView) => void;
/**
* Re-binds the reveal to the current decorations. Called on every repaint while a reveal is in
* flight, because a repaint silently destroys any animation attached to re-rendered DOM.
*/
export declare const rebindReveal: (editorView: EditorView, content: HTMLElement) => void;
/**
* Start the reveal. Must be called BEFORE transaction dispatch (last moment outgoing DOM exists
* for capture). Incoming half animates a frame later, post-decoration-render.
*/
export declare const beginReveal: ({ editorView, onComplete, reveal, }: {
editorView: EditorView;
/** Drops the reveal from plugin state, so the next paint renders the resting style. */
onComplete: () => void;
reveal: RevealOptions;
}) => void;