do11y 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -24
- package/dist/docs/plugins/options.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,19 +9,19 @@ A bare-bones tool to document Vue components.
|
|
|
9
9
|
|
|
10
10
|
### Markdown components with [@mdit-vue](https://github.com/mdit-vue/mdit-vue).
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
> Customizable through the options `markdownSetup` and `markdownCodeBlock`.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Markdown files are treated as single file Vue components with the help of [@mdit-vue](https://github.com/mdit-vue/mdit-vue).
|
|
15
15
|
|
|
16
|
-
###
|
|
16
|
+
### Markdown routes available through `do11y:routes`
|
|
17
17
|
|
|
18
|
-
To include a markdown file as a route it needs to have a `title` and a `slug` (e.g. `/button`) in it's frontmatter
|
|
18
|
+
To include a markdown file as a route it needs to have a `title` and a `slug` (e.g. `/button`) in it's frontmatter, or it needs to be placed inside `docs/do11y/pages`.
|
|
19
19
|
|
|
20
20
|
### [Shiki](https://shiki.style) code highlighting
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
> Customizable through the `highlighter` option.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Code blocks are automatically highlighted with [Shiki](https://shiki.style).
|
|
25
25
|
|
|
26
26
|
### Highlight imports
|
|
27
27
|
|
|
@@ -30,28 +30,50 @@ You can import Vue files as highlighted code blocks through `.vue?highlight`, or
|
|
|
30
30
|
These imports return HTML strings meaning you have to render the code block using `v-html`.
|
|
31
31
|
|
|
32
32
|
> [!WARNING]
|
|
33
|
-
> Imports of type `.vue?highlight&lang=css` only work on
|
|
33
|
+
> Imports of type `.vue?highlight&lang=css` only work on _built_ sites. During development it will return the same result as `.vue?highlight`.
|
|
34
34
|
|
|
35
35
|
### Sandboxes
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
> To customize the Sandbox app add a custom `docs/do11y/pages/Sandbox.vue` wrapper component and/or use the `setupSandbox` option.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Turn a component into a sandbox by adding a `.sandbox` prefix to the component name, e.g. `Button.sandbox.vue` will be available under the url `/sandbox?id=button`, and when importing the component it will be wrapped inside an iframe.
|
|
40
40
|
|
|
41
41
|
> [!NOTE]
|
|
42
|
-
> The id is based on the filename - not the path
|
|
42
|
+
> The id of a sandbox component is based on the filename - not the path - this means every sandbox component must have a unique name.
|
|
43
|
+
|
|
44
|
+
#### Sandbox Iframe
|
|
45
|
+
|
|
46
|
+
> To customize the Sandbox app add a custom `docs/do11y/layout/SandboxIframe.vue` wrapper component.
|
|
47
|
+
|
|
48
|
+
The sandbox iframe component has some props automatically passed to it - you can use the `SandboxIframeProps` type to declare these.
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<template>
|
|
52
|
+
<iframe ref="iframe" :title="`Sandbox for ${title || id}`" :src="url" />
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import type { SandboxIframeProps } from "do11y";
|
|
57
|
+
|
|
58
|
+
defineProps<SandboxIframeProps & { title?: string }>();
|
|
59
|
+
</script>
|
|
60
|
+
```
|
|
43
61
|
|
|
44
62
|
### Document components with [vue-component-meta](https://www.npmjs.com/package/vue-component-meta)
|
|
45
63
|
|
|
46
|
-
Document components through meta imports (`Button.vue?meta`) which give a simplified version of
|
|
64
|
+
Document components through meta imports (`Button.vue?meta`) which give a simplified version of the result from [vue-component-meta](https://www.npmjs.com/package/vue-component-meta).
|
|
47
65
|
|
|
48
66
|
## Options
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
> Options should be the default export of `docs/do11y/do11y.ts`.
|
|
51
69
|
|
|
52
|
-
You can
|
|
70
|
+
You can set the home page by adding a `docs/do11y/pages/Home.vue` file, and you can add a layout for each page in `docs/do11y/layout/Page.vue` using `<RouterView />`.
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
```ts
|
|
73
|
+
import type { Options } from "do11y";
|
|
74
|
+
|
|
75
|
+
export default {} satisfies Options;
|
|
76
|
+
```
|
|
55
77
|
|
|
56
78
|
```ts
|
|
57
79
|
interface Options {
|
|
@@ -60,21 +82,11 @@ interface Options {
|
|
|
60
82
|
*/
|
|
61
83
|
setup?(app: App, router: Router): void | Promise<void>;
|
|
62
84
|
|
|
63
|
-
/**
|
|
64
|
-
* The wrapper component for sandboxes.
|
|
65
|
-
*/
|
|
66
|
-
Sandbox?: () => Promise<Component>;
|
|
67
|
-
|
|
68
85
|
/**
|
|
69
86
|
* Additional setup for the sandbox app.
|
|
70
87
|
*/
|
|
71
88
|
setupSandbox?(app: App): void | Promise<void>;
|
|
72
89
|
|
|
73
|
-
/**
|
|
74
|
-
* Custom wrapper component for `.vue.sandbox` imports.
|
|
75
|
-
*/
|
|
76
|
-
SandboxIframe?: () => Promise<Component>;
|
|
77
|
-
|
|
78
90
|
/**
|
|
79
91
|
* The code highlighter.
|
|
80
92
|
* - Markdown code blocks
|
|
@@ -23,6 +23,9 @@ export default () => {
|
|
|
23
23
|
return {
|
|
24
24
|
name: "do11y:options",
|
|
25
25
|
async resolveId(id, importer) {
|
|
26
|
+
if (id === "do11y:options") {
|
|
27
|
+
return this.resolve(setupFiles[id], importer);
|
|
28
|
+
}
|
|
26
29
|
if (Object.keys(setupFiles).includes(id)) {
|
|
27
30
|
/* prettier-ignore */
|
|
28
31
|
return existsSync(setupFiles[id])
|