Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency updates #4

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.8.3
0f14682a678a17c25441058d1a6894bfefd2f4ea
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.3
0.12.4
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.6.1"
version = "3.8.3"
runner.dialect = scala3

indent.main = 2
Expand Down
5 changes: 2 additions & 3 deletions scautable/js/src/jsSpecific.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package io.github.quafadas.scautable

trait PlatformSpecific {

/**
* With scaladoc
/** With scaladoc
*/
def shouldTotallyAppearInDocs(): Unit = ()

}
}
11 changes: 6 additions & 5 deletions scautable/jvm/src/jvmSpecific.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ trait PlatformSpecific {
runtime.exec(Array[String](s"""xdg-open $uri]"""))
}

/**
* Attempts to open a browser window, and display this Seq of `Product` as a table.
/** Attempts to open a browser window, and display this Seq of `Product` as a table.
*
* @param a - seq of case classes
* @param tableDeriveInstance - summon a HtmlTableRender instance for the case class
* @param a
* \- seq of case classes
* @param tableDeriveInstance
* \- summon a HtmlTableRender instance for the case class
* @return
*/
def desktopShow[A <: Product](a: Seq[A])(using tableDeriveInstance: HtmlTableRender[A]) = {
Expand Down Expand Up @@ -70,4 +71,4 @@ $$(document).ready( function () {
// val asString = scautable(a).toString()
// kernel.publish.html(asString)

}
}
64 changes: 32 additions & 32 deletions scautable/src/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -309,40 +309,40 @@ object scautable extends PlatformSpecific {
tr(elemLabels.map(th(_)))

protected inline def deriveCaseClass[A](using m: Mirror.ProductOf[A]) =
new HtmlTableRender[A] {

override def tableHeader(a: A) =
val elemLabels = getElemLabels[m.MirroredElemLabels]
tr(elemLabels.map(th(_)))

override def tableCell(a: A) = ???

override def tableRow(a: A) = {
val elemLabels = getElemLabels[m.MirroredElemLabels]
val elemInstances = getTypeclassInstances[m.MirroredElemTypes]
val elems =
a.asInstanceOf[Product].productIterator // every case class implements scala.Product, we can safely cast here
val elemCells = elems
.zip(elemInstances)
.map { (elem, instance) =>
instance.tableCell(elem)
}
.toList
tr(
elemCells
)
}
new HtmlTableRender[A] {

override def tableHeader(a: A) =
val elemLabels = getElemLabels[m.MirroredElemLabels]
tr(elemLabels.map(th(_)))

override def tableCell(a: A) = ???

override def tableRow(a: A) = {
val elemLabels = getElemLabels[m.MirroredElemLabels]
val elemInstances = getTypeclassInstances[m.MirroredElemTypes]
val elems =
a.asInstanceOf[Product].productIterator // every case class implements scala.Product, we can safely cast here
val elemCells = elems
.zip(elemInstances)
.map { (elem, instance) =>
instance.tableCell(elem)
}
.toList
tr(
elemCells
)
}
}

/** Render a sequence of unknown type as an html table
*
* @param a
* \- A sequence of unknown type you wish to render as an html table
* @param addHeader
* \- If true, add a header row to the table
* @param tableDeriveInstance
* \- An instance of HtmlTableRender for the type `A`
*/
/** Render a sequence of unknown type as an html table
*
* @param a
* \- A sequence of unknown type you wish to render as an html table
* @param addHeader
* \- If true, add a header row to the table
* @param tableDeriveInstance
* \- An instance of HtmlTableRender for the type `A`
*/
def apply[A <: Product](a: Seq[A], addHeader: Boolean = true)(using tableDeriveInstance: HtmlTableRender[A]): TypedTag[String] =
val h = a.head.productElementNames.toList
val header = tr(h.map(th(_)))
Expand Down