hexo-theme-gnix 12.0.0 → 14.0.0

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 (45) hide show
  1. package/README.md +2 -0
  2. package/include/hexo/generator/archive.js +14 -1
  3. package/include/hexo/generator/index.js +0 -5
  4. package/include/hexo/generator/page.js +18 -4
  5. package/include/hexo/generator/tag.js +1 -1
  6. package/include/hexo/helper.js +0 -4
  7. package/include/hexo/i18n.js +31 -136
  8. package/include/hexo/obsidian-callouts.js +210 -0
  9. package/include/hexo/renderer.js +4 -14
  10. package/include/hexo/shiki.js +191 -0
  11. package/include/hexo/sitemap.js +184 -0
  12. package/include/util/i18n.js +92 -106
  13. package/languages/en.yml +4 -10
  14. package/languages/zh-CN.yml +4 -10
  15. package/layout/archive.jsx +155 -78
  16. package/layout/common/article.jsx +94 -108
  17. package/layout/common/article_cover.jsx +3 -3
  18. package/layout/common/article_info.jsx +11 -48
  19. package/layout/common/article_media.jsx +9 -2
  20. package/layout/common/footer.jsx +17 -106
  21. package/layout/common/head.jsx +3 -15
  22. package/layout/common/navbar.jsx +24 -87
  23. package/layout/common/scripts.jsx +1 -1
  24. package/layout/layout.jsx +37 -19
  25. package/layout/plugin/goatcounter.jsx +25 -0
  26. package/layout/tag.jsx +3 -70
  27. package/layout/tags.jsx +26 -23
  28. package/package.json +7 -13
  29. package/scripts/index.js +1 -0
  30. package/source/css/archive.css +287 -168
  31. package/source/css/callout_blocks.css +41 -21
  32. package/source/css/default.css +154 -132
  33. package/source/css/optional/mermaid.css +12 -6
  34. package/source/css/responsive.css +1 -45
  35. package/source/css/shiki/shiki.css +5 -4
  36. package/source/css/tags.css +53 -59
  37. package/source/js/components/archive-popup.js +313 -0
  38. package/source/js/components/friends-list.js +270 -0
  39. package/source/js/components/x-info-card.js +297 -0
  40. package/source/js/main.js +38 -34
  41. package/source/js/mdit/mermaid.js +10 -0
  42. package/include/hexo/generator/home.js +0 -64
  43. package/layout/index.jsx +0 -19
  44. package/layout/misc/paginator.jsx +0 -69
  45. package/source/js/host/iconify-icon/3.0.2/iconify-icon.min.js +0 -12
package/layout/tag.jsx CHANGED
@@ -1,75 +1,8 @@
1
- const { Component, Fragment } = require("../include/util/common");
2
- const Index = require("./index");
3
-
4
- const breadcrumb_css = `
5
- /* 定义闪烁动画 */
6
- @keyframes blink {
7
- 0%, 100% { opacity: 1; }
8
- 50% { opacity: 0; }
9
- }
10
-
11
- .breadcrumb {
12
- color: var(--blue);
13
- white-space: nowrap;
14
- font-family: var(--font-mono);
15
-
16
- a {
17
- align-items: center;
18
- display: flex;
19
- justify-content: center;
20
- padding: 0 0.1em;
21
- }
22
-
23
- ul {
24
- padding-inline-start: 1em;
25
- align-items: flex-start;
26
- display: flex;
27
- flex-wrap: wrap;
28
- justify-content: flex-start;
29
- }
30
-
31
- li {
32
- align-items: center;
33
- display: flex;
34
- a {
35
- color: var(--yellow);
36
- }
37
- }
38
-
39
- .cursor {
40
- display: inline-block;
41
- color: var(--mauve);
42
- font-weight: bold;
43
- margin-left: 2px;
44
- animation: blink 1s step-end infinite;
45
- }
46
- }`;
1
+ const { Component } = require("../include/util/common");
2
+ const Archive = require("./archive");
47
3
 
48
4
  module.exports = class extends Component {
49
5
  render() {
50
- const { config, page, helper } = this.props;
51
- const { _p } = helper;
52
- const langKey = helper.language_key(page);
53
-
54
- return (
55
- <Fragment>
56
- <style>{breadcrumb_css}</style>
57
- <nav class="breadcrumb" aria-label="breadcrumbs">
58
- <ul>
59
- <li>
60
- <font style="color: var(--green)">$</font>&nbsp;ls&nbsp;
61
- <a href={helper.localized_url_for("/tags/", langKey)}>{_p("common.tag", Infinity)}/</a>
62
- </li>
63
- <li>
64
- <a href="#" aria-current="page" style="cursor: default; pointer-events: none; color: var(--mauve);">
65
- {page.tag}
66
- </a>
67
- <span class="cursor">_</span>
68
- </li>
69
- </ul>
70
- </nav>
71
- <Index config={config} page={page} helper={helper} />
72
- </Fragment>
73
- );
6
+ return <Archive {...this.props} />;
74
7
  }
75
8
  };
package/layout/tags.jsx CHANGED
@@ -1,6 +1,23 @@
1
1
  const { Component, Fragment, cacheComponent } = require("../include/util/common");
2
2
  const { filterByLanguage } = require("../include/util/i18n");
3
3
 
