@wordpress/dom 3.2.6 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,11 +17,14 @@ function getFilesFromDataTransfer(dataTransfer) {
17
17
  Array.from(dataTransfer.items).forEach(item => {
18
18
  const file = item.getAsFile();
19
19
 
20
- if (file && !files.find(({
21
- name,
22
- type,
23
- size
24
- }) => name === file.name && type === file.type && size === file.size)) {
20
+ if (file && !files.find(_ref => {
21
+ let {
22
+ name,
23
+ type,
24
+ size
25
+ } = _ref;
26
+ return name === file.name && type === file.type && size === file.size;
27
+ })) {
25
28
  files.push(file);
26
29
  }
27
30
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/data-transfer.js"],"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAT,CAAmCC,YAAnC,EAAkD;AACxD,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACC,KAAzB,CAAd;AAEAC,EAAAA,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACI,KAAzB,EAAiCC,OAAjC,CAA4CC,IAAF,IAAY;AACrD,UAAMC,IAAI,GAAGD,IAAI,CAACE,SAAL,EAAb;;AAEA,QACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAN,CACD,CAAE;AAAEC,MAAAA,IAAF;AAAQC,MAAAA,IAAR;AAAcC,MAAAA;AAAd,KAAF,KACCF,IAAI,KAAKH,IAAI,CAACG,IAAd,IACAC,IAAI,KAAKJ,IAAI,CAACI,IADd,IAEAC,IAAI,KAAKL,IAAI,CAACK,IAJd,CAFH,EAQE;AACDX,MAAAA,KAAK,CAACY,IAAN,CAAYN,IAAZ;AACA;AACD,GAdD;AAgBA,SAAON,KAAP;AACA","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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/data-transfer.js"],"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAT,CAAmCC,YAAnC,EAAkD;AACxD,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACC,KAAzB,CAAd;AAEAC,EAAAA,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACI,KAAzB,EAAiCC,OAAjC,CAA4CC,IAAF,IAAY;AACrD,UAAMC,IAAI,GAAGD,IAAI,CAACE,SAAL,EAAb;;AAEA,QACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAN,CACD;AAAA,UAAE;AAAEC,QAAAA,IAAF;AAAQC,QAAAA,IAAR;AAAcC,QAAAA;AAAd,OAAF;AAAA,aACCF,IAAI,KAAKH,IAAI,CAACG,IAAd,IACAC,IAAI,KAAKJ,IAAI,CAACI,IADd,IAEAC,IAAI,KAAKL,IAAI,CAACK,IAHf;AAAA,KADC,CAFH,EAQE;AACDX,MAAAA,KAAK,CAACY,IAAN,CAAYN,IAAZ;AACA;AACD,GAdD;AAgBA,SAAON,KAAP;AACA","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"]}
@@ -55,9 +55,9 @@ var _isElement = _interopRequireDefault(require("./is-element"));
55
55
  * @param {boolean} inline Whether to clean for inline mode.
56
56
  */
57
57
  function cleanNodeList(nodeList, doc, schema, inline) {
58
- Array.from(nodeList).forEach(
58
+ Array.from(nodeList).forEach((
59
59
  /** @type {Node & { nextElementSibling?: unknown }} */
60
- node => {
60
+ node) => {
61
61
  var _schema$tag$isMatch, _schema$tag;
62
62
 
63
63
  const tag = node.nodeName.toLowerCase(); // It's a valid child, if the tag exists in the schema without an isMatch
@@ -81,9 +81,11 @@ function cleanNodeList(nodeList, doc, schema, inline) {
81
81
 
82
82
  if (node.hasAttributes()) {
83
83
  // Strip invalid attributes.
84
- Array.from(node.attributes).forEach(({
85
- name
86
- }) => {
84
+ Array.from(node.attributes).forEach(_ref => {
85
+ let {
86
+ name
87
+ } = _ref;
88
+
87
89
  if (name !== 'class' && !(0, _lodash.includes)(attributes, name)) {
88
90
  node.removeAttribute(name);
89
91
  }
@@ -95,14 +97,12 @@ function cleanNodeList(nodeList, doc, schema, inline) {
95
97
  const mattchers = classes.map(item => {
96
98
  if (typeof item === 'string') {
97
99
  return (
98
- /** @type {string} */
99
- className => className === item
100
- );
100
+ /** @type {string} */
101
+ className) => className === item;
101
102
  } else if (item instanceof RegExp) {
102
103
  return (
103
- /** @type {string} */
104
- className => item.test(className)
105
- );
104
+ /** @type {string} */
105
+ className) => item.test(className);
106
106
  }
107
107
 
108
108
  return _lodash.noop;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","noop","some","remove","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAT,CAAwBC,QAAxB,EAAkCC,GAAlC,EAAuCC,MAAvC,EAA+CC,MAA/C,EAAwD;AACtEC,EAAAA,KAAK,CAACC,IAAN,CAAYL,QAAZ,EAAuBM,OAAvB;AACC;AAAuDC,EAAAA,IADxB,IAE3B;AAAA;;AACJ,UAAMC,GAAG,GAAGD,IAAI,CAACE,QAAL,CAAcC,WAAd,EAAZ,CADI,CAGJ;AACA;;AACA,QACCR,MAAM,CAACS,cAAP,CAAuBH,GAAvB,MACE,CAAEN,MAAM,CAAEM,GAAF,CAAN,CAAcI,OAAhB,2BAA2B,eAAAV,MAAM,CAAEM,GAAF,CAAN,EAAcI,OAAzC,gDAA2B,sCAAyBL,IAAzB,CAD7B,CADD,EAGE;AACD,UAAK,wBAAWA,IAAX,CAAL,EAAyB;AACxB,cAAM;AACLM,UAAAA,UAAU,GAAG,EADR;AAELC,UAAAA,OAAO,GAAG,EAFL;AAGLC,UAAAA,QAHK;AAILC,UAAAA,OAAO,GAAG,EAJL;AAKLC,UAAAA;AALK,YAMFf,MAAM,CAAEM,GAAF,CANV,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nB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAE,wCAAmBI,IAAnB,CADF,IAEAA,IAAI,CAACgC,kBAHN,EAIE;AACD,kCAAatC,GAAG,CAACuC,aAAJ,CAAmB,IAAnB,CAAb,EAAwCjC,IAAxC;AACA;;AAED,2BAAQA,IAAR;AACA;AACD,GAjJD;AAkJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, noop } from 'lodash';\n\n/**\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\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) => {\n\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t// function, or with an isMatch function that matches the node.\n\t\tif (\n\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t) {\n\t\t\tif ( isElement( node ) ) {\n\t\t\t\tconst {\n\t\t\t\t\tattributes = [],\n\t\t\t\t\tclasses = [],\n\t\t\t\t\tchildren,\n\t\t\t\t\trequire = [],\n\t\t\t\t\tallowEmpty,\n\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t// remove the node.\n\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\tremove( node );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\tclassName === item;\n\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\titem.test( className );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\tisMatch( name )\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\tnode.classList.remove( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tunwrap( node );\n\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// contains children that are block content, unwrap\n\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t( child ) => ! isPhrasingContent( child )\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\tunwrap( node );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t} else {\n\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t// are not phrasing content.\n\t\t\tif (\n\t\t\t\tinline &&\n\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\tnode.nextElementSibling\n\t\t\t) {\n\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t}\n\n\t\t\tunwrap( node );\n\t\t}\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","noop","some","remove","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA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B,UADO,EAEZlC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;AAMA,mCAAQI,IAAR,EAPC,CAQD;AACA;AACA;AACA,aAdD,MAcO,IACNA,IAAI,CAAC6B,UAAL,IACA7B,IAAI,CAAC6B,UAAL,CAAgB3B,QAAhB,KAA6B,MAD7B,IAEA,wCAAmBF,IAAnB,CAHM,EAIL;AACDR,cAAAA,aAAa,CACZQ,IAAI,CAAC4B,UADO,EAEZlC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;;AAOA,kBACCC,KAAK,CAACC,IAAN,CAAYE,IAAI,CAAC4B,UAAjB,EAA8BL,IAA9B,CACGO,KAAF,IAAa,CAAE,wCAAmBA,KAAnB,CADhB,CADD,EAIE;AACD,qCAAQ9B,IAAR;AACA;AACD,aAnBM,MAmBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC4B,UADO,EAEZlC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA3Cc,CA4Cf;;AACA,WA7CD,MA6CO;AACN,mBAAQI,IAAI,CAAC+B,UAAb,EAA0B;AACzB,mCAAQ/B,IAAI,CAAC+B,UAAb;AACA;AACD;AACD;AACD,OAtHA,CAuHD;;AACA,KA3HD,MA2HO;AACNvC,MAAAA,aAAa,CAAEQ,IAAI,CAAC4B,UAAP,EAAmBlC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAE,wCAAmBI,IAAnB,CADF,IAEAA,IAAI,CAACgC,kBAHN,EAIE;AACD,kCAAatC,GAAG,CAACuC,aAAJ,CAAmB,IAAnB,CAAb,EAAwCjC,IAAxC;AACA;;AAED,2BAAQA,IAAR;AACA;AACD,GAjJD;AAkJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, noop } from 'lodash';\n\n/**\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\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) => {\n\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t// function, or with an isMatch function that matches the node.\n\t\tif (\n\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t) {\n\t\t\tif ( isElement( node ) ) {\n\t\t\t\tconst {\n\t\t\t\t\tattributes = [],\n\t\t\t\t\tclasses = [],\n\t\t\t\t\tchildren,\n\t\t\t\t\trequire = [],\n\t\t\t\t\tallowEmpty,\n\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t// remove the node.\n\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\tremove( node );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\tclassName === item;\n\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\titem.test( className );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\tisMatch( name )\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\tnode.classList.remove( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tunwrap( node );\n\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// contains children that are block content, unwrap\n\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t( child ) => ! isPhrasingContent( child )\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\tunwrap( node );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t} else {\n\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t// are not phrasing content.\n\t\t\tif (\n\t\t\t\tinline &&\n\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\tnode.nextElementSibling\n\t\t\t) {\n\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t}\n\n\t\t\tunwrap( node );\n\t\t}\n\t} );\n}\n"]}
@@ -19,12 +19,18 @@ function getRangeHeight(range) {
19
19
  return;
20
20
  }
21
21
 
22
- const highestTop = Math.min(...rects.map(({
23
- top
24
- }) => top));
25
- const lowestBottom = Math.max(...rects.map(({
26
- bottom
27
- }) => bottom));
22
+ const highestTop = Math.min(...rects.map(_ref => {
23
+ let {
24
+ top
25
+ } = _ref;
26
+ return top;
27
+ }));
28
+ const lowestBottom = Math.max(...rects.map(_ref2 => {
29
+ let {
30
+ bottom
31
+ } = _ref2;
32
+ return bottom;
33
+ }));
28
34
  return lowestBottom - highestTop;
29
35
  }
30
36
  //# sourceMappingURL=get-range-height.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/get-range-height.js"],"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AAC/C,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,KAAK,CAACI,cAAN,EAAZ,CAAd;;AAEA,MAAK,CAAEH,KAAK,CAACI,MAAb,EAAsB;AACrB;AACA;;AAED,QAAMC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAAU,GAAGP,KAAK,CAACQ,GAAN,CAAW,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAeA,GAA1B,CAAb,CAAnB;AACA,QAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAL,CAAU,GAAGX,KAAK,CAACQ,GAAN,CAAW,CAAE;AAAEI,IAAAA;AAAF,GAAF,KAAkBA,MAA7B,CAAb,CAArB;AAEA,SAAOF,YAAY,GAAGL,UAAtB;AACA","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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/get-range-height.js"],"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AAC/C,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,KAAK,CAACI,cAAN,EAAZ,CAAd;;AAEA,MAAK,CAAEH,KAAK,CAACI,MAAb,EAAsB;AACrB;AACA;;AAED,QAAMC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAAU,GAAGP,KAAK,CAACQ,GAAN,CAAW;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAeA,GAAf;AAAA,GAAX,CAAb,CAAnB;AACA,QAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAL,CAAU,GAAGX,KAAK,CAACQ,GAAN,CAAW;AAAA,QAAE;AAAEI,MAAAA;AAAF,KAAF;AAAA,WAAkBA,MAAlB;AAAA,GAAX,CAAb,CAArB;AAEA,SAAOF,YAAY,GAAGL,UAAtB;AACA","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"]}
@@ -30,9 +30,12 @@ function getRectangleFromRange(range) {
30
30
  } // Ignore tiny selection at the edge of a range.
31
31
 
32
32
 
33
- const filteredRects = rects.filter(({
34
- width
35
- }) => width > 1); // If it's full of tiny selections, return browser default.
33
+ const filteredRects = rects.filter(_ref => {
34
+ let {
35
+ width
36
+ } = _ref;
37
+ return width > 1;
38
+ }); // If it's full of tiny selections, return browser default.
36
39
 
37
40
  if (filteredRects.length === 0) {
38
41
  return range.getBoundingClientRect();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["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","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AACtD;AACA;AACA;AACA,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Defined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\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 ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\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[]} */ ( Array.from(\n\t\t\tparentNode.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\tlet rect = range.getClientRects()[ 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 ) {\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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["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","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AACtD;AACA;AACA;AACA,MAAK,CAAEA,KAAK,CAACC,SAAb,EAAyB;AACxB,UAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYJ,KAAK,CAACK,cAAN,EAAZ,CAAd,CADwB,CAGxB;;AACA,QAAKH,KAAK,CAACI,MAAN,KAAiB,CAAtB,EAA0B;AACzB,aAAOJ,KAAK,CAAE,CAAF,CAAZ;AACA,KANuB,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AAA;AAAF,QAAiBH,cAAvB;AACA,0CAAiBG,UAAjB,EAA6B,YAA7B;AACA,UAAMC,KAAK;AAAG;AAAwBtB,IAAAA,KAAK,CAACC,IAAN,CACrCoB,UAAU,CAACE,UAD0B,CAAF,CAEhCC,OAFgC,CAEvBN,cAFuB,CAApC;AAIA,0CAAiBC,aAAjB,EAAgC,eAAhC;AACAtB,IAAAA,KAAK,GAAGsB,aAAa,CAACM,WAAd,EAAR;AACA5B,IAAAA,KAAK,CAAC6B,QAAN,CAAgBL,UAAhB,EAA4BC,KAA5B;AACAzB,IAAAA,KAAK,CAAC8B,MAAN,CAAcN,UAAd,EAA0BC,KAA1B;AACA;;AAED,MAAIM,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAX,CA/DsD,CAiEtD;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAE0B,IAAP,EAAc;AACb,0CAAiBT,aAAjB,EAAgC,eAAhC;AACA,UAAMU,OAAO,GAAGV,aAAa,CAACW,cAAd,CAA8B,QAA9B,CAAhB,CAFa,CAGb;;AACAjC,IAAAA,KAAK,GAAGA,KAAK,CAACkC,UAAN,EAAR;AACAlC,IAAAA,KAAK,CAACmC,UAAN,CAAkBH,OAAlB;AACAD,IAAAA,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAP;AACA,0CAAiB2B,OAAO,CAACR,UAAzB,EAAqC,oBAArC;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\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 ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\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[]} */ ( Array.from(\n\t\t\tparentNode.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\tlet rect = range.getClientRects()[ 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 ) {\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"]}
@@ -5,12 +5,24 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ Object.defineProperty(exports, "__unstableStripHTML", {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _stripHtml.default;
12
+ }
13
+ });
8
14
  Object.defineProperty(exports, "computeCaretRect", {
9
15
  enumerable: true,
10
16
  get: function () {
11
17
  return _computeCaretRect.default;
12
18
  }
13
19
  });
20
+ Object.defineProperty(exports, "documentHasSelection", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return _documentHasSelection.default;
24
+ }
25
+ });
14
26
  Object.defineProperty(exports, "documentHasTextSelection", {
15
27
  enumerable: true,
16
28
  get: function () {
@@ -23,10 +35,10 @@ Object.defineProperty(exports, "documentHasUncollapsedSelection", {
23
35
  return _documentHasUncollapsedSelection.default;
24
36
  }
25
37
  });
26
- Object.defineProperty(exports, "documentHasSelection", {
38
+ Object.defineProperty(exports, "getOffsetParent", {
27
39
  enumerable: true,
28
40
  get: function () {
29
- return _documentHasSelection.default;
41
+ return _getOffsetParent.default;
30
42
  }
31
43
  });
32
44
  Object.defineProperty(exports, "getRectangleFromRange", {
@@ -41,10 +53,16 @@ Object.defineProperty(exports, "getScrollContainer", {
41
53
  return _getScrollContainer.default;
42
54
  }
43
55
  });
44
- Object.defineProperty(exports, "getOffsetParent", {
56
+ Object.defineProperty(exports, "insertAfter", {
45
57
  enumerable: true,
46
58
  get: function () {
47
- return _getOffsetParent.default;
59
+ return _insertAfter.default;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, "isEmpty", {
63
+ enumerable: true,
64
+ get: function () {
65
+ return _isEmpty.default;
48
66
  }
49
67
  });
50
68
  Object.defineProperty(exports, "isEntirelySelected", {
@@ -65,6 +83,12 @@ Object.defineProperty(exports, "isNumberInput", {
65
83
  return _isNumberInput.default;
66
84
  }
67
85
  });
86
+ Object.defineProperty(exports, "isRTL", {
87
+ enumerable: true,
88
+ get: function () {
89
+ return _isRtl.default;
90
+ }
91
+ });
68
92
  Object.defineProperty(exports, "isTextField", {
69
93
  enumerable: true,
70
94
  get: function () {
@@ -89,28 +113,22 @@ Object.defineProperty(exports, "placeCaretAtVerticalEdge", {
89
113
  return _placeCaretAtVerticalEdge.default;
90
114
  }
91
115
  });
92
- Object.defineProperty(exports, "replace", {
93
- enumerable: true,
94
- get: function () {
95
- return _replace.default;
96
- }
97
- });
98
116
  Object.defineProperty(exports, "remove", {
99
117
  enumerable: true,
100
118
  get: function () {
101
119
  return _remove.default;
102
120
  }
103
121
  });
104
- Object.defineProperty(exports, "insertAfter", {
122
+ Object.defineProperty(exports, "removeInvalidHTML", {
105
123
  enumerable: true,
106
124
  get: function () {
107
- return _insertAfter.default;
125
+ return _removeInvalidHtml.default;
108
126
  }
109
127
  });
110
- Object.defineProperty(exports, "unwrap", {
128
+ Object.defineProperty(exports, "replace", {
111
129
  enumerable: true,
112
130
  get: function () {
113
- return _unwrap.default;
131
+ return _replace.default;
114
132
  }
115
133
  });
116
134
  Object.defineProperty(exports, "replaceTag", {
@@ -119,40 +137,22 @@ Object.defineProperty(exports, "replaceTag", {
119
137
  return _replaceTag.default;
120
138
  }
121
139
  });
122
- Object.defineProperty(exports, "wrap", {
123
- enumerable: true,
124
- get: function () {
125
- return _wrap.default;
126
- }
127
- });
128
- Object.defineProperty(exports, "__unstableStripHTML", {
129
- enumerable: true,
130
- get: function () {
131
- return _stripHtml.default;
132
- }
133
- });
134
- Object.defineProperty(exports, "isEmpty", {
135
- enumerable: true,
136
- get: function () {
137
- return _isEmpty.default;
138
- }
139
- });
140
- Object.defineProperty(exports, "removeInvalidHTML", {
140
+ Object.defineProperty(exports, "safeHTML", {
141
141
  enumerable: true,
142
142
  get: function () {
143
- return _removeInvalidHtml.default;
143
+ return _safeHtml.default;
144
144
  }
145
145
  });
146
- Object.defineProperty(exports, "isRTL", {
146
+ Object.defineProperty(exports, "unwrap", {
147
147
  enumerable: true,
148
148
  get: function () {
149
- return _isRtl.default;
149
+ return _unwrap.default;
150
150
  }
151
151
  });
152
- Object.defineProperty(exports, "safeHTML", {
152
+ Object.defineProperty(exports, "wrap", {
153
153
  enumerable: true,
154
154
  get: function () {
155
- return _safeHtml.default;
155
+ return _wrap.default;
156
156
  }
157
157
  });
158
158
 
@@ -36,7 +36,9 @@ var _isInputOrTextArea = _interopRequireDefault(require("./is-input-or-text-area
36
36
  *
37
37
  * @return {boolean} True if at the edge, false if not.
38
38
  */
39
- function isEdge(container, isReverse, onlyVertical = false) {
39
+ function isEdge(container, isReverse) {
40
+ let onlyVertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
41
+
40
42
  if ((0, _isInputOrTextArea.default)(container) && typeof container.selectionStart === 'number') {
41
43
  if (container.selectionStart !== container.selectionEnd) {
42
44
  return false;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"m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CAAEC,YAAF,CAAR,GAA2Bd,SAAS,CAAEc,YAAF,CAAzD;AACA,QAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAF,CAAR,GAA6BhB,kBAAkB,CAAEgB,cAAF,CADhD,CAhG4E,CAmG5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","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';\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 {Element} 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 ( ! (/** @type {HTMLElement} */ ( 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 = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( 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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AATA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAT,CAAiBC,SAAjB,EAA4BC,SAA5B,EAA8D;AAAA,MAAvBC,YAAuB,uEAAR,KAAQ;;AAC5E,MACC,gCAAmBF,SAAnB,KACA,OAAOA,SAAS,CAACG,cAAjB,KAAoC,QAFrC,EAGE;AACD,QAAKH,SAAS,CAACG,cAAV,KAA6BH,SAAS,CAACI,YAA5C,EAA2D;AAC1D,aAAO,KAAP;AACA;;AAED,QAAKH,SAAL,EAAiB;AAChB,aAAOD,SAAS,CAACG,cAAV,KAA6B,CAApC;AACA;;AAED,WAAOH,SAAS,CAACK,KAAV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AGzB,SAAS,CAAC0B,qBAAV,EAAtB,CA9D4E,CAgE5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMC,CAAC,GAAGH,YAAY,GAAGC,aAAa,CAACG,IAAd,GAAqB,CAAxB,GAA4BH,aAAa,CAACI,KAAd,GAAsB,CAAxE;AACA,QAAMC,CAAC,GAAG7B,SAAS,GAAGwB,aAAa,CAACM,GAAd,GAAoB,CAAvB,GAA2BN,aAAa,CAACO,MAAd,GAAuB,CAArE;AACA,QAAMC,SAAS,GAAG,wCACjBzB,aADiB,EAEjBmB,CAFiB,EAGjBG,CAHiB;AAIjB;AAA6B9B,EAAAA,SAJZ,CAAlB;;AAOA,MAAK,CAAEiC,SAAP,EAAmB;AAClB,WAAO,KAAP;AACA;;AAED,QAAMC,QAAQ,GAAG,oCAAuBD,SAAvB,CAAjB;;AAEA,MAAK,CAAEC,QAAP,EAAkB;AACjB,WAAO,KAAP;AACA;;AAED,QAAMC,YAAY,GAAGlC,SAAS,GAAG,KAAH,GAAW,QAAzC;AACA,QAAMmC,cAAc,GAAGZ,YAAY,GAAG,MAAH,GAAY,OAA/C;AACA,QAAMa,YAAY,GAAGH,QAAQ,CAAEC,YAAF,CAAR,GAA2Bd,SAAS,CAAEc,YAAF,CAAzD;AACA,QAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAF,CAAR,GAA6BhB,kBAAkB,CAAEgB,cAAF,CADhD,CAhG4E,CAmG5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","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';\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 {Element} 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 ( ! (/** @type {HTMLElement} */ ( 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 = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( 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"]}
@@ -91,9 +91,11 @@ function isValidFocusableArea(element) {
91
91
  */
92
92
 
93
93
 
94
- function find(context, {
95
- sequential = false
96
- } = {}) {
94
+ function find(context) {
95
+ let {
96
+ sequential = false
97
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
98
+
97
99
  /* eslint-disable jsdoc/no-undefined-types */
98
100
 
99
101
  /** @type {NodeListOf<HTMLElement>} */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,UAAxB,EAAqC;AACpC,SAAO,CACNA,UAAU,GAAG,iCAAH,GAAuC,YAD3C,EAEN,SAFM,EAGN,wBAHM,EAIN,4CAJM,EAKN,wBALM,EAMN,0BANM,EAON,6BAPM,EAQN,QARM,EASN,OATM,EAUN,YAVM,EAWN,gDAXM,EAYLC,IAZK,CAYC,GAZD,CAAP;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,SACCA,OAAO,CAACC,WAAR,GAAsB,CAAtB,IACAD,OAAO,CAACE,YAAR,GAAuB,CADvB,IAEAF,OAAO,CAACG,cAAR,GAAyBC,MAAzB,GAAkC,CAHnC;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BL,OAA/B,EAAyC;AACxC;AACA,QAAMM,GAAG,GAAGN,OAAO,CAACO,OAAR,CAAiB,WAAjB,CAAZ;;AACA,MAAK,CAAED,GAAP,EAAa;AACZ,WAAO,KAAP;AACA;AAED;;;AACA,QAAME,GAAG,GAAGR,OAAO,CAACS,aAAR,CAAsBC,aAAtB,CACX,kBAAkBJ,GAAG,CAACK,IAAtB,GAA6B,IADlB,CAAZ;AAGA,SAAO,CAAC,CAAEH,GAAH,IAAUT,SAAS,CAAES,GAAF,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,IAAT,CAAeC,OAAf,EAAwB;AAAEhB,EAAAA,UAAU,GAAG;AAAf,IAAyB,EAAjD,EAAsD;AAC5D;;AACA;;AACA;AACA,QAAMiB,QAAQ,GAAGD,OAAO,CAACE,gBAAR,CAA0BnB,aAAa,CAAEC,UAAF,CAAvC,CAAjB;AAEA,SAAOmB,KAAK,CAACC,IAAN,CAAYH,QAAZ,EAAuBI,MAAvB,CAAiClB,OAAF,IAAe;AACpD,QAAK,CAAED,SAAS,CAAEC,OAAF,CAAhB,EAA8B;AAC7B,aAAO,KAAP;AACA;;AAED,UAAM;AAAEmB,MAAAA;AAAF,QAAenB,OAArB;;AACA,QAAK,WAAWmB,QAAhB,EAA2B;AAC1B,aAAOd,oBAAoB;AAC1B;AAAiCL,MAAAA,OADP,CAA3B;AAGA;;AAED,WAAO,IAAP;AACA,GAbM,CAAP;AAcA","sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} [options]\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {Element[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,UAAxB,EAAqC;AACpC,SAAO,CACNA,UAAU,GAAG,iCAAH,GAAuC,YAD3C,EAEN,SAFM,EAGN,wBAHM,EAIN,4CAJM,EAKN,wBALM,EAMN,0BANM,EAON,6BAPM,EAQN,QARM,EASN,OATM,EAUN,YAVM,EAWN,gDAXM,EAYLC,IAZK,CAYC,GAZD,CAAP;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,SACCA,OAAO,CAACC,WAAR,GAAsB,CAAtB,IACAD,OAAO,CAACE,YAAR,GAAuB,CADvB,IAEAF,OAAO,CAACG,cAAR,GAAyBC,MAAzB,GAAkC,CAHnC;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BL,OAA/B,EAAyC;AACxC;AACA,QAAMM,GAAG,GAAGN,OAAO,CAACO,OAAR,CAAiB,WAAjB,CAAZ;;AACA,MAAK,CAAED,GAAP,EAAa;AACZ,WAAO,KAAP;AACA;AAED;;;AACA,QAAME,GAAG,GAAGR,OAAO,CAACS,aAAR,CAAsBC,aAAtB,CACX,kBAAkBJ,GAAG,CAACK,IAAtB,GAA6B,IADlB,CAAZ;AAGA,SAAO,CAAC,CAAEH,GAAH,IAAUT,SAAS,CAAES,GAAF,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,IAAT,CAAeC,OAAf,EAAsD;AAAA,MAA9B;AAAEhB,IAAAA,UAAU,GAAG;AAAf,GAA8B,uEAAL,EAAK;;AAC5D;;AACA;;AACA;AACA,QAAMiB,QAAQ,GAAGD,OAAO,CAACE,gBAAR,CAA0BnB,aAAa,CAAEC,UAAF,CAAvC,CAAjB;AAEA,SAAOmB,KAAK,CAACC,IAAN,CAAYH,QAAZ,EAAuBI,MAAvB,CAAiClB,OAAF,IAAe;AACpD,QAAK,CAAED,SAAS,CAAEC,OAAF,CAAhB,EAA8B;AAC7B,aAAO,KAAP;AACA;;AAED,UAAM;AAAEmB,MAAAA;AAAF,QAAenB,OAArB;;AACA,QAAK,WAAWmB,QAAhB,EAA2B;AAC1B,aAAOd,oBAAoB;AAC1B;AAAiCL,MAAAA,OADP,CAA3B;AAGA;;AAED,WAAO,IAAP;AACA,GAbM,CAAP;AAcA","sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} [options]\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {Element[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"]}
package/build/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -56,6 +54,10 @@ Object.keys(_dataTransfer).forEach(function (key) {
56
54
  });
57
55
  });
58
56
 
57
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
58
+
59
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
60
+
59
61
  /**
60
62
  * Internal dependencies
61
63
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/index.js"],"names":["focus","focusable","tabbable"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAQA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG;AAAEC,EAAAA,SAAF;AAAaC,EAAAA;AAAb,CAAd","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/index.js"],"names":["focus","focusable","tabbable"],"mappings":";;;;;;;;;;AAGA;;AACA;;AAQA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;AAdA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG;AAAEC,EAAAA,SAAF;AAAaC,EAAAA;AAAb,CAAd","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"]}
package/build/tabbable.js CHANGED
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isTabbableIndex = isTabbableIndex;
7
6
  exports.find = find;
8
- exports.findPrevious = findPrevious;
9
7
  exports.findNext = findNext;
8
+ exports.findPrevious = findPrevious;
9
+ exports.isTabbableIndex = isTabbableIndex;
10
10
 
11
11
  var _lodash = require("lodash");
12
12
 
@@ -10,11 +10,14 @@ export function getFilesFromDataTransfer(dataTransfer) {
10
10
  Array.from(dataTransfer.items).forEach(item => {
11
11
  const file = item.getAsFile();
12
12
 
13
- if (file && !files.find(({
14
- name,
15
- type,
16
- size
17
- }) => name === file.name && type === file.type && size === file.size)) {
13
+ if (file && !files.find(_ref => {
14
+ let {
15
+ name,
16
+ type,
17
+ size
18
+ } = _ref;
19
+ return name === file.name && type === file.type && size === file.size;
20
+ })) {
18
21
  files.push(file);
19
22
  }
20
23
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/data-transfer.js"],"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,wBAAT,CAAmCC,YAAnC,EAAkD;AACxD,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACC,KAAzB,CAAd;AAEAC,EAAAA,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACI,KAAzB,EAAiCC,OAAjC,CAA4CC,IAAF,IAAY;AACrD,UAAMC,IAAI,GAAGD,IAAI,CAACE,SAAL,EAAb;;AAEA,QACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAN,CACD,CAAE;AAAEC,MAAAA,IAAF;AAAQC,MAAAA,IAAR;AAAcC,MAAAA;AAAd,KAAF,KACCF,IAAI,KAAKH,IAAI,CAACG,IAAd,IACAC,IAAI,KAAKJ,IAAI,CAACI,IADd,IAEAC,IAAI,KAAKL,IAAI,CAACK,IAJd,CAFH,EAQE;AACDX,MAAAA,KAAK,CAACY,IAAN,CAAYN,IAAZ;AACA;AACD,GAdD;AAgBA,SAAON,KAAP;AACA","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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/data-transfer.js"],"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,wBAAT,CAAmCC,YAAnC,EAAkD;AACxD,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACC,KAAzB,CAAd;AAEAC,EAAAA,KAAK,CAACC,IAAN,CAAYH,YAAY,CAACI,KAAzB,EAAiCC,OAAjC,CAA4CC,IAAF,IAAY;AACrD,UAAMC,IAAI,GAAGD,IAAI,CAACE,SAAL,EAAb;;AAEA,QACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAN,CACD;AAAA,UAAE;AAAEC,QAAAA,IAAF;AAAQC,QAAAA,IAAR;AAAcC,QAAAA;AAAd,OAAF;AAAA,aACCF,IAAI,KAAKH,IAAI,CAACG,IAAd,IACAC,IAAI,KAAKJ,IAAI,CAACI,IADd,IAEAC,IAAI,KAAKL,IAAI,CAACK,IAHf;AAAA,KADC,CAFH,EAQE;AACDX,MAAAA,KAAK,CAACY,IAAN,CAAYN,IAAZ;AACA;AACD,GAdD;AAgBA,SAAON,KAAP;AACA","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"]}
@@ -39,9 +39,9 @@ import isElement from './is-element';
39
39
  */
40
40
 
41
41
  export default function cleanNodeList(nodeList, doc, schema, inline) {
42
- Array.from(nodeList).forEach(
42
+ Array.from(nodeList).forEach((
43
43
  /** @type {Node & { nextElementSibling?: unknown }} */
44
- node => {
44
+ node) => {
45
45
  var _schema$tag$isMatch, _schema$tag;
46
46
 
47
47
  const tag = node.nodeName.toLowerCase(); // It's a valid child, if the tag exists in the schema without an isMatch
@@ -65,9 +65,11 @@ export default function cleanNodeList(nodeList, doc, schema, inline) {
65
65
 
66
66
  if (node.hasAttributes()) {
67
67
  // Strip invalid attributes.
68
- Array.from(node.attributes).forEach(({
69
- name
70
- }) => {
68
+ Array.from(node.attributes).forEach(_ref => {
69
+ let {
70
+ name
71
+ } = _ref;
72
+
71
73
  if (name !== 'class' && !includes(attributes, name)) {
72
74
  node.removeAttribute(name);
73
75
  }
@@ -79,14 +81,12 @@ export default function cleanNodeList(nodeList, doc, schema, inline) {
79
81
  const mattchers = classes.map(item => {
80
82
  if (typeof item === 'string') {
81
83
  return (
82
- /** @type {string} */
83
- className => className === item
84
- );
84
+ /** @type {string} */
85
+ className) => className === item;
85
86
  } else if (item instanceof RegExp) {
86
87
  return (
87
- /** @type {string} */
88
- className => item.test(className)
89
- );
88
+ /** @type {string} */
89
+ className) => item.test(className);
90
90
  }
91
91
 
92
92
  return noop;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["includes","noop","isEmpty","remove","unwrap","isPhrasingContent","insertAfter","isElement","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,IAAnB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,aAAT,CAAwBC,QAAxB,EAAkCC,GAAlC,EAAuCC,MAAvC,EAA+CC,MAA/C,EAAwD;AACtEC,EAAAA,KAAK,CAACC,IAAN,CAAYL,QAAZ,EAAuBM,OAA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AAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;;AAOA,kBACCC,KAAK,CAACC,IAAN,CAAYE,IAAI,CAAC0B,UAAjB,EAA8BJ,IAA9B,CACGM,KAAF,IAAa,CAAEvC,iBAAiB,CAAEuC,KAAF,CADjC,CADD,EAIE;AACDxC,gBAAAA,MAAM,CAAEY,IAAF,CAAN;AACA;AACD,aAnBM,MAmBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA3Cc,CA4Cf;;AACA,WA7CD,MA6CO;AACN,mBAAQI,IAAI,CAAC6B,UAAb,EAA0B;AACzB1C,cAAAA,MAAM,CAAEa,IAAI,CAAC6B,UAAP,CAAN;AACA;AACD;AACD;AACD,OAtHA,CAuHD;;AACA,KA3HD,MA2HO;AACNrC,MAAAA,aAAa,CAAEQ,IAAI,CAAC0B,UAAP,EAAmBhC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAEP,iBAAiB,CAAEW,IAAF,CADnB,IAEAA,IAAI,CAAC8B,kBAHN,EAIE;AACDxC,QAAAA,WAAW,CAAEI,GAAG,CAACqC,aAAJ,CAAmB,IAAnB,CAAF,EAA6B/B,IAA7B,CAAX;AACA;;AAEDZ,MAAAA,MAAM,CAAEY,IAAF,CAAN;AACA;AACD,GAjJD;AAkJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, noop } from 'lodash';\n\n/**\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\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) => {\n\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t// function, or with an isMatch function that matches the node.\n\t\tif (\n\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t) {\n\t\t\tif ( isElement( node ) ) {\n\t\t\t\tconst {\n\t\t\t\t\tattributes = [],\n\t\t\t\t\tclasses = [],\n\t\t\t\t\tchildren,\n\t\t\t\t\trequire = [],\n\t\t\t\t\tallowEmpty,\n\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t// remove the node.\n\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\tremove( node );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\tclassName === item;\n\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\titem.test( className );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\tisMatch( name )\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\tnode.classList.remove( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tunwrap( node );\n\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// contains children that are block content, unwrap\n\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t( child ) => ! isPhrasingContent( child )\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\tunwrap( node );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t} else {\n\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t// are not phrasing content.\n\t\t\tif (\n\t\t\t\tinline &&\n\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\tnode.nextElementSibling\n\t\t\t) {\n\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t}\n\n\t\t\tunwrap( node );\n\t\t}\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"names":["includes","noop","isEmpty","remove","unwrap","isPhrasingContent","insertAfter","isElement","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,IAAnB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,aAAT,CAAwBC,QAAxB,EAAkCC,GAAlC,EAAuCC,MAAvC,EAA+CC,MAA/C,EAAwD;AACtEC,EAAAA,KAAK,CAACC,IAAN,CAAYL,QAAZ,EAAuBM,OAAvB,CAAgC;AAC/B;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AAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZC,MAHY,EAIZC,MAJY,CAAb;;AAOA,kBACCC,KAAK,CAACC,IAAN,CAAYE,IAAI,CAAC0B,UAAjB,EAA8BJ,IAA9B,CACGM,KAAF,IAAa,CAAEvC,iBAAiB,CAAEuC,KAAF,CADjC,CADD,EAIE;AACDxC,gBAAAA,MAAM,CAAEY,IAAF,CAAN;AACA;AACD,aAnBM,MAmBA;AACNR,cAAAA,aAAa,CACZQ,IAAI,CAAC0B,UADO,EAEZhC,GAFY,EAGZc,QAHY,EAIZZ,MAJY,CAAb;AAMA,aA3Cc,CA4Cf;;AACA,WA7CD,MA6CO;AACN,mBAAQI,IAAI,CAAC6B,UAAb,EAA0B;AACzB1C,cAAAA,MAAM,CAAEa,IAAI,CAAC6B,UAAP,CAAN;AACA;AACD;AACD;AACD,OAtHA,CAuHD;;AACA,KA3HD,MA2HO;AACNrC,MAAAA,aAAa,CAAEQ,IAAI,CAAC0B,UAAP,EAAmBhC,GAAnB,EAAwBC,MAAxB,EAAgCC,MAAhC,CAAb,CADM,CAGN;AACA;;AACA,UACCA,MAAM,IACN,CAAEP,iBAAiB,CAAEW,IAAF,CADnB,IAEAA,IAAI,CAAC8B,kBAHN,EAIE;AACDxC,QAAAA,WAAW,CAAEI,GAAG,CAACqC,aAAJ,CAAmB,IAAnB,CAAF,EAA6B/B,IAA7B,CAAX;AACA;;AAEDZ,MAAAA,MAAM,CAAEY,IAAF,CAAN;AACA;AACD,GAjJD;AAkJA","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, noop } from 'lodash';\n\n/**\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\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) => {\n\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t// function, or with an isMatch function that matches the node.\n\t\tif (\n\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t) {\n\t\t\tif ( isElement( node ) ) {\n\t\t\t\tconst {\n\t\t\t\t\tattributes = [],\n\t\t\t\t\tclasses = [],\n\t\t\t\t\tchildren,\n\t\t\t\t\trequire = [],\n\t\t\t\t\tallowEmpty,\n\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t// remove the node.\n\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\tremove( node );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t! includes( attributes, name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\tclassName === item;\n\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\treturn ( /** @type {string} */ className ) =>\n\t\t\t\t\t\t\t\t\titem.test( className );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\tisMatch( name )\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\tnode.classList.remove( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tunwrap( node );\n\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// contains children that are block content, unwrap\n\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t( child ) => ! isPhrasingContent( child )\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\tunwrap( node );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t} else {\n\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t// are not phrasing content.\n\t\t\tif (\n\t\t\t\tinline &&\n\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\tnode.nextElementSibling\n\t\t\t) {\n\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t}\n\n\t\t\tunwrap( node );\n\t\t}\n\t} );\n}\n"]}
@@ -12,12 +12,18 @@ export default function getRangeHeight(range) {
12
12
  return;
13
13
  }
14
14
 
15
- const highestTop = Math.min(...rects.map(({
16
- top
17
- }) => top));
18
- const lowestBottom = Math.max(...rects.map(({
19
- bottom
20
- }) => bottom));
15
+ const highestTop = Math.min(...rects.map(_ref => {
16
+ let {
17
+ top
18
+ } = _ref;
19
+ return top;
20
+ }));
21
+ const lowestBottom = Math.max(...rects.map(_ref2 => {
22
+ let {
23
+ bottom
24
+ } = _ref2;
25
+ return bottom;
26
+ }));
21
27
  return lowestBottom - highestTop;
22
28
  }
23
29
  //# sourceMappingURL=get-range-height.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/get-range-height.js"],"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AAC/C,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,KAAK,CAACI,cAAN,EAAZ,CAAd;;AAEA,MAAK,CAAEH,KAAK,CAACI,MAAb,EAAsB;AACrB;AACA;;AAED,QAAMC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAAU,GAAGP,KAAK,CAACQ,GAAN,CAAW,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAeA,GAA1B,CAAb,CAAnB;AACA,QAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAL,CAAU,GAAGX,KAAK,CAACQ,GAAN,CAAW,CAAE;AAAEI,IAAAA;AAAF,GAAF,KAAkBA,MAA7B,CAAb,CAArB;AAEA,SAAOF,YAAY,GAAGL,UAAtB;AACA","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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/get-range-height.js"],"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AAC/C,QAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYH,KAAK,CAACI,cAAN,EAAZ,CAAd;;AAEA,MAAK,CAAEH,KAAK,CAACI,MAAb,EAAsB;AACrB;AACA;;AAED,QAAMC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAAU,GAAGP,KAAK,CAACQ,GAAN,CAAW;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAeA,GAAf;AAAA,GAAX,CAAb,CAAnB;AACA,QAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAL,CAAU,GAAGX,KAAK,CAACQ,GAAN,CAAW;AAAA,QAAE;AAAEI,MAAAA;AAAF,KAAF;AAAA,WAAkBA,MAAlB;AAAA,GAAX,CAAb,CAArB;AAEA,SAAOF,YAAY,GAAGL,UAAtB;AACA","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"]}
@@ -22,9 +22,12 @@ export default function getRectangleFromRange(range) {
22
22
  } // Ignore tiny selection at the edge of a range.
23
23
 
24
24
 
25
- const filteredRects = rects.filter(({
26
- width
27
- }) => width > 1); // If it's full of tiny selections, return browser default.
25
+ const filteredRects = rects.filter(_ref => {
26
+ let {
27
+ width
28
+ } = _ref;
29
+ return width > 1;
30
+ }); // If it's full of tiny selections, return browser default.
28
31
 
29
32
  if (filteredRects.length === 0) {
30
33
  return range.getBoundingClientRect();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["assertIsDefined","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","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,4BAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,CAAgCC,KAAhC,EAAwC;AACtD;AACA;AACA;AACA,MAAK,CAAEA,KAAK,CAACC,SAAb,EAAyB;AACxB,UAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYJ,KAAK,CAACK,cAA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,MAAoBD,cAA1B,CA/CsD,CAiDtD;;AACA,MAAKA,cAAc,CAACE,QAAf,KAA4B,IAAjC,EAAwC;AACvC,UAAM;AAAEC,MAAAA;AAAF,QAAiBH,cAAvB;AACAvB,IAAAA,eAAe,CAAE0B,UAAF,EAAc,YAAd,CAAf;AACA,UAAMC,KAAK;AAAG;AAAwBtB,IAAAA,KAAK,CAACC,IAAN,CACrCoB,UAAU,CAACE,UAD0B,CAAF,CAEhCC,OAFgC,CAEvBN,cAFuB,CAApC;AAIAvB,IAAAA,eAAe,CAAEwB,aAAF,EAAiB,eAAjB,CAAf;AACAtB,IAAAA,KAAK,GAAGsB,aAAa,CAACM,WAAd,EAAR;AACA5B,IAAAA,KAAK,CAAC6B,QAAN,CAAgBL,UAAhB,EAA4BC,KAA5B;AACAzB,IAAAA,KAAK,CAAC8B,MAAN,CAAcN,UAAd,EAA0BC,KAA1B;AACA;;AAED,MAAIM,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAX,CA/DsD,CAiEtD;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAE0B,IAAP,EAAc;AACbjC,IAAAA,eAAe,CAAEwB,aAAF,EAAiB,eAAjB,CAAf;AACA,UAAMU,OAAO,GAAGV,aAAa,CAACW,cAAd,CAA8B,QAA9B,CAAhB,CAFa,CAGb;;AACAjC,IAAAA,KAAK,GAAGA,KAAK,CAACkC,UAAN,EAAR;AACAlC,IAAAA,KAAK,CAACmC,UAAN,CAAkBH,OAAlB;AACAD,IAAAA,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAP;AACAP,IAAAA,eAAe,CAAEkC,OAAO,CAACR,UAAV,EAAsB,oBAAtB,CAAf;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\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 ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\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[]} */ ( Array.from(\n\t\t\tparentNode.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\tlet rect = range.getClientRects()[ 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 ) {\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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"names":["assertIsDefined","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","index","childNodes","indexOf","createRange","setStart","setEnd","rect","padNode","createTextNode","cloneRange","insertNode","removeChild"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,4BAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,CAAgCC,KAAhC,EAAwC;AACtD;AACA;AACA;AACA,MAAK,CAAEA,KAAK,CAACC,SAAb,EAAyB;AACxB,UAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAYJ,KAAK,CAACK,cAAN,EAAZ,CAAd,CADwB,CAGxB;;AACA,QAAKH,KAAK,CAACI,MAAN,KAAiB,CAAtB,EAA0B;AACzB,aAAOJ,KAAK,CAAE,CAAF,CAAZ;AACA,KANuB,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AAA;AAAF,QAAiBH,cAAvB;AACAvB,IAAAA,eAAe,CAAE0B,UAAF,EAAc,YAAd,CAAf;AACA,UAAMC,KAAK;AAAG;AAAwBtB,IAAAA,KAAK,CAACC,IAAN,CACrCoB,UAAU,CAACE,UAD0B,CAAF,CAEhCC,OAFgC,CAEvBN,cAFuB,CAApC;AAIAvB,IAAAA,eAAe,CAAEwB,aAAF,EAAiB,eAAjB,CAAf;AACAtB,IAAAA,KAAK,GAAGsB,aAAa,CAACM,WAAd,EAAR;AACA5B,IAAAA,KAAK,CAAC6B,QAAN,CAAgBL,UAAhB,EAA4BC,KAA5B;AACAzB,IAAAA,KAAK,CAAC8B,MAAN,CAAcN,UAAd,EAA0BC,KAA1B;AACA;;AAED,MAAIM,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAX,CA/DsD,CAiEtD;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAE0B,IAAP,EAAc;AACbjC,IAAAA,eAAe,CAAEwB,aAAF,EAAiB,eAAjB,CAAf;AACA,UAAMU,OAAO,GAAGV,aAAa,CAACW,cAAd,CAA8B,QAA9B,CAAhB,CAFa,CAGb;;AACAjC,IAAAA,KAAK,GAAGA,KAAK,CAACkC,UAAN,EAAR;AACAlC,IAAAA,KAAK,CAACmC,UAAN,CAAkBH,OAAlB;AACAD,IAAAA,IAAI,GAAG/B,KAAK,CAACK,cAAN,GAAwB,CAAxB,CAAP;AACAP,IAAAA,eAAe,CAAEkC,OAAO,CAACR,UAAV,EAAsB,oBAAtB,CAAf;AACAQ,IAAAA,OAAO,CAACR,UAAR,CAAmBY,WAAnB,CAAgCJ,OAAhC;AACA;;AAED,SAAOD,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range.\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 ) furthestTop = top;\n\t\t\tif ( bottom > furthestBottom ) furthestBottom = bottom;\n\t\t\tif ( left < furthestLeft ) furthestLeft = left;\n\t\t\tif ( right > furthestRight ) furthestRight = right;\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[]} */ ( Array.from(\n\t\t\tparentNode.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\tlet rect = range.getClientRects()[ 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 ) {\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"]}
@@ -20,7 +20,9 @@ import isInputOrTextArea from './is-input-or-text-area';
20
20
  * @return {boolean} True if at the edge, false if not.
21
21
  */
22
22
 
23
- export default function isEdge(container, isReverse, onlyVertical = false) {
23
+ export default function isEdge(container, isReverse) {
24
+ let onlyVertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
25
+
24
26
  if (isInputOrTextArea(container) && typeof container.selectionStart === 'number') {
25
27
  if (container.selectionStart !== container.selectionEnd) {
26
28
  return false;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,UAAlB;AACA,OAAO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C,SAAF,CAAtC;;AAEA,MAAK,CAAEC,QAAP,EAAkB;AACjB,WAAO,KAAP;AACA;;AAED,QAAMC,YAAY,GAAGlC,SAAS,GAAG,KAAH,GAAW,QAAzC;AACA,QAAMmC,cAAc,GAAGZ,YAAY,GAAG,MAAH,GAAY,OAA/C;AACA,QAAMa,YAAY,GAAGH,QAAQ,CAAEC,YAAF,CAAR,GAA2Bd,SAAS,CAAEc,YAAF,CAAzD;AACA,QAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAF,CAAR,GAA6BhB,kBAAkB,CAAEgB,cAAF,CADhD,CAhG4E,CAmG5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","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';\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 {Element} 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 ( ! (/** @type {HTMLElement} */ ( 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 = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( 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"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/dom/is-edge.js"],"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,UAAlB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AAC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W,QAAzC;AACA,QAAMmC,cAAc,GAAGZ,YAAY,GAAG,MAAH,GAAY,OAA/C;AACA,QAAMa,YAAY,GAAGH,QAAQ,CAAEC,YAAF,CAAR,GAA2Bd,SAAS,CAAEc,YAAF,CAAzD;AACA,QAAMG,cAAc,GACnBJ,QAAQ,CAAEE,cAAF,CAAR,GAA6BhB,kBAAkB,CAAEgB,cAAF,CADhD,CAhG4E,CAmG5E;;AACA,QAAMG,eAAe,GAAGC,IAAI,CAACC,GAAL,CAAUJ,YAAV,KAA4B,CAApD;AACA,QAAMK,iBAAiB,GAAGF,IAAI,CAACC,GAAL,CAAUH,cAAV,KAA8B,CAAxD;AAEA,SAAOpC,YAAY,GAChBqC,eADgB,GAEhBA,eAAe,IAAIG,iBAFtB;AAGA","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';\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 {Element} 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 ( ! (/** @type {HTMLElement} */ ( 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 = hiddenCaretRangeFromPoint(\n\t\townerDocument,\n\t\tx,\n\t\ty,\n\t\t/** @type {HTMLElement} */ ( 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"]}
@@ -84,9 +84,11 @@ function isValidFocusableArea(element) {
84
84
  */
85
85
 
86
86
 
87
- export function find(context, {
88
- sequential = false
89
- } = {}) {
87
+ export function find(context) {
88
+ let {
89
+ sequential = false
90
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
91
+
90
92
  /* eslint-disable jsdoc/no-undefined-types */
91
93
 
92
94
  /** @type {NodeListOf<HTMLElement>} */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,UAAxB,EAAqC;AACpC,SAAO,CACNA,UAAU,GAAG,iCAAH,GAAuC,YAD3C,EAEN,SAFM,EAGN,wBAHM,EAIN,4CAJM,EAKN,w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AAWmB,QAAhB,EAA2B;AAC1B,aAAOd,oBAAoB;AAC1B;AAAiCL,MAAAA,OADP,CAA3B;AAGA;;AAED,WAAO,IAAP;AACA,GAbM,CAAP;AAcA","sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} [options]\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {Element[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AAC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AZ,EAAuBI,MAAvB,CAAiClB,OAAF,IAAe;AACpD,QAAK,CAAED,SAAS,CAAEC,OAAF,CAAhB,EAA8B;AAC7B,aAAO,KAAP;AACA;;AAED,UAAM;AAAEmB,MAAAA;AAAF,QAAenB,OAArB;;AACA,QAAK,WAAWmB,QAAhB,EAA2B;AAC1B,aAAOd,oBAAoB;AAC1B;AAAiCL,MAAAA,OADP,CAA3B;AAGA;;AAED,WAAO,IAAP;AACA,GAbM,CAAP;AAcA","sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} [options]\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {Element[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dom",
3
- "version": "3.2.6",
3
+ "version": "3.2.7",
4
4
  "description": "DOM utilities module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -28,11 +28,11 @@
28
28
  "types": "build-types",
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@babel/runtime": "^7.13.10",
31
+ "@babel/runtime": "^7.16.0",
32
32
  "lodash": "^4.17.21"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "393c2b5533837fd637e998d23f0124c081a10df0"
37
+ "gitHead": "9a1dd3474d937468e4cf9caf9886ad61ef0a8f50"
38
38
  }