diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eff083fb08..717c4b0029 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,4 +43,4 @@ jobs: name: Benchmarks needs: build_test if: ${{ needs.filter_jobs.outputs.jsChanged == 'true' }} - uses: ./.github/workflows/benchmarks.yml \ No newline at end of file + uses: ./.github/workflows/benchmarks.yml diff --git a/.github/workflows/pr-reporter.yml b/.github/workflows/pr-reporter.yml index 01796fd585..cb7c64024d 100644 --- a/.github/workflows/pr-reporter.yml +++ b/.github/workflows/pr-reporter.yml @@ -79,4 +79,4 @@ jobs: path: results/**/*.json base-bench-name: preact-main pr-bench-name: preact-local - summarize: 'duration, usedJSHeapSize' \ No newline at end of file + summarize: 'duration, usedJSHeapSize' diff --git a/.github/workflows/run-bench.yml b/.github/workflows/run-bench.yml index f741724499..d20126598d 100644 --- a/.github/workflows/run-bench.yml +++ b/.github/workflows/run-bench.yml @@ -119,4 +119,4 @@ jobs: with: name: ${{ steps.log-artifact-name.outputs.artifact_name }} path: benchmarks/out/${{ inputs.benchmark }}_logs.tgz - if-no-files-found: ignore \ No newline at end of file + if-no-files-found: ignore diff --git a/.github/workflows/single-bench.yml b/.github/workflows/single-bench.yml index 76e99147a4..df2eb8e84e 100644 --- a/.github/workflows/single-bench.yml +++ b/.github/workflows/single-bench.yml @@ -87,4 +87,4 @@ jobs: with: benchmark: ${{ inputs.benchmark }} trace: ${{ inputs.trace }} - # timeout: ${{ inputs.timeout }} \ No newline at end of file + # timeout: ${{ inputs.timeout }} diff --git a/.github/workflows/size.yml b/.github/workflows/size.yml index 0dff893cb0..af18dba509 100644 --- a/.github/workflows/size.yml +++ b/.github/workflows/size.yml @@ -18,4 +18,4 @@ jobs: repo-token: '${{ secrets.GITHUB_TOKEN }}' # Our `prepare` script already builds the app post-install, # building it again would be redundant - build-script: 'npm run --if-present noop' \ No newline at end of file + build-script: 'npm run --if-present noop' diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000000..0358ac466b --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,46 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "endOfLine": "lf", + "insertFinalNewline": true, + "useTabs": true, + "tabWidth": 2, + "printWidth": 80, + "singleQuote": true, + "jsxSingleQuote": false, + "quoteProps": "as-needed", + "trailingComma": "none", + "semi": true, + "arrowParens": "avoid", + "bracketSameLine": false, + "bracketSpacing": true, + "singleAttributePerLine": false, + "experimentalSortPackageJson": false, + "ignorePatterns": [ + "benchmarks/**", + "**/.DS_Store", + "**/node_modules", + "**/npm-debug.log", + "**/dist", + "*/package-lock.json", + "**/yarn.lock", + "**/.vscode", + "**/.idea", + "test/ts/**/*.js", + "**/coverage", + "**/*.sw[op]", + "**/*.log", + "**/package/", + "**/preact-*.tgz", + "**/preact.tgz", + "**/package-lock.json" + ], + "overrides": [ + { + "files": ["*.json", ".*rc", "*.yml"], + "options": { + "useTabs": false, + "tabWidth": 2 + } + } + ] +} diff --git a/biome.json b/biome.json deleted file mode 100644 index 3f3271cfb7..0000000000 --- a/biome.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "formatter": { - "enabled": true, - "formatWithErrors": false, - "indentStyle": "tab", - "indentWidth": 2, - "lineEnding": "lf", - "lineWidth": 80, - "attributePosition": "auto", - "ignore": [ - "**/.DS_Store", - "**/node_modules", - "**/npm-debug.log", - "**/dist", - "*/package-lock.json", - "**/yarn.lock", - "**/.vscode", - "**/.idea", - "test/ts/**/*.js", - "**/coverage", - "**/*.sw[op]", - "**/*.log", - "**/package/", - "**/preact-*.tgz", - "**/preact.tgz", - "**/package-lock.json" - ] - }, - "organizeImports": { "enabled": true }, - "linter": { "enabled": true, "rules": { "recommended": true } }, - "javascript": { - "formatter": { - "jsxQuoteStyle": "double", - "quoteProperties": "asNeeded", - "trailingCommas": "none", - "semicolons": "always", - "arrowParentheses": "asNeeded", - "bracketSpacing": true, - "bracketSameLine": false, - "quoteStyle": "single", - "attributePosition": "auto" - } - }, - "overrides": [ - { - "include": ["*.json", ".*rc", "*.yml"], - "formatter": { "indentWidth": 2, "indentStyle": "space" } - } - ] -} diff --git a/compat/src/index.d.ts b/compat/src/index.d.ts index e38b606e00..17df7b9712 100644 --- a/compat/src/index.d.ts +++ b/compat/src/index.d.ts @@ -74,22 +74,23 @@ declare namespace React { export function startTransition(cb: () => void): void; // HTML - export interface HTMLAttributes - extends JSXInternal.HTMLAttributes {} + export interface HTMLAttributes< + T extends EventTarget + > extends JSXInternal.HTMLAttributes {} export interface HTMLProps - extends JSXInternal.AllHTMLAttributes, - preact.ClassAttributes {} - export interface AllHTMLAttributes - extends JSXInternal.AllHTMLAttributes {} + extends JSXInternal.AllHTMLAttributes, preact.ClassAttributes {} + export interface AllHTMLAttributes< + T extends EventTarget + > extends JSXInternal.AllHTMLAttributes {} export import DetailedHTMLProps = JSXInternal.DetailedHTMLProps; export import CSSProperties = JSXInternal.CSSProperties; export interface SVGProps - extends JSXInternal.SVGAttributes, - preact.ClassAttributes {} + extends JSXInternal.SVGAttributes, preact.ClassAttributes {} - interface SVGAttributes - extends JSXInternal.SVGAttributes {} + interface SVGAttributes< + T extends EventTarget = SVGElement + > extends JSXInternal.SVGAttributes {} interface ReactSVG extends JSXInternal.IntrinsicSVGElements {} @@ -260,8 +261,9 @@ declare namespace React { displayName?: string; } - export interface ForwardRefExoticComponent

- extends preact.FunctionComponent

