changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
21:48c4eec2b7e6 | 22:8c2e4d02f4ef |
---|---|
68 isFormElement: () => (/* reexport */ isFormElement), |
68 isFormElement: () => (/* reexport */ isFormElement), |
69 isHorizontalEdge: () => (/* reexport */ isHorizontalEdge), |
69 isHorizontalEdge: () => (/* reexport */ isHorizontalEdge), |
70 isNumberInput: () => (/* reexport */ isNumberInput), |
70 isNumberInput: () => (/* reexport */ isNumberInput), |
71 isPhrasingContent: () => (/* reexport */ isPhrasingContent), |
71 isPhrasingContent: () => (/* reexport */ isPhrasingContent), |
72 isRTL: () => (/* reexport */ isRTL), |
72 isRTL: () => (/* reexport */ isRTL), |
73 isSelectionForward: () => (/* reexport */ isSelectionForward), |
|
73 isTextContent: () => (/* reexport */ isTextContent), |
74 isTextContent: () => (/* reexport */ isTextContent), |
74 isTextField: () => (/* reexport */ isTextField), |
75 isTextField: () => (/* reexport */ isTextField), |
75 isVerticalEdge: () => (/* reexport */ isVerticalEdge), |
76 isVerticalEdge: () => (/* reexport */ isVerticalEdge), |
76 placeCaretAtHorizontalEdge: () => (/* reexport */ placeCaretAtHorizontalEdge), |
77 placeCaretAtHorizontalEdge: () => (/* reexport */ placeCaretAtHorizontalEdge), |
77 placeCaretAtVerticalEdge: () => (/* reexport */ placeCaretAtVerticalEdge), |
78 placeCaretAtVerticalEdge: () => (/* reexport */ placeCaretAtVerticalEdge), |
99 findNext: () => (findNext), |
100 findNext: () => (findNext), |
100 findPrevious: () => (findPrevious), |
101 findPrevious: () => (findPrevious), |
101 isTabbableIndex: () => (isTabbableIndex) |
102 isTabbableIndex: () => (isTabbableIndex) |
102 }); |
103 }); |
103 |
104 |
104 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/focusable.js |
105 ;// ./node_modules/@wordpress/dom/build-module/focusable.js |
105 /** |
106 /** |
106 * References: |
107 * References: |
107 * |
108 * |
108 * Focusable: |
109 * Focusable: |
109 * - https://www.w3.org/TR/html5/editing.html#focus-management |
110 * - https://www.w3.org/TR/html5/editing.html#focus-management |
131 * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute |
132 * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute |
132 * |
133 * |
133 * @return {string} CSS selector. |
134 * @return {string} CSS selector. |
134 */ |
135 */ |
135 function buildSelector(sequential) { |
136 function buildSelector(sequential) { |
136 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(','); |
137 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', 'summary', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(','); |
137 } |
138 } |
138 |
139 |
139 /** |
140 /** |
140 * Returns true if the specified element is visible (i.e. neither display: none |
141 * Returns true if the specified element is visible (i.e. neither display: none |
141 * nor visibility: hidden). |
142 * nor visibility: hidden). |
194 } |
195 } |
195 const { |
196 const { |
196 nodeName |
197 nodeName |
197 } = element; |
198 } = element; |
198 if ('AREA' === nodeName) { |
199 if ('AREA' === nodeName) { |
199 return isValidFocusableArea( /** @type {HTMLAreaElement} */element); |
200 return isValidFocusableArea(/** @type {HTMLAreaElement} */element); |
200 } |
201 } |
201 return true; |
202 return true; |
202 }); |
203 }); |
203 } |
204 } |
204 |
205 |
205 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/tabbable.js |
206 ;// ./node_modules/@wordpress/dom/build-module/tabbable.js |
206 /** |
207 /** |
207 * Internal dependencies |
208 * Internal dependencies |
208 */ |
209 */ |
209 |
210 |
210 |
211 |
247 * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer. |
248 * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer. |
248 */ |
249 */ |
249 function createStatefulCollapseRadioGroup() { |
250 function createStatefulCollapseRadioGroup() { |
250 /** @type {Record<string, MaybeHTMLInputElement>} */ |
251 /** @type {Record<string, MaybeHTMLInputElement>} */ |
251 const CHOSEN_RADIO_BY_NAME = {}; |
252 const CHOSEN_RADIO_BY_NAME = {}; |
252 return function collapseRadioGroup( /** @type {MaybeHTMLInputElement[]} */result, /** @type {MaybeHTMLInputElement} */element) { |
253 return function collapseRadioGroup(/** @type {MaybeHTMLInputElement[]} */result, /** @type {MaybeHTMLInputElement} */element) { |
253 const { |
254 const { |
254 nodeName, |
255 nodeName, |
255 type, |
256 type, |
256 checked, |
257 checked, |
257 name |
258 name |
375 return filterTabbable(find(element.ownerDocument.body)).find(focusable => |
376 return filterTabbable(find(element.ownerDocument.body)).find(focusable => |
376 // eslint-disable-next-line no-bitwise |
377 // eslint-disable-next-line no-bitwise |
377 element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING); |
378 element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING); |
378 } |
379 } |
379 |
380 |
380 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js |
381 ;// ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js |
381 function assertIsDefined(val, name) { |
382 function assertIsDefined(val, name) { |
382 if (false) {} |
383 if (false) {} |
383 } |
384 } |
384 |
385 |
385 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js |
386 ;// ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js |
386 /** |
387 /** |
387 * Internal dependencies |
388 * Internal dependencies |
388 */ |
389 */ |
389 |
390 |
390 |
391 |
491 padNode.parentNode.removeChild(padNode); |
492 padNode.parentNode.removeChild(padNode); |
492 } |
493 } |
493 return rect; |
494 return rect; |
494 } |
495 } |
495 |
496 |
496 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js |
497 ;// ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js |
497 /** |
498 /** |
498 * Internal dependencies |
499 * Internal dependencies |
499 */ |
500 */ |
500 |
501 |
501 |
502 |
515 return null; |
516 return null; |
516 } |
517 } |
517 return getRectangleFromRange(range); |
518 return getRectangleFromRange(range); |
518 } |
519 } |
519 |
520 |
520 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js |
521 ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js |
521 /** |
522 /** |
522 * Internal dependencies |
523 * Internal dependencies |
523 */ |
524 */ |
524 |
525 |
525 |
526 |
540 assertIsDefined(selection, 'selection'); |
541 assertIsDefined(selection, 'selection'); |
541 const range = selection.rangeCount ? selection.getRangeAt(0) : null; |
542 const range = selection.rangeCount ? selection.getRangeAt(0) : null; |
542 return !!range && !range.collapsed; |
543 return !!range && !range.collapsed; |
543 } |
544 } |
544 |
545 |
545 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-html-input-element.js |
546 ;// ./node_modules/@wordpress/dom/build-module/dom/is-html-input-element.js |
546 /* eslint-disable jsdoc/valid-types */ |
547 /* eslint-disable jsdoc/valid-types */ |
547 /** |
548 /** |
548 * @param {Node} node |
549 * @param {Node} node |
549 * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement. |
550 * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement. |
550 */ |
551 */ |
551 function isHTMLInputElement(node) { |
552 function isHTMLInputElement(node) { |
552 /* eslint-enable jsdoc/valid-types */ |
553 /* eslint-enable jsdoc/valid-types */ |
553 return node?.nodeName === 'INPUT'; |
554 return node?.nodeName === 'INPUT'; |
554 } |
555 } |
555 |
556 |
556 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-text-field.js |
557 ;// ./node_modules/@wordpress/dom/build-module/dom/is-text-field.js |
557 /** |
558 /** |
558 * Internal dependencies |
559 * Internal dependencies |
559 */ |
560 */ |
560 |
561 |
561 |
562 |
573 /* eslint-enable jsdoc/valid-types */ |
574 /* eslint-enable jsdoc/valid-types */ |
574 const nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number', 'email', 'time']; |
575 const nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number', 'email', 'time']; |
575 return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === 'TEXTAREA' || /** @type {HTMLElement} */node.contentEditable === 'true'; |
576 return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === 'TEXTAREA' || /** @type {HTMLElement} */node.contentEditable === 'true'; |
576 } |
577 } |
577 |
578 |
578 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/input-field-has-uncollapsed-selection.js |
579 ;// ./node_modules/@wordpress/dom/build-module/dom/input-field-has-uncollapsed-selection.js |
579 /** |
580 /** |
580 * Internal dependencies |
581 * Internal dependencies |
581 */ |
582 */ |
582 |
583 |
583 |
584 |
625 // selection, so we default to true. |
626 // selection, so we default to true. |
626 return true; |
627 return true; |
627 } |
628 } |
628 } |
629 } |
629 |
630 |
630 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-uncollapsed-selection.js |
631 ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-uncollapsed-selection.js |
631 /** |
632 /** |
632 * Internal dependencies |
633 * Internal dependencies |
633 */ |
634 */ |
634 |
635 |
635 |
636 |
645 */ |
646 */ |
646 function documentHasUncollapsedSelection(doc) { |
647 function documentHasUncollapsedSelection(doc) { |
647 return documentHasTextSelection(doc) || !!doc.activeElement && inputFieldHasUncollapsedSelection(doc.activeElement); |
648 return documentHasTextSelection(doc) || !!doc.activeElement && inputFieldHasUncollapsedSelection(doc.activeElement); |
648 } |
649 } |
649 |
650 |
650 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-selection.js |
651 ;// ./node_modules/@wordpress/dom/build-module/dom/document-has-selection.js |
651 /** |
652 /** |
652 * Internal dependencies |
653 * Internal dependencies |
653 */ |
654 */ |
654 |
655 |
655 |
656 |
665 */ |
666 */ |
666 function documentHasSelection(doc) { |
667 function documentHasSelection(doc) { |
667 return !!doc.activeElement && (isHTMLInputElement(doc.activeElement) || isTextField(doc.activeElement) || documentHasTextSelection(doc)); |
668 return !!doc.activeElement && (isHTMLInputElement(doc.activeElement) || isTextField(doc.activeElement) || documentHasTextSelection(doc)); |
668 } |
669 } |
669 |
670 |
670 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-computed-style.js |
671 ;// ./node_modules/@wordpress/dom/build-module/dom/get-computed-style.js |
671 /** |
672 /** |
672 * Internal dependencies |
673 * Internal dependencies |
673 */ |
674 */ |
674 |
675 |
675 |
676 |
682 /* eslint-enable jsdoc/valid-types */ |
683 /* eslint-enable jsdoc/valid-types */ |
683 assertIsDefined(element.ownerDocument.defaultView, 'element.ownerDocument.defaultView'); |
684 assertIsDefined(element.ownerDocument.defaultView, 'element.ownerDocument.defaultView'); |
684 return element.ownerDocument.defaultView.getComputedStyle(element); |
685 return element.ownerDocument.defaultView.getComputedStyle(element); |
685 } |
686 } |
686 |
687 |
687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-scroll-container.js |
688 ;// ./node_modules/@wordpress/dom/build-module/dom/get-scroll-container.js |
688 /** |
689 /** |
689 * Internal dependencies |
690 * Internal dependencies |
690 */ |
691 */ |
691 |
692 |
692 |
693 |
730 if (node.ownerDocument === node.parentNode) { |
731 if (node.ownerDocument === node.parentNode) { |
731 return node; |
732 return node; |
732 } |
733 } |
733 |
734 |
734 // Continue traversing. |
735 // Continue traversing. |
735 return getScrollContainer( /** @type {Element} */node.parentNode, direction); |
736 return getScrollContainer(/** @type {Element} */node.parentNode, direction); |
736 } |
737 } |
737 |
738 |
738 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-offset-parent.js |
739 ;// ./node_modules/@wordpress/dom/build-module/dom/get-offset-parent.js |
739 /** |
740 /** |
740 * Internal dependencies |
741 * Internal dependencies |
741 */ |
742 */ |
742 |
743 |
743 |
744 |
765 return null; |
766 return null; |
766 } |
767 } |
767 |
768 |
768 // If the closest element is already positioned, return it, as offsetParent |
769 // If the closest element is already positioned, return it, as offsetParent |
769 // does not otherwise consider the node itself. |
770 // does not otherwise consider the node itself. |
770 if (getComputedStyle( /** @type {Element} */closestElement).position !== 'static') { |
771 if (getComputedStyle(/** @type {Element} */closestElement).position !== 'static') { |
771 return closestElement; |
772 return closestElement; |
772 } |
773 } |
773 |
774 |
774 // offsetParent is undocumented/draft. |
775 // offsetParent is undocumented/draft. |
775 return /** @type {Node & { offsetParent: Node }} */closestElement.offsetParent; |
776 return /** @type {Node & { offsetParent: Node }} */closestElement.offsetParent; |
776 } |
777 } |
777 |
778 |
778 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-input-or-text-area.js |
779 ;// ./node_modules/@wordpress/dom/build-module/dom/is-input-or-text-area.js |
779 /* eslint-disable jsdoc/valid-types */ |
780 /* eslint-disable jsdoc/valid-types */ |
780 /** |
781 /** |
781 * @param {Element} element |
782 * @param {Element} element |
782 * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea |
783 * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea |
783 */ |
784 */ |
784 function isInputOrTextArea(element) { |
785 function isInputOrTextArea(element) { |
785 /* eslint-enable jsdoc/valid-types */ |
786 /* eslint-enable jsdoc/valid-types */ |
786 return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA'; |
787 return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA'; |
787 } |
788 } |
788 |
789 |
789 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-entirely-selected.js |
790 ;// ./node_modules/@wordpress/dom/build-module/dom/is-entirely-selected.js |
790 /** |
791 /** |
791 * Internal dependencies |
792 * Internal dependencies |
792 */ |
793 */ |
793 |
794 |
794 |
795 |
856 candidate = candidate[propName]; |
857 candidate = candidate[propName]; |
857 } while (candidate); |
858 } while (candidate); |
858 return false; |
859 return false; |
859 } |
860 } |
860 |
861 |
861 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-form-element.js |
862 ;// ./node_modules/@wordpress/dom/build-module/dom/is-form-element.js |
862 /** |
863 /** |
863 * Internal dependencies |
864 * Internal dependencies |
864 */ |
865 */ |
865 |
866 |
866 |
867 |
881 } = element; |
882 } = element; |
882 const checkForInputTextarea = isInputOrTextArea(element); |
883 const checkForInputTextarea = isInputOrTextArea(element); |
883 return checkForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'; |
884 return checkForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'; |
884 } |
885 } |
885 |
886 |
886 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-rtl.js |
887 ;// ./node_modules/@wordpress/dom/build-module/dom/is-rtl.js |
887 /** |
888 /** |
888 * Internal dependencies |
889 * Internal dependencies |
889 */ |
890 */ |
890 |
891 |
891 |
892 |
898 */ |
899 */ |
899 function isRTL(element) { |
900 function isRTL(element) { |
900 return getComputedStyle(element).direction === 'rtl'; |
901 return getComputedStyle(element).direction === 'rtl'; |
901 } |
902 } |
902 |
903 |
903 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-range-height.js |
904 ;// ./node_modules/@wordpress/dom/build-module/dom/get-range-height.js |
904 /** |
905 /** |
905 * Gets the height of the range without ignoring zero width rectangles, which |
906 * Gets the height of the range without ignoring zero width rectangles, which |
906 * some browsers ignore when creating a union. |
907 * some browsers ignore when creating a union. |
907 * |
908 * |
908 * @param {Range} range The range to check. |
909 * @param {Range} range The range to check. |
920 bottom |
921 bottom |
921 }) => bottom)); |
922 }) => bottom)); |
922 return lowestBottom - highestTop; |
923 return lowestBottom - highestTop; |
923 } |
924 } |
924 |
925 |
925 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-selection-forward.js |
926 ;// ./node_modules/@wordpress/dom/build-module/dom/is-selection-forward.js |
926 /** |
927 /** |
927 * Internal dependencies |
928 * Internal dependencies |
928 */ |
929 */ |
929 |
930 |
930 |
931 |
970 |
971 |
971 // This should never be reached, but return true as default case. |
972 // This should never be reached, but return true as default case. |
972 return true; |
973 return true; |
973 } |
974 } |
974 |
975 |
975 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/caret-range-from-point.js |
976 ;// ./node_modules/@wordpress/dom/build-module/dom/caret-range-from-point.js |
976 /** |
977 /** |
977 * Polyfill. |
978 * Polyfill. |
978 * Get a collapsed range for a given point. |
979 * Get a collapsed range for a given point. |
979 * |
980 * |
980 * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint |
981 * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint |
1008 /** |
1009 /** |
1009 * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint |
1010 * @typedef {{caretPositionFromPoint?: (x: number, y: number)=> CaretPosition | null} & Document } DocumentMaybeWithCaretPositionFromPoint |
1010 * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition |
1011 * @typedef {{ readonly offset: number; readonly offsetNode: Node; getClientRect(): DOMRect | null; }} CaretPosition |
1011 */ |
1012 */ |
1012 |
1013 |
1013 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/hidden-caret-range-from-point.js |
1014 ;// ./node_modules/@wordpress/dom/build-module/dom/hidden-caret-range-from-point.js |
1014 /** |
1015 /** |
1015 * Internal dependencies |
1016 * Internal dependencies |
1016 */ |
1017 */ |
1017 |
1018 |
1018 |
1019 |
1045 container.style.zIndex = originalZIndex; |
1046 container.style.zIndex = originalZIndex; |
1046 container.style.position = originalPosition; |
1047 container.style.position = originalPosition; |
1047 return range; |
1048 return range; |
1048 } |
1049 } |
1049 |
1050 |
1050 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/scroll-if-no-range.js |
1051 ;// ./node_modules/@wordpress/dom/build-module/dom/scroll-if-no-range.js |
1051 /** |
1052 /** |
1052 * If no range range can be created or it is outside the container, the element |
1053 * If no range range can be created or it is outside the container, the element |
1053 * may be out of view, so scroll it into view and try again. |
1054 * may be out of view, so scroll it into view and try again. |
1054 * |
1055 * |
1055 * @param {HTMLElement} container The container to scroll. |
1056 * @param {HTMLElement} container The container to scroll. |
1071 } |
1072 } |
1072 } |
1073 } |
1073 return range; |
1074 return range; |
1074 } |
1075 } |
1075 |
1076 |
1076 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-edge.js |
1077 ;// ./node_modules/@wordpress/dom/build-module/dom/is-edge.js |
1077 /** |
1078 /** |
1078 * Internal dependencies |
1079 * Internal dependencies |
1079 */ |
1080 */ |
1080 |
1081 |
1081 |
1082 |
1177 const hasVerticalDiff = Math.abs(verticalDiff) <= 1; |
1178 const hasVerticalDiff = Math.abs(verticalDiff) <= 1; |
1178 const hasHorizontalDiff = Math.abs(horizontalDiff) <= 1; |
1179 const hasHorizontalDiff = Math.abs(horizontalDiff) <= 1; |
1179 return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff; |
1180 return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff; |
1180 } |
1181 } |
1181 |
1182 |
1182 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-horizontal-edge.js |
1183 ;// ./node_modules/@wordpress/dom/build-module/dom/is-horizontal-edge.js |
1183 /** |
1184 /** |
1184 * Internal dependencies |
1185 * Internal dependencies |
1185 */ |
1186 */ |
1186 |
1187 |
1187 |
1188 |
1195 */ |
1196 */ |
1196 function isHorizontalEdge(container, isReverse) { |
1197 function isHorizontalEdge(container, isReverse) { |
1197 return isEdge(container, isReverse); |
1198 return isEdge(container, isReverse); |
1198 } |
1199 } |
1199 |
1200 |
1200 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
1201 ;// external ["wp","deprecated"] |
1201 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
1202 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
1202 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
1203 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
1203 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-number-input.js |
1204 ;// ./node_modules/@wordpress/dom/build-module/dom/is-number-input.js |
1204 /** |
1205 /** |
1205 * WordPress dependencies |
1206 * WordPress dependencies |
1206 */ |
1207 */ |
1207 |
1208 |
1208 |
1209 |
1226 }); |
1227 }); |
1227 /* eslint-enable jsdoc/valid-types */ |
1228 /* eslint-enable jsdoc/valid-types */ |
1228 return isHTMLInputElement(node) && node.type === 'number' && !isNaN(node.valueAsNumber); |
1229 return isHTMLInputElement(node) && node.type === 'number' && !isNaN(node.valueAsNumber); |
1229 } |
1230 } |
1230 |
1231 |
1231 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-vertical-edge.js |
1232 ;// ./node_modules/@wordpress/dom/build-module/dom/is-vertical-edge.js |
1232 /** |
1233 /** |
1233 * Internal dependencies |
1234 * Internal dependencies |
1234 */ |
1235 */ |
1235 |
1236 |
1236 |
1237 |
1244 */ |
1245 */ |
1245 function isVerticalEdge(container, isReverse) { |
1246 function isVerticalEdge(container, isReverse) { |
1246 return isEdge(container, isReverse, true); |
1247 return isEdge(container, isReverse, true); |
1247 } |
1248 } |
1248 |
1249 |
1249 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-edge.js |
1250 ;// ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-edge.js |
1250 /** |
1251 /** |
1251 * Internal dependencies |
1252 * Internal dependencies |
1252 */ |
1253 */ |
1253 |
1254 |
1254 |
1255 |
1331 assertIsDefined(selection, 'selection'); |
1332 assertIsDefined(selection, 'selection'); |
1332 selection.removeAllRanges(); |
1333 selection.removeAllRanges(); |
1333 selection.addRange(range); |
1334 selection.addRange(range); |
1334 } |
1335 } |
1335 |
1336 |
1336 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-horizontal-edge.js |
1337 ;// ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-horizontal-edge.js |
1337 /** |
1338 /** |
1338 * Internal dependencies |
1339 * Internal dependencies |
1339 */ |
1340 */ |
1340 |
1341 |
1341 |
1342 |
1347 */ |
1348 */ |
1348 function placeCaretAtHorizontalEdge(container, isReverse) { |
1349 function placeCaretAtHorizontalEdge(container, isReverse) { |
1349 return placeCaretAtEdge(container, isReverse, undefined); |
1350 return placeCaretAtEdge(container, isReverse, undefined); |
1350 } |
1351 } |
1351 |
1352 |
1352 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-vertical-edge.js |
1353 ;// ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-vertical-edge.js |
1353 /** |
1354 /** |
1354 * Internal dependencies |
1355 * Internal dependencies |
1355 */ |
1356 */ |
1356 |
1357 |
1357 |
1358 |
1364 */ |
1365 */ |
1365 function placeCaretAtVerticalEdge(container, isReverse, rect) { |
1366 function placeCaretAtVerticalEdge(container, isReverse, rect) { |
1366 return placeCaretAtEdge(container, isReverse, rect?.left); |
1367 return placeCaretAtEdge(container, isReverse, rect?.left); |
1367 } |
1368 } |
1368 |
1369 |
1369 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/insert-after.js |
1370 ;// ./node_modules/@wordpress/dom/build-module/dom/insert-after.js |
1370 /** |
1371 /** |
1371 * Internal dependencies |
1372 * Internal dependencies |
1372 */ |
1373 */ |
1373 |
1374 |
1374 |
1375 |
1383 function insertAfter(newNode, referenceNode) { |
1384 function insertAfter(newNode, referenceNode) { |
1384 assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode'); |
1385 assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode'); |
1385 referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); |
1386 referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); |
1386 } |
1387 } |
1387 |
1388 |
1388 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/remove.js |
1389 ;// ./node_modules/@wordpress/dom/build-module/dom/remove.js |
1389 /** |
1390 /** |
1390 * Internal dependencies |
1391 * Internal dependencies |
1391 */ |
1392 */ |
1392 |
1393 |
1393 |
1394 |
1400 function remove(node) { |
1401 function remove(node) { |
1401 assertIsDefined(node.parentNode, 'node.parentNode'); |
1402 assertIsDefined(node.parentNode, 'node.parentNode'); |
1402 node.parentNode.removeChild(node); |
1403 node.parentNode.removeChild(node); |
1403 } |
1404 } |
1404 |
1405 |
1405 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/replace.js |
1406 ;// ./node_modules/@wordpress/dom/build-module/dom/replace.js |
1406 /** |
1407 /** |
1407 * Internal dependencies |
1408 * Internal dependencies |
1408 */ |
1409 */ |
1409 |
1410 |
1410 |
1411 |
1421 assertIsDefined(processedNode.parentNode, 'processedNode.parentNode'); |
1422 assertIsDefined(processedNode.parentNode, 'processedNode.parentNode'); |
1422 insertAfter(newNode, processedNode.parentNode); |
1423 insertAfter(newNode, processedNode.parentNode); |
1423 remove(processedNode); |
1424 remove(processedNode); |
1424 } |
1425 } |
1425 |
1426 |
1426 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/unwrap.js |
1427 ;// ./node_modules/@wordpress/dom/build-module/dom/unwrap.js |
1427 /** |
1428 /** |
1428 * Internal dependencies |
1429 * Internal dependencies |
1429 */ |
1430 */ |
1430 |
1431 |
1431 |
1432 |
1443 parent.insertBefore(node.firstChild, node); |
1444 parent.insertBefore(node.firstChild, node); |
1444 } |
1445 } |
1445 parent.removeChild(node); |
1446 parent.removeChild(node); |
1446 } |
1447 } |
1447 |
1448 |
1448 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/replace-tag.js |
1449 ;// ./node_modules/@wordpress/dom/build-module/dom/replace-tag.js |
1449 /** |
1450 /** |
1450 * Internal dependencies |
1451 * Internal dependencies |
1451 */ |
1452 */ |
1452 |
1453 |
1453 |
1454 |
1467 assertIsDefined(node.parentNode, 'node.parentNode'); |
1468 assertIsDefined(node.parentNode, 'node.parentNode'); |
1468 node.parentNode.replaceChild(newNode, node); |
1469 node.parentNode.replaceChild(newNode, node); |
1469 return newNode; |
1470 return newNode; |
1470 } |
1471 } |
1471 |
1472 |
1472 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/wrap.js |
1473 ;// ./node_modules/@wordpress/dom/build-module/dom/wrap.js |
1473 /** |
1474 /** |
1474 * Internal dependencies |
1475 * Internal dependencies |
1475 */ |
1476 */ |
1476 |
1477 |
1477 |
1478 |
1485 assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode'); |
1486 assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode'); |
1486 referenceNode.parentNode.insertBefore(newNode, referenceNode); |
1487 referenceNode.parentNode.insertBefore(newNode, referenceNode); |
1487 newNode.appendChild(referenceNode); |
1488 newNode.appendChild(referenceNode); |
1488 } |
1489 } |
1489 |
1490 |
1490 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/safe-html.js |
1491 ;// ./node_modules/@wordpress/dom/build-module/dom/safe-html.js |
1491 /** |
1492 /** |
1492 * Internal dependencies |
1493 * Internal dependencies |
1493 */ |
1494 */ |
1494 |
1495 |
1495 |
1496 |
1524 } |
1525 } |
1525 } |
1526 } |
1526 return body.innerHTML; |
1527 return body.innerHTML; |
1527 } |
1528 } |
1528 |
1529 |
1529 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/strip-html.js |
1530 ;// ./node_modules/@wordpress/dom/build-module/dom/strip-html.js |
1530 /** |
1531 /** |
1531 * Internal dependencies |
1532 * Internal dependencies |
1532 */ |
1533 */ |
1533 |
1534 |
1534 |
1535 |
1546 const doc = document.implementation.createHTMLDocument(''); |
1547 const doc = document.implementation.createHTMLDocument(''); |
1547 doc.body.innerHTML = html; |
1548 doc.body.innerHTML = html; |
1548 return doc.body.textContent || ''; |
1549 return doc.body.textContent || ''; |
1549 } |
1550 } |
1550 |
1551 |
1551 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-empty.js |
1552 ;// ./node_modules/@wordpress/dom/build-module/dom/is-empty.js |
1552 /** |
1553 /** |
1553 * Recursively checks if an element is empty. An element is not empty if it |
1554 * Recursively checks if an element is empty. An element is not empty if it |
1554 * contains text or contains elements with attributes such as images. |
1555 * contains text or contains elements with attributes such as images. |
1555 * |
1556 * |
1556 * @param {Element} element The element to check. |
1557 * @param {Element} element The element to check. |
1573 default: |
1574 default: |
1574 return true; |
1575 return true; |
1575 } |
1576 } |
1576 } |
1577 } |
1577 |
1578 |
1578 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/phrasing-content.js |
1579 ;// ./node_modules/@wordpress/dom/build-module/phrasing-content.js |
1579 /** |
1580 /** |
1580 * All phrasing content elements. |
1581 * All phrasing content elements. |
1581 * |
1582 * |
1582 * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 |
1583 * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 |
1583 */ |
1584 */ |
1769 function isTextContent(node) { |
1770 function isTextContent(node) { |
1770 const tag = node.nodeName.toLowerCase(); |
1771 const tag = node.nodeName.toLowerCase(); |
1771 return textContentSchema.hasOwnProperty(tag) || tag === 'span'; |
1772 return textContentSchema.hasOwnProperty(tag) || tag === 'span'; |
1772 } |
1773 } |
1773 |
1774 |
1774 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-element.js |
1775 ;// ./node_modules/@wordpress/dom/build-module/dom/is-element.js |
1775 /* eslint-disable jsdoc/valid-types */ |
1776 /* eslint-disable jsdoc/valid-types */ |
1776 /** |
1777 /** |
1777 * @param {Node | null | undefined} node |
1778 * @param {Node | null | undefined} node |
1778 * @return {node is Element} True if node is an Element node |
1779 * @return {node is Element} True if node is an Element node |
1779 */ |
1780 */ |
1780 function isElement(node) { |
1781 function isElement(node) { |
1781 /* eslint-enable jsdoc/valid-types */ |
1782 /* eslint-enable jsdoc/valid-types */ |
1782 return !!node && node.nodeType === node.ELEMENT_NODE; |
1783 return !!node && node.nodeType === node.ELEMENT_NODE; |
1783 } |
1784 } |
1784 |
1785 |
1785 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/clean-node-list.js |
1786 ;// ./node_modules/@wordpress/dom/build-module/dom/clean-node-list.js |
1786 /** |
1787 /** |
1787 * Internal dependencies |
1788 * Internal dependencies |
1788 */ |
1789 */ |
1789 |
1790 |
1790 |
1791 |
1816 * @param {Document} doc The document of the nodeList. |
1817 * @param {Document} doc The document of the nodeList. |
1817 * @param {Schema} schema An array of functions that can mutate with the provided node. |
1818 * @param {Schema} schema An array of functions that can mutate with the provided node. |
1818 * @param {boolean} inline Whether to clean for inline mode. |
1819 * @param {boolean} inline Whether to clean for inline mode. |
1819 */ |
1820 */ |
1820 function cleanNodeList(nodeList, doc, schema, inline) { |
1821 function cleanNodeList(nodeList, doc, schema, inline) { |
1821 Array.from(nodeList).forEach(( /** @type {Node & { nextElementSibling?: unknown }} */node) => { |
1822 Array.from(nodeList).forEach((/** @type {Node & { nextElementSibling?: unknown }} */node) => { |
1822 const tag = node.nodeName.toLowerCase(); |
1823 const tag = node.nodeName.toLowerCase(); |
1823 |
1824 |
1824 // It's a valid child, if the tag exists in the schema without an isMatch |
1825 // It's a valid child, if the tag exists in the schema without an isMatch |
1825 // function, or with an isMatch function that matches the node. |
1826 // function, or with an isMatch function that matches the node. |
1826 if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || schema[tag].isMatch?.(node))) { |
1827 if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || schema[tag].isMatch?.(node))) { |
1852 // Strip invalid classes. |
1853 // Strip invalid classes. |
1853 // In jsdom-jscore, 'node.classList' can be undefined. |
1854 // In jsdom-jscore, 'node.classList' can be undefined. |
1854 // TODO: Explore patching this in jsdom-jscore. |
1855 // TODO: Explore patching this in jsdom-jscore. |
1855 if (node.classList && node.classList.length) { |
1856 if (node.classList && node.classList.length) { |
1856 const mattchers = classes.map(item => { |
1857 const mattchers = classes.map(item => { |
1857 if (typeof item === 'string') { |
1858 if (item === '*') { |
1858 return ( /** @type {string} */className) => className === item; |
1859 // Keep all classes. |
1860 return () => true; |
|
1861 } else if (typeof item === 'string') { |
|
1862 return (/** @type {string} */className) => className === item; |
|
1859 } else if (item instanceof RegExp) { |
1863 } else if (item instanceof RegExp) { |
1860 return ( /** @type {string} */className) => item.test(className); |
1864 return (/** @type {string} */className) => item.test(className); |
1861 } |
1865 } |
1862 return noop; |
1866 return noop; |
1863 }); |
1867 }); |
1864 Array.from(node.classList).forEach(name => { |
1868 Array.from(node.classList).forEach(name => { |
1865 if (!mattchers.some(isMatch => isMatch(name))) { |
1869 if (!mattchers.some(isMatch => isMatch(name))) { |
1915 unwrap(node); |
1919 unwrap(node); |
1916 } |
1920 } |
1917 }); |
1921 }); |
1918 } |
1922 } |
1919 |
1923 |
1920 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/remove-invalid-html.js |
1924 ;// ./node_modules/@wordpress/dom/build-module/dom/remove-invalid-html.js |
1921 /** |
1925 /** |
1922 * Internal dependencies |
1926 * Internal dependencies |
1923 */ |
1927 */ |
1924 |
1928 |
1925 |
1929 |
1937 doc.body.innerHTML = HTML; |
1941 doc.body.innerHTML = HTML; |
1938 cleanNodeList(doc.body.childNodes, doc, schema, inline); |
1942 cleanNodeList(doc.body.childNodes, doc, schema, inline); |
1939 return doc.body.innerHTML; |
1943 return doc.body.innerHTML; |
1940 } |
1944 } |
1941 |
1945 |
1942 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/index.js |
1946 ;// ./node_modules/@wordpress/dom/build-module/dom/index.js |
1943 |
1947 |
1944 |
1948 |
1945 |
1949 |
1946 |
1950 |
1947 |
1951 |
1948 |
1952 |
1949 |
1953 |
1950 |
1954 |
1951 |
1955 |
1952 |
1956 |
1953 |
1957 |
1954 |
1958 |
1955 |
1959 |
1956 |
1960 |
1957 |
1961 |
1958 |
1962 |
1959 |
1963 |
1960 |
1964 |
1961 |
1965 |
1962 |
1966 |
1963 |
1967 |
1964 |
1968 |
1965 |
1969 |
1966 |
1970 |
1967 |
1971 |
1968 |
1972 |
1969 |
1973 |
1970 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/data-transfer.js |
1974 |
1975 ;// ./node_modules/@wordpress/dom/build-module/data-transfer.js |
|
1971 /** |
1976 /** |
1972 * Gets all files from a DataTransfer object. |
1977 * Gets all files from a DataTransfer object. |
1973 * |
1978 * |
1974 * @param {DataTransfer} dataTransfer DataTransfer object to inspect. |
1979 * @param {DataTransfer} dataTransfer DataTransfer object to inspect. |
1975 * |
1980 * |
1988 } |
1993 } |
1989 }); |
1994 }); |
1990 return files; |
1995 return files; |
1991 } |
1996 } |
1992 |
1997 |
1993 ;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/index.js |
1998 ;// ./node_modules/@wordpress/dom/build-module/index.js |
1994 /** |
1999 /** |
1995 * Internal dependencies |
2000 * Internal dependencies |
1996 */ |
2001 */ |
1997 |
2002 |
1998 |
2003 |