hexo-component-inferno 4.2.2 → 5.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 (69) hide show
  1. package/README.md +5 -18
  2. package/asset/css/github-calendar.css +41 -0
  3. package/asset/js/algolia.js +18 -69
  4. package/asset/js/github-calendar.js +185 -0
  5. package/asset/js/google_cse.js +19 -68
  6. package/asset/js/insight.js +45 -208
  7. package/lib/core/commented_yaml.js +35 -0
  8. package/lib/core/default_value.js +150 -0
  9. package/lib/core/schema.js +8 -196
  10. package/lib/core/schema_util.js +14 -0
  11. package/lib/hexo/helper/cdn.js +10 -97
  12. package/lib/hexo/tag/tabs.js +4 -84
  13. package/lib/schema/comment/artalk.json +7 -1
  14. package/lib/schema/comment/facebook.json +1 -1
  15. package/lib/schema/comment/gitalk.json +23 -6
  16. package/lib/schema/comment/gitment.json +1 -1
  17. package/lib/schema/comment/twikoo.json +3 -3
  18. package/lib/schema/comment/waline.json +28 -3
  19. package/lib/schema/misc/open_graph.json +2 -1
  20. package/lib/schema/plugin/cookie_consent.json +2 -2
  21. package/lib/schema/plugin/mathjax.json +1 -1
  22. package/lib/schema/plugin/outdated_browser.json +1 -1
  23. package/lib/schema/share/bdshare.json +1 -1
  24. package/lib/schema/share/sharejs.json +1 -1
  25. package/lib/schema/share/web_share.json +13 -0
  26. package/lib/schema/widget/github_calendar.json +30 -0
  27. package/lib/schema/widget/profile.json +67 -0
  28. package/lib/util/archives.js +86 -0
  29. package/lib/util/categories.js +102 -0
  30. package/lib/util/cdn-rules.js +109 -0
  31. package/lib/util/cdn.js +116 -0
  32. package/lib/util/consent.js +122 -0
  33. package/lib/util/deprecate.js +1 -1
  34. package/lib/util/gallery.js +227 -0
  35. package/lib/util/insight-search.js +98 -0
  36. package/lib/util/searchbox.js +88 -0
  37. package/lib/util/tab-options.js +109 -0
  38. package/lib/view/comment/artalk.js +24 -6
  39. package/lib/view/comment/disqus.js +1 -1
  40. package/lib/view/comment/disqusjs.js +7 -6
  41. package/lib/view/comment/facebook.js +3 -16
  42. package/lib/view/comment/gitalk.js +18 -15
  43. package/lib/view/comment/gitment.js +2 -2
  44. package/lib/view/comment/twikoo.js +5 -3
  45. package/lib/view/comment/valine.js +4 -3
  46. package/lib/view/comment/waline.js +8 -6
  47. package/lib/view/misc/open_graph.js +3 -5
  48. package/lib/view/plugin/cookie_consent.js +8 -7
  49. package/lib/view/plugin/gallery.js +42 -19
  50. package/lib/view/plugin/katex.js +4 -4
  51. package/lib/view/plugin/mathjax.js +10 -7
  52. package/lib/view/plugin/outdated_browser.js +59 -45
  53. package/lib/view/plugin/progressbar.js +6 -1
  54. package/lib/view/plugin/waline_pageview.js +2 -2
  55. package/lib/view/search/algolia.js +8 -3
  56. package/lib/view/search/google_cse.js +13 -10
  57. package/lib/view/search/insight.js +9 -2
  58. package/lib/view/share/addthis.js +4 -9
  59. package/lib/view/share/addtoany.js +23 -5
  60. package/lib/view/share/bdshare.js +9 -30
  61. package/lib/view/share/sharejs.js +7 -34
  62. package/lib/view/share/sharethis.js +21 -6
  63. package/lib/view/share/web_share.js +153 -0
  64. package/lib/view/widget/archives.js +19 -71
  65. package/lib/view/widget/categories.js +20 -67
  66. package/lib/view/widget/github_calendar.js +94 -0
  67. package/lib/view/widget/profile.js +194 -0
  68. package/lib/view/widget/subscribe_email.js +4 -26
  69. package/package.json +6 -4
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+
3
+ var _inferno = require("inferno");
4
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
6
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
7
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
+ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
10
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
12
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
13
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
15
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
16
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
+ /**
18
+ * Author profile widget JSX component.
19
+ * @module view/widget/profile
20
+ */
21
+ var _require = require('inferno'),
22
+ Component = _require.Component;
23
+ var _require2 = require('hexo-util'),
24
+ gravatarHelper = _require2.gravatar;
25
+ var _require3 = require('../../util/cache'),
26
+ cacheComponent = _require3.cacheComponent;
27
+
28
+ /**
29
+ * Render a profile from presentation data, without requiring Hexo or a theme's avatar asset.
30
+ * The avatar and link URLs are already resolved. Omit avatar to render no image or placeholder.
31
+ *
32
+ * @example
33
+ * <Profile
34
+ * avatar="/author.png"
35
+ * avatarRounded={true}
36
+ * author="Author"
37
+ * authorTitle="Writer"
38
+ * location="London"
39
+ * counter={{
40
+ * post: { title: 'Posts', count: 3, url: '/archives/' },
41
+ * category: { title: 'Categories', count: 1, url: '/categories/' },
42
+ * tag: { title: 'Tags', count: 2, url: '/tags/' }
43
+ * }}
44
+ * followLink="https://example.com/author"
45
+ * followTitle="Follow"
46
+ * socialLinks={[{ name: 'GitHub', url: 'https://github.com/author', icon: 'fab fa-github' }]} />
47
+ */
48
+ var Profile = /*#__PURE__*/function (_Component) {
49
+ function Profile() {
50
+ _classCallCheck(this, Profile);
51
+ return _callSuper(this, Profile, arguments);
52
+ }
53
+ _inherits(Profile, _Component);
54
+ return _createClass(Profile, [{
55
+ key: "renderSocialLinks",
56
+ value: function renderSocialLinks(links) {
57
+ if (!links.length) return null;
58
+ return (0, _inferno.createVNode)(1, "div", "level is-mobile is-multiline", links.filter(function (link) {
59
+ return _typeof(link) === 'object';
60
+ }).map(function (link) {
61
+ return (0, _inferno.createVNode)(1, "a", "level-item button is-transparent is-marginless", link.icon ? (0, _inferno.createVNode)(1, "i", link.icon, null, 1, {
62
+ "aria-hidden": "true"
63
+ }) : link.name, 0, {
64
+ "target": "_blank",
65
+ "rel": "me noopener",
66
+ "title": link.name,
67
+ "href": link.url,
68
+ "aria-label": link.icon ? link.name : null
69
+ });
70
+ }), 0);
71
+ }
72
+ }, {
73
+ key: "render",
74
+ value: function render() {
75
+ var _this$props = this.props,
76
+ avatar = _this$props.avatar,
77
+ avatarRounded = _this$props.avatarRounded,
78
+ author = _this$props.author,
79
+ authorTitle = _this$props.authorTitle,
80
+ location = _this$props.location,
81
+ counter = _this$props.counter,
82
+ followLink = _this$props.followLink,
83
+ followTitle = _this$props.followTitle,
84
+ socialLinks = _this$props.socialLinks;
85
+ return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", [(0, _inferno.createVNode)(1, "nav", "level", (0, _inferno.createVNode)(1, "div", "level-item has-text-centered flex-shrink-1", (0, _inferno.createVNode)(1, "div", null, [avatar ? (0, _inferno.createVNode)(1, "figure", "image is-128x128 mx-auto mb-2", (0, _inferno.createVNode)(1, "img", 'avatar' + (avatarRounded ? ' is-rounded' : ''), null, 1, {
86
+ "src": avatar,
87
+ "alt": author
88
+ }), 2) : null, author ? (0, _inferno.createVNode)(1, "p", "title is-size-4 is-block", author, 0, {
89
+ "style": {
90
+ 'line-height': 'inherit'
91
+ }
92
+ }) : null, authorTitle ? (0, _inferno.createVNode)(1, "p", "is-size-6 is-block", authorTitle, 0) : null, location ? (0, _inferno.createVNode)(1, "p", "is-size-6 is-flex justify-content-center", [(0, _inferno.createVNode)(1, "i", "fas fa-map-marker-alt mr-1"), (0, _inferno.createVNode)(1, "span", null, location, 0)], 4) : null], 0), 2), 2), (0, _inferno.createVNode)(1, "nav", "level is-mobile", [(0, _inferno.createVNode)(1, "div", "level-item has-text-centered is-marginless", (0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "p", "heading", counter.post.title, 0), (0, _inferno.createVNode)(1, "a", null, (0, _inferno.createVNode)(1, "p", "title", counter.post.count, 0), 2, {
93
+ "href": counter.post.url
94
+ })], 4), 2), (0, _inferno.createVNode)(1, "div", "level-item has-text-centered is-marginless", (0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "p", "heading", counter.category.title, 0), (0, _inferno.createVNode)(1, "a", null, (0, _inferno.createVNode)(1, "p", "title", counter.category.count, 0), 2, {
95
+ "href": counter.category.url
96
+ })], 4), 2), (0, _inferno.createVNode)(1, "div", "level-item has-text-centered is-marginless", (0, _inferno.createVNode)(1, "div", null, [(0, _inferno.createVNode)(1, "p", "heading", counter.tag.title, 0), (0, _inferno.createVNode)(1, "a", null, (0, _inferno.createVNode)(1, "p", "title", counter.tag.count, 0), 2, {
97
+ "href": counter.tag.url
98
+ })], 4), 2)], 4), followLink ? (0, _inferno.createVNode)(1, "div", "level", (0, _inferno.createVNode)(1, "a", "level-item button is-primary is-rounded", followTitle, 0, {
99
+ "href": followLink,
100
+ "target": "_blank",
101
+ "rel": "me noopener"
102
+ }), 2) : null, socialLinks ? this.renderSocialLinks(socialLinks) : null], 0), 2, {
103
+ "data-type": "profile"
104
+ });
105
+ }
106
+ }]);
107
+ }(Component);
108
+ /**
109
+ * Adapt Hexo widget options, helpers and site collections to the profile presentation props.
110
+ * Gravatar takes precedence over widget.avatar; url_for resolves the chosen avatar exactly once.
111
+ * With no avatar source the component renders no figure or image.
112
+ *
113
+ * @see module:util/cache.cacheComponent
114
+ * @example
115
+ * <Profile.Cacheable
116
+ * site={site}
117
+ * config={config}
118
+ * helper={helper}
119
+ * widget={{ author: 'Author', avatar: '/author.png', avatar_rounded: true }} />
120
+ */
121
+ Profile.Cacheable = cacheComponent(Profile, 'widget.profile', function (props) {
122
+ var site = props.site,
123
+ helper = props.helper,
124
+ widget = props.widget,
125
+ _props$config = props.config,
126
+ config = _props$config === void 0 ? {} : _props$config;
127
+ var avatar = widget.avatar,
128
+ gravatar = widget.gravatar,
129
+ _widget$avatar_rounde = widget.avatar_rounded,
130
+ avatar_rounded = _widget$avatar_rounde === void 0 ? false : _widget$avatar_rounde,
131
+ _widget$author = widget.author,
132
+ author = _widget$author === void 0 ? config.author : _widget$author,
133
+ author_title = widget.author_title,
134
+ location = widget.location,
135
+ follow_link = widget.follow_link,
136
+ social_links = widget.social_links;
137
+ var url_for = helper.url_for,
138
+ _p = helper._p,
139
+ __ = helper.__;
140
+ function getAvatar() {
141
+ if (gravatar) return gravatarHelper(gravatar, 128);
142
+ return avatar ? url_for(avatar) : undefined;
143
+ }
144
+ var postCount = site.posts.length;
145
+ var categoryCount = site.categories.filter(function (category) {
146
+ return category.length;
147
+ }).length;
148
+ var tagCount = site.tags.filter(function (tag) {
149
+ return tag.length;
150
+ }).length;
151
+ var socialLinks = null;
152
+ if (social_links) {
153
+ socialLinks = Object.keys(social_links).map(function (name) {
154
+ var link = social_links[name];
155
+ if (typeof link === 'string') return {
156
+ name: name,
157
+ url: url_for(link)
158
+ };
159
+ return {
160
+ name: name,
161
+ url: url_for(link.url),
162
+ icon: link.icon
163
+ };
164
+ });
165
+ }
166
+ return {
167
+ avatar: getAvatar(),
168
+ avatarRounded: avatar_rounded,
169
+ author: author,
170
+ authorTitle: author_title,
171
+ location: location,
172
+ counter: {
173
+ post: {
174
+ count: postCount,
175
+ title: _p('common.post', postCount),
176
+ url: url_for('/archives/')
177
+ },
178
+ category: {
179
+ count: categoryCount,
180
+ title: _p('common.category', categoryCount),
181
+ url: url_for('/categories/')
182
+ },
183
+ tag: {
184
+ count: tagCount,
185
+ title: _p('common.tag', tagCount),
186
+ url: url_for('/tags/')
187
+ }
188
+ },
189
+ followLink: follow_link ? url_for(follow_link) : undefined,
190
+ followTitle: __('widget.follow'),
191
+ socialLinks: socialLinks
192
+ };
193
+ });
194
+ module.exports = Profile;
@@ -47,32 +47,10 @@ var SubscribeEmail = /*#__PURE__*/function (_Component) {
47
47
  return _createClass(SubscribeEmail, [{
48
48
  key: "render",
49
49
  value: function render() {
50
- deprecate('widget.subscribe_email', 'Google FeedBurner stopped email subscriptions in July 2021. Use the follow.it widget instead.');
51
- var _this$props = this.props,
52
- title = _this$props.title,
53
- description = _this$props.description,
54
- feedburnerId = _this$props.feedburnerId,
55
- buttonTitle = _this$props.buttonTitle;
56
- 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, "form", null, [(0, _inferno.createVNode)(64, "input", null, null, 1, {
57
- "type": "hidden",
58
- "value": feedburnerId,
59
- "name": "uri"
60
- }), (0, _inferno.createVNode)(64, "input", null, null, 1, {
61
- "type": "hidden",
62
- "name": "loc",
63
- "value": "en_US"
64
- }), (0, _inferno.createVNode)(1, "div", "field has-addons", [(0, _inferno.createVNode)(1, "div", "control has-icons-left is-expanded", [(0, _inferno.createVNode)(64, "input", "input", null, 1, {
65
- "name": "email",
66
- "type": "email",
67
- "placeholder": "Email"
68
- }), (0, _inferno.createVNode)(1, "span", "icon is-small is-left", (0, _inferno.createVNode)(1, "i", "fas fa-envelope"), 2)], 4), (0, _inferno.createVNode)(1, "div", "control", (0, _inferno.createVNode)(64, "input", "button", null, 1, {
69
- "type": "submit",
70
- "value": buttonTitle
71
- }), 2)], 4), description ? (0, _inferno.createVNode)(1, "p", "help", description, 0) : null], 0, {
72
- "action": "https://feedburner.google.com/fb/a/mailverify",
73
- "method": "post",
74
- "target": "popupwindow",
75
- "onsubmit": "window.open('https://feedburner.google.com/fb/a/mailverify?uri=".concat(feedburnerId, "','popupwindow','scrollbars=yes,width=550,height=520');return true")
50
+ deprecate('widget.subscribe_email', 'FeedBurner email ended. Use follow.it.');
51
+ var title = this.props.title;
52
+ 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", "notification is-danger", [(0, _inferno.createTextVNode)("FeedBurner ended email subscriptions in July 2021. Use the "), (0, _inferno.createVNode)(1, "code", null, "followit", 16), (0, _inferno.createTextVNode)(' '), (0, _inferno.createTextVNode)("widget or another email subscription service.")], 0, {
53
+ "role": "status"
76
54
  })], 4), 2), 2, {
77
55
  "data-type": "subscribe-email"
78
56
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-component-inferno",
3
- "version": "4.2.2",
3
+ "version": "5.0.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",
@@ -12,12 +12,12 @@
12
12
  "scripts": {
13
13
  "test": "jest",
14
14
  "test-cov": "jest --coverage",
15
- "lint": "eslint '{src,asset,fixture}/**/*.{js,jsx}'",
15
+ "lint": "eslint \"{src,asset,fixture}/**/*.{js,jsx}\"",
16
16
  "_format": "prettier \"*.{json,babelrc,prettierrc,md}\" \"{.github,*[^lib]}/**/*.{js,jsx,json,yml}\"",
17
17
  "format": "npm run _format -- --write",
18
18
  "format-check": "npm run _format -- --check",
19
19
  "docs": "jsdoc src/**/* -d doc -t node_modules/minami",
20
- "build": "babel src --out-dir lib && mkdir -p lib/schema && cp -r src/schema/. lib/schema",
20
+ "build": "babel src --out-dir lib --copy-files",
21
21
  "clean": "rm -rf lib doc coverage",
22
22
  "prepare": "npm run build"
23
23
  },
@@ -52,8 +52,10 @@
52
52
  "jest": "^29.7.0",
53
53
  "jest-environment-jsdom": "^29.7.0",
54
54
  "jquery": "^3.7.1",
55
- "jsdom": "^20.0.3",
56
55
  "jsdoc": "^4.0.2",
56
+ "jsdom": "^20.0.3",
57
+ "justified-gallery": "4.0.2",
58
+ "lightgallery": "3.0.0",
57
59
  "minami": "^1.2.3",
58
60
  "prettier": "^3.2.4",
59
61
  "taffydb": "^2.7.3",