@wordpress/dom 3.55.0 → 3.57.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/build/data-transfer.js.map +1 -1
- package/build/dom/caret-range-from-point.js.map +1 -1
- package/build/dom/clean-node-list.js.map +1 -1
- package/build/dom/compute-caret-rect.js.map +1 -1
- package/build/dom/document-has-selection.js.map +1 -1
- package/build/dom/document-has-text-selection.js.map +1 -1
- package/build/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/get-computed-style.js.map +1 -1
- package/build/dom/get-offset-parent.js.map +1 -1
- package/build/dom/get-range-height.js.map +1 -1
- package/build/dom/get-rectangle-from-range.js +12 -4
- package/build/dom/get-rectangle-from-range.js.map +1 -1
- package/build/dom/get-scroll-container.js.map +1 -1
- package/build/dom/hidden-caret-range-from-point.js.map +1 -1
- package/build/dom/index.js.map +1 -1
- package/build/dom/input-field-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/insert-after.js.map +1 -1
- package/build/dom/is-edge.js.map +1 -1
- package/build/dom/is-element.js.map +1 -1
- package/build/dom/is-empty.js.map +1 -1
- package/build/dom/is-entirely-selected.js.map +1 -1
- package/build/dom/is-form-element.js.map +1 -1
- package/build/dom/is-horizontal-edge.js.map +1 -1
- package/build/dom/is-html-input-element.js.map +1 -1
- package/build/dom/is-input-or-text-area.js.map +1 -1
- package/build/dom/is-number-input.js.map +1 -1
- package/build/dom/is-rtl.js.map +1 -1
- package/build/dom/is-selection-forward.js.map +1 -1
- package/build/dom/is-text-field.js.map +1 -1
- package/build/dom/is-vertical-edge.js.map +1 -1
- package/build/dom/place-caret-at-edge.js +3 -1
- package/build/dom/place-caret-at-edge.js.map +1 -1
- package/build/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build/dom/remove-invalid-html.js.map +1 -1
- package/build/dom/remove.js.map +1 -1
- package/build/dom/replace-tag.js.map +1 -1
- package/build/dom/replace.js.map +1 -1
- package/build/dom/safe-html.js.map +1 -1
- package/build/dom/scroll-if-no-range.js.map +1 -1
- package/build/dom/strip-html.js.map +1 -1
- package/build/dom/unwrap.js.map +1 -1
- package/build/dom/wrap.js.map +1 -1
- package/build/focusable.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/phrasing-content.js.map +1 -1
- package/build/tabbable.js.map +1 -1
- package/build/utils/assert-is-defined.js.map +1 -1
- package/build-module/data-transfer.js.map +1 -1
- package/build-module/dom/caret-range-from-point.js.map +1 -1
- package/build-module/dom/clean-node-list.js.map +1 -1
- package/build-module/dom/compute-caret-rect.js.map +1 -1
- package/build-module/dom/document-has-selection.js.map +1 -1
- package/build-module/dom/document-has-text-selection.js.map +1 -1
- package/build-module/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build-module/dom/get-computed-style.js.map +1 -1
- package/build-module/dom/get-offset-parent.js.map +1 -1
- package/build-module/dom/get-range-height.js.map +1 -1
- package/build-module/dom/get-rectangle-from-range.js +12 -4
- package/build-module/dom/get-rectangle-from-range.js.map +1 -1
- package/build-module/dom/get-scroll-container.js.map +1 -1
- package/build-module/dom/hidden-caret-range-from-point.js.map +1 -1
- package/build-module/dom/index.js.map +1 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.js.map +1 -1
- package/build-module/dom/insert-after.js.map +1 -1
- package/build-module/dom/is-edge.js.map +1 -1
- package/build-module/dom/is-element.js.map +1 -1
- package/build-module/dom/is-empty.js.map +1 -1
- package/build-module/dom/is-entirely-selected.js.map +1 -1
- package/build-module/dom/is-form-element.js.map +1 -1
- package/build-module/dom/is-horizontal-edge.js.map +1 -1
- package/build-module/dom/is-html-input-element.js.map +1 -1
- package/build-module/dom/is-input-or-text-area.js.map +1 -1
- package/build-module/dom/is-number-input.js.map +1 -1
- package/build-module/dom/is-rtl.js.map +1 -1
- package/build-module/dom/is-selection-forward.js.map +1 -1
- package/build-module/dom/is-text-field.js.map +1 -1
- package/build-module/dom/is-vertical-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-edge.js +3 -1
- package/build-module/dom/place-caret-at-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build-module/dom/remove-invalid-html.js.map +1 -1
- package/build-module/dom/remove.js.map +1 -1
- package/build-module/dom/replace-tag.js.map +1 -1
- package/build-module/dom/replace.js.map +1 -1
- package/build-module/dom/safe-html.js.map +1 -1
- package/build-module/dom/scroll-if-no-range.js.map +1 -1
- package/build-module/dom/strip-html.js.map +1 -1
- package/build-module/dom/unwrap.js.map +1 -1
- package/build-module/dom/wrap.js.map +1 -1
- package/build-module/focusable.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/phrasing-content.js.map +1 -1
- package/build-module/tabbable.js.map +1 -1
- package/build-module/utils/assert-is-defined.js.map +1 -1
- package/build-types/dom/caret-range-from-point.d.ts +1 -1
- package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/clean-node-list.d.ts.map +1 -1
- package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/dom/get-rectangle-from-range.js +12 -4
- package/src/dom/place-caret-at-edge.js +3 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"sources":["@wordpress/dom/src/data-transfer.js"],"sourcesContent":["/**\n * Gets all files from a DataTransfer object.\n *\n * @param {DataTransfer} dataTransfer DataTransfer object to inspect.\n *\n * @return {File[]} An array containing all files.\n */\nexport function getFilesFromDataTransfer( dataTransfer ) {\n\tconst files = Array.from( dataTransfer.files );\n\n\tArray.from( dataTransfer.items ).forEach( ( item ) => {\n\t\tconst file = item.getAsFile();\n\n\t\tif (\n\t\t\tfile &&\n\t\t\t! files.find(\n\t\t\t\t( { name, type, size } ) =>\n\t\t\t\t\tname === file.name &&\n\t\t\t\t\ttype === file.type &&\n\t\t\t\t\tsize === file.size\n\t\t\t)\n\t\t) {\n\t\t\tfiles.push( file );\n\t\t}\n\t} );\n\n\treturn files;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CAAEC,YAAY,EAAG;EACxD,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACC,KAAM,CAAC;EAE9CC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACI,KAAM,CAAC,CAACC,OAAO,CAAIC,IAAI,IAAM;IACrD,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAAC,CAAC;IAE7B,IACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAI,CACX,CAAE;MAAEC,IAAI;MAAEC,IAAI;MAAEC;IAAK,CAAC,KACrBF,IAAI,KAAKH,IAAI,CAACG,IAAI,IAClBC,IAAI,KAAKJ,IAAI,CAACI,IAAI,IAClBC,IAAI,KAAKL,IAAI,CAACK,IAChB,CAAC,EACA;MACDX,KAAK,CAACY,IAAI,CAAEN,IAAK,CAAC;IACnB;EACD,CAAE,CAAC;EAEH,OAAON,KAAK;AACb"}
|
1
|
+
{"version":3,"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"sources":["@wordpress/dom/src/data-transfer.js"],"sourcesContent":["/**\n * Gets all files from a DataTransfer object.\n *\n * @param {DataTransfer} dataTransfer DataTransfer object to inspect.\n *\n * @return {File[]} An array containing all files.\n */\nexport function getFilesFromDataTransfer( dataTransfer ) {\n\tconst files = Array.from( dataTransfer.files );\n\n\tArray.from( dataTransfer.items ).forEach( ( item ) => {\n\t\tconst file = item.getAsFile();\n\n\t\tif (\n\t\t\tfile &&\n\t\t\t! files.find(\n\t\t\t\t( { name, type, size } ) =>\n\t\t\t\t\tname === file.name &&\n\t\t\t\t\ttype === file.type &&\n\t\t\t\t\tsize === file.size\n\t\t\t)\n\t\t) {\n\t\t\tfiles.push( file );\n\t\t}\n\t} );\n\n\treturn files;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CAAEC,YAAY,EAAG;EACxD,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACC,KAAM,CAAC;EAE9CC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACI,KAAM,CAAC,CAACC,OAAO,CAAIC,IAAI,IAAM;IACrD,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAAC,CAAC;IAE7B,IACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAI,CACX,CAAE;MAAEC,IAAI;MAAEC,IAAI;MAAEC;IAAK,CAAC,KACrBF,IAAI,KAAKH,IAAI,CAACG,IAAI,IAClBC,IAAI,KAAKJ,IAAI,CAACI,IAAI,IAClBC,IAAI,KAAKL,IAAI,CAACK,IAChB,CAAC,EACA;MACDX,KAAK,CAACY,IAAI,CAAEN,IAAK,CAAC;IACnB;EACD,CAAE,CAAC;EAEH,OAAON,KAAK;AACb","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["caretRangeFromPoint","doc","x","y","caretPositionFromPoint","point","range","createRange","setStart","offsetNode","offset","collapse"],"sources":["@wordpress/dom/src/dom/caret-range-from-point.js"],"sourcesContent":["/**\n * Polyfill.\n * Get a collapsed range for a given point.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n *\n * @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n *\n * @return {Range | null} The best range for the given point.\n */\nexport default function caretRangeFromPoint( doc, x, y ) {\n\tif ( doc.caretRangeFromPoint ) {\n\t\treturn doc.caretRangeFromPoint( x, y );\n\t}\n\n\tif ( ! doc.caretPositionFromPoint ) {\n\t\treturn null;\n\t}\n\n\tconst point = doc.caretPositionFromPoint( x, y );\n\n\t// If x or y are negative, outside viewport, or there is no text entry node.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n\tif ( ! point ) {\n\t\treturn null;\n\t}\n\n\tconst range = doc.createRange();\n\n\trange.setStart( point.offsetNode, point.offset );\n\trange.collapse( true );\n\n\treturn range;\n}\n\n/**\n * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint\n * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition\n */\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAmBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAG;EACxD,IAAKF,GAAG,CAACD,mBAAmB,EAAG;IAC9B,OAAOC,GAAG,CAACD,mBAAmB,CAAEE,CAAC,EAAEC,CAAE,CAAC;EACvC;EAEA,IAAK,CAAEF,GAAG,CAACG,sBAAsB,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGJ,GAAG,CAACG,sBAAsB,CAAEF,CAAC,EAAEC,CAAE,CAAC;;EAEhD;EACA;EACA,IAAK,CAAEE,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGL,GAAG,CAACM,WAAW,CAAC,CAAC;EAE/BD,KAAK,CAACE,QAAQ,CAAEH,KAAK,CAACI,UAAU,EAAEJ,KAAK,CAACK,MAAO,CAAC;EAChDJ,KAAK,CAACK,QAAQ,CAAE,IAAK,CAAC;EAEtB,OAAOL,KAAK;AACb;;AAEA;AACA;AACA;AACA"}
|
1
|
+
{"version":3,"names":["caretRangeFromPoint","doc","x","y","caretPositionFromPoint","point","range","createRange","setStart","offsetNode","offset","collapse"],"sources":["@wordpress/dom/src/dom/caret-range-from-point.js"],"sourcesContent":["/**\n * Polyfill.\n * Get a collapsed range for a given point.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n *\n * @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n *\n * @return {Range | null} The best range for the given point.\n */\nexport default function caretRangeFromPoint( doc, x, y ) {\n\tif ( doc.caretRangeFromPoint ) {\n\t\treturn doc.caretRangeFromPoint( x, y );\n\t}\n\n\tif ( ! doc.caretPositionFromPoint ) {\n\t\treturn null;\n\t}\n\n\tconst point = doc.caretPositionFromPoint( x, y );\n\n\t// If x or y are negative, outside viewport, or there is no text entry node.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n\tif ( ! point ) {\n\t\treturn null;\n\t}\n\n\tconst range = doc.createRange();\n\n\trange.setStart( point.offsetNode, point.offset );\n\trange.collapse( true );\n\n\treturn range;\n}\n\n/**\n * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint\n * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition\n */\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAmBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAG;EACxD,IAAKF,GAAG,CAACD,mBAAmB,EAAG;IAC9B,OAAOC,GAAG,CAACD,mBAAmB,CAAEE,CAAC,EAAEC,CAAE,CAAC;EACvC;EAEA,IAAK,CAAEF,GAAG,CAACG,sBAAsB,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGJ,GAAG,CAACG,sBAAsB,CAAEF,CAAC,EAAEC,CAAE,CAAC;;EAEhD;EACA;EACA,IAAK,CAAEE,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGL,GAAG,CAACM,WAAW,CAAC,CAAC;EAE/BD,KAAK,CAACE,QAAQ,CAAEH,KAAK,CAACI,UAAU,EAAEJ,KAAK,CAACK,MAAO,CAAC;EAChDJ,KAAK,CAACK,QAAQ,CAAE,IAAK,CAAC;EAEtB,OAAOL,KAAK;AACb;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isEmpty","_interopRequireDefault","require","_remove","_unwrap","_phrasingContent","_insertAfter","_isElement","noop","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","isElement","attributes","classes","children","allowEmpty","isEmpty","remove","hasAttributes","name","includes","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","unwrap","parentNode","isPhrasingContent","child","firstChild","nextElementSibling","insertAfter","createElement"],"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\nconst noop = () => {};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach(\n\t\t( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {\n\t\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t\t// function, or with an isMatch function that matches the node.\n\t\t\tif (\n\t\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t\t) {\n\t\t\t\tif ( isElement( node ) ) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tattributes = [],\n\t\t\t\t\t\tclasses = [],\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trequire = [],\n\t\t\t\t\t\tallowEmpty,\n\t\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t\t// remove the node.\n\t\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\t\tremove( node );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t\t! attributes.includes( name )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => className === item;\n\t\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => item.test( className );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t\t( child ) =>\n\t\t\t\t\t\t\t\t\t\t\t! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t\t} else {\n\t\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t\t// are not phrasing content.\n\t\t\t\tif (\n\t\t\t\t\tinline &&\n\t\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\t\tnode.nextElementSibling\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t\t}\n\n\t\t\t\tunwrap( node );\n\t\t\t}\n\t\t}\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AARA;AACA;AACA;;AAQA,MAAMM,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,aAAaA,CAAEC,QAAQ,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAG;EACtEC,KAAK,CAACC,IAAI,CAAEL,QAAS,CAAC,CAACM,OAAO,CAC7B,EAAE,sDAAuDC,IAAI,KAAM;IAClE,MAAMC,GAAG,GAAGD,IAAI,CAACE,QAAQ,CAACC,WAAW,CAAC,CAAC;;IAEvC;IACA;IACA,IACCR,MAAM,CAACS,cAAc,CAAEH,GAAI,CAAC,KAC1B,CAAEN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cACNR,aAAa,CACZQ,IAAI,CAAC6B,UAAU,EACfnC,GAAG,EACHe,QAAQ,EACRb,MACD,CAAC;YACF;YACA;UACD,CAAC,MAAM;YACN,OAAQI,IAAI,CAACkC,UAAU,EAAG;cACzB,IAAAtB,eAAM,EAAEZ,IAAI,CAACkC,UAAW,CAAC;YAC1B;UACD;QACD;MACD;MACA;IACD,CAAC,MAAM;MACN1C,aAAa,CAAEQ,IAAI,CAAC6B,UAAU,EAAEnC,GAAG,EAAEC,MAAM,EAAEC,MAAO,CAAC;;MAErD;MACA;MACA,IACCA,MAAM,IACN,CAAE,IAAAoC,kCAAiB,EAAEhC,IAAK,CAAC,IAC3BA,IAAI,CAACmC,kBAAkB,EACtB;QACD,IAAAC,oBAAW,EAAE1C,GAAG,CAAC2C,aAAa,CAAE,IAAK,CAAC,EAAErC,IAAK,CAAC;MAC/C;MAEA,IAAA8B,eAAM,EAAE9B,IAAK,CAAC;IACf;EACD,CACD,CAAC;AACF"}
|
1
|
+
{"version":3,"names":["_isEmpty","_interopRequireDefault","require","_remove","_unwrap","_phrasingContent","_insertAfter","_isElement","noop","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","isElement","attributes","classes","children","allowEmpty","isEmpty","remove","hasAttributes","name","includes","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","unwrap","parentNode","isPhrasingContent","child","firstChild","nextElementSibling","insertAfter","createElement"],"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\nconst noop = () => {};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach(\n\t\t( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {\n\t\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t\t// function, or with an isMatch function that matches the node.\n\t\t\tif (\n\t\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t\t) {\n\t\t\t\tif ( isElement( node ) ) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tattributes = [],\n\t\t\t\t\t\tclasses = [],\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trequire = [],\n\t\t\t\t\t\tallowEmpty,\n\t\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t\t// remove the node.\n\t\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\t\tremove( node );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t\t! attributes.includes( name )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => className === item;\n\t\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => item.test( className );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t\t( child ) =>\n\t\t\t\t\t\t\t\t\t\t\t! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t\t} else {\n\t\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t\t// are not phrasing content.\n\t\t\t\tif (\n\t\t\t\t\tinline &&\n\t\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\t\tnode.nextElementSibling\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t\t}\n\n\t\t\t\tunwrap( node );\n\t\t\t}\n\t\t}\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AARA;AACA;AACA;;AAQA,MAAMM,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,aAAaA,CAAEC,QAAQ,EAAEC,GAA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AI,CAAC6B,UAAU,EACfnC,GAAG,EACHC,MAAM,EACNC,MACD,CAAC;cAED,IACCC,KAAK,CAACC,IAAI,CAAEE,IAAI,CAAC6B,UAAW,CAAC,CAACJ,IAAI,CAC/BQ,KAAK,IACN,CAAE,IAAAD,kCAAiB,EAAEC,KAAM,CAC7B,CAAC,EACA;gBACD,IAAAH,eAAM,EAAE9B,IAAK,CAAC;cACf;YACD,CAAC,MAAM;cACNR,aAAa,CACZQ,IAAI,CAAC6B,UAAU,EACfnC,GAAG,EACHe,QAAQ,EACRb,MACD,CAAC;YACF;YACA;UACD,CAAC,MAAM;YACN,OAAQI,IAAI,CAACkC,UAAU,EAAG;cACzB,IAAAtB,eAAM,EAAEZ,IAAI,CAACkC,UAAW,CAAC;YAC1B;UACD;QACD;MACD;MACA;IACD,CAAC,MAAM;MACN1C,aAAa,CAAEQ,IAAI,CAAC6B,UAAU,EAAEnC,GAAG,EAAEC,MAAM,EAAEC,MAAO,CAAC;;MAErD;MACA;MACA,IACCA,MAAM,IACN,CAAE,IAAAoC,kCAAiB,EAAEhC,IAAK,CAAC,IAC3BA,IAAI,CAACmC,kBAAkB,EACtB;QACD,IAAAC,oBAAW,EAAE1C,GAAG,CAAC2C,aAAa,CAAE,IAAK,CAAC,EAAErC,IAAK,CAAC;MAC/C;MAEA,IAAA8B,eAAM,EAAE9B,IAAK,CAAC;IACf;EACD,CACD,CAAC;AACF","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_getRectangleFromRange","_interopRequireDefault","require","_assertIsDefined","computeCaretRect","win","selection","getSelection","assertIsDefined","range","rangeCount","getRangeAt","getRectangleFromRange"],"sources":["@wordpress/dom/src/dom/compute-caret-rect.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle for the selection in a container.\n *\n * @param {Window} win The window of the selection.\n *\n * @return {DOMRect | null} The rectangle.\n */\nexport default function computeCaretRect( win ) {\n\tconst selection = win.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn null;\n\t}\n\n\treturn getRectangleFromRange( range );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,gBAAgBA,CAAEC,GAAG,EAAG;EAC/C,MAAMC,SAAS,GAAGD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,IAAAC,gCAAe,EAAEF,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMG,KAAK,GAAGH,SAAS,CAACI,UAAU,GAAGJ,SAAS,CAACK,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EAErE,IAAK,CAAEF,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAG,8BAAqB,EAAEH,KAAM,CAAC;AACtC"}
|
1
|
+
{"version":3,"names":["_getRectangleFromRange","_interopRequireDefault","require","_assertIsDefined","computeCaretRect","win","selection","getSelection","assertIsDefined","range","rangeCount","getRangeAt","getRectangleFromRange"],"sources":["@wordpress/dom/src/dom/compute-caret-rect.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle for the selection in a container.\n *\n * @param {Window} win The window of the selection.\n *\n * @return {DOMRect | null} The rectangle.\n */\nexport default function computeCaretRect( win ) {\n\tconst selection = win.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn null;\n\t}\n\n\treturn getRectangleFromRange( range );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,gBAAgBA,CAAEC,GAAG,EAAG;EAC/C,MAAMC,SAAS,GAAGD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,IAAAC,gCAAe,EAAEF,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMG,KAAK,GAAGH,SAAS,CAACI,UAAU,GAAGJ,SAAS,CAACK,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EAErE,IAAK,CAAEF,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAG,8BAAqB,EAAEH,KAAM,CAAC;AACtC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isTextField","_interopRequireDefault","require","_isHtmlInputElement","_documentHasTextSelection","documentHasSelection","doc","activeElement","isHTMLInputElement","isTextField","documentHasTextSelection"],"sources":["@wordpress/dom/src/dom/document-has-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\nimport documentHasTextSelection from './document-has-text-selection';\n\n/**\n * Check whether the current document has a selection. This includes focus in\n * input fields, textareas, and general rich-text selection.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasSelection( doc ) {\n\treturn (\n\t\t!! doc.activeElement &&\n\t\t( isHTMLInputElement( doc.activeElement ) ||\n\t\t\tisTextField( doc.activeElement ) ||\n\t\t\tdocumentHasTextSelection( doc ) )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,yBAAA,GAAAH,sBAAA,CAAAC,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,oBAAoBA,CAAEC,GAAG,EAAG;EACnD,OACC,CAAC,CAAEA,GAAG,CAACC,aAAa,KAClB,IAAAC,2BAAkB,EAAEF,GAAG,CAACC,aAAc,CAAC,IACxC,IAAAE,oBAAW,EAAEH,GAAG,CAACC,aAAc,CAAC,IAChC,IAAAG,iCAAwB,EAAEJ,GAAI,CAAC,CAAE;AAEpC"}
|
1
|
+
{"version":3,"names":["_isTextField","_interopRequireDefault","require","_isHtmlInputElement","_documentHasTextSelection","documentHasSelection","doc","activeElement","isHTMLInputElement","isTextField","documentHasTextSelection"],"sources":["@wordpress/dom/src/dom/document-has-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\nimport documentHasTextSelection from './document-has-text-selection';\n\n/**\n * Check whether the current document has a selection. This includes focus in\n * input fields, textareas, and general rich-text selection.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasSelection( doc ) {\n\treturn (\n\t\t!! doc.activeElement &&\n\t\t( isHTMLInputElement( doc.activeElement ) ||\n\t\t\tisTextField( doc.activeElement ) ||\n\t\t\tdocumentHasTextSelection( doc ) )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,yBAAA,GAAAH,sBAAA,CAAAC,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,oBAAoBA,CAAEC,GAAG,EAAG;EACnD,OACC,CAAC,CAAEA,GAAG,CAACC,aAAa,KAClB,IAAAC,2BAAkB,EAAEF,GAAG,CAACC,aAAc,CAAC,IACxC,IAAAE,oBAAW,EAAEH,GAAG,CAACC,aAAc,CAAC,IAChC,IAAAG,iCAAwB,EAAEJ,GAAI,CAAC,CAAE;AAEpC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","documentHasTextSelection","doc","assertIsDefined","defaultView","selection","getSelection","range","rangeCount","getRangeAt","collapsed"],"sources":["@wordpress/dom/src/dom/document-has-text-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc ) {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,wBAAwBA,CAAEC,GAAG,EAAG;EACvD,IAAAC,gCAAe,EAAED,GAAG,CAACE,WAAW,EAAE,iBAAkB,CAAC;EACrD,MAAMC,SAAS,GAAGH,GAAG,CAACE,WAAW,CAACE,YAAY,CAAC,CAAC;EAChD,IAAAH,gCAAe,EAAEE,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EACrE,OAAO,CAAC,CAAEF,KAAK,IAAI,CAAEA,KAAK,CAACG,SAAS;AACrC"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","documentHasTextSelection","doc","assertIsDefined","defaultView","selection","getSelection","range","rangeCount","getRangeAt","collapsed"],"sources":["@wordpress/dom/src/dom/document-has-text-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc ) {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,wBAAwBA,CAAEC,GAAG,EAAG;EACvD,IAAAC,gCAAe,EAAED,GAAG,CAACE,WAAW,EAAE,iBAAkB,CAAC;EACrD,MAAMC,SAAS,GAAGH,GAAG,CAACE,WAAW,CAACE,YAAY,CAAC,CAAC;EAChD,IAAAH,gCAAe,EAAEE,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EACrE,OAAO,CAAC,CAAEF,KAAK,IAAI,CAAEA,KAAK,CAACG,SAAS;AACrC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_documentHasTextSelection","_interopRequireDefault","require","_inputFieldHasUncollapsedSelection","documentHasUncollapsedSelection","doc","documentHasTextSelection","activeElement","inputFieldHasUncollapsedSelection"],"sources":["@wordpress/dom/src/dom/document-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection( doc ) {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kCAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,+BAA+BA,CAAEC,GAAG,EAAG;EAC9D,OACC,IAAAC,iCAAwB,EAAED,GAAI,CAAC,IAC7B,CAAC,CAAEA,GAAG,CAACE,aAAa,IACrB,IAAAC,0CAAiC,EAAEH,GAAG,CAACE,aAAc,CAAG;AAE3D"}
|
1
|
+
{"version":3,"names":["_documentHasTextSelection","_interopRequireDefault","require","_inputFieldHasUncollapsedSelection","documentHasUncollapsedSelection","doc","documentHasTextSelection","activeElement","inputFieldHasUncollapsedSelection"],"sources":["@wordpress/dom/src/dom/document-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection( doc ) {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kCAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,+BAA+BA,CAAEC,GAAG,EAAG;EAC9D,OACC,IAAAC,iCAAwB,EAAED,GAAI,CAAC,IAC7B,CAAC,CAAEA,GAAG,CAACE,aAAa,IACrB,IAAAC,0CAAiC,EAAEH,GAAG,CAACE,aAAc,CAAG;AAE3D","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","getComputedStyle","element","assertIsDefined","ownerDocument","defaultView"],"sources":["@wordpress/dom/src/dom/get-computed-style.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.\n */\nexport default function getComputedStyle( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAEC,OAAO,EAAG;EACnD;EACA,IAAAC,gCAAe,EACdD,OAAO,CAACE,aAAa,CAACC,WAAW,EACjC,mCACD,CAAC;EACD,OAAOH,OAAO,CAACE,aAAa,CAACC,WAAW,CAACJ,gBAAgB,CAAEC,OAAQ,CAAC;AACrE"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","getComputedStyle","element","assertIsDefined","ownerDocument","defaultView"],"sources":["@wordpress/dom/src/dom/get-computed-style.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.\n */\nexport default function getComputedStyle( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAEC,OAAO,EAAG;EACnD;EACA,IAAAC,gCAAe,EACdD,OAAO,CAACE,aAAa,CAACC,WAAW,EACjC,mCACD,CAAC;EACD,OAAOH,OAAO,CAACE,aAAa,CAACC,WAAW,CAACJ,gBAAgB,CAAEC,OAAQ,CAAC;AACrE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","getOffsetParent","node","closestElement","parentNode","nodeType","ELEMENT_NODE","getComputedStyle","position","offsetParent"],"sources":["@wordpress/dom/src/dom/get-offset-parent.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param {Node} node Node from which to find offset parent.\n *\n * @return {Node | null} Offset parent.\n */\nexport default function getOffsetParent( node ) {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement;\n\twhile ( ( closestElement = /** @type {Node} */ ( node.parentNode ) ) ) {\n\t\tif ( closestElement.nodeType === closestElement.ELEMENT_NODE ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif (\n\t\tgetComputedStyle( /** @type {Element} */ ( closestElement ) )\n\t\t\t.position !== 'static'\n\t) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn /** @type {Node & { offsetParent: Node }} */ ( closestElement )\n\t\t.offsetParent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,eAAeA,CAAEC,IAAI,EAAG;EAC/C;EACA;EACA,IAAIC,cAAc;EAClB,OAAUA,cAAc,GAAG,mBAAsBD,IAAI,CAACE,UAAY,EAAK;IACtE,IAAKD,cAAc,CAACE,QAAQ,KAAKF,cAAc,CAACG,YAAY,EAAG;MAC9D;IACD;EACD;EAEA,IAAK,CAAEH,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;;EAEA;EACA;EACA,IACC,IAAAI,yBAAgB,GAAE,sBAAyBJ,cAAiB,CAAC,CAC3DK,QAAQ,KAAK,QAAQ,EACtB;IACD,OAAOL,cAAc;EACtB;;EAEA;EACA,OAAO,4CAA+CA,cAAc,CAClEM,YAAY;AACf"}
|
1
|
+
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","getOffsetParent","node","closestElement","parentNode","nodeType","ELEMENT_NODE","getComputedStyle","position","offsetParent"],"sources":["@wordpress/dom/src/dom/get-offset-parent.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param {Node} node Node from which to find offset parent.\n *\n * @return {Node | null} Offset parent.\n */\nexport default function getOffsetParent( node ) {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement;\n\twhile ( ( closestElement = /** @type {Node} */ ( node.parentNode ) ) ) {\n\t\tif ( closestElement.nodeType === closestElement.ELEMENT_NODE ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif (\n\t\tgetComputedStyle( /** @type {Element} */ ( closestElement ) )\n\t\t\t.position !== 'static'\n\t) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn /** @type {Node & { offsetParent: Node }} */ ( closestElement )\n\t\t.offsetParent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,eAAeA,CAAEC,IAAI,EAAG;EAC/C;EACA;EACA,IAAIC,cAAc;EAClB,OAAUA,cAAc,GAAG,mBAAsBD,IAAI,CAACE,UAAY,EAAK;IACtE,IAAKD,cAAc,CAACE,QAAQ,KAAKF,cAAc,CAACG,YAAY,EAAG;MAC9D;IACD;EACD;EAEA,IAAK,CAAEH,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;;EAEA;EACA;EACA,IACC,IAAAI,yBAAgB,GAAE,sBAAyBJ,cAAiB,CAAC,CAC3DK,QAAQ,KAAK,QAAQ,EACtB;IACD,OAAOL,cAAc;EACtB;;EAEA;EACA,OAAO,4CAA+CA,cAAc,CAClEM,YAAY;AACf","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"sources":["@wordpress/dom/src/dom/get-range-height.js"],"sourcesContent":["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param {Range} range The range to check.\n * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range ) {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAcA,CAAEC,KAAK,EAAG;EAC/C,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,KAAK,CAACI,cAAc,CAAC,CAAE,CAAC;EAElD,IAAK,CAAEH,KAAK,CAACI,MAAM,EAAG;IACrB;EACD;EAEA,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAE,GAAGP,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEC;EAAI,CAAC,KAAMA,GAAI,CAAE,CAAC;EACjE,MAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAG,CAAE,GAAGX,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEI;EAAO,CAAC,KAAMA,MAAO,CAAE,CAAC;EAEzE,OAAOF,YAAY,GAAGL,UAAU;AACjC"}
|
1
|
+
{"version":3,"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"sources":["@wordpress/dom/src/dom/get-range-height.js"],"sourcesContent":["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param {Range} range The range to check.\n * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range ) {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAcA,CAAEC,KAAK,EAAG;EAC/C,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,KAAK,CAACI,cAAc,CAAC,CAAE,CAAC;EAElD,IAAK,CAAEH,KAAK,CAACI,MAAM,EAAG;IACrB;EACD;EAEA,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAE,GAAGP,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEC;EAAI,CAAC,KAAMA,GAAI,CAAE,CAAC;EACjE,MAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAG,CAAE,GAAGX,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEI;EAAO,CAAC,KAAMA,MAAO,CAAE,CAAC;EAEzE,OAAOF,YAAY,GAAGL,UAAU;AACjC","ignoreList":[]}
|
@@ -53,10 +53,18 @@ function getRectangleFromRange(range) {
|
|
53
53
|
left,
|
54
54
|
right
|
55
55
|
} of filteredRects) {
|
56
|
-
if (top < furthestTop)
|
57
|
-
|
58
|
-
|
59
|
-
if (
|
56
|
+
if (top < furthestTop) {
|
57
|
+
furthestTop = top;
|
58
|
+
}
|
59
|
+
if (bottom > furthestBottom) {
|
60
|
+
furthestBottom = bottom;
|
61
|
+
}
|
62
|
+
if (left < furthestLeft) {
|
63
|
+
furthestLeft = left;
|
64
|
+
}
|
65
|
+
if (right > furthestRight) {
|
66
|
+
furthestRight = right;
|
67
|
+
}
|
60
68
|
}
|
61
69
|
return new window.DOMRect(furthestLeft, furthestTop, furthestRight - furthestLeft, furthestBottom - furthestTop);
|
62
70
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","assertIsDefined","index","childNodes","indexOf","createRange","setStart","setEnd","rect","height","padNode","createTextNode","cloneRange","insertNode","removeChild"],"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop )
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","assertIsDefined","index","childNodes","indexOf","createRange","setStart","setEnd","rect","height","padNode","createTextNode","cloneRange","insertNode","removeChild"],"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) {\n\t\t\t\tfurthestTop = top;\n\t\t\t}\n\t\t\tif ( bottom > furthestBottom ) {\n\t\t\t\tfurthestBottom = bottom;\n\t\t\t}\n\t\t\tif ( left < furthestLeft ) {\n\t\t\t\tfurthestLeft = left;\n\t\t\t}\n\t\t\tif ( right > furthestRight ) {\n\t\t\t\tfurthestRight = right;\n\t\t\t}\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD;EACA;EACA;EACA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U,OAAO,CAACV,UAAU,CAACc,WAAW,CAAEJ,OAAQ,CAAC;EAC1C;EAEA,OAAOF,IAAI;AACZ","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","getScrollContainer","node","direction","undefined","scrollHeight","clientHeight","overflowY","getComputedStyle","test","scrollWidth","clientWidth","overflowX","ownerDocument","parentNode"],"sources":["@wordpress/dom/src/dom/get-scroll-container.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,kBAAkBA,CAAEC,IAAI,EAAEC,SAAS,GAAG,UAAU,EAAG;EAC1E,IAAK,CAAED,IAAI,EAAG;IACb,OAAOE,SAAS;EACjB;EAEA,IAAKD,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,KAAK,EAAG;IACtD;IACA,IAAKD,IAAI,CAACG,YAAY,GAAGH,IAAI,CAACI,YAAY,EAAG;MAC5C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAG,IAAAC,yBAAgB,EAAEN,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACO,IAAI,CAAEF,SAAU,CAAC,EAAG;QACxC,OAAOL,IAAI;MACZ;IACD;EACD;EAEA,IAAKC,SAAS,KAAK,YAAY,IAAIA,SAAS,KAAK,KAAK,EAAG;IACxD;IACA,IAAKD,IAAI,CAACQ,WAAW,GAAGR,IAAI,CAACS,WAAW,EAAG;MAC1C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAG,IAAAJ,yBAAgB,EAAEN,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACO,IAAI,CAAEG,SAAU,CAAC,EAAG;QACxC,OAAOV,IAAI;MACZ;IACD;EACD;EAEA,IAAKA,IAAI,CAACW,aAAa,KAAKX,IAAI,CAACY,UAAU,EAAG;IAC7C,OAAOZ,IAAI;EACZ;;EAEA;EACA,OAAOD,kBAAkB,EACxB,sBAAyBC,IAAI,CAACY,UAAU,EACxCX,SACD,CAAC;AACF"}
|
1
|
+
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","getScrollContainer","node","direction","undefined","scrollHeight","clientHeight","overflowY","getComputedStyle","test","scrollWidth","clientWidth","overflowX","ownerDocument","parentNode"],"sources":["@wordpress/dom/src/dom/get-scroll-container.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,kBAAkBA,CAAEC,IAAI,EAAEC,SAAS,GAAG,UAAU,EAAG;EAC1E,IAAK,CAAED,IAAI,EAAG;IACb,OAAOE,SAAS;EACjB;EAEA,IAAKD,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,KAAK,EAAG;IACtD;IACA,IAAKD,IAAI,CAACG,YAAY,GAAGH,IAAI,CAACI,YAAY,EAAG;MAC5C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAG,IAAAC,yBAAgB,EAAEN,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACO,IAAI,CAAEF,SAAU,CAAC,EAAG;QACxC,OAAOL,IAAI;MACZ;IACD;EACD;EAEA,IAAKC,SAAS,KAAK,YAAY,IAAIA,SAAS,KAAK,KAAK,EAAG;IACxD;IACA,IAAKD,IAAI,CAACQ,WAAW,GAAGR,IAAI,CAACS,WAAW,EAAG;MAC1C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAG,IAAAJ,yBAAgB,EAAEN,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACO,IAAI,CAAEG,SAAU,CAAC,EAAG;QACxC,OAAOV,IAAI;MACZ;IACD;EACD;EAEA,IAAKA,IAAI,CAACW,aAAa,KAAKX,IAAI,CAACY,UAAU,EAAG;IAC7C,OAAOZ,IAAI;EACZ;;EAEA;EACA,OAAOD,kBAAkB,EACxB,sBAAyBC,IAAI,CAACY,UAAU,EACxCX,SACD,CAAC;AACF","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_caretRangeFromPoint","_interopRequireDefault","require","_getComputedStyle","hiddenCaretRangeFromPoint","doc","x","y","container","originalZIndex","style","zIndex","originalPosition","position","getComputedStyle","range","caretRangeFromPoint"],"sources":["@wordpress/dom/src/dom/hidden-caret-range-from-point.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,yBAAyBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAG;EACzE,MAAMC,cAAc,GAAGD,SAAS,CAACE,KAAK,CAACC,MAAM;EAC7C,MAAMC,gBAAgB,GAAGJ,SAAS,CAACE,KAAK,CAACG,QAAQ;EAEjD,MAAM;IAAEA,QAAQ,GAAG;EAAS,CAAC,GAAG,IAAAC,yBAAgB,EAAEN,SAAU,CAAC;;EAE7D;EACA,IAAKK,QAAQ,KAAK,QAAQ,EAAG;IAC5BL,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAG,UAAU;EACtC;EAEAL,SAAS,CAACE,KAAK,CAACC,MAAM,GAAG,OAAO;EAEhC,MAAMI,KAAK,GAAG,IAAAC,4BAAmB,EAAEX,GAAG,EAAEC,CAAC,EAAEC,CAAE,CAAC;EAE9CC,SAAS,CAACE,KAAK,CAACC,MAAM,GAAGF,cAAc;EACvCD,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAGD,gBAAgB;EAE3C,OAAOG,KAAK;AACb"}
|
1
|
+
{"version":3,"names":["_caretRangeFromPoint","_interopRequireDefault","require","_getComputedStyle","hiddenCaretRangeFromPoint","doc","x","y","container","originalZIndex","style","zIndex","originalPosition","position","getComputedStyle","range","caretRangeFromPoint"],"sources":["@wordpress/dom/src/dom/hidden-caret-range-from-point.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,yBAAyBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAG;EACzE,MAAMC,cAAc,GAAGD,SAAS,CAACE,KAAK,CAACC,MAAM;EAC7C,MAAMC,gBAAgB,GAAGJ,SAAS,CAACE,KAAK,CAACG,QAAQ;EAEjD,MAAM;IAAEA,QAAQ,GAAG;EAAS,CAAC,GAAG,IAAAC,yBAAgB,EAAEN,SAAU,CAAC;;EAE7D;EACA,IAAKK,QAAQ,KAAK,QAAQ,EAAG;IAC5BL,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAG,UAAU;EACtC;EAEAL,SAAS,CAACE,KAAK,CAACC,MAAM,GAAG,OAAO;EAEhC,MAAMI,KAAK,GAAG,IAAAC,4BAAmB,EAAEX,GAAG,EAAEC,CAAC,EAAEC,CAAE,CAAC;EAE9CC,SAAS,CAACE,KAAK,CAACC,MAAM,GAAGF,cAAc;EACvCD,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAGD,gBAAgB;EAE3C,OAAOG,KAAK;AACb","ignoreList":[]}
|
package/build/dom/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_computeCaretRect","_interopRequireDefault","require","_documentHasTextSelection","_documentHasUncollapsedSelection","_documentHasSelection","_getRectangleFromRange","_getScrollContainer","_getOffsetParent","_isEntirelySelected","_isFormElement","_isHorizontalEdge","_isNumberInput","_isTextField","_isVerticalEdge","_placeCaretAtHorizontalEdge","_placeCaretAtVerticalEdge","_replace","_remove","_insertAfter","_unwrap","_replaceTag","_wrap","_stripHtml","_isEmpty","_removeInvalidHtml","_isRtl","_safeHtml"],"sources":["@wordpress/dom/src/dom/index.js"],"sourcesContent":["export { default as computeCaretRect } from './compute-caret-rect';\nexport { default as documentHasTextSelection } from './document-has-text-selection';\nexport { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';\nexport { default as documentHasSelection } from './document-has-selection';\nexport { default as getRectangleFromRange } from './get-rectangle-from-range';\nexport { default as getScrollContainer } from './get-scroll-container';\nexport { default as getOffsetParent } from './get-offset-parent';\nexport { default as isEntirelySelected } from './is-entirely-selected';\nexport { default as isFormElement } from './is-form-element';\nexport { default as isHorizontalEdge } from './is-horizontal-edge';\nexport { default as isNumberInput } from './is-number-input';\nexport { default as isTextField } from './is-text-field';\nexport { default as isVerticalEdge } from './is-vertical-edge';\nexport { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';\nexport { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';\nexport { default as replace } from './replace';\nexport { default as remove } from './remove';\nexport { default as insertAfter } from './insert-after';\nexport { default as unwrap } from './unwrap';\nexport { default as replaceTag } from './replace-tag';\nexport { default as wrap } from './wrap';\nexport { default as __unstableStripHTML } from './strip-html';\nexport { default as isEmpty } from './is-empty';\nexport { default as removeInvalidHTML } from './remove-invalid-html';\nexport { default as isRTL } from './is-rtl';\nexport { default as safeHTML } from './safe-html';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,qBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,mBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,eAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,2BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,yBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,QAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,OAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,YAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,OAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,WAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,KAAA,GAAArB,sBAAA,CAAAC,OAAA;AACA,IAAAqB,UAAA,GAAAtB,sBAAA,CAAAC,OAAA;AACA,IAAAsB,QAAA,GAAAvB,sBAAA,CAAAC,OAAA;AACA,IAAAuB,kBAAA,GAAAxB,sBAAA,CAAAC,OAAA;AACA,IAAAwB,MAAA,GAAAzB,sBAAA,CAAAC,OAAA;AACA,IAAAyB,SAAA,GAAA1B,sBAAA,CAAAC,OAAA"}
|
1
|
+
{"version":3,"names":["_computeCaretRect","_interopRequireDefault","require","_documentHasTextSelection","_documentHasUncollapsedSelection","_documentHasSelection","_getRectangleFromRange","_getScrollContainer","_getOffsetParent","_isEntirelySelected","_isFormElement","_isHorizontalEdge","_isNumberInput","_isTextField","_isVerticalEdge","_placeCaretAtHorizontalEdge","_placeCaretAtVerticalEdge","_replace","_remove","_insertAfter","_unwrap","_replaceTag","_wrap","_stripHtml","_isEmpty","_removeInvalidHtml","_isRtl","_safeHtml"],"sources":["@wordpress/dom/src/dom/index.js"],"sourcesContent":["export { default as computeCaretRect } from './compute-caret-rect';\nexport { default as documentHasTextSelection } from './document-has-text-selection';\nexport { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';\nexport { default as documentHasSelection } from './document-has-selection';\nexport { default as getRectangleFromRange } from './get-rectangle-from-range';\nexport { default as getScrollContainer } from './get-scroll-container';\nexport { default as getOffsetParent } from './get-offset-parent';\nexport { default as isEntirelySelected } from './is-entirely-selected';\nexport { default as isFormElement } from './is-form-element';\nexport { default as isHorizontalEdge } from './is-horizontal-edge';\nexport { default as isNumberInput } from './is-number-input';\nexport { default as isTextField } from './is-text-field';\nexport { default as isVerticalEdge } from './is-vertical-edge';\nexport { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';\nexport { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';\nexport { default as replace } from './replace';\nexport { default as remove } from './remove';\nexport { default as insertAfter } from './insert-after';\nexport { default as unwrap } from './unwrap';\nexport { default as replaceTag } from './replace-tag';\nexport { default as wrap } from './wrap';\nexport { default as __unstableStripHTML } from './strip-html';\nexport { default as isEmpty } from './is-empty';\nexport { default as removeInvalidHTML } from './remove-invalid-html';\nexport { default as isRTL } from './is-rtl';\nexport { default as safeHTML } from './safe-html';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,qBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,mBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,eAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,2BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,yBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,QAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,OAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,YAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,OAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,WAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,KAAA,GAAArB,sBAAA,CAAAC,OAAA;AACA,IAAAqB,UAAA,GAAAtB,sBAAA,CAAAC,OAAA;AACA,IAAAsB,QAAA,GAAAvB,sBAAA,CAAAC,OAAA;AACA,IAAAuB,kBAAA,GAAAxB,sBAAA,CAAAC,OAAA;AACA,IAAAwB,MAAA,GAAAzB,sBAAA,CAAAC,OAAA;AACA,IAAAyB,SAAA,GAAA1B,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isTextField","_interopRequireDefault","require","_isHtmlInputElement","inputFieldHasUncollapsedSelection","element","isHTMLInputElement","isTextField","selectionStart","selectionEnd","error"],"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,iCAAiCA,CAAEC,OAAO,EAAG;EACpE,IAAK,CAAE,IAAAC,2BAAkB,EAAED,OAAQ,CAAC,IAAI,CAAE,IAAAE,oBAAW,EAAEF,OAAQ,CAAC,EAAG;IAClE,OAAO,KAAK;EACb;;EAEA;EACA;EACA;EACA,IAAI;IACH,MAAM;MAAEG,cAAc;MAAEC;IAAa,CAAC,GACrC,qDAAwDJ,OAAS;IAClE;MACC;MACA;MACA;MACAG,cAAc,KAAK,IAAI;MACvB;MACAA,cAAc,KAAKC;IAAY;EAEjC,CAAC,CAAC,OAAQC,KAAK,EAAG;IACjB;IACA;IACA,OAAO,IAAI;EACZ;AACD"}
|
1
|
+
{"version":3,"names":["_isTextField","_interopRequireDefault","require","_isHtmlInputElement","inputFieldHasUncollapsedSelection","element","isHTMLInputElement","isTextField","selectionStart","selectionEnd","error"],"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textareaa element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,iCAAiCA,CAAEC,OAAO,EAAG;EACpE,IAAK,CAAE,IAAAC,2BAAkB,EAAED,OAAQ,CAAC,IAAI,CAAE,IAAAE,oBAAW,EAAEF,OAAQ,CAAC,EAAG;IAClE,OAAO,KAAK;EACb;;EAEA;EACA;EACA;EACA,IAAI;IACH,MAAM;MAAEG,cAAc;MAAEC;IAAa,CAAC,GACrC,qDAAwDJ,OAAS;IAClE;MACC;MACA;MACA;MACAG,cAAc,KAAK,IAAI;MACvB;MACAA,cAAc,KAAKC;IAAY;EAEjC,CAAC,CAAC,OAAQC,KAAK,EAAG;IACjB;IACA;IACA,OAAO,IAAI;EACZ;AACD","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","insertAfter","newNode","referenceNode","assertIsDefined","parentNode","insertBefore","nextSibling"],"sources":["@wordpress/dom/src/dom/insert-after.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param {Node} newNode Node to be inserted.\n * @param {Node} referenceNode Node after which to perform the insertion.\n * @return {void}\n */\nexport default function insertAfter( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EAC7D,IAAAC,gCAAe,EAAED,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEF,aAAa,CAACE,UAAU,CAACC,YAAY,CAAEJ,OAAO,EAAEC,aAAa,CAACI,WAAY,CAAC;AAC5E"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","insertAfter","newNode","referenceNode","assertIsDefined","parentNode","insertBefore","nextSibling"],"sources":["@wordpress/dom/src/dom/insert-after.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param {Node} newNode Node to be inserted.\n * @param {Node} referenceNode Node after which to perform the insertion.\n * @return {void}\n */\nexport default function insertAfter( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EAC7D,IAAAC,gCAAe,EAAED,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEF,aAAa,CAACE,UAAU,CAACC,YAAY,CAAEJ,OAAO,EAAEC,aAAa,CAACI,WAAY,CAAC;AAC5E","ignoreList":[]}
|
package/build/dom/is-edge.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isRtl","_interopRequireDefault","require","_getRangeHeight","_getRectangleFromRange","_isSelectionForward","_hiddenCaretRangeFromPoint","_assertIsDefined","_isInputOrTextArea","_scrollIfNoRange","isEdge","container","isReverse","onlyVertical","isInputOrTextArea","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","assertIsDefined","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isSelectionForward","isCollapsed","collapse","collapsedRangeRect","getRectangleFromRange","rangeRect","rangeHeight","getRangeHeight","height","isReverseDir","isRTL","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","scrollIfNoRange","hiddenCaretRangeFromPoint","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"sources":["@wordpress/dom/src/dom/is-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\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\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\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EAAExC,SAAS,EAAEC,SAAS,EAAE,MACxD,IAAAwC,kCAAyB,EAAEhC,aAAa,EAAEwB,CAAC,EAAEG,CAAC,EAAEpC,SAAU,CAC3D,CAAC;EAED,IAAK,CAAEuC,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EAEA,MAAMG,QAAQ,GAAG,IAAAlB,8BAAqB,EAAEe,SAAU,CAAC;EAEnD,IAAK,CAAEG,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EAEA,MAAMC,YAAY,GAAG1C,SAAS,GAAG,KAAK,GAAG,QAAQ;EACjD,MAAM2C,cAAc,GAAGf,YAAY,GAAG,MAAM,GAAG,OAAO;EACtD,MAAMgB,YAAY,GAAGH,QAAQ,CAAEC,YAAY,CAAE,GAAGlB,SAAS,CAAEkB,YAAY,CAAE;EACzE,MAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAc,CAAE,GAAGrB,kBAAkB,CAAEqB,cAAc,CAAE;;EAElE;EACA,MAAMG,eAAe,GAAGC,IAAI,CAACC,GAAG,CAAEJ,YAAa,CAAC,IAAI,CAAC;EACrD,MAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAG,CAAEH,cAAe,CAAC,IAAI,CAAC;EAEzD,OAAO5C,YAAY,GAChB6C,eAAe,GACfA,eAAe,IAAIG,iBAAiB;AACxC"}
|
1
|
+
{"version":3,"names":["_isRtl","_interopRequireDefault","require","_getRangeHeight","_getRectangleFromRange","_isSelectionForward","_hiddenCaretRangeFromPoint","_assertIsDefined","_isInputOrTextArea","_scrollIfNoRange","isEdge","container","isReverse","onlyVertical","isInputOrTextArea","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","assertIsDefined","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isSelectionForward","isCollapsed","collapse","collapsedRangeRect","getRectangleFromRange","rangeRect","rangeHeight","getRangeHeight","height","isReverseDir","isRTL","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","scrollIfNoRange","hiddenCaretRangeFromPoint","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"sources":["@wordpress/dom/src/dom/is-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\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\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,0BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAVA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASQ,MAAMA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,YAAY,GAAG,KAAK,EAAG;EAC5E,IACC,IAAAC,0BAAiB,EAAEH,SAAU,CAAC,IAC9B,OAAOA,SAAS,CAACI,cAAc,KAAK,QAAQ,EAC3C;IACD,IAAKJ,SAAS,CAACI,cAAc,KAAKJ,SAAS,CAACK,YAAY,EAAG;MAC1D,OAAO,KAAK;IACb;IAEA,IAAKJ,SAAS,EAAG;MAChB,OAAOD,SAAS,CAACI,cAAc,KAAK,CAAC;IACtC;IAEA,OAAOJ,SAAS,CAACM,KAAK,CAACC,MAAM,KAAKP,SAAS,CAACI,cAAc;EAC3D;EAEA,IAAK,CAAEJ,SAAS,CAACQ,iBAAiB,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC;EAAc,CAAC,GAAGT,SAAS;EACnC,MAAM;IAAEU;EAAY,CAAC,GAAGD,aAAa;EAErC,IAAAE,gCAAe,EAAED,WAAW,EAAE,aAAc,CAAC;EAC7C,MAAME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ACM,GAAG,GAAG,CAAC,GAAGN,aAAa,CAACO,MAAM,GAAG,CAAC;EACtE,MAAMC,SAAS,GAAG,IAAAC,gCAAe,EAAExC,SAAS,EAAEC,SAAS,EAAE,MACxD,IAAAwC,kCAAyB,EAAEhC,aAAa,EAAEwB,CAAC,EAAEG,CAAC,EAAEpC,SAAU,CAC3D,CAAC;EAED,IAAK,CAAEuC,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EAEA,MAAMG,QAAQ,GAAG,IAAAlB,8BAAqB,EAAEe,SAAU,CAAC;EAEnD,IAAK,CAAEG,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EAEA,MAAMC,YAAY,GAAG1C,SAAS,GAAG,KAAK,GAAG,QAAQ;EACjD,MAAM2C,cAAc,GAAGf,YAAY,GAAG,MAAM,GAAG,OAAO;EACtD,MAAMgB,YAAY,GAAGH,QAAQ,CAAEC,YAAY,CAAE,GAAGlB,SAAS,CAAEkB,YAAY,CAAE;EACzE,MAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAc,CAAE,GAAGrB,kBAAkB,CAAEqB,cAAc,CAAE;;EAElE;EACA,MAAMG,eAAe,GAAGC,IAAI,CAACC,GAAG,CAAEJ,YAAa,CAAC,IAAI,CAAC;EACrD,MAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAG,CAAEH,cAAe,CAAC,IAAI,CAAC;EAEzD,OAAO5C,YAAY,GAChB6C,eAAe,GACfA,eAAe,IAAIG,iBAAiB;AACxC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isElement","node","nodeType","ELEMENT_NODE"],"sources":["@wordpress/dom/src/dom/is-element.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA,OAAO,CAAC,CAAEA,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKD,IAAI,CAACE,YAAY;AACtD"}
|
1
|
+
{"version":3,"names":["isElement","node","nodeType","ELEMENT_NODE"],"sources":["@wordpress/dom/src/dom/is-element.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA,OAAO,CAAC,CAAEA,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKD,IAAI,CAACE,YAAY;AACtD","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"sources":["@wordpress/dom/src/dom/is-empty.js"],"sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAOA,CAAEC,OAAO,EAAG;EAC1C,QAASA,OAAO,CAACC,QAAQ;IACxB,KAAKD,OAAO,CAACE,SAAS;MACrB;MACA;MACA,OAAO,wBAAwB,CAACC,IAAI,CAAEH,OAAO,CAACI,SAAS,IAAI,EAAG,CAAC;IAChE,KAAKJ,OAAO,CAACK,YAAY;MACxB,IAAKL,OAAO,CAACM,aAAa,CAAC,CAAC,EAAG;QAC9B,OAAO,KAAK;MACb,CAAC,MAAM,IAAK,CAAEN,OAAO,CAACO,aAAa,CAAC,CAAC,EAAG;QACvC,OAAO,IAAI;MACZ;MAEA,OAAO,wBACNC,KAAK,CAACC,IAAI,CAAET,OAAO,CAACU,UAAW,CAAC,CAC/BC,KAAK,CAAEZ,OAAQ,CAAC;IACnB;MACC,OAAO,IAAI;EACb;AACD"}
|
1
|
+
{"version":3,"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"sources":["@wordpress/dom/src/dom/is-empty.js"],"sourcesContent":["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAOA,CAAEC,OAAO,EAAG;EAC1C,QAASA,OAAO,CAACC,QAAQ;IACxB,KAAKD,OAAO,CAACE,SAAS;MACrB;MACA;MACA,OAAO,wBAAwB,CAACC,IAAI,CAAEH,OAAO,CAACI,SAAS,IAAI,EAAG,CAAC;IAChE,KAAKJ,OAAO,CAACK,YAAY;MACxB,IAAKL,OAAO,CAACM,aAAa,CAAC,CAAC,EAAG;QAC9B,OAAO,KAAK;MACb,CAAC,MAAM,IAAK,CAAEN,OAAO,CAACO,aAAa,CAAC,CAAC,EAAG;QACvC,OAAO,IAAI;MACZ;MAEA,OAAO,wBACNC,KAAK,CAACC,IAAI,CAAET,OAAO,CAACU,UAAW,CAAC,CAC/BC,KAAK,CAAEZ,OAAQ,CAAC;IACnB;MACC,OAAO,IAAI;EACb;AACD","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","_isInputOrTextArea","_interopRequireDefault","isEntirelySelected","element","isInputOrTextArea","selectionStart","value","length","selectionEnd","isContentEditable","ownerDocument","defaultView","assertIsDefined","selection","getSelection","range","rangeCount","getRangeAt","startContainer","endContainer","startOffset","endOffset","childNodes","lastChild","endContainerContentLength","nodeType","TEXT_NODE","data","isDeepChild","query","container","propName","candidate"],"sources":["@wordpress/dom/src/dom/is-entirely-selected.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement} element The element to check.\n *\n * @return {boolean} True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element ) {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? /** @type {Text} */ ( endContainer ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement|Node} query The element to check.\n * @param {HTMLElement} container The container that we suspect \"query\" may be a first or last child of.\n * @param {\"firstChild\"|\"lastChild\"} propName \"firstChild\" or \"lastChild\"\n *\n * @return {boolean} True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild( query, container, propName ) {\n\t/** @type {HTMLElement | ChildNode | null} */\n\tlet candidate = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t} while ( candidate );\n\treturn false;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC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,IAAI,CAACpB,MAAM,GAChDY,YAAY,CAACG,UAAU,CAACf,MAAM;EAElC,OACCqB,WAAW,CAAEV,cAAc,EAAEf,OAAO,EAAE,YAAa,CAAC,IACpDyB,WAAW,CAAET,YAAY,EAAEhB,OAAO,EAAE,WAAY,CAAC,IACjDiB,WAAW,KAAK,CAAC,IACjBC,SAAS,KAAKG,yBAAyB;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,WAAWA,CAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAG;EAClD;EACA,IAAIC,SAAS,GAAGF,SAAS;EACzB,GAAG;IACF,IAAKD,KAAK,KAAKG,SAAS,EAAG;MAC1B,OAAO,IAAI;IACZ;IACAA,SAAS,GAAGA,SAAS,CAAED,QAAQ,CAAE;EAClC,CAAC,QAASC,SAAS;EACnB,OAAO,KAAK;AACb"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","_isInputOrTextArea","_interopRequireDefault","isEntirelySelected","element","isInputOrTextArea","selectionStart","value","length","selectionEnd","isContentEditable","ownerDocument","defaultView","assertIsDefined","selection","getSelection","range","rangeCount","getRangeAt","startContainer","endContainer","startOffset","endOffset","childNodes","lastChild","endContainerContentLength","nodeType","TEXT_NODE","data","isDeepChild","query","container","propName","candidate"],"sources":["@wordpress/dom/src/dom/is-entirely-selected.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement} element The element to check.\n *\n * @return {boolean} True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element ) {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? /** @type {Text} */ ( endContainer ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement|Node} query The element to check.\n * @param {HTMLElement} container The container that we suspect \"query\" may be a first or last child of.\n * @param {\"firstChild\"|\"lastChild\"} propName \"firstChild\" or \"lastChild\"\n *\n * @return {boolean} True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild( query, container, propName ) {\n\t/** @type {HTMLElement | ChildNode | null} */\n\tlet candidate = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t} while ( candidate );\n\treturn false;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,kBAA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,YAAa,CAAC,IACpDyB,WAAW,CAAET,YAAY,EAAEhB,OAAO,EAAE,WAAY,CAAC,IACjDiB,WAAW,KAAK,CAAC,IACjBC,SAAS,KAAKG,yBAAyB;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,WAAWA,CAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAG;EAClD;EACA,IAAIC,SAAS,GAAGF,SAAS;EACzB,GAAG;IACF,IAAKD,KAAK,KAAKG,SAAS,EAAG;MAC1B,OAAO,IAAI;IACZ;IACAA,SAAS,GAAGA,SAAS,CAAED,QAAQ,CAAE;EAClC,CAAC,QAASC,SAAS;EACnB,OAAO,KAAK;AACb","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isInputOrTextArea","_interopRequireDefault","require","isFormElement","element","tagName","checkForInputTextarea","isInputOrTextArea"],"sources":["@wordpress/dom/src/dom/is-form-element.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if form element and false otherwise.\n */\nexport default function isFormElement( element ) {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,aAAaA,CAAEC,OAAO,EAAG;EAChD,IAAK,CAAEA,OAAO,EAAG;IAChB,OAAO,KAAK;EACb;EAEA,MAAM;IAAEC;EAAQ,CAAC,GAAGD,OAAO;EAC3B,MAAME,qBAAqB,GAAG,IAAAC,0BAAiB,EAAEH,OAAQ,CAAC;EAC1D,OACCE,qBAAqB,IAAID,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,QAAQ;AAEvE"}
|
1
|
+
{"version":3,"names":["_isInputOrTextArea","_interopRequireDefault","require","isFormElement","element","tagName","checkForInputTextarea","isInputOrTextArea"],"sources":["@wordpress/dom/src/dom/is-form-element.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if form element and false otherwise.\n */\nexport default function isFormElement( element ) {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,aAAaA,CAAEC,OAAO,EAAG;EAChD,IAAK,CAAEA,OAAO,EAAG;IAChB,OAAO,KAAK;EACb;EAEA,MAAM;IAAEC;EAAQ,CAAC,GAAGD,OAAO;EAC3B,MAAME,qBAAqB,GAAG,IAAAC,0BAAiB,EAAEH,OAAQ,CAAC;EAC1D,OACCE,qBAAqB,IAAID,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,QAAQ;AAEvE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isEdge","_interopRequireDefault","require","isHorizontalEdge","container","isReverse","isEdge"],"sources":["@wordpress/dom/src/dom/is-horizontal-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAChE,OAAO,IAAAC,eAAM,EAAEF,SAAS,EAAEC,SAAU,CAAC;AACtC"}
|
1
|
+
{"version":3,"names":["_isEdge","_interopRequireDefault","require","isHorizontalEdge","container","isReverse","isEdge"],"sources":["@wordpress/dom/src/dom/is-horizontal-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAChE,OAAO,IAAAC,eAAM,EAAEF,SAAS,EAAEC,SAAU,CAAC;AACtC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isHTMLInputElement","node","nodeName"],"sources":["@wordpress/dom/src/dom/is-html-input-element.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn node?.nodeName === 'INPUT';\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,kBAAkBA,CAAEC,IAAI,EAAG;EAClD;EACA,OAAOA,IAAI,EAAEC,QAAQ,KAAK,OAAO;AAClC"}
|
1
|
+
{"version":3,"names":["isHTMLInputElement","node","nodeName"],"sources":["@wordpress/dom/src/dom/is-html-input-element.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn node?.nodeName === 'INPUT';\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,kBAAkBA,CAAEC,IAAI,EAAG;EAClD;EACA,OAAOA,IAAI,EAAEC,QAAQ,KAAK,OAAO;AAClC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isInputOrTextArea","element","tagName"],"sources":["@wordpress/dom/src/dom/is-input-or-text-area.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,iBAAiBA,CAAEC,OAAO,EAAG;EACpD;EACA,OAAOA,OAAO,CAACC,OAAO,KAAK,OAAO,IAAID,OAAO,CAACC,OAAO,KAAK,UAAU;AACrE"}
|
1
|
+
{"version":3,"names":["isInputOrTextArea","element","tagName"],"sources":["@wordpress/dom/src/dom/is-input-or-text-area.js"],"sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,iBAAiBA,CAAEC,OAAO,EAAG;EACpD;EACA,OAAOA,OAAO,CAACC,OAAO,KAAK,OAAO,IAAID,OAAO,CAACC,OAAO,KAAK,UAAU;AACrE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_deprecated","_interopRequireDefault","require","_isHtmlInputElement","isNumberInput","node","deprecated","since","version","isHTMLInputElement","type","isNaN","valueAsNumber"],"sources":["@wordpress/dom/src/dom/is-number-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\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 an input field of type number.\n *\n * @param {Node} node The HTML node.\n *\n * @return {node is HTMLInputElement} True if the node is number input.\n */\nexport default function isNumberInput( node ) {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\t/* eslint-enable jsdoc/valid-types */\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,aAAaA,CAAEC,IAAI,EAAG;EAC7C,IAAAC,mBAAU,EAAE,sBAAsB,EAAE;IACnCC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EACH;EACA,OACC,IAAAC,2BAAkB,EAAEJ,IAAK,CAAC,IAC1BA,IAAI,CAACK,IAAI,KAAK,QAAQ,IACtB,CAAEC,KAAK,CAAEN,IAAI,CAACO,aAAc,CAAC;AAE/B"}
|
1
|
+
{"version":3,"names":["_deprecated","_interopRequireDefault","require","_isHtmlInputElement","isNumberInput","node","deprecated","since","version","isHTMLInputElement","type","isNaN","valueAsNumber"],"sources":["@wordpress/dom/src/dom/is-number-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\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 an input field of type number.\n *\n * @param {Node} node The HTML node.\n *\n * @return {node is HTMLInputElement} True if the node is number input.\n */\nexport default function isNumberInput( node ) {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\t/* eslint-enable jsdoc/valid-types */\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,aAAaA,CAAEC,IAAI,EAAG;EAC7C,IAAAC,mBAAU,EAAE,sBAAsB,EAAE;IACnCC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EACH;EACA,OACC,IAAAC,2BAAkB,EAAEJ,IAAK,CAAC,IAC1BA,IAAI,CAACK,IAAI,KAAK,QAAQ,IACtB,CAAEC,KAAK,CAAEN,IAAI,CAACO,aAAc,CAAC;AAE/B","ignoreList":[]}
|
package/build/dom/is-rtl.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","isRTL","element","getComputedStyle","direction"],"sources":["@wordpress/dom/src/dom/is-rtl.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if rtl, false if ltr.\n */\nexport default function isRTL( element ) {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,KAAKA,CAAEC,OAAO,EAAG;EACxC,OAAO,IAAAC,yBAAgB,EAAED,OAAQ,CAAC,CAACE,SAAS,KAAK,KAAK;AACvD"}
|
1
|
+
{"version":3,"names":["_getComputedStyle","_interopRequireDefault","require","isRTL","element","getComputedStyle","direction"],"sources":["@wordpress/dom/src/dom/is-rtl.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if rtl, false if ltr.\n */\nexport default function isRTL( element ) {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,KAAKA,CAAEC,OAAO,EAAG;EACxC,OAAO,IAAAC,yBAAgB,EAAED,OAAQ,CAAC,CAACE,SAAS,KAAK,KAAK;AACvD","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","isSelectionForward","selection","anchorNode","focusNode","anchorOffset","focusOffset","assertIsDefined","position","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING"],"sources":["@wordpress/dom/src/dom/is-selection-forward.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,kBAAkBA,CAAEC,SAAS,EAAG;EACvD,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAY,CAAC,GAAGJ,SAAS;EAEtE,IAAAK,gCAAe,EAAEJ,UAAU,EAAE,YAAa,CAAC;EAC3C,IAAAI,gCAAe,EAAEH,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMI,QAAQ,GAAGL,UAAU,CAACM,uBAAuB,CAAEL,SAAU,CAAC;;EAEhE;EACA;EACA;EACA;EACA;EACA,IAAKI,QAAQ,GAAGL,UAAU,CAACO,2BAA2B,EAAG;IACxD,OAAO,KAAK;EACb;EAEA,IAAKF,QAAQ,GAAGL,UAAU,CAACQ,2BAA2B,EAAG;IACxD,OAAO,IAAI;EACZ;EACA;;EAEA;EACA;EACA,IAAKH,QAAQ,KAAK,CAAC,EAAG;IACrB,OAAOH,YAAY,IAAIC,WAAW;EACnC;;EAEA;EACA,OAAO,IAAI;AACZ"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","isSelectionForward","selection","anchorNode","focusNode","anchorOffset","focusOffset","assertIsDefined","position","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING"],"sources":["@wordpress/dom/src/dom/is-selection-forward.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,kBAAkBA,CAAEC,SAAS,EAAG;EACvD,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAY,CAAC,GAAGJ,SAAS;EAEtE,IAAAK,gCAAe,EAAEJ,UAAU,EAAE,YAAa,CAAC;EAC3C,IAAAI,gCAAe,EAAEH,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMI,QAAQ,GAAGL,UAAU,CAACM,uBAAuB,CAAEL,SAAU,CAAC;;EAEhE;EACA;EACA;EACA;EACA;EACA,IAAKI,QAAQ,GAAGL,UAAU,CAACO,2BAA2B,EAAG;IACxD,OAAO,KAAK;EACb;EAEA,IAAKF,QAAQ,GAAGL,UAAU,CAACQ,2BAA2B,EAAG;IACxD,OAAO,IAAI;EACZ;EACA;;EAEA;EACA;EACA,IAAKH,QAAQ,KAAK,CAAC,EAAG;IACrB,OAAOH,YAAY,IAAIC,WAAW;EACnC;;EAEA;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isHtmlInputElement","_interopRequireDefault","require","isTextField","node","nonTextInputs","isHTMLInputElement","type","includes","nodeName","contentEditable"],"sources":["@wordpress/dom/src/dom/is-text-field.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAEC,IAAI,EAAG;EAC3C;EACA,MAAMC,aAAa,GAAG,CACrB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,CACN;EACD,OACG,IAAAC,2BAAkB,EAAEF,IAAK,CAAC,IAC3BA,IAAI,CAACG,IAAI,IACT,CAAEF,aAAa,CAACG,QAAQ,CAAEJ,IAAI,CAACG,IAAK,CAAC,IACtCH,IAAI,CAACK,QAAQ,KAAK,UAAU,IAC5B,0BAA6BL,IAAI,CAAGM,eAAe,KAAK,MAAM;AAEhE"}
|
1
|
+
{"version":3,"names":["_isHtmlInputElement","_interopRequireDefault","require","isTextField","node","nonTextInputs","isHTMLInputElement","type","includes","nodeName","contentEditable"],"sources":["@wordpress/dom/src/dom/is-text-field.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAEC,IAAI,EAAG;EAC3C;EACA,MAAMC,aAAa,GAAG,CACrB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,CACN;EACD,OACG,IAAAC,2BAAkB,EAAEF,IAAK,CAAC,IAC3BA,IAAI,CAACG,IAAI,IACT,CAAEF,aAAa,CAACG,QAAQ,CAAEJ,IAAI,CAACG,IAAK,CAAC,IACtCH,IAAI,CAACK,QAAQ,KAAK,UAAU,IAC5B,0BAA6BL,IAAI,CAAGM,eAAe,KAAK,MAAM;AAEhE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_isEdge","_interopRequireDefault","require","isVerticalEdge","container","isReverse","isEdge"],"sources":["@wordpress/dom/src/dom/is-vertical-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC9D,OAAO,IAAAC,eAAM,EAAEF,SAAS,EAAEC,SAAS,EAAE,IAAK,CAAC;AAC5C"}
|
1
|
+
{"version":3,"names":["_isEdge","_interopRequireDefault","require","isVerticalEdge","container","isReverse","isEdge"],"sources":["@wordpress/dom/src/dom/is-vertical-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC9D,OAAO,IAAAC,eAAM,EAAEF,SAAS,EAAEC,SAAS,EAAE,IAAK,CAAC;AAC5C","ignoreList":[]}
|
@@ -75,7 +75,9 @@ function placeCaretAtEdge(container, isReverse, x) {
|
|
75
75
|
return;
|
76
76
|
}
|
77
77
|
const range = (0, _scrollIfNoRange.scrollIfNoRange)(container, isReverse, () => getRange(container, isReverse, x));
|
78
|
-
if (!range)
|
78
|
+
if (!range) {
|
79
|
+
return;
|
80
|
+
}
|
79
81
|
const {
|
80
82
|
ownerDocument
|
81
83
|
} = container;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_hiddenCaretRangeFromPoint","_interopRequireDefault","require","_assertIsDefined","_isInputOrTextArea","_isRtl","_scrollIfNoRange","getRange","container","isReverse","x","ownerDocument","isReverseDir","isRTL","containerRect","getBoundingClientRect","undefined","right","left","y","bottom","top","hiddenCaretRangeFromPoint","placeCaretAtEdge","focus","isInputOrTextArea","selectionStart","value","length","selectionEnd","isContentEditable","range","scrollIfNoRange","defaultView","assertIsDefined","selection","getSelection","removeAllRanges","addRange"],"sources":["@wordpress/dom/src/dom/place-caret-at-edge.js"],"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 )
|
1
|
+
{"version":3,"names":["_hiddenCaretRangeFromPoint","_interopRequireDefault","require","_assertIsDefined","_isInputOrTextArea","_isRtl","_scrollIfNoRange","getRange","container","isReverse","x","ownerDocument","isReverseDir","isRTL","containerRect","getBoundingClientRect","undefined","right","left","y","bottom","top","hiddenCaretRangeFromPoint","placeCaretAtEdge","focus","isInputOrTextArea","selectionStart","value","length","selectionEnd","isContentEditable","range","scrollIfNoRange","defaultView","assertIsDefined","selection","getSelection","removeAllRanges","addRange"],"sources":["@wordpress/dom/src/dom/place-caret-at-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,QAAQA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,CAAC,EAAG;EAC5C,MAAM;IAAEC;EAAc,CAAC,GAAGH,SAAS;EACnC;EACA,MAAMI,YAAY,GAAG,IAAAC,cAAK,EAAEL,SAAU,CAAC,GAAG,CAAEC,SAAS,GAAGA,SAAS;EACjE,MAAMK,aAAa,GAAGN,SAAS,CAACO,qBAAqB,CAAC,CAAC;EACvD;EACA;EACA;EACA;EACA,IAAKL,CAAC,KAAKM,SAAS,EAAG;IACtBN,CAAC,GAAGD,SAAS,GAAGK,aAAa,CAACG,KAAK,GAAG,CAAC,GAAGH,aAAa,CAACI,IAAI,GAAG,CAAC;EACjE,CAAC,MAAM,IAAKR,CAAC,IAAII,aAAa,CAACI,IAAI,EAAG;IACrCR,CAAC,GAAGI,aAAa,CAACI,IAAI,GAAG,CAAC;EAC3B,CAAC,MAAM,IAAKR,CAAC,IAAII,aAAa,CAACG,KAAK,EAAG;IACtCP,CAAC,GAAGI,aAAa,CAACG,KAAK,GAAG,CAAC;EAC5B;EACA,MAAME,CAAC,GAAGP,YAAY,GAAGE,aAAa,CAACM,MAAM,GAAG,CAAC,GAAGN,aAAa,CAACO,GAAG,GAAG,CAAC;EACzE,OAAO,IAAAC,kCAAyB,EAAEX,aAAa,EAAED,CAAC,EAAES,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|
1
|
-
{"version":3,"names":["_placeCaretAtEdge","_interopRequireDefault","require","placeCaretAtHorizontalEdge","container","isReverse","placeCaretAtEdge","undefined"],"sources":["@wordpress/dom/src/dom/place-caret-at-horizontal-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,0BAA0BA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC1E,OAAO,IAAAC,yBAAgB,EAAEF,SAAS,EAAEC,SAAS,EAAEE,SAAU,CAAC;AAC3D"}
|
1
|
+
{"version":3,"names":["_placeCaretAtEdge","_interopRequireDefault","require","placeCaretAtHorizontalEdge","container","isReverse","placeCaretAtEdge","undefined"],"sources":["@wordpress/dom/src/dom/place-caret-at-horizontal-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,0BAA0BA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC1E,OAAO,IAAAC,yBAAgB,EAAEF,SAAS,EAAEC,SAAS,EAAEE,SAAU,CAAC;AAC3D","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_placeCaretAtEdge","_interopRequireDefault","require","placeCaretAtVerticalEdge","container","isReverse","rect","placeCaretAtEdge","left"],"sources":["@wordpress/dom/src/dom/place-caret-at-vertical-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,wBAAwBA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAG;EAC9E,OAAO,IAAAC,yBAAgB,EAAEH,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAEE,IAAK,CAAC;AAC5D"}
|
1
|
+
{"version":3,"names":["_placeCaretAtEdge","_interopRequireDefault","require","placeCaretAtVerticalEdge","container","isReverse","rect","placeCaretAtEdge","left"],"sources":["@wordpress/dom/src/dom/place-caret-at-vertical-edge.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,wBAAwBA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAG;EAC9E,OAAO,IAAAC,yBAAgB,EAAEH,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAEE,IAAK,CAAC;AAC5D","ignoreList":[]}
|