@wordpress/dom 3.2.2 → 3.2.6
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/README.md +3 -4
- package/build/dom/caret-range-from-point.js +7 -3
- package/build/dom/caret-range-from-point.js.map +1 -1
- package/build/dom/document-has-text-selection.js +1 -1
- package/build/dom/document-has-text-selection.js.map +1 -1
- package/build/dom/document-has-uncollapsed-selection.js +2 -2
- package/build/dom/document-has-uncollapsed-selection.js.map +1 -1
- package/build/dom/is-edge.js +1 -1
- package/build/dom/is-edge.js.map +1 -1
- package/build/dom/place-caret-at-edge.js +108 -0
- package/build/dom/place-caret-at-edge.js.map +1 -0
- package/build/dom/place-caret-at-horizontal-edge.js +2 -84
- package/build/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build/dom/place-caret-at-vertical-edge.js +6 -56
- package/build/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build/dom/strip-html.js +14 -2
- package/build/dom/strip-html.js.map +1 -1
- package/build/focusable.js +29 -18
- package/build/focusable.js.map +1 -1
- package/build/phrasing-content.js +1 -1
- package/build/phrasing-content.js.map +1 -1
- package/build/tabbable.js +2 -2
- package/build/tabbable.js.map +1 -1
- package/build-module/dom/caret-range-from-point.js +7 -3
- package/build-module/dom/caret-range-from-point.js.map +1 -1
- package/build-module/dom/document-has-text-selection.js +1 -1
- package/build-module/dom/document-has-text-selection.js.map +1 -1
- package/build-module/dom/document-has-uncollapsed-selection.js +2 -2
- package/build-module/dom/document-has-uncollapsed-selection.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/place-caret-at-edge.js +95 -0
- package/build-module/dom/place-caret-at-edge.js.map +1 -0
- package/build-module/dom/place-caret-at-horizontal-edge.js +2 -81
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +1 -1
- package/build-module/dom/place-caret-at-vertical-edge.js +6 -54
- package/build-module/dom/place-caret-at-vertical-edge.js.map +1 -1
- package/build-module/dom/strip-html.js +11 -2
- package/build-module/dom/strip-html.js.map +1 -1
- package/build-module/focusable.js +29 -18
- package/build-module/focusable.js.map +1 -1
- package/build-module/phrasing-content.js +1 -1
- package/build-module/phrasing-content.js.map +1 -1
- package/build-module/tabbable.js +2 -2
- package/build-module/tabbable.js.map +1 -1
- package/build-types/dom/caret-range-from-point.d.ts +12 -4
- package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/clean-node-list.d.ts +2 -2
- package/build-types/dom/document-has-text-selection.d.ts +1 -1
- package/build-types/dom/document-has-uncollapsed-selection.d.ts +2 -2
- package/build-types/dom/is-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-edge.d.ts +9 -0
- package/build-types/dom/place-caret-at-edge.d.ts.map +1 -0
- package/build-types/dom/place-caret-at-horizontal-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-vertical-edge.d.ts +4 -5
- package/build-types/dom/place-caret-at-vertical-edge.d.ts.map +1 -1
- package/build-types/dom/strip-html.d.ts.map +1 -1
- package/build-types/focusable.d.ts +11 -2
- package/build-types/focusable.d.ts.map +1 -1
- package/build-types/phrasing-content.d.ts +2 -4
- package/build-types/phrasing-content.d.ts.map +1 -1
- package/build-types/tabbable.d.ts +3 -3
- package/build-types/tabbable.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/dom/caret-range-from-point.js +8 -3
- package/src/dom/document-has-text-selection.js +1 -1
- package/src/dom/document-has-uncollapsed-selection.js +2 -2
- package/src/dom/is-edge.js +4 -1
- package/src/dom/place-caret-at-edge.js +95 -0
- package/src/dom/place-caret-at-horizontal-edge.js +2 -83
- package/src/dom/place-caret-at-vertical-edge.js +6 -64
- package/src/dom/strip-html.js +12 -5
- package/src/dom/test/strip-html.js +64 -0
- package/src/focusable.js +37 -32
- package/src/phrasing-content.js +1 -1
- package/src/tabbable.js +2 -4
- package/src/test/dom.js +8 -15
- package/tsconfig.tsbuildinfo +1 -1170
@@ -1,3 +1,7 @@
|
|
1
|
+
/**
|
2
|
+
* Internal dependencies
|
3
|
+
*/
|
4
|
+
import safeHTML from './safe-html';
|
1
5
|
/**
|
2
6
|
* Removes any HTML tags from the provided string.
|
3
7
|
*
|
@@ -5,8 +9,13 @@
|
|
5
9
|
*
|
6
10
|
* @return {string} The text content with any html removed.
|
7
11
|
*/
|
12
|
+
|
8
13
|
export default function stripHTML(html) {
|
9
|
-
|
10
|
-
|
14
|
+
// Remove any script tags or on* attributes otherwise their *contents* will be left
|
15
|
+
// in place following removal of HTML tags.
|
16
|
+
html = safeHTML(html);
|
17
|
+
const doc = document.implementation.createHTMLDocument('');
|
18
|
+
doc.body.innerHTML = html;
|
19
|
+
return doc.body.textContent || '';
|
11
20
|
}
|
12
21
|
//# sourceMappingURL=strip-html.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/dom/src/dom/strip-html.js"],"names":["stripHTML","html","
|
1
|
+
{"version":3,"sources":["@wordpress/dom/src/dom/strip-html.js"],"names":["safeHTML","stripHTML","html","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,aAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,SAAT,CAAoBC,IAApB,EAA2B;AACzC;AACA;AACAA,EAAAA,IAAI,GAAGF,QAAQ,CAAEE,IAAF,CAAf;AAEA,QAAMC,GAAG,GAAGC,QAAQ,CAACC,cAAT,CAAwBC,kBAAxB,CAA4C,EAA5C,CAAZ;AACAH,EAAAA,GAAG,CAACI,IAAJ,CAASC,SAAT,GAAqBN,IAArB;AACA,SAAOC,GAAG,CAACI,IAAJ,CAASE,WAAT,IAAwB,EAA/B;AACA","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"]}
|
@@ -16,31 +16,33 @@
|
|
16
16
|
* AREA elements associated with an IMG:
|
17
17
|
* - https://w3c.github.io/html/editing.html#data-model
|
18
18
|
*/
|
19
|
-
|
19
|
+
|
20
20
|
/**
|
21
|
-
* Returns
|
22
|
-
* nor visibility: hidden).
|
21
|
+
* Returns a CSS selector used to query for focusable elements.
|
23
22
|
*
|
24
|
-
* @param {
|
23
|
+
* @param {boolean} sequential If set, only query elements that are sequentially
|
24
|
+
* focusable. Non-interactive elements with a
|
25
|
+
* negative `tabindex` are focusable but not
|
26
|
+
* sequentially focusable.
|
27
|
+
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
25
28
|
*
|
26
|
-
* @return {
|
29
|
+
* @return {string} CSS selector.
|
27
30
|
*/
|
28
|
-
|
29
|
-
|
30
|
-
return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
|
31
|
+
function buildSelector(sequential) {
|
32
|
+
return [sequential ? '[tabindex]:not([tabindex^="-"])' : '[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe:not([tabindex^="-"])', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(',');
|
31
33
|
}
|
32
34
|
/**
|
33
|
-
* Returns true if the specified element
|
34
|
-
*
|
35
|
+
* Returns true if the specified element is visible (i.e. neither display: none
|
36
|
+
* nor visibility: hidden).
|
35
37
|
*
|
36
|
-
* @param {
|
38
|
+
* @param {HTMLElement} element DOM element to test.
|
37
39
|
*
|
38
|
-
* @return {boolean} Whether element
|
40
|
+
* @return {boolean} Whether element is visible.
|
39
41
|
*/
|
40
42
|
|
41
43
|
|
42
|
-
function
|
43
|
-
return element.
|
44
|
+
function isVisible(element) {
|
45
|
+
return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
|
44
46
|
}
|
45
47
|
/**
|
46
48
|
* Returns true if the specified area element is a valid focusable element, or
|
@@ -69,21 +71,30 @@ function isValidFocusableArea(element) {
|
|
69
71
|
/**
|
70
72
|
* Returns all focusable elements within a given context.
|
71
73
|
*
|
72
|
-
* @param {Element} context
|
74
|
+
* @param {Element} context Element in which to search.
|
75
|
+
* @param {Object} [options]
|
76
|
+
* @param {boolean} [options.sequential] If set, only return elements that are
|
77
|
+
* sequentially focusable.
|
78
|
+
* Non-interactive elements with a
|
79
|
+
* negative `tabindex` are focusable but
|
80
|
+
* not sequentially focusable.
|
81
|
+
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
73
82
|
*
|
74
83
|
* @return {Element[]} Focusable elements.
|
75
84
|
*/
|
76
85
|
|
77
86
|
|
78
|
-
export function find(context
|
87
|
+
export function find(context, {
|
88
|
+
sequential = false
|
89
|
+
} = {}) {
|
79
90
|
/* eslint-disable jsdoc/no-undefined-types */
|
80
91
|
|
81
92
|
/** @type {NodeListOf<HTMLElement>} */
|
82
93
|
|
83
94
|
/* eslint-enable jsdoc/no-undefined-types */
|
84
|
-
const elements = context.querySelectorAll(
|
95
|
+
const elements = context.querySelectorAll(buildSelector(sequential));
|
85
96
|
return Array.from(elements).filter(element => {
|
86
|
-
if (!isVisible(element)
|
97
|
+
if (!isVisible(element)) {
|
87
98
|
return false;
|
88
99
|
}
|
89
100
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["
|
1
|
+
{"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"mapp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D,OAAO,CAACE,gBAAR,CAA0BnB,aAAa,CAAEC,UAAF,CAAvC,CAAjB;AAEA,SAAOmB,KAAK,CAACC,IAAN,CAAYH,QAAZ,EAAuBI,MAAvB,CAAiClB,OAAF,IAAe;AACpD,QAAK,CAAED,SAAS,CAAEC,OAAF,CAAhB,EAA8B;AAC7B,aAAO,KAAP;AACA;;AAED,UAAM;AAAEmB,MAAAA;AAAF,QAAenB,OAArB;;AACA,QAAK,WAAWmB,QAAhB,EAA2B;AAC1B,aAAOd,oBAAoB;AAC1B;AAAiCL,MAAAA,OADP,CAA3B;AAGA;;AAED,WAAO,IAAP;AACA,GAbM,CAAP;AAcA","sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} [options]\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {Element[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/dom/src/phrasing-content.js"],"names":["omit","without","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","Object","keys","forEach","tag","children","embeddedContentSchema","audio","canvas","embed","img","object","video","phrasingContentSchema","getPhrasingContentSchema","context","isPhrasingContent","node","nodeName","toLowerCase","hasOwnProperty","isTextContent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,OAAf,QAA8B,QAA9B;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,iBAAiB,GAAG;AACzBC,EAAAA,MAAM,EAAE,EADiB;AAEzBC,EAAAA,EAAE,EAAE,EAFqB;AAGzBC,EAAAA,CAAC,EAAE,EAHsB;AAIzBC,EAAAA,GAAG,EAAE,EAJoB;AAKzBC,EAAAA,GAAG,EAAE,EALoB;AAMzBC,EAAAA,CAAC,EAAE;AAAEC,IAAAA,UAAU,EAAE,CAAE,MAAF,EAAU,QAAV,EAAoB,KAApB;AAAd,GANsB;AAOzBC,EAAAA,IAAI,EAAE,EAPmB;AAQzBC,EAAAA,IAAI,EAAE;AAAEF,IAAAA,UAAU,EAAE,CAAE,OAAF;AAAd,GARmB;AASzBG,EAAAA,GAAG,EAAE,EAToB;AAUzBC,EAAAA,GAAG,EAAE,EAVoB;AAWzBC,EAAAA,EAAE,EAAE,EAXqB;AAYzBC,EAAAA,KAAK,EAAE,EAZkB;AAazB;AACA;AACAC,EAAAA,CAAC,EAAE;AAAEP,IAAAA,UAAU,EAAE,CAAE,MAAF;AAAd,GAfsB;AAgBzBQ,EAAAA,GAAG,EAAE;AAAER,IAAAA,UAAU,EAAE,CAAE,OAAF;AAAd,GAhBoB;AAiBzBS,EAAAA,IAAI,EAAE;AA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ADD,EACM;AACL,QAFD,EAES;AACR,QAHD,EAGS;AACR,QAJD,EAIS;AACR,OALD,EAKQ;AACP,OAND,EAMQ;AACP,OAPD,CAOQ;AAPR,GARU,CAAX;AAkBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASW,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMb,GAAG,GAAGa,IAAI,CAACC,QAAL,CAAcC,WAAd,EAAZ;AACA,SAAOL,wBAAwB,GAAGM,cAA3B,CAA2ChB,GAA3C,KAAoDA,GAAG,KAAK,MAAnE;AACA;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASiB,aAAT,CAAwBJ,IAAxB,EAA+B;AACrC,QAAMb,GAAG,GAAGa,IAAI,CAACC,QAAL,CAAcC,WAAd,EAAZ;AACA,SAAOjD,iBAAiB,CAACkD,cAAlB,CAAkChB,GAAlC,KAA2CA,GAAG,KAAK,MAA1D;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { omit, without } from 'lodash';\n\n/**\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' ] },\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.\nwithout( Object.keys( textContentSchema ), '#text', 'br' ).forEach( ( tag ) => {\n\ttextContentSchema[ tag ].children = omit( textContentSchema, tag );\n} );\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'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\treturn omit(\n\t\t{\n\t\t\t...phrasingContentSchema,\n\t\t\t// We shouldn't paste potentially sensitive information which is not\n\t\t\t// visible to the user when pasted, so strip the attributes.\n\t\t\tins: { children: phrasingContentSchema.ins.children },\n\t\t\tdel: { children: phrasingContentSchema.del.children },\n\t\t},\n\t\t[\n\t\t\t'u', // Used to mark misspelling. Shouldn't be pasted.\n\t\t\t'abbr', // Invisible.\n\t\t\t'data', // Invisible.\n\t\t\t'time', // Invisible.\n\t\t\t'wbr', // Invisible.\n\t\t\t'bdi', // Invisible.\n\t\t\t'bdo', // Invisible.\n\t\t]\n\t);\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"]}
|
1
|
+
{"version":3,"sources":["@wordpress/dom/src/phrasing-content.js"],"names":["omit","without","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","Object","keys","forEach","tag","children","embeddedContentSchema","audio","canvas","embed","img","object","video","phrasingContentSchema","getPhrasingContentSchema","context","isPhrasingContent","node","nodeName","toLowerCase","hasOwnProperty","isTextContent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,OAAf,QAA8B,QAA9B;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,iBAAiB,GAAG;AACzBC,EAAAA,MAAM,EAAE,EADiB;AAEzBC,EAAAA,EAAE,EAAE,EAFqB;AAGzBC,EAAAA,CAAC,EAAE,EAHsB;AAIzBC,EAAAA,GAAG,EAAE,EAJoB;AAKzBC,EAAAA,GAAG,EAAE,EALoB;AAMzBC,EAAAA,CAAC,EAAE;AAAEC,IAAAA,UAAU,EAAE,CAAE,MAAF,EAAU,QAAV,EAAoB,KAApB,EAA2B,IAA3B;AAAd,GANsB;AAOzBC,EAAAA,IAAI,EAAE,EAPmB;AAQzBC,EAAAA,IAAI,EAAE;AAAEF,IAAAA,UAAU,EAAE,CAAE,OAAF;AAAd,GARmB;AASzBG,EAAAA,GAAG,EAAE,EAToB;AAUzBC,EAAAA,GAAG,EAAE,EAVoB;AAWzBC,EAAAA,EAAE,EAAE,EAXqB;AAYzBC,EAAAA,KAAK,EAAE,EAZkB;AAazB;AACA;AACAC,EAAAA,CAAC,EAAE;AAAEP,IAAAA,UAAU,EAAE,CAAE,MAAF;AAAd,GAfsB;AAgBzBQ,EAAAA,GAAG,EAAE;AAAER,IAAAA,UAAU,EAAE,CAAE,OAAF;AAAd,GAhBoB;AAiBzBS,EAAAA,IAAI,EAAE;AAAET,IAAAA,UAAU,EAAE,CAAE,OAAF;AAAd,GAjBmB;AAkBzBU,EAAAA,IAAI,EAAE;AAAEV,IAAAA,UAAU,EAAE,CAAE,UAAF;AAAd,GAlBmB;AAmBzBW,EAAAA,GAAG,EAAE,EAnBoB;AAoBzBC,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AACA,OAAO,SAASW,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMb,GAAG,GAAGa,IAAI,CAACC,QAAL,CAAcC,WAAd,EAAZ;AACA,SAAOL,wBAAwB,GAAGM,cAA3B,CAA2ChB,GAA3C,KAAoDA,GAAG,KAAK,MAAnE;AACA;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASiB,aAAT,CAAwBJ,IAAxB,EAA+B;AACrC,QAAMb,GAAG,GAAGa,IAAI,CAACC,QAAL,CAAcC,WAAd,EAAZ;AACA,SAAOjD,iBAAiB,CAACkD,cAAlB,CAAkChB,GAAlC,KAA2CA,GAAG,KAAK,MAA1D;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { omit, without } from 'lodash';\n\n/**\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.\nwithout( Object.keys( textContentSchema ), '#text', 'br' ).forEach( ( tag ) => {\n\ttextContentSchema[ tag ].children = omit( textContentSchema, tag );\n} );\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'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\treturn omit(\n\t\t{\n\t\t\t...phrasingContentSchema,\n\t\t\t// We shouldn't paste potentially sensitive information which is not\n\t\t\t// visible to the user when pasted, so strip the attributes.\n\t\t\tins: { children: phrasingContentSchema.ins.children },\n\t\t\tdel: { children: phrasingContentSchema.del.children },\n\t\t},\n\t\t[\n\t\t\t'u', // Used to mark misspelling. Shouldn't be pasted.\n\t\t\t'abbr', // Invisible.\n\t\t\t'data', // Invisible.\n\t\t\t'time', // Invisible.\n\t\t\t'wbr', // Invisible.\n\t\t\t'bdi', // Invisible.\n\t\t\t'bdo', // Invisible.\n\t\t]\n\t);\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"]}
|
package/build-module/tabbable.js
CHANGED
@@ -184,9 +184,9 @@ export function findPrevious(element) {
|
|
184
184
|
|
185
185
|
export function findNext(element) {
|
186
186
|
const focusables = findFocusable(element.ownerDocument.body);
|
187
|
-
const index = focusables.indexOf(element); // Remove all focusables before and
|
187
|
+
const index = focusables.indexOf(element); // Remove all focusables before and including `element`.
|
188
188
|
|
189
|
-
const remaining = focusables.slice(index + 1)
|
189
|
+
const remaining = focusables.slice(index + 1);
|
190
190
|
return first(filterTabbable(remaining));
|
191
191
|
}
|
192
192
|
//# sourceMappingURL=tabbable.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/dom/src/tabbable.js"],"names":["without","first","last","find","findFocusable","getTabIndex","element","tabIndex","getAttribute","parseInt","isTabbableIndex","createStatefulCollapseRadioGroup","CHOSEN_RADIO_BY_NAME","collapseRadioGroup","result","nodeName","type","checked","name","concat","hasChosen","hasOwnProperty","isChosen","hadChosenElement","mapElementToObjectTabbable","index","mapObjectTabbableToElement","object","compareObjectTabbables","a","b","aTabIndex","bTabIndex","filterTabbable","focusables","filter","map","sort","reduce","context","findPrevious","ownerDocument","body","indexOf","length","findNext","remaining","slice"
|
1
|
+
{"version":3,"sources":["@wordpress/dom/src/tabbable.js"],"names":["without","first","last","find","findFocusable","getTabIndex","element","tabIndex","getAttribute","parseInt","isTabbableIndex","createStatefulCollapseRadioGroup","CHOSEN_RADIO_BY_NAME","collapseRadioGroup","result","nodeName","type","checked","name","concat","hasChosen","hasOwnProperty","isChosen","hadChosenElement","mapElementToObjectTabbable","index","mapObjectTabbableToElement","object","compareObjectTabbables","a","b","aTabIndex","bTabIndex","filterTabbable","focusables","filter","map","sort","reduce","context","findPrevious","ownerDocument","body","indexOf","length","findNext","remaining","slice"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,KAAlB,EAAyBC,IAAzB,QAAqC,QAArC;AAEA;AACA;AACA;;AACA,SAASC,IAAI,IAAIC,aAAjB,QAAsC,aAAtC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,CAAsBC,OAAtB,EAAgC;AAC/B,QAAMC,QAAQ,GAAGD,OAAO,CAACE,YAAR,CAAsB,UAAtB,CAAjB;AACA,SAAOD,QAAQ,KAAK,IAAb,GAAoB,CAApB,GAAwBE,QAAQ,CAAEF,QAAF,EAAY,EAAZ,CAAvC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASG,eAAT,CAA0BJ,OAA1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EC,UAAF,CAAhB,CAAX;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASW,QAAT,CAAmBvC,OAAnB,EAA6B;AACnC,QAAM4B,UAAU,GAAG9B,aAAa,CAAEE,OAAO,CAACmC,aAAR,CAAsBC,IAAxB,CAAhC;AACA,QAAMjB,KAAK,GAAGS,UAAU,CAACS,OAAX,CAAoBrC,OAApB,CAAd,CAFmC,CAInC;;AACA,QAAMwC,SAAS,GAAGZ,UAAU,CAACa,KAAX,CAAkBtB,KAAK,GAAG,CAA1B,CAAlB;AAEA,SAAOxB,KAAK,CAAEgC,cAAc,CAAEa,SAAF,CAAhB,CAAZ;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { without, first, last } from 'lodash';\n\n/**\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 {Element & { 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 = without( result, 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 {Element} element Element.\n * @param {number} index Array index of element.\n *\n * @return {{ element: Element, 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: Element }} object Mapped object with element.\n *\n * @return {Element} 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: Element, index: number }} a First object to compare.\n * @param {{ element: Element, 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 {Element[]} focusables Focusable elements to filter.\n *\n * @return {Element[]} 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 {Element[]} 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 */\nexport function findPrevious( element ) {\n\tconst focusables = findFocusable( element.ownerDocument.body );\n\tconst index = focusables.indexOf( element );\n\n\t// Remove all focusables after and including `element`.\n\tfocusables.length = index;\n\n\treturn last( filterTabbable( focusables ) );\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 */\nexport function findNext( element ) {\n\tconst focusables = findFocusable( element.ownerDocument.body );\n\tconst index = focusables.indexOf( element );\n\n\t// Remove all focusables before and including `element`.\n\tconst remaining = focusables.slice( index + 1 );\n\n\treturn first( filterTabbable( remaining ) );\n}\n"]}
|
@@ -4,11 +4,19 @@
|
|
4
4
|
*
|
5
5
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint
|
6
6
|
*
|
7
|
-
* @param {
|
8
|
-
* @param {number}
|
9
|
-
* @param {number}
|
7
|
+
* @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.
|
8
|
+
* @param {number} x Horizontal position within the current viewport.
|
9
|
+
* @param {number} y Vertical position within the current viewport.
|
10
10
|
*
|
11
11
|
* @return {Range | null} The best range for the given point.
|
12
12
|
*/
|
13
|
-
export default function caretRangeFromPoint(doc:
|
13
|
+
export default function caretRangeFromPoint(doc: DocumentMaybeWithCaretPositionFromPoint, x: number, y: number): Range | null;
|
14
|
+
export type DocumentMaybeWithCaretPositionFromPoint = {
|
15
|
+
caretPositionFromPoint?: ((x: number, y: number) => CaretPosition | null) | undefined;
|
16
|
+
} & Document;
|
17
|
+
export type CaretPosition = {
|
18
|
+
readonly offset: number;
|
19
|
+
readonly offsetNode: Node;
|
20
|
+
getClientRect(): DOMRect | null;
|
21
|
+
};
|
14
22
|
//# sourceMappingURL=caret-range-from-point.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/caret-range-from-point.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iDANW,
|
1
|
+
{"version":3,"file":"caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/caret-range-from-point.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iDANW,uCAAuC,KACvC,MAAM,KACN,MAAM,GAEL,KAAK,GAAG,IAAI,CAyBvB;;kCAG0C,MAAM,KAAK,MAAM,KAAI,aAAa,GAAG,IAAI;;4BACvE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAAC,aAAa,IAAI,OAAO,GAAG,IAAI,CAAC;CAAE"}
|
@@ -30,9 +30,9 @@ export type SchemaItem = {
|
|
30
30
|
/**
|
31
31
|
* Child schemas.
|
32
32
|
*/
|
33
|
-
children?: {
|
33
|
+
children?: "*" | {
|
34
34
|
[tag: string]: SchemaItem;
|
35
|
-
} |
|
35
|
+
} | undefined;
|
36
36
|
/**
|
37
37
|
* Selectors to test required children against. Leave empty or undefined if there are no requirements.
|
38
38
|
*/
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* Check whether the current document has selected text. This applies to ranges
|
3
|
-
* of text in the document, and not selection inside
|
3
|
+
* of text in the document, and not selection inside `<input>` and `<textarea>`
|
4
4
|
* elements.
|
5
5
|
*
|
6
6
|
* See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Check whether the current document has any sort of selection. This includes
|
3
|
-
* ranges of text across elements and any selection inside
|
4
|
-
*
|
3
|
+
* ranges of text across elements and any selection inside `<input>` and
|
4
|
+
* `<textarea>` elements.
|
5
5
|
*
|
6
6
|
* @param {Document} doc The document to check.
|
7
7
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-edge.js"],"names":[],"mappings":"AAWA;;;;;;;;;;GAUG;AACH,0CANW,OAAO,aACP,OAAO,uCAGN,OAAO,
|
1
|
+
{"version":3,"file":"is-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-edge.js"],"names":[],"mappings":"AAWA;;;;;;;;;;GAUG;AACH,0CANW,OAAO,aACP,OAAO,uCAGN,OAAO,CA4GlB"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Places the caret at start or end of a given element.
|
3
|
+
*
|
4
|
+
* @param {HTMLElement} container Focusable element.
|
5
|
+
* @param {boolean} isReverse True for end, false for start.
|
6
|
+
* @param {number|undefined} x X coordinate to vertically position.
|
7
|
+
*/
|
8
|
+
export default function placeCaretAtEdge(container: HTMLElement, isReverse: boolean, x: number | undefined): void;
|
9
|
+
//# sourceMappingURL=place-caret-at-edge.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"place-caret-at-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-edge.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AACH,oDAJW,WAAW,aACX,OAAO,KACP,MAAM,GAAC,SAAS,QA0D1B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"place-caret-at-horizontal-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-horizontal-edge.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"place-caret-at-horizontal-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-horizontal-edge.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,8DAHW,WAAW,aACX,OAAO,QAIjB"}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
/**
|
2
2
|
* Places the caret at the top or bottom of a given element.
|
3
3
|
*
|
4
|
-
* @param {HTMLElement} container
|
5
|
-
* @param {boolean} isReverse
|
6
|
-
* @param {DOMRect} [rect]
|
7
|
-
* @param {boolean} [mayUseScroll=true] True to allow scrolling, false to disallow.
|
4
|
+
* @param {HTMLElement} container Focusable element.
|
5
|
+
* @param {boolean} isReverse True for bottom, false for top.
|
6
|
+
* @param {DOMRect} [rect] The rectangle to position the caret with.
|
8
7
|
*/
|
9
|
-
export default function placeCaretAtVerticalEdge(container: HTMLElement, isReverse: boolean, rect?: DOMRect | undefined
|
8
|
+
export default function placeCaretAtVerticalEdge(container: HTMLElement, isReverse: boolean, rect?: DOMRect | undefined): void;
|
10
9
|
//# sourceMappingURL=place-caret-at-vertical-edge.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"place-caret-at-vertical-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-vertical-edge.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"place-caret-at-vertical-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-vertical-edge.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,4DAJW,WAAW,aACX,OAAO,oCAKjB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"strip-html.d.ts","sourceRoot":"","sources":["../../src/dom/strip-html.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"strip-html.d.ts","sourceRoot":"","sources":["../../src/dom/strip-html.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wCAJW,MAAM,GAEL,MAAM,CAUjB"}
|
@@ -1,9 +1,18 @@
|
|
1
1
|
/**
|
2
2
|
* Returns all focusable elements within a given context.
|
3
3
|
*
|
4
|
-
* @param {Element} context
|
4
|
+
* @param {Element} context Element in which to search.
|
5
|
+
* @param {Object} [options]
|
6
|
+
* @param {boolean} [options.sequential] If set, only return elements that are
|
7
|
+
* sequentially focusable.
|
8
|
+
* Non-interactive elements with a
|
9
|
+
* negative `tabindex` are focusable but
|
10
|
+
* not sequentially focusable.
|
11
|
+
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
5
12
|
*
|
6
13
|
* @return {Element[]} Focusable elements.
|
7
14
|
*/
|
8
|
-
export function find(context: Element
|
15
|
+
export function find(context: Element, { sequential }?: {
|
16
|
+
sequential?: boolean | undefined;
|
17
|
+
} | undefined): Element[];
|
9
18
|
//# sourceMappingURL=focusable.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"focusable.d.ts","sourceRoot":"","sources":["../src/focusable.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"focusable.d.ts","sourceRoot":"","sources":["../src/focusable.js"],"names":[],"mappings":"AAqFA;;;;;;;;;;;;;GAaG;AACH,8BAXW,OAAO;;gBASN,OAAO,EAAE,CAsBpB"}
|
@@ -24,9 +24,7 @@ export function isPhrasingContent(node: Node): boolean;
|
|
24
24
|
* @return {boolean} Node is text content
|
25
25
|
*/
|
26
26
|
export function isTextContent(node: Node): boolean;
|
27
|
-
export type ContentSchema =
|
28
|
-
[x: string]: SemanticElementDefinition;
|
29
|
-
};
|
27
|
+
export type ContentSchema = Record<string, SemanticElementDefinition>;
|
30
28
|
export type SemanticElementDefinition = {
|
31
29
|
/**
|
32
30
|
* Content attributes
|
@@ -35,6 +33,6 @@ export type SemanticElementDefinition = {
|
|
35
33
|
/**
|
36
34
|
* Content attributes
|
37
35
|
*/
|
38
|
-
children?:
|
36
|
+
children?: ContentSchema | undefined;
|
39
37
|
};
|
40
38
|
//# sourceMappingURL=phrasing-content.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"phrasing-content.d.ts","sourceRoot":"","sources":["../src/phrasing-content.js"],"names":[],"mappings":"AA0IA;;;;;;;;;GASG;AACH,wEAFY,QAAQ,aAAa,CAAC,CAyBjC;AAED;;;;;;;;GAQG;AACH,wCAJW,IAAI,GAEH,OAAO,CAKlB;AAED;;;GAGG;AACH,oCAHW,IAAI,GACH,OAAO,CAKlB"}
|
1
|
+
{"version":3,"file":"phrasing-content.d.ts","sourceRoot":"","sources":["../src/phrasing-content.js"],"names":[],"mappings":"AA0IA;;;;;;;;;GASG;AACH,wEAFY,QAAQ,aAAa,CAAC,CAyBjC;AAED;;;;;;;;GAQG;AACH,wCAJW,IAAI,GAEH,OAAO,CAKlB;AAED;;;GAGG;AACH,oCAHW,IAAI,GACH,OAAO,CAKlB;4BAtLY,OAAO,MAAM,EAAC,yBAAyB,CAAC"}
|
@@ -26,8 +26,8 @@ export function findPrevious(element: Element): Element | undefined;
|
|
26
26
|
*/
|
27
27
|
export function findNext(element: Element): Element | undefined;
|
28
28
|
export type MaybeHTMLInputElement = Element & {
|
29
|
-
type?: string
|
30
|
-
checked?: boolean
|
31
|
-
name?: string
|
29
|
+
type?: string;
|
30
|
+
checked?: boolean;
|
31
|
+
name?: string;
|
32
32
|
};
|
33
33
|
//# sourceMappingURL=tabbable.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tabbable.d.ts","sourceRoot":"","sources":["../src/tabbable.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,yCAJW,OAAO,GAEN,OAAO,CAIlB;AAiHD;;;GAGG;AACH,8BAHW,OAAO,GACN,OAAO,EAAE,CAIpB;AAED;;;;;GAKG;AACH,sCAHW,OAAO,uBAWjB;AAED;;;;;GAKG;AACH,kCAHW,OAAO,
|
1
|
+
{"version":3,"file":"tabbable.d.ts","sourceRoot":"","sources":["../src/tabbable.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,yCAJW,OAAO,GAEN,OAAO,CAIlB;AAiHD;;;GAGG;AACH,8BAHW,OAAO,GACN,OAAO,EAAE,CAIpB;AAED;;;;;GAKG;AACH,sCAHW,OAAO,uBAWjB;AAED;;;;;GAKG;AACH,kCAHW,OAAO,uBAWjB;oCArJa,OAAO,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/dom",
|
3
|
-
"version": "3.2.
|
3
|
+
"version": "3.2.6",
|
4
4
|
"description": "DOM utilities module for WordPress.",
|
5
5
|
"author": "The WordPress Contributors",
|
6
6
|
"license": "GPL-2.0-or-later",
|
@@ -34,5 +34,5 @@
|
|
34
34
|
"publishConfig": {
|
35
35
|
"access": "public"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "393c2b5533837fd637e998d23f0124c081a10df0"
|
38
38
|
}
|
@@ -4,9 +4,9 @@
|
|
4
4
|
*
|
5
5
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint
|
6
6
|
*
|
7
|
-
* @param {
|
8
|
-
* @param {number}
|
9
|
-
* @param {number}
|
7
|
+
* @param {DocumentMaybeWithCaretPositionFromPoint} doc The document of the range.
|
8
|
+
* @param {number} x Horizontal position within the current viewport.
|
9
|
+
* @param {number} y Vertical position within the current viewport.
|
10
10
|
*
|
11
11
|
* @return {Range | null} The best range for the given point.
|
12
12
|
*/
|
@@ -34,3 +34,8 @@ export default function caretRangeFromPoint( doc, x, y ) {
|
|
34
34
|
|
35
35
|
return range;
|
36
36
|
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint
|
40
|
+
* @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition
|
41
|
+
*/
|
@@ -5,7 +5,7 @@ import { assertIsDefined } from '../utils/assert-is-defined';
|
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Check whether the current document has selected text. This applies to ranges
|
8
|
-
* of text in the document, and not selection inside
|
8
|
+
* of text in the document, and not selection inside `<input>` and `<textarea>`
|
9
9
|
* elements.
|
10
10
|
*
|
11
11
|
* See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
|
@@ -6,8 +6,8 @@ import inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-sel
|
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Check whether the current document has any sort of selection. This includes
|
9
|
-
* ranges of text across elements and any selection inside
|
10
|
-
*
|
9
|
+
* ranges of text across elements and any selection inside `<input>` and
|
10
|
+
* `<textarea>` elements.
|
11
11
|
*
|
12
12
|
* @param {Document} doc The document to check.
|
13
13
|
*
|
package/src/dom/is-edge.js
CHANGED
@@ -21,7 +21,10 @@ import isInputOrTextArea from './is-input-or-text-area';
|
|
21
21
|
* @return {boolean} True if at the edge, false if not.
|
22
22
|
*/
|
23
23
|
export default function isEdge( container, isReverse, onlyVertical = false ) {
|
24
|
-
if (
|
24
|
+
if (
|
25
|
+
isInputOrTextArea( container ) &&
|
26
|
+
typeof container.selectionStart === 'number'
|
27
|
+
) {
|
25
28
|
if ( container.selectionStart !== container.selectionEnd ) {
|
26
29
|
return false;
|
27
30
|
}
|