themekit-js 1.47.2919 → 1.47.3019

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.
@@ -1,10 +1,8 @@
1
1
  <script setup lang="ts">
2
- import Image from './Image.vue'
3
- import Button from './Button.vue'
4
2
 
5
- import { useData } from '../../composables/data'
3
+ import { withBase } from 'themekit-js'
4
+ import Button from './Button.vue'
6
5
 
7
- const { base } = useData()
8
6
  const _blank:string="_blank"
9
7
 
10
8
  defineProps<{
@@ -13,17 +11,17 @@ defineProps<{
13
11
 
14
12
 
15
13
 
14
+ /**
15
+
16
+ function CoverStyles(children:any){
17
+ return itemStyles(children,"cover" );
18
+ }*/
19
+
16
20
 
17
- function hasMasker(children:any){
18
- return hasParam(children,"masker" );
19
- }
20
- function hasCover(children:any){
21
- return hasParam(children,"cover" );
22
- }
23
- function hasParam(children:any,name:string ){
21
+
22
+ function ItemStyles(child:any){//,name:string ){
24
23
  const styles:any=[]
25
- for(let i=0;i< children.length;i++){
26
- const child=children[i]
24
+
27
25
  if(child["src"]!=null ){
28
26
  const src=child["src"]
29
27
  const pattern = /[?&]([^=#]+)=([^&#]*)/g;
@@ -32,63 +30,86 @@ function hasParam(children:any,name:string ){
32
30
  while ((match = pattern.exec(src)) !== null) {
33
31
  params[match[1]]=match[2]
34
32
  }
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": decodeURIComponent(params["color"])})
44
- }
33
+ // if(params["class"]==name){
34
+
45
35
  if(params["background"]){
46
36
  styles.push({"background":decodeURIComponent(params["background"])})
47
-
48
37
  }
49
38
  if(params["height"]){
50
39
  styles.push({"height":params["height"]})
51
40
  }
52
- }
41
+ // }
53
42
  }
54
- }
43
+
55
44
  return styles
56
45
  }
46
+
47
+ /**
48
+ function hasImageParam(child:any,name:string ){
49
+
50
+ if(child["src"]!=null ){
51
+ const src=child["src"]
52
+ const pattern = /[?&]([^=#]+)=([^&#]*)/g;
53
+ const params:any={}
54
+ let match;
55
+ while ((match = pattern.exec(src)) !== null) {
56
+ params[match[1]]=match[2]
57
+ }
58
+ if(params["class"]!=null&& params["class"]==name){
59
+ return true;
60
+ }
61
+ }
62
+ return false;
63
+ }*/
57
64
  </script>
58
65
 
59
66
  <template>
60
67
  <div class="VPFeature" >
61
68
  <article class="box">
62
- <template v-for="(item) in block.children" >
63
- <div class="box-cover" :style="hasCover(item.children)" ></div>
64
- <i class="box-cover-fixed" :style="hasCover(item.children)" ></i>
65
- <div class="box-cover" :style="hasMasker(item.children)" >
66
- <i class="box-marker" ></i>
67
- </div>
68
- <h1 class="title" v-if="item.block_type=='h1'">
69
- <span v-for="(h1) in item.children" class="clip">{{h1.content}}</span>
70
- </h1>
71
- <h2 class="title" v-if="item.block_type=='h2'">
72
- <span v-for="(h2) in item.children" class="clip">{{h2.content}}</span>
73
- </h2>
74
- <h3 class="title" v-if="item.block_type=='h3'">
75
- <span v-for="(h3) in item.children" class="clip">{{h3.content}}</span>
76
- </h3>
77
- <p v-if="item.block_type=='p'" class="details" >
78
- <template v-for="(subitem) in item.children">
79
- <template v-if="subitem.block_type=='text'">{{subitem.content}} </template>
80
- <Image v-if="subitem.block_type=='img'"
81
- :block="subitem" />
82
- <Button v-if="subitem.block_type=='a'"
83
- tag="a"
84
- size="medium"
85
- :block="subitem"
86
- :href="subitem.href"
87
- :target="_blank" ></Button>
88
- </template>
89
- </p>
90
-
91
- </template>
69
+ <template v-for="(item) in block.children" >
70
+ <template v-for="(subitem) in item.children">
71
+ <div v-if="subitem.block_type=='img'&&subitem.alt=='masker'" class="block-feature-masker" >
72
+ <img alt="Image" :src="withBase(subitem.src)" />
73
+ <i class="box-marker"></i>
74
+ </div>
75
+ <div v-if="subitem.block_type=='img'&&subitem.alt=='background'" :style="ItemStyles(subitem)" class="block-feature-masker" ></div>
76
+ </template>
77
+ </template>
78
+ <div class="box-inner">
79
+ <template v-for="(item) in block.children" >
80
+ <template v-for="(subitem) in item.children">
81
+ <div v-if="subitem.block_type=='img'&&subitem.alt=='icon'" class="block-feature-icon" >
82
+ <img alt="Image" :src="withBase(subitem.src)" />
83
+ </div>
84
+ </template>
85
+ </template>
86
+ <div class="box-main" >
87
+ <template class="box-main" v-for="(item) in block.children" >
88
+ <h1 class="title" v-if="item.block_type=='h1'">
89
+ <span v-for="(h1) in item.children" class="clip">{{h1.content}}</span>
90
+ </h1>
91
+ <h2 class="title" v-if="item.block_type=='h2'">
92
+ <span v-for="(h2) in item.children" class="clip">{{h2.content}}</span>
93
+ </h2>
94
+ <h3 class="title" v-if="item.block_type=='h3'">
95
+ <span v-for="(h3) in item.children" class="clip">{{h3.content}}</span>
96
+ </h3>
97
+ <p v-if="item.block_type=='p'" class="details" >
98
+ <template v-for="(subitem) in item.children">
99
+ <template v-if="subitem.block_type=='text'">{{subitem.content}} </template>
100
+ <img v-if="subitem.block_type=='img'&&subitem.alt!='icon'&&subitem.alt!='masker'"
101
+ :src="subitem.src" />
102
+ <Button v-if="subitem.block_type=='a'"
103
+ tag="a"
104
+ size="medium"
105
+ :block="subitem"
106
+ :href="subitem.href"
107
+ :target="_blank" ></Button>
108
+ </template>
109
+ </p>
110
+ </template>
111
+ </div>
112
+ </div>
92
113
  </article>
93
114
  </div>
94
115
  </template>
@@ -112,31 +133,31 @@ function hasParam(children:any,name:string ){
112
133
  right: 0;
113
134
  bottom: 0;
114
135
  z-index: 0;
115
- opacity: 0.75;
116
- background-color: #fff;
136
+ opacity: 0.8;
137
+ background-color: #eee;
117
138
  }
118
139
 
119
140
  .dark .VPFeature .box-marker {
120
141
  background-color: #222;
121
142
  }
122
-
123
- .VPFeature .box-cover {
124
- display: none;
143
+ .block-feature-icon{
144
+ margin-right:16px;
145
+ }
146
+ .block-feature-masker {
147
+ z-index: 0;
125
148
  position: absolute;
126
149
  top: 0;
127
150
  left: 0;
128
151
  right: 0;
129
152
  bottom: 0;
130
- z-index: 0;
131
- border-radius: 12px;
132
- background-size: cover;
133
- background-position: center;
134
- }
135
- .VPFeature .box-cover-fixed{
136
- display: none !important;
137
- opacity: 0;
138
- margin:-24px;
153
+ z-index: 0;
154
+ overflow:hidden;
155
+
139
156
  }
157
+ .block-feature-masker img{ width: 100%;}
158
+
159
+
160
+
140
161
  .VPFeature.link:hover {
141
162
  border-color: var(--vp-c-brand-1);
142
163
  }
@@ -144,10 +165,12 @@ function hasParam(children:any,name:string ){
144
165
  .box {
145
166
  display: flex;
146
167
  flex-direction: column;
147
- padding: 24px;
168
+
148
169
  height: 100%;
170
+ position: relative;
149
171
  }
150
-
172
+ .box-inner{ padding: 24px; z-index: 1; display: flex; }
173
+ .box-main{ flex-grow: 1;}
151
174
  .box > :deep(.VPImage) {
152
175
  margin-bottom: 20px;
153
176
  }
@@ -171,8 +194,13 @@ h1.title{
171
194
  font-weight: 500;
172
195
  color: var(--vp-c-text-2);
173
196
  z-index: 1;
197
+ display: flex;
198
+ justify-content: flex-start;
199
+ gap: 6px;
200
+ margin-bottom: 6px;
174
201
  }
175
-
202
+
203
+
176
204
 
177
205
 
178
206
 
@@ -0,0 +1,214 @@
1
+ <script setup lang="ts">
2
+ import Image from './Image.vue'
3
+ import Button from './Button.vue'
4
+
5
+ import { useData } from '../../composables/data'
6
+
7
+ const { base } = useData()
8
+ const _blank:string="_blank"
9
+
10
+ defineProps<{
11
+ block?: any
12
+ }>()
13
+
14
+
15
+
16
+
17
+ function MaskerStyles(children:any){
18
+ return itemStyles(children,"masker" );
19
+ }
20
+ function CoverStyles(children:any){
21
+ return itemStyles(children,"cover" );
22
+ }
23
+ function itemStyles(children:any,name:string ){
24
+ const styles:any=[]
25
+ for(let i=0;i< children.length;i++){
26
+ const child=children[i]
27
+ if(child["src"]!=null ){
28
+ const src=child["src"]
29
+ const pattern = /[?&]([^=#]+)=([^&#]*)/g;
30
+ const params:any={}
31
+ let match;
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": decodeURIComponent(params["color"])})
44
+ }
45
+ if(params["background"]){
46
+ styles.push({"background":decodeURIComponent(params["background"])})
47
+ }
48
+ if(params["height"]){
49
+ styles.push({"height":params["height"]})
50
+ }
51
+ }
52
+ }
53
+ }
54
+ return styles
55
+ }
56
+
57
+
58
+ function hasImageParam(children:any,name:string ){
59
+
60
+ for(let i=0;i< children.length;i++){
61
+ const child=children[i]
62
+ if(child["src"]!=null ){
63
+ const src=child["src"]
64
+ const pattern = /[?&]([^=#]+)=([^&#]*)/g;
65
+ const params:any={}
66
+ let match;
67
+ while ((match = pattern.exec(src)) !== null) {
68
+ params[match[1]]=match[2]
69
+ }
70
+ if(params["class"]==name){
71
+ return true;
72
+ }
73
+ }
74
+ }
75
+ return false;
76
+ }
77
+ </script>
78
+
79
+ <template>
80
+ <div class="VPFeature" >
81
+ <article class="box">
82
+ <template v-for="(item,index) in block.children" >
83
+ <div class="box-cover" :style="CoverStyles( item.children)" ></div>
84
+ <i class="box-cover-fixed" :style="CoverStyles( item.children)" ></i>
85
+ <div class="box-cover" :style="MaskerStyles( item.children)" >
86
+ <i class="box-marker" ></i>
87
+ </div>
88
+ <h1 class="title" v-if="item.block_type=='h1'">
89
+ <span v-for="(h1) in item.children" class="clip">{{h1.content}}</span>
90
+ </h1>
91
+ <h2 class="title" v-if="item.block_type=='h2'">
92
+ <span v-for="(h2) in item.children" class="clip">{{h2.content}}</span>
93
+ </h2>
94
+ <h3 class="title" v-if="item.block_type=='h3'">
95
+ <span v-for="(h3) in item.children" class="clip">{{h3.content}}</span>
96
+ </h3>
97
+ <p v-if="item.block_type=='p'" class="details" >
98
+ <template v-for="(subitem) in item.children">
99
+ <template v-if="subitem.block_type=='text'">{{subitem.content}} </template>
100
+ <Image v-if="subitem.block_type=='img'"
101
+ :block="subitem" />
102
+ <Button v-if="subitem.block_type=='a'"
103
+ tag="a"
104
+ size="medium"
105
+ :block="subitem"
106
+ :href="subitem.href"
107
+ :target="_blank" ></Button>
108
+ </template>
109
+ </p>
110
+
111
+ </template>
112
+ </article>
113
+ </div>
114
+ </template>
115
+
116
+ <style scoped>
117
+ .VPFeature {
118
+ display: block;
119
+ border-radius: 12px;
120
+ height: 100%;
121
+ background-color: var(--vp-c-bg-soft);
122
+ transition: border-color 0.25s, background-color 0.25s;
123
+ position: relative;
124
+ overflow: hidden;
125
+ }
126
+
127
+ .VPFeature .box-marker {
128
+ display: block;
129
+ position: absolute;
130
+ top: 0;
131
+ left: 0;
132
+ right: 0;
133
+ bottom: 0;
134
+ z-index: 0;
135
+ opacity: 0.75;
136
+ background-color: #fff;
137
+ }
138
+
139
+ .dark .VPFeature .box-marker {
140
+ background-color: #222;
141
+ }
142
+
143
+ .VPFeature .box-cover {
144
+ display: none;
145
+ position: absolute;
146
+ top: 0;
147
+ left: 0;
148
+ right: 0;
149
+ bottom: 0;
150
+ z-index: 0;
151
+ border-radius: 12px;
152
+ background-size: cover;
153
+ background-position: center;
154
+ }
155
+ .VPFeature .box-cover-fixed{
156
+ display: none !important;
157
+ opacity: 0;
158
+ margin:-24px;
159
+ }
160
+ .VPFeature.link:hover {
161
+ border-color: var(--vp-c-brand-1);
162
+ }
163
+
164
+ .box {
165
+ display: flex;
166
+ flex-direction: column;
167
+ padding: 24px;
168
+ height: 100%;
169
+ }
170
+
171
+ .box > :deep(.VPImage) {
172
+ margin-bottom: 20px;
173
+ }
174
+
175
+
176
+
177
+ .title {
178
+ line-height: 24px;
179
+ font-size: 16px;
180
+ font-weight: 600;
181
+ z-index: 2;
182
+ }
183
+ h1.title{
184
+ font-size: 32px;
185
+ padding:16px 0;
186
+ }
187
+ .details {
188
+ flex-grow: 1;
189
+ line-height: 24px;
190
+ font-size: 14px;
191
+ font-weight: 500;
192
+ color: var(--vp-c-text-2);
193
+ z-index: 1;
194
+ }
195
+
196
+
197
+
198
+
199
+ .link-text {
200
+ padding-top: 8px;
201
+ }
202
+
203
+ .link-text-value {
204
+ display: flex;
205
+ align-items: center;
206
+ font-size: 14px;
207
+ font-weight: 500;
208
+ color: var(--vp-c-brand-1);
209
+ }
210
+
211
+ .link-text-icon {
212
+ margin-left: 6px;
213
+ }
214
+ </style>
@@ -62,8 +62,8 @@ const styles= computed(() => {
62
62
  <div :style="styles">
63
63
  <template v-for="(ul,index) in block.children" >
64
64
 
65
- <div v-if="ul.block_type=='h1'||ul.block_type=='h2'||ul.block_type=='h3'" class="block-features-title container vp-doc" >
66
- <Heading :block="ul"></Heading>
65
+ <div v-if="ul.block_type=='h1'||ul.block_type=='h2'||ul.block_type=='h3'" class="block-features-title vp-doc" >
66
+ <div class="container"> <Heading :block="ul"></Heading> </div>
67
67
  </div>
68
68
  <div class="container" v-if="ul.block_type=='p'"> <P :block="ul"></P></div>
69
69
  <div v-if="ul.block_type=='ul'" class="VPFeatures" >
@@ -84,24 +84,24 @@ const styles= computed(() => {
84
84
 
85
85
  <style scoped>
86
86
  .VPFeatures {
87
- position: relative;
88
- padding: 0 24px;
87
+ position: relative;
88
+ padding: 0 24px;
89
89
  }
90
90
 
91
- .block-features-title{ padding:12px 0 8px; }
91
+ .block-features-title{ padding:12px 24px 8px; }
92
92
 
93
93
  @media (min-width: 640px) {
94
94
  .VPFeatures {
95
95
  padding: 0 48px;
96
96
  }
97
- .block-features-title{ padding: 16px 0 8px; }
97
+ .block-features-title{ padding: 16px 24px 8px; }
98
98
  }
99
99
 
100
100
  @media (min-width: 960px) {
101
101
  .VPFeatures {
102
102
  padding: 0 64px;
103
103
  }
104
- .block-features-title{ padding: 24px 0 8px; }
104
+ .block-features-title{ padding: 24px 24px 8px; }
105
105
  }
106
106
 
107
107
  .container {
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-sZj3sT-k.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-JETwzqn2.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-sZj3sT-k.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-sZj3sT-k.js';
3
+ import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-JETwzqn2.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-JETwzqn2.js';
5
5
  import path from 'path';
6
6
  import 'crypto';
7
7
  import 'module';
@@ -38286,7 +38286,8 @@ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, isBuild
38286
38286
  for (let i2 = start2; i2 < tokens.length; i2++) {
38287
38287
  const token = tokens[i2];
38288
38288
  if (token.type == "image") {
38289
- parent["children"].push({ "block_type": "img", "content": token.attrGet("content"), "src": token.attrGet("src") });
38289
+ const alt = token.children != null && token.children.length > 0 ? token.children[0]["content"] : "";
38290
+ parent["children"].push({ "block_type": "img", "content": token.attrGet("content"), "alt": alt, "src": token.attrGet("src") });
38290
38291
  continue;
38291
38292
  }
38292
38293
  if (token.tag == "code") {
@@ -46738,7 +46739,7 @@ function escapeHtml(string) {
46738
46739
 
46739
46740
  var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
46740
46741
 
46741
- var version = "1.47.2919";
46742
+ var version = "1.47.3019";
46742
46743
 
46743
46744
  async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
46744
46745
  const routePath = `/${page.replace(/\.md$/, "")}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "themekit-js",
3
- "version": "1.47.2919",
3
+ "version": "1.47.3019",
4
4
  "description": "基于VitePress开发的Markdown静态网站生成器",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@8.15.6",