Skip to content

Commit

Permalink
Add -xsource:3
Browse files Browse the repository at this point in the history
  • Loading branch information
ddworak committed Mar 27, 2024
1 parent 8c00d97 commit 097e45d
Show file tree
Hide file tree
Showing 33 changed files with 94 additions and 110 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.udash.bootstrap
package alert

import io.udash._
import io.udash.*
import io.udash.bindings.modifiers.Binding
import io.udash.bootstrap.button.{UdashButton, UdashButtonOptions}
import io.udash.bootstrap.utils.{BootstrapStyles, BootstrapTags}
import org.scalajs.dom.Element
import scalatags.JsDom.all._
import scalatags.JsDom.all.*
import com.avsystem.commons.SharedExtensions.universalOps

final class DismissibleUdashAlert private[alert](
alertStyle: ReadableProperty[BootstrapStyles.Color], override val componentId: ComponentId
)(content: Binding.NestedInterceptor => Modifier) extends UdashAlertBase(alertStyle, componentId) {
import io.udash.css.CssView._

private val _dismissed = Property[Boolean](false)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package io.udash.bootstrap
package button

import io.udash.*
import com.avsystem.commons.Opt
import com.avsystem.commons.misc.{AbstractCase, AbstractNamedEnumCompanion, AbstractValueEnum, AbstractValueEnumCompanion, EnumCtx, NamedEnum, SealedEnumCompanion}
import io.udash._
import com.avsystem.commons.misc.AbstractCase
import io.udash.bindings.modifiers.Binding
import io.udash.bootstrap.button.UdashButton.{ButtonClickEvent, ButtonTag, UdashButtonJQuery}
import io.udash.bootstrap.utils._
import io.udash.bootstrap.utils.*
import io.udash.wrappers.jquery.{JQuery, jQ}
import org.scalajs.dom
import org.scalajs.dom._
import org.scalajs.dom.*
import scalatags.JsDom
import scalatags.JsDom.all._
import scalatags.JsDom.all.*
import com.avsystem.commons.SharedExtensions.universalOps

import scala.scalajs.js

Expand Down Expand Up @@ -41,7 +42,7 @@ final class UdashButton private(
options: UdashButtonOptions
)(content: Binding.NestedInterceptor => Modifier) extends UdashBootstrapComponent with Listenable {

import io.udash.css.CssView._
import io.udash.css.CssView.*

override type EventType = ButtonClickEvent

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package io.udash.bootstrap
package datepicker

import java.{util => ju}

import com.avsystem.commons.SharedExtensions._
import java.util as ju
import com.avsystem.commons.misc.{AbstractCase, AbstractValueEnum, AbstractValueEnumCompanion, EnumCtx}
import io.udash._
import com.avsystem.commons.SharedExtensions.*
import io.udash.*
import io.udash.bootstrap.utils.UdashIcons.FontAwesome
import io.udash.bootstrap.utils.{BootstrapStyles, BootstrapTags, UdashBootstrapComponent}
import io.udash.css.{CssStyle, CssStyleName}
import io.udash.logging.CrossLogging
import io.udash.wrappers.jquery._
import io.udash.wrappers.jquery.*
import org.scalajs.dom.{Element, document}

import scala.scalajs.js
Expand All @@ -24,9 +23,8 @@ final class UdashDatePicker private[datepicker](
override val componentId: ComponentId
) extends UdashBootstrapComponent with Listenable with CrossLogging {

import UdashDatePicker._
import io.udash.css.CssView._
import scalatags.JsDom.all._
import UdashDatePicker.*
import scalatags.JsDom.all.*

override type EventType = UdashDatePicker.DatePickerEvent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class UdashForm private(

override val render: Form =
form(formStyle)(
onsubmit :+= { _: Event => fire(new UdashForm.FormEvent(this, UdashForm.FormEvent.EventType.Submit)); true },
onsubmit :+= { (_: Event) => fire(new UdashForm.FormEvent(this, UdashForm.FormEvent.EventType.Submit)); true },
content(new FormElementsFactory(nestedInterceptor, inputValidationTrigger, selectValidationTrigger, this))
).render
}
Expand Down Expand Up @@ -792,7 +792,7 @@ final class FormElementsFactory(
val validationResult = Property[Option[ValidationResult]](None)
Seq(
eventBasedModifiers(validationResult),
onblur :+= { _: Event =>
onblur :+= { (_: Event) =>
startValidation(validationResult, triggerGroup = true)
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object Invalid {
Invalid(error +: errors)

def apply(error: String, errors: String*): Invalid[ValidationError] =
this ((error +: errors).map(DefaultValidationError))
this ((error +: errors).map(DefaultValidationError.apply))
}

trait Validator[-ArgumentType] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object UdashPopover extends TooltipUtils[UdashPopover] {
new UdashPopover(tp)
}

override protected val defaultPlacement = Placement.Right
override protected val defaultPlacement: StaticPlacement = Placement.Right
override protected val defaultTemplate: String = {
import io.udash.css.CssView._
import scalatags.Text.all._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object UdashTooltip extends TooltipUtils[UdashTooltip] {
new UdashTooltip(tp)
}

override protected val defaultPlacement = Placement.Top
override protected val defaultPlacement: StaticPlacement = Placement.Top
override protected val defaultTemplate: String = {
import io.udash.css.CssView._
import scalatags.Text.all._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package io.udash.bootstrap.utils

import io.udash.bindings.modifiers.Binding
import io.udash.component.Component
import io.udash.wrappers.jquery._
import io.udash.css.CssView
import io.udash.wrappers.jquery.*
import org.scalajs.dom.Element

/** Base trait for Bootstrap components. */
trait UdashBootstrapComponent extends Component {
trait UdashBootstrapComponent extends Component with CssView {
override val render: Element

protected class JQueryOnBinding(selector: JQuery, event: EventName, callback: JQueryCallback) extends Binding {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package io.udash.bootstrap.button

import io.udash._
import io.udash.bootstrap._
import io.udash.*
import io.udash.bootstrap.*
import io.udash.bootstrap.utils.BootstrapStyles
import io.udash.testing.UdashCoreFrontendTest
import io.udash.wrappers.jquery._
import io.udash.wrappers.jquery.*
import com.avsystem.commons.SharedExtensions.*

class UdashButtonTest extends UdashCoreFrontendTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package io.udash.bootstrap
package datepicker

import java.{util => ju}
import java.util as ju

import com.avsystem.commons._
import io.udash._
import io.udash.*
import io.udash.bootstrap.datepicker.UdashDatePickerTest.JQueryDatePickerExt
import io.udash.bootstrap.form.UdashInputGroup
import io.udash.bootstrap.utils.UdashIcons.FontAwesome
import io.udash.i18n.{Bundle, BundleHash, Lang, LocalTranslationProvider, TranslationKey}
import io.udash.testing.AsyncUdashCoreFrontendTest
import io.udash.wrappers.jquery._
import io.udash.wrappers.jquery.*
import org.scalajs.dom
import scalatags.JsDom.all._
import scalatags.JsDom.all.*
import com.avsystem.commons.SharedExtensions.*

import scala.concurrent.Future
import scala.scalajs.js
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ val commonSettings = Seq(
"-language:experimental.macros",
"-Xfatal-warnings",
"-Xlint:_,-missing-interpolator,-unused",
"-Xsource:3",
"-Yrangepos",
"-Ybackend-parallelism", "8",
"-Ycache-plugin-class-loader:last-modified",
Expand Down
2 changes: 1 addition & 1 deletion core/.js/src/main/scala/io/udash/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Application[HierarchyRoot >: Null <: GState[HierarchyRoot] : PropertyCreat
onApplicationStarted(rootElement)
}
if (dom.document.readyState != DocumentReadyState.loading) onReady()
else dom.document.addEventListener("DOMContentLoaded", { _: Event => onReady() }, new EventListenerOptions {
else dom.document.addEventListener("DOMContentLoaded", { (_: Event) => onReady() }, new EventListenerOptions {
once = true
passive = true
})
Expand Down
4 changes: 2 additions & 2 deletions core/.js/src/main/scala/io/udash/bindings/Bindings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ object Bindings extends Bindings {
val dyn: js.Dynamic = el.asInstanceOf[js.Dynamic]
val existingCallbacks: js.Function1[T, Boolean] = dyn.selectDynamic(attr.name).asInstanceOf[js.Function1[T, Boolean]]
if (existingCallbacks == null)
dyn.updateDynamic(attr.name) { e: T => if (callback(e) == true) e.preventDefault() }
dyn.updateDynamic(attr.name) { (e: T) => if (callback(e) == true) e.preventDefault() }
else
dyn.updateDynamic(attr.name) { e: T =>
dyn.updateDynamic(attr.name) { (e: T) =>
val preventDefault = callback(e)
if (preventDefault == true) e.preventDefault()
else existingCallbacks(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ private[bindings] abstract class TextInputsModifier(property: Property[String],
}

var propertyUpdateHandler: Int = 0
val callback = if (debounce.toMillis > 0) {
_: Event => {
if (propertyUpdateHandler != 0) window.clearTimeout(propertyUpdateHandler)
propertyUpdateHandler = window.setTimeout(() => {
updatePropertyValueForElement(t)
}, debounce.toMillis.toDouble)
}
} else {
_: Event => {
updatePropertyValueForElement(t)
}
}
val callback =
if (debounce.toMillis > 0)
(_: Event) => {
if (propertyUpdateHandler != 0) window.clearTimeout(propertyUpdateHandler)
propertyUpdateHandler = window.setTimeout(() => {
updatePropertyValueForElement(t)
}, debounce.toMillis.toDouble)
}
else
(_: Event) => updatePropertyValueForElement(t)
setElementKeyUp(t, callback)
setElementOnChange(t, callback)
setElementOnInput(t, callback)
Expand Down
3 changes: 1 addition & 2 deletions core/.js/src/main/scala/io/udash/component/ComponentId.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import org.scalajs.dom.Element
import scalatags.JsDom.GenericAttr
import scalatags.JsDom.all._


final case class ComponentId private(value: String) extends AbstractCase with Modifier {
final case class ComponentId(value: String) extends AbstractCase with Modifier {
override def applyTo(t: Element): Unit = {
t.id = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ class TagsBindingTest extends UdashFrontendTest with Bindings { bindings: Bindin

p.set(new Model.WithSubTrait {
override def i = 5
override def subType = new Model.SubTrait {
override def subType: Model.SubTrait = new Model.SubTrait {
override def i = 7
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package io.udash.web.commons.components

import com.avsystem.commons._
import com.avsystem.commons.Opt
import io.udash.*
import io.udash.css.CssStyle
import io.udash.web.commons.config.ExternalUrls
import io.udash.web.commons.styles.GlobalStyles
import io.udash.web.commons.styles.components.FooterStyles
import io.udash.web.commons.views.Image
import org.scalajs.dom.html.Element
import scalatags.JsDom
import scalatags.JsDom.all._
import scalatags.JsDom.all.*

object Footer {
import io.udash.css.CssView._

import io.udash.css.CssView.*
private val styles = FooterStyles

private def template(wrapperStyle: Opt[CssStyle]): JsDom.TypedTag[Element] = footer(styles.footer)(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.udash.web.commons.views

import com.avsystem.commons._
import com.avsystem.commons.misc.AbstractCase
import io.udash._
import io.udash.bootstrap._
import com.avsystem.commons.misc.{AbstractCase, Opt}
import io.udash.*
import io.udash.bootstrap.*
import io.udash.bootstrap.alert.UdashAlert
import io.udash.web.guide.markdown.{MarkdownPage, MarkdownPageRPC}
import io.udash.web.guide.styles.MarkdownStyles
import org.scalajs.dom
import com.avsystem.commons.SharedExtensions.*

import scala.util.{Failure, Success}

Expand Down Expand Up @@ -67,7 +67,7 @@ final class MarkdownView(model: ReadableModelProperty[MarkdownModel]) extends Vi
import io.udash.css.CssView._
import scalatags.JsDom.all._

override val getTemplate: Modifier = ISeq(
override val getTemplate: Modifier = Seq(
produce(model.roSubProp(_.error)) { error =>
error.opt.filter(_.nonEmpty).map(e =>
div(cls := "bootstrap")(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.udash.web.guide.views

import io.udash._
import io.udash.*
import io.udash.web.commons.styles.GlobalStyles
import io.udash.web.guide.ContentState
import io.udash.web.guide.components.GuideMenu
import io.udash.web.guide.styles.partials.GuideStyles

import scalatags.JsDom.tags2._
import org.scalajs.dom.Element
import scalatags.JsDom.tags2.*

object ContentViewFactory extends StaticViewFactory[ContentState.type](() => new ContentView)

Expand All @@ -15,7 +15,7 @@ class ContentView extends ViewContainer {

import scalatags.JsDom.all._

protected val child = main(GuideStyles.contentWrapper).render
override protected val child: Element = main(GuideStyles.contentWrapper).render

private val content = main(GuideStyles.main)(
div(GlobalStyles.body)(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package io.udash.web.guide.views

import io.udash._
import io.udash.*
import io.udash.web.commons.components.Footer
import io.udash.web.guide.RootState
import io.udash.web.guide.components.Header
import org.scalajs.dom.Element

object RootViewFactory extends StaticViewFactory[RootState.type](() => new RootView)

class RootView extends ViewContainer {
import scalatags.JsDom.all._

protected val child = div().render
override protected val child: Element = div().render

private val content = div(
Header.getTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import org.scalajs.dom._

import scala.scalajs.js

/**
* Created by malchik on 2016-03-30.
*/
abstract class ViewContainer extends ContainerView {
protected val child: Element

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package io.udash.web.guide.views.bootstrapping

import io.udash._
import io.udash.*
import io.udash.web.guide.views.ViewContainer
import io.udash.web.guide.{Context, _}
import io.udash.web.guide.{Context, *}
import org.scalajs.dom.Element
import scalatags.JsDom

case object BootstrappingViewFactory extends StaticViewFactory[BootstrappingState.type](() => new BootstrappingView)
Expand All @@ -11,7 +12,7 @@ class BootstrappingView extends ViewContainer {
import Context._
import JsDom.all._

protected val child = div().render
override protected val child: Element = div().render

override def getTemplate: Modifier = div(
h1("Application bootstrapping"),
Expand Down
Loading

0 comments on commit 097e45d

Please sign in to comment.