themekit-js 1.1.15 → 1.1.17

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.
@@ -3,6 +3,7 @@
3
3
  import { useData } from '../composables/data'
4
4
  import Hero from './blocks/Hero.vue';
5
5
  import Doc from './blocks/Doc.vue';
6
+ import Notion from './blocks/Notion.vue';
6
7
  import Features from './blocks/Features.vue';
7
8
  const { frontmatter } = useData()
8
9
  </script>
@@ -14,6 +15,8 @@ const { frontmatter } = useData()
14
15
  <Hero :block="item" v-if="item.block_type =='Hero'"></Hero>
15
16
  <Features :block="item" v-else-if="item.block_type =='Features'"></Features>
16
17
  <Doc :block="item" v-else-if="item.block_type =='Doc'" ></Doc>
18
+ <Notion :block="item" v-else-if="item.block_type =='Notion'" ></Notion>
19
+
17
20
  </div>
18
21
  <VPHomeContent v-if="frontmatter.markdownStyles !== false">
19
22
  <Content />
@@ -1,45 +1,36 @@
1
- <script setup lang="ts">
2
- import { useWindowSize } from '@vueuse/core'
3
- import { computed } from 'vue'
4
- const { width: vw } = useWindowSize({ includeScrollbar: false })
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
5
3
  const { block} =defineProps<{
6
4
  block?: any
7
5
  }>()
8
6
 
