hexo-theme-shokax 0.2.3 → 0.2.4
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 +1 -0
- package/_config.yml +2 -2
- package/package.json +14 -15
- package/scripts/generaters/config.js +3 -3
- package/scripts/generaters/images.js +4 -7
- package/scripts/generaters/index.js +7 -7
- package/scripts/generaters/script.js +10 -10
- package/scripts/helpers/list_categories.js +2 -5
- package/source/css/_mixins.styl +1 -1
- package/source/js/_app/fireworks.js +14 -14
- package/source/js/_app/library.js +13 -9
- package/source/js/_app/page.js +1 -1
- package/source/js/_app/vue.js +2 -0
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|

|
|
6
6
|

|
|
7
7
|

|
|
8
|
+

|
|
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:
|
|
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/
|
|
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
|
+
"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": "
|
|
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.
|
|
24
|
-
"@
|
|
25
|
-
"@typescript-eslint/
|
|
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.
|
|
30
|
-
"eslint": "^8.
|
|
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.
|
|
31
|
+
"eslint-plugin-n": "^15.7.0",
|
|
34
32
|
"eslint-plugin-promise": "^6.1.1",
|
|
35
|
-
"eslint-plugin-vue": "^9.
|
|
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.
|
|
36
|
+
"instantsearch.js": "^4.54.1",
|
|
39
37
|
"pjax": "^0.2.8",
|
|
40
|
-
"
|
|
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.
|
|
42
|
+
"vuepress-plugin-sitemap2": "2.0.0-beta.205"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
45
|
"js-yaml": "^4.1.0",
|
|
47
|
-
"sass": "^1.
|
|
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
|
|
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 (
|
|
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(
|
|
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
|
|
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 (!
|
|
7
|
+
if (!fs.existsSync(dir)) {
|
|
11
8
|
return;
|
|
12
9
|
}
|
|
13
10
|
const result = [];
|
|
14
|
-
const files =
|
|
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
|
|
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
|
|
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 (
|
|
34
|
+
if (fs.existsSync(cover + '/cover.avif')) {
|
|
35
35
|
covers.push({
|
|
36
36
|
path: cat.slug + '/cover.avif',
|
|
37
37
|
data: function () {
|
|
38
|
-
return
|
|
38
|
+
return fs.createReadStream(cover + '/cover.avif');
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
else if (
|
|
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
|
|
46
|
+
return fs.createReadStream(cover + '/cover.webp');
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
else if (
|
|
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
|
|
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
|
|
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 (
|
|
65
|
-
text +=
|
|
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 +=
|
|
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 (
|
|
73
|
-
text +=
|
|
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 +=
|
|
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 (
|
|
81
|
-
text +=
|
|
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 +=
|
|
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
|
|
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 (
|
|
63
|
+
if (fs.existsSync(cover)) {
|
|
67
64
|
const className = cat.slug.split('/');
|
|
68
65
|
className.pop();
|
|
69
66
|
cat.class = className.join(' ');
|
package/source/css/_mixins.styl
CHANGED
|
@@ -77,9 +77,9 @@ function createCircle(x, y) {
|
|
|
77
77
|
};
|
|
78
78
|
return p;
|
|
79
79
|
}
|
|
80
|
-
function renderParticule(
|
|
81
|
-
for (
|
|
82
|
-
|
|
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
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
};
|
package/source/js/_app/page.js
CHANGED
|
@@ -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
|
});
|