hexo-component-inferno 2.0.3 → 3.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.
- package/lib/hexo/filter/locals.js +2 -2
- package/lib/hexo/helper/cdn.test.js +7 -7
- package/lib/view/comment/changyan.js +8 -9
- package/lib/view/comment/disqus.js +8 -9
- package/lib/view/comment/disqusjs.js +8 -9
- package/lib/view/comment/facebook.js +8 -9
- package/lib/view/comment/gitalk.js +8 -9
- package/lib/view/comment/gitment.js +8 -9
- package/lib/view/comment/isso.js +8 -9
- package/lib/view/comment/livere.js +8 -9
- package/lib/view/comment/twikoo.js +9 -10
- package/lib/view/comment/utterances.js +10 -11
- package/lib/view/comment/valine.js +8 -9
- package/lib/view/comment/waline.js +8 -9
- package/lib/view/common/article_media.js +8 -9
- package/lib/view/donate/afdian.js +8 -9
- package/lib/view/donate/alipay.js +8 -9
- package/lib/view/donate/buymeacoffee.js +8 -9
- package/lib/view/donate/patreon.js +8 -9
- package/lib/view/donate/paypal.js +8 -9
- package/lib/view/donate/wechat.js +8 -9
- package/lib/view/misc/article_licensing.js +8 -9
- package/lib/view/misc/meta.js +10 -11
- package/lib/view/misc/open_graph.js +8 -9
- package/lib/view/misc/paginator.js +8 -9
- package/lib/view/misc/structured_data.js +8 -9
- package/lib/view/misc/web_app.js +8 -9
- package/lib/view/plugin/baidu_analytics.js +8 -9
- package/lib/view/plugin/bing_webmaster.js +8 -9
- package/lib/view/plugin/busuanzi.js +8 -9
- package/lib/view/plugin/cnzz.js +8 -9
- package/lib/view/plugin/cookie_consent.js +8 -9
- package/lib/view/plugin/gallery.js +8 -9
- package/lib/view/plugin/google_analytics.js +8 -9
- package/lib/view/plugin/hotjar.js +8 -9
- package/lib/view/plugin/katex.js +8 -9
- package/lib/view/plugin/mathjax.js +14 -14
- package/lib/view/plugin/outdated_browser.js +8 -9
- package/lib/view/plugin/progressbar.js +8 -9
- package/lib/view/plugin/statcounter.js +8 -9
- package/lib/view/plugin/twitter_conversion_tracking.js +8 -9
- package/lib/view/search/algolia.js +8 -9
- package/lib/view/search/baidu.js +8 -9
- package/lib/view/search/google_cse.js +8 -9
- package/lib/view/search/insight.js +8 -9
- package/lib/view/share/addthis.js +8 -9
- package/lib/view/share/addtoany.js +8 -9
- package/lib/view/share/bdshare.js +8 -9
- package/lib/view/share/sharejs.js +8 -9
- package/lib/view/share/sharethis.js +8 -9
- package/lib/view/widget/adsense.js +8 -9
- package/lib/view/widget/archives.js +14 -15
- package/lib/view/widget/categories.js +8 -9
- package/lib/view/widget/followit.js +8 -9
- package/lib/view/widget/links.js +8 -9
- package/lib/view/widget/recent_posts.js +8 -9
- package/lib/view/widget/subscribe_email.js +8 -9
- package/lib/view/widget/tags.js +8 -9
- package/lib/view/widget/toc.js +21 -22
- package/lib/view/widget/toc.test.js +30 -0
- package/package.json +31 -29
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
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); }
|
|
4
4
|
var _inferno = require("inferno");
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
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); } }
|
|
7
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; }
|
|
8
|
-
function _toPropertyKey(
|
|
9
|
-
function _toPrimitive(
|
|
10
|
-
function
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? 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)); }
|
|
13
11
|
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); }
|
|
14
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
-
function _isNativeReflectConstruct() {
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
14
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
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); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
17
|
/**
|
|
18
18
|
* Recent posts widget JSX component.
|
|
19
19
|
* @module view/widget/recent_posts
|
|
@@ -43,10 +43,9 @@ var ArticleMedia = require('../common/article_media');
|
|
|
43
43
|
*/
|
|
44
44
|
var RecentPosts = /*#__PURE__*/function (_Component) {
|
|
45
45
|
_inherits(RecentPosts, _Component);
|
|
46
|
-
var _super = _createSuper(RecentPosts);
|
|
47
46
|
function RecentPosts() {
|
|
48
47
|
_classCallCheck(this, RecentPosts);
|
|
49
|
-
return
|
|
48
|
+
return _callSuper(this, RecentPosts, arguments);
|
|
50
49
|
}
|
|
51
50
|
_createClass(RecentPosts, [{
|
|
52
51
|
key: "render",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
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); }
|
|
4
4
|
var _inferno = require("inferno");
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
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); } }
|
|
7
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; }
|
|
8
|
-
function _toPropertyKey(
|
|
9
|
-
function _toPrimitive(
|
|
10
|
-
function
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? 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)); }
|
|
13
11
|
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); }
|
|
14
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
-
function _isNativeReflectConstruct() {
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
14
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
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); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
17
|
/**
|
|
18
18
|
* Google FeedBurner widget JSX component.
|
|
19
19
|
* @module view/widget/subscribe_email
|
|
@@ -36,10 +36,9 @@ var _require2 = require('../../util/cache'),
|
|
|
36
36
|
*/
|
|
37
37
|
var SubscribeEmail = /*#__PURE__*/function (_Component) {
|
|
38
38
|
_inherits(SubscribeEmail, _Component);
|
|
39
|
-
var _super = _createSuper(SubscribeEmail);
|
|
40
39
|
function SubscribeEmail() {
|
|
41
40
|
_classCallCheck(this, SubscribeEmail);
|
|
42
|
-
return
|
|
41
|
+
return _callSuper(this, SubscribeEmail, arguments);
|
|
43
42
|
}
|
|
44
43
|
_createClass(SubscribeEmail, [{
|
|
45
44
|
key: "render",
|
package/lib/view/widget/tags.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
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); }
|
|
4
4
|
var _inferno = require("inferno");
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
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); } }
|
|
7
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; }
|
|
8
|
-
function _toPropertyKey(
|
|
9
|
-
function _toPrimitive(
|
|
10
|
-
function
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? 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)); }
|
|
13
11
|
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); }
|
|
14
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
-
function _isNativeReflectConstruct() {
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
14
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
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); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
17
|
/**
|
|
18
18
|
* Tags widget JSX component.
|
|
19
19
|
* @module view/widget/tags
|
|
@@ -40,10 +40,9 @@ var _require2 = require('../../util/cache'),
|
|
|
40
40
|
*/
|
|
41
41
|
var Tags = /*#__PURE__*/function (_Component) {
|
|
42
42
|
_inherits(Tags, _Component);
|
|
43
|
-
var _super = _createSuper(Tags);
|
|
44
43
|
function Tags() {
|
|
45
44
|
_classCallCheck(this, Tags);
|
|
46
|
-
return
|
|
45
|
+
return _callSuper(this, Tags, arguments);
|
|
47
46
|
}
|
|
48
47
|
_createClass(Tags, [{
|
|
49
48
|
key: "render",
|
package/lib/view/widget/toc.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
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); }
|
|
4
4
|
var _inferno = require("inferno");
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
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); } }
|
|
7
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; }
|
|
8
|
-
function _toPropertyKey(
|
|
9
|
-
function _toPrimitive(
|
|
10
|
-
function
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? 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)); }
|
|
13
11
|
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); }
|
|
14
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
-
function _isNativeReflectConstruct() {
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
14
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
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); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
17
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
18
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -68,34 +68,34 @@ function getToc(content, maxDepth) {
|
|
|
68
68
|
min_depth: 1,
|
|
69
69
|
max_depth: 6
|
|
70
70
|
});
|
|
71
|
-
var
|
|
71
|
+
var levels = Array.from(new Set(tocObj.map(function (item) {
|
|
72
72
|
return item.level;
|
|
73
73
|
}))).sort(function (a, b) {
|
|
74
74
|
return a - b;
|
|
75
75
|
}).slice(0, maxDepth);
|
|
76
|
-
var
|
|
76
|
+
var counters = new Array(levels.length).fill(0);
|
|
77
77
|
tocObj.forEach(function (item) {
|
|
78
|
-
if (!
|
|
78
|
+
if (!levels.includes(item.level)) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
var text = item.text,
|
|
82
82
|
id = item.id;
|
|
83
|
-
var
|
|
84
|
-
for (var i = 0; i <
|
|
85
|
-
if (i >
|
|
86
|
-
|
|
87
|
-
} else if (i <
|
|
88
|
-
if (
|
|
83
|
+
var normalizedLevel = levels.indexOf(item.level);
|
|
84
|
+
for (var i = 0; i < counters.length; i++) {
|
|
85
|
+
if (i > normalizedLevel) {
|
|
86
|
+
counters[i] = 0;
|
|
87
|
+
} else if (i < normalizedLevel) {
|
|
88
|
+
if (counters[i] === 0) {
|
|
89
89
|
// if headings start with a lower level heading, set the former heading index to 1
|
|
90
90
|
// e.g. h3, h2, h1, h2, h3 => 1.1.1, 1.2, 2, 2.1, 2.1.1
|
|
91
|
-
|
|
91
|
+
counters[i] = 1;
|
|
92
92
|
}
|
|
93
93
|
} else {
|
|
94
|
-
|
|
94
|
+
counters[i] += 1;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
var node = toc;
|
|
98
|
-
var _iterator = _createForOfIteratorHelper(
|
|
98
|
+
var _iterator = _createForOfIteratorHelper(counters.slice(0, normalizedLevel + 1)),
|
|
99
99
|
_step;
|
|
100
100
|
try {
|
|
101
101
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -112,7 +112,7 @@ function getToc(content, maxDepth) {
|
|
|
112
112
|
}
|
|
113
113
|
node.id = id;
|
|
114
114
|
node.text = text;
|
|
115
|
-
node.index =
|
|
115
|
+
node.index = counters.slice(0, normalizedLevel + 1).join('.');
|
|
116
116
|
});
|
|
117
117
|
return toc;
|
|
118
118
|
}
|
|
@@ -131,10 +131,9 @@ function getToc(content, maxDepth) {
|
|
|
131
131
|
*/
|
|
132
132
|
var Toc = /*#__PURE__*/function (_Component) {
|
|
133
133
|
_inherits(Toc, _Component);
|
|
134
|
-
var _super = _createSuper(Toc);
|
|
135
134
|
function Toc() {
|
|
136
135
|
_classCallCheck(this, Toc);
|
|
137
|
-
return
|
|
136
|
+
return _callSuper(this, Toc, arguments);
|
|
138
137
|
}
|
|
139
138
|
_createClass(Toc, [{
|
|
140
139
|
key: "renderToc",
|
|
@@ -0,0 +1,30 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
var Toc = require('./toc');
|
|
11
|
+
var _require = require('inferno-test-utils'),
|
|
12
|
+
renderIntoContainer = _require.renderIntoContainer,
|
|
13
|
+
scryRenderedDOMElementsWithClass = _require.scryRenderedDOMElementsWithClass;
|
|
14
|
+
function createTocAndGetLevels(content) {
|
|
15
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
16
|
+
var widget = renderIntoContainer((0, _inferno.normalizeProps)((0, _inferno.createComponentVNode)(2, Toc, _objectSpread({
|
|
17
|
+
"content": content
|
|
18
|
+
}, options))));
|
|
19
|
+
return scryRenderedDOMElementsWithClass(widget, 'level-item').map(function (item) {
|
|
20
|
+
return item.innerHTML;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
test('Correctly render headings', function () {
|
|
24
|
+
var levels = createTocAndGetLevels("\n <h1>Title 1</h1>\n <h2>Title 1.1</h2>\n <h3>Title 1.1.1</h3>\n <h3>Title 1.1.2</h3>\n <h2>Title 1.2</h2>\n <h3>Title 1.2.1</h3>\n <h3>Title 1.2.2</h3>\n <h1>Title 2</h1>\n <h2>Title 2.1</h2>\n <h2>Title 2.2</h2>\n <h3>Title 2.2.1</h3>\n <h3>Title 2.2.2</h3>\n ");
|
|
25
|
+
expect(levels).toEqual(['1', 'Title 1', '1.1', 'Title 1.1', '1.1.1', 'Title 1.1.1', '1.1.2', 'Title 1.1.2', '1.2', 'Title 1.2', '1.2.1', 'Title 1.2.1', '1.2.2', 'Title 1.2.2', '2', 'Title 2', '2.1', 'Title 2.1', '2.2', 'Title 2.2', '2.2.1', 'Title 2.2.1', '2.2.2', 'Title 2.2.2']);
|
|
26
|
+
});
|
|
27
|
+
test('Correctly render disjunct levels of heading', function () {
|
|
28
|
+
var levels = createTocAndGetLevels("\n <h2>Title 1</h2>\n <h2>Title 2</h2>\n <h4>Title 2.1</h4>\n <h4>Title 2.2</h4>\n <h4>Title 2.3</h4>\n <h2>Title 3</h2>\n ");
|
|
29
|
+
expect(levels).toEqual(['1', 'Title 1', '2', 'Title 2', '2.1', 'Title 2.1', '2.2', 'Title 2.2', '2.3', 'Title 2.3', '3', 'Title 3']);
|
|
30
|
+
});
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-component-inferno",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.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",
|
|
7
7
|
"author": "ppoffice <ppoffice@users.noreply.github.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=14"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"test": "jest
|
|
14
|
-
"test-cov": "jest
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"test-cov": "jest --coverage",
|
|
15
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",
|
|
@@ -29,37 +29,39 @@
|
|
|
29
29
|
"asset/"
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/cli": "^7.
|
|
33
|
-
"@babel/core": "^7.
|
|
34
|
-
"@babel/preset-env": "^7.
|
|
35
|
-
"@types/hexo": "^3.8.
|
|
36
|
-
"@types/hexo-util": "^0.6.
|
|
37
|
-
"babel-plugin-inferno": "^6.1
|
|
38
|
-
"cheerio": "^1.0.0-rc.
|
|
39
|
-
"deepmerge": "^4.
|
|
40
|
-
"eslint": "^8.
|
|
32
|
+
"@babel/cli": "^7.23.9",
|
|
33
|
+
"@babel/core": "^7.23.9",
|
|
34
|
+
"@babel/preset-env": "^7.23.9",
|
|
35
|
+
"@types/hexo": "^3.8.12",
|
|
36
|
+
"@types/hexo-util": "^0.6.8",
|
|
37
|
+
"babel-plugin-inferno": "^6.7.1",
|
|
38
|
+
"cheerio": "^1.0.0-rc.12",
|
|
39
|
+
"deepmerge": "^4.3.1",
|
|
40
|
+
"eslint": "^8.56.0",
|
|
41
41
|
"eslint-config-hexo": "^5.0.0",
|
|
42
|
-
"eslint-config-prettier": "^
|
|
43
|
-
"eslint-plugin-jest": "^
|
|
42
|
+
"eslint-config-prettier": "^9.1.0",
|
|
43
|
+
"eslint-plugin-jest": "^27.6.3",
|
|
44
44
|
"eslint-plugin-json": "^3.1.0",
|
|
45
|
-
"eslint-plugin-react": "^7.
|
|
46
|
-
"hexo-renderer-marked": "^
|
|
45
|
+
"eslint-plugin-react": "^7.33.2",
|
|
46
|
+
"hexo-renderer-marked": "^6.2.0",
|
|
47
47
|
"html-minifier": "^4.0.0",
|
|
48
|
-
"inferno-server": "^
|
|
49
|
-
"
|
|
50
|
-
"
|
|
48
|
+
"inferno-server": "^8.2.3",
|
|
49
|
+
"inferno-test-utils": "^8.2.3",
|
|
50
|
+
"jest": "^29.7.0",
|
|
51
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
52
|
+
"jsdoc": "^4.0.2",
|
|
51
53
|
"minami": "^1.2.3",
|
|
52
|
-
"prettier": "^2.
|
|
54
|
+
"prettier": "^3.2.4"
|
|
53
55
|
},
|
|
54
56
|
"dependencies": {
|
|
55
|
-
"ajv": "^8.
|
|
56
|
-
"hexo": "^
|
|
57
|
-
"hexo-pagination": "^
|
|
58
|
-
"hexo-util": "^
|
|
59
|
-
"inferno": "^
|
|
60
|
-
"inferno-create-element": "^
|
|
57
|
+
"ajv": "^8.12.0",
|
|
58
|
+
"hexo": "^7.1.1",
|
|
59
|
+
"hexo-pagination": "^3.0.0",
|
|
60
|
+
"hexo-util": "^3.2.0",
|
|
61
|
+
"inferno": "^8.2.3",
|
|
62
|
+
"inferno-create-element": "^8.2.3",
|
|
61
63
|
"js-yaml": "^4.1.0",
|
|
62
|
-
"moment": "^2.
|
|
63
|
-
"semver": "^7.
|
|
64
|
+
"moment": "^2.30.1",
|
|
65
|
+
"semver": "^7.5.4"
|
|
64
66
|
}
|
|
65
67
|
}
|