@do11y/docs 0.0.13 → 0.0.15
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 +1 -1
- package/dist/cli.js +11 -3
- package/dist/index.d.ts +2 -1
- package/dist/plugin-options.d.ts +1 -1
- package/dist/plugin-options.js +4 -1
- package/dist/plugins/meta/meta-mapper.d.ts +2 -41
- package/dist/plugins/meta/meta-mapper.js +8 -8
- package/dist/plugins/meta/meta-types.d.ts +22 -0
- package/dist/plugins/meta/meta-types.js +1 -0
- package/dist/plugins/routes/routes.d.ts +2 -2
- package/dist/plugins/routes/routes.js +2 -2
- package/dist/plugins/site/site.d.ts +5 -1
- package/dist/scaffold.js +4 -5
- package/package.json +5 -6
- package/template/site/Sandbox.vue +20 -0
- package/template/site/SandboxIframe.vue +5 -1
- package/template/site/Site.vue +3 -1
- package/template/site/index.ts +2 -1
- package/template/site/style.css +47 -3
- package/template/tsconfig.json +1 -0
- package/types.d.ts +12 -0
- package/bin/scaffold.js +0 -4
- package/routes.d.ts +0 -5
- package/template/site/plugins.ts +0 -3
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
import { cp } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
1
3
|
import { createServer, build, preview } from 'vite';
|
|
2
4
|
import { getViteConfig } from './vite-config.js';
|
|
5
|
+
import { docs } from './files.js';
|
|
3
6
|
const [_, __, command = 'dev'] = process.argv;
|
|
4
|
-
if (command !== 'dev' && command !== 'build' && command !== 'preview') {
|
|
7
|
+
if (command !== 'scaffold' && command !== 'dev' && command !== 'build' && command !== 'preview') {
|
|
5
8
|
throw new Error();
|
|
6
9
|
}
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
if (command === 'scaffold') {
|
|
11
|
+
const template = join(import.meta.dirname, '../template');
|
|
12
|
+
await cp(template, docs, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
else if (command === 'dev') {
|
|
15
|
+
const viteConfig = await getViteConfig(command);
|
|
9
16
|
const server = await createServer(viteConfig);
|
|
10
17
|
await server.listen();
|
|
11
18
|
server.printUrls();
|
|
12
19
|
server.bindCLIShortcuts({ print: true });
|
|
13
20
|
}
|
|
14
21
|
else {
|
|
22
|
+
const viteConfig = await getViteConfig(command);
|
|
15
23
|
await build(viteConfig);
|
|
16
24
|
if (command === 'preview') {
|
|
17
25
|
const previewServer = await preview(viteConfig);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PluginOptions } from './plugin-options.js';
|
|
2
2
|
import type { Site } from './plugins/site/site.js';
|
|
3
|
-
|
|
3
|
+
import type { Meta } from './plugins/meta/meta-types.js';
|
|
4
|
+
export type { PluginOptions, Site, Meta };
|
|
4
5
|
export declare const vueOptions: {
|
|
5
6
|
include: RegExp[];
|
|
6
7
|
exclude: RegExp[];
|
package/dist/plugin-options.d.ts
CHANGED
package/dist/plugin-options.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import { plugins } from './files.js';
|
|
2
3
|
/**
|
|
3
4
|
* Access plugin options (`docs/site/plugins.ts`).
|
|
4
5
|
*/
|
|
5
|
-
export const pluginOptions = (
|
|
6
|
+
export const pluginOptions = existsSync(plugins)
|
|
7
|
+
? (await import(plugins)).default
|
|
8
|
+
: undefined;
|
|
@@ -1,42 +1,3 @@
|
|
|
1
1
|
import type { ComponentMeta } from 'vue-component-meta';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
default: string | undefined;
|
|
5
|
-
required: boolean;
|
|
6
|
-
name: string;
|
|
7
|
-
type: string;
|
|
8
|
-
description: string;
|
|
9
|
-
deprecated: string | boolean;
|
|
10
|
-
tags: {
|
|
11
|
-
name: string;
|
|
12
|
-
text: string | undefined;
|
|
13
|
-
}[];
|
|
14
|
-
}[];
|
|
15
|
-
props: {
|
|
16
|
-
default: string | undefined;
|
|
17
|
-
required: boolean;
|
|
18
|
-
name: string;
|
|
19
|
-
type: string;
|
|
20
|
-
description: string;
|
|
21
|
-
deprecated: string | boolean;
|
|
22
|
-
tags: {
|
|
23
|
-
name: string;
|
|
24
|
-
text: string | undefined;
|
|
25
|
-
}[];
|
|
26
|
-
}[];
|
|
27
|
-
events: {
|
|
28
|
-
name: string;
|
|
29
|
-
type: string;
|
|
30
|
-
description: string;
|
|
31
|
-
deprecated: string | boolean;
|
|
32
|
-
tags: {
|
|
33
|
-
name: string;
|
|
34
|
-
text: string | undefined;
|
|
35
|
-
}[];
|
|
36
|
-
}[];
|
|
37
|
-
slots: {
|
|
38
|
-
name: string;
|
|
39
|
-
type: string;
|
|
40
|
-
description: string;
|
|
41
|
-
}[];
|
|
42
|
-
};
|
|
2
|
+
import type { Meta } from './meta-types';
|
|
3
|
+
export declare const mapMeta: (meta: ComponentMeta, render: (input: string) => string) => Meta;
|
|
@@ -17,20 +17,20 @@ export const mapMeta = (meta, render) => {
|
|
|
17
17
|
text: tag.text ? render(tag.text) : undefined,
|
|
18
18
|
}));
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const mapEvent = (prop) => ({
|
|
21
21
|
name: prop.name,
|
|
22
22
|
type: prop.type,
|
|
23
|
-
description: render(prop.description),
|
|
23
|
+
description: prop.description ? render(prop.description) : undefined,
|
|
24
24
|
deprecated: getDeprecated(prop.tags),
|
|
25
25
|
tags: getFilteredTags(prop.tags),
|
|
26
26
|
});
|
|
27
|
-
const mapSlotAndExposed = (
|
|
28
|
-
name:
|
|
29
|
-
type:
|
|
30
|
-
description: render(
|
|
27
|
+
const mapSlotAndExposed = (se) => ({
|
|
28
|
+
name: se.name,
|
|
29
|
+
type: se.type,
|
|
30
|
+
description: se.description ? render(se.description) : undefined,
|
|
31
31
|
});
|
|
32
32
|
const mapProperty = (prop) => ({
|
|
33
|
-
...
|
|
33
|
+
...mapEvent(prop),
|
|
34
34
|
default: prop.default || getTag(prop.tags, 'default')?.text,
|
|
35
35
|
required: prop.required,
|
|
36
36
|
});
|
|
@@ -43,7 +43,7 @@ export const mapMeta = (meta, render) => {
|
|
|
43
43
|
.map((prop) => mapProperty(prop)),
|
|
44
44
|
events: meta.events
|
|
45
45
|
.filter((event) => !hasAssociatedProp(event))
|
|
46
|
-
.map((event) =>
|
|
46
|
+
.map((event) => mapEvent(event)),
|
|
47
47
|
slots: meta.slots.map((slot) => mapSlotAndExposed(slot)),
|
|
48
48
|
};
|
|
49
49
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PropertyMeta } from 'vue-component-meta';
|
|
2
|
+
interface Property {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
deprecated: string | boolean;
|
|
7
|
+
tags: PropertyMeta['tags'][number][];
|
|
8
|
+
default?: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface SlotOrExposed {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Meta {
|
|
17
|
+
modelValues: Property[];
|
|
18
|
+
props: Property[];
|
|
19
|
+
events: Omit<Property, 'default' | 'required'>[];
|
|
20
|
+
slots: SlotOrExposed[];
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
/**
|
|
3
|
-
* Adds the ability to import routes (`*.md` files
|
|
4
|
-
* through `do11y:routes`.
|
|
3
|
+
* Adds the ability to import routes (`*.md` files with
|
|
4
|
+
* a `title` and `slug`) through `do11y:routes`.
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: () => Plugin;
|
|
7
7
|
export default _default;
|
|
@@ -3,8 +3,8 @@ import fg from 'fast-glob';
|
|
|
3
3
|
import fm from 'front-matter';
|
|
4
4
|
import { root } from '../../files.js';
|
|
5
5
|
/**
|
|
6
|
-
* Adds the ability to import routes (`*.md` files
|
|
7
|
-
* through `do11y:routes`.
|
|
6
|
+
* Adds the ability to import routes (`*.md` files with
|
|
7
|
+
* a `title` and `slug`) through `do11y:routes`.
|
|
8
8
|
*/
|
|
9
9
|
export default () => {
|
|
10
10
|
const moduleId = 'do11y:routes';
|
|
@@ -3,13 +3,17 @@ import type { App, Component } from 'vue';
|
|
|
3
3
|
import type { Router } from 'vue-router';
|
|
4
4
|
export interface Site {
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
6
|
+
* The wrapper component for the site.
|
|
7
7
|
*/
|
|
8
8
|
Site: () => Promise<Component>;
|
|
9
9
|
/**
|
|
10
10
|
* Additional setup for the app.
|
|
11
11
|
*/
|
|
12
12
|
setup?(app: App, router: Router): void | Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* The wrapper component for the sandbox.
|
|
15
|
+
*/
|
|
16
|
+
Sandbox?: () => Promise<Component>;
|
|
13
17
|
/**
|
|
14
18
|
* Additional setup for the sandbox app.
|
|
15
19
|
*/
|
package/dist/scaffold.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { cp } from 'fs/promises';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
await cp(join(import.meta.dirname, '../template'), target, { recursive: true });
|
|
1
|
+
import { cp } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { docs } from './files.js';
|
|
4
|
+
await cp(join(import.meta.dirname, '../template'), docs, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@do11y/docs",
|
|
3
3
|
"description": "A very bare-bones tool to help document Vue components.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,18 +11,17 @@
|
|
|
11
11
|
"bin",
|
|
12
12
|
"dist",
|
|
13
13
|
"template",
|
|
14
|
-
"
|
|
14
|
+
"types.d.ts"
|
|
15
15
|
],
|
|
16
16
|
"bin": {
|
|
17
|
-
"do11y": "./bin/cli.js"
|
|
18
|
-
"do11y-scaffold": "./bin/scaffold.js"
|
|
17
|
+
"do11y": "./bin/cli.js"
|
|
19
18
|
},
|
|
20
19
|
"exports": {
|
|
21
20
|
".": {
|
|
22
21
|
"import": "./dist/index.js",
|
|
23
22
|
"types": "./dist/index.d.ts"
|
|
24
23
|
},
|
|
25
|
-
"./types": "./
|
|
24
|
+
"./types": "./types.d.ts"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"@vitejs/plugin-vue": "^6.0.2",
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
"markdown-it-attrs": "^4.3.1",
|
|
41
40
|
"v-custom-block": "^1.0.67",
|
|
42
41
|
"vue-component-meta": "^3.1.8",
|
|
43
|
-
"@do11y/ui": "0.0.
|
|
42
|
+
"@do11y/ui": "0.0.8"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@tsconfig/node24": "^24.0.3",
|
package/template/site/Site.vue
CHANGED
package/template/site/index.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { Site } from '@do11y/docs';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
Site: () => import('./Site.vue'),
|
|
5
|
+
Sandbox: () => import('./Sandbox.vue'),
|
|
5
6
|
|
|
6
|
-
async setup(app) {
|
|
7
|
+
async setup(app, router) {
|
|
7
8
|
const SandboxIframe = (await import('./SandboxIframe.vue')).default;
|
|
8
9
|
app.component('SandboxIframe', SandboxIframe);
|
|
9
10
|
},
|
package/template/site/style.css
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
html {
|
|
2
2
|
scrollbar-gutter: stable;
|
|
3
3
|
scrollbar-width: thin;
|
|
4
|
+
|
|
5
|
+
font-family: sans-serif;
|
|
4
6
|
}
|
|
5
7
|
|
|
6
8
|
*,
|
|
@@ -15,7 +17,6 @@ html {
|
|
|
15
17
|
margin: 0;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
[id],
|
|
19
20
|
:target {
|
|
20
21
|
scroll-margin-block: 2em;
|
|
21
22
|
}
|
|
@@ -36,6 +37,49 @@ pre {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
body {
|
|
39
|
-
margin
|
|
40
|
-
inline-size: min(90dvw,
|
|
40
|
+
margin: 2rem auto;
|
|
41
|
+
inline-size: min(90dvw, 40rem);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
nav ul {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 2rem;
|
|
48
|
+
|
|
49
|
+
margin-block-end: 2rem;
|
|
50
|
+
margin-inline-start: 1rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pre {
|
|
54
|
+
border-radius: 4px;
|
|
55
|
+
padding: 1rem;
|
|
56
|
+
|
|
57
|
+
background-color: #1a1a1a;
|
|
58
|
+
color: #fff;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Heading directly after another heading */
|
|
62
|
+
:is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {
|
|
63
|
+
margin-block-start: 1.5rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Heading directly after content */
|
|
67
|
+
:not(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {
|
|
68
|
+
margin-block-start: 2em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Content directly after a heading */
|
|
72
|
+
:is(h1, h2, h3, h4, h5, h6) + :not(h1, h2, h3, h4, h5, h6) {
|
|
73
|
+
margin-block-start: 1.5em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Content directly after content */
|
|
77
|
+
:is(article > div, iframe, p, small, blockquote, table, dl, pre, ol, ul, br)
|
|
78
|
+
+ :is(article > div, iframe, small, blockquote, table, dl, pre, ol, ul, br) {
|
|
79
|
+
margin-block-start: 1em;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
button {
|
|
83
|
+
background-color: transparent;
|
|
84
|
+
border: 1px solid #1a1a1a;
|
|
41
85
|
}
|
package/template/tsconfig.json
CHANGED
package/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module 'do11y:routes' {
|
|
2
|
+
import type { RouteRecordRaw as VueRouteRecordRaw } from 'vue-router';
|
|
3
|
+
type RouteRecordRaw = Omit<VueRouteRecordRaw, 'meta'> & { meta: { title: string; slug: string } };
|
|
4
|
+
const routes: RouteRecordRaw[];
|
|
5
|
+
export default routes;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare module '*.vue?meta' {
|
|
9
|
+
import type { Meta } from '@do11y/docs';
|
|
10
|
+
const meta: Meta;
|
|
11
|
+
export default meta;
|
|
12
|
+
}
|
package/bin/scaffold.js
DELETED
package/routes.d.ts
DELETED
package/template/site/plugins.ts
DELETED