import { FlowBlock, TrackChangeAuthor, TrackedChangeMeta } from './index.js'; /** * Tracked-change visual categories. This is the full paint/metadata * vocabulary: it names the DOM class, `data-track-change-semantic-color-key` * dataset value, and review-metadata category of every rendered * tracked-change side. * * COLOR ownership is split in two: * - {@link TrackedChangeConfigurableSemanticColorKey} (a subset) resolves its * paint color through the JS `semanticColors` config (overrides/resolver) * with the defaults below. * - The table-structure categories (`table-insertion`, `table-deletion`, * `table-row-insertion`, `table-row-deletion`, `table-split`) are CSS-only: * they carry NO JS-resolved color; DomPainter styles them via the * `--sd-tracked-changes-table-*` theme variables, which hosts override in * CSS. * * `move` is a group override key for both move sides; rendered move layers * continue to carry the specific `move-from` / `move-to` keys. * `table-split` covers whole-table split structure; `cell-split` covers split * cells. */ export type TrackedChangeSemanticColorKey = 'insertion' | 'deletion' | 'move' | 'move-from' | 'move-to' | 'table-insertion' | 'table-deletion' | 'table-row-insertion' | 'table-row-deletion' | 'table-cell-insertion' | 'table-cell-deletion' | 'table-split' | 'cell-merge' | 'cell-split' | 'image-insertion' | 'image-deletion' | 'image-property-change'; /** * The categories whose paint color is resolvable through the JS * `semanticColors` config. Table-structure categories are deliberately * excluded: their colors are themed via CSS variables only. */ export type TrackedChangeConfigurableSemanticColorKey = 'insertion' | 'deletion' | 'move' | 'move-from' | 'move-to' | 'table-cell-insertion' | 'table-cell-deletion' | 'cell-merge' | 'cell-split' | 'image-insertion' | 'image-deletion' | 'image-property-change'; /** All semantic color keys, in declaration order (useful for iteration/tests). */ export declare const TRACKED_CHANGE_SEMANTIC_COLOR_KEYS: readonly TrackedChangeSemanticColorKey[]; /** The JS-configurable subset, in declaration order. */ export declare const TRACKED_CHANGE_CONFIGURABLE_SEMANTIC_COLOR_KEYS: readonly TrackedChangeConfigurableSemanticColorKey[]; /** Whether a category resolves its color through the JS `semanticColors` config. */ export declare const isConfigurableSemanticColorKey: (key: TrackedChangeSemanticColorKey | null | undefined) => key is TrackedChangeConfigurableSemanticColorKey; /** * Default semantic colors per JS-configurable key. These are Word-like * defaults for SD-3479: insertion blue, deletion red, and moved text green. * All entries are hex constants so downstream focused-background derivation * (`colorWithAlpha`) works without extra parsing. Table-structure categories * have no entry here — their defaults live in the painter's CSS variables. */ export declare const DEFAULT_TRACKED_CHANGE_SEMANTIC_COLORS: Readonly>; /** Input the host semantic resolver receives for a single tracked-change layer. */ export interface TrackedChangeSemanticColorResolverInput { /** Semantic category being colored (JS-configurable categories only). */ key: TrackedChangeConfigurableSemanticColorKey; /** Author identity, when known (semantic colors are not author-derived). */ author?: TrackChangeAuthor; /** Raw structural change type, when known. */ type?: string; /** Logical structural subtype, when known. */ subtype?: string; /** Structural target kind (e.g. cell/row/table), when known. */ targetKind?: string; /** Scope of the semantic paint anchor, when known. */ semanticAnchorScope?: string; } /** * A composed resolver mapping a semantic tracked-change input to a color. * Returns `undefined` only when the resolver itself declines for a key. The * composer returns `undefined` only when semantic colors are explicitly * disabled. */ export type TrackChangeSemanticColorResolver = (input: TrackedChangeSemanticColorResolverInput) => string | undefined; /** * Host-facing semantic tracked-change color configuration. Mirrors the * (later) `modules.trackChanges.semanticColors` shape on the public `superdoc` * package. */ export interface SemanticColorsConfig { /** When `false`, semantic colors are not applied. Defaults to enabled. */ enabled?: boolean; /** * Color overrides keyed by semantic category. `move` applies to both move * sides unless a side-specific override exists. Table-structure categories * are not configurable here — theme them via the * `--sd-tracked-changes-table-*` CSS variables instead. */ overrides?: Partial>; /** * Resolver consulted after `overrides`. Return a CSS color string, or * `undefined`/nullish to fall through to the default semantic color. */ resolve?: (input: TrackedChangeSemanticColorResolverInput) => string | undefined | null; } /** * Deterministic signature for tracked-change metadata that can affect paint. * * Used by layout/painter cache keys. Keep this aligned with fields DomPainter * reads when stamping classes, datasets, CSS variables, and mode-dependent * tracked-change decorations. */ export declare const trackedChangeMetaSignature: (trackedChange: TrackedChangeMeta | null | undefined) => string; export declare const trackedChangeLayersSignature: (trackedChanges: readonly TrackedChangeMeta[] | null | undefined) => string; /** Default semantic color for a JS-configurable key, or `undefined` for an unknown/CSS-only key. */ export declare const defaultSemanticColor: (key: TrackedChangeSemanticColorKey) => string | undefined; /** Structural target kind painted by a semantic color key. */ export type TrackedChangeSemanticTargetKind = 'text' | 'table' | 'row' | 'cell' | 'image'; /** * Target kind painted by each semantic color key. Single source of truth for * the projection (v2 host), the layout adapter, and sidebar metadata, so a key * added in one layer cannot silently disagree about its target in another. */ export declare const TRACKED_CHANGE_SEMANTIC_TARGET_KINDS: Readonly>; /** Target kind for a semantic key, or `undefined` for an unknown/absent key. */ export declare const semanticColorTargetKind: (key: TrackedChangeSemanticColorKey | null | undefined) => TrackedChangeSemanticTargetKind | undefined; /** * Keys whose paint anchors to an affected range rather than a single direct * marker (cell merge/split and table split are range paints). */ export declare const TRACKED_CHANGE_AFFECTED_RANGE_KEYS: ReadonlySet; /** Anchor scope for a semantic key: `'affected-range'` for range paints, else `null`. */ export declare const semanticColorAnchorScope: (key: TrackedChangeSemanticColorKey | null | undefined) => "affected-range" | null; /** * Semantic key implied by a structural insert/delete marker on a table, row, * cell, or image target. Inverse of {@link TRACKED_CHANGE_SEMANTIC_TARGET_KINDS} for * the structural insert/delete families; `undefined` for other kinds * (formatting, moves) which never imply a structural semantic key. */ export declare const structuralSemanticColorKey: (kind: string | null | undefined, targetKind: "table" | "row" | "cell" | "image") => TrackedChangeSemanticColorKey | undefined; /** * Composes the host `semanticColors` config into a single resolver. * * Resolution order per key: * 1. `overrides[key]` (exact key match). * 2. `overrides.move` for `move-from` / `move-to`. * 3. `resolve(input)`. * 4. The default semantic color for the key. * * Missing config still enables the built-in defaults, so supported semantic * keys receive the requested colors without host configuration. Returns * `undefined` only when semantic colors are disabled (`enabled === false`). A * throwing host resolver must not break rendering: it falls through to the * default color. */ export declare const composeSemanticColorResolver: (config?: SemanticColorsConfig | null) => TrackChangeSemanticColorResolver | undefined; /** * Walks every tracked-change layer in the converted FlowBlocks and stamps * `meta.semanticColor` from the resolver, based on each layer's * `semanticColorKey`. Covers run layers, row-level tracked changes, and the * cell-level `TableCellAttrs.trackedChange` carrier. * * Passing `undefined` (semantic colors disabled or no resolver available) * clears any existing `semanticColor`, which prevents stale semantic colors * from surviving on reused cached blocks. Missing host config should normally * be passed through {@link composeSemanticColorResolver} so defaults apply. * Author `color` fields are never read, mutated, or cleared by this pass. */ export declare const stampTrackedChangeSemanticColors: (blocks: FlowBlock[], resolve: TrackChangeSemanticColorResolver | undefined) => void;