scala.scalajs.js Scala Examples

The following examples show how to use scala.scalajs.js. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: CryptoJs.scala    From iotchain   with MIT License 6 votes vote down vote up
package jbok.crypto.facade

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

object CryptoJs {
  @js.native
  @JSImport("crypto-js/ripemd160", JSImport.Default)
  object ripemd160 extends js.Object {
    def apply(arr: Any): Any = js.native
  }

  @js.native
  @JSImport("crypto-js/sha3", JSImport.Default)
  object sha3 extends js.Object {
    def apply(arr: Any, option: js.Dynamic): Any = js.native
  }

  @js.native
  @JSImport("crypto-js/sha256", JSImport.Default)
  object sha256 extends js.Object {
    def apply(arr: Any): Any = js.native
  }

  @js.native
  @JSImport("crypto-js/enc-base64", JSImport.Default)
  object Base64 extends js.Object {
    def stringify(x: Any): String = js.native
  }

  @js.native
  @JSImport("crypto-js/enc-hex", JSImport.Default)
  object Hex extends js.Object {
    def stringify(x: Any): String = js.native
    def parse(s: String): Any = js.native
  }
} 
Example 2
Source File: HttpClient.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.network.http

import cats.effect.{Async, IO}
import jbok.network.facade.{Axios, Config, Response}

import scala.scalajs.js

object HttpClient {
  def request[F[_]](config: Config)(implicit F: Async[F]): F[Response] =
    F.liftIO(IO.fromFuture(IO(Axios.request(config).toFuture)))

  def get[F[_]](url: String)(implicit F: Async[F]): F[Response] =
    request[F](new Config(url))

  def post[F[_]](url: String, _data: String)(implicit F: Async[F]): F[Response] =
    request[F](new Config(url) {
      override val method: String = "post"
      override val data: js.Any   = _data
    })
} 
Example 3
Source File: JbokApp.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.app

import com.thoughtworks.binding.Binding.{Var, _}
import com.thoughtworks.binding._
import jbok.app.components.{TabList, TabPane, Tabs}
import jbok.app.views._
import org.scalajs.dom._

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

@JSImport("css/normalize.css", JSImport.Namespace)
@js.native
object NormalizeCss extends js.Object

@JSImport("css/app.css", JSImport.Namespace)
@js.native
object AppCss extends js.Object

object JbokApp {
  val normalizeCss = NormalizeCss
  val appCss       = AppCss

  val config = AppConfig.default
  val state  = AppState(Var(config))
  state.init()

  val statusView       = StatusView(state).render
  val accountsView     = AccountsView(state).render
  val blocksView       = BlocksView(state).render
  val transactionsView = TxsView(state).render
  val contractView     = ContractView(state).render
  val configView       = ConfigView(state).render
  val searchView       = SearchView(state).render

  val accountsTab = TabPane("Accounts", accountsView, Some("fa-user-circle"))
  val blocksTab   = TabPane("Blocks", blocksView, Some("fa-th-large"))
  val txsTab      = TabPane("Transactions", transactionsView, Some("fa-arrow-circle-right"))
  val contractTab = TabPane("Contract", contractView, Some("fa-file-contract"))
  val configTab   = TabPane("", configView, Some("fa-cogs"))
  val searchTab   = TabPane("Search", searchView, Some("fa-search"))
  val tabs: Vars[TabPane] = Vars(
    accountsTab,
    blocksTab,
    txsTab,
    contractTab,
    searchTab,
    configTab
  )

  val tabList   = TabList(tabs, Var(tabs.value.head))
  val searchBar = SearchBar(state, onPressEnter = (e: Event) => tabList.selected.value = searchTab).render
  state.activeSearchView(() => tabList.selected.value = searchTab)

  @dom val right: Binding[Node] =
    <div class="nav-right">
      <div class="tab searchbar">{searchBar.bind}</div>
    </div>

  val navBar = Tabs.renderTabBar(tabList, Some(right), onchange = (e: Event) => state.clearSearch())

  @dom def render: Binding[BindingSeq[Node]] =
    <header>
      {navBar.bind}
      {statusView.bind}
    </header>
    <main>
    {Tabs.renderTabContent(tabList).bind}
    </main>
    <footer>
      {Copyright.render.bind}
    </footer>

  def main(args: Array[String]): Unit =
    dom.render(document.body, render)
} 
Example 4
Source File: CryptoHasherPlatform.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.crypto.hash

import jbok.crypto.facade.CryptoJs
import scodec.bits.ByteVector

import scala.scalajs.js

trait CryptoHasherPlatform {
  implicit val kec256Platform: CryptoHasher[Keccak256] = new CryptoHasher[Keccak256] {
    override def hash(bytes: ByteVector): ByteVector = {
      val bin = CryptoJs.sha3(CryptoJs.Hex.parse(bytes.toHex), js.Dynamic.literal(outputLength = 256))
      val hex = CryptoJs.Hex.stringify(bin)
      ByteVector.fromValidHex(hex)
    }
  }

  implicit val kec512Platform: CryptoHasher[Keccak512] = new CryptoHasher[Keccak512] {
    override def hash(bytes: ByteVector): ByteVector = {
      val bin = CryptoJs.sha3(CryptoJs.Hex.parse(bytes.toHex), js.Dynamic.literal(outputLength = 512))
      val hex = CryptoJs.Hex.stringify(bin)
      ByteVector.fromValidHex(hex)
    }
  }

  implicit val sha256Platform: CryptoHasher[SHA256] = new CryptoHasher[SHA256] {
    override def hash(bytes: ByteVector): ByteVector = {
      val bin = CryptoJs.sha256(CryptoJs.Hex.parse(bytes.toHex))
      val hex = CryptoJs.Hex.stringify(bin)
      ByteVector.fromValidHex(hex)
    }
  }

  implicit val ripemd160Platform: CryptoHasher[RipeMD160] = new CryptoHasher[RipeMD160] {
    override def hash(bytes: ByteVector): ByteVector = {
      val bin = CryptoJs.ripemd160(CryptoJs.Hex.parse(bytes.toHex))
      val hex = CryptoJs.Hex.stringify(bin)
      ByteVector.fromValidHex(hex)
    }
  }
} 
Example 5
Source File: Elliptic.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.crypto.facade

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobal, JSImport}
import scala.scalajs.js.typedarray.Uint8Array

@js.native
@JSImport("elliptic", "ec")
class EC(curve: String) extends js.Object {
  def genKeyPair(options: Option[js.Dynamic] = None): KeyPairEC = js.native
  def keyPair(options: js.Dynamic): KeyPairEC                   = js.native
  def keyFromPublic(pub: String, enc: String): KeyPairEC        = js.native
  def keyFromPrivate(priv: String, enc: String): KeyPairEC      = js.native

  def sign(msg: Uint8Array, key: KeyPairEC): SignatureEC                = js.native
  def verify(msg: Uint8Array, sig: js.Dynamic, key: KeyPairEC): Boolean = js.native

  def getKeyRecoveryParam(msg: Uint8Array, signature: js.Dynamic): Int           = js.native
  def recoverPubKey(msg: Uint8Array, signature: js.Dynamic, recId: Int): ECPoint = js.native
}

@js.native
@JSImport("elliptic/ec/key", JSImport.Default)
class KeyPairEC(ec: EC, options: js.Dynamic) extends js.Object {
  def getPublic(compact: Boolean, enc: String): String = js.native
  def getPrivate(enc: String): String                  = js.native
//  val priv: js.Any                                     = js.native
//  val pub: js.Any                                      = js.native
}

@js.native
@JSImport("elliptic/ec/signature", JSImport.Default)
class SignatureEC() extends js.Object {
  def r: Any             = js.native
  def s: Any             = js.native
  def recoveryParam: Int = js.native
}

object SignatureEC {
  def apply(r: BN, s: BN, recoveryParam: Int): js.Dynamic =
    js.Dynamic.literal(r = r, s = s, recoveryParam = recoveryParam)
}

@js.native
@JSGlobal
class ECPoint() extends js.Object {
  def encode(enc: String, compact: Boolean): String = js.native
} 
Example 6
Source File: Signer.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.sdk

import cats.effect.IO
import cats.implicits._
import jbok.core.models.{ChainId, SignedTransaction, Transaction}
import jbok.core.validators.TxValidator
import jbok.crypto.signature.{ECDSA, KeyPair, Signature}

import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}

@JSExportTopLevel("Signer")
@JSExportAll
object Signer {
  def getSender(tx: SignedTransaction): js.UndefOr[String] =
    tx.senderAddress.map(_.toString).orUndefined

  def signTx(tx: Transaction, secretHex: String, chainId: Int): SignedTransaction =
    (for {
      secret <- KeyPair.Secret(secretHex).pure[IO]
      public <- Signature[ECDSA].generatePublicKey[IO](secret)
      keyPair = KeyPair(public, secret)
      stx <- SignedTransaction.sign[IO](tx, keyPair, ChainId(chainId))
      _   <- TxValidator.checkSyntacticValidity[IO](stx, ChainId(chainId))
    } yield stx).unsafeRunSync()
} 
Example 7
Source File: SdkClient.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.sdk

import java.net.URI

import cats.effect.{Clock, IO}
import io.circe.Json
import io.circe.syntax._
import io.circe.parser._
import jbok.network.http.HttpTransport
import jbok.network.rpc.{RpcClient, RpcRequest}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.Promise
import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}
import scala.scalajs.js.JSON

@JSExportAll
final class SdkClient(val uri: URI, val client: RpcClient[IO, Json]) {
  def fetch(api: String, method: String, params: js.UndefOr[js.Any]): Promise[String] = {
    val json = params.toOption match {
      case Some(a) => parse(JSON.stringify(a)).getOrElse(Json.Null)
      case None => Json.Null
    }
    val request = RpcRequest(List(api, method), json)
    client.transport.fetch(request).map(_.asJson.spaces2).unsafeToFuture().toJSPromise
  }
}

@JSExportTopLevel("SdkClient")
@JSExportAll
object SdkClient {
  implicit val clock: Clock[IO] = Clock.create[IO]

  def http(url: String): SdkClient = {
    val transport = HttpTransport[IO](url)
    val client    = RpcClient(transport)
    new SdkClient(new URI(url), client)
  }
} 
Example 8
Source File: BinaryCodec.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.sdk

import jbok.codec.rlp.RlpEncoded
import jbok.codec.rlp.implicits._
import jbok.core.models.{BlockHeader, SignedTransaction}
import scodec.bits.BitVector

import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}
import scala.scalajs.js.typedarray.Int8Array

@JSExportTopLevel("BinaryCodec")
@JSExportAll
object BinaryCodec {
  def encodeBlockHeader(header: BlockHeader): Int8Array =
    new Int8Array(header.encoded.byteArray.toJSArray)

  def decodeBlockHeader(bytes: Int8Array): js.UndefOr[BlockHeader] =
    RlpEncoded.coerce(BitVector(bytes.toArray)).decoded[BlockHeader].toOption.orUndefined

  def encodeTx(tx: SignedTransaction): Int8Array =
    new Int8Array(tx.encoded.byteArray.toJSArray)

  def decodeTx(bytes: Int8Array): js.UndefOr[SignedTransaction] =
    RlpEncoded.coerce(BitVector(bytes.toArray)).decoded[SignedTransaction].toOption.orUndefined
} 
Example 9
Source File: JsonCodec.scala    From iotchain   with MIT License 5 votes vote down vote up
package jbok.sdk

import jbok.core.models._

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}
import scala.scalajs.js.JSConverters._
import _root_.io.circe.parser._
import _root_.io.circe.syntax._
import jbok.codec.json.implicits._

@JSExportTopLevel("JsonCodec")
@JSExportAll
object JsonCodec {
  def decodeBlockHeader(json: String): js.UndefOr[BlockHeader] =
    decode[BlockHeader](json).toOption.orUndefined

  def decodeBlockBody(json: String): js.UndefOr[BlockBody] =
    decode[BlockBody](json).toOption.orUndefined

  def decodeBlock(json: String): js.UndefOr[Block] =
    decode[Block](json).toOption.orUndefined

  def encodeTransaction(stx: Transaction): String =
    stx.asJson.noSpaces

  def decodeTransaction(json: String): js.UndefOr[Transaction] =
    decode[Transaction](json).toOption.orUndefined

  def encodeSignedTransaction(stx: SignedTransaction): String =
    stx.asJson.noSpaces

  def decodeSignedTransaction(json: String): js.UndefOr[SignedTransaction] =
    decode[SignedTransaction](json).toOption.orUndefined

  def encodeContracts(contracts: Contracts): String =
    contracts.asJson.noSpaces

  def decodeContracts(json: String): js.UndefOr[Contracts] =
    decode[Contracts](json).toOption.orUndefined
} 
Example 10
Source File: AsyncStorageExample.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.uiexplorer.apis

import chandu0101.scalajs.rn.ReactNativeComponentB
import chandu0101.scalajs.rn.apis.{AsyncStorage, AsyncStorageException}
import chandu0101.scalajs.rn.components._
import chandu0101.scalajs.rn.examples.uiexplorer.{UIExample, UIExplorerBlock, UIExplorerPage}
import japgolly.scalajs.react.BackendScope
import chandu0101.scalajs.rn.styles.NativeStyleSheet

import scala.async.Async._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.scalajs.js

object AsyncStorageExample extends UIExample {

  val STORAGE_KEY = "@AsyncStorageExample:key"
  val COLORS = js.Array("red", "orange", "yellow", "green", "blue")

  case class State(selectedValue: String = COLORS.head, messages: js.Array[String] = js.Array())

  class Backend(t: BackendScope[_, State]) {

    def appendMessage(message: String) = {
      t.modState(s => s.copy(messages = s.messages.+:(message)))
    }

    val saveError: PartialFunction[Throwable, _] = {
      case (ex: Throwable) => {
        appendMessage(s"AsyncStorage Error ${ex.asInstanceOf[AsyncStorageException].err.message.toString}")
      }
    }

    def onValueChange(selectedValue: String) : Unit = {
      t.modState(_.copy(selectedValue = selectedValue))
      async {
        val result = await(AsyncStorage.setItem(STORAGE_KEY, selectedValue))
        appendMessage(s"Saved selection to disk ${selectedValue}")
      }.recover(saveError)
    }

    def removeStorage : Unit = async{
      val result = await(AsyncStorage.removeItem(STORAGE_KEY))
      appendMessage(s"Selection Removed from Disk")
    }.recover(saveError)
  }

  val component = ReactNativeComponentB[Unit]("AsyncStorageExample")
    .initialState(State())
    .backend(new Backend(_))
    .render((P, S, B) => {
    UIExplorerPage(
     UIExplorerBlock("Basics - getItem, setItem, removeItem")(
       View()(
         PickerIOS(selectedValue = S.selectedValue,onValueChange = B.onValueChange _)(
           COLORS.map(v => PickerItemIOS(key = v , value = v,label = v))
         ),
         Text()("Selected : ",
           Text(style = styles.getColorStyle(S.selectedValue))(S.selectedValue)
         ),
         Text()(" "),
         Text(onPress = B.removeStorage _)("Press here to remove from storage"),
         Text()(" "),
         Text()("Messages : "),
         S.messages.map(m => Text()(m))
       )
     )
    )
  }).componentDidMount(scope => {
     async {
       val result = await(AsyncStorage.getItem(STORAGE_KEY))
       if (result != null) {
         scope.modState(_.copy(selectedValue = result))
         scope.backend.appendMessage(s"Recovered selection from disk : ${result}")
       } else {
         scope.backend.appendMessage(s"Initialized with no selection on disk")
       }
     }.recover(scope.backend.saveError)
  })
  .buildNative

  object styles extends NativeStyleSheet {

   def getColorStyle(c : String) = style(color := c)
  }

  override def title: String = "AsyncStorage"

  override def description: String = "Asynchronous local disk storage."
} 
Example 11
Source File: AppStateIOSExample.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.uiexplorer.apis

import chandu0101.scalajs.rn
import chandu0101.scalajs.rn.ReactNativeComponentB
import chandu0101.scalajs.rn.components._
import chandu0101.scalajs.rn.examples.uiexplorer.{UIExample, UIExplorerBlock, UIExplorerPage}
import japgolly.scalajs.react.BackendScope
import chandu0101.scalajs.rn.styles.NativeStyleSheet

import scala.scalajs.js

object AppStateIOSExample extends UIExample {

  val AppSateIOS = rn.ReactNative.AppStateIOS

  case class State(appState : String = AppSateIOS.currentState.get ,previousAppSates : js.Array[String] = js.Array())

  class Backend(t: BackendScope[_, State]) {
    val handleAppStateChange = (appState : String) => {
      t.modState(s => s.copy(appState,s.previousAppSates.+:(appState)))
    }
  }

  val AppStateSubscription = ReactNativeComponentB[Boolean]("AppStateSubscription")
    .initialState(State())
    .backend(new Backend(_))
    .render((P,S,B) => {
       View()(
        if(P) Text()(S.appState)
        else Text()(S.previousAppSates.mkString(","))
       )
    })
    .componentDidMount(scope => AppSateIOS.addEventListener("change",scope.backend.handleAppStateChange))
    .componentWillUnmount(scope => AppSateIOS.removeEventListener("change",scope.backend.handleAppStateChange))
    .build


  val component = ReactNativeComponentB[Unit]("AppStateIOSExample")
    .render(P => {
    UIExplorerPage(
      UIExplorerBlock("AppStateIOS.currentState")(
        Text()(AppSateIOS.currentState.get)
      ),
      UIExplorerBlock("Subscribed AppStateIOS:")(
       AppStateSubscription(true)
      ),
      UIExplorerBlock("Previous states:")(
       AppStateSubscription(false)
      )
    )
  }).buildNative

  object styles extends NativeStyleSheet {


  }

  override def title: String = "AppStateIOS"

  override def description: String = "iOS app background status"
} 
Example 12
Source File: AlertIOSExample.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.uiexplorer.apis

import chandu0101.scalajs.rn
import chandu0101.scalajs.rn.ReactNativeComponentB
import chandu0101.scalajs.rn.apis.AlertButton
import chandu0101.scalajs.rn.components.{Text, TouchableHighlight, View}
import chandu0101.scalajs.rn.examples.uiexplorer.{UIExample, UIExplorerBlock, UIExplorerPage}
import chandu0101.scalajs.rn.styles.NativeStyleSheet

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}
import scala.scalajs.js.JSConverters.JSRichGenTraversableOnce


object AlertIOSExample extends UIExample {
  override def title: String = "AlertIOS"

  override def component = ReactNativeComponentB[Unit]("AlertIOSExample")
    .render(P => {
    val a1  = () => rn.ReactNative.AlertIOS.alert("Foo title", "alert message")
    val a2 = () => rn.ReactNative.AlertIOS.alert(buttons = js.Array(AlertButton("Button",() => println("Button Pressed")).toJson))
    val a3 = () => rn.ReactNative.AlertIOS.alert(
      title = "Foo Title",
      message = "My Alert Msg" ,
      buttons = js.Array(AlertButton("Foo",() => println("Foo Button Pressed")).toJson,
        AlertButton("Bar",() => println("Bar Button Pressed")).toJson))
    val a4 = () => rn.ReactNative.AlertIOS.alert(
      title = "Foo Title",
      buttons = js.Array(AlertButton("Foo",() => println("Foo Button Pressed")).toJson,
        AlertButton("Bar",() => println("Bar Button Pressed")).toJson,
        AlertButton("Baz",() => println("Baz Button Pressed")).toJson))
    val a5  = () => rn.ReactNative.AlertIOS.alert(title = "Foo title",
    buttons = (1 to 10).map(i => AlertButton(s"Button $i",() => println(s"Button $i pressed")).toJson.asInstanceOf[js.Object]).toJSArray)

    UIExplorerPage(
      UIExplorerBlock("Alerts")(
        View(style = json(flex = 1))(
          TouchableHighlight(style = styles.wrapper, onPress = a1)(
            View(style = styles.button)(
              Text()("Alert Message with default button")
            )
          ),
          TouchableHighlight(style = styles.wrapper, onPress = a2)(
            View(style = styles.button)(
              Text()("Alert with only one button")
            )
          ),
          TouchableHighlight(style = styles.wrapper, onPress = a3)(
            View(style = styles.button)(
              Text()("Alert with two buttons")
            )
          ),
          TouchableHighlight(style = styles.wrapper, onPress = a4)(
            View(style = styles.button)(
              Text()("Alert with 3 buttons")
            )
          ),
          TouchableHighlight(style = styles.wrapper, onPress = a5)(
            View(style = styles.button)(
              Text()("Alert with too many buttons")
            )
          )
        )
      )
    )
  }).buildNative

  object styles extends NativeStyleSheet {
    val alertsContainer = style(backgroundColor := "white",
      padding := 20)
    val wrapper = style(borderRadius := 5, marginBottom := 5)
    val button = style(backgroundColor := "#eeeeee", padding := 10)
  }

  override def description: String = "iOS alerts and action sheets"
} 
Example 13
Source File: TabBarIOSExample.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.uiexplorer.components

import chandu0101.scalajs.rn.ReactNativeComponentB
import chandu0101.scalajs.rn.components._
import chandu0101.scalajs.rn.examples.uiexplorer.UIExample
import japgolly.scalajs.react.BackendScope
import chandu0101.scalajs.rn.styles.NativeStyleSheet

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}


object TabBarIOSExample extends UIExample{

  val BLUE_TAB = "blueTab"
  val RED_TAB = "redTab"
  val GREEN_TAB = "greenTab"

  case class State(selectedTab: String = BLUE_TAB, notifCount: Int = 0, presses: Int = 0)

  class Backend(t: BackendScope[_, State]) {

    def renderContent(color : String,pageText : String) = {
       View(style = js.Array(styles.tabContent,json(backgroundColor = color)))(
          Text(style = styles.tabText)(pageText),
          Text(style = styles.tabText)(s"${t.state.presses} re-renders of this tab")
       )
    }

    def getImage(imageUri : String) = ImageSource(uri = imageUri)
    def selectTab(name : String) = name match {
      case BLUE_TAB => t.modState(_.copy(selectedTab = name))
      case RED_TAB => t.modState(s => s.copy(selectedTab = name,notifCount = s.notifCount + 1))
      case GREEN_TAB => t.modState(s => s.copy(selectedTab = name,presses = s.presses + 1))
    }
  }

 override val component = ReactNativeComponentB[Unit]("TabBarExample")
    .initialState(State())
    .backend(new Backend(_))
    .render((P,S,B) => {
    val badgeValue = if(S.notifCount >0) S.notifCount.toString else null
     TabBarIOS()(
       TabBarItemIOS(key = BLUE_TAB, icon = B.getImage("favorites"),selected = (S.selectedTab == BLUE_TAB),onPress = () => B.selectTab(BLUE_TAB))(
         B.renderContent("#414A8C","Scala-JS Blue Tab")
       ),
       TabBarItemIOS(key = RED_TAB, badge = badgeValue, icon = B.getImage("history"),selected = (S.selectedTab == RED_TAB),onPress = () => B.selectTab(RED_TAB))(
         B.renderContent("#783E33","Scala-JS Red Tab")
       ),
       TabBarItemIOS(key = GREEN_TAB, icon = B.getImage("favorites"),selected = (S.selectedTab == GREEN_TAB),onPress = () => B.selectTab(GREEN_TAB))(
         B.renderContent("#21551C","Scala-JS Green Tab")
       )
     )
  }).buildNative

  object styles extends NativeStyleSheet {

    val tabContent = style(flex := 1,alignItems.center)

    val tabText = style(color := "white" , margin := 50)

  }


  override def title: String = "TabBarIOS"


  override def description: String = "Tab-based navigation."
} 
Example 14
Source File: ListViewExample.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.uiexplorer.components

import chandu0101.scalajs.rn._
import chandu0101.scalajs.rn.components._
import chandu0101.scalajs.rn.examples.uiexplorer.{UIExplorerPage, UIExample}
import japgolly.scalajs.react.BackendScope
import chandu0101.scalajs.rn.styles.NativeStyleSheet
import scala.collection.mutable.Map
import scala.scalajs.js


object ListViewExample extends UIExample {

  val THUMB_URLS = js.Array("https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851549_767334479959628_274486868_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851561_767334496626293_1958532586_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851579_767334503292959_179092627_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851589_767334513292958_1747022277_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851563_767334559959620_1193692107_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851593_767334566626286_1953955109_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851591_767334523292957_797560749_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851567_767334529959623_843148472_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851548_767334489959627_794462220_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851575_767334539959622_441598241_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851573_767334549959621_534583464_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851583_767334573292952_1519550680_n.png")
  val LOREM_IPSUM = "Lorem ipsum dolor sit amet, ius ad pertinax oportere accommodare, an vix civibus corrumpit referrentur. Te nam case ludus inciderint, te mea facilisi adipiscing. Sea id integre luptatum. In tota sale consequuntur nec. Erat ocurreret mei ei. Eu paulo sapientem vulputate est, vel an accusam intellegam interesset. Nam eu stet pericula reprimique, ea vim illud modus, putant invidunt reprehendunt ne qui.";

  case class State(datasource : ListViewDataSource[String] = createListViewDataSource[String,js.Object](rowHasChanged = (r1,r2) => r1 != r2))

  class Backend(t: BackendScope[_, State]) {

    val pressedData = scala.collection.mutable.Map[String,Boolean]().withDefaultValue(false)

    def genRows(pressedData : Map[String,Boolean]) = {
      val dataBlob = js.Array[String]()
      (1 to 100).toList.zipWithIndex.foreach {
        case (i,index) =>  {
          val pressedText = if(pressedData.getOrElse(index.toString,false)) "pressed" else ""
          dataBlob += s"Row $i $pressedText"
        }
      }
      dataBlob
    }


    def pressRow(rowID : String) = {
      pressedData.updated(rowID,pressedData(rowID))
      t.modState(s => s.copy(s.datasource.cloneWithRows(genRows(pressedData))))
    }

    def hashCode2(str : String) = {
      var hash = 15
      str.reverse.foreach( c => {
        hash = ((hash << 5) - hash) + c.toInt
      })
      hash
    }

    def renderRow(rowData : String, sectionID : String,rowID : String) = {
      val rowHash = Math.abs(hashCode2(rowData))
      val imageSource = ImageSource(uri = THUMB_URLS(rowHash % THUMB_URLS.length))
      TouchableHighlight(onPress = () => pressRow(rowID))(
       View()(
        View(style = styles.row)(
         Image(style = styles.thumb , source = imageSource),
         Text(style = styles.text)(
          s"$rowData - ${LOREM_IPSUM.substring(0,rowHash % 301 + 10)}"
         ),
         View(style = styles.separator)()
        )
       )
      )
    }

    val propsDynamic = t.propsDynamic
  }
  val component = ReactNativeComponentB[Unit]("ListViewExample")
    .initialState(State())
    .backend(new Backend(_))
    .render((P,S,B) => {
      View()(
       ListView(dataSource = S.datasource,renderRow = B.renderRow _)
      )
    })
    .componentWillMount(scope => scope.modState(s => s.copy(s.datasource.cloneWithRows(scope.backend.genRows(Map())))))
    .buildNative

  object styles extends NativeStyleSheet {

    val row = style(
     flexDirection.row,
     justifyContent.center,
     padding := 10,
     backgroundColor := "#F6F6F6"
    )

    val separator = style(
     height := 1,
    backgroundColor := "#F6F6F6"
    )

    val thumb = style(width := 64, height := 64)

    val text = style(flex := 1)

  }

  override def title: String = "ListView - simple"

  override def description: String = "Performant, scrollable list of data."

} 
Example 15
Source File: ScrollViewExample.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.uiexplorer.components

import chandu0101.scalajs.rn.ReactNativeComponentB
import chandu0101.scalajs.rn.components._
import chandu0101.scalajs.rn.examples.uiexplorer.{UIExample, UIExplorerBlock, UIExplorerPage}
import chandu0101.scalajs.rn.styles.NativeStyleSheet

import scala.scalajs.js

object ScrollViewExample extends UIExample {

  val THUMBS = js.Array("https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851549_767334479959628_274486868_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851561_767334496626293_1958532586_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851579_767334503292959_179092627_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851589_767334513292958_1747022277_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851563_767334559959620_1193692107_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851593_767334566626286_1953955109_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851591_767334523292957_797560749_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851567_767334529959623_843148472_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851548_767334489959627_794462220_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851575_767334539959622_441598241_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851573_767334549959621_534583464_n.png", "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851583_767334573292952_1519550680_n.png")

  val THUMB = ReactNativeComponentB[String]("THUMB")
    .render(P => {
    View(style = styles.button)(
      Image(style = styles.img, source = ImageSource(uri = P))
    )
  })
    .shouldComponentUpdate((_, _, _) => false)
    .build

  val component = ReactNativeComponentB[Unit]("ScrollViewExample")
    .render(P => {
    UIExplorerPage(
      UIExplorerBlock("ScrollView Vertical")(
        ScrollView(style = styles.scrollView,
          contentInset = EdgeInsets(top = -50.0),
          scrollEventThrottle = 16,
          onScroll = () => println(s"on Scroll!"))(
            THUMBS.++(THUMBS).zipWithIndex.map {
              case (u, i) => THUMB.withKey(i)(u)
            }
          )
      ),
      UIExplorerBlock("ScrollView horizontal")(
        ScrollView(style = styles.horizontalScrollView,
          horizontal = true,
          scrollEventThrottle = 16,
          contentInset = EdgeInsets(top = -50.0),
          onScroll = () => println(s"on Scroll!"))(
            THUMBS.++(THUMBS).zipWithIndex.map {
              case (u, i) => THUMB.withKey(i)(u)
            }
          )
      )
    )
  }).buildNative

  object styles extends NativeStyleSheet {

    val scrollView = style(
      backgroundColor := "#6A85B1",
      height := 300
    )
    val horizontalScrollView = styleE(scrollView)(height := 120)
    val containerPage = style(height := 50,
      width := 50,
      backgroundColor := "#527FE4", padding := 5)

    val text = style(fontSize := 20,
      color := "#888888",
      left := 80,
      top := 20,
      height := 40)

    val button = style(margin := 7,
      padding := 5,
      alignItems.center,
      backgroundColor := "#eaeaea",
      borderRadius := 3)

    val buttonContents = style(flexDirection.row,
      width := 64,
      height := 64)

    val img = style(width := 64, height := 64)


  }

  override def title: String = "ScrollView"

  override def description: String = "Component that enables scrolling through child components"
} 
Example 16
Source File: MoviesUtil.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.movies

import chandu0101.scalajs.rn.components.ImageSource

import scala.scalajs.js
import scala.scalajs.js.isUndefined

object MoviesUtil {

  def getImageSource(movie : js.Dynamic, kind : String = "") : ImageSource = {
    var uri = if(!isUndefined(movie) && !isUndefined(movie.posters)) movie.posters.thumbnail.toString else ""
    if(kind.nonEmpty && uri.nonEmpty) uri = uri.replace("tmb",kind)
    ImageSource(uri = uri)
  }

  def getTextFromScore(score : Int) : String = {
    if(score >0) s"$score%" else "N/A"
  }
} 
Example 17
Source File: MovieCell.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.examples.movies

