11package japgolly .scalajs .react .vdom
22
3- import org .scalajs .dom
43import scala .annotation .{elidable , implicitNotFound }
54import scala .scalajs .js
65import japgolly .scalajs .react ._
76import Scalatags ._
87
98/**
10- * Represents a value that can be nested within a [[ReactTag ]]. This can be
9+ * Represents a value that can be nested within a [[ReactTagOf ]]. This can be
1110 * another [[TagMod ]], but can also be a CSS style or HTML attribute binding,
1211 * which will add itself to the node's attributes but not appear in the final
1312 * `children` list.
@@ -34,9 +33,10 @@ object TagMod {
3433 TagModComposition (ms.toVector)
3534}
3635
37- final case class ReactTag private [vdom](tag : String ,
38- modifiers : List [Seq [TagMod ]],
39- namespace : Namespace ) extends DomFrag {
36+ final case class ReactTagOf [+ N <: TopNode ] private [vdom](
37+ tag : String ,
38+ modifiers : List [Seq [TagMod ]],
39+ namespace : Namespace ) extends DomFrag {
4040
4141 def render : ReactElement = {
4242 val b = new Builder ()
@@ -71,7 +71,7 @@ final case class ReactTag private[vdom](tag: String,
7171 }
7272 }
7373
74- def apply (xs : TagMod * ): ReactTag =
74+ def apply (xs : TagMod * ): ReactTagOf [ N ] =
7575 this .copy(tag = tag, modifiers = xs :: modifiers)
7676
7777 override def toString = render.toString
@@ -215,9 +215,9 @@ private[vdom] object Scalatags {
215215 override def apply (b : Builder , s : Style , t : T [A ]) = ot.foreach(t)(v(b, s, _))
216216 }
217217
218- @ inline def makeAbstractReactTag (tag : String , namespaceConfig : Namespace ): ReactTag = {
218+ @ inline def makeAbstractReactTag [ N <: TopNode ] (tag : String , namespaceConfig : Namespace ): ReactTagOf [ N ] = {
219219 Escaping .assertValidTag(tag)
220- ReactTag (tag, Nil , namespaceConfig)
220+ ReactTagOf [ N ] (tag, Nil , namespaceConfig)
221221 }
222222
223223 implicit final class SeqFrag [A <% Frag ](xs : Seq [A ]) extends Frag {
@@ -258,16 +258,16 @@ private[vdom] object Scalatags {
258258
259259 implicit class STStringExt (private val s : String ) extends AnyVal {
260260 /**
261- * Converts the string to a [[ReactTag ]]
261+ * Converts the string to a [[ReactTagOf ]]
262262 */
263- def tag [N <: dom. Node ](implicit namespaceConfig : Namespace ): ReactTag =
263+ def tag [N <: TopNode ](implicit namespaceConfig : Namespace ): ReactTagOf [ N ] =
264264 makeAbstractReactTag(s, namespaceConfig)
265265
266266 /**
267- * Converts the string to a void [[ReactTag ]]; that means that they cannot
267+ * Converts the string to a void [[ReactTagOf ]]; that means that they cannot
268268 * contain any content, and can be rendered as self-closing tags.
269269 */
270- def voidTag [N <: dom. Node ](implicit namespaceConfig : Namespace ): ReactTag =
270+ def voidTag [N <: TopNode ](implicit namespaceConfig : Namespace ): ReactTagOf [ N ] =
271271 makeAbstractReactTag(s, namespaceConfig)
272272
273273 /**
@@ -284,7 +284,7 @@ private[vdom] object Scalatags {
284284 }
285285
286286 /**
287- * Allows you to modify a [[ReactTag ]] by adding a Seq containing other nest-able
287+ * Allows you to modify a [[ReactTagOf ]] by adding a Seq containing other nest-able
288288 * objects to its list of children.
289289 */
290290 implicit class SeqNode [A <% TagMod ](xs : Seq [A ]) extends TagMod {
0 commit comments