@ckeditor/ckeditor5-list 38.1.0 → 38.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.
Files changed (95) hide show
  1. package/build/list.js +1 -1
  2. package/build/list.js.map +1 -0
  3. package/package.json +3 -3
  4. package/src/augmentation.d.ts +50 -50
  5. package/src/augmentation.js +5 -5
  6. package/src/documentlist/adjacentlistssupport.d.ts +15 -15
  7. package/src/documentlist/adjacentlistssupport.js +81 -81
  8. package/src/documentlist/converters.d.ts +63 -63
  9. package/src/documentlist/converters.js +354 -354
  10. package/src/documentlist/documentlistcommand.d.ts +80 -80
  11. package/src/documentlist/documentlistcommand.js +145 -145
  12. package/src/documentlist/documentlistediting.d.ts +154 -154
  13. package/src/documentlist/documentlistediting.js +565 -565
  14. package/src/documentlist/documentlistindentcommand.d.ts +62 -62
  15. package/src/documentlist/documentlistindentcommand.js +129 -129
  16. package/src/documentlist/documentlistmergecommand.d.ts +76 -76
  17. package/src/documentlist/documentlistmergecommand.js +174 -174
  18. package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
  19. package/src/documentlist/documentlistsplitcommand.js +70 -70
  20. package/src/documentlist/documentlistutils.d.ts +46 -46
  21. package/src/documentlist/documentlistutils.js +50 -50
  22. package/src/documentlist/utils/listwalker.d.ts +141 -141
  23. package/src/documentlist/utils/listwalker.js +162 -162
  24. package/src/documentlist/utils/model.d.ts +193 -193
  25. package/src/documentlist/utils/model.js +435 -435
  26. package/src/documentlist/utils/postfixers.d.ts +37 -37
  27. package/src/documentlist/utils/postfixers.js +118 -118
  28. package/src/documentlist/utils/view.d.ts +81 -81
  29. package/src/documentlist/utils/view.js +117 -117
  30. package/src/documentlist.d.ts +26 -26
  31. package/src/documentlist.js +30 -30
  32. package/src/documentlistproperties/converters.d.ts +19 -19
  33. package/src/documentlistproperties/converters.js +43 -43
  34. package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
  35. package/src/documentlistproperties/documentlistpropertiesediting.js +289 -289
  36. package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
  37. package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
  38. package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
  39. package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
  40. package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
  41. package/src/documentlistproperties/documentliststartcommand.js +57 -57
  42. package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
  43. package/src/documentlistproperties/documentliststylecommand.js +113 -113
  44. package/src/documentlistproperties/utils/style.d.ts +20 -20
  45. package/src/documentlistproperties/utils/style.js +54 -54
  46. package/src/documentlistproperties.d.ts +27 -27
  47. package/src/documentlistproperties.js +31 -31
  48. package/src/index.d.ts +40 -40
  49. package/src/index.js +27 -27
  50. package/src/list/converters.d.ts +196 -196
  51. package/src/list/converters.js +905 -905
  52. package/src/list/indentcommand.d.ts +37 -37
  53. package/src/list/indentcommand.js +107 -107
  54. package/src/list/listcommand.d.ts +55 -55
  55. package/src/list/listcommand.js +274 -274
  56. package/src/list/listediting.d.ts +32 -32
  57. package/src/list/listediting.js +161 -161
  58. package/src/list/listui.d.ts +19 -19
  59. package/src/list/listui.js +32 -32
  60. package/src/list/listutils.d.ts +41 -41
  61. package/src/list/listutils.js +46 -46
  62. package/src/list/utils.d.ts +112 -112
  63. package/src/list/utils.js +374 -374
  64. package/src/list.d.ts +26 -26
  65. package/src/list.js +30 -30
  66. package/src/listconfig.d.ts +122 -122
  67. package/src/listconfig.js +5 -5
  68. package/src/listproperties/listpropertiesediting.d.ts +72 -72
  69. package/src/listproperties/listpropertiesediting.js +696 -696
  70. package/src/listproperties/listpropertiesui.d.ts +23 -23
  71. package/src/listproperties/listpropertiesui.js +277 -277
  72. package/src/listproperties/listreversedcommand.d.ts +38 -38
  73. package/src/listproperties/listreversedcommand.js +52 -52
  74. package/src/listproperties/liststartcommand.d.ts +37 -37
  75. package/src/listproperties/liststartcommand.js +51 -51
  76. package/src/listproperties/liststylecommand.d.ts +67 -67
  77. package/src/listproperties/liststylecommand.js +99 -99
  78. package/src/listproperties/ui/collapsibleview.d.ts +63 -63
  79. package/src/listproperties/ui/collapsibleview.js +89 -89
  80. package/src/listproperties/ui/listpropertiesview.d.ts +157 -157
  81. package/src/listproperties/ui/listpropertiesview.js +299 -299
  82. package/src/listproperties.d.ts +26 -26
  83. package/src/listproperties.js +30 -30
  84. package/src/liststyle.d.ts +28 -28
  85. package/src/liststyle.js +36 -36
  86. package/src/todolist/checktodolistcommand.d.ts +52 -52
  87. package/src/todolist/checktodolistcommand.js +76 -76
  88. package/src/todolist/todolistconverters.d.ts +82 -82
  89. package/src/todolist/todolistconverters.js +260 -260
  90. package/src/todolist/todolistediting.d.ts +39 -39
  91. package/src/todolist/todolistediting.js +161 -161
  92. package/src/todolist/todolistui.d.ts +19 -19
  93. package/src/todolist/todolistui.js +29 -29
  94. package/src/todolist.d.ts +27 -27
  95. package/src/todolist.js +31 -31
