themekit-js 1.1.4 → 1.1.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/README.md CHANGED
@@ -1 +1,50 @@
1
- # ThemeKit
1
+ # ThemeKit
2
+
3
+
4
+
5
+ <!--#Doc-->
6
+ ### markdown样式 222
7
+ <!--Doc #-->
8
+
9
+ <!--#GithubCode-->
10
+ [markdown-it](https://github.com/seedunk/markdown-it)&nbsp;&nbsp;&nbsp;[markdown-it2](https://github.com/seedunk/markdown-it)
11
+
12
+
13
+ ```javascript
14
+ set test="123123"
15
+ set test="123123"
16
+ function a(){}
17
+ //撒大大
18
+ ```
19
+ <!--GithubCode #-->
20
+
21
+ <!--#Hero-->
22
+ ## 个人
23
+ # Seedunk
24
+ 其他站点说明
25
+
26
+ [跳转1](#)&nbsp;&nbsp;[跳转2](?theme=alt)
27
+
28
+ ![右图](bg.jpg)![右图](bg.jpg)
29
+ ![右图](bg.jpg?hero=right)
30
+ <!--Hero #-->
31
+ <!--#Doc-->
32
+ # markdown样式
33
+ <!--Doc #-->
34
+
35
+ <!--#Features-->
36
+ - ![](bg.jpg?class=icon)![](bg.jpg?class=icon)
37
+ # A
38
+ AAAAAAAAAAAAA
39
+
40
+ [查看更多](/baidu.com)
41
+ - ## B
42
+ bbbb
43
+
44
+ * ### c
45
+ ccc
46
+ * ### d
47
+ dd
48
+ * ### d
49
+ dd
50
+ <!--Features #-->
@@ -6,3 +6,4 @@ export { useRoute, useRouter } from './app/router';
6
6
  export { inBrowser, onContentUpdated, defineClientComponent, withBase, getScrollOffset } from './app/utils';
7
7
  // components
8
8
  export { Content } from './app/components/Content';
9
+ //@seedunk
@@ -51,6 +51,11 @@ provide('hero-image-slot-exists', heroImageSlotExists)
51
51
  </VPSidebar>
52
52
 
53
53
  <VPContent>
54
+
55
+ <!--@seedun from TKBlock-->
56
+ <template #block-top><slot name="block-top" /></template>
57
+ <template #block-bottom><slot name="block-bottom" /></template>
58
+
54
59
  <template #page-top><slot name="page-top" /></template>
55
60
  <template #page-bottom><slot name="page-bottom" /></template>
56
61
 
@@ -78,7 +83,7 @@ provide('hero-image-slot-exists', heroImageSlotExists)
78
83
  <template #aside-ads-before><slot name="aside-ads-before" /></template>
79
84
  <template #aside-ads-after><slot name="aside-ads-after" /></template>
80
85
  </VPContent>
81
-
86
+
82
87
  <VPFooter />
83
88
  <slot name="layout-bottom" />
84
89
  </div>
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+
3
+ import { useData } from '../composables/data'
4
+ import Hero from './blocks/Hero.vue';
5
+ import Doc from './blocks/Doc.vue';
6
+ import Features from './blocks/Features.vue';
7
+ const { frontmatter } = useData()
8
+ </script>
9
+
10
+ <template>
11
+ <div class="TKBlock">
12
+
13
+ <div class="clearfix" v-for="(item, index) in frontmatter.blocks" :key="index">
14
+ <Hero :block="item" v-if="item.block_type =='Hero'"></Hero>
15
+ <Features :block="item" v-else-if="item.block_type =='Features'"></Features>
16
+ <Doc :block="item" v-else-if="item.block_type =='Doc'" ></Doc>
17
+ </div>
18
+ <VPHomeContent v-if="frontmatter.markdownStyles !== false">
19
+ <Content />
20
+ </VPHomeContent>
21
+ <Content v-else />
22
+ </div>
23
+ </template>
24
+ <style>
25
+ @import 'blocks/Button.css';
26
+ </style>
27
+ <style scoped>
28
+ .TKBlock {
29
+ margin-bottom: 96px;
30
+ }
31
+
32
+ @media (min-width: 768px) {
33
+ .TKBlock {
34
+ margin-bottom: 128px;
35
+ }
36
+ }
37
+ </style>
38
+
39
+
40
+
41
+
42
+
43
+
@@ -5,6 +5,7 @@ import { useSidebar } from '../composables/sidebar'
5
5
  import VPDoc from './VPDoc.vue'
6
6
  import VPHome from './VPHome.vue'
7
7
  import VPPage from './VPPage.vue'
8
+ import TKBlock from './TKBlock.vue'
8
9
 
9
10
  const { page, frontmatter } = useData()
10
11
  const { hasSidebar } = useSidebar()
@@ -20,7 +21,11 @@ const { hasSidebar } = useSidebar()
20
21
  }"
21
22
  >
22
23
  <slot name="not-found" v-if="page.isNotFound"><NotFound /></slot>
23
-
24
+ <!--@seedun add TKBlock-->
25
+ <TKBlock v-else-if="frontmatter.layout === 'block'">
26
+ <template #block-top><slot name="block-top" /></template>
27
+ <template #block-bottom><slot name="block-bottom" /></template>
28
+ </TKBlock>
24
29
  <VPPage v-else-if="frontmatter.layout === 'page'">
25
30
  <template #page-top><slot name="page-top" /></template>
26
31
  <template #page-bottom><slot name="page-bottom" /></template>
@@ -0,0 +1,87 @@
1
+ .btn {
2
+ display: inline-block;
3
+ border: 1px solid transparent;
4
+ text-align: center;
5
+ font-weight: 600;
6
+ white-space: nowrap;
7
+ transition: color 0.25s, border-color 0.25s, background-color 0.25s;
8
+ }
9
+ a.btn{
10
+ text-decoration:none !important;
11
+ border-radius: 28px;
12
+ padding: 0 12px;
13
+ line-height: 28px;
14
+ font-size: 14px;
15
+ }
16
+ a.btn .icon{ display: inline-flex; vertical-align: middle; margin-left: -6px; margin-right: 2px;margin-top: -2px; }
17
+ .btn:active {
18
+ transition: color 0.1s, border-color 0.1s, background-color 0.1s;
19
+ }
20
+
21
+ .btn.medium {
22
+ border-radius: 20px;
23
+ padding: 0 20px;
24
+ line-height: 38px;
25
+ font-size: 14px;
26
+ }
27
+
28
+ .btn.big {
29
+ border-radius: 24px;
30
+ padding: 0 24px;
31
+ line-height: 46px;
32
+ font-size: 16px;
33
+ }
34
+
35
+ .btn.brand {
36
+ border-color: var(--vp-button-brand-border);
37
+ color: var(--vp-button-brand-text);
38
+ background-color: var(--vp-button-brand-bg);
39
+ }
40
+
41
+ .btn.brand:hover {
42
+ border-color: var(--vp-button-brand-hover-border);
43
+ color: var(--vp-button-brand-hover-text);
44
+ background-color: var(--vp-button-brand-hover-bg);
45
+ }
46
+
47
+ .btn.brand:active {
48
+ border-color: var(--vp-button-brand-active-border);
49
+ color: var(--vp-button-brand-active-text);
50
+ background-color: var(--vp-button-brand-active-bg);
51
+ }
52
+
53
+ .btn.alt {
54
+ border-color: var(--vp-button-alt-border);
55
+ color: var(--vp-button-alt-text);
56
+ background-color: var(--vp-button-alt-bg);
57
+ }
58
+
59
+ .btn.alt:hover {
60
+ border-color: var(--vp-button-alt-hover-border);
61
+ color: var(--vp-button-alt-hover-text);
62
+ background-color: var(--vp-button-alt-hover-bg);
63
+ }
64
+
65
+ .btn.alt:active {
66
+ border-color: var(--vp-button-alt-active-border);
67
+ color: var(--vp-button-alt-active-text);
68
+ background-color: var(--vp-button-alt-active-bg);
69
+ }
70
+
71
+ .btn.sponsor {
72
+ border-color: var(--vp-button-sponsor-border);
73
+ color: var(--vp-button-sponsor-text);
74
+ background-color: var(--vp-button-sponsor-bg);
75
+ }
76
+
77
+ .btn.sponsor:hover {
78
+ border-color: var(--vp-button-sponsor-hover-border);
79
+ color: var(--vp-button-sponsor-hover-text);
80
+ background-color: var(--vp-button-sponsor-hover-bg);
81
+ }
82
+
83
+ .btn.sponsor:active {
84
+ border-color: var(--vp-button-sponsor-active-border);
85
+ color: var(--vp-button-sponsor-active-text);
86
+ background-color: var(--vp-button-sponsor-active-bg);
87
+ }
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+
5
+ interface Props {
6
+ block?:any
7
+ tag?: string
8
+ size?: 'medium' | 'big'
9
+ theme?: 'brand' | 'alt' | 'sponsor'
10
+ href?: string
11
+ target?: string;
12
+ rel?: string;
13
+ icon?:any;
14
+ baseClass?:string;
15
+ }
16
+
17
+ const props = withDefaults(defineProps<Props>(), {
18
+ size: 'medium'
19
+ })
20
+
21
+ const component = computed(() => {
22
+ return props.tag || props.href ? 'a' : 'button'
23
+ })
24
+
25
+ const params = computed(() => {
26
+ const pattern = /[?&]([^=#]+)=([^&#]*)/g;
27
+ let params:any = {};
28
+ let match;
29
+ while ((match = pattern.exec(props.href==null?"?size=big":props.href)) !== null) {
30
+ params[match[1]] = match[2]
31
+ }
32
+ return params
33
+ // return [params["theme"]==null?props.theme:params["theme"],params["size"]==null?props.size:params["size"],props.baseClass]
34
+ })
35
+
36
+
37
+ </script>
38
+
39
+ <template >
40
+ <component
41
+ :is="component"
42
+ class="btn"
43
+ :class="[params['theme']==null?props.theme:params['theme'],params['size']==null?props.size:params['size'],props.baseClass]"
44
+ :href="href ? href : undefined"
45
+ :target="props.target"
46
+ >
47
+ <slot></slot>
48
+ <template v-for="(item) in block.children" >{{item.content}}</template></component>
49
+ </template>
@@ -0,0 +1,72 @@
1
+ <script setup lang="ts">
2
+ import { useWindowSize } from '@vueuse/core'
3
+ import { computed } from 'vue'
4
+ const { width: vw } = useWindowSize({ includeScrollbar: false })
5
+ const { block} =defineProps<{
6
+ block?: any
7
+ }>()
8
+
9
+ const docStyles= computed(() => {
10
+
11
+ let styles:any=[ vw ? { '--vp-offset': "calc(50% - "+vw.value/2+"px)"} : {}];
12
+ if(block['background-color']){
13
+ styles.push({'padding':'1px 0','background-color':block['background-color']})
14
+ }
15
+ if(block['background-image']){
16
+ styles.push({'padding':'1px 0','background-image':block['background-image']})
17
+ }
18
+ return styles
19
+ })
20
+
21
+
22
+ </script>
23
+ <template>
24
+
25
+ <div class="vp-doc doc" :style="docStyles" >
26
+ <div class="container" v-html="block.content"></div>
27
+ </div>
28
+ </template>
29
+
30
+ <style>
31
+ .doc{ background-size: cover;background-position: center;}
32
+ </style>
33
+ <style scoped>
34
+
35
+ .container {
36
+ margin: auto;
37
+ width: 100%;
38
+ max-width: 1280px;
39
+ padding: 0 24px;
40
+ }
41
+
42
+ @media (min-width: 640px) {
43
+ .container {
44
+ padding: 0 48px;
45
+ }
46
+ }
47
+
48
+ @media (min-width: 960px) {
49
+ .container {
50
+ width: 100%;
51
+ padding: 0 64px;
52
+ }
53
+ }
54
+
55
+ .vp-doc :deep(.VPHomeSponsors),
56
+ .vp-doc :deep(.VPTeamPage) {
57
+ margin-left: var(--vp-offset, calc(50% - 50vw));
58
+ margin-right: var(--vp-offset, calc(50% - 50vw));
59
+ }
60
+
61
+ .vp-doc :deep(.VPHomeSponsors h2) {
62
+ border-top: none;
63
+ letter-spacing: normal;
64
+ }
65
+
66
+ .vp-doc :deep(.VPHomeSponsors a),
67
+ .vp-doc :deep(.VPTeamPage a){
68
+ text-decoration: none;
69
+ }
70
+
71
+
72
+ </style>
@@ -0,0 +1,114 @@
1
+ <script setup lang="ts">
2
+ import Image from './Image.vue'
3
+ import Button from './Button.vue'
4
+
5
+ const _blank:string="_blank"
6
+
7
+ defineProps<{
8
+ block?: any
9
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <div class="VPFeature" >
14
+ <article class="box">
15
+ <template v-for="(item) in block.children" >
16
+ <h1 class="title" v-if="item.block_type=='h1'">
17
+ <span v-for="(h1) in item.children" class="clip">{{h1.content}}</span>
18
+ </h1>
19
+ <h2 class="title" v-if="item.block_type=='h2'">
20
+ <span v-for="(h2) in item.children" class="clip">{{h2.content}}</span>
21
+ </h2>
22
+ <h3 class="title" v-if="item.block_type=='h3'">
23
+ <span v-for="(h3) in item.children" class="clip">{{h3.content}}</span>
24
+ </h3>
25
+ <p v-if="item.block_type=='p'" class="details" >
26
+ <template v-for="(subitem) in item.children">
27
+ <template v-if="subitem.block_type=='text'">{{subitem.content}} </template>
28
+ <Image v-if="subitem.block_type=='img'"
29
+ :block="subitem"
30
+ />
31
+ <Button v-if="subitem.block_type=='a'"
32
+ tag="a"
33
+ size="medium"
34
+ :block="subitem"
35
+ :href="subitem.href"
36
+ :target="_blank"
37
+ ></Button>
38
+
39
+ </template>
40
+ </p>
41
+
42
+ </template>
43
+ </article>
44
+ </div>
45
+ </template>
46
+
47
+ <style scoped>
48
+ .VPFeature {
49
+ display: block;
50
+ border: 1px solid var(--vp-c-bg-soft);
51
+ border-radius: 12px;
52
+ height: 100%;
53
+ background-color: var(--vp-c-bg-soft);
54
+ transition: border-color 0.25s, background-color 0.25s;
55
+ position: relative;
56
+ overflow: hidden;
57
+ }
58
+
59
+
60
+ .VPFeature.link:hover {
61
+ border-color: var(--vp-c-brand-1);
62
+ }
63
+
64
+ .box {
65
+ display: flex;
66
+ flex-direction: column;
67
+ padding: 24px;
68
+ height: 100%;
69
+ }
70
+
71
+ .box > :deep(.VPImage) {
72
+ margin-bottom: 20px;
73
+ }
74
+
75
+
76
+
77
+ .title {
78
+ line-height: 24px;
79
+ font-size: 16px;
80
+ font-weight: 600;
81
+ z-index: 2;
82
+ }
83
+ h1.title{
84
+ font-size: 32px;
85
+ padding:16px 0;
86
+ }
87
+ .details {
88
+ flex-grow: 1;
89
+ line-height: 24px;
90
+ font-size: 14px;
91
+ font-weight: 500;
92
+ color: var(--vp-c-text-2);
93
+ z-index: 1;
94
+ }
95
+
96
+
97
+
98
+
99
+ .link-text {
100
+ padding-top: 8px;
101
+ }
102
+
103
+ .link-text-value {
104
+ display: flex;
105
+ align-items: center;
106
+ font-size: 14px;
107
+ font-weight: 500;
108
+ color: var(--vp-c-brand-1);
109
+ }
110
+
111
+ .link-text-icon {
112
+ margin-left: 6px;
113
+ }
114
+ </style>
@@ -0,0 +1,117 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ import Feature from './Feature.vue';
5
+ export interface Feature {
6
+ title: string
7
+ details: string
8
+ link?: string
9
+ linkText?: string
10
+ rel?: string
11
+ target?: string
12
+ }
13
+
14
+ const props = defineProps<{
15
+ block: any
16
+ }>()
17
+ const grids = computed(() => {
18
+ const uls = props.block.children
19
+ let ret:any=[]
20
+ for(let i=0;i<uls.length;i++){
21
+ if(uls[i].block_type=="ul"){
22
+ const length=uls[i].children.length
23
+ if (!length) {
24
+ ret[i]=""
25
+ } else if (length === 2) {
26
+ ret[i]= 'grid-2'
27
+ } else if (length === 3) {
28
+ ret[i]= 'grid-3'
29
+ } else if (length % 3 === 0) {
30
+ ret[i]= 'grid-6'
31
+ } else if (length > 3) {
32
+ ret[i]= 'grid-4'
33
+ }
34
+ }
35
+ }
36
+ return ret
37
+ })
38
+ </script>
39
+
40
+ <template >
41
+ <template v-for="(ul,index) in block.children" >
42
+ <div v-if="ul.block_type=='ul'" class="VPFeatures">
43
+ <div class="container">
44
+ <div class="items">
45
+ <div
46
+ v-for="feature in ul.children"
47
+ class="item"
48
+ :class="grids[index]"
49
+ >
50
+ <Feature :block="feature"></Feature>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </template>
56
+ </template>
57
+
58
+ <style scoped>
59
+ .VPFeatures {
60
+ position: relative;
61
+ padding: 0 24px;
62
+ }
63
+
64
+ @media (min-width: 640px) {
65
+ .VPFeatures {
66
+ padding: 0 48px;
67
+ }
68
+ }
69
+
70
+ @media (min-width: 960px) {
71
+ .VPFeatures {
72
+ padding: 0 64px;
73
+ }
74
+ }
75
+
76
+ .container {
77
+ margin: 0 auto;
78
+ max-width: 1152px;
79
+ }
80
+
81
+ .items {
82
+ display: flex;
83
+ flex-wrap: wrap;
84
+ margin: -8px;
85
+ }
86
+
87
+ .item {
88
+ padding: 8px;
89
+ width: 100%;
90
+ }
91
+
92
+ @media (min-width: 640px) {
93
+ .item.grid-2,
94
+ .item.grid-4,
95
+ .item.grid-6 {
96
+ width: calc(100% / 2);
97
+ }
98
+ }
99
+
100
+ @media (min-width: 768px) {
101
+ .item.grid-2,
102
+ .item.grid-4 {
103
+ width: calc(100% / 2);
104
+ }
105
+
106
+ .item.grid-3,
107
+ .item.grid-6 {
108
+ width: calc(100% / 3);
109
+ }
110
+ }
111
+
112
+ @media (min-width: 960px) {
113
+ .item.grid-4 {
114
+ width: calc(100% / 4);
115
+ }
116
+ }
117
+ </style>
@@ -0,0 +1,111 @@
1
+ <script setup lang="ts">
2
+ import Button from './Button.vue';
3
+ interface Props {
4
+ block?:any
5
+ }
6
+ const props = withDefaults(defineProps<Props>(), {})
7
+
8
+ import { Octokit } from "octokit"
9
+ const octokit = new Octokit({
10
+ //auth: 'YOUR-TOKEN'
11
+ });
12
+
13
+ function GetGithubUserClass(src:string){
14
+ const usernameRegex = /(?<=\.com\/).*?(?=\/)/g;
15
+ const username: any = usernameRegex.exec(src);
16
+ if (username == null) {
17
+ return "";
18
+ } else {
19
+ const cla="github-user-"+username;
20
+ octokit.rest.users.getByUsername({ "username": username[0] }).then((v)=>{
21
+ console.log(v.data.avatar_url);
22
+ const eles= document.getElementsByClassName(cla)
23
+ for(let i=0;i<eles.length;i++){
24
+ if(eles[i].getAttribute("src")==null)
25
+ eles[i].setAttribute("src",v.data.avatar_url)
26
+ }
27
+ })
28
+
29
+ return cla
30
+ }
31
+ }
32
+
33
+ </script>
34
+ <template>
35
+ <div class="vp-doc container">
36
+ <template v-for="(item) in block.children" >
37
+ <template v-if="item.block_type=='p'" v-for="(pItem) in item.children" >
38
+ <template v-if="pItem.block_type=='a'">
39
+ <Button tag="a"
40
+ size="medium"
41
+ baseClass="github-user-button"
42
+ :block="pItem"
43
+ :href="pItem.href"
44
+ >
45
+ <i class="github-user"><img :class="GetGithubUserClass(pItem.href)" ></i>
46
+ </Button>
47
+ </template>
48
+ <template v-if="pItem.block_type=='text'">{{pItem.content}}</template>
49
+ <template v-if="pItem.block_type=='img'&&pItem.src!=HeroImg.src"><img :src="pItem.src"></template>
50
+
51
+ </template>
52
+ <template v-if="item.block_type=='div'" >
53
+ <div v-html="item.html"></div>
54
+ </template>
55
+ </template></div>
56
+ </template>
57
+ <style scoped>
58
+ .container {
59
+ margin: auto;
60
+ width: 100%;
61
+ max-width: 1280px;
62
+ padding: 0 24px;
63
+ }
64
+
65
+ @media (min-width: 640px) {
66
+ .container {
67
+ padding: 0 48px;
68
+ }
69
+ }
70
+
71
+ @media (min-width: 960px) {
72
+ .container {
73
+ width: 100%;
74
+ padding: 0 64px;
75
+ }
76
+ }
77
+
78
+ .vp-doc :deep(.VPHomeSponsors),
79
+ .vp-doc :deep(.VPTeamPage) {
80
+ margin-left: var(--vp-offset, calc(50% - 50vw));
81
+ margin-right: var(--vp-offset, calc(50% - 50vw));
82
+ }
83
+
84
+ .vp-doc :deep(.VPHomeSponsors h2) {
85
+ border-top: none;
86
+ letter-spacing: normal;
87
+ }
88
+
89
+ .vp-doc :deep(.VPHomeSponsors a),
90
+ .vp-doc :deep(.VPTeamPage a){
91
+ text-decoration: none;
92
+ }
93
+
94
+ .github-user-button{
95
+ padding: 0!important;
96
+ line-height: 32px!important;
97
+ }
98
+
99
+ .github-user{
100
+ display: inline-flex;
101
+ vertical-align: middle;
102
+ padding:2px;
103
+ height: 26px;
104
+ width: 32px;
105
+ background-color: #e2e2e2;
106
+ border-radius: 16px;
107
+ }
108
+ .github-user img{
109
+ height: 22px;
110
+ }
111
+ </style>