diff --git a/.gitignore b/.gitignore index f51a8a8..9672d0a 100644 --- a/.gitignore +++ b/.gitignore @@ -119,4 +119,90 @@ gradle-app.setting # End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle # run-paper -run/** \ No newline at end of file +run/** + +# Bun +bun.lock + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# database +*.sqlite + +# package-json +bun.lock + +# bun deploy file +node_modules.bun + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..6dc972e --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +.vitepress/cache \ No newline at end of file diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts new file mode 100644 index 0000000..b589772 --- /dev/null +++ b/docs/.vitepress/config.mts @@ -0,0 +1,42 @@ +import {defineConfig} from 'vitepress' + +// https://vitepress.dev/reference/site-config +export default defineConfig({ + title: "KikoAPI docs", + description: "KikoAPI is a lightweight helper library for our Paper plugins that speeds up development.", + vite: { + css: { + preprocessorOptions: { + scss: { + api: "modern-compiler" + } + } + } + }, + srcDir: './pages', + appearance: 'force-dark', + themeConfig: { + search: { + provider: 'local' + }, + // https://vitepress.dev/reference/default-theme-config + nav: [ + {text: 'Home', link: '/'}, + {text: 'Examples', link: '/markdown-examples'} + ], + + sidebar: [ + { + text: 'Examples', + items: [ + {text: 'Markdown Examples', link: '/markdown-examples'}, + {text: 'Runtime API Examples', link: '/api-examples'} + ] + } + ], + + socialLinks: [ + {icon: 'github', link: 'https://github.com/KikoPlugins/KikoAPI'} + ] + } +}) diff --git a/docs/.vitepress/theme/components/CachedImage.vue b/docs/.vitepress/theme/components/CachedImage.vue new file mode 100644 index 0000000..531d362 --- /dev/null +++ b/docs/.vitepress/theme/components/CachedImage.vue @@ -0,0 +1,190 @@ + + + + + \ No newline at end of file diff --git a/docs/.vitepress/theme/components/KikoFeature.vue b/docs/.vitepress/theme/components/KikoFeature.vue new file mode 100644 index 0000000..102c5bd --- /dev/null +++ b/docs/.vitepress/theme/components/KikoFeature.vue @@ -0,0 +1,181 @@ + + + + + \ No newline at end of file diff --git a/docs/.vitepress/theme/components/KikoHero.vue b/docs/.vitepress/theme/components/KikoHero.vue new file mode 100644 index 0000000..5fa8e93 --- /dev/null +++ b/docs/.vitepress/theme/components/KikoHero.vue @@ -0,0 +1,451 @@ + + + + + \ No newline at end of file diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts new file mode 100644 index 0000000..79429dc --- /dev/null +++ b/docs/.vitepress/theme/index.ts @@ -0,0 +1,13 @@ +import {Theme} from 'vitepress'; +import DefaultTheme from "vitepress/theme"; +import './style/index.css'; +import CachedImage from './components/CachedImage.vue'; + +export default { + extends: DefaultTheme, + enhanceApp({ app }) { + // Register global components + app.component('CachedImage', CachedImage); + } +} satisfies Theme; + diff --git a/docs/.vitepress/theme/style/blocks.css b/docs/.vitepress/theme/style/blocks.css new file mode 100644 index 0000000..90c4257 --- /dev/null +++ b/docs/.vitepress/theme/style/blocks.css @@ -0,0 +1,92 @@ +.VPDoc .custom-block { + margin: 28px 0; + padding: 20px 24px 12px 42px; + border-radius: 8px; + overflow-x: auto; + transition: + color 0.5s, + background-color 0.5s; + position: relative; + font-size: 14px; + line-height: 1.6; + font-weight: 500; + color: var(--vp-c-text-2); + background-color: var(--vp-c-bg-soft); + + &:before { + content: "ℹ️"; + position: absolute; + font-weight: 600; + font-size: 15px; + top: 20px; + left: 16px; + } + + .custom-block-title { + margin-bottom: 8px; + font-size: 15px; + font-weight: 500; + color: var(--vp-c-text-1); + transition: color 0.5s; + } + + &.warning { + border: 1px solid var(--vp-c-yellow-2); + code, + a { + color: var(--vp-c-yellow-2); + } + &:before { + color: var(--vp-c-yellow-2); + content: "⚠️"; + font-size: 16px; + top: 19px; + left: 16px; + } + } + + &.info { + border: 1px solid var(--vp-c-info-2); + code, + a { + color: var(--vp-c-info-1); + } + &:before { + color: var(--vp-c-info-2); + } + } + + &.danger { + border: 1px solid var(--vp-c-red-2); + &:before { + color: var(--vp-c-red-2); + content: "⛔"; + } + } + + &.tip { + border: 1px solid var(--vp-c-green-2); + code, + a { + color: var(--vp-c-green-1); + } + &:before { + color: var(--vp-c-green-2); + content: "💡"; + } + } + + ul li:before { + top: 0.55rem; + } + + ol li:before { + top: 1px; + font-size: 13px; + } + + :not(pre) > code { + font-size: 13px; + background-color: rgba(0, 0, 0, 0.2); + } +} \ No newline at end of file diff --git a/docs/.vitepress/theme/style/colors.css b/docs/.vitepress/theme/style/colors.css new file mode 100644 index 0000000..2f3b97f --- /dev/null +++ b/docs/.vitepress/theme/style/colors.css @@ -0,0 +1,26 @@ +:root { + --vp-c-bg: #16161a; + --vp-c-bg-alt: #101013; + --vp-c-bg-elv: #202127; + --vp-c-bg-soft: #1d1d23; + + --vp-c-brand-1: #FC67FA; + --vp-c-brand-2: #FC67FA; + --vp-c-brand-3: #FC67FA; + --vp-c-brand-soft: rgba(252, 103, 250, 0.27); + + --vp-c-tip-1: var(--vp-c-brand-1); + --vp-c-tip-2: var(--vp-c-brand-2); + --vp-c-tip-3: var(--vp-c-brand-3); + --vp-c-tip-soft: var(--vp-c-brand-soft); + + --vp-c-warning-1: #f5d86f; + --vp-c-warning-2: #eac048; + --vp-c-warning-3: #d4a92a; + --vp-c-warning-soft: #d4a92a44; + + --vp-c-danger-1: #e066f0; + --vp-c-danger-2: #c050d4; + --vp-c-danger-3: #a038b8; + --vp-c-danger-soft: rgba(190, 49, 112, 0.27); +} diff --git a/docs/.vitepress/theme/style/index.css b/docs/.vitepress/theme/style/index.css new file mode 100644 index 0000000..ecde99e --- /dev/null +++ b/docs/.vitepress/theme/style/index.css @@ -0,0 +1,3 @@ +@import "./colors.css"; +@import './style.scss'; +@import "./navbar.css"; \ No newline at end of file diff --git a/docs/.vitepress/theme/style/navbar.css b/docs/.vitepress/theme/style/navbar.css new file mode 100644 index 0000000..0628991 --- /dev/null +++ b/docs/.vitepress/theme/style/navbar.css @@ -0,0 +1,60 @@ +:root { + --vp-nav-bg-color: rgba(22, 22, 26, 0.7); + --vp-nav-border-color: rgba(255, 255, 255, 0.08); +} + +.VPNav { + background-color: var(--vp-nav-bg-color) !important; + backdrop-filter: blur(20px) saturate(180%); + border-bottom: 1px solid var(--vp-nav-border-color); + transition: background-color 0.5s, border-color 0.5s; +} + +.VPNavBar, +.VPLocalNav, +.VPNavBar:not(.home.top) .content-body { + background-color: transparent !important; + backdrop-filter: none !important; + border-bottom: none !important; +} + +.VPNavBarSearchButton { + border-radius: 8px !important; + background-color: rgba(255, 255, 255, 0.05) !important; + border: 1px solid var(--vp-nav-border-color) !important; + transition: all 0.2s ease; +} + +.VPNavBarSearchButton:hover { + background-color: rgba(255, 255, 255, 0.1) !important; + border-color: var(--vp-c-brand-1) !important; +} + +.VPNavBarMenuLink { + font-weight: 500; + font-size: 14px; + color: var(--vp-c-text-2); + transition: color 0.25s; +} + +.VPNavBarMenuLink:hover { + color: var(--vp-c-brand-1) !important; +} + +.VPNav .divider-line { + background-color: var(--vp-nav-border-color) !important; + width: 1px !important; +} + +.curtain { + background-color: rgba(0, 0, 0, 0.4) !important; + backdrop-filter: blur(4px); +} + +@media (max-width: 959px) { + .VPLocalNav { + background-color: var(--vp-nav-bg-color) !important; + backdrop-filter: blur(20px); + border-bottom: 1px solid var(--vp-nav-border-color); + } +} \ No newline at end of file diff --git a/docs/.vitepress/theme/style/style.scss b/docs/.vitepress/theme/style/style.scss new file mode 100644 index 0000000..f119072 --- /dev/null +++ b/docs/.vitepress/theme/style/style.scss @@ -0,0 +1,75 @@ +/** + * Customize default theme styling by overriding CSS variables: + * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css + */ + +/** + * Colors + * + * Each colors have exact same color scale system with 3 levels of solid + * colors with different brightness, and 1 soft color. + * + * - `XXX-1`: The most solid color used mainly for colored text. It must + * satisfy the contrast ratio against when used on top of `XXX-soft`. + * + * - `XXX-2`: The color used mainly for hover state of the button. + * + * - `XXX-3`: The color for solid background, such as bg color of the button. + * It must satisfy the contrast ratio with pure white (#ffffff) text on + * top of it. + * + * - `XXX-soft`: The color used for subtle background such as custom container + * or badges. It must satisfy the contrast ratio when putting `XXX-1` colors + * on top of it. + * + * The soft color must be semi transparent alpha channel. This is crucial + * because it allows adding multiple "soft" colors on top of each other + * to create a accent, such as when having inline code block inside + * custom containers. + * + * - `default`: The color used purely for subtle indication without any + * special meanings attached to it such as bg color for menu hover state. + * + * - `brand`: Used for primary brand colors, such as link text, button with + * brand theme, etc. + * + * - `tip`: Used to indicate useful information. The default theme uses the + * brand color for this by default. + * + * - `warning`: Used to indicate warning to the users. Used in custom + * container, badges, etc. + * + * - `danger`: Used to show error, or dangerous message to the users. Used + * in custom container, badges, etc. + * -------------------------------------------------------------------------- */ + +:root { + --vp-home-hero-name-color: transparent; + --vp-home-hero-name-background: linear-gradient(30deg, rgba(252, 103, 250) 10%, rgba(244, 196, 243)); + + --vp-home-hero-image-background-image: linear-gradient(-45deg, rgba(252, 103, 250, 0.5) 50%, rgba(225, 117, 223, 0.5) 50%); + --vp-home-hero-image-filter: blur(50px); + + --vp-custom-block-tip-border: transparent; + --vp-custom-block-tip-text: var(--vp-c-text-1); + --vp-custom-block-tip-bg: var(--vp-c-brand-soft); + --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft); + --vp-border-radius: 0.5rem; + --vp-anim-dur: 150ms; +} + +.brand-button { + outline: var(--vp-c-brand-2) 2px solid; + box-sizing: border-box !important; + background: var(--vp-c-brand-soft); + transition: 160ms ease-in-out all !important; + + &:hover { + outline-offset: 2px; + background: var(--vp-c-brand-3); + } + + &:active { + background: var(--vp-c-brand-1); + } +} \ No newline at end of file diff --git a/docs/pages/api-examples.md b/docs/pages/api-examples.md new file mode 100644 index 0000000..6bd8bb5 --- /dev/null +++ b/docs/pages/api-examples.md @@ -0,0 +1,49 @@ +--- +outline: deep +--- + +# Runtime API Examples + +This page demonstrates usage of some of the runtime APIs provided by VitePress. + +The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: + +```md + + +## Results + +### Theme Data +
{{ theme }}
+ +### Page Data +
{{ page }}
+ +### Page Frontmatter +
{{ frontmatter }}
+``` + + + +## Results + +### Theme Data +
{{ theme }}
+ +### Page Data +
{{ page }}
+ +### Page Frontmatter +
{{ frontmatter }}
+ +## More + +Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/docs/pages/index.md b/docs/pages/index.md new file mode 100644 index 0000000..43eb348 --- /dev/null +++ b/docs/pages/index.md @@ -0,0 +1,35 @@ +--- +layout: page +navbar: true +sidebar: false +aside: false +outline: false +--- + + + + + + \ No newline at end of file diff --git a/docs/pages/markdown-examples.md b/docs/pages/markdown-examples.md new file mode 100644 index 0000000..f9258a5 --- /dev/null +++ b/docs/pages/markdown-examples.md @@ -0,0 +1,85 @@ +# Markdown Extension Examples + +This page demonstrates some of the built-in markdown extensions provided by VitePress. + +## Syntax Highlighting + +VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting: + +**Input** + +````md +```js{4} +export default { + data () { + return { + msg: 'Highlighted!' + } + } +} +``` +```` + +**Output** + +```js{4} +export default { + data () { + return { + msg: 'Highlighted!' + } + } +} +``` + +## Custom Containers + +**Input** + +```md +::: info +This is an info box. +::: + +::: tip +This is a tip. +::: + +::: warning +This is a warning. +::: + +::: danger +This is a dangerous warning. +::: + +::: details +This is a details block. +::: +``` + +**Output** + +::: info +This is an info box. +::: + +::: tip +This is a tip. +::: + +::: warning +This is a warning. +::: + +::: danger +This is a dangerous warning. +::: + +::: details +This is a details block. +::: + +## More + +Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown). diff --git a/package.json b/package.json new file mode 100644 index 0000000..0c8c9a6 --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "dependencies": { + "@theojs/lumen": "^6.4.5" + }, + "devDependencies": { + "sass": "^1.97.3", + "vitepress": "^2.0.0-alpha.16" + }, + "scripts": { + "docs:dev": "vitepress dev docs", + "docs:build": "vitepress build docs", + "docs:preview": "vitepress preview docs" + } +} \ No newline at end of file