Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: VuePress to VitePress #809

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ npm-debug.log*
# Docs
.cache-loader
build/
# generated typedocs
docs/api
docs/.vitepress/dist
docs/.vitepress/cache
docs/public/register.bundle.esm.js
docs/public/utils.bundle.esm.js

# Development
.DS_Store
Expand Down
108 changes: 108 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { defineConfig } from 'vitepress';
import process from 'node:process';

const docsVersion = "VERSION";
const base = process.env.NODE_ENV === "development" ? '/chartjs-plugin-zoom/master/' : `/chartjs-plugin-zoom/${docsVersion}/`;

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "chartjs-plugin-zoom",
description: "A zoom and pan plugin for Chart.js >= 3.0.0",
head: [
['link', { rel: 'icon', href: base + 'favicon.ico' }],
['link', { rel: 'stylesheet', href: base + 'styles.css' }],
],
base,
outDir: '../dist/docs',
appearance: false,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: '/hero.svg',
footer: {
message: 'Released under the MIT License',
copyright: 'Copyright © 2016-2024 chartjs-plugin-zoom contributors',
},
nav: [
{
text: docsVersion,
items: [
{ text: 'Development (master)', link: '/chartjs-plugin-zoom/master/' },
{ text: '2.x.x', link: '/chartjs-plugin-zoom/2.0.1/' },
{ text: '1.x.x', link: '/chartjs-plugin-zoom/1.3.0/' },
],
},
{ text: 'Home', link: '/' },
{ text: 'Guide', link: '/guide/integration' },
{ text: 'Samples', link: `/samples/basic` },
{
text: 'Ecosystem',
ariaLabel: 'Community Menu',
items: [
{ text: 'Awesome', link: 'https://github.com/chartjs/awesome' },
]
},
],

sidebar: [
{
text: 'Guide',
collapsed: false,
items: [
{ text: 'Integration', link: '/guide/integration' },
{ text: 'Usage', link: '/guide/usage' },
{ text: 'Options', link: '/guide/options' },
{ text: 'Animations', link: '/guide/animations' },
{ text: 'Developers', link: '/guide/developers' },
],
},
{
text: 'Samples',
collapsed: false,
items: [
{ text: 'Basic', link: '/samples/basic' },
{
text: 'Wheel Zoom',
collapsed: true,
items: [
{ text: 'Category Scale', link: '/samples/wheel/category' },
{ text: 'Logarithmic Scale', link: '/samples/wheel/log' },
{ text: 'Time Scale', link: '/samples/wheel/time' },
{ text: 'Over Scale Mode', link: '/samples/wheel/over-scale-mode' },
{ text: 'Click to Zoom', link: '/samples/wheel/click-zoom' },
],
},
{
text: 'Drag to Zoom',
collapsed: true,
items: [
{ text: 'Category Scale', link: '/samples/drag/category' },
{ text: 'Linear Scale', link: '/samples/drag/linear' },
{ text: 'Logarithmic Scale', link: '/samples/drag/log' },
{ text: 'Time Scale', link: '/samples/drag/time' },
{ text: 'Timeseries Scale', link: '/samples/drag/timeseries' },
],
},
{ text: 'API', link: '/samples/api' },
{ text: 'Fetch Data', link: '/samples/fetch-data' },
{ text: 'Pan Region', link: '/samples/pan-region' },
]
},
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/chartjs/chartjs-plugin-zoom' },
]
},
vue: {
template: {
compilerOptions: {
isCustomElement: tag => tag.startsWith('playground-'),
}
}
},
vite: {
optimizeDeps: {
exclude: ['playground-elements'],
}
}
})
170 changes: 0 additions & 170 deletions docs/.vuepress/config.ts

This file was deleted.

19 changes: 0 additions & 19 deletions docs/guide/index.md

This file was deleted.

40 changes: 40 additions & 0 deletions docs/guide/usage-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* playground-hide */
import Chart from './register.js';

Check failure on line 2 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Delete `;`

Check failure on line 2 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Extra semicolon

Check failure on line 2 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Delete `;`

Check failure on line 2 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Extra semicolon
/* playground-hide-end */
const ctx = document.querySelector('canvas');

Check failure on line 4 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Delete `;`

Check failure on line 4 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Extra semicolon

Check failure on line 4 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Delete `;`

Check failure on line 4 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Extra semicolon

const chart = new Chart(ctx, {
type: 'line',
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{

Check failure on line 10 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Insert `⏎······`

Check failure on line 10 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Insert `␍⏎······`
label: 'My First Dataset',

Check failure on line 11 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Replace `······` with `········`

Check failure on line 11 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Replace `······` with `········`
data: [65, 59, 80, 81, 56, 55, 40],

Check failure on line 12 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Insert `··`

Check failure on line 12 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Insert `··`
fill: false,

Check failure on line 13 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Insert `··`

Check failure on line 13 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Insert `··`
borderColor: 'rgb(75, 192, 192)',

Check failure on line 14 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Insert `··`

Check failure on line 14 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Insert `··`
tension: 0.1

Check failure on line 15 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Replace `tension:·0.1` with `··tension:·0.1,`

Check failure on line 15 in docs/guide/usage-example.js

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Replace `tension:·0.1` with `··tension:·0.1,`
}]
},
options: {
plugins: {
zoom: {
zoom: {
wheel: {
enabled: true,
},
pinch: {
enabled: true,
},
mode: 'xy',
}
}
}
}
});

const btnResetZoom = document.createElement('button');
btnResetZoom.textContent = 'Reset zoom';
document.body.append(btnResetZoom);
btnResetZoom.addEventListener('click', () => {
chart.resetZoom();
})
Loading
Loading