hexo-theme-gnix 7.0.0 → 9.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 (53) hide show
  1. package/README.md +6 -2
  2. package/include/hexo/encrypt.js +42 -0
  3. package/include/hexo/feed.js +330 -0
  4. package/include/util/common.js +7 -16
  5. package/languages/en.yml +5 -2
  6. package/languages/zh-CN.yml +5 -2
  7. package/layout/archive.jsx +8 -204
  8. package/layout/comment/twikoo.jsx +2 -11
  9. package/layout/common/article.jsx +45 -32
  10. package/layout/common/article_cover.jsx +11 -1
  11. package/layout/common/article_media.jsx +2 -4
  12. package/layout/common/footer.jsx +10 -14
  13. package/layout/common/head.jsx +7 -15
  14. package/layout/common/navbar.jsx +3 -18
  15. package/layout/common/scripts.jsx +6 -5
  16. package/layout/common/theme_selector.jsx +5 -6
  17. package/layout/common/toc.jsx +8 -14
  18. package/layout/index.jsx +2 -4
  19. package/layout/misc/open_graph.jsx +4 -4
  20. package/layout/misc/paginator.jsx +10 -4
  21. package/layout/misc/structured_data.jsx +3 -4
  22. package/layout/plugin/busuanzi.jsx +1 -1
  23. package/layout/plugin/cookie_consent.jsx +40 -31
  24. package/layout/plugin/swup.jsx +2 -22
  25. package/layout/search/insight.jsx +16 -3
  26. package/package.json +12 -8
  27. package/scripts/hot-reload.js +92 -0
  28. package/scripts/index.js +2 -0
  29. package/source/css/archive.css +251 -0
  30. package/source/css/default.css +300 -309
  31. package/source/css/encrypt.css +55 -0
  32. package/source/css/responsive/desktop.css +0 -119
  33. package/source/css/responsive/mobile.css +2 -22
  34. package/source/css/responsive/touch.css +9 -103
  35. package/source/css/twikoo.css +265 -249
  36. package/source/img/og_image.webp +0 -0
  37. package/source/js/archive-breadcrumb.js +1 -5
  38. package/source/js/busuanzi.js +1 -12
  39. package/source/js/components/chat.js +239 -0
  40. package/source/js/components/image-carousel.js +410 -0
  41. package/source/js/components/text-image-section.js +180 -0
  42. package/source/js/components/theme-stacked.js +165 -246
  43. package/source/js/components/tree.js +437 -0
  44. package/source/js/decrypt.js +112 -0
  45. package/source/js/insight.js +75 -65
  46. package/source/js/main.js +48 -31
  47. package/source/js/mdit/mermaid.js +12 -4
  48. package/source/js/swup.bundle.js +1 -0
  49. package/source/js/theme-selector.js +94 -113
  50. package/source/img/og_image.png +0 -0
  51. package/source/js/host/swup/Swup.umd.min.js +0 -1
  52. package/source/js/host/swup/head-plugin.umd.min.js +0 -1
  53. package/source/js/host/swup/scripts-plugin.umd.min.js +0 -2
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Text-Image Section Custom Element
3
+ * A responsive text-image layout component
4
+ *
5
+ * Usage:
6
+ * <text-image-section
7
+ * image="https://example.com/image.jpg"
8
+ * alt="Image description"
9
+ * width="300px"
10
+ * >
11
+ * Your text content here...
12
+ * </text-image-section>
13
+ *
14
+ * Attributes:
15
+ * - image: Image URL (required)
16
+ * - alt: Image alt text
17
+ * - width: Image width (default: 300px)
18
+ * - left: Put image on left (default: image on right)
19
+ * - font-family: Text font family
20
+ * - font-size: Text font size (default: 0.8rem)
21
+ * - color: Text color
22
+ */
23
+
24
+ let styleSheetInjected = false;
25
+
26
+ class TextImageSection extends HTMLElement {
27
+ constructor() {
28
+ super();
29
+ this._rendered = false;
30
+ }
31
+
32
+ connectedCallback() {
33
+ this.injectStyles();
34
+ this.render();
35
+ this.initZoom();
36
+ }
37
+
38
+ initZoom() {
39
+ if (typeof mediumZoom !== "function") return;
40
+ const img = this.querySelector(".ti-image img");
41
+ if (img) {
42
+ mediumZoom(img, { background: "hsla(from var(--mantle) / 0.9)" });
43
+ }
44
+ }
45
+
46
+ injectStyles() {
47
+ if (styleSheetInjected) return;
48
+
49
+ const style = `
50
+ text-image-section {
51
+ display: block;
52
+ margin: 1em 0;
53
+ }
54
+
55
+ .ti-container {
56
+ overflow: hidden;
57
+
58
+ &::after {
59
+ content: "";
60
+ display: table;
61
+ clear: both;
62
+ }
63
+ }
64
+
65
+ .ti-text {
66
+ line-height: 1.8;
67
+ font-family: var(--ti-font-family, inherit);
68
+ font-size: var(--ti-font-size, 1rem);
69
+ color: var(--ti-color, inherit);
70
+ }
71
+
72
+ .ti-image {
73
+ position: relative;
74
+ z-index: 1;
75
+ width: var(--ti-image-width, 300px);
76
+ margin-bottom: 12px;
77
+
78
+ .ti-container > & {
79
+ float: right;
80
+ margin-left: 24px;
81
+ }
82
+
83
+ .image-left > & {
84
+ float: left;
85
+ margin-left: 0;
86
+ margin-right: 24px;
87
+ }
88
+
89
+ img {
90
+ width: 100%;
91
+ height: auto;
92
+ border-radius: 8px;
93
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
94
+ }
95
+
96
+ figure {
97
+ margin: 0;
98
+ }
99
+
100
+ figcaption {
101
+ font-family: var(--font-serif);
102
+ font-size: 0.875em;
103
+ color: var(--subtext0);
104
+ text-align: center;
105
+ margin-top: 8px;
106
+ font-style: italic;
107
+ }
108
+ }
109
+
110
+ @media (max-width: 640px) {
111
+ .ti-image {
112
+ float: none;
113
+ width: 100%;
114
+ margin: 0 0 16px 0;
115
+ --ti-image-width: 100%;
116
+ }
117
+ }
118
+ `;
119
+
120
+ const styleEl = document.createElement("style");
121
+ styleEl.textContent = style;
122
+ document.head.appendChild(styleEl);
123
+ styleSheetInjected = true;
124
+ }
125
+
126
+ render() {
127
+ if (this._rendered) return;
128
+ this._rendered = true;
129
+
130
+ const image = this.getAttribute("image");
131
+ const alt = this.getAttribute("alt") || "";
132
+ const imageWidth = this.getAttribute("width") || "300px";
133
+ const imageLeft = this.hasAttribute("left");
134
+ const fontFamily = this.getAttribute("font-family");
135
+ const fontSize = this.getAttribute("font-size");
136
+ const color = this.getAttribute("color");
137
+ const contentNodes = Array.from(this.childNodes).filter((node) => {
138
+ return node.nodeType !== Node.ELEMENT_NODE || node.tagName.toLowerCase() !== "text-image-section";
139
+ });
140
+
141
+ const content = contentNodes
142
+ .map((node) => {
143
+ return node.nodeType === Node.TEXT_NODE ? node.textContent : node.outerHTML;
144
+ })
145
+ .join("")
146
+ .trim();
147
+
148
+ if (!image) {
149
+ this.innerHTML = `<div class="ti-container"><div class="ti-text">${content}</div></div>`;
150
+ return;
151
+ }
152
+
153
+ const containerClass = imageLeft ? "ti-container image-left" : "ti-container";
154
+
155
+ const figureHtml = alt
156
+ ? `<figure>
157
+ <img src="${image}" alt="${alt}" loading="lazy">
158
+ <figcaption>${alt}</figcaption>
159
+ </figure>`
160
+ : `<img src="${image}" alt="${alt}" loading="lazy">`;
161
+
162
+ const styleAttrs = [];
163
+ styleAttrs.push(`--ti-image-width: ${imageWidth};`);
164
+ if (fontFamily) styleAttrs.push(`--ti-font-family: ${fontFamily};`);
165
+ if (fontSize) styleAttrs.push(`--ti-font-size: ${fontSize};`);
166
+ if (color) styleAttrs.push(`--ti-color: ${color};`);
167
+ this.innerHTML = `
168
+ <div class="${containerClass}" style="${styleAttrs.join(" ")}">
169
+ <div class="ti-image">
170
+ ${figureHtml}
171
+ </div>
172
+ <div class="ti-text">${content}</div>
173
+ </div>
174
+ `;
175
+ }
176
+ }
177
+
178
+ customElements.define("text-image-section", TextImageSection);
179
+
180
+ export { TextImageSection };