mp-darkmode 1.1.5 → 1.1.8
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/dist/darkmode.js +22 -8
- package/dist/darkmode.js.map +1 -1
- package/dist/darkmode.min.js +1 -1
- package/package.json +1 -1
package/dist/darkmode.js
CHANGED
|
@@ -2509,6 +2509,7 @@ function init() {
|
|
|
2509
2509
|
_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultLightBgColor');
|
|
2510
2510
|
_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultDarkTextColor');
|
|
2511
2511
|
_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultDarkBgColor');
|
|
2512
|
+
_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].init();
|
|
2512
2513
|
|
|
2513
2514
|
if (!_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode && mql === null && window.matchMedia) {
|
|
2514
2515
|
// 匹配媒体查询
|
|
@@ -3178,7 +3179,9 @@ var DomUtils = /*#__PURE__*/function () {
|
|
|
3178
3179
|
}, {
|
|
3179
3180
|
key: "hasDelay",
|
|
3180
3181
|
value: function hasDelay() {
|
|
3181
|
-
|
|
3182
|
+
if (this._els.length) return false; // 有节点,即不含延迟处理的节点
|
|
3183
|
+
|
|
3184
|
+
return this._delayEls.length > 0 || _config__WEBPACK_IMPORTED_MODULE_0__["default"].container !== null; // 否则需要判断延迟节点的列表和容器
|
|
3182
3185
|
}
|
|
3183
3186
|
}, {
|
|
3184
3187
|
key: "addFirstPageNode",
|
|
@@ -3609,19 +3612,19 @@ var SDK = /*#__PURE__*/function () {
|
|
|
3609
3612
|
|
|
3610
3613
|
_defineProperty(this, "_idx", 0);
|
|
3611
3614
|
|
|
3612
|
-
_defineProperty(this, "_defaultDarkTextColorRgb",
|
|
3615
|
+
_defineProperty(this, "_defaultDarkTextColorRgb", null);
|
|
3613
3616
|
|
|
3614
|
-
_defineProperty(this, "_defaultDarkBgColorRgb",
|
|
3617
|
+
_defineProperty(this, "_defaultDarkBgColorRgb", null);
|
|
3615
3618
|
|
|
3616
|
-
_defineProperty(this, "_defaultDarkBgColorHSL",
|
|
3619
|
+
_defineProperty(this, "_defaultDarkBgColorHSL", null);
|
|
3617
3620
|
|
|
3618
|
-
_defineProperty(this, "_defaultDarkTextColorBrightness",
|
|
3621
|
+
_defineProperty(this, "_defaultDarkTextColorBrightness", null);
|
|
3619
3622
|
|
|
3620
|
-
_defineProperty(this, "_defaultDarkBgColorBrightness",
|
|
3623
|
+
_defineProperty(this, "_defaultDarkBgColorBrightness", null);
|
|
3621
3624
|
|
|
3622
|
-
_defineProperty(this, "_defaultDarkBgColorHslBrightness",
|
|
3625
|
+
_defineProperty(this, "_defaultDarkBgColorHslBrightness", null);
|
|
3623
3626
|
|
|
3624
|
-
_defineProperty(this, "_maxLimitOffsetBrightness",
|
|
3627
|
+
_defineProperty(this, "_maxLimitOffsetBrightness", null);
|
|
3625
3628
|
|
|
3626
3629
|
_defineProperty(this, "isDarkmode", false);
|
|
3627
3630
|
}
|
|
@@ -3778,6 +3781,17 @@ var SDK = /*#__PURE__*/function () {
|
|
|
3778
3781
|
typeof _config__WEBPACK_IMPORTED_MODULE_3__["default"].error === 'function' && _config__WEBPACK_IMPORTED_MODULE_3__["default"].error(e);
|
|
3779
3782
|
}
|
|
3780
3783
|
}
|
|
3784
|
+
}, {
|
|
3785
|
+
key: "init",
|
|
3786
|
+
value: function init() {
|
|
3787
|
+
this._defaultDarkTextColorRgb = ColorParser(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkTextColor).rgb().array();
|
|
3788
|
+
this._defaultDarkBgColorRgb = ColorParser(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor).rgb().array();
|
|
3789
|
+
this._defaultDarkBgColorHSL = ColorParser(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor).hsl().array();
|
|
3790
|
+
this._defaultDarkTextColorBrightness = getColorPerceivedBrightness(this._defaultDarkTextColorRgb);
|
|
3791
|
+
this._defaultDarkBgColorBrightness = getColorPerceivedBrightness(this._defaultDarkBgColorRgb);
|
|
3792
|
+
this._defaultDarkBgColorHslBrightness = this._defaultDarkBgColorHSL[2];
|
|
3793
|
+
this._maxLimitOffsetBrightness = this._defaultDarkTextColorBrightness - this._defaultDarkBgColorBrightness;
|
|
3794
|
+
}
|
|
3781
3795
|
}, {
|
|
3782
3796
|
key: "convert",
|
|
3783
3797
|
value: function convert(el, cssKVList, isUpdate) {
|