hexo-theme-shokax 0.3.13 → 0.4.0-alpha.2

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.
Files changed (62) hide show
  1. package/_config.yml +16 -9
  2. package/layout/_mixin/comment.pug +4 -4
  3. package/layout/_partials/footer.pug +1 -1
  4. package/layout/_partials/head/head.pug +7 -1
  5. package/layout/_partials/header.pug +1 -1
  6. package/layout/_partials/layout.pug +0 -10
  7. package/layout/_partials/post/footer.pug +1 -2
  8. package/package.json +10 -5
  9. package/scripts/generaters/archive.js +1 -1
  10. package/scripts/generaters/script.js +64 -42
  11. package/scripts/helpers/asset.js +1 -1
  12. package/scripts/helpers/list_categories.js +0 -4
  13. package/scripts/plugin/lib/injects.js +1 -1
  14. package/source/js/_app/components/comments.ts +33 -0
  15. package/source/js/_app/components/sidebar.ts +239 -0
  16. package/source/js/_app/globals/globalVars.ts +99 -0
  17. package/source/js/_app/globals/handles.ts +123 -0
  18. package/source/js/_app/globals/themeColor.ts +64 -0
  19. package/source/js/_app/globals/thirdparty.ts +63 -0
  20. package/source/js/_app/globals/tools.ts +75 -0
  21. package/source/js/_app/library/anime.ts +110 -0
  22. package/source/js/_app/library/declare.d.ts +126 -0
  23. package/source/js/_app/library/dom.ts +26 -0
  24. package/source/js/_app/library/loadFile.ts +43 -0
  25. package/source/js/_app/library/proto.ts +141 -0
  26. package/source/js/_app/library/scriptPjax.ts +72 -0
  27. package/source/js/_app/library/storage.ts +12 -0
  28. package/source/js/_app/library/vue.ts +50 -0
  29. package/source/js/_app/page/common.ts +42 -0
  30. package/source/js/_app/page/fancybox.ts +71 -0
  31. package/source/js/_app/page/post.ts +266 -0
  32. package/source/js/_app/page/search.ts +135 -0
  33. package/source/js/_app/page/tab.ts +60 -0
  34. package/source/js/_app/pjax/domInit.ts +96 -0
  35. package/source/js/_app/pjax/refresh.ts +78 -0
  36. package/source/js/_app/pjax/siteInit.ts +72 -0
  37. package/source/js/_app/player.ts +799 -0
  38. package/source/assets/beian.webp +0 -0
  39. package/source/js/_app/components/sidebar.js +0 -209
  40. package/source/js/_app/fireworks.js +0 -10
  41. package/source/js/_app/globals/globalVars.js +0 -80
  42. package/source/js/_app/globals/handles.js +0 -98
  43. package/source/js/_app/globals/themeColor.js +0 -62
  44. package/source/js/_app/globals/thirdparty.js +0 -62
  45. package/source/js/_app/globals/tools.js +0 -66
  46. package/source/js/_app/library/anime.js +0 -106
  47. package/source/js/_app/library/dom.js +0 -34
  48. package/source/js/_app/library/loadFile.js +0 -36
  49. package/source/js/_app/library/proto.js +0 -163
  50. package/source/js/_app/library/scriptPjax.js +0 -70
  51. package/source/js/_app/library/storage.js +0 -12
  52. package/source/js/_app/library/vue.js +0 -53
  53. package/source/js/_app/page/comment.js +0 -23
  54. package/source/js/_app/page/common.js +0 -41
  55. package/source/js/_app/page/fancybox.js +0 -65
  56. package/source/js/_app/page/post.js +0 -244
  57. package/source/js/_app/page/search.js +0 -118
  58. package/source/js/_app/page/tab.js +0 -53
  59. package/source/js/_app/pjax/domInit.js +0 -76
  60. package/source/js/_app/pjax/refresh.js +0 -52
  61. package/source/js/_app/pjax/siteInit.js +0 -51
  62. package/source/js/_app/player.js +0 -771
