--- a/build.sbt Thu Dec 14 15:32:50 2017 +0100
+++ b/build.sbt Fri Jan 19 11:13:53 2018 +0100
@@ -45,7 +45,6 @@
initialCommands in console := """
import scalatags.Text.all._
import purecss.text.PureCss._
-
"""
).jsSettings()
--- a/shared/src/main/scala/purecss/generic/Component.scala Thu Dec 14 15:32:50 2017 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package purecss.generic
-
-import scala.language.implicitConversions
-import scalatags.generic.Bundle
-
-trait Component[Builder, Output <: FragT, FragT] {
- implicit val bundle: Bundle[Builder, Output, FragT]
-
- type C = PureCls[Builder, Output, FragT]
-
- import bundle.all._
-
- implicit def cls2mod(v: C): Modifier = v()
-
- protected def pc(c: String): C = PureCls(c)
-
- trait Element {
- def toCls: C
- def & (next: C): C = toCls & next
- def & (next: String): C = toCls & next
- }
-}
--- a/shared/src/main/scala/purecss/generic/PureAlerts.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureAlerts.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
import scala.language.implicitConversions
-trait PureAlerts[B, O <: F, F] extends Component[B, O, F] {
+trait PureAlerts[B, O <: F, F] extends PureCssComponent[B, O, F] {
import bundle.all._
val pure_alert: C = pc("pure-alert")
--- a/shared/src/main/scala/purecss/generic/PureButtons.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureButtons.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
import scala.language.{implicitConversions, postfixOps}
-trait PureButtons[B, O <: F, F] extends Component[B, O ,F] {
+trait PureButtons[B, O <: F, F] extends PureCssComponent[B, O ,F] {
import bundle.all._
val pure_button: C = pc("pure-button")
@@ -36,7 +36,7 @@
implicit def btn2mod(b: Button): Modifier = b.toCls.apply()
case class Button(role: Option[C] = None, state: Option[C] = None,
- level: Option[C] = None, size: Option[C] = None) extends Element {
+ level: Option[C] = None, size: Option[C] = None) extends PureCssElement {
type B = Button
def primary: B = copy(role = Some(pure_button_primary))
--- a/shared/src/main/scala/purecss/generic/PureCls.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureCls.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,10 @@
def apply()(implicit bundle: Bundle[Builder, Output, FragT]):
Modifier[Builder] = {
import bundle.all._
- cls:=((this :: chain.reverse) map(_.css) mkString " ")
+ cls:=asCss
}
+
+ def asCss: String = (this :: chain.reverse) map(_.css) mkString " "
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/src/main/scala/purecss/generic/PureCssComponent.scala Fri Jan 19 11:13:53 2018 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package purecss.generic
+
+import scala.language.implicitConversions
+import scalatags.generic.Bundle
+
+trait PureCssComponent[Builder, Output <: FragT, FragT] {
+ implicit val bundle: Bundle[Builder, Output, FragT]
+
+ type C = PureCls[Builder, Output, FragT]
+
+ import bundle.all._
+
+ implicit def cls2mod(v: C): Modifier = v()
+
+ protected def pc(c: String): C = PureCls(c)
+
+ trait PureCssElement {
+ def toCls: C
+ def & (next: C): C = toCls & next
+ def & (next: String): C = toCls & next
+ }
+}
--- a/shared/src/main/scala/purecss/generic/PureForm.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureForm.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
import scala.language.{implicitConversions, postfixOps}
-trait PureForm[B, O <: F, F] extends Component[B, O, F] {
+trait PureForm[B, O <: F, F] extends PureCssComponent[B, O, F] {
import bundle.all._
@@ -25,6 +25,7 @@
val pure_form_stacked: C = pc("pure-form-stacked")
val pure_form_aligned: C = pc("pure-form-aligned")
val pure_group: C = pc("pure-group")
+ val pure_controls: C = pc("pure-controls")
val pure_control_group: C = pc("pure-control-group")
val pure_form_message: C = pc("pure-form-message")
val pure_form_message_inline: C = pc("pure-form-message-inline")
@@ -32,7 +33,7 @@
implicit def f2cls(f: Form): C = f.toCls
implicit def f2mod(f: Form): Modifier = f.toCls.apply()
- case class Form(opt: Option[C] = None) extends Element {
+ case class Form(opt: Option[C] = None) extends PureCssElement {
def stacked: Form = copy(opt = Some(pure_form_stacked))
def aligned: Form = copy(opt = Some(pure_form_aligned))
override def toCls: C = pure_form.copy(chain = opt toList)
--- a/shared/src/main/scala/purecss/generic/PureGrid.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureGrid.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
package purecss.generic
-trait PureGrid[B, O <: F, F] extends Component[B, O, F] {
+trait PureGrid[B, O <: F, F] extends PureCssComponent[B, O, F] {
trait PureGrid {
--- a/shared/src/main/scala/purecss/generic/PureInputs.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureInputs.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
package purecss.generic
-trait PureInputs[B, O <: F, F] extends Component[B, O, F] {
+trait PureInputs[B, O <: F, F] extends PureCssComponent[B, O, F] {
trait PureInput {
val input_rounded: C = pc("pure-input-rounded")
--- a/shared/src/main/scala/purecss/generic/PureTable.scala Thu Dec 14 15:32:50 2017 +0100
+++ b/shared/src/main/scala/purecss/generic/PureTable.scala Fri Jan 19 11:13:53 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
import scala.language.{implicitConversions, postfixOps}
-trait PureTable[B, O <: F, F] extends Component[B, O, F] {
+trait PureTable[B, O <: F, F] extends PureCssComponent[B, O, F] {
import bundle.all._
@@ -29,7 +29,7 @@
implicit def tbl2cls(t: Table): C = t.toCls
implicit def tbl2mod(t: Table): Modifier = t.toCls.apply()
- case class Table(opt: Option[C] = None) extends Element {
+ case class Table(opt: Option[C] = None) extends PureCssElement {
def bordered: Table = copy(opt = Some(pure_table_bordered))
def horizontal: Table = copy(opt = Some(pure_table_horizontal))
def striped: Table = copy(opt = Some(pure_table_striped))