@ctrl/dom 0.0.0-stage → 0.1.1
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-Hv_BAHIV.js +47537 -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 +163 -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 +3923 -0
- package/dist/user-event/index.js +3898 -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 +55 -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 +178 -4
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { Tokenizer } from "./tokenizer.js";
|
|
2
|
+
export declare const NS_HTML = 0;
|
|
3
|
+
export declare const NS_SVG = 1;
|
|
4
|
+
export declare const NS_MATHML = 2;
|
|
5
|
+
/** The fragment context element's namespace when it is none of the above (sink-defined). */
|
|
6
|
+
export declare const NS_OTHER = 3;
|
|
7
|
+
export declare const ANS_NONE = 0;
|
|
8
|
+
export declare const ANS_XLINK = 1;
|
|
9
|
+
export declare const ANS_XML = 2;
|
|
10
|
+
export declare const ANS_XMLNS = 3;
|
|
11
|
+
export declare const MODE_NO_QUIRKS = 0;
|
|
12
|
+
export declare const MODE_QUIRKS = 1;
|
|
13
|
+
export declare const MODE_LIMITED_QUIRKS = 2;
|
|
14
|
+
export declare function parserTagId(lowerName: string): number;
|
|
15
|
+
/**
|
|
16
|
+
* The DOM side of the parser. Every method has a do-nothing default so subclasses override
|
|
17
|
+
* only what they need. Handles are allocated by the sink, sequentially from 0 per parse;
|
|
18
|
+
* `parent === -1` in an insertion location means "the parent of `ref`" (foster parenting before
|
|
19
|
+
* a table whose parent the builder does not track).
|
|
20
|
+
*/
|
|
21
|
+
export declare class TreeSink {
|
|
22
|
+
/**
|
|
23
|
+
* Create an element in the node document of `parent` (or of `ref`'s parent when parent is
|
|
24
|
+
* -1). `attrNs` holds ANS_* codes when `hasNs` (foreign elements), in which case `names`
|
|
25
|
+
* are local names.
|
|
26
|
+
*/
|
|
27
|
+
createElement(name: string, ns: number, parent: number, ref: number, names: string[], values: string[], attrNs: number[], count: number, hasNs: boolean): number;
|
|
28
|
+
/** Insert (or move) `child` into `parent` before `ref` (-1 = append). */
|
|
29
|
+
insert(parent: number, ref: number, child: number): void;
|
|
30
|
+
/** Insert text before `ref` (or append), merging with an adjacent previous Text node. */
|
|
31
|
+
insertText(parent: number, ref: number, text: string): void;
|
|
32
|
+
insertComment(parent: number, ref: number, data: string): void;
|
|
33
|
+
insertProcessingInstruction(parent: number, ref: number, target: string, data: string): void;
|
|
34
|
+
/** Append a doctype to the document handle. */
|
|
35
|
+
insertDoctype(doc: number, name: string, publicId: string, systemId: string): void;
|
|
36
|
+
/** Detach `child` from its parent, if any. */
|
|
37
|
+
remove(child: number): void;
|
|
38
|
+
hasParent(node: number): boolean;
|
|
39
|
+
/** Move all children of `from` to the end of `to`. */
|
|
40
|
+
reparentChildren(from: number, to: number): void;
|
|
41
|
+
/** Add the given attributes to `node` where it does not already have them. */
|
|
42
|
+
addMissingAttributes(node: number, names: string[], values: string[], count: number): void;
|
|
43
|
+
/** Handle of a template element's contents fragment (allocates a handle). */
|
|
44
|
+
templateContents(template: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Attach a declarative shadow root to `host`; returns the shadow root's handle or -1 if
|
|
47
|
+
* that is not possible (the template is then inserted as a normal template element).
|
|
48
|
+
*/
|
|
49
|
+
attachDeclarativeShadowRoot(host: number, mode: string, delegatesFocus: boolean, serializable: boolean, slotAssignment: string, clonable: boolean): number;
|
|
50
|
+
/** https://html.spec.whatwg.org/#create-an-element-for-the-token form owner association. */
|
|
51
|
+
associateForm(element: number, form: number): void;
|
|
52
|
+
setDocumentMode(mode: number): void;
|
|
53
|
+
}
|
|
54
|
+
/** Per-parse options. */
|
|
55
|
+
export declare class ParseOptions {
|
|
56
|
+
scripting: boolean;
|
|
57
|
+
allowDeclarativeShadowRoots: boolean;
|
|
58
|
+
processingInstructions: boolean;
|
|
59
|
+
/** iframe srcdoc documents are never put in quirks mode. */
|
|
60
|
+
iframeSrcdoc: boolean;
|
|
61
|
+
constructor();
|
|
62
|
+
}
|
|
63
|
+
export declare class TreeBuilder {
|
|
64
|
+
sink: TreeSink;
|
|
65
|
+
tok: Tokenizer;
|
|
66
|
+
hNs: number[];
|
|
67
|
+
hTag: number[];
|
|
68
|
+
hName: string[];
|
|
69
|
+
hIP: boolean[];
|
|
70
|
+
hContents: number[];
|
|
71
|
+
stack: number[];
|
|
72
|
+
afe: number[];
|
|
73
|
+
afeTok: number[];
|
|
74
|
+
ptName: string[];
|
|
75
|
+
ptId: number[];
|
|
76
|
+
ptAttrStart: number[];
|
|
77
|
+
ptAttrCount: number[];
|
|
78
|
+
poolNames: string[];
|
|
79
|
+
poolValues: string[];
|
|
80
|
+
templateModes: number[];
|
|
81
|
+
mode: number;
|
|
82
|
+
originalMode: number;
|
|
83
|
+
docHandle: number;
|
|
84
|
+
headElement: number;
|
|
85
|
+
formElement: number;
|
|
86
|
+
fragmentContext: number;
|
|
87
|
+
framesetOk: boolean;
|
|
88
|
+
fosterParenting: boolean;
|
|
89
|
+
documentMode: number;
|
|
90
|
+
scripting: boolean;
|
|
91
|
+
allowDSD: boolean;
|
|
92
|
+
iframeSrcdoc: boolean;
|
|
93
|
+
stopped: boolean;
|
|
94
|
+
skipNewline: boolean;
|
|
95
|
+
reprocess: boolean;
|
|
96
|
+
/** Current token type (may be rewritten, e.g. </br> → <br>). */
|
|
97
|
+
ttype: number;
|
|
98
|
+
chars: string;
|
|
99
|
+
cpos: number;
|
|
100
|
+
charsHasNull: boolean;
|
|
101
|
+
pendingTableText: string;
|
|
102
|
+
pendingTableNonWs: boolean;
|
|
103
|
+
locParent: number;
|
|
104
|
+
locRef: number;
|
|
105
|
+
fNames: string[];
|
|
106
|
+
fValues: string[];
|
|
107
|
+
fNs: number[];
|
|
108
|
+
emptyStrings: string[];
|
|
109
|
+
emptyNumbers: number[];
|
|
110
|
+
constructor(sink: TreeSink);
|
|
111
|
+
private resetState;
|
|
112
|
+
/** Record facts for a handle the sink created outside the builder (document, fragment, context). */
|
|
113
|
+
setMeta(h: number, ns: number, tag: number, name: string, ip: boolean): void;
|
|
114
|
+
/** https://html.spec.whatwg.org/#parsing — parse a whole document into handle `doc`. */
|
|
115
|
+
parseDocument(input: string, doc: number, options: ParseOptions): void;
|
|
116
|
+
/**
|
|
117
|
+
* https://html.spec.whatwg.org/#html-fragment-parsing-algorithm
|
|
118
|
+
* `root` stands in for the spec's root html element (it is the DocumentFragment that
|
|
119
|
+
* receives the result, cf. the insertion target redirection map); `context` is the context
|
|
120
|
+
* element (its facts given here); `form` the nearest form ancestor-or-self or -1.
|
|
121
|
+
*/
|
|
122
|
+
parseFragment(input: string, root: number, context: number, contextName: string, contextNs: number, contextEncoding: string, form: number, documentMode: number, options: ParseOptions): void;
|
|
123
|
+
private setContextMeta;
|
|
124
|
+
/** Foreign special ids and HTML integration points. */
|
|
125
|
+
private setForeignFacts;
|
|
126
|
+
private run;
|
|
127
|
+
/** https://html.spec.whatwg.org/#tree-construction-dispatcher */
|
|
128
|
+
private processToken;
|
|
129
|
+
private useHtmlRules;
|
|
130
|
+
private dispatchMode;
|
|
131
|
+
private currentNode;
|
|
132
|
+
/** https://html.spec.whatwg.org/#adjusted-current-node */
|
|
133
|
+
private adjustedCurrentNode;
|
|
134
|
+
private isHtml;
|
|
135
|
+
/** Is `h` an HTML element with the current token's tag name? */
|
|
136
|
+
private isHtmlNamedAsToken;
|
|
137
|
+
private currentIs;
|
|
138
|
+
private pop;
|
|
139
|
+
/** Pop until an HTML element with tag id `tag` has been popped. */
|
|
140
|
+
private popUntil;
|
|
141
|
+
private popUntilNode;
|
|
142
|
+
private popUntilNamedAsToken;
|
|
143
|
+
private stackIndexOf;
|
|
144
|
+
/** https://html.spec.whatwg.org/#has-an-element-in-the-specific-scope (by HTML tag id). */
|
|
145
|
+
private inScope;
|
|
146
|
+
/** Has an element in scope that is an HTML element named like the current token. */
|
|
147
|
+
private tokenNameInScope;
|
|
148
|
+
/** https://html.spec.whatwg.org/#has-an-element-in-scope for a specific node. */
|
|
149
|
+
private nodeInScope;
|
|
150
|
+
private isSpecial;
|
|
151
|
+
private templateInStack;
|
|
152
|
+
/** https://html.spec.whatwg.org/#parsing-template-contents */
|
|
153
|
+
private parsingTemplateContents;
|
|
154
|
+
/** https://html.spec.whatwg.org/#generate-implied-end-tags */
|
|
155
|
+
private generateImpliedEndTags;
|
|
156
|
+
private generateImpliedEndTagsThoroughly;
|
|
157
|
+
/** https://html.spec.whatwg.org/#close-a-p-element */
|
|
158
|
+
private closePElement;
|
|
159
|
+
private closePIfInButtonScope;
|
|
160
|
+
/** https://html.spec.whatwg.org/#reset-the-insertion-mode-appropriately */
|
|
161
|
+
private resetInsertionMode;
|
|
162
|
+
/** https://html.spec.whatwg.org/#appropriate-place-for-inserting-a-node → locParent/locRef */
|
|
163
|
+
private appropriatePlace;
|
|
164
|
+
/** https://html.spec.whatwg.org/#insert-a-character */
|
|
165
|
+
private insertChars;
|
|
166
|
+
/** https://html.spec.whatwg.org/#insert-a-comment */
|
|
167
|
+
private insertComment;
|
|
168
|
+
private insertPI;
|
|
169
|
+
private recordElement;
|
|
170
|
+
/**
|
|
171
|
+
* https://html.spec.whatwg.org/#create-an-element-for-the-token in the HTML namespace,
|
|
172
|
+
* with the attributes of the current token (or none), intended parent = locParent/locRef.
|
|
173
|
+
*/
|
|
174
|
+
private createHtmlElement;
|
|
175
|
+
private tokenHasAttr;
|
|
176
|
+
private tokenAttr;
|
|
177
|
+
/** https://html.spec.whatwg.org/#insert-an-html-element for the current token. */
|
|
178
|
+
private insertHtmlElement;
|
|
179
|
+
/** Insert an HTML element for a start tag token with this name and no attributes. */
|
|
180
|
+
private insertHtmlElementNamed;
|
|
181
|
+
private insertVoidHtmlElement;
|
|
182
|
+
/** https://html.spec.whatwg.org/#insert-a-foreign-element with attribute adjustments. */
|
|
183
|
+
private insertForeignElement;
|
|
184
|
+
private storeToken;
|
|
185
|
+
/** Same tag name and attributes (order-insensitive) as the current token? */
|
|
186
|
+
private sameAsToken;
|
|
187
|
+
/** https://html.spec.whatwg.org/#push-onto-the-list-of-active-formatting-elements */
|
|
188
|
+
private pushFormatting;
|
|
189
|
+
private insertMarker;
|
|
190
|
+
/** https://html.spec.whatwg.org/#clear-the-list-of-active-formatting-elements-up-to-the-last-marker */
|
|
191
|
+
private clearToLastMarker;
|
|
192
|
+
private afeIndexOf;
|
|
193
|
+
/** Create an element for a stored formatting token (no insertion). */
|
|
194
|
+
private createFromStored;
|
|
195
|
+
/** https://html.spec.whatwg.org/#reconstruct-the-active-formatting-elements */
|
|
196
|
+
private reconstructFormatting;
|
|
197
|
+
/** https://html.spec.whatwg.org/#adoption-agency-algorithm */
|
|
198
|
+
private adoptionAgency;
|
|
199
|
+
/** Advance cpos over whitespace; returns true if characters remain. */
|
|
200
|
+
private skipWs;
|
|
201
|
+
/** Insert leading whitespace; returns true if characters remain. */
|
|
202
|
+
private insertLeadingWs;
|
|
203
|
+
private restChars;
|
|
204
|
+
/** "in body" character handling for a string. */
|
|
205
|
+
private bodyChars;
|
|
206
|
+
/** https://html.spec.whatwg.org/#the-initial-insertion-mode */
|
|
207
|
+
private initial;
|
|
208
|
+
private setDocumentMode;
|
|
209
|
+
private doctypeMode;
|
|
210
|
+
/** https://html.spec.whatwg.org/#the-before-html-insertion-mode */
|
|
211
|
+
private beforeHtml;
|
|
212
|
+
/** https://html.spec.whatwg.org/#the-before-head-insertion-mode */
|
|
213
|
+
private beforeHead;
|
|
214
|
+
/** https://html.spec.whatwg.org/#generic-raw-text-element-parsing-algorithm */
|
|
215
|
+
private genericTextElement;
|
|
216
|
+
/** https://html.spec.whatwg.org/#parsing-main-inhead */
|
|
217
|
+
private inHead;
|
|
218
|
+
/** "in head": a start tag whose tag name is "template". */
|
|
219
|
+
private templateStartTag;
|
|
220
|
+
/** "in head": an end tag whose tag name is "template". */
|
|
221
|
+
private templateEndTag;
|
|
222
|
+
/** https://html.spec.whatwg.org/#parsing-main-inheadnoscript */
|
|
223
|
+
private inHeadNoscript;
|
|
224
|
+
/** https://html.spec.whatwg.org/#the-after-head-insertion-mode */
|
|
225
|
+
private afterHead;
|
|
226
|
+
/** https://html.spec.whatwg.org/#parsing-main-inbody */
|
|
227
|
+
private inBody;
|
|
228
|
+
private inBodyStartTag;
|
|
229
|
+
private inBodyEndTag;
|
|
230
|
+
private anyOtherEndTagInBody;
|
|
231
|
+
/** https://html.spec.whatwg.org/#parsing-main-incdata */
|
|
232
|
+
private text;
|
|
233
|
+
/** https://html.spec.whatwg.org/#clear-the-stack-back-to-a-table-context */
|
|
234
|
+
private clearStackBackTo;
|
|
235
|
+
/** https://html.spec.whatwg.org/#parsing-main-intable */
|
|
236
|
+
private inTable;
|
|
237
|
+
/** https://html.spec.whatwg.org/#parsing-main-intabletext */
|
|
238
|
+
private inTableText;
|
|
239
|
+
/** https://html.spec.whatwg.org/#parsing-main-incaption */
|
|
240
|
+
private inCaption;
|
|
241
|
+
/** https://html.spec.whatwg.org/#parsing-main-incolgroup */
|
|
242
|
+
private inColumnGroup;
|
|
243
|
+
/** https://html.spec.whatwg.org/#parsing-main-intbody */
|
|
244
|
+
private inTableBody;
|
|
245
|
+
/** https://html.spec.whatwg.org/#parsing-main-intr */
|
|
246
|
+
private inRow;
|
|
247
|
+
/** https://html.spec.whatwg.org/#close-the-cell */
|
|
248
|
+
private closeCell;
|
|
249
|
+
/** https://html.spec.whatwg.org/#parsing-main-intd */
|
|
250
|
+
private inCell;
|
|
251
|
+
/** https://html.spec.whatwg.org/#parsing-main-intemplate */
|
|
252
|
+
private inTemplate;
|
|
253
|
+
private switchTemplateMode;
|
|
254
|
+
/** https://html.spec.whatwg.org/#parsing-main-afterbody */
|
|
255
|
+
private afterBody;
|
|
256
|
+
/** Whitespace is processed using the "in body" rules; returns true if non-whitespace remains. */
|
|
257
|
+
private skipWsViaBody;
|
|
258
|
+
/** https://html.spec.whatwg.org/#parsing-main-inframeset */
|
|
259
|
+
private inFrameset;
|
|
260
|
+
/** Insert only the whitespace characters of the token (others are parse errors, ignored). */
|
|
261
|
+
private insertWsOnly;
|
|
262
|
+
/** https://html.spec.whatwg.org/#parsing-main-afterframeset */
|
|
263
|
+
private afterFrameset;
|
|
264
|
+
/** https://html.spec.whatwg.org/#the-after-after-body-insertion-mode */
|
|
265
|
+
private afterAfterBody;
|
|
266
|
+
/** https://html.spec.whatwg.org/#the-after-after-frameset-insertion-mode */
|
|
267
|
+
private afterAfterFrameset;
|
|
268
|
+
/** https://html.spec.whatwg.org/#parsing-main-inforeign */
|
|
269
|
+
private foreignContent;
|
|
270
|
+
private popToHtmlOrIntegrationPoint;
|
|
271
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Document } from "../nodes/Document.js";
|
|
2
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
3
|
+
export declare const PARSERERROR_NS = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
|
|
4
|
+
/**
|
|
5
|
+
* https://html.spec.whatwg.org/#dom-domparser-parsefromstring (XML types): parse `text` into the
|
|
6
|
+
* empty XML document `doc`. On error `doc` gets a <parsererror> document element instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseXML(text: string, doc: Document, contentType: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* https://html.spec.whatwg.org/#xml-fragment-parsing-algorithm — `markup` parsed as the
|
|
11
|
+
* content of `context` with its in-scope namespace declarations. Throws a "SyntaxError"
|
|
12
|
+
* DOMException when it is not well-formed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseXMLFragment(markup: string, context: NodeImpl): NodeImpl;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
|
+
import { type Complex, type SelectorList } from "./parser.js";
|
|
3
|
+
import { type Predicate } from "./state.js";
|
|
4
|
+
/** One compiled simple selector. Every field is initialized so all tests share one shape. */
|
|
5
|
+
export declare class Test {
|
|
6
|
+
op: number;
|
|
7
|
+
/** Exact name (type/attribute local name, id, class). */
|
|
8
|
+
name: string;
|
|
9
|
+
/** ASCII-lowercased name. */
|
|
10
|
+
lower: string;
|
|
11
|
+
/** For type tests: true when the namespace must equal `ns`. For attribute tests: true when any namespace is allowed. */
|
|
12
|
+
nsCheck: boolean;
|
|
13
|
+
ns: string | null;
|
|
14
|
+
/** Attribute matcher (OP_*). */
|
|
15
|
+
attrOp: number;
|
|
16
|
+
value: string;
|
|
17
|
+
valueLower: string;
|
|
18
|
+
valueCase: number;
|
|
19
|
+
a: number;
|
|
20
|
+
b: number;
|
|
21
|
+
list: CList | null;
|
|
22
|
+
fn: Predicate | null;
|
|
23
|
+
args: string[];
|
|
24
|
+
memoEl: NodeImpl | null;
|
|
25
|
+
memoIdx: number;
|
|
26
|
+
memoVersion: number;
|
|
27
|
+
memoParent: NodeImpl | null;
|
|
28
|
+
memoCount: number;
|
|
29
|
+
memoCountVersion: number;
|
|
30
|
+
/** Depends on state outside Document._version (a non-STABLE predicate, :dir(), :state()): evaluations are logged (StateDeps). */
|
|
31
|
+
volatileTest: boolean;
|
|
32
|
+
constructor(op: number);
|
|
33
|
+
}
|
|
34
|
+
/** A compiled complex (or relative) selector. Compounds are stored right-to-left. */
|
|
35
|
+
export declare class CComplex {
|
|
36
|
+
/** comps[0] is the subject (rightmost) compound. */
|
|
37
|
+
comps: Test[][];
|
|
38
|
+
/** combs[k] joins comps[k] (right) and comps[k + 1] (left). */
|
|
39
|
+
combs: number[];
|
|
40
|
+
last: number;
|
|
41
|
+
/** For relative selectors (:has): the relation of the leftmost compound to the anchor. */
|
|
42
|
+
leading: number;
|
|
43
|
+
/** Search domain for :has candidates (H_*). */
|
|
44
|
+
hasDomain: number;
|
|
45
|
+
/** Pseudo-element name of the subject ("" for none), e.g. "before". */
|
|
46
|
+
pseudoElement: string;
|
|
47
|
+
/** Packed specificity (see packSpecificity). */
|
|
48
|
+
specificity: number;
|
|
49
|
+
/** Source text. */
|
|
50
|
+
text: string;
|
|
51
|
+
/** Matcher closure (built on first call). */
|
|
52
|
+
fn: Matcher;
|
|
53
|
+
constructor();
|
|
54
|
+
}
|
|
55
|
+
export declare class CList {
|
|
56
|
+
items: CComplex[];
|
|
57
|
+
/** Matches if any item matches (built on first call). */
|
|
58
|
+
fn: Matcher;
|
|
59
|
+
constructor();
|
|
60
|
+
}
|
|
61
|
+
export type Matcher = (el: NodeImpl) => boolean;
|
|
62
|
+
/** Results of a compilation besides the program itself. */
|
|
63
|
+
export declare class CompileInfo {
|
|
64
|
+
/** Contains state pseudo-classes whose value is not covered by Document._version. */
|
|
65
|
+
volatile: boolean;
|
|
66
|
+
/** Contains :scope. */
|
|
67
|
+
usesScope: boolean;
|
|
68
|
+
/** :nth-* tests whose memos must be reset after each top-level query. */
|
|
69
|
+
nthTests: Test[];
|
|
70
|
+
/** Namespace resolution: prefix → URI (undefined = undeclared). */
|
|
71
|
+
resolve: ((prefix: string) => string | null | undefined) | null;
|
|
72
|
+
/** Default namespace (undefined = none declared: type selectors match any namespace). */
|
|
73
|
+
defaultNs: string | null | undefined;
|
|
74
|
+
/** First compile error ("" when none). */
|
|
75
|
+
error: string;
|
|
76
|
+
/**
|
|
77
|
+
* A forgiving list (:is/:where) dropped an item: the selector only parses because of
|
|
78
|
+
* forgiving parsing, so `@supports selector()` reports it unsupported
|
|
79
|
+
* (https://drafts.csswg.org/css-conditional-4/#support-definition-ext).
|
|
80
|
+
*/
|
|
81
|
+
forgivingDropped: boolean;
|
|
82
|
+
constructor();
|
|
83
|
+
}
|
|
84
|
+
/** Pack (a, b, c) into one comparable number (each component saturates at 1023). */
|
|
85
|
+
export declare function packSpecificity(a: number, b: number, c: number): number;
|
|
86
|
+
export declare function unpackSpecificity(s: number): [number, number, number];
|
|
87
|
+
/** https://drafts.csswg.org/selectors-4/#specificity-rules */
|
|
88
|
+
export declare function complexSpecificity(cx: Complex): number;
|
|
89
|
+
export declare function compileList(list: SelectorList, info: CompileInfo): CList;
|
|
90
|
+
export declare function compileComplex(cx: Complex, info: CompileInfo): CComplex;
|
|
91
|
+
/** Drop per-query memos (they hold node references). */
|
|
92
|
+
export declare function resetMemos(info: CompileInfo): void;
|
|
93
|
+
/** Volatile tests evaluated while recording, with their elements and results. */
|
|
94
|
+
export declare class StateDeps {
|
|
95
|
+
tests: Test[];
|
|
96
|
+
els: NodeImpl[];
|
|
97
|
+
results: boolean[];
|
|
98
|
+
constructor();
|
|
99
|
+
}
|
|
100
|
+
/** Start recording volatile tests; returns the enclosing recording to pass to `endStateDeps`. */
|
|
101
|
+
export declare function beginStateDeps(): StateDeps | boolean | null;
|
|
102
|
+
/** Stop recording: the tests logged since `beginStateDeps` (null if none). Nested recordings also log into the enclosing one. */
|
|
103
|
+
export declare function endStateDeps(prev: StateDeps | boolean | null): StateDeps | null;
|
|
104
|
+
/** Whether every logged test still evaluates to its logged result. */
|
|
105
|
+
export declare function stateDepsHold(d: StateDeps): boolean;
|
|
106
|
+
/** :scope element for the current top-level match (https://drafts.csswg.org/selectors-4/#scope-element). */
|
|
107
|
+
export declare let scopeEl: NodeImpl | null;
|
|
108
|
+
export declare function setScope(el: NodeImpl | null): NodeImpl | null;
|
|
109
|
+
export declare function setHostContext(el: NodeImpl | null): NodeImpl | null;
|
|
110
|
+
export declare function matchList(list: CList, el: NodeImpl): boolean;
|
|
111
|
+
export declare function matchComplex(cx: CComplex, el: NodeImpl): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Matches the shadow host itself against a selector from its shadow tree's style sheets
|
|
114
|
+
* (https://drafts.csswg.org/selectors-4/#featureless, https://drafts.csswg.org/css-scoping-1/#host-selector):
|
|
115
|
+
* only a lone compound can reach it, and only through :host / :host() / :host-context().
|
|
116
|
+
*/
|
|
117
|
+
export declare function matchFeaturelessHost(cx: CComplex, el: NodeImpl): boolean;
|
|
118
|
+
/** Rightmost-compound key kinds for rule bucketing / candidate collection. */
|
|
119
|
+
export declare const KEY_NONE = 0;
|
|
120
|
+
export declare const KEY_ID = 1;
|
|
121
|
+
export declare const KEY_CLASS = 2;
|
|
122
|
+
export declare const KEY_TAG = 3;
|
|
123
|
+
/** The best bucketing key of the subject compound: id, then class, then tag (lowercased). */
|
|
124
|
+
export declare function subjectKey(cx: CComplex): {
|
|
125
|
+
kind: number;
|
|
126
|
+
value: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Ancestor hashes for the ancestor filter (filter.ts), as WebKit's
|
|
130
|
+
* SelectorFilter::collectSelectorHashes
|
|
131
|
+
* (https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/SelectorFilter.cpp): the ids,
|
|
132
|
+
* classes and type names of compounds joined by a descendant or child combinator. Such a compound
|
|
133
|
+
* always matches an element ancestor of the subject (the ancestor of the subject, of an ancestor,
|
|
134
|
+
* or of a sibling of either), so the subject's ancestors must carry every one of these names.
|
|
135
|
+
* Ids and classes come first (most selective); at most four, as in WebKit.
|
|
136
|
+
*/
|
|
137
|
+
export declare function ancestorHashes(cx: CComplex): number[];
|
|
138
|
+
/**
|
|
139
|
+
* WebKit SelectorQuery's id-rooted traversal
|
|
140
|
+
* (https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/SelectorQuery.cpp,
|
|
141
|
+
* "selectorForIdLookup" / filterRootById): for a single complex selector, the id of a compound
|
|
142
|
+
* joined to the subject only by descendant / child combinators (`#app li`, `#form > div input`).
|
|
143
|
+
* Every match is then a descendant of the element with that id. "" when there is none.
|
|
144
|
+
*/
|
|
145
|
+
export declare function idRootOf(list: CList): string;
|
|
146
|
+
/** Fast-path shapes for querySelector(All): a single complex with one compound of one test. */
|
|
147
|
+
export declare const FAST_NONE = 0;
|
|
148
|
+
export declare const FAST_ALL = 1;
|
|
149
|
+
export declare const FAST_ID = 2;
|
|
150
|
+
export declare const FAST_CLASS = 3;
|
|
151
|
+
export declare const FAST_TAG = 4;
|
|
152
|
+
export declare const FAST_ATTR = 5;
|
|
153
|
+
export declare function fastShape(list: CList): number;
|
|
154
|
+
export declare function fastTest(list: CList): Test;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
|
+
/** Hash of a type selector / element local name (ASCII-lowercased). */
|
|
3
|
+
export declare function tagHash(lower: string): number;
|
|
4
|
+
export declare function idHash(id: string): number;
|
|
5
|
+
export declare function classHash(name: string): number;
|
|
6
|
+
/**
|
|
7
|
+
* Fill the set with the tag, id and classes of every element ancestor of `el` (the parent chain
|
|
8
|
+
* up to the first non-element: a descendant / child combinator never crosses further, except
|
|
9
|
+
* into a featureless shadow host, whose compound carries no hashes).
|
|
10
|
+
* Not for quirks-mode documents (their ids and classes match case-insensitively).
|
|
11
|
+
*
|
|
12
|
+
* Not reused across elements: keeping the last parent to reuse the set for its siblings needs a
|
|
13
|
+
* reference to it, and a WeakRef keeps its target alive until the end of the current job (every
|
|
14
|
+
* tree a test file renders, measured +5.8 MB heap on react/styled-form-rerender).
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildAncestorFilter(el: NodeImpl): void;
|
|
17
|
+
/**
|
|
18
|
+
* Whether a selector with ancestor hashes h0..h3 (-1 = none) may match the element the filter
|
|
19
|
+
* was last built for. Inline-friendly: four slot reads at most.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mayMatchAncestors(h0: number, h1: number, h2: number, h3: number): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
|
+
import { NodeList } from "../collections/NodeList.js";
|
|
3
|
+
/** Drop every compiled selector (e.g. after replacing a pseudo-class predicate). */
|
|
4
|
+
export declare function clearSelectorCaches(): void;
|
|
5
|
+
/** https://dom.spec.whatwg.org/#dom-parentnode-queryselector */
|
|
6
|
+
export declare function querySelector(root: NodeImpl, selectors: string): NodeImpl | null;
|
|
7
|
+
/** https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall (static NodeList) */
|
|
8
|
+
export declare function querySelectorAll(root: NodeImpl, selectors: string): NodeList;
|
|
9
|
+
/** Internal variant of querySelectorAll returning impls (no NodeList allocation). The array is fresh and owned by the caller. */
|
|
10
|
+
export declare function querySelectorAllImpls(root: NodeImpl, selectors: string, out?: NodeImpl[]): NodeImpl[];
|
|
11
|
+
/** https://dom.spec.whatwg.org/#dom-element-matches */
|
|
12
|
+
export declare function matches(el: NodeImpl, selectors: string): boolean;
|
|
13
|
+
/** https://dom.spec.whatwg.org/#dom-element-closest */
|
|
14
|
+
export declare function closest(el: NodeImpl, selectors: string): NodeImpl | null;
|
|
15
|
+
/** Whether `selectors` parses as a valid selector list (no exception). */
|
|
16
|
+
export declare function isValidSelector(selectors: string): boolean;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
2
|
+
import { type NamespaceContext } from "./serialize.js";
|
|
3
|
+
import { type CComplex, CompileInfo, unpackSpecificity, packSpecificity, KEY_NONE, KEY_ID, KEY_CLASS, KEY_TAG } from "./compile.js";
|
|
4
|
+
import { $cx, $info } from "../keys.js";
|
|
5
|
+
export { KEY_NONE, KEY_ID, KEY_CLASS, KEY_TAG, packSpecificity, unpackSpecificity };
|
|
6
|
+
export { buildAncestorFilter, mayMatchAncestors } from "./filter.js";
|
|
7
|
+
export { beginStateDeps, endStateDeps, stateDepsHold, type StateDeps } from "./compile.js";
|
|
8
|
+
export { querySelectorAllImpls, isValidSelector, clearSelectorCaches } from "./index.js";
|
|
9
|
+
export { setHoverTarget, setActiveTarget, setPseudoClassPredicate, interaction, type Predicate } from "./state.js";
|
|
10
|
+
/** One complex selector of a compiled list. */
|
|
11
|
+
export declare class CompiledSelector {
|
|
12
|
+
/** Source text of this complex selector (trimmed). */
|
|
13
|
+
readonly text: string;
|
|
14
|
+
/** Packed specificity: a * 2^20 + b * 2^10 + c (each saturating at 1023). Compare numerically. */
|
|
15
|
+
readonly specificity: number;
|
|
16
|
+
/** KEY_ID / KEY_CLASS / KEY_TAG / KEY_NONE (universal or pseudo-class-only subject). */
|
|
17
|
+
readonly keyKind: number;
|
|
18
|
+
/** The id, class name, or lowercased tag name for `keyKind`; "" for KEY_NONE. */
|
|
19
|
+
readonly key: string;
|
|
20
|
+
/** Subject pseudo-element without colons ("before", "part::before", ...), or "" for elements. */
|
|
21
|
+
readonly pseudoElement: string;
|
|
22
|
+
/** Depends on state not covered by Document._version (focus, hover, checkedness, values, ...). */
|
|
23
|
+
readonly volatile: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Ancestor-filter hashes (filter.ts; -1 = none): names some ancestor of the subject must have.
|
|
26
|
+
* Test with `mayMatchAncestors(h0, h1, h2, h3)` after `buildAncestorFilter(el)`.
|
|
27
|
+
*/
|
|
28
|
+
readonly h0: number;
|
|
29
|
+
readonly h1: number;
|
|
30
|
+
readonly h2: number;
|
|
31
|
+
readonly h3: number;
|
|
32
|
+
/** Matching needs no :scope, :nth-* memo reset or host context: `matchesSelectorDirect` may skip that setup. */
|
|
33
|
+
readonly direct: boolean;
|
|
34
|
+
/** @internal */
|
|
35
|
+
readonly [$cx]: CComplex;
|
|
36
|
+
/** @internal */
|
|
37
|
+
readonly [$info]: CompileInfo;
|
|
38
|
+
constructor(cx: CComplex, info: CompileInfo);
|
|
39
|
+
/** Specificity as an (a, b, c) tuple. */
|
|
40
|
+
get specificityTuple(): [number, number, number];
|
|
41
|
+
}
|
|
42
|
+
export interface CompiledSelectorList {
|
|
43
|
+
readonly text: string;
|
|
44
|
+
/** CSSOM serialization (https://drafts.csswg.org/cssom/#serialize-a-group-of-selectors), for selectorText. */
|
|
45
|
+
readonly serialized: string;
|
|
46
|
+
readonly selectors: readonly CompiledSelector[];
|
|
47
|
+
}
|
|
48
|
+
export interface CompileOptions {
|
|
49
|
+
/** @namespace prefixes declared in the style sheet (prefix → URI; null URI = no namespace). */
|
|
50
|
+
namespaces?: ReadonlyMap<string, string | null>;
|
|
51
|
+
/** The style sheet's default namespace (`@namespace url(...)`), if any. */
|
|
52
|
+
defaultNamespace?: string | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parse and compile a selector list (e.g. a style rule's prelude). Returns null when the list is
|
|
56
|
+
* invalid (https://drafts.csswg.org/css-syntax-3/#style-rules — the whole rule is dropped).
|
|
57
|
+
*/
|
|
58
|
+
export declare function compileSelectorList(text: string, options?: CompileOptions): CompiledSelectorList | null;
|
|
59
|
+
/**
|
|
60
|
+
* `@supports selector(<complex-selector>)` / `CSS.supports("selector(...)")`
|
|
61
|
+
* (https://drafts.csswg.org/css-conditional-4/#support-definition-ext): the selector parses
|
|
62
|
+
* and compiles without relying on forgiving parsing (no :is()/:where() item was dropped).
|
|
63
|
+
*/
|
|
64
|
+
export declare function isSupportedSelector(text: string): boolean;
|
|
65
|
+
/** CSSOM serialization of a selector list, or null if it is invalid. */
|
|
66
|
+
export declare function serializeSelector(text: string, namespaces?: NamespaceContext): string | null;
|
|
67
|
+
export interface MatchOptions {
|
|
68
|
+
/** :scope element (default: none, so :scope matches nothing... per css, :scope = :root in style rules). */
|
|
69
|
+
scope?: NodeImpl | null;
|
|
70
|
+
/** When matching rules from a shadow tree's style sheets: that tree's host (enables :host, :host(), :host-context()). */
|
|
71
|
+
shadowHost?: NodeImpl | null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Whether `sel` matches `el` (or, with `pseudoElement`, that pseudo-element of `el`).
|
|
75
|
+
* A selector with a pseudo-element only matches when the same pseudo-element is requested.
|
|
76
|
+
*/
|
|
77
|
+
export declare function matchesSelector(sel: CompiledSelector, el: NodeImpl, pseudoElement?: string | null, options?: MatchOptions): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* `matchesSelector` for the cascade's hot loop: `pseudoElement` already normalized ("" for the
|
|
80
|
+
* element itself), no :scope element and no shadow host. Selectors that need no per-call setup
|
|
81
|
+
* (`direct`) run their matcher without the save/restore and try/finally.
|
|
82
|
+
*/
|
|
83
|
+
export declare function matchesSelectorDirect(sel: CompiledSelector, el: NodeImpl, pseudoElement: string): boolean;
|
|
84
|
+
/** Whether any selector of the list matches. */
|
|
85
|
+
export declare function matchesSelectorList(list: CompiledSelectorList, el: NodeImpl, pseudoElement?: string | null, options?: MatchOptions): boolean;
|
|
86
|
+
/** Highest specificity among the selectors of `list` that match `el` (-1 when none match). */
|
|
87
|
+
export declare function matchingSpecificity(list: CompiledSelectorList, el: NodeImpl, pseudoElement?: string | null, options?: MatchOptions): number;
|