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,38 +1,28 @@
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
  * Google AdSense widget JSX component.
29
19
  * @module view/widget/adsense
30
20
  */
31
21
  var _require = require('inferno'),
32
- Component = _require.Component;
33
-
22
+ Component = _require.Component;
34
23
  var _require2 = require('../../util/cache'),
35
- cacheComponent = _require2.cacheComponent;
24
+ cacheComponent = _require2.cacheComponent;
25
+
36
26
  /**
37
27
  * Google AdSense widget JSX component.
38
28
  *
@@ -43,31 +33,23 @@ var _require2 = require('../../util/cache'),
43
33
  * clientId="******"
44
34
  * slotId="******" />
45
35
  */
46
-
47
-
48
36
  var AdSense = /*#__PURE__*/function (_Component) {
49
37
  _inherits(AdSense, _Component);
50
-
51
38
  var _super = _createSuper(AdSense);
52
-
53
39
  function AdSense() {
54
40
  _classCallCheck(this, AdSense);
55
-
56
41
  return _super.apply(this, arguments);
57
42
  }
58
-
59
43
  _createClass(AdSense, [{
60
44
  key: "render",
61
45
  value: function render() {
62
46
  var _this$props = this.props,
63
- title = _this$props.title,
64
- clientId = _this$props.clientId,
65
- slotId = _this$props.slotId;
66
-
47
+ title = _this$props.title,
48
+ clientId = _this$props.clientId,
49
+ slotId = _this$props.slotId;
67
50
  if (!clientId || !slotId) {
68
51
  return (0, _inferno.createVNode)(1, "div", "card widget", (0, _inferno.createVNode)(1, "div", "card-content", (0, _inferno.createVNode)(1, "div", "notification is-danger", [(0, _inferno.createTextVNode)("You need to set "), (0, _inferno.createVNode)(1, "code", null, "client_id", 16), (0, _inferno.createTextVNode)(" and "), (0, _inferno.createVNode)(1, "code", null, "slot_id", 16), (0, _inferno.createTextVNode)(" to show this AD unit. Please set it in "), (0, _inferno.createVNode)(1, "code", null, "_config.yml", 16), (0, _inferno.createTextVNode)(".")], 4), 2), 2);
69
52
  }
70
-
71
53
  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, "script", null, null, 1, {
72
54
  "async": true,
73
55
  "src": "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
@@ -86,7 +68,6 @@ var AdSense = /*#__PURE__*/function (_Component) {
86
68
  });
87
69
  }
88
70
  }]);
89
-
90
71
  return AdSense;
91
72
  }(Component);
