diff options
76 files changed, 1708 insertions, 867 deletions
diff --git a/core/src/main/resources/dokka/styles/style.css b/core/src/main/resources/dokka/styles/style.css index a71651ca..fc032e29 100644 --- a/core/src/main/resources/dokka/styles/style.css +++ b/core/src/main/resources/dokka/styles/style.css @@ -422,8 +422,8 @@ footer { color: #fff } -.platform-tagged:hover .platform-tag, -.platform-tagged:hover > .platform-tag { +.table-row:hover .platform-tag, +.table-row:hover > .platform-tag { text-indent: 0; white-space: nowrap; padding: 0 7px; @@ -436,7 +436,7 @@ footer { transition: max-width 1s, max-height 1s } -.platform-tagged { +.platform-tags { flex: auto; display: flex; flex-direction: row; @@ -446,11 +446,7 @@ footer { justify-content: flex-end; } -tr.platform-tagged { - flex-direction: row; -} - -.platform-tagged > .platform-tag { +.platform-tags > .platform-tag { align-self: center; margin: 10px; } @@ -487,7 +483,7 @@ td.content { flex-direction: column; } -.content > a { +.title > a { text-decoration: none; font-style: normal; font-weight: 600; @@ -495,7 +491,7 @@ td.content { color: #282E34; } -.content > a:hover { +.title > a:hover { color: #5B5DEF; } @@ -552,11 +548,59 @@ td.content { display: none } -.sideMenuPart[data-active] { +.sideMenuPart[data-active] > .overview { background: rgba(91, 93, 239, 0.15); border-left: 4px solid #5B5DEF; } +.table { + display: flex; + flex-direction: column; +} + +.table-row { + display: flex; + flex-direction: column; + background: white; + margin: 10px; + padding: 16px 24px 16px 24px; +} + +.table-row > .main-subrow { + height: 24px; + display: grid; + grid-template-columns: 310px auto auto; +} + +.table-row > .signature-subrow { + display: grid; + grid-template-columns: 310px auto; +} + +.main-subrow > .title { + order: 1; +} + +.main-subrow > .brief { + order: 2; +} + +.main-subrow > .platform-tags { + grid-column-start: 3; +} + +.main-subrow > * { + order: 4; +} + +.signature-subrow > .signature { + grid-column-start: 2; +} + +.signature-subrow > * { + order: 4; +} + @media print, screen and (max-width: 960px) { div.wrapper { diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index fbab248a..c53b1b6d 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -30,10 +30,6 @@ open class HtmlRenderer( ) { val additionalClasses = node.style.joinToString(" ") { it.toString().toLowerCase() } return when { - ContentKind.shouldBePlatformTagged(node.dci.kind) -> wrapPlatformTagged( - node, - pageContext - ) { childrenCallback() } node.dci.kind == ContentKind.Symbol -> div("symbol $additionalClasses") { childrenCallback() } node.dci.kind == ContentKind.BriefComment -> div("brief $additionalClasses") { childrenCallback() } node.dci.kind == ContentKind.Cover -> div("cover $additionalClasses") { childrenCallback() } @@ -43,25 +39,6 @@ open class HtmlRenderer( } } - private fun FlowContent.wrapPlatformTagged( - node: ContentGroup, - pageContext: ContentPage, - childrenCallback: FlowContent.() -> Unit - ) { - div("platform-tagged") { - node.platforms.forEach { - val targets = it.targets.joinToString(", ") - div("platform-tag") { - if( targets.equals("common", ignoreCase = true) ) classes = classes + "common" - text(it.targets.joinToString(", ")) - } - } - div("content") { - childrenCallback() - } - } - } - override fun FlowContent.buildPlatformDependent(content: PlatformHintedContent, pageContext: ContentPage) { div("platform-hinted") { attributes["data-platform-hinted"] = "data-platform-hinted" @@ -85,7 +62,6 @@ open class HtmlRenderer( } } } - contents.forEach { consumer.onTagContentUnsafe { +it.second } } @@ -139,42 +115,55 @@ open class HtmlRenderer( } } - private fun TBODY.buildPlatformTaggedRow( - node: ContentTable, + private fun FlowContent.buildRow( + node: ContentGroup, pageContext: ContentPage, platformRestriction: PlatformData? ) { - node.children.filter { platformRestriction == null || platformRestriction in it.platforms }.forEach { - tr("platform-tagged") { - it.children.forEach { - td("content") { - it.build(this, pageContext, platformRestriction) + node.children + .filter { + platformRestriction == null || platformRestriction in it.platforms + } + .takeIf { it.isNotEmpty() } + ?.let { + div(classes = "table-row") { + it.filter { it.dci.kind != ContentKind.Symbol }.takeIf { it.isNotEmpty() }?.let { + div("main-subrow") { + it.filter { platformRestriction == null || platformRestriction in it.platforms } + .forEach { + when(it.dci.kind){ + ContentKind.Main -> div("title") { + it.build(this, pageContext, platformRestriction) + } + ContentKind.BriefComment, ContentKind.Comment -> div("brief") { + it.build(this, pageContext, platformRestriction) + } + else -> div { it.build(this, pageContext, platformRestriction) } + } + } + if (ContentKind.shouldBePlatformTagged(node.dci.kind)) { + createPlatformTags(node) + } + } } - } - td("platform-tagged") { - it.platforms.forEach { - div(("platform-tag")) { - val targets = it.targets.joinToString(", ") - if( targets.equals("common", ignoreCase = true) ) classes = classes + "common" - text(it.targets.joinToString(", ")) + it.filter { it.dci.kind == ContentKind.Symbol }.takeIf { it.isNotEmpty() }?.let { + div("signature-subrow") { + div("signature"){ + it.first().build(this, pageContext, platformRestriction) + } } } } } - } } - private fun TBODY.buildRow( - node: ContentTable, - pageContext: ContentPage, - platformRestriction: PlatformData? - ) { - node.children.filter { platformRestriction == null || platformRestriction in it.platforms }.forEach { - tr { - it.children.forEach { - td { - it.build(this, pageContext, platformRestriction) - } + private fun FlowContent.createPlatformTags( node: ContentNode ) { + div("platform-tags") { + node.platforms.forEach { + div("platform-tag") { + val targets = it.targets.joinToString(", ") + if( targets.equals("common", ignoreCase = true) ) classes = classes + "common" + text(it.targets.joinToString(", ")) } } } @@ -185,24 +174,9 @@ open class HtmlRenderer( pageContext: ContentPage, platformRestriction: PlatformData? ) { - table(if (node.hasStyle(CommentTable)) "comment-table" else "") { - thead { - node.header.forEach { - tr { - it.children.forEach { - th { - it.build(this@table, pageContext, platformRestriction) - } - } - } - } - } - tbody { - if (ContentKind.shouldBePlatformTagged(node.dci.kind)) { - buildPlatformTaggedRow(node, pageContext, platformRestriction) - } else { - buildRow(node, pageContext, platformRestriction) - } + div(classes = "table") { + node.children.forEach { + buildRow(it, pageContext, platformRestriction) } } } diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index c3621d1b..61ec2acf 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -69,7 +69,7 @@ open class DefaultPageCreator( } +contentForComments(m) block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) { - link(it.name, it.dri) + link(it.name, it.dri, kind = ContentKind.Main) } // text("Index\n") TODO // text("Link to allpage here") @@ -82,14 +82,12 @@ open class DefaultPageCreator( +contentForComments(p) +contentForScope(p, p.dri, p.platformData) block("Type aliases", 2, ContentKind.TypeAliases, p.typealiases, p.platformData.toSet()) { - link(it.name, it.dri) - |
