aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/compiler.xml18
-rw-r--r--core/.gitignore2
-rw-r--r--core/build.gradle.kts11
-rw-r--r--core/src/main/resources/dokka/styles/style.css6
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt7
-rw-r--r--search-component/.gitignore3
-rw-r--r--search-component/build.gradle.kts18
-rw-r--r--search-component/package.json80
-rw-r--r--search-component/postcss.config.js17
-rw-r--r--search-component/src/main/js/search/app-root.js13
-rw-r--r--search-component/src/main/js/search/app.css21
-rw-r--r--search-component/src/main/js/search/app.js41
-rw-r--r--search-component/src/main/js/search/search.js53
-rw-r--r--search-component/stylelint.config.js4
-rw-r--r--search-component/webpack.config.js62
-rw-r--r--settings.gradle.kts1
16 files changed, 346 insertions, 11 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 924f38f8..ed6162d8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -38,8 +38,12 @@
<module name="dokka.integration.test" target="1.8" />
<module name="dokka.plugins.base.main" target="1.8" />
<module name="dokka.plugins.base.test" target="1.8" />
+ <module name="dokka.plugins.gfm.main" target="1.8" />
+ <module name="dokka.plugins.gfm.test" target="1.8" />
<module name="dokka.plugins.javadoc8.main" target="1.8" />
<module name="dokka.plugins.javadoc8.test" target="1.8" />
+ <module name="dokka.plugins.jekyll.main" target="1.8" />
+ <module name="dokka.plugins.jekyll.test" target="1.8" />
<module name="dokka.plugins.kotlin-as-java.main" target="1.8" />
<module name="dokka.plugins.kotlin-as-java.test" target="1.8" />
<module name="dokka.plugins.ma.main" target="1.8" />
@@ -94,20 +98,32 @@
<module name="org.jetbrains.dokka.core.test" target="1.8" />
<module name="org.jetbrains.dokka.coreDependencies.main" target="1.8" />
<module name="org.jetbrains.dokka.coreDependencies.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.core.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.core.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.coreDependencies.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.coreDependencies.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.integration-tests.gradle-integration-tests.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.integration-tests.gradle-integration-tests.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.integration-tests.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.integration-tests.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.base.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.base.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.kotlin-as-java.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.kotlin-as-java.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.plugins.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.plugins.mathjax.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.plugins.mathjax.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.plugins.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.cli.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.cli.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.gradle-plugin.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.gradle-plugin.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.runners.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.runners.maven-plugin.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.runners.maven-plugin.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.runners.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.search-component.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.search-component.test" target="1.8" />
<module name="org.jetbrains.dokka.dokka.testApi.main" target="1.8" />
<module name="org.jetbrains.dokka.dokka.testApi.test" target="1.8" />
<module name="org.jetbrains.dokka.fatjar.main" target="1.8" />
@@ -130,6 +146,8 @@
<module name="org.jetbrains.dokka.testApi.test" target="1.8" />
<module name="org.jetbrains.dokka.xml.main" target="1.8" />
<module name="org.jetbrains.dokka.xml.test" target="1.8" />
+ <module name="Workspace.dokka.buildSrc.main" target="1.8" />
+ <module name="Workspace.dokka.buildSrc.test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project> \ No newline at end of file
diff --git a/core/.gitignore b/core/.gitignore
new file mode 100644
index 00000000..a259cd26
--- /dev/null
+++ b/core/.gitignore
@@ -0,0 +1,2 @@
+src/main/resources/dokka/scripts/main.js
+src/main/resources/dokka/scripts/main.js.map \ No newline at end of file
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index 14718cfe..2ea57e09 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -24,6 +24,17 @@ val sourceJar by tasks.registering(Jar::class) {
from(sourceSets["main"].allSource)
}
+task("copy_search", Copy::class) {
+ from(File(project(":search-component").projectDir, "dist/"))
+ destinationDir = File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/scripts")
+}.dependsOn(":search-component:generateSearchFiles")
+
+tasks {
+ processResources {
+ dependsOn("copy_search")
+ }
+}
+
publishing {
publications {
register<MavenPublication>("dokkaCore") {
diff --git a/core/src/main/resources/dokka/styles/style.css b/core/src/main/resources/dokka/styles/style.css
index 1cab694a..80865758 100644
--- a/core/src/main/resources/dokka/styles/style.css
+++ b/core/src/main/resources/dokka/styles/style.css
@@ -46,13 +46,7 @@
}
#searchBar {
- width: 100%;
- pointer-events: none;
-}
-
-#searchForm {
float: right;
- pointer-events: all;
}
#logo {
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 08bfae1f..c2960694 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -306,12 +306,9 @@ open class HtmlRenderer(
id = "main"
div {
id = "searchBar"
- form(action = page.root("-search.html"), method = FormMethod.get) {
- id = "searchForm"
- input(type = InputType.search, name = "query")
- input(type = InputType.submit) { value = "Search" }
- }
}
+ script(type = ScriptType.textJavaScript, src = page.root("scripts/pages.js")) {}
+ script(type = ScriptType.textJavaScript, src = page.root("scripts/main.js")) {}
content()
}
}
diff --git a/search-component/.gitignore b/search-component/.gitignore
new file mode 100644
index 00000000..9220c11f
--- /dev/null
+++ b/search-component/.gitignore
@@ -0,0 +1,3 @@
+/dist/
+/node_modules/
+/package-lock.json
diff --git a/search-component/build.gradle.kts b/search-component/build.gradle.kts
new file mode 100644
index 00000000..ab123e51
--- /dev/null
+++ b/search-component/build.gradle.kts
@@ -0,0 +1,18 @@
+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/*.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/search-component/package.json b/search-component/package.json
new file mode 100644
index 00000000..fa997c44
--- /dev/null
+++ b/search-component/package.json
@@ -0,0 +1,80 @@
+{
+ "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/search-component/postcss.config.js b/search-component/postcss.config.js
new file mode 100644
index 00000000..ce65774e
--- /dev/null
+++ b/search-component/postcss.config.js
@@ -0,0 +1,17 @@
+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/search-component/src/main/js/search/app-root.js b/search-component/src/main/js/search/app-root.js
new file mode 100644
index 00000000..25a374a5
--- /dev/null
+++ b/search-component/src/main/js/search/app-root.js
@@ -0,0 +1,13 @@
+import React, {Component} from 'react';
+import {WithFuzzySearchFilter} from './search';
+import './app.css';
+
+export default class AppRoot extends Component {
+ render() {
+ return (
+ <div className="search-content">
+ <WithFuzzySearchFilter/>
+ </div>
+ );
+ }
+} \ No newline at end of file
diff --git a/search-component/src/main/js/search/app.css b/search-component/src/main/js/search/app.css
new file mode 100644
index 00000000..933237e0
--- /dev/null
+++ b/search-component/src/main/js/search/app.css
@@ -0,0 +1,21 @@
+@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 {
+ margin: calc(var(--ring-unit) * 4);
+}
diff --git a/search-component/src/main/js/search/app.js b/search-component/src/main/js/search/app.js
new file mode 100644
index 00000000..64091607
--- /dev/null
+++ b/search-component/src/main/js/search/app.js
@@ -0,0 +1,41 @@
+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(
+ <AppRoot/>,
+ rootEl
+ );
+};
+
+if (module.hot) {
+ const renderAppHot = renderApp;
+ const renderError = error => {
+ render(
+ <RedBox error={error}/>,
+ rootEl
+ );
+ };
+
+ renderApp = () => {
+ try {
+ renderAppHot();
+ } catch (error) {
+ renderError(error);
+ }
+ };
+
+ module.hot.accept('./app-root', () => {
+ setTimeout(renderApp);
+ });
+}
+
+renderApp();
+appEl.appendChild(rootEl);
diff --git a/search-component/src/main/js/search/search.js b/search-component/src/main/js/search/search.js
new file mode 100644
index 00000000..ea51b9a7
--- /dev/null
+++ b/search-component/src/main/js/search/search.js
@@ -0,0 +1,53 @@
+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 (
+ <div className="search-container">
+ <div className="search">
+ <Select
+ selectedLabel="Search"
+ label="Please type page name"
+ filter={{fuzzy: true}}
+ clear
+ selected={this.state.selected}
+ data={this.props.data}
+ onSelect={this.onSelect}
+ />
+ </div>
+ </div>
+ );
+ }
+}
+
+export const WithFuzzySearchFilter = () => {
+ let data = [];
+ if (window.pages) {
+ data = window.pages.map((page, i) => ({
+ ...page,
+ label: page.name,
+ key: i + 1,
+ type: page.kind,
+ icon: `${window.pathToRoot}${window.iconsFolderName}${page.kind}.png`
+ }));
+ }
+
+ return <WithFuzzySearchFilterComponent data={data}/>;
+};
diff --git a/search-component/stylelint.config.js b/search-component/stylelint.config.js
new file mode 100644
index 00000000..02b3f4ac
--- /dev/null
+++ b/search-component/stylelint.config.js
@@ -0,0 +1,4 @@
+module.exports = {
+ extends: '@jetbrains/stylelint-config',
+ rules: {}
+};
diff --git a/search-component/webpack.config.js b/search-component/webpack.config.js
new file mode 100644
index 00000000..a7b503b6
--- /dev/null
+++ b/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/settings.gradle.kts b/settings.gradle.kts
index 56c122f8..9f6d9421 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -13,6 +13,7 @@ include("plugins:gfm")
include("plugins:jekyll")
include("plugins:kotlin-as-java")
include("integration-tests:gradle-integration-tests")
+include("search-component")
pluginManagement {
val kotlin_version: String by settings