@frontfactory/vitepress-theme 1.6.0 → 1.8.0
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/CHANGELOG.md +214 -0
- package/README.md +160 -8
- package/config.d.ts +26 -1
- package/config.js +165 -21
- package/dist/style.css +1 -1
- package/node/llms.js +31 -0
- package/node/og.js +159 -0
- package/node/pages.js +154 -0
- package/node/rss.js +81 -0
- package/package.json +49 -26
- package/src/blog/posts.data.ts +46 -0
- package/src/components/FfBackToTop.vue +33 -10
- package/src/components/FfBanner.vue +42 -8
- package/src/components/FfCopyStatus.vue +64 -0
- package/src/components/FfDocMeta.vue +50 -46
- package/src/components/FfFeature.vue +18 -7
- package/src/components/FfFeedback.vue +96 -0
- package/src/components/FfFooter.vue +11 -5
- package/src/components/FfHero.vue +20 -10
- package/src/components/FfHeroCommand.vue +24 -27
- package/src/components/FfHomeSponsors.vue +2 -2
- package/src/components/FfNavBarTitle.vue +63 -0
- package/src/components/FfPost.vue +49 -0
- package/src/components/FfProgress.vue +69 -0
- package/src/components/FfVersionSwitcher.vue +20 -0
- package/src/composables/blog.ts +38 -0
- package/src/composables/options.ts +19 -14
- package/src/composables/relativeTime.ts +59 -0
- package/src/composables/tabs.ts +155 -0
- package/src/content/Api.vue +6 -2
- package/src/content/Badge.vue +26 -0
- package/src/content/Callout.vue +27 -0
- package/src/content/FileTree.vue +118 -0
- package/src/content/Tab.vue +11 -0
- package/src/content/Tabs.vue +74 -0
- package/src/content/Timeline.vue +19 -0
- package/src/content/TimelineItem.vue +37 -0
- package/src/content/timeline.ts +4 -0
- package/src/index.ts +37 -1
- package/src/internal.ts +7 -2
- package/src/layout/FfBlog.vue +62 -0
- package/src/layout/FfLayout.vue +17 -1
- package/src/styles/_base.scss +20 -5
- package/src/styles/_blocks.scss +25 -1
- package/src/styles/_blog.scss +131 -0
- package/src/styles/_breakpoints.scss +26 -0
- package/src/styles/_code.scss +5 -5
- package/src/styles/_content.scss +280 -12
- package/src/styles/_doc.scss +18 -5
- package/src/styles/_home.scss +37 -17
- package/src/styles/_motion.scss +22 -2
- package/src/styles/_nav.scss +81 -8
- package/src/styles/_print.scss +77 -0
- package/src/styles/_sidebar.scss +2 -2
- package/src/styles/_tokens.scss +75 -9
- package/src/styles/index.scss +2 -0
- package/src/types.ts +140 -2
- package/types/blog/posts.data.d.ts +14 -0
- package/types/components/FfBackToTop.vue.d.ts +3 -0
- package/types/components/FfBanner.vue.d.ts +3 -0
- package/types/components/FfCopyStatus.vue.d.ts +3 -0
- package/types/components/FfDocMeta.vue.d.ts +3 -0
- package/types/components/FfFeature.vue.d.ts +13 -0
- package/types/components/FfFeedback.vue.d.ts +3 -0
- package/types/components/FfFooter.vue.d.ts +3 -0
- package/types/components/FfHero.vue.d.ts +42 -0
- package/types/components/FfHeroCommand.vue.d.ts +9 -0
- package/types/components/FfHomeSponsors.vue.d.ts +19 -0
- package/types/components/FfNavBarTitle.vue.d.ts +17 -0
- package/types/components/FfPost.vue.d.ts +3 -0
- package/types/components/FfProgress.vue.d.ts +3 -0
- package/types/components/FfVersionSwitcher.vue.d.ts +3 -0
- package/types/composables/blog.d.ts +10 -0
- package/types/composables/link.d.ts +12 -0
- package/types/composables/options.d.ts +15 -0
- package/types/composables/relativeTime.d.ts +2 -0
- package/types/composables/tabs.d.ts +15 -0
- package/types/content/Api.vue.d.ts +27 -0
- package/types/content/Badge.vue.d.ts +21 -0
- package/types/content/Callout.vue.d.ts +24 -0
- package/types/content/Card.vue.d.ts +23 -0
- package/types/content/CardGrid.vue.d.ts +20 -0
- package/types/content/FileTree.vue.d.ts +6 -0
- package/types/content/Kbd.vue.d.ts +15 -0
- package/types/content/Steps.vue.d.ts +15 -0
- package/types/content/Tab.vue.d.ts +19 -0
- package/types/content/Tabs.vue.d.ts +7 -0
- package/types/content/Timeline.vue.d.ts +21 -0
- package/types/content/TimelineItem.vue.d.ts +21 -0
- package/types/content/timeline.d.ts +3 -0
- package/types/index.d.ts +25 -0
- package/types/internal.d.ts +9 -0
- package/types/layout/FfBlog.vue.d.ts +3 -0
- package/types/layout/FfLayout.vue.d.ts +23 -0
- package/types/types.d.ts +256 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Comment, Fragment, Text, createTextVNode, defineComponent, h, isVNode, type VNode
|
|
4
|
+
} from 'vue';
|
|
5
|
+
|
|
6
|
+
interface Entry {
|
|
7
|
+
label: Array<string | VNode>
|
|
8
|
+
children: Entry[]
|
|
9
|
+
folder: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Markdown renders a list as plain <ul>/<li> vnodes, and whitespace between them as text; the
|
|
13
|
+
// fragments and blanks are skipped so only real elements remain.
|
|
14
|
+
function elements(nodes: unknown): VNode[] {
|
|
15
|
+
const list = Array.isArray(nodes) ? nodes : [
|
|
16
|
+
nodes
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
return list.flatMap((node) => {
|
|
20
|
+
if (!isVNode(node) || node.type === Comment) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return node.type === Fragment ? elements(node.children) : [
|
|
25
|
+
node
|
|
26
|
+
];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function textOf(part: string | VNode): string {
|
|
31
|
+
if (typeof part === 'string') {
|
|
32
|
+
return part;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeof part.children === 'string') {
|
|
36
|
+
return part.children;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return Array.isArray(part.children) ? part.children.map((child) => textOf(child as string | VNode)).join('') : '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// The slash only marks a folder in the source; it is dropped from what is displayed.
|
|
43
|
+
function stripSlash(part: string | VNode): string | VNode {
|
|
44
|
+
if (typeof part === 'string') {
|
|
45
|
+
return part.replace(/\/\s*$/, '');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (part.type === Text && typeof part.children === 'string') {
|
|
49
|
+
return createTextVNode(part.children.replace(/\/\s*$/, ''));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof part.children === 'string') {
|
|
53
|
+
return h(part.type as string, part.props, part.children.replace(/\/\s*$/, ''));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (Array.isArray(part.children)) {
|
|
57
|
+
const children = part.children as Array<string | VNode>;
|
|
58
|
+
|
|
59
|
+
return h(part.type as string, part.props, [
|
|
60
|
+
...children.slice(0, -1),
|
|
61
|
+
stripSlash(children[children.length - 1])
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return part;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function entries(list: VNode): Entry[] {
|
|
69
|
+
return elements(list.children).filter((node) => node.type === 'li').map((item) => {
|
|
70
|
+
const parts = typeof item.children === 'string' ? [
|
|
71
|
+
item.children
|
|
72
|
+
] : (item.children as unknown[] ?? []).flatMap((child) => (Array.isArray(child) ? child : [
|
|
73
|
+
child
|
|
74
|
+
]));
|
|
75
|
+
const nested = parts.find((part): part is VNode => isVNode(part) && part.type === 'ul');
|
|
76
|
+
const label = parts.filter((part): part is string | VNode => part !== nested && (typeof part === 'string' || isVNode(part)) && textOf(part).trim() !== '');
|
|
77
|
+
const children = nested ? entries(nested) : [];
|
|
78
|
+
const folder = Boolean(nested) || /\/\s*$/.test(textOf(label[label.length - 1] ?? ''));
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
label: folder && label.length ? [
|
|
82
|
+
...label.slice(0, -1),
|
|
83
|
+
stripSlash(label[label.length - 1])
|
|
84
|
+
] : label,
|
|
85
|
+
children,
|
|
86
|
+
folder
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function render(items: Entry[]): VNode {
|
|
92
|
+
return h('ul', items.map((entry) => h('li', {
|
|
93
|
+
class: entry.folder ? 'is-folder' : 'is-file'
|
|
94
|
+
}, [
|
|
95
|
+
h('span', {
|
|
96
|
+
class: 'ff-filetree-name'
|
|
97
|
+
}, entry.label),
|
|
98
|
+
entry.children.length ? render(entry.children) : null
|
|
99
|
+
])));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export default defineComponent({
|
|
103
|
+
name: 'FileTree',
|
|
104
|
+
setup(_, { slots }) {
|
|
105
|
+
// The tree is read off the slot on each render rather than parsed into state, so it follows
|
|
106
|
+
// hot updates of the Markdown it sits in.
|
|
107
|
+
return () => {
|
|
108
|
+
const list = elements(slots.default?.()).find((node) => node.type === 'ul');
|
|
109
|
+
|
|
110
|
+
return h('div', {
|
|
111
|
+
class: 'ff-filetree'
|
|
112
|
+
}, list ? [
|
|
113
|
+
render(entries(list))
|
|
114
|
+
] : []);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// A marker: <Tabs> reads `label` off this vnode to build the tab list, and renders it as a panel.
|
|
3
|
+
defineProps<{
|
|
4
|
+
/** Text of the tab; also the value shared between groups with the same `syncKey`. */
|
|
5
|
+
label: string
|
|
6
|
+
}>();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<slot />
|
|
11
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Fragment, useId, useSlots, type VNode
|
|
4
|
+
} from 'vue';
|
|
5
|
+
import Tab from './Tab.vue';
|
|
6
|
+
import { useTabs } from '../composables/tabs';
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
/** Groups sharing a key switch together, and the choice is remembered across visits. */
|
|
10
|
+
syncKey?: string
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const slots = useSlots();
|
|
14
|
+
const id = useId();
|
|
15
|
+
|
|
16
|
+
// The tabs are read off the slot rather than registered by each <Tab> on setup: during SSR the
|
|
17
|
+
// list is printed before any child runs, so a registration would come too late.
|
|
18
|
+
function panels(nodes: VNode[] = slots.default?.() ?? []): VNode[] {
|
|
19
|
+
return nodes.flatMap((node) => {
|
|
20
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
21
|
+
return panels(node.children as VNode[]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return node.type === Tab ? [
|
|
25
|
+
node
|
|
26
|
+
] : [];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function labels() {
|
|
31
|
+
return panels().map((node) => String(node.props?.label ?? ''));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { active, select, onKeydown } = useTabs(labels, () => props.syncKey);
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div class="ff-tabs">
|
|
39
|
+
<div
|
|
40
|
+
class="ff-tabs-list"
|
|
41
|
+
role="tablist"
|
|
42
|
+
@keydown="onKeydown"
|
|
43
|
+
>
|
|
44
|
+
<button
|
|
45
|
+
v-for="(label, index) in labels()"
|
|
46
|
+
:id="`${id}-tab-${index}`"
|
|
47
|
+
:key="label"
|
|
48
|
+
type="button"
|
|
49
|
+
role="tab"
|
|
50
|
+
class="ff-tabs-tab"
|
|
51
|
+
:class="{ active: index === active }"
|
|
52
|
+
:aria-selected="index === active"
|
|
53
|
+
:aria-controls="`${id}-panel-${index}`"
|
|
54
|
+
:tabindex="index === active ? 0 : -1"
|
|
55
|
+
@click="select(index)"
|
|
56
|
+
>
|
|
57
|
+
{{ label }}
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
v-for="(panel, index) in panels()"
|
|
63
|
+
v-show="index === active"
|
|
64
|
+
:id="`${id}-panel-${index}`"
|
|
65
|
+
:key="index"
|
|
66
|
+
class="ff-tabs-panel"
|
|
67
|
+
role="tabpanel"
|
|
68
|
+
:aria-labelledby="`${id}-tab-${index}`"
|
|
69
|
+
tabindex="0"
|
|
70
|
+
>
|
|
71
|
+
<component :is="panel" />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { provide, toRef } from 'vue';
|
|
3
|
+
import { TIMELINE_LEVEL } from './timeline';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
/** Heading level of the entry titles, to fit the outline the timeline sits in. */
|
|
7
|
+
level?: 2 | 3 | 4 | 5 | 6
|
|
8
|
+
}>(), {
|
|
9
|
+
level: 3
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
provide(TIMELINE_LEVEL, toRef(props, 'level'));
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="ff-timeline">
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, ref } from 'vue';
|
|
3
|
+
import { TIMELINE_LEVEL } from './timeline';
|
|
4
|
+
|
|
5
|
+
// h3 outside a <Timeline>, matching the timeline's own default.
|
|
6
|
+
const level = inject(TIMELINE_LEVEL, ref(3));
|
|
7
|
+
|
|
8
|
+
defineProps<{
|
|
9
|
+
/** Date or period, printed as a small monospaced label above the title. */
|
|
10
|
+
date?: string
|
|
11
|
+
/** Heading of the entry. */
|
|
12
|
+
title?: string
|
|
13
|
+
}>();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<section class="ff-timeline-item">
|
|
18
|
+
<p
|
|
19
|
+
v-if="date"
|
|
20
|
+
class="ff-timeline-date ff-label"
|
|
21
|
+
>
|
|
22
|
+
{{ date }}
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<component
|
|
26
|
+
:is="`h${level}`"
|
|
27
|
+
v-if="title"
|
|
28
|
+
class="ff-timeline-title"
|
|
29
|
+
>
|
|
30
|
+
{{ title }}
|
|
31
|
+
</component>
|
|
32
|
+
|
|
33
|
+
<div class="ff-timeline-body">
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
</section>
|
|
37
|
+
</template>
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,19 @@ import type { Theme } from 'vitepress';
|
|
|
2
2
|
import DefaultTheme from 'vitepress/theme';
|
|
3
3
|
|
|
4
4
|
import FfLayout from './layout/FfLayout.vue';
|
|
5
|
+
import FfBlog from './layout/FfBlog.vue';
|
|
5
6
|
import Api from './content/Api.vue';
|
|
7
|
+
import Badge from './content/Badge.vue';
|
|
8
|
+
import Callout from './content/Callout.vue';
|
|
6
9
|
import Card from './content/Card.vue';
|
|
7
10
|
import CardGrid from './content/CardGrid.vue';
|
|
11
|
+
import FileTree from './content/FileTree.vue';
|
|
8
12
|
import Kbd from './content/Kbd.vue';
|
|
9
13
|
import Steps from './content/Steps.vue';
|
|
14
|
+
import Tab from './content/Tab.vue';
|
|
15
|
+
import Tabs from './content/Tabs.vue';
|
|
16
|
+
import Timeline from './content/Timeline.vue';
|
|
17
|
+
import TimelineItem from './content/TimelineItem.vue';
|
|
10
18
|
|
|
11
19
|
import '../dist/style.css';
|
|
12
20
|
|
|
@@ -21,21 +29,42 @@ const theme: Theme = {
|
|
|
21
29
|
extends: DefaultTheme,
|
|
22
30
|
Layout: FfLayout,
|
|
23
31
|
enhanceApp({ app }) {
|
|
32
|
+
// DefaultTheme registers its own `Badge` before this runs; registering over it makes Vue warn
|
|
33
|
+
// in dev, so the original is dropped first.
|
|
34
|
+
delete app._context.components.Badge;
|
|
35
|
+
|
|
24
36
|
app.component('Api', Api);
|
|
37
|
+
app.component('Badge', Badge);
|
|
38
|
+
// `layout: blog` in the frontmatter resolves to this component by name.
|
|
39
|
+
// eslint-disable-next-line vue/component-definition-name-casing
|
|
40
|
+
app.component('blog', FfBlog);
|
|
41
|
+
app.component('Callout', Callout);
|
|
25
42
|
app.component('Card', Card);
|
|
26
43
|
app.component('CardGrid', CardGrid);
|
|
44
|
+
app.component('FileTree', FileTree);
|
|
27
45
|
app.component('Kbd', Kbd);
|
|
28
46
|
app.component('Steps', Steps);
|
|
47
|
+
app.component('Tab', Tab);
|
|
48
|
+
app.component('Tabs', Tabs);
|
|
49
|
+
app.component('Timeline', Timeline);
|
|
50
|
+
app.component('TimelineItem', TimelineItem);
|
|
29
51
|
}
|
|
30
52
|
};
|
|
31
53
|
|
|
32
54
|
export default theme;
|
|
33
55
|
|
|
34
56
|
export { default as Api } from './content/Api.vue';
|
|
57
|
+
export { default as Badge } from './content/Badge.vue';
|
|
58
|
+
export { default as Callout } from './content/Callout.vue';
|
|
35
59
|
export { default as Card } from './content/Card.vue';
|
|
36
60
|
export { default as CardGrid } from './content/CardGrid.vue';
|
|
61
|
+
export { default as FileTree } from './content/FileTree.vue';
|
|
37
62
|
export { default as Kbd } from './content/Kbd.vue';
|
|
38
63
|
export { default as Steps } from './content/Steps.vue';
|
|
64
|
+
export { default as Tab } from './content/Tab.vue';
|
|
65
|
+
export { default as Tabs } from './content/Tabs.vue';
|
|
66
|
+
export { default as Timeline } from './content/Timeline.vue';
|
|
67
|
+
export { default as TimelineItem } from './content/TimelineItem.vue';
|
|
39
68
|
|
|
40
69
|
export {
|
|
41
70
|
defaultLabels, useLabels, useThemeOptions
|
|
@@ -43,13 +72,20 @@ export {
|
|
|
43
72
|
|
|
44
73
|
export type {
|
|
45
74
|
BannerConfig,
|
|
75
|
+
BlogAuthor,
|
|
76
|
+
BlogConfig,
|
|
77
|
+
BlogRssConfig,
|
|
78
|
+
FeedbackConfig,
|
|
46
79
|
FooterColumn,
|
|
47
80
|
FooterLink,
|
|
48
81
|
HeroCommandTab,
|
|
49
82
|
HeroExtras,
|
|
50
83
|
HeroMetaItem,
|
|
51
84
|
MetaConfig,
|
|
85
|
+
OgConfig,
|
|
86
|
+
OgFont,
|
|
52
87
|
ThemeConfig,
|
|
53
88
|
ThemeLabels,
|
|
54
|
-
ThemeOptions
|
|
89
|
+
ThemeOptions,
|
|
90
|
+
VersionsConfig
|
|
55
91
|
} from './types';
|
package/src/internal.ts
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
//
|
|
3
3
|
// `VPImage`, `VPLink` and `useLayout` are part of its public surface (`vitepress/theme`), but they
|
|
4
4
|
// are imported from their own files instead: components that this theme swaps in through a Vite
|
|
5
|
-
// alias would otherwise import the theme index that imports them back.
|
|
6
|
-
//
|
|
5
|
+
// alias would otherwise import the theme index that imports them back. `normalizeLink` is the one
|
|
6
|
+
// exception: it is not public, but it is what VPLink and VPButton run every href through (site
|
|
7
|
+
// `base`, `.html` suffix without `cleanUrls`), and the theme's own links need the same treatment.
|
|
7
8
|
|
|
9
|
+
export { default as VPBadge } from 'vitepress/dist/client/theme-default/components/VPBadge.vue';
|
|
10
|
+
export { default as VPFlyout } from 'vitepress/dist/client/theme-default/components/VPFlyout.vue';
|
|
8
11
|
export { default as VPIcon } from 'vitepress/dist/client/theme-default/components/VPIcon.vue';
|
|
9
12
|
export { default as VPImage } from 'vitepress/dist/client/theme-default/components/VPImage.vue';
|
|
10
13
|
export { default as VPLink } from 'vitepress/dist/client/theme-default/components/VPLink.vue';
|
|
11
14
|
export { default as VPSponsors } from 'vitepress/dist/client/theme-default/components/VPSponsors.vue';
|
|
15
|
+
export { useLangs } from 'vitepress/dist/client/theme-default/composables/langs.js';
|
|
12
16
|
export { useLayout } from 'vitepress/dist/client/theme-default/composables/layout.js';
|
|
17
|
+
export { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useData, withBase } from 'vitepress';
|
|
3
|
+
import { data as posts } from '../blog/posts.data';
|
|
4
|
+
import {
|
|
5
|
+
formatDate, resolveAuthor, useBlog
|
|
6
|
+
} from '../composables/blog';
|
|
7
|
+
import { format, useLabels } from '../composables/options';
|
|
8
|
+
|
|
9
|
+
const { frontmatter, lang } = useData();
|
|
10
|
+
const { authors } = useBlog();
|
|
11
|
+
const labels = useLabels();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="ff-blog">
|
|
16
|
+
<h1 class="ff-blog-title">
|
|
17
|
+
{{ frontmatter.title }}
|
|
18
|
+
</h1>
|
|
19
|
+
|
|
20
|
+
<p
|
|
21
|
+
v-if="frontmatter.description"
|
|
22
|
+
class="ff-blog-lede"
|
|
23
|
+
>
|
|
24
|
+
{{ frontmatter.description }}
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<ol class="ff-blog-list">
|
|
28
|
+
<li
|
|
29
|
+
v-for="post in posts"
|
|
30
|
+
:key="post.url"
|
|
31
|
+
class="ff-blog-post"
|
|
32
|
+
>
|
|
33
|
+
<div class="ff-blog-meta ff-label">
|
|
34
|
+
<time :datetime="post.date">{{ formatDate(post.date, lang) }}</time>
|
|
35
|
+
<span v-if="post.author">{{ format(labels.blogBy, resolveAuthor(authors, post.author)!.name) }}</span>
|
|
36
|
+
<span
|
|
37
|
+
v-for="tag in post.tags"
|
|
38
|
+
:key="tag"
|
|
39
|
+
>{{ tag }}</span>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<h2 class="ff-blog-post-title">
|
|
43
|
+
<a :href="withBase(post.url)">{{ post.title }}</a>
|
|
44
|
+
</h2>
|
|
45
|
+
|
|
46
|
+
<p
|
|
47
|
+
v-if="post.excerpt"
|
|
48
|
+
class="ff-blog-excerpt"
|
|
49
|
+
>
|
|
50
|
+
{{ post.excerpt }}
|
|
51
|
+
</p>
|
|
52
|
+
</li>
|
|
53
|
+
</ol>
|
|
54
|
+
|
|
55
|
+
<p
|
|
56
|
+
v-if="!posts.length"
|
|
57
|
+
class="ff-blog-empty ff-label"
|
|
58
|
+
>
|
|
59
|
+
{{ labels.blogEmpty }}
|
|
60
|
+
</p>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
package/src/layout/FfLayout.vue
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useSlots } from 'vue';
|
|
3
|
+
import { useData } from 'vitepress';
|
|
3
4
|
import DefaultTheme from 'vitepress/theme';
|
|
4
5
|
import FfBackToTop from '../components/FfBackToTop.vue';
|
|
5
6
|
import FfBanner from '../components/FfBanner.vue';
|
|
7
|
+
import FfCopyStatus from '../components/FfCopyStatus.vue';
|
|
6
8
|
import FfDocMeta from '../components/FfDocMeta.vue';
|
|
9
|
+
import FfFeedback from '../components/FfFeedback.vue';
|
|
10
|
+
import FfPost from '../components/FfPost.vue';
|
|
11
|
+
import FfProgress from '../components/FfProgress.vue';
|
|
7
12
|
import { useThemeOptions } from '../composables/options';
|
|
8
13
|
|
|
9
14
|
const { Layout } = DefaultTheme;
|
|
10
15
|
const options = useThemeOptions();
|
|
16
|
+
const { frontmatter } = useData();
|
|
11
17
|
|
|
12
|
-
//
|
|
18
|
+
// Four slots carry the additions of this theme; every other slot the site passes in is forwarded
|
|
13
19
|
// untouched, so the whole default slot surface keeps working.
|
|
14
20
|
const owned = [
|
|
15
21
|
'layout-top',
|
|
16
22
|
'doc-before',
|
|
23
|
+
'doc-footer-before',
|
|
17
24
|
'layout-bottom'
|
|
18
25
|
];
|
|
19
26
|
|
|
@@ -26,21 +33,30 @@ const forwarded = computed(() => Object.keys(slots).filter((name) => !owned.incl
|
|
|
26
33
|
class="ff-theme"
|
|
27
34
|
:data-nav-order="options.navOrder ?? 'search-first'"
|
|
28
35
|
:data-nav-sticky="options.navSticky === false ? 'false' : 'true'"
|
|
36
|
+
:data-layout="frontmatter.wide === true ? 'wide' : undefined"
|
|
29
37
|
>
|
|
30
38
|
<Layout>
|
|
31
39
|
<template #layout-top>
|
|
40
|
+
<FfProgress />
|
|
32
41
|
<FfBanner />
|
|
33
42
|
<slot name="layout-top" />
|
|
34
43
|
</template>
|
|
35
44
|
|
|
36
45
|
<template #doc-before>
|
|
37
46
|
<FfDocMeta />
|
|
47
|
+
<FfPost />
|
|
38
48
|
<slot name="doc-before" />
|
|
39
49
|
</template>
|
|
40
50
|
|
|
51
|
+
<template #doc-footer-before>
|
|
52
|
+
<FfFeedback />
|
|
53
|
+
<slot name="doc-footer-before" />
|
|
54
|
+
</template>
|
|
55
|
+
|
|
41
56
|
<template #layout-bottom>
|
|
42
57
|
<slot name="layout-bottom" />
|
|
43
58
|
<FfBackToTop />
|
|
59
|
+
<FfCopyStatus />
|
|
44
60
|
</template>
|
|
45
61
|
|
|
46
62
|
<template
|
package/src/styles/_base.scss
CHANGED
|
@@ -73,10 +73,6 @@
|
|
|
73
73
|
border-width: #{mg.ref("rule-width")};
|
|
74
74
|
font-weight: 550;
|
|
75
75
|
letter-spacing: 0.01em;
|
|
76
|
-
transition:
|
|
77
|
-
background-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
|
|
78
|
-
border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")},
|
|
79
|
-
color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
.VPButton.medium {
|
|
@@ -99,7 +95,7 @@
|
|
|
99
95
|
font-size: #{mg.ref("size-label")};
|
|
100
96
|
font-weight: 500;
|
|
101
97
|
text-transform: uppercase;
|
|
102
|
-
letter-spacing:
|
|
98
|
+
letter-spacing: #{mg.ref("tracking-label-tight")};
|
|
103
99
|
color: #{mg.ref("color-ink-muted")};
|
|
104
100
|
}
|
|
105
101
|
|
|
@@ -119,3 +115,22 @@
|
|
|
119
115
|
color: #{mg.ref("color-danger")};
|
|
120
116
|
}
|
|
121
117
|
}
|
|
118
|
+
|
|
119
|
+
// --------------------------------------------------------------------------------------------- //
|
|
120
|
+
// Forced colours (Windows high contrast)
|
|
121
|
+
//
|
|
122
|
+
// Borders and text are remapped by the browser; what it drops are the colours painted as a
|
|
123
|
+
// background, such as the active tab's underline.
|
|
124
|
+
// --------------------------------------------------------------------------------------------- //
|
|
125
|
+
|
|
126
|
+
@media (forced-colors: active) {
|
|
127
|
+
.ff-theme {
|
|
128
|
+
.ff-hero-command-tab.active::after {
|
|
129
|
+
background: Highlight;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ff-hero-copy {
|
|
133
|
+
border-color: ButtonText;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
package/src/styles/_blocks.scss
CHANGED
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
font-size: #{mg.ref("size-meta")};
|
|
94
94
|
font-weight: 500;
|
|
95
95
|
text-transform: uppercase;
|
|
96
|
-
letter-spacing:
|
|
96
|
+
letter-spacing: #{mg.ref("tracking-label-tight")};
|
|
97
97
|
color: #{mg.ref("color-ink")};
|
|
98
98
|
cursor: pointer;
|
|
99
99
|
}
|
|
@@ -101,4 +101,28 @@
|
|
|
101
101
|
.vp-doc .custom-block.details[open] summary {
|
|
102
102
|
margin-bottom: 0.75rem;
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
// Status badges for `<Badge type="…">`: they extend the tip / warning / danger colours of
|
|
106
|
+
// the base badge, so only the ones that differ from it are declared.
|
|
107
|
+
|
|
108
|
+
.VPBadge.new {
|
|
109
|
+
border-color: #{mg.ref("color-accent")};
|
|
110
|
+
color: #{mg.ref("color-accent")};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.VPBadge.beta {
|
|
114
|
+
border-color: #{mg.ref("color-warning")};
|
|
115
|
+
color: #{mg.ref("color-warning")};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.VPBadge.deprecated {
|
|
119
|
+
border-color: #{mg.ref("color-danger")};
|
|
120
|
+
color: #{mg.ref("color-danger")};
|
|
121
|
+
text-decoration: line-through;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.VPBadge.since {
|
|
125
|
+
border-color: #{mg.ref("color-rule-strong")};
|
|
126
|
+
color: #{mg.ref("color-ink-muted")};
|
|
127
|
+
}
|
|
104
128
|
}
|