Skip to content

Commit

Permalink
Fix ordering of Slinky SyntheticEvent type parameters (#597)
Browse files Browse the repository at this point in the history
* Add tests to reproduce bug (#596).

This reproduces the problem where Slinky SyntheticEvent type parameters
are not being set correctly.

* Fix ordering of Slinky SyntheticEvent type parameters (#596)

* Update japgolly tests (#596)
  • Loading branch information
steinybot authored Jan 28, 2024
1 parent 50c9d0c commit e304f16
Show file tree
Hide file tree
Showing 27 changed files with 368 additions and 325 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object SlinkyTypeConversions {
CastConversion(reactNames.DOMElement, names.ReactElement),
CastConversion(reactNames.ElementType, names.ReactElement),
CastConversion(reactNames.BaseSyntheticEvent, names.SyntheticEvent, _2, _1),
CastConversion(reactNames.SyntheticEvent, names.SyntheticEvent, _2, _1),
CastConversion(reactNames.SyntheticEvent, names.SyntheticEvent, _1, _2),
)

val components: IArray[CastConversion] =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
organization := "org.scalablytyped"
name := "componentstest"
version := "0.0-unknown-bac773"
version := "0.0-unknown-52406a"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package typingsJapgolly.componentstest

import japgolly.scalajs.react.Callback
import japgolly.scalajs.react.CallbackTo
import japgolly.scalajs.react.ReactEventFrom
import japgolly.scalajs.react.ReactMouseEventFrom
import org.scalajs.dom.Element
import org.scalajs.dom.HTMLDivElement
Expand Down Expand Up @@ -163,6 +164,24 @@ object mod {
}
}

trait Events extends StObject {

def onClick(event: ReactEventFrom[Any & Element]): Unit
}
object Events {

inline def apply(onClick: ReactEventFrom[Any & Element] => Callback): Events = {
val __obj = js.Dynamic.literal(onClick = js.Any.fromFunction1((t0: ReactEventFrom[Any & Element]) => onClick(t0).runNow()))
__obj.asInstanceOf[Events]
}

@scala.inline
implicit open class MutableBuilder[Self <: Events] (val x: Self) extends AnyVal {

inline def setOnClick(value: ReactEventFrom[Any & Element] => Callback): Self = StObject.set(x, "onClick", js.Any.fromFunction1((t0: ReactEventFrom[Any & Element]) => value(t0).runNow()))
}
}

/* Rewritten from type alias, can be one of:
- typingsJapgolly.componentstest.mod.A
- typingsJapgolly.componentstest.mod.B
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "componentstest"
version := "0.0-unknown-2f8b04"
version := "0.0-unknown-e027c7"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"me.shadaj" %%% "slinky-web" % "0.7.2",
"org.scalablytyped" %%% "react" % "16.9.2-d793cd",
"org.scalablytyped" %%% "react" % "16.9.2-25cfad",
"org.scalablytyped" %%% "std" % "0.0-unknown-7f073b")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package typingsSlinky.componentstest

import org.scalajs.dom.Event
import org.scalajs.dom.HTMLDivElement
import slinky.core.ReactComponentClass
import slinky.core.SyntheticEvent
import slinky.web.SyntheticMouseEvent
import typingsSlinky.componentstest.anon.Equals
import typingsSlinky.react.mod.CSSProperties
Expand Down Expand Up @@ -157,6 +159,24 @@ object mod {
}
}

trait Events extends StObject {

def onClick(event: SyntheticEvent[Any, Event]): Unit
}
object Events {

inline def apply(onClick: SyntheticEvent[Any, Event] => Unit): Events = {
val __obj = js.Dynamic.literal(onClick = js.Any.fromFunction1(onClick))
__obj.asInstanceOf[Events]
}

@scala.inline
implicit open class MutableBuilder[Self <: Events] (val x: Self) extends AnyVal {

inline def setOnClick(value: SyntheticEvent[Any, Event] => Unit): Self = StObject.set(x, "onClick", js.Any.fromFunction1(value))
}
}

/* Rewritten from type alias, can be one of:
- typingsSlinky.componentstest.mod.A
- typingsSlinky.componentstest.mod.B
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-bootstrap"
version := "0.32-19d27a"
version := "0.32-0b4f99"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"me.shadaj" %%% "slinky-web" % "0.7.2",
"org.scalablytyped" %%% "react" % "16.9.2-d793cd",
"org.scalablytyped" %%% "react" % "16.9.2-25cfad",
"org.scalablytyped" %%% "std" % "0.0-unknown-7f073b")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ object ButtonGroup {

inline def nonce(value: String): this.type = set("nonce", value.asInstanceOf[js.Any])

inline def onAbort(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onAbort", js.Any.fromFunction1(value))
inline def onAbort(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onAbort", js.Any.fromFunction1(value))

inline def onAnimationEnd(value: SyntheticAnimationEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onAnimationEnd", js.Any.fromFunction1(value))

Expand All @@ -383,9 +383,9 @@ object ButtonGroup {

inline def onBlur(value: SyntheticFocusEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onBlur", js.Any.fromFunction1(value))

inline def onCanPlay(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onCanPlay", js.Any.fromFunction1(value))
inline def onCanPlay(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onCanPlay", js.Any.fromFunction1(value))

inline def onCanPlayThrough(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onCanPlayThrough", js.Any.fromFunction1(value))
inline def onCanPlayThrough(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onCanPlayThrough", js.Any.fromFunction1(value))

inline def onChange(value: SyntheticEvent[EventTarget & ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onChange", js.Any.fromFunction1(value))

Expand Down Expand Up @@ -421,15 +421,15 @@ object ButtonGroup {

inline def onDrop(value: DragEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onDrop", js.Any.fromFunction1(value))

inline def onDurationChange(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onDurationChange", js.Any.fromFunction1(value))
inline def onDurationChange(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onDurationChange", js.Any.fromFunction1(value))

inline def onEmptied(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onEmptied", js.Any.fromFunction1(value))
inline def onEmptied(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onEmptied", js.Any.fromFunction1(value))

inline def onEncrypted(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onEncrypted", js.Any.fromFunction1(value))
inline def onEncrypted(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onEncrypted", js.Any.fromFunction1(value))

inline def onEnded(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onEnded", js.Any.fromFunction1(value))
inline def onEnded(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onEnded", js.Any.fromFunction1(value))

inline def onError(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onError", js.Any.fromFunction1(value))
inline def onError(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onError", js.Any.fromFunction1(value))

inline def onFocus(value: SyntheticFocusEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onFocus", js.Any.fromFunction1(value))

Expand All @@ -443,13 +443,13 @@ object ButtonGroup {

inline def onKeyUp(value: SyntheticKeyboardEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onKeyUp", js.Any.fromFunction1(value))

inline def onLoad(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onLoad", js.Any.fromFunction1(value))
inline def onLoad(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onLoad", js.Any.fromFunction1(value))

inline def onLoadStart(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onLoadStart", js.Any.fromFunction1(value))
inline def onLoadStart(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onLoadStart", js.Any.fromFunction1(value))

inline def onLoadedData(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onLoadedData", js.Any.fromFunction1(value))
inline def onLoadedData(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onLoadedData", js.Any.fromFunction1(value))

inline def onLoadedMetadata(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onLoadedMetadata", js.Any.fromFunction1(value))
inline def onLoadedMetadata(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onLoadedMetadata", js.Any.fromFunction1(value))

inline def onMouseDown(value: SyntheticMouseEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onMouseDown", js.Any.fromFunction1(value))

Expand All @@ -467,11 +467,11 @@ object ButtonGroup {

inline def onPaste(value: SyntheticClipboardEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onPaste", js.Any.fromFunction1(value))

inline def onPause(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onPause", js.Any.fromFunction1(value))
inline def onPause(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onPause", js.Any.fromFunction1(value))

inline def onPlay(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onPlay", js.Any.fromFunction1(value))
inline def onPlay(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onPlay", js.Any.fromFunction1(value))

inline def onPlaying(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onPlaying", js.Any.fromFunction1(value))
inline def onPlaying(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onPlaying", js.Any.fromFunction1(value))

inline def onPointerCancel(value: SyntheticPointerEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onPointerCancel", js.Any.fromFunction1(value))

Expand All @@ -489,27 +489,27 @@ object ButtonGroup {

inline def onPointerUp(value: SyntheticPointerEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onPointerUp", js.Any.fromFunction1(value))

inline def onProgress(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onProgress", js.Any.fromFunction1(value))
inline def onProgress(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onProgress", js.Any.fromFunction1(value))

inline def onRateChange(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onRateChange", js.Any.fromFunction1(value))
inline def onRateChange(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onRateChange", js.Any.fromFunction1(value))

inline def onReset(value: SyntheticEvent[EventTarget & ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onReset", js.Any.fromFunction1(value))

inline def onScroll(value: SyntheticUIEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onScroll", js.Any.fromFunction1(value))

inline def onSeeked(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onSeeked", js.Any.fromFunction1(value))
inline def onSeeked(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onSeeked", js.Any.fromFunction1(value))

inline def onSeeking(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onSeeking", js.Any.fromFunction1(value))
inline def onSeeking(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onSeeking", js.Any.fromFunction1(value))

inline def onSelect(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onSelect", js.Any.fromFunction1(value))
inline def onSelect(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onSelect", js.Any.fromFunction1(value))

inline def onStalled(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onStalled", js.Any.fromFunction1(value))
inline def onStalled(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onStalled", js.Any.fromFunction1(value))

inline def onSubmit(value: SyntheticEvent[EventTarget & ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onSubmit", js.Any.fromFunction1(value))

inline def onSuspend(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onSuspend", js.Any.fromFunction1(value))
inline def onSuspend(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onSuspend", js.Any.fromFunction1(value))

inline def onTimeUpdate(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onTimeUpdate", js.Any.fromFunction1(value))
inline def onTimeUpdate(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onTimeUpdate", js.Any.fromFunction1(value))

inline def onTouchCancel(value: SyntheticTouchEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onTouchCancel", js.Any.fromFunction1(value))

Expand All @@ -521,9 +521,9 @@ object ButtonGroup {

inline def onTransitionEnd(value: SyntheticTransitionEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onTransitionEnd", js.Any.fromFunction1(value))

inline def onVolumeChange(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onVolumeChange", js.Any.fromFunction1(value))
inline def onVolumeChange(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onVolumeChange", js.Any.fromFunction1(value))

inline def onWaiting(value: SyntheticEvent[Event, ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onWaiting", js.Any.fromFunction1(value))
inline def onWaiting(value: SyntheticEvent[ReactComponentClass[ButtonGroupProps], Event] => Unit): this.type = set("onWaiting", js.Any.fromFunction1(value))

inline def onWheel(value: SyntheticWheelEvent[ReactComponentClass[ButtonGroupProps]] => Unit): this.type = set("onWheel", js.Any.fromFunction1(value))

Expand Down
Loading

0 comments on commit e304f16

Please sign in to comment.