@frontfactory/vitepress-theme 1.5.0 → 1.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 +18 -1
- package/config.d.ts +4 -4
- package/config.js +39 -17
- package/dist/style.css +1 -2011
- package/package.json +15 -6
- package/src/components/FfBackToTop.vue +37 -30
- package/src/components/FfBanner.vue +64 -50
- package/src/components/FfDocMeta.vue +107 -55
- package/src/components/FfFeature.vue +58 -26
- package/src/components/FfFooter.vue +97 -51
- package/src/components/FfHero.vue +168 -109
- package/src/components/FfHeroCommand.vue +66 -47
- package/src/components/FfHomeSponsors.vue +30 -14
- package/src/composables/options.ts +23 -14
- package/src/content/Api.vue +30 -13
- package/src/content/Card.vue +22 -16
- package/src/content/CardGrid.vue +9 -4
- package/src/content/Kbd.vue +1 -1
- package/src/content/Steps.vue +3 -3
- package/src/index.ts +25 -23
- package/src/internal.ts +5 -5
- package/src/layout/FfLayout.vue +45 -34
- package/src/styles/_blocks.scss +1 -0
- package/src/styles/_code.scss +1 -0
- package/src/styles/_content.scss +8 -2
- package/src/styles/_doc.scss +7 -6
- package/src/styles/_home.scss +13 -8
- package/src/styles/_motion.scss +1 -0
- package/src/styles/_nav.scss +5 -3
- package/src/styles/_sidebar.scss +1 -0
- package/src/styles/_tokens.scss +15 -26
- package/src/types.ts +2 -2
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontfactory/vitepress-theme",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Editorial VitePress theme — hairline rules, numbered sections and monospaced metadata.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "sass --no-source-map --pkg-importer=node --load-path=node_modules src/styles/index.scss dist/style.css",
|
|
7
|
+
"build": "sass --style=compressed --no-source-map --pkg-importer=node --load-path=node_modules src/styles/index.scss dist/style.css",
|
|
8
8
|
"dev": "npm run build -- --watch",
|
|
9
9
|
"dev:playground": "npm run build && vitepress dev playground",
|
|
10
10
|
"build:playground": "npm run build && vitepress build playground",
|
|
11
11
|
"typecheck": "vue-tsc --noEmit",
|
|
12
|
+
"lint:js": "eslint .",
|
|
13
|
+
"lint:css": "stylelint \"src/**/*.scss\"",
|
|
14
|
+
"lint": "npm run lint:js && npm run lint:css",
|
|
12
15
|
"prepare": "husky",
|
|
13
16
|
"prepack": "npm run build",
|
|
14
17
|
"release": "semantic-release"
|
|
@@ -32,17 +35,23 @@
|
|
|
32
35
|
"./package.json": "./package.json"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
|
-
"@commitlint/cli": "^
|
|
36
|
-
"@commitlint/config-conventional": "^
|
|
38
|
+
"@commitlint/cli": "^21.2.2",
|
|
39
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
40
|
+
"@front-factory/eslint-config": "^2.4.2",
|
|
41
|
+
"@front-factory/stylelint-config": "^1.12.1",
|
|
37
42
|
"@magnesium/theme": "^5.2.2",
|
|
38
|
-
"@semantic-release/changelog": "^
|
|
39
|
-
"@semantic-release/git": "^
|
|
43
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
44
|
+
"@semantic-release/git": "^11.0.1",
|
|
40
45
|
"@semantic-release/github": "^12.0.9",
|
|
41
46
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
47
|
+
"eslint": "^10.10.0",
|
|
48
|
+
"eslint-plugin-vue": "^10.11.0",
|
|
42
49
|
"husky": "^9.1.7",
|
|
43
50
|
"sass": "^1.100.0",
|
|
44
51
|
"semantic-release": "^25.0.9",
|
|
52
|
+
"stylelint": "^16.26.1",
|
|
45
53
|
"typescript": "^5.9.3",
|
|
54
|
+
"typescript-eslint": "^8.70.0",
|
|
46
55
|
"vitepress": "^2.0.0-alpha.20",
|
|
47
56
|
"vue": "^3.5.34",
|
|
48
57
|
"vue-tsc": "^3.2.0"
|
|
@@ -1,50 +1,57 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
computed, onMounted, onUnmounted, ref
|
|
4
|
+
} from 'vue';
|
|
5
|
+
import { useData } from 'vitepress';
|
|
6
|
+
import { useLabels, useThemeOptions } from '../composables/options';
|
|
5
7
|
|
|
6
|
-
const { theme } = useData()
|
|
7
|
-
const options = useThemeOptions()
|
|
8
|
-
const labels = useLabels()
|
|
8
|
+
const { theme } = useData();
|
|
9
|
+
const options = useThemeOptions();
|
|
10
|
+
const labels = useLabels();
|
|
9
11
|
|
|
10
12
|
// The visible text is the accessible name; the tooltip reuses the default theme's own option,
|
|
11
13
|
// so a site that already localised its mobile return-to-top link gets this one for free.
|
|
12
|
-
const title = computed(() => theme.value.returnToTopLabel ?? 'Return to top')
|
|
14
|
+
const title = computed(() => theme.value.returnToTopLabel ?? 'Return to top');
|
|
13
15
|
|
|
14
|
-
const enabled = computed(() => options.value.backToTop !== false)
|
|
16
|
+
const enabled = computed(() => options.value.backToTop !== false);
|
|
15
17
|
|
|
16
|
-
const visible = ref(false)
|
|
18
|
+
const visible = ref(false);
|
|
17
19
|
|
|
18
20
|
function onScroll() {
|
|
19
|
-
visible.value = window.scrollY > window.innerHeight
|
|
21
|
+
visible.value = window.scrollY > window.innerHeight;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
function toTop() {
|
|
23
|
-
window.scrollTo({
|
|
25
|
+
window.scrollTo({
|
|
26
|
+
top: 0,
|
|
27
|
+
behavior: 'smooth'
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
onMounted(() => {
|
|
27
|
-
onScroll()
|
|
28
|
-
window.addEventListener('scroll', onScroll, {
|
|
29
|
-
|
|
32
|
+
onScroll();
|
|
33
|
+
window.addEventListener('scroll', onScroll, {
|
|
34
|
+
passive: true
|
|
35
|
+
});
|
|
36
|
+
});
|
|
30
37
|
|
|
31
|
-
onUnmounted(() => window.removeEventListener('scroll', onScroll))
|
|
38
|
+
onUnmounted(() => window.removeEventListener('scroll', onScroll));
|
|
32
39
|
</script>
|
|
33
40
|
|
|
34
41
|
<template>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
<ClientOnly>
|
|
43
|
+
<button
|
|
44
|
+
v-if="enabled"
|
|
45
|
+
type="button"
|
|
46
|
+
class="ff-to-top ff-label"
|
|
47
|
+
:class="{ 'is-visible': visible }"
|
|
48
|
+
:tabindex="visible ? 0 : -1"
|
|
49
|
+
:aria-hidden="!visible"
|
|
50
|
+
:title="title"
|
|
51
|
+
@click="toTop"
|
|
52
|
+
>
|
|
53
|
+
<span aria-hidden="true">↑</span>
|
|
54
|
+
<span>{{ labels.backToTop }}</span>
|
|
55
|
+
</button>
|
|
56
|
+
</ClientOnly>
|
|
50
57
|
</template>
|
|
@@ -1,81 +1,95 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
computed, onMounted, onUnmounted, ref
|
|
4
|
+
} from 'vue';
|
|
5
|
+
import { useLabels, useThemeOptions } from '../composables/options';
|
|
4
6
|
|
|
5
|
-
const options = useThemeOptions()
|
|
6
|
-
const labels = useLabels()
|
|
7
|
-
const banner = computed(() => options.value.banner)
|
|
7
|
+
const options = useThemeOptions();
|
|
8
|
+
const labels = useLabels();
|
|
9
|
+
const banner = computed(() => options.value.banner);
|
|
8
10
|
|
|
9
|
-
const el = ref<HTMLElement>()
|
|
10
|
-
let observer: ResizeObserver | undefined
|
|
11
|
+
const el = ref<HTMLElement>();
|
|
12
|
+
let observer: ResizeObserver | undefined;
|
|
11
13
|
|
|
12
14
|
// The class is set on <html> by an inline script injected in the head, so a dismissed banner never
|
|
13
15
|
// paints. See transformHead() in config.js.
|
|
14
|
-
const DISMISSED = 'ff-banner-dismissed'
|
|
16
|
+
const DISMISSED = 'ff-banner-dismissed';
|
|
15
17
|
|
|
16
18
|
function height() {
|
|
17
|
-
const root = document.documentElement
|
|
19
|
+
const root = document.documentElement;
|
|
18
20
|
|
|
19
21
|
if (!banner.value || root.classList.contains(DISMISSED)) {
|
|
20
|
-
root.style.removeProperty('--vp-layout-top-height')
|
|
22
|
+
root.style.removeProperty('--vp-layout-top-height');
|
|
21
23
|
|
|
22
|
-
return
|
|
24
|
+
return;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
root.style.setProperty('--vp-layout-top-height', `${el.value?.offsetHeight ?? 0}px`)
|
|
27
|
+
root.style.setProperty('--vp-layout-top-height', `${el.value?.offsetHeight ?? 0}px`);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
function dismiss() {
|
|
29
|
-
if (!banner.value)
|
|
31
|
+
if (!banner.value) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
30
34
|
|
|
31
|
-
localStorage.setItem(`ff-banner-${banner.value.id}`, 'dismissed')
|
|
32
|
-
document.documentElement.classList.add(DISMISSED)
|
|
33
|
-
height()
|
|
35
|
+
localStorage.setItem(`ff-banner-${banner.value.id}`, 'dismissed');
|
|
36
|
+
document.documentElement.classList.add(DISMISSED);
|
|
37
|
+
height();
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
onMounted(() => {
|
|
37
|
-
height()
|
|
41
|
+
height();
|
|
38
42
|
|
|
39
43
|
if (el.value) {
|
|
40
|
-
observer = new ResizeObserver(height)
|
|
41
|
-
observer.observe(el.value)
|
|
44
|
+
observer = new ResizeObserver(height);
|
|
45
|
+
observer.observe(el.value);
|
|
42
46
|
}
|
|
43
|
-
})
|
|
47
|
+
});
|
|
44
48
|
|
|
45
49
|
onUnmounted(() => {
|
|
46
|
-
observer?.disconnect()
|
|
47
|
-
document.documentElement.style.removeProperty('--vp-layout-top-height')
|
|
48
|
-
})
|
|
50
|
+
observer?.disconnect();
|
|
51
|
+
document.documentElement.style.removeProperty('--vp-layout-top-height');
|
|
52
|
+
});
|
|
49
53
|
</script>
|
|
50
54
|
|
|
51
55
|
<template>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
<div
|
|
57
|
+
v-if="banner"
|
|
58
|
+
ref="el"
|
|
59
|
+
class="ff-banner"
|
|
60
|
+
:data-variant="banner.variant ?? 'ink'"
|
|
61
|
+
:data-gradient="banner.gradient || undefined"
|
|
62
|
+
>
|
|
63
|
+
<component
|
|
64
|
+
:is="banner.link ? 'a' : 'div'"
|
|
65
|
+
class="ff-banner-body"
|
|
66
|
+
:href="banner.link"
|
|
58
67
|
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
<span
|
|
69
|
+
v-if="banner.icon"
|
|
70
|
+
class="ff-banner-icon"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
>{{ banner.icon }}</span>
|
|
73
|
+
<span
|
|
74
|
+
class="ff-banner-text"
|
|
75
|
+
v-html="banner.text"
|
|
76
|
+
/>
|
|
77
|
+
<span
|
|
78
|
+
v-if="banner.link"
|
|
79
|
+
class="ff-banner-cta"
|
|
80
|
+
>
|
|
81
|
+
{{ banner.linkText ?? 'Read more' }}
|
|
82
|
+
<span aria-hidden="true">→</span>
|
|
83
|
+
</span>
|
|
84
|
+
</component>
|
|
71
85
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
class="ff-banner-close"
|
|
89
|
+
:aria-label="labels.bannerDismiss"
|
|
90
|
+
@click="dismiss"
|
|
91
|
+
>
|
|
92
|
+
×
|
|
93
|
+
</button>
|
|
94
|
+
</div>
|
|
81
95
|
</template>
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import {
|
|
3
|
+
computed, nextTick, onMounted, ref, watch
|
|
4
|
+
} from 'vue';
|
|
5
|
+
import { useData } from 'vitepress';
|
|
6
|
+
import { useLayout } from '../internal';
|
|
7
|
+
import {
|
|
8
|
+
format, useLabels, useThemeOptions
|
|
9
|
+
} from '../composables/options';
|
|
10
|
+
import type { DefaultTheme } from 'vitepress/theme';
|
|
11
|
+
|
|
12
|
+
const { page, frontmatter, lang } = useData();
|
|
13
|
+
const { sidebarGroups } = useLayout();
|
|
14
|
+
const options = useThemeOptions();
|
|
15
|
+
const labels = useLabels();
|
|
12
16
|
|
|
13
17
|
const meta = computed(() => {
|
|
14
|
-
if (options.value.meta === false || frontmatter.value.docMeta === false)
|
|
18
|
+
if (options.value.meta === false || frontmatter.value.docMeta === false) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
15
21
|
|
|
16
|
-
return options.value.meta ?? {}
|
|
17
|
-
})
|
|
22
|
+
return options.value.meta ?? {};
|
|
23
|
+
});
|
|
18
24
|
|
|
19
25
|
// --------------------------------------------------------------------------------------------- //
|
|
20
26
|
// Section, read from the sidebar the site already declares
|
|
@@ -27,86 +33,132 @@ function normalize(path: string) {
|
|
|
27
33
|
return path
|
|
28
34
|
.replace(/^\//, '')
|
|
29
35
|
.replace(/(index)?\.(md|html)$/, '')
|
|
30
|
-
.replace(/\/$/, '')
|
|
36
|
+
.replace(/\/$/, '');
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
function contains(items: DefaultTheme.SidebarItem[], path: string): boolean {
|
|
34
40
|
return items.some(
|
|
35
41
|
(item) =>
|
|
36
42
|
(item.link && normalize(item.link) === path) || contains(item.items ?? [], path)
|
|
37
|
-
)
|
|
43
|
+
);
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
const section = computed(() => {
|
|
41
|
-
if (!meta.value || meta.value.section === false)
|
|
42
|
-
|
|
47
|
+
if (!meta.value || meta.value.section === false) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (frontmatter.value.section) {
|
|
52
|
+
return String(frontmatter.value.section);
|
|
53
|
+
}
|
|
43
54
|
|
|
44
|
-
const path = normalize(page.value.relativePath)
|
|
55
|
+
const path = normalize(page.value.relativePath);
|
|
45
56
|
|
|
46
|
-
return sidebarGroups.value.find((group) => contains(group.items ?? [], path))?.text ?? null
|
|
47
|
-
})
|
|
57
|
+
return sidebarGroups.value.find((group) => contains(group.items ?? [], path))?.text ?? null;
|
|
58
|
+
});
|
|
48
59
|
|
|
49
60
|
// --------------------------------------------------------------------------------------------- //
|
|
50
61
|
// Reading time, measured on the rendered page
|
|
51
62
|
// --------------------------------------------------------------------------------------------- //
|
|
52
63
|
|
|
53
|
-
const words = ref(0)
|
|
64
|
+
const words = ref(0);
|
|
54
65
|
|
|
55
66
|
function measure() {
|
|
56
67
|
words.value =
|
|
57
68
|
document.querySelector('.vp-doc')?.textContent?.trim().split(/\s+/).filter(Boolean)
|
|
58
|
-
.length ?? 0
|
|
69
|
+
.length ?? 0;
|
|
59
70
|
}
|
|
60
71
|
|
|
61
|
-
onMounted(() => nextTick(measure))
|
|
62
|
-
watch(() => page.value.relativePath, () => nextTick(measure))
|
|
72
|
+
onMounted(() => nextTick(measure));
|
|
73
|
+
watch(() => page.value.relativePath, () => nextTick(measure));
|
|
63
74
|
|
|
64
75
|
const minutes = computed(() => {
|
|
65
|
-
if (!meta.value || meta.value.readingTime === false || !words.value)
|
|
76
|
+
if (!meta.value || meta.value.readingTime === false || !words.value) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
66
79
|
|
|
67
|
-
return Math.max(1, Math.round(words.value / (meta.value.wordsPerMinute ?? 200)))
|
|
68
|
-
})
|
|
80
|
+
return Math.max(1, Math.round(words.value / (meta.value.wordsPerMinute ?? 200)));
|
|
81
|
+
});
|
|
69
82
|
|
|
70
83
|
// --------------------------------------------------------------------------------------------- //
|
|
71
84
|
// Last updated
|
|
72
85
|
// --------------------------------------------------------------------------------------------- //
|
|
73
86
|
|
|
74
87
|
const units: [Intl.RelativeTimeFormatUnit, number][] = [
|
|
75
|
-
[
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
[
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
[
|
|
89
|
+
'year',
|
|
90
|
+
31536000000
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
'month',
|
|
94
|
+
2592000000
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
'week',
|
|
98
|
+
604800000
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
'day',
|
|
102
|
+
86400000
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
'hour',
|
|
106
|
+
3600000
|
|
107
|
+
],
|
|
108
|
+
[
|
|
109
|
+
'minute',
|
|
110
|
+
60000
|
|
111
|
+
]
|
|
112
|
+
];
|
|
82
113
|
|
|
83
114
|
const updated = computed(() => {
|
|
84
|
-
if (!meta.value || meta.value.lastUpdated === false || !page.value.lastUpdated)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const relative = new Intl.RelativeTimeFormat(lang.value, { numeric: 'auto' })
|
|
115
|
+
if (!meta.value || meta.value.lastUpdated === false || !page.value.lastUpdated) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
88
118
|
|
|
89
|
-
|
|
90
|
-
|
|
119
|
+
const elapsed = page.value.lastUpdated - Date.now();
|
|
120
|
+
const relative = new Intl.RelativeTimeFormat(lang.value, {
|
|
121
|
+
numeric: 'auto'
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
for (const [
|
|
125
|
+
unit,
|
|
126
|
+
ms
|
|
127
|
+
] of units) {
|
|
128
|
+
if (Math.abs(elapsed) >= ms) {
|
|
129
|
+
return relative.format(Math.round(elapsed / ms), unit);
|
|
130
|
+
}
|
|
91
131
|
}
|
|
92
132
|
|
|
93
|
-
return relative.format(0, 'minute')
|
|
94
|
-
})
|
|
133
|
+
return relative.format(0, 'minute');
|
|
134
|
+
});
|
|
95
135
|
|
|
96
|
-
const hidden = computed(() => !meta.value || frontmatter.value.layout === 'home')
|
|
136
|
+
const hidden = computed(() => !meta.value || frontmatter.value.layout === 'home');
|
|
97
137
|
</script>
|
|
98
138
|
|
|
99
139
|
<template>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
140
|
+
<div
|
|
141
|
+
v-if="!hidden"
|
|
142
|
+
class="ff-doc-meta ff-label"
|
|
143
|
+
>
|
|
144
|
+
<span
|
|
145
|
+
v-if="section"
|
|
146
|
+
class="ff-doc-meta-item"
|
|
147
|
+
>{{ section }}</span>
|
|
148
|
+
|
|
149
|
+
<ClientOnly>
|
|
150
|
+
<span
|
|
151
|
+
v-if="minutes"
|
|
152
|
+
class="ff-doc-meta-item"
|
|
153
|
+
>
|
|
154
|
+
{{ format(labels.readingTime, minutes) }}
|
|
155
|
+
</span>
|
|
156
|
+
<span
|
|
157
|
+
v-if="updated"
|
|
158
|
+
class="ff-doc-meta-item"
|
|
159
|
+
>
|
|
160
|
+
{{ format(labels.lastUpdated, updated) }}
|
|
161
|
+
</span>
|
|
162
|
+
</ClientOnly>
|
|
163
|
+
</div>
|
|
112
164
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { VPImage, VPLink } from '../internal'
|
|
3
|
-
import type { DefaultTheme } from 'vitepress/theme'
|
|
2
|
+
import { VPImage, VPLink } from '../internal';
|
|
3
|
+
import type { DefaultTheme } from 'vitepress/theme';
|
|
4
4
|
|
|
5
5
|
defineProps<{
|
|
6
6
|
icon?: DefaultTheme.FeatureIcon
|
|
@@ -10,35 +10,67 @@ defineProps<{
|
|
|
10
10
|
linkText?: string
|
|
11
11
|
rel?: string
|
|
12
12
|
target?: string
|
|
13
|
-
}>()
|
|
13
|
+
}>();
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
<VPLink
|
|
18
|
+
class="VPFeature ff-feature"
|
|
19
|
+
:href="link"
|
|
20
|
+
:rel="rel"
|
|
21
|
+
:target="target"
|
|
22
|
+
:no-icon="true"
|
|
23
|
+
:tag="link ? 'a' : 'div'"
|
|
24
|
+
>
|
|
25
|
+
<span
|
|
26
|
+
class="ff-feature-index"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
/>
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
<div
|
|
31
|
+
v-if="typeof icon === 'object'"
|
|
32
|
+
class="ff-feature-icon"
|
|
33
|
+
>
|
|
34
|
+
<VPImage
|
|
35
|
+
:image="icon"
|
|
36
|
+
:alt="icon.alt"
|
|
37
|
+
:height="icon.height || 28"
|
|
38
|
+
:width="icon.width || 28"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
<div
|
|
42
|
+
v-else-if="icon"
|
|
43
|
+
class="ff-feature-icon"
|
|
44
|
+
v-html="icon"
|
|
45
|
+
/>
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
<h2
|
|
48
|
+
class="ff-feature-title"
|
|
49
|
+
v-html="title"
|
|
50
|
+
/>
|
|
33
51
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
<ul
|
|
53
|
+
v-if="Array.isArray(details)"
|
|
54
|
+
class="ff-feature-details"
|
|
55
|
+
>
|
|
56
|
+
<li
|
|
57
|
+
v-for="item in details"
|
|
58
|
+
:key="item"
|
|
59
|
+
v-html="item"
|
|
60
|
+
/>
|
|
61
|
+
</ul>
|
|
62
|
+
<p
|
|
63
|
+
v-else-if="details"
|
|
64
|
+
class="ff-feature-details"
|
|
65
|
+
v-html="details"
|
|
66
|
+
/>
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
68
|
+
<span
|
|
69
|
+
v-if="linkText"
|
|
70
|
+
class="ff-feature-link ff-label"
|
|
71
|
+
>
|
|
72
|
+
{{ linkText }}
|
|
73
|
+
<span aria-hidden="true">→</span>
|
|
74
|
+
</span>
|
|
75
|
+
</VPLink>
|
|
44
76
|
</template>
|