themekit-js 1.1.3 → 1.1.4
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/dist/client/app/data.js +3 -0
- package/dist/client/app/index.js +23 -1
- package/dist/client/app/router.js +8 -4
- package/dist/client/app/utils.js +6 -5
- package/dist/client/index.d.ts +4 -0
- package/dist/client/shared.js +2 -1
- package/dist/client/theme-default/components/VPContent.vue +3 -0
- package/dist/client/theme-default/components/VPHero.vue +1 -1
- package/dist/client/theme-default/components/VPHomeHero.vue +1 -1
- package/dist/client/theme-default/components/VPMenuLink.vue +1 -0
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +48 -7
- package/dist/node/cli.js +1 -1
- package/dist/node/index.d.ts +3 -1
- package/dist/node/index.js +4 -4
- package/dist/node/{serve-DQyJC2NI.js → serve-kCMItmVT.js} +11104 -11032
- package/package.json +6 -3
- package/template/.themekit/config.js +3 -1
- package/types/shared.d.ts +2 -0
package/dist/client/app/data.js
CHANGED
|
@@ -37,6 +37,9 @@ export function initData(route) {
|
|
|
37
37
|
});
|
|
38
38
|
return {
|
|
39
39
|
site,
|
|
40
|
+
// @seedunk
|
|
41
|
+
themeName: computed(() => site.value.themeName),
|
|
42
|
+
base: computed(() => site.value.base),
|
|
40
43
|
theme: computed(() => site.value.themeConfig),
|
|
41
44
|
page: computed(() => route.data),
|
|
42
45
|
frontmatter: computed(() => route.data.frontmatter),
|
package/dist/client/app/index.js
CHANGED
|
@@ -29,12 +29,34 @@ const Theme = resolveThemeExtends(RawTheme);
|
|
|
29
29
|
const VitePressApp = defineComponent({
|
|
30
30
|
name: 'VitePressApp',
|
|
31
31
|
setup() {
|
|
32
|
-
const { site, lang, dir } = useData();
|
|
32
|
+
const { site, lang, dir, themeName, base } = useData();
|
|
33
33
|
// change the language on the HTML element based on the current lang
|
|
34
34
|
onMounted(() => {
|
|
35
35
|
watchEffect(() => {
|
|
36
36
|
document.documentElement.lang = lang.value;
|
|
37
37
|
document.documentElement.dir = dir.value;
|
|
38
|
+
//@seedunk-theme
|
|
39
|
+
document.documentElement.setAttribute("theme", themeName.value);
|
|
40
|
+
let links = [];
|
|
41
|
+
//let scripts=[]
|
|
42
|
+
if (themeName.value == "changzhou") {
|
|
43
|
+
links.push("bootstrap3/dist/css/bootstrap.min.css");
|
|
44
|
+
links.push("changzhou/dist/css/style.css");
|
|
45
|
+
}
|
|
46
|
+
for (var linkHref in links) {
|
|
47
|
+
const link = document.createElement('link');
|
|
48
|
+
link.href = base.value + '.themekit/assets/' + links[linkHref];
|
|
49
|
+
link.rel = "stylesheet";
|
|
50
|
+
document.head.appendChild(link);
|
|
51
|
+
}
|
|
52
|
+
/*
|
|
53
|
+
for(var scriptSrc in scripts){
|
|
54
|
+
const script = document.createElement('script');
|
|
55
|
+
script.src = base.value +'.themekit/assets/'+scripts[scriptSrc];
|
|
56
|
+
script.type="text/javascript";
|
|
57
|
+
document.body.appendChild(script);
|
|
58
|
+
}
|
|
59
|
+
*/
|
|
38
60
|
});
|
|
39
61
|
});
|
|
40
62
|
if (import.meta.env.PROD && site.value.router.prefetchLinks) {
|
|
@@ -54,7 +54,8 @@ export function createRouter(loadPageModule, fallbackComponent) {
|
|
|
54
54
|
if (inBrowser) {
|
|
55
55
|
nextTick(() => {
|
|
56
56
|
let actualPathname = siteDataRef.value.base +
|
|
57
|
-
__pageData.relativePath.replace(/(?:(^|\/)
|
|
57
|
+
__pageData.relativePath.replace(/(?:(^|\/)README)?\.md$/, '$1');
|
|
58
|
+
//@seedunk index __pageData.relativePath.replace(/(?:(^|\/)index)?\.md$/, '$1')
|
|
58
59
|
if (!siteDataRef.value.cleanUrls && !actualPathname.endsWith('/')) {
|
|
59
60
|
actualPathname += '.html';
|
|
60
61
|
}
|
|
@@ -215,15 +216,18 @@ function handleHMR(route) {
|
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
function shouldHotReload(payload) {
|
|
218
|
-
const payloadPath = payload.path.replace(/(?:(^|\/)index)?\.md$/, '$1')
|
|
219
|
+
//@seedunk index|const payloadPath = payload.path.replace(/(?:(^|\/)index)?\.md$/, '$1')
|
|
220
|
+
const payloadPath = payload.path.replace(/(?:(^|\/)README)?\.md$/, '$1');
|
|
219
221
|
const locationPath = location.pathname
|
|
220
|
-
|
|
222
|
+
//@seedunk index|.replace(/(?:(^|\/)index)?\.html$/, '')
|
|
223
|
+
.replace(/(?:(^|\/)README)?\.html$/, '')
|
|
221
224
|
.slice(siteDataRef.value.base.length - 1);
|
|
222
225
|
return payloadPath === locationPath;
|
|
223
226
|
}
|
|
224
227
|
function normalizeHref(href) {
|
|
225
228
|
const url = new URL(href, fakeHost);
|
|
226
|
-
url.pathname = url.pathname.replace(/(^|\/)index(\.html)?$/, '$1')
|
|
229
|
+
//@seedunk index| url.pathname = url.pathname.replace(/(^|\/)index(\.html)?$/, '$1')
|
|
230
|
+
url.pathname = url.pathname.replace(/(^|\/)README(\.html)?$/, '$1');
|
|
227
231
|
// ensure correct deep link so page refresh lands on correct files.
|
|
228
232
|
if (siteDataRef.value.cleanUrls)
|
|
229
233
|
url.pathname = url.pathname.replace(/\.html$/, '');
|
package/dist/client/app/utils.js
CHANGED
|
@@ -22,7 +22,8 @@ export function withBase(path) {
|
|
|
22
22
|
export function pathToFile(path) {
|
|
23
23
|
let pagePath = path.replace(/\.html$/, '');
|
|
24
24
|
pagePath = decodeURIComponent(pagePath);
|
|
25
|
-
pagePath = pagePath.replace(/\/$/, '/index')
|
|
25
|
+
//@seedunk index|pagePath = pagePath.replace(/\/$/, '/index') // /foo/ -> /foo/index
|
|
26
|
+
pagePath = pagePath.replace(/\/$/, '/README');
|
|
26
27
|
if (import.meta.env.DEV) {
|
|
27
28
|
// always force re-fetch content in dev
|
|
28
29
|
pagePath += `.md?t=${Date.now()}`;
|
|
@@ -34,14 +35,14 @@ export function pathToFile(path) {
|
|
|
34
35
|
if (inBrowser) {
|
|
35
36
|
const base = import.meta.env.BASE_URL;
|
|
36
37
|
pagePath =
|
|
37
|
-
sanitizeFileName(pagePath.slice(base.length).replace(/\//g, '_') || '
|
|
38
|
+
sanitizeFileName(pagePath.slice(base.length).replace(/\//g, '_') || 'README' //seedunk index| || 'index'
|
|
39
|
+
) + '.md';
|
|
38
40
|
// client production build needs to account for page hash, which is
|
|
39
41
|
// injected directly in the page's html
|
|
40
42
|
let pageHash = __VP_HASH_MAP__[pagePath.toLowerCase()];
|
|
41
43
|
if (!pageHash) {
|
|
42
|
-
pagePath = pagePath.endsWith('_index.md')
|
|
43
|
-
|
|
44
|
-
: pagePath.slice(0, -3) + '_index.md';
|
|
44
|
+
//@seedunk index| pagePath = pagePath.endsWith('_index.md') ? pagePath.slice(0, -9) + '.md' : pagePath.slice(0, -3) + '_index.md'
|
|
45
|
+
pagePath = pagePath.endsWith('_README.md') ? pagePath.slice(0, -9) + '.md' : pagePath.slice(0, -3) + '_README.md';
|
|
45
46
|
pageHash = __VP_HASH_MAP__[pagePath.toLowerCase()];
|
|
46
47
|
}
|
|
47
48
|
if (!pageHash)
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1292,6 +1292,7 @@ interface SiteData<ThemeConfig = any> {
|
|
|
1292
1292
|
| 'force-dark'
|
|
1293
1293
|
| (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' })
|
|
1294
1294
|
themeConfig: ThemeConfig
|
|
1295
|
+
themeName:string
|
|
1295
1296
|
scrollOffset:
|
|
1296
1297
|
| number
|
|
1297
1298
|
| string
|
|
@@ -1317,6 +1318,7 @@ interface LocaleSpecificConfig<ThemeConfig = any> {
|
|
|
1317
1318
|
description?: string
|
|
1318
1319
|
head?: HeadConfig[]
|
|
1319
1320
|
themeConfig?: ThemeConfig
|
|
1321
|
+
themeName?:string
|
|
1320
1322
|
}
|
|
1321
1323
|
|
|
1322
1324
|
type LocaleConfig<ThemeConfig = any> = Record<
|
|
@@ -1382,6 +1384,8 @@ interface VitePressData<T = any> {
|
|
|
1382
1384
|
title: Ref$1<string>;
|
|
1383
1385
|
description: Ref$1<string>;
|
|
1384
1386
|
lang: Ref$1<string>;
|
|
1387
|
+
themeName: Ref$1<string>;
|
|
1388
|
+
base: Ref$1<string>;
|
|
1385
1389
|
dir: Ref$1<string>;
|
|
1386
1390
|
localeIndex: Ref$1<string>;
|
|
1387
1391
|
isDark: Ref$1<boolean>;
|
package/dist/client/shared.js
CHANGED
|
@@ -2,7 +2,8 @@ export const EXTERNAL_URL_RE = /^(?:[a-z]+:|\/\/)/i;
|
|
|
2
2
|
export const APPEARANCE_KEY = 'themekit-js-theme-appearance';
|
|
3
3
|
const HASH_RE = /#.*$/;
|
|
4
4
|
const HASH_OR_QUERY_RE = /[?#].*$/;
|
|
5
|
-
const INDEX_OR_EXT_RE = /(?:(^|\/)index)?\.(?:md|html)
|
|
5
|
+
//@seedunk index|const INDEX_OR_EXT_RE = /(?:(^|\/)index)?\.(?:md|html)$/
|
|
6
|
+
const INDEX_OR_EXT_RE = /(?:(^|\/)README)?\.(?:md|html)$/;
|
|
6
7
|
export const inBrowser = typeof document !== 'undefined';
|
|
7
8
|
export const notFoundPageData = {
|
|
8
9
|
relativePath: '',
|
|
@@ -36,6 +36,8 @@ const { hasSidebar } = useSidebar()
|
|
|
36
36
|
<template #home-hero-after><slot name="home-hero-after" /></template>
|
|
37
37
|
<template #home-features-before><slot name="home-features-before" /></template>
|
|
38
38
|
<template #home-features-after><slot name="home-features-after" /></template>
|
|
39
|
+
|
|
40
|
+
|
|
39
41
|
</VPHome>
|
|
40
42
|
|
|
41
43
|
<component
|
|
@@ -58,6 +60,7 @@ const { hasSidebar } = useSidebar()
|
|
|
58
60
|
<template #aside-ads-after><slot name="aside-ads-after" /></template>
|
|
59
61
|
<template #aside-bottom><slot name="aside-bottom" /></template>
|
|
60
62
|
</VPDoc>
|
|
63
|
+
|
|
61
64
|
</div>
|
|
62
65
|
</template>
|
|
63
66
|
|
|
@@ -36,7 +36,7 @@ const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
|
|
|
36
36
|
<p v-if="tagline" v-html="tagline" class="tagline"></p>
|
|
37
37
|
</slot>
|
|
38
38
|
<slot name="home-hero-info-after" />
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
<div v-if="actions" class="actions">
|
|
41
41
|
<div v-for="action in actions" :key="action.link" class="action">
|
|
42
42
|
<VPButton
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import VPFlyout from './VPFlyout.vue'
|
|
3
|
-
import VPMenuLink from './VPMenuLink.vue'
|
|
3
|
+
// seedunk import VPMenuLink from './VPMenuLink.vue'
|
|
4
4
|
import { useData } from '../composables/data'
|
|
5
5
|
import { useLangs } from '../composables/langs'
|
|
6
6
|
|
|
7
|
-
const { theme
|
|
7
|
+
const { theme,frontmatter} = useData()
|
|
8
8
|
const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
|
|
9
|
+
|
|
10
|
+
|
|
9
11
|
</script>
|
|
10
12
|
|
|
11
13
|
<template>
|
|
@@ -16,11 +18,23 @@ const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
|
|
|
16
18
|
:label="theme.langMenuLabel || 'Change language'"
|
|
17
19
|
>
|
|
18
20
|
<div class="items">
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
21
|
+
<p v-if="frontmatter.lang=='zh_CN'" class="title">简体中文</p>
|
|
22
|
+
<p v-if="frontmatter.lang=='en_US'" class="title">English</p>
|
|
23
|
+
<p v-if="frontmatter.lang=='ja_JP'" class="title">日本語</p>
|
|
24
|
+
<div v-if="frontmatter.en_US!=null" class="VPMenuLink">
|
|
25
|
+
<a class="VPLink link" :href="frontmatter.en_US" >English</a>
|
|
26
|
+
</div>
|
|
27
|
+
<div v-if="frontmatter.zh_CN!=null" class="VPMenuLink">
|
|
28
|
+
<a class="VPLink link" :href="frontmatter.zh_CN" >简体中文</a>
|
|
29
|
+
</div>
|
|
30
|
+
<div v-if="frontmatter.ja_JP!=null" class="VPMenuLink">
|
|
31
|
+
<a class="VPLink link" :href="frontmatter.ja_JP" >日本語</a>
|
|
32
|
+
</div>
|
|
33
|
+
<!--@seedunk
|
|
34
|
+
<p class="title">{{ currentLang.label }}</p>
|
|
35
|
+
<template v-for="locale in localeLinks" :key="locale.link">
|
|
36
|
+
<VPMenuLink :item="locale" />
|
|
37
|
+
</template>-->
|
|
24
38
|
</div>
|
|
25
39
|
</VPFlyout>
|
|
26
40
|
</template>
|
|
@@ -44,4 +58,31 @@ const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
|
|
|
44
58
|
font-weight: 700;
|
|
45
59
|
color: var(--vp-c-text-1);
|
|
46
60
|
}
|
|
61
|
+
|
|
62
|
+
.VPMenuGroup + .VPMenuLink {
|
|
63
|
+
margin: 12px -12px 0;
|
|
64
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
65
|
+
padding: 12px 12px 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.link {
|
|
69
|
+
display: block;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
padding: 0 12px;
|
|
72
|
+
line-height: 32px;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
color: var(--vp-c-text-1);
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
transition: background-color 0.25s, color 0.25s;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.link:hover {
|
|
81
|
+
color: var(--vp-c-brand-1);
|
|
82
|
+
background-color: var(--vp-c-default-soft);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.link.active {
|
|
86
|
+
color: var(--vp-c-brand-1);
|
|
87
|
+
}
|
|
47
88
|
</style>
|
package/dist/node/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-
|
|
1
|
+
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-kCMItmVT.js';
|
|
2
2
|
import { createLogger } from 'vite';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'shiki';
|
package/dist/node/index.d.ts
CHANGED
|
@@ -3320,6 +3320,7 @@ interface SiteData<ThemeConfig = any> {
|
|
|
3320
3320
|
| 'force-dark'
|
|
3321
3321
|
| (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' })
|
|
3322
3322
|
themeConfig: ThemeConfig
|
|
3323
|
+
themeName:string
|
|
3323
3324
|
scrollOffset:
|
|
3324
3325
|
| number
|
|
3325
3326
|
| string
|
|
@@ -3349,6 +3350,7 @@ interface LocaleSpecificConfig<ThemeConfig = any> {
|
|
|
3349
3350
|
description?: string
|
|
3350
3351
|
head?: HeadConfig[]
|
|
3351
3352
|
themeConfig?: ThemeConfig
|
|
3353
|
+
themeName?:string
|
|
3352
3354
|
}
|
|
3353
3355
|
|
|
3354
3356
|
type LocaleConfig<ThemeConfig = any> = Record<
|
|
@@ -4436,7 +4438,7 @@ declare enum ScaffoldThemeType {
|
|
|
4436
4438
|
Default = "default theme",
|
|
4437
4439
|
DefaultCustom = "default theme + customization",
|
|
4438
4440
|
Custom = "custom theme",
|
|
4439
|
-
ChangZhou = "
|
|
4441
|
+
ChangZhou = "changzhou"
|
|
4440
4442
|
}
|
|
4441
4443
|
interface ScaffoldOptions {
|
|
4442
4444
|
root: string;
|
package/dist/node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizePath } from 'vite';
|
|
2
2
|
export { loadEnv } from 'vite';
|
|
3
|
-
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-
|
|
4
|
-
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-
|
|
3
|
+
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-kCMItmVT.js';
|
|
4
|
+
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-kCMItmVT.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import 'crypto';
|
|
7
7
|
import 'module';
|
|
@@ -78,13 +78,13 @@ function createContentLoader(pattern, {
|
|
|
78
78
|
if (cached && timestamp === cached.timestamp) {
|
|
79
79
|
raw.push(cached.data);
|
|
80
80
|
} else {
|
|
81
|
-
|
|
81
|
+
let src = fs.readFileSync(file, "utf-8");
|
|
82
82
|
const { data: frontmatter, excerpt } = matter(
|
|
83
83
|
src,
|
|
84
84
|
// @ts-expect-error gray-matter types are wrong
|
|
85
85
|
typeof renderExcerpt === "string" ? { excerpt_separator: renderExcerpt } : { excerpt: renderExcerpt }
|
|
86
86
|
);
|
|
87
|
-
const url = "/" + normalizePath(path.relative(config.srcDir, file)).replace(/(^|\/)
|
|
87
|
+
const url = "/" + normalizePath(path.relative(config.srcDir, file)).replace(/(^|\/)README\.md$/, "$1").replace(/\.md$/, config.cleanUrls ? "" : ".html");
|
|
88
88
|
const html = render ? md.render(src) : void 0;
|
|
89
89
|
const renderedExcerpt = renderExcerpt ? excerpt && md.render(excerpt) : void 0;
|
|
90
90
|
const data = {
|