@wordpress/dom 4.57.0 → 5.1.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/README.md +23 -23
- package/build/data-transfer.cjs +20 -38
- package/build/data-transfer.cjs.map +1 -7
- package/build/dom/caret-range-from-point.cjs +31 -38
- package/build/dom/caret-range-from-point.cjs.map +1 -7
- package/build/dom/clean-node-list.cjs +88 -133
- package/build/dom/clean-node-list.cjs.map +1 -7
- package/build/dom/compute-caret-rect.cjs +36 -36
- package/build/dom/compute-caret-rect.cjs.map +1 -7
- package/build/dom/document-has-selection.cjs +36 -31
- package/build/dom/document-has-selection.cjs.map +1 -7
- package/build/dom/document-has-text-selection.cjs +24 -30
- package/build/dom/document-has-text-selection.cjs.map +1 -7
- package/build/dom/document-has-uncollapsed-selection.cjs +35 -30
- package/build/dom/document-has-uncollapsed-selection.cjs.map +1 -7
- package/build/dom/get-computed-style.cjs +14 -30
- package/build/dom/get-computed-style.cjs.map +1 -7
- package/build/dom/get-offset-parent.cjs +41 -48
- package/build/dom/get-offset-parent.cjs.map +1 -7
- package/build/dom/get-range-height.cjs +18 -31
- package/build/dom/get-range-height.cjs.map +1 -7
- package/build/dom/get-rectangle-from-range.cjs +82 -133
- package/build/dom/get-rectangle-from-range.cjs.map +1 -7
- package/build/dom/get-scroll-container.cjs +47 -55
- package/build/dom/get-scroll-container.cjs.map +1 -7
- package/build/dom/hidden-caret-range-from-point.cjs +49 -43
- package/build/dom/hidden-caret-range-from-point.cjs.map +1 -7
- package/build/dom/index.cjs +233 -110
- package/build/dom/input-field-has-uncollapsed-selection.cjs +49 -47
- package/build/dom/input-field-has-uncollapsed-selection.cjs.map +1 -7
- package/build/dom/insert-after.cjs +17 -27
- package/build/dom/insert-after.cjs.map +1 -7
- package/build/dom/is-edge.cjs +83 -98
- package/build/dom/is-edge.cjs.map +1 -7
- package/build/dom/is-element.cjs +12 -25
- package/build/dom/is-element.cjs.map +1 -7
- package/build/dom/is-empty.cjs +23 -40
- package/build/dom/is-empty.cjs.map +1 -7
- package/build/dom/is-entirely-selected.cjs +71 -71
- package/build/dom/is-entirely-selected.cjs.map +1 -7
- package/build/dom/is-form-element.cjs +34 -34
- package/build/dom/is-form-element.cjs.map +1 -7
- package/build/dom/is-horizontal-edge.cjs +32 -29
- package/build/dom/is-horizontal-edge.cjs.map +1 -7
- package/build/dom/is-html-input-element.cjs +12 -25
- package/build/dom/is-html-input-element.cjs.map +1 -7
- package/build/dom/is-input-or-text-area.cjs +12 -25
- package/build/dom/is-input-or-text-area.cjs.map +1 -7
- package/build/dom/is-number-input.cjs +37 -34
- package/build/dom/is-number-input.cjs.map +1 -7
- package/build/dom/is-rtl.cjs +31 -29
- package/build/dom/is-rtl.cjs.map +1 -7
- package/build/dom/is-selection-forward.cjs +26 -39
- package/build/dom/is-selection-forward.cjs.map +1 -7
- package/build/dom/is-text-field.cjs +46 -44
- package/build/dom/is-text-field.cjs.map +1 -7
- package/build/dom/is-vertical-edge.cjs +32 -29
- package/build/dom/is-vertical-edge.cjs.map +1 -7
- package/build/dom/place-caret-at-edge.cjs +76 -79
- package/build/dom/place-caret-at-edge.cjs.map +1 -7
- package/build/dom/place-caret-at-horizontal-edge.cjs +30 -29
- package/build/dom/place-caret-at-horizontal-edge.cjs.map +1 -7
- package/build/dom/place-caret-at-vertical-edge.cjs +31 -29
- package/build/dom/place-caret-at-vertical-edge.cjs.map +1 -7
- package/build/dom/remove-invalid-html.cjs +36 -32
- package/build/dom/remove-invalid-html.cjs.map +1 -7
- package/build/dom/remove.cjs +15 -27
- package/build/dom/remove.cjs.map +1 -7
- package/build/dom/replace-tag.cjs +21 -32
- package/build/dom/replace-tag.cjs.map +1 -7
- package/build/dom/replace.cjs +35 -33
- package/build/dom/replace.cjs.map +1 -7
- package/build/dom/safe-html.cjs +46 -47
- package/build/dom/safe-html.cjs.map +1 -7
- package/build/dom/scroll-if-no-range.cjs +24 -37
- package/build/dom/scroll-if-no-range.cjs.map +1 -7
- package/build/dom/strip-html.cjs +34 -32
- package/build/dom/strip-html.cjs.map +1 -7
- package/build/dom/types.cjs +5 -0
- package/build/dom/unwrap.cjs +17 -31
- package/build/dom/unwrap.cjs.map +1 -7
- package/build/dom/wrap.cjs +17 -28
- package/build/dom/wrap.cjs.map +1 -7
- package/build/focusable.cjs +99 -77
- package/build/focusable.cjs.map +1 -7
- package/build/index.cjs +58 -39
- package/build/index.cjs.map +1 -7
- package/build/phrasing-content.cjs +163 -159
- package/build/phrasing-content.cjs.map +1 -7
- package/build/tabbable.cjs +123 -78
- package/build/tabbable.cjs.map +1 -7
- package/build/types.cjs +5 -0
- package/build/utils/assert-is-defined.cjs +8 -33
- package/build/utils/assert-is-defined.cjs.map +1 -7
- package/build-module/data-transfer.mjs +17 -15
- package/build-module/data-transfer.mjs.map +1 -7
- package/build-module/dom/caret-range-from-point.mjs +28 -19
- package/build-module/dom/caret-range-from-point.mjs.map +1 -7
- package/build-module/dom/clean-node-list.mjs +60 -105
- package/build-module/dom/clean-node-list.mjs.map +1 -7
- package/build-module/dom/compute-caret-rect.mjs +16 -12
- package/build-module/dom/compute-caret-rect.mjs.map +1 -7
- package/build-module/dom/document-has-selection.mjs +13 -6
- package/build-module/dom/document-has-selection.mjs.map +1 -7
- package/build-module/dom/document-has-text-selection.mjs +20 -10
- package/build-module/dom/document-has-text-selection.mjs.map +1 -7
- package/build-module/dom/document-has-uncollapsed-selection.mjs +14 -6
- package/build-module/dom/document-has-uncollapsed-selection.mjs.map +1 -7
- package/build-module/dom/get-computed-style.mjs +10 -10
- package/build-module/dom/get-computed-style.mjs.map +1 -7
- package/build-module/dom/get-offset-parent.mjs +21 -25
- package/build-module/dom/get-offset-parent.mjs.map +1 -7
- package/build-module/dom/get-range-height.mjs +15 -12
- package/build-module/dom/get-range-height.mjs.map +1 -7
- package/build-module/dom/get-rectangle-from-range.mjs +78 -113
- package/build-module/dom/get-rectangle-from-range.mjs.map +1 -7
- package/build-module/dom/get-scroll-container.mjs +28 -32
- package/build-module/dom/get-scroll-container.mjs.map +1 -7
- package/build-module/dom/hidden-caret-range-from-point.mjs +28 -19
- package/build-module/dom/hidden-caret-range-from-point.mjs.map +1 -7
- package/build-module/dom/index.mjs +28 -58
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs +28 -23
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +1 -7
- package/build-module/dom/insert-after.mjs +13 -7
- package/build-module/dom/insert-after.mjs.map +1 -7
- package/build-module/dom/is-edge.mjs +53 -69
- package/build-module/dom/is-edge.mjs.map +1 -7
- package/build-module/dom/is-element.mjs +9 -6
- package/build-module/dom/is-element.mjs.map +1 -7
- package/build-module/dom/is-empty.mjs +20 -21
- package/build-module/dom/is-empty.mjs.map +1 -7
- package/build-module/dom/is-entirely-selected.mjs +51 -47
- package/build-module/dom/is-entirely-selected.mjs.map +1 -7
- package/build-module/dom/is-form-element.mjs +15 -11
- package/build-module/dom/is-form-element.mjs.map +1 -7
- package/build-module/dom/is-horizontal-edge.mjs +13 -6
- package/build-module/dom/is-horizontal-edge.mjs.map +1 -7
- package/build-module/dom/is-html-input-element.mjs +9 -6
- package/build-module/dom/is-html-input-element.mjs.map +1 -7
- package/build-module/dom/is-input-or-text-area.mjs +9 -6
- package/build-module/dom/is-input-or-text-area.mjs.map +1 -7
- package/build-module/dom/is-number-input.mjs +16 -10
- package/build-module/dom/is-number-input.mjs.map +1 -7
- package/build-module/dom/is-rtl.mjs +12 -6
- package/build-module/dom/is-rtl.mjs.map +1 -7
- package/build-module/dom/is-selection-forward.mjs +22 -19
- package/build-module/dom/is-selection-forward.mjs.map +1 -7
- package/build-module/dom/is-text-field.mjs +27 -21
- package/build-module/dom/is-text-field.mjs.map +1 -7
- package/build-module/dom/is-vertical-edge.mjs +13 -6
- package/build-module/dom/is-vertical-edge.mjs.map +1 -7
- package/build-module/dom/place-caret-at-edge.mjs +51 -52
- package/build-module/dom/place-caret-at-edge.mjs.map +1 -7
- package/build-module/dom/place-caret-at-horizontal-edge.mjs +11 -6
- package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +1 -7
- package/build-module/dom/place-caret-at-vertical-edge.mjs +12 -6
- package/build-module/dom/place-caret-at-vertical-edge.mjs.map +1 -7
- package/build-module/dom/remove-invalid-html.mjs +17 -9
- package/build-module/dom/remove-invalid-html.mjs.map +1 -7
- package/build-module/dom/remove.mjs +11 -7
- package/build-module/dom/remove.mjs.map +1 -7
- package/build-module/dom/replace-tag.mjs +17 -12
- package/build-module/dom/replace-tag.mjs.map +1 -7
- package/build-module/dom/replace.mjs +13 -8
- package/build-module/dom/replace.mjs.map +1 -7
- package/build-module/dom/safe-html.mjs +27 -24
- package/build-module/dom/safe-html.mjs.map +1 -7
- package/build-module/dom/scroll-if-no-range.mjs +21 -14
- package/build-module/dom/scroll-if-no-range.mjs.map +1 -7
- package/build-module/dom/strip-html.mjs +15 -9
- package/build-module/dom/strip-html.mjs.map +1 -7
- package/build-module/dom/types.mjs +0 -0
- package/build-module/dom/unwrap.mjs +13 -11
- package/build-module/dom/unwrap.mjs.map +1 -7
- package/build-module/dom/wrap.mjs +13 -8
- package/build-module/dom/wrap.mjs.map +1 -7
- package/build-module/focusable.mjs +96 -54
- package/build-module/focusable.mjs.map +1 -7
- package/build-module/index.mjs +11 -5
- package/build-module/index.mjs.map +1 -7
- package/build-module/phrasing-content.mjs +158 -134
- package/build-module/phrasing-content.mjs.map +1 -7
- package/build-module/tabbable.mjs +117 -52
- package/build-module/tabbable.mjs.map +1 -7
- package/build-module/types.mjs +0 -0
- package/build-module/utils/assert-is-defined.mjs +4 -9
- package/build-module/utils/assert-is-defined.mjs.map +1 -7
- package/build-types/data-transfer.d.ts +2 -2
- package/build-types/data-transfer.d.ts.map +1 -1
- package/build-types/dom/caret-range-from-point.d.ts +4 -4
- package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/clean-node-list.d.ts +6 -46
- package/build-types/dom/clean-node-list.d.ts.map +1 -1
- package/build-types/dom/compute-caret-rect.d.ts +2 -2
- package/build-types/dom/compute-caret-rect.d.ts.map +1 -1
- package/build-types/dom/document-has-selection.d.ts +2 -2
- package/build-types/dom/document-has-selection.d.ts.map +1 -1
- package/build-types/dom/document-has-text-selection.d.ts +2 -2
- package/build-types/dom/document-has-text-selection.d.ts.map +1 -1
- package/build-types/dom/document-has-uncollapsed-selection.d.ts +2 -2
- package/build-types/dom/document-has-uncollapsed-selection.d.ts.map +1 -1
- package/build-types/dom/get-computed-style.d.ts +3 -3
- package/build-types/dom/get-computed-style.d.ts.map +1 -1
- package/build-types/dom/get-offset-parent.d.ts +2 -2
- package/build-types/dom/get-offset-parent.d.ts.map +1 -1
- package/build-types/dom/get-range-height.d.ts +2 -2
- package/build-types/dom/get-range-height.d.ts.map +1 -1
- package/build-types/dom/get-rectangle-from-range.d.ts +2 -2
- package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
- package/build-types/dom/get-scroll-container.d.ts +5 -5
- package/build-types/dom/get-scroll-container.d.ts.map +1 -1
- package/build-types/dom/hidden-caret-range-from-point.d.ts +5 -5
- package/build-types/dom/hidden-caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/index.d.ts.map +1 -1
- package/build-types/dom/input-field-has-uncollapsed-selection.d.ts +2 -2
- package/build-types/dom/input-field-has-uncollapsed-selection.d.ts.map +1 -1
- package/build-types/dom/insert-after.d.ts +2 -3
- package/build-types/dom/insert-after.d.ts.map +1 -1
- package/build-types/dom/is-edge.d.ts +4 -4
- package/build-types/dom/is-edge.d.ts.map +1 -1
- package/build-types/dom/is-element.d.ts.map +1 -1
- package/build-types/dom/is-empty.d.ts +3 -3
- package/build-types/dom/is-empty.d.ts.map +1 -1
- package/build-types/dom/is-entirely-selected.d.ts +2 -2
- package/build-types/dom/is-entirely-selected.d.ts.map +1 -1
- package/build-types/dom/is-form-element.d.ts +3 -3
- package/build-types/dom/is-form-element.d.ts.map +1 -1
- package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
- package/build-types/dom/is-html-input-element.d.ts +1 -1
- package/build-types/dom/is-html-input-element.d.ts.map +1 -1
- package/build-types/dom/is-input-or-text-area.d.ts.map +1 -1
- package/build-types/dom/is-number-input.d.ts +2 -2
- package/build-types/dom/is-number-input.d.ts.map +1 -1
- package/build-types/dom/is-rtl.d.ts +2 -2
- package/build-types/dom/is-rtl.d.ts.map +1 -1
- package/build-types/dom/is-selection-forward.d.ts +2 -2
- package/build-types/dom/is-selection-forward.d.ts.map +1 -1
- package/build-types/dom/is-text-field.d.ts +2 -2
- package/build-types/dom/is-text-field.d.ts.map +1 -1
- package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-edge.d.ts +3 -3
- package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
- 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.map +1 -1
- package/build-types/dom/remove-invalid-html.d.ts +5 -4
- package/build-types/dom/remove-invalid-html.d.ts.map +1 -1
- package/build-types/dom/remove.d.ts +1 -2
- package/build-types/dom/remove.d.ts.map +1 -1
- package/build-types/dom/replace-tag.d.ts +3 -3
- package/build-types/dom/replace-tag.d.ts.map +1 -1
- package/build-types/dom/replace.d.ts +2 -3
- package/build-types/dom/replace.d.ts.map +1 -1
- package/build-types/dom/safe-html.d.ts +2 -2
- package/build-types/dom/safe-html.d.ts.map +1 -1
- package/build-types/dom/scroll-if-no-range.d.ts +5 -5
- package/build-types/dom/scroll-if-no-range.d.ts.map +1 -1
- package/build-types/dom/strip-html.d.ts +2 -2
- package/build-types/dom/strip-html.d.ts.map +1 -1
- package/build-types/dom/types.d.ts +32 -0
- package/build-types/dom/types.d.ts.map +1 -0
- package/build-types/dom/unwrap.d.ts +1 -3
- package/build-types/dom/unwrap.d.ts.map +1 -1
- package/build-types/dom/wrap.d.ts +2 -2
- package/build-types/dom/wrap.d.ts.map +1 -1
- package/build-types/focusable.d.ts +11 -30
- package/build-types/focusable.d.ts.map +1 -1
- package/build-types/index.d.ts +17 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/phrasing-content.d.ts +9 -24
- package/build-types/phrasing-content.d.ts.map +1 -1
- package/build-types/tabbable.d.ts +10 -15
- package/build-types/tabbable.d.ts.map +1 -1
- package/build-types/types.d.ts +29 -0
- package/build-types/types.d.ts.map +1 -0
- package/package.json +6 -7
- package/src/{data-transfer.js → data-transfer.ts} +3 -3
- package/src/dom/{caret-range-from-point.js → caret-range-from-point.ts} +9 -5
- package/src/dom/{clean-node-list.js → clean-node-list.ts} +16 -24
- package/src/dom/{compute-caret-rect.js → compute-caret-rect.ts} +3 -3
- package/src/dom/{document-has-selection.js → document-has-selection.ts} +3 -3
- package/src/dom/{document-has-text-selection.js → document-has-text-selection.ts} +3 -3
- package/src/dom/{document-has-uncollapsed-selection.js → document-has-uncollapsed-selection.ts} +5 -3
- package/src/dom/{get-computed-style.js → get-computed-style.ts} +5 -3
- package/src/dom/{get-offset-parent.js → get-offset-parent.ts} +9 -14
- package/src/dom/{get-range-height.js → get-range-height.ts} +3 -3
- package/src/dom/{get-rectangle-from-range.js → get-rectangle-from-range.ts} +6 -12
- package/src/dom/{get-scroll-container.js → get-scroll-container.ts} +9 -9
- package/src/dom/{hidden-caret-range-from-point.js → hidden-caret-range-from-point.ts} +11 -6
- package/src/dom/{input-field-has-uncollapsed-selection.js → input-field-has-uncollapsed-selection.ts} +7 -5
- package/src/dom/{insert-after.js → insert-after.ts} +6 -4
- package/src/dom/{is-edge.js → is-edge.ts} +44 -48
- package/src/dom/{is-element.js → is-element.ts} +3 -1
- package/src/dom/{is-empty.js → is-empty.ts} +5 -7
- package/src/dom/{is-entirely-selected.js → is-entirely-selected.ts} +14 -11
- package/src/dom/{is-form-element.js → is-form-element.ts} +5 -3
- package/src/dom/{is-horizontal-edge.js → is-horizontal-edge.ts} +4 -1
- package/src/dom/{is-html-input-element.js → is-html-input-element.ts} +3 -1
- package/src/dom/{is-input-or-text-area.js → is-input-or-text-area.ts} +3 -1
- package/src/dom/{is-number-input.js → is-number-input.ts} +3 -3
- package/src/dom/{is-rtl.js → is-rtl.ts} +3 -3
- package/src/dom/{is-selection-forward.js → is-selection-forward.ts} +3 -3
- package/src/dom/{is-text-field.js → is-text-field.ts} +4 -4
- package/src/dom/{is-vertical-edge.js → is-vertical-edge.ts} +4 -1
- package/src/dom/{place-caret-at-edge.js → place-caret-at-edge.ts} +17 -9
- package/src/dom/{place-caret-at-horizontal-edge.js → place-caret-at-horizontal-edge.ts} +4 -1
- package/src/dom/{place-caret-at-vertical-edge.js → place-caret-at-vertical-edge.ts} +5 -1
- package/src/dom/{remove-invalid-html.js → remove-invalid-html.ts} +9 -4
- package/src/dom/{remove.js → remove.ts} +2 -3
- package/src/dom/{replace-tag.js → replace-tag.ts} +4 -4
- package/src/dom/{replace.js → replace.ts} +6 -4
- package/src/dom/{safe-html.js → safe-html.ts} +3 -3
- package/src/dom/{scroll-if-no-range.js → scroll-if-no-range.ts} +9 -5
- package/src/dom/{strip-html.js → strip-html.ts} +3 -3
- package/src/dom/test/{get-rectangle-from-range.browser.test.js → get-rectangle-from-range.browser.test.ts} +25 -25
- package/src/dom/types.ts +28 -0
- package/src/dom/{unwrap.js → unwrap.ts} +2 -4
- package/src/dom/{wrap.js → wrap.ts} +3 -3
- package/src/{focusable.js → focusable.ts} +34 -32
- package/src/index.ts +33 -0
- package/src/{phrasing-content.js → phrasing-content.ts} +15 -30
- package/src/{tabbable.js → tabbable.ts} +48 -39
- package/src/test/{dom.jsdom.test.js → dom.jsdom.test.ts} +30 -6
- package/src/test/{focusable.browser.test.js → focusable.browser.test.ts} +14 -13
- package/src/test/{tabbable.browser.test.js → tabbable.browser.test.ts} +3 -2
- package/src/types.ts +32 -0
- package/CHANGELOG.md +0 -317
- package/build/dom/index.cjs.map +0 -7
- package/build-module/dom/index.mjs.map +0 -7
- package/src/index.js +0 -12
- /package/src/dom/{index.js → index.ts} +0 -0
- /package/src/dom/test/{safe-html.jsdom.test.js → safe-html.jsdom.test.ts} +0 -0
- /package/src/dom/test/{strip-html.jsdom.test.js → strip-html.jsdom.test.ts} +0 -0
- /package/src/test/{focusable-area.jsdom.test.js → focusable-area.jsdom.test.ts} +0 -0
- /package/src/test/{utils.js → utils.ts} +0 -0
package/build/dom/unwrap.cjs
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/dom/src/dom/unwrap.js
|
|
21
|
-
var unwrap_exports = {};
|
|
22
|
-
__export(unwrap_exports, {
|
|
23
|
-
default: () => unwrap
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
let ___utils_assert_is_defined_ts = require("../utils/assert-is-defined.cjs");
|
|
7
|
+
// packages/dom/src/dom/unwrap.ts
|
|
8
|
+
/**
|
|
9
|
+
* Unwrap the given node. This means any child nodes are moved to the parent.
|
|
10
|
+
*
|
|
11
|
+
* @param node The node to unwrap.
|
|
12
|
+
*/
|
|
27
13
|
function unwrap(node) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
parent.removeChild(node);
|
|
14
|
+
const parent = node.parentNode;
|
|
15
|
+
(0, ___utils_assert_is_defined_ts.assertIsDefined)(parent, "node.parentNode");
|
|
16
|
+
while (node.firstChild) parent.insertBefore(node.firstChild, node);
|
|
17
|
+
parent.removeChild(node);
|
|
34
18
|
}
|
|
35
|
-
|
|
19
|
+
exports.default = unwrap;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=unwrap.cjs.map
|
package/build/dom/unwrap.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/unwrap.js"],
|
|
4
|
-
"sourcesContent": ["import { 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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AASjB,SAAR,OAAyB,MAAO;AACtC,QAAM,SAAS,KAAK;AAEpB,gDAAiB,QAAQ,iBAAkB;AAE3C,SAAQ,KAAK,YAAa;AACzB,WAAO,aAAc,KAAK,YAAY,IAAK;AAAA,EAC5C;AAEA,SAAO,YAAa,IAAK;AAC1B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"unwrap.cjs","names":[],"sources":["../../src/dom/unwrap.ts"],"sourcesContent":["import { 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 The node to unwrap.\n */\nexport default function unwrap( node: Node ): void {\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":";;;;;;;;;;;;AAOA,SAAwB,OAAQ,MAAmB;CAClD,MAAM,SAAS,KAAK;CAEpB,CAAA,GAAA,8BAAA,gBAAA,CAAiB,QAAQ,iBAAkB;CAE3C,OAAQ,KAAK,YACZ,OAAO,aAAc,KAAK,YAAY,IAAK;CAG5C,OAAO,YAAa,IAAK;AAC1B"}
|
package/build/dom/wrap.cjs
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/dom/src/dom/wrap.js
|
|
21
|
-
var wrap_exports = {};
|
|
22
|
-
__export(wrap_exports, {
|
|
23
|
-
default: () => wrap
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
let ___utils_assert_is_defined_ts = require("../utils/assert-is-defined.cjs");
|
|
7
|
+
// packages/dom/src/dom/wrap.ts
|
|
8
|
+
/**
|
|
9
|
+
* Wraps the given node with a new node with the given tag name.
|
|
10
|
+
*
|
|
11
|
+
* @param newNode The node to insert.
|
|
12
|
+
* @param referenceNode The node to wrap.
|
|
13
|
+
*/
|
|
27
14
|
function wrap(newNode, referenceNode) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
(0, ___utils_assert_is_defined_ts.assertIsDefined)(referenceNode.parentNode, "referenceNode.parentNode");
|
|
16
|
+
referenceNode.parentNode.insertBefore(newNode, referenceNode);
|
|
17
|
+
newNode.appendChild(referenceNode);
|
|
31
18
|
}
|
|
32
|
-
|
|
19
|
+
exports.default = wrap;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=wrap.cjs.map
|
package/build/dom/wrap.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/wrap.js"],
|
|
4
|
-
"sourcesContent": ["import { 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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAQjB,SAAR,KAAuB,SAAS,eAAgB;AACtD,gDAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,aAAc;AAC9D,UAAQ,YAAa,aAAc;AACpC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"wrap.cjs","names":[],"sources":["../../src/dom/wrap.ts"],"sourcesContent":["import { 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 newNode The node to insert.\n * @param referenceNode The node to wrap.\n */\nexport default function wrap( newNode: Element, referenceNode: Element ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,SAAwB,KAAM,SAAkB,eAAyB;CACxE,CAAA,GAAA,8BAAA,gBAAA,CAAiB,cAAc,YAAY,0BAA2B;CACtE,cAAc,WAAW,aAAc,SAAS,aAAc;CAC9D,QAAQ,YAAa,aAAc;AACpC"}
|
package/build/focusable.cjs
CHANGED
|
@@ -1,87 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/dom/src/focusable.js
|
|
21
|
-
var focusable_exports = {};
|
|
22
|
-
__export(focusable_exports, {
|
|
23
|
-
find: () => find
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
6
|
+
// packages/dom/src/focusable.ts
|
|
7
|
+
/**
|
|
8
|
+
* References:
|
|
9
|
+
*
|
|
10
|
+
* Focusable:
|
|
11
|
+
* - https://www.w3.org/TR/html5/editing.html#focus-management
|
|
12
|
+
*
|
|
13
|
+
* Sequential focus navigation:
|
|
14
|
+
* - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
|
|
15
|
+
*
|
|
16
|
+
* Disabled elements:
|
|
17
|
+
* - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements
|
|
18
|
+
*
|
|
19
|
+
* getClientRects algorithm (requiring layout box):
|
|
20
|
+
* - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface
|
|
21
|
+
*
|
|
22
|
+
* AREA elements associated with an IMG:
|
|
23
|
+
* - https://w3c.github.io/html/editing.html#data-model
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Returns a CSS selector used to query for focusable elements.
|
|
27
|
+
*
|
|
28
|
+
* @param sequential If set, only query elements that are sequentially
|
|
29
|
+
* focusable. Non-interactive elements with a
|
|
30
|
+
* negative `tabindex` are focusable but not
|
|
31
|
+
* sequentially focusable.
|
|
32
|
+
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
|
33
|
+
*
|
|
34
|
+
* @return CSS selector.
|
|
35
|
+
*/
|
|
26
36
|
function buildSelector(sequential) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
return [
|
|
38
|
+
sequential ? "[tabindex]:not([tabindex^=\"-\"])" : "[tabindex]",
|
|
39
|
+
"a[href]",
|
|
40
|
+
"button:not([disabled])",
|
|
41
|
+
"input:not([type=\"hidden\"]):not([disabled])",
|
|
42
|
+
"select:not([disabled])",
|
|
43
|
+
"textarea:not([disabled])",
|
|
44
|
+
"iframe:not([tabindex^=\"-\"])",
|
|
45
|
+
"object",
|
|
46
|
+
"embed",
|
|
47
|
+
"summary",
|
|
48
|
+
"area[href]",
|
|
49
|
+
"[contenteditable]:not([contenteditable=false])"
|
|
50
|
+
].join(",");
|
|
41
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns true if the specified element has a layout box and is not hidden by
|
|
54
|
+
* CSS visibility or content visibility.
|
|
55
|
+
*
|
|
56
|
+
* @param element DOM element to test.
|
|
57
|
+
*
|
|
58
|
+
* @return Whether element is visible.
|
|
59
|
+
*/
|
|
42
60
|
function isVisible(element) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
).visibility;
|
|
51
|
-
if (visibility === "hidden" || visibility === "collapse") {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
|
|
61
|
+
if (typeof element.checkVisibility === "function") {
|
|
62
|
+
if (!element.checkVisibility({ visibilityProperty: true })) return false;
|
|
63
|
+
} else {
|
|
64
|
+
const visibility = element.ownerDocument.defaultView?.getComputedStyle(element).visibility;
|
|
65
|
+
if (visibility === "hidden" || visibility === "collapse") return false;
|
|
66
|
+
}
|
|
67
|
+
return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
|
|
56
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns true if the specified area element is a valid focusable element, or
|
|
71
|
+
* false otherwise. Area is only focusable if within a map where a named map
|
|
72
|
+
* referenced by an image somewhere in the document.
|
|
73
|
+
*
|
|
74
|
+
* @param element DOM area element to test.
|
|
75
|
+
*
|
|
76
|
+
* @return Whether area element is valid for focus.
|
|
77
|
+
*/
|
|
57
78
|
function isValidFocusableArea(element) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const img = element.ownerDocument.querySelector(
|
|
63
|
-
'img[usemap="#' + map.name + '"]'
|
|
64
|
-
);
|
|
65
|
-
return !!img && !img.closest("[inert]") && isVisible(img);
|
|
79
|
+
const map = element.closest("map[name]");
|
|
80
|
+
if (!map) return false;
|
|
81
|
+
const img = element.ownerDocument.querySelector("img[usemap=\"#" + map.name + "\"]");
|
|
82
|
+
return !!img && !img.closest("[inert]") && isVisible(img);
|
|
66
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns all focusable elements within a given context.
|
|
86
|
+
*
|
|
87
|
+
* @param context Element in which to search.
|
|
88
|
+
* @param options
|
|
89
|
+
* @param [options.sequential] If set, only return elements that are
|
|
90
|
+
* sequentially focusable.
|
|
91
|
+
* Non-interactive elements with a
|
|
92
|
+
* negative `tabindex` are focusable but
|
|
93
|
+
* not sequentially focusable.
|
|
94
|
+
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
|
95
|
+
*
|
|
96
|
+
* @return Focusable elements.
|
|
97
|
+
*/
|
|
67
98
|
function find(context, { sequential = false } = {}) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
if (element.closest("[inert]")) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return isVisible(element);
|
|
81
|
-
});
|
|
99
|
+
const elements = context.querySelectorAll(buildSelector(sequential));
|
|
100
|
+
return Array.from(elements).filter((element) => {
|
|
101
|
+
const { nodeName } = element;
|
|
102
|
+
if ("AREA" === nodeName) return isValidFocusableArea(element);
|
|
103
|
+
if (element.closest("[inert]")) return false;
|
|
104
|
+
return isVisible(element);
|
|
105
|
+
});
|
|
82
106
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=focusable.cjs.map
|
|
107
|
+
exports.find = find;
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=focusable.cjs.map
|
package/build/focusable.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/focusable.js"],
|
|
4
|
-
"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'summary',\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 has a layout box and is not hidden by\n * CSS visibility or content visibility.\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\tif ( typeof element.checkVisibility === 'function' ) {\n\t\tif ( ! element.checkVisibility( { visibilityProperty: true } ) ) {\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\tconst visibility =\n\t\t\telement.ownerDocument.defaultView?.getComputedStyle(\n\t\t\t\telement\n\t\t\t).visibility;\n\t\tif ( visibility === 'hidden' || visibility === 'collapse' ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\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 && ! img.closest( '[inert]' ) && 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\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\t// The mapped image determines whether this region is visible or inert.\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\t// Elements inside an inert subtree are not focusable.\n\t\tif ( element.closest( '[inert]' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn isVisible( element );\n\t} );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA,SAAS,cAAe,YAAa;AACpC,SAAO;AAAA,IACN,aAAa,oCAAoC;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAM,GAAI;AACb;AAUA,SAAS,UAAW,SAAU;AAC7B,MAAK,OAAO,QAAQ,oBAAoB,YAAa;AACpD,QAAK,CAAE,QAAQ,gBAAiB,EAAE,oBAAoB,KAAK,CAAE,GAAI;AAChE,aAAO;AAAA,IACR;AAAA,EACD,OAAO;AACN,UAAM,aACL,QAAQ,cAAc,aAAa;AAAA,MAClC;AAAA,IACD,EAAE;AACH,QAAK,eAAe,YAAY,eAAe,YAAa;AAC3D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SACC,QAAQ,cAAc,KACtB,QAAQ,eAAe,KACvB,QAAQ,eAAe,EAAE,SAAS;AAEpC;AAWA,SAAS,qBAAsB,SAAU;AAExC,QAAM,MAAM,QAAQ,QAAS,WAAY;AACzC,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,QAAM,MAAM,QAAQ,cAAc;AAAA,IACjC,kBAAkB,IAAI,OAAO;AAAA,EAC9B;AACA,SAAO,CAAC,CAAE,OAAO,CAAE,IAAI,QAAS,SAAU,KAAK,UAAW,GAAI;AAC/D;AAgBO,SAAS,KAAM,SAAS,EAAE,aAAa,MAAM,IAAI,CAAC,GAAI;AAE5D,QAAM,WAAW,QAAQ,iBAAkB,cAAe,UAAW,CAAE;AAEvE,SAAO,MAAM,KAAM,QAAS,EAAE,OAAQ,CAAE,YAAa;AACpD,UAAM,EAAE,SAAS,IAAI;AACrB,QAAK,WAAW,UAAW;AAE1B,aAAO;AAAA;AAAA,QAC2B;AAAA,MAClC;AAAA,IACD;AAGA,QAAK,QAAQ,QAAS,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAEA,WAAO,UAAW,OAAQ;AAAA,EAC3B,CAAE;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"focusable.cjs","names":[],"sources":["../src/focusable.ts"],"sourcesContent":["import type { FindFocusableOptions } from './types';\n\n/**\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 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 CSS selector.\n */\nfunction buildSelector( sequential: boolean ): string {\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'summary',\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 has a layout box and is not hidden by\n * CSS visibility or content visibility.\n *\n * @param element DOM element to test.\n *\n * @return Whether element is visible.\n */\nfunction isVisible( element: HTMLElement ): boolean {\n\tif ( typeof element.checkVisibility === 'function' ) {\n\t\tif ( ! element.checkVisibility( { visibilityProperty: true } ) ) {\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\tconst visibility =\n\t\t\telement.ownerDocument.defaultView?.getComputedStyle(\n\t\t\t\telement\n\t\t\t).visibility;\n\t\tif ( visibility === 'hidden' || visibility === 'collapse' ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\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 element DOM area element to test.\n *\n * @return Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element: HTMLAreaElement ): boolean {\n\tconst map: HTMLMapElement | null = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\tconst img: HTMLImageElement | null = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && ! img.closest( '[inert]' ) && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param context Element in which to search.\n * @param options\n * @param [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 Focusable elements.\n */\nexport function find(\n\tcontext: Element,\n\t{ sequential = false }: FindFocusableOptions = {}\n): HTMLElement[] {\n\tconst elements: NodeListOf< HTMLElement > = context.querySelectorAll(\n\t\tbuildSelector( sequential )\n\t);\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\t// The mapped image determines whether this region is visible or inert.\n\t\t\treturn isValidFocusableArea( element as HTMLAreaElement );\n\t\t}\n\n\t\t// Elements inside an inert subtree are not focusable.\n\t\tif ( element.closest( '[inert]' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn isVisible( element );\n\t} );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,cAAe,YAA8B;CACrD,OAAO;EACN,aAAa,sCAAoC;EACjD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC,CAAC,KAAM,GAAI;AACb;;;;;;;;;AAUA,SAAS,UAAW,SAAgC;CACnD,IAAK,OAAO,QAAQ,oBAAoB,YAClC;MAAA,CAAE,QAAQ,gBAAiB,EAAE,oBAAoB,KAAK,CAAE,GAC5D,OAAO;CAAA,OAEF;EACN,MAAM,aACL,QAAQ,cAAc,aAAa,iBAClC,OACD,CAAC,CAAC;EACH,IAAK,eAAe,YAAY,eAAe,YAC9C,OAAO;CAET;CAEA,OACC,QAAQ,cAAc,KACtB,QAAQ,eAAe,KACvB,QAAQ,eAAe,CAAC,CAAC,SAAS;AAEpC;;;;;;;;;;AAWA,SAAS,qBAAsB,SAAoC;CAClE,MAAM,MAA6B,QAAQ,QAAS,WAAY;CAChE,IAAK,CAAE,KACN,OAAO;CAGR,MAAM,MAA+B,QAAQ,cAAc,cAC1D,mBAAkB,IAAI,OAAO,KAC9B;CACA,OAAO,CAAC,CAAE,OAAO,CAAE,IAAI,QAAS,SAAU,KAAK,UAAW,GAAI;AAC/D;;;;;;;;;;;;;;;AAgBA,SAAgB,KACf,SACA,EAAE,aAAa,UAAgC,CAAC,GAChC;CAChB,MAAM,WAAsC,QAAQ,iBACnD,cAAe,UAAW,CAC3B;CAEA,OAAO,MAAM,KAAM,QAAS,CAAC,CAAC,QAAU,YAAa;EACpD,MAAM,EAAE,aAAa;EACrB,IAAK,WAAW,UAEf,OAAO,qBAAsB,OAA2B;EAIzD,IAAK,QAAQ,QAAS,SAAU,GAC/B,OAAO;EAGR,OAAO,UAAW,OAAQ;CAC3B,CAAE;AACH"}
|
package/build/index.cjs
CHANGED
|
@@ -1,50 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let __focusable_ts = require("./focusable.cjs");
|
|
28
|
+
__focusable_ts = __toESM(__focusable_ts);
|
|
29
|
+
let __tabbable_ts = require("./tabbable.cjs");
|
|
30
|
+
__tabbable_ts = __toESM(__tabbable_ts);
|
|
31
|
+
// packages/dom/src/index.ts
|
|
32
|
+
/**
|
|
33
|
+
* Object grouping `focusable` and `tabbable` utils
|
|
34
|
+
* under the keys with the same name.
|
|
35
|
+
*/
|
|
36
|
+
const focus = {
|
|
37
|
+
focusable: __focusable_ts,
|
|
38
|
+
tabbable: __tabbable_ts
|
|
39
|
+
};
|
|
40
|
+
exports.focus = focus;
|
|
41
|
+
var __dom_index_ts = require("./dom/index.cjs");
|
|
42
|
+
Object.keys(__dom_index_ts).forEach(function(k) {
|
|
43
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function() {
|
|
46
|
+
return __dom_index_ts[k];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var __phrasing_content_ts = require("./phrasing-content.cjs");
|
|
51
|
+
Object.keys(__phrasing_content_ts).forEach(function(k) {
|
|
52
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function() {
|
|
55
|
+
return __phrasing_content_ts[k];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
35
58
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
focus,
|
|
46
|
-
...require("./dom/index.cjs"),
|
|
47
|
-
...require("./phrasing-content.cjs"),
|
|
48
|
-
...require("./data-transfer.cjs")
|
|
59
|
+
var __data_transfer_ts = require("./data-transfer.cjs");
|
|
60
|
+
Object.keys(__data_transfer_ts).forEach(function(k) {
|
|
61
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function() {
|
|
64
|
+
return __data_transfer_ts[k];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
49
67
|
});
|
|
50
|
-
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=index.cjs.map
|
package/build/index.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["import * 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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,eAA0B;AAQ1B,0BAAc,4BATd;AAUA,0BAAc,mCAVd;AAWA,0BAAc,gCAXd;AAOO,IAAM,QAAQ,EAAE,WAAW,SAAS;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import * 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\n/**\n * Schema of the content allowed inside an element, keyed by tag name.\n */\nexport type { ContentSchema } from './types';\n\n/**\n * The attributes and children allowed for an element in a `ContentSchema`.\n */\nexport type { SemanticElementDefinition } from './types';\n\n/**\n * Schema that `cleanNodeList` and `removeInvalidHTML` clean HTML against,\n * keyed by tag name.\n */\nexport type { Schema } from './dom/types';\n\n/**\n * The rules for a single tag in a `Schema`.\n */\nexport type { SchemaItem } from './dom/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAa,QAAQ;CAAE,WAAA;CAAW,UAAA;AAAS"}
|