@ckeditor/ckeditor5-engine 41.3.0-alpha.3 → 41.3.0

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 (132) hide show
  1. package/package.json +2 -3
  2. package/src/model/node.d.ts +1 -0
  3. package/src/model/node.js +2 -0
  4. package/src/model/position.d.ts +1 -0
  5. package/src/model/position.js +2 -0
  6. package/src/view/node.d.ts +1 -0
  7. package/src/view/node.js +2 -0
  8. package/src/view/position.d.ts +1 -0
  9. package/src/view/position.js +2 -0
  10. package/dist/content-index.css +0 -4
  11. package/dist/editor-index.css +0 -23
  12. package/dist/index.css +0 -49
  13. package/dist/index.css.map +0 -1
  14. package/dist/types/controller/datacontroller.d.ts +0 -339
  15. package/dist/types/controller/editingcontroller.d.ts +0 -102
  16. package/dist/types/conversion/conversion.d.ts +0 -482
  17. package/dist/types/conversion/conversionhelpers.d.ts +0 -30
  18. package/dist/types/conversion/downcastdispatcher.d.ts +0 -566
  19. package/dist/types/conversion/downcasthelpers.d.ts +0 -1194
  20. package/dist/types/conversion/mapper.d.ts +0 -507
  21. package/dist/types/conversion/modelconsumable.d.ts +0 -205
  22. package/dist/types/conversion/upcastdispatcher.d.ts +0 -496
  23. package/dist/types/conversion/upcasthelpers.d.ts +0 -503
  24. package/dist/types/conversion/viewconsumable.d.ts +0 -373
  25. package/dist/types/dataprocessor/basichtmlwriter.d.ts +0 -22
  26. package/dist/types/dataprocessor/dataprocessor.d.ts +0 -65
  27. package/dist/types/dataprocessor/htmldataprocessor.d.ts +0 -80
  28. package/dist/types/dataprocessor/htmlwriter.d.ts +0 -20
  29. package/dist/types/dataprocessor/xmldataprocessor.d.ts +0 -94
  30. package/dist/types/dev-utils/model.d.ts +0 -128
  31. package/dist/types/dev-utils/operationreplayer.d.ts +0 -55
  32. package/dist/types/dev-utils/utils.d.ts +0 -41
  33. package/dist/types/dev-utils/view.d.ts +0 -323
  34. package/dist/types/index.d.ts +0 -117
  35. package/dist/types/model/batch.d.ts +0 -110
  36. package/dist/types/model/differ.d.ts +0 -419
  37. package/dist/types/model/document.d.ts +0 -278
  38. package/dist/types/model/documentfragment.d.ts +0 -204
  39. package/dist/types/model/documentselection.d.ts +0 -424
  40. package/dist/types/model/element.d.ts +0 -169
  41. package/dist/types/model/history.d.ts +0 -118
  42. package/dist/types/model/item.d.ts +0 -18
  43. package/dist/types/model/liveposition.d.ts +0 -81
  44. package/dist/types/model/liverange.d.ts +0 -106
  45. package/dist/types/model/markercollection.d.ts +0 -339
  46. package/dist/types/model/model.d.ts +0 -923
  47. package/dist/types/model/node.d.ts +0 -259
  48. package/dist/types/model/nodelist.d.ts +0 -95
  49. package/dist/types/model/operation/attributeoperation.d.ts +0 -107
  50. package/dist/types/model/operation/detachoperation.d.ts +0 -64
  51. package/dist/types/model/operation/insertoperation.d.ts +0 -94
  52. package/dist/types/model/operation/markeroperation.d.ts +0 -95
  53. package/dist/types/model/operation/mergeoperation.d.ts +0 -104
  54. package/dist/types/model/operation/moveoperation.d.ts +0 -100
  55. package/dist/types/model/operation/nooperation.d.ts +0 -42
  56. package/dist/types/model/operation/operation.d.ts +0 -100
  57. package/dist/types/model/operation/operationfactory.d.ts +0 -22
  58. package/dist/types/model/operation/renameoperation.d.ts +0 -87
  59. package/dist/types/model/operation/rootattributeoperation.d.ts +0 -102
  60. package/dist/types/model/operation/rootoperation.d.ts +0 -80
  61. package/dist/types/model/operation/splitoperation.d.ts +0 -113
  62. package/dist/types/model/operation/transform.d.ts +0 -104
  63. package/dist/types/model/operation/utils.d.ts +0 -75
  64. package/dist/types/model/position.d.ts +0 -542
  65. package/dist/types/model/range.d.ts +0 -462
  66. package/dist/types/model/rootelement.d.ts +0 -64
  67. package/dist/types/model/schema.d.ts +0 -1210
  68. package/dist/types/model/selection.d.ts +0 -486
  69. package/dist/types/model/text.d.ts +0 -70
  70. package/dist/types/model/textproxy.d.ts +0 -148
  71. package/dist/types/model/treewalker.d.ts +0 -190
  72. package/dist/types/model/typecheckable.d.ts +0 -289
  73. package/dist/types/model/utils/autoparagraphing.d.ts +0 -41
  74. package/dist/types/model/utils/deletecontent.d.ts +0 -62
  75. package/dist/types/model/utils/getselectedcontent.d.ts +0 -34
  76. package/dist/types/model/utils/insertcontent.d.ts +0 -50
  77. package/dist/types/model/utils/insertobject.d.ts +0 -51
  78. package/dist/types/model/utils/modifyselection.d.ts +0 -52
  79. package/dist/types/model/utils/selection-post-fixer.d.ts +0 -78
  80. package/dist/types/model/writer.d.ts +0 -855
  81. package/dist/types/view/attributeelement.d.ts +0 -112
  82. package/dist/types/view/containerelement.d.ts +0 -53
  83. package/dist/types/view/datatransfer.d.ts +0 -83
  84. package/dist/types/view/document.d.ts +0 -188
  85. package/dist/types/view/documentfragment.d.ts +0 -157
  86. package/dist/types/view/documentselection.d.ts +0 -310
  87. package/dist/types/view/domconverter.d.ts +0 -656
  88. package/dist/types/view/downcastwriter.d.ts +0 -1000
  89. package/dist/types/view/editableelement.d.ts +0 -66
  90. package/dist/types/view/element.d.ts +0 -472
  91. package/dist/types/view/elementdefinition.d.ts +0 -91
  92. package/dist/types/view/emptyelement.d.ts +0 -45
  93. package/dist/types/view/filler.d.ts +0 -115
  94. package/dist/types/view/item.d.ts +0 -18
  95. package/dist/types/view/matcher.d.ts +0 -490
  96. package/dist/types/view/node.d.ts +0 -166
  97. package/dist/types/view/observer/arrowkeysobserver.d.ts +0 -49
  98. package/dist/types/view/observer/bubblingemittermixin.d.ts +0 -170
  99. package/dist/types/view/observer/bubblingeventinfo.d.ts +0 -51
  100. package/dist/types/view/observer/clickobserver.d.ts +0 -47
  101. package/dist/types/view/observer/compositionobserver.d.ts +0 -86
  102. package/dist/types/view/observer/domeventdata.d.ts +0 -54
  103. package/dist/types/view/observer/domeventobserver.d.ts +0 -77
  104. package/dist/types/view/observer/fakeselectionobserver.d.ts +0 -51
  105. package/dist/types/view/observer/focusobserver.d.ts +0 -86
  106. package/dist/types/view/observer/inputobserver.d.ts +0 -90
  107. package/dist/types/view/observer/keyobserver.d.ts +0 -70
  108. package/dist/types/view/observer/mouseobserver.d.ts +0 -93
  109. package/dist/types/view/observer/mutationobserver.d.ts +0 -90
  110. package/dist/types/view/observer/observer.d.ts +0 -93
  111. package/dist/types/view/observer/selectionobserver.d.ts +0 -152
  112. package/dist/types/view/observer/tabobserver.d.ts +0 -50
  113. package/dist/types/view/placeholder.d.ts +0 -100
  114. package/dist/types/view/position.d.ts +0 -192
  115. package/dist/types/view/range.d.ts +0 -283
  116. package/dist/types/view/rawelement.d.ts +0 -77
  117. package/dist/types/view/renderer.d.ts +0 -269
  118. package/dist/types/view/rooteditableelement.d.ts +0 -45
  119. package/dist/types/view/selection.d.ts +0 -379
  120. package/dist/types/view/styles/background.d.ts +0 -37
  121. package/dist/types/view/styles/border.d.ts +0 -47
  122. package/dist/types/view/styles/margin.d.ts +0 -33
  123. package/dist/types/view/styles/padding.d.ts +0 -33
  124. package/dist/types/view/styles/utils.d.ts +0 -97
  125. package/dist/types/view/stylesmap.d.ts +0 -677
  126. package/dist/types/view/text.d.ts +0 -78
  127. package/dist/types/view/textproxy.d.ts +0 -101
  128. package/dist/types/view/treewalker.d.ts +0 -199
  129. package/dist/types/view/typecheckable.d.ts +0 -452
  130. package/dist/types/view/uielement.d.ts +0 -100
  131. package/dist/types/view/upcastwriter.d.ts +0 -421
  132. package/dist/types/view/view.d.ts +0 -491
