hexo-component-inferno 2.0.0 → 2.0.2

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 (89) hide show
  1. package/lib/core/migrate.js +10 -28
  2. package/lib/core/migrate.test.js +10 -12
  3. package/lib/core/schema.js +33 -109
  4. package/lib/core/schema.test.js +2 -6
  5. package/lib/core/view.js +3 -10
  6. package/lib/core/view.test.js +0 -7
  7. package/lib/hexo/filter/locals.js +3 -18
  8. package/lib/hexo/filter/locals.test.js +2 -19
  9. package/lib/hexo/generator/assets.js +2 -8
  10. package/lib/hexo/generator/assets.test.js +0 -4
  11. package/lib/hexo/generator/categories.test.js +0 -3
  12. package/lib/hexo/generator/category.js +1 -6
  13. package/lib/hexo/generator/category.test.js +0 -5
  14. package/lib/hexo/generator/insight.js +1 -9
  15. package/lib/hexo/generator/insight.test.js +0 -3
  16. package/lib/hexo/generator/manifest.js +0 -3
  17. package/lib/hexo/generator/manifest.test.js +0 -3
  18. package/lib/hexo/generator/tags.test.js +0 -3
  19. package/lib/hexo/helper/cdn.js +6 -19
  20. package/lib/hexo/helper/cdn.test.js +0 -3
  21. package/lib/hexo/helper/page.test.js +0 -3
  22. package/lib/hexo/tag/message.js +0 -8
  23. package/lib/hexo/tag/message.test.js +0 -7
  24. package/lib/hexo/tag/tabs.js +17 -48
  25. package/lib/hexo/tag/tabs.test.js +0 -8
  26. package/lib/util/cache.js +0 -11
  27. package/lib/util/cache.test.js +0 -4
  28. package/lib/util/classname.js +0 -3
  29. package/lib/util/classname.test.js +0 -1
  30. package/lib/util/yaml.js +2 -7
  31. package/lib/util/yaml.test.js +0 -4
  32. package/lib/view/comment/changyan.js +12 -31
  33. package/lib/view/comment/disqus.js +11 -32
  34. package/lib/view/comment/disqusjs.js +22 -43
  35. package/lib/view/comment/facebook.js +9 -28
  36. package/lib/view/comment/gitalk.js +28 -49
  37. package/lib/view/comment/gitment.js +15 -37
  38. package/lib/view/comment/isso.js +6 -27
  39. package/lib/view/comment/livere.js +6 -27
  40. package/lib/view/comment/twikoo.js +14 -33
  41. package/lib/view/comment/utterances.js +17 -45
  42. package/lib/view/comment/valine.js +39 -60
  43. package/lib/view/comment/waline.js +45 -66
  44. package/lib/view/common/article_media.js +11 -28
  45. package/lib/view/donate/afdian.js +9 -30
  46. package/lib/view/donate/alipay.js +9 -30
  47. package/lib/view/donate/buymeacoffee.js +9 -30
  48. package/lib/view/donate/patreon.js +9 -30
  49. package/lib/view/donate/paypal.js +10 -31
  50. package/lib/view/donate/wechat.js +9 -30
  51. package/lib/view/misc/article_licensing.js +21 -43
  52. package/lib/view/misc/meta.js +7 -34
  53. package/lib/view/misc/open_graph.js +25 -67
  54. package/lib/view/misc/paginator.js +12 -36
  55. package/lib/view/misc/structured_data.js +16 -43
  56. package/lib/view/misc/web_app.js +15 -49
  57. package/lib/view/plugin/baidu_analytics.js +7 -28
  58. package/lib/view/plugin/bing_webmaster.js +7 -28
  59. package/lib/view/plugin/busuanzi.js +6 -26
  60. package/lib/view/plugin/cnzz.js +9 -30
  61. package/lib/view/plugin/cookie_consent.js +28 -49
  62. package/lib/view/plugin/gallery.js +10 -31
  63. package/lib/view/plugin/google_analytics.js +7 -28
  64. package/lib/view/plugin/hotjar.js +7 -28
  65. package/lib/view/plugin/katex.js +11 -32
  66. package/lib/view/plugin/mathjax.js +7 -28
  67. package/lib/view/plugin/outdated_browser.js +10 -31
  68. package/lib/view/plugin/progressbar.js +7 -28
  69. package/lib/view/plugin/statcounter.js +10 -31
  70. package/lib/view/plugin/twitter_conversion_tracking.js +7 -28
  71. package/lib/view/search/algolia.js +14 -35
  72. package/lib/view/search/baidu.js +9 -28
  73. package/lib/view/search/google_cse.js +10 -30
  74. package/lib/view/search/insight.js +9 -28
  75. package/lib/view/share/addthis.js +6 -27
  76. package/lib/view/share/addtoany.js +6 -25
  77. package/lib/view/share/bdshare.js +6 -25
  78. package/lib/view/share/sharejs.js +8 -27
  79. package/lib/view/share/sharethis.js +6 -27
  80. package/lib/view/widget/adsense.js +11 -32
  81. package/lib/view/widget/archives.js +24 -51
  82. package/lib/view/widget/categories.js +23 -57
  83. package/lib/view/widget/followit.js +12 -31
  84. package/lib/view/widget/links.js +10 -32
  85. package/lib/view/widget/recent_posts.js +14 -36
  86. package/lib/view/widget/subscribe_email.js +12 -31
  87. package/lib/view/widget/tags.js +16 -39
  88. package/lib/view/widget/toc.js +26 -66
  89. package/package.json +1 -1