import chandu0101.scalajs.rn.components.{Image, Text, TouchableHighlight, View}
import chandu0101.scalajs.rn.examples.movies.MoviesUtil._
import chandu0101.scalajs.rn.{ReactNative, ReactNativeComponentB}
import japgolly.scalajs.react._
import chandu0101.scalajs.rn.styles.NativeStyleSheet

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}


object MovieCell {

  val component = ReactNativeComponentB[Props]("MovieCell")
    .render((P) => {
    val criticScore = P.movie.ratings.critics_score.asInstanceOf[Int]
    View()(
      TouchableHighlight(key = "th", onPress = P.onSelect)(
        View(key ="pap", style = styles.row)(
          Image(key = "is", source = getImageSource(P.movie,"det"),style = styles.cellImage),
          View(key = "sv", style = styles.textContainer)(
            Text(key = "tt", style = styles.movieTitle)(P.movie.title.toString),
            Text(key = "year", style = styles.movieYear,numberOfLines = 1)(
               P.movie.year.toString,
               Text(key = "hello")(
                s"Critcs ${getTextFromScore(criticScore)}"
               )
            )
          )
        )
      ),
      View(key = "cb", style = styles.cellBorder)()
    )
  })
    .build


  case class Props(movie: js.Dynamic, onSelect: () => Unit)

  object styles extends NativeStyleSheet {
    val  textContainer = style(
      flex := 1
    )
    val movieTitle = style(
      flex := 1,
      fontSize := 16,
      fontWeight._500,
      marginBottom := 2
    )
    val  movieYear = style(
      color := "#999999",
      fontSize := 12
    )
    val row = style(
      alignItems.center,
      backgroundColor := "white",
      flexDirection.row,
      padding := 5
    )
    val cellImage = style(
      backgroundColor := "#dddddd",
      height := 93,
      marginRight := 10,
      width := 60
    )
    val cellBorder = style(
      backgroundColor := "rgba(0, 0, 0, 0.1)",
      height := 1.0 / ReactNative.PixelRatio.get(),
      marginLeft := 4
    )
  }

  def apply(movie: js.Dynamic, onSelect: () => Unit,key : String = "") = component.withKey(key)(new Props(movie, onSelect))

} 
Example 18
Source File: MapboxGLMap.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.thirdparty

import chandu0101.scalajs.rn
import chandu0101.scalajs.rn.ReactNative
import chandu0101.scalajs.rn.components._
import japgolly.scalajs.react.ReactComponentU_

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}
import scala.scalajs.js.{UndefOr, undefined}


object MapBoxGLMap {

