@ctrl/dom 0.0.0-stage → 0.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/LICENSE +21 -0
- package/NOTICE +338 -0
- package/README.md +362 -2
- package/dist/aria/_chunks/roles-list-CYZF-l9K.js +1503 -0
- package/dist/aria/_chunks/roles-list-D4WCyRO_.cjs +1754 -0
- package/dist/aria/index.cjs +232 -0
- package/dist/aria/index.js +198 -0
- package/dist/aria/internal.cjs +69 -0
- package/dist/aria/internal.js +30 -0
- package/dist/aria/types/accname.d.ts +40 -0
- package/dist/aria/types/data/aria-query.d.ts +61 -0
- package/dist/aria/types/data/aria-query.generated.d.ts +2 -0
- package/dist/aria/types/forms.d.ts +25 -0
- package/dist/aria/types/hidden.d.ts +38 -0
- package/dist/aria/types/index.d.ts +46 -0
- package/dist/aria/types/internal.d.ts +15 -0
- package/dist/aria/types/role.d.ts +27 -0
- package/dist/aria/types/roles-list.d.ts +18 -0
- package/dist/aria/types/states.d.ts +29 -0
- package/dist/aria/types/style.d.ts +18 -0
- package/dist/aria/types/tree.d.ts +20 -0
- package/dist/bridge/index.cjs +3 -0
- package/dist/bridge/index.js +4 -0
- package/dist/bridge/internal.cjs +3 -0
- package/dist/bridge/internal.js +4 -0
- package/dist/cli/_chunks/report-DdncYfuJ.js +93 -0
- package/dist/cli/ctrl-dom.js +199 -0
- package/dist/cli/jest-reporter.js +55 -0
- package/dist/cli/vitest-reporter.js +81 -0
- package/dist/dom/_chunks/src-DWP2w3IQ.js +47516 -0
- package/dist/dom/index.js +3 -0
- package/dist/dom/internal.js +434 -0
- package/dist/dom/types/collections/DOMStringMap.d.ts +8 -0
- package/dist/dom/types/collections/DOMTokenList.d.ts +33 -0
- package/dist/dom/types/collections/HTMLCollection.d.ts +62 -0
- package/dist/dom/types/collections/NamedNodeMap.d.ts +22 -0
- package/dist/dom/types/collections/NodeList.d.ts +43 -0
- package/dist/dom/types/collections/indexed.d.ts +8 -0
- package/dist/dom/types/collections/iterator.d.ts +8 -0
- package/dist/dom/types/css/CSS.d.ts +21 -0
- package/dist/dom/types/css/CSSStyleDeclaration.d.ts +57 -0
- package/dist/dom/types/css/cascade.d.ts +159 -0
- package/dist/dom/types/css/colors.d.ts +28 -0
- package/dist/dom/types/css/computed.d.ts +22 -0
- package/dist/dom/types/css/cssom.d.ts +363 -0
- package/dist/dom/types/css/data/properties.d.ts +1 -0
- package/dist/dom/types/css/declarations.d.ts +40 -0
- package/dist/dom/types/css/index.d.ts +5 -0
- package/dist/dom/types/css/inline-count.d.ts +2 -0
- package/dist/dom/types/css/internal.d.ts +11 -0
- package/dist/dom/types/css/layout-mode.d.ts +4 -0
- package/dist/dom/types/css/layout.d.ts +63 -0
- package/dist/dom/types/css/media.d.ts +55 -0
- package/dist/dom/types/css/parser.d.ts +93 -0
- package/dist/dom/types/css/properties.d.ts +28 -0
- package/dist/dom/types/css/resize-observer.d.ts +19 -0
- package/dist/dom/types/css/selector-info.d.ts +13 -0
- package/dist/dom/types/css/shorthands.d.ts +33 -0
- package/dist/dom/types/css/stylesheets.d.ts +93 -0
- package/dist/dom/types/css/supports.d.ts +4 -0
- package/dist/dom/types/css/tokenizer.d.ts +91 -0
- package/dist/dom/types/css/values.d.ts +91 -0
- package/dist/dom/types/css/view.d.ts +44 -0
- package/dist/dom/types/events/DataTransfer.d.ts +62 -0
- package/dist/dom/types/events/Event.d.ts +115 -0
- package/dist/dom/types/events/EventTarget.d.ts +22 -0
- package/dist/dom/types/events/UIEvents.d.ts +308 -0
- package/dist/dom/types/events/activation.d.ts +7 -0
- package/dist/dom/types/events/convert.d.ts +16 -0
- package/dist/dom/types/events/createEvent.d.ts +3 -0
- package/dist/dom/types/events/dispatch.d.ts +39 -0
- package/dist/dom/types/events/events.d.ts +200 -0
- package/dist/dom/types/events/fire.d.ts +21 -0
- package/dist/dom/types/events/handlers.d.ts +14 -0
- package/dist/dom/types/events/listeners.d.ts +32 -0
- package/dist/dom/types/events/report.d.ts +10 -0
- package/dist/dom/types/html/HTMLElement.d.ts +126 -0
- package/dist/dom/types/html/MathMLElement.d.ts +6 -0
- package/dist/dom/types/html/SVGElement.d.ts +145 -0
- package/dist/dom/types/html/anchor.d.ts +16 -0
- package/dist/dom/types/html/aria-reflection.d.ts +14 -0
- package/dist/dom/types/html/collection.d.ts +5 -0
- package/dist/dom/types/html/custom-elements.d.ts +129 -0
- package/dist/dom/types/html/elements.d.ts +202 -0
- package/dist/dom/types/html/events.d.ts +22 -0
- package/dist/dom/types/html/focus.d.ts +63 -0
- package/dist/dom/types/html/forms/FileList.d.ts +1 -0
- package/dist/dom/types/html/forms/FormData.d.ts +7 -0
- package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +36 -0
- package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +29 -0
- package/dist/dom/types/html/forms/HTMLFormElement.d.ts +61 -0
- package/dist/dom/types/html/forms/HTMLInputElement.d.ts +204 -0
- package/dist/dom/types/html/forms/HTMLLabelElement.d.ts +15 -0
- package/dist/dom/types/html/forms/HTMLOptionElement.d.ts +61 -0
- package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +74 -0
- package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +96 -0
- package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +82 -0
- package/dist/dom/types/html/forms/autofill.d.ts +10 -0
- package/dist/dom/types/html/forms/collections.d.ts +112 -0
- package/dist/dom/types/html/forms/common.d.ts +36 -0
- package/dist/dom/types/html/forms/face.d.ts +59 -0
- package/dist/dom/types/html/forms/form-associated.d.ts +46 -0
- package/dist/dom/types/html/forms/form-submission.d.ts +55 -0
- package/dist/dom/types/html/forms/index.d.ts +17 -0
- package/dist/dom/types/html/forms/input-type.d.ts +50 -0
- package/dist/dom/types/html/forms/microsyntaxes.d.ts +52 -0
- package/dist/dom/types/html/forms/state.d.ts +54 -0
- package/dist/dom/types/html/forms/ui.d.ts +35 -0
- package/dist/dom/types/html/forms/user-validity.d.ts +19 -0
- package/dist/dom/types/html/forms/validation.d.ts +76 -0
- package/dist/dom/types/html/index.d.ts +13 -0
- package/dist/dom/types/html/innerText.d.ts +9 -0
- package/dist/dom/types/html/interactive.d.ts +43 -0
- package/dist/dom/types/html/invokers.d.ts +39 -0
- package/dist/dom/types/html/media.d.ts +86 -0
- package/dist/dom/types/html/reflect.d.ts +67 -0
- package/dist/dom/types/html/registry.d.ts +9 -0
- package/dist/dom/types/html/resources.d.ts +55 -0
- package/dist/dom/types/html/shared.d.ts +22 -0
- package/dist/dom/types/html/slot.d.ts +15 -0
- package/dist/dom/types/html/template.d.ts +18 -0
- package/dist/dom/types/html/top-layer.d.ts +73 -0
- package/dist/dom/types/index.d.ts +50 -0
- package/dist/dom/types/internal.d.ts +61 -0
- package/dist/dom/types/keys.d.ts +209 -0
- package/dist/dom/types/nodes/Attr.d.ts +25 -0
- package/dist/dom/types/nodes/CharacterData.d.ts +35 -0
- package/dist/dom/types/nodes/Document.d.ts +169 -0
- package/dist/dom/types/nodes/DocumentFragment.d.ts +12 -0
- package/dist/dom/types/nodes/DocumentType.d.ts +17 -0
- package/dist/dom/types/nodes/Element.d.ts +142 -0
- package/dist/dom/types/nodes/Node.d.ts +112 -0
- package/dist/dom/types/nodes/NodeImpl.d.ts +90 -0
- package/dist/dom/types/nodes/ShadowRoot.d.ts +43 -0
- package/dist/dom/types/nodes/attr-nodes.d.ts +8 -0
- package/dist/dom/types/nodes/attributes.d.ts +46 -0
- package/dist/dom/types/nodes/cache.d.ts +38 -0
- package/dist/dom/types/nodes/character-data.d.ts +5 -0
- package/dist/dom/types/nodes/clone.d.ts +5 -0
- package/dist/dom/types/nodes/constants.d.ts +52 -0
- package/dist/dom/types/nodes/create.d.ts +42 -0
- package/dist/dom/types/nodes/derived.d.ts +26 -0
- package/dist/dom/types/nodes/inspect.d.ts +2 -0
- package/dist/dom/types/nodes/mixins.d.ts +41 -0
- package/dist/dom/types/nodes/names.d.ts +15 -0
- package/dist/dom/types/nodes/slots.d.ts +38 -0
- package/dist/dom/types/nodes/tags.d.ts +8 -0
- package/dist/dom/types/nodes/traverse.d.ts +21 -0
- package/dist/dom/types/nodes/tree.d.ts +47 -0
- package/dist/dom/types/observers/MutationObserver.d.ts +33 -0
- package/dist/dom/types/observers/MutationRecord.d.ts +17 -0
- package/dist/dom/types/observers/queue.d.ts +45 -0
- package/dist/dom/types/parser/entities-data.d.ts +3 -0
- package/dist/dom/types/parser/entities.d.ts +11 -0
- package/dist/dom/types/parser/index.d.ts +34 -0
- package/dist/dom/types/parser/tags.d.ts +182 -0
- package/dist/dom/types/parser/tokenizer.d.ts +109 -0
- package/dist/dom/types/parser/treebuilder.d.ts +271 -0
- package/dist/dom/types/parser/xml.d.ts +14 -0
- package/dist/dom/types/selectors/compile.d.ts +154 -0
- package/dist/dom/types/selectors/filter.d.ts +21 -0
- package/dist/dom/types/selectors/html-predicates.d.ts +1 -0
- package/dist/dom/types/selectors/index.d.ts +16 -0
- package/dist/dom/types/selectors/internal.d.ts +87 -0
- package/dist/dom/types/selectors/parser.d.ts +310 -0
- package/dist/dom/types/selectors/serialize.d.ts +20 -0
- package/dist/dom/types/selectors/state.d.ts +43 -0
- package/dist/dom/types/serializer/index.d.ts +29 -0
- package/dist/dom/types/trace.d.ts +51 -0
- package/dist/dom/types/traversal/Range.d.ts +113 -0
- package/dist/dom/types/traversal/Selection.d.ts +45 -0
- package/dist/dom/types/traversal/TreeWalker.d.ts +77 -0
- package/dist/dom/types/traversal/live.d.ts +46 -0
- package/dist/dom/types/webidl-runtime.d.ts +18 -0
- package/dist/dom/types/webidl.d.ts +34 -0
- package/dist/dom/types/window/DOMStringList.d.ts +14 -0
- package/dist/dom/types/window/FileList.d.ts +11 -0
- package/dist/dom/types/window/FileReader.d.ts +27 -0
- package/dist/dom/types/window/History.d.ts +43 -0
- package/dist/dom/types/window/Location.d.ts +46 -0
- package/dist/dom/types/window/Navigator.d.ts +79 -0
- package/dist/dom/types/window/Screen.d.ts +27 -0
- package/dist/dom/types/window/Storage.d.ts +28 -0
- package/dist/dom/types/window/Window.d.ts +329 -0
- package/dist/dom/types/window/abort.d.ts +4 -0
- package/dist/dom/types/window/browsing-context.d.ts +12 -0
- package/dist/dom/types/window/clock.d.ts +153 -0
- package/dist/dom/types/window/compat.d.ts +34 -0
- package/dist/dom/types/window/cookies.d.ts +21 -0
- package/dist/dom/types/window/current.d.ts +7 -0
- package/dist/dom/types/window/document.d.ts +19 -0
- package/dist/dom/types/window/events.d.ts +11 -0
- package/dist/dom/types/window/fallbacks.d.ts +20 -0
- package/dist/dom/types/window/geometry.d.ts +133 -0
- package/dist/dom/types/window/globals.d.ts +7 -0
- package/dist/dom/types/window/hooks.d.ts +22 -0
- package/dist/dom/types/window/host-originals.d.ts +9 -0
- package/dist/dom/types/window/interfaces.d.ts +13 -0
- package/dist/dom/types/window/isolation.d.ts +20 -0
- package/dist/dom/types/window/media.d.ts +33 -0
- package/dist/dom/types/window/not-implemented.d.ts +23 -0
- package/dist/dom/types/window/observers.d.ts +42 -0
- package/dist/dom/types/window/origin.d.ts +3 -0
- package/dist/dom/types/window/timers.d.ts +28 -0
- package/dist/dom/types/window/xhr.d.ts +108 -0
- package/dist/jest-dom/_chunks/matchers-CDnnXUfG.js +2211 -0
- package/dist/jest-dom/_chunks/matchers-D988Ducb.cjs +2516 -0
- package/dist/jest-dom/index.cjs +5 -0
- package/dist/jest-dom/index.js +6 -0
- package/dist/jest-dom/jest-globals.cjs +6 -0
- package/dist/jest-dom/jest-globals.js +7 -0
- package/dist/jest-dom/matchers.cjs +53 -0
- package/dist/jest-dom/matchers.js +3 -0
- package/dist/jest-dom/types/bun.d.ts +13 -0
- package/dist/jest-dom/types/index.d.ts +3 -0
- package/dist/jest-dom/types/jest-globals.d.ts +13 -0
- package/dist/jest-dom/types/jest.d.ts +15 -0
- package/dist/jest-dom/types/matchers-standalone.d.ts +32 -0
- package/dist/jest-dom/types/matchers.d.ts +1079 -0
- package/dist/jest-dom/types/package.json +1 -0
- package/dist/jest-dom/types/vitest.d.ts +16 -0
- package/dist/jest-dom/vitest.cjs +6 -0
- package/dist/jest-dom/vitest.js +7 -0
- package/dist/react/_chunks/pure-DZ97z2oT.cjs +498 -0
- package/dist/react/_chunks/pure-PtE2hivW.js +420 -0
- package/dist/react/dont-cleanup-after-each.cjs +3 -0
- package/dist/react/dont-cleanup-after-each.js +4 -0
- package/dist/react/index.cjs +47 -0
- package/dist/react/index.js +35 -0
- package/dist/react/pure.cjs +17 -0
- package/dist/react/pure.js +5 -0
- package/dist/react/types/act-compat.d.ts +6 -0
- package/dist/react/types/config.d.ts +9 -0
- package/dist/react/types/dont-cleanup-after-each.d.ts +1 -0
- package/dist/react/types/dtl.d.ts +1 -0
- package/dist/react/types/fire-event.d.ts +3 -0
- package/dist/react/types/index.d.ts +1 -0
- package/dist/react/types/pure.d.ts +136 -0
- package/dist/register/index.js +11 -0
- package/dist/register/pure.js +147 -0
- package/dist/register/types/index.d.ts +1 -0
- package/dist/register/types/pure.d.ts +36 -0
- package/dist/testing-library/_chunks/aria-snapshot-diff-D7PzpXew.cjs +1170 -0
- package/dist/testing-library/_chunks/aria-snapshot-diff-Q8Wj33K0.js +985 -0
- package/dist/testing-library/agent.cjs +721 -0
- package/dist/testing-library/agent.js +713 -0
- package/dist/testing-library/index.cjs +2469 -0
- package/dist/testing-library/index.js +2390 -0
- package/dist/testing-library/types/agent.d.ts +56 -0
- package/dist/testing-library/types/aria-role.d.ts +99 -0
- package/dist/testing-library/types/aria-snapshot.d.ts +43 -0
- package/dist/testing-library/types/config.d.ts +27 -0
- package/dist/testing-library/types/events.d.ts +118 -0
- package/dist/testing-library/types/get-node-text.d.ts +1 -0
- package/dist/testing-library/types/get-queries-for-element.d.ts +182 -0
- package/dist/testing-library/types/index.d.ts +24 -0
- package/dist/testing-library/types/matches.d.ts +46 -0
- package/dist/testing-library/types/pretty-dom.d.ts +37 -0
- package/dist/testing-library/types/queries.d.ts +315 -0
- package/dist/testing-library/types/query-helpers.d.ts +112 -0
- package/dist/testing-library/types/role-helpers.d.ts +19 -0
- package/dist/testing-library/types/screen.d.ts +30 -0
- package/dist/testing-library/types/suggestions.d.ts +46 -0
- package/dist/testing-library/types/wait-for-element-to-be-removed.d.ts +6 -0
- package/dist/testing-library/types/wait-for.d.ts +12 -0
- package/dist/user-event/index.cjs +3910 -0
- package/dist/user-event/index.js +3885 -0
- package/dist/user-event/types/clipboard/copy.d.ts +2 -0
- package/dist/user-event/types/clipboard/cut.d.ts +2 -0
- package/dist/user-event/types/clipboard/index.d.ts +3 -0
- package/dist/user-event/types/clipboard/paste.d.ts +3 -0
- package/dist/user-event/types/convenience/click.d.ts +5 -0
- package/dist/user-event/types/convenience/hover.d.ts +4 -0
- package/dist/user-event/types/convenience/index.d.ts +3 -0
- package/dist/user-event/types/convenience/tab.d.ts +4 -0
- package/dist/user-event/types/ctrl-dom.d.ts +50 -0
- package/dist/user-event/types/document/UI.d.ts +35 -0
- package/dist/user-event/types/document/copySelection.d.ts +2 -0
- package/dist/user-event/types/document/getValueOrTextContent.d.ts +2 -0
- package/dist/user-event/types/document/index.d.ts +5 -0
- package/dist/user-event/types/document/interceptor.d.ts +20 -0
- package/dist/user-event/types/document/patchFocus.d.ts +7 -0
- package/dist/user-event/types/document/prepareDocument.d.ts +2 -0
- package/dist/user-event/types/document/trackValue.d.ts +13 -0
- package/dist/user-event/types/dom-types.d.ts +56 -0
- package/dist/user-event/types/event/behavior/click.d.ts +1 -0
- package/dist/user-event/types/event/behavior/cut.d.ts +1 -0
- package/dist/user-event/types/event/behavior/index.d.ts +8 -0
- package/dist/user-event/types/event/behavior/keydown.d.ts +1 -0
- package/dist/user-event/types/event/behavior/keypress.d.ts +1 -0
- package/dist/user-event/types/event/behavior/keyup.d.ts +1 -0
- package/dist/user-event/types/event/behavior/paste.d.ts +1 -0
- package/dist/user-event/types/event/behavior/registry.d.ts +9 -0
- package/dist/user-event/types/event/createEvent.d.ts +8 -0
- package/dist/user-event/types/event/dispatchEvent.d.ts +6 -0
- package/dist/user-event/types/event/eventMap.d.ts +265 -0
- package/dist/user-event/types/event/focus.d.ts +6 -0
- package/dist/user-event/types/event/index.d.ts +7 -0
- package/dist/user-event/types/event/input.d.ts +3 -0
- package/dist/user-event/types/event/radio.d.ts +5 -0
- package/dist/user-event/types/event/selection/getInputRange.d.ts +6 -0
- package/dist/user-event/types/event/selection/getTargetTypeAndSelection.d.ts +11 -0
- package/dist/user-event/types/event/selection/index.d.ts +15 -0
- package/dist/user-event/types/event/selection/modifySelection.d.ts +9 -0
- package/dist/user-event/types/event/selection/modifySelectionPerMouse.d.ts +8 -0
- package/dist/user-event/types/event/selection/moveSelection.d.ts +5 -0
- package/dist/user-event/types/event/selection/resolveCaretPosition.d.ts +9 -0
- package/dist/user-event/types/event/selection/selectAll.d.ts +6 -0
- package/dist/user-event/types/event/selection/setSelection.d.ts +11 -0
- package/dist/user-event/types/event/selection/setSelectionPerMouse.d.ts +9 -0
- package/dist/user-event/types/event/selection/setSelectionRange.d.ts +7 -0
- package/dist/user-event/types/event/selection/updateSelectionOnFocus.d.ts +6 -0
- package/dist/user-event/types/event/types.d.ts +21 -0
- package/dist/user-event/types/event/wrapEvent.d.ts +2 -0
- package/dist/user-event/types/index.d.ts +6 -0
- package/dist/user-event/types/keyboard/index.d.ts +3 -0
- package/dist/user-event/types/keyboard/keyMap.d.ts +5 -0
- package/dist/user-event/types/keyboard/parseKeyDef.d.ts +17 -0
- package/dist/user-event/types/options.d.ts +121 -0
- package/dist/user-event/types/pointer/index.d.ts +29 -0
- package/dist/user-event/types/pointer/keyMap.d.ts +2 -0
- package/dist/user-event/types/pointer/parseKeyDef.d.ts +6 -0
- package/dist/user-event/types/setup/api.d.ts +23 -0
- package/dist/user-event/types/setup/directApi.d.ts +25 -0
- package/dist/user-event/types/setup/dtl.d.ts +20 -0
- package/dist/user-event/types/setup/index.d.ts +22 -0
- package/dist/user-event/types/setup/setup.d.ts +45 -0
- package/dist/user-event/types/setup/wrapAsync.d.ts +4 -0
- package/dist/user-event/types/system/index.d.ts +13 -0
- package/dist/user-event/types/system/keyLocation.d.ts +11 -0
- package/dist/user-event/types/system/keyboard.d.ts +46 -0
- package/dist/user-event/types/system/pointer/buttons.d.ts +25 -0
- package/dist/user-event/types/system/pointer/device.d.ts +8 -0
- package/dist/user-event/types/system/pointer/index.d.ts +21 -0
- package/dist/user-event/types/system/pointer/mouse.d.ts +31 -0
- package/dist/user-event/types/system/pointer/pointer.d.ts +32 -0
- package/dist/user-event/types/system/pointer/shared.d.ts +21 -0
- package/dist/user-event/types/utility/clear.d.ts +3 -0
- package/dist/user-event/types/utility/index.d.ts +4 -0
- package/dist/user-event/types/utility/selectOptions.d.ts +4 -0
- package/dist/user-event/types/utility/type.d.ts +10 -0
- package/dist/user-event/types/utility/upload.d.ts +6 -0
- package/dist/user-event/types/utils/click/isClickableInput.d.ts +17 -0
- package/dist/user-event/types/utils/dataTransfer/Blob.d.ts +4 -0
- package/dist/user-event/types/utils/dataTransfer/Clipboard.d.ts +12 -0
- package/dist/user-event/types/utils/dataTransfer/DataTransfer.d.ts +3 -0
- package/dist/user-event/types/utils/dataTransfer/FileList.d.ts +2 -0
- package/dist/user-event/types/utils/edit/isContentEditable.d.ts +8 -0
- package/dist/user-event/types/utils/edit/isEditable.d.ts +26 -0
- package/dist/user-event/types/utils/edit/maxLength.d.ts +16 -0
- package/dist/user-event/types/utils/edit/setFiles.d.ts +11 -0
- package/dist/user-event/types/utils/edit/timeValue.d.ts +5 -0
- package/dist/user-event/types/utils/focus/cursor.d.ts +5 -0
- package/dist/user-event/types/utils/focus/getActiveElement.d.ts +3 -0
- package/dist/user-event/types/utils/focus/getTabDestination.d.ts +2 -0
- package/dist/user-event/types/utils/focus/isFocusable.d.ts +2 -0
- package/dist/user-event/types/utils/focus/selection.d.ts +9 -0
- package/dist/user-event/types/utils/focus/selector.d.ts +1 -0
- package/dist/user-event/types/utils/index.d.ts +29 -0
- package/dist/user-event/types/utils/keyDef/readNextDescriptor.d.ts +21 -0
- package/dist/user-event/types/utils/misc/cloneEvent.d.ts +2 -0
- package/dist/user-event/types/utils/misc/findClosest.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getDocumentFromNode.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getTreeDiff.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getWindow.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isDescendantOrSelf.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isDisabled.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isElementType.d.ts +6 -0
- package/dist/user-event/types/utils/misc/isVisible.d.ts +2 -0
- package/dist/user-event/types/utils/misc/level.d.ts +9 -0
- package/dist/user-event/types/utils/misc/wait.d.ts +6 -0
- package/dist/user-event/types/utils/pointer/cssPointerEvents.d.ts +4 -0
- package/dist/vitest-environment/failure-snapshot.js +42 -0
- package/dist/vitest-environment/index.js +185 -0
- package/dist/vitest-environment/plugin.js +90 -0
- package/dist/vitest-environment/types/failure-snapshot.d.ts +1 -0
- package/dist/vitest-environment/types/index.d.ts +29 -0
- package/dist/vitest-environment/types/plugin.d.ts +33 -0
- package/jest-preset.cjs +17 -0
- package/package.json +177 -3
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
export declare const TK_EOF = 0;
|
|
2
|
+
export declare const TK_IDENT = 1;
|
|
3
|
+
export declare const TK_FUNCTION = 2;
|
|
4
|
+
export declare const TK_AT = 3;
|
|
5
|
+
export declare const TK_HASH = 4;
|
|
6
|
+
export declare const TK_STRING = 5;
|
|
7
|
+
export declare const TK_BAD_STRING = 6;
|
|
8
|
+
export declare const TK_URL = 7;
|
|
9
|
+
export declare const TK_BAD_URL = 8;
|
|
10
|
+
export declare const TK_DELIM = 9;
|
|
11
|
+
export declare const TK_NUMBER = 10;
|
|
12
|
+
export declare const TK_PERCENTAGE = 11;
|
|
13
|
+
export declare const TK_DIMENSION = 12;
|
|
14
|
+
export declare const TK_WS = 13;
|
|
15
|
+
export declare const TK_CDO = 14;
|
|
16
|
+
export declare const TK_CDC = 15;
|
|
17
|
+
export declare const TK_COLON = 16;
|
|
18
|
+
export declare const TK_SEMICOLON = 17;
|
|
19
|
+
export declare const TK_COMMA = 18;
|
|
20
|
+
export declare const TK_LBRACKET = 19;
|
|
21
|
+
export declare const TK_RBRACKET = 20;
|
|
22
|
+
export declare const TK_LPAREN = 21;
|
|
23
|
+
export declare const TK_RPAREN = 22;
|
|
24
|
+
export declare const TK_LBRACE = 23;
|
|
25
|
+
export declare const TK_RBRACE = 24;
|
|
26
|
+
export declare class Token {
|
|
27
|
+
type: number;
|
|
28
|
+
/** Ident/function/at/hash name, string value, delim char, dimension unit. */
|
|
29
|
+
value: string;
|
|
30
|
+
/** Numeric value for number/percentage/dimension. */
|
|
31
|
+
num: number;
|
|
32
|
+
/** Number is an integer (type flag "integer"). */
|
|
33
|
+
isInt: boolean;
|
|
34
|
+
/** Number representation started with "+" or "-". Hash: type flag "id". */
|
|
35
|
+
flag: boolean;
|
|
36
|
+
/** Start offset in the source. */
|
|
37
|
+
start: number;
|
|
38
|
+
constructor(type: number, value: string, start: number);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* CSS tokenizer over a selector string.
|
|
42
|
+
* https://drafts.csswg.org/css-syntax-3/#consume-token
|
|
43
|
+
*
|
|
44
|
+
* Input preprocessing (https://drafts.csswg.org/css-syntax-3/#input-preprocessing) is done
|
|
45
|
+
* lazily: CR/FF/CRLF are treated as newlines and U+0000 becomes U+FFFD when consumed.
|
|
46
|
+
*/
|
|
47
|
+
export declare class Tokenizer {
|
|
48
|
+
src: string;
|
|
49
|
+
pos: number;
|
|
50
|
+
len: number;
|
|
51
|
+
constructor(src: string);
|
|
52
|
+
code(i: number): number;
|
|
53
|
+
/** https://drafts.csswg.org/css-syntax-3/#starts-with-a-valid-escape */
|
|
54
|
+
validEscape(i: number): boolean;
|
|
55
|
+
/** https://drafts.csswg.org/css-syntax-3/#would-start-an-identifier */
|
|
56
|
+
startsIdent(i: number): boolean;
|
|
57
|
+
/** https://drafts.csswg.org/css-syntax-3/#starts-with-a-number */
|
|
58
|
+
startsNumber(i: number): boolean;
|
|
59
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-escaped-code-point (pos is after "\"). */
|
|
60
|
+
consumeEscape(): string;
|
|
61
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-name */
|
|
62
|
+
consumeName(): string;
|
|
63
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-number */
|
|
64
|
+
consumeNumber(tok: Token): void;
|
|
65
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-string-token (pos is after the quote). */
|
|
66
|
+
consumeString(quote: number, start: number): Token;
|
|
67
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-remnants-of-bad-url */
|
|
68
|
+
consumeBadUrl(start: number): Token;
|
|
69
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-url-token */
|
|
70
|
+
consumeUrl(start: number): Token;
|
|
71
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-ident-like-token */
|
|
72
|
+
consumeIdentLike(start: number): Token;
|
|
73
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-numeric-token */
|
|
74
|
+
consumeNumeric(start: number): Token;
|
|
75
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-token (comments are skipped). */
|
|
76
|
+
next(): Token;
|
|
77
|
+
}
|
|
78
|
+
/** Tokenize a whole string (comments dropped). The last token is always TK_EOF. */
|
|
79
|
+
export declare function tokenize(src: string): Token[];
|
|
80
|
+
export declare function asciiLower(s: string): string;
|
|
81
|
+
/** Simple selector kinds. */
|
|
82
|
+
export declare const S_TYPE = 1;
|
|
83
|
+
export declare const S_UNIVERSAL = 2;
|
|
84
|
+
export declare const S_ID = 3;
|
|
85
|
+
export declare const S_CLASS = 4;
|
|
86
|
+
export declare const S_ATTR = 5;
|
|
87
|
+
export declare const S_PSEUDO_CLASS = 6;
|
|
88
|
+
export declare const S_PSEUDO_ELEMENT = 7;
|
|
89
|
+
/** Namespace component of a type/universal/attribute selector. */
|
|
90
|
+
export declare const NS_UNSPECIFIED = 0;
|
|
91
|
+
export declare const NS_ANY = 1;
|
|
92
|
+
export declare const NS_NONE = 2;
|
|
93
|
+
export declare const NS_PREFIX = 3;
|
|
94
|
+
/** Attribute matchers. https://drafts.csswg.org/selectors-4/#attribute-selectors */
|
|
95
|
+
export declare const OP_EXISTS = 0;
|
|
96
|
+
export declare const OP_EQUALS = 1;
|
|
97
|
+
export declare const OP_INCLUDES = 2;
|
|
98
|
+
export declare const OP_DASH = 3;
|
|
99
|
+
export declare const OP_PREFIX = 4;
|
|
100
|
+
export declare const OP_SUFFIX = 5;
|
|
101
|
+
export declare const OP_SUBSTRING = 6;
|
|
102
|
+
/** Attribute case flag. */
|
|
103
|
+
export declare const CASE_DEFAULT = 0;
|
|
104
|
+
export declare const CASE_INSENSITIVE = 1;
|
|
105
|
+
export declare const CASE_SENSITIVE = 2;
|
|
106
|
+
/** Combinators. */
|
|
107
|
+
export declare const C_NONE = 0;
|
|
108
|
+
export declare const C_DESCENDANT = 1;
|
|
109
|
+
export declare const C_CHILD = 2;
|
|
110
|
+
export declare const C_NEXT_SIBLING = 3;
|
|
111
|
+
export declare const C_SUBSEQUENT_SIBLING = 4;
|
|
112
|
+
export declare const P_UNKNOWN = 0;
|
|
113
|
+
export declare const P_IS = 1;
|
|
114
|
+
export declare const P_WHERE = 2;
|
|
115
|
+
export declare const P_NOT = 3;
|
|
116
|
+
export declare const P_HAS = 4;
|
|
117
|
+
export declare const P_NTH_CHILD = 5;
|
|
118
|
+
export declare const P_NTH_LAST_CHILD = 6;
|
|
119
|
+
export declare const P_NTH_OF_TYPE = 7;
|
|
120
|
+
export declare const P_NTH_LAST_OF_TYPE = 8;
|
|
121
|
+
export declare const P_HOST_FN = 9;
|
|
122
|
+
export declare const P_HOST_CONTEXT = 10;
|
|
123
|
+
export declare const P_LANG = 11;
|
|
124
|
+
export declare const P_DIR = 12;
|
|
125
|
+
export declare const P_STATE = 13;
|
|
126
|
+
export declare const P_FIRST_CHILD = 20;
|
|
127
|
+
export declare const P_LAST_CHILD = 21;
|
|
128
|
+
export declare const P_ONLY_CHILD = 22;
|
|
129
|
+
export declare const P_FIRST_OF_TYPE = 23;
|
|
130
|
+
export declare const P_LAST_OF_TYPE = 24;
|
|
131
|
+
export declare const P_ONLY_OF_TYPE = 25;
|
|
132
|
+
export declare const P_EMPTY = 26;
|
|
133
|
+
export declare const P_ROOT = 27;
|
|
134
|
+
export declare const P_SCOPE = 28;
|
|
135
|
+
export declare const P_HOST = 29;
|
|
136
|
+
export declare const P_LINK = 30;
|
|
137
|
+
export declare const P_ANY_LINK = 31;
|
|
138
|
+
export declare const P_VISITED = 32;
|
|
139
|
+
export declare const P_LOCAL_LINK = 33;
|
|
140
|
+
export declare const P_TARGET = 34;
|
|
141
|
+
export declare const P_TARGET_WITHIN = 35;
|
|
142
|
+
export declare const P_DEFINED = 36;
|
|
143
|
+
export declare const P_HOVER = 37;
|
|
144
|
+
export declare const P_ACTIVE = 38;
|
|
145
|
+
export declare const P_FOCUS = 39;
|
|
146
|
+
export declare const P_FOCUS_WITHIN = 40;
|
|
147
|
+
export declare const P_FOCUS_VISIBLE = 41;
|
|
148
|
+
export declare const P_CHECKED = 50;
|
|
149
|
+
export declare const P_INDETERMINATE = 51;
|
|
150
|
+
export declare const P_DEFAULT = 52;
|
|
151
|
+
export declare const P_DISABLED = 53;
|
|
152
|
+
export declare const P_ENABLED = 54;
|
|
153
|
+
export declare const P_REQUIRED = 55;
|
|
154
|
+
export declare const P_OPTIONAL = 56;
|
|
155
|
+
export declare const P_READ_ONLY = 57;
|
|
156
|
+
export declare const P_READ_WRITE = 58;
|
|
157
|
+
export declare const P_PLACEHOLDER_SHOWN = 59;
|
|
158
|
+
export declare const P_VALID = 60;
|
|
159
|
+
export declare const P_INVALID = 61;
|
|
160
|
+
export declare const P_IN_RANGE = 62;
|
|
161
|
+
export declare const P_OUT_OF_RANGE = 63;
|
|
162
|
+
export declare const P_USER_VALID = 64;
|
|
163
|
+
export declare const P_USER_INVALID = 65;
|
|
164
|
+
export declare const P_AUTOFILL = 66;
|
|
165
|
+
export declare const P_BLANK = 67;
|
|
166
|
+
export declare const P_OPEN = 70;
|
|
167
|
+
export declare const P_CLOSED = 71;
|
|
168
|
+
export declare const P_POPOVER_OPEN = 72;
|
|
169
|
+
export declare const P_MODAL = 73;
|
|
170
|
+
export declare const P_FULLSCREEN = 74;
|
|
171
|
+
export declare const P_PICTURE_IN_PICTURE = 75;
|
|
172
|
+
export declare const P_PLAYING = 76;
|
|
173
|
+
export declare const P_PAUSED = 77;
|
|
174
|
+
export declare const P_MUTED = 78;
|
|
175
|
+
export declare const P_SEEKING = 79;
|
|
176
|
+
export declare const P_BUFFERING = 80;
|
|
177
|
+
export declare const P_STALLED = 81;
|
|
178
|
+
export declare const P_VOLUME_LOCKED = 82;
|
|
179
|
+
export declare const P_CURRENT = 83;
|
|
180
|
+
export declare const P_PAST = 84;
|
|
181
|
+
export declare const P_FUTURE = 85;
|
|
182
|
+
export declare const P_HAS_SLOTTED = 86;
|
|
183
|
+
export declare const P_TARGET_CURRENT = 87;
|
|
184
|
+
export declare const P_HEADING = 88;
|
|
185
|
+
export declare const PE_OTHER = 1;
|
|
186
|
+
export declare const PE_SLOTTED = 2;
|
|
187
|
+
export declare const PE_PART = 3;
|
|
188
|
+
export declare const PE_FUNCTION = 4;
|
|
189
|
+
/**
|
|
190
|
+
* One simple selector (or pseudo-element). A single class for every kind keeps the AST
|
|
191
|
+
* monomorphic.
|
|
192
|
+
*/
|
|
193
|
+
export declare class Simple {
|
|
194
|
+
kind: number;
|
|
195
|
+
/** Type/attribute local name (case preserved), id, class name, or lowercased pseudo name. */
|
|
196
|
+
name: string;
|
|
197
|
+
nsKind: number;
|
|
198
|
+
nsPrefix: string;
|
|
199
|
+
/** Attribute matcher (OP_*). */
|
|
200
|
+
op: number;
|
|
201
|
+
/** Attribute value. */
|
|
202
|
+
value: string;
|
|
203
|
+
/** Attribute case flag (CASE_*). */
|
|
204
|
+
caseFlag: number;
|
|
205
|
+
/** Pseudo-class id (P_*) or pseudo-element id (PE_*). */
|
|
206
|
+
pseudo: number;
|
|
207
|
+
/** An+B. */
|
|
208
|
+
a: number;
|
|
209
|
+
b: number;
|
|
210
|
+
/** Selector argument (:is/:where/:not/:has/:nth-*(of S)/:host()/::slotted()); null when absent. */
|
|
211
|
+
list: SelectorList | null;
|
|
212
|
+
/** Identifier/string arguments (:lang, :dir, :state, ::part, ::highlight). */
|
|
213
|
+
args: string[];
|
|
214
|
+
constructor(kind: number, name: string);
|
|
215
|
+
}
|
|
216
|
+
/** https://drafts.csswg.org/selectors-4/#compound */
|
|
217
|
+
export declare class Compound {
|
|
218
|
+
/** Type selector first (if any), then subclass selectors, then pseudo-elements and the pseudo-classes following them, in source order. */
|
|
219
|
+
simples: Simple[];
|
|
220
|
+
/** Index of the first pseudo-element in `simples`, or -1. */
|
|
221
|
+
pseudoElementIndex: number;
|
|
222
|
+
constructor();
|
|
223
|
+
}
|
|
224
|
+
/** https://drafts.csswg.org/selectors-4/#complex (and relative selectors for :has). */
|
|
225
|
+
export declare class Complex {
|
|
226
|
+
compounds: Compound[];
|
|
227
|
+
/** combinators[i] joins compounds[i] and compounds[i + 1]. */
|
|
228
|
+
combinators: number[];
|
|
229
|
+
/** Leading combinator of a relative selector (C_NONE when absent). */
|
|
230
|
+
leading: number;
|
|
231
|
+
/** Source text (trimmed) of this complex selector. */
|
|
232
|
+
text: string;
|
|
233
|
+
/**
|
|
234
|
+
* An item of a forgiving selector list (:is/:where) that failed to parse. It matches nothing
|
|
235
|
+
* but keeps its source text for serialization (https://drafts.csswg.org/selectors-4/#forgiving-selector).
|
|
236
|
+
*/
|
|
237
|
+
invalid: boolean;
|
|
238
|
+
constructor();
|
|
239
|
+
}
|
|
240
|
+
export declare class SelectorList {
|
|
241
|
+
items: Complex[];
|
|
242
|
+
constructor();
|
|
243
|
+
}
|
|
244
|
+
/** Non-functional pseudo-class name (lowercased) → id, or P_UNKNOWN. */
|
|
245
|
+
export declare function pseudoClassId(name: string): number;
|
|
246
|
+
/** Functional pseudo-class name (lowercased) → id, or P_UNKNOWN. */
|
|
247
|
+
export declare function functionalPseudoClassId(name: string): number;
|
|
248
|
+
/**
|
|
249
|
+
* Recursive-descent parser over the token array.
|
|
250
|
+
* https://drafts.csswg.org/selectors-4/#parse-selector
|
|
251
|
+
*/
|
|
252
|
+
export declare class SelectorParser {
|
|
253
|
+
src: string;
|
|
254
|
+
toks: Token[];
|
|
255
|
+
i: number;
|
|
256
|
+
/** Set when parsing failed; a human-readable reason (for debugging; DOM messages use the selector text). */
|
|
257
|
+
error: string;
|
|
258
|
+
constructor(src: string);
|
|
259
|
+
fail(reason: string): void;
|
|
260
|
+
peek(): Token;
|
|
261
|
+
peekType(): number;
|
|
262
|
+
isDelim(ch: string): boolean;
|
|
263
|
+
isDelimAt(i: number, ch: string): boolean;
|
|
264
|
+
skipWs(): void;
|
|
265
|
+
/** Accept a closing token, or EOF (blocks are implicitly closed at EOF per css-syntax). */
|
|
266
|
+
expectClose(type: number): boolean;
|
|
267
|
+
/** <selector-list> at top level (querySelector / style rules). */
|
|
268
|
+
parseSelectorList(): SelectorList | null;
|
|
269
|
+
/** <relative-selector-list> at top level (e.g. for @scope/nesting consumers). */
|
|
270
|
+
parseRelativeSelectorList(): SelectorList | null;
|
|
271
|
+
/** Comma-separated complex (or relative) selectors; stops before `)` or EOF. Unforgiving. */
|
|
272
|
+
parseComplexList(ctx: number, relative: boolean): SelectorList | null;
|
|
273
|
+
/**
|
|
274
|
+
* Forgiving selector list (:is/:where): invalid items are dropped.
|
|
275
|
+
* https://drafts.csswg.org/selectors-4/#forgiving-selector
|
|
276
|
+
*/
|
|
277
|
+
parseForgivingList(ctx: number): SelectorList;
|
|
278
|
+
/** Skip a component value sequence up to (not including) a top-level `,` or `)`. */
|
|
279
|
+
skipToTopLevelCommaOrClose(): boolean;
|
|
280
|
+
/** Reads a combinator at the current position (after optional whitespace); C_NONE if none. Returns C_DESCENDANT for bare whitespace. */
|
|
281
|
+
parseCombinator(): number;
|
|
282
|
+
/** https://drafts.csswg.org/selectors-4/#typedef-complex-selector (and relative-selector). */
|
|
283
|
+
parseComplex(ctx: number, relative: boolean): Complex | null;
|
|
284
|
+
/** <ns-prefix>? (ident | '*'): returns false if no type selector is present. */
|
|
285
|
+
parseTypeSelector(compound: Compound): boolean;
|
|
286
|
+
/** https://drafts.csswg.org/selectors-4/#typedef-compound-selector */
|
|
287
|
+
parseCompound(ctx: number): Compound | null;
|
|
288
|
+
lastPseudoElement(compound: Compound): number;
|
|
289
|
+
/** ::part() may be followed by other pseudo-elements; ::slotted() by ::before/::after/::marker etc. */
|
|
290
|
+
chainablePseudoElement(compound: Compound, pe: Simple): boolean;
|
|
291
|
+
/** https://drafts.csswg.org/selectors-4/#attribute-selectors (after `[`). */
|
|
292
|
+
parseAttribute(): Simple | null;
|
|
293
|
+
/** After `:`. Returns a pseudo-class, or a pseudo-element for legacy `:before` etc. */
|
|
294
|
+
parsePseudoClass(ctx: number): Simple | null;
|
|
295
|
+
parsePseudoClassArgs(s: Simple, ctx: number): boolean;
|
|
296
|
+
/** After `::`. */
|
|
297
|
+
parsePseudoElement(ctx: number): Simple | null;
|
|
298
|
+
/**
|
|
299
|
+
* https://drafts.csswg.org/css-syntax-3/#anb-microsyntax
|
|
300
|
+
* Consumes tokens for <an+b> starting at the current position.
|
|
301
|
+
*/
|
|
302
|
+
parseAnPlusB(s: Simple): boolean;
|
|
303
|
+
/** Clamp A and B to the 32-bit integer range, as engines do (WPT nth-child-large-anplusb-clamp). */
|
|
304
|
+
clampAnb(s: Simple): void;
|
|
305
|
+
anbFail(): boolean;
|
|
306
|
+
}
|
|
307
|
+
/** Parse a selector list; returns null (with `parser.error` set) when invalid. */
|
|
308
|
+
export declare function parseSelectorList(src: string): SelectorList | null;
|
|
309
|
+
/** Like `parseSelectorList` but returns the failure reason ("" on success). */
|
|
310
|
+
export declare function selectorError(src: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Complex, type Compound, type SelectorList } from "./parser.js";
|
|
2
|
+
/** https://drafts.csswg.org/cssom/#serialize-an-identifier */
|
|
3
|
+
export declare function serializeIdentifier(s: string): string;
|
|
4
|
+
/** https://drafts.csswg.org/cssom/#serialize-a-string */
|
|
5
|
+
export declare function serializeString(s: string): string;
|
|
6
|
+
/** https://drafts.csswg.org/css-syntax-3/#serializing-anb */
|
|
7
|
+
export declare function serializeAnPlusB(a: number, b: number): string;
|
|
8
|
+
/** @namespace context of the style sheet whose selector is being serialized (null: none declared). */
|
|
9
|
+
export interface NamespaceContext {
|
|
10
|
+
namespaces?: ReadonlyMap<string, string | null>;
|
|
11
|
+
defaultNamespace?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** Run `fn` with a style sheet's @namespace context for type/universal selector serialization. */
|
|
14
|
+
export declare function withNamespaceContext<T>(ctx: NamespaceContext | null | undefined, fn: () => T): T;
|
|
15
|
+
/** https://drafts.csswg.org/cssom/#serialize-a-simple-selector (compound: universal omitted when other simples follow). */
|
|
16
|
+
export declare function serializeCompound(c: Compound): string;
|
|
17
|
+
/** https://drafts.csswg.org/cssom/#serialize-a-selector */
|
|
18
|
+
export declare function serializeComplex(cx: Complex): string;
|
|
19
|
+
/** https://drafts.csswg.org/cssom/#serialize-a-group-of-selectors */
|
|
20
|
+
export declare function serializeSelectorList(list: SelectorList): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
|
+
export type Predicate = (el: NodeImpl) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Pointer state set by user-event / html-elements. `:hover` and `:active` match the target and
|
|
5
|
+
* its flat-tree ancestors (https://drafts.csswg.org/selectors-4/#the-hover-pseudo). There is no
|
|
6
|
+
* pointer by default, so they match nothing (as in jsdom).
|
|
7
|
+
*/
|
|
8
|
+
export declare const interaction: {
|
|
9
|
+
hovered: NodeImpl | null;
|
|
10
|
+
active: NodeImpl | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function setHoverTarget(el: NodeImpl | null): void;
|
|
13
|
+
export declare function setActiveTarget(el: NodeImpl | null): void;
|
|
14
|
+
/** Host element of a shadow root impl, or null. */
|
|
15
|
+
export declare function shadowHost(sr: NodeImpl): NodeImpl | null;
|
|
16
|
+
/** Parent in the flat tree approximation: parent element, or the host of a shadow root. */
|
|
17
|
+
export declare function parentOrHost(n: NodeImpl): NodeImpl | null;
|
|
18
|
+
/** https://html.spec.whatwg.org/#attr-input-type (lowercased keyword, "text" for missing/invalid). */
|
|
19
|
+
export declare function inputTypeName(el: NodeImpl): string;
|
|
20
|
+
/** :state(x) — https://html.spec.whatwg.org/#selector-custom (ElementInternals.states). */
|
|
21
|
+
export declare function customState(el: NodeImpl, name: string): boolean;
|
|
22
|
+
/** https://html.spec.whatwg.org/#custom-state-pseudo-class — the element's CustomStateSet (installed by ./html-predicates.ts). */
|
|
23
|
+
export declare const customStates: {
|
|
24
|
+
of: (_el: NodeImpl) => Set<string> | null;
|
|
25
|
+
};
|
|
26
|
+
/** https://html.spec.whatwg.org/#language — inclusive ancestors' xml:lang / lang, else "unknown" (null). */
|
|
27
|
+
export declare function elementLanguage(el: NodeImpl): string | null;
|
|
28
|
+
/** RFC 4647 §3.3.2 extended filtering, as used by https://drafts.csswg.org/selectors-4/#the-lang-pseudo */
|
|
29
|
+
export declare function extendedFilter(range: string, tag: string): boolean;
|
|
30
|
+
export declare function matchesLang(el: NodeImpl, ranges: string[]): boolean;
|
|
31
|
+
/** https://html.spec.whatwg.org/#the-directionality — 1 = ltr, 2 = rtl. */
|
|
32
|
+
export declare function directionality(el: NodeImpl): number;
|
|
33
|
+
/**
|
|
34
|
+
* Predicates by pseudo-class name. The compiler reads `predicates[name]` at compile time and
|
|
35
|
+
* captures the function, so registering after a selector was compiled affects only new
|
|
36
|
+
* compilations (call `clearSelectorCaches()` after registering if that matters).
|
|
37
|
+
*/
|
|
38
|
+
export declare const predicates: Record<string, Predicate>;
|
|
39
|
+
/**
|
|
40
|
+
* Replace the predicate for an element-state pseudo-class (e.g. html-forms registers `checked`,
|
|
41
|
+
* html-elements registers `focus`, `popover-open`, `defined`). Name without the colon.
|
|
42
|
+
*/
|
|
43
|
+
export declare function setPseudoClassPredicate(name: string, fn: Predicate): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
|
+
/** https://html.spec.whatwg.org/#escapingString (non-attribute mode). */
|
|
3
|
+
export declare function escapeText(s: string): string;
|
|
4
|
+
/** https://html.spec.whatwg.org/#escapingString (attribute mode). */
|
|
5
|
+
export declare function escapeAttribute(s: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* innerHTML getter: https://html.spec.whatwg.org/#fragment-serializing-algorithm-steps with
|
|
8
|
+
* require well-formed = true (HTML serialization in HTML documents, XML otherwise).
|
|
9
|
+
*/
|
|
10
|
+
export declare function serializeChildren(node: NodeImpl): string;
|
|
11
|
+
/** outerHTML getter: the fragment serializing algorithm on a fictional parent of `node`. */
|
|
12
|
+
export declare function serializeNode(node: NodeImpl): string;
|
|
13
|
+
export interface GetHTMLOptions {
|
|
14
|
+
serializableShadowRoots?: boolean;
|
|
15
|
+
shadowRoots?: readonly unknown[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Element.getHTML() / ShadowRoot.getHTML(): https://html.spec.whatwg.org/#dom-element-gethtml
|
|
19
|
+
* (always the HTML fragment serialization algorithm). `shadowRoots` holds ShadowRoot wrappers.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getHTML(node: NodeImpl, options?: GetHTMLOptions): string;
|
|
22
|
+
/** HTML fragment serialization of `node`'s children, regardless of the document type. */
|
|
23
|
+
export declare function serializeHTMLChildren(node: NodeImpl): string;
|
|
24
|
+
/**
|
|
25
|
+
* https://w3c.github.io/DOM-Parsing/#dfn-concept-serialize-xml — throws an
|
|
26
|
+
* "InvalidStateError" DOMException when `requireWellFormed` and the node cannot be serialized.
|
|
27
|
+
* XMLSerializer.serializeToString passes false.
|
|
28
|
+
*/
|
|
29
|
+
export declare function serializeXML(node: NodeImpl, requireWellFormed: boolean): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as diagnosticsChannel from "node:diagnostics_channel";
|
|
2
|
+
/** The context object a span's start/end/asyncStart/asyncEnd/error events carry. */
|
|
3
|
+
export interface SpanContext {
|
|
4
|
+
/** Sentry-style operation: "testing-library.query", "user-event.click", "react.render", ... */
|
|
5
|
+
op: string;
|
|
6
|
+
/** What ran, as the test wrote it: `getByRole("button", { name: "Save" })`. */
|
|
7
|
+
description: string;
|
|
8
|
+
/**
|
|
9
|
+
* Filled in by the traced code before the span ends (match counts, waitFor checks), and with
|
|
10
|
+
* `clock.skipped_ms` when the virtual clock skipped idle time during it.
|
|
11
|
+
*/
|
|
12
|
+
data: Record<string, string | number | boolean>;
|
|
13
|
+
/** True for promise-returning work: the span ends at asyncEnd rather than end. */
|
|
14
|
+
async: boolean;
|
|
15
|
+
/** Set by the tracing channel when the traced function throws or rejects. */
|
|
16
|
+
error?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare const SPAN_CHANNEL = "ctrl-dom:span";
|
|
19
|
+
type Channel = diagnosticsChannel.TracingChannel<SpanContext, SpanContext>;
|
|
20
|
+
/** The tracing channel, for subscribers. Null where the runtime has none. */
|
|
21
|
+
export declare function spanChannel(): Channel | null;
|
|
22
|
+
/** Whether a span would be recorded: check this before formatting a description. */
|
|
23
|
+
export declare function tracing(): boolean;
|
|
24
|
+
/** Run `fn` as a span. Call only when `tracing()` is true. */
|
|
25
|
+
export declare function traceSync<T>(op: string, description: string, fn: (span: SpanContext) => T): T;
|
|
26
|
+
/** Run promise-returning `fn` as a span that ends when the promise settles. Call only when `tracing()` is true. */
|
|
27
|
+
export declare function tracePromise<T>(op: string, description: string, fn: (span: SpanContext) => Promise<T>): Promise<T>;
|
|
28
|
+
/** `name(arg, arg, ...)` with each argument short and readable, for a span description. */
|
|
29
|
+
export declare function describeCall(name: string, args: readonly unknown[]): string;
|
|
30
|
+
/**
|
|
31
|
+
* Lets a higher layer name elements in span descriptions: @ctrl/dom/aria registers role and accessible
|
|
32
|
+
* name (`button "Save"`), the way queries find them. Called only while tracing.
|
|
33
|
+
*/
|
|
34
|
+
export declare function setNodeDescriber(describer: ((node: unknown) => string | null) | null): void;
|
|
35
|
+
/** An element as a span description shows it: `button "Save"` (see setNodeDescriber), else `<input "Email">`. */
|
|
36
|
+
export declare function describeNode(node: unknown): string;
|
|
37
|
+
/** A short JSON string: names and labels in descriptions stay under ~40 characters. */
|
|
38
|
+
export declare function quote(text: string): string;
|
|
39
|
+
export declare const FAILURE_CHANNEL = "sentry-tests:failure";
|
|
40
|
+
/**
|
|
41
|
+
* Lets a higher layer describe the page of a failed test: @ctrl/dom/testing-library registers its
|
|
42
|
+
* accessibility snapshot. Called only when a test fails with @ctrl/sentry-tests reporting.
|
|
43
|
+
*/
|
|
44
|
+
export declare function setFailureSnapshot(snapshot: ((body: unknown) => string) | null): void;
|
|
45
|
+
/**
|
|
46
|
+
* While an environment runs, add the page's accessibility snapshot and the virtual clock to the
|
|
47
|
+
* failures @ctrl/sentry-tests reports from it (only those of `getDocument()`'s document: another
|
|
48
|
+
* environment's subscriber may be listening in the same process). Returns the unsubscribe.
|
|
49
|
+
*/
|
|
50
|
+
export declare function subscribeTestFailures(getDocument: () => unknown): () => void;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { Document } from "../nodes/Document.js";
|
|
2
|
+
import type { DocumentFragment } from "../nodes/DocumentFragment.js";
|
|
3
|
+
import type { Node } from "../nodes/Node.js";
|
|
4
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
5
|
+
import { DOMRect, DOMRectList } from "../window/geometry.js";
|
|
6
|
+
import { $ec, $eo, $home, $sc, $so } from "../keys.js";
|
|
7
|
+
export declare const START_TO_START = 0;
|
|
8
|
+
export declare const START_TO_END = 1;
|
|
9
|
+
export declare const END_TO_END = 2;
|
|
10
|
+
export declare const END_TO_START = 3;
|
|
11
|
+
/** https://dom.spec.whatwg.org/#concept-node-length */
|
|
12
|
+
export declare function nodeLength(n: NodeImpl): number;
|
|
13
|
+
/**
|
|
14
|
+
* Position of boundary point (a, oa) relative to (b, ob): -1 before, 0 equal, 1 after.
|
|
15
|
+
* https://dom.spec.whatwg.org/#concept-range-bp-position — computed from the two ancestor
|
|
16
|
+
* chains (O(depth)) rather than by scanning tree order. The points must share a root.
|
|
17
|
+
*/
|
|
18
|
+
export declare function compareBoundaryPoints(a: NodeImpl, oa: number, b: NodeImpl, ob: number): number;
|
|
19
|
+
/** https://dom.spec.whatwg.org/#interface-abstractrange */
|
|
20
|
+
export declare abstract class AbstractRange {
|
|
21
|
+
/** @internal start container / offset, end container / offset */
|
|
22
|
+
[$sc]: NodeImpl;
|
|
23
|
+
[$so]: number;
|
|
24
|
+
[$ec]: NodeImpl;
|
|
25
|
+
[$eo]: number;
|
|
26
|
+
/** @internal live.ts bookkeeping (null for StaticRange). */
|
|
27
|
+
[$home]: object | null;
|
|
28
|
+
constructor(sc: NodeImpl, so: number, ec: NodeImpl, eo: number);
|
|
29
|
+
get startContainer(): Node;
|
|
30
|
+
get startOffset(): number;
|
|
31
|
+
get endContainer(): Node;
|
|
32
|
+
get endOffset(): number;
|
|
33
|
+
/** https://dom.spec.whatwg.org/#range-collapsed */
|
|
34
|
+
get collapsed(): boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface StaticRangeInit {
|
|
37
|
+
startContainer: Node;
|
|
38
|
+
startOffset: number;
|
|
39
|
+
endContainer: Node;
|
|
40
|
+
endOffset: number;
|
|
41
|
+
}
|
|
42
|
+
/** https://dom.spec.whatwg.org/#interface-staticrange */
|
|
43
|
+
export declare class StaticRange extends AbstractRange {
|
|
44
|
+
constructor(init: StaticRangeInit);
|
|
45
|
+
}
|
|
46
|
+
/** https://dom.spec.whatwg.org/#interface-range */
|
|
47
|
+
export declare class Range extends AbstractRange {
|
|
48
|
+
static readonly START_TO_START = 0;
|
|
49
|
+
static readonly START_TO_END = 1;
|
|
50
|
+
static readonly END_TO_END = 2;
|
|
51
|
+
static readonly END_TO_START = 3;
|
|
52
|
+
readonly START_TO_START: number;
|
|
53
|
+
readonly START_TO_END: number;
|
|
54
|
+
readonly END_TO_END: number;
|
|
55
|
+
readonly END_TO_START: number;
|
|
56
|
+
/** https://dom.spec.whatwg.org/#dom-range-range */
|
|
57
|
+
constructor(doc?: Document);
|
|
58
|
+
/** @internal Create a live range in `doc` with the given boundary points. */
|
|
59
|
+
static _create(doc: Document, sc: NodeImpl, so: number, ec: NodeImpl, eo: number): Range;
|
|
60
|
+
/** https://dom.spec.whatwg.org/#concept-range-root */
|
|
61
|
+
_treeRoot(): NodeImpl;
|
|
62
|
+
/** https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer */
|
|
63
|
+
get commonAncestorContainer(): Node;
|
|
64
|
+
/** https://dom.spec.whatwg.org/#concept-range-bp-set */
|
|
65
|
+
_setStart(node: NodeImpl, offset: number): void;
|
|
66
|
+
_setEnd(node: NodeImpl, offset: number): void;
|
|
67
|
+
setStart(node: Node, offset: number): void;
|
|
68
|
+
setEnd(node: Node, offset: number): void;
|
|
69
|
+
setStartBefore(node: Node): void;
|
|
70
|
+
setStartAfter(node: Node): void;
|
|
71
|
+
setEndBefore(node: Node): void;
|
|
72
|
+
setEndAfter(node: Node): void;
|
|
73
|
+
/** https://dom.spec.whatwg.org/#dom-range-collapse */
|
|
74
|
+
collapse(toStart?: boolean): void;
|
|
75
|
+
/** https://dom.spec.whatwg.org/#concept-range-select */
|
|
76
|
+
_select(n: NodeImpl): void;
|
|
77
|
+
selectNode(node: Node): void;
|
|
78
|
+
/** https://dom.spec.whatwg.org/#dom-range-selectnodecontents */
|
|
79
|
+
_selectContents(n: NodeImpl): void;
|
|
80
|
+
selectNodeContents(node: Node): void;
|
|
81
|
+
/** https://dom.spec.whatwg.org/#dom-range-compareboundarypoints */
|
|
82
|
+
compareBoundaryPoints(how: number, sourceRange: Range): number;
|
|
83
|
+
/** https://dom.spec.whatwg.org/#contained */
|
|
84
|
+
_contains(n: NodeImpl): boolean;
|
|
85
|
+
/** https://dom.spec.whatwg.org/#dom-range-deletecontents */
|
|
86
|
+
deleteContents(): void;
|
|
87
|
+
/** https://dom.spec.whatwg.org/#dom-range-extractcontents */
|
|
88
|
+
extractContents(): DocumentFragment;
|
|
89
|
+
/** https://dom.spec.whatwg.org/#dom-range-clonecontents */
|
|
90
|
+
cloneContents(): DocumentFragment;
|
|
91
|
+
/** https://dom.spec.whatwg.org/#dom-range-insertnode */
|
|
92
|
+
insertNode(node: Node): void;
|
|
93
|
+
/** https://dom.spec.whatwg.org/#dom-range-surroundcontents */
|
|
94
|
+
surroundContents(newParent: Node): void;
|
|
95
|
+
/** https://dom.spec.whatwg.org/#dom-range-clonerange */
|
|
96
|
+
cloneRange(): Range;
|
|
97
|
+
/** https://dom.spec.whatwg.org/#dom-range-detach — does nothing. */
|
|
98
|
+
detach(): void;
|
|
99
|
+
/** https://dom.spec.whatwg.org/#dom-range-ispointinrange */
|
|
100
|
+
isPointInRange(node: Node, offset: number): boolean;
|
|
101
|
+
/** https://dom.spec.whatwg.org/#dom-range-comparepoint */
|
|
102
|
+
comparePoint(node: Node, offset: number): number;
|
|
103
|
+
/** https://dom.spec.whatwg.org/#dom-range-intersectsnode */
|
|
104
|
+
intersectsNode(node: Node): boolean;
|
|
105
|
+
/** https://dom.spec.whatwg.org/#dom-range-stringifier */
|
|
106
|
+
toString(): string;
|
|
107
|
+
/** https://html.spec.whatwg.org/#dom-range-createcontextualfragment */
|
|
108
|
+
createContextualFragment(fragment: string): DocumentFragment;
|
|
109
|
+
/** CSSOM View: no layout, so always an empty list. */
|
|
110
|
+
getClientRects(): DOMRectList;
|
|
111
|
+
/** CSSOM View: no layout, so always a zero rect. */
|
|
112
|
+
getBoundingClientRect(): DOMRect;
|
|
113
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Document } from "../nodes/Document.js";
|
|
2
|
+
import type { Node } from "../nodes/Node.js";
|
|
3
|
+
import { Range, StaticRange } from "./Range.js";
|
|
4
|
+
export declare class Selection {
|
|
5
|
+
#private;
|
|
6
|
+
/** @internal Use document.getSelection(). */
|
|
7
|
+
constructor(doc: Document);
|
|
8
|
+
get anchorNode(): Node | null;
|
|
9
|
+
get anchorOffset(): number;
|
|
10
|
+
get focusNode(): Node | null;
|
|
11
|
+
get focusOffset(): number;
|
|
12
|
+
get isCollapsed(): boolean;
|
|
13
|
+
get rangeCount(): number;
|
|
14
|
+
get type(): string;
|
|
15
|
+
/** https://w3c.github.io/selection-api/#dom-selection-direction */
|
|
16
|
+
get direction(): string;
|
|
17
|
+
/** https://w3c.github.io/selection-api/#dom-selection-getrangeat */
|
|
18
|
+
getRangeAt(index: number): Range;
|
|
19
|
+
/** https://w3c.github.io/selection-api/#dom-selection-addrange */
|
|
20
|
+
addRange(range: Range): void;
|
|
21
|
+
/** https://w3c.github.io/selection-api/#dom-selection-removerange */
|
|
22
|
+
removeRange(range: Range): void;
|
|
23
|
+
removeAllRanges(): void;
|
|
24
|
+
empty(): void;
|
|
25
|
+
/** https://w3c.github.io/selection-api/#dom-selection-collapse */
|
|
26
|
+
collapse(node: Node | null, offset?: number): void;
|
|
27
|
+
setPosition(node: Node | null, offset?: number): void;
|
|
28
|
+
collapseToStart(): void;
|
|
29
|
+
collapseToEnd(): void;
|
|
30
|
+
/** https://w3c.github.io/selection-api/#dom-selection-extend */
|
|
31
|
+
extend(node: Node, offset?: number): void;
|
|
32
|
+
/** https://w3c.github.io/selection-api/#dom-selection-setbaseandextent */
|
|
33
|
+
setBaseAndExtent(anchorNode: Node, anchorOffset: number, focusNode: Node, focusOffset: number): void;
|
|
34
|
+
/** https://w3c.github.io/selection-api/#dom-selection-selectallchildren */
|
|
35
|
+
selectAllChildren(node: Node): void;
|
|
36
|
+
/** https://w3c.github.io/selection-api/#dom-selection-deletefromdocument */
|
|
37
|
+
deleteFromDocument(): void;
|
|
38
|
+
/** https://w3c.github.io/selection-api/#dom-selection-containsnode */
|
|
39
|
+
containsNode(node: Node, allowPartialContainment?: boolean): boolean;
|
|
40
|
+
/** https://w3c.github.io/selection-api/#dom-selection-getcomposedranges (no shadow root reparenting) */
|
|
41
|
+
getComposedRanges(..._args: unknown[]): StaticRange[];
|
|
42
|
+
/** No layout: https://w3c.github.io/selection-api/#dom-selection-modify is a no-op. */
|
|
43
|
+
modify(_alter?: string, _direction?: string, _granularity?: string): void;
|
|
44
|
+
toString(): string;
|
|
45
|
+
}
|