@@ -1,29 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  var _inferno = require("inferno");
6
-
7
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
-
9
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
10
-
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
-
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
10
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
-
15
11
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
-
17
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
-
19
13
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20
-
21
14
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
-
23
15
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
24
-
25
16
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
-
27
17
  /**
28
18
  * A JSX component that renders Open Graph tags.
29
19
  * @module view/misc/open_graph
@@ -32,17 +22,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
32
22
  * @see https://github.com/hexojs/hexo/blob/4.2.0/lib/plugins/helper/open_graph.js
33
23
  */
34
24
  var urlFn = require('url');
35
-
36
25
  var moment = require('moment');
37
-
38
26
  var _require = require('inferno'),
39
- Component = _require.Component;
40
-
27
+ Component = _require.Component;
41
28
  var _require2 = require('hexo-util'),
42
- encodeURL = _require2.encodeURL,
43
- stripHTML = _require2.stripHTML,
44
- escapeHTML = _require2.escapeHTML;
45
-
29
+ encodeURL = _require2.encodeURL,
30
+ stripHTML = _require2.stripHTML,
31
+ escapeHTML = _require2.escapeHTML;
46
32
  var localeMap = {
47
33
  en: 'en_US',
48
34
  de: 'de_DE',
@@ -60,6 +46,7 @@ var localeMap = {
60
46
  vi: 'vi_VN'
61
47
  };
62
48
  var localeRegex = new RegExp(Object.keys(localeMap).join('|'), 'i');
49
+
63
50
  /**
64
51
  * A JSX component that renders Open Graph tags.
65
52
  *
@@ -86,42 +73,36 @@ var localeRegex = new RegExp(Object.keys(localeMap).join('|'), 'i');
86
73
  * facebookAdmins="Facebook admin ID"
87
74
  * facebookAppId="Facebook APP ID" />
88
75
  */
89
-
90
76
  module.exports = /*#__PURE__*/function (_Component) {
91
77
  _inherits(_class, _Component);
92
-
93
78
  var _super = _createSuper(_class);
94
-
95
79
  function _class() {
96
80
  _classCallCheck(this, _class);
97
-
98
81
  return _super.apply(this, arguments);
99
82
  }
100
-
101
83
  _createClass(_class, [{
102
84
  key: "render",
103
85
  value: function render() {
104
86
  var _this$props = this.props,
105
- type = _this$props.type,
106
- title = _this$props.title,
107
- date = _this$props.date,
108
- updated = _this$props.updated,
109
- author = _this$props.author,
110
- url = _this$props.url,
111
- siteName = _this$props.siteName,
112
- twitterCard = _this$props.twitterCard,
113
- twitterSite = _this$props.twitterSite,
114
- googlePlus = _this$props.googlePlus,
115
- facebookAdmins = _this$props.facebookAdmins,
116
- facebookAppId = _this$props.facebookAppId;
87
+ type = _this$props.type,
88
+ title = _this$props.title,
89
+ date = _this$props.date,
90
+ updated = _this$props.updated,
91
+ author = _this$props.author,
92
+ url = _this$props.url,
93
+ siteName = _this$props.siteName,
94
+ twitterCard = _this$props.twitterCard,
95
+ twitterSite = _this$props.twitterSite,
96
+ googlePlus = _this$props.googlePlus,
97
+ facebookAdmins = _this$props.facebookAdmins,
98
+ facebookAppId = _this$props.facebookAppId;
117
99
  var _this$props2 = this.props,
118
- description = _this$props2.description,
119
- language = _this$props2.language,
120
- images = _this$props2.images,
121
- keywords = _this$props2.keywords,
122
- twitterId = _this$props2.twitterId;
100
+ description = _this$props2.description,
101
+ language = _this$props2.language,
102
+ images = _this$props2.images,
103
+ keywords = _this$props2.keywords,
104
+ twitterId = _this$props2.twitterId;
123
105
  var htmlTags = [];
124
-
125
106
  if (description) {
126
107
  description = escapeHTML(stripHTML(description).substring(0, 200).trim()).replace(/\n/g, ' ');
127
108
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
@@ -129,7 +110,6 @@ module.exports = /*#__PURE__*/function (_Component) {
129
110
  "content": description
130
111
  }));
131
112
  }
132
-
133
113
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
134
114
  "property": "og:type",
135
115
  "content": type || 'website'
@@ -146,14 +126,12 @@ module.exports = /*#__PURE__*/function (_Component) {
146
126
  "property": "og:site_name",
147
127
  "content": siteName
148
128
  }));
149
-
150
129
  if (description) {
151
130
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
152
131
  "property": "og:description",
153
132
  "content": description
154
133
  }));
