@wordpress/dom 4.31.1-next.f56bd8138.0 → 4.32.1-next.47f435fc9.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.
- package/CHANGELOG.md +2 -0
- package/build/data-transfer.js +30 -18
- package/build/data-transfer.js.map +7 -1
- package/build/dom/caret-range-from-point.js +22 -25
- package/build/dom/caret-range-from-point.js.map +7 -1
- package/build/dom/clean-node-list.js +122 -129
- package/build/dom/clean-node-list.js.map +7 -1
- package/build/dom/compute-caret-rect.js +36 -21
- package/build/dom/compute-caret-rect.js.map +7 -1
- package/build/dom/document-has-selection.js +36 -22
- package/build/dom/document-has-selection.js.map +7 -1
- package/build/dom/document-has-text-selection.js +25 -23
- package/build/dom/document-has-text-selection.js.map +7 -1
- package/build/dom/document-has-uncollapsed-selection.js +35 -22
- package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
- package/build/dom/get-computed-style.js +27 -17
- package/build/dom/get-computed-style.js.map +7 -1
- package/build/dom/get-offset-parent.js +43 -32
- package/build/dom/get-offset-parent.js.map +7 -1
- package/build/dom/get-range-height.js +24 -18
- package/build/dom/get-range-height.js.map +7 -1
- package/build/dom/get-rectangle-from-range.js +47 -68
- package/build/dom/get-rectangle-from-range.js.map +7 -1
- package/build/dom/get-scroll-container.js +44 -37
- package/build/dom/get-scroll-container.js.map +7 -1
- package/build/dom/hidden-caret-range-from-point.js +39 -33
- package/build/dom/hidden-caret-range-from-point.js.map +7 -1
- package/build/dom/index.js +116 -195
- package/build/dom/index.js.map +7 -1
- package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
- package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
- package/build/dom/insert-after.js +24 -19
- package/build/dom/insert-after.js.map +7 -1
- package/build/dom/is-edge.js +57 -67
- package/build/dom/is-edge.js.map +7 -1
- package/build/dom/is-element.js +22 -11
- package/build/dom/is-element.js.map +7 -1
- package/build/dom/is-empty.js +27 -17
- package/build/dom/is-empty.js.map +7 -1
- package/build/dom/is-entirely-selected.js +46 -50
- package/build/dom/is-entirely-selected.js.map +7 -1
- package/build/dom/is-form-element.js +36 -24
- package/build/dom/is-form-element.js.map +7 -1
- package/build/dom/is-horizontal-edge.js +34 -20
- package/build/dom/is-horizontal-edge.js.map +7 -1
- package/build/dom/is-html-input-element.js +23 -12
- package/build/dom/is-html-input-element.js.map +7 -1
- package/build/dom/is-input-or-text-area.js +23 -12
- package/build/dom/is-input-or-text-area.js.map +7 -1
- package/build/dom/is-number-input.js +38 -29
- package/build/dom/is-number-input.js.map +7 -1
- package/build/dom/is-rtl.js +34 -19
- package/build/dom/is-rtl.js.map +7 -1
- package/build/dom/is-selection-forward.js +26 -40
- package/build/dom/is-selection-forward.js.map +7 -1
- package/build/dom/is-text-field.js +49 -24
- package/build/dom/is-text-field.js.map +7 -1
- package/build/dom/is-vertical-edge.js +34 -20
- package/build/dom/is-vertical-edge.js.map +7 -1
- package/build/dom/place-caret-at-edge.js +52 -55
- package/build/dom/place-caret-at-edge.js.map +7 -1
- package/build/dom/place-caret-at-horizontal-edge.js +34 -18
- package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
- package/build/dom/place-caret-at-vertical-edge.js +34 -19
- package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
- package/build/dom/remove-invalid-html.js +35 -22
- package/build/dom/remove-invalid-html.js.map +7 -1
- package/build/dom/remove.js +24 -17
- package/build/dom/remove.js.map +7 -1
- package/build/dom/replace-tag.js +24 -19
- package/build/dom/replace-tag.js.map +7 -1
- package/build/dom/replace.js +38 -23
- package/build/dom/replace.js.map +7 -1
- package/build/dom/safe-html.js +39 -28
- package/build/dom/safe-html.js.map +7 -1
- package/build/dom/scroll-if-no-range.js +26 -18
- package/build/dom/scroll-if-no-range.js.map +7 -1
- package/build/dom/strip-html.js +36 -23
- package/build/dom/strip-html.js.map +7 -1
- package/build/dom/unwrap.js +24 -18
- package/build/dom/unwrap.js.map +7 -1
- package/build/dom/wrap.js +24 -17
- package/build/dom/wrap.js.map +7 -1
- package/build/focusable.js +52 -85
- package/build/focusable.js.map +7 -1
- package/build/index.js +44 -58
- package/build/index.js.map +7 -1
- package/build/phrasing-content.js +88 -128
- package/build/phrasing-content.js.map +7 -1
- package/build/tabbable.js +52 -137
- package/build/tabbable.js.map +7 -1
- package/build/utils/assert-is-defined.js +30 -7
- package/build/utils/assert-is-defined.js.map +7 -1
- package/build-module/data-transfer.js +9 -15
- package/build-module/data-transfer.js.map +7 -1
- package/build-module/dom/caret-range-from-point.js +5 -22
- package/build-module/dom/caret-range-from-point.js.map +7 -1
- package/build-module/dom/clean-node-list.js +94 -123
- package/build-module/dom/clean-node-list.js.map +7 -1
- package/build-module/dom/compute-caret-rect.js +8 -16
- package/build-module/dom/compute-caret-rect.js.map +7 -1
- package/build-module/dom/document-has-selection.js +8 -17
- package/build-module/dom/document-has-selection.js.map +7 -1
- package/build-module/dom/document-has-text-selection.js +8 -20
- package/build-module/dom/document-has-text-selection.js.map +7 -1
- package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
- package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
- package/build-module/dom/get-computed-style.js +10 -14
- package/build-module/dom/get-computed-style.js.map +7 -1
- package/build-module/dom/get-offset-parent.js +16 -28
- package/build-module/dom/get-offset-parent.js.map +7 -1
- package/build-module/dom/get-range-height.js +7 -15
- package/build-module/dom/get-range-height.js.map +7 -1
- package/build-module/dom/get-rectangle-from-range.js +30 -65
- package/build-module/dom/get-rectangle-from-range.js.map +7 -1
- package/build-module/dom/get-scroll-container.js +16 -32
- package/build-module/dom/get-scroll-container.js.map +7 -1
- package/build-module/dom/hidden-caret-range-from-point.js +11 -28
- package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
- package/build-module/dom/index.js +57 -28
- package/build-module/dom/index.js.map +7 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
- package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
- package/build-module/dom/insert-after.js +7 -16
- package/build-module/dom/insert-after.js.map +7 -1
- package/build-module/dom/is-edge.js +24 -57
- package/build-module/dom/is-edge.js.map +7 -1
- package/build-module/dom/is-element.js +5 -8
- package/build-module/dom/is-element.js.map +7 -1
- package/build-module/dom/is-empty.js +10 -14
- package/build-module/dom/is-empty.js.map +7 -1
- package/build-module/dom/is-entirely-selected.js +18 -45
- package/build-module/dom/is-entirely-selected.js.map +7 -1
- package/build-module/dom/is-form-element.js +8 -19
- package/build-module/dom/is-form-element.js.map +7 -1
- package/build-module/dom/is-horizontal-edge.js +6 -15
- package/build-module/dom/is-horizontal-edge.js.map +7 -1
- package/build-module/dom/is-html-input-element.js +6 -9
- package/build-module/dom/is-html-input-element.js.map +7 -1
- package/build-module/dom/is-input-or-text-area.js +6 -9
- package/build-module/dom/is-input-or-text-area.js.map +7 -1
- package/build-module/dom/is-number-input.js +11 -25
- package/build-module/dom/is-number-input.js.map +7 -1
- package/build-module/dom/is-rtl.js +7 -15
- package/build-module/dom/is-rtl.js.map +7 -1
- package/build-module/dom/is-selection-forward.js +9 -37
- package/build-module/dom/is-selection-forward.js.map +7 -1
- package/build-module/dom/is-text-field.js +22 -20
- package/build-module/dom/is-text-field.js.map +7 -1
- package/build-module/dom/is-vertical-edge.js +6 -15
- package/build-module/dom/is-vertical-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-edge.js +22 -48
- package/build-module/dom/place-caret-at-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
- package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
- package/build-module/dom/remove-invalid-html.js +7 -17
- package/build-module/dom/remove-invalid-html.js.map +7 -1
- package/build-module/dom/remove.js +7 -14
- package/build-module/dom/remove.js.map +7 -1
- package/build-module/dom/replace-tag.js +7 -16
- package/build-module/dom/replace-tag.js.map +7 -1
- package/build-module/dom/replace.js +9 -17
- package/build-module/dom/replace.js.map +7 -1
- package/build-module/dom/safe-html.js +11 -23
- package/build-module/dom/safe-html.js.map +7 -1
- package/build-module/dom/scroll-if-no-range.js +5 -15
- package/build-module/dom/scroll-if-no-range.js.map +7 -1
- package/build-module/dom/strip-html.js +8 -18
- package/build-module/dom/strip-html.js.map +7 -1
- package/build-module/dom/unwrap.js +7 -15
- package/build-module/dom/unwrap.js.map +7 -1
- package/build-module/dom/wrap.js +7 -14
- package/build-module/dom/wrap.js.map +7 -1
- package/build-module/focusable.js +30 -81
- package/build-module/focusable.js.map +7 -1
- package/build-module/index.js +9 -17
- package/build-module/index.js.map +7 -1
- package/build-module/phrasing-content.js +67 -125
- package/build-module/phrasing-content.js.map +7 -1
- package/build-module/tabbable.js +30 -133
- package/build-module/tabbable.js.map +7 -1
- package/build-module/utils/assert-is-defined.js +9 -4
- package/build-module/utils/assert-is-defined.js.map +7 -1
- package/package.json +11 -4
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-text-field.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mCAA+B;AAYhB,SAAR,YAA8B,MAAO;AAE3C,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,aACG,6BAAAA,SAAoB,IAAK,KAC1B,KAAK,QACL,CAAE,cAAc,SAAU,KAAK,IAAK,KACrC,KAAK,aAAa;AAAA,EACW,KAAO,oBAAoB;AAE1D;",
|
|
6
|
+
"names": ["isHTMLInputElement"]
|
|
7
|
+
}
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var is_vertical_edge_exports = {};
|
|
30
|
+
__export(is_vertical_edge_exports, {
|
|
31
|
+
default: () => isVerticalEdge
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check whether the selection is vertically at the edge of the container.
|
|
15
|
-
*
|
|
16
|
-
* @param {HTMLElement} container Focusable element.
|
|
17
|
-
* @param {boolean} isReverse Set to true to check top, false for bottom.
|
|
18
|
-
*
|
|
19
|
-
* @return {boolean} True if at the vertical edge, false if not.
|
|
20
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(is_vertical_edge_exports);
|
|
34
|
+
var import_is_edge = __toESM(require("./is-edge"));
|
|
21
35
|
function isVerticalEdge(container, isReverse) {
|
|
22
|
-
return (0,
|
|
36
|
+
return (0, import_is_edge.default)(container, isReverse, true);
|
|
23
37
|
}
|
|
24
|
-
//# sourceMappingURL=is-vertical-edge.js.map
|
|
38
|
+
//# sourceMappingURL=is-vertical-edge.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-vertical-edge.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmB;AAUJ,SAAR,eAAiC,WAAW,WAAY;AAC9D,aAAO,eAAAA,SAAQ,WAAW,WAAW,IAAK;AAC3C;",
|
|
6
|
+
"names": ["isEdge"]
|
|
7
|
+
}
|
|
@@ -1,40 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var place_caret_at_edge_exports = {};
|
|
30
|
+
__export(place_caret_at_edge_exports, {
|
|
31
|
+
default: () => placeCaretAtEdge
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Gets the range to place.
|
|
19
|
-
*
|
|
20
|
-
* @param {HTMLElement} container Focusable element.
|
|
21
|
-
* @param {boolean} isReverse True for end, false for start.
|
|
22
|
-
* @param {number|undefined} x X coordinate to vertically position.
|
|
23
|
-
*
|
|
24
|
-
* @return {Range|null} The range to place.
|
|
25
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(place_caret_at_edge_exports);
|
|
34
|
+
var import_hidden_caret_range_from_point = __toESM(require("./hidden-caret-range-from-point"));
|
|
35
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
36
|
+
var import_is_input_or_text_area = __toESM(require("./is-input-or-text-area"));
|
|
37
|
+
var import_is_rtl = __toESM(require("./is-rtl"));
|
|
38
|
+
var import_scroll_if_no_range = require("./scroll-if-no-range");
|
|
26
39
|
function getRange(container, isReverse, x) {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
} = container;
|
|
30
|
-
// In the case of RTL scripts, the horizontal edge is at the opposite side.
|
|
31
|
-
const isReverseDir = (0, _isRtl.default)(container) ? !isReverse : isReverse;
|
|
40
|
+
const { ownerDocument } = container;
|
|
41
|
+
const isReverseDir = (0, import_is_rtl.default)(container) ? !isReverse : isReverse;
|
|
32
42
|
const containerRect = container.getBoundingClientRect();
|
|
33
|
-
|
|
34
|
-
// right corner. When placing at the start, to the top left corner.
|
|
35
|
-
// Ensure x is defined and within the container's boundaries. When it's
|
|
36
|
-
// exactly at the boundary, it's not considered within the boundaries.
|
|
37
|
-
if (x === undefined) {
|
|
43
|
+
if (x === void 0) {
|
|
38
44
|
x = isReverse ? containerRect.right - 1 : containerRect.left + 1;
|
|
39
45
|
} else if (x <= containerRect.left) {
|
|
40
46
|
x = containerRect.left + 1;
|
|
@@ -42,24 +48,15 @@ function getRange(container, isReverse, x) {
|
|
|
42
48
|
x = containerRect.right - 1;
|
|
43
49
|
}
|
|
44
50
|
const y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;
|
|
45
|
-
return (0,
|
|
51
|
+
return (0, import_hidden_caret_range_from_point.default)(ownerDocument, x, y, container);
|
|
46
52
|
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Places the caret at start or end of a given element.
|
|
50
|
-
*
|
|
51
|
-
* @param {HTMLElement} container Focusable element.
|
|
52
|
-
* @param {boolean} isReverse True for end, false for start.
|
|
53
|
-
* @param {number|undefined} x X coordinate to vertically position.
|
|
54
|
-
*/
|
|
55
53
|
function placeCaretAtEdge(container, isReverse, x) {
|
|
56
54
|
if (!container) {
|
|
57
55
|
return;
|
|
58
56
|
}
|
|
59
57
|
container.focus();
|
|
60
|
-
if ((0,
|
|
61
|
-
|
|
62
|
-
if (typeof container.selectionStart !== 'number') {
|
|
58
|
+
if ((0, import_is_input_or_text_area.default)(container)) {
|
|
59
|
+
if (typeof container.selectionStart !== "number") {
|
|
63
60
|
return;
|
|
64
61
|
}
|
|
65
62
|
if (isReverse) {
|
|
@@ -74,20 +71,20 @@ function placeCaretAtEdge(container, isReverse, x) {
|
|
|
74
71
|
if (!container.isContentEditable) {
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
|
-
const range = (0,
|
|
74
|
+
const range = (0, import_scroll_if_no_range.scrollIfNoRange)(
|
|
75
|
+
container,
|
|
76
|
+
isReverse,
|
|
77
|
+
() => getRange(container, isReverse, x)
|
|
78
|
+
);
|
|
78
79
|
if (!range) {
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
const {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const {
|
|
85
|
-
defaultView
|
|
86
|
-
} = ownerDocument;
|
|
87
|
-
(0, _assertIsDefined.assertIsDefined)(defaultView, 'defaultView');
|
|
82
|
+
const { ownerDocument } = container;
|
|
83
|
+
const { defaultView } = ownerDocument;
|
|
84
|
+
(0, import_assert_is_defined.assertIsDefined)(defaultView, "defaultView");
|
|
88
85
|
const selection = defaultView.getSelection();
|
|
89
|
-
(0,
|
|
86
|
+
(0, import_assert_is_defined.assertIsDefined)(selection, "selection");
|
|
90
87
|
selection.removeAllRanges();
|
|
91
88
|
selection.addRange(range);
|
|
92
89
|
}
|
|
93
|
-
//# sourceMappingURL=place-caret-at-edge.js.map
|
|
90
|
+
//# sourceMappingURL=place-caret-at-edge.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/place-caret-at-edge.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n *\n * @return {Range|null} The range to place.\n */\nfunction getRange( container, isReverse, x ) {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge( container, isReverse, x ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2CAAsC;AACtC,+BAAgC;AAChC,mCAA8B;AAC9B,oBAAkB;AAClB,gCAAgC;AAWhC,SAAS,SAAU,WAAW,WAAW,GAAI;AAC5C,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,mBAAe,cAAAA,SAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAKtD,MAAK,MAAM,QAAY;AACtB,QAAI,YAAY,cAAc,QAAQ,IAAI,cAAc,OAAO;AAAA,EAChE,WAAY,KAAK,cAAc,MAAO;AACrC,QAAI,cAAc,OAAO;AAAA,EAC1B,WAAY,KAAK,cAAc,OAAQ;AACtC,QAAI,cAAc,QAAQ;AAAA,EAC3B;AACA,QAAM,IAAI,eAAe,cAAc,SAAS,IAAI,cAAc,MAAM;AACxE,aAAO,qCAAAC,SAA2B,eAAe,GAAG,GAAG,SAAU;AAClE;AASe,SAAR,iBAAmC,WAAW,WAAW,GAAI;AACnE,MAAK,CAAE,WAAY;AAClB;AAAA,EACD;AAEA,YAAU,MAAM;AAEhB,UAAK,6BAAAC,SAAmB,SAAU,GAAI;AAErC,QAAK,OAAO,UAAU,mBAAmB,UAAW;AACnD;AAAA,IACD;AAEA,QAAK,WAAY;AAChB,gBAAU,iBAAiB,UAAU,MAAM;AAC3C,gBAAU,eAAe,UAAU,MAAM;AAAA,IAC1C,OAAO;AACN,gBAAU,iBAAiB;AAC3B,gBAAU,eAAe;AAAA,IAC1B;AAEA;AAAA,EACD;AAEA,MAAK,CAAE,UAAU,mBAAoB;AACpC;AAAA,EACD;AAEA,QAAM,YAAQ;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,MACpD,SAAU,WAAW,WAAW,CAAE;AAAA,EACnC;AAEA,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,gDAAiB,WAAW,WAAY;AACxC,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;",
|
|
6
|
+
"names": ["isRTL", "hiddenCaretRangeFromPoint", "isInputOrTextArea"]
|
|
7
|
+
}
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var place_caret_at_horizontal_edge_exports = {};
|
|
30
|
+
__export(place_caret_at_horizontal_edge_exports, {
|
|
31
|
+
default: () => placeCaretAtHorizontalEdge
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Places the caret at start or end of a given element.
|
|
15
|
-
*
|
|
16
|
-
* @param {HTMLElement} container Focusable element.
|
|
17
|
-
* @param {boolean} isReverse True for end, false for start.
|
|
18
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(place_caret_at_horizontal_edge_exports);
|
|
34
|
+
var import_place_caret_at_edge = __toESM(require("./place-caret-at-edge"));
|
|
19
35
|
function placeCaretAtHorizontalEdge(container, isReverse) {
|
|
20
|
-
return (0,
|
|
36
|
+
return (0, import_place_caret_at_edge.default)(container, isReverse, void 0);
|
|
21
37
|
}
|
|
22
|
-
//# sourceMappingURL=place-caret-at-horizontal-edge.js.map
|
|
38
|
+
//# sourceMappingURL=place-caret-at-horizontal-edge.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/place-caret-at-horizontal-edge.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n */\nexport default function placeCaretAtHorizontalEdge( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAA6B;AAQd,SAAR,2BAA6C,WAAW,WAAY;AAC1E,aAAO,2BAAAA,SAAkB,WAAW,WAAW,MAAU;AAC1D;",
|
|
6
|
+
"names": ["placeCaretAtEdge"]
|
|
7
|
+
}
|
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var place_caret_at_vertical_edge_exports = {};
|
|
30
|
+
__export(place_caret_at_vertical_edge_exports, {
|
|
31
|
+
default: () => placeCaretAtVerticalEdge
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Places the caret at the top or bottom of a given element.
|
|
15
|
-
*
|
|
16
|
-
* @param {HTMLElement} container Focusable element.
|
|
17
|
-
* @param {boolean} isReverse True for bottom, false for top.
|
|
18
|
-
* @param {DOMRect} [rect] The rectangle to position the caret with.
|
|
19
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(place_caret_at_vertical_edge_exports);
|
|
34
|
+
var import_place_caret_at_edge = __toESM(require("./place-caret-at-edge"));
|
|
20
35
|
function placeCaretAtVerticalEdge(container, isReverse, rect) {
|
|
21
|
-
return (0,
|
|
36
|
+
return (0, import_place_caret_at_edge.default)(container, isReverse, rect?.left);
|
|
22
37
|
}
|
|
23
|
-
//# sourceMappingURL=place-caret-at-vertical-edge.js.map
|
|
38
|
+
//# sourceMappingURL=place-caret-at-vertical-edge.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/place-caret-at-vertical-edge.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAA6B;AASd,SAAR,yBAA2C,WAAW,WAAW,MAAO;AAC9E,aAAO,2BAAAA,SAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D;",
|
|
6
|
+
"names": ["placeCaretAtEdge"]
|
|
7
|
+
}
|
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var remove_invalid_html_exports = {};
|
|
30
|
+
__export(remove_invalid_html_exports, {
|
|
31
|
+
default: () => removeInvalidHTML
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Given a schema, unwraps or removes nodes, attributes and classes on HTML.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} HTML The HTML to clean up.
|
|
17
|
-
* @param {import('./clean-node-list').Schema} schema Schema for the HTML.
|
|
18
|
-
* @param {boolean} inline Whether to clean for inline mode.
|
|
19
|
-
*
|
|
20
|
-
* @return {string} The cleaned up HTML.
|
|
21
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(remove_invalid_html_exports);
|
|
34
|
+
var import_clean_node_list = __toESM(require("./clean-node-list"));
|
|
22
35
|
function removeInvalidHTML(HTML, schema, inline) {
|
|
23
|
-
const doc = document.implementation.createHTMLDocument(
|
|
36
|
+
const doc = document.implementation.createHTMLDocument("");
|
|
24
37
|
doc.body.innerHTML = HTML;
|
|
25
|
-
(0,
|
|
38
|
+
(0, import_clean_node_list.default)(doc.body.childNodes, doc, schema, inline);
|
|
26
39
|
return doc.body.innerHTML;
|
|
27
40
|
}
|
|
28
|
-
//# sourceMappingURL=remove-invalid-html.js.map
|
|
41
|
+
//# sourceMappingURL=remove-invalid-html.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/remove-invalid-html.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport cleanNodeList from './clean-node-list';\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on HTML.\n *\n * @param {string} HTML The HTML to clean up.\n * @param {import('./clean-node-list').Schema} schema Schema for the HTML.\n * @param {boolean} inline Whether to clean for inline mode.\n *\n * @return {string} The cleaned up HTML.\n */\nexport default function removeInvalidHTML( HTML, schema, inline ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\n\tdoc.body.innerHTML = HTML;\n\n\tcleanNodeList( doc.body.childNodes, doc, schema, inline );\n\n\treturn doc.body.innerHTML;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,6BAA0B;AAWX,SAAR,kBAAoC,MAAM,QAAQ,QAAS;AACjE,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAE3D,MAAI,KAAK,YAAY;AAErB,6BAAAA,SAAe,IAAI,KAAK,YAAY,KAAK,QAAQ,MAAO;AAExD,SAAO,IAAI,KAAK;AACjB;",
|
|
6
|
+
"names": ["cleanNodeList"]
|
|
7
|
+
}
|
package/build/dom/remove.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var remove_exports = {};
|
|
20
|
+
__export(remove_exports, {
|
|
21
|
+
default: () => remove
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Given a DOM node, removes it from the DOM.
|
|
14
|
-
*
|
|
15
|
-
* @param {Node} node Node to be removed.
|
|
16
|
-
* @return {void}
|
|
17
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(remove_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
18
25
|
function remove(node) {
|
|
19
|
-
(0,
|
|
26
|
+
(0, import_assert_is_defined.assertIsDefined)(node.parentNode, "node.parentNode");
|
|
20
27
|
node.parentNode.removeChild(node);
|
|
21
28
|
}
|
|
22
|
-
//# sourceMappingURL=remove.js.map
|
|
29
|
+
//# sourceMappingURL=remove.js.map
|
package/build/dom/remove.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/remove.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param {Node} node Node to be removed.\n * @return {void}\n */\nexport default function remove( node ) {\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.removeChild( node );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAQjB,SAAR,OAAyB,MAAO;AACtC,gDAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,YAAa,IAAK;AACnC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/dom/replace-tag.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var replace_tag_exports = {};
|
|
20
|
+
__export(replace_tag_exports, {
|
|
21
|
+
default: () => replaceTag
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Replaces the given node with a new node with the given tag name.
|
|
14
|
-
*
|
|
15
|
-
* @param {Element} node The node to replace
|
|
16
|
-
* @param {string} tagName The new tag name.
|
|
17
|
-
*
|
|
18
|
-
* @return {Element} The new node.
|
|
19
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(replace_tag_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
20
25
|
function replaceTag(node, tagName) {
|
|
21
26
|
const newNode = node.ownerDocument.createElement(tagName);
|
|
22
27
|
while (node.firstChild) {
|
|
23
28
|
newNode.appendChild(node.firstChild);
|
|
24
29
|
}
|
|
25
|
-
(0,
|
|
30
|
+
(0, import_assert_is_defined.assertIsDefined)(node.parentNode, "node.parentNode");
|
|
26
31
|
node.parentNode.replaceChild(newNode, node);
|
|
27
32
|
return newNode;
|
|
28
33
|
}
|
|
29
|
-
//# sourceMappingURL=replace-tag.js.map
|
|
34
|
+
//# sourceMappingURL=replace-tag.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/replace-tag.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAUjB,SAAR,WAA6B,MAAM,SAAU;AACnD,QAAM,UAAU,KAAK,cAAc,cAAe,OAAQ;AAE1D,SAAQ,KAAK,YAAa;AACzB,YAAQ,YAAa,KAAK,UAAW;AAAA,EACtC;AAEA,gDAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,aAAc,SAAS,IAAK;AAE5C,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|