You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/superpowers/plans/2026-06-02-dom-event-base-types.md
+19-12Lines changed: 19 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
**Goal:** Make `DOM.event` and `Event.t` same-type aliases over a shared hidden base owner, with `DOM.event` fully opaque and event fields exposed through `Event` getters.
6
6
7
-
**Architecture:** Internal `Base__*` modules own canonical shared event object/interface types and are never public. `DOM` and event leaf modules are sibling public surfaces over those shared internal owners; neither aliases through the other. `WebAPI.EventTypes` is the narrow shared feature for canonical event base owners, with `EventType` as its only public module. Some internal listener/init/abort helper records still live in`src/Event/EventTypes.res`; moving or splitting those helpers is a follow-up boundary cleanup.
7
+
**Architecture:** Internal `Base__*` modules own canonical shared event object/interface types and are never public. `DOM` and event leaf modules are sibling public surfaces over those shared internal owners; neither aliases through the other. `WebAPI.EventTypes` is the narrow shared feature for canonical event base owners, with `EventType` as its only public module. Internal listener/init/abort helper records now live under`src/EventTypes/EventTypes.res`, which remains non-public.
-[x] Removed low-risk `DomTypes` aliases for `DOMRectReadOnly`, `DOMRect`, `DOMRectList`, `FileList`, `TextTrackList`, and `CSSStyleValue`.
34
34
-[x] Added explicit feature dependencies exposed by those direct public owner references.
35
35
-[x] Audited stale `@editor.completeFrom` annotations that pointed through `DOM.*` or non-public base owner paths.
36
+
-[x] Moved shared internal event listener/init/abort helper shapes under the `WebAPI.EventTypes` source root.
37
+
-[x] Removed reverse `@editor.completeFrom` annotations from the internal `EventTypes` helper owner to public Event leaf modules.
36
38
37
39
Not completed in this slice:
38
40
39
41
-[ ] Minimize `DOM.res` to only the lightweight base type surface.
40
42
-[ ] Remove or split the remaining non-event `DomTypes.res` aliases.
41
43
-[ ] Remove all non-event `DOM.*` behavior/type declarations from `DOM.res`.
42
-
-[ ] Decide whether event listener/init/options records should remain in internal `EventTypes.res` or move to smaller hidden owner modules.
43
44
-[ ] Run a rescript-react compatibility check against the new base type surface.
44
45
45
46
## Current Feature Shape
@@ -74,7 +75,7 @@ Important interpretation:
74
75
-`WebAPI.IntersectionObserver` and `WebAPI.ResizeObserver` now explicitly depend on `WebAPI.DOM` and `WebAPI.Geometry`.
75
76
-`WebAPI.UIEvents` now explicitly depends on `WebAPI.DOM`, `WebAPI.Event`, and `WebAPI.FileList`.
76
77
-`src/DOM` does not reference public `Event.*` or `EventTarget.*` modules for the event aliases.
77
-
-`src/DOM/DomGlobal.res`still references internal listener/options helper shapes from `src/Event/EventTypes.res`. That file is not public, but its placement is a follow-up if the shared helper boundary needs to move fully under `src/EventTypes`.
78
+
-`src/DOM/DomGlobal.res` references internal listener/options helper shapes from `src/EventTypes/EventTypes.res`. That file is not public.
78
79
79
80
## Current Type Ownership
80
81
@@ -156,7 +157,7 @@ This preserves the public API direction for the DOM base surface. It is not the
156
157
157
158
## Current Internal Helpers
158
159
159
-
`src/Event/EventTypes.res` remains internal. It currently owns helper shapes that are shared by event modules and DOM globals:
160
+
`src/EventTypes/EventTypes.res` remains internal. It currently owns helper shapes that are shared by event modules and DOM globals:
160
161
161
162
-`abortController`
162
163
-`abortSignal`
@@ -166,7 +167,7 @@ This preserves the public API direction for the DOM base surface. It is not the
166
167
-`addEventListenerOptions`
167
168
-`extendableEvent`
168
169
169
-
This is intentional for the current slice. There is no public `EventTypes` module. The file currently lives in `src/Event`, not `src/EventTypes`, so it should be revisited if we want every shared helper used by `DOM` and `Event` to live under the `WebAPI.EventTypes` source root.
170
+
This is intentional for the current slice. There is no public `EventTypes` module.
170
171
171
172
`AbortSignal.t`, `AbortController.t`, and `ExtendableEvent.t` are public leaf aliases over these internal helper shapes:
172
173
@@ -185,13 +186,16 @@ Added compile-only tests:
185
186
-`tests/DOMAPI/Event__test.res`
186
187
-`tests/DOMAPI/EventTarget__test.res`
187
188
-`tests/DOMAPI/EventType__test.res`
189
+
-`tests/unmonorepo/feature-spec.test.mjs`
188
190
189
191
These verify:
190
192
191
193
-`DOM.event` can be passed where `Event.t` is expected.
192
194
-`Event.t` can be passed where `DOM.event` is expected.
193
195
-`DOM.eventTarget`, `Event.eventTarget`, and `EventTarget.t` are mutually assignable.
194
196
-`EventType.t` accepts the public variant constructors and custom event strings.
197
+
- The internal `EventTypes` helper module lives under `src/EventTypes`, not `src/Event`.
198
+
- The internal `EventTypes` helper module does not point editor completions back to `AbortController`, `AbortSignal`, or `ExtendableEvent`.
195
199
196
200
No event-specific unmonorepo assertions are currently retained in this plan or in `tests/unmonorepo/release-files.test.mjs`.
197
201
@@ -274,32 +278,33 @@ Expected: build passes.
274
278
275
279
## Follow-Up Task 2: Move Or Split Event Helper Shapes If Needed
276
280
277
-
**Goal:** Decide whether internal helper records in `src/Event/EventTypes.res`should stay there, move under `src/EventTypes`, or split into smaller hidden owners.
281
+
**Goal:** Decide whether internal helper records should stay in a shared internal `EventTypes` module or split into smaller hidden owners.
278
282
279
283
**Files:**
280
284
281
-
- Modify: `src/Event/EventTypes.res`
285
+
- Delete: `src/Event/EventTypes.res`
286
+
- Add: `src/EventTypes/EventTypes.res`
282
287
- Modify: `src/Event/AbortSignal.res`
283
288
- Modify: `src/Event/AbortController.res`
284
289
- Modify: `src/Event/ExtendableEvent.res`
285
290
- Modify: `src/Event/Event.res`
286
291
- Modify: `src/DOM/DomGlobal.res`
287
292
288
-
-[]**Step 1: Keep current shape unless it causes a concrete dependency problem**
293
+
-[x]**Step 1: Keep current shape unless it causes a concrete dependency problem**
289
294
290
-
Current internal helper ownership is acceptable for this branch because `EventTypes.res` is not public. If we need `DOM`to avoid any source-level reliance on the `src/Event` folder, move the shared listener/options/abort helper shapes under `src/EventTypes` or split them into hidden `Base__*` owners.
295
+
Result: `DOM`did have source-level reliance on a helper file physically located in `src/Event`, so the shared listener/options/abort helper shapes were moved under `src/EventTypes/EventTypes.res`. The module remains internal because `WebAPI.EventTypes` only exposes `EventType`.
291
296
292
-
-[]**Step 2: If splitting, use hidden same-type owners**
297
+
-[x]**Step 2: If splitting, use hidden same-type owners**
293
298
294
299
Use the same private-spread pattern:
295
300
296
301
```rescript
297
302
type t = Base__AbortSignal.t = private {...Base__AbortSignal.t}
298
303
```
299
304
300
-
Do not expose `Base__AbortSignal`, `Base__AbortController`, or any new `*Types`module publicly.
305
+
Result: no split was needed. `AbortSignal.t`, `AbortController.t`, and `ExtendableEvent.t` remain same-type aliases over internal `EventTypes.*` helper shapes, no new public module was exposed, and the internal helper owner does not point completions back to those public Event leaf modules.
301
306
302
-
-[]**Step 3: Rebuild**
307
+
-[x]**Step 3: Rebuild**
303
308
304
309
Run:
305
310
@@ -309,6 +314,8 @@ npm run build
309
314
310
315
Expected: build passes.
311
316
317
+
Result: build passes.
318
+
312
319
## Follow-Up Task 3: Audit `@editor.completeFrom`
313
320
314
321
**Goal:** Remove stale completion annotations that point through `DOM.*` or non-public modules.
An object of this type is returned by the files property of the HTML <input> element; this lets you access the list of files selected with the <input type="file"> element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage.
4367
4318
[See FileList on MDN](https://developer.mozilla.org/docs/Web/API/FileList)
0 commit comments