From f97efdc8b40bc8275275aacea28d9a114382a900 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Fri, 26 Jun 2026 10:47:46 -0400 Subject: [PATCH 01/21] refactor: split event owner types --- package-lock.json | 689 ++++-------------- package.json | 4 +- rescript.json | 1 + src/Canvas/CanvasTypes.res | 2 +- .../ChannelMessagingTypes.res | 2 +- src/Clipboard/ClipboardTypes.res | 2 +- .../CredentialManagementTypes.res | 4 +- src/DOM/Document.res | 2 +- src/DOM/DomGlobal.res | 14 +- src/DOM/DomTypes.res | 4 +- src/Event/AbortController.res | 6 +- src/Event/AbortSignal.res | 12 +- src/Event/Base__Event.res | 1 + src/Event/Base__EventTarget.res | 1 + src/Event/Event.res | 63 +- src/Event/EventTarget.res | 30 +- src/Event/EventType.res | 110 +++ src/Event/EventTypes.res | 199 +---- src/Event/ExtendableEvent.res | 6 +- src/Fetch/FetchTypes.res | 4 +- src/Fetch/FormData.res | 4 +- src/File/FileTypes.res | 4 +- src/IndexedDB/IndexedDbTypes.res | 6 +- .../MediaCaptureAndStreamsTypes.res | 6 +- src/Notification/NotificationTypes.res | 4 +- src/Performance/PerformanceTypes.res | 2 +- src/Permissions/PermissionsTypes.res | 2 +- .../PictureInPictureTypes.res | 2 +- src/Push/PushTypes.res | 2 +- src/RemotePlayback/RemotePlaybackTypes.res | 2 +- src/ScreenWakeLock/ScreenWakeLockTypes.res | 2 +- src/ServiceWorker/ServiceWorkerTypes.res | 6 +- src/UIEvents/UiEventsTypes.res | 16 +- src/URL/URLSearchParams.res | 6 +- src/VisualViewport/VisualViewportTypes.res | 2 +- src/WebAudio/WebAudioTypes.res | 12 +- src/WebLocks/WebLocksTypes.res | 2 +- src/WebMIDI/WebMidiTypes.res | 2 +- src/WebSockets/MessageEvent.res | 4 +- src/WebSockets/WebSocketsTypes.res | 10 +- src/WebSpeech/WebSpeechTypes.res | 4 +- src/WebStorage/WebStorageTypes.res | 4 +- src/WebVTT/WebVttTypes.res | 4 +- src/WebWorkers/WebWorkersTypes.res | 2 +- tests/DOMAPI/AddEventListener__test.res | 21 +- tests/DOMAPI/EventTarget__test.res | 10 + tests/DOMAPI/EventType__test.res | 5 + tests/DOMAPI/Event__test.res | 10 + tests/FetchAPI/FormData__test.res | 17 +- tests/FetchAPI/URLSearchParams__test.res | 6 +- tests/Fetch__test.res | 2 +- .../ServiceWorkerAPI/ServiceWorker__test.res | 4 +- 52 files changed, 464 insertions(+), 877 deletions(-) create mode 100644 src/Event/Base__Event.res create mode 100644 src/Event/Base__EventTarget.res create mode 100644 src/Event/EventType.res create mode 100644 tests/DOMAPI/EventTarget__test.res create mode 100644 tests/DOMAPI/EventType__test.res create mode 100644 tests/DOMAPI/Event__test.res diff --git a/package-lock.json b/package-lock.json index e9f50187..bd7e5e9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,13 @@ { - "name": "experimental-rescript-webapi", + "name": "@rescript/webapi", "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "experimental-rescript-webapi", + "name": "@rescript/webapi", "version": "0.1.0", "license": "MIT", - "workspaces": [ - "packages/*" - ], "devDependencies": { "@astrojs/starlight": "0.37.7", "astro": "^5.10.1", @@ -18,11 +15,11 @@ "oxfmt": "^0.47.0", "prettier": "^3.8.3", "prettier-plugin-astro": "^0.14.1", - "rescript": ">=12.0.0 <13", + "rescript": "^13.0.0-alpha.4", "sharp": "^0.34.0" }, "peerDependencies": { - "rescript": ">=12.0.0 <13" + "rescript": ">=13" } }, "node_modules/@astrojs/compiler": { @@ -1614,189 +1611,15 @@ "win32" ] }, - "node_modules/@rescript-webapi/base": { - "resolved": "packages/Base", - "link": true - }, - "node_modules/@rescript-webapi/canvas": { - "resolved": "packages/Canvas", - "link": true - }, - "node_modules/@rescript-webapi/channel-messaging": { - "resolved": "packages/ChannelMessaging", - "link": true - }, - "node_modules/@rescript-webapi/clipboard": { - "resolved": "packages/Clipboard", - "link": true - }, - "node_modules/@rescript-webapi/credential-management": { - "resolved": "packages/CredentialManagement", - "link": true - }, - "node_modules/@rescript-webapi/css-font-loading": { - "resolved": "packages/CSSFontLoading", - "link": true - }, - "node_modules/@rescript-webapi/dom": { - "resolved": "packages/DOM", - "link": true - }, - "node_modules/@rescript-webapi/encrypted-media-extensions": { - "resolved": "packages/EncryptedMediaExtensions", - "link": true - }, - "node_modules/@rescript-webapi/event": { - "resolved": "packages/Event", - "link": true - }, - "node_modules/@rescript-webapi/fetch": { - "resolved": "packages/Fetch", - "link": true - }, - "node_modules/@rescript-webapi/file": { - "resolved": "packages/File", - "link": true - }, - "node_modules/@rescript-webapi/file-and-directory-entries": { - "resolved": "packages/FileAndDirectoryEntries", - "link": true - }, - "node_modules/@rescript-webapi/gamepad": { - "resolved": "packages/Gamepad", - "link": true - }, - "node_modules/@rescript-webapi/geolocation": { - "resolved": "packages/Geolocation", - "link": true - }, - "node_modules/@rescript-webapi/history": { - "resolved": "packages/History", - "link": true - }, - "node_modules/@rescript-webapi/indexed-db": { - "resolved": "packages/IndexedDB", - "link": true - }, - "node_modules/@rescript-webapi/intersection-observer": { - "resolved": "packages/IntersectionObserver", - "link": true - }, - "node_modules/@rescript-webapi/media-capabilities": { - "resolved": "packages/MediaCapabilities", - "link": true - }, - "node_modules/@rescript-webapi/media-capture-and-streams": { - "resolved": "packages/MediaCaptureAndStreams", - "link": true - }, - "node_modules/@rescript-webapi/media-session": { - "resolved": "packages/MediaSession", - "link": true - }, - "node_modules/@rescript-webapi/mutation-observer": { - "resolved": "packages/MutationObserver", - "link": true - }, - "node_modules/@rescript-webapi/notification": { - "resolved": "packages/Notification", - "link": true - }, - "node_modules/@rescript-webapi/performance": { - "resolved": "packages/Performance", - "link": true - }, - "node_modules/@rescript-webapi/permissions": { - "resolved": "packages/Permissions", - "link": true - }, - "node_modules/@rescript-webapi/picture-in-picture": { - "resolved": "packages/PictureInPicture", - "link": true - }, - "node_modules/@rescript-webapi/push": { - "resolved": "packages/Push", - "link": true - }, - "node_modules/@rescript-webapi/remote-playback": { - "resolved": "packages/RemotePlayback", - "link": true - }, - "node_modules/@rescript-webapi/resize-observer": { - "resolved": "packages/ResizeObserver", - "link": true - }, - "node_modules/@rescript-webapi/screen-wake-lock": { - "resolved": "packages/ScreenWakeLock", - "link": true - }, - "node_modules/@rescript-webapi/service-worker": { - "resolved": "packages/ServiceWorker", - "link": true - }, - "node_modules/@rescript-webapi/storage": { - "resolved": "packages/Storage", - "link": true - }, - "node_modules/@rescript-webapi/ui-events": { - "resolved": "packages/UIEvents", - "link": true - }, - "node_modules/@rescript-webapi/url": { - "resolved": "packages/URL", - "link": true - }, - "node_modules/@rescript-webapi/view-transitions": { - "resolved": "packages/ViewTransitions", - "link": true - }, - "node_modules/@rescript-webapi/visual-viewport": { - "resolved": "packages/VisualViewport", - "link": true - }, - "node_modules/@rescript-webapi/web-audio": { - "resolved": "packages/WebAudio", - "link": true - }, - "node_modules/@rescript-webapi/web-crypto": { - "resolved": "packages/WebCrypto", - "link": true - }, - "node_modules/@rescript-webapi/web-locks": { - "resolved": "packages/WebLocks", - "link": true - }, - "node_modules/@rescript-webapi/web-midi": { - "resolved": "packages/WebMIDI", - "link": true - }, - "node_modules/@rescript-webapi/web-sockets": { - "resolved": "packages/WebSockets", - "link": true - }, - "node_modules/@rescript-webapi/web-speech": { - "resolved": "packages/WebSpeech", - "link": true - }, - "node_modules/@rescript-webapi/web-storage": { - "resolved": "packages/WebStorage", - "link": true - }, - "node_modules/@rescript-webapi/web-vtt": { - "resolved": "packages/WebVTT", - "link": true - }, - "node_modules/@rescript-webapi/web-workers": { - "resolved": "packages/WebWorkers", - "link": true - }, "node_modules/@rescript/darwin-arm64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/darwin-arm64/-/darwin-arm64-12.2.0.tgz", - "integrity": "sha512-xc3K/J7Ujl1vPiFY2009mRf3kWRlUe/VZyJWprseKxlcEtUQv89ter7r6pY+YFbtYvA/fcaEncL9CVGEdattAg==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/darwin-arm64/-/darwin-arm64-13.0.0-alpha.4.tgz", + "integrity": "sha512-3+uPQvuPoweXQ2MatnADRa6PgXhRI/LtkdWkoy8DFSKN7lhtF3Pg+eVjKxY4x4OCECNvHYWLWBKaiVRa22tocA==", "cpu": [ "arm64" ], + "dev": true, + "license": "(LGPL-3.0-or-later AND MIT)", "optional": true, "os": [ "darwin" @@ -1806,12 +1629,14 @@ } }, "node_modules/@rescript/darwin-x64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/darwin-x64/-/darwin-x64-12.2.0.tgz", - "integrity": "sha512-qqcTvnlSeoKkywLjG7cXfYvKZ1e4Gz2kUKcD6SiqDgCqm8TF+spwlFAiM6sloRUOFsc0bpC/0R0B3yr01FCB1A==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/darwin-x64/-/darwin-x64-13.0.0-alpha.4.tgz", + "integrity": "sha512-L71KY+BfSgrMYPUEGMDmrtbrqgBnoYJ/2nJZQNhPV0FP9oQ23rHw8pPVO8+/OzHYPr/OklnB5RbaBphzMBnaxg==", "cpu": [ "x64" ], + "dev": true, + "license": "(LGPL-3.0-or-later AND MIT)", "optional": true, "os": [ "darwin" @@ -1821,12 +1646,14 @@ } }, "node_modules/@rescript/linux-arm64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/linux-arm64/-/linux-arm64-12.2.0.tgz", - "integrity": "sha512-ODmpG3ji+Nj/8d5yvXkeHlfKkmbw1Q4t1iIjVuNwtmFpz7TiEa7n/sQqoYdE+WzbDX3DoJfmJNbp3Ob7qCUoOg==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/linux-arm64/-/linux-arm64-13.0.0-alpha.4.tgz", + "integrity": "sha512-2sJ4+Ali2PHhNRwIW53jYSuRSbMoioawl1WKAKoH7sQ++1+bIzdMuB3TQpi9oOqTUGlm/5l6bK2Amf8nUiJQ7Q==", "cpu": [ "arm64" ], + "dev": true, + "license": "(LGPL-3.0-or-later AND MIT)", "optional": true, "os": [ "linux" @@ -1836,12 +1663,14 @@ } }, "node_modules/@rescript/linux-x64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/linux-x64/-/linux-x64-12.2.0.tgz", - "integrity": "sha512-2W9Y9/g19Y4F/subl8yV3T8QBG2oRaP+HciNRcBjptyEdw9LmCKH8+rhWO6sp3E+nZLwoE2IAkwH0WKV3wqlxQ==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/linux-x64/-/linux-x64-13.0.0-alpha.4.tgz", + "integrity": "sha512-Gbmk44xkW4+1qG5g2iAATwx/Y6fZvGgEGUFZw1wK1sDpn2DKblmXIV3JLcWROgpmQv4Mfp4RHPSzZdmcBdPUoQ==", "cpu": [ "x64" ], + "dev": true, + "license": "(LGPL-3.0-or-later AND MIT)", "optional": true, "os": [ "linux" @@ -1851,17 +1680,21 @@ } }, "node_modules/@rescript/runtime": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/runtime/-/runtime-12.2.0.tgz", - "integrity": "sha512-NwfljDRq1rjFPHUaca1nzFz13xsa9ZGkBkLvMhvVgavJT5+A4rMcLu8XAaVTi/oAhO/tlHf9ZDoOTF1AfyAk9Q==" + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/runtime/-/runtime-13.0.0-alpha.4.tgz", + "integrity": "sha512-pOGJdN0R3+PeB+tvxqmJB9qWPLTgitHmQY89lBbF3Ddtcbu/aUra9gEeFiX5gXGznEUcS1SVU24Zjr3GBqfy8w==", + "dev": true, + "license": "MIT" }, "node_modules/@rescript/win32-x64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/win32-x64/-/win32-x64-12.2.0.tgz", - "integrity": "sha512-fhf8CBj3p1lkIXPeNko3mVTKQfXXm4BoxJtR1xAXxUn43wDpd8Lox4w8/EPBbbW6C/YFQW6H7rtpY+2AKuNaDA==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/win32-x64/-/win32-x64-13.0.0-alpha.4.tgz", + "integrity": "sha512-NadOoXUe4ek9ZMdHp1hvfc6U11HAOV4VKczCZuM13MvNM0RsmiFUG6jsSNt37ZQuC3iY6I/v3qeKglVv/LG11g==", "cpu": [ "x64" ], + "dev": true, + "license": "(LGPL-3.0-or-later AND MIT)", "optional": true, "os": [ "win32" @@ -6673,28 +6506,39 @@ } }, "node_modules/rescript": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-12.2.0.tgz", - "integrity": "sha512-1Jf2cmNhyx5Mj2vwZ4XXPcXvNSjGj9D1jPBUcoqIOqRpLPo1ch2Ta/7eWh23xAHWHK5ow7BCDyYFjvZSjyjLzg==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-13.0.0-alpha.4.tgz", + "integrity": "sha512-bkUiLFWxwwQ2cEjA9j3h0xQSgVk5ZngmhAhoB8oTyGrrzYzWoFaF0IEJhT0ZV0bqc+sen2xJtfqF1V8kyMql/A==", + "dev": true, + "license": "(LGPL-3.0-or-later AND MIT)", + "workspaces": [ + "packages/playground", + "packages/@rescript/*", + "tests/dependencies/**", + "tests/analysis_tests/**", + "tests/docstring_tests", + "tests/gentype_tests/**", + "tests/tools_tests", + "tests/commonjs_tests", + "scripts/res" + ], "dependencies": { - "@rescript/runtime": "12.2.0" + "@rescript/runtime": "13.0.0-alpha.4" }, "bin": { "bsc": "cli/bsc.js", - "bstracing": "cli/bstracing.js", "rescript": "cli/rescript.js", - "rescript-legacy": "cli/rescript-legacy.js", "rescript-tools": "cli/rescript-tools.js" }, "engines": { "node": ">=20.11.0" }, "optionalDependencies": { - "@rescript/darwin-arm64": "12.2.0", - "@rescript/darwin-x64": "12.2.0", - "@rescript/linux-arm64": "12.2.0", - "@rescript/linux-x64": "12.2.0", - "@rescript/win32-x64": "12.2.0" + "@rescript/darwin-arm64": "13.0.0-alpha.4", + "@rescript/darwin-x64": "13.0.0-alpha.4", + "@rescript/linux-arm64": "13.0.0-alpha.4", + "@rescript/linux-x64": "13.0.0-alpha.4", + "@rescript/win32-x64": "13.0.0-alpha.4" } }, "node_modules/retext": { @@ -7668,6 +7512,7 @@ "packages/Base": { "name": "@rescript-webapi/base", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -7676,6 +7521,7 @@ "packages/Canvas": { "name": "@rescript-webapi/canvas", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -7691,6 +7537,7 @@ "packages/ChannelMessaging": { "name": "@rescript-webapi/channel-messaging", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7702,6 +7549,7 @@ "packages/Clipboard": { "name": "@rescript-webapi/clipboard", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0", @@ -7714,6 +7562,7 @@ "packages/CredentialManagement": { "name": "@rescript-webapi/credential-management", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -7726,6 +7575,7 @@ "packages/CSSFontLoading": { "name": "@rescript-webapi/css-font-loading", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7737,6 +7587,7 @@ "packages/DOM": { "name": "@rescript-webapi/dom", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -7780,6 +7631,7 @@ "packages/EncryptedMediaExtensions": { "name": "@rescript-webapi/encrypted-media-extensions", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -7793,6 +7645,7 @@ "packages/Event": { "name": "@rescript-webapi/event", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/dom": "0.1.0" @@ -7804,6 +7657,7 @@ "packages/Fetch": { "name": "@rescript-webapi/fetch", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -7818,6 +7672,7 @@ "packages/File": { "name": "@rescript-webapi/file", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7829,6 +7684,7 @@ "packages/FileAndDirectoryEntries": { "name": "@rescript-webapi/file-and-directory-entries", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0" @@ -7840,6 +7696,7 @@ "packages/Gamepad": { "name": "@rescript-webapi/gamepad", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0" @@ -7851,6 +7708,7 @@ "packages/Geolocation": { "name": "@rescript-webapi/geolocation", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -7859,6 +7717,7 @@ "packages/History": { "name": "@rescript-webapi/history", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -7867,6 +7726,7 @@ "packages/IndexedDB": { "name": "@rescript-webapi/indexed-db", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -7879,6 +7739,7 @@ "packages/IntersectionObserver": { "name": "@rescript-webapi/intersection-observer", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/dom": "0.1.0" @@ -7890,6 +7751,7 @@ "packages/MediaCapabilities": { "name": "@rescript-webapi/media-capabilities", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -7898,6 +7760,7 @@ "packages/MediaCaptureAndStreams": { "name": "@rescript-webapi/media-capture-and-streams", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7909,6 +7772,7 @@ "packages/MediaSession": { "name": "@rescript-webapi/media-session", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -7917,6 +7781,7 @@ "packages/MutationObserver": { "name": "@rescript-webapi/mutation-observer", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/dom": "0.1.0" @@ -7928,6 +7793,7 @@ "packages/Notification": { "name": "@rescript-webapi/notification", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7939,6 +7805,7 @@ "packages/Performance": { "name": "@rescript-webapi/performance", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7950,6 +7817,7 @@ "packages/Permissions": { "name": "@rescript-webapi/permissions", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7961,6 +7829,7 @@ "packages/PictureInPicture": { "name": "@rescript-webapi/picture-in-picture", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7972,6 +7841,7 @@ "packages/Push": { "name": "@rescript-webapi/push", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7983,6 +7853,7 @@ "packages/RemotePlayback": { "name": "@rescript-webapi/remote-playback", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -7994,6 +7865,7 @@ "packages/ResizeObserver": { "name": "@rescript-webapi/resize-observer", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/dom": "0.1.0" @@ -8005,6 +7877,7 @@ "packages/ScreenWakeLock": { "name": "@rescript-webapi/screen-wake-lock", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -8016,6 +7889,7 @@ "packages/ServiceWorker": { "name": "@rescript-webapi/service-worker", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -8033,6 +7907,7 @@ "packages/Storage": { "name": "@rescript-webapi/storage", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/file": "0.1.0" @@ -8044,6 +7919,7 @@ "packages/UIEvents": { "name": "@rescript-webapi/ui-events", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -8059,6 +7935,7 @@ "packages/URL": { "name": "@rescript-webapi/url", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -8067,6 +7944,7 @@ "packages/ViewTransitions": { "name": "@rescript-webapi/view-transitions", "version": "0.1.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "rescript": ">=12.0.0 <13" @@ -8075,6 +7953,7 @@ "packages/VisualViewport": { "name": "@rescript-webapi/visual-viewport", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -8086,6 +7965,7 @@ "packages/WebAudio": { "name": "@rescript-webapi/web-audio", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -8101,6 +7981,7 @@ "packages/WebCrypto": { "name": "@rescript-webapi/web-crypto", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0" @@ -8112,6 +7993,7 @@ "packages/WebLocks": { "name": "@rescript-webapi/web-locks", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -8123,6 +8005,7 @@ "packages/WebMIDI": { "name": "@rescript-webapi/web-midi", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/base": "0.1.0", @@ -8135,6 +8018,7 @@ "packages/WebSockets": { "name": "@rescript-webapi/web-sockets", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/channel-messaging": "0.1.0", @@ -8148,6 +8032,7 @@ "packages/WebSpeech": { "name": "@rescript-webapi/web-speech", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -8159,6 +8044,7 @@ "packages/WebStorage": { "name": "@rescript-webapi/web-storage", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -8170,6 +8056,7 @@ "packages/WebVTT": { "name": "@rescript-webapi/web-vtt", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/event": "0.1.0" @@ -8181,6 +8068,7 @@ "packages/WebWorkers": { "name": "@rescript-webapi/web-workers", "version": "0.1.0", + "extraneous": true, "license": "MIT", "dependencies": { "@rescript-webapi/channel-messaging": "0.1.0", @@ -9035,353 +8923,45 @@ "dev": true, "optional": true }, - "@rescript-webapi/base": { - "version": "file:packages/Base", - "requires": {} - }, - "@rescript-webapi/canvas": { - "version": "file:packages/Canvas", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/dom": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/file": "0.1.0", - "@rescript-webapi/media-capture-and-streams": "0.1.0" - } - }, - "@rescript-webapi/channel-messaging": { - "version": "file:packages/ChannelMessaging", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/clipboard": { - "version": "file:packages/Clipboard", - "requires": { - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/file": "0.1.0" - } - }, - "@rescript-webapi/credential-management": { - "version": "file:packages/CredentialManagement", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/css-font-loading": { - "version": "file:packages/CSSFontLoading", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/dom": { - "version": "file:packages/DOM", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/channel-messaging": "0.1.0", - "@rescript-webapi/clipboard": "0.1.0", - "@rescript-webapi/credential-management": "0.1.0", - "@rescript-webapi/css-font-loading": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/fetch": "0.1.0", - "@rescript-webapi/file": "0.1.0", - "@rescript-webapi/file-and-directory-entries": "0.1.0", - "@rescript-webapi/gamepad": "0.1.0", - "@rescript-webapi/geolocation": "0.1.0", - "@rescript-webapi/history": "0.1.0", - "@rescript-webapi/indexed-db": "0.1.0", - "@rescript-webapi/media-capabilities": "0.1.0", - "@rescript-webapi/media-capture-and-streams": "0.1.0", - "@rescript-webapi/media-session": "0.1.0", - "@rescript-webapi/performance": "0.1.0", - "@rescript-webapi/permissions": "0.1.0", - "@rescript-webapi/picture-in-picture": "0.1.0", - "@rescript-webapi/remote-playback": "0.1.0", - "@rescript-webapi/screen-wake-lock": "0.1.0", - "@rescript-webapi/service-worker": "0.1.0", - "@rescript-webapi/storage": "0.1.0", - "@rescript-webapi/url": "0.1.0", - "@rescript-webapi/view-transitions": "0.1.0", - "@rescript-webapi/visual-viewport": "0.1.0", - "@rescript-webapi/web-crypto": "0.1.0", - "@rescript-webapi/web-locks": "0.1.0", - "@rescript-webapi/web-midi": "0.1.0", - "@rescript-webapi/web-speech": "0.1.0", - "@rescript-webapi/web-storage": "0.1.0", - "@rescript-webapi/web-vtt": "0.1.0", - "@rescript-webapi/web-workers": "0.1.0" - } - }, - "@rescript-webapi/encrypted-media-extensions": { - "version": "file:packages/EncryptedMediaExtensions", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/dom": "0.1.0", - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/event": { - "version": "file:packages/Event", - "requires": { - "@rescript-webapi/dom": "0.1.0" - } - }, - "@rescript-webapi/fetch": { - "version": "file:packages/Fetch", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/file": "0.1.0", - "@rescript-webapi/url": "0.1.0" - } - }, - "@rescript-webapi/file": { - "version": "file:packages/File", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/file-and-directory-entries": { - "version": "file:packages/FileAndDirectoryEntries", - "requires": { - "@rescript-webapi/base": "0.1.0" - } - }, - "@rescript-webapi/gamepad": { - "version": "file:packages/Gamepad", - "requires": { - "@rescript-webapi/base": "0.1.0" - } - }, - "@rescript-webapi/geolocation": { - "version": "file:packages/Geolocation", - "requires": {} - }, - "@rescript-webapi/history": { - "version": "file:packages/History", - "requires": {} - }, - "@rescript-webapi/indexed-db": { - "version": "file:packages/IndexedDB", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/intersection-observer": { - "version": "file:packages/IntersectionObserver", - "requires": { - "@rescript-webapi/dom": "0.1.0" - } - }, - "@rescript-webapi/media-capabilities": { - "version": "file:packages/MediaCapabilities", - "requires": {} - }, - "@rescript-webapi/media-capture-and-streams": { - "version": "file:packages/MediaCaptureAndStreams", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/media-session": { - "version": "file:packages/MediaSession", - "requires": {} - }, - "@rescript-webapi/mutation-observer": { - "version": "file:packages/MutationObserver", - "requires": { - "@rescript-webapi/dom": "0.1.0" - } - }, - "@rescript-webapi/notification": { - "version": "file:packages/Notification", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/performance": { - "version": "file:packages/Performance", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/permissions": { - "version": "file:packages/Permissions", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/picture-in-picture": { - "version": "file:packages/PictureInPicture", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/push": { - "version": "file:packages/Push", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/remote-playback": { - "version": "file:packages/RemotePlayback", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/resize-observer": { - "version": "file:packages/ResizeObserver", - "requires": { - "@rescript-webapi/dom": "0.1.0" - } - }, - "@rescript-webapi/screen-wake-lock": { - "version": "file:packages/ScreenWakeLock", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/service-worker": { - "version": "file:packages/ServiceWorker", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/channel-messaging": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/fetch": "0.1.0", - "@rescript-webapi/notification": "0.1.0", - "@rescript-webapi/push": "0.1.0", - "@rescript-webapi/web-workers": "0.1.0" - } - }, - "@rescript-webapi/storage": { - "version": "file:packages/Storage", - "requires": { - "@rescript-webapi/file": "0.1.0" - } - }, - "@rescript-webapi/ui-events": { - "version": "file:packages/UIEvents", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/dom": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/file": "0.1.0", - "@rescript-webapi/file-and-directory-entries": "0.1.0" - } - }, - "@rescript-webapi/url": { - "version": "file:packages/URL", - "requires": {} - }, - "@rescript-webapi/view-transitions": { - "version": "file:packages/ViewTransitions", - "requires": {} - }, - "@rescript-webapi/visual-viewport": { - "version": "file:packages/VisualViewport", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/web-audio": { - "version": "file:packages/WebAudio", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/channel-messaging": "0.1.0", - "@rescript-webapi/dom": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/media-capture-and-streams": "0.1.0" - } - }, - "@rescript-webapi/web-crypto": { - "version": "file:packages/WebCrypto", - "requires": { - "@rescript-webapi/base": "0.1.0" - } - }, - "@rescript-webapi/web-locks": { - "version": "file:packages/WebLocks", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/web-midi": { - "version": "file:packages/WebMIDI", - "requires": { - "@rescript-webapi/base": "0.1.0", - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/web-sockets": { - "version": "file:packages/WebSockets", - "requires": { - "@rescript-webapi/channel-messaging": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/file": "0.1.0" - } - }, - "@rescript-webapi/web-speech": { - "version": "file:packages/WebSpeech", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/web-storage": { - "version": "file:packages/WebStorage", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/web-vtt": { - "version": "file:packages/WebVTT", - "requires": { - "@rescript-webapi/event": "0.1.0" - } - }, - "@rescript-webapi/web-workers": { - "version": "file:packages/WebWorkers", - "requires": { - "@rescript-webapi/channel-messaging": "0.1.0", - "@rescript-webapi/event": "0.1.0", - "@rescript-webapi/fetch": "0.1.0", - "@rescript-webapi/url": "0.1.0" - } - }, "@rescript/darwin-arm64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/darwin-arm64/-/darwin-arm64-12.2.0.tgz", - "integrity": "sha512-xc3K/J7Ujl1vPiFY2009mRf3kWRlUe/VZyJWprseKxlcEtUQv89ter7r6pY+YFbtYvA/fcaEncL9CVGEdattAg==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/darwin-arm64/-/darwin-arm64-13.0.0-alpha.4.tgz", + "integrity": "sha512-3+uPQvuPoweXQ2MatnADRa6PgXhRI/LtkdWkoy8DFSKN7lhtF3Pg+eVjKxY4x4OCECNvHYWLWBKaiVRa22tocA==", + "dev": true, "optional": true }, "@rescript/darwin-x64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/darwin-x64/-/darwin-x64-12.2.0.tgz", - "integrity": "sha512-qqcTvnlSeoKkywLjG7cXfYvKZ1e4Gz2kUKcD6SiqDgCqm8TF+spwlFAiM6sloRUOFsc0bpC/0R0B3yr01FCB1A==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/darwin-x64/-/darwin-x64-13.0.0-alpha.4.tgz", + "integrity": "sha512-L71KY+BfSgrMYPUEGMDmrtbrqgBnoYJ/2nJZQNhPV0FP9oQ23rHw8pPVO8+/OzHYPr/OklnB5RbaBphzMBnaxg==", + "dev": true, "optional": true }, "@rescript/linux-arm64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/linux-arm64/-/linux-arm64-12.2.0.tgz", - "integrity": "sha512-ODmpG3ji+Nj/8d5yvXkeHlfKkmbw1Q4t1iIjVuNwtmFpz7TiEa7n/sQqoYdE+WzbDX3DoJfmJNbp3Ob7qCUoOg==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/linux-arm64/-/linux-arm64-13.0.0-alpha.4.tgz", + "integrity": "sha512-2sJ4+Ali2PHhNRwIW53jYSuRSbMoioawl1WKAKoH7sQ++1+bIzdMuB3TQpi9oOqTUGlm/5l6bK2Amf8nUiJQ7Q==", + "dev": true, "optional": true }, "@rescript/linux-x64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/linux-x64/-/linux-x64-12.2.0.tgz", - "integrity": "sha512-2W9Y9/g19Y4F/subl8yV3T8QBG2oRaP+HciNRcBjptyEdw9LmCKH8+rhWO6sp3E+nZLwoE2IAkwH0WKV3wqlxQ==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/linux-x64/-/linux-x64-13.0.0-alpha.4.tgz", + "integrity": "sha512-Gbmk44xkW4+1qG5g2iAATwx/Y6fZvGgEGUFZw1wK1sDpn2DKblmXIV3JLcWROgpmQv4Mfp4RHPSzZdmcBdPUoQ==", + "dev": true, "optional": true }, "@rescript/runtime": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/runtime/-/runtime-12.2.0.tgz", - "integrity": "sha512-NwfljDRq1rjFPHUaca1nzFz13xsa9ZGkBkLvMhvVgavJT5+A4rMcLu8XAaVTi/oAhO/tlHf9ZDoOTF1AfyAk9Q==" + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/runtime/-/runtime-13.0.0-alpha.4.tgz", + "integrity": "sha512-pOGJdN0R3+PeB+tvxqmJB9qWPLTgitHmQY89lBbF3Ddtcbu/aUra9gEeFiX5gXGznEUcS1SVU24Zjr3GBqfy8w==", + "dev": true }, "@rescript/win32-x64": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/@rescript/win32-x64/-/win32-x64-12.2.0.tgz", - "integrity": "sha512-fhf8CBj3p1lkIXPeNko3mVTKQfXXm4BoxJtR1xAXxUn43wDpd8Lox4w8/EPBbbW6C/YFQW6H7rtpY+2AKuNaDA==", + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@rescript/win32-x64/-/win32-x64-13.0.0-alpha.4.tgz", + "integrity": "sha512-NadOoXUe4ek9ZMdHp1hvfc6U11HAOV4VKczCZuM13MvNM0RsmiFUG6jsSNt37ZQuC3iY6I/v3qeKglVv/LG11g==", + "dev": true, "optional": true }, "@rollup/pluginutils": { @@ -12629,16 +12209,17 @@ } }, "rescript": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-12.2.0.tgz", - "integrity": "sha512-1Jf2cmNhyx5Mj2vwZ4XXPcXvNSjGj9D1jPBUcoqIOqRpLPo1ch2Ta/7eWh23xAHWHK5ow7BCDyYFjvZSjyjLzg==", - "requires": { - "@rescript/darwin-arm64": "12.2.0", - "@rescript/darwin-x64": "12.2.0", - "@rescript/linux-arm64": "12.2.0", - "@rescript/linux-x64": "12.2.0", - "@rescript/runtime": "12.2.0", - "@rescript/win32-x64": "12.2.0" + "version": "13.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-13.0.0-alpha.4.tgz", + "integrity": "sha512-bkUiLFWxwwQ2cEjA9j3h0xQSgVk5ZngmhAhoB8oTyGrrzYzWoFaF0IEJhT0ZV0bqc+sen2xJtfqF1V8kyMql/A==", + "dev": true, + "requires": { + "@rescript/darwin-arm64": "13.0.0-alpha.4", + "@rescript/darwin-x64": "13.0.0-alpha.4", + "@rescript/linux-arm64": "13.0.0-alpha.4", + "@rescript/linux-x64": "13.0.0-alpha.4", + "@rescript/runtime": "13.0.0-alpha.4", + "@rescript/win32-x64": "13.0.0-alpha.4" } }, "retext": { diff --git a/package.json b/package.json index 678679b2..1ccf503d 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,10 @@ "oxfmt": "^0.47.0", "prettier": "^3.8.3", "prettier-plugin-astro": "^0.14.1", - "rescript": ">=12.0.0 <13", + "rescript": "^13.0.0-alpha.4", "sharp": "^0.34.0" }, "peerDependencies": { - "rescript": ">=12.0.0 <13" + "rescript": ">=13" } } diff --git a/rescript.json b/rescript.json index 965cdcf7..1cbd32f0 100644 --- a/rescript.json +++ b/rescript.json @@ -214,6 +214,7 @@ "AbortController", "AbortSignal", "Event", + "EventType", "EventTarget", "ExtendableEvent" ] diff --git a/src/Canvas/CanvasTypes.res b/src/Canvas/CanvasTypes.res index 22f5d77e..922c531d 100644 --- a/src/Canvas/CanvasTypes.res +++ b/src/Canvas/CanvasTypes.res @@ -122,7 +122,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(OffscreenCanvas) type offscreenCanvas = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** These attributes return the dimensions of the OffscreenCanvas object's bitmap. diff --git a/src/ChannelMessaging/ChannelMessagingTypes.res b/src/ChannelMessaging/ChannelMessagingTypes.res index 1e3b5eeb..9aeee66a 100644 --- a/src/ChannelMessaging/ChannelMessagingTypes.res +++ b/src/ChannelMessaging/ChannelMessagingTypes.res @@ -6,7 +6,7 @@ This Channel Messaging API interface represents one of the two ports of a Messag */ @editor.completeFrom(MessagePort) type messagePort = private { - ...EventTypes.eventTarget, + ...EventTarget.t, } type structuredSerializeOptions = {mutable transfer?: array>} diff --git a/src/Clipboard/ClipboardTypes.res b/src/Clipboard/ClipboardTypes.res index bc20a0a7..94af9c2f 100644 --- a/src/Clipboard/ClipboardTypes.res +++ b/src/Clipboard/ClipboardTypes.res @@ -25,7 +25,7 @@ type clipboardItem = private { */ @editor.completeFrom(WebApiClipboard) type clipboard = private { - ...EventTypes.eventTarget, + ...EventTarget.t, } type clipboardItemOptions = {mutable presentationStyle?: presentationStyle} diff --git a/src/CredentialManagement/CredentialManagementTypes.res b/src/CredentialManagement/CredentialManagementTypes.res index 5fa16f2c..60f6f792 100644 --- a/src/CredentialManagement/CredentialManagementTypes.res +++ b/src/CredentialManagement/CredentialManagementTypes.res @@ -91,7 +91,7 @@ type publicKeyCredentialRequestOptions = { type credentialRequestOptions = { mutable mediation?: credentialMediationRequirement, - mutable signal?: EventTypes.abortSignal, + mutable signal?: AbortSignal.t, mutable publicKey?: publicKeyCredentialRequestOptions, } @@ -133,6 +133,6 @@ type publicKeyCredentialCreationOptions = { } type credentialCreationOptions = { - mutable signal?: EventTypes.abortSignal, + mutable signal?: AbortSignal.t, mutable publicKey?: publicKeyCredentialCreationOptions, } diff --git a/src/DOM/Document.res b/src/DOM/Document.res index abe9d20a..dd246f96 100644 --- a/src/DOM/Document.res +++ b/src/DOM/Document.res @@ -301,7 +301,7 @@ external createAttributeNS: ( [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/createEvent) */ @send -external createEvent: (DomTypes.document, string) => EventTypes.event = "createEvent" +external createEvent: (DomTypes.document, string) => Event.t = "createEvent" /** Returns an empty range object that has both of its boundary points positioned at the beginning of the document. diff --git a/src/DOM/DomGlobal.res b/src/DOM/DomGlobal.res index d6e7cf28..11903bb2 100644 --- a/src/DOM/DomGlobal.res +++ b/src/DOM/DomGlobal.res @@ -311,9 +311,9 @@ The event listener is appended to target's event listener list and is not append [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) */ external addEventListener: ( - EventTypes.eventType, + EventType.t, EventTypes.eventListener<'event>, - ~options: EventTypes.addEventListenerOptions=?, + ~options: Event.addEventListenerOptions=?, ) => unit = "addEventListener" /** @@ -333,7 +333,7 @@ The event listener is appended to target's event listener list and is not append [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) */ external addEventListenerWithCapture: ( - EventTypes.eventType, + EventType.t, EventTypes.eventListener<'event>, @as(json`true`) _, ) => unit = "addEventListener" @@ -343,9 +343,9 @@ Removes the event listener in target's event listener list with the same type, c [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) */ external removeEventListener: ( - EventTypes.eventType, + EventType.t, EventTypes.eventListener<'event>, - ~options: EventTypes.eventListenerOptions=?, + ~options: Event.eventListenerOptions=?, ) => unit = "removeEventListener" /** @@ -353,7 +353,7 @@ Removes the event listener in target's event listener list with the same type, c [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) */ external removeEventListenerUseCapture: ( - EventTypes.eventType, + EventType.t, EventTypes.eventListener<'event>, @as(json`true`) _, ) => unit = "removeEventListener" @@ -362,7 +362,7 @@ external removeEventListenerUseCapture: ( Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ -external dispatchEvent: EventTypes.event => bool = "dispatchEvent" +external dispatchEvent: Event.t => bool = "dispatchEvent" /** Closes the window. diff --git a/src/DOM/DomTypes.res b/src/DOM/DomTypes.res index 12ffacd8..b00cda21 100644 --- a/src/DOM/DomTypes.res +++ b/src/DOM/DomTypes.res @@ -1,8 +1,8 @@ @@warning("-30") type domStringList = DOM.domStringList -type eventTarget = EventTypes.eventTarget -type eventType = EventTypes.eventType +type eventTarget = EventTarget.t +type eventType = EventType.t type file = FileTypes.file type blob = FileTypes.blob type fileSystemEntry = FileAndDirectoryEntriesTypes.fileSystemEntry diff --git a/src/Event/AbortController.res b/src/Event/AbortController.res index b02abe30..2ebaf0e3 100644 --- a/src/Event/AbortController.res +++ b/src/Event/AbortController.res @@ -1,12 +1,14 @@ /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortController) */ +type t = EventTypes.abortController = private {...EventTypes.abortController} + @new -external make: unit => EventTypes.abortController = "AbortController" +external make: unit => t = "AbortController" /** Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortController/abort) */ @send -external abort: (EventTypes.abortController, ~reason: JSON.t=?) => unit = "abort" +external abort: (t, ~reason: JSON.t=?) => unit = "abort" diff --git a/src/Event/AbortSignal.res b/src/Event/AbortSignal.res index 00b170b9..b9c038f1 100644 --- a/src/Event/AbortSignal.res +++ b/src/Event/AbortSignal.res @@ -1,25 +1,27 @@ -include EventTarget.Impl({type t = EventTypes.abortSignal}) +type t = EventTypes.abortSignal = private {...EventTypes.abortSignal} + +include EventTarget.Impl({type t = t}) /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */ @scope("AbortSignal") -external abort: (~reason: JSON.t=?) => EventTypes.abortSignal = "abort" +external abort: (~reason: JSON.t=?) => t = "abort" /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */ @scope("AbortSignal") -external timeout: int => EventTypes.abortSignal = "timeout" +external timeout: int => t = "timeout" /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ @scope("AbortSignal") -external any: array => EventTypes.abortSignal = "any" +external any: array => t = "any" /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */ @send -external throwIfAborted: EventTypes.abortSignal => unit = "throwIfAborted" +external throwIfAborted: t => unit = "throwIfAborted" diff --git a/src/Event/Base__Event.res b/src/Event/Base__Event.res new file mode 100644 index 00000000..72caedaf --- /dev/null +++ b/src/Event/Base__Event.res @@ -0,0 +1 @@ +type t = private {} diff --git a/src/Event/Base__EventTarget.res b/src/Event/Base__EventTarget.res new file mode 100644 index 00000000..72caedaf --- /dev/null +++ b/src/Event/Base__EventTarget.res @@ -0,0 +1 @@ +type t = private {} diff --git a/src/Event/Event.res b/src/Event/Event.res index 3be950e6..6e0ee7b5 100644 --- a/src/Event/Event.res +++ b/src/Event/Event.res @@ -1,23 +1,70 @@ -/** -[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event) -*/ +type t = private {...Base__Event.t} + +type eventListener<'event> = EventTypes.eventListener<'event> + +type eventListenerOptions = EventTypes.eventListenerOptions = {mutable capture?: bool} + +type abortSignal = EventTypes.abortSignal = private {...EventTypes.abortSignal} + +type eventInit = EventTypes.eventInit = { + mutable bubbles?: bool, + mutable cancelable?: bool, + mutable composed?: bool, +} + +type addEventListenerOptions = EventTypes.addEventListenerOptions = { + ...eventListenerOptions, + mutable passive?: bool, + mutable once?: bool, + mutable signal?: abortSignal, +} + @new -external make: (~type_: string, ~eventInitDict: EventTypes.eventInit=?) => EventTypes.event = - "Event" +external make: (~type_: string, ~eventInitDict: eventInit=?) => t = "Event" + +@get +external type_: t => EventType.t = "type" + +@get +external target: t => Null.t = "target" + +@get +external currentTarget: t => Null.t = "currentTarget" + +@get +external eventPhase: t => int = "eventPhase" + +@get +external bubbles: t => bool = "bubbles" + +@get +external cancelable: t => bool = "cancelable" + +@get +external defaultPrevented: t => bool = "defaultPrevented" + +@get +external composed: t => bool = "composed" + +@get +external isTrusted: t => bool = "isTrusted" + +@get +external timeStamp: t => float = "timeStamp" module Impl = ( T: { type t }, ) => { - external asEvent: T.t => EventTypes.event = "%identity" + external asEvent: T.t => t = "%identity" /** Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composedPath) */ @send - external composedPath: T.t => array = "composedPath" + external composedPath: T.t => array = "composedPath" /** If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. @@ -41,4 +88,4 @@ When dispatched in a tree, invoking this method prevents event from reaching any external stopPropagation: T.t => unit = "stopPropagation" } -include Impl({type t = EventTypes.event}) +include Impl({type t = t}) diff --git a/src/Event/EventTarget.res b/src/Event/EventTarget.res index c2f697cf..103f05ef 100644 --- a/src/Event/EventTarget.res +++ b/src/Event/EventTarget.res @@ -1,15 +1,17 @@ /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) */ +type t = private {...Base__EventTarget.t} + @new -external make: unit => EventTypes.eventTarget = "EventTarget" +external make: unit => t = "EventTarget" module Impl = ( T: { type t }, ) => { - external asEventTarget: T.t => EventTypes.eventTarget = "%identity" + external asEventTarget: T.t => t = "%identity" /** Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. @@ -30,9 +32,9 @@ The event listener is appended to target's event listener list and is not append @send external addEventListener: ( T.t, - EventTypes.eventType, - EventTypes.eventListener<'event>, - ~options: EventTypes.addEventListenerOptions=?, + EventType.t, + Event.eventListener<'event>, + ~options: Event.addEventListenerOptions=?, ) => unit = "addEventListener" /** @@ -54,8 +56,8 @@ The event listener is appended to target's event listener list and is not append @send external addEventListenerWithCapture: ( T.t, - EventTypes.eventType, - EventTypes.eventListener<'event>, + EventType.t, + Event.eventListener<'event>, @as(json`true`) _, ) => unit = "addEventListener" @@ -66,9 +68,9 @@ Removes the event listener in target's event listener list with the same type, c @send external removeEventListener: ( T.t, - EventTypes.eventType, - EventTypes.eventListener<'event>, - ~options: EventTypes.eventListenerOptions=?, + EventType.t, + Event.eventListener<'event>, + ~options: Event.eventListenerOptions=?, ) => unit = "removeEventListener" /** @@ -78,8 +80,8 @@ Removes the event listener in target's event listener list with the same type, c @send external removeEventListenerUseCapture: ( T.t, - EventTypes.eventType, - EventTypes.eventListener<'event>, + EventType.t, + Event.eventListener<'event>, @as(json`true`) _, ) => unit = "removeEventListener" @@ -88,7 +90,7 @@ Dispatches a synthetic event event to target and returns true if either event's [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ @send - external dispatchEvent: (T.t, EventTypes.event) => bool = "dispatchEvent" + external dispatchEvent: (T.t, Event.t) => bool = "dispatchEvent" } -include Impl({type t = EventTypes.eventTarget}) +include Impl({type t = t}) diff --git a/src/Event/EventType.res b/src/Event/EventType.res new file mode 100644 index 00000000..e2c43f65 --- /dev/null +++ b/src/Event/EventType.res @@ -0,0 +1,110 @@ +@@warning("-30") + +@unboxed +type t = + | @as("abort") Abort + | @as("activate") Activate + | @as("auxclick") Auxclick + | @as("beforeinput") Beforeinput + | @as("beforetoggle") Beforetoggle + | @as("blur") Blur + | @as("cancel") Cancel + | @as("canplay") Canplay + | @as("canplaythrough") Canplaythrough + | @as("change") Change + | @as("click") Click + | @as("close") Close + | @as("contextlost") Contextlost + | @as("contextmenu") Contextmenu + | @as("contextrestored") Contextrestored + | @as("copy") Copy + | @as("cuechange") Cuechange + | @as("cut") Cut + | @as("dblclick") Dblclick + | @as("DOMContentLoaded") DOMContentLoaded + | @as("drag") Drag + | @as("dragend") Dragend + | @as("dragenter") Dragenter + | @as("dragleave") Dragleave + | @as("dragover") Dragover + | @as("dragstart") Dragstart + | @as("drop") Drop + | @as("durationchange") Durationchange + | @as("emptied") Emptied + | @as("ended") Ended + | @as("error") Error + | @as("focus") Focus + | @as("formdata") Formdata + | @as("input") Input + | @as("install") Install + | @as("invalid") Invalid + | @as("keydown") Keydown + | @as("keypress") Keypress + | @as("keyup") Keyup + | @as("load") Load + | @as("loadeddata") Loadeddata + | @as("loadedmetadata") Loadedmetadata + | @as("loadstart") Loadstart + | @as("message") Message + | @as("messageerror") MessageError + | @as("mousedown") Mousedown + | @as("mouseenter") Mouseenter + | @as("mouseleave") Mouseleave + | @as("mousemove") Mousemove + | @as("mouseout") Mouseout + | @as("mouseover") Mouseover + | @as("mouseup") Mouseup + | @as("notificationclick") NotificationClick + | @as("paste") Paste + | @as("pause") Pause + | @as("play") Play + | @as("playing") Playing + | @as("progress") Progress + | @as("ratechange") Ratechange + | @as("reset") Reset + | @as("resize") Resize + | @as("scroll") Scroll + | @as("scrollend") Scrollend + | @as("securitypolicyviolation") Securitypolicyviolation + | @as("seeked") Seeked + | @as("seeking") Seeking + | @as("select") Select + | @as("slotchange") Slotchange + | @as("stalled") Stalled + | @as("submit") Submit + | @as("suspend") Suspend + | @as("timeupdate") Timeupdate + | @as("toggle") Toggle + | @as("volumechange") Volumechange + | @as("waiting") Waiting + | @as("webkitanimationend") Webkitanimationend + | @as("webkitanimationiteration") Webkitanimationiteration + | @as("webkitanimationstart") Webkitanimationstart + | @as("webkittransitionend") Webkittransitionend + | @as("wheel") Wheel + | @as("animationstart") Animationstart + | @as("animationiteration") Animationiteration + | @as("animationend") Animationend + | @as("animationcancel") Animationcancel + | @as("transitionrun") Transitionrun + | @as("transitionstart") Transitionstart + | @as("transitionend") Transitionend + | @as("transitioncancel") Transitioncancel + | @as("pointerover") Pointerover + | @as("pointerenter") Pointerenter + | @as("pointerdown") Pointerdown + | @as("pointermove") Pointermove + | @as("pointerup") Pointerup + | @as("pointercancel") Pointercancel + | @as("pointerout") Pointerout + | @as("pointerleave") Pointerleave + | @as("push") Push + | @as("gotpointercapture") Gotpointercapture + | @as("lostpointercapture") Lostpointercapture + | @as("selectstart") Selectstart + | @as("selectionchange") Selectionchange + | @as("touchstart") Touchstart + | @as("touchend") Touchend + | @as("touchmove") Touchmove + | @as("touchcancel") Touchcancel + | Custom(string) diff --git a/src/Event/EventTypes.res b/src/Event/EventTypes.res index 502d2c0c..c845b77d 100644 --- a/src/Event/EventTypes.res +++ b/src/Event/EventTypes.res @@ -1,187 +1,9 @@ @@warning("-30") -@unboxed -type eventType = - | @as("abort") Abort - | @as("activate") Activate - | @as("auxclick") Auxclick - | @as("beforeinput") Beforeinput - | @as("beforetoggle") Beforetoggle - | @as("blur") Blur - | @as("cancel") Cancel - | @as("canplay") Canplay - | @as("canplaythrough") Canplaythrough - | @as("change") Change - | @as("click") Click - | @as("close") Close - | @as("contextlost") Contextlost - | @as("contextmenu") Contextmenu - | @as("contextrestored") Contextrestored - | @as("copy") Copy - | @as("cuechange") Cuechange - | @as("cut") Cut - | @as("dblclick") Dblclick - | @as("DOMContentLoaded") DOMContentLoaded - | @as("drag") Drag - | @as("dragend") Dragend - | @as("dragenter") Dragenter - | @as("dragleave") Dragleave - | @as("dragover") Dragover - | @as("dragstart") Dragstart - | @as("drop") Drop - | @as("durationchange") Durationchange - | @as("emptied") Emptied - | @as("ended") Ended - | @as("error") Error - | @as("focus") Focus - | @as("formdata") Formdata - | @as("input") Input - | @as("install") Install - | @as("invalid") Invalid - | @as("keydown") Keydown - | @as("keypress") Keypress - | @as("keyup") Keyup - | @as("load") Load - | @as("loadeddata") Loadeddata - | @as("loadedmetadata") Loadedmetadata - | @as("loadstart") Loadstart - | @as("message") Message - | @as("messageerror") MessageError - | @as("mousedown") Mousedown - | @as("mouseenter") Mouseenter - | @as("mouseleave") Mouseleave - | @as("mousemove") Mousemove - | @as("mouseout") Mouseout - | @as("mouseover") Mouseover - | @as("mouseup") Mouseup - | @as("notificationclick") NotificationClick - | @as("paste") Paste - | @as("pause") Pause - | @as("play") Play - | @as("playing") Playing - | @as("progress") Progress - | @as("ratechange") Ratechange - | @as("reset") Reset - | @as("resize") Resize - | @as("scroll") Scroll - | @as("scrollend") Scrollend - | @as("securitypolicyviolation") Securitypolicyviolation - | @as("seeked") Seeked - | @as("seeking") Seeking - | @as("select") Select - | @as("slotchange") Slotchange - | @as("stalled") Stalled - | @as("submit") Submit - | @as("suspend") Suspend - | @as("timeupdate") Timeupdate - | @as("toggle") Toggle - | @as("volumechange") Volumechange - | @as("waiting") Waiting - | @as("webkitanimationend") Webkitanimationend - | @as("webkitanimationiteration") Webkitanimationiteration - | @as("webkitanimationstart") Webkitanimationstart - | @as("webkittransitionend") Webkittransitionend - | @as("wheel") Wheel - | @as("animationstart") Animationstart - | @as("animationiteration") Animationiteration - | @as("animationend") Animationend - | @as("animationcancel") Animationcancel - | @as("transitionrun") Transitionrun - | @as("transitionstart") Transitionstart - | @as("transitionend") Transitionend - | @as("transitioncancel") Transitioncancel - | @as("pointerover") Pointerover - | @as("pointerenter") Pointerenter - | @as("pointerdown") Pointerdown - | @as("pointermove") Pointermove - | @as("pointerup") Pointerup - | @as("pointercancel") Pointercancel - | @as("pointerout") Pointerout - | @as("pointerleave") Pointerleave - | @as("push") Push - | @as("gotpointercapture") Gotpointercapture - | @as("lostpointercapture") Lostpointercapture - | @as("selectstart") Selectstart - | @as("selectionchange") Selectionchange - | @as("touchstart") Touchstart - | @as("touchend") Touchend - | @as("touchmove") Touchmove - | @as("touchcancel") Touchcancel - | Custom(string) - -type eventListener<'event> = 'event => unit - -/** -EventTarget is a WebApiDOM interface implemented by objects that can receive events and may have listeners for them. -[See EventTarget on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) -*/ -@editor.completeFrom(EventTarget) -type eventTarget = BaseEvent.eventTarget = private {...BaseEvent.eventTarget} - -/** -An event which takes place in the DOM. -[See WebApiEvent on MDN](https://developer.mozilla.org/docs/Web/API/Event) -*/ -@editor.completeFrom(WebApiEvent) -type event = private { - /** - Returns the type of event, e.g. "click", "hashchange", or "submit". - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/type) - */ - @as("type") - type_: eventType, - /** - Returns the object to which event is dispatched (its target). - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/target) - */ - target: Null.t, - /** - Returns the object whose event listener's callback is currently being invoked. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) - */ - currentTarget: Null.t, - /** - Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) - */ - eventPhase: int, - /** - Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/bubbles) - */ - bubbles: bool, - /** - Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/cancelable) - */ - cancelable: bool, - /** - Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) - */ - defaultPrevented: bool, - /** - Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composed) - */ - composed: bool, - /** - Returns true if event was dispatched by the user agent, and false otherwise. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) - */ - isTrusted: bool, - /** - Returns the event's timestamp as the number of milliseconds measured relative to the time origin. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) - */ - timeStamp: float, -} - /** A controller object that allows you to abort one or more WebApiDOM requests as and when desired. [See AbortController on MDN](https://developer.mozilla.org/docs/Web/API/AbortController) */ -@editor.completeFrom(AbortController) type rec abortController = private { /** Returns the AbortSignal object associated with this object. @@ -194,8 +16,8 @@ type rec abortController = private { A signal object that allows you to communicate with a WebApiDOM request (such as a WebApiFetch) and abort it if required via an AbortController object. [See AbortSignal on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal) */ -@editor.completeFrom(AbortSignal) and abortSignal = private { - ...eventTarget, +and abortSignal = private { + ...Base__EventTarget.t, /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) @@ -207,8 +29,16 @@ A signal object that allows you to communicate with a WebApiDOM request (such as reason: JSON.t, } +type eventListener<'event> = 'event => unit + type eventListenerOptions = {mutable capture?: bool} +type eventInit = { + mutable bubbles?: bool, + mutable cancelable?: bool, + mutable composed?: bool, +} + type addEventListenerOptions = { ...eventListenerOptions, mutable passive?: bool, @@ -216,17 +46,10 @@ type addEventListenerOptions = { mutable signal?: abortSignal, } -type eventInit = { - mutable bubbles?: bool, - mutable cancelable?: bool, - mutable composed?: bool, -} - /** The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. [See ExtendableEvent on MDN](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) */ -@editor.completeFrom(ExtendableEvent) type extendableEvent = private { - ...event, + ...Base__Event.t, } diff --git a/src/Event/ExtendableEvent.res b/src/Event/ExtendableEvent.res index b9321c29..aa94677e 100644 --- a/src/Event/ExtendableEvent.res +++ b/src/Event/ExtendableEvent.res @@ -1,9 +1,11 @@ +type t = EventTypes.extendableEvent = private {...EventTypes.extendableEvent} + module Impl = ( T: { type t }, ) => { - external asExtendableEvent: T.t => EventTypes.extendableEvent = "%identity" + external asExtendableEvent: T.t => t = "%identity" include Event.Impl({type t = T.t}) @@ -11,4 +13,4 @@ module Impl = ( external waitUntil: (T.t, promise<'a>) => unit = "waitUntil" } -include Impl({type t = EventTypes.extendableEvent}) +include Impl({type t = t}) diff --git a/src/Fetch/FetchTypes.res b/src/Fetch/FetchTypes.res index 45a499ff..26469fcd 100644 --- a/src/Fetch/FetchTypes.res +++ b/src/Fetch/FetchTypes.res @@ -145,7 +145,7 @@ type request = private { Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/signal) */ - signal: EventTypes.abortSignal, + signal: AbortSignal.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/body) */ @@ -267,7 +267,7 @@ type requestInit = { /** An AbortSignal to set request's signal. */ - mutable signal?: Null.t, + mutable signal?: Null.t, mutable priority?: requestPriority, /** Can only be null. Used to disassociate request from any Window. diff --git a/src/Fetch/FormData.res b/src/Fetch/FormData.res index 709f3107..09558e05 100644 --- a/src/Fetch/FormData.res +++ b/src/Fetch/FormData.res @@ -50,13 +50,13 @@ external has: (t, string) => bool = "has" [Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/entries) */ @send -external entries: t => Iterator.t<(string, formDataEntryValue)> = "entries" +external entries: t => iterable<(string, formDataEntryValue)> = "entries" /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/keys) */ @send -external keys: t => Iterator.t = "keys" +external keys: t => iterable = "keys" /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/set) diff --git a/src/File/FileTypes.res b/src/File/FileTypes.res index c8635d3b..04241c2b 100644 --- a/src/File/FileTypes.res +++ b/src/File/FileTypes.res @@ -63,7 +63,7 @@ type writableStreamDefaultController = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */ - signal: EventTypes.abortSignal, + signal: AbortSignal.t, } /** @@ -200,7 +200,7 @@ The signal option can be set to an AbortSignal to allow aborting an ongoing pipe mutable preventClose?: bool, mutable preventAbort?: bool, mutable preventCancel?: bool, - mutable signal?: EventTypes.abortSignal, + mutable signal?: AbortSignal.t, } type filePropertyBag = { diff --git a/src/IndexedDB/IndexedDbTypes.res b/src/IndexedDB/IndexedDbTypes.res index 6aeca46f..ad4f499d 100644 --- a/src/IndexedDB/IndexedDbTypes.res +++ b/src/IndexedDB/IndexedDbTypes.res @@ -33,7 +33,7 @@ This WebApiIndexedDB API interface provides a connection to a database; you can */ @editor.completeFrom(IDBDatabase) type idbDatabase = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** Returns the name of the database. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) @@ -56,7 +56,7 @@ type idbDatabase = private { */ @editor.completeFrom(IDBTransaction) type idbTransaction = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) @@ -88,7 +88,7 @@ The request object does not initially contain any information about the result o [See IDBRequest on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest) */ type idbRequest<'t> = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** When a request is completed, returns the result, or undefined if the request failed. Throws a "InvalidStateError" DOMException if the request is still pending. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest/result) diff --git a/src/MediaCaptureAndStreams/MediaCaptureAndStreamsTypes.res b/src/MediaCaptureAndStreams/MediaCaptureAndStreamsTypes.res index fc98e8d0..0f4a1cd7 100644 --- a/src/MediaCaptureAndStreams/MediaCaptureAndStreamsTypes.res +++ b/src/MediaCaptureAndStreams/MediaCaptureAndStreamsTypes.res @@ -15,7 +15,7 @@ Provides access to connected media input devices like cameras and microphones, a */ @editor.completeFrom(MediaDevices) type mediaDevices = private { - ...EventTypes.eventTarget, + ...EventTarget.t, } /** @@ -48,7 +48,7 @@ A stream of media content. A stream consists of several tracks such as video or */ @editor.completeFrom(MediaStream) type mediaStream = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaStream/id) */ @@ -66,7 +66,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(MediaStreamTrack) type mediaStreamTrack = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaStreamTrack/kind) */ diff --git a/src/Notification/NotificationTypes.res b/src/Notification/NotificationTypes.res index 3f63104a..eec81bad 100644 --- a/src/Notification/NotificationTypes.res +++ b/src/Notification/NotificationTypes.res @@ -16,7 +16,7 @@ This Notifications API interface is used to configure and display desktop notifi */ @editor.completeFrom(WebApiNotification) type notification = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/permission_static) */ @@ -95,7 +95,7 @@ type getNotificationOptions = {mutable tag?: string} type notificationPermissionCallback = notificationPermission => unit type notificationEvent = { - ...EventTypes.extendableEvent, + ...ExtendableEvent.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/NotificationEvent/action) */ diff --git a/src/Performance/PerformanceTypes.res b/src/Performance/PerformanceTypes.res index f47cf514..dba3b557 100644 --- a/src/Performance/PerformanceTypes.res +++ b/src/Performance/PerformanceTypes.res @@ -11,7 +11,7 @@ Provides access to performance-related information for the current page. It's pa */ @editor.completeFrom(WebApiPerformance) type performance = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */ diff --git a/src/Permissions/PermissionsTypes.res b/src/Permissions/PermissionsTypes.res index 84c3c4a3..43885434 100644 --- a/src/Permissions/PermissionsTypes.res +++ b/src/Permissions/PermissionsTypes.res @@ -24,7 +24,7 @@ type permissions = private {} [See PermissionStatus on MDN](https://developer.mozilla.org/docs/Web/API/PermissionStatus) */ type permissionStatus = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PermissionStatus/state) */ diff --git a/src/PictureInPicture/PictureInPictureTypes.res b/src/PictureInPicture/PictureInPictureTypes.res index ff556ae9..21cddc60 100644 --- a/src/PictureInPicture/PictureInPictureTypes.res +++ b/src/PictureInPicture/PictureInPictureTypes.res @@ -4,7 +4,7 @@ [See PictureInPictureWindow on MDN](https://developer.mozilla.org/docs/Web/API/PictureInPictureWindow) */ type pictureInPictureWindow = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PictureInPictureWindow/width) */ diff --git a/src/Push/PushTypes.res b/src/Push/PushTypes.res index 33b1228d..39297490 100644 --- a/src/Push/PushTypes.res +++ b/src/Push/PushTypes.res @@ -80,7 +80,7 @@ type pushMessageData @editor.completeFrom(PushEvent) type pushEvent = private { - ...EventTypes.extendableEvent, + ...ExtendableEvent.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushEvent/data) */ diff --git a/src/RemotePlayback/RemotePlaybackTypes.res b/src/RemotePlayback/RemotePlaybackTypes.res index 975cc56d..021a5175 100644 --- a/src/RemotePlayback/RemotePlaybackTypes.res +++ b/src/RemotePlayback/RemotePlaybackTypes.res @@ -10,7 +10,7 @@ type remotePlaybackState = */ @editor.completeFrom(WebApiRemotePlayback) type remotePlayback = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/RemotePlayback/state) */ diff --git a/src/ScreenWakeLock/ScreenWakeLockTypes.res b/src/ScreenWakeLock/ScreenWakeLockTypes.res index 5d23df6c..7f19073b 100644 --- a/src/ScreenWakeLock/ScreenWakeLockTypes.res +++ b/src/ScreenWakeLock/ScreenWakeLockTypes.res @@ -13,7 +13,7 @@ type wakeLock = private {} */ @editor.completeFrom(WakeLockSentinel) type wakeLockSentinel = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WakeLockSentinel/released) */ diff --git a/src/ServiceWorker/ServiceWorkerTypes.res b/src/ServiceWorker/ServiceWorkerTypes.res index d7415b57..a15b5786 100644 --- a/src/ServiceWorker/ServiceWorkerTypes.res +++ b/src/ServiceWorker/ServiceWorkerTypes.res @@ -23,7 +23,7 @@ This WebApiServiceWorker API interface provides a reference to a service worker. */ @editor.completeFrom(WebApiServiceWorker) type serviceWorker = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/scriptURL) */ @@ -46,7 +46,7 @@ This WebApiServiceWorker API interface represents the service worker registratio */ @editor.completeFrom(ServiceWorkerRegistration) type serviceWorkerRegistration = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/installing) */ @@ -83,7 +83,7 @@ The ServiceWorkerContainer interface of the WebApiServiceWorker API provides */ @editor.completeFrom(ServiceWorkerContainer) type serviceWorkerContainer = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/controller) */ diff --git a/src/UIEvents/UiEventsTypes.res b/src/UIEvents/UiEventsTypes.res index 44347325..fb00c4b0 100644 --- a/src/UIEvents/UiEventsTypes.res +++ b/src/UIEvents/UiEventsTypes.res @@ -10,7 +10,7 @@ Simple user interface events. */ @editor.completeFrom(UIEvent) type uiEvent = private { - ...EventTypes.event, + ...Event.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/UIEvent/view) */ @@ -44,7 +44,7 @@ type focusEvent = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/FocusEvent/relatedTarget) */ - relatedTarget: Null.t, + relatedTarget: Null.t, } /** @@ -248,7 +248,7 @@ type mouseEvent = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget) */ - relatedTarget: Null.t, + relatedTarget: Null.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MouseEvent/pageX) */ @@ -321,7 +321,7 @@ type touch = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/target) */ - target: EventTypes.eventTarget, + target: EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/screenX) */ @@ -471,7 +471,7 @@ type pointerEvent = private { } type uiEventInit = { - ...EventTypes.eventInit, + ...Event.eventInit, mutable view?: Null.t, mutable detail?: int, mutable which?: int, @@ -503,14 +503,14 @@ type mouseEventInit = { mutable clientY?: int, mutable button?: int, mutable buttons?: int, - mutable relatedTarget?: Null.t, + mutable relatedTarget?: Null.t, mutable movementX?: float, mutable movementY?: float, } type focusEventInit = { ...uiEventInit, - mutable relatedTarget?: Null.t, + mutable relatedTarget?: Null.t, } type compositionEventInit = { @@ -548,7 +548,7 @@ type inputEventInit = { type touchInit = { mutable identifier: int, - mutable target: EventTypes.eventTarget, + mutable target: EventTarget.t, mutable clientX?: float, mutable clientY?: float, mutable screenX?: float, diff --git a/src/URL/URLSearchParams.res b/src/URL/URLSearchParams.res index 845a9f16..a06dae8b 100644 --- a/src/URL/URLSearchParams.res +++ b/src/URL/URLSearchParams.res @@ -46,7 +46,7 @@ Returns key/value pairs in the same order as they appear in the query string. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams/entries) */ @send -external entries: t => Iterator.t<(string, string)> = "entries" +external entries: t => iterable<(string, string)> = "entries" /** Returns the first value associated to the given search parameter. @@ -74,7 +74,7 @@ Returns an iterator allowing iteration through all keys contained in this object [Read more on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams/keys) */ @send -external keys: t => Iterator.t = "keys" +external keys: t => iterable = "keys" /** Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. @@ -101,4 +101,4 @@ Returns an iterator allowing iteration through all values contained in this obje [Read more on MDN](https://developer.mozilla.org/docs/Web/API/URLSearchParams/values) */ @send -external values: t => Iterator.t = "values" +external values: t => iterable = "values" diff --git a/src/VisualViewport/VisualViewportTypes.res b/src/VisualViewport/VisualViewportTypes.res index dd1df336..db1c2135 100644 --- a/src/VisualViewport/VisualViewportTypes.res +++ b/src/VisualViewport/VisualViewportTypes.res @@ -4,7 +4,7 @@ [See WebApiVisualViewport on MDN](https://developer.mozilla.org/docs/Web/API/VisualViewport) */ type visualViewport = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/VisualViewport/offsetLeft) */ diff --git a/src/WebAudio/WebAudioTypes.res b/src/WebAudio/WebAudioTypes.res index c65d1be1..63d7c75d 100644 --- a/src/WebAudio/WebAudioTypes.res +++ b/src/WebAudio/WebAudioTypes.res @@ -80,7 +80,7 @@ The Web Audio API events that occur when a ScriptProcessorNode input buffer is r */ @editor.completeFrom(AudioProcessingEvent) type audioProcessingEvent = private { - ...EventTypes.event, + ...Event.t, } /** @@ -89,7 +89,7 @@ The Web Audio API OfflineAudioCompletionEvent interface represents events that o */ @editor.completeFrom(OfflineAudioCompletionEvent) type offlineAudioCompletionEvent = private { - ...EventTypes.event, + ...Event.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/OfflineAudioCompletionEvent/renderedBuffer) */ @@ -109,7 +109,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(AudioNode) type rec audioNode = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AudioNode/context) */ @@ -178,7 +178,7 @@ and audioDestinationNode = { [See BaseAudioContext on MDN](https://developer.mozilla.org/docs/Web/API/BaseAudioContext) */ @editor.completeFrom(BaseAudioContext) and baseAudioContext = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/destination) */ @@ -1136,14 +1136,14 @@ type audioBufferOptions = { } type audioProcessingEventInit = { - ...EventTypes.eventInit, + ...Event.eventInit, mutable playbackTime: float, mutable inputBuffer: audioBuffer, mutable outputBuffer: audioBuffer, } type offlineAudioCompletionEventInit = { - ...EventTypes.eventInit, + ...Event.eventInit, mutable renderedBuffer: audioBuffer, } diff --git a/src/WebLocks/WebLocksTypes.res b/src/WebLocks/WebLocksTypes.res index 266a4910..997e60f4 100644 --- a/src/WebLocks/WebLocksTypes.res +++ b/src/WebLocks/WebLocksTypes.res @@ -39,7 +39,7 @@ type lockOptions = { mutable mode?: lockMode, mutable ifAvailable?: bool, mutable steal?: bool, - mutable signal?: EventTypes.abortSignal, + mutable signal?: AbortSignal.t, } type lockGrantedCallback = lock => promise diff --git a/src/WebMIDI/WebMidiTypes.res b/src/WebMIDI/WebMidiTypes.res index 0ccb3c06..6d493a70 100644 --- a/src/WebMIDI/WebMidiTypes.res +++ b/src/WebMIDI/WebMidiTypes.res @@ -14,7 +14,7 @@ type midiOutputMap = {} [See MIDIAccess on MDN](https://developer.mozilla.org/docs/Web/API/MIDIAccess) */ type midiAccess = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MIDIAccess/inputs) */ diff --git a/src/WebSockets/MessageEvent.res b/src/WebSockets/MessageEvent.res index 480b3b93..cf5a022f 100644 --- a/src/WebSockets/MessageEvent.res +++ b/src/WebSockets/MessageEvent.res @@ -1,5 +1,5 @@ -type event = EventTypes.event -type eventTarget = EventTypes.eventTarget +type event = Event.t +type eventTarget = EventTarget.t type messageEventSource = WebSocketsTypes.messageEventSource type messageEvent<'t> = WebSocketsTypes.messageEvent<'t> diff --git a/src/WebSockets/WebSocketsTypes.res b/src/WebSockets/WebSocketsTypes.res index f3574108..79f7cc2e 100644 --- a/src/WebSockets/WebSocketsTypes.res +++ b/src/WebSockets/WebSocketsTypes.res @@ -13,7 +13,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(WebSocket) type webSocket = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** Returns the WebApiURL that was used to establish the WebSocket connection. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/url) @@ -56,7 +56,7 @@ A CloseEvent is sent to clients using WebApiWebSockets when the connection is cl */ @editor.completeFrom(CloseEvent) type closeEvent = private { - ...EventTypes.event, + ...Event.t, /** Returns true if the connection closed cleanly; false otherwise. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) @@ -79,7 +79,7 @@ A message received by a target object. [See MessageEvent on MDN](https://developer.mozilla.org/docs/Web/API/MessageEvent) */ type messageEvent<'t> = { - ...EventTypes.event, + ...Event.t, /** Returns the data of the message. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessageEvent/data) @@ -108,14 +108,14 @@ type messageEvent<'t> = { } type closeEventInit = { - ...EventTypes.eventInit, + ...Event.eventInit, mutable wasClean?: bool, mutable code?: int, mutable reason?: string, } type messageEventInit<'t> = { - ...EventTypes.eventInit, + ...Event.eventInit, mutable data?: 't, mutable origin?: string, mutable lastEventId?: string, diff --git a/src/WebSpeech/WebSpeechTypes.res b/src/WebSpeech/WebSpeechTypes.res index d4028d8a..448409fd 100644 --- a/src/WebSpeech/WebSpeechTypes.res +++ b/src/WebSpeech/WebSpeechTypes.res @@ -6,7 +6,7 @@ This Web Speech API interface is the controller interface for the speech service */ @editor.completeFrom(SpeechSynthesis) type speechSynthesis = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/SpeechSynthesis/pending) */ @@ -55,7 +55,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(SpeechSynthesisUtterance) type speechSynthesisUtterance = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/text) */ diff --git a/src/WebStorage/WebStorageTypes.res b/src/WebStorage/WebStorageTypes.res index 1b210cf2..353182d8 100644 --- a/src/WebStorage/WebStorageTypes.res +++ b/src/WebStorage/WebStorageTypes.res @@ -19,7 +19,7 @@ A StorageEvent is sent to a window when a storage area it has access to is chang */ @editor.completeFrom(StorageEvent) type storageEvent = private { - ...EventTypes.event, + ...Event.t, /** Returns the key of the storage item being changed. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/StorageEvent/key) @@ -48,7 +48,7 @@ type storageEvent = private { } type storageEventInit = { - ...EventTypes.eventInit, + ...Event.eventInit, mutable key?: Null.t, mutable oldValue?: Null.t, mutable newValue?: Null.t, diff --git a/src/WebVTT/WebVttTypes.res b/src/WebVTT/WebVttTypes.res index c0416343..e9d97dff 100644 --- a/src/WebVTT/WebVttTypes.res +++ b/src/WebVTT/WebVttTypes.res @@ -31,7 +31,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(TextTrack) type rec textTrackCue = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** Returns the TextTrack object to which this text track cue belongs, if any, or null otherwise. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextTrackCue/track) @@ -73,7 +73,7 @@ This interface also inherits properties from EventTarget. TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(TextTrack) and textTrack = { - ...EventTypes.eventTarget, + ...EventTarget.t, /** Returns the text track kind string. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextTrack/kind) diff --git a/src/WebWorkers/WebWorkersTypes.res b/src/WebWorkers/WebWorkersTypes.res index 78068fa7..ebd87b57 100644 --- a/src/WebWorkers/WebWorkersTypes.res +++ b/src/WebWorkers/WebWorkersTypes.res @@ -34,7 +34,7 @@ Each WorkerGlobalScope has its own event loop. */ @editor.completeFrom(WorkerGlobalScope) type workerGlobalScope = private { - ...EventTypes.eventTarget, + ...EventTarget.t, /** [Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/caches) */ diff --git a/tests/DOMAPI/AddEventListener__test.res b/tests/DOMAPI/AddEventListener__test.res index ef052991..9f223249 100644 --- a/tests/DOMAPI/AddEventListener__test.res +++ b/tests/DOMAPI/AddEventListener__test.res @@ -1,18 +1,5 @@ -let button = DomGlobal.document->Document.querySelector("button")->Null.toOption -let h2 = DomGlobal.document->Document.querySelector("h2")->Null.toOption +let target = EventTarget.make() -switch (button, h2) { -| (Some(button), Some(h2)) => - button->Element.addEventListener(EventTypes.Click, (e: UiEventsTypes.mouseEvent) => { - Console.log(`Button clicked, ${Int.toString(e.button)}`) - switch h2.textContent { - | Null => h2.textContent = Value("1") - | Value(text) => - switch Int.fromString(text) { - | None => h2.textContent = Value("1") - | Some(number) => h2.textContent = Value(Int.toString(number + 1)) - } - } - }) -| _ => Console.log("Stuff not found") -} +target->EventTarget.addEventListener(EventType.Click, (event: Event.t) => { + event->Event.preventDefault +}) diff --git a/tests/DOMAPI/EventTarget__test.res b/tests/DOMAPI/EventTarget__test.res new file mode 100644 index 00000000..c180afd6 --- /dev/null +++ b/tests/DOMAPI/EventTarget__test.res @@ -0,0 +1,10 @@ +let acceptsDOMEventTarget = (_target: EventTarget.t) => () +let acceptsEventTargetLeaf = (_target: EventTarget.t) => () + +let _ = (target: EventTarget.t) => { + acceptsEventTargetLeaf(target) +} + +let _ = (target: EventTarget.t) => { + acceptsDOMEventTarget(target) +} diff --git a/tests/DOMAPI/EventType__test.res b/tests/DOMAPI/EventType__test.res new file mode 100644 index 00000000..a20b570c --- /dev/null +++ b/tests/DOMAPI/EventType__test.res @@ -0,0 +1,5 @@ +let click: EventType.t = Click + +let custom: EventType.t = Custom("custom-event") + +let _ = (click, custom) diff --git a/tests/DOMAPI/Event__test.res b/tests/DOMAPI/Event__test.res new file mode 100644 index 00000000..3684e389 --- /dev/null +++ b/tests/DOMAPI/Event__test.res @@ -0,0 +1,10 @@ +let acceptsDOMEvent = (_event: Event.t) => () +let acceptsEvent = (_event: Event.t) => () + +let _ = (event: Event.t) => { + acceptsEvent(event) +} + +let _ = (event: Event.t) => { + acceptsDOMEvent(event) +} diff --git a/tests/FetchAPI/FormData__test.res b/tests/FetchAPI/FormData__test.res index b6991336..f76db716 100644 --- a/tests/FetchAPI/FormData__test.res +++ b/tests/FetchAPI/FormData__test.res @@ -43,10 +43,13 @@ logEntry(~stringPrefix="String entry: ", ~filePrefix="Unexpected file entry: ", logEntry(~stringPrefix="Unexpected string entry: ", ~filePrefix="File entry: ", fileEntry) // Iterate over all entries in the FormData -let entries: Iterator.t<(string, EntryValue.t)> = formData->FormData.entries -let _ = entries->Iterator.forEach(((key, value)) => { - switch value { - | String(s) => Console.log(`${key}: ${s}`) - | File(f) => Console.log(`${key}: [WebApiFile] ${f.name}`) - } -}) +let entries: iterable<(string, EntryValue.t)> = formData->FormData.entries +let _ = + entries + ->Array.fromIterable + ->Array.forEach(((key, value)) => { + switch value { + | String(s) => Console.log(`${key}: ${s}`) + | File(f) => Console.log(`${key}: [WebApiFile] ${f.name}`) + } + }) diff --git a/tests/FetchAPI/URLSearchParams__test.res b/tests/FetchAPI/URLSearchParams__test.res index 2bec6371..c4532c4d 100644 --- a/tests/FetchAPI/URLSearchParams__test.res +++ b/tests/FetchAPI/URLSearchParams__test.res @@ -1,13 +1,13 @@ let params1 = URLSearchParams.fromString("foo=1&bar=2") -params1->URLSearchParams.keys->Iterator.toArray->Array.forEach(Console.log) +params1->URLSearchParams.keys->Array.fromIterable->Array.forEach(Console.log) let params2 = URLSearchParams.fromKeyValueArray([("foo", "1"), ("bar", "b")]) -params2->URLSearchParams.values->Iterator.toArray->Array.forEach(Console.log) +params2->URLSearchParams.values->Array.fromIterable->Array.forEach(Console.log) let params3 = URLSearchParams.fromDict(dict{"foo": "1", "bar": "b"}) params3 ->URLSearchParams.entries -->Iterator.toArray +->Array.fromIterable ->Array.forEach(((key, value)) => Console.log2(key, value)) let paramStr = params3->URLSearchParams.toString diff --git a/tests/Fetch__test.res b/tests/Fetch__test.res index 9428890f..b22354e6 100644 --- a/tests/Fetch__test.res +++ b/tests/Fetch__test.res @@ -27,7 +27,7 @@ let response3 = await Fetch.fetchWithRequest( ) DomGlobal.removeEventListener( - EventTypes.Mousedown, + EventType.Mousedown, MouseEvent.preventDefault, ~options={capture: false}, ) diff --git a/tests/ServiceWorkerAPI/ServiceWorker__test.res b/tests/ServiceWorkerAPI/ServiceWorker__test.res index c0fbdb60..e6083688 100644 --- a/tests/ServiceWorkerAPI/ServiceWorker__test.res +++ b/tests/ServiceWorkerAPI/ServiceWorker__test.res @@ -1,6 +1,6 @@ let self = ServiceWorkerScope.current -self->ServiceWorkerScope.addEventListener(EventTypes.Push, (event: PushEvent.t) => { +self->ServiceWorkerScope.addEventListener(EventType.Push, (event: PushEvent.t) => { Console.log("received push event") // Extract data @@ -32,7 +32,7 @@ self->ServiceWorkerScope.addEventListener(EventTypes.Push, (event: PushEvent.t) ->Promise.ignore }) -self->ServiceWorkerScope.addEventListener(EventTypes.NotificationClick, ( +self->ServiceWorkerScope.addEventListener(EventType.NotificationClick, ( event: Notification.notificationEvent, ) => { Console.log(`notification clicked: ${event.action}`) From 2b9928b8e89dcd13be8f4f3d727d875c1e1a9a3f Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Fri, 26 Jun 2026 11:37:04 -0400 Subject: [PATCH 02/21] improving types on hover and codelens --- src/Event/Base__EventTarget.res | 1 + src/Event/Event.res | 8 +++++--- src/Event/EventTarget.res | 4 +--- tests/DOMAPI/Event__test.res | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Event/Base__EventTarget.res b/src/Event/Base__EventTarget.res index 72caedaf..be801568 100644 --- a/src/Event/Base__EventTarget.res +++ b/src/Event/Base__EventTarget.res @@ -1 +1,2 @@ +@editor.completeFrom(EventTarget) type t = private {} diff --git a/src/Event/Event.res b/src/Event/Event.res index 6e0ee7b5..de72b2cb 100644 --- a/src/Event/Event.res +++ b/src/Event/Event.res @@ -1,5 +1,7 @@ type t = private {...Base__Event.t} +type eventTarget = Base__EventTarget.t = private {...Base__EventTarget.t} + type eventListener<'event> = EventTypes.eventListener<'event> type eventListenerOptions = EventTypes.eventListenerOptions = {mutable capture?: bool} @@ -26,10 +28,10 @@ external make: (~type_: string, ~eventInitDict: eventInit=?) => t = "Event" external type_: t => EventType.t = "type" @get -external target: t => Null.t = "target" +external target: t => Null.t = "target" @get -external currentTarget: t => Null.t = "currentTarget" +external currentTarget: t => Null.t = "currentTarget" @get external eventPhase: t => int = "eventPhase" @@ -64,7 +66,7 @@ Returns the invocation target objects of event's path (objects on which listener [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composedPath) */ @send - external composedPath: T.t => array = "composedPath" + external composedPath: T.t => array = "composedPath" /** If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. diff --git a/src/Event/EventTarget.res b/src/Event/EventTarget.res index 103f05ef..8e605c51 100644 --- a/src/Event/EventTarget.res +++ b/src/Event/EventTarget.res @@ -1,7 +1,7 @@ /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) */ -type t = private {...Base__EventTarget.t} +type t = Base__EventTarget.t = private {...Base__EventTarget.t} @new external make: unit => t = "EventTarget" @@ -11,8 +11,6 @@ module Impl = ( type t }, ) => { - external asEventTarget: T.t => t = "%identity" - /** Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. diff --git a/tests/DOMAPI/Event__test.res b/tests/DOMAPI/Event__test.res index 3684e389..a19ab00d 100644 --- a/tests/DOMAPI/Event__test.res +++ b/tests/DOMAPI/Event__test.res @@ -8,3 +8,17 @@ let _ = (event: Event.t) => { let _ = (event: Event.t) => { acceptsDOMEvent(event) } + +let handleClick = (event: Event.t) => { + event->Event.preventDefault + switch event->Event.target { + | Value(target) => Console.log(target) + | Null => Console.log("No target found") + } +} + +let target: EventTarget.t = {} + +let fn = (target: Event.eventTarget) => target + +let x = fn(target) From f6f8edc2918f0b3f556feb8ee955bb481370bf9e Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Fri, 26 Jun 2026 12:29:23 -0400 Subject: [PATCH 03/21] add EventTarget to Element --- src/DOM/Element.res | 4 ++-- src/Event/EventTarget.res | 9 +++++++++ tests/DOMAPI/EventTarget__test.res | 5 +++++ tests/DOMAPI/Event__test.res | 7 ++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/DOM/Element.res b/src/DOM/Element.res index 64a21f31..b2fd978f 100644 --- a/src/DOM/Element.res +++ b/src/DOM/Element.res @@ -5,8 +5,6 @@ module Impl = ( ) => { include Node.Impl({type t = T.t}) - external asElement: T.t => DomTypes.element = "%identity" - /** Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. @@ -505,3 +503,5 @@ Returns true if qualifiedName is now present, and false otherwise. include Impl({type t = DomTypes.element}) let isInstanceOf = (_: 't): bool => %raw(`param instanceof Element`) + +include EventTarget.Extend({type t = DomTypes.element}) diff --git a/src/Event/EventTarget.res b/src/Event/EventTarget.res index 8e605c51..46f3297e 100644 --- a/src/Event/EventTarget.res +++ b/src/Event/EventTarget.res @@ -92,3 +92,12 @@ Dispatches a synthetic event event to target and returns true if either event's } include Impl({type t = t}) + +// Allow an external type to count as a valid EventTarget +module Extend = ( + T: { + type t + }, +) => Impl({ + type t = T.t +}) diff --git a/tests/DOMAPI/EventTarget__test.res b/tests/DOMAPI/EventTarget__test.res index c180afd6..51f78fdd 100644 --- a/tests/DOMAPI/EventTarget__test.res +++ b/tests/DOMAPI/EventTarget__test.res @@ -8,3 +8,8 @@ let _ = (target: EventTarget.t) => { let _ = (target: EventTarget.t) => { acceptsDOMEventTarget(target) } + +let el = switch Document.make()->Document.getElementById("foo") { +| Null => () +| Value(el) => el->Element.addEventListener(Click, () => ()) +} diff --git a/tests/DOMAPI/Event__test.res b/tests/DOMAPI/Event__test.res index a19ab00d..565b46de 100644 --- a/tests/DOMAPI/Event__test.res +++ b/tests/DOMAPI/Event__test.res @@ -19,6 +19,11 @@ let handleClick = (event: Event.t) => { let target: EventTarget.t = {} -let fn = (target: Event.eventTarget) => target +let fn = (target: Event.eventTarget) => + target->EventTarget.addEventListener(Click, () => Console.log("Click 1")) let x = fn(target) + +// Testing out global event listeners + +DomGlobal.addEventListener(Click, () => Console.log("Click 2")) From a5d791f9699d51a240e70e0018367643d1903bd8 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Fri, 26 Jun 2026 12:58:13 -0400 Subject: [PATCH 04/21] Move Window type to Base.res --- README.md | 2 +- docs/content/docs/api-surface.mdx | 10 ++--- docs/content/docs/index.mdx | 2 +- src/DOM/DomGlobal.res | 70 ------------------------------- src/DOM/Element.res | 2 +- src/DOM/Window.res | 8 ++-- src/Event/EventTarget.res | 9 ---- tests/DOMAPI/Event__test.res | 3 +- tests/Fetch__test.res | 8 +--- tests/VisualViewport__test.res | 2 +- 10 files changed, 14 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index bb55a1e3..ca452265 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ and add `@rescript/webapi` to your `rescript.json`: ## Usage ```rescript -let location = WebAPI.Window.current->WebAPI.Window.location +let location = WebAPI.Base.window->WebAPI.Window.location let href = location.href location->WebAPI.Location.reload ``` diff --git a/docs/content/docs/api-surface.mdx b/docs/content/docs/api-surface.mdx index 3dc6ee15..49482f91 100644 --- a/docs/content/docs/api-surface.mdx +++ b/docs/content/docs/api-surface.mdx @@ -13,12 +13,12 @@ add the package to `rescript.json`: } ``` -Use `WebAPI.Window.current` for the browser `window`. Interface-specific methods live on +Use `WebAPI.Base.window` for the browser `window`. Interface-specific methods live on public modules such as `WebAPI.Window`, `WebAPI.Location`, `WebAPI.Document`, `WebAPI.Element`, `WebAPI.Request`, and `WebAPI.Response`. ```ReScript -let location = WebAPI.Window.current->WebAPI.Window.location +let location = WebAPI.Base.window->WebAPI.Window.location let href = location.href location->WebAPI.Location.reload @@ -32,7 +32,7 @@ helper modules. ```ReScript let req: WebAPI.Request.t = WebAPI.Request.fromURL("https://example.com") let headers = WebAPI.Headers.make() -let document = WebAPI.Window.current->WebAPI.Window.document +let document = WebAPI.Base.window->WebAPI.Window.document let element = document->WebAPI.Document.createElement("button") ``` @@ -243,7 +243,7 @@ let redirect = WebAPI.Response.redirect(~url="/login", ~status=302) DOM values are operated on through public interface modules. ```ReScript -let document = WebAPI.Window.current->WebAPI.Window.document +let document = WebAPI.Base.window->WebAPI.Window.document let maybeButton = document ->WebAPI.Document.querySelector("button") @@ -271,7 +271,7 @@ let node = element->WebAPI.Element.asNode `Window.visualViewport` returns a nullable `WebAPI.VisualViewport.t`. ```ReScript -let maybeViewport = WebAPI.Window.current +let maybeViewport = WebAPI.Base.window ->WebAPI.Window.visualViewport ->Null.toOption diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index 5e4d0c56..25d6e109 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -51,7 +51,7 @@ export const rescriptJson = ` After installing the package , you can use bindings for the various Web APIs as defined in [MDN](https://developer.mozilla.org/en-US/docs/Web/API). export const rescriptSample = ` -let location = WebAPI.Window.current->WebAPI.Window.location +let location = WebAPI.Base.window->WebAPI.Window.location // Access properties using \`.\` let href = location.href diff --git a/src/DOM/DomGlobal.res b/src/DOM/DomGlobal.res index 11903bb2..ff508451 100644 --- a/src/DOM/DomGlobal.res +++ b/src/DOM/DomGlobal.res @@ -294,76 +294,6 @@ external requestAnimationFrame: (float => unit) => int = "requestAnimationFrame" */ external cancelAnimationFrame: int => unit = "cancelAnimationFrame" -/** -Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. - -The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. - -When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. - -When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. - -When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. - -If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted. - -The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. -[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) -*/ -external addEventListener: ( - EventType.t, - EventTypes.eventListener<'event>, - ~options: Event.addEventListenerOptions=?, -) => unit = "addEventListener" - -/** -Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. - -The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. - -When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. - -When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. - -When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. - -If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted. - -The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. -[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) -*/ -external addEventListenerWithCapture: ( - EventType.t, - EventTypes.eventListener<'event>, - @as(json`true`) _, -) => unit = "addEventListener" - -/** -Removes the event listener in target's event listener list with the same type, callback, and options. -[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) -*/ -external removeEventListener: ( - EventType.t, - EventTypes.eventListener<'event>, - ~options: Event.eventListenerOptions=?, -) => unit = "removeEventListener" - -/** -Removes the event listener in target's event listener list with the same type, callback, and options. -[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) -*/ -external removeEventListenerUseCapture: ( - EventType.t, - EventTypes.eventListener<'event>, - @as(json`true`) _, -) => unit = "removeEventListener" - -/** -Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. -[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) -*/ -external dispatchEvent: Event.t => bool = "dispatchEvent" - /** Closes the window. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/close) diff --git a/src/DOM/Element.res b/src/DOM/Element.res index b2fd978f..424efb55 100644 --- a/src/DOM/Element.res +++ b/src/DOM/Element.res @@ -504,4 +504,4 @@ include Impl({type t = DomTypes.element}) let isInstanceOf = (_: 't): bool => %raw(`param instanceof Element`) -include EventTarget.Extend({type t = DomTypes.element}) +include EventTarget.Impl({type t = DomTypes.element}) diff --git a/src/DOM/Window.res b/src/DOM/Window.res index 62c8576c..3b027b9a 100644 --- a/src/DOM/Window.res +++ b/src/DOM/Window.res @@ -1,13 +1,11 @@ -type t = DomTypes.window +type t = Base.window = private {...Base.window} type windowPostMessageOptions = DomTypes.windowPostMessageOptions include EventTarget.Impl({type t = t}) -external current: t = "window" - /** - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/window) - */ +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/window) +*/ @get external window: t => t = "window" diff --git a/src/Event/EventTarget.res b/src/Event/EventTarget.res index 46f3297e..8e605c51 100644 --- a/src/Event/EventTarget.res +++ b/src/Event/EventTarget.res @@ -92,12 +92,3 @@ Dispatches a synthetic event event to target and returns true if either event's } include Impl({type t = t}) - -// Allow an external type to count as a valid EventTarget -module Extend = ( - T: { - type t - }, -) => Impl({ - type t = T.t -}) diff --git a/tests/DOMAPI/Event__test.res b/tests/DOMAPI/Event__test.res index 565b46de..22b5cf82 100644 --- a/tests/DOMAPI/Event__test.res +++ b/tests/DOMAPI/Event__test.res @@ -25,5 +25,4 @@ let fn = (target: Event.eventTarget) => let x = fn(target) // Testing out global event listeners - -DomGlobal.addEventListener(Click, () => Console.log("Click 2")) +Base.window->Window.addEventListener(Click, () => Console.log("Click 2")) diff --git a/tests/Fetch__test.res b/tests/Fetch__test.res index b22354e6..ab8ee794 100644 --- a/tests/Fetch__test.res +++ b/tests/Fetch__test.res @@ -26,13 +26,7 @@ let response3 = await Fetch.fetchWithRequest( }, ) -DomGlobal.removeEventListener( - EventType.Mousedown, - MouseEvent.preventDefault, - ~options={capture: false}, -) - -let registrationResult = await Window.current +let registrationResult = await Base.window ->Window.navigator ->Navigator.serviceWorker ->ServiceWorkerContainer.register("/sw.js") diff --git a/tests/VisualViewport__test.res b/tests/VisualViewport__test.res index a823f286..88dd8bd2 100644 --- a/tests/VisualViewport__test.res +++ b/tests/VisualViewport__test.res @@ -1 +1 @@ -let maybeViewport: Null.t = Window.current->Window.visualViewport +let maybeViewport: Null.t = Base.window->Window.visualViewport From 8d1a36b3662344f0ca8e082406f902d2742d8856 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Fri, 26 Jun 2026 13:04:56 -0400 Subject: [PATCH 05/21] move event and eventTarget into Base --- src/DOM/DomTypes.res | 6 ++---- src/Event/Base__Event.res | 1 - src/Event/Base__EventTarget.res | 2 -- src/Event/Event.res | 4 ++-- src/Event/EventTarget.res | 2 +- src/Event/EventTypes.res | 4 ++-- 6 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 src/Event/Base__Event.res delete mode 100644 src/Event/Base__EventTarget.res diff --git a/src/DOM/DomTypes.res b/src/DOM/DomTypes.res index b00cda21..6fcf9100 100644 --- a/src/DOM/DomTypes.res +++ b/src/DOM/DomTypes.res @@ -1,8 +1,6 @@ @@warning("-30") type domStringList = DOM.domStringList -type eventTarget = EventTarget.t -type eventType = EventType.t type file = FileTypes.file type blob = FileTypes.blob type fileSystemEntry = FileAndDirectoryEntriesTypes.fileSystemEntry @@ -336,7 +334,7 @@ type barProp = { */ @editor.completeFrom(ScreenOrientation) type screenOrientation = private { - ...eventTarget, + ...Base.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ScreenOrientation/type) */ @@ -1806,7 +1804,7 @@ The CanvasRenderingContext2D interface, part of the WebApiCanvas API, provides t type canvasRenderingContext2D type rec animation = { - ...eventTarget, + ...Base.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/id) */ diff --git a/src/Event/Base__Event.res b/src/Event/Base__Event.res deleted file mode 100644 index 72caedaf..00000000 --- a/src/Event/Base__Event.res +++ /dev/null @@ -1 +0,0 @@ -type t = private {} diff --git a/src/Event/Base__EventTarget.res b/src/Event/Base__EventTarget.res deleted file mode 100644 index be801568..00000000 --- a/src/Event/Base__EventTarget.res +++ /dev/null @@ -1,2 +0,0 @@ -@editor.completeFrom(EventTarget) -type t = private {} diff --git a/src/Event/Event.res b/src/Event/Event.res index de72b2cb..f72878f9 100644 --- a/src/Event/Event.res +++ b/src/Event/Event.res @@ -1,6 +1,6 @@ -type t = private {...Base__Event.t} +type t = Base.event = private {...Base.event} -type eventTarget = Base__EventTarget.t = private {...Base__EventTarget.t} +type eventTarget = Base.eventTarget = private {...Base.eventTarget} type eventListener<'event> = EventTypes.eventListener<'event> diff --git a/src/Event/EventTarget.res b/src/Event/EventTarget.res index 8e605c51..03bc19e7 100644 --- a/src/Event/EventTarget.res +++ b/src/Event/EventTarget.res @@ -1,7 +1,7 @@ /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) */ -type t = Base__EventTarget.t = private {...Base__EventTarget.t} +type t = Base.eventTarget = private {...Base.eventTarget} @new external make: unit => t = "EventTarget" diff --git a/src/Event/EventTypes.res b/src/Event/EventTypes.res index c845b77d..ee6ad7a2 100644 --- a/src/Event/EventTypes.res +++ b/src/Event/EventTypes.res @@ -17,7 +17,7 @@ A signal object that allows you to communicate with a WebApiDOM request (such as [See AbortSignal on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal) */ and abortSignal = private { - ...Base__EventTarget.t, + ...Base.eventTarget, /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) @@ -51,5 +51,5 @@ The ExtendableEvent interface extends the lifetime of the install and activate e [See ExtendableEvent on MDN](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) */ type extendableEvent = private { - ...Base__Event.t, + ...Base.event, } From a46cf9375ad07c04ad3d4600bc4444356a77a2ac Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 6 Jul 2026 09:38:17 -0400 Subject: [PATCH 06/21] Add missing Base module --- src/Base/Base.res | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/Base/Base.res diff --git a/src/Base/Base.res b/src/Base/Base.res new file mode 100644 index 00000000..23535fa7 --- /dev/null +++ b/src/Base/Base.res @@ -0,0 +1,11 @@ +// This file is temporary and will eventually replace DOM.res + +@editor.completeFrom(Window) +type window = private {} +external window: window = "window" + +@editor.completeFrom(Event) +type event = private {} + +@editor.completeFrom(EventTarget) +type eventTarget = private {} From 535c6a1b31a747aede5edbabdfee64501f117689 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 6 Jul 2026 11:04:24 -0400 Subject: [PATCH 07/21] add Base file- --- src/Base/Base.res | 93 ++++++++++++++++++++++++++++++++++++++++-- src/Base/BaseEvent.res | 6 --- 2 files changed, 90 insertions(+), 9 deletions(-) delete mode 100644 src/Base/BaseEvent.res diff --git a/src/Base/Base.res b/src/Base/Base.res index 23535fa7..bf17c860 100644 --- a/src/Base/Base.res +++ b/src/Base/Base.res @@ -4,8 +4,95 @@ type window = private {} external window: window = "window" -@editor.completeFrom(Event) -type event = private {} - +/** +EventTarget is a WebApiDOM interface implemented by objects that can receive events and may have listeners for them. +[See EventTarget on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) +*/ @editor.completeFrom(EventTarget) type eventTarget = private {} + +/** +An event which takes place in the DOM. +[See WebApiEvent on MDN](https://developer.mozilla.org/docs/Web/API/Event) +*/ +@editor.completeFrom(Event) +type event = private { + /** + Returns the type of event, e.g. "click", "hashchange", or "submit". + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/type) + */ + @as("type") + type_: EventType.t, + /** + Returns the object to which event is dispatched (its target). + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/target) + */ + target: Null.t, + /** + Returns the object whose event listener's callback is currently being invoked. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) + */ + currentTarget: Null.t, + /** + Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) + */ + eventPhase: int, + /** + Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/bubbles) + */ + bubbles: bool, + /** + Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/cancelable) + */ + cancelable: bool, + /** + Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) + */ + defaultPrevented: bool, + /** + Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composed) + */ + composed: bool, + /** + Returns true if event was dispatched by the user agent, and false otherwise. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) + */ + isTrusted: bool, + /** + Returns the event's timestamp as the number of milliseconds measured relative to the time origin. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) + */ + timeStamp: float, +} + +type eventInit = { + mutable bubbles?: bool, + mutable cancelable?: bool, + mutable composed?: bool, +} + +/** +The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. +[See ExtendableEvent on MDN](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) + */ +type extendableEvent = private { + ...event, +} + +type abortSignal = private {} + +type eventListener<'event> = 'event => unit + +type eventListenerOptions = {mutable capture?: bool} + +type addEventListenerOptions = { + ...eventListenerOptions, + mutable passive?: bool, + mutable once?: bool, + mutable signal?: abortSignal, +} diff --git a/src/Base/BaseEvent.res b/src/Base/BaseEvent.res deleted file mode 100644 index 8b811ed5..00000000 --- a/src/Base/BaseEvent.res +++ /dev/null @@ -1,6 +0,0 @@ -/** -EventTarget is a WebApiDOM interface implemented by objects that can receive events and may have listeners for them. -[See EventTarget on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) -*/ -@editor.completeFrom(BaseEvent.EventTarget) -type eventTarget = private {} From 2097c9203334f06c7550450046448427fa0c22ed Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 6 Jul 2026 11:24:46 -0400 Subject: [PATCH 08/21] remove EventTypes file --- README.md | 2 +- docs/content/docs/api-surface.mdx | 10 ++-- docs/content/docs/index.mdx | 2 +- .../2026-04-22-unmonorepo-webapi-design.md | 2 +- src/Base/BaseCSSFontLoading.res | 2 +- src/Base/BaseEncryptedMediaExtensions.res | 2 +- src/Base/DOM.res | 8 +-- src/Base/{Base.res => DOM_.res} | 46 +++++++++++++--- src/DOM/DomTypes.res | 4 +- src/DOM/Window.res | 2 +- src/Event/AbortController.res | 2 +- src/Event/AbortSignal.res | 2 +- src/Event/Event.res | 25 ++------- src/Event/EventTarget.res | 14 ++--- src/Event/EventTypes.res | 55 ------------------- src/Event/ExtendableEvent.res | 4 +- src/IndexedDB/IDBFactory.res | 2 +- src/IndexedDB/IndexedDbTypes.res | 12 ++-- tests/DOMAPI/Event__test.res | 4 +- tests/Fetch__test.res | 2 +- tests/VisualViewport__test.res | 2 +- tests/unmonorepo/migrate-layout.test.mjs | 2 +- .../baselines/dom.generated.d.ts | 18 +++--- .../baselines/serviceworker.generated.d.ts | 18 +++--- .../baselines/sharedworker.generated.d.ts | 18 +++--- .../baselines/ts5.5/dom.generated.d.ts | 18 +++--- .../ts5.5/serviceworker.generated.d.ts | 18 +++--- .../ts5.5/sharedworker.generated.d.ts | 18 +++--- .../baselines/ts5.5/webworker.generated.d.ts | 18 +++--- .../baselines/webworker.generated.d.ts | 18 +++--- .../dom-dump.json | 18 +++--- .../inputfiles/idl/IndexedDB.commentmap.json | 10 ++-- .../inputfiles/mdn/apiDescriptions.json | 8 +-- .../serviceworker-dump.json | 18 +++--- .../sharedworker-dump.json | 18 +++--- .../TypeScript-DOM-lib-generator/src/build.ts | 24 ++++---- .../webworker-dump.json | 18 +++--- 37 files changed, 211 insertions(+), 253 deletions(-) rename src/Base/{Base.res => DOM_.res} (71%) delete mode 100644 src/Event/EventTypes.res diff --git a/README.md b/README.md index ca452265..1d0ed3f8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ and add `@rescript/webapi` to your `rescript.json`: ## Usage ```rescript -let location = WebAPI.Base.window->WebAPI.Window.location +let location = WebAPI.DOM_.window->WebAPI.Window.location let href = location.href location->WebAPI.Location.reload ``` diff --git a/docs/content/docs/api-surface.mdx b/docs/content/docs/api-surface.mdx index 49482f91..216a74dd 100644 --- a/docs/content/docs/api-surface.mdx +++ b/docs/content/docs/api-surface.mdx @@ -13,12 +13,12 @@ add the package to `rescript.json`: } ``` -Use `WebAPI.Base.window` for the browser `window`. Interface-specific methods live on +Use `WebAPI.DOM_.window` for the browser `window`. Interface-specific methods live on public modules such as `WebAPI.Window`, `WebAPI.Location`, `WebAPI.Document`, `WebAPI.Element`, `WebAPI.Request`, and `WebAPI.Response`. ```ReScript -let location = WebAPI.Base.window->WebAPI.Window.location +let location = WebAPI.DOM_.window->WebAPI.Window.location let href = location.href location->WebAPI.Location.reload @@ -32,7 +32,7 @@ helper modules. ```ReScript let req: WebAPI.Request.t = WebAPI.Request.fromURL("https://example.com") let headers = WebAPI.Headers.make() -let document = WebAPI.Base.window->WebAPI.Window.document +let document = WebAPI.DOM_.window->WebAPI.Window.document let element = document->WebAPI.Document.createElement("button") ``` @@ -243,7 +243,7 @@ let redirect = WebAPI.Response.redirect(~url="/login", ~status=302) DOM values are operated on through public interface modules. ```ReScript -let document = WebAPI.Base.window->WebAPI.Window.document +let document = WebAPI.DOM_.window->WebAPI.Window.document let maybeButton = document ->WebAPI.Document.querySelector("button") @@ -271,7 +271,7 @@ let node = element->WebAPI.Element.asNode `Window.visualViewport` returns a nullable `WebAPI.VisualViewport.t`. ```ReScript -let maybeViewport = WebAPI.Base.window +let maybeViewport = WebAPI.DOM_.window ->WebAPI.Window.visualViewport ->Null.toOption diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index 25d6e109..a381faf3 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -51,7 +51,7 @@ export const rescriptJson = ` After installing the package , you can use bindings for the various Web APIs as defined in [MDN](https://developer.mozilla.org/en-US/docs/Web/API). export const rescriptSample = ` -let location = WebAPI.Base.window->WebAPI.Window.location +let location = WebAPI.DOM_.window->WebAPI.Window.location // Access properties using \`.\` let href = location.href diff --git a/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md b/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md index 5cb468f6..be203e71 100644 --- a/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md +++ b/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md @@ -124,7 +124,7 @@ The unified build keeps the original flat module surface instead of adding gener - `WebAPI.Headers` - `WebAPI.URL` -Shared DOM base types should be owned by `DOM`, so common references stay short, for example `DOM.element` instead of `BaseDOM.element` or `Base.DOM.element`. +Shared DOM base types should be owned by `DOM`, so common references stay short, for example `DOM.element` instead of `BaseDOM.element` or `DOM_.DOM.element`. ## Internal Module Naming diff --git a/src/Base/BaseCSSFontLoading.res b/src/Base/BaseCSSFontLoading.res index f5c6eabf..568aff08 100644 --- a/src/Base/BaseCSSFontLoading.res +++ b/src/Base/BaseCSSFontLoading.res @@ -13,7 +13,7 @@ type fontFaceSetLoadStatus = */ @editor.completeFrom(BaseCSSFontLoading.FontFaceSet) type rec fontFaceSet = private { - ...BaseEvent.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) */ diff --git a/src/Base/BaseEncryptedMediaExtensions.res b/src/Base/BaseEncryptedMediaExtensions.res index 7ba05fa4..3bd97aa1 100644 --- a/src/Base/BaseEncryptedMediaExtensions.res +++ b/src/Base/BaseEncryptedMediaExtensions.res @@ -61,7 +61,7 @@ This WebApiEncryptedMediaExtensions API interface represents a context for mess */ @editor.completeFrom(BaseEncryptedMediaExtensions.MediaKeySession) type mediaKeySession = private { - ...BaseEvent.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaKeySession/sessionId) */ diff --git a/src/Base/DOM.res b/src/Base/DOM.res index 1a954a89..680f6c2d 100644 --- a/src/Base/DOM.res +++ b/src/Base/DOM.res @@ -349,7 +349,7 @@ type barProp = { */ @editor.completeFrom(DOM.ScreenOrientation) type screenOrientation = private { - ...BaseEvent.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ScreenOrientation/type) */ @@ -2310,7 +2310,7 @@ TODO: mark as private once mutating fields of private records is allowed */ @editor.completeFrom(DOM.Node) type rec node = { - ...BaseEvent.eventTarget, + ...DOM_.eventTarget, /** Returns the type of node. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeType) @@ -6972,7 +6972,7 @@ Stores information on a media query applied to a document, and handles sending n */ @editor.completeFrom(DOM.MediaQueryList) type mediaQueryList = private { - ...BaseEvent.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaQueryList/media) */ @@ -7045,7 +7045,7 @@ type timeRanges = private { */ @editor.completeFrom(DOM.TextTrackList) type textTrackList = private { - ...BaseEvent.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextTrackList/length) */ diff --git a/src/Base/Base.res b/src/Base/DOM_.res similarity index 71% rename from src/Base/Base.res rename to src/Base/DOM_.res index bf17c860..5e973efb 100644 --- a/src/Base/Base.res +++ b/src/Base/DOM_.res @@ -80,19 +80,49 @@ type eventInit = { The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. [See ExtendableEvent on MDN](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) */ +@editor.completeFrom(ExtendableEvent) type extendableEvent = private { ...event, } -type abortSignal = private {} +/** +A controller object that allows you to abort one or more WebApiDOM requests as and when desired. +[See AbortController on MDN](https://developer.mozilla.org/docs/Web/API/AbortController) +*/ +@editor.completeFrom(AbortController) +type rec abortController = private { + /** + Returns the AbortSignal object associated with this object. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortController/signal) + */ + signal: abortSignal, +} +/** +A signal object that allows you to communicate with a WebApiDOM request (such as a WebApiFetch) and abort it if required via an AbortController object. +[See AbortSignal on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal) +*/ +and abortSignal = private { + ...eventTarget, + /** + Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) + */ + aborted: bool, + /** + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) + */ + reason: JSON.t, +} -type eventListener<'event> = 'event => unit +module EventListener = { + type t<'event> = 'event => unit -type eventListenerOptions = {mutable capture?: bool} + type options = {mutable capture?: bool} -type addEventListenerOptions = { - ...eventListenerOptions, - mutable passive?: bool, - mutable once?: bool, - mutable signal?: abortSignal, + type addEventListenerOptions = { + ...options, + mutable passive?: bool, + mutable once?: bool, + mutable signal?: abortSignal, + } } diff --git a/src/DOM/DomTypes.res b/src/DOM/DomTypes.res index 6fcf9100..71729bfd 100644 --- a/src/DOM/DomTypes.res +++ b/src/DOM/DomTypes.res @@ -334,7 +334,7 @@ type barProp = { */ @editor.completeFrom(ScreenOrientation) type screenOrientation = private { - ...Base.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ScreenOrientation/type) */ @@ -1804,7 +1804,7 @@ The CanvasRenderingContext2D interface, part of the WebApiCanvas API, provides t type canvasRenderingContext2D type rec animation = { - ...Base.eventTarget, + ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/id) */ diff --git a/src/DOM/Window.res b/src/DOM/Window.res index 3b027b9a..c0ed2de5 100644 --- a/src/DOM/Window.res +++ b/src/DOM/Window.res @@ -1,4 +1,4 @@ -type t = Base.window = private {...Base.window} +type t = DOM_.window = private {...DOM_.window} type windowPostMessageOptions = DomTypes.windowPostMessageOptions include EventTarget.Impl({type t = t}) diff --git a/src/Event/AbortController.res b/src/Event/AbortController.res index 2ebaf0e3..7aa5172b 100644 --- a/src/Event/AbortController.res +++ b/src/Event/AbortController.res @@ -1,7 +1,7 @@ /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortController) */ -type t = EventTypes.abortController = private {...EventTypes.abortController} +type t = DOM_.abortController = private {...DOM_.abortController} @new external make: unit => t = "AbortController" diff --git a/src/Event/AbortSignal.res b/src/Event/AbortSignal.res index b9c038f1..5d9e403f 100644 --- a/src/Event/AbortSignal.res +++ b/src/Event/AbortSignal.res @@ -1,4 +1,4 @@ -type t = EventTypes.abortSignal = private {...EventTypes.abortSignal} +type t = DOM_.abortSignal = private {...DOM_.abortSignal} include EventTarget.Impl({type t = t}) diff --git a/src/Event/Event.res b/src/Event/Event.res index f72878f9..d0cdc3a1 100644 --- a/src/Event/Event.res +++ b/src/Event/Event.res @@ -1,26 +1,11 @@ -type t = Base.event = private {...Base.event} +type t = DOM_.event = private {...DOM_.event} -type eventTarget = Base.eventTarget = private {...Base.eventTarget} - -type eventListener<'event> = EventTypes.eventListener<'event> - -type eventListenerOptions = EventTypes.eventListenerOptions = {mutable capture?: bool} - -type abortSignal = EventTypes.abortSignal = private {...EventTypes.abortSignal} - -type eventInit = EventTypes.eventInit = { +type eventInit = DOM_.eventInit = { mutable bubbles?: bool, mutable cancelable?: bool, mutable composed?: bool, } -type addEventListenerOptions = EventTypes.addEventListenerOptions = { - ...eventListenerOptions, - mutable passive?: bool, - mutable once?: bool, - mutable signal?: abortSignal, -} - @new external make: (~type_: string, ~eventInitDict: eventInit=?) => t = "Event" @@ -28,10 +13,10 @@ external make: (~type_: string, ~eventInitDict: eventInit=?) => t = "Event" external type_: t => EventType.t = "type" @get -external target: t => Null.t = "target" +external target: t => Null.t = "target" @get -external currentTarget: t => Null.t = "currentTarget" +external currentTarget: t => Null.t = "currentTarget" @get external eventPhase: t => int = "eventPhase" @@ -66,7 +51,7 @@ Returns the invocation target objects of event's path (objects on which listener [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composedPath) */ @send - external composedPath: T.t => array = "composedPath" + external composedPath: T.t => array = "composedPath" /** If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. diff --git a/src/Event/EventTarget.res b/src/Event/EventTarget.res index 03bc19e7..a639d094 100644 --- a/src/Event/EventTarget.res +++ b/src/Event/EventTarget.res @@ -1,7 +1,7 @@ /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) */ -type t = Base.eventTarget = private {...Base.eventTarget} +type t = DOM_.eventTarget = private {...DOM_.eventTarget} @new external make: unit => t = "EventTarget" @@ -31,8 +31,8 @@ The event listener is appended to target's event listener list and is not append external addEventListener: ( T.t, EventType.t, - Event.eventListener<'event>, - ~options: Event.addEventListenerOptions=?, + DOM_.EventListener.t<'event>, + ~options: DOM_.EventListener.addEventListenerOptions=?, ) => unit = "addEventListener" /** @@ -55,7 +55,7 @@ The event listener is appended to target's event listener list and is not append external addEventListenerWithCapture: ( T.t, EventType.t, - Event.eventListener<'event>, + DOM_.EventListener.t<'event>, @as(json`true`) _, ) => unit = "addEventListener" @@ -67,8 +67,8 @@ Removes the event listener in target's event listener list with the same type, c external removeEventListener: ( T.t, EventType.t, - Event.eventListener<'event>, - ~options: Event.eventListenerOptions=?, + DOM_.EventListener.t<'event>, + ~options: DOM_.EventListener.options=?, ) => unit = "removeEventListener" /** @@ -79,7 +79,7 @@ Removes the event listener in target's event listener list with the same type, c external removeEventListenerUseCapture: ( T.t, EventType.t, - Event.eventListener<'event>, + DOM_.EventListener.t<'event>, @as(json`true`) _, ) => unit = "removeEventListener" diff --git a/src/Event/EventTypes.res b/src/Event/EventTypes.res deleted file mode 100644 index ee6ad7a2..00000000 --- a/src/Event/EventTypes.res +++ /dev/null @@ -1,55 +0,0 @@ -@@warning("-30") - -/** -A controller object that allows you to abort one or more WebApiDOM requests as and when desired. -[See AbortController on MDN](https://developer.mozilla.org/docs/Web/API/AbortController) -*/ -type rec abortController = private { - /** - Returns the AbortSignal object associated with this object. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortController/signal) - */ - signal: abortSignal, -} - -/** -A signal object that allows you to communicate with a WebApiDOM request (such as a WebApiFetch) and abort it if required via an AbortController object. -[See AbortSignal on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal) -*/ -and abortSignal = private { - ...Base.eventTarget, - /** - Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) - */ - aborted: bool, - /** - [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) - */ - reason: JSON.t, -} - -type eventListener<'event> = 'event => unit - -type eventListenerOptions = {mutable capture?: bool} - -type eventInit = { - mutable bubbles?: bool, - mutable cancelable?: bool, - mutable composed?: bool, -} - -type addEventListenerOptions = { - ...eventListenerOptions, - mutable passive?: bool, - mutable once?: bool, - mutable signal?: abortSignal, -} - -/** -The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. -[See ExtendableEvent on MDN](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) - */ -type extendableEvent = private { - ...Base.event, -} diff --git a/src/Event/ExtendableEvent.res b/src/Event/ExtendableEvent.res index aa94677e..3fc12466 100644 --- a/src/Event/ExtendableEvent.res +++ b/src/Event/ExtendableEvent.res @@ -1,12 +1,10 @@ -type t = EventTypes.extendableEvent = private {...EventTypes.extendableEvent} +type t = DOM_.extendableEvent = private {...DOM_.extendableEvent} module Impl = ( T: { type t }, ) => { - external asExtendableEvent: T.t => t = "%identity" - include Event.Impl({type t = T.t}) @send diff --git a/src/IndexedDB/IDBFactory.res b/src/IndexedDB/IDBFactory.res index d6a5b05c..023b7981 100644 --- a/src/IndexedDB/IDBFactory.res +++ b/src/IndexedDB/IDBFactory.res @@ -10,7 +10,7 @@ external open_: ( ) => IndexedDbTypes.idbOpenDBRequest = "open" /** -Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. +Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @send diff --git a/src/IndexedDB/IndexedDbTypes.res b/src/IndexedDB/IndexedDbTypes.res index ad4f499d..c3d4cc3f 100644 --- a/src/IndexedDB/IndexedDbTypes.res +++ b/src/IndexedDB/IndexedDbTypes.res @@ -28,24 +28,24 @@ In the following code snippet, we make a request to open a database, and include type idbFactory = private {} /** -This WebApiIndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. +This WebApiIndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. [See IDBDatabase on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ @editor.completeFrom(IDBDatabase) type idbDatabase = private { ...EventTarget.t, /** - Returns the name of the database. + Returns the name of the dataDOM_. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ name: string, /** - Returns the version of the database. + Returns the version of the dataDOM_. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ version: int, /** - Returns a list of the names of object stores in the database. + Returns a list of the names of object stores in the dataDOM_. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ objectStoreNames: DOM.domStringList, @@ -58,7 +58,7 @@ type idbDatabase = private { type idbTransaction = private { ...EventTarget.t, /** - Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ objectStoreNames: DOM.domStringList, @@ -159,7 +159,7 @@ type idbObjectStore = { } /** -IDBIndex interface of the WebApiIndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. +IDBIndex interface of the WebApiIndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. [See IDBIndex on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex) TODO: mark as private once mutating fields of private records is allowed */ diff --git a/tests/DOMAPI/Event__test.res b/tests/DOMAPI/Event__test.res index 22b5cf82..ff7fe25f 100644 --- a/tests/DOMAPI/Event__test.res +++ b/tests/DOMAPI/Event__test.res @@ -19,10 +19,10 @@ let handleClick = (event: Event.t) => { let target: EventTarget.t = {} -let fn = (target: Event.eventTarget) => +let fn = (target: DOM_.eventTarget) => target->EventTarget.addEventListener(Click, () => Console.log("Click 1")) let x = fn(target) // Testing out global event listeners -Base.window->Window.addEventListener(Click, () => Console.log("Click 2")) +DOM_.window->Window.addEventListener(Click, () => Console.log("Click 2")) diff --git a/tests/Fetch__test.res b/tests/Fetch__test.res index ab8ee794..d781be3c 100644 --- a/tests/Fetch__test.res +++ b/tests/Fetch__test.res @@ -26,7 +26,7 @@ let response3 = await Fetch.fetchWithRequest( }, ) -let registrationResult = await Base.window +let registrationResult = await DOM_.window ->Window.navigator ->Navigator.serviceWorker ->ServiceWorkerContainer.register("/sw.js") diff --git a/tests/VisualViewport__test.res b/tests/VisualViewport__test.res index 88dd8bd2..05c8d70b 100644 --- a/tests/VisualViewport__test.res +++ b/tests/VisualViewport__test.res @@ -1 +1 @@ -let maybeViewport: Null.t = Base.window->Window.visualViewport +let maybeViewport: Null.t = DOM_.window->Window.visualViewport diff --git a/tests/unmonorepo/migrate-layout.test.mjs b/tests/unmonorepo/migrate-layout.test.mjs index 14ceca0a..fda1076b 100644 --- a/tests/unmonorepo/migrate-layout.test.mjs +++ b/tests/unmonorepo/migrate-layout.test.mjs @@ -96,7 +96,7 @@ test("moves legacy sources into src/, renames duplicate leaves, and rem ); assert.equal(readFileSync(path.join(root, "src", "URL", "URLSearchParams.res"), "utf8"), "type t"); assert.ok(!existsSync(path.join(root, "src", "DOM", "DOM.res"))); - assert.ok(!existsSync(path.join(root, "src", "Base", "Base.res"))); + assert.ok(!existsSync(path.join(root, "src", "Base", "DOM_.res"))); assert.equal(readFileSync(path.join(root, "src", "Base", "DOM.res"), "utf8"), "type dom = unit"); assert.ok(!existsSync(path.join(root, "packages", "DOM", "rescript.json"))); assert.ok(!existsSync(path.join(root, "packages", "DOM", "package.json"))); diff --git a/tools/TypeScript-DOM-lib-generator/baselines/dom.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/dom.generated.d.ts index 51e1f81a..b6ffb5be 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/dom.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/dom.generated.d.ts @@ -14079,7 +14079,7 @@ declare var History: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -14154,7 +14154,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -14180,19 +14180,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -14204,7 +14204,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -14265,7 +14265,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -14284,7 +14284,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -14705,7 +14705,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/serviceworker.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/serviceworker.generated.d.ts index 428c6dfb..b4d2cc0e 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/serviceworker.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/serviceworker.generated.d.ts @@ -2835,7 +2835,7 @@ declare var Headers: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -2910,7 +2910,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -2936,19 +2936,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -2960,7 +2960,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -3021,7 +3021,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -3040,7 +3040,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -3461,7 +3461,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/sharedworker.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/sharedworker.generated.d.ts index f53237b0..6cbd963d 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/sharedworker.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/sharedworker.generated.d.ts @@ -2724,7 +2724,7 @@ declare var Headers: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -2799,7 +2799,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -2825,19 +2825,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -2849,7 +2849,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -2910,7 +2910,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -2929,7 +2929,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -3350,7 +3350,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/dom.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/dom.generated.d.ts index 51e1f81a..b6ffb5be 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/dom.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/dom.generated.d.ts @@ -14079,7 +14079,7 @@ declare var History: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -14154,7 +14154,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -14180,19 +14180,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -14204,7 +14204,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -14265,7 +14265,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -14284,7 +14284,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -14705,7 +14705,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/serviceworker.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/serviceworker.generated.d.ts index 428c6dfb..b4d2cc0e 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/serviceworker.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/serviceworker.generated.d.ts @@ -2835,7 +2835,7 @@ declare var Headers: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -2910,7 +2910,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -2936,19 +2936,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -2960,7 +2960,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -3021,7 +3021,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -3040,7 +3040,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -3461,7 +3461,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/sharedworker.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/sharedworker.generated.d.ts index f53237b0..6cbd963d 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/sharedworker.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/sharedworker.generated.d.ts @@ -2724,7 +2724,7 @@ declare var Headers: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -2799,7 +2799,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -2825,19 +2825,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -2849,7 +2849,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -2910,7 +2910,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -2929,7 +2929,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -3350,7 +3350,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/webworker.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/webworker.generated.d.ts index 3f7e4a57..f853678d 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/webworker.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/ts5.5/webworker.generated.d.ts @@ -3309,7 +3309,7 @@ declare var Headers: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -3384,7 +3384,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -3410,19 +3410,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -3434,7 +3434,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -3495,7 +3495,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -3514,7 +3514,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -3935,7 +3935,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/baselines/webworker.generated.d.ts b/tools/TypeScript-DOM-lib-generator/baselines/webworker.generated.d.ts index 3f7e4a57..f853678d 100644 --- a/tools/TypeScript-DOM-lib-generator/baselines/webworker.generated.d.ts +++ b/tools/TypeScript-DOM-lib-generator/baselines/webworker.generated.d.ts @@ -3309,7 +3309,7 @@ declare var Headers: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursor) */ @@ -3384,7 +3384,7 @@ declare var IDBCursor: { }; /** - * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. + * This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue) */ @@ -3410,19 +3410,19 @@ interface IDBDatabaseEventMap { } /** - * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. + * This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase) */ interface IDBDatabase extends EventTarget { /** - * Returns the name of the database. + * Returns the name of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name) */ readonly name: string; /** - * Returns a list of the names of object stores in the database. + * Returns a list of the names of object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames) */ @@ -3434,7 +3434,7 @@ interface IDBDatabase extends EventTarget { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/versionchange_event) */ onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null; /** - * Returns the version of the database. + * Returns the version of the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version) */ @@ -3495,7 +3495,7 @@ interface IDBFactory { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases) */ databases(): Promise; /** - * Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. + * Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase) */ @@ -3514,7 +3514,7 @@ declare var IDBFactory: { }; /** - * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. + * IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBIndex) */ @@ -3935,7 +3935,7 @@ interface IDBTransaction extends EventTarget { */ readonly mode: IDBTransactionMode; /** - * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. + * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) */ diff --git a/tools/TypeScript-DOM-lib-generator/dom-dump.json b/tools/TypeScript-DOM-lib-generator/dom-dump.json index 65a9fa71..d3d78ddc 100644 --- a/tools/TypeScript-DOM-lib-generator/dom-dump.json +++ b/tools/TypeScript-DOM-lib-generator/dom-dump.json @@ -15835,7 +15835,7 @@ "stringifier": false, "exposed": "Window Worker", "secureContext": false, - "comment": "Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", + "comment": "Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase" }, "databases": { @@ -16060,7 +16060,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the name of the database.", + "comment": "Returns the name of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/name" }, "version": { @@ -16072,7 +16072,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the version of the database.", + "comment": "Returns the version of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/version" }, "objectStoreNames": { @@ -16084,7 +16084,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the database.", + "comment": "Returns a list of the names of object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames" }, "onabort": { @@ -16143,7 +16143,7 @@ "transferable": false, "extends": "EventTarget", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase", - "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.", + "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_.", "events": { "event": [ { @@ -16968,7 +16968,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBIndex", - "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." + "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." }, "IDBKeyRange": { "name": "IDBKeyRange", @@ -17423,7 +17423,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursor", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_." }, "IDBCursorWithValue": { "name": "IDBCursorWithValue", @@ -17460,7 +17460,7 @@ "transferable": false, "extends": "IDBCursor", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property." }, "IDBTransaction": { "name": "IDBTransaction", @@ -17543,7 +17543,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.", + "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames" }, "mode": { diff --git a/tools/TypeScript-DOM-lib-generator/inputfiles/idl/IndexedDB.commentmap.json b/tools/TypeScript-DOM-lib-generator/inputfiles/idl/IndexedDB.commentmap.json index 2275a66a..bf17c48d 100644 --- a/tools/TypeScript-DOM-lib-generator/inputfiles/idl/IndexedDB.commentmap.json +++ b/tools/TypeScript-DOM-lib-generator/inputfiles/idl/IndexedDB.commentmap.json @@ -5,11 +5,11 @@ "idbrequest-transaction": "Returns the IDBTransaction the request was made within. If this as an open request, then it returns an upgrade transaction while it is running, or null otherwise.", "idbrequest-readystate": "Returns \"pending\" until a request is complete, then returns \"done\".", "idbfactory-open": "Attempts to open a connection to the named database with the current version, or 1 if it does not already exist. If the request is successful request's result will be the connection.", - "idbfactory-deletedatabase": "Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", + "idbfactory-deletedatabase": "Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", "idbfactory-cmp": "Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.\n\nThrows a \"DataError\" DOMException if either input is not a valid key.", - "idbdatabase-name": "Returns the name of the database.", - "idbdatabase-version": "Returns the version of the database.", - "idbdatabase-objectstorenames": "Returns a list of the names of object stores in the database.", + "idbdatabase-name": "Returns the name of the dataDOM_.", + "idbdatabase-version": "Returns the version of the dataDOM_.", + "idbdatabase-objectstorenames": "Returns a list of the names of object stores in the dataDOM_.", "idbdatabase-createobjectstore": "Creates a new object store with the given name and options and returns a new IDBObjectStore.\n\nThrows a \"InvalidStateError\" DOMException if not called within an upgrade transaction.", "idbdatabase-deleteobjectstore": "Deletes the object store with the given name.\n\nThrows a \"InvalidStateError\" DOMException if not called within an upgrade transaction.", "idbdatabase-transaction": "Returns a new transaction with the given mode (\"readonly\" or \"readwrite\") and scope which can be a single object store name or an array of names.", @@ -60,7 +60,7 @@ "idbcursor-update": "Updated the record pointed at by the cursor with a new value.\n\nThrows a \"DataError\" DOMException if the effective object store uses in-line keys and the key would have changed.\n\nIf successful, request's result will be the record's key.", "idbcursor-delete": "Delete the record pointed at by the cursor with a new value.\n\nIf successful, request's result will be undefined.", "idbcursorwithvalue-value": "Returns the cursor's current value.", - "idbtransaction-objectstorenames": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.", + "idbtransaction-objectstorenames": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_.", "idbtransaction-mode": "Returns the mode the transaction was created with (\"readonly\" or \"readwrite\"), or \"versionchange\" for an upgrade transaction.", "idbtransaction-db": "Returns the transaction's connection.", "idbtransaction-error": "If the transaction was aborted, returns the error (a DOMException) providing the reason.", diff --git a/tools/TypeScript-DOM-lib-generator/inputfiles/mdn/apiDescriptions.json b/tools/TypeScript-DOM-lib-generator/inputfiles/mdn/apiDescriptions.json index a3e621ab..f8091a80 100644 --- a/tools/TypeScript-DOM-lib-generator/inputfiles/mdn/apiDescriptions.json +++ b/tools/TypeScript-DOM-lib-generator/inputfiles/mdn/apiDescriptions.json @@ -172,11 +172,11 @@ "HashChangeEvent": "The HashChangeEvent interface represents events that fire when the fragment identifier of the URL has changed.", "Headers": "The Headers interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.", "History": "The History interface allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in.", - "IDBCursor": "The IDBCursor interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database.", - "IDBCursorWithValue": "The IDBCursorWithValue interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property.", - "IDBDatabase": "The IDBDatabase interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.", + "IDBCursor": "The IDBCursor interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a dataDOM_.", + "IDBCursorWithValue": "The IDBCursorWithValue interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property.", + "IDBDatabase": "The IDBDatabase interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_.", "IDBFactory": "In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.)", - "IDBIndex": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.", + "IDBIndex": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.", "IDBKeyRange": "A key range can be a single value or a range with upper and lower bounds or endpoints. If the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). To retrieve all keys within a certain range, you can use the following code constructs:", "IDBObjectStore": "This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.)", "IDBOpenDBRequest": "Also inherits methods from its parents IDBRequest and EventTarget.", diff --git a/tools/TypeScript-DOM-lib-generator/serviceworker-dump.json b/tools/TypeScript-DOM-lib-generator/serviceworker-dump.json index d1f8304d..d3e12ddb 100644 --- a/tools/TypeScript-DOM-lib-generator/serviceworker-dump.json +++ b/tools/TypeScript-DOM-lib-generator/serviceworker-dump.json @@ -6247,7 +6247,7 @@ "stringifier": false, "exposed": "Window Worker", "secureContext": false, - "comment": "Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", + "comment": "Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase" }, "databases": { @@ -6472,7 +6472,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the name of the database.", + "comment": "Returns the name of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/name" }, "version": { @@ -6484,7 +6484,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the version of the database.", + "comment": "Returns the version of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/version" }, "objectStoreNames": { @@ -6496,7 +6496,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the database.", + "comment": "Returns a list of the names of object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames" }, "onabort": { @@ -6555,7 +6555,7 @@ "transferable": false, "extends": "EventTarget", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase", - "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.", + "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_.", "events": { "event": [ { @@ -7380,7 +7380,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBIndex", - "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." + "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." }, "IDBKeyRange": { "name": "IDBKeyRange", @@ -7835,7 +7835,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursor", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_." }, "IDBCursorWithValue": { "name": "IDBCursorWithValue", @@ -7872,7 +7872,7 @@ "transferable": false, "extends": "IDBCursor", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property." }, "IDBTransaction": { "name": "IDBTransaction", @@ -7955,7 +7955,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.", + "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames" }, "mode": { diff --git a/tools/TypeScript-DOM-lib-generator/sharedworker-dump.json b/tools/TypeScript-DOM-lib-generator/sharedworker-dump.json index 4d9f3da1..2158b3a6 100644 --- a/tools/TypeScript-DOM-lib-generator/sharedworker-dump.json +++ b/tools/TypeScript-DOM-lib-generator/sharedworker-dump.json @@ -6227,7 +6227,7 @@ "stringifier": false, "exposed": "Window Worker", "secureContext": false, - "comment": "Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", + "comment": "Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase" }, "databases": { @@ -6452,7 +6452,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the name of the database.", + "comment": "Returns the name of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/name" }, "version": { @@ -6464,7 +6464,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the version of the database.", + "comment": "Returns the version of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/version" }, "objectStoreNames": { @@ -6476,7 +6476,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the database.", + "comment": "Returns a list of the names of object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames" }, "onabort": { @@ -6535,7 +6535,7 @@ "transferable": false, "extends": "EventTarget", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase", - "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.", + "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_.", "events": { "event": [ { @@ -7360,7 +7360,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBIndex", - "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." + "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." }, "IDBKeyRange": { "name": "IDBKeyRange", @@ -7815,7 +7815,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursor", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_." }, "IDBCursorWithValue": { "name": "IDBCursorWithValue", @@ -7852,7 +7852,7 @@ "transferable": false, "extends": "IDBCursor", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property." }, "IDBTransaction": { "name": "IDBTransaction", @@ -7935,7 +7935,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.", + "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames" }, "mode": { diff --git a/tools/TypeScript-DOM-lib-generator/src/build.ts b/tools/TypeScript-DOM-lib-generator/src/build.ts index 4d73eb84..19c7cf6d 100644 --- a/tools/TypeScript-DOM-lib-generator/src/build.ts +++ b/tools/TypeScript-DOM-lib-generator/src/build.ts @@ -215,33 +215,33 @@ async function emitDom() { webidl.interfaces!.interface[partial.name] || webidl.mixins!.mixin[partial.name]; if (base) { - if (base.exposed) resolveExposure(partial, base.exposed); - merge(base.constants, partial.constants, true); - merge(base.methods, partial.methods, true); - merge(base.properties, partial.properties, true); + if (DOM_.exposed) resolveExposure(partial, DOM_.exposed); + merge(DOM_.constants, partial.constants, true); + merge(DOM_.methods, partial.methods, true); + merge(DOM_.properties, partial.properties, true); } } for (const partial of w.partialMixins) { const base = webidl.mixins!.mixin[partial.name]; if (base) { - if (base.exposed) resolveExposure(partial, base.exposed); - merge(base.constants, partial.constants, true); - merge(base.methods, partial.methods, true); - merge(base.properties, partial.properties, true); + if (DOM_.exposed) resolveExposure(partial, DOM_.exposed); + merge(DOM_.constants, partial.constants, true); + merge(DOM_.methods, partial.methods, true); + merge(DOM_.properties, partial.properties, true); } } for (const partial of w.partialDictionaries) { const base = webidl.dictionaries!.dictionary[partial.name]; if (base) { - merge(base.members, partial.members, true); + merge(DOM_.members, partial.members, true); } } for (const partial of w.partialNamespaces) { const base = webidl.namespaces?.find((n) => n.name === partial.name); if (base) { - if (base.exposed) resolveExposure(partial, base.exposed); - merge(base.methods, partial.methods, true); - merge(base.properties, partial.properties, true); + if (DOM_.exposed) resolveExposure(partial, DOM_.exposed); + merge(DOM_.methods, partial.methods, true); + merge(DOM_.properties, partial.properties, true); } } for (const include of w.includes) { diff --git a/tools/TypeScript-DOM-lib-generator/webworker-dump.json b/tools/TypeScript-DOM-lib-generator/webworker-dump.json index e45dd070..b02c42c0 100644 --- a/tools/TypeScript-DOM-lib-generator/webworker-dump.json +++ b/tools/TypeScript-DOM-lib-generator/webworker-dump.json @@ -7690,7 +7690,7 @@ "stringifier": false, "exposed": "Window Worker", "secureContext": false, - "comment": "Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", + "comment": "Attempts to delete the named dataDOM_. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase" }, "databases": { @@ -7915,7 +7915,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the name of the database.", + "comment": "Returns the name of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/name" }, "version": { @@ -7927,7 +7927,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns the version of the database.", + "comment": "Returns the version of the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/version" }, "objectStoreNames": { @@ -7939,7 +7939,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the database.", + "comment": "Returns a list of the names of object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames" }, "onabort": { @@ -7998,7 +7998,7 @@ "transferable": false, "extends": "EventTarget", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBDatabase", - "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.", + "comment": "This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that dataDOM_. The interface provides the only way to get and manage versions of the dataDOM_.", "events": { "event": [ { @@ -8823,7 +8823,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBIndex", - "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." + "comment": "IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a dataDOM_. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data." }, "IDBKeyRange": { "name": "IDBKeyRange", @@ -9278,7 +9278,7 @@ "secureContext": false, "transferable": false, "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursor", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_." }, "IDBCursorWithValue": { "name": "IDBCursorWithValue", @@ -9315,7 +9315,7 @@ "transferable": false, "extends": "IDBCursor", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBCursorWithValue", - "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property." + "comment": "This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a dataDOM_. It is the same as the IDBCursor, except that it includes the value property." }, "IDBTransaction": { "name": "IDBTransaction", @@ -9398,7 +9398,7 @@ "readonly": true, "exposed": "Window Worker", "secureContext": false, - "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.", + "comment": "Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the dataDOM_.", "mdnUrl": "https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames" }, "mode": { From 0f0daa9774e6c37991e30ddc14b47998d1f04086 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 6 Jul 2026 11:27:20 -0400 Subject: [PATCH 09/21] add missing editor.completeFrom --- src/Base/DOM_.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Base/DOM_.res b/src/Base/DOM_.res index 5e973efb..bfcc554a 100644 --- a/src/Base/DOM_.res +++ b/src/Base/DOM_.res @@ -101,7 +101,7 @@ type rec abortController = private { A signal object that allows you to communicate with a WebApiDOM request (such as a WebApiFetch) and abort it if required via an AbortController object. [See AbortSignal on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal) */ -and abortSignal = private { +@editor.completeFrom(AbortSignal) and abortSignal = private { ...eventTarget, /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. From 58c2adda357e32080bd5d44b67c6a436c37c8ef1 Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 6 Jul 2026 11:27:58 -0400 Subject: [PATCH 10/21] remove unrelated change --- docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md b/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md index be203e71..5cb468f6 100644 --- a/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md +++ b/docs/superpowers/specs/2026-04-22-unmonorepo-webapi-design.md @@ -124,7 +124,7 @@ The unified build keeps the original flat module surface instead of adding gener - `WebAPI.Headers` - `WebAPI.URL` -Shared DOM base types should be owned by `DOM`, so common references stay short, for example `DOM.element` instead of `BaseDOM.element` or `DOM_.DOM.element`. +Shared DOM base types should be owned by `DOM`, so common references stay short, for example `DOM.element` instead of `BaseDOM.element` or `Base.DOM.element`. ## Internal Module Naming From 31a4e39e6d93be5b80975746e21808d05f43e9fa Mon Sep 17 00:00:00 2001 From: Josh Vlk Date: Mon, 6 Jul 2026 12:56:01 -0400 Subject: [PATCH 11/21] remove temo DOM_ file --- README.md | 2 +- docs/content/docs/api-surface.mdx | 10 +- docs/content/docs/index.mdx | 2 +- src/Base/BaseCSSFontLoading.res | 1 - src/Base/BaseEncryptedMediaExtensions.res | 2 +- src/Base/DOM.res | 269 +++++++++++++----- src/Base/DOM_.res | 128 --------- src/DOM/DomTypes.res | 4 +- src/DOM/Window.res | 2 +- src/Event/AbortController.res | 2 +- src/Event/AbortSignal.res | 2 +- src/Event/Event.res | 10 +- src/Event/EventTarget.res | 14 +- src/Event/ExtendableEvent.res | 2 +- tests/DOMAPI/Event__test.res | 4 +- tests/Fetch__test.res | 2 +- tests/VisualViewport__test.res | 2 +- tests/unmonorepo/migrate-layout.test.mjs | 49 +++- .../TypeScript-DOM-lib-generator/src/build.ts | 24 +- 19 files changed, 277 insertions(+), 254 deletions(-) delete mode 100644 src/Base/DOM_.res diff --git a/README.md b/README.md index 1d0ed3f8..18f37ad5 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ and add `@rescript/webapi` to your `rescript.json`: ## Usage ```rescript -let location = WebAPI.DOM_.window->WebAPI.Window.location +let location = WebAPI.DOM.window->WebAPI.Window.location let href = location.href location->WebAPI.Location.reload ``` diff --git a/docs/content/docs/api-surface.mdx b/docs/content/docs/api-surface.mdx index 216a74dd..75c225d5 100644 --- a/docs/content/docs/api-surface.mdx +++ b/docs/content/docs/api-surface.mdx @@ -13,12 +13,12 @@ add the package to `rescript.json`: } ``` -Use `WebAPI.DOM_.window` for the browser `window`. Interface-specific methods live on +Use `WebAPI.DOM.window` for the browser `window`. Interface-specific methods live on public modules such as `WebAPI.Window`, `WebAPI.Location`, `WebAPI.Document`, `WebAPI.Element`, `WebAPI.Request`, and `WebAPI.Response`. ```ReScript -let location = WebAPI.DOM_.window->WebAPI.Window.location +let location = WebAPI.DOM.window->WebAPI.Window.location let href = location.href location->WebAPI.Location.reload @@ -32,7 +32,7 @@ helper modules. ```ReScript let req: WebAPI.Request.t = WebAPI.Request.fromURL("https://example.com") let headers = WebAPI.Headers.make() -let document = WebAPI.DOM_.window->WebAPI.Window.document +let document = WebAPI.DOM.window->WebAPI.Window.document let element = document->WebAPI.Document.createElement("button") ``` @@ -243,7 +243,7 @@ let redirect = WebAPI.Response.redirect(~url="/login", ~status=302) DOM values are operated on through public interface modules. ```ReScript -let document = WebAPI.DOM_.window->WebAPI.Window.document +let document = WebAPI.DOM.window->WebAPI.Window.document let maybeButton = document ->WebAPI.Document.querySelector("button") @@ -271,7 +271,7 @@ let node = element->WebAPI.Element.asNode `Window.visualViewport` returns a nullable `WebAPI.VisualViewport.t`. ```ReScript -let maybeViewport = WebAPI.DOM_.window +let maybeViewport = WebAPI.DOM.window ->WebAPI.Window.visualViewport ->Null.toOption diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index a381faf3..19242735 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -51,7 +51,7 @@ export const rescriptJson = ` After installing the package , you can use bindings for the various Web APIs as defined in [MDN](https://developer.mozilla.org/en-US/docs/Web/API). export const rescriptSample = ` -let location = WebAPI.DOM_.window->WebAPI.Window.location +let location = WebAPI.DOM.window->WebAPI.Window.location // Access properties using \`.\` let href = location.href diff --git a/src/Base/BaseCSSFontLoading.res b/src/Base/BaseCSSFontLoading.res index 568aff08..4a17fe35 100644 --- a/src/Base/BaseCSSFontLoading.res +++ b/src/Base/BaseCSSFontLoading.res @@ -13,7 +13,6 @@ type fontFaceSetLoadStatus = */ @editor.completeFrom(BaseCSSFontLoading.FontFaceSet) type rec fontFaceSet = private { - ...DOM_.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) */ diff --git a/src/Base/BaseEncryptedMediaExtensions.res b/src/Base/BaseEncryptedMediaExtensions.res index 3bd97aa1..43dc1f3a 100644 --- a/src/Base/BaseEncryptedMediaExtensions.res +++ b/src/Base/BaseEncryptedMediaExtensions.res @@ -61,7 +61,7 @@ This WebApiEncryptedMediaExtensions API interface represents a context for mess */ @editor.completeFrom(BaseEncryptedMediaExtensions.MediaKeySession) type mediaKeySession = private { - ...DOM_.eventTarget, + ...DOM.eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaKeySession/sessionId) */ diff --git a/src/Base/DOM.res b/src/Base/DOM.res index 680f6c2d..b41c47c0 100644 --- a/src/Base/DOM.res +++ b/src/Base/DOM.res @@ -27,7 +27,9 @@ type domStringList = { length: int, } -type window +@editor.completeFrom(Window) +type window = private {} +external window: window = "window" type shadowRootMode = | @as("closed") Closed @@ -203,7 +205,7 @@ The location (WebApiURL) of the object it is linked to. Changes done on it are r [See Location on MDN](https://developer.mozilla.org/docs/Web/API/Location) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.Location) +@editor.completeFrom(Location) type location = { /** Returns the Location object's URL. @@ -291,11 +293,11 @@ type userActivation = { The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. [See Navigator on MDN](https://developer.mozilla.org/docs/Web/API/Navigator) */ -@editor.completeFrom(DOM.Navigator) +@editor.completeFrom(Navigator) type navigator // TODO: mark as private once mutating fields of private records is allowed -@editor.completeFrom(DOM.DOMTokenList) +@editor.completeFrom(DOMTokenList) type domTokenList = { /** Returns the number of tokens. @@ -315,7 +317,7 @@ Can be set, to change the associated attribute. A collection of Attr objects. Objects inside a NamedNodeMap are not in any particular order, unlike NodeList, although they may be accessed by an index as in an array. [See NamedNodeMap on MDN](https://developer.mozilla.org/docs/Web/API/NamedNodeMap) */ -@editor.completeFrom(DOM.NamedNodeMap) +@editor.completeFrom(NamedNodeMap) type namedNodeMap = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/NamedNodeMap/length) @@ -331,7 +333,7 @@ type fragmentDirective = {} /** [See CustomElementRegistry on MDN](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry) */ -@editor.completeFrom(DOM.CustomElementRegistry) +@editor.completeFrom(CustomElementRegistry) type customElementRegistry = private {} /** @@ -344,12 +346,135 @@ type barProp = { visible: bool, } +/** +EventTarget is a WebApiDOM interface implemented by objects that can receive events and may have listeners for them. +[See EventTarget on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget) +*/ +@editor.completeFrom(EventTarget) +type eventTarget = private {} + +/** +An event which takes place in the DOM. +[See WebApiEvent on MDN](https://developer.mozilla.org/docs/Web/API/Event) +*/ +@editor.completeFrom(Event) +type event = private { + /** +Returns the type of event, e.g. "click", "hashchange", or "submit". +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/type) +*/ + @as("type") + type_: EventType.t, + /** +Returns the object to which event is dispatched (its target). +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/target) +*/ + target: Null.t, + /** +Returns the object whose event listener's callback is currently being invoked. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) +*/ + currentTarget: Null.t, + /** +Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) +*/ + eventPhase: int, + /** +Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/bubbles) +*/ + bubbles: bool, + /** +Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/cancelable) +*/ + cancelable: bool, + /** +Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) +*/ + defaultPrevented: bool, + /** +Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composed) +*/ + composed: bool, + /** +Returns true if event was dispatched by the user agent, and false otherwise. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) +*/ + isTrusted: bool, + /** +Returns the event's timestamp as the number of milliseconds measured relative to the time origin. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) +*/ + timeStamp: float, +} + +type eventInit = { + mutable bubbles?: bool, + mutable cancelable?: bool, + mutable composed?: bool, +} + +/** +The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. +[See ExtendableEvent on MDN](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) +*/ +@editor.completeFrom(ExtendableEvent) +type extendableEvent = private { + ...event, +} + +/** +A controller object that allows you to abort one or more WebApiDOM requests as and when desired. +[See AbortController on MDN](https://developer.mozilla.org/docs/Web/API/AbortController) +*/ +@editor.completeFrom(AbortController) +type rec abortController = private { + /** +Returns the AbortSignal object associated with this object. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortController/signal) +*/ + signal: abortSignal, +} +/** +A signal object that allows you to communicate with a WebApiDOM request (such as a WebApiFetch) and abort it if required via an AbortController object. +[See AbortSignal on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal) +*/ +@editor.completeFrom(AbortSignal) and abortSignal = private { + ...eventTarget, + /** +Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) +*/ + aborted: bool, + /** +[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) +*/ + reason: JSON.t, +} + +module EventListener = { + type t<'event> = 'event => unit + + type options = {mutable capture?: bool} + + type addEventListenerOptions = { + ...options, + mutable passive?: bool, + mutable once?: bool, + mutable signal?: abortSignal, + } +} + /** [See ScreenOrientation on MDN](https://developer.mozilla.org/docs/Web/API/ScreenOrientation) */ -@editor.completeFrom(DOM.ScreenOrientation) +@editor.completeFrom(ScreenOrientation) type screenOrientation = private { - ...DOM_.eventTarget, + ...eventTarget, /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ScreenOrientation/type) */ @@ -408,7 +533,7 @@ type offscreenRenderingContext = unknown /** [See AnimationTimeline on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline) */ -@editor.completeFrom(DOM.Animation) +@editor.completeFrom(Animation) type rec animationTimeline = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime) @@ -419,7 +544,7 @@ type rec animationTimeline = private { /** [See DocumentTimeline on MDN](https://developer.mozilla.org/docs/Web/API/DocumentTimeline) */ -@editor.completeFrom(DOM.DocumentTimeline) and documentTimeline = private { +@editor.completeFrom(DocumentTimeline) and documentTimeline = private { // Base properties from AnimationTimeline /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime) @@ -432,7 +557,7 @@ type rec animationTimeline = private { [See MediaList on MDN](https://developer.mozilla.org/docs/Web/API/MediaList) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.MediaList) +@editor.completeFrom(MediaList) type mediaList = { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaList/mediaText) @@ -447,7 +572,7 @@ type mediaList = { /** [See StylePropertyMapReadOnly on MDN](https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly) */ -@editor.completeFrom(DOM.StylePropertyMapReadOnly) +@editor.completeFrom(StylePropertyMapReadOnly) type stylePropertyMapReadOnly = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/StylePropertyMapReadOnly/size) @@ -458,7 +583,7 @@ type stylePropertyMapReadOnly = private { /** [See StylePropertyMap on MDN](https://developer.mozilla.org/docs/Web/API/StylePropertyMap) */ -@editor.completeFrom(DOM.StylePropertyMap) +@editor.completeFrom(StylePropertyMap) type stylePropertyMap = private { ...stylePropertyMapReadOnly, } @@ -473,7 +598,7 @@ type domStringMap = {} A list of StyleSheet. [See StyleSheetList on MDN](https://developer.mozilla.org/docs/Web/API/StyleSheetList) */ -@editor.completeFrom(DOM.StyleSheetList) +@editor.completeFrom(StyleSheetList) type rec styleSheetList = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/StyleSheetList/length) @@ -522,7 +647,7 @@ A single CSS style sheet. It inherits properties and methods from its parent, St [See CSSStyleSheet on MDN](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.CSSStyleSheet) and cssStyleSheet = { +@editor.completeFrom(CSSStyleSheet) and cssStyleSheet = { // Base properties from StyleSheet /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/StyleSheet/type) @@ -588,7 +713,7 @@ and cssRule = { A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. [See CSSRuleList on MDN](https://developer.mozilla.org/docs/Web/API/CSSRuleList) */ -@editor.completeFrom(DOM.CSSRuleList) and cssRuleList = private { +@editor.completeFrom(CSSRuleList) and cssRuleList = private { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CSSRuleList/length) */ @@ -600,7 +725,7 @@ An object that is a CSS declaration block, and exposes style information and var [See CSSStyleDeclaration on MDN](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.CSSStyleDeclaration) and cssStyleDeclaration = { +@editor.completeFrom(CSSStyleDeclaration) and cssStyleDeclaration = { /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssText) */ @@ -2308,9 +2433,9 @@ Node is an interface from which a number of WebApiDOM API object types inherit. [See Node on MDN](https://developer.mozilla.org/docs/Web/API/Node) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.Node) +@editor.completeFrom(Node) type rec node = { - ...DOM_.eventTarget, + ...eventTarget, /** Returns the type of node. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeType) @@ -2385,7 +2510,7 @@ type rec node = { NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll(). [See NodeList on MDN](https://developer.mozilla.org/docs/Web/API/NodeList) */ -@editor.completeFrom(DOM.NodeList) and nodeList<'tNode> = private { +@editor.completeFrom(NodeList) and nodeList<'tNode> = private { /** Returns the number of nodes in the collection. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/NodeList/length) @@ -2398,7 +2523,7 @@ Element is the most general base class from which all objects in a Document inhe [See Element on MDN](https://developer.mozilla.org/docs/Web/API/Element) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.Element) and element = { +@editor.completeFrom(Element) and element = { // Base properties from Node /** Returns the type of node. @@ -2770,7 +2895,7 @@ TODO: mark as private once mutating fields of private records is allowed [See ShadowRoot on MDN](https://developer.mozilla.org/docs/Web/API/ShadowRoot) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.ShadowRoot) and shadowRoot = { +@editor.completeFrom(ShadowRoot) and shadowRoot = { // Base properties from DocumentFragment // End base properties from DocumentFragment @@ -2910,7 +3035,7 @@ Similarly, when the focused element is in a different node tree than documentOrS A generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list. [See HTMLCollection on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCollection) */ -@editor.completeFrom(DOM.HTMLCollection) and htmlCollection<'t> = private { +@editor.completeFrom(HTMLCollection) and htmlCollection<'t> = private { /** Sets or retrieves the number of objects in a collection. [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCollection/length) @@ -2922,7 +3047,7 @@ A generic collection (array-like object similar to arguments) of elements (in do A collection of HTML form control elements. [See HTMLFormControlsCollection on MDN](https://developer.mozilla.org/docs/Web/API/HTMLFormControlsCollection) */ -@editor.completeFrom(DOM.DOM.HTMLFormControlsCollection) and htmlFormControlsCollection = private { +@editor.completeFrom(HTMLFormControlsCollection) and htmlFormControlsCollection = private { // Base properties from HTMLCollection /** Sets or retrieves the number of objects in a collection. @@ -2937,7 +3062,7 @@ Any HTML element. Some elements directly implement this interface, while others [See HTMLElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLElement) and htmlElement = { +@editor.completeFrom(HTMLElement) and htmlElement = { // Base properties from Element /** Returns the namespace. @@ -3232,7 +3357,7 @@ Contains the descriptive information, or metadata, for a document. This object i [See HTMLHeadElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLHeadElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLHeadElement) and htmlHeadElement = { +@editor.completeFrom(HTMLHeadElement) and htmlHeadElement = { // Base properties from HTMLElement /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title) @@ -3489,7 +3614,7 @@ A
element in the WebApiDOM; it allows access to and in some cases modific [See HTMLFormElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLFormElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLFormElement) and htmlFormElement = { +@editor.completeFrom(HTMLFormElement) and htmlFormElement = { // Base properties from HTMLElement /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title) @@ -3797,7 +3922,7 @@ Provides special properties and methods for manipulating elements. [See HTMLImageElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLImageElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLImageElement) and htmlImageElement = { +@editor.completeFrom(HTMLImageElement) and htmlImageElement = { // Base properties from HTMLElement /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title) @@ -4141,7 +4266,7 @@ Provides special properties (beyond the regular HTMLElement interface it also ha [See HTMLEmbedElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLEmbedElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLEmbedElement) and htmlEmbedElement = { +@editor.completeFrom(HTMLEmbedElement) and htmlEmbedElement = { // Base properties from HTMLElement /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title) @@ -4414,7 +4539,7 @@ Hyperlink elements and provides special properties and methods (beyond those of [See HTMLAnchorElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLAnchorElement) and htmlAnchorElement = { +@editor.completeFrom(HTMLAnchorElement) and htmlAnchorElement = { // Base properties from HTMLElement /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title) @@ -4788,7 +4913,7 @@ Provides special properties and methods (beyond those of the regular object HTML [See HTMLAreaElement on MDN](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement) TODO: mark as private once mutating fields of private records is allowed */ -@editor.completeFrom(DOM.HTMLAreaElement) and htmlAreaElement = { +@editor.completeFrom(HTMLAreaElement) and htmlAreaElement = { // Base properties from HTMLElement /** [Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title) @@ -5142,7 +5267,7 @@ HTML