From 25d826bb75a78eb674a63aed19f55e92d7ff8bca Mon Sep 17 00:00:00 2001 From: Filip ZybaƂa Date: Tue, 12 May 2020 14:58:05 +0200 Subject: Migrated resources to base-plugin --- core/build.gradle.kts | 11 - core/search-component/.gitignore | 3 - core/search-component/build.gradle.kts | 18 - core/search-component/package.json | 80 --- core/search-component/postcss.config.js | 17 - .../src/main/js/search/app-root.js | 47 -- core/search-component/src/main/js/search/app.css | 21 - core/search-component/src/main/js/search/app.js | 41 -- core/search-component/src/main/js/search/search.js | 52 -- core/search-component/stylelint.config.js | 4 - core/search-component/webpack.config.js | 62 -- .../src/main/resources/dokka/format/gfm.properties | 2 - .../resources/dokka/format/html-as-java.properties | 2 - .../main/resources/dokka/format/html.properties | 2 - .../dokka/format/java-layout-html.properties | 2 - .../main/resources/dokka/format/jekyll.properties | 2 - .../dokka/format/kotlin-website-html.properties | 2 - .../resources/dokka/format/markdown.properties | 2 - .../src/main/resources/dokka/images/arrow_down.svg | 3 - core/src/main/resources/dokka/images/docs_logo.svg | 7 - core/src/main/resources/dokka/images/logo-icon.svg | 3 - core/src/main/resources/dokka/images/logo-text.svg | 6 - .../inbound-link-resolver/dokka-default.properties | 2 - .../java-layout-html.properties | 2 - .../dokka/inbound-link-resolver/javadoc.properties | 2 - .../resources/dokka/scripts/navigationLoader.js | 43 -- .../dokka/scripts/platformContentHandler.js | 52 -- core/src/main/resources/dokka/scripts/scripts.js | 11 - core/src/main/resources/dokka/scripts/search.js | 7 - .../main/resources/dokka/styles/jetbrains-mono.css | 13 - core/src/main/resources/dokka/styles/style.css | 735 --------------------- plugins/base/build.gradle.kts | 11 + plugins/base/search-component/.gitignore | 3 + plugins/base/search-component/build.gradle.kts | 18 + plugins/base/search-component/package.json | 80 +++ plugins/base/search-component/postcss.config.js | 17 + .../src/main/js/search/app-root.js | 47 ++ .../search-component/src/main/js/search/app.css | 21 + .../search-component/src/main/js/search/app.js | 41 ++ .../search-component/src/main/js/search/search.js | 52 ++ plugins/base/search-component/stylelint.config.js | 4 + plugins/base/search-component/webpack.config.js | 62 ++ .../base/src/main/kotlin/renderers/FileWriter.kt | 2 +- .../src/main/resources/dokka/format/gfm.properties | 2 + .../resources/dokka/format/html-as-java.properties | 2 + .../main/resources/dokka/format/html.properties | 2 + .../dokka/format/java-layout-html.properties | 2 + .../main/resources/dokka/format/jekyll.properties | 2 + .../dokka/format/kotlin-website-html.properties | 2 + .../resources/dokka/format/markdown.properties | 2 + .../src/main/resources/dokka/images/arrow_down.svg | 3 + .../src/main/resources/dokka/images/docs_logo.svg | 7 + .../src/main/resources/dokka/images/logo-icon.svg | 3 + .../src/main/resources/dokka/images/logo-text.svg | 6 + .../inbound-link-resolver/dokka-default.properties | 2 + .../java-layout-html.properties | 2 + .../dokka/inbound-link-resolver/javadoc.properties | 2 + .../resources/dokka/scripts/navigationLoader.js | 43 ++ .../dokka/scripts/platformContentHandler.js | 52 ++ .../src/main/resources/dokka/scripts/scripts.js | 11 + .../src/main/resources/dokka/scripts/search.js | 7 + .../main/resources/dokka/styles/jetbrains-mono.css | 13 + .../base/src/main/resources/dokka/styles/style.css | 735 +++++++++++++++++++++ settings.gradle.kts | 2 + 64 files changed, 1259 insertions(+), 1257 deletions(-) delete mode 100644 core/search-component/.gitignore delete mode 100644 core/search-component/build.gradle.kts delete mode 100644 core/search-component/package.json delete mode 100644 core/search-component/postcss.config.js delete mode 100644 core/search-component/src/main/js/search/app-root.js delete mode 100644 core/search-component/src/main/js/search/app.css delete mode 100644 core/search-component/src/main/js/search/app.js delete mode 100644 core/search-component/src/main/js/search/search.js delete mode 100644 core/search-component/stylelint.config.js delete mode 100644 core/search-component/webpack.config.js delete mode 100644 core/src/main/resources/dokka/format/gfm.properties delete mode 100644 core/src/main/resources/dokka/format/html-as-java.properties delete mode 100644 core/src/main/resources/dokka/format/html.properties delete mode 100644 core/src/main/resources/dokka/format/java-layout-html.properties delete mode 100644 core/src/main/resources/dokka/format/jekyll.properties delete mode 100644 core/src/main/resources/dokka/format/kotlin-website-html.properties delete mode 100644 core/src/main/resources/dokka/format/markdown.properties delete mode 100755 core/src/main/resources/dokka/images/arrow_down.svg delete mode 100644 core/src/main/resources/dokka/images/docs_logo.svg delete mode 100755 core/src/main/resources/dokka/images/logo-icon.svg delete mode 100755 core/src/main/resources/dokka/images/logo-text.svg delete mode 100644 core/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties delete mode 100644 core/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties delete mode 100644 core/src/main/resources/dokka/inbound-link-resolver/javadoc.properties delete mode 100644 core/src/main/resources/dokka/scripts/navigationLoader.js delete mode 100644 core/src/main/resources/dokka/scripts/platformContentHandler.js delete mode 100644 core/src/main/resources/dokka/scripts/scripts.js delete mode 100644 core/src/main/resources/dokka/scripts/search.js delete mode 100644 core/src/main/resources/dokka/styles/jetbrains-mono.css delete mode 100644 core/src/main/resources/dokka/styles/style.css create mode 100644 plugins/base/search-component/.gitignore create mode 100644 plugins/base/search-component/build.gradle.kts create mode 100644 plugins/base/search-component/package.json create mode 100644 plugins/base/search-component/postcss.config.js create mode 100644 plugins/base/search-component/src/main/js/search/app-root.js create mode 100644 plugins/base/search-component/src/main/js/search/app.css create mode 100644 plugins/base/search-component/src/main/js/search/app.js create mode 100644 plugins/base/search-component/src/main/js/search/search.js create mode 100644 plugins/base/search-component/stylelint.config.js create mode 100644 plugins/base/search-component/webpack.config.js create mode 100644 plugins/base/src/main/resources/dokka/format/gfm.properties create mode 100644 plugins/base/src/main/resources/dokka/format/html-as-java.properties create mode 100644 plugins/base/src/main/resources/dokka/format/html.properties create mode 100644 plugins/base/src/main/resources/dokka/format/java-layout-html.properties create mode 100644 plugins/base/src/main/resources/dokka/format/jekyll.properties create mode 100644 plugins/base/src/main/resources/dokka/format/kotlin-website-html.properties create mode 100644 plugins/base/src/main/resources/dokka/format/markdown.properties create mode 100755 plugins/base/src/main/resources/dokka/images/arrow_down.svg create mode 100644 plugins/base/src/main/resources/dokka/images/docs_logo.svg create mode 100755 plugins/base/src/main/resources/dokka/images/logo-icon.svg create mode 100755 plugins/base/src/main/resources/dokka/images/logo-text.svg create mode 100644 plugins/base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties create mode 100644 plugins/base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties create mode 100644 plugins/base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties create mode 100644 plugins/base/src/main/resources/dokka/scripts/navigationLoader.js create mode 100644 plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js create mode 100644 plugins/base/src/main/resources/dokka/scripts/scripts.js create mode 100644 plugins/base/src/main/resources/dokka/scripts/search.js create mode 100644 plugins/base/src/main/resources/dokka/styles/jetbrains-mono.css create mode 100644 plugins/base/src/main/resources/dokka/styles/style.css diff --git a/core/build.gradle.kts b/core/build.gradle.kts index bcc74480..14718cfe 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -24,17 +24,6 @@ val sourceJar by tasks.registering(Jar::class) { from(sourceSets["main"].allSource) } -task("copy_search", Copy::class) { - from(File(project(":core:search-component").projectDir, "dist/")) - destinationDir = File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/scripts") -}.dependsOn(":core:search-component:generateSearchFiles") - -tasks { - processResources { - dependsOn("copy_search") - } -} - publishing { publications { register("dokkaCore") { diff --git a/core/search-component/.gitignore b/core/search-component/.gitignore deleted file mode 100644 index 9220c11f..00000000 --- a/core/search-component/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/dist/ -/node_modules/ -/package-lock.json diff --git a/core/search-component/build.gradle.kts b/core/search-component/build.gradle.kts deleted file mode 100644 index ce747c5e..00000000 --- a/core/search-component/build.gradle.kts +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id("com.moowork.node") version "1.3.1" -} - -task("generateSearchFiles") { - dependsOn("npm_install", "npm_run_build") -} - -tasks { - "npm_run_build" { - inputs.dir("$projectDir/src/main/js/search/") - inputs.files("$projectDir/package.json", "$projectDir/webpack.config.js") - outputs.dir("$projectDir/dist/") - } - clean { - delete = setOf("$projectDir/node_modules", "$projectDir/dist/", "$projectDir/package-lock.json") - } -} \ No newline at end of file diff --git a/core/search-component/package.json b/core/search-component/package.json deleted file mode 100644 index fa997c44..00000000 --- a/core/search-component/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "search", - "version": "1.0.0", - "private": true, - "config": { - "components": "./src/main/js/search", - "dist": "./dist" - }, - "scripts": { - "create-component": "yo @jetbrains/ring-ui:react --path $npm_package_config_components", - "build": "webpack --mode=production --devtool sourcemap", - "test": "karma start", - "lint": "eslint . && npm run stylelint", - "stylelint": "stylelint --ignore-path .gitignore **/*.css", - "ci-test": "npm run lint && xvfb-maybe karma start --teamcity", - "start": "webpack-dev-server -d --history-api-fallback --inline --hot --colors --port 9010" - }, - "babel": { - "presets": [ - [ - "@jetbrains/jetbrains", - { - "useBuiltIns": "usage" - } - ] - ] - }, - "dependencies": { - "@babel/core": "^7.8.3", - "@jetbrains/babel-preset-jetbrains": "^2.1.4", - "@jetbrains/icons": "3.6.0", - "@jetbrains/logos": "1.1.5", - "@jetbrains/ring-ui": "2.1.16", - "babel-loader": "^8.0.6", - "copy-webpack-plugin": "^5.1.1", - "css-loader": "^3.4.2", - "json-loader": "^0.5.7", - "postcss-import": "^12.0.1", - "postcss-loader": "^3.0.0", - "postcss-preset-env": "^6.7.0", - "prop-types": "^15.7.2", - "react": "^16.12.0", - "react-dom": "^16.12.0", - "redbox-react": "^1.6.0", - "webpack": "^4.41.5", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.10.1" - }, - "devDependencies": { - "@jetbrains/generator-ring-ui": "2.0.53", - "@jetbrains/eslint-config": "^4.0.6", - "@jetbrains/stylelint-config": "^2.0.0", - "babel-eslint": "^10.0.3", - "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", - "chai-dom": "^1.8.1", - "chai-enzyme": "1.0.0-beta.1", - "electron": "^7.1.9", - "enzyme": "^3.11.0", - "enzyme-adapter-react-16": "^1.15.2", - "eslint": "^6.8.0", - "karma": "^4.4.1", - "karma-chai-plugins": "^0.9.0", - "karma-electron": "^6.3.0", - "karma-mocha": "^1.3.0", - "karma-sourcemap-loader": "^0.3.7", - "karma-teamcity-reporter": "^1.1.0", - "karma-webpack": "^4.0.2", - "mocha": "^6.2.2", - "react-test-renderer": "^16.12.0", - "sinon": "^8.0.4", - "sinon-chai": "^3.4.0", - "stylelint": "^12.0.1", - "xvfb-maybe": "^0.2.1", - "yo": "^3.1.1" - }, - "engines": { - "node": ">=8.0.0" - } -} diff --git a/core/search-component/postcss.config.js b/core/search-component/postcss.config.js deleted file mode 100644 index ce65774e..00000000 --- a/core/search-component/postcss.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = () => ({ - plugins: [ - require('postcss-import'), - require('postcss-preset-env')({ - features: { - stage: 3, // See https://cssdb.org/#staging-process - importFrom: require.resolve('@jetbrains/ring-ui/components/global/variables.css'), - features: { - 'nesting-rules': true, - 'custom-properties': { - preserve: true - } - } - } - }) - ] -}); diff --git a/core/search-component/src/main/js/search/app-root.js b/core/search-component/src/main/js/search/app-root.js deleted file mode 100644 index 5d650581..00000000 --- a/core/search-component/src/main/js/search/app-root.js +++ /dev/null @@ -1,47 +0,0 @@ -import React, {useRef, useState, useEffect} from 'react'; -import {WithFuzzySearchFilter} from './search'; -import './app.css'; - -function useComponentVisible(initialIsVisible) { - const [isComponentVisible, setIsComponentVisible] = useState(initialIsVisible); - const ref = useRef(null); - - const handleHideDropdown = (event) => { - if (event.key === "Escape") { - setIsComponentVisible(false); - } - }; - - const handleClickOutside = event => { - if (ref.current && !ref.current.contains(event.target)) { - setIsComponentVisible(false); - } - }; - - useEffect(() => { - document.addEventListener("keydown", handleHideDropdown, true); - document.addEventListener("click", handleClickOutside, true); - return () => { - document.removeEventListener("keydown", handleHideDropdown, true); - document.removeEventListener("click", handleClickOutside, true); - }; - }); - - return { ref, isComponentVisible, setIsComponentVisible }; -} - -export const AppRoot = () => { - const { - ref, - isComponentVisible, - setIsComponentVisible - } = useComponentVisible(false); - - return
- {isComponentVisible && ()} - {!isComponentVisible && ( - setIsComponentVisible(true)}> - - )} -
-} \ No newline at end of file diff --git a/core/search-component/src/main/js/search/app.css b/core/search-component/src/main/js/search/app.css deleted file mode 100644 index c51d3fe1..00000000 --- a/core/search-component/src/main/js/search/app.css +++ /dev/null @@ -1,21 +0,0 @@ -@import "@jetbrains/ring-ui/components/global/variables.css"; - -html, -.app-root { - height: 100%; -} - -.search-root { - margin: 0; - padding: 0; - - background: var(--ring-content-background-color); - - font-family: var(--ring-font-family); - font-size: var(--ring-font-size); - line-height: var(--ring-line-height); -} - -.search-content { - padding: 24px 41px; -} diff --git a/core/search-component/src/main/js/search/app.js b/core/search-component/src/main/js/search/app.js deleted file mode 100644 index bceffa48..00000000 --- a/core/search-component/src/main/js/search/app.js +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import {render} from 'react-dom'; -import RedBox from 'redbox-react'; - -import {AppRoot} from './app-root'; -import './app.css'; - -const appEl = document.getElementById('searchBar'); -const rootEl = document.createElement('div'); - -let renderApp = () => { - render( - , - rootEl - ); -}; - -if (module.hot) { - const renderAppHot = renderApp; - const renderError = error => { - render( - , - rootEl - ); - }; - - renderApp = () => { - try { - renderAppHot(); - } catch (error) { - renderError(error); - } - }; - - module.hot.accept('./app-root', () => { - setTimeout(renderApp); - }); -} - -renderApp(); -appEl.appendChild(rootEl); diff --git a/core/search-component/src/main/js/search/search.js b/core/search-component/src/main/js/search/search.js deleted file mode 100644 index a742f11d..00000000 --- a/core/search-component/src/main/js/search/search.js +++ /dev/null @@ -1,52 +0,0 @@ -import React, {Component} from 'react'; -import Select from '@jetbrains/ring-ui/components/select/select'; -import '@jetbrains/ring-ui/components/input-size/input-size.scss'; - -class WithFuzzySearchFilterComponent extends Component { - constructor(props) { - super(props); - this.state = {selected: props.data[0]}; - } - - clearSelection = () => { - this.setState({selected: null}); - }; - - onSelect = option => { - window.location.href = `${window.pathToRoot}${option.location}?query${option.name}`; - this.setState({selected: option}); - debugger - }; - - render() { - return ( -
-
- +
+
+ ); + } +} + +export const WithFuzzySearchFilter = () => { + let data = []; + if (window.pages) { + data = window.pages.map((page, i) => ({ + ...page, + label: page.name, + key: i + 1, + type: page.kind + })); + } + + return ; +}; diff --git a/plugins/base/search-component/stylelint.config.js b/plugins/base/search-component/stylelint.config.js new file mode 100644 index 00000000..02b3f4ac --- /dev/null +++ b/plugins/base/search-component/stylelint.config.js @@ -0,0 +1,4 @@ +module.exports = { + extends: '@jetbrains/stylelint-config', + rules: {} +}; diff --git a/plugins/base/search-component/webpack.config.js b/plugins/base/search-component/webpack.config.js new file mode 100644 index 00000000..a7b503b6 --- /dev/null +++ b/plugins/base/search-component/webpack.config.js @@ -0,0 +1,62 @@ +const {join, resolve} = require('path'); + +const ringUiWebpackConfig = require('@jetbrains/ring-ui/webpack.config'); + +const pkgConfig = require('./package.json').config; + +const componentsPath = join(__dirname, pkgConfig.components); + +// Patch @jetbrains/ring-ui svg-sprite-loader config +ringUiWebpackConfig.loaders.svgInlineLoader.include.push( + require('@jetbrains/logos'), + require('@jetbrains/icons') +); + +const webpackConfig = () => ({ + entry: `${componentsPath}/app.js`, + resolve: { + mainFields: ['module', 'browser', 'main'], + alias: { + react: resolve('./node_modules/react'), + 'react-dom': resolve('./node_modules/react-dom'), + '@jetbrains/ring-ui': resolve('./node_modules/@jetbrains/ring-ui') + } + }, + output: { + path: resolve(__dirname, pkgConfig.dist), + filename: '[name].js', + publicPath: '', + devtoolModuleFilenameTemplate: '/[absolute-resource-path]' + }, + module: { + rules: [ + ...ringUiWebpackConfig.config.module.rules, + { + test: /\.css$/, + include: componentsPath, + use: [ + 'style-loader', + {loader: 'css-loader'}, + {loader: 'postcss-loader'} + ] + }, + { + test: /\.css$/, + include: /node_modules/, + exclude: ringUiWebpackConfig.componentsPath, + use: ['style-loader', 'css-loader'] + }, + { + test: /\.js$/, + include: [componentsPath], + loader: 'babel-loader?cacheDirectory' + } + ] + }, + plugins: [], + output: { + path: __dirname + '/dist/' + } +}); + +module.exports = webpackConfig; diff --git a/plugins/base/src/main/kotlin/renderers/FileWriter.kt b/plugins/base/src/main/kotlin/renderers/FileWriter.kt index 236cbad8..181295c0 100644 --- a/plugins/base/src/main/kotlin/renderers/FileWriter.kt +++ b/plugins/base/src/main/kotlin/renderers/FileWriter.kt @@ -66,7 +66,7 @@ class FileWriter(val context: DokkaContext): OutputWriter { val filePath = file.toAbsolutePath().toString() withContext(Dispatchers.IO) { Paths.get(root, rebase(filePath)).toFile().writeBytes( - javaClass.getResourceAsStream(filePath).readBytes() + this@FileWriter.javaClass.getResourceAsStream(filePath).readBytes() ) } } diff --git a/plugins/base/src/main/resources/dokka/format/gfm.properties b/plugins/base/src/main/resources/dokka/format/gfm.properties new file mode 100644 index 00000000..5e8f7aa8 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/gfm.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.GFMFormatDescriptor +description=Produces documentation in GitHub-flavored markdown format diff --git a/plugins/base/src/main/resources/dokka/format/html-as-java.properties b/plugins/base/src/main/resources/dokka/format/html-as-java.properties new file mode 100644 index 00000000..f598f377 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/html-as-java.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.HtmlAsJavaFormatDescriptor +description=Produces output in HTML format using Java syntax \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/format/html.properties b/plugins/base/src/main/resources/dokka/format/html.properties new file mode 100644 index 00000000..7881dfae --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/html.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.HtmlFormatDescriptor +description=Produces output in HTML format \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/format/java-layout-html.properties b/plugins/base/src/main/resources/dokka/format/java-layout-html.properties new file mode 100644 index 00000000..fbb2bbed --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/java-layout-html.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.JavaLayoutHtmlFormatDescriptor +description=Produces Kotlin Style Docs with Javadoc like layout \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/format/jekyll.properties b/plugins/base/src/main/resources/dokka/format/jekyll.properties new file mode 100644 index 00000000..b11401a4 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/jekyll.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.JekyllFormatDescriptor +description=Produces documentation in Jekyll format \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/format/kotlin-website-html.properties b/plugins/base/src/main/resources/dokka/format/kotlin-website-html.properties new file mode 100644 index 00000000..f4c320b9 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/kotlin-website-html.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.KotlinWebsiteHtmlFormatDescriptor +description=Generates Kotlin website documentation \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/format/markdown.properties b/plugins/base/src/main/resources/dokka/format/markdown.properties new file mode 100644 index 00000000..6217a6df --- /dev/null +++ b/plugins/base/src/main/resources/dokka/format/markdown.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.MarkdownFormatDescriptor +description=Produces documentation in markdown format \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/images/arrow_down.svg b/plugins/base/src/main/resources/dokka/images/arrow_down.svg new file mode 100755 index 00000000..89e7df47 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/images/arrow_down.svg @@ -0,0 +1,3 @@ + + + diff --git a/plugins/base/src/main/resources/dokka/images/docs_logo.svg b/plugins/base/src/main/resources/dokka/images/docs_logo.svg new file mode 100644 index 00000000..7c1e3ae8 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/images/docs_logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/base/src/main/resources/dokka/images/logo-icon.svg b/plugins/base/src/main/resources/dokka/images/logo-icon.svg new file mode 100755 index 00000000..1b3b3670 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/images/logo-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/plugins/base/src/main/resources/dokka/images/logo-text.svg b/plugins/base/src/main/resources/dokka/images/logo-text.svg new file mode 100755 index 00000000..7bf3e6c5 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/images/logo-text.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/plugins/base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties b/plugins/base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties new file mode 100644 index 00000000..c484a920 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.InboundExternalLinkResolutionService$Dokka +description=Uses Dokka Default resolver \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties b/plugins/base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties new file mode 100644 index 00000000..3b61eabe --- /dev/null +++ b/plugins/base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.Formats.JavaLayoutHtmlInboundLinkResolutionService +description=Resolver for JavaLayoutHtml \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties b/plugins/base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties new file mode 100644 index 00000000..0d5d7d17 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.InboundExternalLinkResolutionService$Javadoc +description=Uses Javadoc Default resolver \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/scripts/navigationLoader.js b/plugins/base/src/main/resources/dokka/scripts/navigationLoader.js new file mode 100644 index 00000000..cac46d2a --- /dev/null +++ b/plugins/base/src/main/resources/dokka/scripts/navigationLoader.js @@ -0,0 +1,43 @@ +window.addEventListener('load', () => { + fetch(pathToRoot + "navigation.html") + .then(response => response.text()) + .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() + }) +}) + +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) + } +}; \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js b/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js new file mode 100644 index 00000000..72c8daae --- /dev/null +++ b/plugins/base/src/main/resources/dokka/scripts/platformContentHandler.js @@ -0,0 +1,52 @@ +window.addEventListener('load', () => { + document.querySelectorAll("div[data-platform-hinted]") + .forEach(elem => elem.addEventListener('click', (event) => togglePlatformDependent(event,elem))) + document.querySelectorAll("div[tabs-section]") + .forEach(elem => elem.addEventListener('click', (event) => toggleSections(event))) + document.querySelector(".tabs-section-body") + .querySelector("div[data-togglable]") + .setAttribute("data-active", "") +}) + +function toggleSections(evt){ + if(!evt.target.getAttribute("data-togglable")) return + + const activateTabs = (containerClass) => { + for(const element of document.getElementsByClassName(containerClass)){ + for(const child of element.children){ + if(child.getAttribute("data-togglable") === evt.target.getAttribute("data-togglable")){ + child.setAttribute("data-active", "") + } else { + child.removeAttribute("data-active") + } + } + } + } + + activateTabs("tabs-section") + activateTabs("tabs-section-body") +} + +function togglePlatformDependent(e, container) { + let target = e.target + if (target.tagName != 'BUTTON') return; + let index = target.getAttribute('data-toggle') + + for(let child of container.children){ + if(child.hasAttribute('data-toggle-list')){ + for(let bm of child.children){ + if(bm == target){ + bm.setAttribute('data-active',"") + } else if(bm != target) { + bm.removeAttribute('data-active') + } + } + } + else if(child.getAttribute('data-togglable') == index) { + child.setAttribute('data-active',"") + } + else { + child.removeAttribute('data-active') + } + } +} diff --git a/plugins/base/src/main/resources/dokka/scripts/scripts.js b/plugins/base/src/main/resources/dokka/scripts/scripts.js new file mode 100644 index 00000000..c2e29b9f --- /dev/null +++ b/plugins/base/src/main/resources/dokka/scripts/scripts.js @@ -0,0 +1,11 @@ +document.getElementById("navigationFilter").oninput = function (e) { + var input = e.target.value; + var menuParts = document.getElementsByClassName("sideMenuPart") + for (let part of menuParts) { + if(part.querySelector("a").textContent.startsWith(input)) { + part.classList.remove("filtered"); + } else { + part.classList.add("filtered"); + } + } +} \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/scripts/search.js b/plugins/base/src/main/resources/dokka/scripts/search.js new file mode 100644 index 00000000..04d88ab5 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/scripts/search.js @@ -0,0 +1,7 @@ +let query = new URLSearchParams(window.location.search).get("query"); +document.getElementById("searchTitle").innerHTML += '"' + query + '":'; +document.getElementById("searchTable").innerHTML = pages + .filter(el => el.name.toLowerCase().startsWith(query.toLowerCase())) + .reduce((acc, element) => { + return acc + '' + element.name + '' + }, ""); \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/styles/jetbrains-mono.css b/plugins/base/src/main/resources/dokka/styles/jetbrains-mono.css new file mode 100644 index 00000000..2af32a92 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/styles/jetbrains-mono.css @@ -0,0 +1,13 @@ +@font-face{ + font-family: 'JetBrains Mono'; + src: url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff2/JetBrainsMono-Regular.woff2') format('woff2'); + font-weight: normal; + font-style: normal; +} + +@font-face{ + font-family: 'JetBrains Mono'; + src: url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff2/JetBrainsMono-Bold.woff2') format('woff2'); + font-weight: bold; + font-style: normal; +} \ No newline at end of file diff --git a/plugins/base/src/main/resources/dokka/styles/style.css b/plugins/base/src/main/resources/dokka/styles/style.css new file mode 100644 index 00000000..6ba41db4 --- /dev/null +++ b/plugins/base/src/main/resources/dokka/styles/style.css @@ -0,0 +1,735 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:300i,400,700); +@import url('https://rsms.me/inter/inter.css'); +@import url('jetbrains-mono.css'); + +:root { + --breadcrumb-font-color: #A6AFBA; + --hover-link-color: #5B5DEF +} + +#content { + padding: 0 41px; +} + +.breadcrumbs { + padding: 24px 0; + color: var(--breadcrumb-font-color); +} + +.breadcrumbs a { + color: var(--breadcrumb-font-color) +} + +.breadcrumbs a:hover { + color: var(--hover-link-color) +} + +.tabs-section-body > *:not([data-active]){ + display: none; +} + +.tabs-section > .section-tab:first-child { + margin-left: 0; +} + +.section-tab { + border: 0; + cursor: pointer; + background-color: transparent; + border-bottom: 1px solid #DADFE6; + padding: 11px 3px; + font-size: 14px; + color: #637282; + outline:none; + margin: 0 8px; +} + +.section-tab:hover { + color: #282E34; + border-bottom: 2px solid var(--hover-link-color); +} + +.section-tab[data-active=''] { + color: #282E34; + border-bottom: 2px solid var(--hover-link-color); +} + +.tabs-section-body { + padding: 24px 0 +} + +.cover > .platform-hinted { + padding: 24px 0 +} + +.tabbedcontent { + padding: 24px 0; +} + +.cover .platform-hinted .single-content > .symbol { + background-color: white; +} + +.divergent-group { + background-color: white; + padding: 12px 8px; + margin-bottom: 2px; +} + +.divergent-group .table-row { + background-color: #F4F4F4; +} + +#container { + display: flex; + flex-direction: row; + min-height: 100%; +} + +#main { + width: 100%; + padding-left: 12px; +} + +#leftColumn { + width: 280px; + min-height: 100%; + border-right: 1px solid #DADFE6; + flex: 0 0 auto; +} + +@media screen and (max-width: 600px) { + #container { + flex-direction: column; + } + + #leftColumn { + border-right: none; + } +} + +#sideMenu { + height: 100%; + padding-top: 16px; + position: relative; + overflow: auto; +} + +#sideMenu img { + margin: 1em 0.25em; +} + +#sideMenu hr { + background: #DADFE6; +} + +#searchBar { + float: right; +} + +#logo { + background-size: 125px 26px; + border-bottom: 1px solid #DADFE6; + background-repeat: no-repeat; + background-image: url(../images/docs_logo.svg); + background-origin: content-box; + padding-left: 24px; + padding-top: 24px; + height: 48px; +} + +.monospace, +.code { + font-family: monospace; +} + +.overview > .navButton { + width: 100%; + height: 100%; + align-items: center; + display: flex; + justify-content: flex-end; + padding-right: 24px; +} + +.strikethrough { + text-decoration: line-through; +} + +.symbol:empty { + padding: 0; +} + +.symbol { + background-color: #F4F4F4; + align-items: center; + display: flex; + padding: 8px 16px; + box-sizing: border-box; + font-weight: bold; + white-space: pre; + flex-wrap: wrap; +} + +#nav-submenu > .sideMenuPart { + padding-left: 0; /* packages are same level as modules */ +} + +.sideMenuPart > .overview { + height: 40px; + width: 100%; + display: flex; + align-items: center; + position: relative; + user-select: none; /* there's a weird bug with text selection */ +} + +.sideMenuPart a { + display: flex; + align-items: center; + flex: 1; + height: 100%; + color: #637282; +} + +.sideMenuPart > .overview:before { + box-sizing: border-box; + content: ''; + top: 0; + width: 200%; + right: 0; + bottom: 0; + position: absolute; + z-index: -1; +} + +.overview:hover:before { + background-color: #DADFE5; +} + +#nav-submenu { + padding-left: 24px; +} + +.sideMenuPart { + padding-left: 12px; + box-sizing: border-box; +} + +.sideMenuPart .hidden > .overview .navButtonContent::before { + transform: rotate(0deg); +} + +.sideMenuPart > .overview .navButtonContent::before { + content: url("../images/arrow_down.svg"); + height: 100%; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + transform: rotate(180deg); +} + +.sideMenuPart.hidden > .navButton .navButtonContent::after { + content: '\02192'; +} + +.sideMenuPart.hidden > .sideMenuPart { + height: 0; + visibility: hidden; +} + +.filtered > a, .filtered > .navButton { + display: none; +} + +body, table { + font-family: 'Inter', "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + background: #F4F4F4; + font-style: normal; + font-weight: normal; + font-size: 14px; + line-height: 24px; + margin: 0; + max-width: 1440px; +} + +table { + width: 100%; + border-collapse: collapse; + background-color: #ffffff; + padding: 5px; +} + +tbody > tr { + border-bottom: 2px solid #F4F4F4; + min-height: 56px; +} + +td:first-child { + width: 20vw; +} + +.keyword { + color: black; + font-family: JetBrains Mono, Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; + font-size: 12px; +} + +.symbol { + font-family: JetBrains Mono, Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; + font-size: 12px; + min-height: 43px; +} + +.symbol > a { + color: var(--hover-link-color); + text-decoration: underline; +} + +.identifier { + color: darkblue; + font-size: 12px; + font-family: JetBrains Mono, Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; +} + +.brief { + white-space: pre-wrap; + overflow: hidden; + padding-top: 8px; +} + +h1, h2, h3, h4, h5, h6 { + color: #222; +} + +p, ul, ol, table, pre, dl { + margin: 0 0 20px; +} + +h1, h2, h3 { + line-height: 1.1; +} + +h1 { + font-size: 60px; + line-height: 64px; + letter-spacing: -1.5px; +} + +h2 { + color: #393939; +} + +h3, h4, h5, h6 { + color: #494949; +} + +a { + color: #258aaf; + font-weight: 400; + text-decoration: none; +} + +a:hover { + color: #282E34; + text-decoration: none; +} + +a small { + font-size: 11px; + color: #555; + margin-top: -0.6em; + display: block; +} + +.wrapper { + width: 860px; + margin: 0 auto; +} + +blockquote { + border-left: 1px solid #e5e5e5; + margin: 0; + padding: 0 0 0 20px; + font-style: italic; +} + +code, pre { + font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; + color: #333; + font-size: 12px; +} + +pre { + display: block; + /* + padding:8px 8px; + background: #f8f8f8; + border-radius:5px; + border:1px solid #e5e5e5; + */ + overflow-x: auto; +} + +th, td { + text-align: left; + vertical-align: top; + padding: 5px 10px; +} + +dt { + color: #444; + font-weight: 700; +} + +th { + color: #444; +} + +img { + max-width: 100%; +} + +header { + width: 270px; + float: left; + position: fixed; +} + +header ul { + list-style: none; + height: 40px; + + padding: 0; + + background: #eee; + background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f8f8f8), color-stop(100%, #dddddd)); + background: -webkit-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); + background: -o-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); + background: -ms-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); + background: linear-gradient(top, #f8f8f8 0%, #dddddd 100%); + + border-radius: 5px; + border: 1px solid #d2d2d2; + box-shadow: inset #fff 0 1px 0, inset rgba(0, 0, 0, 0.03) 0 -1px 0; + width: 270px; +} + +header li { + width: 89px; + float: left; + border-right: 1px solid #d2d2d2; + height: 40px; +} + +header ul a { + line-height: 1; + font-size: 11px; + color: #999; + display: block; + text-align: center; + padding-top: 6px; + height: 40px; +} + +strong { + color: #222; + font-weight: 700; +} + +header ul li + li { + width: 88px; + border-left: 1px solid #fff; +} + +header ul li + li + li { + border-right: none; + width: 89px; +} + +header ul a strong { + font-size: 14px; + display: block; + color: #222; +} + +section { + width: 500px; + float: right; + padding-bottom: 50px; +} + +small { + font-size: 11px; +} + +hr { + border: 0; + background: #e5e5e5; + height: 1px; + margin: 0 0 20px; +} + +footer { + width: 270px; + float: left; + position: fixed; + bottom: 50px; +} + +.platform-tag { + display: flex; + flex-direction: row; + padding: 4px 8px; + height: 16px; + border-radius: 100px; + + font-family: Inter, Arial, sans-serif; + font-size: 12px; + font-weight: 400; + font-style: normal; + font-stretch: normal; + line-height: normal; + letter-spacing: normal; + text-align: center; + + color: #fff + +} + +.platform-tags { + flex: 0 0 auto; + display: flex; +} + +.platform-tags > .platform-tag { + align-self: center; +} + +.platform-tag.jvm-like { + background-color: #4DBB5F; + color: white; +} + +.platform-tag.js-like { + background-color: #FED236; + color: white; +} + +.platform-tag.native-like { + background-color: #CD74F6; + color: white; +} + +.platform-tag.common-like { + background-color: #A6AFBA; + color: white; +} + +td.content { + padding-left: 24px; + padding-top: 16px; + display: flex; + flex-direction: column; +} + +.main-subrow { + display: flex; + flex-direction: row; + padding: 0; + justify-content: space-between; +} + +.main-subrow > a { + text-decoration: none; + font-style: normal; + font-weight: 600; + font-size: 14px; + color: #282E34; +} + +.main-subrow > a:hover { + color: var(--hover-link-color); +} + +.platform-hinted { + flex: auto; + display: block; + margin-bottom: 5px; +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark { + min-width: 64px; + height: 36px; + border: 2px solid white; + background: white; + outline: none; + flex: none; + order: 5; + align-self: flex-start; + margin: 0; +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.jvm-like:hover { + border-top: 2px solid rgba(77, 187, 95, 0.3); +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.js-like:hover { + border-top: 2px solid rgba(254, 175, 54, 0.3); +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.native-like:hover { + border-top: 2px solid rgba(105, 118, 249, 0.3); +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.common-like:hover { + border-top: 2px solid rgba(161, 170, 180, 0.3); +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.jvm-like[data-active=''] { + border: 2px solid #F4F4F4; + border-top: 2px solid #4DBB5F; + + background: #F4F4F4; +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.js-like[data-active=''] { + border: 2px solid #F4F4F4; + border-top: 2px solid #FED236; + + background: #F4F4F4; +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.native-like[data-active=''] { + border: 2px solid #F4F4F4; + border-top: 2px solid #CD74F6; + + background: #F4F4F4; +} + +.platform-hinted > .platform-bookmarks-row > .platform-bookmark.common-like[data-active=''] { + border: 2px solid #F4F4F4; + border-top: 2px solid #A6AFBA; + + background: #F4F4F4; +} + +.platform-hinted > .content:not([data-active]) { + display: none +} + +.sideMenuPart[data-active] > .overview { + background: rgba(91, 93, 239, 0.15); + border-left: 4px solid var(--hover-link-color); +} + +.table { + display: flex; + flex-direction: column; +} + +.table-row { + display: flex; + flex-direction: column; + background: white; + margin-bottom: 2px; + padding: 16px 24px 16px 24px; +} + +.platform-dependent-row { + display: grid; + padding-top: 8px; +} + +.title-row { + display: grid; + grid-template-columns: auto auto 7em; + width: 100%; +} + +.keyValue { + display: grid; +} + +@media print, screen and (min-width: 960px) { + .keyValue { + grid-template-columns: 20% auto; + } + + .title-row { + grid-template-columns: 20% auto 7em; + } +} + +@media print, screen and (max-width: 960px) { + + div.wrapper { + width: auto; + margin: 0; + } + + header, section, footer { + float: none; + position: static; + width: auto; + } + + header { + padding-right: 320px; + } + + section { + border: 1px solid #e5e5e5; + border-width: 1px 0; + padding: 20px 0; + margin: 0 0 20px; + } + + header a small { + display: inline; + } + + header ul { + position: absolute; + right: 50px; + top: 52px; + } +} + +@media print, screen and (max-width: 720px) { + body { + word-wrap: break-word; + } + + header { + padding: 0; + } + + header ul, header p.view { + position: static; + } + + pre, code { + word-wrap: normal; + } +} + +@media print, screen and (max-width: 480px) { + body { + padding-right: 15px; + } + + header ul { + display: none; + } +} + +@media print { + body { + padding: 0.4in; + font-size: 12pt; + color: #444; + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 82bc8f5d..95ad24b0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -32,3 +32,5 @@ pluginManagement { gradlePluginPortal() } } +include("plugins:base:search-component") +findProject(":plugins:base:search-component")?.name = "search-component" -- cgit