@ckeditor/ckeditor5-utils 48.8.1-alpha.4 → 49.0.0-alpha.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.
- package/LICENSE.md +1 -1
- package/dist/abortabledebounce.d.ts +19 -13
- package/dist/areconnectedthroughproperties.d.ts +7 -7
- package/dist/ckeditorerror.d.ts +114 -113
- package/dist/collection.d.ts +419 -415
- package/dist/collectstylesheets.d.ts +9 -9
- package/dist/comparearrays.d.ts +25 -25
- package/dist/config.d.ts +159 -156
- package/dist/count.d.ts +14 -14
- package/dist/crc32.d.ts +19 -19
- package/dist/decodelicensekey.d.ts +7 -7
- package/dist/delay.d.ts +13 -13
- package/dist/diff.d.ts +32 -27
- package/dist/difftochanges.d.ts +47 -47
- package/dist/dom/adoptglobalstylesheet.d.ts +19 -0
- package/dist/dom/containsnode.d.ts +18 -0
- package/dist/dom/createelement.d.ts +43 -43
- package/dist/dom/emittermixin.d.ts +141 -135
- package/dist/dom/findclosestscrollableancestor.d.ts +13 -8
- package/dist/dom/getactiveelement.d.ts +17 -0
- package/dist/dom/getancestors.d.ts +13 -13
- package/dist/dom/getborderwidths.d.ts +16 -16
- package/dist/dom/getdatafromelement.d.ts +10 -10
- package/dist/dom/getelementfrompoint.d.ts +23 -0
- package/dist/dom/getlayoutparentelement.d.ts +18 -0
- package/dist/dom/getlayoutparentnode.d.ts +24 -0
- package/dist/dom/getoverlaymountroot.d.ts +24 -0
- package/dist/dom/getparentelement.d.ts +13 -0
- package/dist/dom/getparentnode.d.ts +15 -0
- package/dist/dom/getpositionedancestor.d.ts +18 -7
- package/dist/dom/getrangefrommouseevent.d.ts +15 -13
- package/dist/dom/getselection.d.ts +106 -0
- package/dist/dom/getshadowroots.d.ts +19 -0
- package/dist/dom/getvisualviewportoffset.d.ts +7 -7
- package/dist/dom/global.d.ts +24 -24
- package/dist/dom/indexof.d.ts +10 -10
- package/dist/dom/insertat.d.ts +11 -11
- package/dist/dom/iscomment.d.ts +7 -7
- package/dist/dom/isdomselectionbackward.d.ts +18 -0
- package/dist/dom/isnode.d.ts +7 -7
- package/dist/dom/isoffline.d.ts +8 -0
- package/dist/dom/isrange.d.ts +7 -7
- package/dist/dom/isshadowhostof.d.ts +18 -0
- package/dist/dom/isshadowroot.d.ts +41 -0
- package/dist/dom/istext.d.ts +7 -7
- package/dist/dom/isvalidattributename.d.ts +7 -7
- package/dist/dom/isvisible.d.ts +16 -12
- package/dist/dom/iswindow.d.ts +7 -7
- package/dist/dom/position.d.ts +200 -200
- package/dist/dom/rect.d.ts +198 -194
- package/dist/dom/remove.d.ts +7 -10
- package/dist/dom/resizeobserver.d.ts +70 -70
- package/dist/dom/scroll.d.ts +83 -72
- package/dist/dom/setdatainelement.d.ts +8 -11
- package/dist/dom/shadowrootregistry.d.ts +125 -0
- package/dist/dom/tounit.d.ts +16 -16
- package/dist/dom/trustedtypes.d.ts +65 -0
- package/dist/dom/whenelementconnected.d.ts +26 -0
- package/dist/elementreplacer.d.ts +24 -27
- package/dist/emittermixin.d.ts +287 -280
- package/dist/env.d.ts +124 -124
- package/dist/eventinfo.d.ts +58 -55
- package/dist/fastdiff.d.ts +112 -109
- package/dist/first.d.ts +7 -7
- package/dist/focustracker.d.ts +133 -131
- package/dist/formathtml.d.ts +15 -15
- package/dist/index-content.css +3 -0
- package/dist/index-content.css.map +1 -0
- package/dist/index-editor.css +3 -0
- package/dist/index-editor.css.map +1 -0
- package/dist/index.d.ts +95 -77
- package/dist/index.js +6788 -6360
- package/dist/index.js.map +1 -1
- package/dist/inserttopriorityarray.d.ts +23 -23
- package/dist/isfeatureblockedbylicensekey.d.ts +10 -10
- package/dist/isiterable.d.ts +10 -10
- package/dist/keyboard.d.ts +107 -109
- package/dist/keystrokehandler.d.ts +90 -90
- package/dist/language.d.ts +12 -12
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/locale.d.ts +122 -122
- package/dist/mapsequal.d.ts +11 -11
- package/dist/mix.d.ts +54 -53
- package/dist/nth.d.ts +12 -12
- package/dist/objecttomap.d.ts +18 -18
- package/dist/observablemixin.d.ts +618 -539
- package/dist/parsebase64encodedobject.d.ts +7 -7
- package/dist/parsedimensionwithunit.d.ts +40 -0
- package/dist/priorities.d.ts +24 -24
- package/dist/retry.d.ts +27 -27
- package/dist/splicearray.d.ts +22 -22
- package/dist/spy.d.ts +15 -15
- package/dist/toarray.d.ts +17 -17
- package/dist/tomap.d.ts +15 -15
- package/dist/translation-service.d.ts +157 -157
- package/dist/uid.d.ts +12 -12
- package/dist/unicode.d.ts +42 -42
- package/dist/version.d.ts +5 -5
- package/dist/wait.d.ts +11 -11
- package/package.json +3 -3
- package/dist/dom/getcommonancestor.d.ts +0 -12
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/getborderwidths
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
* Returns an object containing CSS border widths of a specified HTML element.
|
|
10
|
+
*
|
|
11
|
+
* @param element An element which has CSS borders.
|
|
12
|
+
* @returns An object containing `top`, `left`, `right` and `bottom` properties
|
|
13
|
+
* with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.
|
|
14
|
+
*/
|
|
15
15
|
export declare function getBorderWidths(element: HTMLElement): BorderWidths;
|
|
16
16
|
/**
|
|
17
|
-
|
|
17
|
+
* An object describing widths of `HTMLElement` borders.
|
|
18
18
|
*/
|
|
19
19
|
export interface BorderWidths {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
top: number;
|
|
21
|
+
right: number;
|
|
22
|
+
bottom: number;
|
|
23
|
+
left: number;
|
|
24
24
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/getdatafromelement
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
* Gets data from a given source element.
|
|
10
|
+
*
|
|
11
|
+
* @param el The element from which the data will be retrieved.
|
|
12
|
+
* @returns The data string.
|
|
13
|
+
*/
|
|
14
14
|
export declare function getDataFromElement(el: HTMLElement): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the topmost element at the given viewport point, looking inside the given shadow roots.
|
|
7
|
+
*
|
|
8
|
+
* The shadow-aware replacement for `Document#elementFromPoint()`, which retargets a point inside a shadow tree
|
|
9
|
+
* to that tree's host and so cannot report the element actually under it.
|
|
10
|
+
*
|
|
11
|
+
* Pass every shadow root a hit may land in – typically each editable's own `getRootNode()`. Only the innermost
|
|
12
|
+
* root containing the point matters, so ancestor roots do not need to be listed, and a point in the light DOM
|
|
13
|
+
* needs no roots at all.
|
|
14
|
+
*
|
|
15
|
+
* The point is hit tested strictly, honoring `pointer-events`, so the answer is the element that a click at
|
|
16
|
+
* those coordinates would reach. The exception is an engine that cannot hit test a shadow root, where the point
|
|
17
|
+
* is resolved from the nearest caret position instead and may land beside what it really hit.
|
|
18
|
+
*
|
|
19
|
+
* @param x The horizontal coordinate, relative to the viewport.
|
|
20
|
+
* @param y The vertical coordinate, relative to the viewport.
|
|
21
|
+
* @param shadowRoots The shadow roots the lookup is allowed to look inside. Empty for the light DOM.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getElementFromPoint(x: number, y: number, shadowRoots?: Array<ShadowRoot>): Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the parent element in the **flattened tree**, the one the browser lays out and paints.
|
|
7
|
+
*
|
|
8
|
+
* The layout-aware counterpart of {@link module:utils/dom/getparentelement~getParentElement}, and the element-only
|
|
9
|
+
* form of {@link module:utils/dom/getlayoutparentnode~getLayoutParentNode} – see that one for why the flattened
|
|
10
|
+
* tree and the node tree disagree for slotted content, and for when to prefer which.
|
|
11
|
+
*
|
|
12
|
+
* Use it to walk outwards over the elements that lay a node out: its scrollable ancestors, its clipping ancestors.
|
|
13
|
+
* Works for open and closed roots alike, and falls back to the node tree for slotted content inside a closed root,
|
|
14
|
+
* whose slot the DOM standard does not expose.
|
|
15
|
+
*
|
|
16
|
+
* @param node The node to get the layout parent element of.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getLayoutParentElement(node: Node): Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the node one step up the **flattened tree**, the one the browser lays out and paints.
|
|
7
|
+
*
|
|
8
|
+
* The layout-aware counterpart of {@link module:utils/dom/getparentnode~getParentNode}, which walks the node
|
|
9
|
+
* tree. The two agree everywhere except for slotted content: assigning a node to a `<slot>` does not move it, so
|
|
10
|
+
* it stays a child of the host in the node tree while rendering inside the slot. A node-tree walk out of such a
|
|
11
|
+
* node therefore leaves into the light DOM and skips every element of the shadow tree that actually lays it out.
|
|
12
|
+
*
|
|
13
|
+
* Use this one for questions about geometry – what scrolls a node, what clips it, what it renders inside – and
|
|
14
|
+
* {@link module:utils/dom/getparentnode~getParentNode} for questions about structure, such as what a node is a
|
|
15
|
+
* descendant of for the purposes of DOM manipulation or event retargeting. Both cross shadow boundaries and both
|
|
16
|
+
* work for open and closed roots alike.
|
|
17
|
+
*
|
|
18
|
+
* **Note**: `Element#assignedSlot` is `null` when the slot lives in a *closed* shadow root, which the DOM
|
|
19
|
+
* standard does not expose. For slotted content inside a closed root this falls back to the node tree and
|
|
20
|
+
* answers exactly as {@link module:utils/dom/getparentnode~getParentNode} does.
|
|
21
|
+
*
|
|
22
|
+
* @param node The node to step up from.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getLayoutParentNode(node: Node): ParentNode | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the DOM tree that a feature's floating UI – its balloons, dialogs and tooltips – should be put in:
|
|
7
|
+
* the same one the feature itself is in.
|
|
8
|
+
*
|
|
9
|
+
* Floating UI would otherwise go into `document.body`. That is outside the shadow root an editor may live in,
|
|
10
|
+
* so the UI would leave the tree the editor's styles were loaded into, and lose them.
|
|
11
|
+
*
|
|
12
|
+
* Being in the same tree means one of three things:
|
|
13
|
+
*
|
|
14
|
+
* * the shadow root the given element is in, if it is in one. A shadow root passed in returns itself.
|
|
15
|
+
* * the `<body>` of that element's own document otherwise, so an editor in an iframe stays in that iframe.
|
|
16
|
+
* * `null` while the element is detached, because there is no telling yet which tree it will end up in. Put
|
|
17
|
+
* the UI nowhere for now and ask again once the element is in the DOM.
|
|
18
|
+
*
|
|
19
|
+
* Feed the result to {@link module:ui/editorui/bodycollection~BodyCollection#syncMountTarget}, and call this
|
|
20
|
+
* again whenever the element may have moved. Works with open and closed shadow roots.
|
|
21
|
+
*
|
|
22
|
+
* @param containerNode The element the floating UI belongs to – usually the feature's container.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getOverlayMountRoot(containerNode: Element | ShadowRoot): HTMLElement | ShadowRoot | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the parent element of the given node, crossing shadow boundaries.
|
|
7
|
+
*
|
|
8
|
+
* The shadow-aware replacement for `Node#parentElement`, which is `null` for a node sitting directly in a
|
|
9
|
+
* `ShadowRoot` and so stops an outward walk at the boundary. Works for open and closed roots alike.
|
|
10
|
+
*
|
|
11
|
+
* @param node The node to get the parent element of.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getParentElement(node: Node): Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the node one step up the composed tree, crossing shadow boundaries.
|
|
7
|
+
*
|
|
8
|
+
* The shadow-aware replacement for `Node#parentNode`, and the primitive for walking from a node outwards to the
|
|
9
|
+
* document. It steps over any node, so such a walk visits the `ShadowRoot` nodes on the way and reaches the
|
|
10
|
+
* `Document` at the top – to walk elements only, use
|
|
11
|
+
* {@link module:utils/dom/getparentelement~getParentElement}. Works for open and closed roots alike.
|
|
12
|
+
*
|
|
13
|
+
* @param node The node to step up from.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getParentNode(node: Node): ParentNode | null;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* Returns the element the given one is laid out against while absolutely positioned – the element whose padding
|
|
7
|
+
* box its `top` and `left` are relative to. Returns `null` when there is nothing to compensate for: the element
|
|
8
|
+
* is laid out against the initial containing block, is `position: fixed`, or is not rendered at all.
|
|
9
|
+
*
|
|
10
|
+
* Use it when turning a position measured against the viewport into the `top` and `left` to set on an absolutely
|
|
11
|
+
* positioned element, by subtracting the returned element's padding-box offset – the way
|
|
12
|
+
* {@link module:utils/dom/rect~Rect#toAbsoluteRect} and {@link module:utils/dom/position~getOptimalPosition} do.
|
|
13
|
+
*
|
|
14
|
+
* The layout-aware counterpart of `Element#offsetParent`, and what to reach for instead of it: this one follows
|
|
15
|
+
* the **flattened tree**, the one the browser lays out, so it stays right for slotted content – an editor slotted
|
|
16
|
+
* into a container component – where `offsetParent` names an element that does not lay that content out. Falls
|
|
17
|
+
* back to `offsetParent` for slotted content inside a closed root, whose slot the DOM standard does not expose.
|
|
18
|
+
*
|
|
19
|
+
* @param element The native DOM element to be checked.
|
|
20
|
+
*/
|
|
10
21
|
export declare function getPositionedAncestor(element?: HTMLElement): HTMLElement | null;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
* Returns a DOM range from a given point specified by a mouse event.
|
|
7
|
+
*
|
|
8
|
+
* **Note**: The point is resolved inside the shadow root the event was dispatched in, so a click inside a shadow
|
|
9
|
+
* tree gives a range in that tree rather than one at its host. Works for open and closed shadow roots alike, on
|
|
10
|
+
* the engines that honor the `shadowRoots` option of `Document#caretPositionFromPoint()`; elsewhere the range
|
|
11
|
+
* still lands beside the host.
|
|
12
|
+
*
|
|
13
|
+
* @param domEvent The mouse event.
|
|
14
|
+
* @returns The DOM range.
|
|
15
|
+
*/
|
|
14
16
|
export declare function getRangeFromMouseEvent(domEvent: MouseEvent & {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
rangeParent?: HTMLElement;
|
|
18
|
+
rangeOffset?: number;
|
|
17
19
|
}): Range | null;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module utils/dom/getselection
|
|
7
|
+
*/
|
|
8
|
+
import { type ArrayOrItem } from "../toarray.js";
|
|
9
|
+
/**
|
|
10
|
+
* Returns the selection of the tree the given node lives in.
|
|
11
|
+
*
|
|
12
|
+
* Use it instead of `window.getSelection()`, which cannot see into a shadow root: its `anchorNode` and
|
|
13
|
+
* `focusNode` point at the host of the tree, not at the nodes selected inside it.
|
|
14
|
+
*
|
|
15
|
+
* Pass the node the selection is read for, usually an editable. Pass several nodes to cover several editables
|
|
16
|
+
* at once. A node in the light DOM gives the document selection, unchanged. Works with open and closed shadow
|
|
17
|
+
* roots.
|
|
18
|
+
*
|
|
19
|
+
* The result behaves like a `Selection` – the part of one the editor uses – so read it and change it the same
|
|
20
|
+
* way. It is `null` when there is no selection to read: a detached node, or a document with no window.
|
|
21
|
+
*
|
|
22
|
+
* One thing this helper cannot fix. In Safari and Chromium browsers, a selection made with the mouse inside a
|
|
23
|
+
* shadow root reports no direction, so a backward selection may look forward. Chromium is asked through its own
|
|
24
|
+
* API where possible. Safari has none.
|
|
25
|
+
*
|
|
26
|
+
* @param nodeOrNodes The node (or nodes) whose tree's selection should be returned.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getSelection(nodeOrNodes: ArrayOrItem<Node>): Selection | ShadowSelection | null;
|
|
29
|
+
/**
|
|
30
|
+
* A `Selection` view over the composed ranges of a set of shadow roots. Read accessors are resolved live
|
|
31
|
+
* from the composed ranges on each access, so the view stays in sync with the underlying document selection;
|
|
32
|
+
* selection mutations are delegated to it. Only the subset of the `Selection` interface consumed by the
|
|
33
|
+
* editor is implemented, so `getSelection()` returns it alongside the native `Selection`.
|
|
34
|
+
*/
|
|
35
|
+
export declare class ShadowSelection {
|
|
36
|
+
/**
|
|
37
|
+
* The underlying document-level selection that mutations are delegated to and composed ranges read
|
|
38
|
+
* from.
|
|
39
|
+
*/
|
|
40
|
+
private readonly _domSelection;
|
|
41
|
+
/**
|
|
42
|
+
* The shadow roots the composed ranges are resolved against.
|
|
43
|
+
*/
|
|
44
|
+
private readonly _shadowRoots;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the engine only accepts the legacy rest-parameter form of `getComposedRanges()`. This is
|
|
47
|
+
* a fixed property of the engine, so it is detected once (the first call throws on the dictionary
|
|
48
|
+
* form) and cached for all instances, keeping the exception off the selection-read hot path.
|
|
49
|
+
*/
|
|
50
|
+
private static _useLegacyComposedRanges;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
constructor(domSelection: Selection, shadowRoots: Array<ShadowRoot>);
|
|
55
|
+
get rangeCount(): number;
|
|
56
|
+
get isCollapsed(): boolean;
|
|
57
|
+
get anchorNode(): Node | null;
|
|
58
|
+
get anchorOffset(): number;
|
|
59
|
+
get focusNode(): Node | null;
|
|
60
|
+
get focusOffset(): number;
|
|
61
|
+
/**
|
|
62
|
+
* The direction of the selection, resolved against the tree the first composed range lives in. It is
|
|
63
|
+
* already computed to orient the anchor and focus endpoints, so exposing it lets consumers read the
|
|
64
|
+
* orientation directly instead of re-deriving it from the endpoints.
|
|
65
|
+
*/
|
|
66
|
+
get direction(): "forward" | "backward" | "none";
|
|
67
|
+
getRangeAt(index: number): Range;
|
|
68
|
+
removeAllRanges(): void;
|
|
69
|
+
addRange(range: Range): void;
|
|
70
|
+
collapse(node: Node | null, offset?: number): void;
|
|
71
|
+
extend(node: Node, offset?: number): void;
|
|
72
|
+
setBaseAndExtent(anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* The composed ranges fully contained in one of the trees on the path from the given nodes to the
|
|
75
|
+
* document, in document order (start before end).
|
|
76
|
+
*
|
|
77
|
+
* Only ranges whose both endpoints resolve into the same tree can be represented as a live, single-tree
|
|
78
|
+
* `Range`. A range crossing a shadow boundary is therefore dropped, and so is one resolving into an
|
|
79
|
+
* unrelated tree, rather than surfacing foreign nodes. The document itself is one of those trees: it is
|
|
80
|
+
* where every node ends up when walking out of its shadow roots, and it is where a selection made in a
|
|
81
|
+
* sibling light-DOM editable lives, so such a selection is kept rather than dropped.
|
|
82
|
+
*
|
|
83
|
+
* A range with an endpoint outside its container is dropped as well, see `isOffsetInNode()` below.
|
|
84
|
+
*/
|
|
85
|
+
private _getRanges;
|
|
86
|
+
/**
|
|
87
|
+
* The raw composed ranges reported for the shadow roots by the underlying selection.
|
|
88
|
+
*/
|
|
89
|
+
private _getComposedRanges;
|
|
90
|
+
/**
|
|
91
|
+
* The direction of the underlying selection, preferring the one reported by Blink's shadow-scoped
|
|
92
|
+
* selection, which stays meaningful for a mouse selection made inside a shadow root.
|
|
93
|
+
*/
|
|
94
|
+
private _getDirection;
|
|
95
|
+
/**
|
|
96
|
+
* The anchor or focus endpoint of the first composed range.
|
|
97
|
+
*
|
|
98
|
+
* `getComposedRanges()` returns ranges in document order (start before end); the anchor/focus
|
|
99
|
+
* orientation therefore has to come from `Selection#direction`. Known limitation: WebKit and Blink
|
|
100
|
+
* report `direction` as `'none'` for a selection made *with the mouse* inside a shadow root (a
|
|
101
|
+
* keyboard selection reports it correctly). Blink's shadow-scoped selection still knows the direction
|
|
102
|
+
* in that case, so it is consulted first; it is of no use for the ranges themselves, as it covers
|
|
103
|
+
* a single tree only. Safari has no such API, so its mouse selections fall back to forward.
|
|
104
|
+
*/
|
|
105
|
+
private _getEndpoint;
|
|
106
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns every shadow root the given node renders in, innermost first.
|
|
7
|
+
*
|
|
8
|
+
* For code that has to act on *all* the shadow boundaries above a node – attaching listeners, injecting styles –
|
|
9
|
+
* rather than only the nearest one. Empty for a node in the light DOM, and one entry per boundary for a node
|
|
10
|
+
* inside nested trees. Works for open and closed roots alike.
|
|
11
|
+
*
|
|
12
|
+
* Derived from the tree the node sits in, not from whether that tree is in a document: a node inside a shadow
|
|
13
|
+
* root reports that root even while its host is detached, because `attachShadow()` makes the shadow tree – and
|
|
14
|
+
* its root – real right away. Callers that only care about the roots a node is currently *rendered* in should
|
|
15
|
+
* check `Node#isConnected` themselves.
|
|
16
|
+
*
|
|
17
|
+
* @param node The node to collect the hosting shadow roots of.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getShadowRoots(node: Node): Array<ShadowRoot>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Returns the visual viewport offsets to adjust elements with `position: fixed` style.
|
|
7
|
+
*/
|
|
8
8
|
export declare function getVisualViewportOffset(): {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
11
|
};
|
package/dist/dom/global.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/global
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* A helper (module) giving an access to the global DOM objects such as `window` and `document`.
|
|
10
|
+
*/
|
|
11
11
|
export interface GlobalType {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
readonly window: Window & typeof globalThis;
|
|
13
|
+
readonly document: Document;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
* A helper (module) giving an access to the global DOM objects such as `window` and
|
|
17
|
+
* `document`. Accessing these objects using this helper allows easy and bulletproof
|
|
18
|
+
* testing, i.e. stubbing native properties:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { global } from 'ckeditor5';
|
|
22
|
+
*
|
|
23
|
+
* // This stub will work for any code using global module.
|
|
24
|
+
* vi.spyOn( global, 'window', 'get' ).mockReturnValue( {
|
|
25
|
+
* innerWidth: 10000
|
|
26
|
+
* } );
|
|
27
|
+
*
|
|
28
|
+
* console.log( global.window.innerWidth );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
31
|
declare let globalVar: GlobalType;
|
|
32
32
|
export { globalVar as global };
|
package/dist/dom/indexof.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/indexof
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
* Returns index of the node in the parent element.
|
|
10
|
+
*
|
|
11
|
+
* @param node Node which index is tested.
|
|
12
|
+
* @returns Index of the node in the parent element. Returns 0 if node has no parent.
|
|
13
|
+
*/
|
|
14
14
|
export declare function indexOf(node: Node): number;
|
package/dist/dom/insertat.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/insertat
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
* Inserts node to the parent at given index.
|
|
10
|
+
*
|
|
11
|
+
* @param parentElement Parent element.
|
|
12
|
+
* @param index Insertions index.
|
|
13
|
+
* @param nodeToInsert Node to insert.
|
|
14
|
+
*/
|
|
15
15
|
export declare function insertAt(parentElement: Element, index: number, nodeToInsert: Node): void;
|
package/dist/dom/iscomment.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/iscomment
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Checks whether the object is a native DOM Comment node.
|
|
10
|
+
*/
|
|
11
11
|
export declare function isComment(obj: any): obj is Comment;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module utils/dom/isdomselectionbackward
|
|
7
|
+
*/
|
|
8
|
+
import { type ShadowSelection } from "./getselection.js";
|
|
9
|
+
/**
|
|
10
|
+
* Returns `true` if the given selection is backward, that is, if its `focus` is positioned before its `anchor`.
|
|
11
|
+
*
|
|
12
|
+
* A replacement for reading `Selection#direction`, which is absent on older engines and reports `'none'` for a
|
|
13
|
+
* selection made with the mouse inside a shadow root. The orientation is then recovered from the anchor and
|
|
14
|
+
* focus positions instead, so an answer is always available.
|
|
15
|
+
*
|
|
16
|
+
* @param selection The selection to check.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isDomSelectionBackward(selection: Selection | ShadowSelection): boolean;
|
package/dist/dom/isnode.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/isnode
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Checks if the object is a native DOM Node.
|
|
10
|
+
*/
|
|
11
11
|
export declare function isNode(obj: any): obj is Node;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Checks whether the browser reports that there is no network connection.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isOffline(): boolean;
|
package/dist/dom/isrange.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/isrange
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Checks if the object is a native DOM Range.
|
|
10
|
+
*/
|
|
11
11
|
export declare function isRange(obj: unknown): obj is Range;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module utils/dom/isshadowhostof
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether the given node is the host of any of the given shadow roots.
|
|
10
|
+
*
|
|
11
|
+
* Answers "is this a stand-in for something inside one of these roots, rather than the real thing?". A DOM API
|
|
12
|
+
* that cannot reach into a shadow tree reports its host in place of the node inside it – most commonly an event
|
|
13
|
+
* target, retargeted for a listener that does not live in that tree. Works for open and closed roots alike.
|
|
14
|
+
*
|
|
15
|
+
* @param node The node to test.
|
|
16
|
+
* @param shadowRoots The shadow roots to test against.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isShadowHostOf(node: EventTarget | null, shadowRoots: Iterable<ShadowRoot>): boolean;
|