/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module list/list/converters
*/
import { type DowncastAttributeEvent, type DowncastInsertEvent, type DowncastRemoveEvent, type Element, type MapperModelToViewPositionEvent, type MapperViewToModelPositionEvent, type Model, type ModelInsertContentEvent, type UpcastElementEvent, type View, type Writer } from 'ckeditor5/src/engine';
import type { GetCallback } from 'ckeditor5/src/utils';
/**
* A model-to-view converter for the `listItem` model element insertion.
*
* It creates a `
` (or ``) view structure out of a `listItem` model element, inserts it at the correct
* position, and merges the list with surrounding lists (if available).
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
* @param model Model instance.
*/
export declare function modelViewInsertion(model: Model): GetCallback>;
/**
* A model-to-view converter for the `listItem` model element removal.
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove
* @param model Model instance.
* @returns Returns a conversion callback.
*/
export declare function modelViewRemove(model: Model): GetCallback;
/**
* A model-to-view converter for the `type` attribute change on the `listItem` model element.
*
* This change means that the `- ` element parent changes from `
` to `` (or vice versa). This is accomplished
* by breaking view elements and changing their name. The next {@link module:list/list/converters~modelViewMergeAfterChangeType}
* converter will attempt to merge split nodes.
*
* Splitting this conversion into 2 steps makes it possible to add an additional conversion in the middle.
* Check {@link module:list/todolist/todolistconverters~modelViewChangeType} to see an example of it.
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
*/
export declare const modelViewChangeType: GetCallback>;
/**
* A model-to-view converter that attempts to merge nodes split by {@link module:list/list/converters~modelViewChangeType}.
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
*/
export declare const modelViewMergeAfterChangeType: GetCallback>;
/**
* A model-to-view converter for the `listIndent` attribute change on the `listItem` model element.
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
* @param model Model instance.
* @returns Returns a conversion callback.
*/
export declare function modelViewChangeIndent(model: Model): GetCallback>;
/**
* A special model-to-view converter introduced by the {@link module:list/list~List list feature}. This converter is fired for
* insert change of every model item, and should be fired before the actual converter. The converter checks whether the inserted
* model item is a non-`listItem` element. If it is, and it is inserted inside a view list, the converter breaks the
* list so the model element is inserted to the view parent element corresponding to its model parent element.
*
* The converter prevents such situations:
*
* ```xml
* // Model: // View:
* foo
*
* // After change: // Correct view guaranteed by this converter:
* foo xxx
* xxx // Instead of this wrong view state:
* bar
* ```
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
*/
export declare const modelViewSplitOnInsert: GetCallback>;
/**
* A special model-to-view converter introduced by the {@link module:list/list~List list feature}. This converter takes care of
* merging view lists after something is removed or moved from near them.
*
* Example:
*
* ```xml
* // Model: // View:
* foo
* xxx xxx
* bar
*
* // After change: // Correct view guaranteed by this converter:
* foo
* ```
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove
*/
export declare const modelViewMergeAfter: GetCallback;
/**
* A view-to-model converter that converts the `- ` view elements into the `listItem` model elements.
*
* To set correct values of the `listType` and `listIndent` attributes the converter:
* * checks `
- `'s parent,
* * stores and increases the `conversionApi.store.indent` value when `
- `'s sub-items are converted.
*
* @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
*/
export declare const viewModelConverter: GetCallback;
/**
* A view-to-model converter for the `
` and `` view elements that cleans the input view of garbage.
* This is mostly to clean whitespaces from between the `- ` view elements inside the view list element, however, also
* incorrect data can be cleared if the view was incorrect.
*
* @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
*/
export declare const cleanList: GetCallback;
/**
* A view-to-model converter for the `
- ` elements that cleans whitespace formatting from the input view.
*
* @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
*/
export declare const cleanListItem: GetCallback;
/**
* Returns a callback for model position to view position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
* positions between the `listItem` elements that would be incorrectly mapped because of how list items are represented in the model
* and in the view.
*/
export declare function modelToViewPosition(view: View): GetCallback;
/**
* The callback for view position to model position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
* positions between the `
- ` elements that would be incorrectly mapped because of how list items are represented in the model
* and in the view.
*
* @see module:engine/conversion/mapper~Mapper#event:viewToModelPosition
* @param model Model instance.
* @returns Returns a conversion callback.
*/
export declare function viewToModelPosition(model: Model): GetCallback;
/**
* Post-fixer that reacts to changes on document and fixes incorrect model states.
*
* In the example below, there is a correct list structure.
* Then the middle element is removed so the list structure will become incorrect:
*
* ```xml
* Item 1
* Item 2 <--- this is removed.
* Item 3
* ```
*
* The list structure after the middle element is removed:
*
* ```xml
* Item 1
* Item 3
* ```
*
* Should become:
*
* ```xml
* Item 1
* Item 3 <--- note that indent got post-fixed.
* ```
*
* @param model The data model.
* @param writer The writer to do changes with.
* @returns `true` if any change has been applied, `false` otherwise.
*/
export declare function modelChangePostFixer(model: Model, writer: Writer): boolean;
/**
* A fixer for pasted content that includes list items.
*
* It fixes indentation of pasted list items so the pasted items match correctly to the context they are pasted into.
*
* Example:
*
* ```xml
* A
* B^
* // At ^ paste: X
* // Y
* C
* ```
*
* Should become:
*
* ```xml
* A
* BX
* Y/listItem>
* C
* ```
*/
export declare const modelIndentPasteFixer: GetCallback;