  def apply(style: UndefOr[js.Any] = undefined,
            onOpenAnnotation: UndefOr[MapViewAnnotation => _] = undefined,
            onRegionChange: UndefOr[js.Object => _] = undefined,
            centerCoordinate: UndefOr[CenterCoordinate] = undefined,
            zoomLevel: UndefOr[Int] = undefined,
            ref: UndefOr[String] = undefined,
            direction: UndefOr[Int] = undefined,
            debugActive: UndefOr[Boolean] = undefined,
            key: UndefOr[String] = undefined,
            styleURL: UndefOr[String] = undefined,
            annotations: UndefOr[js.Array[MapViewAnnotation]] = undefined,
            rotateEnabled: UndefOr[Boolean] = undefined,
            clipsToBounds: UndefOr[Boolean] = undefined,
            showsUserLocation: UndefOr[Boolean] = undefined,
            accessToken: String) = {

    val p = js.Dynamic.literal()
    style.foreach(v => p.updateDynamic("style")(v))
    onOpenAnnotation.foreach(v => p.updateDynamic("onOpenAnnotation")(v))
    onRegionChange.foreach(v => p.updateDynamic("onRegionChange")(v))
    centerCoordinate.foreach(v => p.updateDynamic("centerCoordinate")(if (v != null) v.toJson else null))
    zoomLevel.foreach(v => p.updateDynamic("zoomLevel")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    direction.foreach(v => p.updateDynamic("direction")(v))
    debugActive.foreach(v => p.updateDynamic("debugActive")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    styleURL.foreach(v => p.updateDynamic("styleURL")(v))
    annotations.foreach(v => p.updateDynamic("annotations")(v.map(a => a.toJson)))
    rotateEnabled.foreach(v => p.updateDynamic("rotateEnabled")(v))
    clipsToBounds.foreach(v => p.updateDynamic("clipsToBounds")(v))
    showsUserLocation.foreach(v => p.updateDynamic("showsUserLocation")(v))
    p.updateDynamic("accessToken")(accessToken)
//    val MapBox = js.Dynamic.global.require("react-native-mapbox-gl")
    val f = ReactNative.createFactory(rn.load[js.Object]("react-native-mapbox-gl"))
    f(p).asInstanceOf[ReactComponentU_]

  }

}


case class CenterCoordinate(latitude: Double, longitude: Double) {
  def toJson = {
    val p = json()
    p.updateDynamic("latitude")(latitude)
    p.updateDynamic("longitude")(longitude)
    p
  }
}

object CenterCoordinate {
  def fromJson(obj: js.Dynamic) = CenterCoordinate(latitude = obj.latitude.asInstanceOf[Double], longitude = obj.longitude.asInstanceOf[Double])
} 
Example 19
Source File: ReactNative.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn

import chandu0101.scalajs.rn.apis._
import japgolly.scalajs.react._

import scala.scalajs.js
import scala.scalajs.js.Object

trait ReactNative extends js.Object {


  //components
  val Text: js.Object = js.native
  val View: js.Object = js.native
  val TextInput: js.Object = js.native
  val TouchableWithoutFeedback: js.Object = js.native
  val TouchableHighlight: js.Object = js.native
  val TouchableOpacity: js.Object = js.native
  val ActivityIndicatorIOS: js.Object = js.native
  val DatePickerIOS: js.Object = js.native
  val Image: js.Object = js.native
  val ScrollView: js.Object = js.native
  val ListView: js.Object = js.native
  val MapView: js.Object = js.native
  val Navigator: js.Object = js.native
  val NavigatorIOS: js.Object = js.native
  val PickerIOS: js.Object = js.native
  val SliderIOS: js.Object = js.native
  val SwitchIOS: js.Object = js.native
  val TabBarItemIOS: js.Object = js.native
  val WebView: js.Object = js.native
  val TabBarIOS: js.Object = js.native
  val SegmentedControlIOS: js.Object = js.native

  // apis

  val AlertIOS: AlertIOS = js.native
  val AppRegistry: AppRegistry = js.native
  val StyleSheet: StyleSheet = js.native
  val AppStateIOS: AppStateIOS = js.native
  val AsyncStorage: AsyncStorageJS = js.native
  val CameraRoll: CameraRoll = js.native
  val InteractionManager: InteractionManager = js.native
  val LinkingIOS: LinkingIOS = js.native
  val NetInfo: NetInfo = js.native
  val LayoutAnimation: js.Dynamic = js.native
  val PixelRatio: PixelRatio = js.native
  val PushNotificationIOS: PushNotificationIOS = js.native
  val PanResponder: PanResponder = js.native
  val StatusBarIOS: js.Dynamic = js.native
  val VibrationIOS: VibrationIOS = js.native
  val Dimensions: js.Dynamic = js.native

  def createClass[P, S, B, N <: TopNode](spec: ReactComponentSpec[P, S, B, N]): ReactComponentType[P, S, B, N] = js.native

  def createClass(spec: js.Object): js.Dynamic = js.native

  def createFactory[P, S, B, N <: TopNode](t: ReactComponentType[P, S, B, N]): ReactComponentCU[P, S, B, N] = js.native

  def createFactory(c: js.Object): js.Dynamic = js.native

  def createElement[P, S, B, N <: TopNode](t: ReactComponentType[P, S, B, N]): ReactComponentCU[P, S, B, N] = js.native

  def createElement(tag: String, props: Object, children: ReactNode*): ReactDOMElement = js.native

  def createElement(tag: js.Object, props: Object, children: ReactNode*): ReactDOMElement = js.native


  val addons: js.Dynamic = js.native

  def findNodeHandle(ref : js.Any):js.Object = js.native
} 
Example 20
Source File: TouchableOpacity.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.{ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}





case class TouchableOpacity(onPressIn : js.UndefOr[() => Unit] = js.undefined,
                            onPress : js.UndefOr[() => Unit] = js.undefined,
                            style : js.UndefOr[js.Any] = js.undefined,
                            delayPressIn : js.UndefOr[Int] = js.undefined,
                            ref : js.UndefOr[String] = js.undefined,
                            onPressOut : js.UndefOr[() => Unit] = js.undefined,
                            key : js.UndefOr[String] = js.undefined,
                            onLongPress : js.UndefOr[() => Unit] = js.undefined,
                            delayPressOut : js.UndefOr[Int] = js.undefined,
                            delayLongPress : js.UndefOr[Int] = js.undefined,
                            activeOpacity : js.UndefOr[Int] = js.undefined,
                            accessible : js.UndefOr[Boolean]=js.undefined) {
  def toJS = {
    val p = js.Dynamic.literal()
    onPressIn.foreach(v => p.updateDynamic("onPressIn")(v))
    onPress.foreach(v => p.updateDynamic("onPress")(v))
    style.foreach(v => p.updateDynamic("style")(v))
    delayPressIn.foreach(v => p.updateDynamic("delayPressIn")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    onPressOut.foreach(v => p.updateDynamic("onPressOut")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    onLongPress.foreach(v => p.updateDynamic("onLongPress")(v))
    delayPressOut.foreach(v => p.updateDynamic("delayPressOut")(v))
    delayLongPress.foreach(v => p.updateDynamic("delayLongPress")(v))
    activeOpacity.foreach(v => p.updateDynamic("activeOpacity")(v))
    accessible.foreach(v => p.updateDynamic("accessible")(v))
    p
  }

  def apply(children : ReactNode) = {
    val f = ReactNative.createFactory(ReactNative.TouchableOpacity)
    f(toJS,children).asInstanceOf[ReactComponentU_]
  }
} 
Example 21
Source File: Image.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.ReactComponentU_

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}






object Image {

  def apply(onLoaded : js.UndefOr[Boolean]=js.undefined,
            source : js.UndefOr[ImageSource] = js.undefined,
            style : js.UndefOr[js.Any] = js.undefined,
            onLayout : js.UndefOr[js.Function] = js.undefined ,
            accessibilityLabel : js.UndefOr[String] = js.undefined,
            onLoadError : js.UndefOr[js.Dynamic => Unit] = js.undefined,
            ref : js.UndefOr[String] = js.undefined,
            onLoadAbort : js.UndefOr[js.Function] = js.undefined ,
            key : js.UndefOr[String] = js.undefined,
            resizeMode : js.UndefOr[ImageResizeMode] = js.undefined,
            testID : js.UndefOr[String] = js.undefined,
            onLoadStart : js.UndefOr[js.Dynamic => Unit] = js.undefined,
            defaultSource : js.UndefOr[ImageSource] = js.undefined,
            onLoadProgress : js.UndefOr[js.Dynamic => Unit] = js.undefined,
            accessible : js.UndefOr[Boolean]=js.undefined) = {

    val p = js.Dynamic.literal()
    onLoaded.foreach(v => p.updateDynamic("onLoaded")(v))
    source.foreach(v => p.updateDynamic("source")(v.toJson))
    style.foreach(v => p.updateDynamic("style")(v))
    onLayout.foreach(v => p.updateDynamic("onLayout")(v))
    accessibilityLabel.foreach(v => p.updateDynamic("accessibilityLabel")(v))
    onLoadError.foreach(v => p.updateDynamic("onLoadError")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    onLoadAbort.foreach(v => p.updateDynamic("onLoadAbort")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    resizeMode.foreach(v => p.updateDynamic("resizeMode")(v.mode))
    testID.foreach(v => p.updateDynamic("testID")(v))
    onLoadStart.foreach(v => p.updateDynamic("onLoadStart")(v))
    defaultSource.foreach(v => p.updateDynamic("defaultSource")(v.toJson))
    onLoadProgress.foreach(v => p.updateDynamic("onLoadProgress")(v))
    accessible.foreach(v => p.updateDynamic("accessible")(v))

    val f = ReactNative.createFactory(ReactNative.Image)
    f(p).asInstanceOf[ReactComponentU_]
  }

}



class ImageResizeMode private(val mode: String) extends AnyVal


object ImageResizeMode {

  val COVER = new ImageResizeMode("cover")
  val CONTAIN = new ImageResizeMode("contain")
  val STRETCH = new ImageResizeMode("stretch")

  def newMode(mode : String) = new ImageResizeMode(mode)

} 
Example 22
Source File: TouchableWithoutFeedback.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.{ReactComponentU_, ReactNode}

import scala.scalajs.js




case class TouchableWithoutFeedback(onPressIn : js.UndefOr[() => Unit] = js.undefined,
                                    onPress : js.UndefOr[() => Unit] = js.undefined,
                                    style : js.UndefOr[js.Any] = js.undefined,
                                    delayPressIn : js.UndefOr[Int] = js.undefined,
                                    ref : js.UndefOr[String] = js.undefined,
                                    onPressOut : js.UndefOr[() => Unit] = js.undefined,
                                    key : js.UndefOr[String] = js.undefined,
                                    onLongPress : js.UndefOr[() => Unit] = js.undefined,
                                    delayPressOut : js.UndefOr[Int] = js.undefined,
                                    delayLongPress : js.UndefOr[Int] = js.undefined,
                                    accessible : js.UndefOr[Boolean]=js.undefined) {
  def toJS = {
    val p = js.Dynamic.literal()
    onPressIn.foreach(v => p.updateDynamic("onPressIn")(v))
    onPress.foreach(v => p.updateDynamic("onPress")(v))
    style.foreach(v => p.updateDynamic("style")(v))
    delayPressIn.foreach(v => p.updateDynamic("delayPressIn")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    onPressOut.foreach(v => p.updateDynamic("onPressOut")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    onLongPress.foreach(v => p.updateDynamic("onLongPress")(v))
    delayPressOut.foreach(v => p.updateDynamic("delayPressOut")(v))
    delayLongPress.foreach(v => p.updateDynamic("delayLongPress")(v))
    accessible.foreach(v => p.updateDynamic("accessible")(v))
    p
  }

  def apply(children : ReactNode*) = {
    val f = ReactNative.createFactory(ReactNative.TouchableWithoutFeedback)
    f(toJS,children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
Example 23
Source File: TouchableHighlight.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn._
import japgolly.scalajs.react.{ReactComponentU_, ReactNode}

import scala.scalajs.js




case class TouchableHighlight(onPressIn: js.UndefOr[() => Unit] = js.undefined,
                              onPress: js.UndefOr[() => Unit] = js.undefined,
                              style: js.UndefOr[js.Any] = js.undefined,
                              delayPressIn: js.UndefOr[Int] = js.undefined,
                              onHideUnderlay: js.UndefOr[() => Unit] = js.undefined,
                              ref: js.UndefOr[String] = js.undefined,
                              onPressOut: js.UndefOr[() => Unit] = js.undefined,
                              key: js.UndefOr[String] = js.undefined,
                              onLongPress: js.UndefOr[() => Unit] = js.undefined,
                              underlayColor: js.UndefOr[String] = js.undefined,
                              delayPressOut: js.UndefOr[Int] = js.undefined,
                              delayLongPress: js.UndefOr[Int] = js.undefined,
                              onShowUnderlay: js.UndefOr[() => Unit] = js.undefined,
                              activeOpacity: js.UndefOr[Int] = js.undefined,
                              accessible: js.UndefOr[Boolean] = js.undefined) {
  def toJS = {
    val p = js.Dynamic.literal()
    onPressIn.foreach(v => p.updateDynamic("onPressIn")(v))
    onPress.foreach(v => p.updateDynamic("onPress")(v))
    style.foreach(v => p.updateDynamic("style")(v))
    delayPressIn.foreach(v => p.updateDynamic("delayPressIn")(v))
    onHideUnderlay.foreach(v => p.updateDynamic("onHideUnderlay")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    onPressOut.foreach(v => p.updateDynamic("onPressOut")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    onLongPress.foreach(v => p.updateDynamic("onLongPress")(v))
    underlayColor.foreach(v => p.updateDynamic("underlayColor")(v))
    delayPressOut.foreach(v => p.updateDynamic("delayPressOut")(v))
    delayLongPress.foreach(v => p.updateDynamic("delayLongPress")(v))
    onShowUnderlay.foreach(v => p.updateDynamic("onShowUnderlay")(v))
    activeOpacity.foreach(v => p.updateDynamic("activeOpacity")(v))
    accessible.foreach(v => p.updateDynamic("accessible")(v))
    p
  }

  def apply(children: ReactNode) = {
    val f = ReactNative.createFactory(ReactNative.TouchableHighlight)
    f(toJS, children).asInstanceOf[ReactComponentU_]
  }
} 
Example 24
Source File: DatePickerIOS.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.ReactComponentU_

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}





object DatePickerIOS {

  def apply(ref : js.UndefOr[String] = js.undefined,
            timeZoneOffsetInMinutes : js.UndefOr[Int] = js.undefined,
            key : js.UndefOr[String] = js.undefined,
            date : js.Date,
            minuteInterval : js.UndefOr[MinuteInterval] = js.undefined,
            mode : js.UndefOr[DatePickerIOSMode] = js.undefined,
            minimumDate : js.UndefOr[js.Date] = js.undefined ,
            maximumDate : js.UndefOr[js.Date] = js.undefined ,
            onDateChange : js.Date => Unit) = {

    val p = js.Dynamic.literal()
    ref.foreach(v => p.updateDynamic("ref")(v))
    timeZoneOffsetInMinutes.foreach(v => p.updateDynamic("timeZoneOffsetInMinutes")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    p.updateDynamic("date")(date)
    minuteInterval.foreach(v => p.updateDynamic("minuteInterval")(v.interval))
    mode.foreach(v => p.updateDynamic("mode")(v.mode))
    minimumDate.foreach(v => p.updateDynamic("minimumDate")(v))
    maximumDate.foreach(v => p.updateDynamic("maximumDate")(v))
    p.updateDynamic("onDateChange")(onDateChange)

    val f = ReactNative.createFactory(ReactNative.DatePickerIOS)
    f(p).asInstanceOf[ReactComponentU_]
  }

}


class DatePickerIOSMode private(val mode : String) extends AnyVal

object DatePickerIOSMode {

  val DATE = new DatePickerIOSMode(("date"))
  val TIME = new DatePickerIOSMode(("time"))
  val DATE_TIME = new DatePickerIOSMode(("datetime"))

  def newMode(mode : String) = new DatePickerIOSMode(mode)
}

class MinuteInterval private(val interval : Int) extends AnyVal


object MinuteInterval {

  val _1 = new MinuteInterval(1)
  val _2 = new MinuteInterval(2)
  val _3 = new MinuteInterval(3)
  val _4 = new MinuteInterval(4)
  val _5 = new MinuteInterval(5)
  val _6 = new MinuteInterval(6)
  val _10 = new MinuteInterval(10)
  val _12 = new MinuteInterval(12)
  val _15 = new MinuteInterval(15)
  val _20 = new MinuteInterval(20)
  val _30 = new MinuteInterval(30)

  def newInterval(interval : Int) = new MinuteInterval(interval)
} 
Example 25
Source File: PickerIOS.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.{ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}


object PickerItemIOS {

  def apply[T](style : js.UndefOr[js.Any] = js.undefined,
            label : js.UndefOr[String] = js.undefined,
            ref : js.UndefOr[String] = js.undefined,
            key : js.UndefOr[String] = js.undefined,
            value : js.UndefOr[T] = js.undefined) = {

    val p = js.Dynamic.literal()
    style.foreach(v => p.updateDynamic("style")(v))
    label.foreach(v => p.updateDynamic("label")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    value.foreach(v => p.updateDynamic("value")(v.asInstanceOf[js.Any]))

    val f = ReactNative.createFactory(ReactNative.PickerIOS.asInstanceOf[js.Dynamic].Item.asInstanceOf[js.Object])
    f(p).asInstanceOf[ReactComponentU_]
  }

} 
Example 26
Source File: Text.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn._
import japgolly.scalajs.react.{ReactComponentU_, ReactNode}

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{global => g}
import scala.scalajs.js.{UndefOr, undefined}




case class Text(suppressHighlighting : js.UndefOr[Boolean]=js.undefined,
                onPress : js.UndefOr[() => Unit] = js.undefined,
                style : js.UndefOr[js.Any] = js.undefined,
                onLayout : js.UndefOr[js.Function] = js.undefined ,
                numberOfLines : js.UndefOr[Int] = js.undefined,
                ref : js.UndefOr[String] = js.undefined,
                key : js.UndefOr[String] = js.undefined,
                testID : js.UndefOr[String] = js.undefined) {
  def toJS = {
    val p = js.Dynamic.literal()
    suppressHighlighting.foreach(v => p.updateDynamic("suppressHighlighting")(v))
    onPress.foreach(v => p.updateDynamic("onPress")(v))
    style.foreach(v => p.updateDynamic("style")(v))
    onLayout.foreach(v => p.updateDynamic("onLayout")(v))
    numberOfLines.foreach(v => p.updateDynamic("numberOfLines")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    testID.foreach(v => p.updateDynamic("testID")(v))
    p
  }

  def apply(children : ReactNode*) = {
    val f = ReactNative.createFactory(ReactNative.Text)
    f(toJS,children.toJsArray).asInstanceOf[ReactComponentU_]
  }
} 
Example 27
Source File: SegmentedControlIOS.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn._
import japgolly.scalajs.react._

import scala.scalajs.js




object SegmentedControlIOS {

  def apply(momentary: js.UndefOr[Boolean] = js.undefined,
            style: js.UndefOr[js.Any] = js.undefined,
            onChange: js.UndefOr[js.Dynamic => Unit] = js.undefined,
            enabled: js.UndefOr[Boolean] = js.undefined,
            ref: js.UndefOr[String] = js.undefined,
            tintColor: js.UndefOr[String] = js.undefined,
            key: js.UndefOr[String] = js.undefined,
            onValueChange: js.UndefOr[String => Unit] = js.undefined,
            values: js.UndefOr[Seq[String]] = js.undefined,
            selectedIndex: js.UndefOr[Int] = js.undefined) = {

    val p = js.Dynamic.literal()
    momentary.foreach(v => p.updateDynamic("momentary")(v))
    style.foreach(v => p.updateDynamic("style")(v))
    onChange.foreach(v => p.updateDynamic("onChange")(v))
    enabled.foreach(v => p.updateDynamic("enabled")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    tintColor.foreach(v => p.updateDynamic("tintColor")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    onValueChange.foreach(v => p.updateDynamic("onValueChange")(v))
    values.foreach(v => p.updateDynamic("values")(v.toJsArray))
    selectedIndex.foreach(v => p.updateDynamic("selectedIndex")(v))

    val f = ReactNative.createFactory(ReactNative.SegmentedControlIOS)
    f(p).asInstanceOf[ReactComponentU_]
  }

} 
Example 28
Source File: SliderIOS.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.ReactComponentU_

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}






object SliderIOS {

  def apply(style : js.UndefOr[js.Any] = js.undefined,
            minimumTrackTintColor : js.UndefOr[String] = js.undefined,
            minimumValue : js.UndefOr[Double] = js.undefined,
            onSlidingComplete : js.UndefOr[Double => Unit] = js.undefined,
            ref : js.UndefOr[String] = js.undefined,
            maximumTrackTintColor : js.UndefOr[String] = js.undefined,
            key : js.UndefOr[String] = js.undefined,
            onValueChange : js.UndefOr[Double => Unit] = js.undefined,
            value : js.UndefOr[Double] = js.undefined,
            maximumValue : js.UndefOr[Double] = js.undefined) = {

    val p = js.Dynamic.literal()
    style.foreach(v => p.updateDynamic("style")(v))
    minimumTrackTintColor.foreach(v => p.updateDynamic("minimumTrackTintColor")(v))
    minimumValue.foreach(v => p.updateDynamic("minimumValue")(v))
    onSlidingComplete.foreach(v => p.updateDynamic("onSlidingComplete")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    maximumTrackTintColor.foreach(v => p.updateDynamic("maximumTrackTintColor")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    onValueChange.foreach(v => p.updateDynamic("onValueChange")(v))
    value.foreach(v => p.updateDynamic("value")(v))
    maximumValue.foreach(v => p.updateDynamic("maximumValue")(v))

    val f = ReactNative.createFactory(ReactNative.SliderIOS)
    f(p).asInstanceOf[ReactComponentU_]
  }

} 
Example 29
Source File: ImageSource.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}


case class ImageSource(uri : String,isStatic : js.UndefOr[Boolean] = js.undefined) {

 def toJson = {
   val p = json()
   p.updateDynamic("uri")(uri)
   isStatic.foreach(v => p.updateDynamic("isStatic")(v))
   p
 }
}

object ImageSource {
  def fromJson(obj : js.Dynamic) = {
     ImageSource(obj.uri.toString,if(js.isUndefined(obj.isStatic)) js.undefined else obj.isStatic.asInstanceOf[Boolean] )
  }
} 
Example 30
Source File: SwitchIOS.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn.ReactNative
import japgolly.scalajs.react.ReactComponentU_

import scala.scalajs.js




object SwitchIOS {

  def apply(style: js.UndefOr[js.Any] = js.undefined,
            ref: js.UndefOr[String] = js.undefined,
            tintColor: js.UndefOr[String] = js.undefined,
            key: js.UndefOr[String] = js.undefined,
            thumbTintColor: js.UndefOr[String] = js.undefined,
            onValueChange: js.UndefOr[Boolean => Unit] = js.undefined,
            onTintColor: js.UndefOr[String] = js.undefined,
            disabled: js.UndefOr[Boolean] = js.undefined,
            value: js.UndefOr[Boolean] = js.undefined) = {

    val p = js.Dynamic.literal()
    style.foreach(v => p.updateDynamic("style")(v))
    ref.foreach(v => p.updateDynamic("ref")(v))
    tintColor.foreach(v => p.updateDynamic("tintColor")(v))
    key.foreach(v => p.updateDynamic("key")(v))
    thumbTintColor.foreach(v => p.updateDynamic("thumbTintColor")(v))
    onValueChange.foreach(v => p.updateDynamic("onValueChange")(v))
    onTintColor.foreach(v => p.updateDynamic("onTintColor")(v))
    disabled.foreach(v => p.updateDynamic("disabled")(v))
    value.foreach(v => p.updateDynamic("value")(v))

    val f = ReactNative.createFactory(ReactNative.SwitchIOS)
    f(p).asInstanceOf[ReactComponentU_]
  }

} 
Example 31
Source File: TabBarIOS.scala    From scalajs-react-native   with Apache License 2.0 5 votes vote down vote up
package chandu0101.scalajs.rn.components

import chandu0101.scalajs.rn._
import japgolly.scalajs.react.{ReactComponentU_, ReactNode}

import scala.scalajs.js


case class TabBarItemIOS(systemIcon : js.UndefOr[SystemIcon] = js.undefined,
                         selectedIcon : js.UndefOr[ImageSource] = js.undefined,
                         onPress : () => Unit,
                         style : js.UndefOr[js.Any] = js.undefined,
                         icon : ImageSource,
                         ref : js.UndefOr[String] = js.undefined,
                         selected : Boolean,
                         key : js.UndefOr[String] = js.undefined,
                         badge : js.UndefOr[String] = js.undefined,
                         title : js.UndefOr[String] = js.undefined) {
  def toJS = {
    val p = js.Dynamic.literal()
    systemIcon.foreach(v => p.updateDynamic("systemIcon")(v.name))
    selectedIcon.foreach(v => p.updateDynamic("selectedIcon")(v.toJson))
    p.updateDynamic("onPress")(onPress)
    style.foreach(v => p.updateDynamic("style")(v))
    p.updateDynamic("icon")(icon.toJson)
    ref.foreach(v => p.updateDynamic("ref")(v))
    p.updateDynamic("selected")(selected)
    key.foreach(v => p.updateDynamic("key")(v))
    badge.foreach(v => p.updateDynamic("badge")(v))
    title.foreach(v => p.updateDynamic("title")(v))
    p
  }

  def apply(children : ReactNode) = {
    val f = ReactNative.createFactory(ReactNative.TabBarIOS.asInstanceOf[js.Dynamic].Item.asInstanceOf[js.Object])
    f(toJS,children).asInstanceOf[ReactComponentU_]
  }
}



class SystemIcon private(val name : String) extends AnyVal

object SystemIcon {

  val BOOKMARKS = new SystemIcon("bookmarks")
  val CONTACTS = new SystemIcon("contacts")
  val DOWNLOADS = new SystemIcon("downloads")
  val FAVORITES = new SystemIcon("favorites")
  val FEATURED = new SystemIcon("featured")
  val HISTORY = new SystemIcon("history")
  val MORE = new SystemIcon("more")
  val MOST_RECENT = new SystemIcon("most-recent")
  val MOST_VIEWED = new SystemIcon("most-viewed")
  val RECENTS = new SystemIcon("recents")
  val SEARCH = new SystemIcon("search")
  val TOP_RATED = new SystemIcon("top-rated")

  def newIcon(name : String) = new SystemIcon(name)
} 
Example 32
Source File: BossSelectMenu.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client.views

import com.thoughtworks.binding
import com.thoughtworks.binding.Binding
import com.thoughtworks.binding.Binding._
import org.scalajs.dom
import org.scalajs.dom.raw._
import scala.scalajs.js
import walfie.gbf.raidfinder.client._
import walfie.gbf.raidfinder.client.ViewModel._
import walfie.gbf.raidfinder.client.syntax.{ElementOps, EventOps, HTMLElementOps, StringOps}
import walfie.gbf.raidfinder.protocol._

object BossSelectMenu {
  @binding.dom
  def content(
    client:       RaidFinderClient,
    closeModal:   Event => Unit,
    currentTab:   Binding[DialogTab],
    imageQuality: Binding[ImageQuality]
  ): Binding[Element] = {
    val isFollowing = client.state.followedBossNames
    val bossListElement = bossList(client, imageQuality).bind

    // TODO: Write a more generic event delegation helper
    bossListElement.addEventListener("click", { e: Event =>
      for {
        target <- e.targetElement
        element <- target.findParent(_.classList.contains("gbfrf-js-bossSelect"))
        bossName <- Option(element.getAttribute("data-bossName"))
      } yield client.toggleFollow(bossName)
    })

    <section lang="ja" id="gbfrf-dialog__follow" class={
      val isActive = currentTab.bind == DialogTab.Follow
      "gbfrf-dialog__content mdl-layout__tab-panel".addIf(isActive, "is-active")
    }>
      { bossListElement }
    </section>
  }

  @binding.dom
  def bossList(client: RaidFinderClient, imageQuality: Binding[ImageQuality]): Binding[HTMLUListElement] = {
    <ul class="mdl-list" style="padding: 0; margin: 0;">
      {
        for {
          bossColumn <- client.state.allBosses
          boss = bossColumn.raidBoss
          isFollowing = Binding { client.state.followedBossNames.bind(boss.bind.name) }

          // Only show Japanese bosses unless there is no translation
          // TODO: This is kinda hacky, maybe think of a better way
          if (boss.bind.language == Language.JAPANESE || boss.bind.translatedName.isEmpty || isFollowing.bind)
        } yield bossListItem(boss, isFollowing, imageQuality).bind
      }
    </ul>
  }

  @binding.dom
  def bossListItem(
    boss: Binding[RaidBoss], isFollowing: Binding[Boolean], imageQuality: Binding[ImageQuality]
  ): Binding[HTMLLIElement] = {
    val elem =
      <li class={
        "gbfrf-js-bossSelect gbfrf-follow__boss-box mdl-list__item".addIf(
          imageQuality.bind != ImageQuality.Off,
          "gbfrf-follow__boss-box--with-image mdl-shadow--2dp"
        ).addIf(boss.bind.translatedName.nonEmpty, "mdl-list__item--two-line")
      } data:data-bossName={ boss.bind.name }>
        <span class="mdl-list__item-primary-content">
          <span>{ boss.bind.name }</span>
          {
            boss.bind.translatedName match {
              case Some(translatedName) => Constants(
                <span class="gbfrf-follow__boss-box-subtitle mdl-list__item-sub-title">{ translatedName }</span>
              )
              case None => Constants()
            }
          }
        </span>
        <div class="mdl-layout-spacer"></div>
        {
          if (isFollowing.bind) Constants(<div class="mdl-badge mdl-badge--overlap" data:data-badge="★"></div>)
          else Constants()
        }
      </li>

    elem.backgroundImageQuality(boss.bind.image, 0.25, imageQuality.bind)
  }
} 
Example 33
Source File: MainDialog.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client.views

import com.thoughtworks.binding
import com.thoughtworks.binding.Binding
import com.thoughtworks.binding.Binding._
import org.scalajs.dom
import org.scalajs.dom.raw._
import scala.scalajs.js
import walfie.gbf.raidfinder.client._
import walfie.gbf.raidfinder.client.syntax.{ElementOps, EventOps, HTMLElementOps, StringOps}
import walfie.gbf.raidfinder.client.ViewModel._
import walfie.gbf.raidfinder.protocol._

object MainDialog {
  @binding.dom
  def element(client: RaidFinderClient, viewState: ViewModel.State): Binding[HTMLElement] = {
    val dialog = dom.document.createElement("dialog").asInstanceOf[HTMLElement]
    dialog.classList.add("mdl-dialog")
    dialog.classList.add("gbfrf-dialog")
    val dynamicDialog = dialog.asInstanceOf[js.Dynamic]

    if (js.isUndefined(dynamicDialog.showModal)) {
      js.Dynamic.global.dialogPolyfill.registerDialog(dialog)
    }

    val closeModal = { (e: Event) => dynamicDialog.close(); () }
    val reloadBosses = { (e: Event) => client.resetBossList() }

    val onTabChange = () => ViewModel.persistState(viewState)

    val currentTab = viewState.currentTab

    val inner =
      <div class="gbfrf-main-dialog gbfrf-dialog__container mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-tabs">
        { dialogHeader(viewState.currentTab, onClose = closeModal, onTabChange = onTabChange).bind }
        { BossSelectMenu.content(client, closeModal, currentTab, viewState.imageQuality).bind }
        { SettingsMenu.content(client, viewState).bind }
        <hr style="margin: 0;"/>
        { dialogFooter(viewState.currentTab, closeModal = closeModal, reloadBosses = reloadBosses).bind }
      </div>

    dialog.appendChild(inner)
    dialog.mdl
  }

  @binding.dom
  def dialogHeader(currentTab: Var[ViewModel.DialogTab], onClose: Event => Unit, onTabChange: () => Unit): Binding[HTMLElement] = {
    <header class="mdl-layout__header">
      <div class="mdl-layout__header-row gbfrf-column__header-row">
        {
          Constants(DialogTab.all: _*).map { tab =>
            val classList = "gbfrf-dialog__tab-bar-item mdl-layout__tab".addIf(currentTab.bind == tab, "is-active")
            val onClick = { (e: Event) => currentTab := tab; onTabChange() }
            <div class={ classList } onclick={ onClick }>{ tab.label }</div>
          }
        }
        <div class="mdl-layout-spacer"></div>
        <div class="mdl-button mdl-js-button mdl-button--icon material-icons js-close-dialog" onclick={ onClose }>
          <i class="material-icons">clear</i>
        </div>
      </div>
    </header>
  }

  @binding.dom
  def dialogFooter(
    currentTab:   Binding[ViewModel.DialogTab],
    closeModal:   Event => Unit,
    reloadBosses: Event => Unit
  ): Binding[HTMLDivElement] = {
    <div class="mdl-dialog__actions">
      <button type="button" class="mdl-button gbfrf-dialog__button" onclick={ closeModal }>Close</button>
      <button type="button" class={
        "gbfrf-dialog__button mdl-button".addIf(currentTab.bind != DialogTab.Follow, "is-hidden")
      } onclick={ reloadBosses }>
        <i class="material-icons">refresh</i>
        Reload Bosses
      </button>
    </div>
  }

} 
Example 34
Source File: Notification.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client.views

import com.thoughtworks.binding
import com.thoughtworks.binding.Binding
import com.thoughtworks.binding.Binding._
import org.scalajs.dom.raw._
import scala.scalajs.js
import walfie.gbf.raidfinder.client.syntax.HTMLElementOps

trait Notification {
  def binding: Binding[Element]
  def enqueue(message: String): Unit
}

class SnackbarNotification extends Notification {
  @binding.dom
  val binding: Binding[Element] = {
    <div class="mdl-js-snackbar mdl-snackbar">
      <div class="mdl-snackbar__text"></div>
      <button class="mdl-snackbar__action" type="button"></button>
    </div>
  }.mdl

  def enqueue(message: String): Unit = {
    val data = js.Dictionary("message" -> message, "timeout" -> "1000")
    Binding {
      binding.bind.asInstanceOf[js.Dynamic].MaterialSnackbar.showSnackbar(data)
    }
  }
} 
Example 35
Source File: package.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client

import com.thoughtworks.binding
import com.thoughtworks.binding.Binding
import com.thoughtworks.binding.Binding._
import org.scalajs.dom
import org.scalajs.dom.raw._
import scala.collection.mutable.Buffer
import scala.scalajs.js
import walfie.gbf.raidfinder.client.ViewModel.ImageQuality
import walfie.gbf.raidfinder.protocol._

import js.Dynamic.global

package object syntax {
  implicit class HTMLElementOps[T <: HTMLElement](val elem: T) extends AnyVal {
    
    def :=(elements: TraversableOnce[T]): Buffer[T] = {
      buffer.clear()
      buffer ++= elements
    }
  }

  implicit class StringOps(val string: String) extends AnyVal {
    def addIf(condition: Boolean, s: String): String =
      if (condition) s"$string $s" else string
  }

  implicit class LanguageOps(val language: Language) extends AnyVal {
    def shortName: Option[String] = language match {
      case Language.JAPANESE => Some("JP")
      case Language.ENGLISH => Some("EN")
      case _ => None
    }
  }
} 
Example 36
Source File: Audio.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client

import org.scalajs.dom.raw.HTMLAudioElement
import scala.scalajs.js

package audio {
  case class NotificationSound(id: NotificationSoundId, fileName: String) {
    def play(): Unit = {
      NotificationSounds.audioCache.getOrElseUpdate(fileName, {
        js.Dynamic
          .newInstance(js.Dynamic.global.Audio)(pathPrefix + fileName)
          .asInstanceOf[HTMLAudioElement]
      }).play()
    }
  }
}

package object audio {
  type NotificationSoundId = Int

  private[audio] val pathPrefix = "audio/"

  object NotificationSounds {
    // When adding new items, don't change the numeric IDs
    val all: Seq[NotificationSound] = Seq(
      1 -> "oh-finally.ogg",
      2 -> "oringz-w425.ogg",
      3 -> "pedantic.ogg",
      4 -> "suppressed.ogg",
      5 -> "system.ogg",
      6 -> "tweet.ogg",
      7 -> "you-wouldnt-believe.ogg",
      8 -> "youve-been-informed.ogg"
    ).map { case (id, fileName) => NotificationSound(id, fileName) }.sortBy(_.fileName)

    val findById: NotificationSoundId => Option[NotificationSound] =
      all.map(n => n.id -> n).toMap.get _

    private[audio] var audioCache: js.Dictionary[HTMLAudioElement] = js.Dictionary()
  }

} 
Example 37
Source File: Application.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client

import com.momentjs.Moment
import com.thoughtworks.binding
import com.thoughtworks.binding.Binding._
import org.scalajs.dom
import org.scalajs.dom.raw._
import scala.scalajs.js
import scala.scalajs.js.annotation._
import walfie.gbf.raidfinder.client.util.time._
import walfie.gbf.raidfinder.client.ViewModel.TimeFormat
import walfie.gbf.raidfinder.protocol._

@JSExport("GbfRaidFinder")
object Application {
  @JSExport
  def init(url: String): Unit = {
    val maxReconnectInterval = Duration.seconds(10)

    val websocket = new BinaryProtobufWebSocketClient(url, maxReconnectInterval)

    val client: RaidFinderClient = new WebSocketRaidFinderClient(
      websocket, dom.window.localStorage, SystemClock
    )

    Moment.defineLocale("en-short", MomentShortLocale)

    val notification = new views.SnackbarNotification

    val viewState = ViewModel.loadState()

    // Update currentTime every 30 seconds
    val currentTime: Var[Double] = Var(js.Date.now())
    js.timers.setInterval(Duration.seconds(30).milliseconds) {
      client.truncateColumns(50)
      currentTime := js.Date.now()
    }

    val div = dom.document.createElement("div")
    div.classList.add("gbfrf-container")
    val mainContent = views.MainContent.mainContent(
      client, ViewModel.loadState(), notification, currentTime, client.isConnected
    )

    binding.dom.render(div, mainContent)
    dom.document.body.appendChild(div)
  }
} 
Example 38
Source File: time.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package walfie.gbf.raidfinder.client.util

import java.util.Date
import scala.scalajs.js

package time {
  trait Clock { def now(): Date }
  object SystemClock extends Clock { def now(): Date = new Date() }

  case class Duration(milliseconds: Long) extends AnyVal
  object Duration {
    def seconds(s: Long): Duration = Duration(s * 1000)
    def minutes(m: Long): Duration = Duration(m * 60 * 1000)
    def hours(h: Long): Duration = Duration(h * 3600 * 1000)
    def days(d: Long): Duration = Duration(d * 24 * 3600 * 1000)
  }
}

package object time {
  val MomentShortLocale: js.Dictionary[js.Any] = js.Dictionary(
    "parentLocale" -> "en",
    "relativeTime" -> js.Dictionary(
      "future" -> "in %s",
      "past" -> "%s ago",
      "s" -> "now",
      "ss" -> "%ss",
      "m" -> "1m",
      "mm" -> "%dm",
      "h" -> "1h",
      "hh" -> "%dh",
      "d" -> "1d",
      "dd" -> "%dd",
      "M" -> "1M",
      "MM" -> "%dM",
      "y" -> "1Y",
      "yy" -> "%dY"
    )
  )
} 
Example 39
Source File: package.scala    From gbf-raidfinder   with MIT License 5 votes vote down vote up
package com.momentjs

import scala.scalajs.js
import scala.scalajs.js.annotation.JSName

@js.native
@JSName("moment")
object Moment extends js.Object {
  def apply(millis: Double): Date = js.native

  def locale(localeName: String): Unit = js.native
  def defineLocale(localeName: String, settings: js.Dictionary[js.Any]): Unit = js.native
}

@js.native
trait Date extends js.Object {
  def fromNow(): String = js.native
  def fromNow(withoutSuffix: Boolean): String = js.native
  def from(millis: Double, withoutSuffix: Boolean): String = js.native
  def format(stringFormat: String): String = js.native
} 
Example 40
Source File: SjsonnetMain.scala    From sjsonnet   with Apache License 2.0 5 votes vote down vote up
package sjsonnet

import scala.collection.mutable
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}

@JSExportTopLevel("SjsonnetMain")
object SjsonnetMain {
  def createParseCache() = collection.mutable.Map[String, fastparse.Parsed[(Expr, Map[String, Int])]]()
  @JSExport
  def interpret(text: String,
                extVars: js.Any,
                tlaVars: js.Any,
                wd0: String,
                importer: js.Function2[String, String, js.Array[String]],
                preserveOrder: Boolean = false): js.Any = {
    val interp = new Interpreter(
      mutable.Map.empty,
      ujson.WebJson.transform(extVars, ujson.Value).obj.toMap,
      ujson.WebJson.transform(tlaVars, ujson.Value).obj.toMap,
      JsVirtualPath(wd0),
      importer = (wd, path) => {
        importer(wd.asInstanceOf[JsVirtualPath].path, path) match{
          case null => None
          case arr => Some((JsVirtualPath(arr(0)), arr(1)))
        }
      },
      preserveOrder
    )
    interp.interpret0(text, JsVirtualPath("(memory)"), ujson.WebJson.Builder) match{
      case Left(msg) => throw new js.JavaScriptException(msg)
      case Right(v) => v
    }
  }
}


case class JsVirtualPath(path: String) extends Path{
  def relativeToString(p: Path): String = p match{
    case other: JsVirtualPath if path.startsWith(other.path) => path.drop(other.path.length)
    case _ => path
  }

  def debugRead(): Option[String] = None

  def parent(): Path = JsVirtualPath(path.split('/').dropRight(1).mkString("/"))

  def segmentCount(): Int = path.split('/').length

  def last: String = path.split('/').last

  def /(s: String): Path = JsVirtualPath(path + "/" + s)
} 
Example 41
Source File: JSJValue.scala    From scala-json   with Apache License 2.0 5 votes vote down vote up
package json.internal

import json._

import scala.scalajs.js
import scala.scalajs.js.typedarray._

object JSJValue {
  import accessors._

  private implicit def typedArrToArr[T, U](x: TypedArray[T, U]): js.Array[T] = x.asInstanceOf[js.Array[T]]

  def newPrimArr[T, U](from: TypedArray[T, U]) = (from: js.Array[T])

  private[json] object TypedArrayExtractor {
    def unapply(x: js.Object): Option[TypedArray[_, _]] = {
      val dynamic = x.asInstanceOf[js.Dynamic]
      if(!scalajs.runtime.Bits.areTypedArraysSupported) None
      else if(js.isUndefined(dynamic.length) || js.isUndefined(dynamic.byteLength)) None
      else Some(x.asInstanceOf[TypedArray[_, _]])
    }
  }

  def typedArrayToJArray(arr: TypedArray[_, _]): PrimitiveJArray[_] = arr match {
    case x: Int8Array => new PrimitiveJArray(newPrimArr(x))
    case x: Int16Array => new PrimitiveJArray(newPrimArr(x))
    case x: Int32Array => new PrimitiveJArray(newPrimArr(x))
    case x: Uint8Array => new PrimitiveJArray(newPrimArr(x))
    case x: Uint16Array => new PrimitiveJArray(newPrimArr(x))
    case x: Uint32Array => new PrimitiveJArray(newPrimArr(x))
    case _ => sys.error("Unsupported native array of type " + js.typeOf(arr))
  }

  def fromNativeJS(default: => JValue)(v: Any): JValue = v match {
    case x: JValue => x
    case x if js.isUndefined(x) => JUndefined
    case x: String => JString(x)
    case seq0 if js.Array.isArray(seq0.asInstanceOf[js.Any]) =>
      val seq = seq0.asInstanceOf[js.Array[js.Any]]
      //TODO: this needs a more optimized implementation.... perhaps lazy-eval ?
      val jvals: IndexedSeq[JValue] = seq map JSJValue.safeReverseFromNativeJS

      JArray(jvals)
    case null      => JNull
    case true      => JTrue
    case false     => JFalse
    case x: Double => JNumber(x)
    case TypedArrayExtractor(arr) => typedArrayToJArray(arr)
    case x0: js.Object =>
      val x = x0.asInstanceOf[js.Dynamic]
      val seq = (js.Object keys x0).map { key =>
        val value: JValue = JSJValue safeReverseFromNativeJS x.selectDynamic(key)
        key -> value
      }
      JObject(seq: _*)
    case _ => default
  }

  def fromNativeJS(x: Any): JValue =
    fromNativeJS(sys.error(s"cannot turn $x into a JValue from native JS value"))(x)

  def from(v: Any): JValue =
    JValue.fromAnyInternal(fromNativeJS(v))(v)

  def toJS(x: JValue): js.Any = x.toNativeJS

  //this method simply reverses the order of the pattern match for performance sake
  private def safeReverseFromNativeJS(x: Any): JValue = {
    def err = sys.error(s"cannot turn $x into a JValue from non-native JS value")
    fromNativeJS(JValue.fromAnyInternal(err)(x))(x)
  }
} 
Example 42
Source File: RxPromise.scala    From scalajs-rxjs   with MIT License 5 votes vote down vote up
//     Project: scalajs-rxjs
//      Module: RxPromise
// Description: Provides an extension of js.Promise with simplified event handling

// Copyright (c) 2016. Distributed under the MIT License (see included LICENSE file).
package rxjs

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobal, JSName}
import scala.language.implicitConversions

@js.native
trait RxPromise[T] extends js.Promise[T] {

  @JSName("then")
  def andThen[R](onFulfilled: js.Function1[T,R]): RxPromise[R] = js.native

  @JSName("then")
  def andThen[R](onFulfilled: js.Function1[T,R],
                 onRejected: js.UndefOr[js.Function1[js.Any,R]]): RxPromise[R] = js.native

  @JSName("catch")
  def orCatch(onError: js.Function1[js.Any,_]): RxPromise[T] = js.native
}

object RxPromise {
  @inline
  implicit def toObservable[T](p: RxPromise[T]): Observable[T] = Observable.fromPromise(p)

  type ResolveFun[T] = Function1[T,js.Promise[T]]
  type RejectFun = Function1[Any,js.Promise[Nothing]]

  @JSGlobal("Promise")
  @js.native
  private class Impl[T](executor: js.Function2[js.Function1[T,Unit],js.Function1[Any,Unit],Any]) extends js.Object

  def apply[T](executor: Function2[js.Function1[T,Unit],js.Function1[Any,Unit],Any]): RxPromise[T] = new Impl(executor).asInstanceOf[RxPromise[T]]
  def resolve[T](value: T): RxPromise[T] = js.Promise.resolve[T](value).asInstanceOf[RxPromise[T]]
  def reject(reason: Any): RxPromise[Nothing] = js.Promise.reject(reason).asInstanceOf[RxPromise[Nothing]]

  implicit final class RichRxPromise[T](val p: RxPromise[T]) extends AnyVal {
    @inline
    def map[R](f: T=>R): RxPromise[R] = p.andThen(f)
    @inline
    @deprecated("Use map() instead","0.0.2")
    def onFulfilled[R](f: T=>R): RxPromise[R] = p.andThen(f)
    @inline
    def onError(f: js.Any=>_): RxPromise[T] = p.orCatch(f)
  }
} 
Example 43
Source File: Subscription.scala    From scalajs-rxjs   with MIT License 5 votes vote down vote up
//     Project: scalajs-rxjs
//      Module: rxjs/Subscription.ts
// Description: Façade trait for RxJS5 Subscriptions

// Copyright (c) 2016. Distributed under the MIT License (see included LICENSE file).
package rxjs.core

import rxjs.core.Subscription.TeardownLogic

import scala.scalajs.js

@js.native
trait AnonymousSubscription extends js.Object {
  def unsubscribe(): Unit = js.native
}

@js.native
trait Subscription extends AnonymousSubscription {
  def closed: Boolean = js.native
  def add(teardown: TeardownLogic): Subscription = js.native
  def remove(subscription: Subscription): Unit = js.native
}

object Subscription {
  type TeardownLogic = js.|[AnonymousSubscription,js.Function]
} 
Example 44
Source File: Promise.scala    From scalajs-rxjs   with MIT License 5 votes vote down vote up
//     Project: scalajs-rxjs
//      Module:
// Description: Façade trait for Promises

// Copyright (c) 2016. Distributed under the MIT License (see included LICENSE file).
package rxjs.core

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobal, JSName}

@js.native
@JSGlobal("Promise")
class IPromise[T](f: js.Function2[js.Function1[T,Unit],js.Function1[T,Unit],_]) extends js.Object {
  @JSName("then")
  def andThen[U](onFulfilled: js.Function1[T,U], onRejected: js.Function1[js.Any,_]): IPromise[U] = js.native
}

object IPromise {
  implicit class RichIPromise[T](val p: IPromise[T]) extends AnyVal {
    @inline
    final def andThen[U](onFulfilled: T=>U, onRejected: js.Any=>_): IPromise[U] = p.andThen[U](
      onFulfilled:js.Function1[T,U],
      onRejected: js.Function1[js.Any,_]
    )

    @inline
    final def onSuccess[U](f: T=>U): IPromise[U] = p.andThen[U](f,null)
  }

//  def apply[T](resolve: =>T): IPromise[T] = new IPromise[T]((resolve:js.Function1[T,Unit],reject:js))
}

@js.native
@JSGlobal("Promise")
object Promise extends js.Object {
  def resolve[T](value: T): IPromise[T] = js.native
  def reject[T](value: T): IPromise[T] = js.native
} 
Example 45
Source File: TestBase.scala    From scalajs-rxjs   with MIT License 5 votes vote down vote up
//     Project: scalajs-rxjs
// Description: Common base class for utest-based tests

// Copyright (c) 2016. Distributed under the MIT License (see included LICENSE file).
package rxjs

import rxjs.TestBase.ObservableFuture
import utest._

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.Duration
import scala.concurrent._
import scala.scalajs.js
import scala.util.{Failure, Try}

abstract class TestBase extends TestSuite {
  implicit val ec = scalajs.concurrent.JSExecutionContext.queue

//  def future[T](o: Observable[T]): ObservableFuture[T] = new ObservableFuture[T](o)
}

object TestBase {
  class ObservableFuture[T](obs: Observable[T]) extends Future[Seq[T]] {
    private var _data  = js.Array[T]()
    private val p = Promise[Seq[T]]()
    private lazy val future = p.future
    obs.subscribe((e:T)=> this.synchronized(_data.push(e)),
      (err:Any) => p.failure(new RuntimeException(err.toString)),
      () => p.success(_data) )

    override def onComplete[U](f: (Try[Seq[T]]) => U)(implicit executor: ExecutionContext): Unit = future.onComplete(f)
    override def isCompleted: Boolean = future.isCompleted
    override def value: Option[Try[Seq[T]]] = future.value
    def expectFailure(f: (Throwable)=>Any)(implicit ec: ExecutionContext): Future[Seq[T]] = {
      future.onSuccess{ case _ => throw new RuntimeException("expected Failure")}
      future.recover{
        case x =>
          f(x)
          Seq()
      }
    }

    @throws[Exception](classOf[Exception])
    override def result(atMost: Duration)(implicit permit: CanAwait): Seq[T] = future.result(atMost)

    @throws[InterruptedException](classOf[InterruptedException])
    @throws[TimeoutException](classOf[TimeoutException])
    override def ready(atMost: Duration)(implicit permit: CanAwait): ObservableFuture.this.type = ???

    // additional members since 2.12.0
    def transform[S](f: scala.util.Try[Seq[T]] => scala.util.Try[S])(implicit executor: scala.concurrent.ExecutionContext): scala.concurrent.Future[S] = ???
    def transformWith[S](f: scala.util.Try[Seq[T]] => scala.concurrent.Future[S])(implicit executor: scala.concurrent.ExecutionContext): scala.concurrent.Future[S] = ???
  }
} 
Example 46
Source File: Alert.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}


object Alert extends BootstrapComponent {
  override type P = Alert
  override type S = Unit
  override type B = Backend
  override type N = TopNode

  override def defaultProps = Alert()

  case class Alert(dismissAfter: UndefOr[Int] = undefined,
                   onDismiss: UndefOr[() => Unit] = undefined,
                   bsClass: UndefOr[Classes.Value] = Classes.alert,
                   bsStyle: UndefOr[Styles.Value] = Styles.info,
                   bsSize: UndefOr[Sizes.Value] = undefined,
                   addClasses: String = "") extends BsProps with MergeableProps[Alert] {

    def merge(t: Map[String, Any]): Alert = implicitly[Mergeable[Alert]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[Alert]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  class Backend($: BackendScope[Alert, Unit]) {
    var dismissTimer: js.UndefOr[js.timers.SetTimeoutHandle] =
      js.undefined

    def clearTimer() = {
      if (dismissTimer.isDefined) {
        js.timers.clearTimeout(dismissTimer.get)
        dismissTimer = undefined
      }
    }

    def start(dismissAfter: Int, onDismiss: () => Unit) =
      dismissTimer = js.timers.setTimeout(dismissAfter)(onDismiss())
  }

  override val component = ReactComponentB[Alert]("Alert")
    .stateless
    .backend(new Backend(_))
    .render { (P, C, S, B) =>
    var classes = P.bsClassSet
    val isDismissable = P.onDismiss.isDefined
    classes += ("alert-dismissable" -> isDismissable)

    def renderDismissButton() = {
      <.button(^.tpe := "button", ^.className := "close",
        ^.onClick --> P.onDismiss.get(), ^.aria.hidden := true, ^.dangerouslySetInnerHtml("&times;"))
    }

    // TODO spread props
    <.div(^.classSet1M(P.addClasses, classes))(
      if (isDismissable) renderDismissButton() else EmptyTag,
      C
    )
  }
    .componentDidMount($ =>
    if ($.props.dismissAfter.isDefined && $.props.onDismiss.isDefined)
      $.backend.start($.props.dismissAfter.get, $.props.onDismiss.get)
    )
    .componentWillUnmount($ => $.backend.clearTimer())
    .build

} 
Example 47
Source File: Badge.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.components.bootstrap.Utils.ValidComponentChildren
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._

import scala.scalajs.js
import scala.scalajs.js._


object Badge extends BootstrapComponent {
  override type P = Badge
  override type S = Unit
  override type B = Unit
  override type N = TopNode

  def defaultProps = Badge()

  case class Badge(pullRight: UndefOr[Boolean] = undefined, addClasses: String = "") {
    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  override val component = ReactComponentB[Badge]("Badge")
    .render { (P, C) =>

    def hasContent = {
      var res = ValidComponentChildren.hasValidComponents(C)
      if (!res) {
        C.forEach { c =>
          if (js.typeOf(c) == "string" || js.typeOf(c) == "number")
            res = true
        }
      }
      res
    }

    // FIXME spread props
    <.span(^.className := P.addClasses,
      ^.classSet("pull-right" -> P.pullRight.getOrElse(false), "badge" -> hasContent))(C)

  }.build

} 
Example 48
Source File: ModalTrigger.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.components.bootstrap.Utils._
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}


object ModalTrigger {

  class Container extends OverlayContainer {
    override def getDOMNode = super.getDOMNode
  }

  case class ModalTrigger(modal: ReactElement, container: OverlayContainer = new OverlayContainer {}) extends OverlayProps {

    def apply(child: ReactNode) = component(this, child)

    def apply() = component(this)
  }

  case class State(isOverlayShown: Boolean = false)

  class Backend(val scope: BackendScope[ModalTrigger, State]) extends OverlayMixin[ModalTrigger, State] {

    def show() = scope.modState(_.copy(isOverlayShown = true))

    def hide() = scope.modState(_.copy(isOverlayShown = false))

    def toggle() = {
      scope.modState(s => s.copy(isOverlayShown = !s.isOverlayShown))
    }

    override def renderOverlay(): Option[ReactElement] = {
      if (scope.state.isOverlayShown)
        Some(cloneWithProps(scope.props.modal, (undefined, undefined),
          Map("container" -> scope.props.container,
            "onRequestHide" -> (() => hide()))))
      else
        Some(<.span())
    }
  }

  val component = ReactComponentB[ModalTrigger]("ModelTrigger")
    .initialState(State())
    .backend(new Backend(_))
    .render((P, C, S, B) => {

    val child = React.Children.only(C)
    val childProps = getChildProps[Any](child).asInstanceOf[js.Dynamic]
    val childOnClick: UndefOr[js.Any] = childProps.onClick
    val jsChildOnClick: UndefOr[(ReactEvent) => (js.Any)] = if (childOnClick == null || childOnClick == undefined) undefined else childOnClick.asInstanceOf[(ReactEvent) => (js.Any)]
    val toggle = ((e: ReactEvent) => B.toggle()).asInstanceOf[(ReactEvent) => (js.Any)]
    val onClick = createChainedFunction1(jsChildOnClick, toggle)

    cloneWithProps(child, (undefined, undefined), Map("onClick" -> onClick))
  })
    .componentDidMount(scope => scope.backend.onComponentDidMount())
    .componentDidUpdate((scope, nextProps, state) => scope.backend.onComponentDidUpdate())
    .componentWillUnmount(scope => scope.backend.onComponentWillUnmount())
    .build

  def apply(props: ModalTrigger, child: ReactNode) = component(props, child)
} 
Example 49
Source File: TabPane.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.utils.{TransitionEvent, Mappable, Mergeable}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._
import org.scalajs.dom.Event

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}
import Utils._


object TabPane extends BootstrapComponent {
  override type P = TabPane
  override type S = State
  override type B = Backend
  override type N = TopNode

  override def defaultProps = TabPane()

  case class TabPane(active: Boolean = false,
                   animation: Boolean = true,
                   tab: UndefOr[String] = undefined,
                   eventKey: UndefOr[String] = undefined,
                   onAnimateOutEnd: UndefOr[() => Unit] = undefined,
                   bsStyle: UndefOr[Styles.Value] = Styles.default,
                   addClasses: String = "") extends MergeableProps[TabPane] {

    def merge(t: Map[String, Any]): TabPane = implicitly[Mergeable[TabPane]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[TabPane]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)

  }

  case class State(animateIn: Boolean, animateOut: Boolean)

  class Backend(scope: BackendScope[TabPane, State]) {

    def onComponentWillReceiveProps(nextProps: TabPane) = {
      if (scope.props.animation) {
        if (!scope.state.animateIn && nextProps.active && !scope.props.active)
          scope.modState(_.copy(animateIn = true))
        else if (!scope.state.animateIn && !nextProps.active && scope.props.active)
          scope.modState(_.copy(animateOut = true))
      }
    }

    def onComponentDidUpdate() = {
      if (scope.state.animateIn)
        js.timers.setTimeout(0)(startAnimateIn())
      if (scope.state.animateOut)
        TransitionEvent.addEndEventListener(
          scope.getDOMNode(), (_: Event) => stopAnimateOut()
        )
    }

    def startAnimateIn() = {
      if (scope.isMounted())
        scope.modState(_.copy(animateIn = false))
    }

    def stopAnimateOut() = {
      if (scope.isMounted())
        scope.modState(_.copy(animateOut = false))

      if (scope.props.onAnimateOutEnd.isDefined)
        scope.props.onAnimateOutEnd.get()
    }
  }

  override val component = ReactComponentB[TabPane]("TabPane")
    .initialState(State(animateIn = false, animateOut = false))
    .backend(new Backend(_))
    .render((P, C, S, B) => {
    val classes = Map(
      "active" -> (P.active || S.animateOut),
      "in" -> (P.active && !S.animateIn)
    )
    // FIXME spread props
    <.div(^.classSet1M("tab-pane fade", classes), C)
  })
    .componentWillReceiveProps((scope, nextProps) => {
    scope.backend.onComponentWillReceiveProps(nextProps)
  })
    .componentDidUpdate((scope, prevProps, prevState) => scope.backend.onComponentDidUpdate())
    .build

} 
Example 50
Source File: DropdownMenu.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react.Addons.ReactCloneWithProps

import scala.scalajs.js


                    addClasses: String = "") extends MergeableProps[DropdownMenu] {

    def merge(t: Map[String, Any]): DropdownMenu = implicitly[Mergeable[DropdownMenu]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[DropdownMenu]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  override val component = ReactComponentB[DropdownMenu]("DropdownMenu")
    .render((P, C) => {

    def renderMenuItem(child: ReactNode, index: Int) = {
      val keyAndRef = getChildKeyAndRef(child, index)
      if (P.onSelect.isDefined)
        ReactCloneWithProps(child, keyAndRef ++
          Map[String, js.Any](
            "onSelect" -> P.onSelect.get) // FIXME createChainedFunction0(childProps.onSelect, handleOptionSelect)
        )
      else
        ReactCloneWithProps(child, keyAndRef)
    }

    <.ul(^.classSet1("dropdown-menu", "dropdown-menu-right" -> P.pullRight.getOrElse(false)),
      ^.role := "menu", ^.aria.labelledby := P.ariaLabelledBy)(
        ValidComponentChildren.map(C, renderMenuItem)
      )
  })
    .build

} 
Example 51
Source File: SubNav.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.components.bootstrap.Utils._
import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react.Addons.ReactCloneWithProps
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}




object SubNav extends BootstrapComponent {
  override type P = SubNav
  override type S = Unit
  override type B = Unit
  override type N = TopNode

  override def defaultProps = SubNav()

  case class SubNav(active: Boolean = true,
                   disabled: Boolean = false,
                   href: UndefOr[String] = undefined,
                   target: UndefOr[String] = undefined,
                   title: UndefOr[String] = undefined,
                   text: UndefOr[String] = undefined,
                   eventKey: UndefOr[String] = undefined,
                   onSelect: UndefOr[(String) => Unit] = undefined,
                   bsClass: UndefOr[Classes.Value] = Classes.nav,
                   bsStyle: UndefOr[Styles.Value] = undefined,
                   bsSize: UndefOr[Sizes.Value] = undefined,
                   addClasses: String = "") extends BsProps with MergeableProps[SubNav] {

    def merge(t: Map[String, Any]): SubNav = implicitly[Mergeable[SubNav]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[SubNav]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  // TODO
  def getChildActiveProp(child: ReactNode): Boolean = true

  override val component = ReactComponentB[SubNav]("SubNav")
    .render((P, C) => {

    val handleClick = (e: ReactEvent) => {
      if (P.onSelect.isDefined) {
        e.preventDefault()
        if (!P.disabled)
          P.onSelect.get(P.eventKey.getOrElse("")) // FIXME , P.href, P.target)
      }

    }

    def renderNavItem(child: ReactNode, idx: Int): ReactNode = {
      val keyAndRef = getChildKeyAndRef(child, idx)
      ReactCloneWithProps(child, keyAndRef ++ Map[String, js.Any](
        "active" -> getChildActiveProp(child),
        "onSelect" -> P.onSelect.getOrElse(null) // FIXME create chain function
      )
      )
    }

    val classes = Map("active" -> P.active, "disabled" -> P.disabled)
    val anchorRef = Ref("anchor")
    <.li(^.classSet1M(P.addClasses, classes),
      <.a(^.href := P.href, ^.title := P.title, ^.target := P.target,
        ^.onClick ==> handleClick, ^.ref := anchorRef, P.text),
      <.ul(^.className := "nav",
        ValidComponentChildren.map(C, renderNavItem)
      )
    )
  }
    ).build

} 
Example 52
Source File: FadeMixin.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import japgolly.scalajs.react.{BackendScope, TopNode}
import org.scalajs.dom.raw.HTMLElement
import org.scalajs.dom.{document, raw}

import scala.scalajs.js


trait FadeMixin[P <: OverlayProps, S] {

  def scope: BackendScope[P, S]

  var fadeOutEl: Option[raw.Element] = None

  def getElementAndSelf(root: TopNode, classes: Array[String]): Array[TopNode] = {
    val elements = root.querySelectorAll("." + classes.mkString("."))

    val els = (for (i <- 0 until elements.length) yield elements(i).asInstanceOf[TopNode]).toArray

    var matched = true
    for (i <- 0 until classes.length if matched) {
      val Pattern = "\\b${classes(i)}\\b".r
      root.className match {
        case Pattern() =>
        case _ =>
          matched = false
      }
    }
    if (matched)
      root +: els
    else
      els
  }

  def _fadeIn() = {
    if (scope.isMounted()) {
      val elements = getElementAndSelf(scope.getDOMNode(), Array("fade"))
      elements.foreach { el =>
        val classes = el.className.split(" ").filter(_ != "in") ++ Seq("in")
        el.className = classes.mkString(" ")
      }
    }
  }

  def _fadeOut() = {
    val elements = getElementAndSelf(scope.getDOMNode(), Array("fade", "in"))
    elements.foreach { el =>
      el.className = el.className.replace("\\bin\\b", "")
    }
    js.timers.setTimeout(300)(handleFadeOutEnd())
  }

  def handleFadeOutEnd(): Unit = {
    fadeOutEl.map { fadeout =>
      if (fadeout.parentNode != null)
        fadeout.parentNode.removeChild(fadeout)
    }
  }

  def onComponentDidMount() = {
    // FIXME what does this mean? -- if(document.querySelectorAll)
    //val nodes = document.querySelectorAll("")
    if (true) {
      // Firefox needs delay for transition to be triggered
      js.timers.setTimeout(20)(_fadeIn())
    }
  }

  def onComponentWillUnmount(): Unit = {
    val elements = getElementAndSelf(scope.getDOMNode(), Array("fade"))
    // TODO container
    val container = scope.props.container.getDOMNode
    if (elements.length > 0) {
      val fadeOut = document.createElement("div")
      container.appendChild(fadeOut)
      fadeOut.appendChild(scope.getDOMNode().cloneNode(deep = true))
      fadeOutEl = Some(fadeOut)
      js.timers.setTimeout(20)(_fadeOut())
    }
  }
} 
Example 53
Source File: PageItem.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}


object PageItem extends BootstrapComponent {
  override type P = PageItem
  override type S = Unit
  override type B = Unit
  override type N = TopNode

  override def defaultProps = PageItem()

  case class PageItem(href: UndefOr[String] = "#",
                   title: UndefOr[String] = undefined,
                   target: UndefOr[String] = undefined,
                   disabled: UndefOr[Boolean] = undefined,
                   previous: UndefOr[Boolean] = undefined,
                   next: UndefOr[Boolean] = undefined,
                   eventKey: UndefOr[js.Any] = undefined,
                   onSelect: UndefOr[(js.Any, String, String) => Unit] = undefined, addClasses: String = "")
    extends MergeableProps[PageItem] {

    def merge(t: Map[String, Any]): PageItem = implicitly[Mergeable[PageItem]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[PageItem]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  override val component = ReactComponentB[PageItem]("PageItem")
    .render { (P, C) =>

    def handleSelect(e: ReactEvent) = {
      if (P.onSelect.isDefined) {
        e.preventDefault()

        if (!P.disabled.getOrElse(false)) {
          P.onSelect.get(P.eventKey.get, P.href.get, P.target.get)
        }
      }
    }

    val classes = Map(
      "disabled" -> P.disabled.getOrElse(false),
      "previous" -> P.previous.getOrElse(false),
      "next" -> P.next.getOrElse(false)
    )

    <.li(^.classSet1M(P.addClasses, classes),
      <.a(^.href := P.href, ^.title := P.title, ^.target := P.target, ^.onClick ==> handleSelect,
      C)
    )
  }.build
} 
Example 54
Source File: CarouselItem.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.utils.{Mappable, Mergeable, TransitionEvent}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._
import org.scalajs.dom.raw.Event

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}


object CarouselItem extends BootstrapComponent {
  override type P = CarouselItem
  override type S = State
  override type B = Backend
  override type N = TopNode

  override def defaultProps = CarouselItem()

  case class CarouselItem(index: Int = 0,
                   active: UndefOr[Boolean] = undefined,
                   animation: UndefOr[Boolean] = true,
                   animateIn: UndefOr[Boolean] = false,
                   animateOut: UndefOr[Boolean] = false,
                   direction: UndefOr[Directions.Value] = Directions.next,
                   onAnimateOutEnd: UndefOr[(Int) => Unit] = undefined,
                   caption: UndefOr[String] = undefined,
                   addClasses: String = "") extends MergeableProps[CarouselItem] {

    def merge(t: Map[String, Any]): CarouselItem = implicitly[Mergeable[CarouselItem]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[CarouselItem]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  case class State(direction: UndefOr[Directions.Value] = undefined)

  class Backend($: BackendScope[CarouselItem, State]) {

    def startAnimation() = {
      if ($.isMounted())
        $.modState(s => s.copy(direction = if ($.props.direction.getOrElse(Directions.next) == Directions.prev) Directions.right else Directions.left))
    }

    def onAnimateOutEnd(e: Any) = {
      if ($.isMounted() && $.props.onAnimateOutEnd.isDefined)
        $.props.onAnimateOutEnd.get($.props.index)
    }
  }

  val component = ReactComponentB[CarouselItem]("CarouselItem")
    .initialState(State())
    .backend(new Backend(_))
    .render((P, C, S, B) => {

    def renderCaption() = {
      if (P.caption.isDefined) {
        <.div(^.className := "carousel-caption")(P.caption.get)
      }
      else
        EmptyTag
    }

    var classes = Map("item" -> true,
      "active" -> (P.active.getOrElse(false) && !P.animateIn.getOrElse(false) || P.animateOut.getOrElse(false)),
      "next" -> (P.active.getOrElse(false) && P.animateIn.getOrElse(false) && P.direction.getOrElse(Directions.next) == Directions.next),
      "prev" -> (P.active.getOrElse(false) && P.animateIn.getOrElse(false) && P.direction.getOrElse(Directions.next) == Directions.prev)
    )

    if (S.direction.isDefined && (P.animateIn.getOrElse(false) || P.animateOut.getOrElse(false)))
      classes += (S.direction.get.toString -> true)

    // TODO spread props
    <.div(^.classSet1M(P.addClasses, classes))(C, renderCaption())
  })
    .componentWillReceiveProps(($, newProps) =>
    if ($.props.active.getOrElse(false) != newProps.active.getOrElse(false))
      $.modState(_.copy(direction = undefined))
    )
    .componentDidUpdate(($, previousProps, S) => {
    if (!$.props.active.getOrElse(false) && previousProps.active.getOrElse(false)) {
      TransitionEvent.addEndEventListener($.getDOMNode(), (e: Event) => $.backend.onAnimateOutEnd(e))
    }

    if ($.props.active.getOrElse(false) != previousProps.active.getOrElse(false)) {
      js.timers.setTimeout(20)($.backend.startAnimation())
    }
  })
    .build
} 
Example 55
Source File: DropdownButton.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.components.bootstrap.Utils._
import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react.Addons.ReactCloneWithProps
import japgolly.scalajs.react.Ref

import scala.scalajs.js


                    bsClass: UndefOr[Classes.Value] = Classes.btn,
                    bsStyle: UndefOr[Styles.Value] = Styles.default,
                    bsSize: UndefOr[Sizes.Value] = undefined,
                    addClasses: String = "")
    extends BsProps with MergeableProps[DropdownButton] {

    def merge(t: Map[String, Any]): DropdownButton = implicitly[Mergeable[DropdownButton]].merge(this, t)

    def asMap: Map[String, Any] = implicitly[Mappable[DropdownButton]].toMap(this)

    def apply(children: ReactNode*) = component(this, children)

    def apply() = component(this)
  }

  class Backend(val scope: BackendScope[DropdownButton, DropdownState]) extends DropdownStateMixin[DropdownButton] {

    def handleOptionSelect(key: String): Unit = {
      if (scope.props.onSelect.isDefined)
        scope.props.onSelect.get(key)
    }

    def handleDropdownClick(e: ReactEvent) = {
      e.preventDefault()
      setDropdownState(!scope.state.open)
    }
  }

  override val component = ReactComponentB[DropdownButton]("DropdownButton")
    .initialState(DropdownState(open = false))
    .backend(new Backend(_))
    .render((P, C, S, B) => {
    def renderButtonGroup(children: ReactNode*) = {
      var addClasses = "dropdown"
      if (S.open)
        addClasses += " open"
      ButtonGroup(ButtonGroup.ButtonGroup(addClasses = addClasses), children)
    }
    def renderNavItem(children: ReactNode*) = {
      <.li(^.classSet1("dropdown", "open" -> S.open, "dropup" -> P.dropup.getOrElse(false)))(children)
    }

    def renderMenuItem(child: ReactNode, index: Int) = {
      // Only handle the option selection if an onSelect prop has been set on the
      // component or it's child, this allows a user not to pass an onSelect
      // handler and have the browser preform the default action.
      val handleOptionSelect: js.Any = if (P.onSelect.isDefined) // FIXME || child.props.onSelect)
        B.handleOptionSelect _
      else () => ()

      val keyAndRef = getChildKeyAndRef(child, index)
      ReactCloneWithProps(child, keyAndRef ++
        Map[String, js.Any](
          "onSelect" -> handleOptionSelect) // FIXME createChainedFunction0(childProps.onSelect, handleOptionSelect)
      )
    }

    val buttonRef = Ref("dropdownButton")
    val buttonProps = Button.Button(
      addClasses = "dropdown-toggle",
      onClick = (e: ReactEvent) => B.handleDropdownClick(e),
      navDropdown = P.navItem.getOrElse(false),
      bsStyle = P.bsStyle,
      bsSize = P.bsSize,
      bsClass = P.bsClass
    )

    val menuRef = Ref("menu")
    val dropdownMenu = DropdownMenu.withKey(1).withRef("menu")(DropdownMenu.DropdownMenu(ariaLabelledBy = P.id,
      pullRight = P.pullRight),
      ValidComponentChildren.map(C, renderMenuItem)
    )

    val button = if (P.noCaret.getOrElse(false))
      Button.withKey(0).withRef("dropdownButton")(buttonProps, P.title.get)
    else
      Button.withKey(0).withRef("dropdownButton")(buttonProps, P.title.get, " ", <.span(^.className := "caret"))

    if (P.navItem.getOrElse(false))
      renderNavItem(button, dropdownMenu)
    else
      renderButtonGroup(button, dropdownMenu)
  })
    .componentWillUnmount(_.backend.onComponentWillUnmount())
    .build

} 
Example 56
Source File: Nav.scala    From scalajs-react-bootstrap   with MIT License 5 votes vote down vote up
package com.acework.js.components.bootstrap

import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._
import org.scalajs.dom.raw.{HTMLDocument, HTMLUListElement}

import scala.scalajs.js
import scala.scalajs.js.{UndefOr, undefined}
import com.acework.js.components.bootstrap.Utils._




      <.ul(^.classSet1M(P.addClasses, classes), ^.ref := ulRef,
        ValidComponentChildren.map(C, renderNavItem)
      )
    }

    var classes = if (P.collapsable.getOrElse(false)) B.getCollapsableClassSet("") else Map[String, Boolean]()
    classes += ("navbar-collapse" -> P.collapsable.getOrElse(false))

    if (P.navbar && !P.collapsable.getOrElse(false))
      renderUI()
    else {
      val ui = renderUI()
      <.nav(^.classSetM(classes), ^.role := P.role, ui)
    }
  }
    ).build

} 
Example 57
Source File: SeedVariable.scala    From random-data-generator   with Apache License 2.0 5 votes vote down vote up
package com.danielasfregola.randomdatagenerator.utils

import scala.util.Try
import scala.scalajs.js

protected[utils] object SeedVariable {

  lazy val name = "RANDOM_DATA_GENERATOR_SEED"

  lazy val value = Try {
    val fromEnv = js.Dynamic.global.process.env.selectDynamic(name)
    if (js.isUndefined(fromEnv)) {
      throw new Exception("Seed not defined by user")
    } else {
      fromEnv.toString
    }
  }.toOption

} 
Example 58
Source File: Main.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalajs.dom.console
import typings.p5.mod.{p5InstanceExtensions, ^ => P5}

import scala.scalajs.js

object Main {
  def main(argv: Array[String]): Unit = {
    val sketch = P5Facade { p =>
      val x = 100
      val y = 100

      p.setup = () => p.createCanvas(700, 410)

      p.draw = () => {
        p.background(0)
        p.fill(255)
        p.rect(x, y, 50, 50)
      }
    }
    console.warn(sketch.windowHeight)
  }
}

object P5Facade {

  
  @js.native
  trait P5Config extends js.Object {
    var draw:    js.Function0[Unit] = js.native
    var preload: js.Function0[Unit] = js.native
    var remove:  js.Function0[Unit] = js.native
    var setup:   js.Function0[Unit] = js.native
  }
} 
Example 59
Source File: Demo.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalajs.dom
import typings.highlightJs.mod.initHighlightingOnLoad
import typings.reveal.{RevealOptions, RevealStatic}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

object Demo {
  def main(args: Array[String]): Unit = {
    // Touch to load
    Includes.HighlightingCss
    Includes.WhiteThemeCss
    Includes.RevealCss
    Includes.Reveal
    Includes.ZoomJs

    
  @JSImport("reveal.js/js/reveal.js", JSImport.Namespace)
  @js.native
  object Reveal extends RevealStatic

  @JSImport("reveal.js/plugin/zoom-js/zoom.js", JSImport.Namespace)
  @js.native
  object ZoomJs extends RevealStatic

  @JSImport("reveal.js/lib/css/zenburn.css", JSImport.Namespace)
  @js.native
  object HighlightingCss extends js.Object

  @JSImport("reveal.js/css/theme/white.css", JSImport.Namespace)
  @js.native
  object WhiteThemeCss extends js.Object

  @JSImport("reveal.js/css/reveal.css", JSImport.Namespace)
  @js.native
  object RevealCss extends js.Object
} 
Example 60
Source File: Main.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalajs.dom.{document, html}
import typings.leaflet.{mod => L}

import scala.scalajs.js

object Main {
  val TileLayerUri =
    "https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiZmFuY2VsbHUiLCJhIjoiY2oxMHRzZm5zMDAyMDMycndyaTZyYnp6NSJ9.AJ3owakJtFAJaaRuYB7Ukw"

  def main(argv: Array[String]): Unit = {
    val el  = document.getElementById("content").asInstanceOf[html.Element]
    val map = L.map(el).setView(L.LatLngLiteral(51.505, -0.09), zoom = 13)

    L.tileLayer(
        TileLayerUri,
        L.TileLayerOptions()
          .setId("mapbox.streets")
          .setMaxZoom(19)
          .setAttribution(
            """Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors,
                        |<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>,
                        |Imagery © <a href="http://mapbox.com">Mapbox</a>""".stripMargin
          )
      )
      .addTo(map)

    L.marker(L.LatLngLiteral(51.5, -0.09), L.MarkerOptions().setTitle("I am a marker"))
      .bindPopup("I am a popup")
      .addTo(map)

    L.circle(
        L.LatLngLiteral(51.508, -0.11),
        L.CircleMarkerOptions().setColor("red").setFillColor("#f03").setFillOpacity(0.5).setRadius(500)
      )
      .bindPopup("I am a circle")
      .addTo(map)

    L.circle(
        L.LatLngLiteral(51.516, -0.11),
        L.CircleMarkerOptions().setColor("green").setFillColor("#f03").setFillOpacity(0.5).setRadius(200)
      )
      .addTo(map)

    L.polygon(js.Array(L.LatLngLiteral(51.509, -0.08), L.LatLngLiteral(51.503, -0.06), L.LatLngLiteral(51.51, -0.047)))
      .bindPopup("I am a polygon")
      .addTo(map)

    L.popup()
      .setLatLng(L.LatLngLiteral(51.5, -0.09))
      .setContent("I am a <b>standalone</b> popup.")
      .openOn(map)
  }
} 
Example 61
Source File: NodeExpress.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import typings.express.{mod => expressMod}
import typings.expressServeStaticCore.mod._
import typings.node.global.console
import typings.node.processMod

import scala.scalajs.js

object WelcomeController {

  val Router: Router =
    expressMod.Router()

  val Index: RequestHandler[Unit, String, Unit] =
    (_, res, _) => res.send("Hello, World!")

  trait HasName extends js.Object {
    val name: js.UndefOr[String]
  }

  val Name: RequestHandler[HasName, String, Unit] = (req, res, next) =>
    res.send(s"Hello, ${req.params.name.getOrElse("No Name")}!")

  Router
    .get[Unit, String, Unit]("/", Index)
    .get[HasName, String, Unit]("/:name", Name)
}

object NodeExpress {
  def main(args: Array[String]): Unit = {
    val app  = expressMod.^()
    val port = processMod.^.env.get("PORT").flatMap(_.toOption).fold(3000)(_.toInt)
    app.use[ParamsDictionary, js.Any, js.Any]("/welcome", WelcomeController.Router)

    app.listen(port, () => console.log(s"Listening at http://localhost:$port/"))
  }
} 
Example 62
Source File: Demo.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalablytyped.runtime.{StringDictionary, TopLevel}
import typings.phaser.Phaser.Types.Animations.{Animation, GenerateFrameNames}
import typings.phaser.Phaser.Types.Core.GameConfig
import typings.phaser.Phaser.Types.GameObjects.GameObjectConfig
import typings.phaser.Phaser.Types.GameObjects.Sprite.SpriteConfig
import typings.phaser.Phaser.Types.Scenes.CreateSceneFromObjectConfig
import typings.phaser.phaserMod.{Game, Scene}
import typings.phaser.{phaserMod => Phaser}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.util.Random

object Demo {
  @JSImport("./gems.png", JSImport.Namespace)
  @js.native
  object GemsPng extends TopLevel[String]

   js.ThisFunction1[Scene, js.Object, Unit] = null,
      preload:       js.ThisFunction0[Scene, Unit]                       = null,
      update:        js.ThisFunction0[Scene, Unit]                       = null
  ): CreateSceneFromObjectConfig = {
    val __obj = js.Dynamic.literal()
    if (create != null) __obj.updateDynamic("create")(create)
    if (extend != null) __obj.updateDynamic("extend")(extend.asInstanceOf[js.Any])
    if (extendDotdata != null) __obj.updateDynamic("extend.data")(extendDotdata.asInstanceOf[js.Any])
    if (init != null) __obj.updateDynamic("init")(init)
    if (preload != null) __obj.updateDynamic("preload")(preload)
    if (update != null) __obj.updateDynamic("update")(update.asInstanceOf[js.Any])
    __obj.asInstanceOf[CreateSceneFromObjectConfig]
  }
} 
Example 63
Source File: DisplacementMapFlag.scala    From Demos   with MIT License 5 votes vote down vote up
package demo.filtersbasic

import demo.assets.pixiFilters.{DisplacementMapRepeat, FlagImage}
import demo.pixi.PIXIExample
import typings.pixiJs.mod.{filters, Application, Container, Sprite, WRAP_MODES}
import demo.monkeypatching.PIXIPatching._

import scala.scalajs.js

case object DisplacementMapFlag extends PIXIExample {
  val name: String = "Displacement Map - Flag"
  val pixiUrl: String =
    "https://pixijs.io/examples/#/filters-basic/displacement-map-flag.js"

  protected def newApplication(): Application = {

    val app = new Application()

    app.stage.interactive = true

    val container = new Container
    app.stage.addChild(container)

    val flag = Sprite.from(FlagImage)
    container.addChild(flag)
    flag.x = 100
    flag.y = 100

    val displacementSprite = Sprite.from(DisplacementMapRepeat)
    // Make sure the sprite is wrapping.
    displacementSprite.texture.baseTexture.wrapMode = WRAP_MODES.REPEAT
    val displacementFilter =
      new filters.DisplacementFilter(displacementSprite)
    displacementFilter.padding = 10

    displacementSprite.position = flag.position

    app.stage.addChild(displacementSprite)

    flag.filters = js.Array(displacementFilter)

    displacementFilter.scale.x = 30
    displacementFilter.scale.y = 60

    app.ticker.add(() => {
      // Offset the sprite position to make vFilterCoord update to larger value. Repeat wrapping makes sure there's still pixels on the coordinates.
      displacementSprite.x += 1
      // Reset x to 0 when it's over width to keep values from going to very huge numbers.
      if (displacementSprite.x > displacementSprite.width) {
        displacementSprite.x = 0
      }
    })

    app
  }
} 
Example 64
Source File: Outline.scala    From Demos   with MIT License 5 votes vote down vote up
package demo.pluginfilters

import demo.assets.BunnyImage
import demo.pixi.PIXIExample
import typings.pixiFilterGlow.mod.{GlowFilter, GlowFilterOptions}
import typings.pixiFilterOutline.mod.OutlineFilter
import typings.pixiJs.mod.{Application, Sprite, Texture}

import scala.scalajs.js

case object Outline extends PIXIExample {
  val name:    String = "Outline"
  val pixiUrl: String = "https://pixijs.io/examples/#/plugin-filters/outline.js"

  protected def newApplication(): Application = {
    val app = new Application()

    app.stage.position.set(400, 300)

    val outlineFilterBlue = new OutlineFilter(2, 0x99ff99)
    val outlineFilterRed = new GlowFilter(
      GlowFilterOptions()
        .setOuterStrength(15)
        .setDistance(2)
        .setInnerStrength(1)
        .setColor(0xff9999)
        .setQuality(0.5)
    )

    def filterOn(sprite: Sprite): Unit =
      sprite.filters = js.Array(outlineFilterRed)

    def filterOff(sprite: Sprite): Unit =
      sprite.filters = js.Array(outlineFilterBlue)

    val texture = Texture.from(BunnyImage)

    for (_ <- 0 until 20) {
      val bunny = new Sprite(texture)
      bunny.interactive = true
      bunny.position.set((Math.random() * 2 - 1) * 300, (Math.random() * 2 - 1) * 200)
      bunny.scale.x = (Math.random() * 3) + 1
      bunny
        .on("pointerover", () => filterOn(bunny))
        .on("pointerout", () => filterOff(bunny))
      filterOff(bunny)
      app.stage.addChild(bunny)
    }

    app
  }
} 
Example 65
Source File: assets.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalablytyped.runtime.TopLevel

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport

object assets {
  object pixiFilters {
    @js.native
    @JSImport("./assets/pixi-filters/displacement_map_repeat.jpg", JSImport.Namespace)
    object DisplacementMapRepeat extends TopLevel[String]

    @js.native
    @JSImport("./assets/pixi-filters/flag.png", JSImport.Namespace)
    object FlagImage extends TopLevel[String]
  }

  @js.native
  @JSImport("./assets/bg_grass.jpg", JSImport.Namespace)
  object BackgroundGrass extends TopLevel[String]

  @js.native
  @JSImport("./assets/bg_scene_rotate.jpg", JSImport.Namespace)
  object BackgroundSceneRotate extends TopLevel[String]

  @js.native
  @JSImport("./assets/bunny.png", JSImport.Namespace)
  object BunnyImage extends TopLevel[String]

  @js.native
  @JSImport("./assets/eggHead.png", JSImport.Namespace)
  object EggHeadImage extends TopLevel[String]

  @js.native
  @JSImport("./assets/p2.jpeg", JSImport.Namespace)
  object P2Image extends TopLevel[String]

  @js.native
  @JSImport("./assets/star.png", JSImport.Namespace)
  object StarImage extends TopLevel[String]

  @js.native
  @JSImport("./assets/video.mp4", JSImport.Namespace)
  object TheVideo extends TopLevel[String]

  @js.native
  @JSImport("./assets/trail.png", JSImport.Namespace)
  object TrailImage extends TopLevel[String]
} 
Example 66
Source File: AppComponent.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import typings.angularCore.mod.{Component, ComponentCls, OnInit}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportStatic


  @JSExportStatic
  val annotations = js.Array(
    new ComponentCls(
      new Component {
        selector = "app-root"
        template = """
            |<h1>{{ title }}</h1>
            |<nav>
            |    <a routerLink="/dashboard">Dashboard</a>
            |    <a routerLink="/heroes">Heroes</a>
            |</nav>
            |<router-outlet></router-outlet>
            |
            |<app-messages></app-messages>
            |
        """.stripMargin

        styles = js.Array("""
            |h1 {
            |  font-size: 1.2em;
            |  color: #999;
            |  margin-bottom: 0;
            |}
            |h2 {
            |  font-size: 2em;
            |  margin-top: 0;
            |  padding-top: 0;
            |}
            |nav a {
            |  padding: 5px 10px;
            |  text-decoration: none;
            |  margin-top: 10px;
            |  display: inline-block;
            |  background-color: #eee;
            |  border-radius: 4px;
            |}
            |nav a:visited, a:link {
            |  color: #607d8b;
            |}
            |nav a:hover {
            |  color: #039be5;
            |  background-color: #cfd8dc;
            |}
            |nav a.active {
            |  color: #039be5;
            |}
        """.stripMargin)
      }
    )
  )
} 
Example 67
Source File: AppModule.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import demo.heroeditor._
import typings.angularCore.mod.{NgModule, NgModuleCls}
import typings.angularForms.mod.FormsModule
import typings.angularPlatformBrowser.mod.BrowserModule

import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportStatic


final class AppModule extends js.Object

object AppModule {

  @JSExportStatic
  val annotations = js.Array(
    new NgModuleCls(
      new NgModule {
        imports = js.defined(js.Array(typeOf[BrowserModule], typeOf[FormsModule], typeOf[AppRoutingModule]))
        declarations = js.defined(
          js.Array(
            typeOf[AppComponent],
            typeOf[HeroesComponent],
            typeOf[HeroDetailComponent],
            typeOf[MessagesComponent],
            typeOf[DashboardComponent]
          )
        )
        bootstrap = js.defined(js.Array(typeOf[AppComponent]))
        providers = js.defined(js.Array(typeOf.any[HeroService], typeOf.any[MessageService]))
        exports   = js.defined(js.Array())
      }
    )
  )
} 
Example 68
Source File: AppRoutingModule.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import typings.angularCore.mod.{NgModule, NgModuleCls}
import typings.angularRouter.mod.{Route, RouterModule, Routes}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportStatic

final class AppRoutingModule extends js.Object

object AppRoutingModule {

  @JSExportStatic
  val annotations =
    js.Array(
      new NgModuleCls(
        new NgModule {
          imports = js.defined(js.Array(unspecify(RouterModule.forRoot(routes))))
          exports = js.defined(js.Array(typeOf[RouterModule]))
        }
      )
    )

  def routes: Routes = js.Array(
    Route(
      path      = "heroes",
      component = typeOf[heroeditor.HeroesComponent]
    ),
    Route(
      path      = "dashboard",
      component = typeOf[heroeditor.DashboardComponent]
    ),
    Route(
      path       = "",
      redirectTo = "/dashboard",
      pathMatch  = "full"
    ),
    Route(
      path      = "detail/:id",
      component = typeOf[heroeditor.HeroDetailComponent]
    )
  )
} 
Example 69
Source File: HeroesComponent.scala    From Demos   with MIT License 5 votes vote down vote up
package demo
package heroeditor

import typings.angularCore.mod.{Component, ComponentCls, OnInit}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportStatic

final class HeroesComponent(heroService: HeroService) extends OnInit {

  var heroes: js.Array[Hero] = _

  def getHeroes(): Unit = {
    heroService.heroes.subscribe(hs => heroes = hs)
    heroes = MockHeroes.heroes
  }

  override def ngOnInit(): Unit = {
    println("Heroes Component")

    getHeroes()
  }
}

object HeroesComponent {
  @JSExportStatic
  val annotations = js.Array(
    new ComponentCls(
      new Component {
        selector = "app-heroes"
        template = """
            |
            |<h2>My Heroes</h2>
            |
            |<ul class="heroes">
            |    <li *ngFor="let hero of heroes">
            |        <a routerLink="/detail/{{hero.id}}">
            |            <span class="badge">{{hero.id}}</span> {{hero.name}}
            |        </a>
            |    </li>
            |</ul>
        """.stripMargin
        styles   = js.Array("""
            |
            |.selected {
            |  background-color: #CFD8DC !important;
            |  color: white;
            |}
            |.heroes {
            |  margin: 0 0 2em 0;
            |  list-style-type: none;
            |  padding: 0;
            |  width: 15em;
            |}
            |.heroes li {
            |  cursor: pointer;
            |  position: relative;
            |  left: 0;
            |  background-color: #EEE;
            |  margin: .5em;
            |  padding: .3em 0;
            |  height: 1.6em;
            |  border-radius: 4px;
            |}
            |.heroes li.selected:hover {
            |  background-color: #BBD8DC !important;
            |  color: white;
            |}
            |.heroes li:hover {
            |  color: #607D8B;
            |  background-color: #DDD;
            |  left: .1em;
            |}
            |.heroes .text {
            |  position: relative;
            |  top: -3px;
            |}
            |.heroes .badge {
            |  display: inline-block;
            |  font-size: small;
            |  color: white;
            |  padding: 0.8em 0.7em 0 0.7em;
            |  background-color: #607D8B;
            |  line-height: 1em;
            |  position: relative;
            |  left: -1px;
            |  top: -4px;
            |  height: 1.8em;
            |  min-width: 16px;
            |  text-align: right;
            |  margin-right: .8em;
            |  border-radius: 4px 0 0 4px;
            |}
        """.stripMargin)
      }
    )
  )

  @JSExportStatic
  val parameters = js.Array(typeOf[HeroService])
} 
Example 70
Source File: MessagesComponent.scala    From Demos   with MIT License 5 votes vote down vote up
package demo
package heroeditor

import typings.angularCore.mod.{Component, ComponentCls, OnInit}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportStatic

final class MessagesComponent(val messageService: MessageService) extends OnInit {
  override def ngOnInit(): Unit = ()
}

object MessagesComponent {
  @JSExportStatic
  val annotations =
    js.Array(
      new ComponentCls(
        new Component {
          selector = "app-messages"
          template = """
              |<div *ngIf="messageService.messages.length">
              |
              |    <h2>Messages</h2>
              |    <button class="clear"
              |            (click)="messageService.clear()">clear</button>
              |    <div *ngFor='let message of messageService.messages'> {{message}} </div>
              |
              |</div>
          """.stripMargin
          styles   = js.Array("""
              |h2 {
              |  color: red;
              |  font-family: Arial, Helvetica, sans-serif;
              |  font-weight: lighter;
              |}
              |body {
              |  margin: 2em;
              |}
              |body, input[text], button {
              |  color: crimson;
              |  font-family: Cambria, Georgia;
              |}
              |
              |button.clear {
              |  font-family: Arial;
              |  background-color: #eee;
              |  border: none;
              |  padding: 5px 10px;
              |  border-radius: 4px;
              |  cursor: pointer;
              |  cursor: hand;
              |}
              |button:hover {
              |  background-color: #cfd8dc;
              |}
              |button:disabled {
              |  background-color: #eee;
              |  color: #aaa;
              |  cursor: auto;
              |}
              |button.clear {
              |  color: #888;
              |  margin-bottom: 12px;
              |}
          """.stripMargin)
        }
      )
    )

  @JSExportStatic
  val parameters = js.Array(typeOf[MessageService])
} 
Example 71
Source File: MockHeroes.scala    From Demos   with MIT License 5 votes vote down vote up
package demo.heroeditor

import scala.scalajs.js

object MockHeroes {

  private val names = js.Array(
    "Mr. Nice",
    "Narco",
    "Bombasto",
    "Celeritas",
    "Magneta",
    "RubberMan",
    "Dynama",
    "Dr IQ",
    "Magma",
    "Tornado"
  )

  val heroes: js.Array[Hero] =
    names.zipWithIndex.map { case (n, index) => new Hero(index + 11, n) }
} 
Example 72
Source File: HeroDetailComponent.scala    From Demos   with MIT License 5 votes vote down vote up
package demo
package heroeditor

import typings.angularCommon.mod.Location
import typings.angularCore.mod.{Component, ComponentCls, OnInit, Type}
import typings.angularRouter.mod.ActivatedRoute

import scala.scalajs.js
import scala.scalajs.js.annotation.JSExportStatic

final class HeroDetailComponent(route: ActivatedRoute, heroService: HeroService, location: Location) extends OnInit {

  var hero: js.UndefOr[Hero] = js.undefined

  def getHero(): Unit =
    asOption(route.snapshot.paramMap.get("id")) match {
      case Some(id) if id.forall(_.isDigit) =>
        hero = heroService.getHero(id.toInt)
      case _ => ()
    }

  override def ngOnInit(): Unit = {
    getHero()
    println(hero)
  }

  def goBack(): Unit =
    location.back()
}

object HeroDetailComponent {
  @JSExportStatic
  val annotations = js.Array(
    new ComponentCls(
      new Component {
        selector = "app-hero-detail"
        inputs   = js.Array("hero")
        template = """
            |<div *ngIf="hero">
            |    <h2>{{hero.name | uppercase}} Details</h2>
            |    <div><span>id: </span>{{hero.id}}</div>
            |    <div>
            |        <label>name:
            |            <input [(ngModel)]="hero.name" placeholder="name"/>
            |        </label>
            |    </div>
            |    <button (click)="goBack()">go back</button>
            |</div>
        """.stripMargin
        styles   = js.Array("""
            |
            |label {
            |  display: inline-block;
            |  width: 3em;
            |  margin: .5em 0;
            |  color: #607D8B;
            |  font-weight: bold;
            |}
            |input {
            |  height: 2em;
            |  font-size: 1em;
            |  padding-left: .4em;
            |}
            |button {
            |  margin-top: 20px;
            |  font-family: Arial;
            |  background-color: #eee;
            |  border: none;
            |  padding: 5px 10px;
            |  border-radius: 4px;
            |  cursor: pointer; cursor: hand;
            |}
            |button:hover {
            |  background-color: #cfd8dc;
            |}
            |button:disabled {
            |  background-color: #eee;
            |  color: #ccc;
            |  cursor: auto;
            |}
        """.stripMargin)
      }
    )
  )

  @JSExportStatic
  val parameters: js.Array[Type[_]] = js.Array(
    typeOf[ActivatedRoute],
    typeOf[HeroService],
    typeOf[Location]
  )
} 
Example 73
Source File: HeroService.scala    From Demos   with MIT License 5 votes vote down vote up
package demo
package heroeditor

import typings.angularCore.mod.InjectableCls
import typings.rxjs.internalObservableMod.Observable
import typings.rxjs.{mod => rxjs}

import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.JSExportStatic

final class HeroService(messageService: MessageService) extends js.Object {
  def heroes: Observable[js.Array[Hero]] = {
    messageService.add("HeroService: fetched heroes")
    rxjs.of(MockHeroes.heroes)
  }

  def getHero(id: Int): js.UndefOr[Hero] = {
    messageService.add(s"HeroService: fetched hero id=$id")
    MockHeroes.heroes.find(_.id == id).orUndefined
  }
}

object HeroService {
  @JSExportStatic
  val annotations = js.Array(new InjectableCls)

  @JSExportStatic
  val parameters = js.Array(typeOf[MessageService])
} 
Example 74
Source File: LodashDemo.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalablytyped.runtime.NumberDictionary
import typings.lodash.mod.{ArrayIterator, MemoListIterator, ^ => L}
import typings.lodash.{fpMod => Fp}
import typings.node.global.console
import typings.std.ArrayLike

import scala.scalajs.js
import scala.scalajs.js.|

object LodashDemo {

  class Person(val name: String, val age: Int) extends js.Object

  val Fiona   = new Person("Fiona First", 1)
  val Sam     = new Person("Sam Second", 101)
  val Persons = js.Array(Fiona, Sam)

  def main(args: Array[String]): Unit = {

    val summarizeNames
        : MemoListIterator[Person, js.UndefOr[String], js.Array[Person] | typings.lodash.mod.List[Person]] =
      (prevU, curr, idx, all) =>
        prevU.fold(curr.name) { prev =>
          prev + " and " + curr.name
        }

    val value2 = L.reduce[Person, js.UndefOr[String]](Persons, summarizeNames, js.undefined)
    console.log("Summarized names of two persons", value2)

    val value3 = L.reduce[Person, js.UndefOr[String]](js.Array[Person](), summarizeNames, js.undefined)
    console.log("Summarized names of no persons", value3)

    val toAge: ArrayIterator[Person, Int] =
      (curr, _, _) => curr.age

    console.log("Ages for persons", L.map(Persons.asInstanceOf[NumberDictionary[Double]], toAge))

    console.log("fields for Fiona", L.entriesIn(Fiona))

    console.log("Dropped first", Fp.^.drop(1, Knowledge.isArrayLike(Persons)))
  }
}

object Knowledge {
  def isArrayLike[T](ts: js.Array[T]): ArrayLike[T] =
    ts.asInstanceOf[ArrayLike[T]]
} 
Example 75
Source File: JQueryDemo.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import org.scalajs.dom.html.{Button, Label}
import org.scalajs.dom.document
import org.scalajs.dom.raw.Element
import typings.jquery.{JQueryEventObject, JQuery_, mod => $}
import typings.jqueryui.jqueryuiRequire

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.|

object JQueryDemo {
  @JSImport("jqueryui/jquery-ui.css", JSImport.Namespace)
  @js.native
  object JqueryUiCss extends js.Object

   JQueryEventObject, scala.Unit] = eo => {
      counter += 1
      $[Label]("#label").text(s"Value is $counter")
    }

    $[Button]("#button")
      .text("bumpit")
      .on("click", renderLabel)

    isJQueryUi($("#accordion")).accordion()
  }
} 
Example 76
Source File: D3Demo.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import typings.d3.{mod => d3Mod}
import typings.d3Geo.mod.{GeoContext, GeoProjection_}
import typings.geojson.geojsonStrings
import typings.geojson.mod.{LineString, Position}
import typings.std.global.{console, document, window}
import typings.std.{stdStrings, CanvasRenderingContext2D, FrameRequestCallback, HTMLCanvasElement}

import scala.scalajs.js
import scala.scalajs.js.|

object D3Demo {
  def main(argv: scala.Array[String]): Unit = {
    val canvas: HTMLCanvasElement =
      document
        .getElementsByTagName_canvas(stdStrings.canvas)(0)
        .getOrElse(sys.error("Cannot find canvas element"))

    Knowledge.asOption(canvas.getContext_2d(stdStrings.`2d`)) match {
      case Some(ctx) => run(ctx)
      case None      => console.warn("Cannot get 2d context for", canvas)
    }
  }

  def run(context: CanvasRenderingContext2D): Double = {

    context.lineWidth   = 0.4
    context.strokeStyle = "rgba(255, 255, 255, 0.6)"

    val width  = window.innerWidth
    val height = window.innerHeight
    val size: Double = width min height

    d3Mod
      .select("#content")
      .attr("width", s"${width}px")
      .attr("height", s"${height}px")

    val projection: GeoProjection_ =
      d3Mod
        .geoOrthographic()
        .scale(0.45 * size)
        .translate(js.Tuple2(0.5 * width, 0.5 * height))

    val geoGenerator =
      d3Mod.geoPath(projection, Knowledge.isGeoContext(context))

    val geometry = LineString(
      coordinates = js.Array[Position](),
      `type`      = geojsonStrings.LineString
    )

    def rndLon = -180 + Math.random() * 360
    def rndLat = -90 + Math.random() * 180

    def addPoint(): Unit =
      geometry.coordinates.push(js.Array(rndLon, rndLat))

    def update: FrameRequestCallback =
      (time: Double) => {
        if (geometry.coordinates.length < 6000) addPoint()

        projection.rotate(js.Tuple2(time / 100, 1.0))

        context.clearRect(0, 0, width, height)
        context.beginPath()

        geoGenerator(geometry, null)
        context.stroke()

        window.requestAnimationFrame(update)
      }

    window.requestAnimationFrame(update)
  }
}

object Knowledge {
  def isGeoContext(ctx: CanvasRenderingContext2D): GeoContext =
    ctx.asInstanceOf[GeoContext]
  def asOption[T](t: T | Null): Option[T] =
    Option(t.asInstanceOf[T])
} 
Example 77
Source File: TypescriptCompiler.scala    From Demos   with MIT License 5 votes vote down vote up
package demo

import typings.node.global.console
import typings.node.processMod.{^ => process}
import typings.typescript.{mod => ts}

import scala.scalajs.js
import scala.scalajs.js.|

object TypescriptCompiler {
  def compile(fileNames: js.Array[String], options: ts.CompilerOptions): Unit = {
    val program: ts.Program = ts.createProgram(fileNames, options)
    val emitResult = program.emit()

    val allDiagnostics = ts
      .getPreEmitDiagnostics(program)
      .concat(emitResult.diagnostics)

    allDiagnostics.foreach(diagnostic => {
      val baseMessage = ts.flattenDiagnosticMessageText(Knowledge.force(diagnostic.messageText), "\n")

      val message = diagnostic.file.fold(baseMessage) { file =>
        val pos = file.getLineAndCharacterOfPosition(diagnostic.start.get)
        s"${diagnostic.file.get.fileName} (${pos.line + 1},${pos.character + 1}): $baseMessage"
      }

      console.log(message)
    })

    val exitCode = if (emitResult.emitSkipped) 1 else 0
    console.log(s"Process exiting with code '$exitCode'.")
    process.exit(exitCode)
  }

  def main(args: Array[String]): Unit = {
    val files: js.Array[String] =
      process.argv.drop(2) match {
        case empty if empty.length == 0 =>
          js.Array(
            "typescript/src/main/resources/good.ts",
            "typescript/src/main/resources/bad.ts"
          )
        case nonEmpty => nonEmpty
      }

    compile(
      files,
      ts.CompilerOptions().setNoEmitOnError(true).setNoImplicitAny(true).setOutDir("typescript/target/temp")
    )
  }
}

object Knowledge {
  def force(a: String | ts.DiagnosticMessageChain): ts.DiagnosticMessageChain =
    a.asInstanceOf[ts.DiagnosticMessageChain]
} 
Example 78
Source File: WebWorkerTransport.scala    From suzaku   with Apache License 2.0 5 votes vote down vote up
package suzaku.platform.web

import java.nio.ByteBuffer

import suzaku.platform.Transport
import org.scalajs.dom
import org.scalajs.dom.webworkers.{DedicatedWorkerGlobalScope, Worker}

import scala.scalajs.js
import scala.scalajs.js.typedarray.TypedArrayBufferOps._
import scala.scalajs.js.typedarray.{ArrayBuffer, TypedArrayBuffer}

abstract class WebWorkerTransport extends Transport {
  private val emptyHandler                    = (data: ByteBuffer) => ()
  private var dataHandler: ByteBuffer => Unit = emptyHandler

  override def subscribe(handler: ByteBuffer => Unit): () => Unit = {
    dataHandler = handler
    // return an unsubscribing function
    () =>
      {
        // restore our empty handler when called
        dataHandler = emptyHandler
      }
  }

  def receive(data: ArrayBuffer): Unit = dataHandler(TypedArrayBuffer.wrap(data))
}

class WorkerTransport(worker: DedicatedWorkerGlobalScope) extends WebWorkerTransport {
  override def send(data: ByteBuffer): Unit = {
    assert(data.hasTypedArray())
    val out = data.typedArray.buffer.slice(0, data.limit())
    worker.postMessage(out, js.Array(out).asInstanceOf[js.UndefOr[js.Array[dom.raw.Transferable]]])
  }
}

class WorkerClientTransport(worker: Worker) extends WebWorkerTransport {
  override def send(data: ByteBuffer): Unit = {
    assert(data.hasTypedArray())
    val out = data.typedArray.buffer.slice(0, data.limit())
    worker.postMessage(out, js.Array(out).asInstanceOf[js.UndefOr[js.Array[dom.raw.Transferable]]])
  }
} 
Example 79
Source File: Option.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.commander.mod.local

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Option extends js.Object {
  var bool: Boolean = js.native
  var description: String = js.native
  var flags: String = js.native
  var long: String = js.native
  var optional: Boolean = js.native
  var required: Boolean = js.native
  var short: js.UndefOr[String] = js.native
}

object Option {
  @scala.inline
  def apply(
    bool: Boolean,
    description: String,
    flags: String,
    long: String,
    optional: Boolean,
    required: Boolean
  ): Option = {
    val __obj = js.Dynamic.literal(bool = bool.asInstanceOf[js.Any], description = description.asInstanceOf[js.Any], flags = flags.asInstanceOf[js.Any], long = long.asInstanceOf[js.Any], optional = optional.asInstanceOf[js.Any], required = required.asInstanceOf[js.Any])
    __obj.asInstanceOf[Option]
  }
  @scala.inline
  implicit class OptionOps[Self <: Option] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setBool(value: Boolean): Self = this.set("bool", value.asInstanceOf[js.Any])
    @scala.inline
    def setDescription(value: String): Self = this.set("description", value.asInstanceOf[js.Any])
    @scala.inline
    def setFlags(value: String): Self = this.set("flags", value.asInstanceOf[js.Any])
    @scala.inline
    def setLong(value: String): Self = this.set("long", value.asInstanceOf[js.Any])
    @scala.inline
    def setOptional(value: Boolean): Self = this.set("optional", value.asInstanceOf[js.Any])
    @scala.inline
    def setRequired(value: Boolean): Self = this.set("required", value.asInstanceOf[js.Any])
    @scala.inline
    def setShort(value: String): Self = this.set("short", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteShort: Self = this.set("short", js.undefined)
  }
  
} 
Example 80
Source File: CommandOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.commander.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait CommandOptions extends js.Object {
  var isDefault: js.UndefOr[Boolean] = js.native
  var noHelp: js.UndefOr[Boolean] = js.native
}

object CommandOptions {
  @scala.inline
  def apply(): CommandOptions = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[CommandOptions]
  }
  @scala.inline
  implicit class CommandOptionsOps[Self <: CommandOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setIsDefault(value: Boolean): Self = this.set("isDefault", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteIsDefault: Self = this.set("isDefault", js.undefined)
    @scala.inline
    def setNoHelp(value: Boolean): Self = this.set("noHelp", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteNoHelp: Self = this.set("noHelp", js.undefined)
  }
  
} 
Example 81
Source File: ParseOptionsResult.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.commander.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ParseOptionsResult extends js.Object {
  var args: js.Array[String] = js.native
  var unknown: js.Array[String] = js.native
}

object ParseOptionsResult {
  @scala.inline
  def apply(args: js.Array[String], unknown: js.Array[String]): ParseOptionsResult = {
    val __obj = js.Dynamic.literal(args = args.asInstanceOf[js.Any], unknown = unknown.asInstanceOf[js.Any])
    __obj.asInstanceOf[ParseOptionsResult]
  }
  @scala.inline
  implicit class ParseOptionsResultOps[Self <: ParseOptionsResult] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setArgs(value: js.Array[String]): Self = this.set("args", value.asInstanceOf[js.Any])
    @scala.inline
    def setUnknown(value: js.Array[String]): Self = this.set("unknown", value.asInstanceOf[js.Any])
  }
  
} 
Example 82
Source File: unionToInheritanceNumbers.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.unionToInheritance

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

object unionToInheritanceNumbers {
  @js.native
  sealed trait `1` extends _C
  
  @js.native
  sealed trait `2` extends _C
  
  @scala.inline
  def `1`: `1` = 1.asInstanceOf[`1`]
  @scala.inline
  def `2`: `2` = 2.asInstanceOf[`2`]
} 
Example 83
Source File: Foo.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.unionToInheritance

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Foo[U]
  extends Legal1[U]
     with Legal2[U, js.Any]
     with Legal3[js.Any, js.Any, U] {
  var value: U = js.native
}

object Foo {
  @scala.inline
  def apply[U](value: U): Foo[U] = {
    val __obj = js.Dynamic.literal(value = value.asInstanceOf[js.Any])
    __obj.asInstanceOf[Foo[U]]
  }
  @scala.inline
  implicit class FooOps[Self <: Foo[_], U] (val x: Self with Foo[U]) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setValue(value: U): Self = this.set("value", value.asInstanceOf[js.Any])
  }
  
} 
Example 84
Source File: Foo2.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.unionToInheritance

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Foo2[U, V]
  extends Legal2[V, U]
     with Legal3[U, js.Any, V]
     with _Test[U, js.Any, V] {
  var u: U = js.native
  var v: V = js.native
}

object Foo2 {
  @scala.inline
  def apply[U, V](u: U, v: V): Foo2[U, V] = {
    val __obj = js.Dynamic.literal(u = u.asInstanceOf[js.Any], v = v.asInstanceOf[js.Any])
    __obj.asInstanceOf[Foo2[U, V]]
  }
  @scala.inline
  implicit class Foo2Ops[Self <: Foo2[_, _], U, V] (val x: Self with (Foo2[U, V])) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setU(value: U): Self = this.set("u", value.asInstanceOf[js.Any])
    @scala.inline
    def setV(value: V): Self = this.set("v", value.asInstanceOf[js.Any])
  }
  
} 
Example 85
Source File: Either.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.unionToInheritance

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Either[L, R]
  extends Legal3[js.Any, L, R]
     with _Test[js.Any, L, R]
     with _Test2[R, L] {
  var value: R = js.native
}

object Either {
  @scala.inline
  def apply[L, R](value: R): Either[L, R] = {
    val __obj = js.Dynamic.literal(value = value.asInstanceOf[js.Any])
    __obj.asInstanceOf[Either[L, R]]
  }
  @scala.inline
  implicit class EitherOps[Self <: Either[_, _], L, R] (val x: Self with (Either[L, R])) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setValue(value: R): Self = this.set("value", value.asInstanceOf[js.Any])
  }
  
} 
Example 86
Source File: unionToInheritanceStrings.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.unionToInheritance

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

object unionToInheritanceStrings {
  @js.native
  sealed trait a1 extends _A
  
  @js.native
  sealed trait a2 extends _A
  
  @js.native
  sealed trait b1 extends _B
  
  @js.native
  sealed trait b2 extends _B
  
  @js.native
  sealed trait bar
    extends Legal1[js.Any]
       with Legal2[js.Any, js.Any]
       with Legal3[js.Any, js.Any, js.Any]
       with _Illegal1
       with _Illegal2
       with _Illegal3[js.Any]
       with _Test[js.Any, js.Any, js.Any]
  
  @js.native
  sealed trait foo
    extends Legal1[js.Any]
       with Legal2[js.Any, js.Any]
       with Legal3[js.Any, js.Any, js.Any]
       with _Illegal1
       with _Illegal2
       with _Illegal3[js.Any]
       with _Test[js.Any, js.Any, js.Any]
  
  @scala.inline
  def a1: a1 = "a1".asInstanceOf[a1]
  @scala.inline
  def a2: a2 = "a2".asInstanceOf[a2]
  @scala.inline
  def b1: b1 = "b1".asInstanceOf[b1]
  @scala.inline
  def b2: b2 = "b2".asInstanceOf[b2]
  @scala.inline
  def bar: bar = "bar".asInstanceOf[bar]
  @scala.inline
  def foo: foo = "foo".asInstanceOf[foo]
} 
Example 87
Source File: TwoFoo.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.std

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait TwoFoo[Foo1, Foo2] extends js.Object {
  var value: Foo1 = js.native
}

object TwoFoo {
  @scala.inline
  def apply[Foo1, Foo2](value: Foo1): TwoFoo[Foo1, Foo2] = {
    val __obj = js.Dynamic.literal(value = value.asInstanceOf[js.Any])
    __obj.asInstanceOf[TwoFoo[Foo1, Foo2]]
  }
  @scala.inline
  implicit class TwoFooOps[Self <: TwoFoo[_, _], Foo1, Foo2] (val x: Self with (TwoFoo[Foo1, Foo2])) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setValue(value: Foo1): Self = this.set("value", value.asInstanceOf[js.Any])
  }
  
} 
Example 88
Source File: PersonRecord.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait PersonRecord extends js.Object {
  var age: String = js.native
  var name: String = js.native
}

object PersonRecord {
  @scala.inline
  def apply(age: String, name: String): PersonRecord = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any], name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[PersonRecord]
  }
  @scala.inline
  implicit class PersonRecordOps[Self <: PersonRecord] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: String): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 89
Source File: TypographyStyleOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait TypographyStyleOptions extends js.Object {
  var color: js.UndefOr[String] = js.native
  var fontFamily: js.UndefOr[String] = js.native
  var fontSize: js.UndefOr[String] = js.native
  var fontWeight: js.UndefOr[String] = js.native
  var letterSpacing: js.UndefOr[String] = js.native
  var lineHeight: js.UndefOr[String] = js.native
  var textTransform: js.UndefOr[String] = js.native
}

object TypographyStyleOptions {
  @scala.inline
  def apply(): TypographyStyleOptions = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[TypographyStyleOptions]
  }
  @scala.inline
  implicit class TypographyStyleOptionsOps[Self <: TypographyStyleOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setColor(value: String): Self = this.set("color", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteColor: Self = this.set("color", js.undefined)
    @scala.inline
    def setFontFamily(value: String): Self = this.set("fontFamily", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteFontFamily: Self = this.set("fontFamily", js.undefined)
    @scala.inline
    def setFontSize(value: String): Self = this.set("fontSize", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteFontSize: Self = this.set("fontSize", js.undefined)
    @scala.inline
    def setFontWeight(value: String): Self = this.set("fontWeight", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteFontWeight: Self = this.set("fontWeight", js.undefined)
    @scala.inline
    def setLetterSpacing(value: String): Self = this.set("letterSpacing", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteLetterSpacing: Self = this.set("letterSpacing", js.undefined)
    @scala.inline
    def setLineHeight(value: String): Self = this.set("lineHeight", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteLineHeight: Self = this.set("lineHeight", js.undefined)
    @scala.inline
    def setTextTransform(value: String): Self = this.set("textTransform", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteTextTransform: Self = this.set("textTransform", js.undefined)
  }
  
} 
Example 90
Source File: Mark.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import typings.typeMappings.typeMappingsStrings.text
import typings.typeMappings.typeMappingsStrings.trail
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


trait Mark extends js.Object

object Mark {
  @scala.inline
  def TextMark(`type`: text): Mark = {
    val __obj = js.Dynamic.literal()
    __obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
    __obj.asInstanceOf[Mark]
  }
  @scala.inline
  def TrailMark(`type`: trail): Mark = {
    val __obj = js.Dynamic.literal()
    __obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
    __obj.asInstanceOf[Mark]
  }
} 
Example 91
Source File: Person.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Person extends js.Object {
  var age: js.UndefOr[scala.Double | Null] = js.native
  var name: String = js.native
}

object Person {
  @scala.inline
  def apply(name: String): Person = {
    val __obj = js.Dynamic.literal(name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[Person]
  }
  @scala.inline
  implicit class PersonOps[Self <: Person] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
    @scala.inline
    def setAge(value: scala.Double): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAge: Self = this.set("age", js.undefined)
    @scala.inline
    def setAgeNull: Self = this.set("age", null)
  }
  
} 
Example 92
Source File: NamePerson.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait NamePerson extends js.Object {
  var name: String = js.native
}

object NamePerson {
  @scala.inline
  def apply(name: String): NamePerson = {
    val __obj = js.Dynamic.literal(name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[NamePerson]
  }
  @scala.inline
  implicit class NamePersonOps[Self <: NamePerson] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 93
Source File: TextMark.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import typings.typeMappings.typeMappingsStrings.text
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait TextMark extends Mark {
  var `type`: text = js.native
}

object TextMark {
  @scala.inline
  def apply(`type`: text): TextMark = {
    val __obj = js.Dynamic.literal()
    __obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
    __obj.asInstanceOf[TextMark]
  }
  @scala.inline
  implicit class TextMarkOps[Self <: TextMark] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setType(value: text): Self = this.set("type", value.asInstanceOf[js.Any])
  }
  
} 
Example 94
Source File: Marking.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait Marking extends js.Object {
  var text: String = js.native
  var trail: String = js.native
}

object Marking {
  @scala.inline
  def apply(text: String, trail: String): Marking = {
    val __obj = js.Dynamic.literal(text = text.asInstanceOf[js.Any], trail = trail.asInstanceOf[js.Any])
    __obj.asInstanceOf[Marking]
  }
  @scala.inline
  implicit class MarkingOps[Self <: Marking] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setText(value: String): Self = this.set("text", value.asInstanceOf[js.Any])
    @scala.inline
    def setTrail(value: String): Self = this.set("trail", value.asInstanceOf[js.Any])
  }
  
} 
Example 95
Source File: Excluded.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait Excluded extends js.Object {
  var fontFamily: String = js.native
  var fontSize: String = js.native
  var fontWeight: String = js.native
  var letterSpacing: String = js.native
  var lineHeight: String = js.native
  var textTransform: String = js.native
}

object Excluded {
  @scala.inline
  def apply(
    fontFamily: String,
    fontSize: String,
    fontWeight: String,
    letterSpacing: String,
    lineHeight: String,
    textTransform: String
  ): Excluded = {
    val __obj = js.Dynamic.literal(fontFamily = fontFamily.asInstanceOf[js.Any], fontSize = fontSize.asInstanceOf[js.Any], fontWeight = fontWeight.asInstanceOf[js.Any], letterSpacing = letterSpacing.asInstanceOf[js.Any], lineHeight = lineHeight.asInstanceOf[js.Any], textTransform = textTransform.asInstanceOf[js.Any])
    __obj.asInstanceOf[Excluded]
  }
  @scala.inline
  implicit class ExcludedOps[Self <: Excluded] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setFontFamily(value: String): Self = this.set("fontFamily", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontSize(value: String): Self = this.set("fontSize", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontWeight(value: String): Self = this.set("fontWeight", value.asInstanceOf[js.Any])
    @scala.inline
    def setLetterSpacing(value: String): Self = this.set("letterSpacing", value.asInstanceOf[js.Any])
    @scala.inline
    def setLineHeight(value: String): Self = this.set("lineHeight", value.asInstanceOf[js.Any])
    @scala.inline
    def setTextTransform(value: String): Self = this.set("textTransform", value.asInstanceOf[js.Any])
  }
  
} 
Example 96
Source File: IProxiedPerson.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import typings.typeMappings.anon.Get
import typings.typeMappings.anon.Set
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait IProxiedPerson extends js.Object {
  var age: Get = js.native
  var name: Set = js.native
}

object IProxiedPerson {
  @scala.inline
  def apply(age: Get, name: Set): IProxiedPerson = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any], name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[IProxiedPerson]
  }
  @scala.inline
  implicit class IProxiedPersonOps[Self <: IProxiedPerson] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: Get): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def setName(value: Set): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 97
Source File: U.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait U extends js.Object {
  var age: scala.Double = js.native
  var name: String = js.native
}

object U {
  @scala.inline
  def apply(age: scala.Double, name: String): U = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any], name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[U]
  }
  @scala.inline
  implicit class UOps[Self <: U] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: scala.Double): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 98
Source File: RequiredPerson.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait RequiredPerson extends js.Object {
  var age: scala.Double = js.native
  var name: String = js.native
}

object RequiredPerson {
  @scala.inline
  def apply(age: scala.Double, name: String): RequiredPerson = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any], name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[RequiredPerson]
  }
  @scala.inline
  implicit class RequiredPersonOps[Self <: RequiredPerson] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: scala.Double): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 99
Source File: Set.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Set extends js.Object {
  def get(): String = js.native
  def set(v: String): Unit = js.native
}

object Set {
  @scala.inline
  def apply(get: () => String, set: String => Unit): Set = {
    val __obj = js.Dynamic.literal(get = js.Any.fromFunction0(get), set = js.Any.fromFunction1(set))
    __obj.asInstanceOf[Set]
  }
  @scala.inline
  implicit class SetOps[Self <: Set] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setGet(value: () => String): Self = this.set("get", js.Any.fromFunction0(value))
    @scala.inline
    def setSet(value: String => Unit): Self = this.set("set", js.Any.fromFunction1(value))
  }
  
} 
Example 100
Source File: Name.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Name extends js.Object {
  var name: String = js.native
}

object Name {
  @scala.inline
  def apply(name: String): Name = {
    val __obj = js.Dynamic.literal(name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[Name]
  }
  @scala.inline
  implicit class NameOps[Self <: Name] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 101
Source File: Age.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Age extends js.Object {
  var age: Double = js.native
}

object Age {
  @scala.inline
  def apply(age: Double): Age = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any])
    __obj.asInstanceOf[Age]
  }
  @scala.inline
  implicit class AgeOps[Self <: Age] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: Double): Self = this.set("age", value.asInstanceOf[js.Any])
  }
  
} 
Example 102
Source File: V.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait V extends js.Object {
  var age: scala.Double = js.native
}