@@ -1,379 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/selection
11
- */
12
- import TypeCheckable from './typecheckable.js';
13
- import Range from './range.js';
14
- import Position, { type PositionOffset } from './position.js';
15
- import Node from './node.js';
16
- import DocumentSelection from './documentselection.js';
17
- import type Element from './element.js';
18
- import type Item from './item.js';
19
- import type EditableElement from './editableelement.js';
20
- declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
21
- /**
22
- * Class representing an arbirtary selection in the view.
23
- * See also {@link module:engine/view/documentselection~DocumentSelection}.
24
- *
25
- * New selection instances can be created via the constructor or one these methods:
26
- *
27
- * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
28
- * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
29
- *
30
- * A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
31
- * the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
32
- */
33
- export default class Selection extends Selection_base {
34
- /**
35
- * Stores all ranges that are selected.
36
- */
37
- private _ranges;
38
- /**
39
- * Specifies whether the last added range was added as a backward or forward range.
40
- */
41
- private _lastRangeBackward;
42
- /**
43
- * Specifies whether selection instance is fake.
44
- */
45
- private _isFake;
46
- /**
47
- * Fake selection's label.
48
- */
49
- private _fakeSelectionLabel;
50
- /**
51
- * Creates new selection instance.
52
- *
53
- * **Note**: The selection constructor is available as a factory method:
54
- *
55
- * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
56
- * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
57
- *
58
- * ```ts
59
- * // Creates empty selection without ranges.
60
- * const selection = writer.createSelection();
61
- *
62
- * // Creates selection at the given range.
63
- * const range = writer.createRange( start, end );
64
- * const selection = writer.createSelection( range );
65
- *
66
- * // Creates selection at the given ranges
67
- * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];
68
- * const selection = writer.createSelection( ranges );
69
- *
70
- * // Creates selection from the other selection.
71
- * const otherSelection = writer.createSelection();
72
- * const selection = writer.createSelection( otherSelection );
73
- *
74
- * // Creates selection from the document selection.
75
- * const selection = writer.createSelection( editor.editing.view.document.selection );
76
- *
77
- * // Creates selection at the given position.
78
- * const position = writer.createPositionFromPath( root, path );
79
- * const selection = writer.createSelection( position );
80
- *
81
- * // Creates collapsed selection at the position of given item and offset.
82
- * const paragraph = writer.createContainerElement( 'paragraph' );
83
- * const selection = writer.createSelection( paragraph, offset );
84
- *
85
- * // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
86
- * // first child of that element and ends after the last child of that element.
87
- * const selection = writer.createSelection( paragraph, 'in' );
88
- *
89
- * // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
90
- * // just after the item.
91
- * const selection = writer.createSelection( paragraph, 'on' );
92
- * ```
93
- *
94
- * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.
95
- *
96
- * ```ts
97
- * // Creates backward selection.
98
- * const selection = writer.createSelection( range, { backward: true } );
99
- * ```
100
- *
101
- * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
102
- * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
103
- * represented in other way, for example by applying proper CSS class.
104
- *
105
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
106
- * (and be properly handled by screen readers).
107
- *
108
- * ```ts
109
- * // Creates fake selection with label.
110
- * const selection = writer.createSelection( range, { fake: true, label: 'foo' } );
111
- * ```
112
- *
113
- * @internal
114
- */
115
- constructor(...args: [] | [
116
- selectable: Node,
117
- placeOrOffset: PlaceOrOffset,
118
- options?: SelectionOptions
119
- ] | [
120
- selectable?: Exclude<Selectable, Node>,
121
- options?: SelectionOptions
122
- ]);
123
- /**
124
- * Returns true if selection instance is marked as `fake`.
125
- *
126
- * @see #setTo
127
- */
128
- get isFake(): boolean;
129
- /**
130
- * Returns fake selection label.
131
- *
132
- * @see #setTo
133
- */
134
- get fakeSelectionLabel(): string;
135
- /**
136
- * Selection anchor. Anchor may be described as a position where the selection starts. Together with
137
- * {@link #focus focus} they define the direction of selection, which is important
138
- * when expanding/shrinking selection. Anchor is always the start or end of the most recent added range.
139
- * It may be a bit unintuitive when there are multiple ranges in selection.
140
- *
141
- * @see #focus
142
- */
143
- get anchor(): Position | null;
144
- /**
145
- * Selection focus. Focus is a position where the selection ends.
146
- *
147
- * @see #anchor
148
- */
149
- get focus(): Position | null;
150
- /**
151
- * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is
152
- * collapsed.
153
- */
154
- get isCollapsed(): boolean;
155
- /**
156
- * Returns number of ranges in selection.
157
- */
158
- get rangeCount(): number;
159
- /**
160
- * Specifies whether the {@link #focus} precedes {@link #anchor}.
161
- */
162
- get isBackward(): boolean;
163
- /**
164
- * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`
165
- * if the selection is not inside an editable element.
166
- */
167
- get editableElement(): EditableElement | null;
168
- /**
169
- * Returns an iterable that contains copies of all ranges added to the selection.
170
- */
171
- getRanges(): IterableIterator<Range>;
172
- /**
173
- * Returns copy of the first range in the selection. First range is the one which
174
- * {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start
175
- * position of all other ranges (not to confuse with the first range added to the selection).
176
- * Returns `null` if no ranges are added to selection.
177
- */
178
- getFirstRange(): Range | null;
179
- /**
180
- * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}
181
- * position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse
182
- * with the last range added to the selection). Returns `null` if no ranges are added to selection.
183
- */
184
- getLastRange(): Range | null;
185
- /**
186
- * Returns copy of the first position in the selection. First position is the position that
187
- * {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.
188
- * Returns `null` if no ranges are added to selection.
189
- */
190
- getFirstPosition(): Position | null;
191
- /**
192
- * Returns copy of the last position in the selection. Last position is the position that
193
- * {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.
194
- * Returns `null` if no ranges are added to selection.
195
- */
196
- getLastPosition(): Position | null;
197
- /**
198
- * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,
199
- * same number of ranges and all ranges from one selection equal to a range from other selection.
200
- *
201
- * @param otherSelection Selection to compare with.
202
- * @returns `true` if selections are equal, `false` otherwise.
203
- */
204
- isEqual(otherSelection: Selection | DocumentSelection): boolean;
205
- /**
206
- * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same
207
- * number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are
208
- * equal to any trimmed range from other selection.
209
- *
210
- * @param otherSelection Selection to compare with.
211
- * @returns `true` if selections are similar, `false` otherwise.
212
- */
213
- isSimilar(otherSelection: Selection | DocumentSelection): boolean;
214
- /**
215
- * Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only
216
- * one range in the selection, and that range contains exactly one element.
217
- * Returns `null` if there is no selected element.
218
- */
219
- getSelectedElement(): Element | null;
220
- /**
221
- * Sets this selection's ranges and direction to the specified location based on the given
222
- * {@link module:engine/view/selection~Selectable selectable}.
223
- *
224
- * ```ts
225
- * // Sets selection to the given range.
226
- * const range = writer.createRange( start, end );
227
- * selection.setTo( range );
228
- *
229
- * // Sets selection to given ranges.
230
- * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];
231
- * selection.setTo( range );
232
- *
233
- * // Sets selection to the other selection.
234
- * const otherSelection = writer.createSelection();
235
- * selection.setTo( otherSelection );
236
- *
237
- * // Sets selection to contents of DocumentSelection.
238
- * selection.setTo( editor.editing.view.document.selection );
239
- *
240
- * // Sets collapsed selection at the given position.
241
- * const position = writer.createPositionAt( root, path );
242
- * selection.setTo( position );
243
- *
244
- * // Sets collapsed selection at the position of given item and offset.
245
- * selection.setTo( paragraph, offset );
246
- * ```
247
- *
248
- * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
249
- * that element and ends after the last child of that element.
250
- *
251
- * ```ts
252
- * selection.setTo( paragraph, 'in' );
253
- * ```
254
- *
255
- * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.
256
- *
257
- * ```ts
258
- * selection.setTo( paragraph, 'on' );
259
- *
260
- * // Clears selection. Removes all ranges.
261
- * selection.setTo( null );
262
- * ```
263
- *
264
- * `Selection#setTo()` method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
265
- *
266
- * ```ts
267
- * // Sets selection as backward.
268
- * selection.setTo( range, { backward: true } );
269
- * ```
270
- *
271
- * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
272
- * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
273
- * represented in other way, for example by applying proper CSS class.
274
- *
275
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
276
- * (and be properly handled by screen readers).
277
- *
278
- * ```ts
279
- * // Creates fake selection with label.
280
- * selection.setTo( range, { fake: true, label: 'foo' } );
281
- * ```
282
- *
283
- * @fires change
284
- */
285
- setTo(...args: [
286
- selectable: Node,
287
- placeOrOffset: PlaceOrOffset,
288
- options?: SelectionOptions
289
- ] | [
290
- selectable?: Exclude<Selectable, Node>,
291
- options?: SelectionOptions
292
- ]): void;
293
- /**
294
- * Moves {@link #focus} to the specified location.
295
- *
296
- * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}
297
- * parameters.
298
- *
299
- * @fires change
300
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
301
- */
302
- setFocus(itemOrPosition: Item | Position, offset?: PositionOffset): void;
303
- /**
304
- * Replaces all ranges that were added to the selection with given array of ranges. Last range of the array
305
- * is treated like the last added range and is used to set {@link #anchor anchor} and {@link #focus focus}.
306
- * Accepts a flag describing in which way the selection is made.
307
- *
308
- * @param newRanges Iterable object of ranges to set.
309
- * @param isLastBackward Flag describing if last added range was selected forward - from start to end
310
- * (`false`) or backward - from end to start (`true`). Defaults to `false`.
311
- */
312
- private _setRanges;
313
- /**
314
- * Sets this selection instance to be marked as `fake`. A fake selection does not render as browser native selection
315
- * over selected elements and is hidden to the user. This way, no native selection UI artifacts are displayed to
316
- * the user and selection over elements can be represented in other way, for example by applying proper CSS class.
317
- *
318
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM (and be
319
- * properly handled by screen readers).
320
- */
321
- private _setFakeOptions;
322
- /**
323
- * Adds a range to the selection. Added range is copied. This means that passed range is not saved in the
324
- * selection instance and you can safely operate on it.
325
- *
326
- * Accepts a flag describing in which way the selection is made - passed range might be selected from
327
- * {@link module:engine/view/range~Range#start start} to {@link module:engine/view/range~Range#end end}
328
- * or from {@link module:engine/view/range~Range#end end} to {@link module:engine/view/range~Range#start start}.
329
- * The flag is used to set {@link #anchor anchor} and {@link #focus focus} properties.
330
- *
331
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
332
- * with ranges already stored in Selection instance.
333
- */
334
- private _addRange;
335
- /**
336
- * Adds range to selection - creates copy of given range so it can be safely used and modified.
337
- *
338
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
339
- * with ranges already stored in selection instance.
340
- */
341
- private _pushRange;
342
- }
343
- /**
344
- * Additional options for {@link ~Selection}.
345
- */
346
- export interface SelectionOptions {
347
- /**
348
- * Sets this selection instance to be backward.
349
- */
350
- backward?: boolean;
351
- /**
352
- * Sets this selection instance to be marked as `fake`.
353
- */
354
- fake?: boolean;
355
- /**
356
- * Label for the fake selection.
357
- */
358
- label?: string;
359
- }
360
- /**
361
- * The place or offset of the selection.
362
- */
363
- export type PlaceOrOffset = number | 'before' | 'end' | 'after' | 'on' | 'in';
364
- /**
365
- * Fired whenever selection ranges are changed through {@link ~Selection Selection API}.
366
- *
367
- * @eventName ~Selection#change
368
- */
369
- export type ViewSelectionChangeEvent = {
370
- name: 'change';
371
- args: [];
372
- };
373
- /**
374
- * An entity that is used to set selection.
375
- *
376
- * See also {@link module:engine/view/selection~Selection#setTo}
377
- */
378
- export type Selectable = Selection | DocumentSelection | Position | Iterable<Range> | Range | Node | null;
379
- export {};
@@ -1,37 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/styles/background
11
- */
12
- import type { StylesProcessor } from '../stylesmap.js';
13
- /**
14
- * Adds a background CSS styles processing rules.
15
- *
16
- * ```ts
17
- * editor.data.addStyleProcessorRules( addBackgroundRules );
18
- * ```
19
- *
20
- * The normalized value is stored as:
21
- *
22
- * ```ts
23
- * const styles = {
24
- * background: {
25
- * color,
26
- * repeat,
27
- * position,
28
- * attachment,
29
- * image
30
- * }
31
- * };
32
- * ````
33
- *
34
- * **Note**: Currently only `'background-color'` longhand value is parsed besides `'background'` shorthand. The reducer also supports only
35
- * `'background-color'` value.
36
- */
37
- export declare function addBackgroundRules(stylesProcessor: StylesProcessor): void;
@@ -1,47 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/styles/border
11
- */
12
- import type { StylesProcessor } from '../stylesmap.js';
13
- /**
14
- * Adds a border CSS styles processing rules.
15
- *
16
- * ```ts
17
- * editor.data.addStyleProcessorRules( addBorderRules );
18
- * ```
19
- *
20
- * This rules merges all [border](https://developer.mozilla.org/en-US/docs/Web/CSS/border) styles notation shorthands:
21
- *
22
- * - border
23
- * - border-top
24
- * - border-right
25
- * - border-bottom
26
- * - border-left
27
- * - border-color
28
- * - border-style
29
- * - border-width
30
- *
31
- * and all corresponding longhand forms (like `border-top-color`, `border-top-style`, etc).
32
- *
33
- * It does not handle other shorthands (like `border-radius` or `border-image`).
34
- *
35
- * The normalized model stores border values as:
36
- *
37
- * ```ts
38
- * const styles = {
39
- * border: {
40
- * color: { top, right, bottom, left },
41
- * style: { top, right, bottom, left },
42
- * width: { top, right, bottom, left },
43
- * }
44
- * };
45
- * ```
46
- */
47
- export declare function addBorderRules(stylesProcessor: StylesProcessor): void;
@@ -1,33 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/styles/margin
11
- */
12
- import type { StylesProcessor } from '../stylesmap.js';
13
- /**
14
- * Adds a margin CSS styles processing rules.
15
- *
16
- * ```ts
17
- * editor.data.addStyleProcessorRules( addMarginRules );
18
- * ```
19
- *
20
- * The normalized value is stored as:
21
- *
22
- * ```ts
23
- * const styles = {
24
- * margin: {
25
- * top,
26
- * right,
27
- * bottom,
28
- * left
29
- * }
30
- * };
31
- * ```
32
- */
33
- export declare function addMarginRules(stylesProcessor: StylesProcessor): void;
@@ -1,33 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/styles/padding
11
- */
12
- import type { StylesProcessor } from '../stylesmap.js';
13
- /**
14
- * Adds a padding CSS styles processing rules.
15
- *
16
- * ```ts
17
- * editor.data.addStyleProcessorRules( addPaddingRules );
18
- * ```
19
- *
20
- * The normalized value is stored as:
21
- *
22
- * ```ts
23
- * const styles = {
24
- * padding: {
25
- * top,
26
- * right,
27
- * bottom,
28
- * left
29
- * }
30
- * };
31
- * ```
32
- */
33
- export declare function addPaddingRules(stylesProcessor: StylesProcessor): void;
@@ -1,97 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/styles/utils
11
- */
12
- import type { BoxSides, PropertyDescriptor, StyleValue } from '../stylesmap.js';
13
- /**
14
- * Checks if string contains [color](https://developer.mozilla.org/en-US/docs/Web/CSS/color) CSS value.
15
- *
16
- * ```ts
17
- * isColor( '#f00' ); // true
18
- * isColor( '#AA00BB33' ); // true
19
- * isColor( 'rgb(0, 0, 250)' ); // true
20
- * isColor( 'hsla(240, 100%, 50%, .7)' ); // true
21
- * isColor( 'deepskyblue' ); // true
22
- * ```
23
- *
24
- * **Note**: It does not support CSS Level 4 whitespace syntax, system colors and radius values for HSL colors.
25
- */
26
- export declare function isColor(string: string): boolean;
27
- /**
28
- * Checks if string contains [line style](https://developer.mozilla.org/en-US/docs/Web/CSS/border-style) CSS value.
29
- */
30
- export declare function isLineStyle(string: string): boolean;
31
- /**
32
- * Checks if string contains [length](https://developer.mozilla.org/en-US/docs/Web/CSS/length) CSS value.
33
- */
34
- export declare function isLength(string: string): boolean;
35
- /**
36
- * Checks if string contains [percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/percentage) CSS value.
37
- */
38
- export declare function isPercentage(string: string): boolean;
39
- /**
40
- * Checks if string contains [background repeat](https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat) CSS value.
41
- */
42
- export declare function isRepeat(string: string): boolean;
43
- /**
44
- * Checks if string contains [background position](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position) CSS value.
45
- */
46
- export declare function isPosition(string: string): boolean;
47
- /**
48
- * Checks if string contains [background attachment](https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment) CSS value.
49
- */
50
- export declare function isAttachment(string: string): boolean;
51
- /**
52
- * Checks if string contains [URL](https://developer.mozilla.org/en-US/docs/Web/CSS/url) CSS value.
53
- */
54
- export declare function isURL(string: string): boolean;
55
- /**
56
- * Parses box sides as individual values.
57
- */
58
- export declare function getBoxSidesValues(value?: string): BoxSides;
59
- /**
60
- * Default reducer for CSS properties that concerns edges of a box
61
- * [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) notations:
62
- *
63
- * ```ts
64
- * stylesProcessor.setReducer( 'padding', getBoxSidesValueReducer( 'padding' ) );
65
- * ```
66
- */
67
- export declare function getBoxSidesValueReducer(styleShorthand: string): (value: StyleValue) => Array<PropertyDescriptor>;
68
- /**
69
- * Returns a [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) notation
70
- * of a CSS property value.
71
- *
72
- * ```ts
73
- * getBoxSidesShorthandValue( { top: '1px', right: '1px', bottom: '2px', left: '1px' } );
74
- * // will return '1px 1px 2px'
75
- * ```
76
- */
77
- export declare function getBoxSidesShorthandValue({ top, right, bottom, left }: BoxSides): string;
78
- /**
79
- * Creates a normalizer for a [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) 1-to-4 value.
80
- *
81
- * ```ts
82
- * stylesProcessor.setNormalizer( 'margin', getPositionShorthandNormalizer( 'margin' ) );
83
- * ```
84
- */
85
- export declare function getPositionShorthandNormalizer(shorthand: string): (value: string) => {
86
- path: string;
87
- value: BoxSides;
88
- };
89
- /**
90
- * Parses parts of a 1-to-4 value notation - handles some CSS values with spaces (like RGB()).
91
- *
92
- * ```ts
93
- * getShorthandValues( 'red blue RGB(0, 0, 0)');
94
- * // will return [ 'red', 'blue', 'RGB(0, 0, 0)' ]
95
- * ```
96
- */
97
- export declare function getShorthandValues(string: string): Array<string>;