155
134
  }
156
-
157
135
  if (language) {
158
136
  if (language.length === 2) {
159
137
  language = language.replace(localeRegex, function (str) {
@@ -173,18 +151,15 @@ module.exports = /*#__PURE__*/function (_Component) {
173
151
  }));
174
152
  }
175
153
  }
176
-
177
154
  if (!Array.isArray(images)) {
178
155
  images = [images];
179
156
  }
180
-
181
157
  images.map(function (path) {
182
158
  if (!urlFn.parse(path).host) {
183
159
  // resolve `path`'s absolute path relative to current page's url
184
160
  // `path` can be both absolute (starts with `/`) or relative.
185
161
  return urlFn.resolve(url, path);
186
162
  }
187
-
188
163
  return path;
189
164
  }).forEach(function (path) {
190
165
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
@@ -192,33 +167,28 @@ module.exports = /*#__PURE__*/function (_Component) {
192
167
  "content": path
193
168
  }));
194
169
  });
195
-
196
170
  if (date && (moment.isMoment(date) || moment.isDate(date)) && !isNaN(date.valueOf())) {
197
171
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
198
172
  "property": "article:published_time",
199
173
  "content": date.toISOString()
200
174
  }));
201
175
  }
202
-
203
176
  if (updated && (moment.isMoment(updated) || moment.isDate(updated)) && !isNaN(updated.valueOf())) {
204
177
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
205
178
  "property": "article:modified_time",
206
179
  "content": updated.toISOString()
207
180
  }));
208
181
  }
209
-
210
182
  if (author) {
211
183
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
212
184
  "property": "article:author",
213
185
  "content": author
214
186
  }));
215
187
  }
216
-
217
188
  if (keywords) {
218
189
  if (typeof keywords === 'string') {
219
190
  keywords = [keywords];
220
191
  }
221
-
222
192
  keywords.map(function (tag) {
223
193
  return tag.name ? tag.name : tag;
224
194
  }).filter(Boolean).forEach(function (keyword) {
@@ -228,69 +198,57 @@ module.exports = /*#__PURE__*/function (_Component) {
228
198
  }));
229
199
  });
230
200
  }
231
-
232
201
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
233
202
  "property": "twitter:card",
234
203
  "content": twitterCard || 'summary'
235
204
  }));
236
-
237
205
  if (images.length) {
238
206
  var image = images[0];
239
-
240
207
  if (!urlFn.parse(image).host) {
241
208
  // resolve `path`'s absolute path relative to current page's url
242
209
  // `path` can be both absolute (starts with `/`) or relative.
243
210
  image = urlFn.resolve(url, image);
244
211
  }
245
-
246
212
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
247
213
  "property": "twitter:image:src",
248
214
  "content": image
249
215
  }));
250
216
  }
251
-
252
217
  if (twitterId) {
253
218
  if (twitterId[0] !== '@') {
254
219
  twitterId = "@".concat(twitterId);
255
220
  }
256
-
257
221
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
258
222
  "property": "twitter:creator",
259
223
  "content": twitterId
260
224
  }));
261
225
  }
262
-
263
226
  if (twitterSite) {
264
227
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
265
228
  "property": "twitter:site",
266
229
  "content": twitterSite
267
230
  }));
268
231
  }
269
-
270
232
  if (googlePlus) {
271
233
  htmlTags.push((0, _inferno.createVNode)(1, "link", null, null, 1, {
272
234
  "rel": "publisher",
273
235
  "href": googlePlus
274
236
  }));
275
237
  }