package/_config.yml CHANGED
@@ -21,7 +21,6 @@ pwa:
21
21
 
22
22
  # 实验性特性
23
23
  experiments:
24
- noPlayer: false # 禁用音乐播放器
25
24
  gradient: false # 使用CSS渐变作为文章封面
26
25
  fixedCover: "" # 主页面cover(为空则使用bing随机图片)
27
26
  debug: false # 使用debug模式启动
@@ -31,6 +30,17 @@ experiments:
31
30
  # 具体见https://docs.kaitaku.xyz/guide/theme.html#%E9%95%BF%E6%96%87%E7%AB%A0%E4%BC%98%E5%8C%96
32
31
  mobileWidth: 820px # 移动版和桌面版导航栏最短切换长度
33
32
 
33
+ # ShokaX 模块化分包引入设置
34
+ # 请关闭所有不使用的模块以优化主题 js 体积和性能
35
+ modules:
36
+ player: true # 启用音乐播放器
37
+ fireworks: true # 启用鼠标点击烟花特效
38
+ unlazyHash: false # 启用unlazy hash预览图支持
39
+ visibilityListener: true # 启用可见度监听器
40
+ tabs: true # 启用选项卡扩展支持,如需开启 summary 功能请一并开启
41
+ quiz: true # 启用文章内问题扩展支持
42
+ fancybox: true # 启用 fancybox 支持(不建议禁用)
43
+
34
44
  # 优化性能区
35
45
  performance:
36
46
  # 使用preconnect预加载的网址(不建议超过三个)
@@ -38,15 +48,11 @@ performance:
38
48
  - "https://lf9-cdn-tos.bytecdntp.com"
39
49
  # 使用dns-prefetch预解析的网址
40
50
  dnsPrefetch:
41
- - "https://cdn.jsdelivr.net"
42
- - "https://unpkg.com"
43
51
 
44
52
  playerAPI: "https://api.injahow.cn" # 结尾不带/,只填写域名
45
53
  # 如果条件允许,请参考 https://github.com/injahow/meting-api 自建API
46
54
  # 使用vercel自行部署,请参考: https://github.com/xizeyoupan/Meting-API
47
55
 
48
- disableVL: false # 禁用可见度监听
49
-
50
56
  icon:
51
57
  favicon: "/favicon.ico"
52
58
  apple_touch_icon: "/apple-touch-icon.png"
@@ -263,7 +269,8 @@ footer:
263
269
  word2: 秋 #第二个字
264
270
  icp: # ICP备案
265
271
  enable: false
266
- icon: "beian.webp" #网安备案图片
272
+ # 请在登录后从 https://beian.mps.gov.cn/web/business/businessHome/website 下载对应图标
273
+ icon: "" #网安备案图片
267
274
  icpnumber: "xxx" # ICP备案号
268
275
  beian: "xxx" # 网安备案号
269
276
  recordcode: "xxx" # 网安备案链接中的recordcode参数
@@ -357,9 +364,9 @@ vendors:
357
364
  # pjax: npm_webcache|theme-shokax-pjax@0.0.3/pjax.shokax.min.js
358
365
  # anime: npm_webcache|theme-shokax-anime@0.0.6/anime.shokax.min.js
359
366
  # lozad: npm_webcache|lozad@1.16.0/dist/lozad.min.js
360
- algolia: bytedance|algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
361
- instantsearch: bytedance|instantsearch.js/4.39.0/instantsearch.production.min.js
362
- quicklink: npm_webcache|quicklink@2.3.0/dist/quicklink.umd.js
367
+ # algolia: bytedance|algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
368
+ # instantsearch: bytedance|instantsearch.js/4.39.0/instantsearch.production.min.js
369
+ # quicklink: npm_webcache|quicklink@2.3.0/dist/quicklink.umd.js
363
370
  # mouse_firework: npm_webcache|mouse-firework@0.0.4/dist/index.umd.js
364
371
  async_js:
365
372
  fancybox: bytedance|??jquery/3.5.1/jquery.min.js,fancybox/3.5.7/jquery.fancybox.min.js,justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