4
+ function toRoman(num) {
5
+ const map = [
6
+ [1000, "M"], [900, "CM"], [500, "D"], [400, "CD"],
7
+ [100, "C"], [90, "XC"], [50, "L"], [40, "XL"],
8
+ [10, "X"], [9, "IX"], [5, "V"], [4, "IV"], [1, "I"],
9
+ ];
10
+ let n = num;
11
+ let out = "";
12
+ for (const [value, sym] of map) {
13
+ while (n >= value) {
14
+ out += sym;
15
+ n -= value;
16
+ }
17
+ }
18
+ return out;
19
+ }
20
+
4
21
  function getTagSize(count, maxCount) {
5
22
  const ratio = maxCount ? count / maxCount : 0;
6
23
  return `${(0.95 + ratio * 0.35).toFixed(3)}rem`;
@@ -8,7 +25,7 @@ function getTagSize(count, maxCount) {
8
25
 
9
26
  class Tags extends Component {
10
27
  render() {
11
- const { cssUrl, tags, title, showCount, totalPosts, topTag } = this.props;
28
+ const { cssUrl, tags, title, showCount } = this.props;
12
29
 
13
30
  return (
14
31
  <Fragment>
@@ -16,26 +33,16 @@ class Tags extends Component {
16
33
  <main class="tags-page">
17
34
  <header class="tags-hero">
18
35
  <div>
19
- <p class="tags-eyebrow">Topic Index</p>
20
- <h1>{title}</h1>
21
- <p class="tags-hero__summary">
22
- {tags.length ? `Browse ${tags.length} topics across ${totalPosts} tagged ${totalPosts === 1 ? "post" : "posts"}.` : "No tagged posts are available yet."}
36
+ <p class="tags-eyebrow">
37
+ <span>Topic Index</span>
38
+ <span class="tags-hero__sep" aria-hidden="true">·</span>
39
+ <span>{tags.length} {tags.length === 1 ? "topic" : "topics"}</span>
23
40
  </p>
41
+ <h1>{title}</h1>
24
42
  </div>
25
- <dl class="tags-stats" aria-label="Tags summary">
26
- <div>
27
- <dt>Tags</dt>
28
- <dd>{tags.length}</dd>
29
- </div>
30
- <div>
31
- <dt>Posts</dt>
32
- <dd>{totalPosts}</dd>
33
- </div>
34
- <div>
35
- <dt>Largest</dt>
36
- <dd>{topTag ? topTag.name : "None"}</dd>
37
- </div>
38
- </dl>
43
+ {tags.length > 0 && (
44
+ <span class="tags-hero__roman" aria-hidden="true">{toRoman(tags.length)}</span>
45
+ )}
39
46
  </header>
40
47
 
41
48
  <nav class="tags-index" aria-label={title}>
@@ -87,15 +94,11 @@ Tags.Cacheable = cacheComponent(Tags, "page.tags", (props) => {
87
94
  };
88
95
  });
89
96
  const maxCount = mappedTags.reduce((max, tag) => Math.max(max, tag.count), 0);
90
- const totalPosts = mappedTags.reduce((total, tag) => total + tag.count, 0);
91
- const topTag = mappedTags.reduce((top, tag) => (tag.count > top.count ? tag : top), mappedTags[0]);
92
97
 
93
98
  return {
94
99
  cssUrl: helper.url_for("/css/tags.css"),
95
100
  showCount: show_count,
96
101
  title: _p("common.tag", Infinity),
97
- totalPosts,
98
- topTag,
99
102
  tags: mappedTags.map((tag) => ({
100
103
  ...tag,
101
104
  size: getTagSize(tag.count, maxCount),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-gnix",
3
- "version": "12.0.0",
3
+ "version": "14.0.0",
4
4
  "author": "Efterklang <gaojiaxing0220@gmail.com> (https://vluv.space)",
5
5
  "license": "MIT",
6
6
  "description": "Second generation of Hexo theme Icarus, now with Catppuccin flavor and night mode support.",
@@ -21,8 +21,7 @@
21
21
  "lint": "biome check --write .",
22
22
  "format": "biome format .",
23
23
  "check": "biome check",
24
- "test": "node test/md_generator.test.js",
25
- "build:swup": "cp src/swup.js source/js/swup.js"
24
+ "test": "node test/md_generator.test.js"
26
25
  },
27
26
  "files": [
28
27
  "include",
@@ -34,8 +33,6 @@
34
33
  "README.md"
35
34
  ],
36
35
  "dependencies": {
37
- "@swup/head-plugin": "^2.3.1",
38
- "@swup/scripts-plugin": "^2.1.0",
39
36
  "esbuild": "^0.28.0",
40
37
  "feedsmith": "^2.9.4",
41
38
  "hexo-pagination": "^4.0.0",
@@ -46,19 +43,16 @@
46
43
  "markdown-exit": "^1.0.0-beta.9",
47
44
  "markdown-exit-mermaid": "^2.2.3",
48
45
  "markdown-exit-ratex": "^0.2.2",
49
- "markdown-exit-shiki": "^0.3.2",
50
- "markdown-it-abbr": "^2.0.0",
46
+ "@shikijs/colorized-brackets": "^4.1.0",
47
+ "@shikijs/transformers": "^4.1.0",
48
+ "shiki": "^4.1.0",
51
49
  "markdown-it-anchor": "^9.2.0",
52
50
  "markdown-it-footnote": "^4.0.0",
53
- "markdown-it-ins": "^4.0.0",
54
51
  "markdown-it-mark": "^4.0.0",
55
- "markdown-it-sub": "^2.0.0",
56
- "markdown-it-sup": "^2.0.0",
57
52
  "markdown-it-task-lists": "^2.1.1",
58
- "swup": "^4.8.3"
53
+ "hexo-util": "^4.0.0"
59
54
  },
60
55
  "peerDependencies": {
61
- "hexo": "^8.1.1",
62
- "hexo-util": "^4.0.0"
56
+ "hexo": "^8.1.2"
63
57
  }
64
58
  }
package/scripts/index.js CHANGED
@@ -2,6 +2,7 @@ require("../include/hexo/i18n")(hexo);
2
2
  require("../include/hexo/filter")(hexo);
3
3
  require("../include/hexo/generator")(hexo);
4
4
  require("../include/hexo/feed")(hexo);
5
+ require("../include/hexo/sitemap")(hexo);
5
6
  require("../include/hexo/encrypt")(hexo);
6
7
  require("../include/hexo/view").init(hexo);
7
8
  require("../include/hexo/helper")(hexo);