com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
758 stars 117 forks source link

Stylesheet internals should be private/protected #138

Closed lihaoyi closed 8 years ago

lihaoyi commented 8 years ago

Currently, if you instantiate a stylesheet and import Sheet._ from it, internal definitions like cls and others which should never be used outside the scope of the class end up being imported. This clobbers other things of the same name, e.g. the cls shorthand from scalatags.Text.all._:

@ import $ivy.`com.lihaoyi::scalatags:0.6.0`, scalatags.Text.all._
import $ivy.$                             , scalatags.Text.all._
@ object Foo extends scalatags.stylesheet.StyleSheet
defined object Foo
@ import Foo._
import Foo._
@ div(cls := "lol")
cmd3.sc:1: value := is not a member of object $sess.cmd1.Foo.cls
val res3 = div(cls := "lol")
                   ^
Compilation Failed

cls should really be protected[this] so it's not accidentally imported, and we should go over many of the other things to make sure they're properly privatized and protected