object V {
  @scala.inline
  def apply(age: scala.Double): V = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any])
    __obj.asInstanceOf[V]
  }
  @scala.inline
  implicit class VOps[Self <: V] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: scala.Double): Self = this.set("age", value.asInstanceOf[js.Any])
  }
  
} 
Example 103
Source File: TrailMark.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import typings.typeMappings.typeMappingsStrings.trail
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait TrailMark extends Mark {
  var `type`: trail = js.native
}

object TrailMark {
  @scala.inline
  def apply(`type`: trail): TrailMark = {
    val __obj = js.Dynamic.literal()
    __obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
    __obj.asInstanceOf[TrailMark]
  }
  @scala.inline
  implicit class TrailMarkOps[Self <: TrailMark] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setType(value: trail): Self = this.set("type", value.asInstanceOf[js.Any])
  }
  
} 
Example 104
Source File: ProxiedPerson.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import typings.typeMappings.anon.Get
import typings.typeMappings.anon.Set
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait ProxiedPerson extends js.Object {
  var age: Get = js.native
  var name: Set = js.native
}

object ProxiedPerson {
  @scala.inline
  def apply(age: Get, name: Set): ProxiedPerson = {
    val __obj = js.Dynamic.literal(age = age.asInstanceOf[js.Any], name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[ProxiedPerson]
  }
  @scala.inline
  implicit class ProxiedPersonOps[Self <: ProxiedPerson] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: Get): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def setName(value: Set): Self = this.set("name", value.asInstanceOf[js.Any])
  }
  
} 
Example 105
Source File: typeMappingsStrings.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

object typeMappingsStrings {
  @js.native
  sealed trait Proxify extends js.Object
  
  @js.native
  sealed trait age extends js.Object
  
  @js.native
  sealed trait name extends js.Object
  
  @js.native
  sealed trait text extends js.Object
  
  @js.native
  sealed trait trail extends js.Object
  
  @scala.inline
  def Proxify: Proxify = "Proxify".asInstanceOf[Proxify]
  @scala.inline
  def age: age = "age".asInstanceOf[age]
  @scala.inline
  def name: name = "name".asInstanceOf[name]
  @scala.inline
  def text: text = "text".asInstanceOf[text]
  @scala.inline
  def trail: trail = "trail".asInstanceOf[trail]
} 
Example 106
Source File: ReadonlyPerson.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait ReadonlyPerson extends js.Object {
  val age: js.UndefOr[scala.Double] = js.native
  val name: String = js.native
}

object ReadonlyPerson {
  @scala.inline
  def apply(name: String): ReadonlyPerson = {
    val __obj = js.Dynamic.literal(name = name.asInstanceOf[js.Any])
    __obj.asInstanceOf[ReadonlyPerson]
  }
  @scala.inline
  implicit class ReadonlyPersonOps[Self <: ReadonlyPerson] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
    @scala.inline
    def setAge(value: scala.Double): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAge: Self = this.set("age", js.undefined)
  }
  
} 
Example 107
Source File: TypographyStyle.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait TypographyStyle extends js.Object {
  var color: String = js.native
  var fontFamily: String = js.native
  var fontSize: String = js.native
  var fontWeight: String = js.native
  var letterSpacing: js.UndefOr[String] = js.native
  var lineHeight: js.UndefOr[String] = js.native
  var textTransform: js.UndefOr[String] = js.native
}