@@ -1,193 +1,193 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module list/documentlist/utils/model
7
- */
8
- import type { DocumentFragment, Element, Model, Node, Writer, Item } from 'ckeditor5/src/engine';
9
- import { type ArrayOrItem } from 'ckeditor5/src/utils';
10
- /**
11
- * The list item ID generator.
12
- *
13
- * @internal
14
- */
15
- export declare class ListItemUid {
16
- /**
17
- * Returns the next ID.
18
- *
19
- * @internal
20
- */
21
- static next(): string;
22
- }
23
- /**
24
- * An {@link module:engine/model/element~Element} that is known to be a list element.
25
- *
26
- * @internal
27
- */
28
- export interface ListElement extends Element {
29
- getAttribute(key: 'listItemId'): string;
30
- getAttribute(key: 'listIndent'): number;
31
- getAttribute(key: 'listType'): 'numbered' | 'bulleted';
32
- getAttribute(key: string): unknown;
33
- }
34
- /**
35
- * Returns true if the given model node is a list item block.
36
- *
37
- * @internal
38
- */
39
- export declare function isListItemBlock(node: Item | DocumentFragment | null): node is ListElement;
40
- /**
41
- * Returns an array with all elements that represents the same list item.
42
- *
43
- * It means that values for `listIndent`, and `listItemId` for all items are equal.
44
- *
45
- * @internal
46
- * @param listItem Starting list item element.
47
- * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
48
- * in the result.
49
- */
50
- export declare function getAllListItemBlocks(listItem: Node, options?: {
51
- higherIndent?: boolean;
52
- }): Array<ListElement>;
53
- /**
54
- * Returns an array with elements that represents the same list item in the specified direction.
55
- *
56
- * It means that values for `listIndent` and `listItemId` for all items are equal.
57
- *
58
- * **Note**: For backward search the provided item is not included, but for forward search it is included in the result.
59
- *
60
- * @internal
61
- * @param listItem Starting list item element.
62
- * @param options.direction Walking direction.
63
- * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included in the result.
64
- */
65
- export declare function getListItemBlocks(listItem: Node, options?: {
66
- direction?: 'forward' | 'backward';
67
- higherIndent?: boolean;
68
- }): Array<ListElement>;
69
- /**
70
- * Returns a list items nested inside the given list item.
71
- *
72
- * @internal
73
- */
74
- export declare function getNestedListBlocks(listItem: Element): Array<ListElement>;
75
- /**
76
- * Returns array of all blocks/items of the same list as given block (same indent, same type and properties).
77
- *
78
- * @internal
79
- * @param listItem Starting list item element.
80
- */
81
- export declare function getListItems(listItem: Element): Array<ListElement>;
82
- /**
83
- * Check if the given block is the first in the list item.
84
- *
85
- * @internal
86
- * @param listBlock The list block element.
87
- */
88
- export declare function isFirstBlockOfListItem(listBlock: Node): boolean;
89
- /**
90
- * Check if the given block is the last in the list item.
91
- *
92
- * @internal
93
- */
94
- export declare function isLastBlockOfListItem(listBlock: Element): boolean;
95
- /**
96
- * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
97
- *
98
- * @internal
99
- * @param blocks The list of selected blocks.
100
- * @param options.withNested Whether should include nested list items.
101
- */
102
- export declare function expandListBlocksToCompleteItems(blocks: ArrayOrItem<Element>, options?: {
103
- withNested?: boolean;
104
- }): Array<ListElement>;
105
- /**
106
- * Expands the given list of selected blocks to include all the items of the lists they're in.
107
- *
108
- * @internal
109
- * @param blocks The list of selected blocks.
110
- */
111
- export declare function expandListBlocksToCompleteList(blocks: ArrayOrItem<Element>): Array<ListElement>;
112
- /**
113
- * Splits the list item just before the provided list block.
114
- *
115
- * @internal
116
- * @param listBlock The list block element.
117
- * @param writer The model writer.
118
- * @returns The array of updated blocks.
119
- */
120
- export declare function splitListItemBefore(listBlock: Element, writer: Writer): Array<ListElement>;
121
- /**
122
- * Merges the list item with the parent list item.
123
- *
124
- * @internal
125
- * @param listBlock The list block element.
126
- * @param parentBlock The list block element to merge with.
127
- * @param writer The model writer.
128
- * @returns The array of updated blocks.
129
- */
130
- export declare function mergeListItemBefore(listBlock: Node, parentBlock: Element, writer: Writer): Array<ListElement>;
131
- /**
132
- * Increases indentation of given list blocks.
133
- *
134
- * @internal
135
- * @param blocks The block or iterable of blocks.
136
- * @param writer The model writer.
137
- * @param options.expand Whether should expand the list of blocks to include complete list items.
138
- * @param options.indentBy The number of levels the indentation should change (could be negative).
139
- */
140
- export declare function indentBlocks(blocks: ArrayOrItem<ListElement>, writer: Writer, { expand, indentBy }?: {
141
- expand?: boolean;
142
- indentBy?: number;
143
- }): Array<ListElement>;
144
- /**
145
- * Decreases indentation of given list of blocks. If the indentation of some blocks matches the indentation
146
- * of surrounding blocks, they get merged together.
147
- *
148
- * @internal
149
- * @param blocks The block or iterable of blocks.
150
- * @param writer The model writer.
151
- */
152
- export declare function outdentBlocksWithMerge(blocks: ArrayOrItem<ListElement>, writer: Writer): Array<ListElement>;
153
- /**
154
- * Removes all list attributes from the given blocks.
155
- *
156
- * @internal
157
- * @param blocks The block or iterable of blocks.
158
- * @param writer The model writer.
159
- * @returns Array of altered blocks.
160
- */
161
- export declare function removeListAttributes(blocks: ArrayOrItem<Element>, writer: Writer): Array<Element>;
162
- /**
163
- * Checks whether the given blocks are related to a single list item.
164
- *
165
- * @internal
166
- * @param blocks The list block elements.
167
- */
168
- export declare function isSingleListItem(blocks: Array<Node>): boolean;
169
- /**
170
- * Modifies the indents of list blocks following the given list block so the indentation is valid after
171
- * the given block is no longer a list item.
172
- *
173
- * @internal
174
- * @param lastBlock The last list block that has become a non-list element.
175
- * @param writer The model writer.
176
- * @returns Array of altered blocks.
177
- */
178
- export declare function outdentFollowingItems(lastBlock: Element, writer: Writer): Array<ListElement>;
179
- /**
180
- * Returns the array of given blocks sorted by model indexes (document order).
181
- *
182
- * @internal
183
- */
184
- export declare function sortBlocks<T extends Element>(blocks: Iterable<T>): Array<T>;
185
- /**
186
- * Returns a selected block object. If a selected object is inline or when there is no selected
187
- * object, `null` is returned.
188
- *
189
- * @internal
190
- * @param model The instance of editor model.
191
- * @returns Selected block object or `null`.
192
- */
193
- export declare function getSelectedBlockObject(model: Model): Element | null;
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/documentlist/utils/model
7
+ */
8
+ import type { DocumentFragment, Element, Model, Node, Writer, Item } from 'ckeditor5/src/engine';
9
+ import { type ArrayOrItem } from 'ckeditor5/src/utils';
10
+ /**
11
+ * The list item ID generator.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare class ListItemUid {
16
+ /**
17
+ * Returns the next ID.
18
+ *
19
+ * @internal
20
+ */
21
+ static next(): string;
22
+ }
23
+ /**
24
+ * An {@link module:engine/model/element~Element} that is known to be a list element.
25
+ *
26
+ * @internal
27
+ */
28
+ export interface ListElement extends Element {
29
+ getAttribute(key: 'listItemId'): string;
30
+ getAttribute(key: 'listIndent'): number;
31
+ getAttribute(key: 'listType'): 'numbered' | 'bulleted';
32
+ getAttribute(key: string): unknown;
33
+ }
34
+ /**
35
+ * Returns true if the given model node is a list item block.
36
+ *
37
+ * @internal
38
+ */
39
+ export declare function isListItemBlock(node: Item | DocumentFragment | null): node is ListElement;
40
+ /**
41
+ * Returns an array with all elements that represents the same list item.
42
+ *
43
+ * It means that values for `listIndent`, and `listItemId` for all items are equal.
44
+ *
45
+ * @internal
46
+ * @param listItem Starting list item element.
47
+ * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
48
+ * in the result.
49
+ */
50
+ export declare function getAllListItemBlocks(listItem: Node, options?: {
51
+ higherIndent?: boolean;
52
+ }): Array<ListElement>;
53
+ /**
54
+ * Returns an array with elements that represents the same list item in the specified direction.
55
+ *
56
+ * It means that values for `listIndent` and `listItemId` for all items are equal.
57
+ *
58
+ * **Note**: For backward search the provided item is not included, but for forward search it is included in the result.
59
+ *
60
+ * @internal
61
+ * @param listItem Starting list item element.
62
+ * @param options.direction Walking direction.
63
+ * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included in the result.
64
+ */
65
+ export declare function getListItemBlocks(listItem: Node, options?: {
66
+ direction?: 'forward' | 'backward';
67
+ higherIndent?: boolean;
68
+ }): Array<ListElement>;
69
+ /**
70
+ * Returns a list items nested inside the given list item.
71
+ *
72
+ * @internal
73
+ */
74
+ export declare function getNestedListBlocks(listItem: Element): Array<ListElement>;
75
+ /**
76
+ * Returns array of all blocks/items of the same list as given block (same indent, same type and properties).
77
+ *
78
+ * @internal
79
+ * @param listItem Starting list item element.
80
+ */
81
+ export declare function getListItems(listItem: Element): Array<ListElement>;
82
+ /**
83
+ * Check if the given block is the first in the list item.
84
+ *
85
+ * @internal
86
+ * @param listBlock The list block element.
87
+ */
88
+ export declare function isFirstBlockOfListItem(listBlock: Node): boolean;
89
+ /**
90
+ * Check if the given block is the last in the list item.
91
+ *
92
+ * @internal
93
+ */
94
+ export declare function isLastBlockOfListItem(listBlock: Element): boolean;
95
+ /**
96
+ * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
97
+ *
98
+ * @internal
99
+ * @param blocks The list of selected blocks.
100
+ * @param options.withNested Whether should include nested list items.
101
+ */
102
+ export declare function expandListBlocksToCompleteItems(blocks: ArrayOrItem<Element>, options?: {
103
+ withNested?: boolean;
104
+ }): Array<ListElement>;
105
+ /**
106
+ * Expands the given list of selected blocks to include all the items of the lists they're in.
107
+ *
108
+ * @internal
109
+ * @param blocks The list of selected blocks.
110
+ */
111
+ export declare function expandListBlocksToCompleteList(blocks: ArrayOrItem<Element>): Array<ListElement>;
112
+ /**
113
+ * Splits the list item just before the provided list block.
114
+ *
115
+ * @internal
116
+ * @param listBlock The list block element.
117
+ * @param writer The model writer.
118
+ * @returns The array of updated blocks.
119
+ */
120
+ export declare function splitListItemBefore(listBlock: Element, writer: Writer): Array<ListElement>;
121
+ /**
122
+ * Merges the list item with the parent list item.
123
+ *
124
+ * @internal
125
+ * @param listBlock The list block element.
126
+ * @param parentBlock The list block element to merge with.
127
+ * @param writer The model writer.
128
+ * @returns The array of updated blocks.
129
+ */
130
+ export declare function mergeListItemBefore(listBlock: Node, parentBlock: Element, writer: Writer): Array<ListElement>;
131
+ /**
132
+ * Increases indentation of given list blocks.
133
+ *
134
+ * @internal
135
+ * @param blocks The block or iterable of blocks.
136
+ * @param writer The model writer.
137
+ * @param options.expand Whether should expand the list of blocks to include complete list items.
138
+ * @param options.indentBy The number of levels the indentation should change (could be negative).
139
+ */
140
+ export declare function indentBlocks(blocks: ArrayOrItem<ListElement>, writer: Writer, { expand, indentBy }?: {
141
+ expand?: boolean;
142
+ indentBy?: number;
143
+ }): Array<ListElement>;
144
+ /**
145
+ * Decreases indentation of given list of blocks. If the indentation of some blocks matches the indentation
146
+ * of surrounding blocks, they get merged together.
147
+ *
148
+ * @internal
149
+ * @param blocks The block or iterable of blocks.
150
+ * @param writer The model writer.
151
+ */
152
+ export declare function outdentBlocksWithMerge(blocks: ArrayOrItem<ListElement>, writer: Writer): Array<ListElement>;
153
+ /**
154
+ * Removes all list attributes from the given blocks.
155
+ *
156
+ * @internal
157
+ * @param blocks The block or iterable of blocks.
158
+ * @param writer The model writer.
159
+ * @returns Array of altered blocks.
160
+ */
161
+ export declare function removeListAttributes(blocks: ArrayOrItem<Element>, writer: Writer): Array<Element>;
162
+ /**
163
+ * Checks whether the given blocks are related to a single list item.
164
+ *
165
+ * @internal
166
+ * @param blocks The list block elements.
167
+ */
168
+ export declare function isSingleListItem(blocks: Array<Node>): boolean;
169
+ /**
170
+ * Modifies the indents of list blocks following the given list block so the indentation is valid after
171
+ * the given block is no longer a list item.
172
+ *
173
+ * @internal
174
+ * @param lastBlock The last list block that has become a non-list element.
175
+ * @param writer The model writer.
176
+ * @returns Array of altered blocks.
177
+ */
178
+ export declare function outdentFollowingItems(lastBlock: Element, writer: Writer): Array<ListElement>;
179
+ /**
180
+ * Returns the array of given blocks sorted by model indexes (document order).
181
+ *
182
+ * @internal
183
+ */
184
+ export declare function sortBlocks<T extends Element>(blocks: Iterable<T>): Array<T>;
185
+ /**
186
+ * Returns a selected block object. If a selected object is inline or when there is no selected
187
+ * object, `null` is returned.
188
+ *
189
+ * @internal
190
+ * @param model The instance of editor model.
191
+ * @returns Selected block object or `null`.
192
+ */
193
+ export declare function getSelectedBlockObject(model: Model): Element | null;