diff --git a/src/Dom/Browser.Dom.fs b/src/Dom/Browser.Dom.fs index 67cd04d..96c1ea4 100644 --- a/src/Dom/Browser.Dom.fs +++ b/src/Dom/Browser.Dom.fs @@ -170,7 +170,7 @@ type [] Document = abstract onfocus: (FocusEvent -> unit) with get, set abstract onfullscreenchange: (Event -> unit) with get, set abstract onfullscreenerror: (Event -> unit) with get, set - abstract oninput: (Event -> unit) with get, set + abstract oninput: (InputEvent -> unit) with get, set /// Fires when the user presses a key. abstract onkeydown: (KeyboardEvent -> unit) with get, set /// Fires when the user presses an alphanumeric key. @@ -233,6 +233,7 @@ type [] Document = abstract onsuspend: (Event -> unit) with get, set /// Occurs to indicate the current playback position. abstract ontimeupdate: (Event -> unit) with get, set + abstract ontoggle: (ToggleEvent -> unit) with get, set abstract ontouchcancel: (TouchEvent -> unit) with get, set abstract ontouchend: (TouchEvent -> unit) with get, set abstract ontouchmove: (TouchEvent -> unit) with get, set @@ -997,7 +998,7 @@ type [] Window = abstract onselect: (UIEvent -> unit) with get, set abstract onstalled: (Event -> unit) with get, set abstract onstorage: (StorageEvent -> unit) with get, set - abstract onsubmit: (Event -> unit) with get, set + abstract onsubmit: (SubmitEvent -> unit) with get, set abstract onsuspend: (Event -> unit) with get, set abstract ontimeupdate: (Event -> unit) with get, set abstract ongamepadconnected: (GamepadEvent -> unit) with get, set @@ -2877,6 +2878,7 @@ type [] AnimationEvent = inherit Event abstract animationName: string with get, set abstract elapsedTime: float with get, set + abstract pseudoElement: string with get, set type [] MouseEvent = inherit UIEvent @@ -2937,6 +2939,7 @@ type [] DataTransfer = abstract clearData: ?format: string -> bool abstract getData: format: string -> string abstract setData: format: string * data: string -> bool + abstract setDragImage: image: Element * x: float * y: float -> unit type [] DataTransferItem = abstract kind: string @@ -2958,20 +2961,18 @@ type [] FocusEvent = type [] PointerEvent = inherit MouseEvent - abstract currentPoint: obj abstract height: float - abstract hwTimestamp: float - abstract intermediatePoints: obj abstract isPrimary: bool abstract pointerId: float - abstract pointerType: obj + abstract pointerType: string abstract pressure: float - abstract rotation: float + abstract tangentialPressure: float abstract tiltX: float abstract tiltY: float + abstract twist: float abstract width: float - abstract getCurrentPoint: element: Element -> unit - abstract getIntermediatePoints: element: Element -> unit + abstract getCoalescedEvents: unit -> PointerEvent[] + abstract getPredictedEvents: unit -> PointerEvent[] type [] PopStateEvent = inherit Event @@ -2980,22 +2981,18 @@ type [] PopStateEvent = type [] KeyboardEvent = inherit UIEvent abstract altKey: bool - abstract char: string + [] abstract charCode: float + abstract code: string abstract ctrlKey: bool abstract key: string - [] + [] abstract keyCode: float - abstract code: string - abstract locale: string abstract location: float abstract metaKey: bool abstract repeat: bool abstract shiftKey: bool - abstract which: float - abstract DOM_KEY_LOCATION_JOYSTICK: float abstract DOM_KEY_LOCATION_LEFT: float - abstract DOM_KEY_LOCATION_MOBILE: float abstract DOM_KEY_LOCATION_NUMPAD: float abstract DOM_KEY_LOCATION_RIGHT: float abstract DOM_KEY_LOCATION_STANDARD: float @@ -3005,6 +3002,7 @@ type [] ProgressEvent = inherit Event abstract lengthComputable: bool abstract loaded: float + abstract target: EventTarget abstract total: float type [] Touch = @@ -3069,6 +3067,7 @@ type [] TransitionEvent = inherit Event abstract elapsedTime: float with get, set abstract propertyName: string with get, set + abstract pseudoElement: string with get, set type [] PageTransitionEvent = inherit Event @@ -3092,10 +3091,30 @@ type [] WheelEvent = abstract DOM_DELTA_LINE: float abstract DOM_DELTA_PAGE: float abstract DOM_DELTA_PIXEL: float - abstract getCurrentPoint: element: Element -> unit -// type [] WheelEventType = -// abstract DOM_DELTA_LINE: float -// abstract DOM_DELTA_PAGE: float -// abstract DOM_DELTA_PIXEL: float -// [] abstract Create: typeArg: string * ?eventInitDict: WheelEventInit -> WheelEvent +type [] AbstractRange = + abstract collapsed: bool + abstract endContainer: Node + abstract endOffset: float + abstract startContainer: Node + abstract startOffset: float + +type StaticRange = + inherit AbstractRange + +type [] InputEvent = + inherit UIEvent + abstract data: string + abstract dataTransfer: DataTransfer + abstract inputType: string + abstract isComposing: bool + abstract getTargetRanges: unit -> StaticRange[] + +type [] ToggleEvent = + inherit Event + abstract newState: string + abstract oldState: string + +type [] SubmitEvent = + inherit Event + abstract submitter: HTMLElement \ No newline at end of file diff --git a/src/Dom/RELEASE_NOTES.md b/src/Dom/RELEASE_NOTES.md index 94fa85e..c6d0e23 100644 --- a/src/Dom/RELEASE_NOTES.md +++ b/src/Dom/RELEASE_NOTES.md @@ -1,3 +1,9 @@ +### 2.18.0 + +* Better type event by replacing `Event` with things like `InputEvent` (by @Lanayx) +* Add missing event properties (by @Lanayx) +* Remove incorrect APIs (by @Lanayx) + ### 2.17.0 * Fix #137: Remove `Worker` related types, use `Fable.Browser.Worker` if needed (by @MangelMaxime) diff --git a/src/Event/Browser.Event.fs b/src/Event/Browser.Event.fs index f1aee12..0c39e01 100644 --- a/src/Event/Browser.Event.fs +++ b/src/Event/Browser.Event.fs @@ -5,8 +5,8 @@ open Fable.Core type [] Event = abstract bubbles: bool with get, set - abstract cancelBubble: bool with get, set abstract cancelable: bool with get, set + abstract composed: bool with get, set abstract currentTarget: EventTarget with get, set abstract defaultPrevented: bool with get, set abstract eventPhase: float with get, set @@ -18,6 +18,8 @@ type [] Event = abstract AT_TARGET: float with get, set abstract BUBBLING_PHASE: float with get, set abstract CAPTURING_PHASE: float with get, set + abstract cancelBubble: unit -> unit + abstract composedPath: unit -> EventTarget[] abstract initEvent: eventTypeArg: string * canBubbleArg: bool * cancelableArg: bool -> unit abstract preventDefault: unit -> unit abstract stopImmediatePropagation: unit -> unit diff --git a/src/Event/RELEASE_NOTES.md b/src/Event/RELEASE_NOTES.md index 8c20edc..0917a66 100644 --- a/src/Event/RELEASE_NOTES.md +++ b/src/Event/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +### 1.7.0 + +* Add `Event.compose`, `Event.cancelBubble` and `Event.composedPath` (by @Lanayx) + ### 1.6.0 * Align Fable.Core version to 3.2.8 for all of fable-browser packages