Initial commit, base tags, ng & twbs tags
authorTomas Zeman <tzeman@volny.cz>
Fri, 14 Aug 2015 07:56:09 +0200
changeset 1 d3ac46c5db55
parent 0 cdc379f9554c
child 2 8fcd8bb50987
Initial commit, base tags, ng & twbs tags
build.sbt
project/build.properties
project/plugins.sbt
shared/src/main/scala/Nvd3.scala
shared/src/main/scala/Tags.scala
shared/src/main/scala/ngTags.scala
shared/src/main/scala/twbsTags.scala
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.sbt	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,34 @@
+lazy val root = project.in(file(".")).
+  aggregate(ngtagsJS, ngtagsJVM).
+  settings(
+    publish := {},
+    publishLocal := {}
+  )
+
+lazy val ngtags = crossProject.in(file(".")).
+enablePlugins(BuildInfoPlugin).
+settings(
+  name := "ngTags",
+  scalaVersion := "2.11.7",
+  version := "0.1-SNAPSHOT",
+
+  libraryDependencies ++= Seq(
+    "com.lihaoyi" %%% "scalatags" % "0.5.2"
+    //"com.github.japgolly.scalacss" %%% "ext-scalatags" % "0.1.0"
+  ),
+
+  buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion,
+    "scalaJSVersion" -> scalaJSVersion,
+    BuildInfoKey.action("buildTime") { System.currentTimeMillis },
+    BuildInfoKey.action("hgId") { Process("hg id -i").lines.head },
+    BuildInfoKey.action("hgTags") { Process("hg id -t").lines.head }
+  ),
+  buildInfoPackage := "ngtags",
+  buildInfoOptions ++= Seq(BuildInfoOption.ToMap, BuildInfoOption.ToJson)
+
+).jvmSettings().jsSettings()
+
+lazy val ngtagsJS = ngtags.js
+lazy val ngtagsJVM = ngtags.jvm
+
+// vim: et ts=2 sw=2 syn=scala 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/build.properties	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,1 @@
+sbt.version=0.13.9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/plugins.sbt	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,16 @@
+// Resolvers
+resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
+
+resolvers += Resolver.url("scala-js-snapshots", 
+  url("http://repo.scala-js.org/repo/snapshots/"))(Resolver.ivyStylePatterns)
+
+// Sbt plugins
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.4")
+
+addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.6.8")
+
+addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.1.1")
+
+addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.5.0")
+
+addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/src/main/scala/Nvd3.scala	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2015 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 net.tz.nvd3
+
+import scalatags.Text.all._
+
+object Nvd3 {
+  val nvd3 = "nvd3".tag
+  def nvd3options(varName: String) = "options".attr:=varName
+  def nvd3data(varName: String) = "data".attr:=varName
+}
+
+// vim: set ts=2 sw=2 et:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/src/main/scala/Tags.scala	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2015 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 net.tz.ngtags
+
+import scalatags.Text.all._
+
+object Tags {
+  val closeAttr = "close".attr
+  val dataFramework: Attr = "data-framework".attr
+  val dataToggle: Attr = "data-toggle".attr
+  val dataTarget: Attr = "data-target".attr
+
+  val html5 = "<!DOCTYPE html>"
+  def role(expr: String) = "role".attr:=expr
+  val scope = "scope".attr
+
+  val typeAttr = "type".attr
+}
+
+// vim: set ts=2 sw=2 et:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/src/main/scala/ngTags.scala	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2015 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 net.tz.ngtags
+
+import scalatags.Text.all._
+
+object ngTags {
+  def i18n(s: String): String = s"{{'$s' | translate}}"
+  def interpolate(s: String) = s"{{$s}}"
+  def isOpen(expr: String) = "is-open".attr:=expr
+
+  val ngAlert = "alert".tag
+  val ngApp: Attr = "ng-app".attr
+  def ngChange(expr: String) = "ng-change".attr:=expr
+  def ngClick(expr: String) = "ng-click".attr:=expr
+  val ngCloak = "ng-cloak".tag
+  def ngCls(expr: String) = "ng-class".attr:=expr
+  def ngCtrl(c: String) = "ng-controller".attr:=c
+  def ngHide(expr: String) = "ng-hide".attr:=expr
+  val ngInclude = "ng-include".tag
+  def ngInit(expr: String) = "ng-init".attr:=expr
+  def ngModel(expr: String) = "ng-model".attr:=expr
+  def ngRepeat(name: String, list: String) = "ng-repeat".attr:=s"$name in $list"
+  def ngSrc(expr: String) = "ng-src".attr:=expr
+  def ngShow(expr: String) = "ng-show".attr:=expr
+  def ngStyle(s: String) = "ng-style".attr:=s
+  def ngValue(expr: String) = "ng-value".attr:=expr
+  val ngView = "ng-view".tag
+
+  val translateAttr = "translate".attr
+}
+
+// vim: set ts=2 sw=2 et:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/src/main/scala/twbsTags.scala	Fri Aug 14 07:56:09 2015 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2015 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 net.tz.ngtags
+
+import scalatags.Text.all._
+
+object Accordion {
+  val acMain = "accordion".tag
+  val acGroup = "accordion-group".tag
+  val acHeading = "accordion-heading".tag
+  val closeOthers = "close-others".attr
+}
+
+object twbsTags {
+  val dropdown = "dropdown".attr
+  val dropdownToggle = "dropdown-toggle".attr
+  val nav = "nav".tag
+  def tooltip(content: String) = "tooltip".attr:=content
+  def tooltipPlacement(where: String) = "tooltip-placement".attr:=where
+  def tooltipAppendToBody(b: Boolean) = "tooltip-append-to-body".attr:=b
+}
+
+object Tabs {
+  val tabset = "tabset".tag
+  val tab = "tab".tag
+  val tabHeading = "tab-heading".tag
+  val heading = "heading".attr
+}
+
+// vim: set ts=2 sw=2 et: