From f481ee130906bd291f4778176a8c43602d82870c Mon Sep 17 00:00:00 2001 From: AxenoDev Date: Fri, 13 Feb 2026 17:50:15 +0100 Subject: [PATCH 01/10] add: create .gitignore to exclude VitePress cache directory --- docs/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/.gitignore diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..f95ea57 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +.vitepress/cache/ \ No newline at end of file From c6dd7248c699a69d886f229dfd71272ed0e0996e Mon Sep 17 00:00:00 2001 From: AxenoDev Date: Fri, 13 Feb 2026 17:50:26 +0100 Subject: [PATCH 02/10] add: expand .gitignore to include additional log and cache files --- .gitignore | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f51a8a8..fb07ce4 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 +package-json.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 From a742de8f678c7e961b9efb6d7a3cc7012fb4facf Mon Sep 17 00:00:00 2001 From: AxenoDev Date: Sat, 14 Feb 2026 11:48:00 +0100 Subject: [PATCH 03/10] feat: add runtime API examples and custom styles for documentation --- docs/.gitignore | 2 +- docs/.vitepress/config.mts | 42 ++ .../theme/components/CachedImage.vue | 179 +++++++ .../theme/components/KikoFeature.vue | 181 +++++++ docs/.vitepress/theme/components/KikoHero.vue | 453 ++++++++++++++++++ docs/.vitepress/theme/index.ts | 13 + docs/.vitepress/theme/style/blocks.css | 92 ++++ docs/.vitepress/theme/style/colors.css | 26 + docs/.vitepress/theme/style/index.css | 3 + docs/.vitepress/theme/style/navbar.css | 60 +++ docs/.vitepress/theme/style/style.scss | 77 +++ docs/pages/api-examples.md | 49 ++ docs/pages/index.md | 36 ++ package.json | 14 + 14 files changed, 1226 insertions(+), 1 deletion(-) create mode 100644 docs/.vitepress/config.mts create mode 100644 docs/.vitepress/theme/components/CachedImage.vue create mode 100644 docs/.vitepress/theme/components/KikoFeature.vue create mode 100644 docs/.vitepress/theme/components/KikoHero.vue create mode 100644 docs/.vitepress/theme/index.ts create mode 100644 docs/.vitepress/theme/style/blocks.css create mode 100644 docs/.vitepress/theme/style/colors.css create mode 100644 docs/.vitepress/theme/style/index.css create mode 100644 docs/.vitepress/theme/style/navbar.css create mode 100644 docs/.vitepress/theme/style/style.scss create mode 100644 docs/pages/api-examples.md create mode 100644 docs/pages/index.md create mode 100644 package.json diff --git a/docs/.gitignore b/docs/.gitignore index f95ea57..6dc972e 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1 +1 @@ -.vitepress/cache/ \ No newline at end of file +.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..88250e6 --- /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/vuejs/vitepress'} + ] + } +}) diff --git a/docs/.vitepress/theme/components/CachedImage.vue b/docs/.vitepress/theme/components/CachedImage.vue new file mode 100644 index 0000000..81fd4d9 --- /dev/null +++ b/docs/.vitepress/theme/components/CachedImage.vue @@ -0,0 +1,179 @@ + + + + + \ 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..736c38b --- /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..9fc95f7 --- /dev/null +++ b/docs/.vitepress/theme/components/KikoHero.vue @@ -0,0 +1,453 @@ + + + + + \ 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..0200a68 --- /dev/null +++ b/docs/.vitepress/theme/style/style.scss @@ -0,0 +1,77 @@ +/** + * 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 attched 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); +} + +:root { + --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..1034945 --- /dev/null +++ b/docs/pages/index.md @@ -0,0 +1,36 @@ +--- +layout: page +navbar: true +sidebar: false +aside: false +outline: false +--- + + + + + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..5327fb0 --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "dependencies": { + "@theojs/lumen": "^6.4.5", + "sass": "^1.97.3" + }, + "devDependencies": { + "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 From dd2f375fb62083c4151c5cab70c9abe506c33e78 Mon Sep 17 00:00:00 2001 From: AxenoDev Date: Sat, 14 Feb 2026 11:48:05 +0100 Subject: [PATCH 04/10] feat: add runtime API examples and custom styles for documentation --- docs/pages/markdown-examples.md | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 docs/pages/markdown-examples.md 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). From 74bd4decff56c2946af8c2bc554498463c94c36e Mon Sep 17 00:00:00 2001 From: AxenoDev Date: Mon, 16 Feb 2026 17:07:41 +0100 Subject: [PATCH 05/10] add: update .gitignore to replace package-json.lock with bun.lock --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fb07ce4..9672d0a 100644 --- a/.gitignore +++ b/.gitignore @@ -136,7 +136,7 @@ lerna-debug.log* *.sqlite # package-json -package-json.lock +bun.lock # bun deploy file node_modules.bun From 92b50151fe572e5825cfc46d7407d02e903f8593 Mon Sep 17 00:00:00 2001 From: AxenoDev Date: Mon, 16 Feb 2026 17:16:34 +0100 Subject: [PATCH 06/10] feat: implement image caching limit and improve error handling --- docs/.vitepress/config.mts | 2 +- docs/.vitepress/theme/components/CachedImage.vue | 10 +++++++++- docs/.vitepress/theme/components/KikoFeature.vue | 4 ++-- docs/.vitepress/theme/components/KikoHero.vue | 14 ++++++-------- docs/.vitepress/theme/style/style.scss | 2 -- package.json | 4 ++-- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 88250e6..10ebc68 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -36,7 +36,7 @@ export default defineConfig({ ], socialLinks: [ - {icon: 'github', link: 'https://github.com/vuejs/vitepress'} + {icon: 'github', link: 'https://github.com/kikoplugin/KikoAPI'} ] } }) diff --git a/docs/.vitepress/theme/components/CachedImage.vue b/docs/.vitepress/theme/components/CachedImage.vue index 81fd4d9..0d9119b 100644 --- a/docs/.vitepress/theme/components/CachedImage.vue +++ b/docs/.vitepress/theme/components/CachedImage.vue @@ -39,6 +39,10 @@ const getCachedImage = (url: string): string | null => { const setCachedImage = (url: string, dataUrl: string): void => { try { + if (dataUrl.length > 5 * 1024 * 1024) { // 5MB limit + console.warn('Image is too large to cache:', url); + return; + } const key = CACHE_PREFIX + btoa(url); const data: CachedImageData = { data: dataUrl, @@ -46,7 +50,11 @@ const setCachedImage = (url: string, dataUrl: string): void => { }; localStorage.setItem(key, JSON.stringify(data)); } catch (e) { - console.warn('Failed to cache image:', e); + if (e instanceof DOMException && e.name === 'QuotaExceededError') { + console.warn('LocalStorage quota exceeded, cannot cache image:', e); + } else { + console.warn('Failed to retrieve cached image:', e); + } } }; diff --git a/docs/.vitepress/theme/components/KikoFeature.vue b/docs/.vitepress/theme/components/KikoFeature.vue index 736c38b..102c5bd 100644 --- a/docs/.vitepress/theme/components/KikoFeature.vue +++ b/docs/.vitepress/theme/components/KikoFeature.vue @@ -26,7 +26,7 @@ defineProps<{

- En savoir plus -> + Learn More > @@ -145,7 +145,7 @@ defineProps<{ .details { margin: 0; font-size: 15px; - line-height: 18px; + line-height: 1.2; color: var(--vp-c-text-2); } diff --git a/docs/.vitepress/theme/components/KikoHero.vue b/docs/.vitepress/theme/components/KikoHero.vue index 9fc95f7..5fa8e93 100644 --- a/docs/.vitepress/theme/components/KikoHero.vue +++ b/docs/.vitepress/theme/components/KikoHero.vue @@ -1,8 +1,6 @@