Skip to content

Commit dfff1c9

Browse files
committed
refactor: add shared event base types
1 parent 49e227d commit dfff1c9

55 files changed

Lines changed: 1354 additions & 318 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/superpowers/plans/2026-06-02-dom-event-base-types.md

Lines changed: 970 additions & 0 deletions
Large diffs are not rendered by default.

rescript.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "@rescript/webapi",
33
"namespace": "WebAPI",
44
"features": {
5-
"WebAPI.Base": ["WebAPI.Location"],
5+
"WebAPI.Base": ["WebAPI.EventTypes", "WebAPI.Location"],
66
"WebAPI.DOM": [
77
"WebAPI.Base",
88
"WebAPI.CSSFontLoading",
99
"WebAPI.ChannelMessaging",
1010
"WebAPI.CSSTypedOM",
1111
"WebAPI.DOMException",
1212
"WebAPI.DOMStringList",
13-
"WebAPI.Event",
13+
"WebAPI.EventTypes",
1414
"WebAPI.File",
1515
"WebAPI.FileAndDirectoryEntries",
1616
"WebAPI.FileList",
@@ -32,7 +32,9 @@
3232
],
3333
"WebAPI.CSSOM": ["WebAPI.DOM", "WebAPI.Event"],
3434
"WebAPI.CustomElements": ["WebAPI.DOM"],
35-
"WebAPI.Event": ["WebAPI.Base"],
35+
"WebAPI.CredentialManagement": ["WebAPI.Event"],
36+
"WebAPI.EventTypes": [],
37+
"WebAPI.Event": ["WebAPI.Base", "WebAPI.EventTypes"],
3638
"WebAPI.Fetch": ["WebAPI.Event", "WebAPI.File", "WebAPI.URL"],
3739
"WebAPI.File": ["WebAPI.Base", "WebAPI.Event"],
3840
"WebAPI.FileAndDirectoryEntries": ["WebAPI.Base", "WebAPI.DOMException"],
@@ -66,6 +68,8 @@
6668
],
6769
"WebAPI.Locks": ["WebAPI.Event"],
6870
"WebAPI.MIDI": ["WebAPI.Event"],
71+
"WebAPI.Notification": ["WebAPI.Event"],
72+
"WebAPI.Push": ["WebAPI.ChannelMessaging", "WebAPI.Event"],
6973
"WebAPI.Sockets": [
7074
"WebAPI.ChannelMessaging",
7175
"WebAPI.Event",
@@ -96,9 +100,6 @@
96100
"feature": "WebAPI.Base",
97101
"public": [
98102
"ArrayBufferTypedArrayOrDataView",
99-
"BaseCSSFontLoading",
100-
"BaseEncryptedMediaExtensions",
101-
"BaseEvent",
102103
"BaseFile",
103104
"BaseFileAndDirectoryEntries"
104105
]
@@ -179,6 +180,12 @@
179180
"feature": "WebAPI.DOMException",
180181
"public": ["DOMException"]
181182
},
183+
{
184+
"dir": "src/EventTypes",
185+
"subdirs": true,
186+
"feature": "WebAPI.EventTypes",
187+
"public": ["EventType"]
188+
},
182189
{
183190
"dir": "src/DOMStringList",
184191
"subdirs": true,

src/Base/BaseCSSFontLoading.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type fontFaceSetLoadStatus =
1313
*/
1414
@editor.completeFrom(BaseCSSFontLoading.FontFaceSet)
1515
type rec fontFaceSet = private {
16-
...BaseEvent.eventTarget,
16+
...Base__EventTarget.t,
1717
/**
1818
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready)
1919
*/

src/Base/BaseEncryptedMediaExtensions.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This WebApiEncryptedMediaExtensions API interface represents a context for mess
6161
*/
6262
@editor.completeFrom(BaseEncryptedMediaExtensions.MediaKeySession)
6363
type mediaKeySession = private {
64-
...BaseEvent.eventTarget,
64+
...Base__EventTarget.t,
6565
/**
6666
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaKeySession/sessionId)
6767
*/

src/Base/BaseEvent.res

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Canvas/CanvasTypes.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ TODO: mark as private once mutating fields of private records is allowed
122122
*/
123123
@editor.completeFrom(OffscreenCanvas)
124124
type offscreenCanvas = {
125-
...EventTypes.eventTarget,
125+
...Event.eventTarget,
126126
/**
127127
These attributes return the dimensions of the OffscreenCanvas object's bitmap.
128128

src/ChannelMessaging/ChannelMessagingTypes.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This Channel Messaging API interface represents one of the two ports of a Messag
66
*/
77
@editor.completeFrom(MessagePort)
88
type messagePort = private {
9-
...EventTypes.eventTarget,
9+
...Event.eventTarget,
1010
}
1111

1212
type structuredSerializeOptions = {mutable transfer?: array<Dict.t<string>>}

src/Clipboard/ClipboardTypes.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type clipboardItem = private {
2525
*/
2626
@editor.completeFrom(WebApiClipboard)
2727
type clipboard = private {
28-
...EventTypes.eventTarget,
28+
...Event.eventTarget,
2929
}
3030

3131
type clipboardItemOptions = {mutable presentationStyle?: presentationStyle}

src/CredentialManagement/CredentialManagementTypes.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type publicKeyCredentialRequestOptions = {
9191

9292
type credentialRequestOptions = {
9393
mutable mediation?: credentialMediationRequirement,
94-
mutable signal?: EventTypes.abortSignal,
94+
mutable signal?: AbortSignal.t,
9595
mutable publicKey?: publicKeyCredentialRequestOptions,
9696
}
9797

@@ -133,6 +133,6 @@ type publicKeyCredentialCreationOptions = {
133133
}
134134

135135
type credentialCreationOptions = {
136-
mutable signal?: EventTypes.abortSignal,
136+
mutable signal?: AbortSignal.t,
137137
mutable publicKey?: publicKeyCredentialCreationOptions,
138138
}

src/DOM/DOM.res

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ type domStringList = DOMStringList.t
1010

1111
type window
1212

13+
type event = Base__Event.t = private {...Base__Event.t}
14+
15+
type eventTarget = Base__EventTarget.t = private {...Base__EventTarget.t}
16+
1317
type shadowRootMode =
1418
| @as("closed") Closed
1519
| @as("open") Open
@@ -2181,7 +2185,7 @@ TODO: mark as private once mutating fields of private records is allowed
21812185
*/
21822186
@editor.completeFrom(DOM.Node)
21832187
type rec node = {
2184-
...BaseEvent.eventTarget,
2188+
...eventTarget,
21852189
/**
21862190
Returns the type of node.
21872191
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Node/nodeType)
@@ -6150,7 +6154,7 @@ Stores information on a media query applied to a document, and handles sending n
61506154
*/
61516155
@editor.completeFrom(DOM.MediaQueryList)
61526156
type mediaQueryList = private {
6153-
...BaseEvent.eventTarget,
6157+
...eventTarget,
61546158
/**
61556159
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaQueryList/media)
61566160
*/

0 commit comments

Comments
 (0)