@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 @@
|
|
|
1
|
+
export declare const PROPERTY_TABLE: readonly (string | number)[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type RawDecl } from "./parser.js";
|
|
2
|
+
export declare class DeclBlock {
|
|
3
|
+
/** Property names (lowercase, or custom property names as written). */
|
|
4
|
+
names: string[];
|
|
5
|
+
/** Specified values, already normalized. */
|
|
6
|
+
values: string[];
|
|
7
|
+
important: boolean[];
|
|
8
|
+
/** Set by put()/removeOne() when they change the block (setProperty's "updated" flag). */
|
|
9
|
+
dirty: boolean;
|
|
10
|
+
constructor();
|
|
11
|
+
get length(): number;
|
|
12
|
+
indexOf(name: string): number;
|
|
13
|
+
clear(): void;
|
|
14
|
+
/** Low-level set: update in place, or append. */
|
|
15
|
+
put(name: string, value: string, important: boolean): void;
|
|
16
|
+
/** Low-level set used while parsing a block: a later declaration moves to the end, but never overrides an important one with a normal one. */
|
|
17
|
+
putParsed(name: string, value: string, important: boolean): void;
|
|
18
|
+
/** Removes `name`; returns true if it was present. */
|
|
19
|
+
removeOne(name: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* https://drafts.csswg.org/cssom/#set-a-css-declaration with value parsing/expansion.
|
|
22
|
+
* `property` must already be normalized (lowercase unless custom). Returns false if the
|
|
23
|
+
* value was invalid (nothing changed).
|
|
24
|
+
*/
|
|
25
|
+
setValue(property: string, value: string, important: boolean, parsing: boolean): boolean;
|
|
26
|
+
putOrParsed(name: string, value: string, important: boolean, parsing: boolean): void;
|
|
27
|
+
/** https://drafts.csswg.org/cssom/#parse-a-css-declaration-block — replaces the contents. */
|
|
28
|
+
parse(text: string): void;
|
|
29
|
+
addRaw(decls: RawDecl[]): void;
|
|
30
|
+
/** Removes a property (expanding shorthands); returns true if anything was removed. */
|
|
31
|
+
remove(property: string): boolean;
|
|
32
|
+
/** https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue */
|
|
33
|
+
getPropertyValue(property: string): string;
|
|
34
|
+
/** https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority */
|
|
35
|
+
getPropertyPriority(property: string): string;
|
|
36
|
+
/** https://drafts.csswg.org/cssom/#serialize-a-css-declaration-block */
|
|
37
|
+
serialize(): string;
|
|
38
|
+
}
|
|
39
|
+
/** Parses a style attribute / declaration list into a fresh block. */
|
|
40
|
+
export declare function parseDeclBlock(text: string): DeclBlock;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./resize-observer.js";
|
|
2
|
+
export { CSSStyleDeclaration } from "./CSSStyleDeclaration.js";
|
|
3
|
+
export { CSSRule, CSSRuleList, CSSGroupingRule, CSSConditionRule, CSSStyleRule, CSSNestedDeclarations, CSSMediaRule, CSSSupportsRule, CSSContainerRule, CSSLayerBlockRule, CSSLayerStatementRule, CSSScopeRule, CSSStartingStyleRule, CSSImportRule, CSSNamespaceRule, CSSFontFaceRule, CSSPageRule, CSSPropertyRule, CSSKeyframesRule, CSSKeyframeRule, StyleSheet, CSSStyleSheet, StyleSheetList, MediaList, } from "./cssom.js";
|
|
4
|
+
export { CSS } from "./CSS.js";
|
|
5
|
+
export { getComputedStyle } from "./computed.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { hasAuthorStyles, isDisplayNone, isDisplayNoneInclusive, computedDisplay, computedVisibility, isVisibilityHidden, pointerEvents, pointerEventsNone, computedValue, pseudoContent, uaDisplay, currentStyleVersion, setComputedColorMode, } from "./cascade.js";
|
|
2
|
+
export { createOwnerSheet as styleElementSheet, removeOwnerSheet, createLinkSheet, registerOwnerSheet, unregisterOwnerSheet, styleSheetsOf, adoptedStyleSheetsOf, setAdoptedStyleSheets, } from "./stylesheets.js";
|
|
3
|
+
export { matchMediaText, parseMediaQueryList, evaluateMediaQueryList, type MediaEnvironment } from "./media.js";
|
|
4
|
+
export { getComputedStyle } from "./computed.js";
|
|
5
|
+
export { DeclBlock, parseDeclBlock } from "./declarations.js";
|
|
6
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
7
|
+
import type { CSSStyleSheet } from "./cssom.js";
|
|
8
|
+
/** A <style> element's text/connection changed: (re)create its sheet. Returns the sheet. */
|
|
9
|
+
export declare function styleElementUpdated(el: NodeImpl, text: string, media?: string): CSSStyleSheet;
|
|
10
|
+
/** A <style>/<link> element's sheet is going away. */
|
|
11
|
+
export declare function styleElementRemoved(el: NodeImpl, sheet: CSSStyleSheet): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Document } from "../nodes/Document.js";
|
|
2
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
3
|
+
import type { Window } from "../window/Window.js";
|
|
4
|
+
export declare const BOX_SCROLLER = 1;
|
|
5
|
+
/** position: fixed on the element or an ancestor box: not moved by window scrolling. */
|
|
6
|
+
export declare const BOX_FIXED = 2;
|
|
7
|
+
/** Non-replaced inline box: client* are 0 (https://drafts.csswg.org/cssom-view/#dom-element-clientwidth step 1). */
|
|
8
|
+
export declare const BOX_INLINE = 4;
|
|
9
|
+
export declare const BOX_ROOT = 8;
|
|
10
|
+
/** Establishes the fixed-position chain cut (the element itself is position: fixed). */
|
|
11
|
+
export declare const BOX_FIXED_SELF = 16;
|
|
12
|
+
/** One element's box. All coordinates are document coordinates with no scrolling applied. */
|
|
13
|
+
export declare class Box {
|
|
14
|
+
/** Border-box origin (layout position: what offsetTop/offsetLeft use). */
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
/** Border-box origin with translate transforms of the element and its ancestors applied. */
|
|
18
|
+
vx: number;
|
|
19
|
+
vy: number;
|
|
20
|
+
/** Border-box size. */
|
|
21
|
+
w: number;
|
|
22
|
+
h: number;
|
|
23
|
+
mt: number;
|
|
24
|
+
mr: number;
|
|
25
|
+
mb: number;
|
|
26
|
+
ml: number;
|
|
27
|
+
bt: number;
|
|
28
|
+
br: number;
|
|
29
|
+
bb: number;
|
|
30
|
+
bl: number;
|
|
31
|
+
pt: number;
|
|
32
|
+
pr: number;
|
|
33
|
+
pb: number;
|
|
34
|
+
pl: number;
|
|
35
|
+
/** This box's index in the generation's box list, and the end (exclusive) of its subtree's range. */
|
|
36
|
+
idx: number;
|
|
37
|
+
end: number;
|
|
38
|
+
gen: number;
|
|
39
|
+
flags: number;
|
|
40
|
+
constructor();
|
|
41
|
+
}
|
|
42
|
+
export declare function setRelayoutListener(fn: (doc: Document) => void): void;
|
|
43
|
+
/** Whether layout-lite applies to a document (its window was created with `layout: "lite"`). */
|
|
44
|
+
export declare function layoutOn(doc: Document): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The element's box, or null when layout-lite is off for its document, the element is not
|
|
47
|
+
* connected, or it generates no box (display: none, inside a replaced element, ...).
|
|
48
|
+
*/
|
|
49
|
+
export declare function boxOf(el: NodeImpl): Box | null;
|
|
50
|
+
/**
|
|
51
|
+
* A computed length in px: px/em/rem/ex/ch/%/vw/vh/vmin/vmax/absolute units and calc(), min(),
|
|
52
|
+
* max(), clamp() over them. NaN for `auto`, `none`, keywords, or a percentage without a base
|
|
53
|
+
* (`pct` NaN). https://drafts.csswg.org/css-values-4/#lengths
|
|
54
|
+
*/
|
|
55
|
+
export declare function length(v: string, pct: number, fs: number): number;
|
|
56
|
+
/** Layout viewport size of the element's window. */
|
|
57
|
+
export declare function viewport(el: NodeImpl): Window;
|
|
58
|
+
/** Content extent of a box's subtree (for scrollWidth/scrollHeight), relative to its padding edge. */
|
|
59
|
+
export declare function scrollExtent(el: NodeImpl, b: Box, vertical: boolean): number;
|
|
60
|
+
export declare function clientWidthOf(b: Box, el: NodeImpl): number;
|
|
61
|
+
export declare function clientHeightOf(b: Box, el: NodeImpl): number;
|
|
62
|
+
/** The box of an element of a document boxOf() just validated (no revalidation: for ancestor walks). */
|
|
63
|
+
export declare function knownBox(el: NodeImpl): Box | null;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface MediaEnvironment {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
devicePixelRatio: number;
|
|
5
|
+
/** "screen" (default) or "print". */
|
|
6
|
+
mediaType?: string;
|
|
7
|
+
/** Feature overrides, e.g. { "prefers-color-scheme": "dark" }. */
|
|
8
|
+
features?: Record<string, string | number> | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const DEFAULT_MEDIA_ENV: MediaEnvironment;
|
|
11
|
+
declare class Tok {
|
|
12
|
+
type: number;
|
|
13
|
+
text: string;
|
|
14
|
+
lower: string;
|
|
15
|
+
num: number;
|
|
16
|
+
unit: string;
|
|
17
|
+
constructor(type: number, text: string, lower: string, num: number, unit: string);
|
|
18
|
+
}
|
|
19
|
+
declare class MQNode {
|
|
20
|
+
kind: number;
|
|
21
|
+
children: MQNode[];
|
|
22
|
+
/** Feature name (lowercase) for N_FEATURE. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Comparison: "" boolean, ":" plain, or "<" "<=" ">" ">=" "=" (feature OP value). */
|
|
25
|
+
op: string;
|
|
26
|
+
value: Tok[] | null;
|
|
27
|
+
/** Second comparison for `a < name < b` ranges (value OP2 feature, normalized as feature op2 value2). */
|
|
28
|
+
op2: string;
|
|
29
|
+
value2: Tok[] | null;
|
|
30
|
+
constructor(kind: number);
|
|
31
|
+
}
|
|
32
|
+
export declare class MediaQuery {
|
|
33
|
+
/** Serialization (https://drafts.csswg.org/cssom/#serialize-a-media-query). */
|
|
34
|
+
text: string;
|
|
35
|
+
negated: boolean;
|
|
36
|
+
/** Lowercase media type ("all" when omitted). */
|
|
37
|
+
type: string;
|
|
38
|
+
condition: MQNode | null;
|
|
39
|
+
/** Unparsable query: evaluates false and serializes as "not all". */
|
|
40
|
+
invalid: boolean;
|
|
41
|
+
constructor(text: string, negated: boolean, type: string, condition: MQNode | null, invalid: boolean);
|
|
42
|
+
}
|
|
43
|
+
/** https://drafts.csswg.org/cssom/#parse-a-media-query-list */
|
|
44
|
+
export declare function parseMediaQueryList(text: string): MediaQuery[];
|
|
45
|
+
/** https://drafts.csswg.org/cssom/#serialize-a-media-query-list */
|
|
46
|
+
export declare function serializeMediaQueryList(list: MediaQuery[]): string;
|
|
47
|
+
/** https://drafts.csswg.org/mediaqueries-5/#evaluating — one query. */
|
|
48
|
+
export declare function evaluateMediaQuery(q: MediaQuery, env: MediaEnvironment): boolean;
|
|
49
|
+
/** A media query list matches if empty or if any query matches. */
|
|
50
|
+
export declare function evaluateMediaQueryList(list: MediaQuery[], env: MediaEnvironment): boolean;
|
|
51
|
+
/** Text-level helper for matchMedia(): https://drafts.csswg.org/cssom-view/#dom-window-matchmedia */
|
|
52
|
+
export declare function matchMediaText(text: string, env: MediaEnvironment): boolean;
|
|
53
|
+
/** Serialization used by MediaQueryList.media. */
|
|
54
|
+
export declare function normalizeMediaText(text: string): string;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CSSTokenizer } from "./tokenizer.js";
|
|
2
|
+
export declare const RULE_QUALIFIED = 1;
|
|
3
|
+
export declare const RULE_AT = 2;
|
|
4
|
+
/**
|
|
5
|
+
* A run of declarations that follows a nested rule inside a block: CSS Syntax's "list of
|
|
6
|
+
* declarations" item of a block's rules (https://drafts.csswg.org/css-syntax-3/#consume-block-contents),
|
|
7
|
+
* which becomes a CSSNestedDeclarations rule (https://drafts.csswg.org/css-nesting-1/#nested-declarations-rule).
|
|
8
|
+
*/
|
|
9
|
+
export declare const RULE_DECLS = 3;
|
|
10
|
+
export declare class RawDecl {
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
important: boolean;
|
|
14
|
+
constructor(name: string, value: string, important: boolean);
|
|
15
|
+
}
|
|
16
|
+
export declare class RawRule {
|
|
17
|
+
/** RULE_QUALIFIED, RULE_AT or RULE_DECLS. */
|
|
18
|
+
kind: number;
|
|
19
|
+
/** At-rule name without "@" (as written); "" for qualified rules. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Prelude text, comments removed, trimmed. */
|
|
22
|
+
prelude: string;
|
|
23
|
+
/** Whether the rule ended with a {} block (vs. ";" / EOF). */
|
|
24
|
+
hasBlock: boolean;
|
|
25
|
+
/** Every declaration found directly in the block, in order. */
|
|
26
|
+
decls: RawDecl[];
|
|
27
|
+
/**
|
|
28
|
+
* How many of `decls` precede the first nested rule (the rule's own declarations). The
|
|
29
|
+
* later ones are also listed, grouped, as RULE_DECLS entries of `rules`.
|
|
30
|
+
*/
|
|
31
|
+
leading: number;
|
|
32
|
+
/** Rules found directly in the block, with RULE_DECLS runs between and after them. */
|
|
33
|
+
rules: RawRule[];
|
|
34
|
+
constructor(kind: number, name: string, prelude: string, hasBlock: boolean);
|
|
35
|
+
}
|
|
36
|
+
/** Removes comments from a source slice by re-tokenizing it (only called when the range contained comments). */
|
|
37
|
+
export declare function stripComments(text: string): string;
|
|
38
|
+
export declare class CSSParser {
|
|
39
|
+
src: string;
|
|
40
|
+
t: CSSTokenizer;
|
|
41
|
+
/** True when the current token has been pushed back and must be returned by the next `advance()`. */
|
|
42
|
+
peeked: boolean;
|
|
43
|
+
/** Closer stack for skipping nested blocks. */
|
|
44
|
+
stack: number[];
|
|
45
|
+
/** Results of the last consumed declaration value scan. */
|
|
46
|
+
valueStart: number;
|
|
47
|
+
valueEnd: number;
|
|
48
|
+
importantEnd: number;
|
|
49
|
+
important: boolean;
|
|
50
|
+
valueHasBlock: boolean;
|
|
51
|
+
valueOtherCount: number;
|
|
52
|
+
constructor(src: string);
|
|
53
|
+
advance(): number;
|
|
54
|
+
reconsume(): void;
|
|
55
|
+
/** Returns the next non-whitespace token type (consumed). */
|
|
56
|
+
advanceNonWs(): number;
|
|
57
|
+
/** Source offset of the current token start (the mark used for backtracking). */
|
|
58
|
+
mark(): number;
|
|
59
|
+
restore(pos: number): void;
|
|
60
|
+
/** Skips the rest of a simple block / function whose opening token was just consumed. */
|
|
61
|
+
skipBlock(opener: number): void;
|
|
62
|
+
/** Slice of the source with comments removed when the range contained any. */
|
|
63
|
+
text(start: number, end: number, commentsBefore: number): string;
|
|
64
|
+
parseStylesheet(): RawRule[];
|
|
65
|
+
consumeAtRule(nested: boolean): RawRule | null;
|
|
66
|
+
consumeQualifiedRule(nested: boolean): RawRule | null;
|
|
67
|
+
consumeBlockContents(rule: RawRule): void;
|
|
68
|
+
/**
|
|
69
|
+
* https://drafts.csswg.org/css-syntax-3/#consume-declaration — the name ident is the
|
|
70
|
+
* current token. Returns null (without consuming the remnants) when this is not a valid
|
|
71
|
+
* declaration; the caller restores and re-parses it as a nested rule.
|
|
72
|
+
*/
|
|
73
|
+
consumeDeclaration(): RawDecl | null;
|
|
74
|
+
/**
|
|
75
|
+
* Consumes a declaration value up to (and including) ";" or up to (not including) "}" /
|
|
76
|
+
* EOF, recording the value range and whether it ends with "!important".
|
|
77
|
+
*/
|
|
78
|
+
scanValue(): void;
|
|
79
|
+
}
|
|
80
|
+
/** https://drafts.csswg.org/css-syntax-3/#parse-stylesheet */
|
|
81
|
+
export declare function parseStylesheet(src: string): RawRule[];
|
|
82
|
+
/**
|
|
83
|
+
* https://drafts.csswg.org/css-syntax-3/#parse-rule — returns null on a syntax error
|
|
84
|
+
* (nothing, or more than one rule).
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseRule(src: string): RawRule | null;
|
|
87
|
+
/**
|
|
88
|
+
* https://drafts.csswg.org/css-syntax-3/#parse-block-contents keeping only declarations —
|
|
89
|
+
* what the `style` attribute and `cssText` setters use.
|
|
90
|
+
*/
|
|
91
|
+
export declare function parseDeclarationList(src: string): RawDecl[];
|
|
92
|
+
/** True if a value contains bad-string / bad-url tokens or unbalanced closers (never valid). */
|
|
93
|
+
export declare function hasInvalidTokens(value: string): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class PropInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
inherited: boolean;
|
|
4
|
+
/** Initial value as computed-value text (browser serialization). */
|
|
5
|
+
initial: string;
|
|
6
|
+
/** Longhands per spec data (also for shorthands we store as-is). */
|
|
7
|
+
specLonghands: string[] | null;
|
|
8
|
+
constructor(name: string, inherited: boolean, initial: string, specLonghands: string[] | null);
|
|
9
|
+
}
|
|
10
|
+
/** Metadata for a lowercase property name, or undefined if unsupported. */
|
|
11
|
+
export declare function propertyInfo(name: string): PropInfo | undefined;
|
|
12
|
+
export declare function isSupportedProperty(name: string): boolean;
|
|
13
|
+
export declare function isCustomPropertyName(name: string): boolean;
|
|
14
|
+
export declare function isInherited(name: string): boolean;
|
|
15
|
+
/** All supported property names (sorted). */
|
|
16
|
+
export declare function allPropertyNames(): readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Properties enumerated by computed style declarations: longhands (no spec longhands of
|
|
19
|
+
* their own), unprefixed, sorted — like browsers' `getComputedStyle()` item list.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computedPropertyNames(): readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* https://drafts.csswg.org/cssom/#css-property-to-idl-attribute — "margin-top" → "marginTop",
|
|
24
|
+
* "-webkit-x" → "WebkitX" (with lowercase_first = false), "float" → also "cssFloat".
|
|
25
|
+
*/
|
|
26
|
+
export declare function cssPropertyToIDLAttribute(property: string, lowercaseFirst: boolean): string;
|
|
27
|
+
/** Converts an IDL attribute name or property-ish key to a CSS property name ("" if none). */
|
|
28
|
+
export declare function idlAttributeToProperty(key: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Element } from "../nodes/Element.js";
|
|
2
|
+
import { DOMRectReadOnly } from "../window/geometry.js";
|
|
3
|
+
/** https://drafts.csswg.org/resize-observer/#resizeobserversize */
|
|
4
|
+
export declare class ResizeObserverSize {
|
|
5
|
+
readonly inlineSize: number;
|
|
6
|
+
readonly blockSize: number;
|
|
7
|
+
constructor(inlineSize: number, blockSize: number);
|
|
8
|
+
get [Symbol.toStringTag](): string;
|
|
9
|
+
}
|
|
10
|
+
/** https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface */
|
|
11
|
+
export declare class ResizeObserverEntry {
|
|
12
|
+
readonly target: Element;
|
|
13
|
+
readonly contentRect: DOMRectReadOnly;
|
|
14
|
+
readonly borderBoxSize: readonly ResizeObserverSize[];
|
|
15
|
+
readonly contentBoxSize: readonly ResizeObserverSize[];
|
|
16
|
+
readonly devicePixelContentBoxSize: readonly ResizeObserverSize[];
|
|
17
|
+
constructor(target: Element, border: ResizeObserverSize, content: ResizeObserverSize, device: ResizeObserverSize, paddingLeft: number, paddingTop: number);
|
|
18
|
+
get [Symbol.toStringTag](): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Splits a selector list on top-level commas (trimmed parts). */
|
|
2
|
+
export declare function splitSelectorList(text: string): string[];
|
|
3
|
+
/** Does a (nested) selector contain the nesting selector `&` at any level? */
|
|
4
|
+
export declare function containsNesting(text: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a nested style rule's selector list against its parent's resolved selector list
|
|
7
|
+
* (https://drafts.csswg.org/css-nesting-1/#nest-selector): `&` represents the elements the
|
|
8
|
+
* parent list matches, with the specificity of `:is(<parent list>)`, so it is replaced by
|
|
9
|
+
* `:is(...)` — textually only when the parent is one compound selector that cannot change
|
|
10
|
+
* meaning when glued to its neighbours (no combinator, no leading type selector). Selectors
|
|
11
|
+
* without `&` are relative to the parent (`& ` prepended, keeping a leading combinator).
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveNested(child: string, parents: string[]): string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Comp } from "./values.js";
|
|
2
|
+
/** Expanded shorthand → longhands (in serialization order). */
|
|
3
|
+
export declare const SHORTHANDS: Map<string, string[]>;
|
|
4
|
+
export declare function isExpandedShorthand(name: string): boolean;
|
|
5
|
+
export declare function longhandsOf(name: string): string[] | undefined;
|
|
6
|
+
/** Shorthands that contain `longhand`, in preferred (largest-first) order. */
|
|
7
|
+
export declare function shorthandsContaining(longhand: string): string[] | undefined;
|
|
8
|
+
/** https://drafts.csswg.org/css-backgrounds-3/#typedef-bg-position → [x, y]. */
|
|
9
|
+
export declare function parsePosition(parts: Comp[]): string[] | null;
|
|
10
|
+
/**
|
|
11
|
+
* Expands a shorthand value into longhand values aligned with `longhandsOf(name)`. Returns
|
|
12
|
+
* null if invalid. (CSS-wide keywords and var() are handled by the caller.)
|
|
13
|
+
*/
|
|
14
|
+
export declare function expandShorthand(name: string, value: string): string[] | null;
|
|
15
|
+
/** One map of every shorthand the cascade records per longhand (expanded and cascade-only). */
|
|
16
|
+
export declare function pendingLonghandsMap(): Map<string, string[]>;
|
|
17
|
+
/** Longhands the cascade records for a declaration of `name` (expanded or cascade-only shorthand), else undefined. */
|
|
18
|
+
export declare function cascadeLonghandsOf(name: string): string[] | undefined;
|
|
19
|
+
export declare function isCascadeOnlyShorthand(name: string): boolean;
|
|
20
|
+
/** Expands a cascade-only shorthand into values aligned with `cascadeLonghandsOf(name)`, or null if invalid. */
|
|
21
|
+
export declare function expandCascadeShorthand(name: string, value: string): string[] | null;
|
|
22
|
+
/** Computed-value serialization of a cascade-only shorthand from its computed longhands (Blink's order). */
|
|
23
|
+
export declare function serializeCascadeShorthand(name: string, v: string[]): string;
|
|
24
|
+
/** Sentinel: a valid value that is stored unexpanded (multi-layer backgrounds). */
|
|
25
|
+
export declare const MULTI_LAYER: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Serializes an expanded shorthand from its longhand values (aligned with
|
|
28
|
+
* `longhandsOf(name)`), or returns "" if the longhands cannot be represented.
|
|
29
|
+
* `computed` selects computed-style serialization (no omission of initial values).
|
|
30
|
+
*/
|
|
31
|
+
export declare function serializeShorthand(name: string, v: string[], computed: boolean): string;
|
|
32
|
+
/** Normalizes a single longhand value from a shorthand component list (helper for callers). */
|
|
33
|
+
export declare function normalizeLonghandValue(name: string, value: string): string | null;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Document } from "../nodes/Document.js";
|
|
2
|
+
import type { NodeImpl } from "../nodes/NodeImpl.js";
|
|
3
|
+
import { CSSStyleSheet, StyleSheetList } from "./cssom.js";
|
|
4
|
+
import type { RuleIndex } from "./cascade.js";
|
|
5
|
+
/** Style sheets of one tree (a document or a shadow root). */
|
|
6
|
+
export declare class RootStyles {
|
|
7
|
+
root: NodeImpl;
|
|
8
|
+
/** Owner sheets (<style>, <link>) in tree order. */
|
|
9
|
+
owners: CSSStyleSheet[];
|
|
10
|
+
ownerNodes: NodeImpl[];
|
|
11
|
+
/** The adoptedStyleSheets array handed out to script (may be mutated in place). */
|
|
12
|
+
adopted: CSSStyleSheet[];
|
|
13
|
+
/** Copy of `adopted` at the last validation (detects push/splice). */
|
|
14
|
+
adoptedSnapshot: CSSStyleSheet[];
|
|
15
|
+
list: StyleSheetList | null;
|
|
16
|
+
/** `adopted` was handed to script, which may mutate it in place (validateAdopted watches it). */
|
|
17
|
+
adoptedExposed: boolean;
|
|
18
|
+
/** Listed in its document's DocCSS.shadows index. */
|
|
19
|
+
indexed: boolean;
|
|
20
|
+
/** The weak reference the document's RootRefs hold (created on first use). */
|
|
21
|
+
ref: WeakRef<RootStyles> | null;
|
|
22
|
+
/** Rule index cache (built by cascade.ts). */
|
|
23
|
+
index: RuleIndex | null;
|
|
24
|
+
constructor(root: NodeImpl);
|
|
25
|
+
hasSheets(): boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Document-wide CSS state, hung on `Document._css`. */
|
|
28
|
+
/**
|
|
29
|
+
* Weak references to shadow roots' RootStyles. Collected entries are pruned whenever the set
|
|
30
|
+
* doubles since the last prune (amortized O(1) per add), so a document that sees thousands of
|
|
31
|
+
* short-lived shadow roots keeps a small index. Walkers deref each entry and delete the collected.
|
|
32
|
+
*/
|
|
33
|
+
export declare class RootRefs {
|
|
34
|
+
readonly refs: Set<WeakRef<RootStyles>>;
|
|
35
|
+
pruneAt: number;
|
|
36
|
+
constructor();
|
|
37
|
+
add(rs: RootStyles): void;
|
|
38
|
+
delete(rs: RootStyles): void;
|
|
39
|
+
}
|
|
40
|
+
export declare class DocCSS {
|
|
41
|
+
doc: Document;
|
|
42
|
+
main: RootStyles;
|
|
43
|
+
/**
|
|
44
|
+
* Shadow roots with sheets, or whose `styleSheets` / `adoptedStyleSheets` script holds, for the
|
|
45
|
+
* "does any sheet apply?" fast paths. Weak: each shadow root owns its RootStyles (shadowStyles),
|
|
46
|
+
* so a shadow tree that goes away (custom elements rendered per test, Lit components adopting a
|
|
47
|
+
* shared sheet) is collected with its host. Entries leave when unused (releaseIfUnused) or
|
|
48
|
+
* collected (RootRefs prunes them).
|
|
49
|
+
*/
|
|
50
|
+
shadows: RootRefs | null;
|
|
51
|
+
/** Shadow roots whose adoptedStyleSheets array script holds (validateAdopted checks only these). */
|
|
52
|
+
watched: RootRefs | null;
|
|
53
|
+
/** Viewport the rule index was last validated against. */
|
|
54
|
+
envWidth: number;
|
|
55
|
+
envHeight: number;
|
|
56
|
+
envDpr: number;
|
|
57
|
+
/** Cache for hasAuthorStyles(): (version, styleVersion) → result. */
|
|
58
|
+
authorVersion: number;
|
|
59
|
+
authorStyleVersion: number;
|
|
60
|
+
authorResult: boolean;
|
|
61
|
+
constructor(doc: Document);
|
|
62
|
+
}
|
|
63
|
+
export declare function docCSS(doc: Document): DocCSS;
|
|
64
|
+
export declare function existingDocCSS(doc: Document): DocCSS | null;
|
|
65
|
+
/** RootStyles for a tree root (document or shadow root impl), created (and indexed) on demand. */
|
|
66
|
+
export declare function rootStylesFor(root: NodeImpl, create: boolean): RootStyles | null;
|
|
67
|
+
/** Top of the (shadow-scoped) tree containing `n`. */
|
|
68
|
+
export declare function treeTop(n: NodeImpl): NodeImpl;
|
|
69
|
+
/** Is `top` a tree root whose sheets apply (a document, or a shadow root)? */
|
|
70
|
+
export declare function isStyleRoot(top: NodeImpl): boolean;
|
|
71
|
+
/** Negative if a precedes b in tree order. */
|
|
72
|
+
export declare function compareTreeOrder(a: NodeImpl, b: NodeImpl): number;
|
|
73
|
+
/** Registers a new owner sheet (from a connected <style>/<link>) with its tree. */
|
|
74
|
+
export declare function registerOwnerSheet(owner: NodeImpl, sheet: CSSStyleSheet): void;
|
|
75
|
+
/** Removes an owner sheet (element disconnected, emptied or retyped). */
|
|
76
|
+
export declare function unregisterOwnerSheet(owner: NodeImpl, sheet: CSSStyleSheet): void;
|
|
77
|
+
/** `styleSheetHooks.createSheet` — https://html.spec.whatwg.org/#update-a-style-block step 6 */
|
|
78
|
+
export declare function createOwnerSheet(owner: NodeImpl, text: string, media: string): CSSStyleSheet;
|
|
79
|
+
/** `styleSheetHooks.createLinkSheet` — an empty sheet (nothing is fetched). */
|
|
80
|
+
export declare function createLinkSheet(owner: NodeImpl, href: string, media: string): CSSStyleSheet;
|
|
81
|
+
/** `styleSheetHooks.removeSheet` */
|
|
82
|
+
export declare function removeOwnerSheet(owner: NodeImpl, sheet: object): void;
|
|
83
|
+
/** https://drafts.csswg.org/cssom/#dom-documentorshadowroot-stylesheets */
|
|
84
|
+
export declare function styleSheetsOf(root: NodeImpl): StyleSheetList;
|
|
85
|
+
/** https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets (getter) */
|
|
86
|
+
export declare function adoptedStyleSheetsOf(root: NodeImpl): CSSStyleSheet[];
|
|
87
|
+
/** Setter: every entry must be a constructed sheet of the same document. */
|
|
88
|
+
export declare function setAdoptedStyleSheets(root: NodeImpl, value: unknown): void;
|
|
89
|
+
/**
|
|
90
|
+
* Detects in-place mutation of adoptedStyleSheets arrays (push/splice) since the last check
|
|
91
|
+
* and bumps the style version if so. Cheap: compares a few references.
|
|
92
|
+
*/
|
|
93
|
+
export declare function validateAdopted(css: DocCSS): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** https://drafts.csswg.org/css-conditional-3/#dom-css-supports — property/value form. */
|
|
2
|
+
export declare function supportsDeclaration(property: string, value: string): boolean;
|
|
3
|
+
/** https://drafts.csswg.org/css-conditional-3/#dom-css-supports-conditiontext */
|
|
4
|
+
export declare function evaluateSupportsCondition(text: string): boolean;
|
|
@@ -0,0 +1,91 @@
|
|
|
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_KEYWORD = 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_WHITESPACE = 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
|
+
/** https://drafts.csswg.org/css-syntax-3/#ident-start-code-point */
|
|
27
|
+
export declare function isIdentStart(c: number): boolean;
|
|
28
|
+
/** https://drafts.csswg.org/css-syntax-3/#ident-code-point */
|
|
29
|
+
export declare function isIdentChar(c: number): boolean;
|
|
30
|
+
export declare class CSSTokenizer {
|
|
31
|
+
src: string;
|
|
32
|
+
len: number;
|
|
33
|
+
pos: number;
|
|
34
|
+
/** Current token type (TK_*). */
|
|
35
|
+
type: number;
|
|
36
|
+
/** Source offsets of the current token. */
|
|
37
|
+
start: number;
|
|
38
|
+
end: number;
|
|
39
|
+
/**
|
|
40
|
+
* Decoded value: ident/function/at-keyword/hash name, string/url contents, delim
|
|
41
|
+
* character, or the unit for dimensions. "" for other tokens.
|
|
42
|
+
*/
|
|
43
|
+
value: string;
|
|
44
|
+
/** Numeric value of number/percentage/dimension tokens. */
|
|
45
|
+
num: number;
|
|
46
|
+
/** Number token type flag: true for "integer", false for "number". */
|
|
47
|
+
isInteger: boolean;
|
|
48
|
+
/** Dimension unit (decoded, original case). */
|
|
49
|
+
unit: string;
|
|
50
|
+
/** Hash token type flag: true for "id". */
|
|
51
|
+
hashId: boolean;
|
|
52
|
+
/** Number token sign character ("+", "-" or ""). */
|
|
53
|
+
sign: string;
|
|
54
|
+
/** Number of comments skipped so far (lets callers detect comments inside a range). */
|
|
55
|
+
comments: number;
|
|
56
|
+
constructor(src: string);
|
|
57
|
+
/** Restarts tokenization at `pos` (used for backtracking by the parser). */
|
|
58
|
+
reset(pos: number): void;
|
|
59
|
+
code(i: number): number;
|
|
60
|
+
/** https://drafts.csswg.org/css-syntax-3/#starts-with-a-valid-escape */
|
|
61
|
+
validEscape(i: number): boolean;
|
|
62
|
+
/** https://drafts.csswg.org/css-syntax-3/#would-start-an-identifier */
|
|
63
|
+
startsIdent(i: number): boolean;
|
|
64
|
+
/** https://drafts.csswg.org/css-syntax-3/#starts-with-a-number */
|
|
65
|
+
startsNumber(i: number): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* https://drafts.csswg.org/css-syntax-3/#consume-escaped-code-point — `this.pos` is just
|
|
68
|
+
* past the backslash. Returns the decoded code point as a string.
|
|
69
|
+
*/
|
|
70
|
+
consumeEscape(): string;
|
|
71
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-name */
|
|
72
|
+
consumeName(): string;
|
|
73
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-number */
|
|
74
|
+
consumeNumber(): void;
|
|
75
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-numeric-token */
|
|
76
|
+
consumeNumeric(): number;
|
|
77
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-string-token — `this.pos` is past the opening quote. */
|
|
78
|
+
consumeString(quote: number): number;
|
|
79
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-remnants-of-bad-url */
|
|
80
|
+
consumeBadUrl(): number;
|
|
81
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-url-token — `this.pos` is past "url(". */
|
|
82
|
+
consumeUrl(): number;
|
|
83
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-ident-like-token */
|
|
84
|
+
consumeIdentLike(): number;
|
|
85
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-comments */
|
|
86
|
+
skipComments(): void;
|
|
87
|
+
/** https://drafts.csswg.org/css-syntax-3/#consume-token — returns the token type. */
|
|
88
|
+
next(): number;
|
|
89
|
+
consumeToken(): number;
|
|
90
|
+
delim(): number;
|
|
91
|
+
}
|