@wordpress/dom 3.54.0 → 3.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/data-transfer.js.map +1 -1
- package/build/dom/caret-range-from-point.js.map +1 -1
- package/build/dom/clean-node-list.js.map +1 -1
- package/build/dom/compute-caret-rect.js.map +1 -1
- package/build/dom/document-has-selection.js.map +1 -1
- package/build/dom/document-has-text-selection.js.map +1 -1
- package/build/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/get-computed-style.js.map +1 -1
- package/build/dom/get-offset-parent.js.map +1 -1
- package/build/dom/get-range-height.js.map +1 -1
- package/build/dom/get-rectangle-from-range.js.map +1 -1
- package/build/dom/get-scroll-container.js.map +1 -1
- package/build/dom/hidden-caret-range-from-point.js.map +1 -1
- package/build/dom/index.js.map +1 -1
- package/build/dom/input-field-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/insert-after.js.map +1 -1
- package/build/dom/is-edge.js +1 -1
- package/build/dom/is-edge.js.map +1 -1
- package/build/dom/is-element.js.map +1 -1
- package/build/dom/is-empty.js.map +1 -1
- package/build/dom/is-entirely-selected.js.map +1 -1
- package/build/dom/is-form-element.js.map +1 -1
- package/build/dom/is-horizontal-edge.js.map +1 -1
- package/build/dom/is-html-input-element.js.map +1 -1
- package/build/dom/is-input-or-text-area.js.map +1 -1
- package/build/dom/is-number-input.js.map +1 -1
- package/build/dom/is-rtl.js.map +1 -1
- package/build/dom/is-selection-forward.js.map +1 -1
- package/build/dom/is-text-field.js.map +1 -1
- package/build/dom/is-vertical-edge.js.map +1 -1
- package/build/dom/place-caret-at-edge.js.map +1 -1
- package/build/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build/dom/remove-invalid-html.js.map +1 -1
- package/build/dom/remove.js.map +1 -1
- package/build/dom/replace-tag.js.map +1 -1
- package/build/dom/replace.js.map +1 -1
- package/build/dom/safe-html.js.map +1 -1
- package/build/dom/scroll-if-no-range.js.map +1 -1
- package/build/dom/strip-html.js.map +1 -1
- package/build/dom/unwrap.js.map +1 -1
- package/build/dom/wrap.js.map +1 -1
- package/build/focusable.js +0 -2
- package/build/focusable.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/phrasing-content.js.map +1 -1
- package/build/tabbable.js +19 -25
- package/build/tabbable.js.map +1 -1
- package/build/utils/assert-is-defined.js.map +1 -1
- package/build-module/data-transfer.js.map +1 -1
- package/build-module/dom/caret-range-from-point.js.map +1 -1
- package/build-module/dom/clean-node-list.js.map +1 -1
- package/build-module/dom/compute-caret-rect.js.map +1 -1
- package/build-module/dom/document-has-selection.js.map +1 -1
- package/build-module/dom/document-has-text-selection.js.map +1 -1
- package/build-module/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build-module/dom/get-computed-style.js.map +1 -1
- package/build-module/dom/get-offset-parent.js.map +1 -1
- package/build-module/dom/get-range-height.js.map +1 -1
- package/build-module/dom/get-rectangle-from-range.js.map +1 -1
- package/build-module/dom/get-scroll-container.js.map +1 -1
- package/build-module/dom/hidden-caret-range-from-point.js.map +1 -1
- package/build-module/dom/index.js.map +1 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.js.map +1 -1
- package/build-module/dom/insert-after.js.map +1 -1
- package/build-module/dom/is-edge.js +1 -1
- package/build-module/dom/is-edge.js.map +1 -1
- package/build-module/dom/is-element.js.map +1 -1
- package/build-module/dom/is-empty.js.map +1 -1
- package/build-module/dom/is-entirely-selected.js.map +1 -1
- package/build-module/dom/is-form-element.js.map +1 -1
- package/build-module/dom/is-horizontal-edge.js.map +1 -1
- package/build-module/dom/is-html-input-element.js.map +1 -1
- package/build-module/dom/is-input-or-text-area.js.map +1 -1
- package/build-module/dom/is-number-input.js.map +1 -1
- package/build-module/dom/is-rtl.js.map +1 -1
- package/build-module/dom/is-selection-forward.js.map +1 -1
- package/build-module/dom/is-text-field.js.map +1 -1
- package/build-module/dom/is-vertical-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build-module/dom/remove-invalid-html.js.map +1 -1
- package/build-module/dom/remove.js.map +1 -1
- package/build-module/dom/replace-tag.js.map +1 -1
- package/build-module/dom/replace.js.map +1 -1
- package/build-module/dom/safe-html.js.map +1 -1
- package/build-module/dom/scroll-if-no-range.js.map +1 -1
- package/build-module/dom/strip-html.js.map +1 -1
- package/build-module/dom/unwrap.js.map +1 -1
- package/build-module/dom/wrap.js.map +1 -1
- package/build-module/focusable.js +0 -2
- package/build-module/focusable.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/phrasing-content.js.map +1 -1
- package/build-module/tabbable.js +19 -25
- package/build-module/tabbable.js.map +1 -1
- package/build-module/utils/assert-is-defined.js.map +1 -1
- package/build-types/dom/caret-range-from-point.d.ts +1 -1
- package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/clean-node-list.d.ts.map +1 -1
- package/build-types/focusable.d.ts.map +1 -1
- package/build-types/tabbable.d.ts +7 -7
- package/build-types/tabbable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/dom/is-edge.js +1 -1
- package/src/focusable.js +0 -2
- package/src/tabbable.js +20 -24
- package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","replaceTag","node","tagName","newNode","ownerDocument","createElement","firstChild","appendChild","assertIsDefined","parentNode","replaceChild"],"sources":["@wordpress/dom/src/dom/replace-tag.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAAEC,IAAI,EAAEC,OAAO,EAAG;EACnD,MAAMC,OAAO,GAAGF,IAAI,CAACG,aAAa,CAACC,aAAa,CAAEH,OAAQ,CAAC;EAE3D,OAAQD,IAAI,CAACK,UAAU,EAAG;IACzBH,OAAO,CAACI,WAAW,CAAEN,IAAI,CAACK,UAAW,CAAC;EACvC;EAEA,IAAAE,gCAAe,EAAEP,IAAI,CAACQ,UAAU,EAAE,iBAAkB,CAAC;EACrDR,IAAI,CAACQ,UAAU,CAACC,YAAY,CAAEP,OAAO,EAAEF,IAAK,CAAC;EAE7C,OAAOE,OAAO;AACf"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","replaceTag","node","tagName","newNode","ownerDocument","createElement","firstChild","appendChild","assertIsDefined","parentNode","replaceChild"],"sources":["@wordpress/dom/src/dom/replace-tag.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAAEC,IAAI,EAAEC,OAAO,EAAG;EACnD,MAAMC,OAAO,GAAGF,IAAI,CAACG,aAAa,CAACC,aAAa,CAAEH,OAAQ,CAAC;EAE3D,OAAQD,IAAI,CAACK,UAAU,EAAG;IACzBH,OAAO,CAACI,WAAW,CAAEN,IAAI,CAACK,UAAW,CAAC;EACvC;EAEA,IAAAE,gCAAe,EAAEP,IAAI,CAACQ,UAAU,EAAE,iBAAkB,CAAC;EACrDR,IAAI,CAACQ,UAAU,CAACC,YAAY,CAAEP,OAAO,EAAEF,IAAK,CAAC;EAE7C,OAAOE,OAAO;AACf","ignoreList":[]}
|
package/build/dom/replace.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","_insertAfter","_interopRequireDefault","_remove","replace","processedNode","newNode","assertIsDefined","parentNode","insertAfter","remove"],"sources":["@wordpress/dom/src/dom/replace.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,OAAOA,CAAEC,aAAa,EAAEC,OAAO,EAAG;EACzD,IAAAC,gCAAe,EAAEF,aAAa,CAACG,UAAU,EAAE,0BAA2B,CAAC;EACvE,IAAAC,oBAAW,EAAEH,OAAO,EAAED,aAAa,CAACG,UAAW,CAAC;EAChD,IAAAE,eAAM,EAAEL,aAAc,CAAC;AACxB"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","_insertAfter","_interopRequireDefault","_remove","replace","processedNode","newNode","assertIsDefined","parentNode","insertAfter","remove"],"sources":["@wordpress/dom/src/dom/replace.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,OAAOA,CAAEC,aAAa,EAAEC,OAAO,EAAG;EACzD,IAAAC,gCAAe,EAAEF,aAAa,CAACG,UAAU,EAAE,0BAA2B,CAAC;EACvE,IAAAC,oBAAW,EAAEH,OAAO,EAAED,aAAa,CAACG,UAAW,CAAC;EAChD,IAAAE,eAAM,EAAEL,aAAc,CAAC;AACxB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_remove","_interopRequireDefault","require","safeHTML","html","body","document","implementation","createHTMLDocument","innerHTML","elements","getElementsByTagName","elementIndex","length","element","tagName","remove","attributeIndex","attributes","name","key","startsWith","removeAttribute"],"sources":["@wordpress/dom/src/dom/safe-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,QAAQA,CAAEC,IAAI,EAAG;EACxC,MAAM;IAAEC;EAAK,CAAC,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EACjEH,IAAI,CAACI,SAAS,GAAGL,IAAI;EACrB,MAAMM,QAAQ,GAAGL,IAAI,CAACM,oBAAoB,CAAE,GAAI,CAAC;EACjD,IAAIC,YAAY,GAAGF,QAAQ,CAACG,MAAM;EAElC,OAAQD,YAAY,EAAE,EAAG;IACxB,MAAME,OAAO,GAAGJ,QAAQ,CAAEE,YAAY,CAAE;IAExC,IAAKE,OAAO,CAACC,OAAO,KAAK,QAAQ,EAAG;MACnC,IAAAC,eAAM,EAAEF,OAAQ,CAAC;IAClB,CAAC,MAAM;MACN,IAAIG,cAAc,GAAGH,OAAO,CAACI,UAAU,CAACL,MAAM;MAE9C,OAAQI,cAAc,EAAE,EAAG;QAC1B,MAAM;UAAEE,IAAI,EAAEC;QAAI,CAAC,GAAGN,OAAO,CAACI,UAAU,CAAED,cAAc,CAAE;QAE1D,IAAKG,GAAG,CAACC,UAAU,CAAE,IAAK,CAAC,EAAG;UAC7BP,OAAO,CAACQ,eAAe,CAAEF,GAAI,CAAC;QAC/B;MACD;IACD;EACD;EAEA,OAAOf,IAAI,CAACI,SAAS;AACtB"}
|
1
|
+
{"version":3,"names":["_remove","_interopRequireDefault","require","safeHTML","html","body","document","implementation","createHTMLDocument","innerHTML","elements","getElementsByTagName","elementIndex","length","element","tagName","remove","attributeIndex","attributes","name","key","startsWith","removeAttribute"],"sources":["@wordpress/dom/src/dom/safe-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,QAAQA,CAAEC,IAAI,EAAG;EACxC,MAAM;IAAEC;EAAK,CAAC,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EACjEH,IAAI,CAACI,SAAS,GAAGL,IAAI;EACrB,MAAMM,QAAQ,GAAGL,IAAI,CAACM,oBAAoB,CAAE,GAAI,CAAC;EACjD,IAAIC,YAAY,GAAGF,QAAQ,CAACG,MAAM;EAElC,OAAQD,YAAY,EAAE,EAAG;IACxB,MAAME,OAAO,GAAGJ,QAAQ,CAAEE,YAAY,CAAE;IAExC,IAAKE,OAAO,CAACC,OAAO,KAAK,QAAQ,EAAG;MACnC,IAAAC,eAAM,EAAEF,OAAQ,CAAC;IAClB,CAAC,MAAM;MACN,IAAIG,cAAc,GAAGH,OAAO,CAACI,UAAU,CAACL,MAAM;MAE9C,OAAQI,cAAc,EAAE,EAAG;QAC1B,MAAM;UAAEE,IAAI,EAAEC;QAAI,CAAC,GAAGN,OAAO,CAACI,UAAU,CAAED,cAAc,CAAE;QAE1D,IAAKG,GAAG,CAACC,UAAU,CAAE,IAAK,CAAC,EAAG;UAC7BP,OAAO,CAACQ,eAAe,CAAEF,GAAI,CAAC;QAC/B;MACD;IACD;EACD;EAEA,OAAOf,IAAI,CAACI,SAAS;AACtB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["scrollIfNoRange","container","alignToTop","callback","range","startContainer","contains","scrollIntoView"],"sources":["@wordpress/dom/src/dom/scroll-if-no-range.js"],"sourcesContent":["/**\n * If no range range can be created or it is outside the container, the element\n * may be out of view, so scroll it into view and try again.\n *\n * @param {HTMLElement} container The container to scroll.\n * @param {boolean} alignToTop True to align to top, false to bottom.\n * @param {Function} callback The callback to create the range.\n *\n * @return {?Range} The range returned by the callback.\n */\nexport function scrollIfNoRange( container, alignToTop, callback ) {\n\tlet range = callback();\n\n\t// If no range range can be created or it is outside the container, the\n\t// element may be out of view.\n\tif (\n\t\t! range ||\n\t\t! range.startContainer ||\n\t\t! container.contains( range.startContainer )\n\t) {\n\t\tcontainer.scrollIntoView( alignToTop );\n\t\trange = callback();\n\n\t\tif (\n\t\t\t! range ||\n\t\t\t! range.startContainer ||\n\t\t\t! container.contains( range.startContainer )\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn range;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAG;EAClE,IAAIC,KAAK,GAAGD,QAAQ,CAAC,CAAC;;EAEtB;EACA;EACA,IACC,CAAEC,KAAK,IACP,CAAEA,KAAK,CAACC,cAAc,IACtB,CAAEJ,SAAS,CAACK,QAAQ,CAAEF,KAAK,CAACC,cAAe,CAAC,EAC3C;IACDJ,SAAS,CAACM,cAAc,CAAEL,UAAW,CAAC;IACtCE,KAAK,GAAGD,QAAQ,CAAC,CAAC;IAElB,IACC,CAAEC,KAAK,IACP,CAAEA,KAAK,CAACC,cAAc,IACtB,CAAEJ,SAAS,CAACK,QAAQ,CAAEF,KAAK,CAACC,cAAe,CAAC,EAC3C;MACD,OAAO,IAAI;IACZ;EACD;EAEA,OAAOD,KAAK;AACb"}
|
1
|
+
{"version":3,"names":["scrollIfNoRange","container","alignToTop","callback","range","startContainer","contains","scrollIntoView"],"sources":["@wordpress/dom/src/dom/scroll-if-no-range.js"],"sourcesContent":["/**\n * If no range range can be created or it is outside the container, the element\n * may be out of view, so scroll it into view and try again.\n *\n * @param {HTMLElement} container The container to scroll.\n * @param {boolean} alignToTop True to align to top, false to bottom.\n * @param {Function} callback The callback to create the range.\n *\n * @return {?Range} The range returned by the callback.\n */\nexport function scrollIfNoRange( container, alignToTop, callback ) {\n\tlet range = callback();\n\n\t// If no range range can be created or it is outside the container, the\n\t// element may be out of view.\n\tif (\n\t\t! range ||\n\t\t! range.startContainer ||\n\t\t! container.contains( range.startContainer )\n\t) {\n\t\tcontainer.scrollIntoView( alignToTop );\n\t\trange = callback();\n\n\t\tif (\n\t\t\t! range ||\n\t\t\t! range.startContainer ||\n\t\t\t! container.contains( range.startContainer )\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn range;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAG;EAClE,IAAIC,KAAK,GAAGD,QAAQ,CAAC,CAAC;;EAEtB;EACA;EACA,IACC,CAAEC,KAAK,IACP,CAAEA,KAAK,CAACC,cAAc,IACtB,CAAEJ,SAAS,CAACK,QAAQ,CAAEF,KAAK,CAACC,cAAe,CAAC,EAC3C;IACDJ,SAAS,CAACM,cAAc,CAAEL,UAAW,CAAC;IACtCE,KAAK,GAAGD,QAAQ,CAAC,CAAC;IAElB,IACC,CAAEC,KAAK,IACP,CAAEA,KAAK,CAACC,cAAc,IACtB,CAAEJ,SAAS,CAACK,QAAQ,CAAEF,KAAK,CAACC,cAAe,CAAC,EAC3C;MACD,OAAO,IAAI;IACZ;EACD;EAEA,OAAOD,KAAK;AACb","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_safeHtml","_interopRequireDefault","require","stripHTML","html","safeHTML","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent"],"sources":["@wordpress/dom/src/dom/strip-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param {string} html The string containing html.\n *\n * @return {string} The text content with any html removed.\n */\nexport default function stripHTML( html ) {\n\t// Remove any script tags or on* attributes otherwise their *contents* will be left\n\t// in place following removal of HTML tags.\n\thtml = safeHTML( html );\n\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA;EACAA,IAAI,GAAG,IAAAC,iBAAQ,EAAED,IAAK,CAAC;EAEvB,MAAME,GAAG,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EAC5DH,GAAG,CAACI,IAAI,CAACC,SAAS,GAAGP,IAAI;EACzB,OAAOE,GAAG,CAACI,IAAI,CAACE,WAAW,IAAI,EAAE;AAClC"}
|
1
|
+
{"version":3,"names":["_safeHtml","_interopRequireDefault","require","stripHTML","html","safeHTML","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent"],"sources":["@wordpress/dom/src/dom/strip-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param {string} html The string containing html.\n *\n * @return {string} The text content with any html removed.\n */\nexport default function stripHTML( html ) {\n\t// Remove any script tags or on* attributes otherwise their *contents* will be left\n\t// in place following removal of HTML tags.\n\thtml = safeHTML( html );\n\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA;EACAA,IAAI,GAAG,IAAAC,iBAAQ,EAAED,IAAK,CAAC;EAEvB,MAAME,GAAG,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EAC5DH,GAAG,CAACI,IAAI,CAACC,SAAS,GAAGP,IAAI;EACzB,OAAOE,GAAG,CAACI,IAAI,CAACE,WAAW,IAAI,EAAE;AAClC","ignoreList":[]}
|
package/build/dom/unwrap.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","unwrap","node","parent","parentNode","assertIsDefined","firstChild","insertBefore","removeChild"],"sources":["@wordpress/dom/src/dom/unwrap.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param {Node} node The node to unwrap.\n *\n * @return {void}\n */\nexport default function unwrap( node ) {\n\tconst parent = node.parentNode;\n\n\tassertIsDefined( parent, 'node.parentNode' );\n\n\twhile ( node.firstChild ) {\n\t\tparent.insertBefore( node.firstChild, node );\n\t}\n\n\tparent.removeChild( node );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,MAAMA,CAAEC,IAAI,EAAG;EACtC,MAAMC,MAAM,GAAGD,IAAI,CAACE,UAAU;EAE9B,IAAAC,gCAAe,EAAEF,MAAM,EAAE,iBAAkB,CAAC;EAE5C,OAAQD,IAAI,CAACI,UAAU,EAAG;IACzBH,MAAM,CAACI,YAAY,CAAEL,IAAI,CAACI,UAAU,EAAEJ,IAAK,CAAC;EAC7C;EAEAC,MAAM,CAACK,WAAW,CAAEN,IAAK,CAAC;AAC3B"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","unwrap","node","parent","parentNode","assertIsDefined","firstChild","insertBefore","removeChild"],"sources":["@wordpress/dom/src/dom/unwrap.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param {Node} node The node to unwrap.\n *\n * @return {void}\n */\nexport default function unwrap( node ) {\n\tconst parent = node.parentNode;\n\n\tassertIsDefined( parent, 'node.parentNode' );\n\n\twhile ( node.firstChild ) {\n\t\tparent.insertBefore( node.firstChild, node );\n\t}\n\n\tparent.removeChild( node );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,MAAMA,CAAEC,IAAI,EAAG;EACtC,MAAMC,MAAM,GAAGD,IAAI,CAACE,UAAU;EAE9B,IAAAC,gCAAe,EAAEF,MAAM,EAAE,iBAAkB,CAAC;EAE5C,OAAQD,IAAI,CAACI,UAAU,EAAG;IACzBH,MAAM,CAACI,YAAY,CAAEL,IAAI,CAACI,UAAU,EAAEJ,IAAK,CAAC;EAC7C;EAEAC,MAAM,CAACK,WAAW,CAAEN,IAAK,CAAC;AAC3B","ignoreList":[]}
|
package/build/dom/wrap.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_assertIsDefined","require","wrap","newNode","referenceNode","assertIsDefined","parentNode","insertBefore","appendChild"],"sources":["@wordpress/dom/src/dom/wrap.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param {Element} newNode The node to insert.\n * @param {Element} referenceNode The node to wrap.\n */\nexport default function wrap( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,IAAIA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EACtD,IAAAC,gCAAe,EAAED,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEF,aAAa,CAACE,UAAU,CAACC,YAAY,CAAEJ,OAAO,EAAEC,aAAc,CAAC;EAC/DD,OAAO,CAACK,WAAW,CAAEJ,aAAc,CAAC;AACrC"}
|
1
|
+
{"version":3,"names":["_assertIsDefined","require","wrap","newNode","referenceNode","assertIsDefined","parentNode","insertBefore","appendChild"],"sources":["@wordpress/dom/src/dom/wrap.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param {Element} newNode The node to insert.\n * @param {Element} referenceNode The node to wrap.\n */\nexport default function wrap( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,IAAIA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EACtD,IAAAC,gCAAe,EAAED,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEF,aAAa,CAACE,UAAU,CAACC,YAAY,CAAEJ,OAAO,EAAEC,aAAc,CAAC;EAC/DD,OAAO,CAACK,WAAW,CAAEJ,aAAc,CAAC;AACrC","ignoreList":[]}
|
package/build/focusable.js
CHANGED
@@ -88,9 +88,7 @@ function isValidFocusableArea(element) {
|
|
88
88
|
function find(context, {
|
89
89
|
sequential = false
|
90
90
|
} = {}) {
|
91
|
-
/* eslint-disable jsdoc/no-undefined-types */
|
92
91
|
/** @type {NodeListOf<HTMLElement>} */
|
93
|
-
/* eslint-enable jsdoc/no-undefined-types */
|
94
92
|
const elements = context.querySelectorAll(buildSelector(sequential));
|
95
93
|
return Array.from(elements).filter(element => {
|
96
94
|
if (!isVisible(element)) {
|
package/build/focusable.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"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"],"sources":["@wordpress/dom/src/focusable.js"],"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 {HTMLElement[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t
|
1
|
+
{"version":3,"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"],"sources":["@wordpress/dom/src/focusable.js"],"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 {HTMLElement[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/** @type {NodeListOf<HTMLElement>} */\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"],"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,aAAaA,CAAEC,UAAU,EAAG;EACpC,OAAO,CACNA,UAAU,GAAG,iCAAiC,GAAG,YAAY,EAC7D,SAAS,EACT,wBAAwB,EACxB,4CAA4C,EAC5C,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,gDAAgD,CAChD,CAACC,IAAI,CAAE,GAAI,CAAC;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAAEC,OAAO,EAAG;EAC7B,OACCA,OAAO,CAACC,WAAW,GAAG,CAAC,IACvBD,OAAO,CAACE,YAAY,GAAG,CAAC,IACxBF,OAAO,CAACG,cAAc,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC;AAErC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,oBAAoBA,CAAEL,OAAO,EAAG;EACxC;EACA,MAAMM,GAAG,GAAGN,OAAO,CAACO,OAAO,CAAE,WAAY,CAAC;EAC1C,IAAK,CAAED,GAAG,EAAG;IACZ,OAAO,KAAK;EACb;;EAEA;EACA,MAAME,GAAG,GAAGR,OAAO,CAACS,aAAa,CAACC,aAAa,CAC9C,eAAe,GAAGJ,GAAG,CAACK,IAAI,GAAG,IAC9B,CAAC;EACD,OAAO,CAAC,CAAEH,GAAG,IAAIT,SAAS,CAAES,GAAI,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,IAAIA,CAAEC,OAAO,EAAE;EAAEhB,UAAU,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,EAAG;EAC5D;EACA,MAAMiB,QAAQ,GAAGD,OAAO,CAACE,gBAAgB,CAAEnB,aAAa,CAAEC,UAAW,CAAE,CAAC;EAExE,OAAOmB,KAAK,CAACC,IAAI,CAAEH,QAAS,CAAC,CAACI,MAAM,CAAIlB,OAAO,IAAM;IACpD,IAAK,CAAED,SAAS,CAAEC,OAAQ,CAAC,EAAG;MAC7B,OAAO,KAAK;IACb;IAEA,MAAM;MAAEmB;IAAS,CAAC,GAAGnB,OAAO;IAC5B,IAAK,MAAM,KAAKmB,QAAQ,EAAG;MAC1B,OAAOd,oBAAoB,EAC1B,8BAAiCL,OAClC,CAAC;IACF;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ","ignoreList":[]}
|
package/build/index.js
CHANGED
@@ -46,7 +46,7 @@ Object.keys(_dataTransfer).forEach(function (key) {
|
|
46
46
|
});
|
47
47
|
});
|
48
48
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
49
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
49
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
50
50
|
/**
|
51
51
|
* Internal dependencies
|
52
52
|
*/
|
package/build/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["focusable","_interopRequireWildcard","require","tabbable","_dom","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_phrasingContent","_dataTransfer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","focus"],"sources":["@wordpress/dom/src/index.js"],"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"],"mappings":";;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,uBAAA,CAAAC,OAAA;AAQA,IAAAE,IAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,IAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,IAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,IAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,gBAAA,GAAAf,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAW,gBAAA,EAAAV,OAAA,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IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAP,GAAA,CAAAI,CAAA,OAAAO,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAxB,MAAA,CAAAS,cAAA,IAAAT,MAAA,CAAAyB,wBAAA,WAAAC,CAAA,IAAAX,CAAA,oBAAAW,CAAA,
|
1
|
+
{"version":3,"names":["focusable","_interopRequireWildcard","require","tabbable","_dom","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_phrasingContent","_dataTransfer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","focus"],"sources":["@wordpress/dom/src/index.js"],"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"],"mappings":";;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,uBAAA,CAAAC,OAAA;AAQA,IAAAE,IAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,IAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,IAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,IAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,gBAAA,GAAAf,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AAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAP,GAAA,CAAAI,CAAA,OAAAO,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAxB,MAAA,CAAAS,cAAA,IAAAT,MAAA,CAAAyB,wBAAA,WAAAC,CAAA,IAAAX,CAAA,oBAAAW,CAAA,OAAArB,cAAA,CAAAC,IAAA,CAAAS,CAAA,EAAAW,CAAA,SAAAC,CAAA,GAAAH,CAAA,GAAAxB,MAAA,CAAAyB,wBAAA,CAAAV,CAAA,EAAAW,CAAA,UAAAC,CAAA,KAAAA,CAAA,CAAAhB,GAAA,IAAAgB,CAAA,CAAAC,GAAA,IAAA5B,MAAA,CAAAS,cAAA,CAAAa,CAAA,EAAAI,CAAA,EAAAC,CAAA,IAAAL,CAAA,CAAAI,CAAA,IAAAX,CAAA,CAAAW,CAAA,YAAAJ,CAAA,CAAAF,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAU,GAAA,CAAAb,CAAA,EAAAO,CAAA,GAAAA,CAAA;AAdhC;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,MAAMO,KAAK,GAAArB,OAAA,CAAAqB,KAAA,GAAG;EAAElC,SAAS;EAAEG;AAAS,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["textContentSchema","strong","em","s","del","ins","a","attributes","code","abbr","sub","sup","br","small","q","dfn","data","time","var","samp","kbd","i","b","u","mark","ruby","rt","rp","bdi","bdo","wbr","excludedElements","Object","keys","filter","element","includes","forEach","tag","removedTag","restSchema","children","embeddedContentSchema","audio","canvas","embed","img","object","video","phrasingContentSchema","getPhrasingContentSchema","context","remainingContentSchema","isPhrasingContent","node","nodeName","toLowerCase","hasOwnProperty","isTextContent"],"sources":["@wordpress/dom/src/phrasing-content.js"],"sourcesContent":["/**\n * All phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\n\n/**\n * @typedef {Record<string,SemanticElementDefinition>} ContentSchema\n */\n\n/**\n * @typedef SemanticElementDefinition\n * @property {string[]} [attributes] Content attributes\n * @property {ContentSchema} [children] Content attributes\n */\n\n/**\n * All text-level semantic elements.\n *\n * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html\n *\n * @type {ContentSchema}\n */\nconst textContentSchema = {\n\tstrong: {},\n\tem: {},\n\ts: {},\n\tdel: {},\n\tins: {},\n\ta: { attributes: [ 'href', 'target', 'rel', 'id' ] },\n\tcode: {},\n\tabbr: { attributes: [ 'title' ] },\n\tsub: {},\n\tsup: {},\n\tbr: {},\n\tsmall: {},\n\t// To do: fix blockquote.\n\t// cite: {},\n\tq: { attributes: [ 'cite' ] },\n\tdfn: { attributes: [ 'title' ] },\n\tdata: { attributes: [ 'value' ] },\n\ttime: { attributes: [ 'datetime' ] },\n\tvar: {},\n\tsamp: {},\n\tkbd: {},\n\ti: {},\n\tb: {},\n\tu: {},\n\tmark: {},\n\truby: {},\n\trt: {},\n\trp: {},\n\tbdi: { attributes: [ 'dir' ] },\n\tbdo: { attributes: [ 'dir' ] },\n\twbr: {},\n\t'#text': {},\n};\n\n// Recursion is needed.\n// Possible: strong > em > strong.\n// Impossible: strong > strong.\nconst excludedElements = [ '#text', 'br' ];\nObject.keys( textContentSchema )\n\t.filter( ( element ) => ! excludedElements.includes( element ) )\n\t.forEach( ( tag ) => {\n\t\tconst { [ tag ]: removedTag, ...restSchema } = textContentSchema;\n\t\ttextContentSchema[ tag ].children = restSchema;\n\t} );\n\n/**\n * Embedded content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0\n *\n * @type {ContentSchema}\n */\nconst embeddedContentSchema = {\n\taudio: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'preload',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t],\n\t},\n\tcanvas: { attributes: [ 'width', 'height' ] },\n\tembed: { attributes: [ 'src', 'type', 'width', 'height' ] },\n\timg: {\n\t\tattributes: [\n\t\t\t'alt',\n\t\t\t'src',\n\t\t\t'srcset',\n\t\t\t'usemap',\n\t\t\t'ismap',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tobject: {\n\t\tattributes: [\n\t\t\t'data',\n\t\t\t'type',\n\t\t\t'name',\n\t\t\t'usemap',\n\t\t\t'form',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tvideo: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'poster',\n\t\t\t'preload',\n\t\t\t'playsinline',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t\t'controls',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n};\n\n/**\n * Phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\nconst phrasingContentSchema = {\n\t...textContentSchema,\n\t...embeddedContentSchema,\n};\n\n/**\n * Get schema of possible paths for phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param {string} [context] Set to \"paste\" to exclude invisible elements and\n * sensitive data.\n *\n * @return {Partial<ContentSchema>} Schema.\n */\nexport function getPhrasingContentSchema( context ) {\n\tif ( context !== 'paste' ) {\n\t\treturn phrasingContentSchema;\n\t}\n\n\t/**\n\t * @type {Partial<ContentSchema>}\n\t */\n\tconst {\n\t\tu, // Used to mark misspelling. Shouldn't be pasted.\n\t\tabbr, // Invisible.\n\t\tdata, // Invisible.\n\t\ttime, // Invisible.\n\t\twbr, // Invisible.\n\t\tbdi, // Invisible.\n\t\tbdo, // Invisible.\n\t\t...remainingContentSchema\n\t} = {\n\t\t...phrasingContentSchema,\n\t\t// We shouldn't paste potentially sensitive information which is not\n\t\t// visible to the user when pasted, so strip the attributes.\n\t\tins: { children: phrasingContentSchema.ins.children },\n\t\tdel: { children: phrasingContentSchema.del.children },\n\t};\n\n\treturn remainingContentSchema;\n}\n\n/**\n * Find out whether or not the given node is phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param {Node} node The node to test.\n *\n * @return {boolean} True if phrasing content, false if not.\n */\nexport function isPhrasingContent( node ) {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn getPhrasingContentSchema().hasOwnProperty( tag ) || tag === 'span';\n}\n\n/**\n * @param {Node} node\n * @return {boolean} Node is text content\n */\nexport function isTextContent( node ) {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn textContentSchema.hasOwnProperty( tag ) || tag === 'span';\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG;EACzBC,MAAM,EAAE,CAAC,CAAC;EACVC,EAAE,EAAE,CAAC,CAAC;EACNC,CAAC,EAAE,CAAC,CAAC;EACLC,GAAG,EAAE,CAAC,CAAC;EACPC,GAAG,EAAE,CAAC,CAAC;EACPC,CAAC,EAAE;IAAEC,UAAU,EAAE,CAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI;EAAG,CAAC;EACpDC,IAAI,EAAE,CAAC,CAAC;EACRC,IAAI,EAAE;IAAEF,UAAU,EAAE,CAAE,OAAO;EAAG,CAAC;EACjCG,GAAG,EAAE,CAAC,CAAC;EACPC,GAAG,EAAE,CAAC,CAAC;EACPC,EAAE,EAAE,CAAC,CAAC;EACNC,KAAK,EAAE,CAAC,CAAC;EACT;EACA;EACAC,CAAC,EAAE;IAAEP,UAAU,EAAE,CAAE,MAAM;EAAG,CAAC;EAC7BQ,GAAG,EAAE;IAAER,UAAU,EAAE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,qBAAqB,CAAC7C,GAAG,CAACqC;IAAS;EACrD,CAAC;EAED,OAAOW,sBAAsB;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAAEC,IAAI,EAAG;EACzC,MAAMhB,GAAG,GAAGgB,IAAI,CAACC,QAAQ,CAACC,WAAW,CAAC,CAAC;EACvC,OAAON,wBAAwB,CAAC,CAAC,CAACO,cAAc,CAAEnB,GAAI,CAAC,IAAIA,GAAG,KAAK,MAAM;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAASoB,aAAaA,CAAEJ,IAAI,EAAG;EACrC,MAAMhB,GAAG,GAAGgB,IAAI,CAACC,QAAQ,CAACC,WAAW,CAAC,CAAC;EACvC,OAAOxD,iBAAiB,CAACyD,cAAc,CAAEnB,GAAI,CAAC,IAAIA,GAAG,KAAK,MAAM;AACjE"}
|
1
|
+
{"version":3,"names":["textContentSchema","strong","em","s","del","ins","a","attributes","code","abbr","sub","sup","br","small","q","dfn","data","time","var","samp","kbd","i","b","u","mark","ruby","rt","rp","bdi","bdo","wbr","excludedElements","Object","keys","filter","element","includes","forEach","tag","removedTag","restSchema","children","embeddedContentSchema","audio","canvas","embed","img","object","video","phrasingContentSchema","getPhrasingContentSchema","context","remainingContentSchema","isPhrasingContent","node","nodeName","toLowerCase","hasOwnProperty","isTextContent"],"sources":["@wordpress/dom/src/phrasing-content.js"],"sourcesContent":["/**\n * All phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\n\n/**\n * @typedef {Record<string,SemanticElementDefinition>} ContentSchema\n */\n\n/**\n * @typedef SemanticElementDefinition\n * @property {string[]} [attributes] Content attributes\n * @property {ContentSchema} [children] Content attributes\n */\n\n/**\n * All text-level semantic elements.\n *\n * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html\n *\n * @type {ContentSchema}\n */\nconst textContentSchema = {\n\tstrong: {},\n\tem: {},\n\ts: {},\n\tdel: {},\n\tins: {},\n\ta: { attributes: [ 'href', 'target', 'rel', 'id' ] },\n\tcode: {},\n\tabbr: { attributes: [ 'title' ] },\n\tsub: {},\n\tsup: {},\n\tbr: {},\n\tsmall: {},\n\t// To do: fix blockquote.\n\t// cite: {},\n\tq: { attributes: [ 'cite' ] },\n\tdfn: { attributes: [ 'title' ] },\n\tdata: { attributes: [ 'value' ] },\n\ttime: { attributes: [ 'datetime' ] },\n\tvar: {},\n\tsamp: {},\n\tkbd: {},\n\ti: {},\n\tb: {},\n\tu: {},\n\tmark: {},\n\truby: {},\n\trt: {},\n\trp: {},\n\tbdi: { attributes: [ 'dir' ] },\n\tbdo: { attributes: [ 'dir' ] },\n\twbr: {},\n\t'#text': {},\n};\n\n// Recursion is needed.\n// Possible: strong > em > strong.\n// Impossible: strong > strong.\nconst excludedElements = [ '#text', 'br' ];\nObject.keys( textContentSchema )\n\t.filter( ( element ) => ! excludedElements.includes( element ) )\n\t.forEach( ( tag ) => {\n\t\tconst { [ tag ]: removedTag, ...restSchema } = textContentSchema;\n\t\ttextContentSchema[ tag ].children = restSchema;\n\t} );\n\n/**\n * Embedded content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0\n *\n * @type {ContentSchema}\n */\nconst embeddedContentSchema = {\n\taudio: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'preload',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t],\n\t},\n\tcanvas: { attributes: [ 'width', 'height' ] },\n\tembed: { attributes: [ 'src', 'type', 'width', 'height' ] },\n\timg: {\n\t\tattributes: [\n\t\t\t'alt',\n\t\t\t'src',\n\t\t\t'srcset',\n\t\t\t'usemap',\n\t\t\t'ismap',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tobject: {\n\t\tattributes: [\n\t\t\t'data',\n\t\t\t'type',\n\t\t\t'name',\n\t\t\t'usemap',\n\t\t\t'form',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n\tvideo: {\n\t\tattributes: [\n\t\t\t'src',\n\t\t\t'poster',\n\t\t\t'preload',\n\t\t\t'playsinline',\n\t\t\t'autoplay',\n\t\t\t'mediagroup',\n\t\t\t'loop',\n\t\t\t'muted',\n\t\t\t'controls',\n\t\t\t'width',\n\t\t\t'height',\n\t\t],\n\t},\n};\n\n/**\n * Phrasing content elements.\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0\n */\nconst phrasingContentSchema = {\n\t...textContentSchema,\n\t...embeddedContentSchema,\n};\n\n/**\n * Get schema of possible paths for phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param {string} [context] Set to \"paste\" to exclude invisible elements and\n * sensitive data.\n *\n * @return {Partial<ContentSchema>} Schema.\n */\nexport function getPhrasingContentSchema( context ) {\n\tif ( context !== 'paste' ) {\n\t\treturn phrasingContentSchema;\n\t}\n\n\t/**\n\t * @type {Partial<ContentSchema>}\n\t */\n\tconst {\n\t\tu, // Used to mark misspelling. Shouldn't be pasted.\n\t\tabbr, // Invisible.\n\t\tdata, // Invisible.\n\t\ttime, // Invisible.\n\t\twbr, // Invisible.\n\t\tbdi, // Invisible.\n\t\tbdo, // Invisible.\n\t\t...remainingContentSchema\n\t} = {\n\t\t...phrasingContentSchema,\n\t\t// We shouldn't paste potentially sensitive information which is not\n\t\t// visible to the user when pasted, so strip the attributes.\n\t\tins: { children: phrasingContentSchema.ins.children },\n\t\tdel: { children: phrasingContentSchema.del.children },\n\t};\n\n\treturn remainingContentSchema;\n}\n\n/**\n * Find out whether or not the given node is phrasing content.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content\n *\n * @param {Node} node The node to test.\n *\n * @return {boolean} True if phrasing content, false if not.\n */\nexport function isPhrasingContent( node ) {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn getPhrasingContentSchema().hasOwnProperty( tag ) || tag === 'span';\n}\n\n/**\n * @param {Node} node\n * @return {boolean} Node is text content\n */\nexport function isTextContent( node ) {\n\tconst tag = node.nodeName.toLowerCase();\n\treturn textContentSchema.hasOwnProperty( tag ) || tag === 'span';\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG;EACzBC,MAAM,EAAE,CAAC,CAAC;EACVC,EAAE,EAAE,CAAC,CAAC;EACNC,CAAC,EAAE,CAAC,CAAC;EACLC,GAAG,EAAE,CAAC,CAAC;EACPC,GAAG,EAAE,CAAC,CAAC;EACPC,CAAC,EAAE;IAAEC,UAAU,EAAE,CAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI;EAAG,CAAC;EACpDC,IAAI,EAAE,CAAC,CAAC;EACRC,IAAI,EAAE;IAAEF,UAAU,EAAE,CAAE,OAAO;EAAG,CAAC;EACjCG,GAAG,EAAE,CAAC,CAAC;EACPC,GAAG,EAAE,CAAC,CAAC;EACPC,EAAE,EAAE,CAAC,CAAC;EACNC,KAAK,EAAE,CAAC,CAAC;EACT;EACA;EACAC,CAAC,EAAE;IAAEP,UAAU,EAAE,CAAE,MAAM;EAAG,CAAC;EAC7BQ,GAAG,EAAE;IAAER,UAAU,EAAE,CAAE,OAAO;EAAG,CAAC;EAChCS,IAAI,EAAE;IAAET,UAAU,EAAE,CAAE,OAAO;EAAG,CAAC;EACjCU,IAAI,EAAE;IAAEV,UAAU,EAAE,CAAE,UAAU;EAAG,CAAC;EACpCW,GAAG,EAAE,CAAC,CAAC;EACPC,IAAI,EAAE,CAAC,CAAC;EACRC,GAAG,EAAE,CAAC,CAAC;EACPC,CAAC,EAAE,CAAC,CAAC;EACLC,CAAC,EAAE,CAAC,CAAC;EACLC,CAAC,EAAE,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,MAAM;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAASoB,aAAaA,CAAEJ,IAAI,EAAG;EACrC,MAAMhB,GAAG,GAAGgB,IAAI,CAACC,QAAQ,CAACC,WAAW,CAAC,CAAC;EACvC,OAAOxD,iBAAiB,CAACyD,cAAc,CAAEnB,GAAI,CAAC,IAAIA,GAAG,KAAK,MAAM;AACjE","ignoreList":[]}
|
package/build/tabbable.js
CHANGED
@@ -40,7 +40,7 @@ function isTabbableIndex(element) {
|
|
40
40
|
return getTabIndex(element) !== -1;
|
41
41
|
}
|
42
42
|
|
43
|
-
/** @typedef {
|
43
|
+
/** @typedef {HTMLElement & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */
|
44
44
|
|
45
45
|
/**
|
46
46
|
* Returns a stateful reducer function which constructs a filtered array of
|
@@ -91,10 +91,10 @@ function createStatefulCollapseRadioGroup() {
|
|
91
91
|
* sort where equal tabIndex should be left in order of their occurrence in the
|
92
92
|
* document.
|
93
93
|
*
|
94
|
-
* @param {
|
95
|
-
* @param {number}
|
94
|
+
* @param {HTMLElement} element Element.
|
95
|
+
* @param {number} index Array index of element.
|
96
96
|
*
|
97
|
-
* @return {{ element:
|
97
|
+
* @return {{ element: HTMLElement, index: number }} Mapped object with element, index.
|
98
98
|
*/
|
99
99
|
function mapElementToObjectTabbable(element, index) {
|
100
100
|
return {
|
@@ -107,9 +107,9 @@ function mapElementToObjectTabbable(element, index) {
|
|
107
107
|
* An array map callback, returning an element of the given mapped object's
|
108
108
|
* element value.
|
109
109
|
*
|
110
|
-
* @param {{ element:
|
110
|
+
* @param {{ element: HTMLElement }} object Mapped object with element.
|
111
111
|
*
|
112
|
-
* @return {
|
112
|
+
* @return {HTMLElement} Mapped object element.
|
113
113
|
*/
|
114
114
|
function mapObjectTabbableToElement(object) {
|
115
115
|
return object.element;
|
@@ -120,8 +120,8 @@ function mapObjectTabbableToElement(object) {
|
|
120
120
|
*
|
121
121
|
* @see mapElementToObjectTabbable
|
122
122
|
*
|
123
|
-
* @param {{ element:
|
124
|
-
* @param {{ element:
|
123
|
+
* @param {{ element: HTMLElement, index: number }} a First object to compare.
|
124
|
+
* @param {{ element: HTMLElement, index: number }} b Second object to compare.
|
125
125
|
*
|
126
126
|
* @return {number} Comparator result.
|
127
127
|
*/
|
@@ -137,9 +137,9 @@ function compareObjectTabbables(a, b) {
|
|
137
137
|
/**
|
138
138
|
* Givin focusable elements, filters out tabbable element.
|
139
139
|
*
|
140
|
-
* @param {
|
140
|
+
* @param {HTMLElement[]} focusables Focusable elements to filter.
|
141
141
|
*
|
142
|
-
* @return {
|
142
|
+
* @return {HTMLElement[]} Tabbable elements.
|
143
143
|
*/
|
144
144
|
function filterTabbable(focusables) {
|
145
145
|
return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []);
|
@@ -147,7 +147,7 @@ function filterTabbable(focusables) {
|
|
147
147
|
|
148
148
|
/**
|
149
149
|
* @param {Element} context
|
150
|
-
* @return {
|
150
|
+
* @return {HTMLElement[]} Tabbable elements within the context.
|
151
151
|
*/
|
152
152
|
function find(context) {
|
153
153
|
return filterTabbable((0, _focusable.find)(context));
|
@@ -159,15 +159,12 @@ function find(context) {
|
|
159
159
|
* @param {Element} element The focusable element before which to look. Defaults
|
160
160
|
* to the active element.
|
161
161
|
*
|
162
|
-
* @return {
|
162
|
+
* @return {HTMLElement|undefined} Preceding tabbable element.
|
163
163
|
*/
|
164
164
|
function findPrevious(element) {
|
165
|
-
return filterTabbable((0, _focusable.find)(element.ownerDocument.body)).reverse().find(focusable =>
|
166
|
-
|
167
|
-
|
168
|
-
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING
|
169
|
-
);
|
170
|
-
});
|
165
|
+
return filterTabbable((0, _focusable.find)(element.ownerDocument.body)).reverse().find(focusable =>
|
166
|
+
// eslint-disable-next-line no-bitwise
|
167
|
+
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING);
|
171
168
|
}
|
172
169
|
|
173
170
|
/**
|
@@ -176,14 +173,11 @@ function findPrevious(element) {
|
|
176
173
|
* @param {Element} element The focusable element after which to look. Defaults
|
177
174
|
* to the active element.
|
178
175
|
*
|
179
|
-
* @return {
|
176
|
+
* @return {HTMLElement|undefined} Next tabbable element.
|
180
177
|
*/
|
181
178
|
function findNext(element) {
|
182
|
-
return filterTabbable((0, _focusable.find)(element.ownerDocument.body)).find(focusable =>
|
183
|
-
|
184
|
-
|
185
|
-
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING
|
186
|
-
);
|
187
|
-
});
|
179
|
+
return filterTabbable((0, _focusable.find)(element.ownerDocument.body)).find(focusable =>
|
180
|
+
// eslint-disable-next-line no-bitwise
|
181
|
+
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING);
|
188
182
|
}
|
189
183
|
//# sourceMappingURL=tabbable.js.map
|
package/build/tabbable.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_focusable","require","getTabIndex","element","tabIndex","getAttribute","parseInt","isTabbableIndex","createStatefulCollapseRadioGroup","CHOSEN_RADIO_BY_NAME","collapseRadioGroup","result","nodeName","type","checked","name","concat","hasChosen","hasOwnProperty","isChosen","hadChosenElement","filter","e","mapElementToObjectTabbable","index","mapObjectTabbableToElement","object","compareObjectTabbables","a","b","aTabIndex","bTabIndex","filterTabbable","focusables","map","sort","reduce","find","context","findFocusable","findPrevious","ownerDocument","body","reverse","focusable","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","findNext","DOCUMENT_POSITION_FOLLOWING"],"sources":["@wordpress/dom/src/tabbable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { find as findFocusable } from './focusable';\n\n/**\n * Returns the tab index of the given element. In contrast with the tabIndex\n * property, this normalizes the default (0) to avoid browser inconsistencies,\n * operating under the assumption that this function is only ever called with a\n * focusable node.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261\n *\n * @param {Element} element Element from which to retrieve.\n *\n * @return {number} Tab index of element (default 0).\n */\nfunction getTabIndex( element ) {\n\tconst tabIndex = element.getAttribute( 'tabindex' );\n\treturn tabIndex === null ? 0 : parseInt( tabIndex, 10 );\n}\n\n/**\n * Returns true if the specified element is tabbable, or false otherwise.\n *\n * @param {Element} element Element to test.\n *\n * @return {boolean} Whether element is tabbable.\n */\nexport function isTabbableIndex( element ) {\n\treturn getTabIndex( element ) !== -1;\n}\n\n/** @typedef {
|
1
|
+
{"version":3,"names":["_focusable","require","getTabIndex","element","tabIndex","getAttribute","parseInt","isTabbableIndex","createStatefulCollapseRadioGroup","CHOSEN_RADIO_BY_NAME","collapseRadioGroup","result","nodeName","type","checked","name","concat","hasChosen","hasOwnProperty","isChosen","hadChosenElement","filter","e","mapElementToObjectTabbable","index","mapObjectTabbableToElement","object","compareObjectTabbables","a","b","aTabIndex","bTabIndex","filterTabbable","focusables","map","sort","reduce","find","context","findFocusable","findPrevious","ownerDocument","body","reverse","focusable","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","findNext","DOCUMENT_POSITION_FOLLOWING"],"sources":["@wordpress/dom/src/tabbable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { find as findFocusable } from './focusable';\n\n/**\n * Returns the tab index of the given element. In contrast with the tabIndex\n * property, this normalizes the default (0) to avoid browser inconsistencies,\n * operating under the assumption that this function is only ever called with a\n * focusable node.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261\n *\n * @param {Element} element Element from which to retrieve.\n *\n * @return {number} Tab index of element (default 0).\n */\nfunction getTabIndex( element ) {\n\tconst tabIndex = element.getAttribute( 'tabindex' );\n\treturn tabIndex === null ? 0 : parseInt( tabIndex, 10 );\n}\n\n/**\n * Returns true if the specified element is tabbable, or false otherwise.\n *\n * @param {Element} element Element to test.\n *\n * @return {boolean} Whether element is tabbable.\n */\nexport function isTabbableIndex( element ) {\n\treturn getTabIndex( element ) !== -1;\n}\n\n/** @typedef {HTMLElement & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */\n\n/**\n * Returns a stateful reducer function which constructs a filtered array of\n * tabbable elements, where at most one radio input is selected for a given\n * name, giving priority to checked input, falling back to the first\n * encountered.\n *\n * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer.\n */\nfunction createStatefulCollapseRadioGroup() {\n\t/** @type {Record<string, MaybeHTMLInputElement>} */\n\tconst CHOSEN_RADIO_BY_NAME = {};\n\n\treturn function collapseRadioGroup(\n\t\t/** @type {MaybeHTMLInputElement[]} */ result,\n\t\t/** @type {MaybeHTMLInputElement} */ element\n\t) {\n\t\tconst { nodeName, type, checked, name } = element;\n\n\t\t// For all non-radio tabbables, construct to array by concatenating.\n\t\tif ( nodeName !== 'INPUT' || type !== 'radio' || ! name ) {\n\t\t\treturn result.concat( element );\n\t\t}\n\n\t\tconst hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty( name );\n\n\t\t// Omit by skipping concatenation if the radio element is not chosen.\n\t\tconst isChosen = checked || ! hasChosen;\n\t\tif ( ! isChosen ) {\n\t\t\treturn result;\n\t\t}\n\n\t\t// At this point, if there had been a chosen element, the current\n\t\t// element is checked and should take priority. Retroactively remove\n\t\t// the element which had previously been considered the chosen one.\n\t\tif ( hasChosen ) {\n\t\t\tconst hadChosenElement = CHOSEN_RADIO_BY_NAME[ name ];\n\t\t\tresult = result.filter( ( e ) => e !== hadChosenElement );\n\t\t}\n\n\t\tCHOSEN_RADIO_BY_NAME[ name ] = element;\n\n\t\treturn result.concat( element );\n\t};\n}\n\n/**\n * An array map callback, returning an object with the element value and its\n * array index location as properties. This is used to emulate a proper stable\n * sort where equal tabIndex should be left in order of their occurrence in the\n * document.\n *\n * @param {HTMLElement} element Element.\n * @param {number} index Array index of element.\n *\n * @return {{ element: HTMLElement, index: number }} Mapped object with element, index.\n */\nfunction mapElementToObjectTabbable( element, index ) {\n\treturn { element, index };\n}\n\n/**\n * An array map callback, returning an element of the given mapped object's\n * element value.\n *\n * @param {{ element: HTMLElement }} object Mapped object with element.\n *\n * @return {HTMLElement} Mapped object element.\n */\nfunction mapObjectTabbableToElement( object ) {\n\treturn object.element;\n}\n\n/**\n * A sort comparator function used in comparing two objects of mapped elements.\n *\n * @see mapElementToObjectTabbable\n *\n * @param {{ element: HTMLElement, index: number }} a First object to compare.\n * @param {{ element: HTMLElement, index: number }} b Second object to compare.\n *\n * @return {number} Comparator result.\n */\nfunction compareObjectTabbables( a, b ) {\n\tconst aTabIndex = getTabIndex( a.element );\n\tconst bTabIndex = getTabIndex( b.element );\n\n\tif ( aTabIndex === bTabIndex ) {\n\t\treturn a.index - b.index;\n\t}\n\n\treturn aTabIndex - bTabIndex;\n}\n\n/**\n * Givin focusable elements, filters out tabbable element.\n *\n * @param {HTMLElement[]} focusables Focusable elements to filter.\n *\n * @return {HTMLElement[]} Tabbable elements.\n */\nfunction filterTabbable( focusables ) {\n\treturn focusables\n\t\t.filter( isTabbableIndex )\n\t\t.map( mapElementToObjectTabbable )\n\t\t.sort( compareObjectTabbables )\n\t\t.map( mapObjectTabbableToElement )\n\t\t.reduce( createStatefulCollapseRadioGroup(), [] );\n}\n\n/**\n * @param {Element} context\n * @return {HTMLElement[]} Tabbable elements within the context.\n */\nexport function find( context ) {\n\treturn filterTabbable( findFocusable( context ) );\n}\n\n/**\n * Given a focusable element, find the preceding tabbable element.\n *\n * @param {Element} element The focusable element before which to look. Defaults\n * to the active element.\n *\n * @return {HTMLElement|undefined} Preceding tabbable element.\n */\nexport function findPrevious( element ) {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) )\n\t\t.reverse()\n\t\t.find(\n\t\t\t( focusable ) =>\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\t\telement.DOCUMENT_POSITION_PRECEDING\n\t\t);\n}\n\n/**\n * Given a focusable element, find the next tabbable element.\n *\n * @param {Element} element The focusable element after which to look. Defaults\n * to the active element.\n *\n * @return {HTMLElement|undefined} Next tabbable element.\n */\nexport function findNext( element ) {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) ).find(\n\t\t( focusable ) =>\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\telement.DOCUMENT_POSITION_FOLLOWING\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CAAEC,OAAO,EAAG;EAC/B,MAAMC,QAAQ,GAAGD,OAAO,CAACE,YAAY,CAAE,UAAW,CAAC;EACnD,OAAOD,QAAQ,KAAK,IAAI,GAAG,CAAC,GAAGE,QAAQ,CAAEF,QAAQ,EAAE,EAAG,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,eAAeA,CAAEJ,OAAO,EAAG;EAC1C,OAAOD,WAAW,CAAEC,OAAQ,CAAC,KAAK,CAAC,CAAC;AACrC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,gCAAgCA,CAAA,EAAG;EAC3C;EACA,MAAMC,oBAAoB,GAAG,CAAC,CAAC;EAE/B,OAAO,SAASC,kBAAkBA,CAAA,CACjC,sCAAuCC,MAAM,EAC7C,oCAAqCR,OAAO,EAC3C;IACD,MAAM;MAAES,QAAQ;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAK,CAAC,GAAGZ,OAAO;;IAEjD;IACA,IAAKS,QAAQ,KAAK,OAAO,IAAIC,IAAI,KAAK,OAAO,IAAI,CAAEE,IAAI,EAAG;MACzD,OAAOJ,MAAM,CAACK,MAAM,CAAEb,OAAQ,CAAC;IAChC;IAEA,MAAMc,SAAS,GAAGR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,UAAU,CACfZ,MAAM,CAAEd,eAAgB,CAAC,CACzB2B,GAAG,CAAEX,0BAA2B,CAAC,CACjCY,IAAI,CAAER,sBAAuB,CAAC,CAC9BO,GAAG,CAAET,0BAA2B,CAAC,CACjCW,MAAM,CAAE5B,gCAAgC,CAAC,CAAC,EAAE,EAAG,CAAC;AACnD;;AAEA;AACA;AACA;AACA;AACO,SAAS6B,IAAIA,CAAEC,OAAO,EAAG;EAC/B,OAAON,cAAc,CAAE,IAAAO,eAAa,EAAED,OAAQ,CAAE,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAAErC,OAAO,EAAG;EACvC,OAAO6B,cAAc,CAAE,IAAAO,eAAa,EAAEpC,OAAO,CAACsC,aAAa,CAACC,IAAK,CAAE,CAAC,CAClEC,OAAO,CAAC,CAAC,CACTN,IAAI,CACFO,SAAS;EACV;EACAzC,OAAO,CAAC0C,uBAAuB,CAAED,SAAU,CAAC,GAC5CzC,OAAO,CAAC2C,2BACV,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAE5C,OAAO,EAAG;EACnC,OAAO6B,cAAc,CAAE,IAAAO,eAAa,EAAEpC,OAAO,CAACsC,aAAa,CAACC,IAAK,CAAE,CAAC,CAACL,IAAI,CACtEO,SAAS;EACV;EACAzC,OAAO,CAAC0C,uBAAuB,CAAED,SAAU,CAAC,GAC5CzC,OAAO,CAAC6C,2BACV,CAAC;AACF","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["assertIsDefined","val","name","process","env","NODE_ENV","undefined","Error"],"sources":["@wordpress/dom/src/utils/assert-is-defined.ts"],"sourcesContent":["export function assertIsDefined< T >(\n\tval: T,\n\tname: string\n): asserts val is NonNullable< T > {\n\tif (\n\t\tprocess.env.NODE_ENV !== 'production' &&\n\t\t( val === undefined || val === null )\n\t) {\n\t\tthrow new Error(\n\t\t\t`Expected '${ name }' to be defined, but received ${ val }`\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;AAAO,SAASA,eAAeA,CAC9BC,GAAM,EACNC,IAAY,EACsB;EAClC,IACCC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,KACnCJ,GAAG,KAAKK,SAAS,IAAIL,GAAG,KAAK,IAAI,CAAE,EACpC;IACD,MAAM,IAAIM,KAAK,CACb,aAAaL,IAAM,iCAAiCD,GAAK,EAC3D,CAAC;EACF;AACD"}
|
1
|
+
{"version":3,"names":["assertIsDefined","val","name","process","env","NODE_ENV","undefined","Error"],"sources":["@wordpress/dom/src/utils/assert-is-defined.ts"],"sourcesContent":["export function assertIsDefined< T >(\n\tval: T,\n\tname: string\n): asserts val is NonNullable< T > {\n\tif (\n\t\tprocess.env.NODE_ENV !== 'production' &&\n\t\t( val === undefined || val === null )\n\t) {\n\t\tthrow new Error(\n\t\t\t`Expected '${ name }' to be defined, but received ${ val }`\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;AAAO,SAASA,eAAeA,CAC9BC,GAAM,EACNC,IAAY,EACsB;EAClC,IACCC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,KACnCJ,GAAG,KAAKK,SAAS,IAAIL,GAAG,KAAK,IAAI,CAAE,EACpC;IACD,MAAM,IAAIM,KAAK,CACb,aAAaL,IAAM,iCAAiCD,GAAK,EAC3D,CAAC;EACF;AACD","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"sources":["@wordpress/dom/src/data-transfer.js"],"sourcesContent":["/**\n * Gets all files from a DataTransfer object.\n *\n * @param {DataTransfer} dataTransfer DataTransfer object to inspect.\n *\n * @return {File[]} An array containing all files.\n */\nexport function getFilesFromDataTransfer( dataTransfer ) {\n\tconst files = Array.from( dataTransfer.files );\n\n\tArray.from( dataTransfer.items ).forEach( ( item ) => {\n\t\tconst file = item.getAsFile();\n\n\t\tif (\n\t\t\tfile &&\n\t\t\t! files.find(\n\t\t\t\t( { name, type, size } ) =>\n\t\t\t\t\tname === file.name &&\n\t\t\t\t\ttype === file.type &&\n\t\t\t\t\tsize === file.size\n\t\t\t)\n\t\t) {\n\t\t\tfiles.push( file );\n\t\t}\n\t} );\n\n\treturn files;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,wBAAwBA,CAAEC,YAAY,EAAG;EACxD,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACC,KAAM,CAAC;EAE9CC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACI,KAAM,CAAC,CAACC,OAAO,CAAIC,IAAI,IAAM;IACrD,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAAC,CAAC;IAE7B,IACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAI,CACX,CAAE;MAAEC,IAAI;MAAEC,IAAI;MAAEC;IAAK,CAAC,KACrBF,IAAI,KAAKH,IAAI,CAACG,IAAI,IAClBC,IAAI,KAAKJ,IAAI,CAACI,IAAI,IAClBC,IAAI,KAAKL,IAAI,CAACK,IAChB,CAAC,EACA;MACDX,KAAK,CAACY,IAAI,CAAEN,IAAK,CAAC;IACnB;EACD,CAAE,CAAC;EAEH,OAAON,KAAK;AACb"}
|
1
|
+
{"version":3,"names":["getFilesFromDataTransfer","dataTransfer","files","Array","from","items","forEach","item","file","getAsFile","find","name","type","size","push"],"sources":["@wordpress/dom/src/data-transfer.js"],"sourcesContent":["/**\n * Gets all files from a DataTransfer object.\n *\n * @param {DataTransfer} dataTransfer DataTransfer object to inspect.\n *\n * @return {File[]} An array containing all files.\n */\nexport function getFilesFromDataTransfer( dataTransfer ) {\n\tconst files = Array.from( dataTransfer.files );\n\n\tArray.from( dataTransfer.items ).forEach( ( item ) => {\n\t\tconst file = item.getAsFile();\n\n\t\tif (\n\t\t\tfile &&\n\t\t\t! files.find(\n\t\t\t\t( { name, type, size } ) =>\n\t\t\t\t\tname === file.name &&\n\t\t\t\t\ttype === file.type &&\n\t\t\t\t\tsize === file.size\n\t\t\t)\n\t\t) {\n\t\t\tfiles.push( file );\n\t\t}\n\t} );\n\n\treturn files;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,wBAAwBA,CAAEC,YAAY,EAAG;EACxD,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACC,KAAM,CAAC;EAE9CC,KAAK,CAACC,IAAI,CAAEH,YAAY,CAACI,KAAM,CAAC,CAACC,OAAO,CAAIC,IAAI,IAAM;IACrD,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAAC,CAAC;IAE7B,IACCD,IAAI,IACJ,CAAEN,KAAK,CAACQ,IAAI,CACX,CAAE;MAAEC,IAAI;MAAEC,IAAI;MAAEC;IAAK,CAAC,KACrBF,IAAI,KAAKH,IAAI,CAACG,IAAI,IAClBC,IAAI,KAAKJ,IAAI,CAACI,IAAI,IAClBC,IAAI,KAAKL,IAAI,CAACK,IAChB,CAAC,EACA;MACDX,KAAK,CAACY,IAAI,CAAEN,IAAK,CAAC;IACnB;EACD,CAAE,CAAC;EAEH,OAAON,KAAK;AACb","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["caretRangeFromPoint","doc","x","y","caretPositionFromPoint","point","range","createRange","setStart","offsetNode","offset","collapse"],"sources":["@wordpress/dom/src/dom/caret-range-from-point.js"],"sourcesContent":["/**\n * Polyfill.\n * Get a collapsed range for a given point.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n *\n * @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n *\n * @return {Range | null} The best range for the given point.\n */\nexport default function caretRangeFromPoint( doc, x, y ) {\n\tif ( doc.caretRangeFromPoint ) {\n\t\treturn doc.caretRangeFromPoint( x, y );\n\t}\n\n\tif ( ! doc.caretPositionFromPoint ) {\n\t\treturn null;\n\t}\n\n\tconst point = doc.caretPositionFromPoint( x, y );\n\n\t// If x or y are negative, outside viewport, or there is no text entry node.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n\tif ( ! point ) {\n\t\treturn null;\n\t}\n\n\tconst range = doc.createRange();\n\n\trange.setStart( point.offsetNode, point.offset );\n\trange.collapse( true );\n\n\treturn range;\n}\n\n/**\n * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint\n * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,mBAAmBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAG;EACxD,IAAKF,GAAG,CAACD,mBAAmB,EAAG;IAC9B,OAAOC,GAAG,CAACD,mBAAmB,CAAEE,CAAC,EAAEC,CAAE,CAAC;EACvC;EAEA,IAAK,CAAEF,GAAG,CAACG,sBAAsB,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGJ,GAAG,CAACG,sBAAsB,CAAEF,CAAC,EAAEC,CAAE,CAAC;;EAEhD;EACA;EACA,IAAK,CAAEE,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGL,GAAG,CAACM,WAAW,CAAC,CAAC;EAE/BD,KAAK,CAACE,QAAQ,CAAEH,KAAK,CAACI,UAAU,EAAEJ,KAAK,CAACK,MAAO,CAAC;EAChDJ,KAAK,CAACK,QAAQ,CAAE,IAAK,CAAC;EAEtB,OAAOL,KAAK;AACb;;AAEA;AACA;AACA;AACA"}
|
1
|
+
{"version":3,"names":["caretRangeFromPoint","doc","x","y","caretPositionFromPoint","point","range","createRange","setStart","offsetNode","offset","collapse"],"sources":["@wordpress/dom/src/dom/caret-range-from-point.js"],"sourcesContent":["/**\n * Polyfill.\n * Get a collapsed range for a given point.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n *\n * @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n *\n * @return {Range | null} The best range for the given point.\n */\nexport default function caretRangeFromPoint( doc, x, y ) {\n\tif ( doc.caretRangeFromPoint ) {\n\t\treturn doc.caretRangeFromPoint( x, y );\n\t}\n\n\tif ( ! doc.caretPositionFromPoint ) {\n\t\treturn null;\n\t}\n\n\tconst point = doc.caretPositionFromPoint( x, y );\n\n\t// If x or y are negative, outside viewport, or there is no text entry node.\n\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint\n\tif ( ! point ) {\n\t\treturn null;\n\t}\n\n\tconst range = doc.createRange();\n\n\trange.setStart( point.offsetNode, point.offset );\n\trange.collapse( true );\n\n\treturn range;\n}\n\n/**\n * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint\n * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition\n */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,mBAAmBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAG;EACxD,IAAKF,GAAG,CAACD,mBAAmB,EAAG;IAC9B,OAAOC,GAAG,CAACD,mBAAmB,CAAEE,CAAC,EAAEC,CAAE,CAAC;EACvC;EAEA,IAAK,CAAEF,GAAG,CAACG,sBAAsB,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGJ,GAAG,CAACG,sBAAsB,CAAEF,CAAC,EAAEC,CAAE,CAAC;;EAEhD;EACA;EACA,IAAK,CAAEE,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGL,GAAG,CAACM,WAAW,CAAC,CAAC;EAE/BD,KAAK,CAACE,QAAQ,CAAEH,KAAK,CAACI,UAAU,EAAEJ,KAAK,CAACK,MAAO,CAAC;EAChDJ,KAAK,CAACK,QAAQ,CAAE,IAAK,CAAC;EAEtB,OAAOL,KAAK;AACb;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isEmpty","remove","unwrap","isPhrasingContent","insertAfter","isElement","noop","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","includes","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\nconst noop = () => {};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach(\n\t\t( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {\n\t\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t\t// function, or with an isMatch function that matches the node.\n\t\t\tif (\n\t\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t\t) {\n\t\t\t\tif ( isElement( node ) ) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tattributes = [],\n\t\t\t\t\t\tclasses = [],\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trequire = [],\n\t\t\t\t\t\tallowEmpty,\n\t\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t\t// remove the node.\n\t\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\t\tremove( node );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t\t! attributes.includes( name )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => className === item;\n\t\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => item.test( className );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t\t( child ) =>\n\t\t\t\t\t\t\t\t\t\t\t! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t\t} else {\n\t\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t\t// are not phrasing content.\n\t\t\t\tif (\n\t\t\t\t\tinline &&\n\t\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\t\tnode.nextElementSibling\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t\t}\n\n\t\t\t\tunwrap( node );\n\t\t\t}\n\t\t}\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAO,MAAM,YAAY;AAChC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAEC,QAAQ,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAG;EACtEC,KAAK,CAACC,IAAI,CAAEL,QAAS,CAAC,CAACM,OAAO,CAC7B,EAAE,sDAAuDC,IAAI,KAAM;IAClE,MAAMC,GAAG,GAAGD,IAAI,CAACE,QAAQ,CAACC,WAAW,CAAC,CAAC;;IAEvC;IACA;IACA,IACCR,MAAM,CAACS,cAAc,CAAEH,GAAI,CAAC,KAC1B,CAAEN,MAAM,CAAEM,GAAG,CAAE,CAACI,OAAO,IAAIV,MAAM,CAAEM,GAAG,CAAE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AAC8B,UAAU,EAAG;cACzB5C,MAAM,CAAEc,IAAI,CAAC8B,UAAW,CAAC;YAC1B;UACD;QACD;MACD;MACA;IACD,CAAC,MAAM;MACNtC,aAAa,CAAEQ,IAAI,CAAC2B,UAAU,EAAEjC,GAAG,EAAEC,MAAM,EAAEC,MAAO,CAAC;;MAErD;MACA;MACA,IACCA,MAAM,IACN,CAAER,iBAAiB,CAAEY,IAAK,CAAC,IAC3BA,IAAI,CAAC+B,kBAAkB,EACtB;QACD1C,WAAW,CAAEK,GAAG,CAACsC,aAAa,CAAE,IAAK,CAAC,EAAEhC,IAAK,CAAC;MAC/C;MAEAb,MAAM,CAAEa,IAAK,CAAC;IACf;EACD,CACD,CAAC;AACF"}
|
1
|
+
{"version":3,"names":["isEmpty","remove","unwrap","isPhrasingContent","insertAfter","isElement","noop","cleanNodeList","nodeList","doc","schema","inline","Array","from","forEach","node","tag","nodeName","toLowerCase","hasOwnProperty","isMatch","attributes","classes","children","require","allowEmpty","hasAttributes","name","includes","removeAttribute","classList","length","mattchers","map","item","className","RegExp","test","some","hasChildNodes","querySelector","join","childNodes","parentNode","child","firstChild","nextElementSibling","createElement"],"sources":["@wordpress/dom/src/dom/clean-node-list.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEmpty from './is-empty';\nimport remove from './remove';\nimport unwrap from './unwrap';\nimport { isPhrasingContent } from '../phrasing-content';\nimport insertAfter from './insert-after';\nimport isElement from './is-element';\n\nconst noop = () => {};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef SchemaItem\n * @property {string[]} [attributes] Attributes.\n * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.\n * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.\n * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.\n * @property {boolean} allowEmpty Whether to allow nodes without children.\n * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.\n */\n\n/** @typedef {{ [tag: string]: SchemaItem }} Schema */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on a node\n * list.\n *\n * @param {NodeList} nodeList The nodeList to filter.\n * @param {Document} doc The document of the nodeList.\n * @param {Schema} schema An array of functions that can mutate with the provided node.\n * @param {boolean} inline Whether to clean for inline mode.\n */\nexport default function cleanNodeList( nodeList, doc, schema, inline ) {\n\tArray.from( nodeList ).forEach(\n\t\t( /** @type {Node & { nextElementSibling?: unknown }} */ node ) => {\n\t\t\tconst tag = node.nodeName.toLowerCase();\n\n\t\t\t// It's a valid child, if the tag exists in the schema without an isMatch\n\t\t\t// function, or with an isMatch function that matches the node.\n\t\t\tif (\n\t\t\t\tschema.hasOwnProperty( tag ) &&\n\t\t\t\t( ! schema[ tag ].isMatch || schema[ tag ].isMatch?.( node ) )\n\t\t\t) {\n\t\t\t\tif ( isElement( node ) ) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tattributes = [],\n\t\t\t\t\t\tclasses = [],\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trequire = [],\n\t\t\t\t\t\tallowEmpty,\n\t\t\t\t\t} = schema[ tag ];\n\n\t\t\t\t\t// If the node is empty and it's supposed to have children,\n\t\t\t\t\t// remove the node.\n\t\t\t\t\tif ( children && ! allowEmpty && isEmpty( node ) ) {\n\t\t\t\t\t\tremove( node );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasAttributes() ) {\n\t\t\t\t\t\t// Strip invalid attributes.\n\t\t\t\t\t\tArray.from( node.attributes ).forEach( ( { name } ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tname !== 'class' &&\n\t\t\t\t\t\t\t\t! attributes.includes( name )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( name );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Strip invalid classes.\n\t\t\t\t\t\t// In jsdom-jscore, 'node.classList' can be undefined.\n\t\t\t\t\t\t// TODO: Explore patching this in jsdom-jscore.\n\t\t\t\t\t\tif ( node.classList && node.classList.length ) {\n\t\t\t\t\t\t\tconst mattchers = classes.map( ( item ) => {\n\t\t\t\t\t\t\t\tif ( typeof item === 'string' ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => className === item;\n\t\t\t\t\t\t\t\t} else if ( item instanceof RegExp ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t/** @type {string} */ className\n\t\t\t\t\t\t\t\t\t) => item.test( className );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn noop;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tArray.from( node.classList ).forEach( ( name ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! mattchers.some( ( isMatch ) =>\n\t\t\t\t\t\t\t\t\t\tisMatch( name )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnode.classList.remove( name );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tif ( ! node.classList.length ) {\n\t\t\t\t\t\t\t\tnode.removeAttribute( 'class' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( node.hasChildNodes() ) {\n\t\t\t\t\t\t// Do not filter any content.\n\t\t\t\t\t\tif ( children === '*' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Continue if the node is supposed to have children.\n\t\t\t\t\t\tif ( children ) {\n\t\t\t\t\t\t\t// If a parent requires certain children, but it does\n\t\t\t\t\t\t\t// not have them, drop the parent and continue.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\trequire.length &&\n\t\t\t\t\t\t\t\t! node.querySelector( require.join( ',' ) )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t// If the node is at the top, phrasing content, and\n\t\t\t\t\t\t\t\t// contains children that are block content, unwrap\n\t\t\t\t\t\t\t\t// the node because it is invalid.\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tnode.parentNode &&\n\t\t\t\t\t\t\t\tnode.parentNode.nodeName === 'BODY' &&\n\t\t\t\t\t\t\t\tisPhrasingContent( node )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tArray.from( node.childNodes ).some(\n\t\t\t\t\t\t\t\t\t\t( child ) =>\n\t\t\t\t\t\t\t\t\t\t\t! isPhrasingContent( child )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tunwrap( node );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcleanNodeList(\n\t\t\t\t\t\t\t\t\tnode.childNodes,\n\t\t\t\t\t\t\t\t\tdoc,\n\t\t\t\t\t\t\t\t\tchildren,\n\t\t\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Remove children if the node is not supposed to have any.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twhile ( node.firstChild ) {\n\t\t\t\t\t\t\t\tremove( node.firstChild );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Invalid child. Continue with schema at the same place and unwrap.\n\t\t\t} else {\n\t\t\t\tcleanNodeList( node.childNodes, doc, schema, inline );\n\n\t\t\t\t// For inline mode, insert a line break when unwrapping nodes that\n\t\t\t\t// are not phrasing content.\n\t\t\t\tif (\n\t\t\t\t\tinline &&\n\t\t\t\t\t! isPhrasingContent( node ) &&\n\t\t\t\t\tnode.nextElementSibling\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter( doc.createElement( 'br' ), node );\n\t\t\t\t}\n\n\t\t\t\tunwrap( node );\n\t\t\t}\n\t\t}\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAO,MAAM,YAAY;AAChC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAEC,QAAQ,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAG;EACtEC,KAAK,CAACC,IAAI,CAAEL,QAAS,CAAC,CAACM,OAAO,CAC7B,EAAE,sDAAuDC,IAAI,KAAM;IAClE,MAAMC,GAAG,GAAGD,IAAI,CAACE,QAAQ,CAACC,WAAW,CAAC,CAAC;;IAEvC;IACA;IACA,IACCR,MAAM,CAACS,cAAc,CAAEH,GAAI,CAAC,KAC1B,CAAEN,MAAM,CA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Z,MACD,CAAC;YACF;YACA;UACD,CAAC,MAAM;YACN,OAAQI,IAAI,CAAC8B,UAAU,EAAG;cACzB5C,MAAM,CAAEc,IAAI,CAAC8B,UAAW,CAAC;YAC1B;UACD;QACD;MACD;MACA;IACD,CAAC,MAAM;MACNtC,aAAa,CAAEQ,IAAI,CAAC2B,UAAU,EAAEjC,GAAG,EAAEC,MAAM,EAAEC,MAAO,CAAC;;MAErD;MACA;MACA,IACCA,MAAM,IACN,CAAER,iBAAiB,CAAEY,IAAK,CAAC,IAC3BA,IAAI,CAAC+B,kBAAkB,EACtB;QACD1C,WAAW,CAAEK,GAAG,CAACsC,aAAa,CAAE,IAAK,CAAC,EAAEhC,IAAK,CAAC;MAC/C;MAEAb,MAAM,CAAEa,IAAK,CAAC;IACf;EACD,CACD,CAAC;AACF","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getRectangleFromRange","assertIsDefined","computeCaretRect","win","selection","getSelection","range","rangeCount","getRangeAt"],"sources":["@wordpress/dom/src/dom/compute-caret-rect.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle for the selection in a container.\n *\n * @param {Window} win The window of the selection.\n *\n * @return {DOMRect | null} The rectangle.\n */\nexport default function computeCaretRect( win ) {\n\tconst selection = win.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn null;\n\t}\n\n\treturn getRectangleFromRange( range );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,GAAG,EAAG;EAC/C,MAAMC,SAAS,GAAGD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpCJ,eAAe,CAAEG,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EAErE,IAAK,CAAEF,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OAAON,qBAAqB,CAAEM,KAAM,CAAC;AACtC"}
|
1
|
+
{"version":3,"names":["getRectangleFromRange","assertIsDefined","computeCaretRect","win","selection","getSelection","range","rangeCount","getRangeAt"],"sources":["@wordpress/dom/src/dom/compute-caret-rect.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle for the selection in a container.\n *\n * @param {Window} win The window of the selection.\n *\n * @return {DOMRect | null} The rectangle.\n */\nexport default function computeCaretRect( win ) {\n\tconst selection = win.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn null;\n\t}\n\n\treturn getRectangleFromRange( range );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,GAAG,EAAG;EAC/C,MAAMC,SAAS,GAAGD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpCJ,eAAe,CAAEG,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EAErE,IAAK,CAAEF,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OAAON,qBAAqB,CAAEM,KAAM,CAAC;AACtC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isTextField","isHTMLInputElement","documentHasTextSelection","documentHasSelection","doc","activeElement"],"sources":["@wordpress/dom/src/dom/document-has-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\nimport documentHasTextSelection from './document-has-text-selection';\n\n/**\n * Check whether the current document has a selection. This includes focus in\n * input fields, textareas, and general rich-text selection.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasSelection( doc ) {\n\treturn (\n\t\t!! doc.activeElement &&\n\t\t( isHTMLInputElement( doc.activeElement ) ||\n\t\t\tisTextField( doc.activeElement ) ||\n\t\t\tdocumentHasTextSelection( doc ) )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,iBAAiB;AACzC,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,wBAAwB,MAAM,+BAA+B;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAEC,GAAG,EAAG;EACnD,OACC,CAAC,CAAEA,GAAG,CAACC,aAAa,KAClBJ,kBAAkB,CAAEG,GAAG,CAACC,aAAc,CAAC,IACxCL,WAAW,CAAEI,GAAG,CAACC,aAAc,CAAC,IAChCH,wBAAwB,CAAEE,GAAI,CAAC,CAAE;AAEpC"}
|
1
|
+
{"version":3,"names":["isTextField","isHTMLInputElement","documentHasTextSelection","documentHasSelection","doc","activeElement"],"sources":["@wordpress/dom/src/dom/document-has-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\nimport documentHasTextSelection from './document-has-text-selection';\n\n/**\n * Check whether the current document has a selection. This includes focus in\n * input fields, textareas, and general rich-text selection.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasSelection( doc ) {\n\treturn (\n\t\t!! doc.activeElement &&\n\t\t( isHTMLInputElement( doc.activeElement ) ||\n\t\t\tisTextField( doc.activeElement ) ||\n\t\t\tdocumentHasTextSelection( doc ) )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,iBAAiB;AACzC,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,wBAAwB,MAAM,+BAA+B;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAEC,GAAG,EAAG;EACnD,OACC,CAAC,CAAEA,GAAG,CAACC,aAAa,KAClBJ,kBAAkB,CAAEG,GAAG,CAACC,aAAc,CAAC,IACxCL,WAAW,CAAEI,GAAG,CAACC,aAAc,CAAC,IAChCH,wBAAwB,CAAEE,GAAI,CAAC,CAAE;AAEpC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["assertIsDefined","documentHasTextSelection","doc","defaultView","selection","getSelection","range","rangeCount","getRangeAt","collapsed"],"sources":["@wordpress/dom/src/dom/document-has-text-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc ) {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,wBAAwBA,CAAEC,GAAG,EAAG;EACvDF,eAAe,CAAEE,GAAG,CAACC,WAAW,EAAE,iBAAkB,CAAC;EACrD,MAAMC,SAAS,GAAGF,GAAG,CAACC,WAAW,CAACE,YAAY,CAAC,CAAC;EAChDL,eAAe,CAAEI,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EACrE,OAAO,CAAC,CAAEF,KAAK,IAAI,CAAEA,KAAK,CAACG,SAAS;AACrC"}
|
1
|
+
{"version":3,"names":["assertIsDefined","documentHasTextSelection","doc","defaultView","selection","getSelection","range","rangeCount","getRangeAt","collapsed"],"sources":["@wordpress/dom/src/dom/document-has-text-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc ) {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,wBAAwBA,CAAEC,GAAG,EAAG;EACvDF,eAAe,CAAEE,GAAG,CAACC,WAAW,EAAE,iBAAkB,CAAC;EACrD,MAAMC,SAAS,GAAGF,GAAG,CAACC,WAAW,CAACE,YAAY,CAAC,CAAC;EAChDL,eAAe,CAAEI,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EACrE,OAAO,CAAC,CAAEF,KAAK,IAAI,CAAEA,KAAK,CAACG,SAAS;AACrC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["documentHasTextSelection","inputFieldHasUncollapsedSelection","documentHasUncollapsedSelection","doc","activeElement"],"sources":["@wordpress/dom/src/dom/document-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection( doc ) {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,iCAAiC,MAAM,yCAAyC;;AAEvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,+BAA+BA,CAAEC,GAAG,EAAG;EAC9D,OACCH,wBAAwB,CAAEG,GAAI,CAAC,IAC7B,CAAC,CAAEA,GAAG,CAACC,aAAa,IACrBH,iCAAiC,CAAEE,GAAG,CAACC,aAAc,CAAG;AAE3D"}
|
1
|
+
{"version":3,"names":["documentHasTextSelection","inputFieldHasUncollapsedSelection","documentHasUncollapsedSelection","doc","activeElement"],"sources":["@wordpress/dom/src/dom/document-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection( doc ) {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,iCAAiC,MAAM,yCAAyC;;AAEvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,+BAA+BA,CAAEC,GAAG,EAAG;EAC9D,OACCH,wBAAwB,CAAEG,GAAI,CAAC,IAC7B,CAAC,CAAEA,GAAG,CAACC,aAAa,IACrBH,iCAAiC,CAAEE,GAAG,CAACC,aAAc,CAAG;AAE3D","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["assertIsDefined","getComputedStyle","element","ownerDocument","defaultView"],"sources":["@wordpress/dom/src/dom/get-computed-style.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.\n */\nexport default function getComputedStyle( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,OAAO,EAAG;EACnD;EACAF,eAAe,CACdE,OAAO,CAACC,aAAa,CAACC,WAAW,EACjC,mCACD,CAAC;EACD,OAAOF,OAAO,CAACC,aAAa,CAACC,WAAW,CAACH,gBAAgB,CAAEC,OAAQ,CAAC;AACrE"}
|
1
|
+
{"version":3,"names":["assertIsDefined","getComputedStyle","element","ownerDocument","defaultView"],"sources":["@wordpress/dom/src/dom/get-computed-style.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.\n */\nexport default function getComputedStyle( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,OAAO,EAAG;EACnD;EACAF,eAAe,CACdE,OAAO,CAACC,aAAa,CAACC,WAAW,EACjC,mCACD,CAAC;EACD,OAAOF,OAAO,CAACC,aAAa,CAACC,WAAW,CAACH,gBAAgB,CAAEC,OAAQ,CAAC;AACrE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getComputedStyle","getOffsetParent","node","closestElement","parentNode","nodeType","ELEMENT_NODE","position","offsetParent"],"sources":["@wordpress/dom/src/dom/get-offset-parent.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param {Node} node Node from which to find offset parent.\n *\n * @return {Node | null} Offset parent.\n */\nexport default function getOffsetParent( node ) {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement;\n\twhile ( ( closestElement = /** @type {Node} */ ( node.parentNode ) ) ) {\n\t\tif ( closestElement.nodeType === closestElement.ELEMENT_NODE ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif (\n\t\tgetComputedStyle( /** @type {Element} */ ( closestElement ) )\n\t\t\t.position !== 'static'\n\t) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn /** @type {Node & { offsetParent: Node }} */ ( closestElement )\n\t\t.offsetParent;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,IAAI,EAAG;EAC/C;EACA;EACA,IAAIC,cAAc;EAClB,OAAUA,cAAc,GAAG,mBAAsBD,IAAI,CAACE,UAAY,EAAK;IACtE,IAAKD,cAAc,CAACE,QAAQ,KAAKF,cAAc,CAACG,YAAY,EAAG;MAC9D;IACD;EACD;EAEA,IAAK,CAAEH,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;;EAEA;EACA;EACA,IACCH,gBAAgB,EAAE,sBAAyBG,cAAiB,CAAC,CAC3DI,QAAQ,KAAK,QAAQ,EACtB;IACD,OAAOJ,cAAc;EACtB;;EAEA;EACA,OAAO,4CAA+CA,cAAc,CAClEK,YAAY;AACf"}
|
1
|
+
{"version":3,"names":["getComputedStyle","getOffsetParent","node","closestElement","parentNode","nodeType","ELEMENT_NODE","position","offsetParent"],"sources":["@wordpress/dom/src/dom/get-offset-parent.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param {Node} node Node from which to find offset parent.\n *\n * @return {Node | null} Offset parent.\n */\nexport default function getOffsetParent( node ) {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement;\n\twhile ( ( closestElement = /** @type {Node} */ ( node.parentNode ) ) ) {\n\t\tif ( closestElement.nodeType === closestElement.ELEMENT_NODE ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif (\n\t\tgetComputedStyle( /** @type {Element} */ ( closestElement ) )\n\t\t\t.position !== 'static'\n\t) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn /** @type {Node & { offsetParent: Node }} */ ( closestElement )\n\t\t.offsetParent;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,IAAI,EAAG;EAC/C;EACA;EACA,IAAIC,cAAc;EAClB,OAAUA,cAAc,GAAG,mBAAsBD,IAAI,CAACE,UAAY,EAAK;IACtE,IAAKD,cAAc,CAACE,QAAQ,KAAKF,cAAc,CAACG,YAAY,EAAG;MAC9D;IACD;EACD;EAEA,IAAK,CAAEH,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;;EAEA;EACA;EACA,IACCH,gBAAgB,EAAE,sBAAyBG,cAAiB,CAAC,CAC3DI,QAAQ,KAAK,QAAQ,EACtB;IACD,OAAOJ,cAAc;EACtB;;EAEA;EACA,OAAO,4CAA+CA,cAAc,CAClEK,YAAY;AACf","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"sources":["@wordpress/dom/src/dom/get-range-height.js"],"sourcesContent":["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param {Range} range The range to check.\n * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range ) {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAcA,CAAEC,KAAK,EAAG;EAC/C,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,KAAK,CAACI,cAAc,CAAC,CAAE,CAAC;EAElD,IAAK,CAAEH,KAAK,CAACI,MAAM,EAAG;IACrB;EACD;EAEA,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAE,GAAGP,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEC;EAAI,CAAC,KAAMA,GAAI,CAAE,CAAC;EACjE,MAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAG,CAAE,GAAGX,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEI;EAAO,CAAC,KAAMA,MAAO,CAAE,CAAC;EAEzE,OAAOF,YAAY,GAAGL,UAAU;AACjC"}
|
1
|
+
{"version":3,"names":["getRangeHeight","range","rects","Array","from","getClientRects","length","highestTop","Math","min","map","top","lowestBottom","max","bottom"],"sources":["@wordpress/dom/src/dom/get-range-height.js"],"sourcesContent":["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param {Range} range The range to check.\n * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range ) {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAcA,CAAEC,KAAK,EAAG;EAC/C,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEH,KAAK,CAACI,cAAc,CAAC,CAAE,CAAC;EAElD,IAAK,CAAEH,KAAK,CAACI,MAAM,EAAG;IACrB;EACD;EAEA,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAE,GAAGP,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEC;EAAI,CAAC,KAAMA,GAAI,CAAE,CAAC;EACjE,MAAMC,YAAY,GAAGJ,IAAI,CAACK,GAAG,CAAE,GAAGX,KAAK,CAACQ,GAAG,CAAE,CAAE;IAAEI;EAAO,CAAC,KAAMA,MAAO,CAAE,CAAC;EAEzE,OAAOF,YAAY,GAAGL,UAAU;AACjC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"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","height","padNode","createTextNode","cloneRange","insertNode","removeChild"],"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) 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[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD;EACA;EACA;EACA,IAAK,CAAEA,KAAK,CAACC,SAAS,EAAG;IACxB,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEJ,KAAK,CAACK,cAAc,CAAC,CAAE,CAAC;;IAElD;IACA,IAAKH,KAAK,CAACI,MAAM,KAAK,CAAC,EAAG;MACzB,OAAOJ,KAAK,CAAE,CAAC,CAAE;IAClB;;IAEA;IACA,MAAMK,aAAa,GAAGL,KAAK,CAACM,MAAM,CAAE,CAAE;MAAEC;IAA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AAe,CAAEwB,aAAa,EAAE,eAAgB,CAAC;IACjDtB,KAAK,GAAGsB,aAAa,CAACM,WAAW,CAAC,CAAC;IACnC5B,KAAK,CAAC6B,QAAQ,CAAEL,UAAU,EAAEC,KAAM,CAAC;IACnCzB,KAAK,CAAC8B,MAAM,CAAEN,UAAU,EAAEC,KAAM,CAAC;EAClC;EAEA,MAAMvB,KAAK,GAAGF,KAAK,CAACK,cAAc,CAAC,CAAC;;EAEpC;EACA;EACA,IAAKH,KAAK,CAACI,MAAM,GAAG,CAAC,EAAG;IACvB,OAAO,IAAI;EACZ;EAEA,IAAIyB,IAAI,GAAG7B,KAAK,CAAE,CAAC,CAAE;;EAErB;EACA;EACA;EACA;EACA;EACA,IAAK,CAAE6B,IAAI,IAAIA,IAAI,CAACC,MAAM,KAAK,CAAC,EAAG;IAClClC,eAAe,CAAEwB,aAAa,EAAE,eAAgB,CAAC;IACjD,MAAMW,OAAO,GAAGX,aAAa,CAACY,cAAc,CAAE,QAAS,CAAC;IACxD;IACAlC,KAAK,GAAGA,KAAK,CAACmC,UAAU,CAAC,CAAC;IAC1BnC,KAAK,CAACoC,UAAU,CAAEH,OAAQ,CAAC;IAC3BF,IAAI,GAAG/B,KAAK,CAACK,cAAc,CAAC,CAAC,CAAE,CAAC,CAAE;IAClCP,eAAe,CAAEmC,OAAO,CAACT,UAAU,EAAE,oBAAqB,CAAC;IAC3DS,OAAO,CAACT,UAAU,CAACa,WAAW,CAAEJ,OAAQ,CAAC;EAC1C;EAEA,OAAOF,IAAI;AACZ"}
|
1
|
+
{"version":3,"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","height","padNode","createTextNode","cloneRange","insertNode","removeChild"],"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) 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[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD;EACA;EACA;EACA,IAAK,CAAEA,KAAK,CAACC,SAAS,EAAG;IACxB,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAEJ,KAAK,CAACK,cAAc,CAAC,CAAE,CAAC;;IAElD;IACA,IAAKH,KAAK,CAACI,MAAM,KAAK,CAAC,EAAG;MACzB,OAAOJ,KAAK,CAAE,CAAC,CAAE;IAClB;;IAEA;IACA,MAAMK,aAAa,GAAGL,KAAK,CAACM,MAAM,CAAE,CA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AC;IAE3BvB,eAAe,CAAEwB,aAAa,EAAE,eAAgB,CAAC;IACjDtB,KAAK,GAAGsB,aAAa,CAACM,WAAW,CAAC,CAAC;IACnC5B,KAAK,CAAC6B,QAAQ,CAAEL,UAAU,EAAEC,KAAM,CAAC;IACnCzB,KAAK,CAAC8B,MAAM,CAAEN,UAAU,EAAEC,KAAM,CAAC;EAClC;EAEA,MAAMvB,KAAK,GAAGF,KAAK,CAACK,cAAc,CAAC,CAAC;;EAEpC;EACA;EACA,IAAKH,KAAK,CAACI,MAAM,GAAG,CAAC,EAAG;IACvB,OAAO,IAAI;EACZ;EAEA,IAAIyB,IAAI,GAAG7B,KAAK,CAAE,CAAC,CAAE;;EAErB;EACA;EACA;EACA;EACA;EACA,IAAK,CAAE6B,IAAI,IAAIA,IAAI,CAACC,MAAM,KAAK,CAAC,EAAG;IAClClC,eAAe,CAAEwB,aAAa,EAAE,eAAgB,CAAC;IACjD,MAAMW,OAAO,GAAGX,aAAa,CAACY,cAAc,CAAE,QAAS,CAAC;IACxD;IACAlC,KAAK,GAAGA,KAAK,CAACmC,UAAU,CAAC,CAAC;IAC1BnC,KAAK,CAACoC,UAAU,CAAEH,OAAQ,CAAC;IAC3BF,IAAI,GAAG/B,KAAK,CAACK,cAAc,CAAC,CAAC,CAAE,CAAC,CAAE;IAClCP,eAAe,CAAEmC,OAAO,CAACT,UAAU,EAAE,oBAAqB,CAAC;IAC3DS,OAAO,CAACT,UAAU,CAACa,WAAW,CAAEJ,OAAQ,CAAC;EAC1C;EAEA,OAAOF,IAAI;AACZ","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getComputedStyle","getScrollContainer","node","direction","undefined","scrollHeight","clientHeight","overflowY","test","scrollWidth","clientWidth","overflowX","ownerDocument","parentNode"],"sources":["@wordpress/dom/src/dom/get-scroll-container.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,IAAI,EAAEC,SAAS,GAAG,UAAU,EAAG;EAC1E,IAAK,CAAED,IAAI,EAAG;IACb,OAAOE,SAAS;EACjB;EAEA,IAAKD,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,KAAK,EAAG;IACtD;IACA,IAAKD,IAAI,CAACG,YAAY,GAAGH,IAAI,CAACI,YAAY,EAAG;MAC5C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAGP,gBAAgB,CAAEE,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACM,IAAI,CAAED,SAAU,CAAC,EAAG;QACxC,OAAOL,IAAI;MACZ;IACD;EACD;EAEA,IAAKC,SAAS,KAAK,YAAY,IAAIA,SAAS,KAAK,KAAK,EAAG;IACxD;IACA,IAAKD,IAAI,CAACO,WAAW,GAAGP,IAAI,CAACQ,WAAW,EAAG;MAC1C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAGX,gBAAgB,CAAEE,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACM,IAAI,CAAEG,SAAU,CAAC,EAAG;QACxC,OAAOT,IAAI;MACZ;IACD;EACD;EAEA,IAAKA,IAAI,CAACU,aAAa,KAAKV,IAAI,CAACW,UAAU,EAAG;IAC7C,OAAOX,IAAI;EACZ;;EAEA;EACA,OAAOD,kBAAkB,EACxB,sBAAyBC,IAAI,CAACW,UAAU,EACxCV,SACD,CAAC;AACF"}
|
1
|
+
{"version":3,"names":["getComputedStyle","getScrollContainer","node","direction","undefined","scrollHeight","clientHeight","overflowY","test","scrollWidth","clientWidth","overflowX","ownerDocument","parentNode"],"sources":["@wordpress/dom/src/dom/get-scroll-container.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,IAAI,EAAEC,SAAS,GAAG,UAAU,EAAG;EAC1E,IAAK,CAAED,IAAI,EAAG;IACb,OAAOE,SAAS;EACjB;EAEA,IAAKD,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,KAAK,EAAG;IACtD;IACA,IAAKD,IAAI,CAACG,YAAY,GAAGH,IAAI,CAACI,YAAY,EAAG;MAC5C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAGP,gBAAgB,CAAEE,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACM,IAAI,CAAED,SAAU,CAAC,EAAG;QACxC,OAAOL,IAAI;MACZ;IACD;EACD;EAEA,IAAKC,SAAS,KAAK,YAAY,IAAIA,SAAS,KAAK,KAAK,EAAG;IACxD;IACA,IAAKD,IAAI,CAACO,WAAW,GAAGP,IAAI,CAACQ,WAAW,EAAG;MAC1C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAGX,gBAAgB,CAAEE,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACM,IAAI,CAAEG,SAAU,CAAC,EAAG;QACxC,OAAOT,IAAI;MACZ;IACD;EACD;EAEA,IAAKA,IAAI,CAACU,aAAa,KAAKV,IAAI,CAACW,UAAU,EAAG;IAC7C,OAAOX,IAAI;EACZ;;EAEA;EACA,OAAOD,kBAAkB,EACxB,sBAAyBC,IAAI,CAACW,UAAU,EACxCV,SACD,CAAC;AACF","ignoreList":[]}
|