Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions src/Base/DOM.res
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,6 @@ type canPlayTypeResult =
| @as("maybe") Maybe
| @as("probably") Probably

type animationPlayState =
| @as("finished") Finished
| @as("idle") Idle
| @as("paused") Paused
| @as("running") Running

type animationReplaceState =
| @as("active") Active
| @as("persisted") Persisted
| @as("removed") Removed

type fillMode =
| @as("auto") Auto
| @as("backwards") Backwards
Expand Down Expand Up @@ -457,27 +446,14 @@ type renderingContext = unknown

type offscreenRenderingContext = unknown

/**
[See AnimationTimeline on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline)
*/
@editor.completeFrom(Animation)
type rec animationTimeline = private {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime)
*/
currentTime: Null.t<float>,
}

/**
[See DocumentTimeline on MDN](https://developer.mozilla.org/docs/Web/API/DocumentTimeline)
*/
@editor.completeFrom(DocumentTimeline) and documentTimeline = private {
// Base properties from AnimationTimeline
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime)
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DocumentTimeline/currentTime)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this URL does not exist?

*/
currentTime: Null.t<float>,
// End base properties from AnimationTimeline
}

/**
Expand Down
96 changes: 83 additions & 13 deletions src/DOM/Animation.res
Original file line number Diff line number Diff line change
@@ -1,58 +1,128 @@
type animationPlayState =
| @as("finished") Finished
| @as("idle") Idle
| @as("paused") Paused
| @as("running") Running

type animationReplaceState =
| @as("active") Active
| @as("persisted") Persisted
| @as("removed") Removed

/**
[See AnimationTimeline on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline)
*/
type animationTimeline = private {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime)
*/
currentTime: Null.t<float>,
}

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation)
*/
type rec t = {
...DOM.eventTarget,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/id)
*/
mutable id: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/effect)
*/
mutable effect: Null.t<AnimationEffect.t>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/timeline)
*/
mutable timeline: Null.t<animationTimeline>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/playbackRate)
*/
mutable playbackRate: float,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/playState)
*/
playState: animationPlayState,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/replaceState)
*/
replaceState: animationReplaceState,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/pending)
*/
pending: bool,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/ready)
*/
ready: promise<t>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/finished)
*/
finished: promise<t>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/startTime)
*/
mutable startTime: Null.t<float>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/currentTime)
*/
mutable currentTime: Null.t<float>,
}

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation)
*/
@new
external make: (
~effect: DomTypes.animationEffect=?,
~timeline: DomTypes.animationTimeline=?,
) => DomTypes.animation = "Animation"
external make: (~effect: AnimationEffect.t=?, ~timeline: DomTypes.animationTimeline=?) => t =
"Animation"

include EventTarget.Impl({type t = DomTypes.animation})
include EventTarget.Impl({type t = t})

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/cancel)
*/
@send
external cancel: DomTypes.animation => unit = "cancel"
external cancel: t => unit = "cancel"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/finish)
*/
@send
external finish: DomTypes.animation => unit = "finish"
external finish: t => unit = "finish"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/play)
*/
@send
external play: DomTypes.animation => unit = "play"
external play: t => unit = "play"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/pause)
*/
@send
external pause: DomTypes.animation => unit = "pause"
external pause: t => unit = "pause"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/updatePlaybackRate)
*/
@send
external updatePlaybackRate: (DomTypes.animation, float) => unit = "updatePlaybackRate"
external updatePlaybackRate: (t, float) => unit = "updatePlaybackRate"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/reverse)
*/
@send
external reverse: DomTypes.animation => unit = "reverse"
external reverse: t => unit = "reverse"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/persist)
*/
@send
external persist: DomTypes.animation => unit = "persist"
external persist: t => unit = "persist"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/commitStyles)
*/
@send
external commitStyles: DomTypes.animation => unit = "commitStyles"
external commitStyles: t => unit = "commitStyles"
15 changes: 8 additions & 7 deletions src/DOM/AnimationEffect.res
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
/**
[See AnimationEffect on MDN](https://developer.mozilla.org/docs/Web/API/AnimationEffect)
*/
type t = private {}

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationEffect/getTiming)
*/
@send
external getTiming: DomTypes.animationEffect => DomTypes.effectTiming = "getTiming"
external getTiming: t => DomTypes.effectTiming = "getTiming"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationEffect/getComputedTiming)
*/
@send
external getComputedTiming: DomTypes.animationEffect => DomTypes.computedEffectTiming =
"getComputedTiming"
external getComputedTiming: t => DomTypes.computedEffectTiming = "getComputedTiming"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/AnimationEffect/updateTiming)
*/
@send
external updateTiming: (
DomTypes.animationEffect,
~timing: DomTypes.optionalEffectTiming=?,
) => unit = "updateTiming"
external updateTiming: (t, ~timing: DomTypes.optionalEffectTiming=?) => unit = "updateTiming"
2 changes: 1 addition & 1 deletion src/DOM/DOMImplementation.res
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ external createDocument: (
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createHTMLDocument)
*/
@send
external createHTMLDocument: (DomTypes.domImplementation, ~title: string=?) => DomTypes.document =
external createHTMLDocument: (DomTypes.domImplementation, ~title: string=?) => DOM.document =
"createHTMLDocument"
Loading