From 8e5c63d035ef44a269b8c43430f43f5c8eebfb63 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Fri, 10 Nov 2023 11:46:54 +0100 Subject: Restructure the project to utilize included builds (#3174) * Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich --- .../org.jetbrains.dokka.plugability.DokkaPlugin | 5 + .../dokka/docs/javadoc/EnumValueOf.java.template | 12 + .../dokka/docs/javadoc/EnumValues.java.template | 8 + .../dokka/docs/kdoc/EnumEntries.kt.template | 3 + .../dokka/docs/kdoc/EnumValueOf.kt.template | 4 + .../dokka/docs/kdoc/EnumValues.kt.template | 3 + .../src/main/resources/dokka/format/gfm.properties | 6 + .../resources/dokka/format/html-as-java.properties | 6 + .../main/resources/dokka/format/html.properties | 6 + .../dokka/format/java-layout-html.properties | 6 + .../main/resources/dokka/format/jekyll.properties | 6 + .../dokka/format/kotlin-website-html.properties | 6 + .../resources/dokka/format/markdown.properties | 6 + .../resources/dokka/images/anchor-copy-button.svg | 8 + .../src/main/resources/dokka/images/arrow_down.svg | 7 + .../src/main/resources/dokka/images/burger.svg | 9 + .../src/main/resources/dokka/images/copy-icon.svg | 7 + .../dokka/images/copy-successful-icon.svg | 7 + .../resources/dokka/images/footer-go-to-link.svg | 7 + .../main/resources/dokka/images/go-to-top-icon.svg | 8 + .../src/main/resources/dokka/images/homepage.svg | 5 + .../src/main/resources/dokka/images/logo-icon.svg | 14 + .../images/nav-icons/abstract-class-kotlin.svg | 26 + .../dokka/images/nav-icons/abstract-class.svg | 20 + .../dokka/images/nav-icons/annotation-kotlin.svg | 13 + .../dokka/images/nav-icons/annotation.svg | 7 + .../dokka/images/nav-icons/class-kotlin.svg | 13 + .../resources/dokka/images/nav-icons/class.svg | 7 + .../dokka/images/nav-icons/enum-kotlin.svg | 13 + .../main/resources/dokka/images/nav-icons/enum.svg | 7 + .../dokka/images/nav-icons/exception-class.svg | 7 + .../dokka/images/nav-icons/field-value.svg | 10 + .../dokka/images/nav-icons/field-variable.svg | 10 + .../resources/dokka/images/nav-icons/function.svg | 7 + .../dokka/images/nav-icons/interface-kotlin.svg | 13 + .../resources/dokka/images/nav-icons/interface.svg | 7 + .../resources/dokka/images/nav-icons/object.svg | 13 + .../dokka/images/nav-icons/typealias-kotlin.svg | 13 + .../main/resources/dokka/images/theme-toggle.svg | 7 + .../inbound-link-resolver/dokka-default.properties | 6 + .../java-layout-html.properties | 6 + .../dokka/inbound-link-resolver/javadoc.properties | 6 + .../src/main/resources/dokka/scripts/clipboard.js | 56 + .../resources/dokka/scripts/navigation-loader.js | 95 ++ .../dokka/scripts/platform-content-handler.js | 400 ++++++ .../src/main/resources/dokka/scripts/prism.js | 22 + .../scripts/symbol-parameters-wrapper_deferred.js | 64 + .../resources/dokka/styles/font-jb-sans-auto.css | 36 + .../main/resources/dokka/styles/logo-styles.css | 9 + .../src/main/resources/dokka/styles/prism.css | 217 +++ .../src/main/resources/dokka/styles/style.css | 1513 ++++++++++++++++++++ .../src/main/resources/dokka/templates/base.ftl | 44 + .../resources/dokka/templates/includes/footer.ftl | 7 + .../resources/dokka/templates/includes/header.ftl | 31 + .../dokka/templates/includes/page_metadata.ftl | 6 + .../templates/includes/source_set_selector.ftl | 9 + 56 files changed, 2869 insertions(+) create mode 100644 dokka-subprojects/plugin-base/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValueOf.java.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValues.java.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumEntries.kt.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValueOf.kt.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValues.kt.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/gfm.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/html-as-java.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/java-layout-html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/jekyll.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/kotlin-website-html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/markdown.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/anchor-copy-button.svg create mode 100755 dokka-subprojects/plugin-base/src/main/resources/dokka/images/arrow_down.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/burger.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-successful-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/footer-go-to-link.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/go-to-top-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/homepage.svg create mode 100755 dokka-subprojects/plugin-base/src/main/resources/dokka/images/logo-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/exception-class.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-value.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-variable.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/function.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/object.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/typealias-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/theme-toggle.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/clipboard.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/navigation-loader.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/platform-content-handler.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/prism.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/symbol-parameters-wrapper_deferred.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/font-jb-sans-auto.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/logo-styles.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/prism.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/style.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/base.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/footer.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/header.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/page_metadata.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/source_set_selector.ftl (limited to 'dokka-subprojects/plugin-base/src/main/resources') diff --git a/dokka-subprojects/plugin-base/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin b/dokka-subprojects/plugin-base/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin new file mode 100644 index 00000000..a014a209 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin @@ -0,0 +1,5 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +org.jetbrains.dokka.base.DokkaBase diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValueOf.java.template b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValueOf.java.template new file mode 100644 index 00000000..233f8819 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValueOf.java.template @@ -0,0 +1,12 @@ +/** + * Returns the enum constant of this type with the specified + * name. + * The string must match exactly an identifier used to declare + * an enum constant in this type. (Extraneous whitespace + * characters are not permitted.) + * + * @return the enum constant with the specified name + * @throws IllegalArgumentException if this enum type has no + * constant with the specified name + */ + \ No newline at end of file diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValues.java.template b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValues.java.template new file mode 100644 index 00000000..4aed38a6 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValues.java.template @@ -0,0 +1,8 @@ +/** + * Returns an array containing the constants of this enum + * type, in the order they're declared. This method may be + * used to iterate over the constants. + * + * @return an array containing the constants of this enum + * type, in the order they're declared + */ diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumEntries.kt.template b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumEntries.kt.template new file mode 100644 index 00000000..20d16421 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumEntries.kt.template @@ -0,0 +1,3 @@ +Returns a representation of an immutable list of all enum entries, in the order they're declared. + +This method may be used to iterate over the enum entries. diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValueOf.kt.template b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValueOf.kt.template new file mode 100644 index 00000000..fbf8fa8d --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValueOf.kt.template @@ -0,0 +1,4 @@ +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used +to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +@throws kotlin.IllegalArgumentException if this enum type has no constant with the specified name diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValues.kt.template b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValues.kt.template new file mode 100644 index 00000000..c0e3559c --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValues.kt.template @@ -0,0 +1,3 @@ +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/gfm.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/gfm.properties new file mode 100644 index 00000000..66b1ea8f --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/gfm.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.GFMFormatDescriptor +description=Produces documentation in GitHub-flavored markdown format diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/html-as-java.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/html-as-java.properties new file mode 100644 index 00000000..cbb5a399 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/html-as-java.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.HtmlAsJavaFormatDescriptor +description=Produces output in HTML format using Java syntax diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/html.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/html.properties new file mode 100644 index 00000000..42438d16 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/html.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.HtmlFormatDescriptor +description=Produces output in HTML format diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/java-layout-html.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/java-layout-html.properties new file mode 100644 index 00000000..79925edd --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/java-layout-html.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.JavaLayoutHtmlFormatDescriptor +description=Produces Kotlin Style Docs with Javadoc like layout diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/jekyll.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/jekyll.properties new file mode 100644 index 00000000..28f55afc --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/jekyll.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.JekyllFormatDescriptor +description=Produces documentation in Jekyll format diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/kotlin-website-html.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/kotlin-website-html.properties new file mode 100644 index 00000000..4e8dea39 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/kotlin-website-html.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.KotlinWebsiteHtmlFormatDescriptor +description=Generates Kotlin website documentation diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/format/markdown.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/markdown.properties new file mode 100644 index 00000000..62a0f2b2 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/format/markdown.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.MarkdownFormatDescriptor +description=Produces documentation in markdown format diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/anchor-copy-button.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/anchor-copy-button.svg new file mode 100644 index 00000000..19c1fa3f --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/anchor-copy-button.svg @@ -0,0 +1,8 @@ + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/arrow_down.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/arrow_down.svg new file mode 100755 index 00000000..639aaf12 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/arrow_down.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/burger.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/burger.svg new file mode 100644 index 00000000..fcca732b --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/burger.svg @@ -0,0 +1,9 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-icon.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-icon.svg new file mode 100644 index 00000000..2cb02ec6 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-icon.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-successful-icon.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-successful-icon.svg new file mode 100644 index 00000000..c4b95383 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-successful-icon.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/footer-go-to-link.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/footer-go-to-link.svg new file mode 100644 index 00000000..a87add7a --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/footer-go-to-link.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/go-to-top-icon.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/go-to-top-icon.svg new file mode 100644 index 00000000..abc3d1ce --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/go-to-top-icon.svg @@ -0,0 +1,8 @@ + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/homepage.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/homepage.svg new file mode 100644 index 00000000..a3d7602b --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/homepage.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/logo-icon.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/logo-icon.svg new file mode 100755 index 00000000..e42f9570 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/logo-icon.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class-kotlin.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class-kotlin.svg new file mode 100644 index 00000000..19d6148c --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class-kotlin.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class.svg new file mode 100644 index 00000000..60182030 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation-kotlin.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation-kotlin.svg new file mode 100644 index 00000000..b90f508c --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation-kotlin.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation.svg new file mode 100644 index 00000000..b80c54b4 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class-kotlin.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class-kotlin.svg new file mode 100644 index 00000000..797a2423 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class-kotlin.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class.svg new file mode 100644 index 00000000..3f1ad167 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum-kotlin.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum-kotlin.svg new file mode 100644 index 00000000..775a7cc9 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum-kotlin.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum.svg new file mode 100644 index 00000000..fa7f2476 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/exception-class.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/exception-class.svg new file mode 100644 index 00000000..c0b2bdeb --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/exception-class.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-value.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-value.svg new file mode 100644 index 00000000..2771ee56 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-value.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-variable.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-variable.svg new file mode 100644 index 00000000..e2d2bbd0 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-variable.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/function.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/function.svg new file mode 100644 index 00000000..f0da64a0 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/function.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface-kotlin.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface-kotlin.svg new file mode 100644 index 00000000..5e163260 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface-kotlin.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface.svg new file mode 100644 index 00000000..32063ba2 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/object.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/object.svg new file mode 100644 index 00000000..31f0ee3e --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/object.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/typealias-kotlin.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/typealias-kotlin.svg new file mode 100644 index 00000000..f4bb238b --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/typealias-kotlin.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/images/theme-toggle.svg b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/theme-toggle.svg new file mode 100644 index 00000000..df86202b --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/images/theme-toggle.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties new file mode 100644 index 00000000..214fe8d7 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.InboundExternalLinkResolutionService$Dokka +description=Uses Dokka Default resolver diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties new file mode 100644 index 00000000..285fc11a --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.Formats.JavaLayoutHtmlInboundLinkResolutionService +description=Resolver for JavaLayoutHtml diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties b/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties new file mode 100644 index 00000000..66fcc7c9 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties @@ -0,0 +1,6 @@ +# +# Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +# + +class=org.jetbrains.dokka.InboundExternalLinkResolutionService$Javadoc +description=Uses Javadoc Default resolver diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/clipboard.js b/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/clipboard.js new file mode 100644 index 00000000..7a4f33c5 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/clipboard.js @@ -0,0 +1,56 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +window.addEventListener('load', () => { + document.querySelectorAll('span.copy-icon').forEach(element => { + element.addEventListener('click', (el) => copyElementsContentToClipboard(element)); + }) + + document.querySelectorAll('span.anchor-icon').forEach(element => { + element.addEventListener('click', (el) => { + if(element.hasAttribute('pointing-to')){ + const location = hrefWithoutCurrentlyUsedAnchor() + '#' + element.getAttribute('pointing-to') + copyTextToClipboard(element, location) + } + }); + }) +}) + +const copyElementsContentToClipboard = (element) => { + const selection = window.getSelection(); + const range = document.createRange(); + range.selectNodeContents(element.parentNode.parentNode); + selection.removeAllRanges(); + selection.addRange(range); + + copyAndShowPopup(element, () => selection.removeAllRanges()) +} + +const copyTextToClipboard = (element, text) => { + var textarea = document.createElement("textarea"); + textarea.textContent = text; + textarea.style.position = "fixed"; + document.body.appendChild(textarea); + textarea.select(); + + copyAndShowPopup(element, () => document.body.removeChild(textarea)) +} + +const copyAndShowPopup = (element, after) => { + try { + document.execCommand('copy'); + element.nextElementSibling.classList.add('active-popup'); + setTimeout(() => { + element.nextElementSibling.classList.remove('active-popup'); + }, 1200); + } catch (e) { + console.error('Failed to write to clipboard:', e) + } + finally { + if(after) after() + } +} + +const hrefWithoutCurrentlyUsedAnchor = () => window.location.href.split('#')[0] + diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/navigation-loader.js b/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/navigation-loader.js new file mode 100644 index 00000000..3df7ac8c --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/navigation-loader.js @@ -0,0 +1,95 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +navigationPageText = fetch(pathToRoot + "navigation.html").then(response => response.text()) + +displayNavigationFromPage = () => { + navigationPageText.then(data => { + document.getElementById("sideMenu").innerHTML = data; + }).then(() => { + document.querySelectorAll(".overview > a").forEach(link => { + link.setAttribute("href", pathToRoot + link.getAttribute("href")); + }) + }).then(() => { + document.querySelectorAll(".sideMenuPart").forEach(nav => { + if (!nav.classList.contains("hidden")) + nav.classList.add("hidden") + }) + }).then(() => { + revealNavigationForCurrentPage() + }).then(() => { + scrollNavigationToSelectedElement() + }) + document.querySelectorAll('.footer a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + document.querySelector(this.getAttribute('href')).scrollIntoView({ + behavior: 'smooth' + }); + }); + }); +} + +revealNavigationForCurrentPage = () => { + let pageId = document.getElementById("content").attributes["pageIds"].value.toString(); + let parts = document.querySelectorAll(".sideMenuPart"); + let found = 0; + do { + parts.forEach(part => { + if (part.attributes['pageId'].value.indexOf(pageId) !== -1 && found === 0) { + found = 1; + if (part.classList.contains("hidden")) { + part.classList.remove("hidden"); + part.setAttribute('data-active', ""); + } + revealParents(part) + } + }); + pageId = pageId.substring(0, pageId.lastIndexOf("/")) + } while (pageId.indexOf("/") !== -1 && found === 0) +}; +revealParents = (part) => { + if (part.classList.contains("sideMenuPart")) { + if (part.classList.contains("hidden")) + part.classList.remove("hidden"); + revealParents(part.parentNode) + } +}; + +scrollNavigationToSelectedElement = () => { + let selectedElement = document.querySelector('div.sideMenuPart[data-active]') + if (selectedElement == null) { // nothing selected, probably just the main page opened + return + } + + let hasIcon = selectedElement.querySelectorAll(":scope > div.overview span.nav-icon").length > 0 + + // for instance enums also have children and are expandable, but are not package/module elements + let isPackageElement = selectedElement.children.length > 1 && !hasIcon + if (isPackageElement) { + // if package is selected or linked, it makes sense to align it to top + // so that you can see all the members it contains + selectedElement.scrollIntoView(true) + } else { + // if a member within a package is linked, it makes sense to center it since it, + // this should make it easier to look at surrounding members + selectedElement.scrollIntoView({ + behavior: 'auto', + block: 'center', + inline: 'center' + }) + } +} + +/* + This is a work-around for safari being IE of our times. + It doesn't fire a DOMContentLoaded, presumabely because eventListener is added after it wants to do it +*/ +if (document.readyState == 'loading') { + window.addEventListener('DOMContentLoaded', () => { + displayNavigationFromPage() + }) +} else { + displayNavigationFromPage() +} diff --git a/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/platform-content-handler.js b/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/platform-content-handler.js new file mode 100644 index 00000000..811c4788 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/platform-content-handler.js @@ -0,0 +1,400 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +filteringContext = { + dependencies: {}, + restrictedDependencies: [], + activeFilters: [] +} +let highlightedAnchor; +let topNavbarOffset; +let instances = []; +let sourcesetNotification; + +const samplesDarkThemeName = 'darcula' +const samplesLightThemeName = 'idea' + +window.addEventListener('load', () => { + document.querySelectorAll("div[data-platform-hinted]") + .forEach(elem => elem.addEventListener('click', (event) => togglePlatformDependent(event, elem))) + const filterSection = document.getElementById('filter-section') + if (filterSection) { + filterSection.addEventListener('click', (event) => filterButtonHandler(event)) + initializeFiltering() + } + initTabs() + handleAnchor() + initHidingLeftNavigation() + topNavbarOffset = document.getElementById('navigation-wrapper') + darkModeSwitch() +}) + +const darkModeSwitch = () => { + const localStorageKey = "dokka-dark-mode" + const storage = localStorage.getItem(localStorageKey) + const osDarkSchemePreferred = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches + const darkModeEnabled = storage ? JSON.parse(storage) : osDarkSchemePreferred + const element = document.getElementById("theme-toggle-button") + initPlayground(darkModeEnabled ? samplesDarkThemeName : samplesLightThemeName) + + element.addEventListener('click', () => { + const enabledClasses = document.getElementsByTagName("html")[0].classList + enabledClasses.toggle("theme-dark") + + //if previously we had saved dark theme then we set it to light as this is what we save in local storage + const darkModeEnabled = enabledClasses.contains("theme-dark") + if (darkModeEnabled) { + initPlayground(samplesDarkThemeName) + } else { + initPlayground(samplesLightThemeName) + } + localStorage.setItem(localStorageKey, JSON.stringify(darkModeEnabled)) + }) +} + +const initPlayground = (theme) => { + if (!samplesAreEnabled()) return + instances.forEach(instance => instance.destroy()) + instances = [] + + // Manually tag code fragments as not processed by playground since we also manually destroy all of its instances + document.querySelectorAll('code.runnablesample').forEach(node => { + node.removeAttribute("data-kotlin-playground-initialized"); + }) + + KotlinPlayground('code.runnablesample', { + getInstance: playgroundInstance => { + instances.push(playgroundInstance) + }, + theme: theme + }); +} + +// We check if type is accessible from the current scope to determine if samples script is present +// As an alternative we could extract this samples-specific script to new js file but then we would handle dark mode in 2 separate files which is not ideal +const samplesAreEnabled = () => { + try { + KotlinPlayground + return true + } catch (e) { + return false + } +} + + +const initHidingLeftNavigation = () => { + document.getElementById("menu-toggle").onclick = function (event) { + //Events need to be prevented from bubbling since they will trigger next handler + event.preventDefault(); + event.stopPropagation(); + event.stopImmediatePropagation(); + document.getElementById("leftColumn").classList.toggle("open"); + } + + document.getElementById("main").onclick = () => { + document.getElementById("leftColumn").classList.remove("open"); + } +} + +// Hash change is needed in order to allow for linking inside the same page with anchors +// If this is not present user is forced to refresh the site in order to use an anchor +window.onhashchange = handleAnchor + +function scrollToElementInContent(element) { + const scrollToElement = () => document.getElementById('main').scrollTo({ + top: element.offsetTop - topNavbarOffset.offsetHeight, + behavior: "smooth" + }) + + const waitAndScroll = () => { + setTimeout(() => { + if (topNavbarOffset) { + scrollToElement() + } else { + waitForScroll() + } + }, 50) + } + + if (topNavbarOffset) { + scrollToElement() + } else { + waitAndScroll() + } +} + + +function handleAnchor() { + if (highlightedAnchor) { + highlightedAnchor.classList.remove('anchor-highlight') + highlightedAnchor = null; + } + + let searchForContentTarget = function (element) { + if (element && element.hasAttribute) { + if (element.hasAttribute("data-togglable")) return element.getAttribute("data-togglable"); + else return searchForContentTarget(element.parentNode) + } else return null + } + + let findAnyTab = function (target) { + let result = null + document.querySelectorAll('div[tabs-section] > button[data-togglable]') + .forEach(node => { + if(node.getAttribute("data-togglable").split(",").includes(target)) { + result = node + } + }) + return result + } + + let anchor = window.location.hash + if (anchor != "") { + anchor = anchor.substring(1) + let element = document.querySelector('a[data-name="' + anchor + '"]') + + if (element) { + const content = element.nextElementSibling + const contentStyle = window.getComputedStyle(content) + if(contentStyle.display == 'none') { + let tab = findAnyTab(searchForContentTarget(content)) + if (tab) { + toggleSections(tab) + } + } + + if (content) { + content.classList.add('anchor-highlight') + highlightedAnchor = content + } + + scrollToElementInContent(element) + } + } +} + +function initTabs() { + // we could have only a single type of data - classlike or package + const mainContent = document.querySelector('.main-content'); + const type = mainContent ? mainContent.getAttribute("data-page-type") : null; + const localStorageKey = "active-tab-" + type; + document.querySelectorAll('div[tabs-section]').forEach(element => { + showCorrespondingTabBody(element); + element.addEventListener('click', ({target}) => { + const togglable = target ? target.getAttribute("data-togglable") : null; + if (!togglable) return; + + localStorage.setItem(localStorageKey, JSON.stringify(togglable)); + toggleSections(target); + }); + }); + + const cached = localStorage.getItem(localStorageKey); + if (!cached) return; + + const tab = document.querySelector( + 'div[tabs-section] > button[data-togglable="' + JSON.parse(cached) + '"]' + ); + if (!tab) return; + + toggleSections(tab); +} + +function showCorrespondingTabBody(element) { + const buttonWithKey = element.querySelector("button[data-active]") + if (buttonWithKey) { + toggleSections(buttonWithKey) + } +} + +function filterButtonHandler(event) { + if (event.target.tagName == "BUTTON" && event.target.hasAttribute("data-filter")) { + let sourceset = event.target.getAttribute("data-filter") + if (filteringContext.activeFilters.indexOf(sourceset) != -1) { + filterSourceset(sourceset) + } else { + unfilterSourceset(sourceset) + } + } +} + +function initializeFiltering() { + filteringContext.dependencies = JSON.parse(sourceset_dependencies) + document.querySelectorAll("#filter-section > button") + .forEach(p => filteringContext.restrictedDependencies.push(p.getAttribute("data-filter"))) + Object.keys(filteringContext.dependencies).forEach(p => { + filteringContext.dependencies[p] = filteringContext.dependencies[p] + .filter(q => -1 !== filteringContext.restrictedDependencies.indexOf(q)) + }) + let cached = window.localStorage.getItem('inactive-filters') + if (cached) { + l