@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,90 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
|
|
3
|
+
// src/plugin.ts
|
|
4
|
+
const extension = import.meta.url.endsWith(".ts") ? ".ts" : ".js";
|
|
5
|
+
const environment = fileURLToPath(new URL(`./index${extension}`, import.meta.url));
|
|
6
|
+
const failureSnapshot = fileURLToPath(new URL(`./failure-snapshot${extension}`, import.meta.url));
|
|
7
|
+
const DEBUG_FORMATS = /* @__PURE__ */ new Set([
|
|
8
|
+
"aria",
|
|
9
|
+
"compact",
|
|
10
|
+
"html"
|
|
11
|
+
]);
|
|
12
|
+
const ENVIRONMENT_NAME = "ctrl-dom";
|
|
13
|
+
const ENVIRONMENT_PACKAGE = `vitest-environment-${ENVIRONMENT_NAME}`;
|
|
14
|
+
const TESTING_LIBRARY = [
|
|
15
|
+
{
|
|
16
|
+
find: /^@testing-library\/react(\/.*)?$/,
|
|
17
|
+
replacement: "@ctrl/dom/react$1"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
find: /^@testing-library\/dom$/,
|
|
21
|
+
replacement: "@ctrl/dom/testing-library"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
find: /^@testing-library\/user-event$/,
|
|
25
|
+
replacement: "@ctrl/dom/user-event"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
find: /^@testing-library\/jest-dom(\/.*)?$/,
|
|
29
|
+
replacement: "@ctrl/dom/jest-dom$1"
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Turns on Node's compile cache as the worker process starts, before Vitest's own worker modules
|
|
34
|
+
* load, rather than at environment setup (CtrlDomEnvironmentOptions.compileCache): Vitest's
|
|
35
|
+
* runner, chai and the module runner then load from it too. A `data:` URL, so there is no file to
|
|
36
|
+
* resolve. Node ignores it under NODE_DISABLE_COMPILE_CACHE (Vitest's v8 coverage sets that).
|
|
37
|
+
*/
|
|
38
|
+
const COMPILE_CACHE_IMPORT = "--import=data:text/javascript,import{enableCompileCache}from\"node:module\";enableCompileCache?.()";
|
|
39
|
+
/**
|
|
40
|
+
* @internal The Node flags the plugin adds to a project's workers: the compile cache from process
|
|
41
|
+
* start (with `compileCache`), in every pool. Exported for comparison/, which mirrors the plugin's
|
|
42
|
+
* setup without loading Vitest's config machinery.
|
|
43
|
+
*/
|
|
44
|
+
function workerExecArgv({ compileCache = false }) {
|
|
45
|
+
const flags = [];
|
|
46
|
+
const env = process.env.CTRL_DOM_COMPILE_CACHE;
|
|
47
|
+
if (env === "1" || env !== "0" && compileCache) flags.push(COMPILE_CACHE_IMPORT);
|
|
48
|
+
return flags;
|
|
49
|
+
}
|
|
50
|
+
/** @ctrl/dom's Vitest environment plus (by default) the Testing Library aliases. */
|
|
51
|
+
function ctrlDom(options = {}) {
|
|
52
|
+
const { testingLibrary = true, debug, ...rest } = options;
|
|
53
|
+
const environmentOptions = {
|
|
54
|
+
compileCache: testingLibrary,
|
|
55
|
+
...rest
|
|
56
|
+
};
|
|
57
|
+
const shellDebug = process.env.CTRL_DOM_DEBUG;
|
|
58
|
+
const agentMode = DEBUG_FORMATS.has(String(shellDebug ?? debug ?? "").trim().toLowerCase());
|
|
59
|
+
return {
|
|
60
|
+
name: "@ctrl/dom",
|
|
61
|
+
enforce: "pre",
|
|
62
|
+
resolveId(id) {
|
|
63
|
+
return id === ENVIRONMENT_PACKAGE ? environment : null;
|
|
64
|
+
},
|
|
65
|
+
config(config) {
|
|
66
|
+
const configured = config.test?.environment;
|
|
67
|
+
return {
|
|
68
|
+
...testingLibrary ? { resolve: { alias: TESTING_LIBRARY } } : {},
|
|
69
|
+
test: {
|
|
70
|
+
...configured === void 0 || configured === ENVIRONMENT_NAME ? { environment } : {},
|
|
71
|
+
environmentOptions: { [ENVIRONMENT_NAME]: environmentOptions },
|
|
72
|
+
...debug && shellDebug === void 0 ? { env: { CTRL_DOM_DEBUG: debug } } : {},
|
|
73
|
+
...agentMode ? { setupFiles: [failureSnapshot] } : {}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
configureVitest({ project }) {
|
|
78
|
+
const config = project.config;
|
|
79
|
+
if (config.browser?.enabled) return;
|
|
80
|
+
const flags = workerExecArgv({
|
|
81
|
+
pool: config.pool,
|
|
82
|
+
execArgv: config.execArgv,
|
|
83
|
+
compileCache: environmentOptions.compileCache === true
|
|
84
|
+
});
|
|
85
|
+
if (flags.length > 0) config.execArgv = [...config.execArgv ?? [], ...flags];
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { ctrlDom, ctrlDom as default, workerExecArgv };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Environment } from "vitest/runtime";
|
|
2
|
+
import type { CompatProfile, WindowOptions } from "@ctrl/dom";
|
|
3
|
+
export interface CtrlDomEnvironmentOptions extends Omit<WindowOptions, "shareStorageWith"> {
|
|
4
|
+
/**
|
|
5
|
+
* Skip idle time (default true): timers live on a virtual clock that jumps to the next timer
|
|
6
|
+
* whenever the event loop has nothing else to do (no pending immediates, no I/O), with Date and
|
|
7
|
+
* performance.now() advancing by the same amount. `false` keeps real-time timers. The
|
|
8
|
+
* CTRL_DOM_TIME_SKIP environment variable ("0"/"1") overrides it. See
|
|
9
|
+
* @ctrl/dom window/clock.ts.
|
|
10
|
+
*/
|
|
11
|
+
timeSkip?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* APIs beyond jsdom's (@ctrl/dom window/compat.ts): "jsdom-30" (default, what Vitest's jsdom
|
|
14
|
+
* environment exposes), "jsdom-26" (jest-environment-jsdom 30's) or "modern" (everything,
|
|
15
|
+
* including matchMedia, ResizeObserver and the `inert` IDL attribute).
|
|
16
|
+
*/
|
|
17
|
+
compat?: CompatProfile;
|
|
18
|
+
/**
|
|
19
|
+
* Enable Node's on-disk compile cache before importing the DOM (default false; the @ctrl/dom
|
|
20
|
+
* Vitest plugin turns it on when it routes Testing Library to @ctrl/dom's bundles). It applies to
|
|
21
|
+
* every module the worker loads afterwards: a win for a few large bundles, a loss for many small
|
|
22
|
+
* CommonJS files such as stock Testing Library's. The CTRL_DOM_COMPILE_CACHE environment
|
|
23
|
+
* variable ("0"/"1"; also CTRL_DOM_COMPILE_CACHE) overrides it; NODE_COMPILE_CACHE enables it for the
|
|
24
|
+
* whole process regardless.
|
|
25
|
+
*/
|
|
26
|
+
compileCache?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const environment: Environment;
|
|
29
|
+
export default environment;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Plugin } from "vitest/config";
|
|
2
|
+
import type { CtrlDomEnvironmentOptions } from "./index.js";
|
|
3
|
+
export type { CtrlDomEnvironmentOptions };
|
|
4
|
+
export interface CtrlDomPluginOptions extends CtrlDomEnvironmentOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Route stock `@testing-library/react`, `/dom`, `/user-event` and `/jest-dom` imports to
|
|
7
|
+
* @ctrl/dom's implementations (default true). `false` swaps only the DOM.
|
|
8
|
+
*/
|
|
9
|
+
testingLibrary?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Agent-oriented debug output, the same as the `CTRL_DOM_DEBUG` env var (which wins when set):
|
|
12
|
+
* `"aria"` prints accessibility snapshots instead of HTML in `screen.debug()`, `prettyDOM` and
|
|
13
|
+
* failing query errors (with the closest matching elements); `"compact"` prints HTML without
|
|
14
|
+
* class/style attributes and SVG internals. Default: upstream output.
|
|
15
|
+
*
|
|
16
|
+
* When on (here or through `CTRL_DOM_DEBUG`), the plugin also adds a setup file that appends a
|
|
17
|
+
* snapshot of `document.body` to every failing test's error, taken before cleanup.
|
|
18
|
+
*/
|
|
19
|
+
debug?: "aria" | "compact";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @internal The Node flags the plugin adds to a project's workers: the compile cache from process
|
|
23
|
+
* start (with `compileCache`), in every pool. Exported for comparison/, which mirrors the plugin's
|
|
24
|
+
* setup without loading Vitest's config machinery.
|
|
25
|
+
*/
|
|
26
|
+
export declare function workerExecArgv({ compileCache, }: {
|
|
27
|
+
pool?: unknown;
|
|
28
|
+
execArgv?: readonly string[];
|
|
29
|
+
compileCache?: boolean;
|
|
30
|
+
}): string[];
|
|
31
|
+
/** @ctrl/dom's Vitest environment plus (by default) the Testing Library aliases. */
|
|
32
|
+
export declare function ctrlDom(options?: CtrlDomPluginOptions): Plugin;
|
|
33
|
+
export default ctrlDom;
|
package/jest-preset.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Generated by scripts/release.ts (writeJestPreset): `preset: "@ctrl/dom"`.
|
|
2
|
+
"use strict";
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const dist = (file) => path.join(__dirname, "dist", file);
|
|
5
|
+
module.exports = {
|
|
6
|
+
testEnvironment: "@ctrl/dom-jest-environment",
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
"^@testing-library/dom$": dist("testing-library/index.cjs"),
|
|
9
|
+
"^@testing-library/react$": dist("react/index.cjs"),
|
|
10
|
+
"^@testing-library/react/pure$": dist("react/pure.cjs"),
|
|
11
|
+
"^@testing-library/react/dont-cleanup-after-each$": dist("react/dont-cleanup-after-each.cjs"),
|
|
12
|
+
"^@testing-library/user-event$": dist("user-event/index.cjs"),
|
|
13
|
+
"^@testing-library/jest-dom$": dist("jest-dom/index.cjs"),
|
|
14
|
+
"^@testing-library/jest-dom/matchers$": dist("jest-dom/matchers.cjs"),
|
|
15
|
+
"^@testing-library/jest-dom/jest-globals$": dist("jest-dom/jest-globals.cjs"),
|
|
16
|
+
},
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,180 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctrl/dom",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A fast DOM for testing React components: a drop-in replacement for jsdom and happy-dom, with Testing Library, user-event and jest-dom built in.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dom",
|
|
7
|
+
"jsdom",
|
|
8
|
+
"happy-dom",
|
|
9
|
+
"testing",
|
|
10
|
+
"react",
|
|
11
|
+
"testing-library",
|
|
12
|
+
"user-event",
|
|
13
|
+
"jest-dom",
|
|
14
|
+
"vitest",
|
|
15
|
+
"jest"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://github.com/scttcper/dom#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/scttcper/dom/issues"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/scttcper/dom.git",
|
|
25
|
+
"directory": "publish/ctrl-dom"
|
|
26
|
+
},
|
|
27
|
+
"author": "Scott Cooper <scttcper@gmail.com>",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=26"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"main": "./dist/bridge/index.js",
|
|
36
|
+
"types": "./dist/dom/types/index.d.ts",
|
|
37
|
+
"bin": {
|
|
38
|
+
"ctrl-dom": "./dist/cli/ctrl-dom.js"
|
|
39
|
+
},
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/dom/types/index.d.ts",
|
|
43
|
+
"require": "./dist/bridge/index.cjs",
|
|
44
|
+
"default": "./dist/bridge/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./internal": {
|
|
47
|
+
"types": "./dist/dom/types/internal.d.ts",
|
|
48
|
+
"require": "./dist/bridge/internal.cjs",
|
|
49
|
+
"default": "./dist/bridge/internal.js"
|
|
50
|
+
},
|
|
51
|
+
"./aria": {
|
|
52
|
+
"types": "./dist/aria/types/index.d.ts",
|
|
53
|
+
"require": "./dist/aria/index.cjs",
|
|
54
|
+
"default": "./dist/aria/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./aria/internal": {
|
|
57
|
+
"types": "./dist/aria/types/internal.d.ts",
|
|
58
|
+
"require": "./dist/aria/internal.cjs",
|
|
59
|
+
"default": "./dist/aria/internal.js"
|
|
60
|
+
},
|
|
61
|
+
"./testing-library": {
|
|
62
|
+
"types": "./dist/testing-library/types/index.d.ts",
|
|
63
|
+
"require": "./dist/testing-library/index.cjs",
|
|
64
|
+
"default": "./dist/testing-library/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./testing-library/agent": {
|
|
67
|
+
"types": "./dist/testing-library/types/agent.d.ts",
|
|
68
|
+
"require": "./dist/testing-library/agent.cjs",
|
|
69
|
+
"default": "./dist/testing-library/agent.js"
|
|
70
|
+
},
|
|
71
|
+
"./react": {
|
|
72
|
+
"types": "./dist/react/types/index.d.ts",
|
|
73
|
+
"require": "./dist/react/index.cjs",
|
|
74
|
+
"default": "./dist/react/index.js"
|
|
75
|
+
},
|
|
76
|
+
"./react/pure": {
|
|
77
|
+
"types": "./dist/react/types/pure.d.ts",
|
|
78
|
+
"require": "./dist/react/pure.cjs",
|
|
79
|
+
"default": "./dist/react/pure.js"
|
|
80
|
+
},
|
|
81
|
+
"./react/dont-cleanup-after-each": {
|
|
82
|
+
"types": "./dist/react/types/dont-cleanup-after-each.d.ts",
|
|
83
|
+
"require": "./dist/react/dont-cleanup-after-each.cjs",
|
|
84
|
+
"default": "./dist/react/dont-cleanup-after-each.js"
|
|
85
|
+
},
|
|
86
|
+
"./user-event": {
|
|
87
|
+
"types": "./dist/user-event/types/index.d.ts",
|
|
88
|
+
"require": "./dist/user-event/index.cjs",
|
|
89
|
+
"default": "./dist/user-event/index.js"
|
|
90
|
+
},
|
|
91
|
+
"./jest-dom": {
|
|
92
|
+
"types": "./dist/jest-dom/types/index.d.ts",
|
|
93
|
+
"require": "./dist/jest-dom/index.cjs",
|
|
94
|
+
"default": "./dist/jest-dom/index.js"
|
|
95
|
+
},
|
|
96
|
+
"./jest-dom/matchers": {
|
|
97
|
+
"types": "./dist/jest-dom/types/matchers-standalone.d.ts",
|
|
98
|
+
"require": "./dist/jest-dom/matchers.cjs",
|
|
99
|
+
"default": "./dist/jest-dom/matchers.js"
|
|
100
|
+
},
|
|
101
|
+
"./jest-dom/vitest": {
|
|
102
|
+
"types": "./dist/jest-dom/types/vitest.d.ts",
|
|
103
|
+
"require": "./dist/jest-dom/vitest.cjs",
|
|
104
|
+
"default": "./dist/jest-dom/vitest.js"
|
|
105
|
+
},
|
|
106
|
+
"./jest-dom/jest-globals": {
|
|
107
|
+
"types": "./dist/jest-dom/types/jest-globals.d.ts",
|
|
108
|
+
"require": "./dist/jest-dom/jest-globals.cjs",
|
|
109
|
+
"default": "./dist/jest-dom/jest-globals.js"
|
|
110
|
+
},
|
|
111
|
+
"./vitest-environment": {
|
|
112
|
+
"types": "./dist/vitest-environment/types/index.d.ts",
|
|
113
|
+
"default": "./dist/vitest-environment/index.js"
|
|
114
|
+
},
|
|
115
|
+
"./vitest": {
|
|
116
|
+
"types": "./dist/vitest-environment/types/plugin.d.ts",
|
|
117
|
+
"default": "./dist/vitest-environment/plugin.js"
|
|
118
|
+
},
|
|
119
|
+
"./vitest-environment/failure-snapshot": {
|
|
120
|
+
"types": "./dist/vitest-environment/types/failure-snapshot.d.ts",
|
|
121
|
+
"default": "./dist/vitest-environment/failure-snapshot.js"
|
|
122
|
+
},
|
|
123
|
+
"./register": {
|
|
124
|
+
"types": "./dist/register/types/index.d.ts",
|
|
125
|
+
"default": "./dist/register/index.js"
|
|
126
|
+
},
|
|
127
|
+
"./register/pure": {
|
|
128
|
+
"types": "./dist/register/types/pure.d.ts",
|
|
129
|
+
"default": "./dist/register/pure.js"
|
|
130
|
+
},
|
|
131
|
+
"./jest-preset": "./jest-preset.cjs",
|
|
132
|
+
"./package.json": "./package.json"
|
|
133
|
+
},
|
|
134
|
+
"files": [
|
|
135
|
+
"dist",
|
|
136
|
+
"jest-preset.cjs",
|
|
137
|
+
"README.md",
|
|
138
|
+
"NOTICE",
|
|
139
|
+
"LICENSE"
|
|
140
|
+
],
|
|
141
|
+
"dependencies": {
|
|
142
|
+
"@adobe/css-tools": "4.5.0",
|
|
143
|
+
"@babel/code-frame": "^7.10.4",
|
|
144
|
+
"dom-accessibility-api": "0.6.3",
|
|
145
|
+
"picocolors": "1.1.1",
|
|
146
|
+
"pretty-format": "^27.0.2"
|
|
147
|
+
},
|
|
148
|
+
"peerDependencies": {
|
|
149
|
+
"@jest/globals": ">=30.0.0",
|
|
150
|
+
"@types/react": "^19.0.0",
|
|
151
|
+
"@types/react-dom": "^19.0.0",
|
|
152
|
+
"jest": ">=30.0.0",
|
|
153
|
+
"react": "^19.0.0",
|
|
154
|
+
"react-dom": "^19.0.0",
|
|
155
|
+
"vitest": ">=5.0.0"
|
|
156
|
+
},
|
|
157
|
+
"peerDependenciesMeta": {
|
|
158
|
+
"@jest/globals": {
|
|
159
|
+
"optional": true
|
|
160
|
+
},
|
|
161
|
+
"@types/react": {
|
|
162
|
+
"optional": true
|
|
163
|
+
},
|
|
164
|
+
"@types/react-dom": {
|
|
165
|
+
"optional": true
|
|
166
|
+
},
|
|
167
|
+
"jest": {
|
|
168
|
+
"optional": true
|
|
169
|
+
},
|
|
170
|
+
"react": {
|
|
171
|
+
"optional": true
|
|
172
|
+
},
|
|
173
|
+
"react-dom": {
|
|
174
|
+
"optional": true
|
|
175
|
+
},
|
|
176
|
+
"vitest": {
|
|
177
|
+
"optional": true
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|