276
-
277
238
  if (facebookAdmins) {
278
239
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
279
240
  "property": "fb:admins",
280
241
  "content": facebookAdmins
281
242
  }));
282
243
  }
283
-
284
244
  if (facebookAppId) {
285
245
  htmlTags.push((0, _inferno.createVNode)(1, "meta", null, null, 1, {
286
246
  "property": "fb:app_id",
287
247
  "content": facebookAppId
288
248
  }));
289
249
  }
290
-
291
250
  return (0, _inferno.createFragment)(htmlTags, 0);
292
251
  }
293
252
  }]);
294
-
295
253
  return _class;
296
254
  }(Component);
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  var _inferno = require("inferno");
6
-
7
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
-
9
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
10
-
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
-
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
10
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
-
15
11
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
-
17
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
-
19
13
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20
-
21
14
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
-
23
15
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
24
-
25
16
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
-
27
17
  /**
28
18
  * Paginator JSX component.
29
19
  * @module view/misc/paginator
30
20
  */
31
21
  var _require = require('inferno'),
32
- Component = _require.Component;
22
+ Component = _require.Component;
23
+
33
24
  /**
34
25
  * Paginator JSX component.
35
26
  *
@@ -44,35 +35,27 @@ var _require = require('inferno'),
44
35
  * prevTitle="Prev"
45
36
  * nextTitle="Next" />
46
37
  */
