hexo-theme-shokax 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  ![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
6
6
  ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
7
7
  ![version](https://shields.io/npm/v/hexo-theme-shokax)
8
+ ![build](https://img.shields.io/github/actions/workflow/status/theme-shoka-x/hexo-theme-shokaX/build-theme.yml)
8
9
 
9
10
  语言(language): 简体中文 | [English](./README_en.md) \
10
11
  此项目是shoka的一个二次开发版(算精神续作),致力于提高性能和优化魔改体验 \
package/_config.yml CHANGED
@@ -344,7 +344,7 @@ advVendors:
344
344
  fetch:
345
345
  src: npm:whatwg-fetch@3.4.0/dist/fetch.umd.js
346
346
  anime:
347
- src: bytedance:animejs/3.2.0/anime.min.js
347
+ src: npm:theme-shokax-anime@latest/anime.shokax.min.js
348
348
  algolia:
349
349
  src: bytedance:algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
350
350
  instantsearch:
@@ -394,7 +394,7 @@ vendors:
394
394
  pace: npm/pace-js@1.0.2/pace.min.js # ok
395
395
  pjax: npm/pjax@0.2.8/pjax.min.js # ok
396
396
  fetch: npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js # ok
397
- anime: npm/animejs@3.2.0/lib/anime.min.js # ok
397
+ anime: npm/theme-shokax-anime@latest/anime.shokax.min.js
398
398
  algolia: npm/algoliasearch@4/dist/algoliasearch-lite.umd.js # ok
399
399
  instantsearch: npm/instantsearch.js@4/dist/instantsearch.production.min.js # ok
400
400
  lazyload: npm/lozad@1/dist/lozad.min.js # ok
package/package.json CHANGED
@@ -1,49 +1,48 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/zkz098/hexo-theme-shokaX",
7
7
  "author": "Chou kaitaku",
8
8
  "license": "GPL-3.0-or-later",
9
9
  "scripts": {
10
- "test": "cd ./source/js && tsc",
10
+ "test": "tsc",
11
11
  "build": "pnpm install && tsc",
12
12
  "docs:dev": "vuepress dev docs",
13
13
  "docs:build": "vuepress build docs"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@algolia/client-search": "^4",
17
- "@types/animejs": "^3.1.7",
18
17
  "@types/fancybox": "^3.5.3",
19
18
  "@types/hexo": "^3.8.8",
20
19
  "@types/jquery": "^3.5.16",
21
20
  "@types/js-yaml": "^4.0.5",
22
21
  "@types/lozad": "^1.16.1",
23
- "@types/node": "^18.15.6",
24
- "@types/shelljs": "^0.8.11",
25
- "@typescript-eslint/eslint-plugin": "^5.56.0",
26
- "@typescript-eslint/parser": "^5.56.0",
22
+ "@types/node": "^18.15.13",
23
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
24
+ "@typescript-eslint/parser": "^5.59.0",
27
25
  "@vuepress/client": "2.0.0-beta.61",
28
26
  "@vuepress/plugin-docsearch": "2.0.0-beta.61",
29
- "algoliasearch": "^4.16.0",
30
- "eslint": "^8.36.0",
27
+ "algoliasearch": "^4.17.0",
28
+ "eslint": "^8.39.0",
31
29
  "eslint-config-standard": "^17.0.0",
32
30
  "eslint-plugin-import": "^2.27.5",
33
- "eslint-plugin-n": "^15.6.1",
31
+ "eslint-plugin-n": "^15.7.0",
34
32
  "eslint-plugin-promise": "^6.1.1",
35
- "eslint-plugin-vue": "^9.10.0",
33
+ "eslint-plugin-vue": "^9.11.0",
36
34
  "hexo-fs": "^4.1.1",
37
35
  "hexo-util": "^3.0.1",
38
- "instantsearch.js": "^4.53.0",
36
+ "instantsearch.js": "^4.54.1",
39
37
  "pjax": "^0.2.8",
40
- "typescript": "^5.0.2",
38
+ "theme-shokax-anime": "^0.0.4",
39
+ "typescript": "^5.0.4",
41
40
  "vue": "^3.2.47",
42
41
  "vuepress": "2.0.0-beta.61",
43
- "vuepress-plugin-sitemap2": "2.0.0-beta.197"
42
+ "vuepress-plugin-sitemap2": "2.0.0-beta.205"
44
43
  },
45
44
  "dependencies": {
46
45
  "js-yaml": "^4.1.0",
47
- "sass": "^1.60.0"
46
+ "sass": "^1.62.0"
48
47
  }
49
48
  }
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const hexo_util_1 = __importDefault(require("hexo-util"));
7
- const hexo_fs_1 = __importDefault(require("hexo-fs"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const js_yaml_1 = __importDefault(require("js-yaml"));
10
10
  hexo.extend.filter.register('before_generate', () => {
@@ -26,7 +26,7 @@ hexo.extend.filter.register('before_generate', () => {
26
26
  hexo.theme.config.style = {};
27
27
  for (const style of ['iconfont', 'colors', 'custom']) {
28
28
  const custom_file = 'source/_data/' + style + '.styl';
29
- if (hexo_fs_1.default.existsSync(custom_file)) {
29
+ if (node_fs_1.default.existsSync(custom_file)) {
30
30
  hexo.theme.config.style[style] = path_1.default.resolve(hexo.base_dir, custom_file);
31
31
  }
32
32
  }
@@ -34,6 +34,6 @@ hexo.extend.filter.register('before_generate', () => {
34
34
  hexo.theme.config.image_list = data.images;
35
35
  }
36
36
  else {
37
- hexo.theme.config.image_list = js_yaml_1.default.load(hexo_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml')));
37
+ hexo.theme.config.image_list = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml')));
38
38
  }
39
39
  });
@@ -1,22 +1,19 @@
1
1
  'use strict';
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const hexo_fs_1 = __importDefault(require("hexo-fs"));
3
+ const fs = require("hexo-fs");
7
4
  hexo.extend.generator.register('images', function (locals) {
8
5
  const theme = hexo.theme.config;
9
6
  const dir = 'source/_data/' + theme.assets + '/';
10
- if (!hexo_fs_1.default.existsSync(dir)) {
7
+ if (!fs.existsSync(dir)) {
11
8
  return;
12
9
  }
13
10
  const result = [];
14
- const files = hexo_fs_1.default.listDirSync(dir);
11
+ const files = fs.listDirSync(dir);
15
12
  files.forEach((file) => {
16
13
  result.push({
17
14
  path: theme.assets + '/' + file,
18
15
  data: function () {
19
- return hexo_fs_1.default.createReadStream(dir + file);
16
+ return fs.createReadStream(dir + file);
20
17
  }
21
18
  });
22
19
  });
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const hexo_fs_1 = __importDefault(require("hexo-fs"));
6
+ const fs = require("hexo-fs");
7
7
  const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
8
8
  hexo.config.index_generator = Object.assign({
9
9
  per_page: typeof hexo.config.per_page === 'undefined' ? 10 : hexo.config.per_page,
@@ -31,27 +31,27 @@ hexo.extend.generator.register('index', function (locals) {
31
31
  if (categories && categories.length) {
32
32
  categories.forEach((cat) => {
33
33
  const cover = `source/_posts/${cat.slug}`;
34
- if (hexo_fs_1.default.existsSync(cover + '/cover.avif')) {
34
+ if (fs.existsSync(cover + '/cover.avif')) {
35
35
  covers.push({
36
36
  path: cat.slug + '/cover.avif',
37
37
  data: function () {
38
- return hexo_fs_1.default.createReadStream(cover + '/cover.avif');
38
+ return fs.createReadStream(cover + '/cover.avif');
39
39
  }
40
40
  });
41
41
  }
42
- else if (hexo_fs_1.default.existsSync(cover + '/cover.webp')) {
42
+ else if (fs.existsSync(cover + '/cover.webp')) {
43
43
  covers.push({
44
44
  path: cat.slug + '/cover.webp',
45
45
  data: function () {
46
- return hexo_fs_1.default.createReadStream(cover + '/cover.webp');
46
+ return fs.createReadStream(cover + '/cover.webp');
47
47
  }
48
48
  });
49
49
  }
50
- else if (hexo_fs_1.default.existsSync(cover + '/cover.jpg')) {
50
+ else if (fs.existsSync(cover + '/cover.jpg')) {
51
51
  covers.push({
52
52
  path: cat.slug + '/cover.jpg',
53
53
  data: function () {
54
- return hexo_fs_1.default.createReadStream(cover + '/cover.jpg');
54
+ return fs.createReadStream(cover + '/cover.jpg');
55
55
  }
56
56
  });
57
57
  const topcat = getTopcat(cat);
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const package_json_1 = __importDefault(require("../../package.json"));
7
- const hexo_fs_1 = __importDefault(require("hexo-fs"));
7
+ const fs = require("hexo-fs");
8
8
  hexo.extend.generator.register('script', function (locals) {
9
9
  const log = hexo.log || console.log;
10
10
  const config = hexo.config;
@@ -61,27 +61,27 @@ hexo.extend.generator.register('script', function (locals) {
61
61
  }
62
62
  let text = '';
63
63
  ['library', 'global', 'page', 'vue', 'components'].forEach(function (item) {
64
- if (hexo_fs_1.default.existsSync(`themes/shokaX/source/js/_app/${item}.js`)) {
65
- text += hexo_fs_1.default.readFileSync(`themes/shokaX/source/js/_app/${item}.js`).toString();
64
+ if (fs.existsSync(`themes/shokaX/source/js/_app/${item}.js`)) {
65
+ text += fs.readFileSync(`themes/shokaX/source/js/_app/${item}.js`).toString();
66
66
  }
67
67
  else {
68
- text += hexo_fs_1.default.readFileSync(`node_modules/hexo-theme-shokax/source/js/_app/${item}.js`).toString();
68
+ text += fs.readFileSync(`node_modules/hexo-theme-shokax/source/js/_app/${item}.js`).toString();
69
69
  }
70
70
  });
71
71
  if (!theme.experiments?.noPlayer) {
72
- if (hexo_fs_1.default.existsSync('themes/shokaX/source/js/_app/player.js')) {
73
- text += hexo_fs_1.default.readFileSync('themes/shokaX/source/js/_app/player.js').toString();
72
+ if (fs.existsSync('themes/shokaX/source/js/_app/player.js')) {
73
+ text += fs.readFileSync('themes/shokaX/source/js/_app/player.js').toString();
74
74
  }
75
75
  else {
76
- text += hexo_fs_1.default.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/player.js').toString();
76
+ text += fs.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/player.js').toString();
77
77
  }
78
78
  }
79
79
  if (theme.fireworks && theme.fireworks.enable) {
80
- if (hexo_fs_1.default.existsSync('themes/shokaX/source/js/_app/fireworks.js')) {
81
- text += hexo_fs_1.default.readFileSync('themes/shokaX/source/js/_app/fireworks.js').toString();
80
+ if (fs.existsSync('themes/shokaX/source/js/_app/fireworks.js')) {
81
+ text += fs.readFileSync('themes/shokaX/source/js/_app/fireworks.js').toString();
82
82
  }
83
83
  else {
84
- text += hexo_fs_1.default.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/fireworks.js').toString();
84
+ text += fs.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/fireworks.js').toString();
85
85
  }
86
86
  siteConfig.fireworks = theme.fireworks.color || ['rgba(255,182,185,.9)', 'rgba(250,227,217,.9)', 'rgba(187,222,214,.9)', 'rgba(138,198,209,.9)'];
87
87
  }
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const hexo_fs_1 = __importDefault(require("hexo-fs"));
3
+ const fs = require("hexo-fs");
7
4
  const prepareQuery = (categories, parent) => {
8
5
  const query = {
9
6
  parent: undefined
@@ -63,7 +60,7 @@ hexo.extend.helper.register('_categories', function () {
63
60
  categories.forEach((cat, i) => {
64
61
  const child = prepareQuery(categories, cat._id);
65
62
  const cover = 'source/_posts' + cat.path.replace(this.config.category_dir, '') + 'cover.jpg';
66
- if (hexo_fs_1.default.existsSync(cover)) {
63
+ if (fs.existsSync(cover)) {
67
64
  const className = cat.slug.split('/');
68
65
  className.pop();
69
66
  cat.class = className.join(' ');
@@ -1,4 +1,4 @@
1
- $mobile-wdith = hexo-config('experiments.mobileWidth')
1
+ $mobile-wdith = unquote(hexo-config('experiments.mobileWidth'))
2
2
 
3
3
  the-transition(duration = .2s, function = ease-in-out, delay = 0s, property = all) {
4
4
  transition:property duration function delay;
@@ -77,9 +77,9 @@ function createCircle(x, y) {
77
77
  };
78
78
  return p;
79
79
  }
80
- function renderParticule(anim) {
81
- for (let i = 0; i < anim.animatables.length; i++) {
82
- anim.animatables[i].target.draw();
80
+ function renderParticule(targets) {
81
+ for (const target of targets) {
82
+ target.draw();
83
83
  }
84
84
  }
85
85
  function animateParticules(x, y) {
@@ -88,31 +88,31 @@ function animateParticules(x, y) {
88
88
  for (let i = 0; i < numberOfParticules; i++) {
89
89
  particules.push(createParticule(x, y));
90
90
  }
91
- anime.timeline().add({
91
+ anime().timeline().add({
92
92
  targets: particules,
93
+ duration: anime.random(1200, 1800),
94
+ easing: 'easeOutExpo',
95
+ update: renderParticule,
93
96
  x: function (p) {
94
97
  return p.endPos.x;
95
98
  },
96
99
  y: function (p) {
97
100
  return p.endPos.y;
98
101
  },
99
- radius: 0.1,
100
- duration: anime.random(1200, 1800),
101
- easing: 'easeOutExpo',
102
- update: renderParticule
102
+ radius: 0.1
103
103
  }).add({
104
104
  targets: circle,
105
+ duration: anime.random(1200, 1800),
106
+ easing: 'easeOutExpo',
107
+ update: renderParticule,
105
108
  radius: anime.random(80, 160),
106
109
  lineWidth: 0,
107
110
  alpha: {
108
111
  value: 0,
109
112
  easing: 'linear',
110
113
  duration: anime.random(600, 800)
111
- },
112
- duration: anime.random(1200, 1800),
113
- easing: 'easeOutExpo',
114
- update: renderParticule
115
- }, 0);
114
+ }
115
+ }).play();
116
116
  }
117
117
  const render = anime({
118
118
  duration: Infinity,
@@ -127,7 +127,7 @@ const hasAncestor = function (node, name) {
127
127
  break;
128
128
  if (node.nodeName === name)
129
129
  return true;
130
- } while (node = node.parentNode);
130
+ } while ((node = node.parentNode) !== null);
131
131
  return false;
132
132
  };
133
133
  document.addEventListener(tap, function (e) {
@@ -192,7 +192,7 @@ const vendorCss = function (type, condition) {
192
192
  window['css' + type] = true;
193
193
  }
194
194
  };
195
- const transition = (target, type, complete) => {
195
+ const transition = (target, type, complete, begin) => {
196
196
  let animation;
197
197
  let display = 'none';
198
198
  switch (type) {
@@ -236,14 +236,14 @@ const transition = (target, type, complete) => {
236
236
  begin: function (anim) {
237
237
  target.display('block');
238
238
  },
239
- translateX: [100, 0],
239
+ translateX: ['100%', '0%'],
240
240
  opacity: [0, 1]
241
241
  };
242
242
  display = 'block';
243
243
  break;
244
244
  case 'slideRightOut':
245
245
  animation = {
246
- translateX: [0, 100],
246
+ translateX: ['0%', '100%'],
247
247
  opacity: [1, 0]
248
248
  };
249
249
  break;
@@ -255,11 +255,15 @@ const transition = (target, type, complete) => {
255
255
  anime(Object.assign({
256
256
  targets: target,
257
257
  duration: 200,
258
- easing: 'linear'
259
- }, animation)).finished.then(function () {
260
- target.display(display);
261
- complete && complete();
262
- });
258
+ easing: 'linear',
259
+ begin: function () {
260
+ begin && begin();
261
+ },
262
+ complete: function () {
263
+ target.display(display);
264
+ complete && complete();
265
+ }
266
+ }, animation)).play();
263
267
  };
264
268
  const pjaxScript = function (element) {
265
269
  const { text, parentNode, id, className, type, src, dataset } = element;
@@ -297,5 +301,5 @@ const pageScroll = function (target, offset, complete) {
297
301
  complete && complete();
298
302
  }
299
303
  };
300
- anime(opt);
304
+ anime(opt).play();
301
305
  };
@@ -616,7 +616,7 @@ const domInit = function () {
616
616
  const pjaxReload = function () {
617
617
  pagePosition();
618
618
  if (sideBar.hasClass('on')) {
619
- transition(sideBar, function () {
619
+ transition(sideBar, 0, function () {
620
620
  sideBar.removeClass('on');
621
621
  menuToggle.removeClass('close');
622
622
  });
@@ -37,6 +37,8 @@ Vue.createApp({
37
37
  }
38
38
  transition(neko, 1, function () {
39
39
  setTimeout(c, 210);
40
+ }, function () {
41
+ neko.display('block');
40
42
  });
41
43
  }
42
44
  }