92
73
  /**
@@ -101,13 +82,11 @@ var AdSense = /*#__PURE__*/function (_Component) {
101
82
  * widget={{ client_id: '******', slot_id: '******' }}
102
83
  * helper={{ __: function() {...} }} />
103
84
  */
104
-
105
-
106
85
  AdSense.Cacheable = cacheComponent(AdSense, 'widget.adsense', function (props) {
107
86
  var widget = props.widget,
108
- helper = props.helper;
87
+ helper = props.helper;
109
88
  var client_id = widget.client_id,
110
- slot_id = widget.slot_id;
89
+ slot_id = widget.slot_id;
111
90
  return {
112
91
  title: helper.__('widget.adsense'),
113
92
  clientId: client_id,
@@ -1,38 +1,30 @@
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
  * Archives widget JSX component.
29
19
  * @module view/widget/archives
30
20
  */
31
21
  var _require = require('inferno'),
32
- Component = _require.Component;
22
+ Component = _require.Component;
23
+ var _require2 = require('hexo/lib/plugins/helper/date'),
24
+ toMomentLocale = _require2.toMomentLocale;
25
+ var _require3 = require('../../util/cache'),
26
+ cacheComponent = _require3.cacheComponent;
33
27
 
34
- var _require2 = require('../../util/cache'),
35
- cacheComponent = _require2.cacheComponent;
36
28
  /**
37
29
  * Archives widget JSX component.
38
30
  *
@@ -48,26 +40,20 @@ var _require2 = require('../../util/cache'),
48
40
  * }
49
41
  * ]} />
50
42
  */
51
-
52
-
53
43
  var Archives = /*#__PURE__*/function (_Component) {
54
44
  _inherits(Archives, _Component);
55
-
56
45
  var _super = _createSuper(Archives);
57
-
58
46
  function Archives() {
59
47
  _classCallCheck(this, Archives);
60
-
61
48
  return _super.apply(this, arguments);
62
49
  }
63
-
64
50
  _createClass(Archives, [{
65
51
  key: "render",
66
52
  value: function render() {
67
53
  var _this$props = this.props,
68
- items = _this$props.items,
69
- title = _this$props.title,
70
- showCount = _this$props.showCount;
54
+ items = _this$props.items,
55
+ title = _this$props.title,
56
+ showCount = _this$props.showCount;
71
57
  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", items.map(function (archive) {
72
58
  return (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", archive.name, 0), 2), showCount ? (0, _inferno.createVNode)(1, "span", "level-end", (0, _inferno.createVNode)(1, "span", "level-item tag", archive.count, 0), 2) : null], 0, {
73
59
  "href": archive.url
@@ -77,7 +63,6 @@ var Archives = /*#__PURE__*/function (_Component) {
77
63
  });
78
64
  }
79
65
  }]);
80
-
81
66
  return Archives;
82
67
  }(Component);
83
68
  /**
@@ -109,49 +94,41 @@ var Archives = /*#__PURE__*/function (_Component) {
109
94
  * showCount={true}
110
95
  * format="MMMM YYYY" />
111
96
  */
112
-
113
-
114
97
  Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props) {
115
98
  var site = props.site,
116
- config = props.config,
117
- page = props.page,
118
- helper = props.helper,
119
- _props$type = props.type,
120
- type = _props$type === void 0 ? 'monthly' : _props$type,
121
- _props$order = props.order,
122
- order = _props$order === void 0 ? -1 : _props$order,
123
- _props$showCount = props.showCount,
124
- showCount = _props$showCount === void 0 ? true : _props$showCount,
125
- _props$format = props.format,
126
- format = _props$format === void 0 ? null : _props$format;
99
+ config = props.config,
100
+ page = props.page,
101
+ helper = props.helper,
102
+ _props$type = props.type,
103
+ type = _props$type === void 0 ? 'monthly' : _props$type,
104
+ _props$order = props.order,
105
+ order = _props$order === void 0 ? -1 : _props$order,
106
+ _props$showCount = props.showCount,
107
+ showCount = _props$showCount === void 0 ? true : _props$showCount,
108
+ _props$format = props.format,
109
+ format = _props$format === void 0 ? null : _props$format;
127
110
  var url_for = helper.url_for,
128
- _p = helper._p;
111
+ _p = helper._p;
129
112
  var posts = site.posts.sort('date', order);
130
-
131
113
  if (!posts.length) {
132
114
  return null;
133
115
  }
134
-
135
- var language = page.lang || page.language || config.language;
116
+ var language = toMomentLocale(page.lang || page.language || config.language);
136
117
  var data = [];
137
118
  var length = 0;
138
119
  posts.forEach(function (post) {
139
120
  // Clone the date object to avoid pollution
140
121
  var date = post.date.clone();
141
-
142
122
  if (config.timezone) {
143
123
  date = date.tz(config.timezone);
144
124
  }
145
-
146
125
  if (language) {
147
126
  date = date.locale(language);
148
127
  }
149
-
150
128
  var year = date.year();
151
129
  var month = date.month() + 1;
152
130
  var name = date.format(format || type === 'monthly' ? 'MMMM YYYY' : 'YYYY');
153
131
  var lastData = data[length - 1];
154
-
155
132
  if (!lastData || lastData.name !== name) {
156
133
  length = data.push({
157
134
  name: name,
@@ -163,18 +140,14 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', function (props
163
140
  lastData.count++;
164
141
  }
165
142
  });
166
-
167
143
  var link = function link(item) {
168
144
  var url = "".concat(config.archive_dir, "/").concat(item.year, "/");
169
-
170
145
  if (type === 'monthly') {
171
146
  if (item.month < 10) url += '0';
172
147
  url += "".concat(item.month, "/");
173
148
  }
174
-
175
149
  return url_for(url);
176
150
  };
177
-
178
151
  return {
179
152
  items: data.map(function (item) {
180
153
  return {
@@ -1,38 +1,28 @@
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
  * Categories widget JSX component.
29
19
  * @module view/widget/categories
30
20
  */
31
21
  var _require = require('inferno'),
32
- Component = _require.Component;
33
-
22
+ Component = _require.Component;
34
23
  var _require2 = require('../../util/cache'),
35
- cacheComponent = _require2.cacheComponent;
24
+ cacheComponent = _require2.cacheComponent;
25
+
36
26
  /**
37
27
  * Categories widget JSX component.
38
28
  *
@@ -54,24 +44,17 @@ var _require2 = require('../../util/cache'),
54
44
  * }
55
45
  * ]} />
56
46
  */
57
-
58
-
59
47
  var Categories = /*#__PURE__*/function (_Component) {
60
48
  _inherits(Categories, _Component);
61
-
62
49
  var _super = _createSuper(Categories);
63
-
64
50
  function Categories() {
65
51
  _classCallCheck(this, Categories);
66
-
67
52
  return _super.apply(this, arguments);
68
53
  }
69
-
70
54
  _createClass(Categories, [{
71
55
  key: "renderList",
72
56
  value: function renderList(categories, showCount) {
73
57
  var _this = this;
74
-
75
58
  return categories.map(function (category) {
76
59
  return (0, _inferno.createVNode)(1, "li", null, [(0, _inferno.createVNode)(1, "a", 'level is-mobile' + (category.isCurrent ? ' is-active' : ''), [(0, _inferno.createVNode)(1, "span", "level-start", (0, _inferno.createVNode)(1, "span", "level-item", category.name, 0), 2), showCount ? (0, _inferno.createVNode)(1, "span", "level-end", (0, _inferno.createVNode)(1, "span", "level-item tag", category.count, 0), 2) : null], 0, {
77
60
  "href": category.url
@@ -82,15 +65,14 @@ var Categories = /*#__PURE__*/function (_Component) {
82
65
  key: "render",
83
66
  value: function render() {
84
67
  var _this$props = this.props,
85
- title = _this$props.title,
86
- showCount = _this$props.showCount,
87
- categories = _this$props.categories;
68
+ title = _this$props.title,
69
+ showCount = _this$props.showCount,
70
+ categories = _this$props.categories;
88
71
  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), 0)], 4), 2), 2, {
89
72
  "data-type": "categories"
90
73
  });
91
74
  }
92
75
  }]);
93
-
94
76
  return Categories;
95
77
  }(Component);
96
78
  /**
@@ -119,37 +101,30 @@ var Categories = /*#__PURE__*/function (_Component) {
119
101
  * showCount={true}
120
102
  * depth={3} />
121
103
  */
122
-
123
-
124
104
  Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function (props) {
125
105
  var page = props.page,
126
- helper = props.helper,
127
- _props$categories = props.categories,
128
- categories = _props$categories === void 0 ? props.site.categories : _props$categories,
129
- _props$orderBy = props.orderBy,
130
- orderBy = _props$orderBy === void 0 ? 'name' : _props$orderBy,
131
- _props$order = props.order,
132
- order = _props$order === void 0 ? 1 : _props$order,
133
- _props$showCurrent = props.showCurrent,
134
- showCurrent = _props$showCurrent === void 0 ? false : _props$showCurrent,
135
- _props$showCount = props.showCount,
136
- showCount = _props$showCount === void 0 ? true : _props$showCount;
106
+ helper = props.helper,
107
+ _props$categories = props.categories,
108
+ categories = _props$categories === void 0 ? props.site.categories : _props$categories,
109
+ _props$orderBy = props.orderBy,
110
+ orderBy = _props$orderBy === void 0 ? 'name' : _props$orderBy,
111
+ _props$order = props.order,
112
+ order = _props$order === void 0 ? 1 : _props$order,
113
+ _props$showCurrent = props.showCurrent,
114
+ showCurrent = _props$showCurrent === void 0 ? false : _props$showCurrent,
115
+ _props$showCount = props.showCount,
116
+ showCount = _props$showCount === void 0 ? true : _props$showCount;
137
117
  var url_for = helper.url_for,
138
- _p = helper._p;
139
-
118
+ _p = helper._p;
140
119
  if (!categories || !categories.length) {
141
120
  return null;
142
121
  }
143
-
144
122
  var depth = 0;
145
-
146
123
  try {
147
124
  depth = parseInt(props.depth, 10);
148
125
  } catch (e) {}
149
-
150
126
  function prepareQuery(parent) {
151
127
  var query = {};
152
-
153
128
  if (parent) {
154
129
  query.parent = parent;
155
130
  } else {
@@ -157,36 +132,28 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
157
132
  $exists: false
158
133
  };
159
134
  }
160
-
161
135
  return categories.find(query).sort(orderBy, order).filter(function (cat) {
162
136
  return cat.length;
163
137
  });
164
138
  }
165
-
166
139
  function hierarchicalList(level, parent) {
167
140
  return prepareQuery(parent).map(function (cat, i) {
168
141
  var children = [];
169
-
170
142
  if (!depth || level + 1 < depth) {
171
143
  children = hierarchicalList(level + 1, cat._id);
172
144
  }
173
-
174
145
  var isCurrent = false;
175
-
176
146
  if (showCurrent && page) {
177
147
  for (var j = 0; j < cat.length; j++) {
178
148
  var post = cat.posts.data[j];
179
-
180
149
  if (post && post._id === page._id) {
181
150
  isCurrent = true;
182
151
  break;
183
152
  }
184
- } // special case: category page
185
-
186
-
153
+ }
154
+ // special case: category page
187
155
  isCurrent = isCurrent || page.base && page.base.startsWith(cat.path);
188
156
  }
189
-
190
157
  return {
191
158
  children: children,
192
159
  isCurrent: isCurrent,
@@ -196,7 +163,6 @@ Categories.Cacheable = cacheComponent(Categories, 'widget.categories', function
196
163
  };
197
164
  });
198
165
  }
199
-
200
166
  return {
201
167
  showCount: showCount,
202
168
  categories: hierarchicalList(0),
@@ -1,38 +1,28 @@
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
  * follow.it widget JSX component.
29
19
  * @module view/widget/followit
30
20
  */
31
21
  var _require = require('inferno'),
32
- Component = _require.Component;
33
-
22
+ Component = _require.Component;
34
23
  var _require2 = require('../../util/cache'),
35
- cacheComponent = _require2.cacheComponent;
24
+ cacheComponent = _require2.cacheComponent;
25
+
36
26
  /**
37
27
  * follow.it widget JSX component.
38
28
  *
@@ -44,27 +34,21 @@ var _require2 = require('../../util/cache'),
44
34
  * buttonTitle="Subscribe now"
45
35
  * actionUrl="https://api.follow.it/subscription-form/******" />
46
36
  */
47
-
48
-
49
37
  var FollowIt = /*#__PURE__*/function (_Component) {
50
38
  _inherits(FollowIt, _Component);
51
-
52
39
  var _super = _createSuper(FollowIt);
53
-
54
40
  function FollowIt() {
55
41
  _classCallCheck(this, FollowIt);
56
-
57
42
  return _super.apply(this, arguments);
58
43
  }
59
-
60
44
  _createClass(FollowIt, [{
61
45
  key: "render",
62
46
  value: function render() {
63
47
  var _this$props = this.props,
64
- title = _this$props.title,
65
- description = _this$props.description,
66
- actionUrl = _this$props.actionUrl,
67
- buttonTitle = _this$props.buttonTitle;
48
+ title = _this$props.title,
49
+ description = _this$props.description,
50
+ actionUrl = _this$props.actionUrl,
51
+ buttonTitle = _this$props.buttonTitle;
68
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, "form", null, [(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, {
69
53
  "name": "email",
70
54
  "type": "email",
@@ -81,7 +65,6 @@ var FollowIt = /*#__PURE__*/function (_Component) {
81
65
  });
82
66
  }
83
67
  }]);
84
-
85
68
  return FollowIt;
86
69
  }(Component);
87
70
  /**
@@ -99,13 +82,11 @@ var FollowIt = /*#__PURE__*/function (_Component) {
99
82
  * }}
100
83
  * helper={{ __: function() {...} }} />
101
84
  */
102
-
103
-
104
85
  FollowIt.Cacheable = cacheComponent(FollowIt, 'widget.followit', function (props) {
105
86
  var helper = props.helper,
106
- widget = props.widget;
87
+ widget = props.widget;
107
88
  var action_url = widget.action_url,
108
- description = widget.description;
89
+ description = widget.description;
109
90
  return {
110
91
  description: description,
111
92
  actionUrl: action_url,