object TypographyStyle {
  @scala.inline
  def apply(color: String, fontFamily: String, fontSize: String, fontWeight: String): TypographyStyle = {
    val __obj = js.Dynamic.literal(color = color.asInstanceOf[js.Any], fontFamily = fontFamily.asInstanceOf[js.Any], fontSize = fontSize.asInstanceOf[js.Any], fontWeight = fontWeight.asInstanceOf[js.Any])
    __obj.asInstanceOf[TypographyStyle]
  }
  @scala.inline
  implicit class TypographyStyleOps[Self <: TypographyStyle] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setColor(value: String): Self = this.set("color", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontFamily(value: String): Self = this.set("fontFamily", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontSize(value: String): Self = this.set("fontSize", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontWeight(value: String): Self = this.set("fontWeight", value.asInstanceOf[js.Any])
    @scala.inline
    def setLetterSpacing(value: String): Self = this.set("letterSpacing", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteLetterSpacing: Self = this.set("letterSpacing", js.undefined)
    @scala.inline
    def setLineHeight(value: String): Self = this.set("lineHeight", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteLineHeight: Self = this.set("lineHeight", js.undefined)
    @scala.inline
    def setTextTransform(value: String): Self = this.set("textTransform", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteTextTransform: Self = this.set("textTransform", js.undefined)
  }
  
} 
Example 108
Source File: PartialPerson.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait PartialPerson extends js.Object {
  var age: js.UndefOr[scala.Double] = js.native
  var name: js.UndefOr[String] = js.native
}

object PartialPerson {
  @scala.inline
  def apply(): PartialPerson = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[PartialPerson]
  }
  @scala.inline
  implicit class PartialPersonOps[Self <: PartialPerson] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAge(value: scala.Double): Self = this.set("age", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAge: Self = this.set("age", js.undefined)
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteName: Self = this.set("name", js.undefined)
  }
  
} 
Example 109
Source File: CSSProperties.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.typeMappings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait CSSProperties extends js.Object {
  var color: String = js.native
  var fontFamily: String = js.native
  var fontSize: String = js.native
  var fontWeight: String = js.native
  var letterSpacing: String = js.native
  var lineHeight: String = js.native
  var textTransform: String = js.native
}

object CSSProperties {
  @scala.inline
  def apply(
    color: String,
    fontFamily: String,
    fontSize: String,
    fontWeight: String,
    letterSpacing: String,
    lineHeight: String,
    textTransform: String
  ): CSSProperties = {
    val __obj = js.Dynamic.literal(color = color.asInstanceOf[js.Any], fontFamily = fontFamily.asInstanceOf[js.Any], fontSize = fontSize.asInstanceOf[js.Any], fontWeight = fontWeight.asInstanceOf[js.Any], letterSpacing = letterSpacing.asInstanceOf[js.Any], lineHeight = lineHeight.asInstanceOf[js.Any], textTransform = textTransform.asInstanceOf[js.Any])
    __obj.asInstanceOf[CSSProperties]
  }
  @scala.inline
  implicit class CSSPropertiesOps[Self <: CSSProperties] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setColor(value: String): Self = this.set("color", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontFamily(value: String): Self = this.set("fontFamily", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontSize(value: String): Self = this.set("fontSize", value.asInstanceOf[js.Any])
    @scala.inline
    def setFontWeight(value: String): Self = this.set("fontWeight", value.asInstanceOf[js.Any])
    @scala.inline
    def setLetterSpacing(value: String): Self = this.set("letterSpacing", value.asInstanceOf[js.Any])
    @scala.inline
    def setLineHeight(value: String): Self = this.set("lineHeight", value.asInstanceOf[js.Any])
    @scala.inline
    def setTextTransform(value: String): Self = this.set("textTransform", value.asInstanceOf[js.Any])
  }
  
} 
Example 110
Source File: package.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

package object typeMappings {
  type Double[T] = typings.std.Partial[typings.std.Partial[T]]
  type IPersonRecord = typings.typeMappings.PersonRecord
  type NewedPerson = typings.std.InstanceType[org.scalablytyped.runtime.Instantiable0[typings.typeMappings.Person]]
  type NonNullablePerson = typings.std.NonNullable[typings.typeMappings.Person]
  type Omit[T, K  typings.typeMappings.typeMappingsStrings.Proxify with org.scalablytyped.runtime.TopLevel[js.Any]
  type ReturnedPerson = typings.std.ReturnType[js.Function0[typings.typeMappings.Person]]
  type T = typings.std.Pick[
    typings.typeMappings.anon.Name | typings.typeMappings.anon.Age, 
    typings.typeMappings.typeMappingsStrings.name with typings.typeMappings.typeMappingsStrings.age
  ]
} 
Example 111
Source File: stdStrings.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.std

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

object stdStrings {
  @js.native
  sealed trait Partial extends js.Object
  
  @js.native
  sealed trait Pick extends js.Object
  
  @js.native
  sealed trait Proxify extends js.Object
  
  @js.native
  sealed trait Readonly extends js.Object
  
  @js.native
  sealed trait Required extends js.Object
  
  @scala.inline
  def Partial: Partial = "Partial".asInstanceOf[Partial]
  @scala.inline
  def Pick: Pick = "Pick".asInstanceOf[Pick]
  @scala.inline
  def Proxify: Proxify = "Proxify".asInstanceOf[Proxify]
  @scala.inline
  def Readonly: Readonly = "Readonly".asInstanceOf[Readonly]
  @scala.inline
  def Required: Required = "Required".asInstanceOf[Required]
} 
Example 112
Source File: AcceptOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.webpackEnv.WebpackModuleApi

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait AcceptOptions extends js.Object {
  
  var ignoreUnaccepted: js.UndefOr[Boolean] = js.native
}

object AcceptOptions {
  @scala.inline
  def apply(): AcceptOptions = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[AcceptOptions]
  }
  @scala.inline
  implicit class AcceptOptionsOps[Self <: AcceptOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAutoApply(value: Boolean): Self = this.set("autoApply", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAutoApply: Self = this.set("autoApply", js.undefined)
    @scala.inline
    def setIgnoreUnaccepted(value: Boolean): Self = this.set("ignoreUnaccepted", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteIgnoreUnaccepted: Self = this.set("ignoreUnaccepted", js.undefined)
  }
  
} 
Example 113
Source File: NodeProcess.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.webpackEnv.WebpackModuleApi

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


@js.native
trait NodeProcess extends js.Object {
  var env: js.UndefOr[js.Any] = js.native
}

object NodeProcess {
  @scala.inline
  def apply(): NodeProcess = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[NodeProcess]
  }
  @scala.inline
  implicit class NodeProcessOps[Self <: NodeProcess] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setEnv(value: js.Any): Self = this.set("env", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteEnv: Self = this.set("env", js.undefined)
  }
  
} 
Example 114
Source File: Module.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.webpackEnv.WebpackModuleApi

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Module extends js.Object {
  var children: js.Array[_] = js.native
  var exports: js.Any = js.native
  var filename: String = js.native
  var hot: js.UndefOr[Hot] = js.native
  var id: String = js.native
  var loaded: Boolean = js.native
  var parent: js.Any = js.native
  def require(id: String): js.Any = js.native
  @JSName("require")
  def require_T_T[T](id: String): T = js.native
} 
Example 115
Source File: VueConfiguration.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.vueMod

import org.scalablytyped.runtime.StringDictionary
import typings.std.Error
import typings.std.RegExp
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait VueConfiguration extends js.Object {
  var devtools: Boolean = js.native
  var ignoredElements: js.Array[String | RegExp] = js.native
  var keyCodes: StringDictionary[Double | js.Array[Double]] = js.native
  var optionMergeStrategies: js.Any = js.native
  var performance: Boolean = js.native
  var productionTip: Boolean = js.native
  var silent: Boolean = js.native
  def errorHandler(err: Error, vm: Vue, info: String): Unit = js.native
  def warnHandler(msg: String, vm: Vue, trace: String): Unit = js.native
}

object VueConfiguration {
  @scala.inline
  def apply(
    devtools: Boolean,
    errorHandler: (Error, Vue, String) => Unit,
    ignoredElements: js.Array[String | RegExp],
    keyCodes: StringDictionary[Double | js.Array[Double]],
    optionMergeStrategies: js.Any,
    performance: Boolean,
    productionTip: Boolean,
    silent: Boolean,
    warnHandler: (String, Vue, String) => Unit
  ): VueConfiguration = {
    val __obj = js.Dynamic.literal(devtools = devtools.asInstanceOf[js.Any], errorHandler = js.Any.fromFunction3(errorHandler), ignoredElements = ignoredElements.asInstanceOf[js.Any], keyCodes = keyCodes.asInstanceOf[js.Any], optionMergeStrategies = optionMergeStrategies.asInstanceOf[js.Any], performance = performance.asInstanceOf[js.Any], productionTip = productionTip.asInstanceOf[js.Any], silent = silent.asInstanceOf[js.Any], warnHandler = js.Any.fromFunction3(warnHandler))
    __obj.asInstanceOf[VueConfiguration]
  }
  @scala.inline
  implicit class VueConfigurationOps[Self <: VueConfiguration] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDevtools(value: Boolean): Self = this.set("devtools", value.asInstanceOf[js.Any])
    @scala.inline
    def setErrorHandler(value: (Error, Vue, String) => Unit): Self = this.set("errorHandler", js.Any.fromFunction3(value))
    @scala.inline
    def setIgnoredElements(value: js.Array[String | RegExp]): Self = this.set("ignoredElements", value.asInstanceOf[js.Any])
    @scala.inline
    def setKeyCodes(value: StringDictionary[Double | js.Array[Double]]): Self = this.set("keyCodes", value.asInstanceOf[js.Any])
    @scala.inline
    def setOptionMergeStrategies(value: js.Any): Self = this.set("optionMergeStrategies", value.asInstanceOf[js.Any])
    @scala.inline
    def setPerformance(value: Boolean): Self = this.set("performance", value.asInstanceOf[js.Any])
    @scala.inline
    def setProductionTip(value: Boolean): Self = this.set("productionTip", value.asInstanceOf[js.Any])
    @scala.inline
    def setSilent(value: Boolean): Self = this.set("silent", value.asInstanceOf[js.Any])
    @scala.inline
    def setWarnHandler(value: (String, Vue, String) => Unit): Self = this.set("warnHandler", js.Any.fromFunction3(value))
  }
  
} 
Example 116
Source File: CreateElement.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.vueMod

import typings.vue.optionsMod.AsyncComponent
import typings.vue.optionsMod.Component
import typings.vue.optionsMod.DefaultComputed
import typings.vue.optionsMod.DefaultData
import typings.vue.optionsMod.DefaultMethods
import typings.vue.optionsMod.DefaultProps
import typings.vue.vnodeMod.VNode
import typings.vue.vnodeMod.VNodeChildren
import typings.vue.vnodeMod.VNodeData
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait CreateElement extends js.Object {
  def apply(): VNode = js.native
  def apply(tag: String): VNode = js.native
  def apply(tag: String, children: VNodeChildren): VNode = js.native
  def apply(tag: String, data: VNodeData): VNode = js.native
  def apply(tag: String, data: VNodeData, children: VNodeChildren): VNode = js.native
  def apply(tag: js.Function0[Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps]]): VNode = js.native
  def apply(
    tag: js.Function0[Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps]],
    children: VNodeChildren
  ): VNode = js.native
  def apply(
    tag: js.Function0[Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps]],
    data: VNodeData
  ): VNode = js.native
  def apply(
    tag: js.Function0[Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps]],
    data: VNodeData,
    children: VNodeChildren
  ): VNode = js.native
  def apply(tag: AsyncComponent[_, _, _, _]): VNode = js.native
  def apply(tag: AsyncComponent[_, _, _, _], children: VNodeChildren): VNode = js.native
  def apply(tag: AsyncComponent[_, _, _, _], data: VNodeData): VNode = js.native
  def apply(tag: AsyncComponent[_, _, _, _], data: VNodeData, children: VNodeChildren): VNode = js.native
  def apply(tag: Component[_, _, _, _]): VNode = js.native
  def apply(tag: Component[_, _, _, _], children: VNodeChildren): VNode = js.native
  def apply(tag: Component[_, _, _, _], data: VNodeData): VNode = js.native
  def apply(tag: Component[_, _, _, _], data: VNodeData, children: VNodeChildren): VNode = js.native
} 
Example 117
Source File: vueStrings.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

object vueStrings {
  @js.native
  sealed trait Accessors extends js.Object
  
  @js.native
  sealed trait RecordPropsDefinition extends js.Object
  
  @scala.inline
  def Accessors: Accessors = "Accessors".asInstanceOf[Accessors]
  @scala.inline
  def RecordPropsDefinition: RecordPropsDefinition = "RecordPropsDefinition".asInstanceOf[RecordPropsDefinition]
} 
Example 118
Source File: EsModuleComponent.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.optionsMod

import typings.vue.vueMod.Vue
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait EsModuleComponent extends js.Object {
  var default: Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps] = js.native
}

object EsModuleComponent {
  @scala.inline
  def apply(default: Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps]): EsModuleComponent = {
    val __obj = js.Dynamic.literal(default = default.asInstanceOf[js.Any])
    __obj.asInstanceOf[EsModuleComponent]
  }
  @scala.inline
  implicit class EsModuleComponentOps[Self <: EsModuleComponent] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDefault(value: Component[DefaultData[Vue], DefaultMethods[Vue], DefaultComputed, DefaultProps]): Self = this.set("default", value.asInstanceOf[js.Any])
  }
  
} 
Example 119
Source File: RenderContext.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.optionsMod

import typings.vue.vnodeMod.VNode
import typings.vue.vnodeMod.VNodeData
import typings.vue.vueMod.Vue
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait RenderContext[Props] extends js.Object {
  var children: js.Array[VNode] = js.native
  var data: VNodeData = js.native
  var injections: js.Any = js.native
  var parent: Vue = js.native
  var props: Props = js.native
  def slots(): js.Any = js.native
}

object RenderContext {
  @scala.inline
  def apply[Props](
    children: js.Array[VNode],
    data: VNodeData,
    injections: js.Any,
    parent: Vue,
    props: Props,
    slots: () => js.Any
  ): RenderContext[Props] = {
    val __obj = js.Dynamic.literal(children = children.asInstanceOf[js.Any], data = data.asInstanceOf[js.Any], injections = injections.asInstanceOf[js.Any], parent = parent.asInstanceOf[js.Any], props = props.asInstanceOf[js.Any], slots = js.Any.fromFunction0(slots))
    __obj.asInstanceOf[RenderContext[Props]]
  }
  @scala.inline
  implicit class RenderContextOps[Self <: RenderContext[_], Props] (val x: Self with RenderContext[Props]) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setChildren(value: js.Array[VNode]): Self = this.set("children", value.asInstanceOf[js.Any])
    @scala.inline
    def setData(value: VNodeData): Self = this.set("data", value.asInstanceOf[js.Any])
    @scala.inline
    def setInjections(value: js.Any): Self = this.set("injections", value.asInstanceOf[js.Any])
    @scala.inline
    def setParent(value: Vue): Self = this.set("parent", value.asInstanceOf[js.Any])
    @scala.inline
    def setProps(value: Props): Self = this.set("props", value.asInstanceOf[js.Any])
    @scala.inline
    def setSlots(value: () => js.Any): Self = this.set("slots", js.Any.fromFunction0(value))
  }
  
} 
Example 120
Source File: DirectiveOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.optionsMod

import typings.std.HTMLElement
import typings.vue.vnodeMod.VNode
import typings.vue.vnodeMod.VNodeDirective
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait DirectiveOptions extends js.Object {
  var bind: js.UndefOr[DirectiveFunction] = js.native
  var componentUpdated: js.UndefOr[DirectiveFunction] = js.native
  var inserted: js.UndefOr[DirectiveFunction] = js.native
  var unbind: js.UndefOr[DirectiveFunction] = js.native
  var update: js.UndefOr[DirectiveFunction] = js.native
}

object DirectiveOptions {
  @scala.inline
  def apply(): DirectiveOptions = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[DirectiveOptions]
  }
  @scala.inline
  implicit class DirectiveOptionsOps[Self <: DirectiveOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setBind(
      value: ( VNode) => Unit
    ): Self = this.set("update", js.Any.fromFunction4(value))
    @scala.inline
    def deleteUpdate: Self = this.set("update", js.undefined)
  }
  
} 
Example 121
Source File: WatchOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.optionsMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait WatchOptions extends js.Object {
  var deep: js.UndefOr[Boolean] = js.native
  var immediate: js.UndefOr[Boolean] = js.native
}

object WatchOptions {
  @scala.inline
  def apply(): WatchOptions = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[WatchOptions]
  }
  @scala.inline
  implicit class WatchOptionsOps[Self <: WatchOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDeep(value: Boolean): Self = this.set("deep", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteDeep: Self = this.set("deep", js.undefined)
    @scala.inline
    def setImmediate(value: Boolean): Self = this.set("immediate", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteImmediate: Self = this.set("immediate", js.undefined)
  }
  
} 
Example 122
Source File: FunctionalComponentOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.optionsMod

import typings.vue.vnodeMod.VNode
import typings.vue.vueMod.CreateElement
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait FunctionalComponentOptions[Props, PropDefs] extends js.Object {
  var functional: Boolean = js.native
  var inject: js.UndefOr[InjectOptions] = js.native
  var name: js.UndefOr[String] = js.native
  var props: js.UndefOr[PropDefs] = js.native
  def render(createElement: CreateElement, context: RenderContext[Props]): VNode = js.native
}

object FunctionalComponentOptions {
  @scala.inline
  def apply[Props, PropDefs](functional: Boolean, render: (CreateElement, RenderContext[Props]) => VNode): FunctionalComponentOptions[Props, PropDefs] = {
    val __obj = js.Dynamic.literal(functional = functional.asInstanceOf[js.Any], render = js.Any.fromFunction2(render))
    __obj.asInstanceOf[FunctionalComponentOptions[Props, PropDefs]]
  }
  @scala.inline
  implicit class FunctionalComponentOptionsOps[Self <: FunctionalComponentOptions[_, _], Props, PropDefs] (val x: Self with (FunctionalComponentOptions[Props, PropDefs])) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setFunctional(value: Boolean): Self = this.set("functional", value.asInstanceOf[js.Any])
    @scala.inline
    def setRender(value: (CreateElement, RenderContext[Props]) => VNode): Self = this.set("render", js.Any.fromFunction2(value))
    @scala.inline
    def setInject(value: InjectOptions): Self = this.set("inject", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteInject: Self = this.set("inject", js.undefined)
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteName: Self = this.set("name", js.undefined)
    @scala.inline
    def setProps(value: PropDefs): Self = this.set("props", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteProps: Self = this.set("props", js.undefined)
  }
  
} 
Example 123
Source File: PropOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.optionsMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait PropOptions[T] extends js.Object {
  var default: js.UndefOr[T | Null | js.Function0[js.Object]] = js.native
  var required: js.UndefOr[Boolean] = js.native
  var `type`: js.UndefOr[Prop[T] | js.Array[Prop[T]]] = js.native
  var validator: js.UndefOr[js.Function1[ T => Boolean): Self = this.set("validator", js.Any.fromFunction1(value))
    @scala.inline
    def deleteValidator: Self = this.set("validator", js.undefined)
  }
  
} 
Example 124
Source File: StaticRenderFns.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.anon

import typings.vue.vnodeMod.VNode
import typings.vue.vueMod.CreateElement
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait StaticRenderFns extends js.Object {
  var staticRenderFns: js.Array[js.Function0[VNode]] = js.native
  def render(createElement: CreateElement): VNode = js.native
}

object StaticRenderFns {
  @scala.inline
  def apply(render: CreateElement => VNode, staticRenderFns: js.Array[js.Function0[VNode]]): StaticRenderFns = {
    val __obj = js.Dynamic.literal(render = js.Any.fromFunction1(render), staticRenderFns = staticRenderFns.asInstanceOf[js.Any])
    __obj.asInstanceOf[StaticRenderFns]
  }
  @scala.inline
  implicit class StaticRenderFnsOps[Self <: StaticRenderFns] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setRender(value: CreateElement => VNode): Self = this.set("render", js.Any.fromFunction1(value))
    @scala.inline
    def setStaticRenderFns(value: js.Array[js.Function0[VNode]]): Self = this.set("staticRenderFns", value.asInstanceOf[js.Any])
  }
  
} 
Example 125
Source File: Default.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.anon

import typings.vue.optionsMod.InjectKey
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Default extends js.Object {
  var default: js.UndefOr[js.Any] = js.native
  var from: js.UndefOr[InjectKey] = js.native
}

object Default {
  @scala.inline
  def apply(): Default = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[Default]
  }
  @scala.inline
  implicit class DefaultOps[Self <: Default] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDefault(value: js.Any): Self = this.set("default", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteDefault: Self = this.set("default", js.undefined)
    @scala.inline
    def setFrom(value: InjectKey): Self = this.set("from", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteFrom: Self = this.set("from", js.undefined)
  }
  
} 
Example 126
Source File: Render.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Render extends js.Object {
  var render: js.Function = js.native
  var staticRenderFns: js.Array[js.Function] = js.native
}

object Render {
  @scala.inline
  def apply(render: js.Function, staticRenderFns: js.Array[js.Function]): Render = {
    val __obj = js.Dynamic.literal(render = render.asInstanceOf[js.Any], staticRenderFns = staticRenderFns.asInstanceOf[js.Any])
    __obj.asInstanceOf[Render]
  }
  @scala.inline
  implicit class RenderOps[Self <: Render] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setRender(value: js.Function): Self = this.set("render", value.asInstanceOf[js.Any])
    @scala.inline
    def setStaticRenderFns(value: js.Array[js.Function]): Self = this.set("staticRenderFns", value.asInstanceOf[js.Any])
  }
  
} 
Example 127
Source File: Event.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Event extends js.Object {
  var event: js.UndefOr[String] = js.native
  var prop: js.UndefOr[String] = js.native
}

object Event {
  @scala.inline
  def apply(): Event = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[Event]
  }
  @scala.inline
  implicit class EventOps[Self <: Event] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setEvent(value: String): Self = this.set("event", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteEvent: Self = this.set("event", js.undefined)
    @scala.inline
    def setProp(value: String): Self = this.set("prop", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteProp: Self = this.set("prop", js.undefined)
  }
  
} 
Example 128
Source File: VNodeComponentOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.vnodeMod

import typings.vue.vueMod.Vue
import typings.vue.vueMod.VueConstructor
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait VNodeComponentOptions extends js.Object {
  var Ctor: VueConstructor[Vue] = js.native
  var children: js.UndefOr[VNodeChildren] = js.native
  var listeners: js.UndefOr[js.Object] = js.native
  var propsData: js.UndefOr[js.Object] = js.native
  var tag: js.UndefOr[String] = js.native
}