@@ -3,17 +3,17 @@ mixin CommentRender()
3
3
  - var tk = theme?.twikoo?.enable,wl = theme?.waline?.enable
4
4
  if page.comment !== false && !theme.experiments.disableThemeComment
5
5
  if tk
6
- div(class="wrap" id="tcomments")
6
+ div(class="wrap" id="comments")
7
7
  script(type="text/javascript" data-pjax).
8
8
  setTimeout(function () {
9
9
  twikoo.init({
10
10
  envId: '#{ theme.twikoo.envId }',
11
- el: '#tcomments',
11
+ el: '#comments',
12
12
  region: '#{theme.twikoo.region}'
13
13
  })
14
14
  }, 1000)
15
15
  else if wl
16
- div(class="wrap" id="wcomments")
16
+ div(class="wrap" id="comments")
17
17
  - var locale = JSON.stringify(theme.waline.locale)
18
18
  - var emoji = JSON.stringify(theme.waline.emoji)
19
19
  - var meta = JSON.stringify(theme.waline.meta)
@@ -23,7 +23,7 @@ mixin CommentRender()
23
23
 
24
24
  setTimeout(function () {
25
25
  init({
26
- el: '#wcomments',
26
+ el: '#comments',
27
27
  serverURL: '#{theme.waline.serverURL.replace(/\/+$/, '')}',
28
28
  lang: '#{theme.waline.lang}',
29
29
  locale: !{locale},
@@ -33,7 +33,7 @@ div(class="status")
33
33
  - var beianN = theme.footer.icp?.beian, RC=theme.footer.icp?.recordcode
34
34
  if beianN && RC
35
35
  br
36
- a(target="_blank" href=`https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=${RC}`)
36
+ a(target="_blank" href=`https://beian.mps.gov.cn/#/query/webSearch?code=${RC}`)
37
37
  img(src=theme.statics + theme.assets + '/' + theme.footer.icp.icon style="max-width: 2em;display:inline;" width="20" height="20")
38
38
  != beianN
39
39
  != shokax_inject('status')
@@ -38,11 +38,17 @@ each prelink in prelinks
38
38
  each dnsLink in dnslinks
39
39
  link(rel="dns-prefetch" href=dnsLink)
40
40
 
41
- - var fontConfig = theme?.font?.loadFromGoogle
41
+ - var fontConfig = theme.font?.loadFromGoogle
42
42
  if fontConfig
43
43
  != _vendor_font()
44
44
  != _css('app.css')
45
45
 
46
+ if theme.polyfill.enable
47
+ script(src=`https://polyfill.io/v3/polyfill.min.js?features=${theme.polyfill.features}` defer)
48
+
49
+ != vendor_js()
50
+ != _js('siteInit.js')
51
+
46
52
  include pwa.pug
47
53
  if tk
48
54
  script(src=theme.twikoo.link )
@@ -11,7 +11,7 @@ nav(id="nav")
11
11
  != alternate || title
12
12
  ul(class="right" id="rightNav")
13
13
  li(class="item theme" @click="changeThemeByBtn")
14
- i(class="ic" :class="{'i-sun': !themeStatus,'i-moon': themeStatus}")
14
+ i(class="ic i-sun")
15
15
  li(class="item search")
16
16
  i(class="ic i-search")
17
17
  != shokax_inject('rightNav')
@@ -115,16 +115,6 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
115
115
  ]
116
116
  };
117
117
 
118
- if theme.polyfill.enable
119
- script(src=`https://polyfill.io/v3/polyfill.min.js?features=${theme.polyfill.features}`)
120
-
121
- - debugVue = theme?.experiments?.debug
122
- if debugVue
123
- script(src="https://cdn.bootcdn.net/ajax/libs/vue/3.3.4/vue.global.min.js")
124
- else
125
- script(src="https://cdn.bootcdn.net/ajax/libs/vue/3.3.4/vue.global.prod.min.js")
126
- != vendor_js()
127
- != _js('app.js')
128
118
  != partial('_partials/third-party/baidu-analytics.pug', {}, {cache: true})
129
119
  != partial('_partials/third-party/clarity.pug', {}, {cache: true})
130
120
  != partial('_partials/third-party/google-analytics.pug', {}, {cache: true})
@@ -16,10 +16,9 @@ div(class="meta")
16
16
  script(type = "module" data-pjax).
17
17
  import { pageviewCount } from 'https://unpkg.com/@waline/client@2/dist/pageview.mjs';
18
18
 
19
- const path = document.getElementById("twikoo_visitors").getAttribute("data-path");
20
19
  pageviewCount({
21
20
  serverURL: '#{theme.waline.serverURL}',
22
- path: path,
21
+ path: window.location.pathname,
23
22
  });
24
23
 
25
24
  != shokax_inject('postMeta')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.3.13",
3
+ "version": "0.4.0-alpha.2",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
@@ -9,33 +9,38 @@
9
9
  "packageManager": "pnpm@8.14.1",
10
10
  "scripts": {
11
11
  "test": "tsc --build --verbose",
12
- "build": "cd ./source && tsc --build --verbose && cd ../scripts && tsc --build --verbose"
12
+ "build": "cd ./scripts && tsc --build --verbose"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/fancybox": "^3.5.6",
16
16
  "@types/jquery": "^3.5.29",
17
17
  "@types/js-yaml": "^4.0.9",
18
18
  "@types/node": "^20.11.10",
19
- "@typescript-eslint/eslint-plugin": "^6.19.1",
20
- "@typescript-eslint/parser": "^6.19.1",
19
+ "@types/quicklink": "^2.3.4",
20
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
21
+ "@typescript-eslint/parser": "^6.20.0",
22
+ "@waline/client": "3.0.0-alpha.11",
21
23
  "eslint": "^8.56.0",
22
24
  "eslint-config-standard": "~17",
23
25
  "eslint-plugin-import": "^2.29.1",
24
26
  "eslint-plugin-n": "^16.6.2",
25
27
  "eslint-plugin-promise": "^6.1.1",
26
28
  "eslint-plugin-vue": "^9.20.1",
27
- "instantsearch.js": "^4.64.1",
28
29
  "typescript": "^5.3.3",
29
30
  "vue": "^3.4.15"
30
31
  },
31
32
  "dependencies": {
33
+ "@algolia/client-search": "^4.22.1",
34
+ "algoliasearch": "4.22.1",
32
35
  "esbuild": "^0.20.0",
33
36
  "hexo": "7.0.0",
34
37
  "hexo-fs": "^4.1.1",
35
38
  "hexo-pagination": "^3.0.0",
36
39
  "hexo-util": "^3.2.0",
40
+ "instantsearch.js": "^4.64.2",
37
41
  "js-yaml": "^4.1.0",
38
42
  "mouse-firework": "^0.0.5",
43
+ "quicklink": "^2.3.0",
39
44
  "theme-shokax-anime": "^0.0.6",
40
45
  "theme-shokax-pjax": "^0.0.3",
41
46
  "unlazy": "^0.10.4"
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  // @ts-ignore
8
8
  const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
9
9
  // @ts-ignore
10
- const fmtNum = num => {
10
+ const fmtNum = (num) => {
11
11
  return num < 10 ? '0' + num : num;
12
12
  };
13
13
  if (!(hexo.config.archive && hexo.config.archive.enabled === false)) {
@@ -1,34 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  /* global hexo */
30
7
  const package_json_1 = __importDefault(require("../../package.json"));
31
- const fs = __importStar(require("hexo-fs"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
32
9
  const esbuild_1 = require("esbuild");
33
10
  const utils_1 = require("../utils");
34
11
  hexo.extend.generator.register('script', function (locals) {
@@ -67,8 +44,6 @@ hexo.extend.generator.register('script', function (locals) {
67
44
  priority: theme.quicklink.priority
68
45
  },
69
46
  playerAPI: theme.playerAPI,
70
- disableVL: theme.disableVL,
71
- noPlayer: theme.experiments?.noPlayer,
72
47
  audio: undefined,
73
48
  fireworks: (theme.fireworks && theme.fireworks.enable && theme.fireworks.options)
74
49
  ? theme.fireworks.options
@@ -85,34 +60,81 @@ hexo.extend.generator.register('script', function (locals) {
85
60
  if (theme?.audio) {
86
61
  siteConfig.audio = theme.audio;
87
62
  }
88
- let text;
89
63
  let enterPoint;
90
- if (fs.existsSync('themes/shokaX/source/js/_app/pjax/siteInit.js')) {
91
- enterPoint = 'themes/shokaX/source/js/_app/pjax/siteInit.js';
64
+ if (node_fs_1.default.existsSync('themes/shokaX/source/js/_app/pjax/siteInit.ts')) {
65
+ enterPoint = 'themes/shokaX/source/js/_app/pjax/siteInit.ts';
92
66
  }
93
67
  else {
94
- enterPoint = 'node_modules/hexo-theme-shokax/source/js/_app/pjax/siteInit.js';
68
+ enterPoint = 'node_modules/hexo-theme-shokax/source/js/_app/pjax/siteInit.ts';
95
69
  }
96
- text = 'const CONFIG = ' + JSON.stringify(siteConfig) + ';';
97
70
  (0, esbuild_1.buildSync)({
98
71
  entryPoints: [enterPoint],
99
72
  bundle: true,
100
- outfile: 'shokax_temp.js',
73
+ outdir: 'shokaxTemp',
74
+ tsconfigRaw: {
75
+ compilerOptions: {
76
+ target: 'ES2022',
77
+ esModuleInterop: true,
78
+ module: 'ESNext',
79
+ moduleResolution: 'Node',
80
+ skipLibCheck: true
81
+ }
82
+ },
101
83
  platform: 'browser',
102
- format: 'iife',
84
+ format: 'esm',
103
85
  target: ['es2022'],
104
86
  minify: true,
87
+ legalComments: 'linked',
88
+ mainFields: ['module', 'main'],
89
+ splitting: true,
105
90
  define: {
106
- __UNLAZY_LOGGING__: 'false'
91
+ __UNLAZY_LOGGING__: 'false',
92
+ __UNLAZY_HASH_DECODING__: theme.modules.unlazyHash ? 'true' : 'false',
93
+ __shokax_player__: theme.modules.player ? 'true' : 'false',
94
+ __shokax_VL__: theme.modules.visibilityListener ? 'true' : 'false',
95
+ __shokax_fireworks__: (theme.fireworks && theme.fireworks.enable && theme.fireworks.options && theme.modules.fireworks) ? 'true' : 'false',
96
+ __shokax_search__: config?.algolia ? 'true' : 'false',
97
+ __shokax_outime__: theme.outime.enable ? 'true' : 'false',
98
+ __shokax_tabs__: theme.modules.tabs ? 'true' : 'false',
99
+ __shokax_quiz__: theme.modules.quiz ? 'true' : 'false',
100
+ __shokax_fancybox__: theme.modules.fancybox ? 'true' : 'false',
101
+ shokax_CONFIG: JSON.stringify(siteConfig)
102
+ },
103
+ alias: {
104
+ 'algoliasearch/lite': 'algoliasearch/dist/algoliasearch-lite.esm.browser.js'
107
105
  }
108
106
  });
109
- text += fs.readFileSync('shokax_temp.js');
110
- const result = hexo.render.renderSync({ text, engine: 'js' });
111
- fs.unlinkSync('shokax_temp.js');
112
- return {
113
- path: theme.js + '/app.js',
114
- data: function () {
115
- return result;
107
+ const res = [];
108
+ node_fs_1.default.readdirSync('./shokaxTemp').forEach((file) => {
109
+ const fileText = node_fs_1.default.readFileSync(`./shokaxTemp/${file}`, { encoding: 'utf-8' });
110
+ if (file.endsWith('js')) {
111
+ const result = hexo.render.renderSync({ text: fileText, engine: 'js' });
112
+ res.push({
113
+ path: theme.js + '/' + file,
114
+ data: function () {
115
+ return result;
116
+ }
117
+ });
116
118
  }
117
- };
119
+ else if (file.endsWith('css')) {
120
+ const result = hexo.render.renderSync({ text: fileText, engine: 'css' });
121
+ res.push({
122
+ path: theme.css + '/' + file,
123
+ data: function () {
124
+ return result;
125
+ }
126
+ });
127
+ }
128
+ else {
129
+ res.push({
130
+ path: theme.js + '/' + file,
131
+ data: function () {
132
+ return fileText;
133
+ }
134
+ });
135
+ }
136
+ node_fs_1.default.unlinkSync(`./shokaxTemp/${file}`);
137
+ });
138
+ node_fs_1.default.rmSync('./shokaxTemp', { force: true, recursive: true });
139
+ return res;
118
140
  });
@@ -126,7 +126,7 @@ hexo.extend.helper.register('_css', function (...urls) {
126
126
  });
127
127
  hexo.extend.helper.register('_js', function (...urls) {
128
128
  const { statics, js } = hexo.theme.config;
129
- return urls.map(url => (0, hexo_util_1.htmlTag)('script', { src: hexo_util_1.url_for.call(this, `${statics}${js}/${url}?v=${package_json_1.default.version}`) }, '')).join('');
129
+ return urls.map(url => (0, hexo_util_1.htmlTag)('script', { src: hexo_util_1.url_for.call(this, `${statics}${js}/${url}?v=${package_json_1.default.version}`), type: 'module', fetchpriority: 'high' }, '')).join('');
130
130
  });
131
131
  hexo.extend.helper.register('vendor_js', function () {
132
132
  const vendors = hexo.theme.config.vendors;
@@ -1,5 +1,3 @@
1
- 'use strict';
2
- /* global hexo */
3
1
  const prepareQuery = (categories, parent) => {
4
2
  const query = {
5
3
  parent: undefined
@@ -13,7 +11,6 @@ const prepareQuery = (categories, parent) => {
13
11
  return categories.find(query).sort('name', 1).filter(cat => cat.length);
14
12
  };
15
13
  hexo.extend.helper.register('_list_categories', function (depth = 0) {
16
- // let hexo = this
17
14
  const categories = this.site.categories;
18
15
  if (!categories || !categories.length)
19
16
  return '';
@@ -48,7 +45,6 @@ hexo.extend.helper.register('_list_categories', function (depth = 0) {
48
45
  return hierarchicalList(0);
49
46
  });
50
47
  hexo.extend.helper.register('_category_prev', function (name) {
51
- // let hexo = this
52
48
  const categories = this.site.categories;
53
49
  if (!categories || !categories.length)
54
50
  return '';
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ "use strict";
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
@@ -0,0 +1,33 @@
1
+ import { CONFIG } from '../globals/globalVars'
2
+ import { init, pageviewCount } from '@waline/client'
3
+
4
+ // await import('@waline/client/style')
5
+ // fixme 处理样式引入问题
6
+
7
+ export const walineComment = function () {
8
+ init({
9
+ el: '#comments',
10
+ serverURL: CONFIG.waline.serverURL,
11
+ lang: CONFIG.waline.lang,
12
+ locale: CONFIG.waline.locale,
13
+ emoji: CONFIG.waline.emoji,
14
+ meta: CONFIG.waline.meta,
15
+ requiredMeta: CONFIG.waline.requiredMeta,
16
+ wordLimit: CONFIG.waline.wordLimit,
17
+ pageSize: CONFIG.waline.pageSize,
18
+ pageview: CONFIG.waline.pageview,
19
+ path: window.location.pathname,
20
+ dark: 'html[data-theme="dark"]'
21
+ })
22
+ }
23
+
24
+ export const walinePageview = function () {
25
+ pageviewCount({
26
+ serverURL: CONFIG.waline.serverURL,
27
+ path: window.location.pathname
28
+ })
29
+ }
30
+
31
+ export const walineRecentComments = async function () {
32
+
33
+ }