From 138a7f0a8ae4f7eebd1369976f667afa8015a225 Mon Sep 17 00:00:00 2001
From: starzu
Date: Thu, 28 Jan 2016 08:58:43 +0100
Subject: [PATCH 01/80] Deployment configuration
---
build.sbt | 35 +++++++++++++++++++++++++++++++++++
project/plugins.sbt | 4 ++++
2 files changed, 39 insertions(+)
diff --git a/build.sbt b/build.sbt
index 36e1b7f..cae2d61 100644
--- a/build.sbt
+++ b/build.sbt
@@ -30,3 +30,38 @@ scalaJSUseRhino in Test := false
lazy val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
+
+// Deployment configuration
+publishMavenStyle := true
+publishArtifact in Test := false
+pomIncludeRepository := { _ => false }
+
+publishTo := {
+ val nexus = "https://oss.sonatype.org/"
+ if (isSnapshot.value)
+ Some("snapshots" at nexus + "content/repositories/snapshots")
+ else
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
+}
+
+pomExtra := {
+ https://github.com/UdashFramework/scala-js-jquery
+
+
+ Apache v.2 License
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+ git@github.com:UdashFramework/scala-js-jquery.git
+ scm:git@github.com:UdashFramework/scala-js-jquery.git
+
+
+
+ avsystem
+ AVSystem
+ http://www.avsystem.com/
+
+
+}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index e513ea5..afe60eb 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,3 +1,7 @@
logLevel := Level.Warn
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.9")
+
+// Deployment configuration
+addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
\ No newline at end of file
From 7c68f0954ac2615d287cba224d2e9632ef2b97d5 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Fri, 30 Jun 2017 13:56:01 +0200
Subject: [PATCH 02/80] Upgrade to jQuery 3.2.1
---
build.sbt | 23 +-
project/build.properties | 2 +-
project/plugins.sbt | 2 +-
.../io/udash/wrappers/jquery/JQuery.scala | 546 +++++-------------
.../wrappers/jquery/JQueryDeferred.scala | 8 +-
.../udash/wrappers/jquery/JQueryStatic.scala | 75 +--
6 files changed, 197 insertions(+), 459 deletions(-)
diff --git a/build.sbt b/build.sbt
index 2d41939..17f5081 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,10 +1,10 @@
name := "udash-jquery"
-version := "1.0.1"
+version := "1.1.0"
organization := "io.udash"
-scalaVersion := "2.12.1"
-crossScalaVersions := Seq("2.11.8", "2.12.1")
+scalaVersion := "2.12.2"
+crossScalaVersions := Seq("2.11.11", "2.12.2")
scalacOptions in ThisBuild ++= Seq(
"-feature",
"-deprecation",
@@ -14,23 +14,24 @@ scalacOptions in ThisBuild ++= Seq(
"-language:dynamics",
"-Xfuture",
"-Xfatal-warnings",
- "-Xlint:_,-missing-interpolator,-adapted-args"
+ CrossVersion.partialVersion(scalaVersion.value).collect {
+ // WORKAROUND https://github.com/scala/scala/pull/5402
+ case (2, 12) => "-Xlint:-unused,_"
+ }.getOrElse("-Xlint:_")
)
-jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox)
+jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox())
libraryDependencies ++= Seq(
- "org.scala-js" %%% "scalajs-dom" % "0.9.1",
- "org.scalatest" %%% "scalatest" % "3.0.1" % Test,
- "com.lihaoyi" %%% "scalatags" % "0.6.2" % Test
+ "org.scala-js" %%% "scalajs-dom" % "0.9.2",
+ "org.scalatest" %%% "scalatest" % "3.0.3" % Test,
+ "com.lihaoyi" %%% "scalatags" % "0.6.5" % Test
)
jsDependencies +=
- "org.webjars" % "jquery" % "2.2.4" / "2.2.4/jquery.js" minified "2.2.4/jquery.min.js"
+ "org.webjars" % "jquery" % "3.2.1" / "3.2.1/jquery.js" minified "3.2.1/jquery.min.js"
requiresDOM in Test := true
-persistLauncher in Test := false
-scalaJSUseRhino in Test := false
lazy val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
diff --git a/project/build.properties b/project/build.properties
index e0cbc71..6be4958 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version = 0.13.13
\ No newline at end of file
+sbt.version = 0.13.15
\ No newline at end of file
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 5aec49e..3a623d2 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,5 +1,5 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.1.3"
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index 6e4b757..7c7bdd8 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -6,7 +6,7 @@ import scala.collection.mutable
import scala.concurrent.duration.Duration
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
-import scala.scalajs.js.{Dictionary, ThisFunction1, UndefOr}
+import scala.scalajs.js.{Dictionary, ThisFunction1, UndefOr, |}
@js.native
trait JQuery extends js.Object {
@@ -36,14 +36,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def addClass(className: String): JQuery = js.native
- /** Adds the specified class(es) to each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def addClass(function: js.Function1[Int, String]): JQuery = js.native
-
- /** Adds the specified class(es) to each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def addClass(function: js.Function2[Int, String, String]): JQuery = js.native
-
/** Insert content, specified by the parameter, after each element in the set of matched elements.
* See: jQuery Docs */
def after(content: (Selector | Element | JQuery)*): JQuery = js.native
@@ -52,22 +44,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def after(function: js.Function2[Int, String, String | Element | JQuery]): JQuery = js.native
- /** Perform a custom animation of a set of CSS properties.
- * See: jQuery Docs */
- private[jquery] def animate(properties: js.Dictionary[Any], duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Perform a custom animation of a set of CSS properties.
- * See: jQuery Docs */
- private[jquery] def animate(properties: js.Dictionary[Any], options: js.Dictionary[Any]): JQuery = js.native
-
/** Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* See: jQuery Docs */
def append(content: (String | Element | JQuery)*): JQuery = js.native
- /** Insert content, specified by the parameter, to the end of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def append(function: js.ThisFunction2[Element, Int, String, Any]): JQuery = js.native
-
/** Insert every element in the set of matched elements to the end of the target.
* See: jQuery Docs */
def appendTo(target: (Selector | Element | JQuery)*): JQuery = js.native
@@ -76,26 +56,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def attr(attributeName: String, attributeValue: String | Int | Double | Boolean): JQuery = js.native
- /** Get the value of an attribute for the first element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def attr(attributeName: String): UndefOr[String] = js.native
-
- /** Set one or more attributes for the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def attr(attributes: js.Dictionary[String | Int | Double | Boolean]): JQuery = js.native
-
- /** Set one or more attributes for the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def attr(attributeName: String, function: js.Function2[Int, String, String | Int | Double | Boolean]): JQuery = js.native
-
/** Insert content, specified by the parameter, before each element in the set of matched elements.
* See: jQuery Docs */
def before(content: (String | Element | JQuery)*): JQuery = js.native
- /** Insert content, specified by the parameter, before each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def before(content: js.Function2[Int, String, String | Element | JQuery]): JQuery = js.native
-
/** Trigger blur event on an element.
* See: jQuery Docs */
def blur(): JQuery = js.native
@@ -153,30 +117,14 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def css(attributeName: String, attributeValue: String | Int | Double | Boolean): JQuery = js.native
- /** Set one or more CSS properties for the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def css(attributeName: String, attributeFun: js.Function2[Int, String, String | Int | Double | Boolean]): JQuery = js.native
-
- /** Set one or more CSS properties for the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def css(properties: js.Dictionary[String | Int | Double | Boolean]): JQuery = js.native
-
/** Store arbitrary data associated with the matched elements.
* See: jQuery Docs */
def data(key: String, value: Any): JQuery = js.native
- /** Store arbitrary data associated with the matched elements.
- * See: jQuery Docs */
- private[jquery] def data(obj: js.Dictionary[Any]): JQuery = js.native
-
/** Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
* See: jQuery Docs */
def data(): js.Dynamic = js.native
- /** Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
- * See: jQuery Docs */
- private[jquery] def data(key: String): UndefOr[Any] = js.native
-
/** Trigger dblclick event on an element.
* See: jQuery Docs */
@JSName("dblclick")
@@ -194,10 +142,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def detach(selector: Selector): JQuery = js.native
- /** Iterate over a jQuery object, executing a function for each matched element.
- * See: jQuery Docs */
- private[jquery] def each(function: js.ThisFunction1[Element, Int, Any]): JQuery = js.native
-
/** Remove all child nodes of the set of matched elements from the DOM.
* See: jQuery Docs */
def empty(): JQuery = js.native
@@ -220,54 +164,22 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def fadeIn(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Display the matched elements by fading them to opaque.
- * See: jQuery Docs */
- private[jquery] def fadeIn(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Display the matched elements by fading them to opaque.
- * See: jQuery Docs */
- private[jquery] def fadeIn(options: js.Dictionary[Any]): JQuery = js.native
-
/** Hide the matched elements by fading them to transparent.
* See: jQuery Docs */
def fadeOut(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Hide the matched elements by fading them to transparent.
- * See: jQuery Docs */
- private[jquery] def fadeOut(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Hide the matched elements by fading them to transparent.
- * See: jQuery Docs */
- private[jquery] def fadeOut(options: js.Dictionary[Any]): JQuery = js.native
-
/** Adjust the opacity of the matched elements.
* See: jQuery Docs */
def fadeTo(duration: Int, opacity: Double): JQuery = js.native
- /** Adjust the opacity of the matched elements.
- * See: jQuery Docs */
- private[jquery] def fadeTo(duration: Int, opacity: Double, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
/** Adjust the opacity of the matched elements.
* See: jQuery Docs */
def fadeTo(duration: Int, opacity: Double, easing: EasingFunction): JQuery = js.native
- /** Adjust the opacity of the matched elements.
- * See: jQuery Docs */
- private[jquery] def fadeTo(duration: Int, opacity: Double, easing:String, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
/** Display or hide the matched elements by animating their opacity.
* See: jQuery Docs */
def fadeToggle(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Display or hide the matched elements by animating their opacity.
- * See: jQuery Docs */
- private[jquery] def fadeToggle(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Display or hide the matched elements by animating their opacity.
- * See: jQuery Docs */
- private[jquery] def fadeToggle(options: js.Dictionary[Any]): JQuery = js.native
-
/** Reduce the set of matched elements to those that match the selector or pass the function's test.
* See: jQuery Docs */
def filter(selector: Selector | JQuery): JQuery = js.native
@@ -276,10 +188,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def filter(elements: Element*): JQuery = js.native
- /** Reduce the set of matched elements to those that match the selector or pass the function's test.
- * See: jQuery Docs */
- private[jquery] def filter(function: js.ThisFunction2[Element, Int, Element, Boolean]): JQuery = js.native
-
/** Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
* See: jQuery Docs */
def find(selector: String | Element | JQuery): JQuery = js.native
@@ -306,14 +214,6 @@ trait JQuery extends js.Object {
@JSName("focusout")
def focusOut(): JQuery = js.native
- /** Retrieve one of the elements matched by the jQuery object.
- * See: jQuery Docs */
- private[jquery] def get(index: Int): UndefOr[Element] = js.native
-
- /** Retrieve the elements matched by the jQuery object.
- * See: jQuery Docs */
- private[jquery] def get(): js.Array[Element] = js.native
-
/** Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
* See: jQuery Docs */
def has(selector: String | Element): JQuery = js.native
@@ -330,22 +230,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def height(value: String | Int | Double): JQuery = js.native
- /** Set the CSS height of every matched element.
- * See: jQuery Docs */
- private[jquery] def height(function: js.ThisFunction2[Element, Int, Int, String | Int | Double]): JQuery = js.native
-
/** Hide the matched elements.
* See: jQuery Docs */
def hide(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Hide the matched elements.
- * See: jQuery Docs */
- private[jquery] def hide(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Hide the matched elements.
- * See: jQuery Docs */
- private[jquery] def hide(options: js.Dictionary[Any]): JQuery = js.native
-
/** Get the HTML contents of the first element in the set of matched elements.
* See: jQuery Docs */
def html(): String = js.native
@@ -370,10 +258,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def innerHeight(value: Double | String): JQuery = js.native
- /** Set the CSS inner height of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def innerHeight(function: js.ThisFunction2[Element, Int, Double, Int | Double | String]): JQuery = js.native
-
/** Get the current computed inner width for the first element in the set of matched elements, including padding but not border.
* See: jQuery Docs */
def innerWidth(): Double = js.native
@@ -382,10 +266,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def innerWidth(value: Int | Double | String): JQuery = js.native
- /** Set the CSS inner width of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def innerWidth(function: js.ThisFunction2[Element, Int, Double, Int | Double | String]): JQuery = js.native
-
/** Insert every element in the set of matched elements after the target.
* See: jQuery Docs */
def insertAfter(selector: String | Element | JQuery): JQuery = js.native
@@ -398,10 +278,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def is(selector: String | Element | JQuery): Boolean = js.native
- /** Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
- * See: jQuery Docs */
- private[jquery] def is(function: js.ThisFunction2[Element, Int, Element, Boolean]): Boolean = js.native
-
/** A string containing the jQuery version number.
* See: jQuery Docs */
def jquery: String = js.native
@@ -433,14 +309,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def load(url: String, data: js.Any = js.native): JQuery = js.native
- /** Load data from the server and place the returned HTML into the matched element.
- * See: jQuery Docs */
- private[jquery] def load(url: String, data: js.Any, callback: js.ThisFunction3[Element, String, String, JQueryXHR, Any]): JQuery = js.native
-
- /** Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
- * See: jQuery Docs */
- private[jquery] def map(callback: js.Function2[Int, Element, Any]): JQuery = js.native
-
/** Trigger mousedown event on an element.
* See: jQuery Docs */
@JSName("mousedown")
@@ -496,10 +364,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def not(el: Element*): JQuery = js.native
- /** Remove elements from the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def not(function: js.ThisFunction2[Element, Int, Element, Boolean]): JQuery = js.native
-
/** Remove an event handler.
* See: jQuery Docs */
def off(): JQuery = js.native
@@ -512,53 +376,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def off(jEvent: JQueryEvent, selector: String = js.native): JQuery = js.native
- // Don't use this method directly. Use CallbackRegistration::unregister() returned from on() instead
- private[jquery] def off(events: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Get the current coordinates of the first element in the set of matched elements, relative to the document.
- * See: jQuery Docs */
- private[jquery] def offset(): js.Dictionary[Double] = js.native
-
- /** Get the current coordinates of the first element in the set of matched elements, relative to the document.
- * See: jQuery Docs */
- private[jquery] def offset(coordinates: js.Dictionary[Int | Double]): JQuery = js.native
-
/** Get the closest ancestor element that is positioned.
* See: jQuery Docs */
def offsetParent(): JQuery = js.native
- /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */
- private[jquery] def on(events: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */
- private[jquery] def on(events: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */
- private[jquery] def on(events: String, selector: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach an event handler function for one or more events to the selected elements.
- * See: jQuery Docs */
- private[jquery] def on(events: String, selector: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */
- private[jquery] def one(events: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */
- private[jquery] def one(events: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */
- private[jquery] def one(events: String, selector: String, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
- /** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
- * See: jQuery Docs */
- private[jquery] def one(events: String, selector: String, data: js.Any, callback: js.ThisFunction1[Element, JQueryEvent, Any]): JQuery = js.native
-
/** Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without "px") representation of the value or null if called on an empty set of elements.
* See: jQuery Docs */
def outerHeight(includeMargin: Boolean = js.native): Double = js.native
@@ -567,10 +388,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def outerHeight(value: Int | Double | String): JQuery = js.native
- /** Set the CSS outer Height of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def outerHeight(function: js.ThisFunction2[Element, Int, Double, Double]): JQuery = js.native
-
/** Get the current computed width for the first element in the set of matched elements, including padding and border.
* See: jQuery Docs */
def outerWidth(includeMargin: Boolean = js.native): Double = js.native
@@ -579,10 +396,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def outerWidth(value: Int | Double | String): JQuery = js.native
- /** Set the CSS outer width of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def outerWidth(function: js.ThisFunction2[Element, Int, Double, Double]): JQuery = js.native
-
/** Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
* See: jQuery Docs */
def parent(selector: Selector = js.native): JQuery = js.native
@@ -595,18 +408,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def parentsUntil(selector: Selector | Element | JQuery = js.native, filter: Selector = js.native): JQuery = js.native
- /** Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
- * See: jQuery Docs */
- private[jquery] def position(): js.Dictionary[Double] = js.native
-
/** Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
* See: jQuery Docs */
def prepend(content: (String | Element | JQuery)*): JQuery = js.native
- /** Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def prepend(function: js.ThisFunction2[Element, Int, String, Any]): JQuery = js.native
-
/** Insert every element in the set of matched elements to the beginning of the target.
* See: jQuery Docs */
def prependTo(target: (Selector | Element | JQuery)*): JQuery = js.native
@@ -635,26 +440,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def prop(propertyName: String, value: js.Any): JQuery = js.native
- /** Set one or more properties for the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def prop(propertyName: String, function: js.ThisFunction2[Element, Int, js.Any, Any]): JQuery = js.native
-
- /** Set one or more properties for the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def prop(properties: js.Dictionary[Any]): JQuery = js.native
-
- /** Add a collection of DOM elements onto the jQuery stack.
- * See: jQuery Docs */
- private[jquery] def pushStack(elements: js.Array[Any]): JQuery = js.native
-
- /** Add a collection of DOM elements onto the jQuery stack.
- * See: jQuery Docs */
- private[jquery] def pushStack(elements: js.Array[Any], name: String, arguments: js.Array[Any]): JQuery = js.native
-
- /** Specify a function to execute when the DOM is fully loaded.
- * See: jQuery Docs */
- private[jquery] def ready(callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
/** Remove the set of matched elements from the DOM.
* See: jQuery Docs */
def remove(selector: String = js.native): JQuery = js.native
@@ -667,18 +452,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def removeClass(className: String*): JQuery = js.native
- /** Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def removeClass(function: js.Function2[Int, String, String]): JQuery = js.native
-
/** Remove a previously-stored piece of data.
* See: jQuery Docs */
def removeData(name: String = js.native): JQuery = js.native
- /** Remove a previously-stored piece of data.
- * See: jQuery Docs */
- private[jquery] def removeData(list: js.Array[String]): JQuery = js.native
-
/** Remove a property for the set of matched elements.
* See: jQuery Docs */
def removeProp(propertyName: String): JQuery = js.native
@@ -731,14 +508,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def show(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Display the matched elements.
- * See: jQuery Docs */
- private[jquery] def show(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Display the matched elements.
- * See: jQuery Docs */
- private[jquery] def show(options: js.Dictionary[Any]): JQuery = js.native
-
/** Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
* See: jQuery Docs */
def siblings(selector: String = js.native): JQuery = js.native
@@ -751,38 +520,14 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def slideDown(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Display the matched elements with a sliding motion.
- * See: jQuery Docs */
- private[jquery] def slideDown(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Display the matched elements with a sliding motion.
- * See: jQuery Docs */
- private[jquery] def slideDown(options: js.Dictionary[Any]): JQuery = js.native
-
/** Display or hide the matched elements with a sliding motion.
* See: jQuery Docs */
def slideToggle(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Display or hide the matched elements with a sliding motion.
- * See: jQuery Docs */
- private[jquery] def slideToggle(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Display or hide the matched elements with a sliding motion.
- * See: jQuery Docs */
- private[jquery] def slideToggle(options: js.Dictionary[Any]): JQuery = js.native
-
/** Hide the matched elements with a sliding motion.
* See: jQuery Docs */
def slideUp(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Hide the matched elements with a sliding motion.
- * See: jQuery Docs */
- private[jquery] def slideUp(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Hide the matched elements with a sliding motion.
- * See: jQuery Docs */
- private[jquery] def slideUp(options: js.Dictionary[Any]): JQuery = js.native
-
/** Stop the currently-running animation on the matched elements.
* See: jQuery Docs */
def stop(queue: String = js.native, clearQueue: Boolean = js.native, jumpToEnd: Boolean = js.native): JQuery = js.native
@@ -799,14 +544,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def text(text: String | Double | Int | Boolean): JQuery = js.native
- /** Set the content of each element in the set of matched elements to the specified text.
- * See: jQuery Docs */
- private[jquery] def text(function: js.ThisFunction2[Element, Int, String, String]): JQuery = js.native
-
- /** Retrieve all the elements contained in the jQuery set, as an array.
- * See: jQuery Docs */
- private[jquery] def toArray(): js.Array[Element] = js.native
-
/** Display or hide the matched elements.
* See: jQuery Docs */
def toggle(display: Boolean): JQuery = js.native
@@ -815,14 +552,6 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def toggle(duration: Int = js.native, easing: EasingFunction = js.native): JQuery = js.native
- /** Display or hide the matched elements.
- * See: jQuery Docs */
- private[jquery] def toggle(duration: Int, easing: EasingFunction, callback: js.ThisFunction0[Element, Any]): JQuery = js.native
-
- /** Display or hide the matched elements.
- * See: jQuery Docs */
- private[jquery] def toggle(options: js.Dictionary[Any]): JQuery = js.native
-
/** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */
def toggleClass(className: String): JQuery = js.native
@@ -831,26 +560,14 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def toggleClass(className: String, state: Boolean): JQuery = js.native
- /** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
- * See: jQuery Docs */
- private[jquery] def toggleClass(function: js.Function3[Int, String, Boolean, String], state: Boolean = js.native): JQuery = js.native
-
/** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */
def trigger(event: String | JQueryEvent): JQuery = js.native
- /** Execute all handlers and behaviors attached to the matched elements for the given event type.
- * See: jQuery Docs */
- private[jquery] def trigger(event: String | JQueryEvent, extraParams: js.Dictionary[Any] | js.Array[Any]): JQuery = js.native
-
/** Execute all handlers attached to an element for an event.
* See: jQuery Docs */
def triggerHandler(event: String | JQueryEvent): JQuery = js.native
- /** Execute all handlers attached to an element for an event.
- * See: jQuery Docs */
- private[jquery] def triggerHandler(event: String | JQueryEvent, extraParams: js.Dictionary[Any] | js.Array[Any]): JQuery = js.native
-
/** Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
* See: jQuery Docs */
def unwrap(): JQuery = js.native
@@ -865,11 +582,6 @@ trait JQuery extends js.Object {
@JSName("val")
def value(value: String | Int | Double | js.Array[Any]): JQuery = js.native
- /** Set the value of each element in the set of matched elements.
- * See: jQuery Docs */
- @JSName("val")
- private[jquery] def value(function: js.ThisFunction2[Element, Int, String, String]): JQuery = js.native
-
/** Get the current computed width for the first element in the set of matched elements.
* See: jQuery Docs */
def width(): Double = js.native
@@ -878,38 +590,20 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def width(value: String | Int | Double): JQuery = js.native
- /** Set the CSS width of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def width(function: js.ThisFunction2[Element, Int, Int, String | Int | Double]): JQuery = js.native
-
/** Wrap an HTML structure around each element in the set of matched elements.
* See: jQuery Docs */
def wrap(wrappingElement: Selector | Element | JQuery): JQuery = js.native
- /** Wrap an HTML structure around each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def wrap(function: js.ThisFunction1[Element, Int, String | JQuery]): JQuery = js.native
-
/** Wrap an HTML structure around all elements in the set of matched elements.
* See: jQuery Docs */
def wrapAll(wrappingElement: Selector | Element | JQuery): JQuery = js.native
- /** Wrap an HTML structure around all elements in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def wrapAll(function: js.ThisFunction1[Element, Int, String | JQuery]): JQuery = js.native
-
/** Wrap an HTML structure around the content of each element in the set of matched elements.
* See: jQuery Docs */
def wrapInner(wrappingElement: Selector | Element | JQuery): JQuery = js.native
-
- /** Wrap an HTML structure around the content of each element in the set of matched elements.
- * See: jQuery Docs */
- private[jquery] def wrapInner(function: js.ThisFunction1[Element, Int, String | JQuery]): JQuery = js.native
}
object JQuery {
- import scala.scalajs.js.`|`
-
trait CallbackRegistration {
def unregister(): Unit
}
@@ -924,7 +618,7 @@ object JQuery {
class OnCallbackRegistration(event: String, callback: JQueryCallback,
reg: (ThisFunction1[Element, JQueryEvent, Any]) => Any,
- unreg: (String, ThisFunction1[Element, JQueryEvent, Any]) => js.Any = (event, c) => jquery.off(event, c))
+ unreg: (String, ThisFunction1[Element, JQueryEvent, Any]) => js.Any = (event, c) => jquery.asInstanceOf[js.Dynamic].off(event, c))
extends CallbackRegistration {
private val c: ThisFunction1[Element, JQueryEvent, Any] = callback
reg(c)
@@ -934,40 +628,48 @@ object JQuery {
/** Adds the specified class(es) to each element in the set of matched elements.
* See: jQuery Docs */
- def addClass(function: (Int) => String): JQuery = jquery.addClass(function)
+ def addClass(function: (Int) => String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].addClass(function).asInstanceOf[JQuery]
/** Adds the specified class(es) to each element in the set of matched elements.
* See: jQuery Docs */
- def addClass(function: (Int, String) => String): JQuery = jquery.addClass(function)
+ def addClass(function: (Int, String) => String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].addClass(function).asInstanceOf[JQuery]
/** Perform a custom animation of a set of CSS properties.
* See: jQuery Docs */
def animate(properties: Map[String, Any], duration: Int = 400, easing: EasingFunction = EasingFunction.swing, callback: (Element) => Any = (_) => {}): JQuery =
- jquery.animate(properties.toJSDictionary, duration, easing, callback)
+ jquery.asInstanceOf[js.Dynamic].animate(properties.toJSDictionary, duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Perform a custom animation of a set of CSS properties.
* See: jQuery Docs */
- def animate(properties: Map[String, Any], options: AnimationOptions): JQuery = jquery.animate(properties.toJSDictionary, options.toJSDictionary)
+ def animate(properties: Map[String, Any], options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].animate(properties.toJSDictionary, options.toJSDictionary).asInstanceOf[JQuery]
/** Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* See: jQuery Docs */
- def append(function: (Element, Int, String) => Any): JQuery = jquery.append(function)
+ def append(function: (Element, Int, String) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].append(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Get the value of an attribute for the first element in the set of matched elements.
* See: jQuery Docs */
- def attr(attributeName: String): Option[String] = jquery.attr(attributeName).toOption
+ def attr(attributeName: String): Option[String] =
+ jquery.asInstanceOf[js.Dynamic].attr(attributeName).asInstanceOf[UndefOr[String]].toOption
/** Set one or more attributes for the set of matched elements.
* See: jQuery Docs */
- def attr(attributes: Map[String, String | Int | Double | Boolean]): JQuery = jquery.attr(attributes.toJSDictionary)
+ def attr(attributes: Map[String, String | Int | Double | Boolean]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].attr(attributes.toJSDictionary).asInstanceOf[JQuery]
/** Set one or more attributes for the set of matched elements.
* See: jQuery Docs */
- def attr(attributeName: String, function: (Int, String) => String | Int | Double | Boolean): JQuery = jquery.attr(attributeName, function)
+ def attr(attributeName: String, function: (Int, String) => String | Int | Double | Boolean): JQuery =
+ jquery.asInstanceOf[js.Dynamic].attr(attributeName, function).asInstanceOf[JQuery]
/** Insert content, specified by the parameter, before each element in the set of matched elements.
* See: jQuery Docs */
- def before(content: (Int, String) => String | Element | JQuery): JQuery = jquery.before(content)
+ def before(content: (Int, String) => String | Element | JQuery): JQuery =
+ jquery.asInstanceOf[js.Dynamic].before(content).asInstanceOf[JQuery]
/** Bind an event handler to the "blur" JavaScript event on an element.
* See: jQuery Docs */
@@ -1003,19 +705,23 @@ object JQuery {
/** Set one or more CSS properties for the set of matched elements.
* See: jQuery Docs */
- def css(propertyNames: Map[String, String | Int | Double | Boolean]): JQuery = jquery.css(propertyNames.toJSDictionary)
+ def css(propertyNames: Map[String, String | Int | Double | Boolean]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].css(propertyNames.toJSDictionary).asInstanceOf[JQuery]
/** Set one or more CSS properties for the set of matched elements.
* See: jQuery Docs */
- def css(attributeName: String, attributeFun: (Int, String) => String | Int | Double | Boolean): JQuery = jquery.css(attributeName, attributeFun)
+ def css(attributeName: String, attributeFun: (Int, String) => String | Int | Double | Boolean): JQuery =
+ jquery.asInstanceOf[js.Dynamic].css(attributeName, attributeFun).asInstanceOf[JQuery]
/** Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
* See: jQuery Docs */
- def data(key: String): Option[Any] = jquery.data(key).toOption
+ def data(key: String): Option[Any] =
+ jquery.asInstanceOf[js.Dynamic].data(key).asInstanceOf[UndefOr[Any]].toOption
/** Store arbitrary data associated with the matched elements.
* See: jQuery Docs */
- def data(obj: Map[String, Any]): JQuery = jquery.data(obj.toJSDictionary)
+ def data(obj: Map[String, Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].data(obj.toJSDictionary).asInstanceOf[JQuery]
/** Bind an event handler to the "dblclick" JavaScript event on an element.
* See: jQuery Docs */
@@ -1027,7 +733,8 @@ object JQuery {
/** Iterate over a jQuery object, executing a function for each matched element.
* See: jQuery Docs */
- def each(callback: (Element, Int) => Any): JQuery = jquery.each(callback)
+ def each(callback: (Element, Int) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].each(js.ThisFunction.fromFunction2(callback)).asInstanceOf[JQuery]
/** Bind an event handler to the "error" JavaScript event on an element.
* See: jQuery Docs */
@@ -1041,39 +748,48 @@ object JQuery {
/** Display the matched elements by fading them to opaque.
* See: jQuery Docs */
- def fadeIn(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeIn(duration, easing, callback)
+ def fadeIn(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeIn(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display the matched elements by fading them to opaque.
* See: jQuery Docs */
- def fadeIn(options: AnimationOptions): JQuery = jquery.fadeIn(options.toJSDictionary)
+ def fadeIn(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeIn(options.toJSDictionary).asInstanceOf[JQuery]
/** Hide the matched elements by fading them to transparent.
* See: jQuery Docs */
- def fadeOut(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeOut(duration, easing, callback)
+ def fadeOut(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeOut(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Hide the matched elements by fading them to transparent.
* See: jQuery Docs */
- def fadeOut(options: AnimationOptions): JQuery = jquery.fadeOut(options.toJSDictionary)
+ def fadeOut(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeOut(options.toJSDictionary).asInstanceOf[JQuery]
/** Adjust the opacity of the matched elements.
* See: jQuery Docs */
- def fadeTo(duration: Int, opacity: Double, callback: (Element) => Any): JQuery = jquery.fadeTo(duration, opacity, callback)
+ def fadeTo(duration: Int, opacity: Double, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeTo(duration, opacity, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Adjust the opacity of the matched elements.
* See: jQuery Docs */
- def fadeTo(duration: Int, opacity: Double, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeTo(duration, opacity, easing, callback)
+ def fadeTo(duration: Int, opacity: Double, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeTo(duration, opacity, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display or hide the matched elements by animating their opacity.
* See: jQuery Docs */
- def fadeToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.fadeToggle(duration, easing, callback)
+ def fadeToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeToggle(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display or hide the matched elements by animating their opacity.
* See: jQuery Docs */
- def fadeToggle(options: AnimationOptions): JQuery = jquery.fadeToggle(options.toJSDictionary)
+ def fadeToggle(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].fadeToggle(options.toJSDictionary).asInstanceOf[JQuery]
/** Reduce the set of matched elements to those that match the selector or pass the function's test.
* See: jQuery Docs */
- def filter(function: (Element, Int, Element) => Boolean): JQuery = jquery.filter(function)
+ def filter(function: (Element, Int, Element) => Boolean): JQuery =
+ jquery.asInstanceOf[js.Dynamic].filter(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Bind an event handler to the "focus" JavaScript event on an element.
* See: jQuery Docs */
@@ -1101,23 +817,28 @@ object JQuery {
/** Retrieve one of the elements matched by the jQuery object.
* See: jQuery Docs */
- def get(index: Int): Option[Element] = jquery.get(index).toOption
+ def get(index: Int): Option[Element] =
+ jquery.asInstanceOf[js.Dynamic].get(index).asInstanceOf[UndefOr[Element]].toOption
/** Retrieve the elements matched by the jQuery object.
* See: jQuery Docs */
- def get(): Seq[Element] = jquery.get().toSeq
+ def get(): Seq[Element] =
+ jquery.asInstanceOf[js.Dynamic].get().asInstanceOf[js.Array[Element]].toSeq
/** Set the CSS height of every matched element.
* See: jQuery Docs */
- def height(function: (Element, Int, Int) => String | Int | Double): JQuery = jquery.height(function)
+ def height(function: (Element, Int, Int) => String | Int | Double): JQuery =
+ jquery.asInstanceOf[js.Dynamic].height(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Hide the matched elements.
* See: jQuery Docs */
- def hide(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.hide(duration, easing, callback)
+ def hide(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].hide(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Hide the matched elements.
* See: jQuery Docs */
- def hide(options: AnimationOptions): JQuery = jquery.hide(options.toJSDictionary)
+ def hide(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].hide(options.toJSDictionary).asInstanceOf[JQuery]
/** Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
* See: jQuery Docs */
@@ -1133,15 +854,18 @@ object JQuery {
/** Set the CSS inner height of each element in the set of matched elements.
* See: jQuery Docs */
- def innerHeight(function: (Element, Int, Double) => Int | Double | String): JQuery = jquery.innerHeight(function)
+ def innerHeight(function: (Element, Int, Double) => Int | Double | String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].innerHeight(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Set the CSS inner width of each element in the set of matched elements.
* See: jQuery Docs */
- def innerWidth(function: (Element, Int, Double) => Int | Double | String): JQuery = jquery.innerWidth(function)
+ def innerWidth(function: (Element, Int, Double) => Int | Double | String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].innerWidth(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
* See: jQuery Docs */
- def is(function: (Element, Int, Element) => Boolean): Boolean = jquery.is(function)
+ def is(function: (Element, Int, Element) => Boolean): Boolean =
+ jquery.asInstanceOf[js.Dynamic].is(js.ThisFunction.fromFunction3(function)).asInstanceOf[Boolean]
/** Bind an event handler to the "keydown" JavaScript event on an element.
* See: jQuery Docs */
@@ -1169,11 +893,13 @@ object JQuery {
/** Load data from the server and place the returned HTML into the matched element.
* See: jQuery Docs */
- def load(url: String, data: js.Any, callback: (Element, String, String, JQueryXHR) => Any): JQuery = jquery.load(url, data, callback)
+ def load(url: String, data: js.Any, callback: (Element, String, String, JQueryXHR) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].load(url, data, js.ThisFunction.fromFunction4(callback)).asInstanceOf[JQuery]
/** Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
* See: jQuery Docs */
- def map(callback: (Int, Element) => Any): JQuery = jquery.map(callback)
+ def map(callback: (Int, Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].map(js.ThisFunction.fromFunction2(callback)).asInstanceOf[JQuery]
/** Bind an event handler to the "mousedown" JavaScript event on an element.
* See: jQuery Docs */
@@ -1233,18 +959,20 @@ object JQuery {
/** Remove elements from the set of matched elements.
* See: jQuery Docs */
- def not(function: (Element, Int, Element) => Boolean): JQuery = jquery.not(function)
+ def not(function: (Element, Int, Element) => Boolean): JQuery =
+ jquery.asInstanceOf[js.Dynamic].not(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Get the current coordinates of the first element in the set of matched elements, relative to the document.
* See: jQuery Docs */
def offset(): Offset = {
- val o = jquery.offset()
+ val o = jquery.asInstanceOf[js.Dynamic].offset().asInstanceOf[js.Dictionary[Double]]
Offset(o("top"), o("left"))
}
/** Get the current coordinates of the first element in the set of matched elements, relative to the document.
* See: jQuery Docs */
- def offset(coordinates: Offset): JQuery = jquery.offset(coordinates.toJSDictionary)
+ def offset(coordinates: Offset): JQuery =
+ jquery.asInstanceOf[js.Dynamic].offset(coordinates.toJSDictionary).asInstanceOf[JQuery]
/** Attach an event handler function for one or more events to the selected elements.
* See: jQuery Docs */
@@ -1305,10 +1033,10 @@ object JQuery {
/** Remove an event handler.
* See: jQuery Docs */
def off(event: String, callback: JQueryCallback): JQuery = {
- jquery.toArray()
+ jquery.asInstanceOf[js.Dynamic].toArray().asInstanceOf[js.Array[Element]]
.foreach( el => {
if (registrations.contains(el)) {
- val jqueryRegs: mutable.Buffer[CallbackRegistrationRef] = registrations.get(el).get
+ val jqueryRegs: mutable.Buffer[CallbackRegistrationRef] = registrations(el)
val found: mutable.Buffer[CallbackRegistrationRef] = jqueryRegs.filter(r => {
r match {
case CallbackRegistrationRef(ev, cb, _) if cb == callback && ev == event => true
@@ -1324,26 +1052,26 @@ object JQuery {
jquery
}
- private def separateCallbacks(event: String, callback:JQueryCallback, params: CallbackParameters): Unit = {
+ private def separateCallbacks(event: String, callback: JQueryCallback, params: CallbackParameters): Unit = {
type ThisFunctionCallback = ThisFunction1[Element, JQueryEvent, Any]
- jquery.each((element: Element, idx: Int) => {
+ jquery.asInstanceOf[js.Dynamic].each(js.ThisFunction.fromFunction2((element: Element, idx: Int) => {
val cb = params match {
- case CallbackParameters(false, null, null) => c: ThisFunctionCallback => jQ(element).on(event, c)
- case CallbackParameters(false, null, data) => c: ThisFunctionCallback => jQ(element).on(event, data, c)
- case CallbackParameters(false, selector, null) => c: ThisFunctionCallback => jQ(element).on(event, selector, c)
- case CallbackParameters(false, selector, data) => c: ThisFunctionCallback => jQ(element).on(event, selector, data, c)
-
- case CallbackParameters(true, null, null) => c: ThisFunctionCallback => jQ(element).one(event, c)
- case CallbackParameters(true, null, data) => c: ThisFunctionCallback => jQ(element).one(event, data, c)
- case CallbackParameters(true, selector, null) => c: ThisFunctionCallback => jQ(element).one(event, selector, c)
- case CallbackParameters(true, selector, data) => c: ThisFunctionCallback => jQ(element).one(event, selector, data, c)
+ case CallbackParameters(false, null, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, c)
+ case CallbackParameters(false, null, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, data, c)
+ case CallbackParameters(false, selector, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, selector, c)
+ case CallbackParameters(false, selector, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].on(event, selector, data, c)
+
+ case CallbackParameters(true, null, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, c)
+ case CallbackParameters(true, null, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, data, c)
+ case CallbackParameters(true, selector, null) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, selector, c)
+ case CallbackParameters(true, selector, data) => c: ThisFunctionCallback => jQ(element).asInstanceOf[js.Dynamic].one(event, selector, data, c)
}
val registration: CallbackRegistration = new OnCallbackRegistration(event, callback, cb)
collectRegistration(event, callback, element, idx, params, registration)
- })
+ }))
}
private def collectRegistration(event: String, callback: JQueryCallback, el: Element, index: Int, params: CallbackParameters, reg: CallbackRegistration) = {
@@ -1354,50 +1082,61 @@ object JQuery {
/** Set the CSS outer Height of each element in the set of matched elements.
* See: jQuery Docs */
- def outerHeight(function: (Element, Int, Double) => Double): JQuery = jquery.outerHeight(function)
+ def outerHeight(function: (Element, Int, Double) => Double): JQuery =
+ jquery.asInstanceOf[js.Dynamic].outerHeight(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Set the CSS outer width of each element in the set of matched elements.
* See: jQuery Docs */
- def outerWidth(function: (Element, Int, Double) => Double): JQuery = jquery.outerWidth(function)
+ def outerWidth(function: (Element, Int, Double) => Double): JQuery =
+ jquery.asInstanceOf[js.Dynamic].outerWidth(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
* See: jQuery Docs */
def position(): Position = {
- val p = jquery.position()
+ val p = jquery.asInstanceOf[js.Dynamic].position().asInstanceOf[js.Dictionary[Double]]
Position(p("top"), p("left"))
}
/** Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
* See: jQuery Docs */
- def prepend(function: (Element, Int, String) => Any): JQuery = jquery.prepend(function)
+ def prepend(function: (Element, Int, String) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].prepend(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Set one or more properties for the set of matched elements.
* See: jQuery Docs */
- def prop(propertyName: String, function: (Element, Int, Any) => Any): JQuery = jquery.prop(propertyName, function)
+ def prop(propertyName: String, function: (Element, Int, Any) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].prop(propertyName, js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Set one or more properties for the set of matched elements.
* See: jQuery Docs */
- def prop(properties: Map[String, Any]): JQuery = jquery.prop(properties.toJSDictionary)
+ def prop(properties: Map[String, Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].prop(properties.toJSDictionary).asInstanceOf[JQuery]
/** Add a collection of DOM elements onto the jQuery stack.
* See: jQuery Docs */
- def pushStack(elements: Seq[Any]): JQuery = jquery.pushStack(elements.toJSArray)
+ def pushStack(elements: Seq[Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].pushStack(elements.toJSArray).asInstanceOf[JQuery]
/** Add a collection of DOM elements onto the jQuery stack.
* See: jQuery Docs */
- def pushStack(elements: Seq[Any], name: String, arguments: Seq[Any]): JQuery = jquery.pushStack(elements.toJSArray, name, arguments.toJSArray)
+ def pushStack(elements: Seq[Any], name: String, arguments: Seq[Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].pushStack(elements.toJSArray, name, arguments.toJSArray).asInstanceOf[JQuery]
/** Specify a function to execute when the DOM is fully loaded.
* See: jQuery Docs */
- def ready(callback: (Element) => Any): JQuery = jquery.ready(callback)
+ @deprecated("Use jQ(callback) instead.", "1.1.0")
+ def ready(callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].ready(js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
* See: jQuery Docs */
- def removeClass(function: (Int, String) => String): JQuery = jquery.removeClass(function)
+ def removeClass(function: (Int, String) => String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].removeClass(function).asInstanceOf[JQuery]
/** Remove a previously-stored piece of data.
* See: jQuery Docs */
- def removeData(list: String*): JQuery = jquery.removeData(list.toJSArray)
+ def removeData(list: String*): JQuery =
+ jquery.asInstanceOf[js.Dynamic].removeData(list.toJSArray).asInstanceOf[JQuery]
/** Bind an event handler to the "resize" JavaScript event on an element.
* See: jQuery Docs */
@@ -1425,35 +1164,43 @@ object JQuery {
/** Display the matched elements.
* See: jQuery Docs */
- def show(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.show(duration, easing, callback)
+ def show(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].show(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display the matched elements.
* See: jQuery Docs */
- def show(options: AnimationOptions): JQuery = jquery.show(options.toJSDictionary)
+ def show(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].show(options.toJSDictionary).asInstanceOf[JQuery]
/** Display the matched elements with a sliding motion.
* See: jQuery Docs */
- def slideDown(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.slideDown(duration, easing, callback)
+ def slideDown(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].slideDown(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display the matched elements with a sliding motion.
* See: jQuery Docs */
- def slideDown(options: AnimationOptions): JQuery = jquery.slideDown(options.toJSDictionary)
+ def slideDown(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].slideDown(options.toJSDictionary).asInstanceOf[JQuery]
/** Display or hide the matched elements with a sliding motion.
* See: jQuery Docs */
- def slideToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.slideToggle(duration, easing, callback)
+ def slideToggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].slideToggle(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display or hide the matched elements with a sliding motion.
* See: jQuery Docs */
- def slideToggle(options: AnimationOptions): JQuery = jquery.slideToggle(options.toJSDictionary)
+ def slideToggle(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].slideToggle(options.toJSDictionary).asInstanceOf[JQuery]
/** Hide the matched elements with a sliding motion.
* See: jQuery Docs */
- def slideUp(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.slideUp(duration, easing, callback)
+ def slideUp(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].slideUp(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Hide the matched elements with a sliding motion.
* See: jQuery Docs */
- def slideUp(options: AnimationOptions): JQuery = jquery.slideUp(options.toJSDictionary)
+ def slideUp(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].slideUp(options.toJSDictionary).asInstanceOf[JQuery]
/** Trigger submit event on an element.
* See: jQuery Docs */
@@ -1465,63 +1212,78 @@ object JQuery {
/** Set the content of each element in the set of matched elements to the specified text.
* See: jQuery Docs */
- def text(function: (Element, Int, String) => String): JQuery = jquery.text(function)
+ def text(function: (Element, Int, String) => String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].text(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Retrieve all the elements contained in the jQuery set, as an array.
* See: jQuery Docs */
- def toArray: Seq[Element] = jquery.toArray().toSeq
+ def toArray: Seq[Element] =
+ jquery.asInstanceOf[js.Dynamic].toArray().asInstanceOf[js.Array[Element]].toSeq
/** Display or hide the matched elements.
* See: jQuery Docs */
- def toggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery = jquery.toggle(duration, easing, callback)
+ def toggle(duration: Int, easing: EasingFunction, callback: (Element) => Any): JQuery =
+ jquery.asInstanceOf[js.Dynamic].toggle(duration, easing, js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
/** Display or hide the matched elements.
* See: jQuery Docs */
- def toggle(options: AnimationOptions): JQuery = jquery.toggle(options.toJSDictionary)
+ def toggle(options: AnimationOptions): JQuery =
+ jquery.asInstanceOf[js.Dynamic].toggle(options.toJSDictionary).asInstanceOf[JQuery]
/** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */
- def toggleClass(function: (Int, String, Boolean) => String): JQuery = jquery.toggleClass(function)
+ def toggleClass(function: (Int, String, Boolean) => String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].toggleClass(function).asInstanceOf[JQuery]
/** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */
- def toggleClass(function: (Int, String, Boolean) => String, state: Boolean): JQuery = jquery.toggleClass(function, state)
+ def toggleClass(function: (Int, String, Boolean) => String, state: Boolean): JQuery =
+ jquery.asInstanceOf[js.Dynamic].toggleClass(function, state).asInstanceOf[JQuery]
/** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */
- def trigger(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery = jquery.trigger(event, extraParams.toJSDictionary)
+ def trigger(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].trigger(event.asInstanceOf[js.Dynamic], extraParams.toJSDictionary).asInstanceOf[JQuery]
/** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */
- def trigger(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery = jquery.trigger(event, extraParams.toJSArray)
+ def trigger(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].trigger(event.asInstanceOf[js.Dynamic], extraParams.toJSArray).asInstanceOf[JQuery]
/** Execute all handlers attached to an element for an event.
* See: jQuery Docs */
- def triggerHandler(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery = jquery.triggerHandler(event, extraParams.toJSDictionary)
+ def triggerHandler(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].triggerHandler(event.asInstanceOf[js.Dynamic], extraParams.toJSDictionary).asInstanceOf[JQuery]
/** Execute all handlers attached to an element for an event.
* See: jQuery Docs */
- def triggerHandler(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery = jquery.triggerHandler(event, extraParams.toJSArray)
+ def triggerHandler(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].triggerHandler(event.asInstanceOf[js.Dynamic], extraParams.toJSArray).asInstanceOf[JQuery]
/** Set the value of each element in the set of matched elements.
* See: jQuery Docs */
- def value(function: (Element, Int, String) => String): JQuery = jquery.value(function)
+ def value(function: (Element, Int, String) => String): JQuery =
+ jquery.asInstanceOf[js.Dynamic].value(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Set the CSS width of each element in the set of matched elements.
* See: jQuery Docs */
- def width(function: (Element, Int, Int) => String | Int | Double): JQuery = jquery.width(function)
+ def width(function: (Element, Int, Int) => String | Int | Double): JQuery =
+ jquery.asInstanceOf[js.Dynamic].width(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
/** Wrap an HTML structure around each element in the set of matched elements.
* See: jQuery Docs */
- def wrap(function: (Element, Int) => String | JQuery): JQuery = jquery.wrap(function)
+ def wrap(function: (Element, Int) => String | JQuery): JQuery =
+ jquery.asInstanceOf[js.Dynamic].wrap(js.ThisFunction.fromFunction2(function)).asInstanceOf[JQuery]
/** Wrap an HTML structure around all elements in the set of matched elements.
* See: jQuery Docs */
- def wrapAll(function: (Element, Int) => String | JQuery): JQuery = jquery.wrapAll(function)
+ def wrapAll(function: (Element, Int) => String | JQuery): JQuery =
+ jquery.asInstanceOf[js.Dynamic].wrapAll(js.ThisFunction.fromFunction2(function)).asInstanceOf[JQuery]
/** Wrap an HTML structure around the content of each element in the set of matched elements.
* See: jQuery Docs */
- def wrapInner(function: (Element, Int) => String | JQuery): JQuery = jquery.wrapInner(function)
+ def wrapInner(function: (Element, Int) => String | JQuery): JQuery =
+ jquery.asInstanceOf[js.Dynamic].wrapInner(js.ThisFunction.fromFunction2(function)).asInstanceOf[JQuery]
}
}
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala
index da307ea..0695953 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala
@@ -29,11 +29,7 @@ trait JQueryPromise[FunType <: js.Function1[ArgType, js.Any], ArgType] extends j
/** Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
* See: jQuery Docs */
// Usage of then as identifier is deprecated. It can be used as a keyword in future versions of scala.
- // def then(done: FunType, fail: FunType, progress: FunType): JQueryDeferred[FunType, ArgType] = js.native
-
- /** Determine the current state of a Deferred object.
- * See: jQuery Docs */
- private[jquery] def state: String = js.native
+ def `then`(done: FunType, fail: FunType, progress: FunType): JQueryDeferred[FunType, ArgType] = js.native
}
@@ -74,7 +70,7 @@ object JQueryPromise {
implicit class JQueryPromiseExt(jQueryPromise: JQueryPromise[_, _]) {
/** Determine the current state of a Deferred object.
* See: jQuery Docs */
- def state: JQueryDeferredState = jQueryPromise.state match {
+ def state: JQueryDeferredState = jQueryPromise.asInstanceOf[js.Dynamic].state.asInstanceOf[String] match {
case "pending" => JQueryDeferredPending
case "resolved" => JQueryDeferredResolved
case "rejected" => JQueryDeferredRejected
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
index b659bea..f4d4ac3 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
@@ -29,10 +29,6 @@ trait JQueryStatic extends js.Object {
* See: jQuery Docs */
def apply(`object`: js.Any): JQuery = js.native
- /** Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
- * See: jQuery Docs */
- private[jquery] def apply(elementArray: js.Array[Element]): JQuery = js.native
-
/** Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
* See: jQuery Docs */
def apply(jq: JQuery): JQuery = js.native
@@ -57,14 +53,6 @@ trait JQueryStatic extends js.Object {
* See: jQuery Docs */
def ajax(url: String, settings: JQueryAjaxSettings = js.native): JQueryXHR = js.native
- /** Handle custom Ajax options or modify existing options before each request is sent and before they are processed by `.ajax()`.
- * See: jQuery Docs */
- private[jquery] def ajaxPrefilter(dataTypes: String, handler: js.Function3[js.Dynamic, js.Dynamic, JQueryXHR, js.Any]): Unit = js.native
-
- /** Creates an object that handles the actual transmission of Ajax data.
- * See: jQuery Docs */
- private[jquery] def ajaxTransport(tpe: String, handler: js.Function3[js.Dynamic, js.Dynamic, JQueryXHR, js.Any]): Unit = js.native
-
/** A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
* See: jQuery Docs */
@JSName("Callbacks")
@@ -88,52 +76,30 @@ trait JQueryStatic extends js.Object {
* See: jQuery Docs */
def dequeue(element: Element, queueName: String): Unit = js.native
- /** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and
- * array-like objects with a length property (such as a function's arguments object) are iterated by numeric index,
- * from 0 to length-1. Other objects are iterated via their named properties.
- * See: jQuery Docs */
- private[jquery] def each[T](array: js.Array[T], callback: js.Function2[Int, T, js.Any]): Unit = js.native
-
- /** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and
- * array-like objects with a length property (such as a function's arguments object) are iterated by numeric index,
- * from 0 to length-1. Other objects are iterated via their named properties.
- * See: jQuery Docs */
- private[jquery] def each(obj: js.Any, callback: js.Function2[String, js.Any, js.Any]): Unit = js.native
+ /** Escapes any character that has a special meaning in a CSS selector.
+ * See: jQuery Docs */
+ def escapeSelector(index: Int): JQuery = js.native
/** Load data from the server using a HTTP GET request.
* See: jQuery Docs */
def get(settings: JQueryAjaxSettings): Unit = js.native
- /** Load data from the server using a HTTP GET request.
- * See: jQuery Docs */
- private[jquery] def get(url: String, data: js.Any | String = js.native, success: js.Function3[js.Dynamic, String, JQueryXHR, js.Any] = js.native, dataType: String = js.native): JQueryXHR = js.native
-
- /** Load a JavaScript file from the server using a GET HTTP request, then execute it.
- * See: jQuery Docs */
- private[jquery] def getScript(url: String, success: (String, String, JQueryXHR) => js.Any): JQueryXHR = js.native
-
/** Execute some JavaScript code globally.
* See: jQuery Docs */
def globalEval(code: String): Unit = js.native
- /** Finds the elements of an array which satisfy a filter function. The original array is not affected.
- * See: jQuery Docs */
- private[jquery] def grep[T](array: js.Array[T], function: js.Function2[T, Int, Boolean], invert: Boolean): js.Array[T] = js.native
-
/** Determine whether an element has any jQuery data associated with it.
* See: jQuery Docs */
def hasData(element: Element): Boolean = js.native
/** Determine whether an element has any jQuery data associated with it.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.2.0", "1.1.0")
def holdReady(hold: Boolean): Unit = js.native
- /** Search for a specified value within an array and return its index (or -1 if not found).
- * See: jQuery Docs */
- private[jquery] def inArray[T](value: T, array: js.Array[T], fromIndex: Int): Int = js.native
-
/** Determine whether the argument is an array.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.2.0", "1.1.0")
def isArray[T](el: js.Any): Boolean = js.native
/** Check to see if an object is empty (contains no enumerable properties).
@@ -166,6 +132,7 @@ trait JQueryStatic extends js.Object {
/** Takes a well-formed JSON string and returns the resulting JavaScript value.
* See: jQuery Docs */
+ @deprecated("Since all the browsers supported by jQuery 3.0 support the native JSON.parse() method, we are deprecating jQuery.parseJSON().", "1.1.0")
def parseJSON(json: String): js.Any = js.native
/** Parses a string into an XML document.
@@ -178,8 +145,13 @@ trait JQueryStatic extends js.Object {
/** Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
* See: jQuery Docs */
+ @deprecated("The jQuery.unique() method has been renamed to jQuery.uniqueSort() to make its behavior easier to understand.", "1.1.0")
def unique[T](array: js.Array[T]): js.Array[T] = js.native
+ /** Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
+ * See: jQuery Docs */
+ def uniqueSort[T](array: js.Array[T]): js.Array[T] = js.native
+
/** Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
* See: jQuery Docs */
def when[FunType <: js.Function1[ArgType, js.Any], ArgType](deferred: JQueryDeferred[FunType, ArgType]*): JQueryPromise[FunType, ArgType] = js.native
@@ -206,49 +178,56 @@ object JQueryStatic {
/** Handle custom Ajax options or modify existing options before each request is sent and before they are processed by `.ajax()`.
* See: jQuery Docs */
- def ajaxPrefilter(dataTypes: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit = jQueryStatic.ajaxPrefilter(dataTypes, handler)
+ def ajaxPrefilter(dataTypes: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit =
+ jQueryStatic.asInstanceOf[js.Dynamic].ajaxPrefilter(dataTypes, handler)
/** Creates an object that handles the actual transmission of Ajax data.
* See: jQuery Docs */
- def ajaxTransport(tpe: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit = jQueryStatic.ajaxTransport(tpe, handler)
+ def ajaxTransport(tpe: String, handler: (js.Dynamic, js.Dynamic, JQueryXHR) => js.Any): Unit =
+ jQueryStatic.asInstanceOf[js.Dynamic].ajaxTransport(tpe, handler)
/** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and
* array-like objects with a length property (such as a function's arguments object) are iterated by numeric index,
* from 0 to length-1. Other objects are iterated via their named properties.
* See: jQuery Docs */
- def each[T](array: Seq[T], callback: (Int, T) => js.Any): Unit = jQueryStatic.each[T](array.toJSArray, callback)
+ def each[T](array: Seq[T], callback: (Int, T) => js.Any): Unit =
+ jQueryStatic.asInstanceOf[js.Dynamic].each(array.toJSArray, callback)
/** A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and
* array-like objects with a length property (such as a function's arguments object) are iterated by numeric index,
* from 0 to length-1. Other objects are iterated via their named properties.
* See: jQuery Docs */
- def each(obj: js.Any, callback: (String, js.Any) => js.Any): Unit = jQueryStatic.each(obj, callback)
+ def each(obj: js.Any, callback: (String, js.Any) => js.Any): Unit =
+ jQueryStatic.asInstanceOf[js.Dynamic].each(obj, callback)
/** Load data from the server using a HTTP GET request.
* See: jQuery Docs */
def get[T](url: String, data: js.Any, success: (T, String, JQueryXHR) => js.Any, dataType: String): JQueryXHR = {
val callback = (data: js.Dynamic, status: String, xhr: JQueryXHR) => success(data.asInstanceOf[T], status, xhr)
- jQueryStatic.get(url, data, callback, dataType)
+ jQueryStatic.asInstanceOf[js.Dynamic].get(url, data, callback, dataType).asInstanceOf[JQueryXHR]
}
/** Load JSON-encoded data from the server using a GET HTTP request.
* See: jQuery Docs */
def getJSON[T](url: String, data: js.Any, success: (T, String, JQueryXHR) => js.Any): JQueryXHR = {
val callback = (data: js.Dynamic, status: String, xhr: JQueryXHR) => success(data.asInstanceOf[T], status, xhr)
- jQueryStatic.get(url, data, callback, "json")
+ jQueryStatic.asInstanceOf[js.Dynamic].get(url, data, callback, "json").asInstanceOf[JQueryXHR]
}
/** Load a JavaScript file from the server using a GET HTTP request, then execute it.
* See: jQuery Docs */
- def getScript(url: String, success: (String, String, JQueryXHR) => js.Any): JQueryXHR = jQueryStatic.getScript(url, success)
+ def getScript(url: String, success: (String, String, JQueryXHR) => js.Any): JQueryXHR =
+ jQueryStatic.asInstanceOf[js.Dynamic].getScript(url, success).asInstanceOf[JQueryXHR]
/** Finds the elements of an array which satisfy a filter function. The original array is not affected.
* See: jQuery Docs */
- def grep[T](array: Seq[T], function: (T, Int) => Boolean, invert: Boolean = false): js.Array[T] = jQueryStatic.grep[T](array.toJSArray, function, invert)
+ def grep[T](array: Seq[T], function: (T, Int) => Boolean, invert: Boolean = false): Seq[T] =
+ jQueryStatic.asInstanceOf[js.Dynamic].grep(array.toJSArray, function, invert).asInstanceOf[js.Array[T]].toSeq
/** Search for a specified value within an array and return its index (or -1 if not found).
* See: jQuery Docs */
- def inArray[T](value: T, array: Seq[T], fromIndex: Int): Int = jQueryStatic.inArray(value, array.toJSArray, fromIndex)
+ def inArray[T](value: T, array: Seq[T], fromIndex: Int): Int =
+ jQueryStatic.asInstanceOf[js.Dynamic].inArray(value.asInstanceOf[js.Dynamic], array.toJSArray, fromIndex).asInstanceOf[Int]
def parse(data: String) = {
jQ(jQueryStatic.parseHTML(data)(0))
From 7608242c7ee6e15aec50b31003be2e3dc47e1735 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Mon, 3 Jul 2017 08:49:29 +0200
Subject: [PATCH 03/80] Demo upgrade
---
example/build.sbt | 20 +++++++++----------
example/project/Dependencies.scala | 9 +++------
example/project/UdashBuild.scala | 2 +-
example/project/build.properties | 2 +-
example/project/plugins.sbt | 2 +-
example/src/main/assets/index.dev.html | 1 -
example/src/main/assets/index.prod.html | 1 -
.../scala/io/udash/demos/jquery/init.scala | 6 +++---
8 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/example/build.sbt b/example/build.sbt
index 19f5556..3cbf20d 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -1,7 +1,10 @@
+import UdashBuild._
+import Dependencies._
+
name := "jquery-demo"
-version in ThisBuild := "1.0.1-SNAPSHOT"
-scalaVersion in ThisBuild := "2.11.8"
+version in ThisBuild := "1.1.0"
+scalaVersion in ThisBuild := "2.12.2"
organization in ThisBuild := "io.udash"
crossPaths in ThisBuild := false
scalacOptions in ThisBuild ++= Seq(
@@ -12,29 +15,28 @@ scalacOptions in ThisBuild ++= Seq(
"-language:existentials",
"-language:dynamics",
"-Xfuture",
- "-Xfatal-warnings",
- "-Xlint:_,-missing-interpolator,-adapted-args"
+ "-Xfatal-warnings"
)
val generatedDir = file("generated")
val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
.settings(
libraryDependencies ++= deps.value,
- persistLauncher in Compile := true,
/* move these files out of target/. */
crossTarget in (Compile, fullOptJS) := generatedDir,
crossTarget in (Compile, fastOptJS) := generatedDir,
crossTarget in (Compile, packageJSDependencies) := generatedDir,
- crossTarget in (Compile, packageScalaJSLauncher) := generatedDir,
crossTarget in (Compile, packageMinifiedJSDependencies) := generatedDir,
- compile <<= (compile in Compile).dependsOn(compileStatics),
+ compile := (compile in Compile).dependsOn(compileStatics).value,
compileStatics := {
compileStaticsForRelease.value
(crossTarget.value / StaticFilesDir).***.get
},
+ scalaJSUseMainModuleInitializer := true,
+
artifactPath in(Compile, fastOptJS) :=
(crossTarget in(Compile, fastOptJS)).value / StaticFilesDir / WebContent / "scripts" / "frontend-impl-fast.js",
artifactPath in(Compile, fullOptJS) :=
@@ -42,7 +44,5 @@ val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
artifactPath in(Compile, packageJSDependencies) :=
(crossTarget in(Compile, packageJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps-fast.js",
artifactPath in(Compile, packageMinifiedJSDependencies) :=
- (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps.js",
- artifactPath in(Compile, packageScalaJSLauncher) :=
- (crossTarget in(Compile, packageScalaJSLauncher)).value / StaticFilesDir / WebContent / "scripts" / "frontend-init.js"
+ (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps.js"
)
\ No newline at end of file
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 9364f20..946b5be 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,15 +1,12 @@
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt._
-object Dependencies extends Build {
- val udashCoreVersion = "0.4.0"
- val udashJQueryVersion = "1.0.1"
+object Dependencies {
+ val udashCoreVersion = "0.5.0"
+ val udashJQueryVersion = "1.1.0"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
-
- val depsJS = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID](
- ))
}
\ No newline at end of file
diff --git a/example/project/UdashBuild.scala b/example/project/UdashBuild.scala
index 464b556..f58e7c3 100644
--- a/example/project/UdashBuild.scala
+++ b/example/project/UdashBuild.scala
@@ -2,7 +2,7 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.AutoImport._
import sbt.Keys._
import sbt._
-object UdashBuild extends Build {
+object UdashBuild {
val StaticFilesDir = "UdashStatic"
val WebContent = "WebContent"
diff --git a/example/project/build.properties b/example/project/build.properties
index e0cbc71..6be4958 100644
--- a/example/project/build.properties
+++ b/example/project/build.properties
@@ -1 +1 @@
-sbt.version = 0.13.13
\ No newline at end of file
+sbt.version = 0.13.15
\ No newline at end of file
diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt
index 26a69b3..68fe409 100644
--- a/example/project/plugins.sbt
+++ b/example/project/plugins.sbt
@@ -1,2 +1,2 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")
\ No newline at end of file
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
\ No newline at end of file
diff --git a/example/src/main/assets/index.dev.html b/example/src/main/assets/index.dev.html
index 72b62d5..ce52d69 100644
--- a/example/src/main/assets/index.dev.html
+++ b/example/src/main/assets/index.dev.html
@@ -6,7 +6,6 @@
-
diff --git a/example/src/main/assets/index.prod.html b/example/src/main/assets/index.prod.html
index 9c2609e..187b36d 100644
--- a/example/src/main/assets/index.prod.html
+++ b/example/src/main/assets/index.prod.html
@@ -6,7 +6,6 @@
-
diff --git a/example/src/main/scala/io/udash/demos/jquery/init.scala b/example/src/main/scala/io/udash/demos/jquery/init.scala
index 8bbe6ce..30d7f4b 100644
--- a/example/src/main/scala/io/udash/demos/jquery/init.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/init.scala
@@ -16,12 +16,12 @@ object Context {
implicit val applicationInstance = new Application[RoutingState](routingRegistry, viewPresenterRegistry, RootState)
}
-object Init extends JSApp {
+object Init {
import Context._
@JSExport
- override def main(): Unit = {
- jQ(document).ready((_: Element) => {
+ def main(args: Array[String]): Unit = {
+ jQ((_: Element) => {
val appRoot = jQ("#application").get(0)
if (appRoot.isEmpty) {
dom.console.error("Application root element not found! Check you index.html file!")
From d51b0334948e57f3354546b947967853ee3fd114 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Mon, 3 Jul 2017 08:50:22 +0200
Subject: [PATCH 04/80] Travis build configuration
---
.travis.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 556f7d1..5a5db0c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,8 +3,8 @@ dist: trusty
jdk: oraclejdk8
scala:
- - 2.11.8
- - 2.12.1
+ - 2.11.11
+ - 2.12.2
before_script:
- "export DISPLAY=:99.0"
@@ -24,4 +24,4 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION "set (jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Chrome))" test
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- # - cd example && sbt ++$TRAVIS_SCALA_VERSION compile
\ No newline at end of file
+ - cd example && sbt ++$TRAVIS_SCALA_VERSION compile
\ No newline at end of file
From 33226e1d710d251e548148c5427a2a2dc81a3a22 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Mon, 3 Jul 2017 08:51:28 +0200
Subject: [PATCH 05/80] README update
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index fca8785..9918489 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program
Add the following to your SBT build:
```scala
-libraryDependencies += "io.udash" %%% "udash-jquery" % "1.0.0"
+libraryDependencies += "io.udash" %%% "udash-jquery" % "1.1.0"
```
then import the jQuery package:
From fea931b451206c80f4e312d6c670d81bf3651deb Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 11:25:31 +0200
Subject: [PATCH 06/80] Detach selector parameter is optional
---
src/main/scala/io/udash/wrappers/jquery/JQuery.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index 7c7bdd8..f2afbf1 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -140,7 +140,7 @@ trait JQuery extends js.Object {
/** Remove the set of matched elements from the DOM.
* See: jQuery Docs */
- def detach(selector: Selector): JQuery = js.native
+ def detach(selector: Selector = js.native): JQuery = js.native
/** Remove all child nodes of the set of matched elements from the DOM.
* See: jQuery Docs */
From dc19bf515a5449d113728a617c778b5bc4cb0b52 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 11:36:11 +0200
Subject: [PATCH 07/80] Chrome driver update
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 5a5db0c..b1875ab 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,7 @@ before_script:
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
# Install Selenium chromedriver
- - wget http://chromedriver.storage.googleapis.com/2.25/chromedriver_linux64.zip
+ - wget http://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip -d selenium-bin
- export PATH=$PWD/selenium-bin:$PATH
From be4ab572ae568330db6b87ee182dc8310c609161 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 12:32:29 +0200
Subject: [PATCH 08/80] Release 1.1.1
---
build.sbt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.sbt b/build.sbt
index 17f5081..6dd6da8 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,7 +1,7 @@
name := "udash-jquery"
-version := "1.1.0"
+version := "1.1.1"
organization := "io.udash"
scalaVersion := "2.12.2"
crossScalaVersions := Seq("2.11.11", "2.12.2")
From 6f7d988aa384afa9ac321b024d4c095bdaeb527b Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 12:30:45 +0200
Subject: [PATCH 09/80] Dependencies and build update
---
.travis.yml | 6 +--
build.sbt | 84 ++++++++++++++++++++++++++++------------
project/build.properties | 2 +-
project/plugins.sbt | 4 +-
4 files changed, 65 insertions(+), 31 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index b1875ab..3c7f61b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,8 +3,8 @@ dist: trusty
jdk: oraclejdk8
scala:
- - 2.11.11
- - 2.12.2
+ - 2.11.12
+ - 2.12.6
before_script:
- "export DISPLAY=:99.0"
@@ -22,6 +22,6 @@ before_script:
- export PATH=$PWD/selenium-bin:$PATH
script:
- - sbt ++$TRAVIS_SCALA_VERSION "set (jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Chrome))" test
+ - sbt ++$TRAVIS_SCALA_VERSION test
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- cd example && sbt ++$TRAVIS_SCALA_VERSION compile
\ No newline at end of file
diff --git a/build.sbt b/build.sbt
index 6dd6da8..090b491 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,37 +1,71 @@
+import org.openqa.selenium.chrome.ChromeOptions
+import org.openqa.selenium.remote.DesiredCapabilities
+import org.scalajs.jsenv.selenium.SeleniumJSEnv
name := "udash-jquery"
-version := "1.1.1"
-organization := "io.udash"
-scalaVersion := "2.12.2"
-crossScalaVersions := Seq("2.11.11", "2.12.2")
-scalacOptions in ThisBuild ++= Seq(
- "-feature",
- "-deprecation",
- "-unchecked",
- "-language:implicitConversions",
- "-language:existentials",
- "-language:dynamics",
- "-Xfuture",
- "-Xfatal-warnings",
- CrossVersion.partialVersion(scalaVersion.value).collect {
- // WORKAROUND https://github.com/scala/scala/pull/5402
- case (2, 12) => "-Xlint:-unused,_"
- }.getOrElse("-Xlint:_")
-)
+inThisBuild(Seq(
+ version := "1.2.0",
+ organization := "io.udash",
+ scalaVersion := "2.12.6",
+ crossScalaVersions := Seq("2.11.12", "2.12.6"),
+ scalacOptions ++= Seq(
+ "-feature",
+ "-deprecation",
+ "-unchecked",
+ "-language:implicitConversions",
+ "-language:existentials",
+ "-language:dynamics",
+ "-language:postfixOps",
+ "-language:experimental.macros",
+ "-Xfuture",
+ "-Xfatal-warnings",
+ "-Xlint:_",
+ ),
+ scalacOptions ++= {
+ if (CrossVersion.partialVersion((root / scalaVersion).value).contains((2, 12))) Seq(
+ "-Ywarn-unused:_,-explicits,-implicits",
+ "-Ybackend-parallelism", "4",
+ "-Ycache-plugin-class-loader:last-modified",
+ "-Ycache-macro-class-loader:last-modified"
+ ) else Seq.empty
+ },
+))
+
+// Settings for JS tests run in browser
+val browserCapabilities: DesiredCapabilities = {
+ // requires ChromeDriver: https://sites.google.com/a/chromium.org/chromedriver/
+ val capabilities = DesiredCapabilities.chrome()
+ capabilities.setCapability(ChromeOptions.CAPABILITY, {
+ val options = new ChromeOptions()
+ options.addArguments("--headless", "--disable-gpu")
+ options
+ })
+ capabilities
+}
-jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox())
+val commonJSSettings = Seq(
+ Compile / emitSourceMaps := true,
+ Test / parallelExecution := false,
+ Test / scalaJSStage := FastOptStage,
+ Test / jsEnv := new SeleniumJSEnv(browserCapabilities),
+ scalacOptions += {
+ val localDir = (ThisBuild / baseDirectory).value.toURI.toString
+ val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery"
+ s"-P:scalajs:mapSourceURI:$localDir->$githubDir/v${version.value}/"
+ },
+ scalacOptions += "-P:scalajs:sjsDefinedByDefault",
+)
libraryDependencies ++= Seq(
- "org.scala-js" %%% "scalajs-dom" % "0.9.2",
- "org.scalatest" %%% "scalatest" % "3.0.3" % Test,
- "com.lihaoyi" %%% "scalatags" % "0.6.5" % Test
+ "org.scala-js" %%% "scalajs-dom" % "0.9.5",
+ "org.scalatest" %%% "scalatest" % "3.0.5" % Test,
+ "com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
)
jsDependencies +=
- "org.webjars" % "jquery" % "3.2.1" / "3.2.1/jquery.js" minified "3.2.1/jquery.min.js"
-
-requiresDOM in Test := true
+ "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
lazy val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
+ .settings(commonJSSettings)
diff --git a/project/build.properties b/project/build.properties
index 6be4958..c3e3abc 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version = 0.13.15
\ No newline at end of file
+sbt.version = 1.1.4
\ No newline at end of file
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 3a623d2..953c2a1 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,5 +1,5 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
+libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"
-libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.1.3"
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
From ab0e793f7580852d9ae43688d2b629c31bf37ecc Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 12:31:07 +0200
Subject: [PATCH 10/80] JQuery wrapper update
---
.../io/udash/wrappers/jquery/JQuery.scala | 88 ++++++++++++++++++-
.../wrappers/jquery/JQueryDeferred.scala | 2 -
.../udash/wrappers/jquery/JQueryStatic.scala | 3 +
.../io/udash/wrappers/jquery/package.scala | 1 -
.../wrappers/jquery_test/TraversingTest.scala | 8 +-
5 files changed, 91 insertions(+), 11 deletions(-)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index f2afbf1..952316b 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -3,10 +3,9 @@ package io.udash.wrappers.jquery
import org.scalajs.dom._
import scala.collection.mutable
-import scala.concurrent.duration.Duration
import scala.scalajs.js
import scala.scalajs.js.annotation.JSName
-import scala.scalajs.js.{Dictionary, ThisFunction1, UndefOr, |}
+import scala.scalajs.js.{ThisFunction1, UndefOr, |}
@js.native
trait JQuery extends js.Object {
@@ -62,10 +61,12 @@ trait JQuery extends js.Object {
/** Trigger blur event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def blur(): JQuery = js.native
/** Trigger change event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def change(): JQuery = js.native
/** Get the children of each element in the set of matched elements.
@@ -86,6 +87,7 @@ trait JQuery extends js.Object {
/** Trigger click event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def click(): JQuery = js.native
/** Create a deep copy of the set of matched elements.
@@ -107,6 +109,7 @@ trait JQuery extends js.Object {
/** Trigger contextmenu event on an element.
* See: jQuery Docs */
@JSName("contextmenu")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def contextMenu(): JQuery = js.native
/** Get the computed style properties for the first element in the set of matched elements.
@@ -128,6 +131,7 @@ trait JQuery extends js.Object {
/** Trigger dblclick event on an element.
* See: jQuery Docs */
@JSName("dblclick")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def dblClick(): JQuery = js.native
/** Set a timer to delay execution of subsequent items in the queue.
@@ -202,16 +206,19 @@ trait JQuery extends js.Object {
/** Trigger focus event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focus(): JQuery = js.native
/** Trigger focusin event on an element.
* See: jQuery Docs */
@JSName("focusin")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focusIn(): JQuery = js.native
/** Trigger focusout event on an element.
* See: jQuery Docs */
@JSName("focusout")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focusOut(): JQuery = js.native
/** Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
@@ -285,16 +292,19 @@ trait JQuery extends js.Object {
/** Trigger keydown event on an element.
* See: jQuery Docs */
@JSName("keydown")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyDown(): JQuery = js.native
/** Trigger keypress event on an element.
* See: jQuery Docs */
@JSName("keypress")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyPress(): JQuery = js.native
/** Trigger keyup event on an element.
* See: jQuery Docs */
@JSName("keyup")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyUp(): JQuery = js.native
/** Reduce the set of matched elements to the final one in the set.
@@ -312,36 +322,43 @@ trait JQuery extends js.Object {
/** Trigger mousedown event on an element.
* See: jQuery Docs */
@JSName("mousedown")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseDown(): JQuery = js.native
/** Trigger mouseenter event on an element.
* See: jQuery Docs */
@JSName("mouseenter")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseEnter(): JQuery = js.native
/** Trigger mouseleave event on an element.
* See: jQuery Docs */
@JSName("mouseleave")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseLeave(): JQuery = js.native
/** Trigger mousemove event on an element.
* See: jQuery Docs */
@JSName("mousemove")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseMove(): JQuery = js.native
/** Trigger mouseout event on an element.
* See: jQuery Docs */
@JSName("mouseout")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseOut(): JQuery = js.native
/** Trigger mouseover event on an element.
* See: jQuery Docs */
@JSName("mouseover")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseOver(): JQuery = js.native
/** Trigger mouseup event on an element.
* See: jQuery Docs */
@JSName("mouseup")
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseUp(): JQuery = js.native
/** Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
@@ -470,10 +487,12 @@ trait JQuery extends js.Object {
/** Trigger resize event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def resize(): JQuery = js.native
/** Trigger scroll event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def scroll(): JQuery = js.native
/** Get the current horizontal position of the scroll bar for the first element in the set of matched elements.
@@ -494,6 +513,7 @@ trait JQuery extends js.Object {
/** Trigger select event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def select(): JQuery = js.native
/** Encode a set of form elements as a string for submission.
@@ -534,6 +554,7 @@ trait JQuery extends js.Object {
/** Trigger submit event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def submit(): JQuery = js.native
/** Get the combined text contents of each element in the set of matched elements, including their descendants.
@@ -626,6 +647,11 @@ object JQuery {
override def unregister(): Unit = unreg(event, c)
}
+ /** Adds the specified class(es) to each element in the set of matched elements.
+ * See: jQuery Docs */
+ def addClass(classNames: Seq[String]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].addClass(classNames.toJSArray).asInstanceOf[JQuery]
+
/** Adds the specified class(es) to each element in the set of matched elements.
* See: jQuery Docs */
def addClass(function: (Int) => String): JQuery =
@@ -673,34 +699,42 @@ object JQuery {
/** Bind an event handler to the "blur" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def blur(callback: JQueryCallback): JQuery = on("blur", callback)
/** Bind an event handler to the "blur" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def blur(data: js.Any, callback: JQueryCallback): JQuery = on("blur", data, callback)
/** Bind an event handler to the "change" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def change(callback: JQueryCallback): JQuery = on("change", callback)
/** Bind an event handler to the "change" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def change(data: js.Any, callback: JQueryCallback): JQuery = on("change", data, callback)
/** Bind an event handler to the "click" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def click(callback: JQueryCallback): JQuery = on("click", callback)
/** Bind an event handler to the "click" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def click(data: js.Any, callback: JQueryCallback): JQuery = on("click", data, callback)
/** Bind an event handler to the "contextmenu" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def contextMenu(callback: JQueryCallback): JQuery = on("contextmenu", callback)
/** Bind an event handler to the "contextmenu" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def contextMenu(data: js.Any, callback: JQueryCallback): JQuery = on("contextmenu", data, callback)
/** Set one or more CSS properties for the set of matched elements.
@@ -725,10 +759,12 @@ object JQuery {
/** Bind an event handler to the "dblclick" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def dblClick(callback: JQueryCallback): JQuery = on("dblclick", callback)
/** Bind an event handler to the "dblclick" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def dblClick(data: js.Any, callback: JQueryCallback): JQuery = on("dblclick", data, callback)
/** Iterate over a jQuery object, executing a function for each matched element.
@@ -793,26 +829,32 @@ object JQuery {
/** Bind an event handler to the "focus" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focus(callback: JQueryCallback): JQuery = on("focus", callback)
/** Bind an event handler to the "focus" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focus(data: js.Any, callback: JQueryCallback): JQuery = on("focus", data, callback)
/** Bind an event handler to the "focusIn" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focusIn(callback: JQueryCallback): JQuery = on("focusin", callback)
/** Bind an event handler to the "focusIn" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focusIn(data: js.Any, callback: JQueryCallback): JQuery = on("focusin", data, callback)
/** Bind an event handler to the "focusOut" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focusOut(callback: JQueryCallback): JQuery = on("focusout", callback)
/** Bind an event handler to the "focusOut" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def focusOut(data: js.Any, callback: JQueryCallback): JQuery = on("focusout", data, callback)
/** Retrieve one of the elements matched by the jQuery object.
@@ -843,8 +885,8 @@ object JQuery {
/** Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
* See: jQuery Docs */
def hover(handlerIn: (Element) => Any, handlerOut: (Element) => Any): JQuery = {
- mouseEnter((el, _) => handlerIn(el))
- mouseLeave((el, _) => handlerOut(el))
+ on("mouseenter", (el, _) => handlerIn(el))
+ on("mouseleave", (el, _) => handlerOut(el))
jquery
}
@@ -869,26 +911,32 @@ object JQuery {
/** Bind an event handler to the "keydown" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyDown(callback: JQueryCallback): JQuery = on("keydown", callback)
/** Bind an event handler to the "keydown" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyDown(data: js.Any, callback: JQueryCallback): JQuery = on("keydown", data, callback)
/** Bind an event handler to the "keypress" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyPress(callback: JQueryCallback): JQuery = on("keypress", callback)
/** Bind an event handler to the "keypress" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyPress(data: js.Any, callback: JQueryCallback): JQuery = on("keypress", data, callback)
/** Bind an event handler to the "keyup" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyUp(callback: JQueryCallback): JQuery = on("keyup", callback)
/** Bind an event handler to the "keyup" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def keyUp(data: js.Any, callback: JQueryCallback): JQuery = on("keyup", data, callback)
/** Load data from the server and place the returned HTML into the matched element.
@@ -903,58 +951,72 @@ object JQuery {
/** Bind an event handler to the "mousedown" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseDown(callback: JQueryCallback): JQuery = on("mousedown", callback)
/** Bind an event handler to the "mousedown" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseDown(data: js.Any, callback: JQueryCallback): JQuery = on("mousedown", data, callback)
/** Bind an event handler to the "mouseenter" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseEnter(callback: JQueryCallback): JQuery = on("mouseenter", callback)
/** Bind an event handler to the "mouseenter" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseEnter(data: js.Any, callback: JQueryCallback): JQuery = on("mouseenter", data, callback)
/** Bind an event handler to the "mouseleave" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseLeave(callback: JQueryCallback): JQuery = on("mouseleave", callback)
/** Bind an event handler to the "mouseleave" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseLeave(data: js.Any, callback: JQueryCallback): JQuery = on("mouseleave", data, callback)
/** Bind an event handler to the "mousemove" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseMove(callback: JQueryCallback): JQuery = on("mousemove", callback)
/** Bind an event handler to the "mousemove" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseMove(data: js.Any, callback: JQueryCallback): JQuery = on("mousemove", data, callback)
/** Bind an event handler to the "mouseout" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseOut(callback: JQueryCallback): JQuery = on("mouseout", callback)
/** Bind an event handler to the "mouseout" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseOut(data: js.Any, callback: JQueryCallback): JQuery = on("mouseout", data, callback)
/** Bind an event handler to the "mouseover" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseOver(callback: JQueryCallback): JQuery = on("mouseover", callback)
/** Bind an event handler to the "mouseover" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseOver(data: js.Any, callback: JQueryCallback): JQuery = on("mouseover", data, callback)
/** Bind an event handler to the "mouseup" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseUp(callback: JQueryCallback): JQuery = on("mouseup", callback)
/** Bind an event handler to the "mouseup" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def mouseUp(data: js.Any, callback: JQueryCallback): JQuery = on("mouseup", data, callback)
/** Remove elements from the set of matched elements.
@@ -1128,6 +1190,11 @@ object JQuery {
def ready(callback: (Element) => Any): JQuery =
jquery.asInstanceOf[js.Dynamic].ready(js.ThisFunction.fromFunction1(callback)).asInstanceOf[JQuery]
+ /** Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
+ * See: jQuery Docs */
+ def removeClass(classNames: Seq[String]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].removeClass(classNames.toJSArray).asInstanceOf[JQuery]
+
/** Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
* See: jQuery Docs */
def removeClass(function: (Int, String) => String): JQuery =
@@ -1140,26 +1207,32 @@ object JQuery {
/** Bind an event handler to the "resize" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def resize(callback: JQueryCallback): JQuery = on("resize", callback)
/** Bind an event handler to the "resize" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def resize(data: js.Any, callback: JQueryCallback): JQuery = on("resize", data, callback)
/** Bind an event handler to the "scroll" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def scroll(callback: JQueryCallback): JQuery = on("scroll", callback)
/** Bind an event handler to the "scroll" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def scroll(data: js.Any, callback: JQueryCallback): JQuery = on("scroll", data, callback)
/** Bind an event handler to the "select" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def select(callback: JQueryCallback): JQuery = on("select", callback)
/** Bind an event handler to the "select" JavaScript event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def select(data: js.Any, callback: JQueryCallback): JQuery = on("select", data, callback)
/** Display the matched elements.
@@ -1204,10 +1277,12 @@ object JQuery {
/** Trigger submit event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def submit(callback: JQueryCallback): JQuery = on("submit", callback)
/** Trigger submit event on an element.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def submit(data: js.Any, callback: JQueryCallback): JQuery = on("submit", data, callback)
/** Set the content of each element in the set of matched elements to the specified text.
@@ -1230,6 +1305,11 @@ object JQuery {
def toggle(options: AnimationOptions): JQuery =
jquery.asInstanceOf[js.Dynamic].toggle(options.toJSDictionary).asInstanceOf[JQuery]
+ /** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
+ * See: jQuery Docs */
+ def toggleClass(classNames: Seq[String]): JQuery =
+ jquery.asInstanceOf[js.Dynamic].toggleClass(classNames.toJSArray).asInstanceOf[JQuery]
+
/** Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
* See: jQuery Docs */
def toggleClass(function: (Int, String, Boolean) => String): JQuery =
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala
index 0695953..e0ee079 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQueryDeferred.scala
@@ -1,7 +1,5 @@
package io.udash.wrappers.jquery
-import org.scalajs.dom._
-
import scala.scalajs.js
@js.native
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
index f4d4ac3..7044e8f 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
@@ -108,10 +108,12 @@ trait JQueryStatic extends js.Object {
/** Determine if the argument passed is a JavaScript function object.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def isFunction[T](el: js.Any): Boolean = js.native
/** Determines whether its argument is a number.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def isNumeric[T](el: js.Any): Boolean = js.native
/** Check to see if an object is a plain object (created using "{}" or "new Object").
@@ -120,6 +122,7 @@ trait JQueryStatic extends js.Object {
/** Determine whether the argument is a window.
* See: jQuery Docs */
+ @deprecated("Since jQuery 3.3.0", "1.2.0")
def isWindow[T](el: js.Any): Boolean = js.native
/** Check to see if a DOM node is within an XML document (or is an XML document).
diff --git a/src/main/scala/io/udash/wrappers/jquery/package.scala b/src/main/scala/io/udash/wrappers/jquery/package.scala
index 51cc4dc..9ad7299 100644
--- a/src/main/scala/io/udash/wrappers/jquery/package.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/package.scala
@@ -3,7 +3,6 @@ package io.udash.wrappers
import org.scalajs.dom._
import scala.scalajs.js
-import scala.scalajs.js.annotation.JSName
/** All docs are quoted from jQuery API docs. */
package object jquery {
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
index d042acb..1400684 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
@@ -63,9 +63,9 @@ class TraversingTest extends WordSpec with Matchers {
val el1 = span.render
val el2 = span.render
val el3 = h1.render
- val p1 = div(el1).render
- val p2 = div(el2).render
- val p3 = div(el3).render
+ div(el1).render
+ div(el2).render
+ div(el3).render
val selection = jQ(el1, el2, el3)
selection.parent().filter("div").length should be(3)
@@ -89,7 +89,7 @@ class TraversingTest extends WordSpec with Matchers {
val el1 = span.render
val el2 = span.render
val el3 = h1.render
- val d = div(el1, el2, el3).render
+ div(el1, el2, el3).render
val selection = jQ(el1, el2, el3)
selection.parent().filter("div").length should be(1)
From 371e847ae34c2bb493a5cfd9f14bb2d4933378e1 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 13:35:13 +0200
Subject: [PATCH 11/80] Demo upgrade
---
.travis.yml | 2 +-
example/README.md | 4 +
example/build.sbt | 83 +++++++++++--------
example/project/Dependencies.scala | 4 +-
example/project/UdashBuild.scala | 36 --------
example/project/build.properties | 2 +-
example/project/plugins.sbt | 3 +-
example/src/main/assets/index.dev.html | 14 ----
.../assets/{index.prod.html => index.html} | 1 -
.../demos/jquery/RoutingRegistryDef.scala | 3 +-
.../jquery/StatesToViewPresenterDef.scala | 4 +-
.../scala/io/udash/demos/jquery/init.scala | 5 +-
.../scala/io/udash/demos/jquery/states.scala | 61 ++++++--------
.../udash/demos/jquery/views/ErrorView.scala | 3 +-
.../udash/demos/jquery/views/IndexView.scala | 4 +-
.../udash/demos/jquery/views/RootView.scala | 21 +----
.../jquery/views/functions/AddBackView.scala | 2 +-
.../jquery/views/functions/AddView.scala | 2 +-
.../jquery/views/functions/AfterView.scala | 2 +-
.../jquery/views/functions/AnimateView.scala | 12 +--
.../views/functions/AppendPrependView.scala | 2 +-
.../jquery/views/functions/AttrView.scala | 16 ++--
.../views/functions/CallbacksView.scala | 10 +--
.../jquery/views/functions/ChildrenView.scala | 2 +-
.../jquery/views/functions/DataView.scala | 2 +-
.../jquery/views/functions/DeferredView.scala | 2 +-
.../jquery/views/functions/EachView.scala | 2 +-
.../jquery/views/functions/HideShowView.scala | 2 +-
.../views/functions/OffsetPositionView.scala | 5 +-
.../jquery/views/functions/OnOneOffView.scala | 2 +-
30 files changed, 126 insertions(+), 187 deletions(-)
create mode 100644 example/README.md
delete mode 100644 example/project/UdashBuild.scala
delete mode 100644 example/src/main/assets/index.dev.html
rename example/src/main/assets/{index.prod.html => index.html} (98%)
diff --git a/.travis.yml b/.travis.yml
index 3c7f61b..92b85a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,4 +24,4 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION test
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- - cd example && sbt ++$TRAVIS_SCALA_VERSION compile
\ No newline at end of file
+ - cd example && sbt ++$TRAVIS_SCALA_VERSION compile fullOptJS
\ No newline at end of file
diff --git a/example/README.md b/example/README.md
new file mode 100644
index 0000000..bacbfad
--- /dev/null
+++ b/example/README.md
@@ -0,0 +1,4 @@
+### How to use?
+
+Run `sbt fastOptJS` or `sbt fullOptJS` to compile this demo. You can find all generated files
+in the `generated` directory. Open `index.html` in your browser.
diff --git a/example/build.sbt b/example/build.sbt
index 3cbf20d..a6221fe 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -1,48 +1,61 @@
-import UdashBuild._
-import Dependencies._
-
name := "jquery-demo"
-version in ThisBuild := "1.1.0"
-scalaVersion in ThisBuild := "2.12.2"
-organization in ThisBuild := "io.udash"
-crossPaths in ThisBuild := false
-scalacOptions in ThisBuild ++= Seq(
- "-feature",
- "-deprecation",
- "-unchecked",
- "-language:implicitConversions",
- "-language:existentials",
- "-language:dynamics",
- "-Xfuture",
- "-Xfatal-warnings"
-)
+inThisBuild(Seq(
+ version := "1.2.0",
+ organization := "io.udash",
+ scalaVersion := "2.12.6",
+ scalacOptions ++= Seq(
+ "-feature",
+ "-deprecation",
+ "-unchecked",
+ "-language:implicitConversions",
+ "-language:existentials",
+ "-language:dynamics",
+ "-language:postfixOps",
+ "-Xfuture",
+ "-Xfatal-warnings",
+ "-Xlint:_",
+ ),
+ scalacOptions ++= {
+ if (CrossVersion.partialVersion((`jquery-demo` / scalaVersion).value).contains((2, 12))) Seq(
+ "-Ywarn-unused:_,-explicits,-implicits",
+ "-Ybackend-parallelism", "4",
+ "-Ycache-plugin-class-loader:last-modified",
+ "-Ycache-macro-class-loader:last-modified"
+ ) else Seq.empty
+ },
+))
val generatedDir = file("generated")
+val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
.settings(
- libraryDependencies ++= deps.value,
+ libraryDependencies ++= Dependencies.deps.value,
/* move these files out of target/. */
- crossTarget in (Compile, fullOptJS) := generatedDir,
- crossTarget in (Compile, fastOptJS) := generatedDir,
- crossTarget in (Compile, packageJSDependencies) := generatedDir,
- crossTarget in (Compile, packageMinifiedJSDependencies) := generatedDir,
+ Compile / fullOptJS / crossTarget := generatedDir,
+ Compile / fastOptJS / crossTarget := generatedDir,
+ Compile / packageJSDependencies / crossTarget := generatedDir,
+ Compile / packageMinifiedJSDependencies / crossTarget := generatedDir,
- compile := (compile in Compile).dependsOn(compileStatics).value,
- compileStatics := {
- compileStaticsForRelease.value
- (crossTarget.value / StaticFilesDir).***.get
- },
+ Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value,
+ Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value,
scalaJSUseMainModuleInitializer := true,
- artifactPath in(Compile, fastOptJS) :=
- (crossTarget in(Compile, fastOptJS)).value / StaticFilesDir / WebContent / "scripts" / "frontend-impl-fast.js",
- artifactPath in(Compile, fullOptJS) :=
- (crossTarget in(Compile, fullOptJS)).value / StaticFilesDir / WebContent / "scripts" / "frontend-impl.js",
- artifactPath in(Compile, packageJSDependencies) :=
- (crossTarget in(Compile, packageJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps-fast.js",
- artifactPath in(Compile, packageMinifiedJSDependencies) :=
- (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "frontend-deps.js"
+ copyAssets := {
+ IO.copyFile(
+ sourceDirectory.value / "main/assets/index.html",
+ generatedDir / "index.html"
+ )
+ },
+
+ Compile / fastOptJS / artifactPath :=
+ (Compile / fastOptJS / crossTarget).value / "scripts" / "frontend-impl.js",
+ Compile / fullOptJS / artifactPath :=
+ (Compile / fullOptJS / crossTarget).value / "scripts" / "frontend-impl.js",
+ Compile / packageJSDependencies / artifactPath :=
+ (Compile / packageJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js",
+ Compile / packageMinifiedJSDependencies / artifactPath :=
+ (Compile / packageMinifiedJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js"
)
\ No newline at end of file
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 946b5be..48bac51 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -2,8 +2,8 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt._
object Dependencies {
- val udashCoreVersion = "0.5.0"
- val udashJQueryVersion = "1.1.0"
+ val udashCoreVersion = "0.6.1"
+ val udashJQueryVersion = "1.2.0"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
diff --git a/example/project/UdashBuild.scala b/example/project/UdashBuild.scala
deleted file mode 100644
index f58e7c3..0000000
--- a/example/project/UdashBuild.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-import org.scalajs.sbtplugin.ScalaJSPlugin.AutoImport._
-import sbt.Keys._
-import sbt._
-
-object UdashBuild {
- val StaticFilesDir = "UdashStatic"
- val WebContent = "WebContent"
-
- def copyIndex(file: File, to: File) = {
- val newFile = Path(to.toPath.toString + "/index.html")
- IO.copyFile(file, newFile.asFile)
- }
-
- val compileStatics = taskKey[Seq[File]]("Frontend static files manager.")
-
- val compileStaticsForRelease = Def.taskDyn {
- def outDir(target: File) = target / StaticFilesDir / WebContent
- if (!isSnapshot.value) {
- Def.task {
- val indexFile = sourceDirectory.value / "main/assets/index.prod.html"
- copyIndex(indexFile, outDir((crossTarget in (Compile, fullOptJS)).value))
- (fullOptJS in Compile).value
- (packageMinifiedJSDependencies in Compile).value
- (packageScalaJSLauncher in Compile).value
- }
- } else {
- Def.task {
- val indexFile = sourceDirectory.value / "main/assets/index.dev.html"
- copyIndex(indexFile, outDir((crossTarget in (Compile, fastOptJS)).value))
- (fastOptJS in Compile).value
- (packageJSDependencies in Compile).value
- (packageScalaJSLauncher in Compile).value
- }
- }
- }
-}
\ No newline at end of file
diff --git a/example/project/build.properties b/example/project/build.properties
index 6be4958..c3e3abc 100644
--- a/example/project/build.properties
+++ b/example/project/build.properties
@@ -1 +1 @@
-sbt.version = 0.13.15
\ No newline at end of file
+sbt.version = 1.1.4
\ No newline at end of file
diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt
index 68fe409..293d135 100644
--- a/example/project/plugins.sbt
+++ b/example/project/plugins.sbt
@@ -1,2 +1,3 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
\ No newline at end of file
+
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
\ No newline at end of file
diff --git a/example/src/main/assets/index.dev.html b/example/src/main/assets/index.dev.html
deleted file mode 100644
index ce52d69..0000000
--- a/example/src/main/assets/index.dev.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- jquery-demo - development
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/example/src/main/assets/index.prod.html b/example/src/main/assets/index.html
similarity index 98%
rename from example/src/main/assets/index.prod.html
rename to example/src/main/assets/index.html
index 187b36d..fd8b57a 100644
--- a/example/src/main/assets/index.prod.html
+++ b/example/src/main/assets/index.html
@@ -6,7 +6,6 @@
-
diff --git a/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala b/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala
index 118e345..f43d899 100644
--- a/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala
@@ -1,7 +1,6 @@
package io.udash.demos.jquery
import io.udash._
-import io.udash.utils.Bidirectional
class RoutingRegistryDef extends RoutingRegistry[RoutingState] {
def matchUrl(url: Url): RoutingState =
@@ -10,7 +9,7 @@ class RoutingRegistryDef extends RoutingRegistry[RoutingState] {
def matchState(state: RoutingState): Url =
Url(state2Url.apply(state))
- private val (url2State, state2Url) = Bidirectional[String, RoutingState] {
+ private val (url2State, state2Url) = bidirectional {
case "" => IndexState
case "/add" => AddState
case "/addBack" => AddBackState
diff --git a/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala b/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala
index 0ff8f68..dee3a6e 100644
--- a/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala
@@ -4,8 +4,8 @@ import io.udash._
import io.udash.demos.jquery.views.functions._
import io.udash.demos.jquery.views.{ErrorViewPresenter, IndexViewPresenter, RootViewPresenter}
-class StatesToViewPresenterDef extends ViewPresenterRegistry[RoutingState] {
- def matchStateToResolver(state: RoutingState): ViewPresenter[_ <: RoutingState] = state match {
+class StatesToViewPresenterDef extends ViewFactoryRegistry[RoutingState] {
+ def matchStateToResolver(state: RoutingState): ViewFactory[_ <: RoutingState] = state match {
case RootState => RootViewPresenter
case IndexState => IndexViewPresenter
case AddState => AddViewPresenter
diff --git a/example/src/main/scala/io/udash/demos/jquery/init.scala b/example/src/main/scala/io/udash/demos/jquery/init.scala
index 30d7f4b..549798b 100644
--- a/example/src/main/scala/io/udash/demos/jquery/init.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/init.scala
@@ -3,9 +3,8 @@ package io.udash.demos.jquery
import io.udash._
import io.udash.wrappers.jquery._
import org.scalajs.dom
-import org.scalajs.dom.{Element, document}
+import org.scalajs.dom.Element
-import scala.scalajs.js.JSApp
import scala.scalajs.js.annotation.JSExport
object Context {
@@ -13,7 +12,7 @@ object Context {
private val routingRegistry = new RoutingRegistryDef
private val viewPresenterRegistry = new StatesToViewPresenterDef
- implicit val applicationInstance = new Application[RoutingState](routingRegistry, viewPresenterRegistry, RootState)
+ implicit val applicationInstance = new Application[RoutingState](routingRegistry, viewPresenterRegistry)
}
object Init {
diff --git a/example/src/main/scala/io/udash/demos/jquery/states.scala b/example/src/main/scala/io/udash/demos/jquery/states.scala
index 2ef0306..f4e7452 100644
--- a/example/src/main/scala/io/udash/demos/jquery/states.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/states.scala
@@ -2,40 +2,31 @@ package io.udash.demos.jquery
import io.udash._
-sealed abstract class RoutingState(val parentState: RoutingState) extends State {
- def url(implicit application: Application[RoutingState]): String = s"#${application.matchState(this).value}"
-}
-
-case object RootState extends RoutingState(null)
-
-case object ErrorState extends RoutingState(RootState)
-
-case object IndexState extends RoutingState(RootState)
-
-case object AddState extends RoutingState(RootState)
-
-case object AddBackState extends RoutingState(RootState)
-
-case object AfterBeforeState extends RoutingState(RootState)
-
-case object AnimateState extends RoutingState(RootState)
-
-case object AppendPrependState extends RoutingState(RootState)
+sealed abstract class RoutingState(val parentState: Option[ContainerRoutingState]) extends State {
+ type HierarchyRoot = RoutingState
-case object AttrState extends RoutingState(RootState)
-
-case object CallbacksState extends RoutingState(RootState)
-
-case object ChildrenState extends RoutingState(RootState)
-
-case object DataState extends RoutingState(RootState)
-
-case object DeferredState extends RoutingState(RootState)
-
-case object EachState extends RoutingState(RootState)
-
-case object HideShowState extends RoutingState(RootState)
-
-case object OffsetPositionState extends RoutingState(RootState)
+ def url(implicit application: Application[RoutingState]): String =
+ s"#${application.matchState(this).value}"
+}
-case object OnOneOffState extends RoutingState(RootState)
\ No newline at end of file
+sealed abstract class ContainerRoutingState(parentState: Option[ContainerRoutingState]) extends RoutingState(parentState) with ContainerState
+sealed abstract class FinalRoutingState(parentState: ContainerRoutingState) extends RoutingState(Option(parentState)) with FinalState
+
+
+case object RootState extends ContainerRoutingState(None)
+case object ErrorState extends FinalRoutingState(RootState)
+case object IndexState extends FinalRoutingState(RootState)
+case object AddState extends FinalRoutingState(RootState)
+case object AddBackState extends FinalRoutingState(RootState)
+case object AfterBeforeState extends FinalRoutingState(RootState)
+case object AnimateState extends FinalRoutingState(RootState)
+case object AppendPrependState extends FinalRoutingState(RootState)
+case object AttrState extends FinalRoutingState(RootState)
+case object CallbacksState extends FinalRoutingState(RootState)
+case object ChildrenState extends FinalRoutingState(RootState)
+case object DataState extends FinalRoutingState(RootState)
+case object DeferredState extends FinalRoutingState(RootState)
+case object EachState extends FinalRoutingState(RootState)
+case object HideShowState extends FinalRoutingState(RootState)
+case object OffsetPositionState extends FinalRoutingState(RootState)
+case object OnOneOffState extends FinalRoutingState(RootState)
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala b/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala
index 2a427cf..a2b8fa7 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala
@@ -2,9 +2,8 @@ package io.udash.demos.jquery.views
import io.udash._
import io.udash.demos.jquery.IndexState
-import org.scalajs.dom.Element
-object ErrorViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new ErrorView)
+object ErrorViewPresenter extends StaticViewFactory[IndexState.type](() => new ErrorView)
class ErrorView extends FinalView {
import scalatags.JsDom.all._
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
index aaf2e46..cad18f0 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
@@ -2,13 +2,11 @@ package io.udash.demos.jquery.views
import io.udash._
import io.udash.demos.jquery._
-import org.scalajs.dom.Element
-object IndexViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new IndexView)
+object IndexViewPresenter extends StaticViewFactory[IndexState.type](() => new IndexView)
class IndexView extends FinalView {
import Context._
-
import scalatags.JsDom.all._
private val content = div(
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala b/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala
index c58cf5d..3906559 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala
@@ -2,28 +2,15 @@ package io.udash.demos.jquery.views
import io.udash._
import io.udash.demos.jquery.{Context, IndexState, RootState}
-import org.scalajs.dom.Element
-object RootViewPresenter extends DefaultViewPresenterFactory[RootState.type](() => new RootView)
+object RootViewPresenter extends StaticViewFactory[RootState.type](() => new RootView)
-class RootView extends View {
+class RootView extends ContainerView {
import Context._
-
import scalatags.JsDom.all._
- private var child: Element = div().render
-
- private val content = div(
+ override def getTemplate: Modifier = div(
a(href := IndexState.url)(h1("jquery-demo")),
- child
+ childViewContainer
)
-
- override def getTemplate: Modifier = content
-
- override def renderChild(view: View): Unit = {
- import io.udash.wrappers.jquery._
-
- jQ(child).children().remove()
- view.getTemplate.applyTo(child)
- }
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
index 76037ce..cdc25ba 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
@@ -7,7 +7,7 @@ import io.udash.wrappers.jquery._
import scalatags.JsDom.tags2
-object AddBackViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new AddBackView)
+object AddBackViewPresenter extends StaticViewFactory[IndexState.type](() => new AddBackView)
/** Based on examples from: jQuery Docs. */
class AddBackView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
index c77042d..9c0b0d8 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
@@ -7,7 +7,7 @@ import io.udash.wrappers.jquery._
import scalatags.JsDom.tags2
-object AddViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new AddView)
+object AddViewPresenter extends StaticViewFactory[IndexState.type](() => new AddView)
/** Based on examples from: jQuery Docs. */
class AddView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala
index 15ffc96..7e61e09 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala
@@ -5,7 +5,7 @@ import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object AfterBeforeViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new AfterBeforeView)
+object AfterBeforeViewPresenter extends StaticViewFactory[IndexState.type](() => new AfterBeforeView)
/** Based on examples from: jQuery Docs. */
class AfterBeforeView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
index ad4c630..1831bae 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
@@ -8,7 +8,7 @@ import org.scalajs.dom.Element
import scalatags.JsDom.tags2
-object AnimateViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new AnimateView)
+object AnimateViewPresenter extends StaticViewFactory[IndexState.type](() => new AnimateView)
/** Based on examples from: jQuery Docs. */
class AnimateView extends FunctionView {
@@ -39,7 +39,7 @@ class AnimateView extends FunctionView {
).render
override protected val script = () => {
- jQ("#go1").click((_: Element, _: JQueryEvent) => {
+ jQ("#go1").on("click", (_: Element, _: JQueryEvent) => {
jQ( "#block1" )
.animate(Map(
"width" -> "90%"
@@ -51,18 +51,18 @@ class AnimateView extends FunctionView {
.animate(Map("borderRightWidth" -> "15px"), 1500)
})
- jQ("#go2").click((_: Element, _: JQueryEvent) => {
+ jQ("#go2").on("click", (_: Element, _: JQueryEvent) => {
jQ("#block2")
.animate(Map("width" -> "90%"), 1000)
.animate(Map("fontSize" -> "24px"), 1000)
.animate(Map("borderLeftWidth" -> "15px"), 1000)
})
- jQ("#go3").click((_: Element, _: JQueryEvent) => {
- jQ("#go1").add("#go2").click()
+ jQ("#go3").on("click", (_: Element, _: JQueryEvent) => {
+ jQ("#go1").add("#go2").trigger("click")
})
- jQ("#go4").click((_: Element, _: JQueryEvent) => {
+ jQ("#go4").on("click", (_: Element, _: JQueryEvent) => {
// TODO: It does not work without explicit Map elements type
import scala.scalajs.js.`|`
jQ("div").css(Map[String, String | Int | Double | Boolean](
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
index 6640498..2908b43 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
@@ -5,7 +5,7 @@ import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object AppendPrependViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new AppendPrependView)
+object AppendPrependViewPresenter extends StaticViewFactory[IndexState.type](() => new AppendPrependView)
/** Based on examples from: jQuery Docs. */
class AppendPrependView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
index 433981f..aec3c68 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
@@ -6,7 +6,7 @@ import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.{Element, Event}
-object AttrViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new AttrView)
+object AttrViewPresenter extends StaticViewFactory[IndexState.type](() => new AttrView)
/** Based on examples from: jQuery Docs. */
class AttrView extends FunctionView {
@@ -18,34 +18,34 @@ class AttrView extends FunctionView {
label(`for` := "check1")("Check me"),
p(),
button(onclick :+= ((_: Event) => {
- jQ(".demo input").attr("data-checked", "checked").change()
+ jQ(".demo input").attr("data-checked", "checked").trigger("change")
false
}))(".attr(\"data-checked\", \"checked\")"),
button(onclick :+= ((_: Event) => {
- jQ(".demo input").attr("data-checked", "").change()
+ jQ(".demo input").attr("data-checked", "").trigger("change")
false
}))(".attr(\"data-checked\", \"\")"),
button(onclick :+= ((_: Event) => {
- jQ(".demo input").attr("data-checked", null).change()
+ jQ(".demo input").attr("data-checked", null).trigger("change")
false
}))(".attr(\"data-checked\", null)"), br(),
button(onclick :+= ((_: Event) => {
- jQ(".demo input").prop("checked", true).change()
+ jQ(".demo input").prop("checked", true).trigger("change")
false
}))(".prop(\"checked\", true)"),
button(onclick :+= ((_: Event) => {
- jQ(".demo input").prop("checked", false).change()
+ jQ(".demo input").prop("checked", false).trigger("change")
false
}))(".prop(\"checked\", false)")
).render
override protected val script = () => {
- jQ(".demo input").change((input: Element, _: JQueryEvent) => {
+ jQ(".demo input").on("change", (input: Element, _: JQueryEvent) => {
jQ(".demo p").html(
s""".attr('data-checked'): ${jQ(input).attr("data-checked")}
|.prop('checked'): ${jQ(input).prop("checked")}
|.is(':checked'): ${jQ(input).is(":checked")}""".stripMargin
)
- }).change()
+ }).trigger("change")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
index aa297a2..e3824bb 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
@@ -7,7 +7,7 @@ import io.udash.wrappers.jquery._
import scala.scalajs.js
-object CallbacksViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new CallbacksView)
+object CallbacksViewPresenter extends StaticViewFactory[IndexState.type](() => new CallbacksView)
/** Based on examples from: jQuery Docs. */
class CallbacksView extends FunctionView {
@@ -40,11 +40,11 @@ class CallbacksView extends FunctionView {
jQ("#div").append(li(s"$a / $b = ${a/b}").render)
})
- callbacks.fire(1, 1)
- callbacks.fire(3, 3)
- callbacks.fire(7, 4)
+ callbacks.fire((1, 1))
+ callbacks.fire((3, 3))
+ callbacks.fire((7, 4))
callbacks.disable()
- callbacks.fire(1, 2)
+ callbacks.fire((1, 2))
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
index 845042f..ea4d0f6 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
@@ -5,7 +5,7 @@ import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object ChildrenViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new ChildrenView)
+object ChildrenViewPresenter extends StaticViewFactory[IndexState.type](() => new ChildrenView)
/** Based on examples from: jQuery Docs. */
class ChildrenView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
index 8d67ac0..f905ec5 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
@@ -5,7 +5,7 @@ import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object DataViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new DataView)
+object DataViewPresenter extends StaticViewFactory[IndexState.type](() => new DataView)
/** Based on examples from: jQuery Docs. */
class DataView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
index edb6ced..82ee717 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
@@ -8,7 +8,7 @@ import org.scalajs.dom.Event
import scala.scalajs.js
-object DeferredViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new DeferredView)
+object DeferredViewPresenter extends StaticViewFactory[IndexState.type](() => new DeferredView)
/** Based on examples from: jQuery Docs. */
class DeferredView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
index 10e9395..447267b 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
@@ -6,7 +6,7 @@ import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.Element
-object EachViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new EachView)
+object EachViewPresenter extends StaticViewFactory[IndexState.type](() => new EachView)
/** Based on examples from: jQuery Docs. */
class EachView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
index fcd8246..9ed0a46 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
@@ -5,7 +5,7 @@ import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object HideShowViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new HideShowView)
+object HideShowViewPresenter extends StaticViewFactory[IndexState.type](() => new HideShowView)
/** Based on examples from: jQuery Docs. */
class HideShowView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
index d2304d9..9ec5d02 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
@@ -1,12 +1,11 @@
package io.udash.demos.jquery.views.functions
import io.udash._
-import io.udash.demos.jquery.{IndexState, OffsetPositionState}
+import io.udash.demos.jquery.OffsetPositionState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-import org.scalajs.dom.{Element, Event}
-object OffsetPositionViewPresenter extends DefaultViewPresenterFactory[OffsetPositionState.type](() => new OffsetPositionView)
+object OffsetPositionViewPresenter extends StaticViewFactory[OffsetPositionState.type](() => new OffsetPositionView)
/** Based on examples from: jQuery Docs. */
class OffsetPositionView extends FunctionView {
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
index e237e37..2e1a7f3 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
@@ -6,7 +6,7 @@ import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.{Element, Event}
-object OnOneOffViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new OnOneOffView)
+object OnOneOffViewPresenter extends StaticViewFactory[IndexState.type](() => new OnOneOffView)
/** Based on examples from: jQuery Docs. */
class OnOneOffView extends FunctionView {
From 0b3054ba47d580eaae4431830910632c8af386b7 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Wed, 9 May 2018 13:42:34 +0200
Subject: [PATCH 12/80] Travis build fix
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 92b85a2..632188e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,5 +23,5 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION test
- - sbt ++$TRAVIS_SCALA_VERSION publishLocal
+ - sbt ++$TRAVIS_SCALA_VERSION +publishLocal
- cd example && sbt ++$TRAVIS_SCALA_VERSION compile fullOptJS
\ No newline at end of file
From f94ea9f15a6594f1e94b102ac13e72823fb30d22 Mon Sep 17 00:00:00 2001
From: Starzu
Date: Thu, 10 May 2018 08:16:44 +0200
Subject: [PATCH 13/80] EventName - event names enum
---
.../jquery/views/functions/AnimateView.scala | 8 +-
.../jquery/views/functions/AttrView.scala | 2 +-
.../jquery/views/functions/OnOneOffView.scala | 8 +-
.../io/udash/wrappers/jquery/JQuery.scala | 60 ++++++-------
.../io/udash/wrappers/jquery/package.scala | 1 +
.../io/udash/wrappers/jquery/utils.scala | 89 ++++++++++++-------
6 files changed, 97 insertions(+), 71 deletions(-)
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
index 1831bae..c1c8693 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
@@ -39,7 +39,7 @@ class AnimateView extends FunctionView {
).render
override protected val script = () => {
- jQ("#go1").on("click", (_: Element, _: JQueryEvent) => {
+ jQ("#go1").on(EventName.click, (_: Element, _: JQueryEvent) => {
jQ( "#block1" )
.animate(Map(
"width" -> "90%"
@@ -51,18 +51,18 @@ class AnimateView extends FunctionView {
.animate(Map("borderRightWidth" -> "15px"), 1500)
})
- jQ("#go2").on("click", (_: Element, _: JQueryEvent) => {
+ jQ("#go2").on(EventName.click, (_: Element, _: JQueryEvent) => {
jQ("#block2")
.animate(Map("width" -> "90%"), 1000)
.animate(Map("fontSize" -> "24px"), 1000)
.animate(Map("borderLeftWidth" -> "15px"), 1000)
})
- jQ("#go3").on("click", (_: Element, _: JQueryEvent) => {
+ jQ("#go3").on(EventName.click, (_: Element, _: JQueryEvent) => {
jQ("#go1").add("#go2").trigger("click")
})
- jQ("#go4").on("click", (_: Element, _: JQueryEvent) => {
+ jQ("#go4").on(EventName.click, (_: Element, _: JQueryEvent) => {
// TODO: It does not work without explicit Map elements type
import scala.scalajs.js.`|`
jQ("div").css(Map[String, String | Int | Double | Boolean](
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
index aec3c68..7ae29d0 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
@@ -40,7 +40,7 @@ class AttrView extends FunctionView {
).render
override protected val script = () => {
- jQ(".demo input").on("change", (input: Element, _: JQueryEvent) => {
+ jQ(".demo input").on(EventName.change, (input: Element, _: JQueryEvent) => {
jQ(".demo p").html(
s""".attr('data-checked'): ${jQ(input).attr("data-checked")}
|.prop('checked'): ${jQ(input).prop("checked")}
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
index 2e1a7f3..08035d0 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
@@ -26,8 +26,8 @@ class OnOneOffView extends FunctionView {
disabled := "disabled",
onclick :+= ((_: Event) => {
jQ(".demo #click")
- .off("click", onCallback)
- .off("click", oneCallback)
+ .off(EventName.click, onCallback)
+ .off(EventName.click, oneCallback)
false
})
)("Off")
@@ -35,8 +35,8 @@ class OnOneOffView extends FunctionView {
override protected val script = () => {
jQ(".demo #click")
- .on("click", onCallback)
- .one("click", oneCallback)
+ .on(EventName.click, onCallback)
+ .one(EventName.click, oneCallback)
jQ(".demo button")
.prop("disabled", "")
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index 952316b..f3c3fa5 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -96,11 +96,11 @@ trait JQuery extends js.Object {
/** For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
* See: jQuery Docs */
- def closest(selector: String | Element | JQuery): JQuery = js.native
+ def closest(selector: Selector | Element | JQuery): JQuery = js.native
/** For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
* See: jQuery Docs */
- def closest(selector: String, context: Element): JQuery = js.native
+ def closest(selector: Selector, context: Element): JQuery = js.native
/** Get the children of each element in the set of matched elements, including text and comment nodes.
* See: jQuery Docs */
@@ -194,7 +194,7 @@ trait JQuery extends js.Object {
/** Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
* See: jQuery Docs */
- def find(selector: String | Element | JQuery): JQuery = js.native
+ def find(selector: Selector | Element | JQuery): JQuery = js.native
/** Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.
* See: jQuery Docs */
@@ -223,7 +223,7 @@ trait JQuery extends js.Object {
/** Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
* See: jQuery Docs */
- def has(selector: String | Element): JQuery = js.native
+ def has(selector: Selector | Element): JQuery = js.native
/** Determine whether any of the matched elements are assigned the given class.
* See: jQuery Docs */
@@ -275,15 +275,15 @@ trait JQuery extends js.Object {
/** Insert every element in the set of matched elements after the target.
* See: jQuery Docs */
- def insertAfter(selector: String | Element | JQuery): JQuery = js.native
+ def insertAfter(selector: Selector | Element | JQuery): JQuery = js.native
/** Insert every element in the set of matched elements before the target.
* See: jQuery Docs */
- def insertBefore(selector: String | Element | JQuery): JQuery = js.native
+ def insertBefore(selector: Selector | Element | JQuery): JQuery = js.native
/** Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
* See: jQuery Docs */
- def is(selector: String | Element | JQuery): Boolean = js.native
+ def is(selector: Selector | Element | JQuery): Boolean = js.native
/** A string containing the jQuery version number.
* See: jQuery Docs */
@@ -375,7 +375,7 @@ trait JQuery extends js.Object {
/** Remove elements from the set of matched elements.
* See: jQuery Docs */
- def not(selector: String | JQuery): JQuery = js.native
+ def not(selector: Selector | JQuery): JQuery = js.native
/** Remove elements from the set of matched elements.
* See: jQuery Docs */
@@ -391,7 +391,7 @@ trait JQuery extends js.Object {
/** Remove an event handler.
* See: jQuery Docs */
- def off(jEvent: JQueryEvent, selector: String = js.native): JQuery = js.native
+ def off(jEvent: JQueryEvent, selector: Selector = js.native): JQuery = js.native
/** Get the closest ancestor element that is positioned.
* See: jQuery Docs */
@@ -530,7 +530,7 @@ trait JQuery extends js.Object {
/** Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
* See: jQuery Docs */
- def siblings(selector: String = js.native): JQuery = js.native
+ def siblings(selector: Selector = js.native): JQuery = js.native
/** Reduce the set of matched elements to a subset specified by a range of indices. Including `start`, without `end`.
* See: jQuery Docs */
@@ -583,11 +583,11 @@ trait JQuery extends js.Object {
/** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */
- def trigger(event: String | JQueryEvent): JQuery = js.native
+ def trigger(event: EventName | JQueryEvent): JQuery = js.native
/** Execute all handlers attached to an element for an event.
* See: jQuery Docs */
- def triggerHandler(event: String | JQueryEvent): JQuery = js.native
+ def triggerHandler(event: EventName | JQueryEvent): JQuery = js.native
/** Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
* See: jQuery Docs */
@@ -629,15 +629,15 @@ object JQuery {
def unregister(): Unit
}
- case class CallbackParameters(once: Boolean, selector: String, data: js.Any)
- case class CallbackRegistrationRef(event: String, callback: JQueryCallback, registration: CallbackRegistration)
+ case class CallbackParameters(once: Boolean, selector: Selector, data: js.Any)
+ case class CallbackRegistrationRef(event: EventName, callback: JQueryCallback, registration: CallbackRegistration)
private val registrations: mutable.Map[Element, mutable.Buffer[CallbackRegistrationRef]] = mutable.Map[Element, mutable.Buffer[CallbackRegistrationRef]]()
implicit class JQueryWrapper(private val jquery: JQuery) {
import js.JSConverters._
- class OnCallbackRegistration(event: String, callback: JQueryCallback,
+ class OnCallbackRegistration(event: EventName, callback: JQueryCallback,
reg: (ThisFunction1[Element, JQueryEvent, Any]) => Any,
unreg: (String, ThisFunction1[Element, JQueryEvent, Any]) => js.Any = (event, c) => jquery.asInstanceOf[js.Dynamic].off(event, c))
extends CallbackRegistration {
@@ -1038,63 +1038,63 @@ object JQuery {
/** Attach an event handler function for one or more events to the selected elements.
* See: jQuery Docs */
- def on(event: String, callback: JQueryCallback): JQuery = {
+ def on(event: EventName, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(false, null, null))
jquery
}
/** Attach an event handler function for one or more events to the selected elements.
* See: jQuery Docs */
- def on(event: String, data: js.Any, callback: JQueryCallback): JQuery = {
+ def on(event: EventName, data: js.Any, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(false, null, data))
jquery
}
/** Attach an event handler function for one or more events to the selected elements.
* See: jQuery Docs */
- def on(event: String, selector: String, callback: JQueryCallback): JQuery = {
+ def on(event: EventName, selector: Selector, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(false, selector, null))
jquery
}
/** Attach an event handler function for one or more events to the selected elements.
* See: jQuery Docs */
- def on(event: String, selector: String, data: js.Any, callback: JQueryCallback): JQuery = {
+ def on(event: EventName, selector: Selector, data: js.Any, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(false, selector, data))
jquery
}
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
* See: jQuery Docs */
- def one(event: String, callback: JQueryCallback): JQuery = {
+ def one(event: EventName, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(true, null, null))
jquery
}
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
* See: jQuery Docs */
- def one(event: String, data: js.Any, callback: JQueryCallback): JQuery = {
+ def one(event: EventName, data: js.Any, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(true, null, data))
jquery
}
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
* See: jQuery Docs */
- def one(event: String, selector: String, callback: JQueryCallback): JQuery = {
+ def one(event: EventName, selector: Selector, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(true, selector, null))
jquery
}
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
* See: jQuery Docs */
- def one(event: String, selector: String, data: js.Any, callback: JQueryCallback): JQuery = {
+ def one(event: EventName, selector: Selector, data: js.Any, callback: JQueryCallback): JQuery = {
separateCallbacks(event, callback, new CallbackParameters(true, selector, data))
jquery
}
/** Remove an event handler.
* See: jQuery Docs */
- def off(event: String, callback: JQueryCallback): JQuery = {
+ def off(event: EventName, callback: JQueryCallback): JQuery = {
jquery.asInstanceOf[js.Dynamic].toArray().asInstanceOf[js.Array[Element]]
.foreach( el => {
if (registrations.contains(el)) {
@@ -1114,7 +1114,7 @@ object JQuery {
jquery
}
- private def separateCallbacks(event: String, callback: JQueryCallback, params: CallbackParameters): Unit = {
+ private def separateCallbacks(event: EventName, callback: JQueryCallback, params: CallbackParameters): Unit = {
type ThisFunctionCallback = ThisFunction1[Element, JQueryEvent, Any]
@@ -1136,7 +1136,7 @@ object JQuery {
}))
}
- private def collectRegistration(event: String, callback: JQueryCallback, el: Element, index: Int, params: CallbackParameters, reg: CallbackRegistration) = {
+ private def collectRegistration(event: EventName, callback: JQueryCallback, el: Element, index: Int, params: CallbackParameters, reg: CallbackRegistration) = {
val jqueryRegs: mutable.Buffer[CallbackRegistrationRef] = registrations.getOrElse(el, mutable.Buffer[CallbackRegistrationRef]())
jqueryRegs += CallbackRegistrationRef(event, callback, reg)
registrations.update(el, jqueryRegs)
@@ -1322,22 +1322,22 @@ object JQuery {
/** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */
- def trigger(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery =
+ def trigger(event: EventName | JQueryEvent, extraParams: Map[String, Any]): JQuery =
jquery.asInstanceOf[js.Dynamic].trigger(event.asInstanceOf[js.Dynamic], extraParams.toJSDictionary).asInstanceOf[JQuery]
/** Execute all handlers and behaviors attached to the matched elements for the given event type.
* See: jQuery Docs */
- def trigger(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery =
+ def trigger(event: EventName | JQueryEvent, extraParams: Seq[Any]): JQuery =
jquery.asInstanceOf[js.Dynamic].trigger(event.asInstanceOf[js.Dynamic], extraParams.toJSArray).asInstanceOf[JQuery]
/** Execute all handlers attached to an element for an event.
* See: jQuery Docs */
- def triggerHandler(event: String | JQueryEvent, extraParams: Map[String, Any]): JQuery =
+ def triggerHandler(event: EventName | JQueryEvent, extraParams: Map[String, Any]): JQuery =
jquery.asInstanceOf[js.Dynamic].triggerHandler(event.asInstanceOf[js.Dynamic], extraParams.toJSDictionary).asInstanceOf[JQuery]
/** Execute all handlers attached to an element for an event.
* See: jQuery Docs */
- def triggerHandler(event: String | JQueryEvent, extraParams: Seq[Any]): JQuery =
+ def triggerHandler(event: EventName | JQueryEvent, extraParams: Seq[Any]): JQuery =
jquery.asInstanceOf[js.Dynamic].triggerHandler(event.asInstanceOf[js.Dynamic], extraParams.toJSArray).asInstanceOf[JQuery]
/** Set the value of each element in the set of matched elements.
diff --git a/src/main/scala/io/udash/wrappers/jquery/package.scala b/src/main/scala/io/udash/wrappers/jquery/package.scala
index 9ad7299..16a83bd 100644
--- a/src/main/scala/io/udash/wrappers/jquery/package.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/package.scala
@@ -9,6 +9,7 @@ package object jquery {
/** See: jQuery Docs */
type Selector = String
type EasingFunction = String
+ type EventName = String
type JQueryCallback = (Element, JQueryEvent) => Any
def jQ: JQueryStatic = js.Dynamic.global.jQuery.asInstanceOf[JQueryStatic]
diff --git a/src/main/scala/io/udash/wrappers/jquery/utils.scala b/src/main/scala/io/udash/wrappers/jquery/utils.scala
index e584afc..4c18fdb 100644
--- a/src/main/scala/io/udash/wrappers/jquery/utils.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/utils.scala
@@ -37,38 +37,63 @@ case class AnimationOptions(duration: Option[Int] = None, easing: Option[EasingF
/** Easing functions specify the speed at which an animation progresses at different points within the animation.
* See: jQuery Docs */
object EasingFunction {
- val linear = "linear"
- val swing = "swing"
+ val linear: EasingFunction = "linear"
+ val swing: EasingFunction = "swing"
/* Require jQuery UI */
- val easeInQuad = "easeInQuad"
- val easeOutQuad = "easeOutQuad"
- val easeInOutQuad = "easeInOutQuad"
- val easeInCubic = "easeInCubic"
- val easeOutCubic = "easeOutCubic"
- val easeInOutCubic = "easeInOutCubic"
- val easeInQuart = "easeInQuart"
- val easeOutQuart = "easeOutQuart"
- val easeInOutQuart = "easeInOutQuart"
- val easeInQuint = "easeInQuint"
- val easeOutQuint = "easeOutQuint"
- val easeInOutQuint = "easeInOutQuint"
- val easeInExpo = "easeInExpo"
- val easeOutExpo = "easeOutExpo"
- val easeInOutExpo = "easeInOutExpo"
- val easeInSine = "easeInSine"
- val easeOutSine = "easeOutSine"
- val easeInOutSine = "easeInOutSine"
- val easeInCirc = "easeInCirc"
- val easeOutCirc = "easeOutCirc"
- val easeInOutCirc = "easeInOutCirc"
- val easeInElastic = "easeInElastic"
- val easeOutElastic = "easeOutElastic"
- val easeInOutElastic = "easeInOutElastic"
- val easeInBack = "easeInBack"
- val easeOutBack = "easeOutBack"
- val easeInOutBack = "easeInOutBack"
- val easeInBounce = "easeInBounce"
- val easeOutBounce = "easeOutBounce"
- val easeInOutBounce = "easeInOutBounce"
+ val easeInQuad: EasingFunction = "easeInQuad"
+ val easeOutQuad: EasingFunction = "easeOutQuad"
+ val easeInOutQuad: EasingFunction = "easeInOutQuad"
+ val easeInCubic: EasingFunction = "easeInCubic"
+ val easeOutCubic: EasingFunction = "easeOutCubic"
+ val easeInOutCubic: EasingFunction = "easeInOutCubic"
+ val easeInQuart: EasingFunction = "easeInQuart"
+ val easeOutQuart: EasingFunction = "easeOutQuart"
+ val easeInOutQuart: EasingFunction = "easeInOutQuart"
+ val easeInQuint: EasingFunction = "easeInQuint"
+ val easeOutQuint: EasingFunction = "easeOutQuint"
+ val easeInOutQuint: EasingFunction = "easeInOutQuint"
+ val easeInExpo: EasingFunction = "easeInExpo"
+ val easeOutExpo: EasingFunction = "easeOutExpo"
+ val easeInOutExpo: EasingFunction = "easeInOutExpo"
+ val easeInSine: EasingFunction = "easeInSine"
+ val easeOutSine: EasingFunction = "easeOutSine"
+ val easeInOutSine: EasingFunction = "easeInOutSine"
+ val easeInCirc: EasingFunction = "easeInCirc"
+ val easeOutCirc: EasingFunction = "easeOutCirc"
+ val easeInOutCirc: EasingFunction = "easeInOutCirc"
+ val easeInElastic: EasingFunction = "easeInElastic"
+ val easeOutElastic: EasingFunction = "easeOutElastic"
+ val easeInOutElastic: EasingFunction = "easeInOutElastic"
+ val easeInBack: EasingFunction = "easeInBack"
+ val easeOutBack: EasingFunction = "easeOutBack"
+ val easeInOutBack: EasingFunction = "easeInOutBack"
+ val easeInBounce: EasingFunction = "easeInBounce"
+ val easeOutBounce: EasingFunction = "easeOutBounce"
+ val easeInOutBounce: EasingFunction = "easeInOutBounce"
}
+
+object EventName {
+ val blur: EventName = "blur"
+ val change: EventName = "change"
+ val click: EventName = "click"
+ val contextMenu: EventName = "contextmenu"
+ val dblClick: EventName = "dblclick"
+ val focus: EventName = "focus"
+ val focusIn: EventName = "focusin"
+ val focusOut: EventName = "focusout"
+ val keyDown: EventName = "keydown"
+ val keyPress: EventName = "keypress"
+ val keyUp: EventName = "keyup"
+ val mouseDown: EventName = "mousedown"
+ val mouseEnter: EventName = "mouseenter"
+ val mouseLeave: EventName = "mouseleave"
+ val mouseMove: EventName = "mousemove"
+ val mouseOut: EventName = "mouseout"
+ val mouseover: EventName = "mouseover"
+ val mouseUp: EventName = "mouseup"
+ val resize: EventName = "resize"
+ val scroll: EventName = "scroll"
+ val select: EventName = "select"
+ val submit: EventName = "submit"
+}
\ No newline at end of file
From 33f1399f96a0a3ac2ef6afe94bb85bf6ef46177d Mon Sep 17 00:00:00 2001
From: Cyrille Dejemeppe
Date: Wed, 1 Aug 2018 17:02:33 +0200
Subject: [PATCH 14/80] Fixing the return type of outerHeight and outerWidth
---
src/main/scala/io/udash/wrappers/jquery/JQuery.scala | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index f3c3fa5..1f2b6cc 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -397,9 +397,9 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def offsetParent(): JQuery = js.native
- /** Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without "px") representation of the value or null if called on an empty set of elements.
+ /** Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without "px") representation of the value or undef if called on an empty set of elements.
* See: jQuery Docs */
- def outerHeight(includeMargin: Boolean = js.native): Double = js.native
+ def outerHeight(includeMargin: Boolean = js.native): js.UndefOr[Double] = js.native
/** Set the CSS outer Height of each element in the set of matched elements.
* See: jQuery Docs */
@@ -407,7 +407,7 @@ trait JQuery extends js.Object {
/** Get the current computed width for the first element in the set of matched elements, including padding and border.
* See: jQuery Docs */
- def outerWidth(includeMargin: Boolean = js.native): Double = js.native
+ def outerWidth(includeMargin: Boolean = js.native): js.UndefOr[Double] = js.native
/** Set the CSS outer width of each element in the set of matched elements.
* See: jQuery Docs */
From 75d9b80f0cb47a8bce6e308cde44d0ebdffb563e Mon Sep 17 00:00:00 2001
From: Cyrille Dejemeppe
Date: Thu, 2 Aug 2018 12:36:51 +0200
Subject: [PATCH 15/80] Implementing wrapper functions for outerWidth and
outerHeight in `JQueryWrapper`
---
.../scala/io/udash/wrappers/jquery/JQuery.scala | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index 1f2b6cc..5aa70c9 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -399,7 +399,7 @@ trait JQuery extends js.Object {
/** Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without "px") representation of the value or undef if called on an empty set of elements.
* See: jQuery Docs */
- def outerHeight(includeMargin: Boolean = js.native): js.UndefOr[Double] = js.native
+ def outerHeight(includeMargin: Boolean = js.native): Double = js.native
/** Set the CSS outer Height of each element in the set of matched elements.
* See: jQuery Docs */
@@ -407,7 +407,7 @@ trait JQuery extends js.Object {
/** Get the current computed width for the first element in the set of matched elements, including padding and border.
* See: jQuery Docs */
- def outerWidth(includeMargin: Boolean = js.native): js.UndefOr[Double] = js.native
+ def outerWidth(includeMargin: Boolean = js.native): Double = js.native
/** Set the CSS outer width of each element in the set of matched elements.
* See: jQuery Docs */
@@ -1142,11 +1142,23 @@ object JQuery {
registrations.update(el, jqueryRegs)
}
+ /** Get the current computed height for the first element in the set of matched elements, including padding,
+ * border, and optionally margin. Returns a number (without "px") representation of the value or undef
+ * if called on an empty set of elements.
+ * See: jQuery Docs */
+ def outerHeight(includeMargin: Boolean = false): Option[Double] =
+ jquery.asInstanceOf[js.Dynamic].outerHeight(includeMargin).asInstanceOf[UndefOr[Double]].toOption
+
/** Set the CSS outer Height of each element in the set of matched elements.
* See: jQuery Docs */
def outerHeight(function: (Element, Int, Double) => Double): JQuery =
jquery.asInstanceOf[js.Dynamic].outerHeight(js.ThisFunction.fromFunction3(function)).asInstanceOf[JQuery]
+ /** Get the current computed width for the first element in the set of matched elements, including padding and border.
+ * See: jQuery Docs */
+ def outerWidth(includeMargin: Boolean = false): Option[Double] =
+ jquery.asInstanceOf[js.Dynamic].outerWidth(includeMargin).asInstanceOf[UndefOr[Double]].toOption
+
/** Set the CSS outer width of each element in the set of matched elements.
* See: jQuery Docs */
def outerWidth(function: (Element, Int, Double) => Double): JQuery =
From 31788bc9b47341fd5c38bbf2e74aa4a2351c7f89 Mon Sep 17 00:00:00 2001
From: Cyrille Dejemeppe
Date: Thu, 2 Aug 2018 13:37:19 +0200
Subject: [PATCH 16/80] Removing outerWidth and outerHeight from JQuery trait
---
src/main/scala/io/udash/wrappers/jquery/JQuery.scala | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index 5aa70c9..61ab8f2 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -397,18 +397,10 @@ trait JQuery extends js.Object {
* See: jQuery Docs */
def offsetParent(): JQuery = js.native
- /** Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without "px") representation of the value or undef if called on an empty set of elements.
- * See: jQuery Docs */
- def outerHeight(includeMargin: Boolean = js.native): Double = js.native
-
/** Set the CSS outer Height of each element in the set of matched elements.
* See: jQuery Docs */
def outerHeight(value: Int | Double | String): JQuery = js.native
- /** Get the current computed width for the first element in the set of matched elements, including padding and border.
- * See: jQuery Docs */
- def outerWidth(includeMargin: Boolean = js.native): Double = js.native
-
/** Set the CSS outer width of each element in the set of matched elements.
* See: jQuery Docs */
def outerWidth(value: Int | Double | String): JQuery = js.native
From 760387092df9c134abbf7e29d7f6335dc0e27fa5 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Fri, 3 Aug 2018 07:47:51 +0200
Subject: [PATCH 17/80] Remove direct JS dependencies
---
README.md | 19 +++++++++++++++++--
build.sbt | 7 ++-----
example/build.sbt | 3 ++-
example/project/Dependencies.scala | 4 ++++
example/project/build.properties | 2 +-
example/project/plugins.sbt | 2 +-
project/build.properties | 2 +-
project/plugins.sbt | 2 +-
8 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 9918489..a716941 100644
--- a/README.md
+++ b/README.md
@@ -4,10 +4,10 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program
## Usage
-Add the following to your SBT build:
+Add the following dependency to your SBT build:
```scala
-libraryDependencies += "io.udash" %%% "udash-jquery" % "1.1.0"
+libraryDependencies += "io.udash" %%% "udash-jquery" % "2.0.0"
```
then import the jQuery package:
@@ -16,6 +16,21 @@ then import the jQuery package:
import io.udash.wrappers.jquery._
```
+Since version `2.0.0` the wrapper does not force JS dependency on jQuery. You have to
+add it manually by:
+ * explicit link in your `index.html`.
+ ```html
+
+ ```
+ * [Scala.js dependency](http://www.scala-js.org/doc/project/dependencies.html).
+ ```scala
+ jsDependencies +=
+ "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
+ ```
+
+
## Examples
```scala
diff --git a/build.sbt b/build.sbt
index 090b491..251534e 100644
--- a/build.sbt
+++ b/build.sbt
@@ -5,7 +5,7 @@ import org.scalajs.jsenv.selenium.SeleniumJSEnv
name := "udash-jquery"
inThisBuild(Seq(
- version := "1.2.0",
+ version := "2.0.0",
organization := "io.udash",
scalaVersion := "2.12.6",
crossScalaVersions := Seq("2.11.12", "2.12.6"),
@@ -58,14 +58,11 @@ val commonJSSettings = Seq(
)
libraryDependencies ++= Seq(
- "org.scala-js" %%% "scalajs-dom" % "0.9.5",
+ "org.scala-js" %%% "scalajs-dom" % "0.9.6",
"org.scalatest" %%% "scalatest" % "3.0.5" % Test,
"com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
)
-jsDependencies +=
- "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
-
lazy val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(commonJSSettings)
diff --git a/example/build.sbt b/example/build.sbt
index a6221fe..fe054fe 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -1,7 +1,7 @@
name := "jquery-demo"
inThisBuild(Seq(
- version := "1.2.0",
+ version := "2.0.0",
organization := "io.udash",
scalaVersion := "2.12.6",
scalacOptions ++= Seq(
@@ -31,6 +31,7 @@ val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
.settings(
libraryDependencies ++= Dependencies.deps.value,
+ jsDependencies ++= Dependencies.jsDeps.value,
/* move these files out of target/. */
Compile / fullOptJS / crossTarget := generatedDir,
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 48bac51..82f3448 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -9,4 +9,8 @@ object Dependencies {
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
+
+ val jsDeps = Def.setting(Seq[JSModuleID](
+ "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
+ )
}
\ No newline at end of file
diff --git a/example/project/build.properties b/example/project/build.properties
index c3e3abc..84d4f68 100644
--- a/example/project/build.properties
+++ b/example/project/build.properties
@@ -1 +1 @@
-sbt.version = 1.1.4
\ No newline at end of file
+sbt.version = 1.2.0
\ No newline at end of file
diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt
index 293d135..a6a5fe1 100644
--- a/example/project/plugins.sbt
+++ b/example/project/plugins.sbt
@@ -1,3 +1,3 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
\ No newline at end of file
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
\ No newline at end of file
diff --git a/project/build.properties b/project/build.properties
index c3e3abc..84d4f68 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version = 1.1.4
\ No newline at end of file
+sbt.version = 1.2.0
\ No newline at end of file
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 953c2a1..9ffbb26 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,4 +2,4 @@ logLevel := Level.Warn
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
From 2f2bfafa504fddb035fb7787aa2bcf2a4a0c16f5 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Fri, 3 Aug 2018 08:02:49 +0200
Subject: [PATCH 18/80] Add JS dependency for tests
---
build.sbt | 3 +++
example/project/Dependencies.scala | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/build.sbt b/build.sbt
index 251534e..9cde657 100644
--- a/build.sbt
+++ b/build.sbt
@@ -63,6 +63,9 @@ libraryDependencies ++= Seq(
"com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
)
+jsDependencies +=
+ "org.webjars" % "jquery" % "3.3.1" % Test / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
+
lazy val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(commonJSSettings)
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 82f3448..060c510 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -3,7 +3,7 @@ import sbt._
object Dependencies {
val udashCoreVersion = "0.6.1"
- val udashJQueryVersion = "1.2.0"
+ val udashJQueryVersion = "2.0.0"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
@@ -12,5 +12,5 @@ object Dependencies {
val jsDeps = Def.setting(Seq[JSModuleID](
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
- )
+ ))
}
\ No newline at end of file
From 2f1ab81bf2d811928250718098d69ef9a2f1a871 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Fri, 3 Aug 2018 08:18:07 +0200
Subject: [PATCH 19/80] Fix example build
---
example/project/Dependencies.scala | 1 +
1 file changed, 1 insertion(+)
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 060c510..1c72400 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,4 +1,5 @@
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
+import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt._
object Dependencies {
From db9f436772869c38b84bd07448994c9ad7a538af Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Fri, 3 Aug 2018 08:25:40 +0200
Subject: [PATCH 20/80] Publish only for the current Scala version for demo
compilation
---
.travis.yml | 2 +-
example/build.sbt | 1 +
example/project/Dependencies.scala | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 632188e..92b85a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,5 +23,5 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION test
- - sbt ++$TRAVIS_SCALA_VERSION +publishLocal
+ - sbt ++$TRAVIS_SCALA_VERSION publishLocal
- cd example && sbt ++$TRAVIS_SCALA_VERSION compile fullOptJS
\ No newline at end of file
diff --git a/example/build.sbt b/example/build.sbt
index fe054fe..66c5314 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -4,6 +4,7 @@ inThisBuild(Seq(
version := "2.0.0",
organization := "io.udash",
scalaVersion := "2.12.6",
+ crossScalaVersions := Seq("2.11.12", "2.12.6"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 1c72400..44cffc7 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -11,7 +11,7 @@ object Dependencies {
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
- val jsDeps = Def.setting(Seq[JSModuleID](
+ val jsDeps = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID](
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
))
}
\ No newline at end of file
From adbaa2da80ea114a860d7c960ddac59dde78bb9e Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Fri, 3 Aug 2018 09:04:22 +0200
Subject: [PATCH 21/80] Readme improvement
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a716941..c62da25 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ add it manually by:
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
```
- * [Scala.js dependency](http://www.scala-js.org/doc/project/dependencies.html).
+ * or a [Scala.js dependency](http://www.scala-js.org/doc/project/dependencies.html).
```scala
jsDependencies +=
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
From 96c7cbc30e1db2f1dde4358795755e8d98f0728b Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Mon, 24 Sep 2018 13:02:02 +0200
Subject: [PATCH 22/80] Add missing `param` method
---
.../io/udash/wrappers/jquery/JQueryStatic.scala | 12 +++++++++---
.../wrappers/jquery_test/MiscellaneousTest.scala | 5 +++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
index 7044e8f..1d29cf6 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQueryStatic.scala
@@ -129,17 +129,23 @@ trait JQueryStatic extends js.Object {
* See: jQuery Docs */
def isXMLDoc[T](el: js.Any): Boolean = js.native
+ /** Create a serialized representation of an array, a plain object, or a jQuery object suitable
+ * for use in a URL query string or Ajax request. In case a jQuery object is passed, it should
+ * contain input elements with name/value properties.
+ * See: jQuery Docs */
+ def param(obj: js.Array[js.Any] | js.Object | JQuery, traditional: Boolean = js.native): String = js.native
+
/** Parses a string into an array of DOM nodes.
- * See: jQuery Docs */
+ * See: jQuery Docs */
def parseHTML(data: String, context: Element = js.native, keepScripts: Boolean = js.native): js.Array[Element] = js.native
/** Takes a well-formed JSON string and returns the resulting JavaScript value.
- * See: jQuery Docs */
+ * See: jQuery Docs */
@deprecated("Since all the browsers supported by jQuery 3.0 support the native JSON.parse() method, we are deprecating jQuery.parseJSON().", "1.1.0")
def parseJSON(json: String): js.Any = js.native
/** Parses a string into an XML document.
- * See: jQuery Docs */
+ * See: jQuery Docs */
def parseXML(xml: String): js.Dynamic = js.native
/** Load data from the server using a HTTP POST request.
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala
index c2630c7..95b3953 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala
@@ -43,6 +43,11 @@ class MiscellaneousTest extends WordSpec with Matchers {
selection.index(jQ(el3)) should be(2)
selection.index(el4) should be(-1)
}
+
+ "serialize objects to URL query string" in {
+ import scala.scalajs.js, js.JSConverters._
+ jQ.param(js.Dynamic.literal("a" -> Seq(1, 2, 3).toJSArray, "b" -> "c")) should be("a%5B%5D=1&a%5B%5D=2&a%5B%5D=3&b=c")
+ }
}
}
From bcdee247a21164206953b3882620d499fba787d8 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Mon, 24 Sep 2018 13:14:53 +0200
Subject: [PATCH 23/80] Release 2.0.1
---
build.sbt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.sbt b/build.sbt
index 9cde657..2fbe661 100644
--- a/build.sbt
+++ b/build.sbt
@@ -5,7 +5,7 @@ import org.scalajs.jsenv.selenium.SeleniumJSEnv
name := "udash-jquery"
inThisBuild(Seq(
- version := "2.0.0",
+ version := "2.0.1",
organization := "io.udash",
scalaVersion := "2.12.6",
crossScalaVersions := Seq("2.11.12", "2.12.6"),
From b07abaabf6ef1440cd2384f78d3bec4946e76fbf Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Tue, 30 Oct 2018 14:33:22 +0100
Subject: [PATCH 24/80] Publish jQuery wrapper as CommonJS module with global
scope fallback
---
.travis.yml | 2 +-
build.sbt | 52 ++++++++-----------
example/README.md | 9 ++++
example/build.sbt | 39 ++++++++++++--
example/project/Dependencies.scala | 2 +-
example/project/build.properties | 2 +-
example/project/plugins.sbt | 3 +-
example/src/main/assets/index-bundler.html | 11 ++++
.../assets/{index.html => index-global.html} | 2 +-
project/build.properties | 2 +-
project/plugins.sbt | 5 +-
.../io/udash/wrappers/jquery/package.scala | 7 ++-
.../io/udash/wrappers/jquery/utils.scala | 18 ++++---
13 files changed, 102 insertions(+), 52 deletions(-)
create mode 100644 example/src/main/assets/index-bundler.html
rename example/src/main/assets/{index.html => index-global.html} (83%)
diff --git a/.travis.yml b/.travis.yml
index 92b85a2..6357a9d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,4 +24,4 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION test
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- - cd example && sbt ++$TRAVIS_SCALA_VERSION compile fullOptJS
\ No newline at end of file
+ - cd example && sbt ++$TRAVIS_SCALA_VERSION compile jquery-demo/fullOptJS jquery-bundler-demo/compileStatics
\ No newline at end of file
diff --git a/build.sbt b/build.sbt
index 2fbe661..75b940b 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,14 +1,12 @@
import org.openqa.selenium.chrome.ChromeOptions
-import org.openqa.selenium.remote.DesiredCapabilities
-import org.scalajs.jsenv.selenium.SeleniumJSEnv
name := "udash-jquery"
inThisBuild(Seq(
- version := "2.0.1",
+ version := "3.0.0-SNAPSHOT",
organization := "io.udash",
- scalaVersion := "2.12.6",
- crossScalaVersions := Seq("2.11.12", "2.12.6"),
+ scalaVersion := "2.12.7",
+ crossScalaVersions := Seq("2.11.12", "2.12.7"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -20,35 +18,25 @@ inThisBuild(Seq(
"-language:experimental.macros",
"-Xfuture",
"-Xfatal-warnings",
- "-Xlint:_",
+ "-Xlint:_"
),
scalacOptions ++= {
- if (CrossVersion.partialVersion((root / scalaVersion).value).contains((2, 12))) Seq(
+ if (scalaBinaryVersion.value == "2.12") Seq(
"-Ywarn-unused:_,-explicits,-implicits",
"-Ybackend-parallelism", "4",
"-Ycache-plugin-class-loader:last-modified",
"-Ycache-macro-class-loader:last-modified"
) else Seq.empty
- },
+ }
))
-// Settings for JS tests run in browser
-val browserCapabilities: DesiredCapabilities = {
- // requires ChromeDriver: https://sites.google.com/a/chromium.org/chromedriver/
- val capabilities = DesiredCapabilities.chrome()
- capabilities.setCapability(ChromeOptions.CAPABILITY, {
- val options = new ChromeOptions()
- options.addArguments("--headless", "--disable-gpu")
- options
- })
- capabilities
-}
-
val commonJSSettings = Seq(
Compile / emitSourceMaps := true,
Test / parallelExecution := false,
Test / scalaJSStage := FastOptStage,
- Test / jsEnv := new SeleniumJSEnv(browserCapabilities),
+ // ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
+ // https://github.com/scalacenter/scalajs-bundler/issues/89
+ // Test / jsEnv := new SeleniumJSEnv(browserCapabilities),
scalacOptions += {
val localDir = (ThisBuild / baseDirectory).value.toURI.toString
val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery"
@@ -57,15 +45,17 @@ val commonJSSettings = Seq(
scalacOptions += "-P:scalajs:sjsDefinedByDefault",
)
-libraryDependencies ++= Seq(
- "org.scala-js" %%% "scalajs-dom" % "0.9.6",
- "org.scalatest" %%% "scalatest" % "3.0.5" % Test,
- "com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
-)
+lazy val root = project.in(file("."))
+ .enablePlugins(ScalaJSBundlerPlugin)
+ .settings(
+ commonJSSettings,
-jsDependencies +=
- "org.webjars" % "jquery" % "3.3.1" % Test / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
+ libraryDependencies ++= Seq(
+ "org.scala-js" %%% "scalajs-dom" % "0.9.6",
+ "org.scalatest" %%% "scalatest" % "3.0.5" % Test,
+ "com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
+ ),
-lazy val root = project.in(file("."))
- .enablePlugins(ScalaJSPlugin)
- .settings(commonJSSettings)
+ Compile / npmDependencies += "jquery" -> "3.3.1",
+ Test / requiresDOM := true
+ )
diff --git a/example/README.md b/example/README.md
index bacbfad..94fe2eb 100644
--- a/example/README.md
+++ b/example/README.md
@@ -1,4 +1,13 @@
+The `build.sbt` file contains two configurations:
+* `jquery-demo` uses global jQuery dependency.
+* `jquery-bundler-demo` uses `ScalaJSBundlerPlugin` in order to manage module dependencies.
+
### How to use?
Run `sbt fastOptJS` or `sbt fullOptJS` to compile this demo. You can find all generated files
in the `generated` directory. Open `index.html` in your browser.
+
+### How to use? (ScalaJSBundlerPlugin)
+
+Run `sbt compileStatics` to compile this demo. You can find all generated files
+in the `generated` directory. Open `index.html` in your browser.
\ No newline at end of file
diff --git a/example/build.sbt b/example/build.sbt
index 66c5314..c218e7d 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -1,10 +1,10 @@
name := "jquery-demo"
inThisBuild(Seq(
- version := "2.0.0",
+ version := "3.0.0",
organization := "io.udash",
- scalaVersion := "2.12.6",
- crossScalaVersions := Seq("2.11.12", "2.12.6"),
+ scalaVersion := "2.12.7",
+ crossScalaVersions := Seq("2.11.12", "2.12.7"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -18,7 +18,7 @@ inThisBuild(Seq(
"-Xlint:_",
),
scalacOptions ++= {
- if (CrossVersion.partialVersion((`jquery-demo` / scalaVersion).value).contains((2, 12))) Seq(
+ if (scalaBinaryVersion.value == "2.12") Seq(
"-Ywarn-unused:_,-explicits,-implicits",
"-Ybackend-parallelism", "4",
"-Ycache-plugin-class-loader:last-modified",
@@ -28,6 +28,7 @@ inThisBuild(Seq(
))
val generatedDir = file("generated")
+val compileStatics = taskKey[Unit]("Compiles all static files.")
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
.settings(
@@ -47,7 +48,7 @@ val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
copyAssets := {
IO.copyFile(
- sourceDirectory.value / "main/assets/index.html",
+ sourceDirectory.value / "main/assets/index-global.html",
generatedDir / "index.html"
)
},
@@ -60,4 +61,32 @@ val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
(Compile / packageJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js",
Compile / packageMinifiedJSDependencies / artifactPath :=
(Compile / packageMinifiedJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js"
+ )
+
+val `jquery-bundler-demo` = project.in(file("."))
+ .enablePlugins(ScalaJSBundlerPlugin)
+ .settings(
+ libraryDependencies ++= Dependencies.deps.value,
+
+ Compile / scalaJSUseMainModuleInitializer := true,
+
+ copyAssets := {
+ IO.copyFile(
+ sourceDirectory.value / "main/assets/index-bundler.html",
+ generatedDir / "index.html"
+ )
+ },
+
+ compileStatics := {
+ val sjsFileName = (Compile / fastOptJS).value.data.name.stripSuffix(".js")
+ IO.copyFile(
+ (Compile / npmUpdate / crossTarget).value / s"$sjsFileName-bundle.js",
+ generatedDir / "scripts/frontend.js"
+ )
+ IO.copyFile(
+ (Compile / npmUpdate / crossTarget).value / s"$sjsFileName-bundle.js.map",
+ generatedDir / "scripts/frontend.js.map"
+ )
+ },
+ compileStatics := compileStatics.dependsOn(Compile / fastOptJS / webpack, copyAssets).value,
)
\ No newline at end of file
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 44cffc7..821aaeb 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -4,7 +4,7 @@ import sbt._
object Dependencies {
val udashCoreVersion = "0.6.1"
- val udashJQueryVersion = "2.0.0"
+ val udashJQueryVersion = "3.0.0-SNAPSHOT"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
diff --git a/example/project/build.properties b/example/project/build.properties
index 84d4f68..e71780d 100644
--- a/example/project/build.properties
+++ b/example/project/build.properties
@@ -1 +1 @@
-sbt.version = 1.2.0
\ No newline at end of file
+sbt.version = 1.2.6
\ No newline at end of file
diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt
index a6a5fe1..4ff27ce 100644
--- a/example/project/plugins.sbt
+++ b/example/project/plugins.sbt
@@ -1,3 +1,4 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
\ No newline at end of file
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.1")
\ No newline at end of file
diff --git a/example/src/main/assets/index-bundler.html b/example/src/main/assets/index-bundler.html
new file mode 100644
index 0000000..5f8226d
--- /dev/null
+++ b/example/src/main/assets/index-bundler.html
@@ -0,0 +1,11 @@
+
+
+
+
+ jquery-demo - ScalaJSBundlerPlugin demo
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/assets/index.html b/example/src/main/assets/index-global.html
similarity index 83%
rename from example/src/main/assets/index.html
rename to example/src/main/assets/index-global.html
index fd8b57a..13da206 100644
--- a/example/src/main/assets/index.html
+++ b/example/src/main/assets/index-global.html
@@ -2,7 +2,7 @@
- jquery-demo
+ jquery-demo - global scope
diff --git a/project/build.properties b/project/build.properties
index 84d4f68..e71780d 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version = 1.2.0
\ No newline at end of file
+sbt.version = 1.2.6
\ No newline at end of file
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 9ffbb26..7135c5b 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,5 +1,6 @@
logLevel := Level.Warn
-libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"
+libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.1")
diff --git a/src/main/scala/io/udash/wrappers/jquery/package.scala b/src/main/scala/io/udash/wrappers/jquery/package.scala
index 16a83bd..cf43fa1 100644
--- a/src/main/scala/io/udash/wrappers/jquery/package.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/package.scala
@@ -3,6 +3,7 @@ package io.udash.wrappers
import org.scalajs.dom._
import scala.scalajs.js
+import scala.scalajs.js.annotation.JSImport
/** All docs are quoted from jQuery API docs. */
package object jquery {
@@ -12,5 +13,7 @@ package object jquery {
type EventName = String
type JQueryCallback = (Element, JQueryEvent) => Any
- def jQ: JQueryStatic = js.Dynamic.global.jQuery.asInstanceOf[JQueryStatic]
-}
+ @js.native
+ @JSImport("jquery", JSImport.Default, "$")
+ object jQ extends JQueryStatic
+}
\ No newline at end of file
diff --git a/src/main/scala/io/udash/wrappers/jquery/utils.scala b/src/main/scala/io/udash/wrappers/jquery/utils.scala
index 4c18fdb..ac287b1 100644
--- a/src/main/scala/io/udash/wrappers/jquery/utils.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/utils.scala
@@ -12,12 +12,18 @@ sealed trait TopLeftCoords {
case class Position(override val top: Double, override val left: Double) extends TopLeftCoords
case class Offset(override val top: Double, override val left: Double) extends TopLeftCoords
-case class AnimationOptions(duration: Option[Int] = None, easing: Option[EasingFunction] = None, queue: Option[Boolean] = None,
- step: (Int, js.Dynamic) => Any = null, progress: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Int, Int) => Any = null,
- complete: () => Any = null, start: JQueryPromise[js.Function1[js.Any, js.Any], js.Any] => Any = null,
- done: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Boolean) => Any = null,
- fail: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Boolean) => Any = null,
- always: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Boolean) => Any = null) {
+case class AnimationOptions(
+ duration: Option[Int] = None,
+ easing: Option[EasingFunction] = None,
+ queue: Option[Boolean] = None,
+ step: (Int, js.Dynamic) => Any = null,
+ progress: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Int, Int) => Any = null,
+ complete: () => Any = null,
+ start: JQueryPromise[js.Function1[js.Any, js.Any], js.Any] => Any = null,
+ done: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Boolean) => Any = null,
+ fail: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Boolean) => Any = null,
+ always: (JQueryPromise[js.Function1[js.Any, js.Any], js.Any], Boolean) => Any = null
+) {
def toJSDictionary: js.Dictionary[Any] = {
val r = js.Dictionary[Any]()
if (duration.isDefined) r.update("duration", duration.get)
From 64677a4b8a0d5eb330097cace5732f3dc67dd6a9 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Wed, 31 Oct 2018 08:28:57 +0100
Subject: [PATCH 25/80] Improved jQuery demo build configuration: two modules
with shared sources
---
.travis.yml | 4 +-
example/README.md | 8 +--
example/build.sbt | 56 ++++++++++++++-----
.../src/main/assets/index.html} | 0
.../src/main/assets/index.html} | 0
5 files changed, 47 insertions(+), 21 deletions(-)
rename example/{src/main/assets/index-bundler.html => bundler-demo/src/main/assets/index.html} (100%)
rename example/{src/main/assets/index-global.html => global-demo/src/main/assets/index.html} (100%)
diff --git a/.travis.yml b/.travis.yml
index 6357a9d..49f4d8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,7 @@ dist: trusty
jdk: oraclejdk8
scala:
- 2.11.12
- - 2.12.6
+ - 2.12.7
before_script:
- "export DISPLAY=:99.0"
@@ -24,4 +24,4 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION test
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- - cd example && sbt ++$TRAVIS_SCALA_VERSION compile jquery-demo/fullOptJS jquery-bundler-demo/compileStatics
\ No newline at end of file
+ - cd example && sbt ++$TRAVIS_SCALA_VERSION compile jquery-global-demo/fullOptJS jquery-bundler-demo/compileStatics
\ No newline at end of file
diff --git a/example/README.md b/example/README.md
index 94fe2eb..bcb3feb 100644
--- a/example/README.md
+++ b/example/README.md
@@ -4,10 +4,10 @@ The `build.sbt` file contains two configurations:
### How to use?
-Run `sbt fastOptJS` or `sbt fullOptJS` to compile this demo. You can find all generated files
-in the `generated` directory. Open `index.html` in your browser.
+Run `sbt jquery-global-demo/fastOptJS` or `sbt jquery-global-demo/fullOptJS` to compile this demo. You can find all generated files
+in the `generated/global` directory. Open `index.html` in your browser.
### How to use? (ScalaJSBundlerPlugin)
-Run `sbt compileStatics` to compile this demo. You can find all generated files
-in the `generated` directory. Open `index.html` in your browser.
\ No newline at end of file
+Run `sbt jquery-bundler-demo/compileStatics` to compile this demo. You can find all generated files
+in the `generated/bundler` directory. Open `index.html` in your browser.
\ No newline at end of file
diff --git a/example/build.sbt b/example/build.sbt
index c218e7d..64f9a69 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -27,19 +27,20 @@ inThisBuild(Seq(
},
))
-val generatedDir = file("generated")
-val compileStatics = taskKey[Unit]("Compiles all static files.")
+val generatedGlobalDir = file("generated/global")
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
-val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
+val `jquery-global-demo` = project.in(file("global-demo")).enablePlugins(ScalaJSPlugin)
.settings(
libraryDependencies ++= Dependencies.deps.value,
jsDependencies ++= Dependencies.jsDeps.value,
+ sourceDirsSettings(_.getParentFile),
+
/* move these files out of target/. */
- Compile / fullOptJS / crossTarget := generatedDir,
- Compile / fastOptJS / crossTarget := generatedDir,
- Compile / packageJSDependencies / crossTarget := generatedDir,
- Compile / packageMinifiedJSDependencies / crossTarget := generatedDir,
+ Compile / fullOptJS / crossTarget := generatedGlobalDir,
+ Compile / fastOptJS / crossTarget := generatedGlobalDir,
+ Compile / packageJSDependencies / crossTarget := generatedGlobalDir,
+ Compile / packageMinifiedJSDependencies / crossTarget := generatedGlobalDir,
Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value,
Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value,
@@ -48,8 +49,8 @@ val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
copyAssets := {
IO.copyFile(
- sourceDirectory.value / "main/assets/index-global.html",
- generatedDir / "index.html"
+ sourceDirectory.value / "main/assets/index.html",
+ generatedGlobalDir / "index.html"
)
},
@@ -63,17 +64,21 @@ val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
(Compile / packageMinifiedJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js"
)
-val `jquery-bundler-demo` = project.in(file("."))
+val generatedBundlerDir = file("generated/bundler")
+val compileStatics = taskKey[Unit]("Compiles all static files.")
+val `jquery-bundler-demo` = project.in(file("bundler-demo"))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
libraryDependencies ++= Dependencies.deps.value,
+
+ sourceDirsSettings(_.getParentFile),
Compile / scalaJSUseMainModuleInitializer := true,
copyAssets := {
IO.copyFile(
- sourceDirectory.value / "main/assets/index-bundler.html",
- generatedDir / "index.html"
+ sourceDirectory.value / "main/assets/index.html",
+ generatedBundlerDir / "index.html"
)
},
@@ -81,12 +86,33 @@ val `jquery-bundler-demo` = project.in(file("."))
val sjsFileName = (Compile / fastOptJS).value.data.name.stripSuffix(".js")
IO.copyFile(
(Compile / npmUpdate / crossTarget).value / s"$sjsFileName-bundle.js",
- generatedDir / "scripts/frontend.js"
+ generatedBundlerDir / "scripts/frontend.js"
)
IO.copyFile(
(Compile / npmUpdate / crossTarget).value / s"$sjsFileName-bundle.js.map",
- generatedDir / "scripts/frontend.js.map"
+ generatedBundlerDir / "scripts/frontend.js.map"
)
},
compileStatics := compileStatics.dependsOn(Compile / fastOptJS / webpack, copyAssets).value,
- )
\ No newline at end of file
+ )
+
+def mkSourceDirs(base: File, scalaBinary: String, conf: String): Seq[File] = Seq(
+ base / "src" / conf / "scala",
+ base / "src" / conf / s"scala-$scalaBinary",
+ base / "src" / conf / "java"
+)
+
+def mkResourceDirs(base: File, conf: String): Seq[File] = Seq(
+ base / "src" / conf / "resources"
+)
+
+def sourceDirsSettings(baseMapper: File => File) = Seq(
+ Compile / unmanagedSourceDirectories ++=
+ mkSourceDirs(baseMapper(baseDirectory.value), scalaBinaryVersion.value, "main"),
+ Compile / unmanagedResourceDirectories ++=
+ mkResourceDirs(baseMapper(baseDirectory.value), "main"),
+ Test / unmanagedSourceDirectories ++=
+ mkSourceDirs(baseMapper(baseDirectory.value), scalaBinaryVersion.value, "test"),
+ Test / unmanagedResourceDirectories ++=
+ mkResourceDirs(baseMapper(baseDirectory.value), "test"),
+)
\ No newline at end of file
diff --git a/example/src/main/assets/index-bundler.html b/example/bundler-demo/src/main/assets/index.html
similarity index 100%
rename from example/src/main/assets/index-bundler.html
rename to example/bundler-demo/src/main/assets/index.html
diff --git a/example/src/main/assets/index-global.html b/example/global-demo/src/main/assets/index.html
similarity index 100%
rename from example/src/main/assets/index-global.html
rename to example/global-demo/src/main/assets/index.html
From f8e3a2454cdf7ba402fde2ebc2b2edbea82444ba Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Wed, 31 Oct 2018 10:09:39 +0100
Subject: [PATCH 26/80] SBT settings cleanup
---
build.sbt | 8 ++++++--
example/build.sbt | 17 +++++++++++++----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/build.sbt b/build.sbt
index 75b940b..75d1163 100644
--- a/build.sbt
+++ b/build.sbt
@@ -5,6 +5,9 @@ name := "udash-jquery"
inThisBuild(Seq(
version := "3.0.0-SNAPSHOT",
organization := "io.udash",
+))
+
+val commonSettings = Seq(
scalaVersion := "2.12.7",
crossScalaVersions := Seq("2.11.12", "2.12.7"),
scalacOptions ++= Seq(
@@ -28,13 +31,13 @@ inThisBuild(Seq(
"-Ycache-macro-class-loader:last-modified"
) else Seq.empty
}
-))
+)
val commonJSSettings = Seq(
Compile / emitSourceMaps := true,
Test / parallelExecution := false,
Test / scalaJSStage := FastOptStage,
- // ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
+ // ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
// https://github.com/scalacenter/scalajs-bundler/issues/89
// Test / jsEnv := new SeleniumJSEnv(browserCapabilities),
scalacOptions += {
@@ -48,6 +51,7 @@ val commonJSSettings = Seq(
lazy val root = project.in(file("."))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
+ commonSettings,
commonJSSettings,
libraryDependencies ++= Seq(
diff --git a/example/build.sbt b/example/build.sbt
index 64f9a69..2a277dc 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -3,6 +3,9 @@ name := "jquery-demo"
inThisBuild(Seq(
version := "3.0.0",
organization := "io.udash",
+))
+
+val commonSettings = Seq(
scalaVersion := "2.12.7",
crossScalaVersions := Seq("2.11.12", "2.12.7"),
scalacOptions ++= Seq(
@@ -25,13 +28,19 @@ inThisBuild(Seq(
"-Ycache-macro-class-loader:last-modified"
) else Seq.empty
},
-))
+
+ libraryDependencies ++= Dependencies.deps.value
+)
val generatedGlobalDir = file("generated/global")
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
+val root = project.in(file(".")).enablePlugins(ScalaJSPlugin)
+ .settings(commonSettings)
+
val `jquery-global-demo` = project.in(file("global-demo")).enablePlugins(ScalaJSPlugin)
.settings(
- libraryDependencies ++= Dependencies.deps.value,
+ commonSettings,
+
jsDependencies ++= Dependencies.jsDeps.value,
sourceDirsSettings(_.getParentFile),
@@ -69,8 +78,8 @@ val compileStatics = taskKey[Unit]("Compiles all static files.")
val `jquery-bundler-demo` = project.in(file("bundler-demo"))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
- libraryDependencies ++= Dependencies.deps.value,
-
+ commonSettings,
+
sourceDirsSettings(_.getParentFile),
Compile / scalaJSUseMainModuleInitializer := true,
From a7ea10c59ae247aaf7086ddfaecfb0b924be9779 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Wed, 31 Oct 2018 10:09:39 +0100
Subject: [PATCH 27/80] Docs
---
README.md | 8 +++++---
example/README.md | 2 +-
example/build.sbt | 8 +++++---
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index c62da25..f728a0c 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program
Add the following dependency to your SBT build:
```scala
-libraryDependencies += "io.udash" %%% "udash-jquery" % "2.0.0"
+libraryDependencies += "io.udash" %%% "udash-jquery" % "3.0.0"
```
then import the jQuery package:
@@ -16,8 +16,10 @@ then import the jQuery package:
import io.udash.wrappers.jquery._
```
-Since version `2.0.0` the wrapper does not force JS dependency on jQuery. You have to
-add it manually by:
+Since version `3.0.0` the wrapper is published as a CommonJS module with JS dependencies managed
+by [scalajs-bundler](https://github.com/scalacenter/scalajs-bundler).
+
+If you do not want to use the bundler, you have to include jQuery sources manually by:
* explicit link in your `index.html`.
```html
+
+
\ No newline at end of file
diff --git a/example/global-demo/src/main/assets/index.html b/example/global-demo/src/main/assets/index.html
index 13da206..b746eab 100644
--- a/example/global-demo/src/main/assets/index.html
+++ b/example/global-demo/src/main/assets/index.html
@@ -3,11 +3,11 @@
jquery-demo - global scope
-
-
-
+
+
+
\ No newline at end of file
From 744e2fe3a0a967fd5f279795253c8699633ab0a7 Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Tue, 6 Nov 2018 08:21:57 +0100
Subject: [PATCH 30/80] Release 3.0.0
---
build.sbt | 2 +-
example/project/Dependencies.scala | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/build.sbt b/build.sbt
index 3e95cb5..f32933c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,7 +3,7 @@ import org.openqa.selenium.chrome.ChromeOptions
name := "udash-jquery"
inThisBuild(Seq(
- version := "3.0.0-SNAPSHOT",
+ version := "3.0.0",
organization := "io.udash",
))
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 821aaeb..9f9e3d9 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -4,7 +4,7 @@ import sbt._
object Dependencies {
val udashCoreVersion = "0.6.1"
- val udashJQueryVersion = "3.0.0-SNAPSHOT"
+ val udashJQueryVersion = "3.0.0"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
From ebf460927621966329f6cd7d39df5433c5741cac Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Tue, 22 Jan 2019 12:29:48 +0100
Subject: [PATCH 31/80] JQueryEvent - access to the original event
---
src/main/scala/io/udash/wrappers/jquery/JQueryEvent.scala | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQueryEvent.scala b/src/main/scala/io/udash/wrappers/jquery/JQueryEvent.scala
index 0b5dea0..d71f057 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQueryEvent.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQueryEvent.scala
@@ -87,4 +87,8 @@ trait JQueryEvent extends Event {
/** For key or mouse events, this property indicates the specific key or button that was pressed.
* See: jQuery Docs */
def which: Int = js.native
+
+ /** The original JavaScript event.
+ * See: jQuery Docs */
+ def originalEvent: Event = js.native
}
From 57c8e2f017808ee0e17ab920568d6e6b26cc8b4b Mon Sep 17 00:00:00 2001
From: Mateusz Starzec
Date: Tue, 22 Jan 2019 14:28:05 +0100
Subject: [PATCH 32/80] v3.0.1
---
build.sbt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.sbt b/build.sbt
index ead37eb..b76070c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,7 +3,7 @@ import org.openqa.selenium.chrome.ChromeOptions
name := "udash-jquery"
inThisBuild(Seq(
- version := "3.0.0",
+ version := "3.0.1",
organization := "io.udash",
))
From e80784b5aa0270369554c52d80f7639944091ed1 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Wed, 9 Oct 2019 17:32:54 +0200
Subject: [PATCH 33/80] Dependency updates
---
.travis.yml | 2 +-
build.sbt | 14 +++++++-------
project/build.properties | 3 ++-
project/plugins.sbt | 4 ++--
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 49f4d8e..04edd58 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,7 @@ dist: trusty
jdk: oraclejdk8
scala:
- 2.11.12
- - 2.12.7
+ - 2.12.10
before_script:
- "export DISPLAY=:99.0"
diff --git a/build.sbt b/build.sbt
index f32933c..5d51c5c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,4 +1,4 @@
-import org.openqa.selenium.chrome.ChromeOptions
+
name := "udash-jquery"
@@ -8,8 +8,8 @@ inThisBuild(Seq(
))
val commonSettings = Seq(
- scalaVersion := "2.12.7",
- crossScalaVersions := Seq("2.11.12", "2.12.7"),
+ scalaVersion := "2.12.10",
+ crossScalaVersions := Seq("2.11.12", "2.12.10"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -34,7 +34,7 @@ val commonSettings = Seq(
)
val commonJSSettings = Seq(
- Compile / emitSourceMaps := true,
+ //Compile / emitSourceMaps := true,
Test / parallelExecution := false,
Test / scalaJSStage := FastOptStage,
// ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
@@ -55,9 +55,9 @@ lazy val root = project.in(file("."))
commonJSSettings,
libraryDependencies ++= Seq(
- "org.scala-js" %%% "scalajs-dom" % "0.9.6",
- "org.scalatest" %%% "scalatest" % "3.0.5" % Test,
- "com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
+ "org.scala-js" %%% "scalajs-dom" % "0.9.7",
+ "org.scalatest" %%% "scalatest" % "3.0.8" % Test,
+ "com.lihaoyi" %%% "scalatags" % "0.7.0" % Test
),
Compile / npmDependencies += "jquery" -> "3.3.1",
diff --git a/project/build.properties b/project/build.properties
index e71780d..ebcc8ac 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1,2 @@
-sbt.version = 1.2.6
\ No newline at end of file
+# suppress inspection "UnusedProperty"
+sbt.version=1.3.2
\ No newline at end of file
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 9155818..6b9840d 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,5 +2,5 @@ logLevel := Level.Warn
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
-addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.14.0")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6")
From 9c9224817f6c85c4124598ee9086e83769d22a3e Mon Sep 17 00:00:00 2001
From: ddworak
Date: Wed, 9 Oct 2019 17:41:23 +0200
Subject: [PATCH 34/80] Example project fix
---
build.sbt | 2 +-
example/build.sbt | 4 ++--
example/project/build.properties | 3 ++-
example/project/plugins.sbt | 4 ++--
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/build.sbt b/build.sbt
index 5d51c5c..975350e 100644
--- a/build.sbt
+++ b/build.sbt
@@ -34,7 +34,7 @@ val commonSettings = Seq(
)
val commonJSSettings = Seq(
- //Compile / emitSourceMaps := true,
+ Compile / emitSourceMaps := true,
Test / parallelExecution := false,
Test / scalaJSStage := FastOptStage,
// ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
diff --git a/example/build.sbt b/example/build.sbt
index 81a3d89..8cf9c90 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -6,8 +6,8 @@ inThisBuild(Seq(
))
val commonSettings = Seq(
- scalaVersion := "2.12.7",
- crossScalaVersions := Seq("2.11.12", "2.12.7"),
+ scalaVersion := "2.12.10",
+ crossScalaVersions := Seq("2.11.12", "2.12.10"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
diff --git a/example/project/build.properties b/example/project/build.properties
index e71780d..ebcc8ac 100644
--- a/example/project/build.properties
+++ b/example/project/build.properties
@@ -1 +1,2 @@
-sbt.version = 1.2.6
\ No newline at end of file
+# suppress inspection "UnusedProperty"
+sbt.version=1.3.2
\ No newline at end of file
diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt
index 4432bca..cafe39a 100644
--- a/example/project/plugins.sbt
+++ b/example/project/plugins.sbt
@@ -1,4 +1,4 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
-addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.14.0")
\ No newline at end of file
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6")
\ No newline at end of file
From 18921b23ec77b4486d4dfd15e3c495cd2ae836ea Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 10 Oct 2019 13:49:36 +0200
Subject: [PATCH 35/80] Add 2.13 support, drop 2.11
---
.travis.yml | 5 +++--
build.sbt | 21 +++++++------------
.../io/udash/wrappers/jquery/JQuery.scala | 2 +-
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 04edd58..d7fb0c2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,11 @@
language: scala
dist: trusty
-jdk: oraclejdk8
+jdk: openjdk11
+
scala:
- - 2.11.12
- 2.12.10
+ - 2.13.1
before_script:
- "export DISPLAY=:99.0"
diff --git a/build.sbt b/build.sbt
index 975350e..6bff42d 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,13 +3,13 @@
name := "udash-jquery"
inThisBuild(Seq(
- version := "3.0.0",
+ version := "3.0.1",
organization := "io.udash",
))
val commonSettings = Seq(
- scalaVersion := "2.12.10",
- crossScalaVersions := Seq("2.11.12", "2.12.10"),
+ scalaVersion := "2.13.1",
+ crossScalaVersions := Seq("2.12.10", "2.13.1"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -19,18 +19,13 @@ val commonSettings = Seq(
"-language:dynamics",
"-language:postfixOps",
"-language:experimental.macros",
- "-Xfuture",
"-Xfatal-warnings",
- "-Xlint:_"
+ "-Xlint:_",
+ "-Ywarn-unused:_,-explicits,-implicits",
+ "-Ybackend-parallelism", "4",
+ "-Ycache-plugin-class-loader:last-modified",
+ "-Ycache-macro-class-loader:last-modified",
),
- scalacOptions ++= {
- if (scalaBinaryVersion.value == "2.12") Seq(
- "-Ywarn-unused:_,-explicits,-implicits",
- "-Ybackend-parallelism", "4",
- "-Ycache-plugin-class-loader:last-modified",
- "-Ycache-macro-class-loader:last-modified"
- ) else Seq.empty
- }
)
val commonJSSettings = Seq(
diff --git a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
index 61ab8f2..8218c5a 100644
--- a/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
+++ b/src/main/scala/io/udash/wrappers/jquery/JQuery.scala
@@ -1,6 +1,6 @@
package io.udash.wrappers.jquery
-import org.scalajs.dom._
+import org.scalajs.dom.Element
import scala.collection.mutable
import scala.scalajs.js
From 58cc6f0a538e9f368c8352d73b981e31bc287664 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 10 Oct 2019 13:58:25 +0200
Subject: [PATCH 36/80] Example update and test simplification
---
.travis.yml | 6 ++----
example/build.sbt | 17 ++++++-----------
example/project/Dependencies.scala | 6 +++---
3 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index d7fb0c2..56f862c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,6 @@ dist: trusty
jdk: openjdk11
scala:
- - 2.12.10
- 2.13.1
before_script:
@@ -23,6 +22,5 @@ before_script:
- export PATH=$PWD/selenium-bin:$PATH
script:
- - sbt ++$TRAVIS_SCALA_VERSION test
- - sbt ++$TRAVIS_SCALA_VERSION publishLocal
- - cd example && sbt ++$TRAVIS_SCALA_VERSION compile jquery-global-demo/fullOptJS jquery-bundler-demo/compileStatics
\ No newline at end of file
+ - sbt +test +publishLocal
+ - cd example && sbt compile jquery-global-demo/fullOptJS jquery-bundler-demo/compileStatics
\ No newline at end of file
diff --git a/example/build.sbt b/example/build.sbt
index 8cf9c90..04eeabb 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -1,13 +1,13 @@
name := "jquery-demo"
inThisBuild(Seq(
- version := "3.0.0",
+ version := "3.0.1",
organization := "io.udash",
))
val commonSettings = Seq(
scalaVersion := "2.12.10",
- crossScalaVersions := Seq("2.11.12", "2.12.10"),
+ crossScalaVersions := Seq("2.12.10"), //todo 2.13
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -16,18 +16,13 @@ val commonSettings = Seq(
"-language:existentials",
"-language:dynamics",
"-language:postfixOps",
- "-Xfuture",
"-Xfatal-warnings",
"-Xlint:_",
+ "-Ywarn-unused:_,-explicits,-implicits",
+ "-Ybackend-parallelism", "4",
+ "-Ycache-plugin-class-loader:last-modified",
+ "-Ycache-macro-class-loader:last-modified"
),
- scalacOptions ++= {
- if (scalaBinaryVersion.value == "2.12") Seq(
- "-Ywarn-unused:_,-explicits,-implicits",
- "-Ybackend-parallelism", "4",
- "-Ycache-plugin-class-loader:last-modified",
- "-Ycache-macro-class-loader:last-modified"
- ) else Seq.empty
- },
libraryDependencies ++= Dependencies.deps.value
)
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 9f9e3d9..d557764 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -3,11 +3,11 @@ import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt._
object Dependencies {
- val udashCoreVersion = "0.6.1"
- val udashJQueryVersion = "3.0.0"
+ val udashCoreVersion = "0.8.1"
+ val udashJQueryVersion = "3.0.1"
val deps = Def.setting(Seq[ModuleID](
- "io.udash" %%% "udash-core-frontend" % udashCoreVersion,
+ "io.udash" %%% "udash-core" % udashCoreVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
From 1ceebb4cb1d220cbf2f49988e8f0319a6ec5d1d9 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Tue, 15 Oct 2019 06:52:36 +0200
Subject: [PATCH 37/80] Set version to 3.0.2
---
README.md | 2 +-
build.sbt | 2 +-
example/project/Dependencies.scala | 6 ++----
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index f728a0c..77158a1 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program
Add the following dependency to your SBT build:
```scala
-libraryDependencies += "io.udash" %%% "udash-jquery" % "3.0.0"
+libraryDependencies += "io.udash" %%% "udash-jquery" % "3.0.2"
```
then import the jQuery package:
diff --git a/build.sbt b/build.sbt
index 6bff42d..383767f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,7 +3,7 @@
name := "udash-jquery"
inThisBuild(Seq(
- version := "3.0.1",
+ version := "3.0.2",
organization := "io.udash",
))
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index d557764..77df420 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,10 +1,8 @@
-import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
-import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
-import sbt._
+
object Dependencies {
val udashCoreVersion = "0.8.1"
- val udashJQueryVersion = "3.0.1"
+ val udashJQueryVersion = "3.0.2"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core" % udashCoreVersion,
From 4968d5f983f143323eac1458cc450b764d2694d5 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Tue, 15 Oct 2019 06:57:25 +0200
Subject: [PATCH 38/80] Update deployment plugins
---
project/plugins.sbt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/project/plugins.sbt b/project/plugins.sbt
index c32bd8f..2b1dd16 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -6,5 +6,5 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6")
// Deployment configuration
-addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
-addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
\ No newline at end of file
+addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.4")
\ No newline at end of file
From 1d7b4f9174ce908d01a990b4b8f3b58d3871f2c1 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Tue, 15 Oct 2019 07:06:14 +0200
Subject: [PATCH 39/80] Restore build imports
---
example/project/Dependencies.scala | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 77df420..caa9172 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,4 +1,6 @@
-
+import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
+import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
+import sbt._
object Dependencies {
val udashCoreVersion = "0.8.1"
From 016f3d79ae27375e05238eb0065206f04e7ccb14 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Wed, 18 Mar 2020 14:50:46 +0100
Subject: [PATCH 40/80] Dependency upgrades
---
build.sbt | 43 ++-----------------
project/build.properties | 2 +-
project/plugins.sbt | 8 ++--
.../jquery_test/DomManipulationTest.scala | 6 ++-
.../jquery_test/EventsHandlingTest.scala | 9 ++--
.../jquery_test/MiscellaneousTest.scala | 10 +++--
.../wrappers/jquery_test/SelectorsTest.scala | 6 ++-
.../wrappers/jquery_test/TraversingTest.scala | 7 +--
8 files changed, 33 insertions(+), 58 deletions(-)
diff --git a/build.sbt b/build.sbt
index 8902567..4ca74b7 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,7 +3,7 @@
name := "udash-jquery"
inThisBuild(Seq(
- version := "3.0.2",
+ version := "3.0.3",
organization := "io.udash",
))
@@ -50,46 +50,11 @@ lazy val root = project.in(file("."))
commonJSSettings,
libraryDependencies ++= Seq(
- "org.scala-js" %%% "scalajs-dom" % "0.9.7",
- "org.scalatest" %%% "scalatest" % "3.0.8" % Test,
- "com.lihaoyi" %%% "scalatags" % "0.7.0" % Test
+ "org.scala-js" %%% "scalajs-dom" % "0.9.8",
+ "org.scalatest" %%% "scalatest" % "3.1.1" % Test,
+ "com.lihaoyi" %%% "scalatags" % "0.8.6" % Test
),
Compile / npmDependencies += "jquery" -> "3.3.1",
Test / requireJsDomEnv := true
)
-
-// Deployment configuration
-publishMavenStyle := true
-publishArtifact in Test := false
-pomIncludeRepository := { _ => false }
-
-publishTo := {
- val nexus = "https://oss.sonatype.org/"
- if (isSnapshot.value)
- Some("snapshots" at nexus + "content/repositories/snapshots")
- else
- Some("releases" at nexus + "service/local/staging/deploy/maven2")
-}
-
-pomExtra := {
- https://github.com/UdashFramework/scala-js-jquery
-
-
- Apache v.2 License
- http://www.apache.org/licenses/LICENSE-2.0.txt
- repo
-
-
-
- git@github.com:UdashFramework/scala-js-jquery.git
- scm:git@github.com:UdashFramework/scala-js-jquery.git
-
-
-
- avsystem
- AVSystem
- http://www.avsystem.com/
-
-
-}
diff --git a/project/build.properties b/project/build.properties
index ebcc8ac..c9c5a37 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1,2 +1,2 @@
# suppress inspection "UnusedProperty"
-sbt.version=1.3.2
\ No newline at end of file
+sbt.version=1.3.8
\ No newline at end of file
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 2b1dd16..ea0423d 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,9 +2,9 @@ logLevel := Level.Warn
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
-addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.17.0")
// Deployment configuration
-addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")
-addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.4")
\ No newline at end of file
+addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")
\ No newline at end of file
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala
index ede038d..d16b4cc 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/DomManipulationTest.scala
@@ -1,8 +1,10 @@
package io.udash.wrappers.jquery_test
-import org.scalatest.{Matchers, WordSpec}
+import org.scalatest.matchers.should.Matchers
+import org.scalatest.wordspec.AnyWordSpec
+
+class DomManipulationTest extends AnyWordSpec with Matchers {
-class DomManipulationTest extends WordSpec with Matchers {
import io.udash.wrappers.jquery._
import scalatags.JsDom.all._
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala
index 42fea1c..710fa0a 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/EventsHandlingTest.scala
@@ -1,10 +1,13 @@
+package io.udash.wrappers.jquery_test
+
import org.scalajs.dom.Element
import org.scalajs.dom.html.Input
-import org.scalatest.{Matchers, WordSpec}
+import org.scalatest.matchers.should.Matchers
+import org.scalatest.wordspec.AnyWordSpec
-class EventsHandlingTest extends WordSpec with Matchers {
- import io.udash.wrappers.jquery._
+class EventsHandlingTest extends AnyWordSpec with Matchers {
+ import io.udash.wrappers.jquery._
import scalatags.JsDom.all._
class C(i: Int)
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala
index 95b3953..4d32382 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/MiscellaneousTest.scala
@@ -1,10 +1,11 @@
package io.udash.wrappers.jquery_test
-import org.scalatest.{Matchers, WordSpec}
+import org.scalatest.matchers.should.Matchers
+import org.scalatest.wordspec.AnyWordSpec
-class MiscellaneousTest extends WordSpec with Matchers {
- import io.udash.wrappers.jquery._
+class MiscellaneousTest extends AnyWordSpec with Matchers {
+ import io.udash.wrappers.jquery._
import scalatags.JsDom.all._
class C(i: Int)
@@ -45,7 +46,8 @@ class MiscellaneousTest extends WordSpec with Matchers {
}
"serialize objects to URL query string" in {
- import scala.scalajs.js, js.JSConverters._
+ import scala.scalajs.js
+ import js.JSConverters._
jQ.param(js.Dynamic.literal("a" -> Seq(1, 2, 3).toJSArray, "b" -> "c")) should be("a%5B%5D=1&a%5B%5D=2&a%5B%5D=3&b=c")
}
}
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala
index 6654210..61ea636 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/SelectorsTest.scala
@@ -1,8 +1,10 @@
package io.udash.wrappers.jquery_test
-import org.scalatest.{Matchers, WordSpec}
+import org.scalatest.matchers.should.Matchers
+import org.scalatest.wordspec.AnyWordSpec
+
+class SelectorsTest extends AnyWordSpec with Matchers {
-class SelectorsTest extends WordSpec with Matchers {
import io.udash.wrappers.jquery._
import scalatags.JsDom.all._
diff --git a/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala b/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
index 1400684..82116cf 100644
--- a/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
+++ b/src/test/scala/io/udash/wrappers/jquery_test/TraversingTest.scala
@@ -1,10 +1,11 @@
package io.udash.wrappers.jquery_test
-import org.scalatest.{Matchers, WordSpec}
+import org.scalatest.matchers.should.Matchers
+import org.scalatest.wordspec.AnyWordSpec
-class TraversingTest extends WordSpec with Matchers {
- import io.udash.wrappers.jquery._
+class TraversingTest extends AnyWordSpec with Matchers {
+ import io.udash.wrappers.jquery._
import scalatags.JsDom.all._
"jQuery" should {
From 1c7a60e8c8932b1c218741ed930f5509bdd7b4a9 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Wed, 18 Mar 2020 15:36:22 +0100
Subject: [PATCH 41/80] Bundler-only demo
---
example/build.sbt | 44 ++-----------------
.../global-demo/src/main/assets/index.html | 13 ------
example/project/Dependencies.scala | 7 +--
example/project/build.properties | 2 +-
example/project/plugins.sbt | 4 +-
.../src/main/assets/index.html | 0
6 files changed, 8 insertions(+), 62 deletions(-)
delete mode 100644 example/global-demo/src/main/assets/index.html
rename example/{bundler-demo => }/src/main/assets/index.html (100%)
diff --git a/example/build.sbt b/example/build.sbt
index 04eeabb..8f85222 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -1,13 +1,13 @@
name := "jquery-demo"
inThisBuild(Seq(
- version := "3.0.1",
+ version := "3.0.2",
organization := "io.udash",
))
val commonSettings = Seq(
scalaVersion := "2.12.10",
- crossScalaVersions := Seq("2.12.10"), //todo 2.13
+ crossScalaVersions := Seq("2.12.10"), //todo 2.13 & SJS 1.0 with Udash 0.9
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -33,46 +33,10 @@ val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings)
-val `jquery-global-demo` = project.in(file("global-demo"))
- .enablePlugins(ScalaJSPlugin)
- .settings(
- commonSettings,
-
- jsDependencies ++= Dependencies.jsDeps.value,
-
- sourceDirsSettings(_.getParentFile),
-
- /* move these files out of target/. */
- Compile / fullOptJS / crossTarget := generatedGlobalDir,
- Compile / fastOptJS / crossTarget := generatedGlobalDir,
- Compile / packageJSDependencies / crossTarget := generatedGlobalDir,
- Compile / packageMinifiedJSDependencies / crossTarget := generatedGlobalDir,
-
- Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value,
- Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value,
-
- scalaJSUseMainModuleInitializer := true,
-
- copyAssets := {
- IO.copyFile(
- sourceDirectory.value / "main/assets/index.html",
- generatedGlobalDir / "index.html"
- )
- },
-
- Compile / fastOptJS / artifactPath :=
- (Compile / fastOptJS / crossTarget).value / "scripts" / "frontend-impl.js",
- Compile / fullOptJS / artifactPath :=
- (Compile / fullOptJS / crossTarget).value / "scripts" / "frontend-impl.js",
- Compile / packageJSDependencies / artifactPath :=
- (Compile / packageJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js",
- Compile / packageMinifiedJSDependencies / artifactPath :=
- (Compile / packageMinifiedJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js"
- )
-
val generatedBundlerDir = file("generated/bundler")
val compileStatics = taskKey[Unit]("Compiles all static files.")
-val `jquery-bundler-demo` = project.in(file("bundler-demo"))
+
+val example = project.in(file("."))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
commonSettings,
diff --git a/example/global-demo/src/main/assets/index.html b/example/global-demo/src/main/assets/index.html
deleted file mode 100644
index b746eab..0000000
--- a/example/global-demo/src/main/assets/index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- jquery-demo - global scope
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index caa9172..32852d9 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,17 +1,12 @@
-import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt._
object Dependencies {
- val udashCoreVersion = "0.8.1"
+ val udashCoreVersion = "0.8.3"
val udashJQueryVersion = "3.0.2"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core" % udashCoreVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
-
- val jsDeps = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID](
- "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
- ))
}
\ No newline at end of file
diff --git a/example/project/build.properties b/example/project/build.properties
index ebcc8ac..c9c5a37 100644
--- a/example/project/build.properties
+++ b/example/project/build.properties
@@ -1,2 +1,2 @@
# suppress inspection "UnusedProperty"
-sbt.version=1.3.2
\ No newline at end of file
+sbt.version=1.3.8
\ No newline at end of file
diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt
index cafe39a..c0848e6 100644
--- a/example/project/plugins.sbt
+++ b/example/project/plugins.sbt
@@ -1,4 +1,4 @@
logLevel := Level.Warn
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
-addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6")
\ No newline at end of file
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.17.0")
\ No newline at end of file
diff --git a/example/bundler-demo/src/main/assets/index.html b/example/src/main/assets/index.html
similarity index 100%
rename from example/bundler-demo/src/main/assets/index.html
rename to example/src/main/assets/index.html
From b71ad988dd574d1f05c8b9604b5f25448a2fb3d8 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Wed, 18 Mar 2020 15:40:02 +0100
Subject: [PATCH 42/80] SJS 1.0.1
---
build.sbt | 4 +---
project/plugins.sbt | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/build.sbt b/build.sbt
index 4ca74b7..b330dc3 100644
--- a/build.sbt
+++ b/build.sbt
@@ -9,7 +9,7 @@ inThisBuild(Seq(
val commonSettings = Seq(
scalaVersion := "2.13.1",
- crossScalaVersions := Seq("2.12.10", "2.13.1"),
+ crossScalaVersions := Seq("2.12.11", "2.13.1"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
@@ -29,7 +29,6 @@ val commonSettings = Seq(
)
val commonJSSettings = Seq(
- Compile / emitSourceMaps := true,
Test / parallelExecution := false,
Test / scalaJSStage := FastOptStage,
// ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
@@ -40,7 +39,6 @@ val commonJSSettings = Seq(
val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery"
s"-P:scalajs:mapSourceURI:$localDir->$githubDir/v${version.value}/"
},
- scalacOptions += "-P:scalajs:sjsDefinedByDefault",
)
lazy val root = project.in(file("."))
diff --git a/project/plugins.sbt b/project/plugins.sbt
index ea0423d..ab16f2f 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,8 +2,8 @@ logLevel := Level.Warn
libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
-addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.17.0")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.17.0")
// Deployment configuration
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
From 70fabcf43a2335c14e6f5769f176cae67abb3635 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 07:13:01 +0100
Subject: [PATCH 43/80] CI cleanup
---
.travis.yml | 2 +-
example/build.sbt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 56f862c..c1c2b6a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,4 +23,4 @@ before_script:
script:
- sbt +test +publishLocal
- - cd example && sbt compile jquery-global-demo/fullOptJS jquery-bundler-demo/compileStatics
\ No newline at end of file
+ - cd example && sbt compileStatics
\ No newline at end of file
diff --git a/example/build.sbt b/example/build.sbt
index 8f85222..422bf9d 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -33,7 +33,7 @@ val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings)
-val generatedBundlerDir = file("generated/bundler")
+val generatedBundlerDir = file("generated")
val compileStatics = taskKey[Unit]("Compiles all static files.")
val example = project.in(file("."))
From 949cb211a638a082f6ddfeb9f8e99d7a38dacaec Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 08:17:23 +0100
Subject: [PATCH 44/80] Travis setup for releasing
---
.travis.yml | 49 ++++++++++++++++++++++++++++++++-----------------
travis.gpg.enc | Bin 0 -> 3712 bytes
2 files changed, 32 insertions(+), 17 deletions(-)
create mode 100644 travis.gpg.enc
diff --git a/.travis.yml b/.travis.yml
index c1c2b6a..86def1f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,26 +1,41 @@
-language: scala
dist: trusty
-
+language: scala
jdk: openjdk11
-
scala:
- 2.13.1
+stages:
+ - test
+ - name: release
+ if: tag =~ ^v
+
before_script:
- - "export DISPLAY=:99.0"
- - "sh -e /etc/init.d/xvfb start"
- - sleep 3 # give xvfb some time to start
- # Instal google-chrome
- - export CHROME_BIN=/usr/bin/google-chrome
- - sudo apt-get update
- - sudo apt-get install -y libappindicator1 fonts-liberation
- - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- - sudo dpkg -i google-chrome*.deb
- # Install Selenium chromedriver
- - wget http://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip
- - unzip chromedriver_linux64.zip -d selenium-bin
- - export PATH=$PWD/selenium-bin:$PATH
+ - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
+ - mkdir geckodriver
+ - tar -xzf geckodriver-v0.24.0-linux64.tar.gz -C geckodriver
+ - export PATH=$PWD/geckodriver:$PATH
script:
- sbt +test +publishLocal
- - cd example && sbt compileStatics
\ No newline at end of file
+ - cd example && sbt compileStatics
+
+jobs:
+ include:
+ - stage: release
+ script:
+ - openssl aes-256-cbc -K $encrypted_f00a6d0a0202_key -iv $encrypted_f00a6d0a0202_iv -in travis/travis.gpg.enc -out travis/travis.gpg -d
+ - gpg --import travis/travis.gpg
+ - test $TRAVIS_PULL_REQUEST = "false" && sbt +publishSigned sonatypeBundleRelease
+
+before_cache:
+ # Cleanup the cached directories to avoid unnecessary cache updates
+ - rm -fv $HOME/.ivy2/.sbt.ivy.lock
+ - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
+ - find $HOME/.sbt -name "*.lock" -print -delete
+
+cache:
+ directories:
+ - $HOME/.ivy2/cache
+ - $HOME/.m2
+ - $HOME/.cache
+ - $HOME/.sbt
\ No newline at end of file
diff --git a/travis.gpg.enc b/travis.gpg.enc
new file mode 100644
index 0000000000000000000000000000000000000000..399e4773eceb781b839288110f4eb79b00f9e135
GIT binary patch
literal 3712
zcmV-`4uA2*H7koBJ8%!iZTWF$!{Z-QD*oRFDW;sl!QySp%&UtFSA@?)Ezh1<@e
zau_=SuvL!Tpo3ELmII4Skngn(thtLkE10yq{iZL40@L~09np95yr5&jcTVrKD)X?Y
znm1{n@xL*E`PILmVck}3W>@|MDj@^jf}mWr%F4P~U7VGCHRmI`idtw5J;$7yMp&AO
zavvK2s?cc4f>NLgrFY?~KuMF|p+(OyvDq%^W*~{JTLk{p*mm6xqw^L9hKo}`PKc@0
z;AUAm{+EI@tpCfJH<0rFh`+-=UC}mJ6D!XH_b{#wcA?MAyC(*|pkyaj&oqBdKJts3JBd~|LY
zZZK>1#9%&WoE$Wo0qA5`$r>}EPv3}h-+Gp|*<}s%<`PZ(w97t8_>G^-90o!?w$|wP
zCSlq2LIfA@l&41CpWAc5b=JO=ghqUnq3!swPRh88^gf;vE#oN$JZ3KXZ
zNHpfpMlC;E*=;zM+i)6bxor0lzUBW9$+`Qpq&_i3yypiKVaT5ISY(Q?>E*VE51(;F
zjmE!)REd@<8!-(VLGfy}+z`#6$5)ano{e2?0UjDLuE>0&;()S%TL
zZYo4aw5JAt*R{&A(Ub?T@4}25qn*5)bw2frbfnt^r}oxjj$9Im@;IQ2fv~(Yc1I{}
zMZrPD`g=+}{7Xdo!s(=kU;L>t{p00{2Se7ifba3O1z%prX>K0nHl<9pw;H(g&b9TH
zcA-5o`2mVT>9e!HDj|Vh>R<5DHx{m_6
zGkoa2wop$_O1omwPhS6}!c8l7iO4o!MgkbdvMu?x%T;KqIgLfOMGb52t@r&;;}Rv^
zWT))87nG!F8N5J9;qE^2mmXKF5jjWU$cZ;$FfZs(VMq-|C)LXSbC3zReacAfk`GZh
zmTMZq`ZGvvr5`=MXvwj~-0~p**IW>JB`0cFTH$jvd;!V5wKU^PZS08i(TO=Qn@39&
zRl0$pVuG&G3@ZH0awpKaLbKut>}lyXrbkScE#LWf;Nt6VN|SP0SEa>1LVr*Y`Vuv!
z7XtKS@HY&pRas*3bG*e4{+c4}M|y+%36v4{AK;MF{bP8G**HF96L=gRH?|{q#=QVT
z72^G(`XBprjiIpeStxIaPDR;?#gB8lDLa?q++pv=q4quk15|C#f^TT;PdOZ
zF42&DE5IAaGd4%`Z38S)JC>A?1X{!0rw7_UpeCysKr#53NJC*f|KOtul-yUqP7;c7
zCLaAow$MfDU!&!0hhPla
zc-N({E}Fy+SCx9!2XyVqc&R1%fjI8Vz{&P!u!n4g^=phbw%o6SIbgo8NIh7QH%=kj?IfPMAu?G3XL1Rzj
zFC4ZCv^fFY7JZ&kf_G`Uow$-Jb7^oY-cy8U+W5EhgI0C5sO>1%9vS_ER%ayC%k~?9
zb>s1ccf9i>G$SnzS}UnM==BH)fk!<)Fo$PzuXL5JR
zHE54^B+S7ZljvVLQ;ILWemRf9k~O2c)AG?u#o!GLtY42OVJ-HUjHM|+_T9iSa!-pc
zlIJ&QqadZASpI>UThjcM)_2ObgYP*<82*{YT4`|g({a@lr^Vw}zQy55?63Pxoc~rK
z;r&^J%D`+dzgR%9MVU9Ae6r_%Ud+nI+`+#~#n6mHF%Bo+>5fd~njY;4H(FJzHM%qx
zHEjHr>>n7>${W0-Df>mzKdEuuN{U!f_4I-1T)?oDe<7u00*UMFX93u32aOWBcx~36
zyeQ7S3m=RVv>+@jU8e?kNrinG`zqbj{31w?@LTd*)vXv9uZEvwfL`gr{1j8*8UR}b
zz4wQWp>11}VRNe<<7knD4$nv=M(MAUIG_gVX1B1hPhOaxRjml;i1W_Zb~A2qc5e*j
zJSyn0ktIbs4W0w4<18QdCSbgZY$rfjwQ;U<5M7w7%trfcd(xbj9atipn%W*cGeStv
zhvi?IQj(7J
z^b1;k_M*vFg=x-528fO(Tsm@W5hAbAtBNyQrWv#X6E~-R5AcFds20Cu_6?6^z66$>
zR_>K+$AIMF!s{6mZ6Th88=2xL!4G7sdjxgegRik2qStjg#Q#{w7os;eyx%(wBWO*G
zeSf|Sa4SrV=DY|^MHLwe`r0_(?^7j1FRn?Iat661Yke!%UQ%3szH1YZWZk1zP#ny;B<#2>fpTqfTMsz!-B~iRHR_b
ziRh3yVt(#UH@~`A=|GzuP}$ZF02ULInaEhRbos`W**%oxW{8!pyKJBn9?v(N(Du=6
zRqV2tUtwsXqrZZd_*;xX#-8RL{;oMmJ1~k}I}4n-LIH@#Dm!-D!5Y{<>w7wjksc4V
z{DTB-GP3TqU7n;-E|}vuWm-Uk*^QeUHnuLe
z)Vf4y$Q^I*Fhd>vH0`VLhlq>{65S;(=G+Afs5q5|XMCF9e;s5O?;~?tC@55S=tx+<
z+nE0*r^8)P%GG}%H3Hf%o;Uf4Cd<~4t*Hf%b@Qn29=Hh
zr}sv?`Zha8$kzBdtF>0eYl)iJu%eWB<%z#^LqDQE-7!(*5DbQ9L#9{g(3`3mWsM`D
zmL6Xl1;`l;6t}s0fF{BbI7&h~awIIz?{kCiV|k`2-{~KoMv9lMVvJ|quHdDre(-kd
z(*ECRT?<^KyR_z?jJk-*0=DFGOD}=SLB}!XD
z!*z$WIhhzQBcE1G`qFs!y7TiOxYTgb8A;F>>p95%d`)l;>${2pDr4gG_9(Yt^8>PZ
zkpr$G0cCT~=Qk0{n15)@@Wczb^S>0%mFdtcq8FsOas8}zXc9f9+M(gytG1G$pd4tf
z%g}j@3})aX(2l*iZSc#5)+6Jr1U{!xj5`HZ&={WRV;Yh#pwG`6j~rSXRB8$8{Wkz0
zu{#wTje{bcAN+v*n(NEpq)@|<^2suf>@U|<=%sDFM;04N6aM$EVGnh<6^*yJMS879
zW=_n%=LKjryk2g2)CHGN?Ava7qb7<6>w=
e*PLdv@dpma`3t##6ry)fh1I!P_X>&~CqX&^>Q6HO
literal 0
HcmV?d00001
From 08e13154aa86336105245e7a4b5d3dcdca5d507e Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 08:19:03 +0100
Subject: [PATCH 45/80] Default to snapshot version in dev
---
build.sbt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/build.sbt b/build.sbt
index b330dc3..f69a332 100644
--- a/build.sbt
+++ b/build.sbt
@@ -3,8 +3,9 @@
name := "udash-jquery"
inThisBuild(Seq(
- version := "3.0.3",
+ version := sys.env.get("TRAVIS_TAG").filter(_.startsWith("v")).map(_.drop(1)).getOrElse("3.0.0-SNAPSHOT"),
organization := "io.udash",
+ cancelable := true,
))
val commonSettings = Seq(
From 6e10c20ebadce3b5fbcaa3fd17339612b4525255 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 08:20:34 +0100
Subject: [PATCH 46/80] Travis fix
---
.travis.yml | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 86def1f..1534178 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,18 +9,17 @@ stages:
- name: release
if: tag =~ ^v
-before_script:
- - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
- - mkdir geckodriver
- - tar -xzf geckodriver-v0.24.0-linux64.tar.gz -C geckodriver
- - export PATH=$PWD/geckodriver:$PATH
-
-script:
- - sbt +test +publishLocal
- - cd example && sbt compileStatics
-
jobs:
include:
+ - stage: test
+ before_script:
+ - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
+ - mkdir geckodriver
+ - tar -xzf geckodriver-v0.24.0-linux64.tar.gz -C geckodriver
+ - export PATH=$PWD/geckodriver:$PATH
+ script:
+ - sbt +test +publishLocal
+ - cd example && sbt compileStatics
- stage: release
script:
- openssl aes-256-cbc -K $encrypted_f00a6d0a0202_key -iv $encrypted_f00a6d0a0202_iv -in travis/travis.gpg.enc -out travis/travis.gpg -d
From a236e022f005c50cdbbe4d9429ffd4dd46e544fa Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 09:15:53 +0100
Subject: [PATCH 47/80] Complete autopublish setup
---
.travis.yml | 24 ++++++++++++------------
build.sbt | 38 +++++++++++++++++++++++++++++++++++---
project/plugins.sbt | 4 +---
3 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1534178..5bb28bf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,34 +7,34 @@ scala:
stages:
- test
- name: release
- if: tag =~ ^v
+ - if: tag =~ ^v
jobs:
include:
- stage: test
- before_script:
- - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
- - mkdir geckodriver
- - tar -xzf geckodriver-v0.24.0-linux64.tar.gz -C geckodriver
- - export PATH=$PWD/geckodriver:$PATH
script:
- sbt +test +publishLocal
- cd example && sbt compileStatics
- stage: release
script:
- - openssl aes-256-cbc -K $encrypted_f00a6d0a0202_key -iv $encrypted_f00a6d0a0202_iv -in travis/travis.gpg.enc -out travis/travis.gpg -d
+ - openssl aes-256-cbc -K $encrypted_f00a6d0a0202_key -iv $encrypted_f00a6d0a0202_iv
+ -in travis/travis.gpg.enc -out travis/travis.gpg -d
- gpg --import travis/travis.gpg
- test $TRAVIS_PULL_REQUEST = "false" && sbt +publishSigned sonatypeBundleRelease
before_cache:
- # Cleanup the cached directories to avoid unnecessary cache updates
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete
cache:
directories:
- - $HOME/.ivy2/cache
- - $HOME/.m2
- - $HOME/.cache
- - $HOME/.sbt
\ No newline at end of file
+ - "$HOME/.ivy2/cache"
+ - "$HOME/.m2"
+ - "$HOME/.cache"
+ - "$HOME/.sbt"
+
+env:
+ global:
+ - secure: rG9cHG3au9EUYQSJKHAsMxws3IW/tSxG1Y/xbuW2Ri1JVr6L6c9ig8gYj4Hju5KkVvxXejb1/8bYCoZEP1vZpNeSkNordHECp0l+i9mI5ZFo5RN3vMCq4/0xWEQTdZ7c3BjN+pn4veDJ+W8cHFXgivC9tsX7FEbksz4bFVIm1knvz5r7HN4ntgQUeLwY/J9EpKSr/TYZsnEcf8aH9q6tvTLqcfYAR6ggs68Kc2qJ5sII0rj3vP2NANjTLuvdkPSe3i/9KCDRDr9KIoVsam4LfFDG8YXSNWBP3OQU86DF19V0brt6WGGX6G5V2dyjlHyyUy0GBFJOlPmfkEL8ylOprGy1OPw40ZPRbtzpbztFlVmgJoO3UcKIWlyB8umz0M9A+E3Of3P9mTnskAe366VPSq8R/G3kxc7ictZDQH7hgf2nKqlFQNXCJkBqynWRlC0HQ31izrACqNmmYdwQspUnAFVOEFSmfXu8sPVyOSQhHT4IG+xgG4KCKdC8Cv4buOFDzj4z0DRnfJwR71KvxA9KGhUtMZXXqfdZANThHMV1bsi3S3UPQKqRg62aja4+I7lzbwrPRbkDPsl0eTdULF39jIMnbfjC2TqeCgfG+tpel0DBMBOuuESvTVFVX38HSgK1QNhSAAu1nrVIFtZQbKDZLOm7hCgfOJO6v65R3PgIFFI=
+ - secure: wjX1uXAYdNxpUr1nz9cQ96cgJI3wUqJ7hIQlHwtg1gLJJtgdf6STSTbAm1IKMb0Ouytc2muC1H8jhBbv94tyZh2/NI7IDk7OY2wcLobH2Jh/wnDEAAcATIhqR/oFtSdqr0umr1HDevUPIBU/ZFViCPribnCQ/Rxn8jttguGd3Ho1k1dxzJ9pEiET66nU8CnW0j8g1Nkg540xFPff0Q+1C7+3akU03KwLnh8C0KR1oGhT354IhocLtFKWPuD9GTXAiA6qcOZ0cmUlv8jwHhWyJ6dmVkOlv873nGPrFaWEDPepNkGaAz2TYjkeFS0YS8q1zbd7YM0opnQd8TJCnFddyzc09+1d5RMAJVWdKOKVjrbDwvKaNWfEHW6GXJ83xm8cbo3dCREfL7UTKjejkQTRgmj2BdrZVRB9xs+XKZpZi0ECVbIrwik9tyYoiuSHe96yNN3Ma56Q4x094ZTvsccjy7pET4FCpNwrFu0aD+HFPerWB/xlr9ILz7sWy99r4eafS+O2eidoQnPIHAHZ+z/k9ExQedKUzTxO/skgrf1FvswrY7cpfnNApOhCSKm8C5NfMB5BC7M7OsYqDIhIwfs/Q3J9gw18F4fa9czpnduVzkpQUGdZ2vtS+oxDGICB7uaxkRq7HudHHElhz4w9qEOIMpTJjICPa38Hr/fKGxpuhKE=
\ No newline at end of file
diff --git a/build.sbt b/build.sbt
index f69a332..ed68634 100644
--- a/build.sbt
+++ b/build.sbt
@@ -27,14 +27,46 @@ val commonSettings = Seq(
"-Ycache-plugin-class-loader:last-modified",
"-Ycache-macro-class-loader:last-modified",
),
+ autoAPIMappings := true,
+ publishMavenStyle := true,
+ publishArtifact in Test := false,
+ pomIncludeRepository := { _ => false },
+
+ publishTo := sonatypePublishToBundle.value,
+
+ credentials in Global += Credentials(
+ "Sonatype Nexus Repository Manager",
+ "oss.sonatype.org",
+ sys.env.getOrElse("SONATYPE_USERNAME", ""),
+ sys.env.getOrElse("SONATYPE_PASSWORD", "")
+ ),
+
+ pomExtra := {
+ https://github.com/UdashFramework/scala-js-jquery
+
+
+ Apache v.2 License
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+ git@github.com:UdashFramework/scala-js-jquery.git
+ scm:git@github.com:UdashFramework/scala-js-jquery.git
+
+
+
+ avsystem
+ AVSystem
+ http://www.avsystem.com/
+
+
+ }
)
val commonJSSettings = Seq(
Test / parallelExecution := false,
Test / scalaJSStage := FastOptStage,
- // ScalaJSBundlerPlugin does not work with scalajs-env-selenium:
- // https://github.com/scalacenter/scalajs-bundler/issues/89
- // Test / jsEnv := new SeleniumJSEnv(browserCapabilities),
scalacOptions += {
val localDir = (ThisBuild / baseDirectory).value.toURI.toString
val githubDir = "https://raw.githubusercontent.com/UdashFramework/scala-js-jquery"
diff --git a/project/plugins.sbt b/project/plugins.sbt
index ab16f2f..418498b 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,10 +1,8 @@
logLevel := Level.Warn
-libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.17.0")
// Deployment configuration
-addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
+addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")
\ No newline at end of file
From f5328c14488d8f1719f84ab60c88a31b005ef916 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 09:22:28 +0100
Subject: [PATCH 48/80] Move key file
---
travis.gpg.enc => travis/travis.gpg.enc | Bin
1 file changed, 0 insertions(+), 0 deletions(-)
rename travis.gpg.enc => travis/travis.gpg.enc (100%)
diff --git a/travis.gpg.enc b/travis/travis.gpg.enc
similarity index 100%
rename from travis.gpg.enc
rename to travis/travis.gpg.enc
From 4acb8d5453b66e66951321f62156189eac8d5f66 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 19 Mar 2020 09:23:03 +0100
Subject: [PATCH 49/80] Attempt to cleanup stages
---
.travis.yml | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 5bb28bf..e2322af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,11 +4,6 @@ jdk: openjdk11
scala:
- 2.13.1
-stages:
- - test
- - name: release
- - if: tag =~ ^v
-
jobs:
include:
- stage: test
@@ -16,6 +11,7 @@ jobs:
- sbt +test +publishLocal
- cd example && sbt compileStatics
- stage: release
+ if: tag =~ ^v
script:
- openssl aes-256-cbc -K $encrypted_f00a6d0a0202_key -iv $encrypted_f00a6d0a0202_iv
-in travis/travis.gpg.enc -out travis/travis.gpg -d
From efbabe0b7a9b91923e3de9a3a8dbe75443b7816a Mon Sep 17 00:00:00 2001
From: Dawid Dworak
Date: Thu, 19 Mar 2020 13:44:08 +0100
Subject: [PATCH 50/80] Update README.md
---
README.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 77158a1..fd89164 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
-# scala-js-jquery [](https://travis-ci.org/UdashFramework/scala-js-jquery) [](https://gitter.im/UdashFramework/scala-js-jquery?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [
](http://www.avsystem.com/)
+udash-jquery [
](http://www.avsystem.com/)
+[](https://travis-ci.org/UdashFramework/scala-js-jquery)
+[](https://maven-badges.herokuapp.com/maven-central/io.udash/udash-jquery_sjs1_2.12)
+[](https://gitter.im/UdashFramework/scala-js-jquery?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) programs.
From 8a6a55f6fe107677f9e9d9e1cedc393f363648ce Mon Sep 17 00:00:00 2001
From: Dawid Dworak
Date: Thu, 19 Mar 2020 13:48:00 +0100
Subject: [PATCH 51/80] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index fd89164..71b1d97 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-udash-jquery [
](http://www.avsystem.com/)
+# udash-jquery [
](http://www.avsystem.com/)
[](https://travis-ci.org/UdashFramework/scala-js-jquery)
-[](https://maven-badges.herokuapp.com/maven-central/io.udash/udash-jquery_sjs1_2.12)
+[](https://maven-badges.herokuapp.com/maven-central/io.udash/udash-jquery_sjs1_2.12)
[](https://gitter.im/UdashFramework/scala-js-jquery?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) programs.
From 7c48457a6b35bb5777c176cf9510116ef1ed8b3d Mon Sep 17 00:00:00 2001
From: Dawid Dworak
Date: Thu, 19 Mar 2020 13:50:17 +0100
Subject: [PATCH 52/80] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 71b1d97..8e775a1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# udash-jquery [
](http://www.avsystem.com/)
[](https://travis-ci.org/UdashFramework/scala-js-jquery)
-[](https://maven-badges.herokuapp.com/maven-central/io.udash/udash-jquery_sjs1_2.12)
+[](https://maven-badges.herokuapp.com/maven-central/io.udash/udash-jquery_sjs1_2.12)
[](https://gitter.im/UdashFramework/scala-js-jquery?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) programs.
From e3794013fbefc1a05db30151558b6d3c2993bc49 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 26 Mar 2020 11:41:36 +0100
Subject: [PATCH 53/80] Publish both npm and js deps in jar
---
build.sbt | 5 ++---
example/project/Dependencies.scala | 2 +-
project/plugins.sbt | 1 +
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/build.sbt b/build.sbt
index ed68634..1addc24 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,5 +1,3 @@
-
-
name := "udash-jquery"
inThisBuild(Seq(
@@ -75,7 +73,7 @@ val commonJSSettings = Seq(
)
lazy val root = project.in(file("."))
- .enablePlugins(ScalaJSBundlerPlugin)
+ .enablePlugins(ScalaJSBundlerPlugin, JSDependenciesPlugin)
.settings(
commonSettings,
commonJSSettings,
@@ -87,5 +85,6 @@ lazy val root = project.in(file("."))
),
Compile / npmDependencies += "jquery" -> "3.3.1",
+ jsDependencies += "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js",
Test / requireJsDomEnv := true
)
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 32852d9..8885338 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -3,7 +3,7 @@ import sbt._
object Dependencies {
val udashCoreVersion = "0.8.3"
- val udashJQueryVersion = "3.0.2"
+ val udashJQueryVersion = "3.0.0-SNAPSHOT"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core" % udashCoreVersion,
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 418498b..84c42cf 100755
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,6 +2,7 @@ logLevel := Level.Warn
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.17.0")
+addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.0")
// Deployment configuration
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
From 69208bc978779717fd54e9874a71cf28dc9bb745 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 26 Mar 2020 15:59:54 +0100
Subject: [PATCH 54/80] Restore global dep demo
---
example/build.sbt | 53 ++++++++++++++++++++++++++----
example/project/Dependencies.scala | 7 +++-
2 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/example/build.sbt b/example/build.sbt
index 422bf9d..103332f 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -28,15 +28,56 @@ val commonSettings = Seq(
)
val generatedGlobalDir = file("generated/global")
+val compileStatics = taskKey[Unit]("Compiles all static files.")
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
-val root = project.in(file("."))
+
+lazy val root: Project = project.in(file("."))
+ .aggregate(`jquery-bundler-demo`, `jquery-global-demo`)
+ .settings(
+ crossScalaVersions := Nil,
+ )
+
+lazy val `jquery-global-demo` = project.in(file("global-demo"))
.enablePlugins(ScalaJSPlugin)
- .settings(commonSettings)
+ .settings(
+ commonSettings,
-val generatedBundlerDir = file("generated")
-val compileStatics = taskKey[Unit]("Compiles all static files.")
+ jsDependencies ++= Dependencies.jsDeps.value,
+
+ sourceDirsSettings(_.getParentFile),
+
+ /* move these files out of target/. */
+ Compile / fullOptJS / crossTarget := generatedGlobalDir,
+ Compile / fastOptJS / crossTarget := generatedGlobalDir,
+ Compile / packageJSDependencies / crossTarget := generatedGlobalDir,
+ Compile / packageMinifiedJSDependencies / crossTarget := generatedGlobalDir,
+
+ Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value,
+ Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value,
+
+ scalaJSUseMainModuleInitializer := true,
+
+ copyAssets := {
+ IO.copyFile(
+ root.base / "src/main/assets/index.html",
+ generatedGlobalDir / "index.html"
+ )
+ },
+
+ compileStatics := (Compile / fastOptJS).value,
+
+ Compile / fastOptJS / artifactPath :=
+ (Compile / fastOptJS / crossTarget).value / "scripts" / "frontend-impl.js",
+ Compile / fullOptJS / artifactPath :=
+ (Compile / fullOptJS / crossTarget).value / "scripts" / "frontend-impl.js",
+ Compile / packageJSDependencies / artifactPath :=
+ (Compile / packageJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js",
+ Compile / packageMinifiedJSDependencies / artifactPath :=
+ (Compile / packageMinifiedJSDependencies / crossTarget).value / "scripts" / "frontend-deps.js"
+ )
-val example = project.in(file("."))
+val generatedBundlerDir = file("generated/bundler")
+lazy val `jquery-bundler-demo` = project.in(file("bundler-demo"))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
commonSettings,
@@ -47,7 +88,7 @@ val example = project.in(file("."))
copyAssets := {
IO.copyFile(
- sourceDirectory.value / "main/assets/index.html",
+ root.base / "src/main/assets/index.html",
generatedBundlerDir / "index.html"
)
},
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 8885338..92576f0 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,12 +1,17 @@
+import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt._
object Dependencies {
val udashCoreVersion = "0.8.3"
- val udashJQueryVersion = "3.0.0-SNAPSHOT"
+ val udashJQueryVersion = "3.0.2"
val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core" % udashCoreVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
+
+ val jsDeps = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID](
+ "org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
+ ))
}
\ No newline at end of file
From f913939db0a7e114fa797182604f2cbbd26fb2b5 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 26 Mar 2020 16:03:32 +0100
Subject: [PATCH 55/80] Restore separate index files
---
example/build.sbt | 6 +++---
.../{ => bundler-demo}/src/main/assets/index.html | 0
example/global-demo/src/main/assets/index.html | 13 +++++++++++++
3 files changed, 16 insertions(+), 3 deletions(-)
rename example/{ => bundler-demo}/src/main/assets/index.html (100%)
create mode 100644 example/global-demo/src/main/assets/index.html
diff --git a/example/build.sbt b/example/build.sbt
index 103332f..97e63f2 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -31,7 +31,7 @@ val generatedGlobalDir = file("generated/global")
val compileStatics = taskKey[Unit]("Compiles all static files.")
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
-lazy val root: Project = project.in(file("."))
+lazy val root = project.in(file("."))
.aggregate(`jquery-bundler-demo`, `jquery-global-demo`)
.settings(
crossScalaVersions := Nil,
@@ -59,7 +59,7 @@ lazy val `jquery-global-demo` = project.in(file("global-demo"))
copyAssets := {
IO.copyFile(
- root.base / "src/main/assets/index.html",
+ sourceDirectory.value / "main/assets/index.html",
generatedGlobalDir / "index.html"
)
},
@@ -88,7 +88,7 @@ lazy val `jquery-bundler-demo` = project.in(file("bundler-demo"))
copyAssets := {
IO.copyFile(
- root.base / "src/main/assets/index.html",
+ sourceDirectory.value / "main/assets/index.html",
generatedBundlerDir / "index.html"
)
},
diff --git a/example/src/main/assets/index.html b/example/bundler-demo/src/main/assets/index.html
similarity index 100%
rename from example/src/main/assets/index.html
rename to example/bundler-demo/src/main/assets/index.html
diff --git a/example/global-demo/src/main/assets/index.html b/example/global-demo/src/main/assets/index.html
new file mode 100644
index 0000000..9276c28
--- /dev/null
+++ b/example/global-demo/src/main/assets/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+ jquery-demo - ScalaJSBundlerPlugin demo
+
+
+
+
+
+
+
+
\ No newline at end of file
From 32bad57ae3f1de9edd83ab5ed61f1b8b2386b740 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Thu, 26 Mar 2020 16:08:22 +0100
Subject: [PATCH 56/80] Root project deps
---
example/build.sbt | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/example/build.sbt b/example/build.sbt
index 97e63f2..49478f2 100644
--- a/example/build.sbt
+++ b/example/build.sbt
@@ -32,10 +32,8 @@ val compileStatics = taskKey[Unit]("Compiles all static files.")
val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
lazy val root = project.in(file("."))
- .aggregate(`jquery-bundler-demo`, `jquery-global-demo`)
- .settings(
- crossScalaVersions := Nil,
- )
+ .enablePlugins(ScalaJSPlugin)
+ .settings(commonSettings)
lazy val `jquery-global-demo` = project.in(file("global-demo"))
.enablePlugins(ScalaJSPlugin)
From 6a737892db6aaff4ebc16a4e84c744fbd5670641 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Sun, 29 Mar 2020 13:52:51 +0200
Subject: [PATCH 57/80] Udash-less views
---
.../global-demo/src/main/assets/index.html | 4 +-
example/project/Dependencies.scala | 6 +--
.../demos/jquery/{init.scala => Init.scala} | 12 +----
.../demos/jquery/RoutingRegistryDef.scala | 29 ------------
.../jquery/StatesToViewPresenterDef.scala | 27 -----------
.../scala/io/udash/demos/jquery/states.scala | 32 -------------
.../udash/demos/jquery/views/ErrorView.scala | 13 ------
.../demos/jquery/views/FunctionView.scala | 15 ++++---
.../udash/demos/jquery/views/IndexView.scala | 45 +++++++++----------
.../udash/demos/jquery/views/RootView.scala | 16 -------
.../jquery/views/functions/AddBackView.scala | 20 ++++-----
.../jquery/views/functions/AddView.scala | 14 +++---
...{AfterView.scala => AfterBeforeView.scala} | 13 +++---
.../jquery/views/functions/AnimateView.scala | 16 +++----
.../views/functions/AppendPrependView.scala | 13 +++---
.../jquery/views/functions/AttrView.scala | 23 +++++-----
.../views/functions/CallbacksView.scala | 17 +++----
.../jquery/views/functions/ChildrenView.scala | 13 +++---
.../jquery/views/functions/DataView.scala | 13 +++---
.../jquery/views/functions/DeferredView.scala | 13 +++---
.../jquery/views/functions/EachView.scala | 13 +++---
.../jquery/views/functions/HideShowView.scala | 13 +++---
.../views/functions/OffsetPositionView.scala | 13 +++---
.../jquery/views/functions/OnOneOffView.scala | 15 +++----
24 files changed, 117 insertions(+), 291 deletions(-)
rename example/src/main/scala/io/udash/demos/jquery/{init.scala => Init.scala} (52%)
delete mode 100644 example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala
delete mode 100644 example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala
delete mode 100644 example/src/main/scala/io/udash/demos/jquery/states.scala
delete mode 100644 example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala
delete mode 100644 example/src/main/scala/io/udash/demos/jquery/views/RootView.scala
rename example/src/main/scala/io/udash/demos/jquery/views/functions/{AfterView.scala => AfterBeforeView.scala} (61%)
diff --git a/example/global-demo/src/main/assets/index.html b/example/global-demo/src/main/assets/index.html
index 9276c28..90d7641 100644
--- a/example/global-demo/src/main/assets/index.html
+++ b/example/global-demo/src/main/assets/index.html
@@ -2,12 +2,12 @@
- jquery-demo - ScalaJSBundlerPlugin demo
+ jquery-demo - global scope
-
+
\ No newline at end of file
diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala
index 92576f0..7be9655 100644
--- a/example/project/Dependencies.scala
+++ b/example/project/Dependencies.scala
@@ -1,13 +1,13 @@
-import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
+import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt._
object Dependencies {
- val udashCoreVersion = "0.8.3"
+ val scalatagsVersion = "0.8.6"
val udashJQueryVersion = "3.0.2"
val deps = Def.setting(Seq[ModuleID](
- "io.udash" %%% "udash-core" % udashCoreVersion,
+ "com.lihaoyi" %%% "scalatags" % scalatagsVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))
diff --git a/example/src/main/scala/io/udash/demos/jquery/init.scala b/example/src/main/scala/io/udash/demos/jquery/Init.scala
similarity index 52%
rename from example/src/main/scala/io/udash/demos/jquery/init.scala
rename to example/src/main/scala/io/udash/demos/jquery/Init.scala
index 549798b..0836569 100644
--- a/example/src/main/scala/io/udash/demos/jquery/init.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/Init.scala
@@ -1,22 +1,12 @@
package io.udash.demos.jquery
-import io.udash._
import io.udash.wrappers.jquery._
import org.scalajs.dom
import org.scalajs.dom.Element
import scala.scalajs.js.annotation.JSExport
-object Context {
- implicit val executionContext = scalajs.concurrent.JSExecutionContext.Implicits.queue
- private val routingRegistry = new RoutingRegistryDef
- private val viewPresenterRegistry = new StatesToViewPresenterDef
-
- implicit val applicationInstance = new Application[RoutingState](routingRegistry, viewPresenterRegistry)
-}
-
object Init {
- import Context._
@JSExport
def main(args: Array[String]): Unit = {
@@ -25,7 +15,7 @@ object Init {
if (appRoot.isEmpty) {
dom.console.error("Application root element not found! Check you index.html file!")
} else {
- applicationInstance.run(appRoot.get)
+ //applicationInstance.run(appRoot.get)
}
})
}
diff --git a/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala b/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala
deleted file mode 100644
index f43d899..0000000
--- a/example/src/main/scala/io/udash/demos/jquery/RoutingRegistryDef.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-package io.udash.demos.jquery
-
-import io.udash._
-
-class RoutingRegistryDef extends RoutingRegistry[RoutingState] {
- def matchUrl(url: Url): RoutingState =
- url2State.applyOrElse(url.value.stripSuffix("/"), (x: String) => ErrorState)
-
- def matchState(state: RoutingState): Url =
- Url(state2Url.apply(state))
-
- private val (url2State, state2Url) = bidirectional {
- case "" => IndexState
- case "/add" => AddState
- case "/addBack" => AddBackState
- case "/after" => AfterBeforeState
- case "/animate" => AnimateState
- case "/append" => AppendPrependState
- case "/attr" => AttrState
- case "/callbacks" => CallbacksState
- case "/children" => ChildrenState
- case "/data" => DataState
- case "/deferred" => DeferredState
- case "/each" => EachState
- case "/hide" => HideShowState
- case "/offset" => OffsetPositionState
- case "/on" => OnOneOffState
- }
-}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala b/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala
deleted file mode 100644
index dee3a6e..0000000
--- a/example/src/main/scala/io/udash/demos/jquery/StatesToViewPresenterDef.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.udash.demos.jquery
-
-import io.udash._
-import io.udash.demos.jquery.views.functions._
-import io.udash.demos.jquery.views.{ErrorViewPresenter, IndexViewPresenter, RootViewPresenter}
-
-class StatesToViewPresenterDef extends ViewFactoryRegistry[RoutingState] {
- def matchStateToResolver(state: RoutingState): ViewFactory[_ <: RoutingState] = state match {
- case RootState => RootViewPresenter
- case IndexState => IndexViewPresenter
- case AddState => AddViewPresenter
- case AddBackState => AddBackViewPresenter
- case AfterBeforeState => AfterBeforeViewPresenter
- case AnimateState => AnimateViewPresenter
- case AppendPrependState => AppendPrependViewPresenter
- case AttrState => AttrViewPresenter
- case CallbacksState => CallbacksViewPresenter
- case ChildrenState => ChildrenViewPresenter
- case DataState => DataViewPresenter
- case DeferredState => DeferredViewPresenter
- case EachState => EachViewPresenter
- case HideShowState => HideShowViewPresenter
- case OnOneOffState => OnOneOffViewPresenter
- case OffsetPositionState => OffsetPositionViewPresenter
- case _ => ErrorViewPresenter
- }
-}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/states.scala b/example/src/main/scala/io/udash/demos/jquery/states.scala
deleted file mode 100644
index f4e7452..0000000
--- a/example/src/main/scala/io/udash/demos/jquery/states.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.udash.demos.jquery
-
-import io.udash._
-
-sealed abstract class RoutingState(val parentState: Option[ContainerRoutingState]) extends State {
- type HierarchyRoot = RoutingState
-
- def url(implicit application: Application[RoutingState]): String =
- s"#${application.matchState(this).value}"
-}
-
-sealed abstract class ContainerRoutingState(parentState: Option[ContainerRoutingState]) extends RoutingState(parentState) with ContainerState
-sealed abstract class FinalRoutingState(parentState: ContainerRoutingState) extends RoutingState(Option(parentState)) with FinalState
-
-
-case object RootState extends ContainerRoutingState(None)
-case object ErrorState extends FinalRoutingState(RootState)
-case object IndexState extends FinalRoutingState(RootState)
-case object AddState extends FinalRoutingState(RootState)
-case object AddBackState extends FinalRoutingState(RootState)
-case object AfterBeforeState extends FinalRoutingState(RootState)
-case object AnimateState extends FinalRoutingState(RootState)
-case object AppendPrependState extends FinalRoutingState(RootState)
-case object AttrState extends FinalRoutingState(RootState)
-case object CallbacksState extends FinalRoutingState(RootState)
-case object ChildrenState extends FinalRoutingState(RootState)
-case object DataState extends FinalRoutingState(RootState)
-case object DeferredState extends FinalRoutingState(RootState)
-case object EachState extends FinalRoutingState(RootState)
-case object HideShowState extends FinalRoutingState(RootState)
-case object OffsetPositionState extends FinalRoutingState(RootState)
-case object OnOneOffState extends FinalRoutingState(RootState)
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala b/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala
deleted file mode 100644
index a2b8fa7..0000000
--- a/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.udash.demos.jquery.views
-
-import io.udash._
-import io.udash.demos.jquery.IndexState
-
-object ErrorViewPresenter extends StaticViewFactory[IndexState.type](() => new ErrorView)
-
-class ErrorView extends FinalView {
- import scalatags.JsDom.all._
-
- override def getTemplate: Modifier =
- h3("URL not found!")
-}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala b/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala
index 5874d47..d26459e 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala
@@ -1,19 +1,20 @@
package io.udash.demos.jquery.views
-import io.udash._
-import org.scalajs.dom.{Element, Event}
+import org.scalajs.dom.Event
+
+abstract class FunctionView {
-abstract class FunctionView extends FinalView {
import scalatags.JsDom.all._
- protected val content: Element
- protected val script: () => Any
+ protected def content: Modifier
+
+ protected def script: () => Any
- override def getTemplate: Modifier =
+ final def getTemplate: Modifier =
div(
content,
button(
- onclick :+= ((_: Event) => {
+ onclick := ((_: Event) => {
script()
false
})
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
index cad18f0..4783c0f 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
@@ -1,33 +1,30 @@
package io.udash.demos.jquery.views
-import io.udash._
-import io.udash.demos.jquery._
+import io.udash.demos.jquery.views.functions._
-object IndexViewPresenter extends StaticViewFactory[IndexState.type](() => new IndexView)
+object IndexView {
-class IndexView extends FinalView {
- import Context._
import scalatags.JsDom.all._
- private val content = div(
- "Take a look at following demo pages:",
- ul(
- li(a(href := AddState.url)(".add() & .css()")),
- li(a(href := AddBackState.url)(".addBack() & .addClass()")),
- li(a(href := AfterBeforeState.url)(".after() & .before()")),
- li(a(href := AnimateState.url)(".animate() & .click()")),
- li(a(href := AppendPrependState.url)(".append() & .prepend()")),
- li(a(href := AttrState.url)(".attr()")),
- li(a(href := CallbacksState.url)("Callbacks")),
- li(a(href := ChildrenState.url)(".children()")),
- li(a(href := DataState.url)(".data()")),
- li(a(href := DeferredState.url)("Deferred")),
- li(a(href := EachState.url)(".each()")),
- li(a(href := HideShowState.url)(".hide() & .show()")),
- li(a(href := OnOneOffState.url)(".on() & .one() & .off()")),
- li(a(href := OffsetPositionState.url)(".offset() & .position()"))
- )
+ private val demos = Seq(
+ AddBackView,
+ AddView,
+ AfterBeforeView,
+ AnimateView,
+ AppendPrependView,
+ AttrView,
+ CallbacksView,
+ ChildrenView,
+ DataView,
+ DeferredView,
+ EachView,
+ HideShowView,
+ OffsetPositionView,
+ OnOneOffView,
)
- override def getTemplate: Modifier = content
+ final val content = div(
+ "Take a look at following demo pages:",
+ demos.map(_.getTemplate),
+ )
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala b/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala
deleted file mode 100644
index 3906559..0000000
--- a/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.udash.demos.jquery.views
-
-import io.udash._
-import io.udash.demos.jquery.{Context, IndexState, RootState}
-
-object RootViewPresenter extends StaticViewFactory[RootState.type](() => new RootView)
-
-class RootView extends ContainerView {
- import Context._
- import scalatags.JsDom.all._
-
- override def getTemplate: Modifier = div(
- a(href := IndexState.url)(h1("jquery-demo")),
- childViewContainer
- )
-}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
index cdc25ba..620c320 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
@@ -1,19 +1,15 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-
import scalatags.JsDom.tags2
-object AddBackViewPresenter extends StaticViewFactory[IndexState.type](() => new AddBackView)
-
/** Based on examples from: jQuery Docs. */
-class AddBackView extends FunctionView {
+object AddBackView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".addBack() & .addClass()"),
tags2.style(
""".demo p, .demo div {
@@ -48,15 +44,15 @@ class AddBackView extends FunctionView {
p("Second Paragraph")
)
)
- ).render
+ )
- override protected val script = () => {
- jQ( ".demo div.left, .demo div.right" ).find( "div, div > p" ).addClass( "border" )
+ override protected def script = () => {
+ jQ(".demo div.left, .demo div.right").find("div, div > p").addClass("border")
// First Example
- jQ( ".demo div.before-addback" ).find( "p" ).addClass( "background" )
+ jQ(".demo div.before-addback").find("p").addClass("background")
// Second Example
- jQ( ".demo div.after-addback" ).find( "p" ).addBack().addClass( "background" )
+ jQ(".demo div.after-addback").find("p").addBack().addClass("background")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
index 9c0b0d8..f97749d 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
@@ -1,19 +1,15 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-
import scalatags.JsDom.tags2
-object AddViewPresenter extends StaticViewFactory[IndexState.type](() => new AddView)
-
/** Based on examples from: jQuery Docs. */
-class AddView extends FunctionView {
+object AddView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".add() & .css()"),
tags2.style(
""".demo div {
@@ -38,9 +34,9 @@ class AddView extends FunctionView {
div(),
div(),
p("Added this... (notice no border)")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo div").css("border", "2px solid red")
.add(".demo p")
.css("background", "yellow")
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala
similarity index 61%
rename from example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala
rename to example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala
index 7e61e09..32acbed 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala
@@ -1,17 +1,14 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object AfterBeforeViewPresenter extends StaticViewFactory[IndexState.type](() => new AfterBeforeView)
-
/** Based on examples from: jQuery Docs. */
-class AfterBeforeView extends FunctionView {
+object AfterBeforeView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".after()"),
div(
p(cls := "after")("I would like to say: ")
@@ -20,9 +17,9 @@ class AfterBeforeView extends FunctionView {
div(
p(cls := "before")("is what I said...")
)
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".after").after("Hello")
jQ(".before").before("Hello")
}
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
index c1c8693..ec14da8 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
@@ -1,20 +1,16 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.Element
-
import scalatags.JsDom.tags2
-object AnimateViewPresenter extends StaticViewFactory[IndexState.type](() => new AnimateView)
-
/** Based on examples from: jQuery Docs. */
-class AnimateView extends FunctionView {
+object AnimateView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".animate() & .click()"),
tags2.style(
""".demo div {
@@ -36,11 +32,11 @@ class AnimateView extends FunctionView {
button(id := "go4", disabled := "disabled")("» Reset"),
div(id := "block1")("Block1"),
div(id := "block2")("Block2")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ("#go1").on(EventName.click, (_: Element, _: JQueryEvent) => {
- jQ( "#block1" )
+ jQ("#block1")
.animate(Map(
"width" -> "90%"
), AnimationOptions(
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
index 2908b43..90d01e5 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
@@ -1,24 +1,21 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object AppendPrependViewPresenter extends StaticViewFactory[IndexState.type](() => new AppendPrependView)
-
/** Based on examples from: jQuery Docs. */
-class AppendPrependView extends FunctionView {
+object AppendPrependView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".append()"),
p(id := "append")("I would like to say: "),
h3(".prepend()"),
p(id := "prepend")("amigo!")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ("#append").append("hello")
jQ("#prepend").prepend("Hello ")
}
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
index 7ae29d0..3fc4748 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
@@ -1,45 +1,42 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.{Element, Event}
-object AttrViewPresenter extends StaticViewFactory[IndexState.type](() => new AttrView)
-
/** Based on examples from: jQuery Docs. */
-class AttrView extends FunctionView {
+object AttrView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".attr() & .prop()"),
input(id := "check1", tpe := "checkbox", checked := "checked"),
label(`for` := "check1")("Check me"),
p(),
- button(onclick :+= ((_: Event) => {
+ button(onclick := ((_: Event) => {
jQ(".demo input").attr("data-checked", "checked").trigger("change")
false
}))(".attr(\"data-checked\", \"checked\")"),
- button(onclick :+= ((_: Event) => {
+ button(onclick := ((_: Event) => {
jQ(".demo input").attr("data-checked", "").trigger("change")
false
}))(".attr(\"data-checked\", \"\")"),
- button(onclick :+= ((_: Event) => {
+ button(onclick := ((_: Event) => {
jQ(".demo input").attr("data-checked", null).trigger("change")
false
}))(".attr(\"data-checked\", null)"), br(),
- button(onclick :+= ((_: Event) => {
+ button(onclick := ((_: Event) => {
jQ(".demo input").prop("checked", true).trigger("change")
false
}))(".prop(\"checked\", true)"),
- button(onclick :+= ((_: Event) => {
+ button(onclick := ((_: Event) => {
jQ(".demo input").prop("checked", false).trigger("change")
false
}))(".prop(\"checked\", false)")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo input").on(EventName.change, (input: Element, _: JQueryEvent) => {
jQ(".demo p").html(
s""".attr('data-checked'): ${jQ(input).attr("data-checked")}
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
index e3824bb..639b700 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
@@ -1,35 +1,32 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import scala.scalajs.js
-object CallbacksViewPresenter extends StaticViewFactory[IndexState.type](() => new CallbacksView)
-
/** Based on examples from: jQuery Docs. */
-class CallbacksView extends FunctionView {
+object CallbacksView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3("Callbacks"),
ul(id := "plus"),
ul(id := "minus"),
ul(id := "mul"),
ul(id := "div")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
val callbacks = jQ.callbacks[js.Function1[(Int, Int), js.Any], (Int, Int)]()
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
- jQ("#plus").append(li(s"$a + $b = ${a+b}").render)
+ jQ("#plus").append(li(s"$a + $b = ${a + b}").render)
})
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
- jQ("#minus").append(li(s"$a - $b = ${a-b}").render)
+ jQ("#minus").append(li(s"$a - $b = ${a - b}").render)
})
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
index ea4d0f6..a1e492e 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
@@ -1,17 +1,14 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object ChildrenViewPresenter extends StaticViewFactory[IndexState.type](() => new ChildrenView)
-
/** Based on examples from: jQuery Docs. */
-class ChildrenView extends FunctionView {
+object ChildrenView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".children()"),
div(
span("Hello"),
@@ -19,9 +16,9 @@ class ChildrenView extends FunctionView {
div(cls := "selected")("and again"),
p("and one last time.")
)
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo div").children().css("color", "blue")
jQ(".demo div").children(".selected").css("border-bottom", "3px double red")
jQ(".demo div").children("div.selected").css("border-top", "1px dashed green")
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
index f905ec5..3f315f6 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
@@ -1,17 +1,14 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object DataViewPresenter extends StaticViewFactory[IndexState.type](() => new DataView)
-
/** Based on examples from: jQuery Docs. */
-class DataView extends FunctionView {
+object DataView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".data()"),
div(
"The values stored were ",
@@ -19,9 +16,9 @@ class DataView extends FunctionView {
" and ",
span("_")
)
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo div").data("test", Map("first" -> 16, "last" -> "pizza!"))
val data: Map[String, Any] = jQ(".demo div").data("test").get.asInstanceOf[Map[String, Any]]
jQ(".demo div span:first").text(data.get("first").get.toString)
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
index 82ee717..a4e1cbe 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
@@ -1,22 +1,19 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.Event
import scala.scalajs.js
-object DeferredViewPresenter extends StaticViewFactory[IndexState.type](() => new DeferredView)
-
/** Based on examples from: jQuery Docs. */
-class DeferredView extends FunctionView {
+object DeferredView extends FunctionView {
+
import scalatags.JsDom.all._
var deferred: JQueryDeferred[js.Function1[Int, js.Any], Int] = null
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3("Deferred"),
div(
div(id := "deferred")("???"),
@@ -42,9 +39,9 @@ class DeferredView extends FunctionView {
})
)("Notify(1)")
)
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo button").prop("disabled", "")
deferred = jQ.deferred[js.Function1[Int, js.Any], Int]()
jQ("#deferred").text(s"Waiting...")
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
index 447267b..dd64fc7 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
@@ -1,25 +1,22 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.Element
-object EachViewPresenter extends StaticViewFactory[IndexState.type](() => new EachView)
-
/** Based on examples from: jQuery Docs. */
-class EachView extends FunctionView {
+object EachView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".each()"),
div("Click button"),
div("to iterate through"),
div("these divs.")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo div").each((el: Element, idx: Int) => {
jQ(el).replaceWith(span(s"${el.textContent} ").render)
})
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
index 9ed0a46..4227d2c 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
@@ -1,22 +1,19 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object HideShowViewPresenter extends StaticViewFactory[IndexState.type](() => new HideShowView)
-
/** Based on examples from: jQuery Docs. */
-class HideShowView extends FunctionView {
+object HideShowView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".hide() & .show()"),
div("Click button to hide me")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo div")
.hide(AnimationOptions(
duration = Some(3000),
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
index 9ec5d02..9ad4328 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
@@ -1,25 +1,22 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.OffsetPositionState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
-object OffsetPositionViewPresenter extends StaticViewFactory[OffsetPositionState.type](() => new OffsetPositionView)
-
/** Based on examples from: jQuery Docs. */
-class OffsetPositionView extends FunctionView {
+object OffsetPositionView extends FunctionView {
+
import scalatags.JsDom.all._
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".offset() & .position()"),
div(style := "padding: 12px; border: 1px red solid;")(
p(style := "margin-left: 10px; border: 1px blue solid;")("Hello world!")
),
p(id := "results")("")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
val div = jQ(".demo div")
val p = jQ(".demo div p")
jQ("#results").html(
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
index 08035d0..1c0de22 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
@@ -1,15 +1,12 @@
package io.udash.demos.jquery.views.functions
-import io.udash._
-import io.udash.demos.jquery.IndexState
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
import org.scalajs.dom.{Element, Event}
-object OnOneOffViewPresenter extends StaticViewFactory[IndexState.type](() => new OnOneOffView)
-
/** Based on examples from: jQuery Docs. */
-class OnOneOffView extends FunctionView {
+object OnOneOffView extends FunctionView {
+
import scalatags.JsDom.all._
val onCallback = (_: Element, _: JQueryEvent) =>
@@ -17,23 +14,23 @@ class OnOneOffView extends FunctionView {
val oneCallback = (_: Element, _: JQueryEvent) =>
jQ(".demo ul").append(li("This will be added only once").render)
- override protected val content = div(cls := "demo")(
+ override protected def content = div(cls := "demo")(
h3(".on() & .one() & .off()"),
button(id := "click", disabled := "disabled")("Click me"),
ul(),
button(
id := "off",
disabled := "disabled",
- onclick :+= ((_: Event) => {
+ onclick := ((_: Event) => {
jQ(".demo #click")
.off(EventName.click, onCallback)
.off(EventName.click, oneCallback)
false
})
)("Off")
- ).render
+ )
- override protected val script = () => {
+ override protected def script = () => {
jQ(".demo #click")
.on(EventName.click, onCallback)
.one(EventName.click, oneCallback)
From 02637545b9994ea261b30ce307a94222178402c7 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Mon, 30 Mar 2020 08:25:54 +0200
Subject: [PATCH 58/80] Append demos
---
example/src/main/scala/io/udash/demos/jquery/Init.scala | 2 ++
.../main/scala/io/udash/demos/jquery/views/IndexView.scala | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/example/src/main/scala/io/udash/demos/jquery/Init.scala b/example/src/main/scala/io/udash/demos/jquery/Init.scala
index 0836569..40ed49c 100644
--- a/example/src/main/scala/io/udash/demos/jquery/Init.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/Init.scala
@@ -1,5 +1,6 @@
package io.udash.demos.jquery
+import io.udash.demos.jquery.views.IndexView
import io.udash.wrappers.jquery._
import org.scalajs.dom
import org.scalajs.dom.Element
@@ -15,6 +16,7 @@ object Init {
if (appRoot.isEmpty) {
dom.console.error("Application root element not found! Check you index.html file!")
} else {
+ appRoot.get.appendChild(IndexView.content.render)
//applicationInstance.run(appRoot.get)
}
})
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
index 4783c0f..672b852 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
@@ -24,7 +24,7 @@ object IndexView {
)
final val content = div(
- "Take a look at following demo pages:",
- demos.map(_.getTemplate),
+ "Take a look at following demos:",
+ demos.map(demo => div(demo.getTemplate)),
)
}
\ No newline at end of file
From 64ddf4b652d5a588601d81addc19693ebe847c94 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Mon, 30 Mar 2020 10:34:05 +0200
Subject: [PATCH 59/80] Fixes for single view scripts
---
.../demos/jquery/views/FunctionView.scala | 9 ++++---
.../udash/demos/jquery/views/IndexView.scala | 2 +-
.../jquery/views/functions/AddBackView.scala | 26 ++++++-------------
.../jquery/views/functions/AddView.scala | 12 ++++-----
.../views/functions/AfterBeforeView.scala | 8 +++---
.../jquery/views/functions/AnimateView.scala | 26 +++++++++----------
.../views/functions/AppendPrependView.scala | 8 +++---
.../jquery/views/functions/AttrView.scala | 19 +++++++-------
.../views/functions/CallbacksView.scala | 12 ++++-----
.../jquery/views/functions/ChildrenView.scala | 10 +++----
.../jquery/views/functions/DataView.scala | 12 ++++-----
.../jquery/views/functions/DeferredView.scala | 14 +++++-----
.../jquery/views/functions/EachView.scala | 6 ++---
.../jquery/views/functions/HideShowView.scala | 6 ++---
.../views/functions/OffsetPositionView.scala | 10 +++----
.../jquery/views/functions/OnOneOffView.scala | 15 ++++++-----
16 files changed, 94 insertions(+), 101 deletions(-)
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala b/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala
index d26459e..e3c7360 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala
@@ -1,23 +1,24 @@
package io.udash.demos.jquery.views
-import org.scalajs.dom.Event
+import org.scalajs.dom.{Element, Event}
abstract class FunctionView {
import scalatags.JsDom.all._
- protected def content: Modifier
+ protected val content: Element
protected def script: () => Any
final def getTemplate: Modifier =
div(
content,
- button(
+ h3(button(
+ marginTop := 10.px,
onclick := ((_: Event) => {
script()
false
})
- )("Run script")
+ )("Run script"))
)
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
index 672b852..0a1e7e2 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala
@@ -25,6 +25,6 @@ object IndexView {
final val content = div(
"Take a look at following demos:",
- demos.map(demo => div(demo.getTemplate)),
+ demos.map(demo => Seq(hr, div(demo.getTemplate))),
)
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
index 620c320..3927a6b 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddBackView.scala
@@ -9,25 +9,15 @@ object AddBackView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(cls := "addback")(
h3(".addBack() & .addClass()"),
tags2.style(
- """.demo p, .demo div {
- | margin: 5px;
- | padding: 5px;
- |}
- |.border {
+ """
+ |.addback .border {
| border: 2px solid red;
|}
- |.background {
+ |.addback .background {
| background: yellow;
- |}
- |.left, .right {
- | width: 45%;
- | float: left;
- |}
- |.right {
- | margin-left: 3%;
|}""".stripMargin
),
div(cls := "left")(
@@ -44,15 +34,15 @@ object AddBackView extends FunctionView {
p("Second Paragraph")
)
)
- )
+ ).render
override protected def script = () => {
- jQ(".demo div.left, .demo div.right").find("div, div > p").addClass("border")
+ jQ("div.left, div.right", content).find("div, div > p").addClass("border")
// First Example
- jQ(".demo div.before-addback").find("p").addClass("background")
+ jQ("div.before-addback", content).find("p").addClass("background")
// Second Example
- jQ(".demo div.after-addback").find("p").addBack().addClass("background")
+ jQ("div.after-addback", content).find("p").addBack().addClass("background")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
index f97749d..45c65f1 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AddView.scala
@@ -9,16 +9,16 @@ object AddView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(cls := "addview")(
h3(".add() & .css()"),
tags2.style(
- """.demo div {
+ """.addview div {
| width: 60px;
| height: 60px;
| margin: 10px;
| float: left;
|}
- |.demo p {
+ |.addview p {
| clear: left;
| font-weight: bold;
| font-size: 16px;
@@ -34,11 +34,11 @@ object AddView extends FunctionView {
div(),
div(),
p("Added this... (notice no border)")
- )
+ ).render
override protected def script = () => {
- jQ(".demo div").css("border", "2px solid red")
- .add(".demo p")
+ jQ("div", content).css("border", "2px solid red")
+ .add("p", content)
.css("background", "yellow")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala
index 32acbed..3aaf39d 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala
@@ -8,7 +8,7 @@ object AfterBeforeView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".after()"),
div(
p(cls := "after")("I would like to say: ")
@@ -17,10 +17,10 @@ object AfterBeforeView extends FunctionView {
div(
p(cls := "before")("is what I said...")
)
- )
+ ).render
override protected def script = () => {
- jQ(".after").after("Hello")
- jQ(".before").before("Hello")
+ jQ(".after", content).after("Hello")
+ jQ(".before", content).before("Hello")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
index ec14da8..445631d 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AnimateView.scala
@@ -10,10 +10,10 @@ object AnimateView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(cls := "animate")(
h3(".animate() & .click()"),
tags2.style(
- """.demo div {
+ """.animate div {
| background-color: #bca;
| width: 200px;
| height: 1.1em;
@@ -22,7 +22,7 @@ object AnimateView extends FunctionView {
| margin: 3px;
| font-size: 14px;
|}
- |.demo button {
+ |.animate button {
| font-size: 14px;
|}""".stripMargin
),
@@ -32,11 +32,11 @@ object AnimateView extends FunctionView {
button(id := "go4", disabled := "disabled")("» Reset"),
div(id := "block1")("Block1"),
div(id := "block2")("Block2")
- )
+ ).render
override protected def script = () => {
- jQ("#go1").on(EventName.click, (_: Element, _: JQueryEvent) => {
- jQ("#block1")
+ jQ("#go1", content).on(EventName.click, (_: Element, _: JQueryEvent) => {
+ jQ("#block1", content)
.animate(Map(
"width" -> "90%"
), AnimationOptions(
@@ -47,27 +47,27 @@ object AnimateView extends FunctionView {
.animate(Map("borderRightWidth" -> "15px"), 1500)
})
- jQ("#go2").on(EventName.click, (_: Element, _: JQueryEvent) => {
- jQ("#block2")
+ jQ("#go2", content).on(EventName.click, (_: Element, _: JQueryEvent) => {
+ jQ("#block2", content)
.animate(Map("width" -> "90%"), 1000)
.animate(Map("fontSize" -> "24px"), 1000)
.animate(Map("borderLeftWidth" -> "15px"), 1000)
})
- jQ("#go3").on(EventName.click, (_: Element, _: JQueryEvent) => {
- jQ("#go1").add("#go2").trigger("click")
+ jQ("#go3", content).on(EventName.click, (_: Element, _: JQueryEvent) => {
+ jQ("#go1", content).add("#go2", content).trigger("click")
})
- jQ("#go4").on(EventName.click, (_: Element, _: JQueryEvent) => {
+ jQ("#go4", content).on(EventName.click, (_: Element, _: JQueryEvent) => {
// TODO: It does not work without explicit Map elements type
import scala.scalajs.js.`|`
- jQ("div").css(Map[String, String | Int | Double | Boolean](
+ jQ("div", content).css(Map[String, String | Int | Double | Boolean](
"width" -> "",
"fontSize" -> "",
"borderWidth" -> ""
))
})
- jQ(".demo button").prop("disabled", "")
+ jQ("button", content).prop("disabled", "")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
index 90d01e5..b5d2d81 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AppendPrependView.scala
@@ -8,15 +8,15 @@ object AppendPrependView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".append()"),
p(id := "append")("I would like to say: "),
h3(".prepend()"),
p(id := "prepend")("amigo!")
- )
+ ).render
override protected def script = () => {
- jQ("#append").append("hello")
- jQ("#prepend").prepend("Hello ")
+ jQ("#append", content).append("hello")
+ jQ("#prepend", content).prepend("Hello ")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
index 3fc4748..0c6f2be 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/AttrView.scala
@@ -2,6 +2,7 @@ package io.udash.demos.jquery.views.functions
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
+import org.scalajs.dom.html.Div
import org.scalajs.dom.{Element, Event}
/** Based on examples from: jQuery Docs. */
@@ -9,36 +10,36 @@ object AttrView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content: Div = div(
h3(".attr() & .prop()"),
input(id := "check1", tpe := "checkbox", checked := "checked"),
label(`for` := "check1")("Check me"),
p(),
button(onclick := ((_: Event) => {
- jQ(".demo input").attr("data-checked", "checked").trigger("change")
+ jQ("input", content).attr("data-checked", "checked").trigger("change")
false
}))(".attr(\"data-checked\", \"checked\")"),
button(onclick := ((_: Event) => {
- jQ(".demo input").attr("data-checked", "").trigger("change")
+ jQ("input", content).attr("data-checked", "").trigger("change")
false
}))(".attr(\"data-checked\", \"\")"),
button(onclick := ((_: Event) => {
- jQ(".demo input").attr("data-checked", null).trigger("change")
+ jQ("input", content).attr("data-checked", null).trigger("change")
false
}))(".attr(\"data-checked\", null)"), br(),
button(onclick := ((_: Event) => {
- jQ(".demo input").prop("checked", true).trigger("change")
+ jQ("input", content).prop("checked", true).trigger("change")
false
}))(".prop(\"checked\", true)"),
button(onclick := ((_: Event) => {
- jQ(".demo input").prop("checked", false).trigger("change")
+ jQ("input", content).prop("checked", false).trigger("change")
false
}))(".prop(\"checked\", false)")
- )
+ ).render
override protected def script = () => {
- jQ(".demo input").on(EventName.change, (input: Element, _: JQueryEvent) => {
- jQ(".demo p").html(
+ jQ("input", content).on(EventName.change, (input: Element, _: JQueryEvent) => {
+ jQ("p", content).html(
s""".attr('data-checked'): ${jQ(input).attr("data-checked")}
|.prop('checked'): ${jQ(input).prop("checked")}
|.is(':checked'): ${jQ(input).is(":checked")}""".stripMargin
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
index 639b700..a7a8243 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/CallbacksView.scala
@@ -10,31 +10,31 @@ object CallbacksView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3("Callbacks"),
ul(id := "plus"),
ul(id := "minus"),
ul(id := "mul"),
ul(id := "div")
- )
+ ).render
override protected def script = () => {
val callbacks = jQ.callbacks[js.Function1[(Int, Int), js.Any], (Int, Int)]()
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
- jQ("#plus").append(li(s"$a + $b = ${a + b}").render)
+ jQ("#plus", content).append(li(s"$a + $b = ${a + b}").render)
})
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
- jQ("#minus").append(li(s"$a - $b = ${a - b}").render)
+ jQ("#minus", content).append(li(s"$a - $b = ${a - b}").render)
})
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
- jQ("#mul").append(li(s"$a * $b = ${a*b}").render)
+ jQ("#mul", content).append(li(s"$a * $b = ${a * b}").render)
})
callbacks.add((t: (Int, Int)) => {
val (a, b) = t
- jQ("#div").append(li(s"$a / $b = ${a/b}").render)
+ jQ("#div", content).append(li(s"$a / $b = ${a / b}").render)
})
callbacks.fire((1, 1))
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
index a1e492e..7043bc8 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/ChildrenView.scala
@@ -8,7 +8,7 @@ object ChildrenView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".children()"),
div(
span("Hello"),
@@ -16,11 +16,11 @@ object ChildrenView extends FunctionView {
div(cls := "selected")("and again"),
p("and one last time.")
)
- )
+ ).render
override protected def script = () => {
- jQ(".demo div").children().css("color", "blue")
- jQ(".demo div").children(".selected").css("border-bottom", "3px double red")
- jQ(".demo div").children("div.selected").css("border-top", "1px dashed green")
+ jQ("div", content).children().css("color", "blue")
+ jQ("div", content).children(".selected").css("border-bottom", "3px double red")
+ jQ("div", content).children("div.selected").css("border-top", "1px dashed green")
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
index 3f315f6..ad3f660 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/DataView.scala
@@ -8,7 +8,7 @@ object DataView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".data()"),
div(
"The values stored were ",
@@ -16,12 +16,12 @@ object DataView extends FunctionView {
" and ",
span("_")
)
- )
+ ).render
override protected def script = () => {
- jQ(".demo div").data("test", Map("first" -> 16, "last" -> "pizza!"))
- val data: Map[String, Any] = jQ(".demo div").data("test").get.asInstanceOf[Map[String, Any]]
- jQ(".demo div span:first").text(data.get("first").get.toString)
- jQ(".demo div span:last").text(data.get("last").get.toString)
+ jQ("div", content).data("test", Map("first" -> 16, "last" -> "pizza!"))
+ val data: Map[String, Any] = jQ("div", content).data("test").get.asInstanceOf[Map[String, Any]]
+ jQ("div span:first", content).text(data.get("first").get.toString)
+ jQ("div span:last", content).text(data.get("last").get.toString)
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
index a4e1cbe..ae31443 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/DeferredView.scala
@@ -13,7 +13,7 @@ object DeferredView extends FunctionView {
var deferred: JQueryDeferred[js.Function1[Int, js.Any], Int] = null
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3("Deferred"),
div(
div(id := "deferred")("???"),
@@ -39,14 +39,14 @@ object DeferredView extends FunctionView {
})
)("Notify(1)")
)
- )
+ ).render
override protected def script = () => {
- jQ(".demo button").prop("disabled", "")
+ jQ("button", content).prop("disabled", "")
deferred = jQ.deferred[js.Function1[Int, js.Any], Int]()
- jQ("#deferred").text(s"Waiting...")
- deferred.done((i: Int) => jQ("#deferred").text(s"Done: $i"))
- deferred.fail((i: Int) => jQ("#deferred").text(s"Fail: $i"))
- deferred.progress((i: Int) => jQ("#deferred").text(s"Progress: $i"))
+ jQ("#deferred", content).text(s"Waiting...")
+ deferred.done((i: Int) => jQ("#deferred", content).text(s"Done: $i"))
+ deferred.fail((i: Int) => jQ("#deferred", content).text(s"Fail: $i"))
+ deferred.progress((i: Int) => jQ("#deferred", content).text(s"Progress: $i"))
}
}
\ No newline at end of file
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
index dd64fc7..0f5097a 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/EachView.scala
@@ -9,15 +9,15 @@ object EachView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".each()"),
div("Click button"),
div("to iterate through"),
div("these divs.")
- )
+ ).render
override protected def script = () => {
- jQ(".demo div").each((el: Element, idx: Int) => {
+ jQ("div", content).each((el: Element, idx: Int) => {
jQ(el).replaceWith(span(s"${el.textContent} ").render)
})
}
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
index 4227d2c..7a1d137 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/HideShowView.scala
@@ -8,13 +8,13 @@ object HideShowView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".hide() & .show()"),
div("Click button to hide me")
- )
+ ).render
override protected def script = () => {
- jQ(".demo div")
+ jQ("div", content)
.hide(AnimationOptions(
duration = Some(3000),
easing = Some(EasingFunction.linear)
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
index 9ad4328..0796b29 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OffsetPositionView.scala
@@ -8,18 +8,18 @@ object OffsetPositionView extends FunctionView {
import scalatags.JsDom.all._
- override protected def content = div(cls := "demo")(
+ override protected val content = div(
h3(".offset() & .position()"),
div(style := "padding: 12px; border: 1px red solid;")(
p(style := "margin-left: 10px; border: 1px blue solid;")("Hello world!")
),
p(id := "results")("")
- )
+ ).render
override protected def script = () => {
- val div = jQ(".demo div")
- val p = jQ(".demo div p")
- jQ("#results").html(
+ val div = jQ("div", content)
+ val p = jQ("div p", content)
+ jQ("#results", content).html(
s"""Div offset: (${div.offset().top}, ${div.offset().left})
|Div position: (${div.position().top}, ${div.position().left})
|Paragraph offset: (${p.offset().top}, ${p.offset().left})
diff --git a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
index 1c0de22..368f69f 100644
--- a/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
+++ b/example/src/main/scala/io/udash/demos/jquery/views/functions/OnOneOffView.scala
@@ -2,6 +2,7 @@ package io.udash.demos.jquery.views.functions
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
+import org.scalajs.dom.html.Div
import org.scalajs.dom.{Element, Event}
/** Based on examples from: jQuery Docs. */
@@ -10,11 +11,11 @@ object OnOneOffView extends FunctionView {
import scalatags.JsDom.all._
val onCallback = (_: Element, _: JQueryEvent) =>
- jQ(".demo ul").append(li("This will be added on every click").render)
+ jQ("ul", content).append(li("This will be added on every click").render)
val oneCallback = (_: Element, _: JQueryEvent) =>
- jQ(".demo ul").append(li("This will be added only once").render)
+ jQ("ul", content).append(li("This will be added only once").render)
- override protected def content = div(cls := "demo")(
+ override protected val content: Div = div(
h3(".on() & .one() & .off()"),
button(id := "click", disabled := "disabled")("Click me"),
ul(),
@@ -22,20 +23,20 @@ object OnOneOffView extends FunctionView {
id := "off",
disabled := "disabled",
onclick := ((_: Event) => {
- jQ(".demo #click")
+ jQ("#click", content)
.off(EventName.click, onCallback)
.off(EventName.click, oneCallback)
false
})
)("Off")
- )
+ ).render
override protected def script = () => {
- jQ(".demo #click")
+ jQ("#click", content)
.on(EventName.click, onCallback)
.one(EventName.click, oneCallback)
- jQ(".demo button")
+ jQ("button", content)
.prop("disabled", "")
}
}
\ No newline at end of file
From 06ca2e3517d76ea94c26d7e198e566c3ba61bae1 Mon Sep 17 00:00:00 2001
From: ddworak
Date: Mon, 30 Mar 2020 10:40:12 +0200
Subject: [PATCH 60/80] Fix global demo
---
example/global-demo/src/main/assets/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/example/global-demo/src/main/assets/index.html b/example/global-demo/src/main/assets/index.html
index 90d7641..b746eab 100644
--- a/example/global-demo/src/main/assets/index.html
+++ b/example/global-demo/src/main/assets/index.html
@@ -7,7 +7,7 @@
-
+