diff --git a/packages/example/source/Button.vue b/packages/example/source/Button.vue index 65a5f0a..d7006d2 100644 --- a/packages/example/source/Button.vue +++ b/packages/example/source/Button.vue @@ -1,5 +1,8 @@ diff --git a/packages/example/source/Input.vue b/packages/example/source/Input.vue new file mode 100644 index 0000000..ec5129b --- /dev/null +++ b/packages/example/source/Input.vue @@ -0,0 +1,100 @@ + + + diff --git a/packages/preview/browser/app.css b/packages/preview/browser/app.css index 725940b..29a1740 100644 --- a/packages/preview/browser/app.css +++ b/packages/preview/browser/app.css @@ -12,3 +12,48 @@ html { .dark { color: #efefef; } + +/* Documentation Panel */ +.docs { + width: 400px; + margin: 5px 10px; +} + +.docs h2 { + margin-bottom: 10px; + padding: 5px; + border-bottom: 1px solid #ccc; +} + +.docs h3 { + margin-top: 20px; + padding: 0 5px; +} +.docs table { + margin: 10px 5px; + color: #333; + font-size: small; +} + +.docs table td, +.docs table th { + border-bottom: 1px solid #cccccc; + padding: 5px 8px; +} + +.docs table th { + background-color: #f2f2f2; + color: #000; +} + +.docs table li { + padding: 0; + margin: 5px 0; + list-style-type: none; +} + +.docs table li strong { + display: inline-block; + font-weight: bold; + width: 70px; +} diff --git a/packages/preview/browser/components/Dashboard.vue b/packages/preview/browser/components/Dashboard.vue index a655354..e690e6f 100644 --- a/packages/preview/browser/components/Dashboard.vue +++ b/packages/preview/browser/components/Dashboard.vue @@ -3,6 +3,7 @@ import { inject, computed, ref, watch, markRaw, defineComponent, provide } from import { COMPONENTS, ZOOM, THEME } from '../config'; import { ComponentModule } from '../types'; import Preview from './Preview.vue'; +import Documentation from './Documentation.vue'; const current = ref(localStorage.getItem('@preview:current')); const currentPreview = ref>({}); @@ -12,11 +13,13 @@ const defaultPreviews = [ { name: 'Desktop', device: 'MacBook Pro 16"' }, ]; export default defineComponent({ - components: { Preview }, + components: { Preview, Documentation }, setup() { const components = inject(COMPONENTS)!; const zoom = ref(50); const theme = ref('light'); + const asideOpen = ref(true); + const docsAsideOpen = ref(false); if (window.matchMedia('(prefers-color-scheme: dark)').matches) { theme.value = 'dark'; @@ -36,6 +39,7 @@ export default defineComponent({ ...preview, }) ), + docgen: component.docgen, })); options.sort((a, b) => a.name.localeCompare(b.name)); @@ -53,11 +57,23 @@ export default defineComponent({ return `id=${encodeURIComponent(id)}&name=${encodeURIComponent(name)}`; } - return { options, current, currentPreview, component, zoom, getPreviewId, theme }; + return { + options, + current, + currentPreview, + component, + zoom, + getPreviewId, + theme, + asideOpen, + docsAsideOpen, + }; }, }); +// @ts-ignore if (import.meta.hot) { + // @ts-ignore import.meta.hot.on('@preview', (event) => { if (event.type === 'pick') { current.value = event.id; @@ -68,12 +84,12 @@ if (import.meta.hot) { diff --git a/packages/preview/browser/components/Documentation.vue b/packages/preview/browser/components/Documentation.vue new file mode 100644 index 0000000..b8c6400 --- /dev/null +++ b/packages/preview/browser/components/Documentation.vue @@ -0,0 +1,30 @@ + + + diff --git a/packages/preview/browser/components/Preview.bak.vue b/packages/preview/browser/components/Preview.bak.vue deleted file mode 100644 index e1a63e2..0000000 --- a/packages/preview/browser/components/Preview.bak.vue +++ /dev/null @@ -1,142 +0,0 @@ - - -