valaxy 0.25.3 → 0.25.5
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/client/components/ValaxyDynamicComponent.vue +33 -0
- package/client/components/{ValaxyContainerBlockTitle.vue → builtin/ValaxyTranslate.vue} +2 -5
- package/client/main.ts +0 -12
- package/client/modules/components.ts +13 -0
- package/client/setup/main.ts +2 -0
- package/client/styles/common/code.scss +22 -22
- package/client/styles/common/markdown.scss +2 -2
- package/dist/{chunk-V3FAZBPQ.js → chunk-D6OORM36.js} +70 -8
- package/dist/node/cli/index.js +1 -1
- package/dist/node/index.js +1 -1
- package/package.json +5 -6
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Component } from 'vue'
|
|
3
|
+
import { compile, defineAsyncComponent, onMounted, shallowRef } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
templateStr: string
|
|
8
|
+
data?: Record<string, any>
|
|
9
|
+
}>(),
|
|
10
|
+
{
|
|
11
|
+
data: () => ({}),
|
|
12
|
+
},
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
const dynamicComponent = shallowRef<Component | null>(null)
|
|
16
|
+
|
|
17
|
+
async function createComponent() {
|
|
18
|
+
const render = compile(props.templateStr)
|
|
19
|
+
const componentDefinition = {
|
|
20
|
+
render,
|
|
21
|
+
data: () => props.data,
|
|
22
|
+
}
|
|
23
|
+
dynamicComponent.value = defineAsyncComponent(() => Promise.resolve(componentDefinition))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
onMounted(() => {
|
|
27
|
+
createComponent()
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<component :is="dynamicComponent" />
|
|
33
|
+
</template>
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
// import { useValaxyI18n } from 'valaxy'
|
|
3
2
|
import { useI18n } from 'vue-i18n'
|
|
4
3
|
|
|
5
4
|
defineProps<{
|
|
6
|
-
|
|
5
|
+
content: string
|
|
7
6
|
}>()
|
|
8
7
|
|
|
9
8
|
const { t } = useI18n()
|
|
10
9
|
</script>
|
|
11
10
|
|
|
12
11
|
<template>
|
|
13
|
-
|
|
14
|
-
{{ t(title) }}
|
|
15
|
-
</span>
|
|
12
|
+
{{ t(content) }}
|
|
16
13
|
</template>
|
package/client/main.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ViteSSGContext } from 'vite-ssg'
|
|
2
1
|
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders'
|
|
3
2
|
import { dataSymbol, initValaxyConfig, valaxyConfigSymbol } from 'valaxy'
|
|
4
3
|
import { setupLayouts } from 'virtual:generated-layouts'
|
|
@@ -9,10 +8,8 @@ import { routes } from 'vue-router/auto-routes'
|
|
|
9
8
|
import App from './App.vue'
|
|
10
9
|
|
|
11
10
|
import { initData } from './app/data'
|
|
12
|
-
import AppLink from './components/AppLink.vue'
|
|
13
11
|
|
|
14
12
|
import setupMain from './setup/main'
|
|
15
|
-
|
|
16
13
|
import { setupValaxyDevTools } from './utils/dev'
|
|
17
14
|
/**
|
|
18
15
|
* user styles
|
|
@@ -23,14 +20,6 @@ import 'uno.css'
|
|
|
23
20
|
|
|
24
21
|
const valaxyConfig = initValaxyConfig()
|
|
25
22
|
|
|
26
|
-
/**
|
|
27
|
-
* register global components
|
|
28
|
-
* @param ctx
|
|
29
|
-
*/
|
|
30
|
-
export function registerComponents(ctx: ViteSSGContext) {
|
|
31
|
-
ctx.app.component('AppLink', AppLink)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
23
|
const { redirectRoutes, useVueRouter } = valaxyConfig.value.runtimeConfig.redirects
|
|
35
24
|
if (useVueRouter)
|
|
36
25
|
routes.push(...redirectRoutes)
|
|
@@ -84,7 +73,6 @@ export const createApp = ViteSSG(
|
|
|
84
73
|
|
|
85
74
|
app.provide(valaxyConfigSymbol, valaxyConfig)
|
|
86
75
|
|
|
87
|
-
registerComponents(ctx)
|
|
88
76
|
setupMain(ctx, valaxyConfig)
|
|
89
77
|
},
|
|
90
78
|
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ViteSSGContext } from 'vite-ssg'
|
|
2
|
+
|
|
3
|
+
import AppLink from '../components/AppLink.vue'
|
|
4
|
+
import ValaxyTranslate from '../components/builtin/ValaxyTranslate.vue'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* register global components
|
|
8
|
+
* @param ctx
|
|
9
|
+
*/
|
|
10
|
+
export function registerGlobalComponents(ctx: ViteSSGContext) {
|
|
11
|
+
ctx.app.component('AppLink', AppLink)
|
|
12
|
+
ctx.app.component('VT', ValaxyTranslate)
|
|
13
|
+
}
|
package/client/setup/main.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { ViteSSGContext } from 'vite-ssg'
|
|
|
9
9
|
import type { ComputedRef } from 'vue'
|
|
10
10
|
|
|
11
11
|
import { consola } from 'consola'
|
|
12
|
+
import { registerGlobalComponents } from '../modules/components'
|
|
12
13
|
import { install as installFloatingVue } from '../modules/floating-vue'
|
|
13
14
|
import { install as installNprogress } from '../modules/nprogress'
|
|
14
15
|
import { install as installPinia } from '../modules/pinia'
|
|
@@ -20,6 +21,7 @@ export default function setupMain(ctx: ViteSSGContext, config: ComputedRef<Valax
|
|
|
20
21
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
21
22
|
const injection_arg = ctx
|
|
22
23
|
|
|
24
|
+
registerGlobalComponents(ctx)
|
|
23
25
|
installValaxy(ctx, config)
|
|
24
26
|
installUnhead(ctx)
|
|
25
27
|
installPinia(ctx)
|
|
@@ -23,14 +23,14 @@ html:not(.dark) .vp-code-dark {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
@media (width >=
|
|
26
|
+
@media (width >=640px) {
|
|
27
27
|
.markdown-body div[class*="language-"] {
|
|
28
28
|
border-radius: 6px;
|
|
29
29
|
margin: 16px 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
@media (width <=
|
|
33
|
+
@media (width <=639.9px) {
|
|
34
34
|
.markdown-body li div[class*="language-"] {
|
|
35
35
|
border-radius: 6px 0 0 6px;
|
|
36
36
|
}
|
|
@@ -101,7 +101,7 @@ html:not(.dark) .vp-code-dark {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// copy
|
|
104
|
-
[class*='language-']
|
|
104
|
+
[class*='language-']>button.copy {
|
|
105
105
|
/* rtl:ignore */
|
|
106
106
|
direction: ltr;
|
|
107
107
|
position: absolute;
|
|
@@ -126,28 +126,28 @@ html:not(.dark) .vp-code-dark {
|
|
|
126
126
|
background-color 0.25s,
|
|
127
127
|
opacity 0.25s;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
[class*='language-']:hover
|
|
131
|
-
[class*='language-']
|
|
129
|
+
|
|
130
|
+
[class*='language-']:hover>button.copy,
|
|
131
|
+
[class*='language-']>button.copy:focus {
|
|
132
132
|
opacity: 1;
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
[class*='language-']
|
|
136
|
-
[class*='language-']
|
|
134
|
+
|
|
135
|
+
[class*='language-']>button.copy:hover,
|
|
136
|
+
[class*='language-']>button.copy.copied {
|
|
137
137
|
border-color: var(--va-code-copy-code-hover-border-color);
|
|
138
138
|
background-color: var(--va-code-copy-code-hover-bg);
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
[class*='language-']
|
|
142
|
-
[class*='language-']
|
|
140
|
+
|
|
141
|
+
[class*='language-']>button.copy.copied,
|
|
142
|
+
[class*='language-']>button.copy:hover.copied {
|
|
143
143
|
/* rtl:ignore */
|
|
144
144
|
border-radius: 0 4px 4px 0;
|
|
145
145
|
background-color: var(--va-code-copy-code-hover-bg);
|
|
146
146
|
background-image: var(--va-icon-copied);
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
[class*='language-']
|
|
150
|
-
[class*='language-']
|
|
148
|
+
|
|
149
|
+
[class*='language-']>button.copy.copied::before,
|
|
150
|
+
[class*='language-']>button.copy:hover.copied::before {
|
|
151
151
|
position: relative;
|
|
152
152
|
top: -1px;
|
|
153
153
|
|
|
@@ -173,7 +173,7 @@ html:not(.dark) .vp-code-dark {
|
|
|
173
173
|
content: var(--va-code-copy-copied-text-content);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
[class*='language-']
|
|
176
|
+
[class*='language-']>span.lang {
|
|
177
177
|
position: absolute;
|
|
178
178
|
top: 2px;
|
|
179
179
|
|
|
@@ -187,9 +187,9 @@ html:not(.dark) .vp-code-dark {
|
|
|
187
187
|
color 0.4s,
|
|
188
188
|
opacity 0.4s;
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
[class*='language-']:hover
|
|
192
|
-
[class*='language-']
|
|
190
|
+
|
|
191
|
+
[class*='language-']:hover>button.copy+span.lang,
|
|
192
|
+
[class*='language-']>button.copy:focus+span.lang {
|
|
193
193
|
opacity: 0;
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -227,7 +227,7 @@ html:not(.dark) .vp-code-dark {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
// collapse
|
|
230
|
-
[class*='language-']
|
|
230
|
+
[class*='language-']>button.collapse {
|
|
231
231
|
display: none;
|
|
232
232
|
position: absolute;
|
|
233
233
|
z-index: 10;
|
|
@@ -237,7 +237,7 @@ html:not(.dark) .vp-code-dark {
|
|
|
237
237
|
height: 24px;
|
|
238
238
|
opacity: 1;
|
|
239
239
|
cursor: pointer;
|
|
240
|
-
background-image: linear-gradient(-180deg,rgb(0 0 0 / 0) 0%,var(--va-c-bg-dark) 100%);
|
|
240
|
+
background-image: linear-gradient(-180deg, rgb(0 0 0 / 0) 0%, var(--va-c-bg-dark) 100%);
|
|
241
241
|
|
|
242
242
|
&::before {
|
|
243
243
|
display: block;
|
|
@@ -251,7 +251,7 @@ html:not(.dark) .vp-code-dark {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
[class*='language-'].folded
|
|
254
|
+
[class*='language-'].folded>button.collapse {
|
|
255
255
|
display: block;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use "sass:map";
|
|
2
2
|
|
|
3
3
|
.markdown-body {
|
|
4
|
+
|
|
4
5
|
h1,
|
|
5
6
|
h2,
|
|
6
7
|
h3,
|
|
@@ -94,11 +95,10 @@
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
|
|
97
|
-
@media (width >=
|
|
98
|
+
@media (width >=768px) {
|
|
98
99
|
.markdown-body h1 {
|
|
99
100
|
letter-spacing: -0.02em;
|
|
100
101
|
line-height: 40px;
|
|
101
102
|
font-size: 32px;
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
|
|
@@ -4,7 +4,7 @@ import yargs from "yargs";
|
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.25.
|
|
7
|
+
var version = "0.25.5";
|
|
8
8
|
|
|
9
9
|
// node/modules/fuse.ts
|
|
10
10
|
import path4 from "path";
|
|
@@ -2075,7 +2075,7 @@ function createContainer(key, block = {}, md3) {
|
|
|
2075
2075
|
let iconTag = "";
|
|
2076
2076
|
if (block.icon)
|
|
2077
2077
|
iconTag = `<i class="icon ${block.icon}" ${block.color ? `style="color: ${block.color}"` : ""}></i>`;
|
|
2078
|
-
const title = `<
|
|
2078
|
+
const title = `<VT content="blocks.${key}" />`;
|
|
2079
2079
|
const titleClass = `custom-block-title${info ? "" : " custom-block-title-default"}`;
|
|
2080
2080
|
if (classes === "details")
|
|
2081
2081
|
return `<details ${attrs}><summary>${title}</summary>
|
|
@@ -2531,6 +2531,22 @@ function snippetPlugin(md3, srcDir) {
|
|
|
2531
2531
|
md3.block.ruler.before("fence", "snippet", parser);
|
|
2532
2532
|
}
|
|
2533
2533
|
|
|
2534
|
+
// node/plugins/markdown/plugins/markdown-it/titleCollector.ts
|
|
2535
|
+
var globalTitleCollector = /* @__PURE__ */ new Set();
|
|
2536
|
+
function getGlobalTitleCollector() {
|
|
2537
|
+
return globalTitleCollector;
|
|
2538
|
+
}
|
|
2539
|
+
function titleCollectorPlugin(md3) {
|
|
2540
|
+
const fence = md3.renderer.rules.fence;
|
|
2541
|
+
md3.renderer.rules.fence = (...args) => {
|
|
2542
|
+
const [tokens, idx] = args;
|
|
2543
|
+
const token = tokens[idx];
|
|
2544
|
+
const title = extractTitle(token.info);
|
|
2545
|
+
globalTitleCollector.add(title);
|
|
2546
|
+
return fence(...args);
|
|
2547
|
+
};
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2534
2550
|
// node/plugins/markdown/setup.ts
|
|
2535
2551
|
var defaultCodeTheme = { light: "github-light", dark: "github-dark" };
|
|
2536
2552
|
async function setupMarkdownPlugins(md3, options, base = "/") {
|
|
@@ -2539,7 +2555,7 @@ async function setupMarkdownPlugins(md3, options, base = "/") {
|
|
|
2539
2555
|
const siteConfig = options?.config.siteConfig || {};
|
|
2540
2556
|
if (mdOptions.preConfig)
|
|
2541
2557
|
mdOptions.preConfig(md3);
|
|
2542
|
-
md3.use(highlightLinePlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(containerPlugin, {
|
|
2558
|
+
md3.use(highlightLinePlugin).use(preWrapperPlugin, { theme, siteConfig }).use(snippetPlugin, options?.userRoot).use(titleCollectorPlugin).use(containerPlugin, {
|
|
2543
2559
|
languages: siteConfig.languages,
|
|
2544
2560
|
...mdOptions?.container,
|
|
2545
2561
|
blocks: {
|
|
@@ -4058,8 +4074,10 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
|
|
|
4058
4074
|
typedoc: "vscode-icons:file-type-typedoc",
|
|
4059
4075
|
eslint: "vscode-icons:file-type-eslint"
|
|
4060
4076
|
};
|
|
4061
|
-
|
|
4062
|
-
|
|
4077
|
+
let cachedGroupIconsCSS = null;
|
|
4078
|
+
const generateGroupIconsCSS = (id) => {
|
|
4079
|
+
const codeBlockTitles = getGlobalTitleCollector();
|
|
4080
|
+
const originalPlugin = groupIconVitePlugin({
|
|
4063
4081
|
customIcon: {
|
|
4064
4082
|
...builtinCustomIcon,
|
|
4065
4083
|
...valaxyConfig.groupIcons?.customIcon
|
|
@@ -4067,10 +4085,54 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
|
|
|
4067
4085
|
defaultLabels: [
|
|
4068
4086
|
...valaxyConfig.groupIcons?.defaultLabels || [],
|
|
4069
4087
|
...Object.keys(builtinCustomIcon),
|
|
4070
|
-
...Object.keys(valaxyConfig.groupIcons?.customIcon || {})
|
|
4088
|
+
...Object.keys(valaxyConfig.groupIcons?.customIcon || {}),
|
|
4089
|
+
...Array.from(codeBlockTitles)
|
|
4071
4090
|
]
|
|
4072
|
-
})
|
|
4073
|
-
|
|
4091
|
+
});
|
|
4092
|
+
if (originalPlugin && typeof originalPlugin === "object" && "load" in originalPlugin) {
|
|
4093
|
+
return originalPlugin.load(id);
|
|
4094
|
+
}
|
|
4095
|
+
return "";
|
|
4096
|
+
};
|
|
4097
|
+
const dynamicGroupIconPlugin = {
|
|
4098
|
+
name: "post-process-add-group-icons",
|
|
4099
|
+
enforce: "post",
|
|
4100
|
+
configureServer(server) {
|
|
4101
|
+
const markdownGlobs = roots.map((root) => `${root}/**/*.md`);
|
|
4102
|
+
server.watcher.add(markdownGlobs);
|
|
4103
|
+
server.watcher.on("change", (file) => {
|
|
4104
|
+
if (file.endsWith(".md")) {
|
|
4105
|
+
cachedGroupIconsCSS = null;
|
|
4106
|
+
const module = server.moduleGraph.getModuleById("\0virtual:group-icons.css");
|
|
4107
|
+
if (module) {
|
|
4108
|
+
server.reloadModule(module);
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
});
|
|
4112
|
+
},
|
|
4113
|
+
resolveId(id) {
|
|
4114
|
+
if (id === "virtual:group-icons.css") {
|
|
4115
|
+
return "\0virtual:group-icons.css";
|
|
4116
|
+
}
|
|
4117
|
+
return void 0;
|
|
4118
|
+
},
|
|
4119
|
+
async load(id) {
|
|
4120
|
+
if (id === "\0virtual:group-icons.css") {
|
|
4121
|
+
if (cachedGroupIconsCSS !== null) {
|
|
4122
|
+
return cachedGroupIconsCSS;
|
|
4123
|
+
}
|
|
4124
|
+
return generateGroupIconsCSS(id);
|
|
4125
|
+
}
|
|
4126
|
+
return void 0;
|
|
4127
|
+
},
|
|
4128
|
+
// In build mode, regenerate the CSS after all markdown files have been processed
|
|
4129
|
+
generateBundle() {
|
|
4130
|
+
if (this.meta.rollupVersion) {
|
|
4131
|
+
cachedGroupIconsCSS = generateGroupIconsCSS("\0virtual:group-icons.css");
|
|
4132
|
+
}
|
|
4133
|
+
}
|
|
4134
|
+
};
|
|
4135
|
+
plugins.push(dynamicGroupIconPlugin);
|
|
4074
4136
|
return plugins;
|
|
4075
4137
|
}
|
|
4076
4138
|
|
package/dist/node/cli/index.js
CHANGED
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.5",
|
|
5
5
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "me@yunyoujun.cn",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@clack/prompts": "^0.11.0",
|
|
59
59
|
"@iconify-json/ri": "^1.2.5",
|
|
60
60
|
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
61
|
-
"@shikijs/transformers": "^3.
|
|
61
|
+
"@shikijs/transformers": "^3.8.0",
|
|
62
62
|
"@types/katex": "^0.16.7",
|
|
63
63
|
"@unhead/addons": "^2.0.12",
|
|
64
64
|
"@unhead/schema-org": "^2.0.12",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"@vueuse/core": "^13.5.0",
|
|
69
69
|
"@vueuse/integrations": "^13.5.0",
|
|
70
70
|
"beasties": "^0.3.5",
|
|
71
|
-
"birpc": "^2.4.0",
|
|
72
71
|
"consola": "^3.4.2",
|
|
73
72
|
"cross-spawn": "^7.0.6",
|
|
74
73
|
"css-i18n": "^0.0.5",
|
|
@@ -112,7 +111,7 @@
|
|
|
112
111
|
"qrcode": "^1.5.4",
|
|
113
112
|
"resolve-global": "^2.0.0",
|
|
114
113
|
"sass": "^1.89.2",
|
|
115
|
-
"shiki": "^3.
|
|
114
|
+
"shiki": "^3.8.0",
|
|
116
115
|
"star-markdown-css": "^0.5.3",
|
|
117
116
|
"table": "^6.9.0",
|
|
118
117
|
"unhead": "^2.0.12",
|
|
@@ -132,8 +131,8 @@
|
|
|
132
131
|
"vue-i18n": "^11.1.9",
|
|
133
132
|
"vue-router": "^4.5.1",
|
|
134
133
|
"yargs": "^18.0.0",
|
|
135
|
-
"@valaxyjs/devtools": "0.25.
|
|
136
|
-
"@valaxyjs/utils": "0.25.
|
|
134
|
+
"@valaxyjs/devtools": "0.25.5",
|
|
135
|
+
"@valaxyjs/utils": "0.25.5"
|
|
137
136
|
},
|
|
138
137
|
"devDependencies": {
|
|
139
138
|
"@mdit-vue/plugin-component": "^2.1.4",
|