Skip to content

Commit

Permalink
Build: Bump Scala DOM Types and other versions
Browse files Browse the repository at this point in the history
  • Loading branch information
raquo committed May 9, 2024
1 parent 19c4b95 commit ed64906
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 8 deletions.
4 changes: 2 additions & 2 deletions project/Versions.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
object Versions {

val Scala_2_13 = "2.13.12"
val Scala_2_13 = "2.13.14"

val Scala_3 = "3.3.1"

// -- Dependencies --

val Airstream = "17.0.0-RC1"
val Airstream = "17.0.0"

val Ew = "0.2.0"

Expand Down
2 changes: 1 addition & 1 deletion project/lastScalaDomTypesVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.0
18.1.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")

addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1")

Expand Down
2 changes: 1 addition & 1 deletion project/project/ProjectVersions.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** Versions of compile-time dependencies */
object ProjectVersions {

val ScalaDomTypes = "18.0.0"
val ScalaDomTypes = "18.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,54 @@ trait GlobalEventProps {
lazy val lostPointerCapture: EventProp[dom.PointerEvent] = eventProp("lostpointercapture")


// -- Touch Events --


/**
* The touchstart event is fired when one or more touch points are
* placed on the touch surface.
*
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Element/touchstart_event touchstart_event @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent TouchEvent @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Touch_events#browser_compatibility Touch_events#browser_compatibility @ MDN]]
*/
lazy val onTouchStart: EventProp[dom.TouchEvent] = eventProp("touchstart")


/**
* The touchmove event is fired when one or more touch points are moved
* along the touch surface.
*
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Element/touchmove_event touchmove_event @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent TouchEvent @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Touch_events#browser_compatibility Touch_events#browser_compatibility @ MDN]]
*/
lazy val onTouchMove: EventProp[dom.TouchEvent] = eventProp("touchmove")


/**
* The touchcancel event is fired when one or more touch points have
* been disrupted in an implementation-specific manner.
*
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Element/touchcancel_event touchcancel_event @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent TouchEvent @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Touch_events#browser_compatibility Touch_events#browser_compatibility @ MDN]]
*/
lazy val onTouchCancel: EventProp[dom.TouchEvent] = eventProp("touchcancel")


/**
* The touchend event fires when one or more touch points are removed
* from the touch surface. Remember that it is possible to get a
* touchcancel event instead.
*
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Element/touchend_event touchend_event @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent TouchEvent @ MDN]]
* - [[https://developer.mozilla.org/en-US/docs/Web/API/Touch_events#browser_compatibility Touch_events#browser_compatibility @ MDN]]
*/
lazy val onTouchEnd: EventProp[dom.TouchEvent] = eventProp("touchend")


// -- Form Events --


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait Color { this: StyleProp[_] =>

lazy val cyan: StyleSetter = this := "cyan"

lazy val fuschia: StyleSetter = this := "fuschia"
lazy val fuchsia: StyleSetter = this := "fuchsia"

lazy val gray: StyleSetter = this := "gray"

Expand Down
4 changes: 2 additions & 2 deletions website/docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ If that is what you wanted, that's fine, Laminar will not break, it's just weird

### Missing Keys

Laminar gets the definition of HTML and SVG DOM tags, attributes, properties, events and CSS styles from [Scala DOM Types](https://github.com/raquo/scala-dom-types). These definitions provide hundreds of keys, but they are not exhaustive. For example, we don't have touch events like `touchmove` defined, so those are not available to be put on the left hand side of `:=` methods.
Laminar gets the definition of HTML and SVG DOM tags, attributes, properties, events and CSS styles from [Scala DOM Types](https://github.com/raquo/scala-dom-types). These definitions provide hundreds of keys, but they are not exhaustive. For example, we don't have CSS grid properties like `grid-area` defined, so those are not available to be put on the left hand side of `:=` methods.

To work around this, you can contribute definitions of missing attrs / props / etc. to Scala DOM Types. It's easy – you don't even need to code any logic, just need to specify the names and types of the things you want to add. For example, the `value` property is defined at the bottom of [PropDefs.scala](https://github.com/raquo/scala-dom-types/blob/master/shared/src/main/scala/com/raquo/domtypes/defs/props/PropDefs.scala). Read [this](https://github.com/raquo/scala-dom-types/#reflected-attributes) to understand the difference between props and attributes and reflected attributes.

Expand All @@ -504,7 +504,7 @@ div(

And similarly with `styleProp`, `htmlAttr`, `htmlTag`, `svgAttr`, `svgTag`.

To clarify, you don't have to do this for touch events specifically, because [@Busti](https://github.com/busti) already added the superior [pointer-events](https://github.com/raquo/scala-dom-types/pull/49) to address this particular shortcoming. Unless you want touch events regardless of that, in which case, you're welcome to it.
I mentioned `onTouchMove` as an example, but you don't have to do this for touch events specifically, because [@felher](https://github.com/felher) already [added](https://github.com/raquo/scala-dom-types/pull/102) them to address this particular shortcoming. Unless you want touch events regardless of that, in which case, you're welcome to it.


### Modifiers FAQ
Expand Down

0 comments on commit ed64906

Please sign in to comment.