47
-
48
-
49
38
  module.exports = /*#__PURE__*/function (_Component) {
50
39
  _inherits(_class, _Component);
51
-
52
40
  var _super = _createSuper(_class);
53
-
54
41
  function _class() {
55
42
  _classCallCheck(this, _class);
56
-
57
43
  return _super.apply(this, arguments);
58
44
  }
59
-
60
45
  _createClass(_class, [{
61
46
  key: "render",
62
47
  value: function render() {
63
48
  var _this$props = this.props,
64
- current = _this$props.current,
65
- total = _this$props.total,
66
- baseUrl = _this$props.baseUrl,
67
- path = _this$props.path,
68
- urlFor = _this$props.urlFor,
69
- prevTitle = _this$props.prevTitle,
70
- nextTitle = _this$props.nextTitle;
71
-
49
+ current = _this$props.current,
50
+ total = _this$props.total,
51
+ baseUrl = _this$props.baseUrl,
52
+ path = _this$props.path,
53
+ urlFor = _this$props.urlFor,
54
+ prevTitle = _this$props.prevTitle,
55
+ nextTitle = _this$props.nextTitle;
72
56
  function getPageUrl(i) {
73
57
  return urlFor(i === 1 ? baseUrl : baseUrl + path + '/' + i + '/');
74
58
  }
75
-
76
59
  function pagination(c, m) {
77
60
  var current = c;
78
61
  var last = m;
@@ -82,16 +65,13 @@ module.exports = /*#__PURE__*/function (_Component) {
82
65
  var range = [];
83
66
  var elements = [];
84
67
  var l;
85
-
86
68
  for (var i = 1; i <= last; i++) {
87
69
  if (i === 1 || i === last || i >= left && i < right) {
88
70
  range.push(i);
89
71
  }
90
72
  }
91
-
92
73
  for (var _i = 0, _range = range; _i < _range.length; _i++) {
93
74
  var _i2 = _range[_i];
94
-
95
75
  if (l) {
96
76
  if (_i2 - l === 2) {
97
77
  elements.push((0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "pagination-link", l + 1, 0, {
@@ -105,16 +85,13 @@ module.exports = /*#__PURE__*/function (_Component) {
105
85
  }), 2));
106
86
  }
107
87
  }
108
-
109
88
  elements.push((0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "pagination-link".concat(c === _i2 ? ' is-current' : ''), _i2, 0, {
110
89
  "href": getPageUrl(_i2)
111
90
  }), 2));
112
91
  l = _i2;
113
92
  }
114
-
115
93
  return elements;
116
94
  }
117
-
118
95
  return (0, _inferno.createVNode)(1, "nav", "pagination", [(0, _inferno.createVNode)(1, "div", "pagination-previous".concat(current > 1 ? '' : ' is-invisible is-hidden-mobile'), (0, _inferno.createVNode)(1, "a", null, prevTitle, 0, {
119
96
  "href": getPageUrl(current - 1)
120
97
  }), 2), (0, _inferno.createVNode)(1, "div", "pagination-next".concat(current < total ? '' : ' is-invisible is-hidden-mobile'), (0, _inferno.createVNode)(1, "a", null, nextTitle, 0, {
@@ -125,6 +102,5 @@ module.exports = /*#__PURE__*/function (_Component) {
125
102
  });
126
103
  }
127
104
  }]);
128
-
129
105
  return _class;
130
106
  }(Component);
@@ -1,43 +1,31 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  var _inferno = require("inferno");
6
-
7
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
-
9
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
10
-
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
-
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
10
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
-
15
11
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
-
17
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
-
19
13
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20
-
21
14
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
-
23
15
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
24
-
25
16
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
-
27
17
  /**
28
18
  * A JSX component that renders simple Google structured data.
29
19
  * @module view/misc/structured_data
30
20
  */
31
21
  var urlFn = require('url');
32
-
33
22
  var moment = require('moment');
34
-
35
23
  var _require = require('inferno'),
36
- Component = _require.Component;
37
-
24
+ Component = _require.Component;
38
25
  var _require2 = require('hexo-util'),
39
- stripHTML = _require2.stripHTML,
40
- escapeHTML = _require2.escapeHTML;
26
+ stripHTML = _require2.stripHTML,
27
+ escapeHTML = _require2.escapeHTML;
28
+
41
29
  /**
42
30
  * A JSX component that renders simple Google structured data.
43
31
  *
@@ -54,66 +42,52 @@ var _require2 = require('hexo-util'),
54
42
  * date="Page publish date"
55
43
  * updated="Page update date" />
56
44
  */
57
-
58
-
59
45
  module.exports = /*#__PURE__*/function (_Component) {
60
46
  _inherits(_class, _Component);
61
-
62
47
  var _super = _createSuper(_class);
63
-
64
48
  function _class() {
65
49
  _classCallCheck(this, _class);
66
-
67
50
  return _super.apply(this, arguments);
68
51
  }
69
-
70
52
  _createClass(_class, [{
71
53
  key: "render",
72
54
  value: function render() {
73
55
  var _this$props = this.props,
74
- title = _this$props.title,
75
- url = _this$props.url,
76
- author = _this$props.author,
77
- publisher = _this$props.publisher;
56
+ title = _this$props.title,
57
+ url = _this$props.url,
58
+ author = _this$props.author,
59
+ publisher = _this$props.publisher;
78
60
  var _this$props2 = this.props,
79
- description = _this$props2.description,
80
- images = _this$props2.images,
81
- date = _this$props2.date,
82
- updated = _this$props2.updated,
83
- publisherLogo = _this$props2.publisherLogo;
84
-
61
+ description = _this$props2.description,
62
+ images = _this$props2.images,
63
+ date = _this$props2.date,
64
+ updated = _this$props2.updated,
65
+ publisherLogo = _this$props2.publisherLogo;
85
66
  if (description) {
86
67
  description = escapeHTML(stripHTML(description).substring(0, 200).trim()).replace(/\n/g, ' ');
87
68
  }
88
-
89
69
  if (!Array.isArray(images)) {
90
70
  images = [images];
91
71
  }
92
-
93
72
  images = images.map(function (path) {
94
73
  if (!urlFn.parse(path).host) {
95
74
  // resolve `path`'s absolute path relative to current page's url
96
75
  // `path` can be both absolute (starts with `/`) or relative.
97
76
  return urlFn.resolve(url, path);
98
77
  }
99
-
100
78
  return path;
101
79
  }).filter(function (url) {
102
80
  return url.endsWith('.jpg') || url.endsWith('.png') || url.endsWith('.gif') || url.endsWith('.webp');
103
81
  });
104
-
105
82
  if (typeof publisherLogo === 'string' && !urlFn.parse(publisherLogo).host) {
106
83
  publisherLogo = urlFn.resolve(url, publisherLogo);
107
84
  }
108
-
109
85
  if (date && (moment.isMoment(date) || moment.isDate(date)) && !isNaN(date.valueOf())) {
110
86
  date = date.toISOString();
111
87
  }
112
-
113
88
  if (updated && (moment.isMoment(updated) || moment.isDate(updated)) && !isNaN(updated.valueOf())) {
114
89
  updated = updated.toISOString();
115
90
  }
116
-
117
91
  var data = {
118
92
  '@context': 'https://schema.org',
119
93
  '@type': 'BlogPosting',
@@ -147,6 +121,5 @@ module.exports = /*#__PURE__*/function (_Component) {
147
121
  });
148
122
  }
149
123
  }]);
150
-
151
124
  return _class;
152
125
  }(Component);