9
- const docStyles= computed(() => {
7
+ import { useData } from 'themekit-js'
8
+ const { base } = useData()
9
+ const styles= computed(() => {
10
10
 
11
- let styles:any=[ vw ? { '--vp-offset': "calc(50% - "+vw.value/2+"px)"} : {}];
12
- if(block['background-color']){
13
- styles.push({ 'background-color':block['background-color']})
14
- }
15
- if(block['background-image']){
16
- styles.push({ 'background-image':"url("+block['background-image']+")"})
17
- }
18
- if(block['color']){
19
- styles.push({ 'color':block['color']})
20
- }
21
- return styles
22
- })
23
- const blockClass= computed(() => {
24
- if(block["class"]){
25
- return [block["class"]]
26
- }else
27
- return []
11
+ let styles:any=[ ];
12
+ if(block['background-color']){
13
+ styles.push({ 'background-color':block['background-color']})
14
+ }
15
+ if(block['background-image']){
16
+ styles.push({ 'background-image':'url('+base.value+block['background-image']+")"})
17
+
18
+ }
19
+ return styles
28
20
  })
21
+
22
+
29
23
 
30
24
  </script>
31
25
  <template>
32
26
 
33
- <div class="vp-doc doc" :class="blockClass" :style="docStyles" >
27
+ <div class="vp-doc doc" v-if="block!=null " :style="styles" >
34
28
  <div class="container" v-html="block.content"></div>
35
29
  </div>
36
30
  </template>
37
31
 
38
32
  <style>
39
- .doc{
40
- background-size: cover;
41
- background-position: center;
42
- }
33
+ .doc{ background-size: cover;background-position: center;}
43
34
  </style>
44
35
  <style scoped>
45
36
 
@@ -1,8 +1,10 @@
1
- <script setup lang="ts">
1
+ <script setup lang="ts">
2
+ import type { DefaultTheme } from 'themekit-js/theme'
2
3
  import { computed } from 'vue'
3
4
 
4
5
  import Feature from './Feature.vue';
5
- export interface Feature {
6
+ export interface Feature {
7
+ icon?: DefaultTheme.FeatureIcon
6
8
  title: string
7
9
  details: string
8
10
  link?: string
@@ -14,32 +16,6 @@ export interface Feature {
14
16
  const props = defineProps<{
15
17
  block: any
16
18
  }>()
17
-
18
-
19
- const docStyles= computed(() => {
20
-
21
- let styles:any=[];
22
- if(props.block['background-color']){
23
- styles.push({ 'background-color':props.block['background-color']})
24
- }
25
- if(props.block['background-image']){
26
- styles.push({'background-image':"url("+props.block['background-image']+")"})
27
- }
28
- if(props.block['color']){
29
- styles.push({ 'color':props.block['color']})
30
- }
31
- return styles
32
- })
33
-
34
-
35
- const blockClass= computed(() => {
36
- if(props.block["class"]){
37
- return [props.block["class"]]
38
- }else
39
- return []
40
- })
41
-
42
-
43
19
  const grids = computed(() => {
44
20
  const uls = props.block.children
45
21
  let ret:any=[]
@@ -61,11 +37,29 @@ const grids = computed(() => {
61
37
  }
62
38
  return ret
63
39
  })
40
+
41
+
42
+ import { useData } from 'themekit-js'
43
+ const { base } = useData()
44
+ const styles= computed(() => {
45
+
46
+ let styles:any=[ ];
47
+ if(props.block['background-color']){
48
+ styles.push({ 'background-color':props.block['background-color']})
49
+ }
50
+ if(props.block['background-image']){
51
+ styles.push({ 'background-image':'url('+base.value+props.block['background-image']+")"})
52
+
53
+ }
54
+ return styles
55
+ })
56
+
64
57
  </script>
65
58
 
66
59
  <template >
67
- <template v-for="(ul,index) in block.children" >
68
- <div v-if="ul.block_type=='ul'" class="VPFeatures" :class="blockClass" :style="docStyles">
60
+ <div :style="styles">
61
+ <template v-for="(ul,index) in block.children" >
62
+ <div v-if="ul.block_type=='ul'" class="VPFeatures" >
69
63
  <div class="container">
70
64
  <div class="items">
71
65
  <div
@@ -78,7 +72,7 @@ const grids = computed(() => {
78
72
  </div>
79
73
  </div>
80
74
  </div>
81
- </template>
75
+ </template></div>
82
76
  </template>
83
77
 
84
78
  <style scoped>
@@ -1,9 +1,7 @@
1
- <script setup lang="ts">
2
- import Button from './Button.vue';
3
- interface Props {
4
- block?:any
5
- }
6
- const props = withDefaults(defineProps<Props>(), {})
1
+ <script setup lang="ts">
2
+ import Button from './Button.vue';
3
+
4
+
7
5
 
8
6
  import { Octokit } from "octokit"
9
7
  const octokit = new Octokit({
@@ -4,6 +4,11 @@ import type { DefaultTheme } from 'themekit-js/theme'
4
4
 
5
5
  import Button from './Button.vue';
6
6
  import Image from './Image.vue';
7
+
8
+
9
+
10
+
11
+
7
12
  export interface HeroAction {
8
13
  theme?: 'brand' | 'alt'
9
14
  text: string
@@ -22,7 +27,7 @@ interface Props {
22
27
  const props = withDefaults(defineProps<Props>(), {
23
28
 
24
29
  })
25
-
30
+
26
31
  let HeroImg:any=null
27
32
  const items=props.block.children
28
33
  for(let i=0;i<items.length;i++){
@@ -54,6 +59,10 @@ const props = withDefaults(defineProps<Props>(), {
54
59
  const hasBgImg =computed(()=>{
55
60
  return props.block['nav-color']!==null
56
61
  })
62
+
63
+
64
+ import { useData } from 'themekit-js'
65
+ const { base } = useData()
57
66
  const styles= computed(() => {
58
67
 
59
68
  let styles:any=[ ];
@@ -61,11 +70,9 @@ const styles= computed(() => {
61
70
  styles.push({ 'background-color':props.block['background-color']})
62
71
  }
63
72
  if(props.block['background-image']){
64
- styles.push({'background-image':"url("+props.block['background-image']+")"})
73
+ styles.push({ 'background-image':'url('+base.value+props.block['background-image']+")"})
74
+
65
75
  }
66
- if(props.block['color']){
67
- styles.push({ 'color':props.block['color']})
68
- }
69
76
  return styles
70
77
  })
71
78
  </script>
@@ -44,7 +44,7 @@ const imgParams:any = (() => {
44
44
  class="VPImage"
45
45
  v-bind="typeof image === 'string' ? $attrs : { ...image, ...$attrs }"
46
46
  :src="withBase(typeof image === 'string' ? image : image.src)"
47
- alt="Img"
47
+
48
48
  />
49
49
  <template v-else>
50
50
  <VPImage
@@ -0,0 +1,127 @@
1
+ <script setup lang="ts">
2
+ /**import MarkdownIt from 'markdown-it'
3
+ * MarkdownIt({
4
+ html: true,
5
+ linkify: true
6
+ }).render("# 标题")
7
+ */
8
+ import axios from 'axios'
9
+
10
+ import { ref } from 'vue'
11
+ import NotionListRow from './NotionListRow.vue';
12
+ import NotionBlockTitle from './NotionBlockTitle.vue';
13
+ import NotionBlocks from './NotionBlocks.vue';
14
+
15
+ function param(name:string){
16
+   return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(window.location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
17
+ }
18
+
19
+ const objectType= ref(param("object"))
20
+
21
+ interface Props {
22
+ block?:any
23
+ }
24
+ const h1="h1"
25
+ const props = withDefaults(defineProps<Props>(), {})
26
+
27
+
28
+ let Results=ref(null)
29
+ let Page=ref({"properties":{"Page":false}})
30
+ let Blocks=ref(null);
31
+ const API="http://forward.seedunk.com/v1/"
32
+ const Bearer="secret_ppf82nO2iZgQ7IA7btWhxO9ocyC8C2pzG0YsPgCyuuA"
33
+
34
+ const option={
35
+ headers:{
36
+ 'forward':"https://api.notion.com",
37
+ 'forward-heads':"Notion-Version",
38
+ 'Bearer': Bearer,
39
+ 'Content-Type': 'application/json',
40
+ 'Notion-Version': '2022-06-28'
41
+ }
42
+ }
43
+
44
+
45
+ if(objectType.value=="page"){
46
+
47
+ axios.get(API+"blocks/"+param("target")+"/children?page_size=100",option)
48
+ .then(response => {
49
+ Blocks.value=response.data["results"]
50
+
51
+
52
+
53
+ })
54
+ .catch(error => { console.error(error); });
55
+
56
+ axios.get(API+"pages/"+param("target"),option)
57
+ .then(response => {
58
+ Page.value=response.data
59
+
60
+ })
61
+ .catch(error => { console.error(error); });
62
+
63
+ }else{
64
+ axios.post( API+"databases/"+props.block["target"]+"/query",{sorts:
65
+ [{"property":"TAG","direction":"ascending"}]},option)
66
+ .then(response => {
67
+ Results.value=response.data["results"]
68
+ })
69
+ .catch(error => { console.error(error); });
70
+ }
71
+
72
+
73
+
74
+
75
+ </script>
76
+ <template>
77
+
78
+
79
+ <div class='container' v-if="objectType=='page'" >
80
+ <NotionBlockTitle :parent="Page" v-if="Page!=null" :block="Page.properties.Page" :component="h1"></NotionBlockTitle>
81
+ <NotionBlocks v-if="Blocks!=null" :blocks="Blocks"></NotionBlocks>
82
+ </div>
83
+ <template v-else v-for="(row,index) in Results" >
84
+ <NotionListRow :row="row" :index="index"></NotionListRow>
85
+ </template>
86
+ </template>
87
+
88
+ <style scoped>
89
+
90
+ .container {
91
+ margin: auto;
92
+ width: 100%;
93
+ max-width: 1280px;
94
+ padding: 0 24px;
95
+ }
96
+
97
+ @media (min-width: 640px) {
98
+ .container {
99
+ padding: 0 48px;
100
+ }
101
+ }
102
+
103
+ @media (min-width: 960px) {
104
+ .container {
105
+ width: 100%;
106
+ padding: 0 64px;
107
+ }
108
+ }
109
+
110
+ .vp-doc :deep(.VPHomeSponsors),
111
+ .vp-doc :deep(.VPTeamPage) {
112
+ margin-left: var(--vp-offset, calc(50% - 50vw));
113
+ margin-right: var(--vp-offset, calc(50% - 50vw));
114
+ }
115
+
116
+ .vp-doc :deep(.VPHomeSponsors h2) {
117
+ border-top: none;
118
+ letter-spacing: normal;
119
+ }
120
+
121
+ .vp-doc :deep(.VPHomeSponsors a),
122
+ .vp-doc :deep(.VPTeamPage a){
123
+ text-decoration: none;
124
+ }
125
+
126
+
127
+ </style>
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+
3
+ interface Props {
4
+ block?: any
5
+ }
6
+ const props = withDefaults(defineProps<Props>(), {
7
+
8
+ })
9
+ console.log(props.block)
10
+
11
+ </script>
12
+
13
+ <template>
14
+ <p>
15
+ <template v-for="(item) in block.paragraph.rich_text" >
16
+ <component :is="item.type" >
17
+ {{item.plain_text}}
18
+ </component>
19
+ </template> </p>
20
+ </template>
21
+
22
+ <style scoped>
23
+
24
+ </style>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ interface Props {
5
+ block?: any
6
+ parent?: any
7
+ component?:string
8
+ }
9
+ const props = withDefaults(defineProps<Props>(), {
10
+ component:"a"
11
+ })
12
+ defineOptions({ inheritAttrs: false })
13
+
14
+ const blockHref =computed(() => {
15
+
16
+ return "?object="+props.parent["object"]+"&target="+props.parent["id"]
17
+ })
18
+
19
+
20
+
21
+
22
+ </script>
23
+
24
+ <template>
25
+
26
+ <a v-if="component=='a'" :href="blockHref">
27
+ <template v-for="(items) in block.title" >
28
+ <component
29
+ :is="items.type"
30
+ >
31
+ {{items.plain_text}}
32
+ </component>
33
+ </template>
34
+ </a>
35
+ <component v-else :is="component" >
36
+ <template v-for="(items) in block.title" >
37
+ <component
38
+ :is="items.type"
39
+ >
40
+ {{items.plain_text}}
41
+ </component>
42
+ </template>
43
+ </component>
44
+ </template>
45
+
46
+ <style scoped>
47
+
48
+ </style>
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+
3
+ import NotionBlockParagraph from './NotionBlockParagraph.vue';
4
+
5
+ interface Props {
6
+ blocks?: any
7
+ }
8
+ const props = withDefaults(defineProps<Props>(), {
9
+
10
+ })
11
+ console.log(props)
12
+
13
+ </script>
14
+
15
+ <template>
16
+ <template v-for="(block) in blocks" >
17
+ <NotionBlockParagraph
18
+ v-if="block.type=='paragraph'"
19
+ :block="block"
20
+ >
21
+ </NotionBlockParagraph>
22
+
23
+ </template>
24
+ </template>
25
+
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+
3
+
4
+ import NotionBlockTitle from './NotionBlockTitle.vue';
5
+ interface Props {
6
+ row?: any
7
+ index?: number
8
+ }
9
+ const props = withDefaults(defineProps<Props>(), {
10
+
11
+ })
12
+ console.debug(props)
13
+ defineOptions({ inheritAttrs: false })
14
+
15
+
16
+
17
+ const a:string="a"
18
+
19
+ </script>
20
+
21
+ <template>
22
+ <template v-for="(property) in row.properties" >
23
+ <NotionBlockTitle v-if="property.type=='title'" :parent="row" :block="property" :component="a"></NotionBlockTitle>
24
+ </template>
25
+ </template>
26
+
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-BI5vlbXe.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-pVKeYHjI.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-BI5vlbXe.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-BI5vlbXe.js';
3
+ import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-pVKeYHjI.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-pVKeYHjI.js';
5
5
  import path from 'path';
6
6
  import 'crypto';
7
7
  import 'module';
@@ -38269,7 +38269,7 @@ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, isBuild
38269
38269
  }
38270
38270
  console.log("Layout:" + layoutVal);
38271
38271
  let blocks = [];
38272
- if (layoutVal == "block") {
38272
+ if (layoutVal == "block" || layoutVal == "home") {
38273
38273
  while ((blockRaw = blocksRegex.exec(src)) !== null) {
38274
38274
  blockRaws.push(blockRaw[0]);
38275
38275
  }
@@ -46725,7 +46725,7 @@ function escapeHtml(string) {
46725
46725
 
46726
46726
  var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
46727
46727
 
46728
- var version = "1.1.15";
46728
+ var version = "1.1.16";
46729
46729
 
46730
46730
  async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
46731
46731
  const routePath = `/${page.replace(/\.md$/, "")}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "themekit-js",
3
- "version": "1.1.15",
4
- "description": "基于VitePress开发的Markdown静态网站生成器",
3
+ "version": "1.1.17",
4
+ "description": "基于VitePress开发的Markdown静态网站生成器",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@8.15.6",
7
7
  "main": "dist/node/index.js",
@@ -104,6 +104,7 @@
104
104
  "@vue/devtools-api": "^7.0.25",
105
105
  "@vueuse/core": "^10.9.0",
106
106
  "@vueuse/integrations": "^10.9.0",
107
+ "axios": "^1.7.2",
107
108
  "focus-trap": "^7.5.4",
108
109
  "github-markdown-css": "^5.5.1",
109
110
  "mark.js": "8.11.1",