/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/toolkit/dataidassigner */ import { type Editor } from "@ckeditor/ckeditor5-core"; import { type ViewDocumentFragment, type ViewElement } from "@ckeditor/ckeditor5-engine"; /** * Assigns a unique `data-id` to the structural view elements that lack one — container, empty and raw elements, plus * any element containing an id-bearing descendant (skipping `
`). Existing ids are preserved. */ export declare class DataIdAssigner { constructor(editor: Editor); /** * Assigns the missing `data-id`s across the given view fragment (or element). */ assign(view: ViewElement | ViewDocumentFragment): void; /** * Generates a random 4-letter id not already used (and records it). Short and letters-only, mirroring the AI scheme. */ nextId(): string; } /** * Gives every element the processed data marks as new an id of its own, so the comparison can tell them apart. * * Elements are matched by `data-id`, and the mark is shared by everything a reply added, so the comparison would read * all of them as one and the same. An id each keeps them apart, and matches nothing in the snapshot - which is what new * content should do. `AIResponseApplier` does the same before a reply reaches a diff. * * An element that simply carries no id is left alone: the processed data is a whole root, where that means an element * the processing did not label rather than one it wrote, and the comparison matches it on its name and attributes. * * @param data The processed data, as the comparison received it. * @returns The same data with every new element named, or exactly what came in when there was nothing to name. */ export declare function resolveDataIds(data: string): string;