diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index fce96c3..5f46834 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -26,4 +26,5 @@ jobs: - run: npm ci - run: npm run build - run: python3 benchmarks/check-consumer.py + - run: npm run test:dom-props - run: npm run test diff --git a/README.md b/README.md index fd70c9e..0a221fa 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,23 @@ npm start See [the WebAPI profiling report](benchmarks/README.md) for the built-in DOM migration, build measurements, and local-link reproduction commands. +The intrinsic DOM props and ref types are owned by `ReactDOM`, not by the built-in +`JsxDOM` module. Use `ReactDOM.domProps`, `ReactDOM.domRef`, and the +`ReactDOM.Ref` helpers instead of explicitly annotating values with `JsxDOM` types. +Popover constructors now live here too, for example `ReactDOM.Auto` and `ReactDOM.Toggle`. +The separate `JsxDOMStyle` and `JsxEvent` aliases are not migrated yet. + +Run the DOM props regression checks with Node.js and Python 3 available: + +```sh +npm run test:dom-props +``` + +This checks the complete prop surface against the pinned compiler's definitions, +then builds a disposable consumer with the `JsxDOM` module removed from a private +runtime copy. It checks JSX and server-rendering behavior, plus rejection of +invalid props, styles, event handlers, and refs. Shared dependencies are not modified. + Event targets, native events, and FormData files now use WebAPI's core types. `currentTarget` and UI/pointer `view` return options to handle absent values. Clipboard data is an optional WebAPI DataTransfer, touch getters return diff --git a/benchmarks/README.md b/benchmarks/README.md index 3be7e29..87f8886 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -57,6 +57,10 @@ final ten-sample comparison were 196.98 ms for the migrated 59-module selection, 15-module layout. The reduced layouts are effectively tied at this sample size. PR #2 retains only the separate JsxDOM props/ref removal on top of this base. +Its new [before/after benchmark report](jsxdom-report.md) measures that change +against a fresh PR #1 control, with exact source revisions and timestamps: +clean medians are 182.87 ms before and 208.52 ms after (ten samples each). +Those measurements are separate from the older layout comparison above. The six-module investigation below is preserved as historical evidence, not the current implementation or a new measurement of the follow-up. diff --git a/benchmarks/jsxdom-report.md b/benchmarks/jsxdom-report.md new file mode 100644 index 0000000..5992041 --- /dev/null +++ b/benchmarks/jsxdom-report.md @@ -0,0 +1,114 @@ +# JsxDOM removal: PR #2 build timings + +Historical 15-module comparison. The current 27-module data-feature base and +refreshed PR #2 before/after timings are in +[data-feature-report.md](data-feature-report.md). + +This measures the additional cost of owning React's intrinsic props/ref types +locally, after the 15-module WebAPI migration in PR #1. It does not measure the +still-pending removal of `JsxDOMStyle` or `JsxEvent`. + +Both source snapshots predate the later [core-backed event/file type +strengthening](webapi-type-strengthening.md). That follow-up is inherited by +PR #2, but these timings have not been relabeled as measurements of newer sources. + +## Same-session before/after results + +ReScript **13.0.0-alpha.7**. Median wall-clock milliseconds, **10 samples per +mode per version**, pooled from two blocks of five: + +| Source snapshot | Clean | Cached no-op | Single-file rebuild | +| --- | ---: | ---: | ---: | +| PR #1: before JsxDOM removal | 182.87 | 58.92 | 97.36 | +| PR #2: after JsxDOM removal | **208.52** | **61.76** | **121.91** | +| Difference in medians | +25.65 | +2.84 | +24.55 | + +Ranges (minimum–maximum milliseconds): + +| Source snapshot | Clean | Cached no-op | Single-file rebuild | +| --- | ---: | ---: | ---: | +| Before | 164.21–237.43 | 46.72–74.04 | 70.44–113.44 | +| After | 191.15–234.44 | 53.40–70.15 | 100.64–140.36 | + +The clean and edited-build medians are higher after the change in both blocks. +Cached-build ranges overlap substantially. This experiment does **not** show a +build-speed improvement from removing JsxDOM, and is not a general compiler +performance guarantee. + +Both versions compile **15 WebAPI + 9 React = 24 source modules**. Removing an +alias to a precompiled runtime type does not remove one of those source modules; +PR #2 instead puts the intrinsic-props record in React's own compilation. +That is a plausible source of extra work, not a compiler-profiled attribution. +The incremental edit recompiles two modules in both versions. + +Do not compare these absolute timings directly with PR #1's older 122.27 ms +15-module median or the original no-WebAPI v12/v13 baselines. Those came from +different sessions. The freshly measured PR #1 row above is the control here. + +## Exact revisions and timestamps + +- Before: `9ab058ca78be7fec01f3b6001f5683f4cf5a5f02` (PR #1). +- After: `5410e8095a2c57498b226b50da662bffcd579bf5` (PR #2). +- Shared WebAPI: `81ac4eebeae3ff0cc9118e7b4b62323e3cee9729`. +- Shared WebAPI input SHA-256: + `de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118`. + +Each raw result's `recorded_at` timestamp is captured after fixture setup, +before its warm-up and measured builds. It is a **block timestamp**, not an +individual sample timestamp: + +| Execution order | Recorded at (local offset included) | Raw samples and build logs | +| --- | --- | --- | +| Before A | `2026-11-17T06:45:47-0500` | [jsxdom-before-a.json](results/jsxdom-before-a.json) | +| After A | `2026-11-17T06:45:51-0500` | [jsxdom-after-a.json](results/jsxdom-after-a.json) | +| After B | `2026-11-17T06:45:55-0500` | [jsxdom-after-b.json](results/jsxdom-after-b.json) | +| Before B | `2026-11-17T06:45:58-0500` | [jsxdom-before-b.json](results/jsxdom-before-b.json) | + +The results' `source_ref` identifies the measured source revision. +`react_commit` identifies the harness checkout, which stayed on PR #2 throughout. +Source hashes were checked against each `source_ref`; only ReactDOM.res, +ReactEvent.res, and ReactEvent.resi differ between the measured source sets. +The effective ReScript configuration and WebAPI fingerprint match in all blocks. + +## Method + +- Used the existing `builds.py` harness without changes: **60 measured builds**. +- Executed sequentially, before → after in block A, after → before in block B. + No parallel benchmark or validation builds were launched. +- Each scenario gets a separate React fixture and an untimed warm-up. All link + the same private local WebAPI source snapshot, archived from the exact commit + without its development dependencies. The external WebAPI checkout is untouched. +- Build timing includes compiler startup, but excludes npm installation and + cleanup. Clean removes compiler artifacts, not OS page caches or the installed + precompiled runtime. The harness checks for leftover WebAPI build artifacts. +- Cached builds change no source. Edited builds append an exported + `benchmarkIteration` value to the fixture's ReactDOMStyle.res, then restore it. +- Linux x86_64, eight logical CPUs; Node `v24.16.0`, npm `11.15.0`, + React and React DOM `19.2.0`. No CPU-frequency or system-load isolation. +- This is a library-build benchmark, not an application JSX compilation or runtime + benchmark. It does not rerun the DOM-props behavioral regression suite. + +## Reproduce + +Prepare a local WebAPI source snapshot at the shared revision above, without +installed development dependencies. Then run the following sequentially, choosing +new scenario names if fixtures with these names already exist: + +```sh +for pair in \ + "before-a 9ab058ca78be7fec01f3b6001f5683f4cf5a5f02" \ + "after-a 5410e8095a2c57498b226b50da662bffcd579bf5" \ + "after-b 5410e8095a2c57498b226b50da662bffcd579bf5" \ + "before-b 9ab058ca78be7fec01f3b6001f5683f4cf5a5f02" +do + set -- $pair + python3 benchmarks/builds.py "jsxdom-repeat-$1" --compiler 13 --runs 5 \ + --source-ref "$2" --webapi /path/to/private-webapi-snapshot \ + --webapi-source-ref 81ac4eebeae3ff0cc9118e7b4b62323e3cee9729 \ + --feature WebAPI.DOMTree --feature WebAPI.History --feature WebAPI.Location +done +``` + +The harness writes compiler artifacts into the linked snapshot; do not use it +concurrently for other builds. Raw JSON includes every sample, compiler log, +configuration, source hashes, timestamp, and compiled-module inventory. diff --git a/benchmarks/results/jsxdom-after-a.json b/benchmarks/results/jsxdom-after-a.json new file mode 100644 index 0000000..f401e35 --- /dev/null +++ b/benchmarks/results/jsxdom-after-a.json @@ -0,0 +1,207 @@ +{ + "scenario": "jsxdom-after-a", + "compiler": "13.0.0-alpha.7", + "recorded_at": "2026-11-17T06:45:51-0500", + "react_commit": "5410e8095a2c57498b226b50da662bffcd579bf5", + "source_ref": "5410e8095a2c57498b226b50da662bffcd579bf5", + "probe": null, + "platform": "Linux-7.2.9-1-MANJARO-x86_64-with-glibc2.44", + "cpu_count": 8, + "node": "v24.16.0", + "npm": "11.15.0", + "webapi": "/home/josh/Dev/rescript-react/.delta/worktrees/jsswxvp74w80/rescript-react/node_modules/.jsxdom-profile-webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ], + "sources": { + "src/React.res": "65b34f706818a620d97c2a42e42dc1e0883aa5149480858677c12269466ddad5", + "src/ReactDOM.res": "7b0304b03f8aebcd83e89a121f618b8818b362d7d7db0ea1f010925a0ebe1ae3", + "src/ReactDOMServer.res": "2be8757a8fd3e60280313faa4c75d1c6f77b4b99dc4042cb0a043c0999ab0d10", + "src/ReactDOMStatic.res": "1296d7932d043a040b6c59ee5cd014374a4a063a13ee75c9c95fd0324e7e31f9", + "src/ReactDOMStyle.res": "a2836a0764364b9bcbd0fc090432c711aecad7b91ffc83dfd9c4e26fb2e7ed2e", + "src/ReactEvent.res": "13538573814569ce56e41a6d5f36e8f67ca0cbcccdf7d9adbac0df39af536d7c", + "src/ReactEvent.resi": "ae6f83946cc6b251a26a09de167b6a252feb2ca183e420a18e15e0531135744e", + "src/ReactTestUtils.res": "86bd87d05c94db682eb762cc0270f35b2402016f23ef90370294f3e3d78bc341", + "src/ReactTestUtils.resi": "a24e9869884a0aa4612fe02bd5809ffb20cb2864b4291e42ec2b875c82163357", + "src/RescriptReactErrorBoundary.res": "7fab116e5e519687faa1ef91066accf7cea3698bc774538c6bff65d3f9a328c3", + "src/RescriptReactErrorBoundary.resi": "5dd0c5018531f28a31802172a8b70e07aa3e747e02629a546d49fe902da523e2", + "src/RescriptReactRouter.res": "2df77b3609d86e636f0abf1a2e3cb3e50365b44ca7689254e2b51450df4227a1", + "src/RescriptReactRouter.resi": "b2a7daa2be5b4e3ca1ac9ac4f838bf1350edf552eac5170e3381a7b05b0dc399" + }, + "config": { + "name": "@rescript/react", + "jsx": { + "version": 4 + }, + "sources": [ + { + "dir": "src" + } + ], + "package-specs": [ + { + "module": "esmodule", + "in-source": true + } + ], + "suffix": ".res.js", + "dependencies": [ + { + "name": "@rescript/webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ] + } + ] + }, + "webapi_commit": null, + "webapi_status": null, + "webapi_source_ref": "81ac4eebeae3ff0cc9118e7b4b62323e3cee9729", + "webapi_inputs_sha256": "de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118", + "samples": [ + { + "iteration": 1, + "mode": "clean", + "ms": 203.258065, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 1, + "mode": "cached", + "ms": 53.4023, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 1, + "mode": "edit", + "ms": 126.673949, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 2, + "mode": "clean", + "ms": 208.646775, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 2, + "mode": "cached", + "ms": 63.983013, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 2, + "mode": "edit", + "ms": 113.458766, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 3, + "mode": "clean", + "ms": 199.121289, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 3, + "mode": "cached", + "ms": 70.153819, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 3, + "mode": "edit", + "ms": 100.638416, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 4, + "mode": "clean", + "ms": 191.152914, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 4, + "mode": "cached", + "ms": 69.590388, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 4, + "mode": "edit", + "ms": 121.414975, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 5, + "mode": "clean", + "ms": 210.692128, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 5, + "mode": "cached", + "ms": 57.907987, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 5, + "mode": "edit", + "ms": 140.363394, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + } + ], + "summary": { + "clean": { + "median_ms": 203.258065, + "min_ms": 191.152914, + "max_ms": 210.692128, + "mean_ms": 202.5742342 + }, + "cached": { + "median_ms": 63.983013, + "min_ms": 53.4023, + "max_ms": 70.153819, + "mean_ms": 63.0075014 + }, + "edit": { + "median_ms": 121.414975, + "min_ms": 100.638416, + "max_ms": 140.363394, + "mean_ms": 120.5099 + } + }, + "artifacts": { + "react": { + ".cmi": 18, + ".cmj": 18, + ".ast": 18 + }, + "webapi": { + ".cmi": 32, + ".cmj": 32, + ".ast": 30 + } + }, + "webapi_compiled_modules": [ + "WebAPI.cmj", + "src/core/ArrayBufferTypedArrayOrDataView-WebAPI.cmj", + "src/core/DOM-WebAPI.cmj", + "src/core/EventType-WebAPI.cmj", + "src/cssom-core/CSSStyleDeclaration-WebAPI.cmj", + "src/cssom-core/CSSStyleValue-WebAPI.cmj", + "src/cssom-core/MediaList-WebAPI.cmj", + "src/cssom-core/StylePropertyMap-WebAPI.cmj", + "src/cssom-core/StylePropertyMapReadOnly-WebAPI.cmj", + "src/cssom-core/StyleSheet-WebAPI.cmj", + "src/cssom-core/StyleSheetList-WebAPI.cmj", + "src/dom-tree/DOMStringMap-WebAPI.cmj", + "src/dom-tree/DOMTree-WebAPI.cmj", + "src/history/History-WebAPI.cmj", + "src/history/HistoryTypes-WebAPI.cmj", + "src/location/Location-WebAPI.cmj" + ] +} diff --git a/benchmarks/results/jsxdom-after-b.json b/benchmarks/results/jsxdom-after-b.json new file mode 100644 index 0000000..737b69d --- /dev/null +++ b/benchmarks/results/jsxdom-after-b.json @@ -0,0 +1,207 @@ +{ + "scenario": "jsxdom-after-b", + "compiler": "13.0.0-alpha.7", + "recorded_at": "2026-11-17T06:45:55-0500", + "react_commit": "5410e8095a2c57498b226b50da662bffcd579bf5", + "source_ref": "5410e8095a2c57498b226b50da662bffcd579bf5", + "probe": null, + "platform": "Linux-7.2.9-1-MANJARO-x86_64-with-glibc2.44", + "cpu_count": 8, + "node": "v24.16.0", + "npm": "11.15.0", + "webapi": "/home/josh/Dev/rescript-react/.delta/worktrees/jsswxvp74w80/rescript-react/node_modules/.jsxdom-profile-webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ], + "sources": { + "src/React.res": "65b34f706818a620d97c2a42e42dc1e0883aa5149480858677c12269466ddad5", + "src/ReactDOM.res": "7b0304b03f8aebcd83e89a121f618b8818b362d7d7db0ea1f010925a0ebe1ae3", + "src/ReactDOMServer.res": "2be8757a8fd3e60280313faa4c75d1c6f77b4b99dc4042cb0a043c0999ab0d10", + "src/ReactDOMStatic.res": "1296d7932d043a040b6c59ee5cd014374a4a063a13ee75c9c95fd0324e7e31f9", + "src/ReactDOMStyle.res": "a2836a0764364b9bcbd0fc090432c711aecad7b91ffc83dfd9c4e26fb2e7ed2e", + "src/ReactEvent.res": "13538573814569ce56e41a6d5f36e8f67ca0cbcccdf7d9adbac0df39af536d7c", + "src/ReactEvent.resi": "ae6f83946cc6b251a26a09de167b6a252feb2ca183e420a18e15e0531135744e", + "src/ReactTestUtils.res": "86bd87d05c94db682eb762cc0270f35b2402016f23ef90370294f3e3d78bc341", + "src/ReactTestUtils.resi": "a24e9869884a0aa4612fe02bd5809ffb20cb2864b4291e42ec2b875c82163357", + "src/RescriptReactErrorBoundary.res": "7fab116e5e519687faa1ef91066accf7cea3698bc774538c6bff65d3f9a328c3", + "src/RescriptReactErrorBoundary.resi": "5dd0c5018531f28a31802172a8b70e07aa3e747e02629a546d49fe902da523e2", + "src/RescriptReactRouter.res": "2df77b3609d86e636f0abf1a2e3cb3e50365b44ca7689254e2b51450df4227a1", + "src/RescriptReactRouter.resi": "b2a7daa2be5b4e3ca1ac9ac4f838bf1350edf552eac5170e3381a7b05b0dc399" + }, + "config": { + "name": "@rescript/react", + "jsx": { + "version": 4 + }, + "sources": [ + { + "dir": "src" + } + ], + "package-specs": [ + { + "module": "esmodule", + "in-source": true + } + ], + "suffix": ".res.js", + "dependencies": [ + { + "name": "@rescript/webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ] + } + ] + }, + "webapi_commit": null, + "webapi_status": null, + "webapi_source_ref": "81ac4eebeae3ff0cc9118e7b4b62323e3cee9729", + "webapi_inputs_sha256": "de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118", + "samples": [ + { + "iteration": 1, + "mode": "clean", + "ms": 208.396208, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 1, + "mode": "cached", + "ms": 61.922129, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 1, + "mode": "edit", + "ms": 122.402663, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 2, + "mode": "clean", + "ms": 199.604082, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 2, + "mode": "cached", + "ms": 61.596037, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 2, + "mode": "edit", + "ms": 117.602236, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 3, + "mode": "clean", + "ms": 234.44435, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 3, + "mode": "cached", + "ms": 64.244571, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 3, + "mode": "edit", + "ms": 124.49053, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 4, + "mode": "clean", + "ms": 212.19023, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 4, + "mode": "cached", + "ms": 60.45262, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 4, + "mode": "edit", + "ms": 107.306486, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 5, + "mode": "clean", + "ms": 221.993903, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 5, + "mode": "cached", + "ms": 57.434223, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 5, + "mode": "edit", + "ms": 124.269905, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + } + ], + "summary": { + "clean": { + "median_ms": 212.19023, + "min_ms": 199.604082, + "max_ms": 234.44435, + "mean_ms": 215.3257546 + }, + "cached": { + "median_ms": 61.596037, + "min_ms": 57.434223, + "max_ms": 64.244571, + "mean_ms": 61.129916 + }, + "edit": { + "median_ms": 122.402663, + "min_ms": 107.306486, + "max_ms": 124.49053, + "mean_ms": 119.214364 + } + }, + "artifacts": { + "react": { + ".cmi": 18, + ".cmj": 18, + ".ast": 18 + }, + "webapi": { + ".cmi": 32, + ".cmj": 32, + ".ast": 30 + } + }, + "webapi_compiled_modules": [ + "WebAPI.cmj", + "src/core/ArrayBufferTypedArrayOrDataView-WebAPI.cmj", + "src/core/DOM-WebAPI.cmj", + "src/core/EventType-WebAPI.cmj", + "src/cssom-core/CSSStyleDeclaration-WebAPI.cmj", + "src/cssom-core/CSSStyleValue-WebAPI.cmj", + "src/cssom-core/MediaList-WebAPI.cmj", + "src/cssom-core/StylePropertyMap-WebAPI.cmj", + "src/cssom-core/StylePropertyMapReadOnly-WebAPI.cmj", + "src/cssom-core/StyleSheet-WebAPI.cmj", + "src/cssom-core/StyleSheetList-WebAPI.cmj", + "src/dom-tree/DOMStringMap-WebAPI.cmj", + "src/dom-tree/DOMTree-WebAPI.cmj", + "src/history/History-WebAPI.cmj", + "src/history/HistoryTypes-WebAPI.cmj", + "src/location/Location-WebAPI.cmj" + ] +} diff --git a/benchmarks/results/jsxdom-before-a.json b/benchmarks/results/jsxdom-before-a.json new file mode 100644 index 0000000..dbe875a --- /dev/null +++ b/benchmarks/results/jsxdom-before-a.json @@ -0,0 +1,207 @@ +{ + "scenario": "jsxdom-before-a", + "compiler": "13.0.0-alpha.7", + "recorded_at": "2026-11-17T06:45:47-0500", + "react_commit": "5410e8095a2c57498b226b50da662bffcd579bf5", + "source_ref": "9ab058ca78be7fec01f3b6001f5683f4cf5a5f02", + "probe": null, + "platform": "Linux-7.2.9-1-MANJARO-x86_64-with-glibc2.44", + "cpu_count": 8, + "node": "v24.16.0", + "npm": "11.15.0", + "webapi": "/home/josh/Dev/rescript-react/.delta/worktrees/jsswxvp74w80/rescript-react/node_modules/.jsxdom-profile-webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ], + "sources": { + "src/React.res": "65b34f706818a620d97c2a42e42dc1e0883aa5149480858677c12269466ddad5", + "src/ReactDOM.res": "00f126ec50595c92bba4a4fe0b30b7ae25e98aa9ac528273658c12209f8b1e37", + "src/ReactDOMServer.res": "2be8757a8fd3e60280313faa4c75d1c6f77b4b99dc4042cb0a043c0999ab0d10", + "src/ReactDOMStatic.res": "1296d7932d043a040b6c59ee5cd014374a4a063a13ee75c9c95fd0324e7e31f9", + "src/ReactDOMStyle.res": "a2836a0764364b9bcbd0fc090432c711aecad7b91ffc83dfd9c4e26fb2e7ed2e", + "src/ReactEvent.res": "aaf5a83223d1074900b5c6db929bb4f327466edc788882c04db98c9a8f3429b2", + "src/ReactEvent.resi": "4850adff8b0645fc9c1e1004adaaa211337609d4990d3dc154465b89059a761a", + "src/ReactTestUtils.res": "86bd87d05c94db682eb762cc0270f35b2402016f23ef90370294f3e3d78bc341", + "src/ReactTestUtils.resi": "a24e9869884a0aa4612fe02bd5809ffb20cb2864b4291e42ec2b875c82163357", + "src/RescriptReactErrorBoundary.res": "7fab116e5e519687faa1ef91066accf7cea3698bc774538c6bff65d3f9a328c3", + "src/RescriptReactErrorBoundary.resi": "5dd0c5018531f28a31802172a8b70e07aa3e747e02629a546d49fe902da523e2", + "src/RescriptReactRouter.res": "2df77b3609d86e636f0abf1a2e3cb3e50365b44ca7689254e2b51450df4227a1", + "src/RescriptReactRouter.resi": "b2a7daa2be5b4e3ca1ac9ac4f838bf1350edf552eac5170e3381a7b05b0dc399" + }, + "config": { + "name": "@rescript/react", + "jsx": { + "version": 4 + }, + "sources": [ + { + "dir": "src" + } + ], + "package-specs": [ + { + "module": "esmodule", + "in-source": true + } + ], + "suffix": ".res.js", + "dependencies": [ + { + "name": "@rescript/webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ] + } + ] + }, + "webapi_commit": null, + "webapi_status": null, + "webapi_source_ref": "81ac4eebeae3ff0cc9118e7b4b62323e3cee9729", + "webapi_inputs_sha256": "de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118", + "samples": [ + { + "iteration": 1, + "mode": "clean", + "ms": 179.13815, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 1, + "mode": "cached", + "ms": 55.146119, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 1, + "mode": "edit", + "ms": 109.352996, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 2, + "mode": "clean", + "ms": 180.245386, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 2, + "mode": "cached", + "ms": 69.337394, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 2, + "mode": "edit", + "ms": 113.439906, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 3, + "mode": "clean", + "ms": 237.434104, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 3, + "mode": "cached", + "ms": 64.066664, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 3, + "mode": "edit", + "ms": 98.44467, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 4, + "mode": "clean", + "ms": 206.103497, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 4, + "mode": "cached", + "ms": 62.693222, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 4, + "mode": "edit", + "ms": 99.626484, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 5, + "mode": "clean", + "ms": 195.851783, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 5, + "mode": "cached", + "ms": 67.518019, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 5, + "mode": "edit", + "ms": 92.257457, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + } + ], + "summary": { + "clean": { + "median_ms": 195.851783, + "min_ms": 179.13815, + "max_ms": 237.434104, + "mean_ms": 199.754584 + }, + "cached": { + "median_ms": 64.066664, + "min_ms": 55.146119, + "max_ms": 69.337394, + "mean_ms": 63.7522836 + }, + "edit": { + "median_ms": 99.626484, + "min_ms": 92.257457, + "max_ms": 113.439906, + "mean_ms": 102.62430260000001 + } + }, + "artifacts": { + "react": { + ".cmi": 18, + ".cmj": 18, + ".ast": 18 + }, + "webapi": { + ".cmi": 32, + ".cmj": 32, + ".ast": 30 + } + }, + "webapi_compiled_modules": [ + "WebAPI.cmj", + "src/core/ArrayBufferTypedArrayOrDataView-WebAPI.cmj", + "src/core/DOM-WebAPI.cmj", + "src/core/EventType-WebAPI.cmj", + "src/cssom-core/CSSStyleDeclaration-WebAPI.cmj", + "src/cssom-core/CSSStyleValue-WebAPI.cmj", + "src/cssom-core/MediaList-WebAPI.cmj", + "src/cssom-core/StylePropertyMap-WebAPI.cmj", + "src/cssom-core/StylePropertyMapReadOnly-WebAPI.cmj", + "src/cssom-core/StyleSheet-WebAPI.cmj", + "src/cssom-core/StyleSheetList-WebAPI.cmj", + "src/dom-tree/DOMStringMap-WebAPI.cmj", + "src/dom-tree/DOMTree-WebAPI.cmj", + "src/history/History-WebAPI.cmj", + "src/history/HistoryTypes-WebAPI.cmj", + "src/location/Location-WebAPI.cmj" + ] +} diff --git a/benchmarks/results/jsxdom-before-b.json b/benchmarks/results/jsxdom-before-b.json new file mode 100644 index 0000000..5bc9d6c --- /dev/null +++ b/benchmarks/results/jsxdom-before-b.json @@ -0,0 +1,207 @@ +{ + "scenario": "jsxdom-before-b", + "compiler": "13.0.0-alpha.7", + "recorded_at": "2026-11-17T06:45:58-0500", + "react_commit": "5410e8095a2c57498b226b50da662bffcd579bf5", + "source_ref": "9ab058ca78be7fec01f3b6001f5683f4cf5a5f02", + "probe": null, + "platform": "Linux-7.2.9-1-MANJARO-x86_64-with-glibc2.44", + "cpu_count": 8, + "node": "v24.16.0", + "npm": "11.15.0", + "webapi": "/home/josh/Dev/rescript-react/.delta/worktrees/jsswxvp74w80/rescript-react/node_modules/.jsxdom-profile-webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ], + "sources": { + "src/React.res": "65b34f706818a620d97c2a42e42dc1e0883aa5149480858677c12269466ddad5", + "src/ReactDOM.res": "00f126ec50595c92bba4a4fe0b30b7ae25e98aa9ac528273658c12209f8b1e37", + "src/ReactDOMServer.res": "2be8757a8fd3e60280313faa4c75d1c6f77b4b99dc4042cb0a043c0999ab0d10", + "src/ReactDOMStatic.res": "1296d7932d043a040b6c59ee5cd014374a4a063a13ee75c9c95fd0324e7e31f9", + "src/ReactDOMStyle.res": "a2836a0764364b9bcbd0fc090432c711aecad7b91ffc83dfd9c4e26fb2e7ed2e", + "src/ReactEvent.res": "aaf5a83223d1074900b5c6db929bb4f327466edc788882c04db98c9a8f3429b2", + "src/ReactEvent.resi": "4850adff8b0645fc9c1e1004adaaa211337609d4990d3dc154465b89059a761a", + "src/ReactTestUtils.res": "86bd87d05c94db682eb762cc0270f35b2402016f23ef90370294f3e3d78bc341", + "src/ReactTestUtils.resi": "a24e9869884a0aa4612fe02bd5809ffb20cb2864b4291e42ec2b875c82163357", + "src/RescriptReactErrorBoundary.res": "7fab116e5e519687faa1ef91066accf7cea3698bc774538c6bff65d3f9a328c3", + "src/RescriptReactErrorBoundary.resi": "5dd0c5018531f28a31802172a8b70e07aa3e747e02629a546d49fe902da523e2", + "src/RescriptReactRouter.res": "2df77b3609d86e636f0abf1a2e3cb3e50365b44ca7689254e2b51450df4227a1", + "src/RescriptReactRouter.resi": "b2a7daa2be5b4e3ca1ac9ac4f838bf1350edf552eac5170e3381a7b05b0dc399" + }, + "config": { + "name": "@rescript/react", + "jsx": { + "version": 4 + }, + "sources": [ + { + "dir": "src" + } + ], + "package-specs": [ + { + "module": "esmodule", + "in-source": true + } + ], + "suffix": ".res.js", + "dependencies": [ + { + "name": "@rescript/webapi", + "features": [ + "WebAPI.DOMTree", + "WebAPI.History", + "WebAPI.Location" + ] + } + ] + }, + "webapi_commit": null, + "webapi_status": null, + "webapi_source_ref": "81ac4eebeae3ff0cc9118e7b4b62323e3cee9729", + "webapi_inputs_sha256": "de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118", + "samples": [ + { + "iteration": 1, + "mode": "clean", + "ms": 176.527171, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 1, + "mode": "cached", + "ms": 49.665736, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 1, + "mode": "edit", + "ms": 96.282887, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 2, + "mode": "clean", + "ms": 178.999936, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 2, + "mode": "cached", + "ms": 53.977018, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 2, + "mode": "edit", + "ms": 102.247165, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 3, + "mode": "clean", + "ms": 164.210369, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 3, + "mode": "cached", + "ms": 46.72276, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 3, + "mode": "edit", + "ms": 70.437905, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 4, + "mode": "clean", + "ms": 186.463238, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 4, + "mode": "cached", + "ms": 74.035104, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 4, + "mode": "edit", + "ms": 74.073857, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + }, + { + "iteration": 5, + "mode": "clean", + "ms": 185.499201, + "log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n" + }, + { + "iteration": 5, + "mode": "cached", + "ms": 53.957491, + "log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n" + }, + { + "iteration": 5, + "mode": "edit", + "ms": 70.910945, + "log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n" + } + ], + "summary": { + "clean": { + "median_ms": 178.999936, + "min_ms": 164.210369, + "max_ms": 186.463238, + "mean_ms": 178.339983 + }, + "cached": { + "median_ms": 53.957491, + "min_ms": 46.72276, + "max_ms": 74.035104, + "mean_ms": 55.671621800000004 + }, + "edit": { + "median_ms": 74.073857, + "min_ms": 70.437905, + "max_ms": 102.247165, + "mean_ms": 82.7905518 + } + }, + "artifacts": { + "react": { + ".cmi": 18, + ".cmj": 18, + ".ast": 18 + }, + "webapi": { + ".cmi": 32, + ".cmj": 32, + ".ast": 30 + } + }, + "webapi_compiled_modules": [ + "WebAPI.cmj", + "src/core/ArrayBufferTypedArrayOrDataView-WebAPI.cmj", + "src/core/DOM-WebAPI.cmj", + "src/core/EventType-WebAPI.cmj", + "src/cssom-core/CSSStyleDeclaration-WebAPI.cmj", + "src/cssom-core/CSSStyleValue-WebAPI.cmj", + "src/cssom-core/MediaList-WebAPI.cmj", + "src/cssom-core/StylePropertyMap-WebAPI.cmj", + "src/cssom-core/StylePropertyMapReadOnly-WebAPI.cmj", + "src/cssom-core/StyleSheet-WebAPI.cmj", + "src/cssom-core/StyleSheetList-WebAPI.cmj", + "src/dom-tree/DOMStringMap-WebAPI.cmj", + "src/dom-tree/DOMTree-WebAPI.cmj", + "src/history/History-WebAPI.cmj", + "src/history/HistoryTypes-WebAPI.cmj", + "src/location/Location-WebAPI.cmj" + ] +} diff --git a/benchmarks/selective-dom-report.md b/benchmarks/selective-dom-report.md index 1bcc190..ac7d399 100644 --- a/benchmarks/selective-dom-report.md +++ b/benchmarks/selective-dom-report.md @@ -47,7 +47,9 @@ stacked on the History/Location work in #413. React pins WebAPI commit The measurements used local source-folder links, not the archive install. The portable dependency pin makes the PRs reproducible without a machine-local path. -No new timings are claimed for the separate JsxDOM-removal code in PR #2. +These layout measurements do not include the JsxDOM-removal code in PR #2. +The separate [JsxDOM before/after report](jsxdom-report.md) now measures that +follow-up against a fresh PR #1 control, with timestamps and exact revisions. ## What changed this time diff --git a/package.json b/package.json index 6ad114c..25a606f 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "start": "rescript watch", "clean": "rescript clean", "format": "rescript format", + "test:dom-props": "python3 tests/check-dom-props.py", "test": "echo 'tests disabled for now'" }, "keywords": [ diff --git a/src/ReactDOM.res b/src/ReactDOM.res index 3936a36..52f41b5 100644 --- a/src/ReactDOM.res +++ b/src/ReactDOM.res @@ -78,7 +78,7 @@ external domElementToObj: WebAPI.DOMTree.element => {..} = "%identity" type style = ReactDOMStyle.t -type domRef = JsxDOM.domRef +type domRef module Ref = { type t = domRef @@ -226,7 +226,634 @@ external preinitModule: (string, preloadModuleOptions) => unit = "preinitModule" // Runtime -type domProps = JsxDOM.domProps +/** + * React's intrinsic DOM props. Based on @rescript/runtime 13.0.0-alpha.7 + * JsxDOM definitions. + * + * Copyright (C) 2015-2016 Bloomberg Finance L.P. + * Copyright (C) 2017- Hongbo Zhang, Authors of ReScript + * SPDX-License-Identifier: MIT + */ +type popover = | @as("auto") Auto | @as("manual") Manual | @as("hint") Hint + +type popoverTargetAction = | @as("toggle") Toggle | @as("show") Show | @as("hide") Hide + +type domProps = { + key?: string, + children?: Jsx.element, + ref?: domRef, + allow?: string, + @as("aria-current") + ariaCurrent?: [#page | #step | #location | #date | #time | #"true" | #"false"], + @as("aria-details") ariaDetails?: string, + @as("aria-disabled") ariaDisabled?: bool, + @as("aria-hidden") ariaHidden?: bool, + @as("aria-invalid") ariaInvalid?: [#grammar | #"false" | #spelling | #"true"], + @as("aria-keyshortcuts") ariaKeyshortcuts?: string, + @as("aria-label") ariaLabel?: string, + @as("aria-roledescription") ariaRoledescription?: string, + @as("aria-autocomplete") ariaAutocomplete?: [#inline | #list | #both | #none], + @as("aria-checked") ariaChecked?: [#"true" | #"false" | #mixed], + @as("aria-expanded") ariaExpanded?: bool, + @as("aria-haspopup") + ariaHaspopup?: [#menu | #listbox | #tree | #grid | #dialog | #"true" | #"false"], + @as("aria-level") ariaLevel?: int, + @as("aria-modal") ariaModal?: bool, + @as("aria-multiline") ariaMultiline?: bool, + @as("aria-multiselectable") ariaMultiselectable?: bool, + @as("aria-orientation") ariaOrientation?: [#horizontal | #vertical | #undefined], + @as("aria-placeholder") ariaPlaceholder?: string, + @as("aria-pressed") ariaPressed?: [#"true" | #"false" | #mixed], + @as("aria-readonly") ariaReadonly?: bool, + @as("aria-required") ariaRequired?: bool, + @as("aria-selected") ariaSelected?: bool, + @as("aria-sort") ariaSort?: string, + @as("aria-valuemax") ariaValuemax?: float, + @as("aria-valuemin") ariaValuemin?: float, + @as("aria-valuenow") ariaValuenow?: float, + @as("aria-valuetext") ariaValuetext?: string, + @as("aria-atomic") ariaAtomic?: bool, + @as("aria-busy") ariaBusy?: bool, + @as("aria-live") ariaLive?: [#off | #polite | #assertive | #rude], + @as("aria-relevant") ariaRelevant?: string, + @as("aria-dropeffect") ariaDropeffect?: [#copy | #move | #link | #execute | #popup | #none], + @as("aria-grabbed") ariaGrabbed?: bool, + @as("aria-activedescendant") ariaActivedescendant?: string, + @as("aria-colcount") ariaColcount?: int, + @as("aria-colindex") ariaColindex?: int, + @as("aria-colspan") ariaColspan?: int, + @as("aria-controls") ariaControls?: string, + @as("aria-describedby") ariaDescribedby?: string, + @as("aria-errormessage") ariaErrormessage?: string, + @as("aria-flowto") ariaFlowto?: string, + @as("aria-labelledby") ariaLabelledby?: string, + @as("aria-owns") ariaOwns?: string, + @as("aria-posinset") ariaPosinset?: int, + @as("aria-rowcount") ariaRowcount?: int, + @as("aria-rowindex") ariaRowindex?: int, + @as("aria-rowspan") ariaRowspan?: int, + @as("aria-setsize") ariaSetsize?: int, + defaultChecked?: bool, + defaultValue?: string, + accessKey?: string, + capture?: [#user | #environment], + className?: string, + contentEditable?: bool, + contextMenu?: string, + @as("data-testid") dataTestId?: string, + dir?: string, + draggable?: bool, + hidden?: bool, + id?: string, + inert?: bool, + lang?: string, + popover?: popover, + popoverTarget?: string, + popoverTargetAction?: popoverTargetAction, + role?: string, + style?: style, + spellCheck?: bool, + tabIndex?: int, + title?: string, + itemID?: string, + itemProp?: string, + itemRef?: string, + itemScope?: bool, + itemType?: string, + accept?: string, + acceptCharset?: string, + action?: string, + allowFullScreen?: bool, + alt?: string, + @as("as") as_?: string, + async?: bool, + autoComplete?: string, + autoCapitalize?: string, + autoFocus?: bool, + autoPlay?: bool, + challenge?: string, + charSet?: string, + checked?: bool, + cite?: string, + crossOrigin?: string, + cols?: int, + colSpan?: int, + content?: string, + controls?: bool, + coords?: string, + data?: string, + dateTime?: string, + default?: bool, + defer?: bool, + disabled?: bool, + download?: string, + encType?: string, + form?: string, + formAction?: string, + formTarget?: string, + formMethod?: string, + frameBorder?: int, + headers?: string, + height?: string, + high?: int, + href?: string, + hrefLang?: string, + htmlFor?: string, + httpEquiv?: string, + icon?: string, + inputMode?: string, + integrity?: string, + keyType?: string, + kind?: string, + label?: string, + list?: string, + loading?: [#lazy | #eager], + loop?: bool, + low?: int, + manifest?: string, + max?: string, + maxLength?: int, + media?: string, + mediaGroup?: string, + method?: string, + min?: string, + minLength?: int, + multiple?: bool, + muted?: bool, + name?: string, + nonce?: string, + noValidate?: bool, + @as("open") open_?: bool, + optimum?: int, + pattern?: string, + placeholder?: string, + playsInline?: bool, + poster?: string, + preload?: string, + radioGroup?: string, + readOnly?: bool, + rel?: string, + required?: bool, + reversed?: bool, + rows?: int, + rowSpan?: int, + sandbox?: string, + scope?: string, + scoped?: bool, + scrolling?: string, + selected?: bool, + shape?: string, + size?: int, + sizes?: string, + span?: int, + src?: string, + srcDoc?: string, + srcLang?: string, + srcSet?: string, + start?: int, + step?: float, + summary?: string, + target?: string, + @as("type") type_?: string, + useMap?: string, + value?: string, + width?: string, + wrap?: string, + onCancel?: ReactEvent.Synthetic.t => unit, + onCancelCapture?: ReactEvent.Synthetic.t => unit, + onClose?: ReactEvent.Synthetic.t => unit, + onCloseCapture?: ReactEvent.Synthetic.t => unit, + onFullscreenChange?: ReactEvent.Synthetic.t => unit, + onFullscreenChangeCapture?: ReactEvent.Synthetic.t => unit, + onFullscreenError?: ReactEvent.Synthetic.t => unit, + onFullscreenErrorCapture?: ReactEvent.Synthetic.t => unit, + onBeforeToggle?: ReactEvent.Toggle.t => unit, + onBeforeToggleCapture?: ReactEvent.Toggle.t => unit, + onToggle?: ReactEvent.Toggle.t => unit, + onToggleCapture?: ReactEvent.Toggle.t => unit, + onCopy?: ReactEvent.Clipboard.t => unit, + onCopyCapture?: ReactEvent.Clipboard.t => unit, + onCut?: ReactEvent.Clipboard.t => unit, + onCutCapture?: ReactEvent.Clipboard.t => unit, + onPaste?: ReactEvent.Clipboard.t => unit, + onPasteCapture?: ReactEvent.Clipboard.t => unit, + onCompositionEnd?: ReactEvent.Composition.t => unit, + onCompositionEndCapture?: ReactEvent.Composition.t => unit, + onCompositionStart?: ReactEvent.Composition.t => unit, + onCompositionStartCapture?: ReactEvent.Composition.t => unit, + onCompositionUpdate?: ReactEvent.Composition.t => unit, + onCompositionUpdateCapture?: ReactEvent.Composition.t => unit, + onKeyDown?: ReactEvent.Keyboard.t => unit, + onKeyDownCapture?: ReactEvent.Keyboard.t => unit, + onKeyPress?: ReactEvent.Keyboard.t => unit, + onKeyPressCapture?: ReactEvent.Keyboard.t => unit, + onKeyUp?: ReactEvent.Keyboard.t => unit, + onKeyUpCapture?: ReactEvent.Keyboard.t => unit, + onFocus?: ReactEvent.Focus.t => unit, + onFocusCapture?: ReactEvent.Focus.t => unit, + onBlur?: ReactEvent.Focus.t => unit, + onBlurCapture?: ReactEvent.Focus.t => unit, + onBeforeInput?: ReactEvent.Form.t => unit, + onBeforeInputCapture?: ReactEvent.Form.t => unit, + onChange?: ReactEvent.Form.t => unit, + onChangeCapture?: ReactEvent.Form.t => unit, + onInput?: ReactEvent.Form.t => unit, + onInputCapture?: ReactEvent.Form.t => unit, + onReset?: ReactEvent.Form.t => unit, + onResetCapture?: ReactEvent.Form.t => unit, + onSubmit?: ReactEvent.Form.t => unit, + onSubmitCapture?: ReactEvent.Form.t => unit, + onInvalid?: ReactEvent.Form.t => unit, + onInvalidCapture?: ReactEvent.Form.t => unit, + onAuxClick?: ReactEvent.Mouse.t => unit, + onAuxClickCapture?: ReactEvent.Mouse.t => unit, + onClick?: ReactEvent.Mouse.t => unit, + onClickCapture?: ReactEvent.Mouse.t => unit, + onContextMenu?: ReactEvent.Mouse.t => unit, + onContextMenuCapture?: ReactEvent.Mouse.t => unit, + onDoubleClick?: ReactEvent.Mouse.t => unit, + onDoubleClickCapture?: ReactEvent.Mouse.t => unit, + onDrag?: ReactEvent.Mouse.t => unit, + onDragCapture?: ReactEvent.Mouse.t => unit, + onDragEnd?: ReactEvent.Mouse.t => unit, + onDragEndCapture?: ReactEvent.Mouse.t => unit, + onDragEnter?: ReactEvent.Mouse.t => unit, + onDragEnterCapture?: ReactEvent.Mouse.t => unit, + onDragExit?: ReactEvent.Mouse.t => unit, + onDragExitCapture?: ReactEvent.Mouse.t => unit, + onDragLeave?: ReactEvent.Mouse.t => unit, + onDragLeaveCapture?: ReactEvent.Mouse.t => unit, + onDragOver?: ReactEvent.Mouse.t => unit, + onDragOverCapture?: ReactEvent.Mouse.t => unit, + onDragStart?: ReactEvent.Mouse.t => unit, + onDragStartCapture?: ReactEvent.Mouse.t => unit, + onDrop?: ReactEvent.Mouse.t => unit, + onDropCapture?: ReactEvent.Mouse.t => unit, + onMouseDown?: ReactEvent.Mouse.t => unit, + onMouseDownCapture?: ReactEvent.Mouse.t => unit, + onMouseEnter?: ReactEvent.Mouse.t => unit, + onMouseLeave?: ReactEvent.Mouse.t => unit, + onMouseMove?: ReactEvent.Mouse.t => unit, + onMouseMoveCapture?: ReactEvent.Mouse.t => unit, + onMouseOut?: ReactEvent.Mouse.t => unit, + onMouseOutCapture?: ReactEvent.Mouse.t => unit, + onMouseOver?: ReactEvent.Mouse.t => unit, + onMouseOverCapture?: ReactEvent.Mouse.t => unit, + onMouseUp?: ReactEvent.Mouse.t => unit, + onMouseUpCapture?: ReactEvent.Mouse.t => unit, + onSelect?: ReactEvent.Selection.t => unit, + onSelectCapture?: ReactEvent.Selection.t => unit, + onTouchCancel?: ReactEvent.Touch.t => unit, + onTouchCancelCapture?: ReactEvent.Touch.t => unit, + onTouchEnd?: ReactEvent.Touch.t => unit, + onTouchEndCapture?: ReactEvent.Touch.t => unit, + onTouchMove?: ReactEvent.Touch.t => unit, + onTouchMoveCapture?: ReactEvent.Touch.t => unit, + onTouchStart?: ReactEvent.Touch.t => unit, + onTouchStartCapture?: ReactEvent.Touch.t => unit, + onPointerOver?: ReactEvent.Pointer.t => unit, + onPointerOverCapture?: ReactEvent.Pointer.t => unit, + onPointerEnter?: ReactEvent.Pointer.t => unit, + onPointerDown?: ReactEvent.Pointer.t => unit, + onPointerDownCapture?: ReactEvent.Pointer.t => unit, + onPointerMove?: ReactEvent.Pointer.t => unit, + onPointerMoveCapture?: ReactEvent.Pointer.t => unit, + onPointerUp?: ReactEvent.Pointer.t => unit, + onPointerUpCapture?: ReactEvent.Pointer.t => unit, + onPointerCancel?: ReactEvent.Pointer.t => unit, + onPointerCancelCapture?: ReactEvent.Pointer.t => unit, + onPointerOut?: ReactEvent.Pointer.t => unit, + onPointerOutCapture?: ReactEvent.Pointer.t => unit, + onPointerLeave?: ReactEvent.Pointer.t => unit, + onGotPointerCapture?: ReactEvent.Pointer.t => unit, + onGotPointerCaptureCapture?: ReactEvent.Pointer.t => unit, + onLostPointerCapture?: ReactEvent.Pointer.t => unit, + onLostPointerCaptureCapture?: ReactEvent.Pointer.t => unit, + onScroll?: ReactEvent.UI.t => unit, + onScrollCapture?: ReactEvent.UI.t => unit, + onScrollEnd?: ReactEvent.UI.t => unit, + onScrollEndCapture?: ReactEvent.UI.t => unit, + onWheel?: ReactEvent.Wheel.t => unit, + onWheelCapture?: ReactEvent.Wheel.t => unit, + onAbort?: ReactEvent.Media.t => unit, + onAbortCapture?: ReactEvent.Media.t => unit, + onCanPlay?: ReactEvent.Media.t => unit, + onCanPlayCapture?: ReactEvent.Media.t => unit, + onCanPlayThrough?: ReactEvent.Media.t => unit, + onCanPlayThroughCapture?: ReactEvent.Media.t => unit, + onDurationChange?: ReactEvent.Media.t => unit, + onDurationChangeCapture?: ReactEvent.Media.t => unit, + onEmptied?: ReactEvent.Media.t => unit, + onEmptiedCapture?: ReactEvent.Media.t => unit, + onEncrypted?: ReactEvent.Media.t => unit, + onEncryptedCapture?: ReactEvent.Media.t => unit, + onEnded?: ReactEvent.Media.t => unit, + onEndedCapture?: ReactEvent.Media.t => unit, + onError?: ReactEvent.Media.t => unit, + onErrorCapture?: ReactEvent.Media.t => unit, + onLoadedData?: ReactEvent.Media.t => unit, + onLoadedDataCapture?: ReactEvent.Media.t => unit, + onLoadedMetadata?: ReactEvent.Media.t => unit, + onLoadedMetadataCapture?: ReactEvent.Media.t => unit, + onLoadStart?: ReactEvent.Media.t => unit, + onLoadStartCapture?: ReactEvent.Media.t => unit, + onPause?: ReactEvent.Media.t => unit, + onPauseCapture?: ReactEvent.Media.t => unit, + onPlay?: ReactEvent.Media.t => unit, + onPlayCapture?: ReactEvent.Media.t => unit, + onPlaying?: ReactEvent.Media.t => unit, + onPlayingCapture?: ReactEvent.Media.t => unit, + onProgress?: ReactEvent.Media.t => unit, + onProgressCapture?: ReactEvent.Media.t => unit, + onRateChange?: ReactEvent.Media.t => unit, + onRateChangeCapture?: ReactEvent.Media.t => unit, + onResize?: ReactEvent.Media.t => unit, + onResizeCapture?: ReactEvent.Media.t => unit, + onSeeked?: ReactEvent.Media.t => unit, + onSeekedCapture?: ReactEvent.Media.t => unit, + onSeeking?: ReactEvent.Media.t => unit, + onSeekingCapture?: ReactEvent.Media.t => unit, + onStalled?: ReactEvent.Media.t => unit, + onStalledCapture?: ReactEvent.Media.t => unit, + onSuspend?: ReactEvent.Media.t => unit, + onSuspendCapture?: ReactEvent.Media.t => unit, + onTimeUpdate?: ReactEvent.Media.t => unit, + onTimeUpdateCapture?: ReactEvent.Media.t => unit, + onVolumeChange?: ReactEvent.Media.t => unit, + onVolumeChangeCapture?: ReactEvent.Media.t => unit, + onWaiting?: ReactEvent.Media.t => unit, + onWaitingCapture?: ReactEvent.Media.t => unit, + onLoad?: ReactEvent.Image.t => unit, + onLoadCapture?: ReactEvent.Image.t => unit, + onAnimationStart?: ReactEvent.Animation.t => unit, + onAnimationStartCapture?: ReactEvent.Animation.t => unit, + onAnimationEnd?: ReactEvent.Animation.t => unit, + onAnimationEndCapture?: ReactEvent.Animation.t => unit, + onAnimationIteration?: ReactEvent.Animation.t => unit, + onAnimationIterationCapture?: ReactEvent.Animation.t => unit, + onTransitionCancel?: ReactEvent.Transition.t => unit, + onTransitionCancelCapture?: ReactEvent.Transition.t => unit, + onTransitionRun?: ReactEvent.Transition.t => unit, + onTransitionRunCapture?: ReactEvent.Transition.t => unit, + onTransitionStart?: ReactEvent.Transition.t => unit, + onTransitionStartCapture?: ReactEvent.Transition.t => unit, + onTransitionEnd?: ReactEvent.Transition.t => unit, + onTransitionEndCapture?: ReactEvent.Transition.t => unit, + accentHeight?: string, + accumulate?: string, + additive?: string, + alignmentBaseline?: string, + allowReorder?: string, + alphabetic?: string, + amplitude?: string, + arabicForm?: string, + ascent?: string, + attributeName?: string, + attributeType?: string, + autoReverse?: string, + azimuth?: string, + baseFrequency?: string, + baseProfile?: string, + baselineShift?: string, + bbox?: string, + begin?: string, + bias?: string, + by?: string, + calcMode?: string, + capHeight?: string, + clip?: string, + clipPath?: string, + clipPathUnits?: string, + clipRule?: string, + colorInterpolation?: string, + colorInterpolationFilters?: string, + colorProfile?: string, + colorRendering?: string, + contentScriptType?: string, + contentStyleType?: string, + cursor?: string, + cx?: string, + cy?: string, + d?: string, + decelerate?: string, + descent?: string, + diffuseConstant?: string, + direction?: string, + display?: string, + divisor?: string, + dominantBaseline?: string, + dur?: string, + dx?: string, + dy?: string, + edgeMode?: string, + elevation?: string, + enableBackground?: string, + end?: string, + exponent?: string, + externalResourcesRequired?: string, + fill?: string, + fillOpacity?: string, + fillRule?: string, + filter?: string, + filterRes?: string, + filterUnits?: string, + floodColor?: string, + floodOpacity?: string, + focusable?: string, + fontFamily?: string, + fontSize?: string, + fontSizeAdjust?: string, + fontStretch?: string, + fontStyle?: string, + fontVariant?: string, + fontWeight?: string, + fomat?: string, + from?: string, + fx?: string, + fy?: string, + g1?: string, + g2?: string, + glyphName?: string, + glyphOrientationHorizontal?: string, + glyphOrientationVertical?: string, + glyphRef?: string, + gradientTransform?: string, + gradientUnits?: string, + hanging?: string, + horizAdvX?: string, + horizOriginX?: string, + ideographic?: string, + imageRendering?: string, + @as("in") in_?: string, + in2?: string, + intercept?: string, + k?: string, + k1?: string, + k2?: string, + k3?: string, + k4?: string, + kernelMatrix?: string, + kernelUnitLength?: string, + kerning?: string, + keyPoints?: string, + keySplines?: string, + keyTimes?: string, + lengthAdjust?: string, + letterSpacing?: string, + lightingColor?: string, + limitingConeAngle?: string, + local?: string, + markerEnd?: string, + markerHeight?: string, + markerMid?: string, + markerStart?: string, + markerUnits?: string, + markerWidth?: string, + mask?: string, + maskContentUnits?: string, + maskUnits?: string, + mathematical?: string, + mode?: string, + numOctaves?: string, + offset?: string, + opacity?: string, + operator?: string, + order?: string, + orient?: string, + orientation?: string, + origin?: string, + overflow?: string, + overflowX?: string, + overflowY?: string, + overlinePosition?: string, + overlineThickness?: string, + paintOrder?: string, + panose1?: string, + pathLength?: string, + patternContentUnits?: string, + patternTransform?: string, + patternUnits?: string, + pointerEvents?: string, + points?: string, + pointsAtX?: string, + pointsAtY?: string, + pointsAtZ?: string, + preserveAlpha?: string, + preserveAspectRatio?: string, + primitiveUnits?: string, + r?: string, + radius?: string, + referrerPolicy?: string, + refX?: string, + refY?: string, + renderingIntent?: string, + repeatCount?: string, + repeatDur?: string, + requiredExtensions?: string, + requiredFeatures?: string, + restart?: string, + result?: string, + rotate?: string, + rx?: string, + ry?: string, + scale?: string, + seed?: string, + shapeRendering?: string, + slope?: string, + slot?: string, + spacing?: string, + specularConstant?: string, + specularExponent?: string, + speed?: string, + spreadMethod?: string, + startOffset?: string, + stdDeviation?: string, + stemh?: string, + stemv?: string, + stitchTiles?: string, + stopColor?: string, + stopOpacity?: string, + strikethroughPosition?: string, + strikethroughThickness?: string, + string?: string, + stroke?: string, + strokeDasharray?: string, + strokeDashoffset?: string, + strokeLinecap?: string, + strokeLinejoin?: string, + strokeMiterlimit?: string, + strokeOpacity?: string, + strokeWidth?: string, + surfaceScale?: string, + systemLanguage?: string, + tableValues?: string, + targetX?: string, + targetY?: string, + textAnchor?: string, + textDecoration?: string, + textLength?: string, + textRendering?: string, + to?: string, + transform?: string, + u1?: string, + u2?: string, + underlinePosition?: string, + underlineThickness?: string, + unicode?: string, + unicodeBidi?: string, + unicodeRange?: string, + unitsPerEm?: string, + vAlphabetic?: string, + vHanging?: string, + vIdeographic?: string, + vMathematical?: string, + values?: string, + vectorEffect?: string, + version?: string, + vertAdvX?: string, + vertAdvY?: string, + vertOriginX?: string, + vertOriginY?: string, + viewBox?: string, + viewTarget?: string, + visibility?: string, + widths?: string, + wordSpacing?: string, + writingMode?: string, + x?: string, + x1?: string, + x2?: string, + xChannelSelector?: string, + xHeight?: string, + xlinkActuate?: string, + xlinkArcrole?: string, + xlinkHref?: string, + xlinkRole?: string, + xlinkShow?: string, + xlinkTitle?: string, + xlinkType?: string, + xmlns?: string, + xmlnsXlink?: string, + xmlBase?: string, + xmlLang?: string, + xmlSpace?: string, + y?: string, + y1?: string, + y2?: string, + yChannelSelector?: string, + z?: string, + zoomAndPan?: string, + about?: string, + datatype?: string, + inlist?: string, + prefix?: string, + property?: string, + resource?: string, + typeof?: string, + vocab?: string, + dangerouslySetInnerHTML?: {"__html": string}, + suppressContentEditableWarning?: bool, +} @variadic @module("react") external createElement: (string, ~props: domProps=?, array) => React.element = @@ -242,15 +869,15 @@ external createDOMElementVariadic: ( external someElement: React.element => option = "%identity" @module("react/jsx-runtime") -external jsx: (string, JsxDOM.domProps) => Jsx.element = "jsx" +external jsx: (string, domProps) => Jsx.element = "jsx" @module("react/jsx-runtime") -external jsxKeyed: (string, JsxDOM.domProps, ~key: string=?, @ignore unit) => Jsx.element = "jsx" +external jsxKeyed: (string, domProps, ~key: string=?, @ignore unit) => Jsx.element = "jsx" @module("react/jsx-runtime") -external jsxs: (string, JsxDOM.domProps) => Jsx.element = "jsxs" +external jsxs: (string, domProps) => Jsx.element = "jsxs" @module("react/jsx-runtime") -external jsxsKeyed: (string, JsxDOM.domProps, ~key: string=?, @ignore unit) => Jsx.element = "jsxs" +external jsxsKeyed: (string, domProps, ~key: string=?, @ignore unit) => Jsx.element = "jsxs" module Style = ReactDOMStyle diff --git a/src/ReactEvent.res b/src/ReactEvent.res index d2427a6..bbd7b29 100644 --- a/src/ReactEvent.res +++ b/src/ReactEvent.res @@ -274,3 +274,16 @@ module Transition = { @get external pseudoElement: t => string = "pseudoElement" @get external elapsedTime: t => float = "elapsedTime" } + +module Toggle = { + type tag = JsxEvent.Toggle.tag + type t = synthetic + + include MakeEventWithType({type t = t}) + + @get external oldState: t => [#closed | #"open"] = "oldState" + @get external newState: t => [#closed | #"open"] = "newState" + + /** The element that triggered the toggle. Available in React 19.3 and later. */ + @get @return(nullable) external source: t => option = "source" +} diff --git a/src/ReactEvent.res.js b/src/ReactEvent.res.js index 5303ddd..ac17a6e 100644 --- a/src/ReactEvent.res.js +++ b/src/ReactEvent.res.js @@ -33,6 +33,8 @@ let Animation = {}; let Transition = {}; +let Toggle = {}; + export { Synthetic, Clipboard, @@ -50,5 +52,6 @@ export { Image, Animation, Transition, + Toggle, } /* No side effect */ diff --git a/src/ReactEvent.resi b/src/ReactEvent.resi index 0a62798..62bfb44 100644 --- a/src/ReactEvent.resi +++ b/src/ReactEvent.resi @@ -542,3 +542,31 @@ module Transition: { @get external pseudoElement: t => string = "pseudoElement" @get external elapsedTime: t => float = "elapsedTime" } + +module Toggle: { + type tag = JsxEvent.Toggle.tag + type t = synthetic + @get external bubbles: t => bool = "bubbles" + @get external cancelable: t => bool = "cancelable" + + @get @return(nullable) + external currentTarget: t => option = "currentTarget" + + @get external defaultPrevented: t => bool = "defaultPrevented" + @get external eventPhase: t => int = "eventPhase" + @get external isTrusted: t => bool = "isTrusted" + @get external nativeEvent: t => WebAPI.DOM.event = "nativeEvent" + @send external preventDefault: t => unit = "preventDefault" + @send external isDefaultPrevented: t => bool = "isDefaultPrevented" + @send external stopPropagation: t => unit = "stopPropagation" + @send external isPropagationStopped: t => bool = "isPropagationStopped" + @get external target: t => WebAPI.DOM.eventTarget = "target" + @get external timeStamp: t => float = "timeStamp" + @get external type_: t => string = "type" + @send external persist: t => unit = "persist" + @get external oldState: t => [#closed | #"open"] = "oldState" + @get external newState: t => [#closed | #"open"] = "newState" + + /** The element that triggered the toggle. Available in React 19.3 and later. */ + @get @return(nullable) external source: t => option = "source" +} diff --git a/tests/check-dom-props.py b/tests/check-dom-props.py new file mode 100644 index 0000000..fcedc81 --- /dev/null +++ b/tests/check-dom-props.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +"""Compile and run a real React consumer with the built-in JsxDOM unavailable.""" + +import json +from pathlib import Path +import re +import shutil +import subprocess +import tempfile + + +ROOT = Path(__file__).resolve().parents[1] +CASES = ROOT / "tests" / "dom-props" + + +def copy_sources(source, destination): + destination.mkdir(parents=True) + for name in ("package.json", "rescript.json"): + shutil.copy(source / name, destination / name) + for path in (source / "src").rglob("*"): + if path.suffix in (".res", ".resi"): + target = destination / path.relative_to(source) + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copy(path, target) + + +def prepare(fixture): + packages = fixture / "node_modules" + packages.mkdir() + scoped = packages / "@rescript" + scoped.mkdir() + copy_sources(ROOT, scoped / "react") + copy_sources((ROOT / "node_modules/@rescript/webapi").resolve(), scoped / "webapi") + shutil.copytree( + ROOT / "node_modules/@rescript/runtime", scoped / "runtime", + ignore=shutil.ignore_patterns("JsxDOM.*"), + ) + # The CLI resolves its runtime relative to itself, so it must not be a symlink + # back to the shared compiler package and its intact runtime. + shutil.copytree(ROOT / "node_modules/rescript", packages / "rescript") + for name in ("react", "react-dom"): + (packages / name).symlink_to((ROOT / "node_modules" / name).resolve(), target_is_directory=True) + config = { + "name": "react-dom-props-check", + "sources": ["src"], + "jsx": {"version": 4}, + "dependencies": [ + "@rescript/react", + json.loads((ROOT / "rescript.json").read_text())["dependencies"][0], + ], + "package-specs": {"module": "esmodule", "in-source": True}, + "suffix": ".res.js", + } + (fixture / "rescript.json").write_text(json.dumps(config, indent=2) + "\n") + (fixture / "package.json").write_text('{"name":"react-dom-props-check","private":true,"type":"module"}\n') + (fixture / "src").mkdir() + shutil.copy(CASES / "DomPropsChecks.res", fixture / "src") + + +def build(fixture): + compiler = fixture / "node_modules/rescript/cli/rescript.js" + result = subprocess.run(["node", str(compiler), "build"], cwd=fixture, capture_output=True, text=True) + return result.returncode, result.stdout + result.stderr + + +def require_build(fixture): + code, log = build(fixture) + if code: + raise RuntimeError(f"Consumer compilation failed:\n{log}") + + +def verify_rejection(fixture, name, expected): + target = fixture / "src" / name + shutil.copy(CASES / name, target) + try: + code, log = build(fixture) + if code == 0 or not all(text in log for text in expected): + raise RuntimeError(f"Expected {name} rejection matching {expected}:\n{log}") + print(f"PASS: expected rejection of {name}") + finally: + target.unlink() + require_build(fixture) + + +def normalize_record(source): + match = re.search(r"^type domProps = \{\n(.*?)^\}", source, flags=re.M | re.S) + if not match: + raise RuntimeError("Could not find the concrete domProps record") + without_comments = re.sub(r"/\*.*?\*/|//[^\n]*", "", match[1], flags=re.S) + return re.sub(r"\s+", "", without_comments) + + +def verify_prop_surface(): + original = (ROOT / "node_modules/@rescript/runtime/lib/ocaml/JsxDOM.res").read_text() + expected = original.replace("JsxEvent.", "ReactEvent.").replace("Jsx.element", "React.element") + actual = (ROOT / "src/ReactDOM.res").read_text().replace("Jsx.element", "React.element") + if normalize_record(actual) != normalize_record(expected): + raise RuntimeError("Local prop fields differ from the pinned runtime beyond ownership changes") + if re.search(r"\bJsxDOM\b", re.sub(r"/\*.*?\*/|//[^\n]*", "", actual, flags=re.S)): + raise RuntimeError("ReactDOM still references the built-in JsxDOM module") + print("PASS: full pinned prop surface preserved with local type ownership") + + +def main(): + verify_prop_surface() + with tempfile.TemporaryDirectory(prefix=".dom-props-", dir=ROOT / "node_modules") as directory: + fixture = Path(directory) + prepare(fixture) + require_build(fixture) + print("PASS: consumer and React sources compile without the JsxDOM interface") + for name, expected in ( + ("ForbiddenJsxDOM.res", ("JsxDOM", "can't be found")), + ("InvalidProp.res", ("definitelyNotAProp", "field")), + ("InvalidStyle.res", ("int", "string")), + ("InvalidEvent.res", ("Keyboard", "Mouse")), + ("InvalidRef.res", ("int", "domRef")), + ): + verify_rejection(fixture, name, expected) + subprocess.run(["node", str(CASES / "runtime.mjs"), str(fixture)], cwd=ROOT, check=True) + + +if __name__ == "__main__": + main() diff --git a/tests/dom-props/DomPropsChecks.res b/tests/dom-props/DomPropsChecks.res new file mode 100644 index 0000000..a254412 --- /dev/null +++ b/tests/dom-props/DomPropsChecks.res @@ -0,0 +1,86 @@ +let empty =
+let single =
{React.string("child")}
+ +let multiple = +
+ + +
+ +let keyed =
{React.string("child")}
+ +let keyedMultiple = +
+ + +
+ +let optionalKey = key =>
+ +let baseProps: ReactDOM.domProps = {id: "base", title: "kept"} +let spreadOnly =
+let spreadOverride =
+ +let styles: ReactDOMStyle.t = {color: "red", marginTop: "2px"} + +let styled = +
+ +let customStyle =
+ +let svg = + + + + +let rawHtml =
raw"}} /> +let popover =