{ + export interface ForwardRefExoticComponent< + P + > extends preact.FunctionComponent

{ defaultProps?: Partial

| undefined; } diff --git a/compat/src/internal.d.ts b/compat/src/internal.d.ts index efc5287ca3..a07b2a2090 100644 --- a/compat/src/internal.d.ts +++ b/compat/src/internal.d.ts @@ -40,8 +40,10 @@ export interface SuspenseState { _suspended?: null | VNode; } -export interface SuspenseComponent - extends PreactComponent { +export interface SuspenseComponent extends PreactComponent< + SuspenseProps, + SuspenseState +> { _pendingSuspensionCount: number; _suspenders: Component[]; _detachOnNextRender: null | VNode; diff --git a/compat/test/browser/forwardRef.test.js b/compat/test/browser/forwardRef.test.js index 241608b177..ae1ce7a1ed 100644 --- a/compat/test/browser/forwardRef.test.js +++ b/compat/test/browser/forwardRef.test.js @@ -509,5 +509,5 @@ describe('forwardRef', () => { const Forwarded = forwardRef(Foo); expect(Forwarded.render).to.equal(Foo); - }); + }); }); diff --git a/compat/test/ts/tsconfig.json b/compat/test/ts/tsconfig.json index 82b3d5f09e..912b586027 100644 --- a/compat/test/ts/tsconfig.json +++ b/compat/test/ts/tsconfig.json @@ -14,4 +14,4 @@ } }, "include": ["./**/*.ts", "./**/*.tsx"] -} \ No newline at end of file +} diff --git a/demo/index.html b/demo/index.html index c4d4fe0d68..c2ebc702c6 100644 --- a/demo/index.html +++ b/demo/index.html @@ -1,4 +1,4 @@ - + diff --git a/demo/people/styles/app.scss b/demo/people/styles/app.scss index 4473f9effd..08dc43ad36 100644 --- a/demo/people/styles/app.scss +++ b/demo/people/styles/app.scss @@ -76,7 +76,9 @@ background-size: 10000%; content: ''; opacity: 0; - transition: opacity 700ms, background 300ms; + transition: + opacity 700ms, + background 300ms; } > nav li > a:active::after { diff --git a/demo/people/styles/button.scss b/demo/people/styles/button.scss index ce4313853f..611a700c4c 100644 --- a/demo/people/styles/button.scss +++ b/demo/people/styles/button.scss @@ -14,7 +14,9 @@ font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; - transition: background 300ms, color 200ms; + transition: + background 300ms, + color 200ms; white-space: nowrap; } @@ -56,7 +58,9 @@ background-size: 20000%; content: ''; opacity: 0; - transition: opacity 700ms, background 400ms; + transition: + opacity 700ms, + background 400ms; } button:active:not(:disabled)::after { diff --git a/demo/people/styles/index.scss b/demo/people/styles/index.scss index 6d73aaa0a0..fa402b6c03 100644 --- a/demo/people/styles/index.scss +++ b/demo/people/styles/index.scss @@ -109,7 +109,9 @@ height: var(--spinner-size); animation: zoom 250ms 500ms forwards ease-out; opacity: 0; - transition: opacity 200ms, transform 200ms ease-in; + transition: + opacity 200ms, + transform 200ms ease-in; } .spinner.exit { diff --git a/demo/style.css b/demo/style.css index becadbf483..e8688d1ea8 100644 --- a/demo/style.css +++ b/demo/style.css @@ -1,6 +1,8 @@ html, body { - font: 14px system-ui, sans-serif; + font: + 14px system-ui, + sans-serif; } .list { list-style: none; @@ -13,7 +15,9 @@ body { } @keyframes fadeIn { 0% { - box-shadow: inset 0 0 2px 2px red, 0 0 2px 2px red; + box-shadow: + inset 0 0 2px 2px red, + 0 0 2px 2px red; } } .list > .odd { diff --git a/demo/style.scss b/demo/style.scss index 51e5c1bdf9..24f76364ea 100644 --- a/demo/style.scss +++ b/demo/style.scss @@ -3,7 +3,10 @@ body { height: 100%; margin: 0; background: #eee; - font: 400 16px/1.3 'Helvetica Neue', helvetica, sans-serif; + font: + 400 16px/1.3 'Helvetica Neue', + helvetica, + sans-serif; text-rendering: optimizeSpeed; color: #444; } @@ -16,7 +19,8 @@ body { > header { flex: 0; background: #f9f9f9; - box-shadow: inset 0 -0.5px 0 0 rgba(0, 0, 0, 0.2), + box-shadow: + inset 0 -0.5px 0 0 rgba(0, 0, 0, 0.2), 0 0.5px 0 0 rgba(255, 255, 255, 0.6); nav { diff --git a/hooks/src/internal.d.ts b/hooks/src/internal.d.ts index 76cd97812b..e219c58390 100644 --- a/hooks/src/internal.d.ts +++ b/hooks/src/internal.d.ts @@ -4,7 +4,7 @@ import { VNode as PreactVNode, PreactContext, HookType, - ErrorInfo, + ErrorInfo } from '../../src/internal'; import { Reducer, StateUpdater } from '.'; @@ -32,7 +32,10 @@ export interface ComponentHooks { _pendingEffects: EffectHookState[]; } -export interface Component extends Omit, '_renderCallbacks'> { +export interface Component extends Omit< + PreactComponent, + '_renderCallbacks' +> { __hooks?: ComponentHooks; // Extend to include HookStates _renderCallbacks?: Array void)>; @@ -80,8 +83,10 @@ export interface MemoHookState extends BaseHookState { _factory?: () => T; } -export interface ReducerHookState - extends BaseHookState { +export interface ReducerHookState< + S = unknown, + A = unknown +> extends BaseHookState { _nextValue?: [S, StateUpdater]; _value?: [S, StateUpdater]; _component?: Component; diff --git a/hooks/test/browser/useImperativeHandle.test.js b/hooks/test/browser/useImperativeHandle.test.js index f05df6212c..794162c31e 100644 --- a/hooks/test/browser/useImperativeHandle.test.js +++ b/hooks/test/browser/useImperativeHandle.test.js @@ -102,14 +102,10 @@ describe('useImperativeHandle', () => { function Comp({ a }) { ref = useRef({}); - useImperativeHandle( - ref, - () => { - createHandleSpy(); - return { test: () => 'test' + a }; - }, - [a] - ); + useImperativeHandle(ref, () => { + createHandleSpy(); + return { test: () => 'test' + a }; + }, [a]); return

Test

; } diff --git a/package-lock.json b/package-lock.json index 4650ffc5f6..531fa0eef1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "@babel/plugin-transform-react-jsx-source": "^7.25.9", "@babel/preset-env": "^7.26.0", "@babel/register": "^7.25.9", - "@biomejs/biome": "^1.9.4", "@types/chai": "^5.0.1", "@types/mocha": "^10.0.0", "@types/node": "^18.19.87", @@ -34,6 +33,7 @@ "microbundle": "^0.15.1", "mocha": "^11.0.0", "npm-run-all2": "^7.0.0", + "oxfmt": "^0.32.0", "oxlint": "^0.15.12", "preact-render-to-string": "^6.5.0", "prop-types": "^15.8.1", @@ -1774,161 +1774,6 @@ "node": ">=6.9.0" } }, - "node_modules/@biomejs/biome": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", - "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", - "dev": true, - "hasInstallScript": true, - "bin": { - "biome": "bin/biome" - }, - "engines": { - "node": ">=14.21.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/biome" - }, - "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.9.4", - "@biomejs/cli-darwin-x64": "1.9.4", - "@biomejs/cli-linux-arm64": "1.9.4", - "@biomejs/cli-linux-arm64-musl": "1.9.4", - "@biomejs/cli-linux-x64": "1.9.4", - "@biomejs/cli-linux-x64-musl": "1.9.4", - "@biomejs/cli-win32-arm64": "1.9.4", - "@biomejs/cli-win32-x64": "1.9.4" - } - }, - "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", - "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-darwin-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", - "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-linux-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", - "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-linux-arm64-musl": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", - "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-linux-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", - "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-linux-x64-musl": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", - "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-win32-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", - "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=14.21.3" - } - }, - "node_modules/@biomejs/cli-win32-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", - "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=14.21.3" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", @@ -2632,6 +2477,310 @@ "@octokit/openapi-types": "^22.2.0" } }, + "node_modules/@oxfmt/binding-android-arm-eabi": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.32.0.tgz", + "integrity": "sha512-DpVyuVzgLH6/MvuB/YD3vXO9CN/o9EdRpA0zXwe/tagP6yfVSFkFWkPqTROdqp0mlzLH5Yl+/m+hOrcM601EbA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-android-arm64": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.32.0.tgz", + "integrity": "sha512-w1cmNXf9zs0vKLuNgyUF3hZ9VUAS1hBmQGndYJv1OmcVqStBtRTRNxSWkWM0TMkrA9UbvIvM9gfN+ib4Wy6lkQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-arm64": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.32.0.tgz", + "integrity": "sha512-m6wQojz/hn94XdZugFPtdFbOvXbOSYEqPsR2gyLyID3BvcrC2QsJyT1o3gb4BZEGtZrG1NiKVGwDRLM0dHd2mg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-x64": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.32.0.tgz", + "integrity": "sha512-hN966Uh6r3Erkg2MvRcrJWaB6QpBzP15rxWK/QtkUyD47eItJLsAQ2Hrm88zMIpFZ3COXZLuN3hqgSlUtvB0Xw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-freebsd-x64": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.32.0.tgz", + "integrity": "sha512-g5UZPGt8tJj263OfSiDGdS54HPa0KgFfspLVAUivVSdoOgsk6DkwVS9nO16xQTDztzBPGxTvrby8WuufF0g86Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.32.0.tgz", + "integrity": "sha512-F4ZY83/PVQo9ZJhtzoMqbmjqEyTVEZjbaw4x1RhzdfUhddB41ZB2Vrt4eZi7b4a4TP85gjPRHgQBeO0c1jbtaw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-musleabihf": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.32.0.tgz", + "integrity": "sha512-olR37eG16Lzdj9OBSvuoT5RxzgM5xfQEHm1OEjB3M7Wm4KWa5TDWIT13Aiy74GvAN77Hq1+kUKcGVJ/0ynf75g==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-gnu": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.32.0.tgz", + "integrity": "sha512-eZhk6AIjRCDeLoXYBhMW7qq/R1YyVi+tGnGfc3kp7AZQrMsFaWtP/bgdCJCTNXMpbMwymtVz0qhSQvR5w2sKcg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-musl": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.32.0.tgz", + "integrity": "sha512-UYiqO9MlipntFbdbUKOIo84vuyzrK4TVIs7Etat91WNMFSW54F6OnHq08xa5ZM+K9+cyYMgQPXvYCopuP+LyKw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-ppc64-gnu": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.32.0.tgz", + "integrity": "sha512-IDH/fxMv+HmKsMtsjEbXqhScCKDIYp38sgGEcn0QKeXMxrda67PPZA7HMfoUwEtFUG+jsO1XJxTrQsL+kQ90xQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-gnu": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.32.0.tgz", + "integrity": "sha512-bQFGPDa0buYWJFeK2I7ah8wRZjrAgamaG2OAGv+Ua5UMYEnHxmHcv+r8lWUUrwP2oqQGvp1SB8JIVtBbYuAueQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-musl": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.32.0.tgz", + "integrity": "sha512-3vFp9DW1ItEKWltADzCFqG5N7rYFToT4ztlhg8wALoo2E2VhveLD88uAF4FF9AxD9NhgHDGmPCV+WZl/Qlj8cQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-s390x-gnu": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.32.0.tgz", + "integrity": "sha512-Fub2y8S9ImuPzAzpbgkoz/EVTWFFBolxFZYCMRhRZc8cJZI2gl/NlZswqhvJd/U0Jopnwgm/OJ2x128vVzFFWA==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-gnu": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.32.0.tgz", + "integrity": "sha512-XufwsnV3BF81zO2ofZvhT4FFaMmLTzZEZnC9HpFz/quPeg9C948+kbLlZnsfjmp+1dUxKMCpfmRMqOfF4AOLsA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-musl": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.32.0.tgz", + "integrity": "sha512-u2f9tC2qYfikKmA2uGpnEJgManwmk0ZXWs5BB4ga4KDu2JNLdA3i634DGHeMLK9wY9+iRf3t7IYpgN3OVFrvDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-openharmony-arm64": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.32.0.tgz", + "integrity": "sha512-5ZXb1wrdbZ1YFXuNXNUCePLlmLDy4sUt4evvzD4Cgumbup5wJgS9PIe5BOaLywUg9f1wTH6lwltj3oT7dFpIGA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-arm64-msvc": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.32.0.tgz", + "integrity": "sha512-IGSMm/Agq+IA0++aeAV/AGPfjcBdjrsajB5YpM3j7cMcwoYgUTi/k2YwAmsHH3ueZUE98pSM/Ise2J7HtyRjOA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-ia32-msvc": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.32.0.tgz", + "integrity": "sha512-H/9gsuqXmceWMsVoCPZhtJG2jLbnBeKr7xAXm2zuKpxLVF7/2n0eh7ocOLB6t+L1ARE76iORuUsRMnuGjj8FjQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-x64-msvc": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.32.0.tgz", + "integrity": "sha512-fF8VIOeligq+mA6KfKvWtFRXbf0EFy73TdR6ZnNejdJRM8VWN1e3QFhYgIwD7O8jBrQsd7EJbUpkAr/YlUOokg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@oxlint/darwin-arm64": { "version": "0.15.15", "resolved": "https://registry.npmjs.org/@oxlint/darwin-arm64/-/darwin-arm64-0.15.15.tgz", @@ -8981,6 +9130,54 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/oxfmt": { + "version": "0.32.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.32.0.tgz", + "integrity": "sha512-KArQhGzt/Y8M1eSAX98Y8DLtGYYDQhkR55THUPY5VNcpFQ+9nRZkL3ULXhagHMD2hIvjy8JSeEQEP5/yYJSrLA==", + "dev": true, + "dependencies": { + "tinypool": "2.1.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxfmt/binding-android-arm-eabi": "0.32.0", + "@oxfmt/binding-android-arm64": "0.32.0", + "@oxfmt/binding-darwin-arm64": "0.32.0", + "@oxfmt/binding-darwin-x64": "0.32.0", + "@oxfmt/binding-freebsd-x64": "0.32.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.32.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.32.0", + "@oxfmt/binding-linux-arm64-gnu": "0.32.0", + "@oxfmt/binding-linux-arm64-musl": "0.32.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.32.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.32.0", + "@oxfmt/binding-linux-riscv64-musl": "0.32.0", + "@oxfmt/binding-linux-s390x-gnu": "0.32.0", + "@oxfmt/binding-linux-x64-gnu": "0.32.0", + "@oxfmt/binding-linux-x64-musl": "0.32.0", + "@oxfmt/binding-openharmony-arm64": "0.32.0", + "@oxfmt/binding-win32-arm64-msvc": "0.32.0", + "@oxfmt/binding-win32-ia32-msvc": "0.32.0", + "@oxfmt/binding-win32-x64-msvc": "0.32.0" + } + }, + "node_modules/oxfmt/node_modules/tinypool": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", + "integrity": "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==", + "dev": true, + "engines": { + "node": "^20.0.0 || >=22.0.0" + } + }, "node_modules/oxlint": { "version": "0.15.15", "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-0.15.15.tgz", diff --git a/package.json b/package.json index 97f56b27b4..95ca04e157 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "source": "src/index.js", "typesVersions": { "<=5.0": { - ".": ["./src/index-5.d.ts"] + ".": [ + "./src/index-5.d.ts" + ] } }, "exports": { @@ -151,12 +153,12 @@ "lint": "run-s oxlint tsc", "tsc": "tsc -p jsconfig-lint.json", "oxlint": "oxlint -c oxlint.json src test/browser test/node test/shared debug compat hooks test-utils", - "format": "biome format --write .", - "format:check": "biome format ." + "format": "oxfmt . --write", + "format:check": "oxfmt --check ." }, "nano-staged": { "**/*.{js,jsx,mjs,cjs,ts,tsx,yml,json,html,md,css,scss}": [ - "biome format --write --no-errors-on-unmatched" + "oxfmt --write --no-error-on-unmatched-pattern" ] }, "files": [ @@ -221,7 +223,6 @@ "@babel/plugin-transform-react-jsx-source": "^7.25.9", "@babel/preset-env": "^7.26.0", "@babel/register": "^7.25.9", - "@biomejs/biome": "^1.9.4", "@types/chai": "^5.0.1", "@types/mocha": "^10.0.0", "@types/node": "^18.19.87", @@ -239,6 +240,7 @@ "microbundle": "^0.15.1", "mocha": "^11.0.0", "npm-run-all2": "^7.0.0", + "oxfmt": "^0.32.0", "oxlint": "^0.15.12", "preact-render-to-string": "^6.5.0", "prop-types": "^15.8.1", diff --git a/src/dom.d.ts b/src/dom.d.ts index 27a5b10671..228dfe5cc1 100644 --- a/src/dom.d.ts +++ b/src/dom.d.ts @@ -42,7 +42,7 @@ interface SnapEvent extends Event { declare var SnapEvent: { prototype: SnapEvent; new (type: string, eventInitDict?: SnapEventInit): SnapEvent; -} +}; interface SnapEventInit extends EventInit { snapTargetBlock?: Element | null; @@ -78,8 +78,9 @@ export interface CSSProperties extends AllCSSProperties, DOMCSSProperties { cssText?: string | null; } -export interface SVGAttributes - extends HTMLAttributes { +export interface SVGAttributes< + Target extends EventTarget = SVGElement +> extends HTMLAttributes { accentHeight?: Signalish; accumulate?: Signalish<'none' | 'sum' | undefined>; additive?: Signalish<'replace' | 'sum' | undefined>; @@ -602,8 +603,9 @@ export type WheelEventHandler = EventHandler< export type PictureInPictureEventHandler = EventHandler>; -export interface DOMAttributes - extends PreactDOMAttributes { +export interface DOMAttributes< + Target extends EventTarget +> extends PreactDOMAttributes { // Image Events onLoad?: GenericEventHandler | undefined; onLoadCapture?: GenericEventHandler | undefined; @@ -1224,9 +1226,7 @@ export type DPubAriaRole = export type AriaRole = WAIAriaRole | DPubAriaRole; export interface AllHTMLAttributes - extends ClassAttributes, - DOMAttributes, - AriaAttributes { + extends ClassAttributes, DOMAttributes, AriaAttributes { // Standard HTML Attributes accept?: Signalish; acceptCharset?: Signalish; @@ -1478,9 +1478,7 @@ export interface AllHTMLAttributes } export interface HTMLAttributes - extends ClassAttributes, - DOMAttributes, - AriaAttributes { + extends ClassAttributes, DOMAttributes, AriaAttributes { // Standard HTML Attributes accesskey?: Signalish; accessKey?: Signalish; @@ -1583,8 +1581,9 @@ export type HTMLAttributeAnchorTarget = | '_top' | (string & {}); -export interface AnchorHTMLAttributes - extends HTMLAttributes { +export interface AnchorHTMLAttributes< + T extends EventTarget = HTMLAnchorElement +> extends HTMLAttributes { download?: Signalish; href?: Signalish; hreflang?: Signalish; @@ -1598,8 +1597,9 @@ export interface AnchorHTMLAttributes referrerPolicy?: Signalish; } -export interface AreaHTMLAttributes - extends HTMLAttributes { +export interface AreaHTMLAttributes< + T extends EventTarget = HTMLAreaElement +> extends HTMLAttributes { alt?: Signalish; coords?: Signalish; download?: Signalish; @@ -1614,11 +1614,13 @@ export interface AreaHTMLAttributes target?: Signalish; } -export interface AudioHTMLAttributes - extends MediaHTMLAttributes {} +export interface AudioHTMLAttributes< + T extends EventTarget = HTMLAudioElement +> extends MediaHTMLAttributes {} -export interface BaseHTMLAttributes - extends HTMLAttributes { +export interface BaseHTMLAttributes< + T extends EventTarget = HTMLBaseElement +> extends HTMLAttributes { href?: Signalish; target?: Signalish; } @@ -1629,8 +1631,9 @@ export interface BlockquoteHTMLAttributes< cite?: Signalish; } -export interface ButtonHTMLAttributes - extends HTMLAttributes { +export interface ButtonHTMLAttributes< + T extends EventTarget = HTMLButtonElement +> extends HTMLAttributes { command?: Signalish; commandfor?: Signalish; commandFor?: Signalish; @@ -1655,14 +1658,16 @@ export interface ButtonHTMLAttributes value?: Signalish; } -export interface CanvasHTMLAttributes - extends HTMLAttributes { +export interface CanvasHTMLAttributes< + T extends EventTarget = HTMLCanvasElement +> extends HTMLAttributes { height?: Signalish; width?: Signalish; } -export interface ColHTMLAttributes - extends HTMLAttributes { +export interface ColHTMLAttributes< + T extends EventTarget = HTMLTableColElement +> extends HTMLAttributes { span?: Signalish; width?: Signalish; } @@ -1673,13 +1678,15 @@ export interface ColgroupHTMLAttributes< span?: Signalish; } -export interface DataHTMLAttributes - extends HTMLAttributes { +export interface DataHTMLAttributes< + T extends EventTarget = HTMLDataElement +> extends HTMLAttributes { value?: Signalish; } -export interface DelHTMLAttributes - extends HTMLAttributes { +export interface DelHTMLAttributes< + T extends EventTarget = HTMLModElement +> extends HTMLAttributes { cite?: Signalish; datetime?: Signalish; dateTime?: Signalish; @@ -1692,8 +1699,9 @@ export interface DetailsHTMLAttributes< open?: Signalish; } -export interface DialogHTMLAttributes - extends HTMLAttributes { +export interface DialogHTMLAttributes< + T extends EventTarget = HTMLDialogElement +> extends HTMLAttributes { onCancel?: GenericEventHandler | undefined; onClose?: GenericEventHandler | undefined; open?: Signalish; @@ -1701,8 +1709,9 @@ export interface DialogHTMLAttributes closedBy?: Signalish<'none' | 'closerequest' | 'any' | undefined>; } -export interface EmbedHTMLAttributes - extends HTMLAttributes { +export interface EmbedHTMLAttributes< + T extends EventTarget = HTMLEmbedElement +> extends HTMLAttributes { height?: Signalish; src?: Signalish; type?: Signalish; @@ -1717,8 +1726,9 @@ export interface FieldsetHTMLAttributes< name?: Signalish; } -export interface FormHTMLAttributes - extends HTMLAttributes { +export interface FormHTMLAttributes< + T extends EventTarget = HTMLFormElement +> extends HTMLAttributes { 'accept-charset'?: Signalish; acceptCharset?: Signalish; action?: Signalish; @@ -1734,8 +1744,9 @@ export interface FormHTMLAttributes target?: Signalish; } -export interface IframeHTMLAttributes - extends HTMLAttributes { +export interface IframeHTMLAttributes< + T extends EventTarget = HTMLIFrameElement +> extends HTMLAttributes { allow?: Signalish; allowFullScreen?: Signalish; allowTransparency?: Signalish; @@ -1764,8 +1775,9 @@ export interface IframeHTMLAttributes export type HTMLAttributeCrossOrigin = 'anonymous' | 'use-credentials'; -export interface ImgHTMLAttributes - extends HTMLAttributes { +export interface ImgHTMLAttributes< + T extends EventTarget = HTMLImageElement +> extends HTMLAttributes { alt?: Signalish; crossorigin?: Signalish; crossOrigin?: Signalish; @@ -1810,8 +1822,9 @@ export type HTMLInputTypeAttribute = | 'week' | (string & {}); -export interface InputHTMLAttributes - extends HTMLAttributes { +export interface InputHTMLAttributes< + T extends EventTarget = HTMLInputElement +> extends HTMLAttributes { accept?: Signalish; alt?: Signalish; autocomplete?: Signalish; @@ -1867,8 +1880,9 @@ export interface InputHTMLAttributes onChange?: GenericEventHandler | undefined; } -export interface InsHTMLAttributes - extends HTMLAttributes { +export interface InsHTMLAttributes< + T extends EventTarget = HTMLModElement +> extends HTMLAttributes { cite?: Signalish; datetime?: Signalish; dateTime?: Signalish; @@ -1885,20 +1899,23 @@ export interface KeygenHTMLAttributes< name?: Signalish; } -export interface LabelHTMLAttributes - extends HTMLAttributes { +export interface LabelHTMLAttributes< + T extends EventTarget = HTMLLabelElement +> extends HTMLAttributes { for?: Signalish; form?: Signalish; htmlFor?: Signalish; } -export interface LiHTMLAttributes - extends HTMLAttributes { +export interface LiHTMLAttributes< + T extends EventTarget = HTMLLIElement +> extends HTMLAttributes { value?: Signalish; } -export interface LinkHTMLAttributes - extends HTMLAttributes { +export interface LinkHTMLAttributes< + T extends EventTarget = HTMLLinkElement +> extends HTMLAttributes { as?: Signalish; crossorigin?: Signalish; crossOrigin?: Signalish; @@ -1919,8 +1936,9 @@ export interface LinkHTMLAttributes charSet?: Signalish; } -export interface MapHTMLAttributes - extends HTMLAttributes { +export interface MapHTMLAttributes< + T extends EventTarget = HTMLMapElement +> extends HTMLAttributes { name?: Signalish; } @@ -1940,8 +1958,9 @@ export interface MarqueeHTMLAttributes< width?: Signalish; } -export interface MediaHTMLAttributes - extends HTMLAttributes { +export interface MediaHTMLAttributes< + T extends EventTarget = HTMLMediaElement +> extends HTMLAttributes { autoplay?: Signalish; autoPlay?: Signalish; controls?: Signalish; @@ -1965,13 +1984,15 @@ export interface MediaHTMLAttributes volume?: Signalish; } -export interface MenuHTMLAttributes - extends HTMLAttributes { +export interface MenuHTMLAttributes< + T extends EventTarget = HTMLMenuElement +> extends HTMLAttributes { type?: Signalish; } -export interface MetaHTMLAttributes - extends HTMLAttributes { +export interface MetaHTMLAttributes< + T extends EventTarget = HTMLMetaElement +> extends HTMLAttributes { charset?: Signalish; charSet?: Signalish; content?: Signalish; @@ -1981,8 +2002,9 @@ export interface MetaHTMLAttributes media?: Signalish; } -export interface MeterHTMLAttributes - extends HTMLAttributes { +export interface MeterHTMLAttributes< + T extends EventTarget = HTMLMeterElement +> extends HTMLAttributes { form?: Signalish; high?: Signalish; low?: Signalish; @@ -1992,8 +2014,9 @@ export interface MeterHTMLAttributes value?: Signalish; } -export interface ObjectHTMLAttributes - extends HTMLAttributes { +export interface ObjectHTMLAttributes< + T extends EventTarget = HTMLObjectElement +> extends HTMLAttributes { classID?: Signalish; data?: Signalish; form?: Signalish; @@ -2006,8 +2029,9 @@ export interface ObjectHTMLAttributes wmode?: Signalish; } -export interface OlHTMLAttributes - extends HTMLAttributes { +export interface OlHTMLAttributes< + T extends EventTarget = HTMLOListElement +> extends HTMLAttributes { reversed?: Signalish; start?: Signalish; type?: Signalish<'1' | 'a' | 'A' | 'i' | 'I' | undefined>; @@ -2020,24 +2044,27 @@ export interface OptgroupHTMLAttributes< label?: Signalish; } -export interface OptionHTMLAttributes - extends HTMLAttributes { +export interface OptionHTMLAttributes< + T extends EventTarget = HTMLOptionElement +> extends HTMLAttributes { disabled?: Signalish; label?: Signalish; selected?: Signalish; value?: Signalish; } -export interface OutputHTMLAttributes - extends HTMLAttributes { +export interface OutputHTMLAttributes< + T extends EventTarget = HTMLOutputElement +> extends HTMLAttributes { for?: Signalish; form?: Signalish; htmlFor?: Signalish; name?: Signalish; } -export interface ParamHTMLAttributes - extends HTMLAttributes { +export interface ParamHTMLAttributes< + T extends EventTarget = HTMLParamElement +> extends HTMLAttributes { name?: Signalish; value?: Signalish; } @@ -2049,13 +2076,15 @@ export interface ProgressHTMLAttributes< value?: Signalish; } -export interface QuoteHTMLAttributes - extends HTMLAttributes { +export interface QuoteHTMLAttributes< + T extends EventTarget = HTMLQuoteElement +> extends HTMLAttributes { cite?: Signalish; } -export interface ScriptHTMLAttributes - extends HTMLAttributes { +export interface ScriptHTMLAttributes< + T extends EventTarget = HTMLScriptElement +> extends HTMLAttributes { async?: Signalish; /** @deprecated */ charset?: Signalish; @@ -2073,8 +2102,9 @@ export interface ScriptHTMLAttributes type?: Signalish; } -export interface SelectHTMLAttributes - extends HTMLAttributes { +export interface SelectHTMLAttributes< + T extends EventTarget = HTMLSelectElement +> extends HTMLAttributes { autocomplete?: Signalish; autoComplete?: Signalish; defaultValue?: Signalish; @@ -2088,13 +2118,15 @@ export interface SelectHTMLAttributes onChange?: GenericEventHandler | undefined; } -export interface SlotHTMLAttributes - extends HTMLAttributes { +export interface SlotHTMLAttributes< + T extends EventTarget = HTMLSlotElement +> extends HTMLAttributes { name?: Signalish; } -export interface SourceHTMLAttributes - extends HTMLAttributes { +export interface SourceHTMLAttributes< + T extends EventTarget = HTMLSourceElement +> extends HTMLAttributes { height?: Signalish; media?: Signalish; sizes?: Signalish; @@ -2105,23 +2137,26 @@ export interface SourceHTMLAttributes width?: Signalish; } -export interface StyleHTMLAttributes - extends HTMLAttributes { +export interface StyleHTMLAttributes< + T extends EventTarget = HTMLStyleElement +> extends HTMLAttributes { media?: Signalish; scoped?: Signalish; type?: Signalish; } -export interface TableHTMLAttributes - extends HTMLAttributes { +export interface TableHTMLAttributes< + T extends EventTarget = HTMLTableElement +> extends HTMLAttributes { cellPadding?: Signalish; cellSpacing?: Signalish; summary?: Signalish; width?: Signalish; } -export interface TdHTMLAttributes - extends HTMLAttributes { +export interface TdHTMLAttributes< + T extends EventTarget = HTMLTableCellElement +> extends HTMLAttributes { align?: Signalish< 'left' | 'center' | 'right' | 'justify' | 'char' | undefined >; @@ -2161,8 +2196,9 @@ export interface TextareaHTMLAttributes< onChange?: GenericEventHandler | undefined; } -export interface ThHTMLAttributes - extends HTMLAttributes { +export interface ThHTMLAttributes< + T extends EventTarget = HTMLTableCellElement +> extends HTMLAttributes { align?: Signalish< 'left' | 'center' | 'right' | 'justify' | 'char' | undefined >; @@ -2175,14 +2211,16 @@ export interface ThHTMLAttributes abbr?: Signalish; } -export interface TimeHTMLAttributes - extends HTMLAttributes { +export interface TimeHTMLAttributes< + T extends EventTarget = HTMLTimeElement +> extends HTMLAttributes { datetime?: Signalish; dateTime?: Signalish; } -export interface TrackHTMLAttributes - extends MediaHTMLAttributes { +export interface TrackHTMLAttributes< + T extends EventTarget = HTMLTrackElement +> extends MediaHTMLAttributes { default?: Signalish; kind?: Signalish; label?: Signalish; @@ -2190,8 +2228,9 @@ export interface TrackHTMLAttributes srcLang?: Signalish; } -export interface VideoHTMLAttributes - extends MediaHTMLAttributes { +export interface VideoHTMLAttributes< + T extends EventTarget = HTMLVideoElement +> extends MediaHTMLAttributes { disablePictureInPicture?: Signalish; height?: Signalish; playsinline?: Signalish; @@ -2205,8 +2244,9 @@ export type DetailedHTMLProps< RefType extends EventTarget = EventTarget > = HA; -export interface MathMLAttributes - extends HTMLAttributes { +export interface MathMLAttributes< + Target extends EventTarget = MathMLElement +> extends HTMLAttributes { dir?: Signalish<'ltr' | 'rtl' | undefined>; displaystyle?: Signalish; /** @deprecated This feature is non-standard. See https://developer.mozilla.org/en-US/docs/Web/MathML/Global_attributes/href */ @@ -2221,50 +2261,58 @@ export interface MathMLAttributes scriptlevel?: Signalish; } -export interface AnnotationMathMLAttributes - extends MathMLAttributes { +export interface AnnotationMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { encoding?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics#src */ src?: Signalish; } -export interface AnnotationXmlMathMLAttributes - extends MathMLAttributes { +export interface AnnotationXmlMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { encoding?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics#src */ src?: Signalish; } -export interface MActionMathMLAttributes - extends MathMLAttributes { +export interface MActionMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/maction#actiontype */ actiontype?: Signalish<'statusline' | 'toggle' | undefined>; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/maction#selection */ selection?: Signalish; } -export interface MathMathMLAttributes - extends MathMLAttributes { +export interface MathMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { display?: Signalish<'block' | 'inline' | undefined>; } -export interface MEncloseMathMLAttributes - extends MathMLAttributes { +export interface MEncloseMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { notation?: Signalish; } -export interface MErrorMathMLAttributes - extends MathMLAttributes {} +export interface MErrorMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MFencedMathMLAttributes - extends MathMLAttributes { +export interface MFencedMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { close?: Signalish; open?: Signalish; separators?: Signalish; } -export interface MFracMathMLAttributes - extends MathMLAttributes { +export interface MFracMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfrac#denomalign */ denomalign?: Signalish<'center' | 'left' | 'right' | undefined>; linethickness?: Signalish; @@ -2272,8 +2320,9 @@ export interface MFracMathMLAttributes numalign?: Signalish<'center' | 'left' | 'right' | undefined>; } -export interface MiMathMLAttributes - extends MathMLAttributes { +export interface MiMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** The only value allowed in the current specification is normal (case insensitive) * See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mi#mathvariant */ mathvariant?: Signalish< @@ -2299,19 +2348,22 @@ export interface MiMathMLAttributes >; } -export interface MmultiScriptsMathMLAttributes - extends MathMLAttributes { +export interface MmultiScriptsMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts#subscriptshift */ subscriptshift?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts#superscriptshift */ superscriptshift?: Signalish; } -export interface MNMathMLAttributes - extends MathMLAttributes {} +export interface MNMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MOMathMLAttributes - extends MathMLAttributes { +export interface MOMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo#accent */ accent?: Signalish; fence?: Signalish; @@ -2326,13 +2378,15 @@ export interface MOMathMLAttributes symmetric?: Signalish; } -export interface MOverMathMLAttributes - extends MathMLAttributes { +export interface MOverMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { accent?: Signalish; } -export interface MPaddedMathMLAttributes - extends MathMLAttributes { +export interface MPaddedMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { depth?: Signalish; height?: Signalish; lspace?: Signalish; @@ -2340,38 +2394,46 @@ export interface MPaddedMathMLAttributes width?: Signalish; } -export interface MPhantomMathMLAttributes - extends MathMLAttributes {} +export interface MPhantomMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MPrescriptsMathMLAttributes - extends MathMLAttributes {} +export interface MPrescriptsMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MRootMathMLAttributes - extends MathMLAttributes {} +export interface MRootMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MRowMathMLAttributes - extends MathMLAttributes {} +export interface MRowMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MSMathMLAttributes - extends MathMLAttributes { +export interface MSMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms#browser_compatibility */ lquote?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms#browser_compatibility */ rquote?: Signalish; } -export interface MSpaceMathMLAttributes - extends MathMLAttributes { +export interface MSpaceMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { depth?: Signalish; height?: Signalish; width?: Signalish; } -export interface MSqrtMathMLAttributes - extends MathMLAttributes {} +export interface MSqrtMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MStyleMathMLAttributes - extends MathMLAttributes { +export interface MStyleMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle#background */ background?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle#color */ @@ -2388,28 +2450,32 @@ export interface MStyleMathMLAttributes scriptsizemultiplier?: Signalish; } -export interface MSubMathMLAttributes - extends MathMLAttributes { +export interface MSubMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msub#subscriptshift */ subscriptshift?: Signalish; } -export interface MSubsupMathMLAttributes - extends MathMLAttributes { +export interface MSubsupMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup#subscriptshift */ subscriptshift?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup#superscriptshift */ superscriptshift?: Signalish; } -export interface MSupMathMLAttributes - extends MathMLAttributes { +export interface MSupMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msup#superscriptshift */ superscriptshift?: Signalish; } -export interface MTableMathMLAttributes - extends MathMLAttributes { +export interface MTableMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtable#align */ align?: Signalish< 'axis' | 'baseline' | 'bottom' | 'center' | 'top' | undefined @@ -2436,8 +2502,9 @@ export interface MTableMathMLAttributes width?: Signalish; } -export interface MTdMathMLAttributes - extends MathMLAttributes { +export interface MTdMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { columnspan?: Signalish; rowspan?: Signalish; /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtd#columnalign */ @@ -2448,11 +2515,13 @@ export interface MTdMathMLAttributes >; } -export interface MTextMathMLAttributes - extends MathMLAttributes {} +export interface MTextMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} -export interface MTrMathMLAttributes - extends MathMLAttributes { +export interface MTrMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtr#columnalign */ columnalign?: Signalish<'center' | 'left' | 'right' | undefined>; /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtr#rowalign */ @@ -2461,16 +2530,19 @@ export interface MTrMathMLAttributes >; } -export interface MUnderMathMLAttributes - extends MathMLAttributes { +export interface MUnderMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { accentunder?: Signalish; } -export interface MUnderoverMathMLAttributes - extends MathMLAttributes { +export interface MUnderoverMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes { accent?: Signalish; accentunder?: Signalish; } -export interface SemanticsMathMLAttributes - extends MathMLAttributes {} +export interface SemanticsMathMLAttributes< + T extends EventTarget +> extends MathMLAttributes {} diff --git a/src/index-5.d.ts b/src/index-5.d.ts index eb9b331d0b..f2bf9577e2 100644 --- a/src/index-5.d.ts +++ b/src/index-5.d.ts @@ -80,11 +80,12 @@ export type ComponentFactory

= ComponentType

; export type ComponentProps< C extends ComponentType | keyof JSXInternal.IntrinsicElements -> = C extends ComponentType - ? P - : C extends keyof JSXInternal.IntrinsicElements - ? JSXInternal.IntrinsicElements[C] - : {}; +> = + C extends ComponentType + ? P + : C extends keyof JSXInternal.IntrinsicElements + ? JSXInternal.IntrinsicElements[C] + : {}; export interface FunctionComponent

{ (props: RenderableProps

, context?: any): VNode | null; @@ -104,8 +105,10 @@ export interface ComponentClass

{ ): Partial | null; getDerivedStateFromError?(error: any): Partial | null; } -export interface ComponentConstructor

- extends ComponentClass {} +export interface ComponentConstructor

extends ComponentClass< + P, + S +> {} // Type alias for a component instance considered generally, whether stateless or stateful. export type AnyComponent

= @@ -373,21 +376,18 @@ export function isValidElement(vnode: any): vnode is VNode; // // Context // ----------------------------------- -export interface Consumer - extends FunctionComponent<{ - children: (value: T) => ComponentChildren; - }> {} +export interface Consumer extends FunctionComponent<{ + children: (value: T) => ComponentChildren; +}> {} export interface PreactConsumer extends Consumer {} -export interface Provider - extends FunctionComponent<{ - value: T; - children?: ComponentChildren; - }> {} +export interface Provider extends FunctionComponent<{ + value: T; + children?: ComponentChildren; +}> {} export interface PreactProvider extends Provider {} -export type ContextType> = C extends Context - ? T - : never; +export type ContextType> = + C extends Context ? T : never; export interface Context { Consumer: Consumer; diff --git a/src/index.d.ts b/src/index.d.ts index 038d3dc4fa..a91a61d7e9 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -82,11 +82,12 @@ export type ComponentFactory

= ComponentType

; export type ComponentProps< C extends ComponentType | keyof JSXInternal.IntrinsicElements -> = C extends ComponentType - ? P - : C extends keyof JSXInternal.IntrinsicElements - ? JSXInternal.IntrinsicElements[C] - : {}; +> = + C extends ComponentType + ? P + : C extends keyof JSXInternal.IntrinsicElements + ? JSXInternal.IntrinsicElements[C] + : {}; export interface FunctionComponent

{ (props: RenderableProps

, context?: any): ComponentChildren; @@ -106,8 +107,10 @@ export interface ComponentClass

{ ): Partial | null; getDerivedStateFromError?(error: any): Partial | null; } -export interface ComponentConstructor

- extends ComponentClass {} +export interface ComponentConstructor

extends ComponentClass< + P, + S +> {} // Type alias for a component instance considered generally, whether stateless or stateful. export type AnyComponent

= @@ -192,14 +195,10 @@ export abstract class Component { export function createElement( type: 'input', props: - | (DOMAttributes & - ClassAttributes) + | (DOMAttributes & ClassAttributes) | null, ...children: ComponentChildren[] -): VNode< - DOMAttributes & - ClassAttributes ->; +): VNode & ClassAttributes>; export function createElement< P extends HTMLAttributes, T extends HTMLElement @@ -218,15 +217,9 @@ export function createElement< ): VNode & P>; export function createElement( type: string, - props: - | (ClassAttributes & - HTMLAttributes & - SVGAttributes) - | null, + props: (ClassAttributes & HTMLAttributes & SVGAttributes) | null, ...children: ComponentChildren[] -): VNode< - ClassAttributes & HTMLAttributes & SVGAttributes ->; +): VNode & HTMLAttributes & SVGAttributes>; export function createElement

( type: ComponentType

| string, props: (Attributes & P) | null, @@ -239,44 +232,25 @@ export namespace createElement { export function h( type: 'input', props: - | (DOMAttributes & - ClassAttributes) + | (DOMAttributes & ClassAttributes) | null, ...children: ComponentChildren[] -): VNode< - DOMAttributes & - ClassAttributes ->; -export function h< - P extends HTMLAttributes, - T extends HTMLElement ->( +): VNode & ClassAttributes>; +export function h

, T extends HTMLElement>( type: keyof JSXInternal.IntrinsicElements, props: (ClassAttributes & P) | null, ...children: ComponentChildren[] ): VNode & P>; -export function h< - P extends SVGAttributes, - T extends HTMLElement ->( +export function h

, T extends HTMLElement>( type: keyof JSXInternal.IntrinsicSVGElements, props: (ClassAttributes & P) | null, ...children: ComponentChildren[] ): VNode & P>; export function h( type: string, - props: - | (ClassAttributes & - HTMLAttributes & - SVGAttributes) - | null, + props: (ClassAttributes & HTMLAttributes & SVGAttributes) | null, ...children: ComponentChildren[] -): VNode< - | (ClassAttributes & - HTMLAttributes & - SVGAttributes) - | null ->; +): VNode<(ClassAttributes & HTMLAttributes & SVGAttributes) | null>; export function h

( type: ComponentType

| string, props: (Attributes & P) | null, @@ -375,21 +349,18 @@ export function isValidElement(vnode: any): vnode is VNode; // // Context // ----------------------------------- -export interface Consumer - extends FunctionComponent<{ - children: (value: T) => ComponentChildren; - }> {} +export interface Consumer extends FunctionComponent<{ + children: (value: T) => ComponentChildren; +}> {} export interface PreactConsumer extends Consumer {} -export interface Provider - extends FunctionComponent<{ - value: T; - children?: ComponentChildren; - }> {} +export interface Provider extends FunctionComponent<{ + value: T; + children?: ComponentChildren; +}> {} export interface PreactProvider extends Provider {} -export type ContextType> = C extends Context - ? T - : never; +export type ContextType> = + C extends Context ? T : never; export interface Context extends preact.Provider { Consumer: preact.Consumer; diff --git a/src/internal.d.ts b/src/internal.d.ts index 85e704be65..481d4b12d8 100644 --- a/src/internal.d.ts +++ b/src/internal.d.ts @@ -62,8 +62,7 @@ export type ComponentChild = | undefined; export type ComponentChildren = ComponentChild[] | ComponentChild; -export interface FunctionComponent

- extends preact.FunctionComponent

{ +export interface FunctionComponent

extends preact.FunctionComponent

{ // Internally, createContext uses `contextType` on a Function component to // implement the Consumer component contextType?: PreactContext; @@ -158,7 +157,10 @@ export interface VNode

extends preact.VNode

{ _flags: number; } -export interface Component

extends Omit, 'base'> { +export interface Component

extends Omit< + preact.Component, + 'base' +> { // When component is functional component, this is reset to functional component constructor: ComponentType

; state: S; // Override Component["state"] to not be readonly for internal use, specifically Hooks diff --git a/src/jsx.d.ts b/src/jsx.d.ts index 86330bdd4e..4d5408d49d 100644 --- a/src/jsx.d.ts +++ b/src/jsx.d.ts @@ -68,7 +68,7 @@ interface SnapEvent extends Event { declare var SnapEvent: { prototype: SnapEvent; new (type: string, eventInitDict?: SnapEventInit): SnapEvent; -} +}; interface SnapEventInit extends EventInit { snapTargetBlock?: Element | null; @@ -138,8 +138,9 @@ export namespace JSXInternal { export type UnpackSignal = T extends SignalLike ? V : T; /** @deprecated Please import from the Preact namespace instead */ - export interface SVGAttributes - extends HTMLAttributes { + export interface SVGAttributes< + Target extends EventTarget = SVGElement + > extends HTMLAttributes { accentHeight?: Signalish; accumulate?: Signalish<'none' | 'sum' | undefined>; additive?: Signalish<'replace' | 'sum' | undefined>; @@ -696,8 +697,9 @@ export namespace JSXInternal { EventHandler>; /** @deprecated Please import from the Preact namespace instead */ - export interface DOMAttributes - extends PreactDOMAttributes { + export interface DOMAttributes< + Target extends EventTarget + > extends PreactDOMAttributes { // Image Events onLoad?: GenericEventHandler | undefined; onLoadCapture?: GenericEventHandler | undefined; @@ -1323,9 +1325,7 @@ export namespace JSXInternal { /** @deprecated Please import from the Preact namespace instead */ export interface AllHTMLAttributes - extends ClassAttributes, - DOMAttributes, - AriaAttributes { + extends ClassAttributes, DOMAttributes, AriaAttributes { // Standard HTML Attributes accept?: Signalish; acceptCharset?: Signalish; @@ -1578,9 +1578,7 @@ export namespace JSXInternal { /** @deprecated Please import from the Preact namespace instead */ export interface HTMLAttributes - extends ClassAttributes, - DOMAttributes, - AriaAttributes { + extends ClassAttributes, DOMAttributes, AriaAttributes { // Standard HTML Attributes accesskey?: Signalish; accessKey?: Signalish; @@ -1686,8 +1684,9 @@ export namespace JSXInternal { | (string & {}); /** @deprecated Please import from the Preact namespace instead */ - interface AnchorHTMLAttributes - extends HTMLAttributes { + interface AnchorHTMLAttributes< + T extends EventTarget = HTMLAnchorElement + > extends HTMLAttributes { download?: Signalish; href?: Signalish; hreflang?: Signalish; @@ -1702,8 +1701,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface AreaHTMLAttributes - extends HTMLAttributes { + interface AreaHTMLAttributes< + T extends EventTarget = HTMLAreaElement + > extends HTMLAttributes { alt?: Signalish; coords?: Signalish; download?: Signalish; @@ -1719,25 +1719,29 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface AudioHTMLAttributes - extends MediaHTMLAttributes {} + interface AudioHTMLAttributes< + T extends EventTarget = HTMLAudioElement + > extends MediaHTMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - interface BaseHTMLAttributes - extends HTMLAttributes { + interface BaseHTMLAttributes< + T extends EventTarget = HTMLBaseElement + > extends HTMLAttributes { href?: Signalish; target?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface BlockquoteHTMLAttributes - extends HTMLAttributes { + interface BlockquoteHTMLAttributes< + T extends EventTarget = HTMLQuoteElement + > extends HTMLAttributes { cite?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface ButtonHTMLAttributes - extends HTMLAttributes { + interface ButtonHTMLAttributes< + T extends EventTarget = HTMLButtonElement + > extends HTMLAttributes { command?: Signalish; commandfor?: Signalish; commandFor?: Signalish; @@ -1763,49 +1767,56 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface CanvasHTMLAttributes - extends HTMLAttributes { + interface CanvasHTMLAttributes< + T extends EventTarget = HTMLCanvasElement + > extends HTMLAttributes { height?: Signalish; width?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface ColHTMLAttributes - extends HTMLAttributes { + interface ColHTMLAttributes< + T extends EventTarget = HTMLTableColElement + > extends HTMLAttributes { span?: Signalish; width?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface ColgroupHTMLAttributes - extends HTMLAttributes { + interface ColgroupHTMLAttributes< + T extends EventTarget = HTMLTableColElement + > extends HTMLAttributes { span?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface DataHTMLAttributes - extends HTMLAttributes { + interface DataHTMLAttributes< + T extends EventTarget = HTMLDataElement + > extends HTMLAttributes { value?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface DelHTMLAttributes - extends HTMLAttributes { + interface DelHTMLAttributes< + T extends EventTarget = HTMLModElement + > extends HTMLAttributes { cite?: Signalish; datetime?: Signalish; dateTime?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface DetailsHTMLAttributes - extends HTMLAttributes { + interface DetailsHTMLAttributes< + T extends EventTarget = HTMLDetailsElement + > extends HTMLAttributes { name?: Signalish; open?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface DialogHTMLAttributes - extends HTMLAttributes { + interface DialogHTMLAttributes< + T extends EventTarget = HTMLDialogElement + > extends HTMLAttributes { onCancel?: GenericEventHandler | undefined; onClose?: GenericEventHandler | undefined; open?: Signalish; @@ -1814,8 +1825,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface EmbedHTMLAttributes - extends HTMLAttributes { + interface EmbedHTMLAttributes< + T extends EventTarget = HTMLEmbedElement + > extends HTMLAttributes { height?: Signalish; src?: Signalish; type?: Signalish; @@ -1823,16 +1835,18 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface FieldsetHTMLAttributes - extends HTMLAttributes { + interface FieldsetHTMLAttributes< + T extends EventTarget = HTMLFieldSetElement + > extends HTMLAttributes { disabled?: Signalish; form?: Signalish; name?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface FormHTMLAttributes - extends HTMLAttributes { + interface FormHTMLAttributes< + T extends EventTarget = HTMLFormElement + > extends HTMLAttributes { 'accept-charset'?: Signalish; acceptCharset?: Signalish; action?: Signalish; @@ -1849,8 +1863,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface IframeHTMLAttributes - extends HTMLAttributes { + interface IframeHTMLAttributes< + T extends EventTarget = HTMLIFrameElement + > extends HTMLAttributes { allow?: Signalish; allowFullScreen?: Signalish; allowTransparency?: Signalish; @@ -1881,8 +1896,9 @@ export namespace JSXInternal { type HTMLAttributeCrossOrigin = 'anonymous' | 'use-credentials'; /** @deprecated Please import from the Preact namespace instead */ - interface ImgHTMLAttributes - extends HTMLAttributes { + interface ImgHTMLAttributes< + T extends EventTarget = HTMLImageElement + > extends HTMLAttributes { alt?: Signalish; crossorigin?: Signalish; crossOrigin?: Signalish; @@ -1929,8 +1945,9 @@ export namespace JSXInternal { | (string & {}); /** @deprecated Please import from the Preact namespace instead */ - interface InputHTMLAttributes - extends HTMLAttributes { + interface InputHTMLAttributes< + T extends EventTarget = HTMLInputElement + > extends HTMLAttributes { accept?: Signalish; alt?: Signalish; autocomplete?: Signalish; @@ -1987,16 +2004,18 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface InsHTMLAttributes - extends HTMLAttributes { + interface InsHTMLAttributes< + T extends EventTarget = HTMLModElement + > extends HTMLAttributes { cite?: Signalish; datetime?: Signalish; dateTime?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface KeygenHTMLAttributes - extends HTMLAttributes { + interface KeygenHTMLAttributes< + T extends EventTarget = HTMLUnknownElement + > extends HTMLAttributes { challenge?: Signalish; disabled?: Signalish; form?: Signalish; @@ -2006,22 +2025,25 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface LabelHTMLAttributes - extends HTMLAttributes { + interface LabelHTMLAttributes< + T extends EventTarget = HTMLLabelElement + > extends HTMLAttributes { for?: Signalish; form?: Signalish; htmlFor?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface LiHTMLAttributes - extends HTMLAttributes { + interface LiHTMLAttributes< + T extends EventTarget = HTMLLIElement + > extends HTMLAttributes { value?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface LinkHTMLAttributes - extends HTMLAttributes { + interface LinkHTMLAttributes< + T extends EventTarget = HTMLLinkElement + > extends HTMLAttributes { as?: Signalish; crossorigin?: Signalish; crossOrigin?: Signalish; @@ -2043,14 +2065,16 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface MapHTMLAttributes - extends HTMLAttributes { + interface MapHTMLAttributes< + T extends EventTarget = HTMLMapElement + > extends HTMLAttributes { name?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface MarqueeHTMLAttributes - extends HTMLAttributes { + interface MarqueeHTMLAttributes< + T extends EventTarget = HTMLMarqueeElement + > extends HTMLAttributes { behavior?: Signalish<'scroll' | 'slide' | 'alternate' | undefined>; bgColor?: Signalish; direction?: Signalish<'left' | 'right' | 'up' | 'down' | undefined>; @@ -2065,8 +2089,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface MediaHTMLAttributes - extends HTMLAttributes { + interface MediaHTMLAttributes< + T extends EventTarget = HTMLMediaElement + > extends HTMLAttributes { autoplay?: Signalish; autoPlay?: Signalish; controls?: Signalish; @@ -2091,14 +2116,16 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface MenuHTMLAttributes - extends HTMLAttributes { + interface MenuHTMLAttributes< + T extends EventTarget = HTMLMenuElement + > extends HTMLAttributes { type?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface MetaHTMLAttributes - extends HTMLAttributes { + interface MetaHTMLAttributes< + T extends EventTarget = HTMLMetaElement + > extends HTMLAttributes { charset?: Signalish; charSet?: Signalish; content?: Signalish; @@ -2109,8 +2136,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface MeterHTMLAttributes - extends HTMLAttributes { + interface MeterHTMLAttributes< + T extends EventTarget = HTMLMeterElement + > extends HTMLAttributes { form?: Signalish; high?: Signalish; low?: Signalish; @@ -2121,8 +2149,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface ObjectHTMLAttributes - extends HTMLAttributes { + interface ObjectHTMLAttributes< + T extends EventTarget = HTMLObjectElement + > extends HTMLAttributes { classID?: Signalish; data?: Signalish; form?: Signalish; @@ -2136,23 +2165,26 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface OlHTMLAttributes - extends HTMLAttributes { + interface OlHTMLAttributes< + T extends EventTarget = HTMLOListElement + > extends HTMLAttributes { reversed?: Signalish; start?: Signalish; type?: Signalish<'1' | 'a' | 'A' | 'i' | 'I' | undefined>; } /** @deprecated Please import from the Preact namespace instead */ - interface OptgroupHTMLAttributes - extends HTMLAttributes { + interface OptgroupHTMLAttributes< + T extends EventTarget = HTMLOptGroupElement + > extends HTMLAttributes { disabled?: Signalish; label?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface OptionHTMLAttributes - extends HTMLAttributes { + interface OptionHTMLAttributes< + T extends EventTarget = HTMLOptionElement + > extends HTMLAttributes { disabled?: Signalish; label?: Signalish; selected?: Signalish; @@ -2160,8 +2192,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface OutputHTMLAttributes - extends HTMLAttributes { + interface OutputHTMLAttributes< + T extends EventTarget = HTMLOutputElement + > extends HTMLAttributes { for?: Signalish; form?: Signalish; htmlFor?: Signalish; @@ -2169,28 +2202,32 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface ParamHTMLAttributes - extends HTMLAttributes { + interface ParamHTMLAttributes< + T extends EventTarget = HTMLParamElement + > extends HTMLAttributes { name?: Signalish; value?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface ProgressHTMLAttributes - extends HTMLAttributes { + interface ProgressHTMLAttributes< + T extends EventTarget = HTMLProgressElement + > extends HTMLAttributes { max?: Signalish; value?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface QuoteHTMLAttributes - extends HTMLAttributes { + interface QuoteHTMLAttributes< + T extends EventTarget = HTMLQuoteElement + > extends HTMLAttributes { cite?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface ScriptHTMLAttributes - extends HTMLAttributes { + interface ScriptHTMLAttributes< + T extends EventTarget = HTMLScriptElement + > extends HTMLAttributes { async?: Signalish; /** @deprecated */ charset?: Signalish; @@ -2209,8 +2246,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface SelectHTMLAttributes - extends HTMLAttributes { + interface SelectHTMLAttributes< + T extends EventTarget = HTMLSelectElement + > extends HTMLAttributes { autocomplete?: Signalish; autoComplete?: Signalish; defaultValue?: Signalish; @@ -2225,14 +2263,16 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface SlotHTMLAttributes - extends HTMLAttributes { + interface SlotHTMLAttributes< + T extends EventTarget = HTMLSlotElement + > extends HTMLAttributes { name?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface SourceHTMLAttributes - extends HTMLAttributes { + interface SourceHTMLAttributes< + T extends EventTarget = HTMLSourceElement + > extends HTMLAttributes { height?: Signalish; media?: Signalish; sizes?: Signalish; @@ -2244,16 +2284,18 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface StyleHTMLAttributes - extends HTMLAttributes { + interface StyleHTMLAttributes< + T extends EventTarget = HTMLStyleElement + > extends HTMLAttributes { media?: Signalish; scoped?: Signalish; type?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface TableHTMLAttributes - extends HTMLAttributes { + interface TableHTMLAttributes< + T extends EventTarget = HTMLTableElement + > extends HTMLAttributes { cellPadding?: Signalish; cellSpacing?: Signalish; summary?: Signalish; @@ -2261,8 +2303,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface TdHTMLAttributes - extends HTMLAttributes { + interface TdHTMLAttributes< + T extends EventTarget = HTMLTableCellElement + > extends HTMLAttributes { align?: Signalish< 'left' | 'center' | 'right' | 'justify' | 'char' | undefined >; @@ -2279,8 +2322,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface TextareaHTMLAttributes - extends HTMLAttributes { + interface TextareaHTMLAttributes< + T extends EventTarget = HTMLTextAreaElement + > extends HTMLAttributes { autocomplete?: Signalish; autoComplete?: Signalish; cols?: Signalish; @@ -2303,8 +2347,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface ThHTMLAttributes - extends HTMLAttributes { + interface ThHTMLAttributes< + T extends EventTarget = HTMLTableCellElement + > extends HTMLAttributes { align?: Signalish< 'left' | 'center' | 'right' | 'justify' | 'char' | undefined >; @@ -2318,15 +2363,17 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface TimeHTMLAttributes - extends HTMLAttributes { + interface TimeHTMLAttributes< + T extends EventTarget = HTMLTimeElement + > extends HTMLAttributes { datetime?: Signalish; dateTime?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - interface TrackHTMLAttributes - extends MediaHTMLAttributes { + interface TrackHTMLAttributes< + T extends EventTarget = HTMLTrackElement + > extends MediaHTMLAttributes { default?: Signalish; kind?: Signalish; label?: Signalish; @@ -2335,8 +2382,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - interface VideoHTMLAttributes - extends MediaHTMLAttributes { + interface VideoHTMLAttributes< + T extends EventTarget = HTMLVideoElement + > extends MediaHTMLAttributes { disablePictureInPicture?: Signalish; height?: Signalish; playsinline?: Signalish; @@ -2352,8 +2400,9 @@ export namespace JSXInternal { > = HA; /** @deprecated Please import from the Preact namespace instead */ - export interface MathMLAttributes - extends HTMLAttributes { + export interface MathMLAttributes< + Target extends EventTarget = MathMLElement + > extends HTMLAttributes { dir?: Signalish<'ltr' | 'rtl' | undefined>; displaystyle?: Signalish; /** @deprecated This feature is non-standard. See https://developer.mozilla.org/en-US/docs/Web/MathML/Global_attributes/href */ @@ -2369,24 +2418,27 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface AnnotationMathMLAttributes - extends MathMLAttributes { + export interface AnnotationMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { encoding?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics#src */ src?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface AnnotationXmlMathMLAttributes - extends MathMLAttributes { + export interface AnnotationXmlMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { encoding?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/semantics#src */ src?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MActionMathMLAttributes - extends MathMLAttributes { + export interface MActionMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/maction#actiontype */ actiontype?: Signalish<'statusline' | 'toggle' | undefined>; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/maction#selection */ @@ -2394,32 +2446,37 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MathMathMLAttributes - extends MathMLAttributes { + export interface MathMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { display?: Signalish<'block' | 'inline' | undefined>; } /** @deprecated Please import from the Preact namespace instead */ - export interface MEncloseMathMLAttributes - extends MathMLAttributes { + export interface MEncloseMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { notation?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MErrorMathMLAttributes - extends MathMLAttributes {} + export interface MErrorMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MFencedMathMLAttributes - extends MathMLAttributes { + export interface MFencedMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { close?: Signalish; open?: Signalish; separators?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MFracMathMLAttributes - extends MathMLAttributes { + export interface MFracMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mfrac#denomalign */ denomalign?: Signalish<'center' | 'left' | 'right' | undefined>; linethickness?: Signalish; @@ -2428,8 +2485,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MiMathMLAttributes - extends MathMLAttributes { + export interface MiMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** The only value allowed in the current specification is normal (case insensitive) * See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mi#mathvariant */ mathvariant?: Signalish< @@ -2456,8 +2514,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MmultiScriptsMathMLAttributes - extends MathMLAttributes { + export interface MmultiScriptsMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts#subscriptshift */ subscriptshift?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mmultiscripts#superscriptshift */ @@ -2465,12 +2524,14 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MNMathMLAttributes - extends MathMLAttributes {} + export interface MNMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MOMathMLAttributes - extends MathMLAttributes { + export interface MOMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo#accent */ accent?: Signalish; fence?: Signalish; @@ -2486,14 +2547,16 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MOverMathMLAttributes - extends MathMLAttributes { + export interface MOverMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { accent?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MPaddedMathMLAttributes - extends MathMLAttributes { + export interface MPaddedMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { depth?: Signalish; height?: Signalish; lspace?: Signalish; @@ -2502,24 +2565,29 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MPhantomMathMLAttributes - extends MathMLAttributes {} + export interface MPhantomMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MPrescriptsMathMLAttributes - extends MathMLAttributes {} + export interface MPrescriptsMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MRootMathMLAttributes - extends MathMLAttributes {} + export interface MRootMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MRowMathMLAttributes - extends MathMLAttributes {} + export interface MRowMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MSMathMLAttributes - extends MathMLAttributes { + export interface MSMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms#browser_compatibility */ lquote?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/ms#browser_compatibility */ @@ -2527,20 +2595,23 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MSpaceMathMLAttributes - extends MathMLAttributes { + export interface MSpaceMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { depth?: Signalish; height?: Signalish; width?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MSqrtMathMLAttributes - extends MathMLAttributes {} + export interface MSqrtMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MStyleMathMLAttributes - extends MathMLAttributes { + export interface MStyleMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle#background */ background?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mstyle#color */ @@ -2558,15 +2629,17 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MSubMathMLAttributes - extends MathMLAttributes { + export interface MSubMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msub#subscriptshift */ subscriptshift?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MSubsupMathMLAttributes - extends MathMLAttributes { + export interface MSubsupMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup#subscriptshift */ subscriptshift?: Signalish; /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msubsup#superscriptshift */ @@ -2574,15 +2647,17 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MSupMathMLAttributes - extends MathMLAttributes { + export interface MSupMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** @deprecated See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/msup#superscriptshift */ superscriptshift?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MTableMathMLAttributes - extends MathMLAttributes { + export interface MTableMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtable#align */ align?: Signalish< 'axis' | 'baseline' | 'bottom' | 'center' | 'top' | undefined @@ -2610,8 +2685,9 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MTdMathMLAttributes - extends MathMLAttributes { + export interface MTdMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { columnspan?: Signalish; rowspan?: Signalish; /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtd#columnalign */ @@ -2623,12 +2699,14 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MTextMathMLAttributes - extends MathMLAttributes {} + export interface MTextMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} /** @deprecated Please import from the Preact namespace instead */ - export interface MTrMathMLAttributes - extends MathMLAttributes { + export interface MTrMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtr#columnalign */ columnalign?: Signalish<'center' | 'left' | 'right' | undefined>; /** Non-standard attribute See https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mtr#rowalign */ @@ -2638,21 +2716,24 @@ export namespace JSXInternal { } /** @deprecated Please import from the Preact namespace instead */ - export interface MUnderMathMLAttributes - extends MathMLAttributes { + export interface MUnderMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { accentunder?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface MUnderoverMathMLAttributes - extends MathMLAttributes { + export interface MUnderoverMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes { accent?: Signalish; accentunder?: Signalish; } /** @deprecated Please import from the Preact namespace instead */ - export interface SemanticsMathMLAttributes - extends MathMLAttributes {} + export interface SemanticsMathMLAttributes< + T extends EventTarget + > extends MathMLAttributes {} export interface IntrinsicSVGElements { svg: SVGAttributes; @@ -2755,8 +2836,7 @@ export namespace JSXInternal { } export interface IntrinsicElements - extends IntrinsicSVGElements, - IntrinsicMathMLElements { + extends IntrinsicSVGElements, IntrinsicMathMLElements { a: AnchorHTMLAttributes; abbr: HTMLAttributes; address: HTMLAttributes; diff --git a/test-utils/src/index.js b/test-utils/src/index.js index 3a9d5a4f3a..d5b0b9be86 100644 --- a/test-utils/src/index.js +++ b/test-utils/src/index.js @@ -57,7 +57,8 @@ export function act(cb) { const rerender = setupRerender(); /** @type {() => void} */ - let flushes = [], toFlush; + let flushes = [], + toFlush; // Override requestAnimationFrame so we can flush pending hooks. options.requestAnimationFrame = fc => flushes.push(fc); diff --git a/test/browser/createContext.test.js b/test/browser/createContext.test.js index a3aa17b51b..ff215e504b 100644 --- a/test/browser/createContext.test.js +++ b/test/browser/createContext.test.js @@ -1013,7 +1013,7 @@ describe('createContext', () => { it('should pass context through strict equal children', () => { const context = { foo: 'bar' }; - const Ctx = createContext(null) + const Ctx = createContext(null); /** @type {(s: { foo: string }) => void} */ let set; @@ -1021,7 +1021,7 @@ describe('createContext', () => { constructor(props) { super(props); this.state = context; - set = this.setState.bind(this) + set = this.setState.bind(this); } getChildContext() { @@ -1035,10 +1035,15 @@ describe('createContext', () => { } } - render({value =>

{value.foo}

}, scratch); + render( + + {value =>

{value.foo}

}
+
, + scratch + ); expect(scratch.innerHTML).to.equal('

bar

'); - set({ foo: 'baz' }) + set({ foo: 'baz' }); rerender(); expect(scratch.innerHTML).to.equal('

baz

'); }); diff --git a/vitest.setup.js b/vitest.setup.js index d9991d62a0..d1b00b2372 100644 --- a/vitest.setup.js +++ b/vitest.setup.js @@ -7,7 +7,7 @@ chai.use(sinonChai); globalThis.context = describe; globalThis.sinon = sinon; -window.addEventListener('error', () => {}) +window.addEventListener('error', () => {}); // Something that's loaded before this file polyfills Symbol object. // We need to verify that it works in IE without that.