diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index 3210b47..a4b6a2f 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -5,10 +5,8 @@ on: push: branches: - 'master' - path: - - 'docs/**' - # trigger deployment manually - workflow_dispatch: + paths: + - 'docs/**/*' jobs: docs: @@ -31,7 +29,7 @@ jobs: run: npm install # run build script - - name: Build VuePress site + - name: Build VitePress site working-directory: docs run: npm run docs:build diff --git a/.gitignore b/.gitignore index cb25098..f921fda 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ lerna-debug.log* node_modules .ghpages -.cache -.temp +cache +temp .vscode playground/pdf/* playground/samples/* diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js new file mode 100644 index 0000000..8935bae --- /dev/null +++ b/docs/.vitepress/config.js @@ -0,0 +1,196 @@ +import { version } from '../package.json' + +export default { + title: 'VuePDF', + description: 'PDF Viewer for Vue 3', + base: '/VuePDF/', + lastUpdated: true, + themeConfig: { + logo: '/logo.png', + editLink: { + pattern: 'https://github.com/TaTo30/VuePDF/edit/master/docs/:path', + }, + socialLinks: [ + { + icon: 'github', + link: 'https://github.com/TaTo30/VuePDF', + }, + ], + search: { + provider: 'local', + }, + nav: [ + { + text: 'Guide', + link: '/guide/introduction.md', + }, + { + text: 'Examples', + items: [ + { + text: 'Basic usages', + link: '/examples/basic/one_page.md', + }, + { + text: 'Advanced usages', + link: '/examples/advanced/fit_parent.md', + }, + { + text: 'Events', + link: '/examples/loaded_events/loaded.md', + }, + ], + }, + { + text: `v${version}`, + items: [ + { + text: 'Changelog', + link: 'https://github.com/TaTo30/VuePDF/releases', + }, + { + text: 'Contributing', + link: 'https://github.com/TaTo30/VuePDF#contributing', + }, + ], + }, + ], + sidebar: { + '/guide/': { + base: '/guide/', + items: [ + { + text: 'Guide', + items: [ + { + text: 'Introduction', + link: 'introduction', + }, + { + text: 'Composables', + link: 'composables', + }, + ], + }, + { + text: 'Reference', + items: [ + { + text: 'Props', + link: 'props', + }, + { + text: 'Events', + link: 'events', + }, + { + text: 'Methods', + link: 'methods', + }, + { + text: 'Slots', + link: 'slots', + }, + ], + }, + ], + }, + '/examples/': { + items: [ + { + text: 'Basic usages', + base: '/examples/basic/', + items: [ + { + text: 'One Page', + link: 'one_page', + }, + { + text: 'All Pages', + link: 'all_pages', + }, + { + text: 'Scale', + link: 'scale', + }, + { + text: 'Rotation', + link: 'rotation', + }, + { + text: 'Text Layer', + link: 'text_layer', + }, + { + text: 'Annotation Layer', + link: 'annotation_layer', + }, + { + text: 'XFA Layer', + link: 'xfa_layer', + }, + ], + }, + { + text: 'Advanced usages', + base: '/examples/advanced/', + items: [ + { + text: 'Watermark', + link: 'watermark', + }, + { + text: 'Highlight Text', + link: 'highlight_text', + }, + { + text: 'Annotation Filter', + link: 'annotation_filter', + }, + { + text: 'Multiple PDF', + link: 'multiple_pdf', + }, + { + text: 'TOC', + link: 'toc', + }, + ], + }, + { + text: 'Events', + base: '/examples/', + items: [ + { + text: 'Loaded Event', + link: '/loaded_events/loaded', + }, + { + text: 'Highlight Event', + link: '/text_events/text_highlight', + }, + { + text: 'Annotation Events', + base: '/examples/annotation_events/', + items: [ + { + text: 'Form fields', + link: 'annotation_forms', + }, + { + text: 'Links', + link: 'annotation_links', + }, + { + text: 'Attachment', + link: 'annotation_attachment', + }, + ], + }, + ], + }, + ], + }, + }, + }, +} diff --git a/docs/.vuepress/styles/index.scss b/docs/.vitepress/styles/index.scss similarity index 75% rename from docs/.vuepress/styles/index.scss rename to docs/.vitepress/styles/index.scss index a5fccd8..5a39f34 100644 --- a/docs/.vuepress/styles/index.scss +++ b/docs/.vitepress/styles/index.scss @@ -1,5 +1,5 @@ .button-example { - background-color: var(--c-brand); + background-color: var(--vp-c-brand-2); color: white; padding: 10px; margin: 7px; @@ -9,7 +9,7 @@ } .button-example:hover { - background-color: var(--c-brand-light); + background-color: var(--vp-c-brand-1); } .checkbox-example { @@ -27,11 +27,11 @@ } .input-example:focus{ cursor: auto; - border-color: var(--search-accent-color); + border-color: var(--vp-c-brand-1); } .select-example { - background-color: var(--c-brand); + background-color: var(--vp-c-brand-2); color: white; padding: 10px; margin: 7px; @@ -39,7 +39,7 @@ border: none; } -.container { +.vue-pdf-container { display: flex; align-items:center; flex-direction: column diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js new file mode 100644 index 0000000..eeb7856 --- /dev/null +++ b/docs/.vitepress/theme/index.js @@ -0,0 +1,46 @@ +import DefaultTheme from 'vitepress/theme' +import '../styles/index.scss' + +import AllPages from '../../components/AllPages.vue' +import AnnoAttachment from '../../components/AnnoAttachment.vue' +import AnnoForms from '../../components/AnnoForms.vue' +import AnnoLinks from '../../components/AnnoLinks.vue' +import AnnotationFilter from '../../components/AnnotationFilter.vue' +import AnnotationLayer from '../../components/AnnotationLayer.vue' +import FitParent from '../../components/FitParent.vue' +import Loaded from '../../components/Loaded.vue' +import MultiplePDF from '../../components/MultiplePDF.vue' +import OnePage from '../../components/OnePage.vue' +import Rotation from '../../components/Rotation.vue' +import Scale from '../../components/Scale.vue' +import TextLayer from '../../components/TextLayer.vue' +import XFALayer from '../../components/XFALayer.vue' +import Watermark from '../../components/Watermark.vue' +import TOC from '../../components/TOC.vue' +import HighlightText from '../../components/HighlightText.vue' +import TextHighlight from '../../components/TextHighlight.vue' + +/** @type {import('vitepress').Theme} */ +export default { + extends: DefaultTheme, + enhanceApp({ app }) { + app.component('OnePage', OnePage) + app.component('Watermark', Watermark) + app.component('AllPages', AllPages) + app.component('Scale', Scale) + app.component('Rotation', Rotation) + app.component('TextLayer', TextLayer) + app.component('AnnotationLayer', AnnotationLayer) + app.component('XFALayer', XFALayer) + app.component('FitParent', FitParent) + app.component('AnnotationFilter', AnnotationFilter) + app.component('MultiplePDF', MultiplePDF) + app.component('AnnoAttachment', AnnoAttachment) + app.component('AnnoForms', AnnoForms) + app.component('AnnoLinks', AnnoLinks) + app.component('Loaded', Loaded) + app.component('TOC', TOC) + app.component('HighlightText', HighlightText) + app.component('TextHighlight', TextHighlight) + }, +} diff --git a/docs/.vuepress/.gh-pages b/docs/.vuepress/.gh-pages deleted file mode 160000 index b19e416..0000000 --- a/docs/.vuepress/.gh-pages +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b19e4165fb8838c72361687456da02ee9b8a14d4 diff --git a/docs/.vuepress/client.js b/docs/.vuepress/client.js deleted file mode 100644 index e5b4974..0000000 --- a/docs/.vuepress/client.js +++ /dev/null @@ -1,45 +0,0 @@ -import { defineClientConfig } from '@vuepress/client' -import './styles/index.scss' - -import AllPages from '../components/AllPages.vue' -import AnnoAttachment from '../components/AnnoAttachment.vue' -import AnnoForms from '../components/AnnoForms.vue' -import AnnoLinks from '../components/AnnoLinks.vue' -import AnnotationFilter from '../components/AnnotationFilter.vue' -import AnnotationLayer from '../components/AnnotationLayer.vue' -import FitParent from '../components/FitParent.vue' -import Loaded from '../components/Loaded.vue' -import MultiplePDF from '../components/MultiplePDF.vue' -import OnePage from '../components/OnePage.vue' -import Rotation from '../components/Rotation.vue' -import Scale from '../components/Scale.vue' -import TextLayer from '../components/TextLayer.vue' -import XFALayer from '../components/XFALayer.vue' -import Watermark from '../components/Watermark.vue' -import TOC from '../components/TOC.vue' -import HighlightText from "../components/HighlightText.vue"; -import TextHighlight from "../components/TextHighlight.vue"; - - -export default defineClientConfig({ - enhance({app}) { - app.component('OnePage', OnePage) - app.component('Watermark', Watermark) - app.component('AllPages', AllPages) - app.component('Scale', Scale) - app.component('Rotation', Rotation) - app.component('TextLayer', TextLayer) - app.component('AnnotationLayer', AnnotationLayer) - app.component('XFALayer', XFALayer) - app.component('FitParent', FitParent) - app.component('AnnotationFilter', AnnotationFilter) - app.component('MultiplePDF', MultiplePDF) - app.component('AnnoAttachment', AnnoAttachment) - app.component('AnnoForms', AnnoForms) - app.component('AnnoLinks', AnnoLinks) - app.component('Loaded', Loaded) - app.component('TOC', TOC) - app.component("HighlightText", HighlightText); - app.component("TextHighlight", TextHighlight); - } -}) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js deleted file mode 100644 index f8e28ee..0000000 --- a/docs/.vuepress/config.js +++ /dev/null @@ -1,108 +0,0 @@ -import { defineUserConfig } from '@vuepress/cli'; -import { defaultTheme } from '@vuepress/theme-default'; -import { searchPlugin } from '@vuepress/plugin-search' - -export default defineUserConfig({ - title: 'VuePDF', - description: 'PDF Viewer for Vue 3', - base: '/VuePDF/', - theme: defaultTheme({ - logo: '/logo.png', - repo: 'https://github.com/TaTo30/VuePDF', - colorMode: 'auto', - docsBranch: 'master', - docsDir: 'docs', - navbar: [ - { - text: 'Docs', - link: '/guide/introduction.md' - }, - { - text: 'Examples', - children: [ - { - text: 'Basic usages', - link: '/examples/basic/one_page.md' - }, - { - text: 'Advanced usages', - link: '/examples/advanced/fit_parent.md' - }, - { - text: 'Events', - link: '/examples/loaded_events/loaded.md' - }, - ] - } - ], - sidebar: { - '/guide/': [ - { - text: 'Guide', - children: [ - '/guide/introduction.md', - '/guide/composables.md', - ], - }, - { - text: 'VuePDF Component', - children: [ - '/guide/props.md', - '/guide/events.md', - '/guide/methods.md', - '/guide/slots.md', - ] - } - ], - '/examples/': [ - { - text: 'Basic usages', - children: [ - '/examples/basic/one_page.md', - '/examples/basic/all_pages.md', - '/examples/basic/scale.md', - '/examples/basic/rotation.md', - '/examples/basic/text_layer.md', - '/examples/basic/annotation_layer.md', - '/examples/basic/xfa_layer.md', - ], - }, - { - text: 'Advanced usages', - children: [ - '/examples/advanced/watermark.md', - '/examples/advanced/highlight_text.md', - '/examples/advanced/fit_parent.md', - '/examples/advanced/annotation_filter.md', - '/examples/advanced/multiple_pdf.md', - '/examples/advanced/toc.md', - ] - }, - { - text: 'Events', - children: [ - '/examples/loaded_events/loaded.md', - '/examples/text_events/text_highlight.md', - { - text: 'Annotation Events', - children: [ - '/examples/annotation_events/annotation_forms.md', - '/examples/annotation_events/annotation_links.md', - '/examples/annotation_events/annotation_attachment.md', - ] - } - ] - } - ], - }, - }), - plugins: [ - searchPlugin({ - locales: { - '/': { - placeholder: 'Search', - } - }, - }) - ] -}); diff --git a/docs/components/AllPages.vue b/docs/components/AllPages.vue index 6ac9863..7ce1a05 100644 --- a/docs/components/AllPages.vue +++ b/docs/components/AllPages.vue @@ -5,7 +5,7 @@ const { pdf, pages } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ diff --git a/docs/components/AnnoAttachment.vue b/docs/components/AnnoAttachment.vue index 20f52ea..5aba6f6 100644 --- a/docs/components/AnnoAttachment.vue +++ b/docs/components/AnnoAttachment.vue @@ -1,6 +1,6 @@