object VNodeComponentOptions {
  @scala.inline
  def apply(Ctor: VueConstructor[Vue]): VNodeComponentOptions = {
    val __obj = js.Dynamic.literal(Ctor = Ctor.asInstanceOf[js.Any])
    __obj.asInstanceOf[VNodeComponentOptions]
  }
  @scala.inline
  implicit class VNodeComponentOptionsOps[Self <: VNodeComponentOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setCtor(value: VueConstructor[Vue]): Self = this.set("Ctor", value.asInstanceOf[js.Any])
    @scala.inline
    def setChildren(value: VNodeChildren): Self = this.set("children", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteChildren: Self = this.set("children", js.undefined)
    @scala.inline
    def setListeners(value: js.Object): Self = this.set("listeners", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteListeners: Self = this.set("listeners", js.undefined)
    @scala.inline
    def setPropsData(value: js.Object): Self = this.set("propsData", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePropsData: Self = this.set("propsData", js.undefined)
    @scala.inline
    def setTag(value: String): Self = this.set("tag", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteTag: Self = this.set("tag", js.undefined)
  }
  
} 
Example 129
Source File: VNodeDirective.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vue.vnodeMod

import org.scalablytyped.runtime.StringDictionary
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait VNodeDirective extends js.Object {
  val arg: String = js.native
  val expression: js.Any = js.native
  val modifiers: StringDictionary[Boolean] = js.native
  val name: String = js.native
  val oldValue: js.Any = js.native
  val value: js.Any = js.native
}

object VNodeDirective {
  @scala.inline
  def apply(
    arg: String,
    expression: js.Any,
    modifiers: StringDictionary[Boolean],
    name: String,
    oldValue: js.Any,
    value: js.Any
  ): VNodeDirective = {
    val __obj = js.Dynamic.literal(arg = arg.asInstanceOf[js.Any], expression = expression.asInstanceOf[js.Any], modifiers = modifiers.asInstanceOf[js.Any], name = name.asInstanceOf[js.Any], oldValue = oldValue.asInstanceOf[js.Any], value = value.asInstanceOf[js.Any])
    __obj.asInstanceOf[VNodeDirective]
  }
  @scala.inline
  implicit class VNodeDirectiveOps[Self <: VNodeDirective] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setArg(value: String): Self = this.set("arg", value.asInstanceOf[js.Any])
    @scala.inline
    def setExpression(value: js.Any): Self = this.set("expression", value.asInstanceOf[js.Any])
    @scala.inline
    def setModifiers(value: StringDictionary[Boolean]): Self = this.set("modifiers", value.asInstanceOf[js.Any])
    @scala.inline
    def setName(value: String): Self = this.set("name", value.asInstanceOf[js.Any])
    @scala.inline
    def setOldValue(value: js.Any): Self = this.set("oldValue", value.asInstanceOf[js.Any])
    @scala.inline
    def setValue(value: js.Any): Self = this.set("value", value.asInstanceOf[js.Any])
  }
  
} 
Example 130
Source File: Method.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Method extends js.Object {
  var method: String = js.native
}

object Method {
  @scala.inline
  def apply(method: String): Method = {
    val __obj = js.Dynamic.literal(method = method.asInstanceOf[js.Any])
    __obj.asInstanceOf[Method]
  }
  @scala.inline
  implicit class MethodOps[Self <: Method] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setMethod(value: String): Self = this.set("method", value.asInstanceOf[js.Any])
  }
  
} 
Example 131
Source File: Call.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.anon

import typings.vueResource.vuejs.HttpOptions
import typings.vueResource.vuejs.HttpResponse
import typings.vueResource.vuejs.http
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Call extends js.Object {
  @JSName("delete")
  var delete_Original: http = js.native
  @JSName("get")
  var get_Original: http = js.native
  @JSName("jsonp")
  var jsonp_Original: http = js.native
  @JSName("patch")
  var patch_Original: http = js.native
  @JSName("post")
  var post_Original: http = js.native
  @JSName("put")
  var put_Original: http = js.native
  def apply(options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def delete(url: String): js.Thenable[HttpResponse] = js.native
  def delete(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def delete(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def delete(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def get(url: String): js.Thenable[HttpResponse] = js.native
  def get(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def get(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def get(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def patch(url: String): js.Thenable[HttpResponse] = js.native
  def patch(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def patch(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def patch(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def post(url: String): js.Thenable[HttpResponse] = js.native
  def post(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def post(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def post(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def put(url: String): js.Thenable[HttpResponse] = js.native
  def put(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def put(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def put(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
} 
Example 132
Source File: HttpResponse.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import typings.std.Blob
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait HttpResponse extends js.Object {
  var data: js.Object = js.native
  var headers: js.Function = js.native
  var ok: Boolean = js.native
  var status: Double = js.native
  var statusText: String = js.native
  def blob(): Blob = js.native
  def json(): js.Any = js.native
  def text(): String = js.native
}

object HttpResponse {
  @scala.inline
  def apply(
    blob: () => Blob,
    data: js.Object,
    headers: js.Function,
    json: () => js.Any,
    ok: Boolean,
    status: Double,
    statusText: String,
    text: () => String
  ): HttpResponse = {
    val __obj = js.Dynamic.literal(blob = js.Any.fromFunction0(blob), data = data.asInstanceOf[js.Any], headers = headers.asInstanceOf[js.Any], json = js.Any.fromFunction0(json), ok = ok.asInstanceOf[js.Any], status = status.asInstanceOf[js.Any], statusText = statusText.asInstanceOf[js.Any], text = js.Any.fromFunction0(text))
    __obj.asInstanceOf[HttpResponse]
  }
  @scala.inline
  implicit class HttpResponseOps[Self <: HttpResponse] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setBlob(value: () => Blob): Self = this.set("blob", js.Any.fromFunction0(value))
    @scala.inline
    def setData(value: js.Object): Self = this.set("data", value.asInstanceOf[js.Any])
    @scala.inline
    def setHeaders(value: js.Function): Self = this.set("headers", value.asInstanceOf[js.Any])
    @scala.inline
    def setJson(value: () => js.Any): Self = this.set("json", js.Any.fromFunction0(value))
    @scala.inline
    def setOk(value: Boolean): Self = this.set("ok", value.asInstanceOf[js.Any])
    @scala.inline
    def setStatus(value: Double): Self = this.set("status", value.asInstanceOf[js.Any])
    @scala.inline
    def setStatusText(value: String): Self = this.set("statusText", value.asInstanceOf[js.Any])
    @scala.inline
    def setText(value: () => String): Self = this.set("text", js.Any.fromFunction0(value))
  }
  
} 
Example 133
Source File: ComponentOption.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import typings.vueResource.anon.headersHttpHeaderskeystri
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ComponentOption extends js.Object {
  var http: js.UndefOr[headersHttpHeaderskeystri] = js.native
}

object ComponentOption {
  @scala.inline
  def apply(): ComponentOption = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[ComponentOption]
  }
  @scala.inline
  implicit class ComponentOptionOps[Self <: ComponentOption] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setHttp(value: headersHttpHeaderskeystri): Self = this.set("http", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteHttp: Self = this.set("http", js.undefined)
  }
  
} 
Example 134
Source File: ResourceActions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import typings.vueResource.anon.Method
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ResourceActions extends js.Object {
  var delete: Method = js.native
  var get: Method = js.native
  var query: Method = js.native
  var remove: Method = js.native
  var save: Method = js.native
  var update: Method = js.native
}

object ResourceActions {
  @scala.inline
  def apply(delete: Method, get: Method, query: Method, remove: Method, save: Method, update: Method): ResourceActions = {
    val __obj = js.Dynamic.literal(delete = delete.asInstanceOf[js.Any], get = get.asInstanceOf[js.Any], query = query.asInstanceOf[js.Any], remove = remove.asInstanceOf[js.Any], save = save.asInstanceOf[js.Any], update = update.asInstanceOf[js.Any])
    __obj.asInstanceOf[ResourceActions]
  }
  @scala.inline
  implicit class ResourceActionsOps[Self <: ResourceActions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDelete(value: Method): Self = this.set("delete", value.asInstanceOf[js.Any])
    @scala.inline
    def setGet(value: Method): Self = this.set("get", value.asInstanceOf[js.Any])
    @scala.inline
    def setQuery(value: Method): Self = this.set("query", value.asInstanceOf[js.Any])
    @scala.inline
    def setRemove(value: Method): Self = this.set("remove", value.asInstanceOf[js.Any])
    @scala.inline
    def setSave(value: Method): Self = this.set("save", value.asInstanceOf[js.Any])
    @scala.inline
    def setUpdate(value: Method): Self = this.set("update", value.asInstanceOf[js.Any])
  }
  
} 
Example 135
Source File: ResourceMethods.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ResourceMethods extends js.Object {
  @JSName("delete")
  var delete_Original: ResourceMethod = js.native
  @JSName("get")
  var get_Original: ResourceMethod = js.native
  @JSName("query")
  var query_Original: ResourceMethod = js.native
  @JSName("remove")
  var remove_Original: ResourceMethod = js.native
  @JSName("save")
  var save_Original: ResourceMethod = js.native
  @JSName("update")
  var update_Original: ResourceMethod = js.native
  def delete(): js.Thenable[HttpResponse] = js.native
  def delete(params: js.Any): js.Thenable[HttpResponse] = js.native
  def delete(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def delete(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def delete(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def delete(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def delete(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def delete(success: js.Function): js.Thenable[HttpResponse] = js.native
  def delete(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def get(): js.Thenable[HttpResponse] = js.native
  def get(params: js.Any): js.Thenable[HttpResponse] = js.native
  def get(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def get(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def get(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def get(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def get(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def get(success: js.Function): js.Thenable[HttpResponse] = js.native
  def get(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def query(): js.Thenable[HttpResponse] = js.native
  def query(params: js.Any): js.Thenable[HttpResponse] = js.native
  def query(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def query(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def query(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def query(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def query(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def query(success: js.Function): js.Thenable[HttpResponse] = js.native
  def query(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def remove(): js.Thenable[HttpResponse] = js.native
  def remove(params: js.Any): js.Thenable[HttpResponse] = js.native
  def remove(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def remove(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def remove(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def remove(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def remove(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def remove(success: js.Function): js.Thenable[HttpResponse] = js.native
  def remove(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def save(): js.Thenable[HttpResponse] = js.native
  def save(params: js.Any): js.Thenable[HttpResponse] = js.native
  def save(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def save(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def save(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def save(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def save(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def save(success: js.Function): js.Thenable[HttpResponse] = js.native
  def save(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def update(): js.Thenable[HttpResponse] = js.native
  def update(params: js.Any): js.Thenable[HttpResponse] = js.native
  def update(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def update(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def update(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def update(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def update(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def update(success: js.Function): js.Thenable[HttpResponse] = js.native
  def update(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
} 
Example 136
Source File: Http_.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import typings.vueResource.anon.HttpOptionsrootstring
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Http_ extends js.Object {
  @JSName("delete")
  var delete_Original: http = js.native
  @JSName("get")
  var get_Original: http = js.native
  var headers: HttpHeaders = js.native
  var interceptors: js.Array[HttpInterceptor | js.Function0[HttpInterceptor]] = js.native
  @JSName("jsonp")
  var jsonp_Original: http = js.native
  var options: HttpOptionsrootstring = js.native
  @JSName("patch")
  var patch_Original: http = js.native
  @JSName("post")
  var post_Original: http = js.native
  @JSName("put")
  var put_Original: http = js.native
  def delete(url: String): js.Thenable[HttpResponse] = js.native
  def delete(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def delete(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def delete(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def get(url: String): js.Thenable[HttpResponse] = js.native
  def get(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def get(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def get(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def jsonp(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def patch(url: String): js.Thenable[HttpResponse] = js.native
  def patch(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def patch(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def patch(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def post(url: String): js.Thenable[HttpResponse] = js.native
  def post(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def post(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def post(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def put(url: String): js.Thenable[HttpResponse] = js.native
  def put(url: String, data: js.Any): js.Thenable[HttpResponse] = js.native
  def put(url: String, data: js.Any, options: HttpOptions): js.Thenable[HttpResponse] = js.native
  def put(url: String, options: HttpOptions): js.Thenable[HttpResponse] = js.native
} 
Example 137
Source File: ResourceMethod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ResourceMethod extends js.Object {
  def apply(): js.Thenable[HttpResponse] = js.native
  def apply(params: js.Any): js.Thenable[HttpResponse] = js.native
  def apply(params: js.Any, data: js.Any): js.Thenable[HttpResponse] = js.native
  def apply(params: js.Any, data: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def apply(params: js.Any, data: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def apply(params: js.Any, success: js.Function): js.Thenable[HttpResponse] = js.native
  def apply(params: js.Any, success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
  def apply(success: js.Function): js.Thenable[HttpResponse] = js.native
  def apply(success: js.Function, error: js.Function): js.Thenable[HttpResponse] = js.native
} 
Example 138
Source File: HttpHeaders.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import org.scalablytyped.runtime.StringDictionary
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait HttpHeaders
  extends  StringDictionary[js.Any] {
  var common: js.UndefOr[StringDictionary[String]] = js.native
  var custom: js.UndefOr[StringDictionary[String]] = js.native
  var delete: js.UndefOr[StringDictionary[String]] = js.native
  var patch: js.UndefOr[StringDictionary[String]] = js.native
  var post: js.UndefOr[StringDictionary[String]] = js.native
  var put: js.UndefOr[StringDictionary[String]] = js.native
}

object HttpHeaders {
  @scala.inline
  def apply(): HttpHeaders = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[HttpHeaders]
  }
  @scala.inline
  implicit class HttpHeadersOps[Self <: HttpHeaders] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setCommon(value: StringDictionary[String]): Self = this.set("common", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteCommon: Self = this.set("common", js.undefined)
    @scala.inline
    def setCustom(value: StringDictionary[String]): Self = this.set("custom", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteCustom: Self = this.set("custom", js.undefined)
    @scala.inline
    def setDelete(value: StringDictionary[String]): Self = this.set("delete", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteDelete: Self = this.set("delete", js.undefined)
    @scala.inline
    def setPatch(value: StringDictionary[String]): Self = this.set("patch", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePatch: Self = this.set("patch", js.undefined)
    @scala.inline
    def setPost(value: StringDictionary[String]): Self = this.set("post", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePost: Self = this.set("post", js.undefined)
    @scala.inline
    def setPut(value: StringDictionary[String]): Self = this.set("put", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePut: Self = this.set("put", js.undefined)
  }
  
} 
Example 139
Source File: VueStatic.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait VueStatic extends js.Object {
  var http: Http_ = js.native
  var resource: Resource_ = js.native
}

object VueStatic {
  @scala.inline
  def apply(http: Http_, resource: Resource_): VueStatic = {
    val __obj = js.Dynamic.literal(http = http.asInstanceOf[js.Any], resource = resource.asInstanceOf[js.Any])
    __obj.asInstanceOf[VueStatic]
  }
  @scala.inline
  implicit class VueStaticOps[Self <: VueStatic] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setHttp(value: Http_): Self = this.set("http", value.asInstanceOf[js.Any])
    @scala.inline
    def setResource(value: Resource_): Self = this.set("resource", value.asInstanceOf[js.Any])
  }
  
} 
Example 140
Source File: HttpOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait HttpOptions extends js.Object {
  var before: js.UndefOr[js.Function1[ js.Any => _): Self = this.set("progress", js.Any.fromFunction1(value))
    @scala.inline
    def deleteProgress: Self = this.set("progress", js.undefined)
    @scala.inline
    def setUrl(value: String): Self = this.set("url", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteUrl: Self = this.set("url", js.undefined)
  }
  
} 
Example 141
Source File: Vue.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueResource.vuejs

import typings.vueResource.anon.Call
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Vue extends js.Object {
  @JSName("$http")
  var $http_Original: Call = js.native
  @JSName("$resource")
  var $resource_Original: resource = js.native
  @JSName("$http")
  def $http(options: HttpOptions): js.Thenable[HttpResponse] = js.native
  @JSName("$resource")
  def $resource(url: String): ResourceMethods = js.native
  @JSName("$resource")
  def $resource(url: String, params: js.Object): ResourceMethods = js.native
  @JSName("$resource")
  def $resource(url: String, params: js.Object, actions: js.Any): ResourceMethods = js.native
  @JSName("$resource")
  def $resource(url: String, params: js.Object, actions: js.Any, options: HttpOptions): ResourceMethods = js.native
} 
Example 142
Source File: ^.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueScrollto.mod

import typings.vue.pluginMod.PluginFunction
import typings.vue.vueMod.Vue
import typings.vue.vueMod.VueConstructor
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("vue-scrollto", JSImport.Namespace)
@js.native
class ^ () extends VueScrollTo

@JSImport("vue-scrollto", JSImport.Namespace)
@js.native
object ^ extends js.Object {
  @JSName("install")
  var install_Original: PluginFunction[scala.Nothing] = js.native
  def install(Vue: VueConstructor[Vue]): Unit = js.native
  def install(Vue: VueConstructor[Vue], options: scala.Nothing): Unit = js.native
} 
Example 143
Source File: vueTypesVueAugmentingMod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueScrollto.mod

import typings.std.Element
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("vue/types/vue", JSImport.Namespace)
@js.native
object vueTypesVueAugmentingMod extends js.Object {
  @js.native
  trait Vue extends js.Object {
    @JSName("$scrollTo")
    var $scrollTo_Original: VueStatic = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: String): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: String, duration: Double): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: String, duration: Double, options: Options): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: String, options: Options): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: Element): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: Element, duration: Double): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: Element, duration: Double, options: Options): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(element: Element, options: Options): Unit = js.native
    @JSName("$scrollTo")
    def $scrollTo(options: Options): Unit = js.native
  }
  
} 
Example 144
Source File: VueStatic.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueScrollto.mod

import typings.std.Element
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait VueStatic extends js.Object {
  def apply(element: String): Unit = js.native
  def apply(element: String, duration: Double): Unit = js.native
  def apply(element: String, duration: Double, options: Options): Unit = js.native
  def apply(element: String, options: Options): Unit = js.native
  def apply(element: Element): Unit = js.native
  def apply(element: Element, duration: Double): Unit = js.native
  def apply(element: Element, duration: Double, options: Options): Unit = js.native
  def apply(element: Element, options: Options): Unit = js.native
  def apply(options: Options): Unit = js.native
} 
Example 145
Source File: VueScrollTo.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.vueScrollto.mod

import typings.std.Element
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait VueScrollTo extends js.Object {
  @JSName("scrollTo")
  var scrollTo_Original: VueStatic = js.native
  def scrollTo(element: String): Unit = js.native
  def scrollTo(element: String, duration: Double): Unit = js.native
  def scrollTo(element: String, duration: Double, options: Options): Unit = js.native
  def scrollTo(element: String, options: Options): Unit = js.native
  def scrollTo(element: Element): Unit = js.native
  def scrollTo(element: Element, duration: Double): Unit = js.native
  def scrollTo(element: Element, duration: Double, options: Options): Unit = js.native
  def scrollTo(element: Element, options: Options): Unit = js.native
  def scrollTo(options: Options): Unit = js.native
} 
Example 146
Source File: Kind.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.storybookVue.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Kind extends js.Object {
  var kind: String = js.native
  var story: String = js.native
}

object Kind {
  @scala.inline
  def apply(kind: String, story: String): Kind = {
    val __obj = js.Dynamic.literal(kind = kind.asInstanceOf[js.Any], story = story.asInstanceOf[js.Any])
    __obj.asInstanceOf[Kind]
  }
  @scala.inline
  implicit class KindOps[Self <: Kind] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setKind(value: String): Self = this.set("kind", value.asInstanceOf[js.Any])
    @scala.inline
    def setStory(value: String): Self = this.set("story", value.asInstanceOf[js.Any])
  }
  
} 
Example 147
Source File: Story.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.storybookVue.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Story extends js.Object {
  val kind: String = js.native
  def add(storyName: String, getStory: StoryFunction): this.type = js.native
  def addDecorator(decorator: StoryDecorator): this.type = js.native
}

object Story {
  @scala.inline
  def apply(add: (String, StoryFunction) => Story, addDecorator: StoryDecorator => Story, kind: String): Story = {
    val __obj = js.Dynamic.literal(add = js.Any.fromFunction2(add), addDecorator = js.Any.fromFunction1(addDecorator), kind = kind.asInstanceOf[js.Any])
    __obj.asInstanceOf[Story]
  }
  @scala.inline
  implicit class StoryOps[Self <: Story] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAdd(value: (String, StoryFunction) => Story): Self = this.set("add", js.Any.fromFunction2(value))
    @scala.inline
    def setAddDecorator(value: StoryDecorator => Story): Self = this.set("addDecorator", js.Any.fromFunction1(value))
    @scala.inline
    def setKind(value: String): Self = this.set("kind", value.asInstanceOf[js.Any])
  }
  
} 
Example 148
Source File: StoryStore.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.storybookVue.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait StoryStore extends js.Object {
  var fileName: js.UndefOr[String] = js.native
  var kind: String = js.native
  var stories: js.Array[StoryObject] = js.native
}

object StoryStore {
  @scala.inline
  def apply(kind: String, stories: js.Array[StoryObject]): StoryStore = {
    val __obj = js.Dynamic.literal(kind = kind.asInstanceOf[js.Any], stories = stories.asInstanceOf[js.Any])
    __obj.asInstanceOf[StoryStore]
  }
  @scala.inline
  implicit class StoryStoreOps[Self <: StoryStore] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setKind(value: String): Self = this.set("kind", value.asInstanceOf[js.Any])
    @scala.inline
    def setStories(value: js.Array[StoryObject]): Self = this.set("stories", value.asInstanceOf[js.Any])
    @scala.inline
    def setFileName(value: String): Self = this.set("fileName", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteFileName: Self = this.set("fileName", js.undefined)
  }
  
} 
Example 149
Source File: StoryObject.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.storybookVue.mod

import typings.vue.optionsMod.ComponentOptions
import typings.vue.optionsMod.DefaultComputed
import typings.vue.optionsMod.DefaultData
import typings.vue.optionsMod.DefaultMethods
import typings.vue.optionsMod.DefaultProps
import typings.vue.optionsMod.PropsDefinition
import typings.vue.vueMod.Vue
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait StoryObject extends js.Object {
  var name: String = js.native
  @JSName("render")
  var render_Original: StoryFunction = js.native
  def render(): (ComponentOptions[
    Vue, 
    DefaultData[Vue], 
    DefaultMethods[Vue], 
    DefaultComputed, 
    PropsDefinition[DefaultProps]
  ]) | String = js.native
} 
Example 150
Source File: package.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.storybookVue

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

package object mod {
  type Addon = org.scalablytyped.runtime.StringDictionary[
    js.Function2[
       typings.storybookVue.anon.Kind, 
    (typings.vue.optionsMod.ComponentOptions[
      typings.vue.vueMod.Vue, 
      typings.vue.optionsMod.DefaultData[typings.vue.vueMod.Vue], 
      typings.vue.optionsMod.DefaultMethods[typings.vue.vueMod.Vue], 
      typings.vue.optionsMod.DefaultComputed, 
      typings.vue.optionsMod.PropsDefinition[typings.vue.optionsMod.DefaultProps]
    ]) | scala.Null
  ]
  type StoryFunction = js.Function0[
    (typings.vue.optionsMod.ComponentOptions[
      typings.vue.vueMod.Vue, 
      typings.vue.optionsMod.DefaultData[typings.vue.vueMod.Vue], 
      typings.vue.optionsMod.DefaultMethods[typings.vue.vueMod.Vue], 
      typings.vue.optionsMod.DefaultComputed, 
      typings.vue.optionsMod.PropsDefinition[typings.vue.optionsMod.DefaultProps]
    ]) | java.lang.String
  ]
} 
Example 151
Source File: ErrnoException.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.node.NodeJS

import typings.node.Error
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ErrnoException extends Error {
  var code: js.UndefOr[String] = js.native
  var errno: js.UndefOr[Double] = js.native
  var path: js.UndefOr[String] = js.native
  var syscall: js.UndefOr[String] = js.native
}

object ErrnoException {
  @scala.inline
  def apply(): ErrnoException = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[ErrnoException]
  }
  @scala.inline
  implicit class ErrnoExceptionOps[Self <: ErrnoException] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setCode(value: String): Self = this.set("code", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteCode: Self = this.set("code", js.undefined)
    @scala.inline
    def setErrno(value: Double): Self = this.set("errno", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteErrno: Self = this.set("errno", js.undefined)
    @scala.inline
    def setPath(value: String): Self = this.set("path", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePath: Self = this.set("path", js.undefined)
    @scala.inline
    def setSyscall(value: String): Self = this.set("syscall", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteSyscall: Self = this.set("syscall", js.undefined)
  }
  
} 
Example 152
Source File: SymbolConstructor.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.node

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait SymbolConstructor extends js.Object {
  val asyncIterator: js.Symbol = js.native
  val iterator: js.Symbol = js.native
}

object SymbolConstructor {
  @scala.inline
  def apply(asyncIterator: js.Symbol, iterator: js.Symbol): SymbolConstructor = {
    val __obj = js.Dynamic.literal(asyncIterator = asyncIterator.asInstanceOf[js.Any], iterator = iterator.asInstanceOf[js.Any])
    __obj.asInstanceOf[SymbolConstructor]
  }
  @scala.inline
  implicit class SymbolConstructorOps[Self <: SymbolConstructor] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAsyncIterator(value: js.Symbol): Self = this.set("asyncIterator", value.asInstanceOf[js.Any])
    @scala.inline
    def setIterator(value: js.Symbol): Self = this.set("iterator", value.asInstanceOf[js.Any])
  }
  
} 
Example 153
Source File: Error.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.node

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Error extends js.Object {
  var stack: js.UndefOr[String] = js.native
}

object Error {
  @scala.inline
  def apply(): Error = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[Error]
  }
  @scala.inline
  implicit class ErrorOps[Self <: Error] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setStack(value: String): Self = this.set("stack", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteStack: Self = this.set("stack", js.undefined)
  }
  
} 
Example 154
Source File: streamMod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.node

import typings.node.NodeJS.ReadableStream
import typings.node.NodeJS.WritableStream
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("stream", JSImport.Namespace)
@js.native
object streamMod extends js.Object {
   @js.native
  class Duplex () extends Readable {
    var writable: Boolean = js.native
    def end(): Unit = js.native
    def end(cb: js.Function): Unit = js.native
    def end(chunk: js.Any): Unit = js.native
    def end(chunk: js.Any, cb: js.Function): Unit = js.native
    def end(chunk: js.Any, encoding: String): Unit = js.native
    def end(chunk: js.Any, encoding: String, cb: js.Function): Unit = js.native
    def end(str: String): Unit = js.native
    def end(str: String, encoding: String): Unit = js.native
    def end(str: String, encoding: String, cb: js.Function): Unit = js.native
  }
  
  @js.native
  class Readable ()
    extends Stream
       with ReadableStream {
    def read(): String = js.native
    def read(size: Double): String = js.native
  }
  
  @js.native
  class Stream () extends js.Object
  
  @js.native
  class Writable ()
    extends Stream
       with WritableStream {
    def end(str: String): Unit = js.native
    def end(str: String, encoding: String): Unit = js.native
    def end(str: String, encoding: String, cb: js.Function): Unit = js.native
  }
  
} 
Example 155
Source File: global.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.node

import typings.node.NodeJS.Process
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSGlobalScope
@js.native
object global extends js.Object {
  var process: Process = js.native
  @js.native
  object NodeJS extends js.Object {
    @js.native
    class EventEmitter ()
      extends typings.node.NodeJS.EventEmitter
    
  }
  
  @js.native
  object Symbol extends SymbolConstructor
  
} 
Example 156
Source File: MainInterface.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.electron.Electron

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait MainInterface extends CommonInterface {
  var app: App = js.native
}

object MainInterface {
  @scala.inline
  def apply(app: App): MainInterface = {
    val __obj = js.Dynamic.literal(app = app.asInstanceOf[js.Any])
    __obj.asInstanceOf[MainInterface]
  }
  @scala.inline
  implicit class MainInterfaceOps[Self <: MainInterface] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setApp(value: App): Self = this.set("app", value.asInstanceOf[js.Any])
  }
  
} 
Example 157
Source File: App.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.electron.Electron

import typings.electron.electronStrings.`accessibility-support-changed`
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait App extends EventEmitter {
  // Docs: http://electron.atom.io/docs/api/app
  
  @JSName("on")
  def on_accessibilitysupportchanged(event: `accessibility-support-changed`, listener: js.Any): String = js.native
}

object App {
  @scala.inline
  def apply(addListener: (String, js.Function) => App, on: (`accessibility-support-changed`, js.Any) => String): App = {
    val __obj = js.Dynamic.literal(addListener = js.Any.fromFunction2(addListener), on = js.Any.fromFunction2(on))
    __obj.asInstanceOf[App]
  }
  @scala.inline
  implicit class AppOps[Self <: App] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setOn(value: (`accessibility-support-changed`, js.Any) => String): Self = this.set("on", js.Any.fromFunction2(value))
  }
  
} 
Example 158
Source File: Event.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.electron.Electron

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Event
  extends typings.std.Event {
  var altKey: js.UndefOr[Boolean] = js.native
  var ctrlKey: js.UndefOr[Boolean] = js.native
  var metaKey: js.UndefOr[Boolean] = js.native
  var returnValue: js.Any = js.native
  var shiftKey: js.UndefOr[Boolean] = js.native
  def preventDefault(): Unit = js.native
}

object Event {
  @scala.inline
  def apply(preventDefault: () => Unit, returnValue: js.Any): Event = {
    val __obj = js.Dynamic.literal(preventDefault = js.Any.fromFunction0(preventDefault), returnValue = returnValue.asInstanceOf[js.Any])
    __obj.asInstanceOf[Event]
  }
  @scala.inline
  implicit class EventOps[Self <: Event] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setPreventDefault(value: () => Unit): Self = this.set("preventDefault", js.Any.fromFunction0(value))
    @scala.inline
    def setReturnValue(value: js.Any): Self = this.set("returnValue", value.asInstanceOf[js.Any])
    @scala.inline
    def setAltKey(value: Boolean): Self = this.set("altKey", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAltKey: Self = this.set("altKey", js.undefined)
    @scala.inline
    def setCtrlKey(value: Boolean): Self = this.set("ctrlKey", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteCtrlKey: Self = this.set("ctrlKey", js.undefined)
    @scala.inline
    def setMetaKey(value: Boolean): Self = this.set("metaKey", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteMetaKey: Self = this.set("metaKey", js.undefined)
    @scala.inline
    def setShiftKey(value: Boolean): Self = this.set("shiftKey", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteShiftKey: Self = this.set("shiftKey", js.undefined)
  }
  
} 
Example 159
Source File: EventEmitter.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.electron.Electron

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait EventEmitter extends js.Object {
  def addListener(event: String, listener: js.Function): this.type = js.native
}

object EventEmitter {
  @scala.inline
  def apply(addListener: (String, js.Function) => EventEmitter): EventEmitter = {
    val __obj = js.Dynamic.literal(addListener = js.Any.fromFunction2(addListener))
    __obj.asInstanceOf[EventEmitter]
  }
  @scala.inline
  implicit class EventEmitterOps[Self <: EventEmitter] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAddListener(value: (String, js.Function) => EventEmitter): Self = this.set("addListener", js.Any.fromFunction2(value))
  }
  
} 
Example 160
Source File: electronStrings.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.electron

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

object electronStrings {
  @js.native
  sealed trait Bar extends js.Object
  
  @js.native
  sealed trait `accessibility-support-changed` extends js.Object
  
  @js.native
  sealed trait bar_ extends js.Object
  
  @scala.inline
  def Bar: Bar = "Bar".asInstanceOf[Bar]
  @scala.inline
  def `accessibility-support-changed`: `accessibility-support-changed` = "accessibility-support-changed".asInstanceOf[`accessibility-support-changed`]
  @scala.inline
  def bar_ : bar_ = "bar".asInstanceOf[bar_]
} 
Example 161
Source File: global.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.electron

import typings.electron.Electron.App
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSGlobalScope
@js.native
object global extends js.Object {
  @js.native
  object Electron extends js.Object {
    @js.native
    class EventEmitter ()
      extends typings.electron.Electron.EventEmitter
    
    val app: App = js.native
  }
  
} 
Example 162
Source File: Options.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.stylis.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Options extends js.Object {
  var cascade: js.UndefOr[Boolean] = js.native
  var compress: js.UndefOr[Boolean] = js.native
  var global: js.UndefOr[Boolean] = js.native
  var keyframe: js.UndefOr[Boolean] = js.native
  var prefix: js.UndefOr[
    Boolean | (js.Function3[ Double, Boolean])
    ): Self = this.set("prefix", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePrefix: Self = this.set("prefix", js.undefined)
    @scala.inline
    def setPreserve(value: Boolean): Self = this.set("preserve", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePreserve: Self = this.set("preserve", js.undefined)
    @scala.inline
    def setSemicolon(value: Boolean): Self = this.set("semicolon", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteSemicolon: Self = this.set("semicolon", js.undefined)
  }
  
} 
Example 163
Source File: Stylis.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.stylis.mod

import org.scalablytyped.runtime.Instantiable0
import org.scalablytyped.runtime.Instantiable1
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Stylis
  extends Instantiable0[Stylis]
     with Instantiable1[ Options, Stylis] {
  @JSName("set")
  var set_Original: Set = js.native
  @JSName("use")
  var use_Original: Use = js.native
  def apply(namescope: String, input: String): String | js.Any = js.native
  def set(): Set = js.native
  def set(options: Options): Set = js.native
  def use(): Use = js.native
  def use(plugin: js.Array[Plugin]): Use = js.native
  def use(plugin: Plugin): Use = js.native
} 
Example 164
Source File: Context.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.stylis.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
sealed trait Context extends js.Object

@JSImport("stylis/stylis", "Context")
@js.native
object Context extends js.Object {
  @js.native
  sealed trait ATRUL extends Context
  
  @js.native
  sealed trait BLCKS extends Context
  
  @js.native
  sealed trait POSTS extends Context
  
  @js.native
  sealed trait PREPS extends Context
  
  @js.native
  sealed trait PROPS extends Context
  
  @js.native
  sealed trait UNKWN extends Context
  
} 
Example 165
Source File: global.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.stylis.mod

import org.scalablytyped.runtime.TopLevel
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSGlobalScope
@js.native
object global extends js.Object {
  @js.native
  class stylis () extends Stylis {
    def this(options: Options) = this()
  }
  
  @js.native
  object stylis extends TopLevel[Stylis]
  
} 
Example 166
Source File: Default_.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.fullcalendar.eventPeriodMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("fullcalendar/EventPeriod", "Default")
@js.native
class Default_ protected () extends js.Object {
  def this(start: js.Any, end: js.Any, timezone: js.Any) = this()
  var eventInstanceGroupsById: js.Any = js.native
  var freezeDepth: Double = js.native
  @JSName("on")
  var on_Original: js.Function2[ js.Any, _] = js.native
  var pendingCnt: Double = js.native
  var requestsByUid: js.Any = js.native
  def isWithinRange(start: js.Any, end: js.Any): Boolean = js.native
  def on(types: js.Any, handler: js.Any): js.Any = js.native
  def thaw(): Unit = js.native
} 
Example 167
Source File: EmitterInterface.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.fullcalendar.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait EmitterInterface extends js.Object {
  def on(types: js.Any, handler: js.Any): js.Any = js.native
}

object EmitterInterface {
  @scala.inline
  def apply(on: (js.Any, js.Any) => js.Any): EmitterInterface = {
    val __obj = js.Dynamic.literal(on = js.Any.fromFunction2(on))
    __obj.asInstanceOf[EmitterInterface]
  }
  @scala.inline
  implicit class EmitterInterfaceOps[Self <: EmitterInterface] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setOn(value: (js.Any, js.Any) => js.Any): Self = this.set("on", js.Any.fromFunction2(value))
  }
  
} 
Example 168
Source File: mod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.firebaseAdmin

import typings.googleCloudFirestore.FirebaseFirestore.Settings
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("firebase-admin", JSImport.Namespace)
@js.native
object mod extends js.Object {
  @js.native
  object firestore extends js.Object {
    @js.native
    
    class Firestore ()
      extends typings.googleCloudFirestore.FirebaseFirestore.Firestore {
      def this(settings: Settings) = this()
    }
    
    def apply(): Firestore = js.native
    def apply(str: String): Firestore = js.native
  }
  
} 
Example 169
Source File: global.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.googleCloudFirestore

import typings.googleCloudFirestore.FirebaseFirestore.Settings
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSGlobalScope
@js.native
object global extends js.Object {
  @js.native
  object FirebaseFirestore extends js.Object {
    @js.native
    
    class Firestore ()
      extends typings.googleCloudFirestore.FirebaseFirestore.Firestore {
      def this(settings: Settings) = this()
    }
    
  }
  
} 
Example 170
Source File: Settings.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.googleCloudFirestore.FirebaseFirestore

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Settings extends js.Object {
  var projectId: js.UndefOr[String] = js.native
}

object Settings {
  @scala.inline
  def apply(): Settings = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[Settings]
  }
  @scala.inline
  implicit class SettingsOps[Self <: Settings] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setProjectId(value: String): Self = this.set("projectId", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteProjectId: Self = this.set("projectId", js.undefined)
  }
  
} 
Example 171
Source File: Firestore.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.googleCloudFirestore.FirebaseFirestore

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Firestore extends js.Object {
  
  def settings(settings: Settings): Unit = js.native
}

object Firestore {
  @scala.inline
  def apply(settings: Settings => Unit): Firestore = {
    val __obj = js.Dynamic.literal(settings = js.Any.fromFunction1(settings))
    __obj.asInstanceOf[Firestore]
  }
  @scala.inline
  implicit class FirestoreOps[Self <: Firestore] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setSettings(value: Settings => Unit): Self = this.set("settings", js.Any.fromFunction1(value))
  }
  
} 
Example 172
Source File: observableMod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.rxjs

import typings.rxjs.typesMod.OperatorFunction
import typings.rxjs.typesMod.Subscribable
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("rxjs/internal/Observable", JSImport.Namespace)
@js.native
object observableMod extends js.Object {
  @js.native
  class Observable[T] () extends Subscribable[T] {
    
    var source: Observable[_] = js.native
    def foo(source: Observable[Double]): Observable[String] = js.native
    def pipe(): Observable[T] = js.native
  }
  
} 
Example 173
Source File: PartialObserver.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.rxjs.typesMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._


trait PartialObserver[T] extends js.Object

object PartialObserver {
  @scala.inline
  def NextObserver[T](next: T => Unit): PartialObserver[T] = {
    val __obj = js.Dynamic.literal(next = js.Any.fromFunction1(next))
    __obj.asInstanceOf[PartialObserver[T]]
  }
  @scala.inline
  def ErrorObserver[T](error: js.Any => Unit): PartialObserver[T] = {
    val __obj = js.Dynamic.literal(error = js.Any.fromFunction1(error))
    __obj.asInstanceOf[PartialObserver[T]]
  }
  @scala.inline
  def CompletionObserver[T](complete: () => Unit): PartialObserver[T] = {
    val __obj = js.Dynamic.literal(complete = js.Any.fromFunction0(complete))
    __obj.asInstanceOf[PartialObserver[T]]
  }
} 
Example 174
Source File: SubscriptionLike.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.rxjs.typesMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait SubscriptionLike extends Unsubscribable {
  val closed: Boolean = js.native
}

object SubscriptionLike {
  @scala.inline
  def apply(closed: Boolean, unsubscribe: () => Unit): SubscriptionLike = {
    val __obj = js.Dynamic.literal(closed = closed.asInstanceOf[js.Any], unsubscribe = js.Any.fromFunction0(unsubscribe))
    __obj.asInstanceOf[SubscriptionLike]
  }
  @scala.inline
  implicit class SubscriptionLikeOps[Self <: SubscriptionLike] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setClosed(value: Boolean): Self = this.set("closed", value.asInstanceOf[js.Any])
  }
  
} 
Example 175
Source File: Unsubscribable.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.rxjs.typesMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Unsubscribable extends js.Object {
  def unsubscribe(): Unit = js.native
}

object Unsubscribable {
  @scala.inline
  def apply(unsubscribe: () => Unit): Unsubscribable = {
    val __obj = js.Dynamic.literal(unsubscribe = js.Any.fromFunction0(unsubscribe))
    __obj.asInstanceOf[Unsubscribable]
  }
  @scala.inline
  implicit class UnsubscribableOps[Self <: Unsubscribable] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setUnsubscribe(value: () => Unit): Self = this.set("unsubscribe", js.Any.fromFunction0(value))
  }
  
} 
Example 176
Source File: Observer.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.rxjs.typesMod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Observer[T] extends js.Object {
  var closed: js.UndefOr[Boolean] = js.native
  def complete(): Unit = js.native
  def error(err: js.Any): Unit = js.native
  def next(value: T): Unit = js.native
}

object Observer {
  @scala.inline
  def apply[T](complete: () => Unit, error: js.Any => Unit, next: T => Unit): Observer[T] = {
    val __obj = js.Dynamic.literal(complete = js.Any.fromFunction0(complete), error = js.Any.fromFunction1(error), next = js.Any.fromFunction1(next))
    __obj.asInstanceOf[Observer[T]]
  }
  @scala.inline
  implicit class ObserverOps[Self <: Observer[_], T] (val x: Self with Observer[T]) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setComplete(value: () => Unit): Self = this.set("complete", js.Any.fromFunction0(value))
    @scala.inline
    def setError(value: js.Any => Unit): Self = this.set("error", js.Any.fromFunction1(value))
    @scala.inline
    def setNext(value: T => Unit): Self = this.set("next", js.Any.fromFunction1(value))
    @scala.inline
    def setClosed(value: Boolean): Self = this.set("closed", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteClosed: Self = this.set("closed", js.undefined)
  }
  
} 
Example 177
Source File: Dictkey.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.chartJs.anon

import org.scalablytyped.runtime.StringDictionary
import typings.chartJs.mod.ChartFontOptions
import typings.chartJs.mod.ChartOptions
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Dictkey
  extends  StringDictionary[js.Any] {
  var global: ChartOptions with ChartFontOptions = js.native
}

object Dictkey {
  @scala.inline
  def apply(global: ChartOptions with ChartFontOptions): Dictkey = {
    val __obj = js.Dynamic.literal(global = global.asInstanceOf[js.Any])
    __obj.asInstanceOf[Dictkey]
  }
  @scala.inline
  implicit class DictkeyOps[Self <: Dictkey] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setGlobal(value: ChartOptions with ChartFontOptions): Self = this.set("global", value.asInstanceOf[js.Any])
  }
  
} 
Example 178
Source File: ^.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.chartJs.mod

import org.scalablytyped.runtime.StringDictionary
import typings.chartJs.anon.Dictkey
import typings.chartJs.anon.TypeofChart
import typings.std.ArrayLike
import typings.std.CanvasRenderingContext2D
import typings.std.HTMLCanvasElement
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("chart.js", JSImport.Namespace)
@js.native
class ^ protected () extends Chart {
  def this(context: String, options: js.Any) = this()
  def this(context: ArrayLike[CanvasRenderingContext2D | HTMLCanvasElement], options: js.Any) = this()
  def this(context: CanvasRenderingContext2D, options: js.Any) = this()
  def this(context: HTMLCanvasElement, options: js.Any) = this()
}

@JSImport("chart.js", JSImport.Namespace)
@js.native
object ^ extends js.Object {
  val Chart: TypeofChart = js.native
  var controllers: StringDictionary[js.Any] = js.native
  var defaults: Dictkey = js.native
} 
Example 179
Source File: ChartFontOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.chartJs.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ChartFontOptions extends js.Object {
  var foo: Boolean = js.native
}

object ChartFontOptions {
  @scala.inline
  def apply(foo: Boolean): ChartFontOptions = {
    val __obj = js.Dynamic.literal(foo = foo.asInstanceOf[js.Any])
    __obj.asInstanceOf[ChartFontOptions]
  }
  @scala.inline
  implicit class ChartFontOptionsOps[Self <: ChartFontOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setFoo(value: Boolean): Self = this.set("foo", value.asInstanceOf[js.Any])
  }
  
} 
Example 180
Source File: Chart.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.chartJs.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Chart extends js.Object {
  var data: ChartData = js.native
  def clear(): js.Object = js.native
  def destroy(): js.Object = js.native
  def generateLegend(): js.Object = js.native
  def getDatasetAtEvent(e: js.Any): js.Array[js.Object] = js.native
  def getElementAtEvent(e: js.Any): js.Object = js.native
  def getElementsAtEvent(e: js.Any): js.Array[js.Object] = js.native
  def render(): js.Object = js.native
  def render(duration: js.Any): js.Object = js.native
  def render(duration: js.Any, `lazy`: js.Any): js.Object = js.native
  def resize(): js.Object = js.native
  def stop(): js.Object = js.native
  def toBase64(): String = js.native
  def update(): js.Object = js.native
  def update(duration: js.Any): js.Object = js.native
  def update(duration: js.Any, `lazy`: js.Any): js.Object = js.native
} 
Example 181
Source File: ChartOptions.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.chartJs.mod

import org.scalablytyped.runtime.StringDictionary
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ChartOptions extends js.Object {
  // Plugins can require any options
  var plugins: js.UndefOr[StringDictionary[js.Any]] = js.native
  var responsive: js.UndefOr[Boolean] = js.native
}

object ChartOptions {
  @scala.inline
  def apply(): ChartOptions = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[ChartOptions]
  }
  @scala.inline
  implicit class ChartOptionsOps[Self <: ChartOptions] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setPlugins(value: StringDictionary[js.Any]): Self = this.set("plugins", value.asInstanceOf[js.Any])
    @scala.inline
    def deletePlugins: Self = this.set("plugins", js.undefined)
    @scala.inline
    def setResponsive(value: Boolean): Self = this.set("responsive", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteResponsive: Self = this.set("responsive", js.undefined)
  }
  
} 
Example 182
Source File: ChartData.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typings.chartJs.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ChartData extends js.Object {
  var labels: js.UndefOr[js.Array[String | js.Array[String]]] = js.native
}

object ChartData {
  @scala.inline
  def apply(): ChartData = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[ChartData]
  }
  @scala.inline
  implicit class ChartDataOps[Self <: ChartData] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setLabels(value: js.Array[String | js.Array[String]]): Self = this.set("labels", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteLabels: Self = this.set("labels", js.undefined)
  }
  
} 
Example 183
Source File: Children.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.react.anon

import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.vdom.VdomNode
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Children extends js.Object {
  var children: js.UndefOr[Node] = js.native
}

object Children {
  @scala.inline
  def apply(): Children = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[Children]
  }
  @scala.inline
  implicit class ChildrenOps[Self <: Children] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setChildren(value: VdomNode): Self = this.set("children", value.rawNode.asInstanceOf[js.Any])
    @scala.inline
    def deleteChildren: Self = this.set("children", js.undefined)
  }
  
} 
Example 184
Source File: Html.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.react.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Html extends js.Object {
  var __html: String = js.native
}

object Html {
  @scala.inline
  def apply(__html: String): Html = {
    val __obj = js.Dynamic.literal(__html = __html.asInstanceOf[js.Any])
    __obj.asInstanceOf[Html]
  }
  @scala.inline
  implicit class HtmlOps[Self <: Html] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def set__html(value: String): Self = this.set("__html", value.asInstanceOf[js.Any])
  }
  
} 
Example 185
Source File: HTMLAttributes.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.react.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait HTMLAttributes[T] extends DOMAttributes[T] {
  var defaultChecked: js.UndefOr[Boolean] = js.native
}

object HTMLAttributes {
  @scala.inline
  def apply[T](): HTMLAttributes[T] = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[HTMLAttributes[T]]
  }
  @scala.inline
  implicit class HTMLAttributesOps[Self <: HTMLAttributes[_], T] (val x: Self with HTMLAttributes[T]) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDefaultChecked(value: Boolean): Self = this.set("defaultChecked", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteDefaultChecked: Self = this.set("defaultChecked", js.undefined)
  }
  
} 
Example 186
Source File: HTMLProps.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.react.mod

import typingsJapgolly.react.reactStrings.foo
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait HTMLProps[T] extends AllHTMLAttributes[T] {
  var defaultValue: foo = js.native
  var onChange: foo = js.native
  var `type`: foo = js.native
  var value: foo = js.native
}

object HTMLProps {
  @scala.inline
  def apply[T](defaultValue: foo, onChange: foo, `type`: foo, value: foo): HTMLProps[T] = {
    val __obj = js.Dynamic.literal(defaultValue = defaultValue.asInstanceOf[js.Any], onChange = onChange.asInstanceOf[js.Any], value = value.asInstanceOf[js.Any])
    __obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
    __obj.asInstanceOf[HTMLProps[T]]
  }
  @scala.inline
  implicit class HTMLPropsOps[Self <: HTMLProps[_], T] (val x: Self with HTMLProps[T]) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setDefaultValue(value: foo): Self = this.set("defaultValue", value.asInstanceOf[js.Any])
    @scala.inline
    def setOnChange(value: foo): Self = this.set("onChange", value.asInstanceOf[js.Any])
    @scala.inline
    def setType(value: foo): Self = this.set("type", value.asInstanceOf[js.Any])
    @scala.inline
    def setValue(value: foo): Self = this.set("value", value.asInstanceOf[js.Any])
  }
  
} 
Example 187
Source File: AllHTMLAttributes.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.react.mod

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait AllHTMLAttributes[T] extends HTMLAttributes[T] {
  var accept: js.UndefOr[String] = js.native
  var acceptCharset: js.UndefOr[String] = js.native
}

object AllHTMLAttributes {
  @scala.inline
  def apply[T](): AllHTMLAttributes[T] = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[AllHTMLAttributes[T]]
  }
  @scala.inline
  implicit class AllHTMLAttributesOps[Self <: AllHTMLAttributes[_], T] (val x: Self with AllHTMLAttributes[T]) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setAccept(value: String): Self = this.set("accept", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAccept: Self = this.set("accept", js.undefined)
    @scala.inline
    def setAcceptCharset(value: String): Self = this.set("acceptCharset", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteAcceptCharset: Self = this.set("acceptCharset", js.undefined)
  }
  
} 
Example 188
Source File: ReactElement.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.react.mod

import japgolly.scalajs.react.raw.React.ComponentClassP
import japgolly.scalajs.react.raw.React.Element
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait ReactElement extends js.Object {
  var key: Key | Null = js.native
  var props: js.Any = js.native
  var `type`: String | ComponentClassP[js.Object] | SFC[_] = js.native
}

object ReactElement {
  @scala.inline
  def apply(props: js.Any, `type`: String | ComponentClassP[js.Object] | SFC[_]): ReactElement = {
    val __obj = js.Dynamic.literal(props = props.asInstanceOf[js.Any])
    __obj.updateDynamic("type")(`type`.asInstanceOf[js.Any])
    __obj.asInstanceOf[ReactElement]
  }
  @scala.inline
  implicit class ReactElementOps[Self <: Element] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setProps(value: js.Any): Self = this.set("props", value.asInstanceOf[js.Any])
    @scala.inline
    def setTypeComponentClass(value: ComponentClassP[js.Object]): Self = this.set("type", value.asInstanceOf[js.Any])
    @scala.inline
    def setType(value: String | ComponentClassP[js.Object] | SFC[_]): Self = this.set("type", value.asInstanceOf[js.Any])
    @scala.inline
    def setKey(value: Key): Self = this.set("key", value.asInstanceOf[js.Any])
    @scala.inline
    def setKeyNull: Self = this.set("key", null)
  }
  
} 
Example 189
Source File: accessibilityMod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi

import typingsJapgolly.react.mod.Component
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("material-ui/svg-icons/action/accessibility", JSImport.Namespace)
@js.native
object accessibilityMod extends js.Object {
  @js.native
  class ActionAccessibility ()
    extends Component[js.Object, js.Object]
  
  @js.native
  class default ()
    extends Component[js.Object, js.Object]
  
} 
Example 190
Source File: BottomNavigationItemProps.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi.MaterialUI.BottomNavigation

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait BottomNavigationItemProps extends js.Object {
  var children: Double = js.native
  var className: js.UndefOr[String] = js.native
}

object BottomNavigationItemProps {
  @scala.inline
  def apply(children: Double): BottomNavigationItemProps = {
    val __obj = js.Dynamic.literal(children = children.asInstanceOf[js.Any])
    __obj.asInstanceOf[BottomNavigationItemProps]
  }
  @scala.inline
  implicit class BottomNavigationItemPropsOps[Self <: BottomNavigationItemProps] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setChildren(value: Double): Self = this.set("children", value.asInstanceOf[js.Any])
    @scala.inline
    def setClassName(value: String): Self = this.set("className", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteClassName: Self = this.set("className", js.undefined)
  }
  
} 
Example 191
Source File: MuiTheme.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi.MaterialUI.Styles

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait MuiTheme extends js.Object {
  var spacing: js.UndefOr[js.Any] = js.native
}

object MuiTheme {
  @scala.inline
  def apply(): MuiTheme = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[MuiTheme]
  }
  @scala.inline
  implicit class MuiThemeOps[Self <: MuiTheme] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setSpacing(value: js.Any): Self = this.set("spacing", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteSpacing: Self = this.set("spacing", js.undefined)
  }
  
} 
Example 192
Source File: MaterialUI.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi.global

import typingsJapgolly.materialUi.MaterialUI.BottomNavigation.BottomNavigationItemProps
import typingsJapgolly.materialUi.MaterialUI.Styles.MuiTheme
import typingsJapgolly.react.mod.Component
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSGlobal("__MaterialUI")
@js.native
object MaterialUI extends js.Object {
  @js.native
  class SvgIcon ()
    extends Component[js.Object, js.Object]
  
  @js.native
  object BottomNavigation extends js.Object {
    @js.native
    class BottomNavigationItem ()
      extends Component[BottomNavigationItemProps, js.Object]
    
  }
  
  @js.native
  object Styles extends js.Object {
    var Transitions: js.Any = js.native
    var Typography: js.Any = js.native
    var a: js.Any = js.native
    var zIndex: js.Any = js.native
    def getMuiTheme(muiTheme: MuiTheme*): MuiTheme = js.native
  }
  
} 
Example 193
Source File: bottomNavigationItemMod.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi

import typingsJapgolly.materialUi.MaterialUI.BottomNavigation.BottomNavigationItemProps
import typingsJapgolly.react.mod.Component
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@JSImport("material-ui/BottomNavigation/BottomNavigationItem", JSImport.Namespace)
@js.native
object bottomNavigationItemMod extends js.Object {
  @js.native
  class BottomNavigationItem ()
    extends Component[BottomNavigationItemProps, js.Object]
  
  @js.native
  class default ()
    extends Component[BottomNavigationItemProps, js.Object]
  
} 
Example 194
Source File: SharedApply_Object_1928072692.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi.components

import japgolly.scalajs.react.Children.Varargs
import japgolly.scalajs.react.CtorType.ChildArg
import japgolly.scalajs.react.JsForwardRefComponent.force
import japgolly.scalajs.react.Key
import japgolly.scalajs.react.component.JsForwardRef.UnmountedWithRoot
import org.scalablytyped.runtime.StringDictionary
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

abstract class SharedApply_Object_1928072692[ComponentRef] () {
  val componentImport: js.Any
  def apply(key: Key = null, _overrides: StringDictionary[js.Any] = null)(children: ChildArg*): UnmountedWithRoot[js.Object, ComponentRef, Unit, js.Object] = {
    val __obj = js.Dynamic.literal()
    if (key != null) __obj.updateDynamic("key")(key.asInstanceOf[js.Any])
    if (_overrides != null) js.Dynamic.global.Object.assign(__obj, _overrides)
    val f = force[js.Object, Varargs, ComponentRef](this.componentImport)
    f(__obj.asInstanceOf[js.Object])(children :_*)
  }
} 
Example 195
Source File: SharedApply_BottomNavigationItemProps_754457836.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.materialUi.components

import japgolly.scalajs.react.Children.None
import japgolly.scalajs.react.JsForwardRefComponent.force
import japgolly.scalajs.react.Key
import japgolly.scalajs.react.component.JsForwardRef.UnmountedWithRoot
import org.scalablytyped.runtime.StringDictionary
import typingsJapgolly.materialUi.MaterialUI.BottomNavigation.BottomNavigationItemProps
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

abstract class SharedApply_BottomNavigationItemProps_754457836[ComponentRef] () {
  val componentImport: js.Any
  def apply(
    className: String = null,
    key: Key = null,
    _overrides: StringDictionary[js.Any] = null
  )(
    children: Double
  ): UnmountedWithRoot[BottomNavigationItemProps, ComponentRef, Unit, BottomNavigationItemProps] = {
    val __obj = js.Dynamic.literal(children = children.asInstanceOf[js.Any])
    if (className != null) __obj.updateDynamic("className")(className.asInstanceOf[js.Any])
    if (key != null) __obj.updateDynamic("key")(key.asInstanceOf[js.Any])
    if (_overrides != null) js.Dynamic.global.Object.assign(__obj, _overrides)
    val f = force[BottomNavigationItemProps, None, ComponentRef](this.componentImport)
    f(__obj.asInstanceOf[BottomNavigationItemProps])
  }
} 
Example 196
Source File: HTMLElementTagNameMap.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.std

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait HTMLElementTagNameMap extends js.Object {
  var a: org.scalajs.dom.raw.HTMLAnchorElement = js.native
  var abbr: org.scalajs.dom.raw.HTMLElement = js.native
  var address: org.scalajs.dom.raw.HTMLElement = js.native
  var area: org.scalajs.dom.raw.HTMLAreaElement = js.native
  var article: org.scalajs.dom.raw.HTMLElement = js.native
  var aside: org.scalajs.dom.raw.HTMLElement = js.native
  var audio: org.scalajs.dom.raw.HTMLAudioElement = js.native
}

object HTMLElementTagNameMap {
  @scala.inline
  def apply(
    a: org.scalajs.dom.raw.HTMLAnchorElement,
    abbr: org.scalajs.dom.raw.HTMLElement,
    address: org.scalajs.dom.raw.HTMLElement,
    area: org.scalajs.dom.raw.HTMLAreaElement,
    article: org.scalajs.dom.raw.HTMLElement,
    aside: org.scalajs.dom.raw.HTMLElement,
    audio: org.scalajs.dom.raw.HTMLAudioElement
  ): HTMLElementTagNameMap = {
    val __obj = js.Dynamic.literal(a = a.asInstanceOf[js.Any], abbr = abbr.asInstanceOf[js.Any], address = address.asInstanceOf[js.Any], area = area.asInstanceOf[js.Any], article = article.asInstanceOf[js.Any], aside = aside.asInstanceOf[js.Any], audio = audio.asInstanceOf[js.Any])
    __obj.asInstanceOf[HTMLElementTagNameMap]
  }
  @scala.inline
  implicit class HTMLElementTagNameMapOps[Self <: HTMLElementTagNameMap] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setA(value: org.scalajs.dom.raw.HTMLAnchorElement): Self = this.set("a", value.asInstanceOf[js.Any])
    @scala.inline
    def setAbbr(value: org.scalajs.dom.raw.HTMLElement): Self = this.set("abbr", value.asInstanceOf[js.Any])
    @scala.inline
    def setAddress(value: org.scalajs.dom.raw.HTMLElement): Self = this.set("address", value.asInstanceOf[js.Any])
    @scala.inline
    def setArea(value: org.scalajs.dom.raw.HTMLAreaElement): Self = this.set("area", value.asInstanceOf[js.Any])
    @scala.inline
    def setArticle(value: org.scalajs.dom.raw.HTMLElement): Self = this.set("article", value.asInstanceOf[js.Any])
    @scala.inline
    def setAside(value: org.scalajs.dom.raw.HTMLElement): Self = this.set("aside", value.asInstanceOf[js.Any])
    @scala.inline
    def setAudio(value: org.scalajs.dom.raw.HTMLAudioElement): Self = this.set("audio", value.asInstanceOf[js.Any])
  }
  
} 
Example 197
Source File: SVGElementTagNameMap.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsJapgolly.std

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait SVGElementTagNameMap extends js.Object {
  var circle: org.scalajs.dom.raw.SVGCircleElement = js.native
}

object SVGElementTagNameMap {
  @scala.inline
  def apply(circle: org.scalajs.dom.raw.SVGCircleElement): SVGElementTagNameMap = {
    val __obj = js.Dynamic.literal(circle = circle.asInstanceOf[js.Any])
    __obj.asInstanceOf[SVGElementTagNameMap]
  }
  @scala.inline
  implicit class SVGElementTagNameMapOps[Self <: SVGElementTagNameMap] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setCircle(value: org.scalajs.dom.raw.SVGCircleElement): Self = this.set("circle", value.asInstanceOf[js.Any])
  }
  
} 
Example 198
Source File: StBuildingComponent.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsSlinky

import slinky.core.AttrPair
import slinky.core.OptionalAttrPair
import slinky.core.TagMod
import slinky.core.facade.ReactElement
import slinky.core.facade.ReactRef
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

trait StBuildingComponent[E, R <: js.Object] extends Any {
  @scala.inline
  def args: js.Array[js.Any]
  @scala.inline
  def set(key: String, value: js.Any): this.type = {
    args(1).asInstanceOf[js.Dynamic].updateDynamic(key)(value)
    this
  }
  @scala.inline
  def withComponent(f: js.Any => js.Any): this.type = {
    args.update(0, f(args(0)))
    this
  }
  @scala.inline
  def apply(mods: TagMod[E]*): this.type = {
    mods.foreach((mod: TagMod[E]) => if (mod.isInstanceOf[AttrPair[_]]) {
      val a = mod.asInstanceOf[AttrPair[_]]
      set(a.name, a.value)
  } else if (mod.isInstanceOf[OptionalAttrPair[_]]) {
      val o = mod.asInstanceOf[OptionalAttrPair[_]]
      if (o.value.isDefined) set(o.name, o.value.get)
  } else args.push(mod))
    this
  }
  @scala.inline
  def withKey(key: String): this.type = set("key", key)
  @scala.inline
  def withRef(ref: R => Unit): this.type = set("ref", ref)
  @scala.inline
  def withRef(ref: ReactRef[R]): this.type = set("ref", ref)
}

object StBuildingComponent {
  @JSImport("react", JSImport.Namespace, "React")
  @js.native
  object ReactRaw
    extends js.Object {
    val createElement: js.Dynamic = js.native
  }
  
  @scala.inline
  implicit def make[E, R <: js.Object](comp: StBuildingComponent[E, R]): ReactElement = {
    if (!scala.scalajs.runtime.linkingInfo.productionMode) {
      if (comp.args(0) == null) throw new IllegalStateException("This component has already been built into a ReactElement, and cannot be reused")
  }
    val ret = (ReactRaw.createElement.applyDynamic("apply")(ReactRaw, comp.args)).asInstanceOf[ReactElement]
    if (!scala.scalajs.runtime.linkingInfo.productionMode) {
      comp.args.update(0, null)
  }
    ret
  }
  class Default[E, R <: js.Object] (val args: js.Array[js.Any])
    extends AnyVal
       with StBuildingComponent[E, R]
  
} 
Example 199
Source File: Children.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsSlinky.react.anon

import slinky.core.facade.ReactElement
import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Children extends js.Object {
  var children: js.UndefOr[ReactElement] = js.native
}

object Children {
  @scala.inline
  def apply(): Children = {
    val __obj = js.Dynamic.literal()
    __obj.asInstanceOf[Children]
  }
  @scala.inline
  implicit class ChildrenOps[Self <: Children] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def setChildren(value: ReactElement): Self = this.set("children", value.asInstanceOf[js.Any])
    @scala.inline
    def deleteChildren: Self = this.set("children", js.undefined)
  }
  
} 
Example 200
Source File: Html.scala    From Converter   with GNU General Public License v3.0 5 votes vote down vote up
package typingsSlinky.react.anon

import scala.scalajs.js
import scala.scalajs.js.`|`
import scala.scalajs.js.annotation._

@js.native
trait Html extends js.Object {
  var __html: String = js.native
}

object Html {
  @scala.inline
  def apply(__html: String): Html = {
    val __obj = js.Dynamic.literal(__html = __html.asInstanceOf[js.Any])
    __obj.asInstanceOf[Html]
  }
  @scala.inline
  implicit class HtmlOps[Self <: Html] (val x: Self) extends AnyVal {
    @scala.inline
    def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self]
    @scala.inline
    def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other]
    @scala.inline
    def set(key: String, value: js.Any): Self = {
        x.asInstanceOf[js.Dynamic].updateDynamic(key)(value)
        x
    }
    @scala.inline
    def set__html(value: String): Self = this.set("__html", value.asInstanceOf[js.Any])
  }
  
}