themekit-js 1.1.31 → 1.1.35

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.
@@ -13,22 +13,42 @@ defineProps<{
13
13
 
14
14
 
15
15
 
16
+
17
+ function hasMasker(children:any){
18
+ return hasParam(children,"masker" );
19
+ }
16
20
  function hasCover(children:any){
17
-
18
- const styles:any=[]
21
+ return hasParam(children,"cover" );
22
+ }
23
+ function hasParam(children:any,name:string ){
24
+ const styles:any=[]
19
25
  for(let i=0;i< children.length;i++){
20
26
  const child=children[i]
21
27
  if(child["src"]!=null ){
22
- const pattern = /[?&]([^=#]+)=([^&#]*)/g;
28
+ const src=child["src"]
29
+ const pattern = /[?&]([^=#]+)=([^&#]*)/g;
30
+ const params:any={}
23
31
  let match;
24
- while ((match = pattern.exec(child["src"])) !== null) {
25
-
26
- if(match.length>2&&match[1]=="class"&&match[2]=="cover"){
27
- styles.push({"display":"block"})
28
- styles.push({"background-image":"url("+ base.value+ child["src"] +")"})
29
- break
30
- }
31
- }
32
+ while ((match = pattern.exec(src)) !== null) {
33
+ params[match[1]]=match[2]
34
+ }
35
+ if(params["class"]==name){
36
+ styles.push({"display":"block"})
37
+ if(src.substring(0,1)=="/"){
38
+ styles.push({"background-image":"url("+ base.value+src.substring(1,src.length) +")"})
39
+ }else{
40
+ styles.push({"background-image":"url("+ src +")"})
41
+ }
42
+ if(params["color"]){
43
+ styles.push({"color":params["color"]})
44
+ }
45
+ if(params["background"]){
46
+ styles.push({"background":params["background"]})
47
+ }
48
+ if(params["height"]){
49
+ styles.push({"height":params["height"]})
50
+ }
51
+ }
32
52
  }
33
53
  }
34
54
  return styles
@@ -38,14 +58,12 @@ function hasCover(children:any){
38
58
  <template>
39
59
  <div class="VPFeature" >
40
60
  <article class="box">
41
- <template v-for="(item) in block.children" >
42
-
43
-
44
- <i class="box-cover" :style="hasCover(item.children)" >
45
- <i class="box-marker" ></i>
46
- </i>
47
-
48
-
61
+ <template v-for="(item) in block.children" >
62
+ <div class="box-cover" :style="hasCover(item.children)" ></div>
63
+ <i class="box-cover-fixed" :style="hasCover(item.children)" ></i>
64
+ <div class="box-cover" :style="hasMasker(item.children)" >
65
+ <i class="box-marker" ></i>
66
+ </div>
49
67
  <h1 class="title" v-if="item.block_type=='h1'">
50
68
  <span v-for="(h1) in item.children" class="clip">{{h1.content}}</span>
51
69
  </h1>
@@ -113,7 +131,11 @@ function hasCover(children:any){
113
131
  background-size: cover;
114
132
  background-position: center;
115
133
  }
116
-
134
+ .VPFeature .box-cover-fixed{
135
+ display: none;
136
+ opacity: 0;
137
+ margin:-24px;
138
+ }
117
139
  .VPFeature.link:hover {
118
140
  border-color: var(--vp-c-brand-1);
119
141
  }
@@ -70,7 +70,14 @@ const styles= computed(() => {
70
70
  styles.push({ 'background-color':props.block['background-color']})
71
71
  }
72
72
  if(props.block['background-image']){
73
- styles.push({ 'background-image':'url('+base.value+props.block['background-image']+")"})
73
+
74
+ const src=props.block['background-image']
75
+ if(src.substring(0,1)=="/"){
76
+ styles.push({"background-image":"url("+ base.value+src.substring(1,src.length) +")"})
77
+ }else{
78
+ styles.push({"background-image":"url("+ src +")"})
79
+ }
80
+
74
81
  }
75
82
  if(props.block['color']){
76
83
  styles.push({ 'color': props.block['color']})
@@ -85,7 +85,8 @@ html:not(.dark) .VPImage.dark {
85
85
  .dark .VPImage.light {
86
86
  display: none;
87
87
  }
88
- .VPImage.cover{
88
+ .VPImage.cover,
89
+ .VPImage.masker{
89
90
  display: none;
90
91
  }
91
92
 
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-DIhz1XaQ.js';
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-XcggAXcG.js';
2
2
  import { createLogger } from 'vite';
3
3
  import 'path';
4
4
  import 'shiki';
@@ -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-DIhz1XaQ.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-DIhz1XaQ.js';
3
+ import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-XcggAXcG.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-XcggAXcG.js';
5
5
  import path from 'path';
6
6
  import 'crypto';
7
7
  import 'module';
@@ -46733,7 +46733,7 @@ function escapeHtml(string) {
46733
46733
 
46734
46734
  var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
46735
46735
 
46736
- var version = "1.1.31";
46736
+ var version = "1.1.35";
46737
46737
 
46738
46738
  async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
46739
46739
  const routePath = `/${page.replace(/\.md$/, "")}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "themekit-js",
3
- "version": "1.1.31",
3
+ "version": "1.1.35",
4
4
  "description": "基于VitePress开发的Markdown静态网站生成器",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@8.15.6",