hexo-component-inferno 4.0.0 → 4.2.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.
- package/LICENSE +21 -0
- package/README.md +159 -8
- package/asset/js/algolia.js +27 -10
- package/asset/js/insight.js +62 -44
- package/lib/core/migrate.js +23 -4
- package/lib/core/schema.js +31 -9
- package/lib/core/view.js +1 -1
- package/lib/hexo/filter/locals.js +5 -2
- package/lib/hexo/generator/category.js +8 -1
- package/lib/hexo/generator/insight.js +8 -15
- package/lib/hexo/generator/manifest.js +6 -0
- package/lib/hexo/helper/cdn.js +11 -3
- package/lib/hexo/tag/message.js +11 -1
- package/lib/hexo/tag/tabs.js +28 -5
- package/lib/schema/comment/artalk.json +37 -0
- package/lib/schema/comment/beaudar.json +62 -0
- package/lib/schema/comment/cusdis.json +34 -0
- package/lib/schema/comment/giscus.json +12 -1
- package/lib/schema/comment/gitment.json +1 -1
- package/lib/schema/comment/utterances.json +15 -1
- package/lib/schema/comment/valine.json +1 -1
- package/lib/schema/comment/waline.json +2 -2
- package/lib/schema/misc/open_graph.json +0 -1
- package/lib/schema/plugin/waline_pageview.json +14 -0
- package/lib/schema/share/addthis.json +1 -1
- package/lib/schema/widget/archives.json +28 -0
- package/lib/schema/widget/categories.json +32 -0
- package/lib/schema/widget/recent_posts.json +5 -0
- package/lib/schema/widget/subscribe_email.json +1 -1
- package/lib/schema/widget/tags.json +1 -1
- package/lib/util/appearance.js +40 -0
- package/lib/util/classname.js +1 -1
- package/lib/util/deprecate.js +28 -0
- package/lib/util/html.js +51 -0
- package/lib/util/i18n.js +24 -0
- package/lib/util/script.js +73 -5
- package/lib/view/comment/artalk.js +119 -0
- package/lib/view/comment/beaudar.js +134 -0
- package/lib/view/comment/changyan.js +2 -1
- package/lib/view/comment/cusdis.js +120 -0
- package/lib/view/comment/disqus.js +3 -1
- package/lib/view/comment/disqusjs.js +3 -2
- package/lib/view/comment/facebook.js +3 -1
- package/lib/view/comment/giscus.js +32 -21
- package/lib/view/comment/gitalk.js +4 -2
- package/lib/view/comment/gitment.js +7 -2
- package/lib/view/comment/isso.js +5 -1
- package/lib/view/comment/twikoo.js +5 -1
- package/lib/view/comment/utterances.js +26 -16
- package/lib/view/comment/valine.js +7 -1
- package/lib/view/comment/waline.js +31 -21
- package/lib/view/donate/afdian.js +1 -1
- package/lib/view/donate/alipay.js +1 -1
- package/lib/view/donate/buymeacoffee.js +1 -1
- package/lib/view/donate/patreon.js +1 -1
- package/lib/view/donate/wechat.js +1 -1
- package/lib/view/misc/meta.js +9 -3
- package/lib/view/misc/open_graph.js +12 -15
- package/lib/view/misc/structured_data.js +8 -9
- package/lib/view/misc/web_app.js +15 -6
- package/lib/view/plugin/baidu_analytics.js +3 -1
- package/lib/view/plugin/cookie_consent.js +3 -1
- package/lib/view/plugin/google_analytics.js +3 -1
- package/lib/view/plugin/hotjar.js +3 -1
- package/lib/view/plugin/matomo.js +3 -1
- package/lib/view/plugin/outdated_browser.js +1 -1
- package/lib/view/plugin/statcounter.js +3 -1
- package/lib/view/plugin/twitter_conversion_tracking.js +3 -1
- package/lib/view/plugin/waline_pageview.js +100 -0
- package/lib/view/search/algolia.js +3 -1
- package/lib/view/search/baidu.js +3 -1
- package/lib/view/search/google_cse.js +3 -1
- package/lib/view/search/insight.js +4 -2
- package/lib/view/share/addthis.js +4 -0
- package/lib/view/widget/archives.js +37 -9
- package/lib/view/widget/categories.js +41 -15
- package/lib/view/widget/links.js +1 -1
- package/lib/view/widget/subscribe_email.js +5 -0
- package/lib/view/widget/tags.js +18 -5
- package/package.json +4 -2
|
@@ -22,6 +22,21 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var _require3 = require('../../util/i18n'),
|
|
26
|
+
translate = _require3.translate;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the first value that is set, i.e., neither null nor undefined.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
function firstSet() {
|
|
33
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
+
values[_key] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
return values.find(function (value) {
|
|
37
|
+
return value !== null && typeof value !== 'undefined';
|
|
38
|
+
});
|
|
39
|
+
}
|
|
25
40
|
|
|
26
41
|
/**
|
|
27
42
|
* Categories widget JSX component.
|
|
@@ -66,8 +81,14 @@ var Categories = /*#__PURE__*/function (_Component) {
|
|
|
66
81
|
var _this$props = this.props,
|
|
67
82
|
title = _this$props.title,
|
|
68
83
|
showCount = _this$props.showCount,
|
|
69
|
-
categories = _this$props.categories
|
|
70
|
-
|
|
84
|
+
categories = _this$props.categories,
|
|
85
|
+
moreUrl = _this$props.moreUrl,
|
|
86
|
+
moreTitle = _this$props.moreTitle;
|
|
87
|
+
return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", (0, _inferno.createVNode)(1, "div", "menu", [(0, _inferno.createVNode)(1, "h3", "menu-label", title, 0), (0, _inferno.createVNode)(1, "ul", "menu-list", [this.renderList(categories, showCount), moreUrl ? (0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "level is-mobile", [(0, _inferno.createVNode)(1, "span", "level-start", (0, _inferno.createVNode)(1, "span", "level-item", moreTitle, 0), 2), (0, _inferno.createVNode)(1, "span", "level-end", (0, _inferno.createVNode)(1, "span", "level-item icon is-small", (0, _inferno.createVNode)(1, "i", "fas fa-chevron-right"), 2, {
|
|
88
|
+
"aria-hidden": "true"
|
|
89
|
+
}), 2)], 4, {
|
|
90
|
+
"href": moreUrl
|
|
91
|
+
}), 2) : null], 0)], 4), 2), 2, {
|
|
71
92
|
"data-type": "categories"
|
|
72
93
|
});
|
|
73
94
|
}
|
|
@@ -106,23 +127,22 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
|
|
|
106
127
|
widget = _props$widget === void 0 ? {} : _props$widget;
|
|
107
128
|
var _widget$categories = widget.categories,
|
|
108
129
|
categories = _widget$categories === void 0 ? props.site.categories : _widget$categories,
|
|
109
|
-
_widget$orderBy = widget.orderBy,
|
|
110
|
-
orderBy = _widget$orderBy === void 0 ? 'name' : _widget$orderBy,
|
|
111
130
|
_widget$order = widget.order,
|
|
112
131
|
order = _widget$order === void 0 ? 1 : _widget$order,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
132
|
+
amount = widget.amount;
|
|
133
|
+
// Snake case, like the tags widget, or camel case, which this widget used to read
|
|
134
|
+
var orderBy = firstSet(widget.order_by, widget.orderBy, 'name');
|
|
135
|
+
var showCurrent = firstSet(widget.show_current, widget.showCurrent, false);
|
|
136
|
+
var showCount = firstSet(widget.show_count, widget.showCount, true);
|
|
117
137
|
var url_for = helper.url_for,
|
|
118
|
-
_p = helper._p
|
|
138
|
+
_p = helper._p,
|
|
139
|
+
__ = helper.__;
|
|
119
140
|
if (!categories || !categories.length) {
|
|
120
141
|
return null;
|
|
121
142
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} catch (e) {}
|
|
143
|
+
|
|
144
|
+
// 0 or no depth shows all levels
|
|
145
|
+
var depth = parseInt(firstSet(widget.depth, props.depth), 10) || 0;
|
|
126
146
|
function prepareQuery(parent) {
|
|
127
147
|
var query = {};
|
|
128
148
|
if (parent) {
|
|
@@ -163,10 +183,16 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
|
|
|
163
183
|
};
|
|
164
184
|
});
|
|
165
185
|
}
|
|
186
|
+
|
|
187
|
+
// Only limit the top-level categories, and link to the category page when some are not shown
|
|
188
|
+
var list = hierarchicalList(0);
|
|
189
|
+
var hasMore = amount > 0 && list.length > amount;
|
|
166
190
|
return {
|
|
167
191
|
showCount: showCount,
|
|
168
|
-
categories:
|
|
169
|
-
title: _p('common.category', Infinity)
|
|
192
|
+
categories: hasMore ? list.slice(0, amount) : list,
|
|
193
|
+
title: _p('common.category', Infinity),
|
|
194
|
+
moreUrl: hasMore ? url_for('categories/') : null,
|
|
195
|
+
moreTitle: translate(__, 'widget.more', 'More')
|
|
170
196
|
};
|
|
171
197
|
});
|
|
172
198
|
module.exports = Categories;
|
package/lib/view/widget/links.js
CHANGED
|
@@ -95,7 +95,7 @@ var Links = /*#__PURE__*/function (_Component) {
|
|
|
95
95
|
Links.Cacheable = cacheComponent(Links, 'widget.links', function (props) {
|
|
96
96
|
var helper = props.helper,
|
|
97
97
|
widget = props.widget;
|
|
98
|
-
if (!Object.keys(widget.links).length) {
|
|
98
|
+
if (!widget.links || !Object.keys(widget.links).length) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
return {
|
|
@@ -22,10 +22,14 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var _require3 = require('../../util/deprecate'),
|
|
26
|
+
deprecate = _require3.deprecate;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Google FeedBurner widget JSX component.
|
|
28
30
|
*
|
|
31
|
+
* @deprecated Google FeedBurner stopped email subscriptions in July 2021. Use the follow.it widget
|
|
32
|
+
* instead.
|
|
29
33
|
* @see https://feedburner.google.com/
|
|
30
34
|
* @example
|
|
31
35
|
* <SubscribeEmail
|
|
@@ -43,6 +47,7 @@ var SubscribeEmail = /*#__PURE__*/function (_Component) {
|
|
|
43
47
|
return _createClass(SubscribeEmail, [{
|
|
44
48
|
key: "render",
|
|
45
49
|
value: function render() {
|
|
50
|
+
deprecate('widget.subscribe_email', 'Google FeedBurner stopped email subscriptions in July 2021. Use the follow.it widget instead.');
|
|
46
51
|
var _this$props = this.props,
|
|
47
52
|
title = _this$props.title,
|
|
48
53
|
description = _this$props.description,
|
package/lib/view/widget/tags.js
CHANGED
|
@@ -22,6 +22,8 @@ var _require = require('inferno'),
|
|
|
22
22
|
Component = _require.Component;
|
|
23
23
|
var _require2 = require('../../util/cache'),
|
|
24
24
|
cacheComponent = _require2.cacheComponent;
|
|
25
|
+
var _require3 = require('../../util/i18n'),
|
|
26
|
+
translate = _require3.translate;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Tags widget JSX component.
|
|
@@ -50,12 +52,18 @@ var Tags = /*#__PURE__*/function (_Component) {
|
|
|
50
52
|
var _this$props = this.props,
|
|
51
53
|
tags = _this$props.tags,
|
|
52
54
|
title = _this$props.title,
|
|
53
|
-
showCount = _this$props.showCount
|
|
54
|
-
|
|
55
|
+
showCount = _this$props.showCount,
|
|
56
|
+
moreUrl = _this$props.moreUrl,
|
|
57
|
+
moreTitle = _this$props.moreTitle;
|
|
58
|
+
return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", (0, _inferno.createVNode)(1, "div", "menu", [(0, _inferno.createVNode)(1, "h3", "menu-label", title, 0), (0, _inferno.createVNode)(1, "div", "field is-grouped is-grouped-multiline", [tags.map(function (tag) {
|
|
55
59
|
return (0, _inferno.createVNode)(1, "div", "control", (0, _inferno.createVNode)(1, "a", "tags has-addons", [(0, _inferno.createVNode)(1, "span", "tag", tag.name, 0), showCount ? (0, _inferno.createVNode)(1, "span", "tag", tag.count, 0) : null], 0, {
|
|
56
60
|
"href": tag.url
|
|
57
61
|
}), 2);
|
|
58
|
-
}), 0)
|
|
62
|
+
}), moreUrl ? (0, _inferno.createVNode)(1, "div", "control", (0, _inferno.createVNode)(1, "a", "tags has-addons", (0, _inferno.createVNode)(1, "span", "tag", [(0, _inferno.createVNode)(1, "span", null, moreTitle, 0), (0, _inferno.createVNode)(1, "span", "icon is-small", (0, _inferno.createVNode)(1, "i", "fas fa-chevron-right"), 2, {
|
|
63
|
+
"aria-hidden": "true"
|
|
64
|
+
})], 4), 2, {
|
|
65
|
+
"href": moreUrl
|
|
66
|
+
}), 2) : null], 0)], 4), 2), 2, {
|
|
59
67
|
"data-type": "tags"
|
|
60
68
|
});
|
|
61
69
|
}
|
|
@@ -94,19 +102,24 @@ Tags.Cacheable = cacheComponent(Tags, 'widget.tags', function (props) {
|
|
|
94
102
|
show_count = _widget$show_count === void 0 ? true : _widget$show_count;
|
|
95
103
|
var tags = props.tags || props.site.tags;
|
|
96
104
|
var url_for = helper.url_for,
|
|
97
|
-
_p = helper._p
|
|
105
|
+
_p = helper._p,
|
|
106
|
+
__ = helper.__;
|
|
98
107
|
if (!tags || !tags.length) {
|
|
99
108
|
return null;
|
|
100
109
|
}
|
|
101
110
|
tags = tags.sort(order_by).filter(function (tag) {
|
|
102
111
|
return tag.length;
|
|
103
112
|
});
|
|
104
|
-
|
|
113
|
+
// Link to the tag page when some of the tags are not shown
|
|
114
|
+
var hasMore = amount > 0 && tags.length > amount;
|
|
115
|
+
if (hasMore) {
|
|
105
116
|
tags = tags.limit(amount);
|
|
106
117
|
}
|
|
107
118
|
return {
|
|
108
119
|
showCount: show_count,
|
|
109
120
|
title: _p('common.tag', Infinity),
|
|
121
|
+
moreUrl: hasMore ? url_for('tags/') : null,
|
|
122
|
+
moreTitle: translate(__, 'widget.more', 'More'),
|
|
110
123
|
tags: tags.map(function (tag) {
|
|
111
124
|
return {
|
|
112
125
|
name: tag.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-component-inferno",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "A collection of Inferno.js layout components and utility scripts for Hexo",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": "https://github.com/ppoffice/hexo-component-inferno",
|
|
@@ -44,13 +44,15 @@
|
|
|
44
44
|
"eslint-plugin-jest": "^27.6.3",
|
|
45
45
|
"eslint-plugin-json": "^3.1.0",
|
|
46
46
|
"eslint-plugin-react": "^7.33.2",
|
|
47
|
-
"hexo": "^
|
|
47
|
+
"hexo": "^8.1.2",
|
|
48
48
|
"hexo-renderer-marked": "^6.2.0",
|
|
49
49
|
"html-minifier": "^4.0.0",
|
|
50
50
|
"inferno-server": "^8.2.3",
|
|
51
51
|
"inferno-test-utils": "^8.2.3",
|
|
52
52
|
"jest": "^29.7.0",
|
|
53
53
|
"jest-environment-jsdom": "^29.7.0",
|
|
54
|
+
"jquery": "^3.7.1",
|
|
55
|
+
"jsdom": "^20.0.3",
|
|
54
56
|
"jsdoc": "^4.0.2",
|
|
55
57
|
"minami": "^1.2.3",
|
|
56
58
|
"prettier": "^3.2.4",
|