mp-darkmode 1.2.3-beta.2 → 1.2.3-beta.4

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 CHANGED
@@ -7,132 +7,47 @@
7
7
  exports["Darkmode"] = factory();
8
8
  else
9
9
  root["Darkmode"] = factory();
10
- })(window, function() {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
- /******/ }
51
- /******/ };
52
- /******/
53
- /******/ // define __esModule on exports
54
- /******/ __webpack_require__.r = function(exports) {
55
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
- /******/ }
58
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
- /******/ };
60
- /******/
61
- /******/ // create a fake namespace object
62
- /******/ // mode & 1: value is a module id, require it
63
- /******/ // mode & 2: merge all properties of value into the ns
64
- /******/ // mode & 4: return value when already ns object
65
- /******/ // mode & 8|1: behave like require
66
- /******/ __webpack_require__.t = function(value, mode) {
67
- /******/ if(mode & 1) value = __webpack_require__(value);
68
- /******/ if(mode & 8) return value;
69
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
- /******/ var ns = Object.create(null);
71
- /******/ __webpack_require__.r(ns);
72
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
- /******/ return ns;
75
- /******/ };
76
- /******/
77
- /******/ // getDefaultExport function for compatibility with non-harmony modules
78
- /******/ __webpack_require__.n = function(module) {
79
- /******/ var getter = module && module.__esModule ?
80
- /******/ function getDefault() { return module['default']; } :
81
- /******/ function getModuleExports() { return module; };
82
- /******/ __webpack_require__.d(getter, 'a', getter);
83
- /******/ return getter;
84
- /******/ };
85
- /******/
86
- /******/ // Object.prototype.hasOwnProperty.call
87
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
- /******/
89
- /******/ // __webpack_public_path__
90
- /******/ __webpack_require__.p = "";
91
- /******/
92
- /******/
93
- /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = "./src/darkmode.js");
95
- /******/ })
96
- /************************************************************************/
97
- /******/ ({
10
+ })(self, () => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
98
13
 
99
- /***/ "./node_modules/color-blend/dist/index.modern.js":
14
+ /***/ "./node_modules/color-blend/dist/index.modern.js"
100
15
  /*!*******************************************************!*\
101
16
  !*** ./node_modules/color-blend/dist/index.modern.js ***!
102
17
  \*******************************************************/
103
- /*! exports provided: color, colorBurn, colorDodge, darken, difference, exclusion, hardLight, hue, lighten, luminosity, multiply, normal, overlay, saturation, screen, softLight */
104
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
18
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
105
19
 
106
20
  "use strict";
107
21
  __webpack_require__.r(__webpack_exports__);
108
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "color", function() { return R; });
109
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorBurn", function() { return H; });
110
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorDodge", function() { return G; });
111
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "darken", function() { return E; });
112
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return L; });
113
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exclusion", function() { return N; });
114
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hardLight", function() { return J; });
115
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hue", function() { return P; });
116
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lighten", function() { return F; });
117
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "luminosity", function() { return S; });
118
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return B; });
119
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normal", function() { return A; });
120
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "overlay", function() { return D; });
121
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "saturation", function() { return Q; });
122
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "screen", function() { return C; });
123
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "softLight", function() { return K; });
22
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23
+ /* harmony export */ color: () => (/* binding */ R),
24
+ /* harmony export */ colorBurn: () => (/* binding */ H),
25
+ /* harmony export */ colorDodge: () => (/* binding */ G),
26
+ /* harmony export */ darken: () => (/* binding */ E),
27
+ /* harmony export */ difference: () => (/* binding */ L),
28
+ /* harmony export */ exclusion: () => (/* binding */ N),
29
+ /* harmony export */ hardLight: () => (/* binding */ J),
30
+ /* harmony export */ hue: () => (/* binding */ P),
31
+ /* harmony export */ lighten: () => (/* binding */ F),
32
+ /* harmony export */ luminosity: () => (/* binding */ S),
33
+ /* harmony export */ multiply: () => (/* binding */ B),
34
+ /* harmony export */ normal: () => (/* binding */ A),
35
+ /* harmony export */ overlay: () => (/* binding */ D),
36
+ /* harmony export */ saturation: () => (/* binding */ Q),
37
+ /* harmony export */ screen: () => (/* binding */ C),
38
+ /* harmony export */ softLight: () => (/* binding */ K)
39
+ /* harmony export */ });
124
40
  function n(n,r,t){return{r:255*t(n.r/255,r.r/255),g:255*t(n.g/255,r.g/255),b:255*t(n.b/255,r.b/255)}}function r(n,r){return r}function t(n,r){return n*r}function u(n,r){return n+r-n*r}function i(n,r){return a(r,n)}function o(n,r){return Math.min(n,r)}function e(n,r){return Math.min(Math.max(n,r),1)}function c(n,r){return 0===n?0:1===r?1:Math.min(1,n/(1-r))}function f(n,r){return 1===n?1:0===r?0:1-Math.min(1,(1-n)/r)}function a(n,r){return r<=.5?t(n,2*r):u(n,2*r-1)}function b(n,r){return r<=.5?n-(1-2*r)*n*(1-n):n+(2*r-1)*((n<=.25?((16*n-12)*n+4)*n:Math.sqrt(n))-n)}function g(n,r){return Math.abs(n-r)}function h(n,r){return n+r-2*n*r}function M(n,r,t){return Math.min(Math.max(n||0,r),t)}function m(n){return{r:M(n.r,0,255),g:M(n.g,0,255),b:M(n.b,0,255),a:M(n.a,0,1)}}function d(n){return{r:255*n.r,g:255*n.g,b:255*n.b,a:n.a}}function p(n){return{r:n.r/255,g:n.g/255,b:n.b/255,a:n.a}}function v(n,r){void 0===r&&(r=0);var t=Math.pow(10,r);return{r:Math.round(n.r*t)/t,g:Math.round(n.g*t)/t,b:Math.round(n.b*t)/t,a:n.a}}function x(n,r,t,u,i,o){return(1-r/t)*u+r/t*Math.round((1-n)*i+n*o)}function O(n,r,t,u,i){void 0===i&&(i={unitInput:!1,unitOutput:!1,roundOutput:!0}),i.unitInput&&(n=d(n),r=d(r)),n=m(n);var o=(r=m(r)).a+n.a-r.a*n.a,e=t(n,r,u),c=m({r:x(n.a,r.a,o,n.r,r.r,e.r),g:x(n.a,r.a,o,n.g,r.g,e.g),b:x(n.a,r.a,o,n.b,r.b,e.b),a:o});return c=i.unitOutput?p(c):i.roundOutput?v(c):function(n){return v(n,9)}(c),c}function s(n,r,t){return d(t(p(n),p(r)))}function I(n){return.3*n.r+.59*n.g+.11*n.b}function q(n,r){var t=r-I(n);return function(n){var r=I(n),t=n.r,u=n.g,i=n.b,o=Math.min(t,u,i),e=Math.max(t,u,i);function c(n){return r+(n-r)*r/(r-o)}function f(n){return r+(n-r)*(1-r)/(e-r)}return o<0&&(t=c(t),u=c(u),i=c(i)),e>1&&(t=f(t),u=f(u),i=f(i)),{r:t,g:u,b:i}}({r:n.r+t,g:n.g+t,b:n.b+t})}function w(n){return Math.max(n.r,n.g,n.b)-Math.min(n.r,n.g,n.b)}function j(n,r){var t=["r","g","b"].sort(function(r,t){return n[r]-n[t]}),u=t[0],i=t[1],o=t[2],e={r:n.r,g:n.g,b:n.b};return e[o]>e[u]?(e[i]=(e[i]-e[u])*r/(e[o]-e[u]),e[o]=r):e[i]=e[o]=0,e[u]=0,e}function k(n,r){return q(j(r,w(n)),I(n))}function l(n,r){return q(j(n,w(r)),I(n))}function y(n,r){return q(r,I(n))}function z(n,r){return q(n,I(r))}function A(t,u){return O(t,u,n,r)}function B(r,u){return O(r,u,n,t)}function C(r,t){return O(r,t,n,u)}function D(r,t){return O(r,t,n,i)}function E(r,t){return O(r,t,n,o)}function F(r,t){return O(r,t,n,e)}function G(r,t){return O(r,t,n,c)}function H(r,t){return O(r,t,n,f)}function J(r,t){return O(r,t,n,a)}function K(r,t){return O(r,t,n,b)}function L(r,t){return O(r,t,n,g)}function N(r,t){return O(r,t,n,h)}function P(n,r){return O(n,r,s,k)}function Q(n,r){return O(n,r,s,l)}function R(n,r){return O(n,r,s,y)}function S(n,r){return O(n,r,s,z)}
125
41
  //# sourceMappingURL=index.modern.js.map
126
42
 
127
43
 
128
- /***/ }),
44
+ /***/ },
129
45
 
130
- /***/ "./node_modules/color-convert/conversions.js":
46
+ /***/ "./node_modules/color-convert/conversions.js"
131
47
  /*!***************************************************!*\
132
48
  !*** ./node_modules/color-convert/conversions.js ***!
133
49
  \***************************************************/
134
- /*! no static exports found */
135
- /***/ (function(module, exports, __webpack_require__) {
50
+ (module, __unused_webpack_exports, __webpack_require__) {
136
51
 
137
52
  /* MIT license */
138
53
  var cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-convert/node_modules/color-name/index.js");
@@ -1004,14 +919,13 @@ convert.rgb.gray = function (rgb) {
1004
919
  };
1005
920
 
1006
921
 
1007
- /***/ }),
922
+ /***/ },
1008
923
 
1009
- /***/ "./node_modules/color-convert/index.js":
924
+ /***/ "./node_modules/color-convert/index.js"
1010
925
  /*!*********************************************!*\
1011
926
  !*** ./node_modules/color-convert/index.js ***!
1012
927
  \*********************************************/
1013
- /*! no static exports found */
1014
- /***/ (function(module, exports, __webpack_require__) {
928
+ (module, __unused_webpack_exports, __webpack_require__) {
1015
929
 
1016
930
  var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
1017
931
  var route = __webpack_require__(/*! ./route */ "./node_modules/color-convert/route.js");
@@ -1093,14 +1007,13 @@ models.forEach(function (fromModel) {
1093
1007
  module.exports = convert;
1094
1008
 
1095
1009
 
1096
- /***/ }),
1010
+ /***/ },
1097
1011
 
1098
- /***/ "./node_modules/color-convert/node_modules/color-name/index.js":
1012
+ /***/ "./node_modules/color-convert/node_modules/color-name/index.js"
1099
1013
  /*!*********************************************************************!*\
1100
1014
  !*** ./node_modules/color-convert/node_modules/color-name/index.js ***!
1101
1015
  \*********************************************************************/
1102
- /*! no static exports found */
1103
- /***/ (function(module, exports, __webpack_require__) {
1016
+ (module) {
1104
1017
 
1105
1018
  "use strict";
1106
1019
 
@@ -1257,14 +1170,13 @@ module.exports = {
1257
1170
  };
1258
1171
 
1259
1172
 
1260
- /***/ }),
1173
+ /***/ },
1261
1174
 
1262
- /***/ "./node_modules/color-convert/route.js":
1175
+ /***/ "./node_modules/color-convert/route.js"
1263
1176
  /*!*********************************************!*\
1264
1177
  !*** ./node_modules/color-convert/route.js ***!
1265
1178
  \*********************************************/
1266
- /*! no static exports found */
1267
- /***/ (function(module, exports, __webpack_require__) {
1179
+ (module, __unused_webpack_exports, __webpack_require__) {
1268
1180
 
1269
1181
  var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
1270
1182
 
@@ -1365,14 +1277,13 @@ module.exports = function (fromModel) {
1365
1277
 
1366
1278
 
1367
1279
 
1368
- /***/ }),
1280
+ /***/ },
1369
1281
 
1370
- /***/ "./node_modules/color-name/index.js":
1282
+ /***/ "./node_modules/color-name/index.js"
1371
1283
  /*!******************************************!*\
1372
1284
  !*** ./node_modules/color-name/index.js ***!
1373
1285
  \******************************************/
1374
- /*! no static exports found */
1375
- /***/ (function(module, exports, __webpack_require__) {
1286
+ (module) {
1376
1287
 
1377
1288
  "use strict";
1378
1289
 
@@ -1529,21 +1440,20 @@ module.exports = {
1529
1440
  };
1530
1441
 
1531
1442
 
1532
- /***/ }),
1443
+ /***/ },
1533
1444
 
1534
- /***/ "./node_modules/color-string/index.js":
1445
+ /***/ "./node_modules/color-string/index.js"
1535
1446
  /*!********************************************!*\
1536
1447
  !*** ./node_modules/color-string/index.js ***!
1537
1448
  \********************************************/
1538
- /*! no static exports found */
1539
- /***/ (function(module, exports, __webpack_require__) {
1449
+ (module, __unused_webpack_exports, __webpack_require__) {
1540
1450
 
1541
1451
  /* MIT license */
1542
1452
  var colorNames = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
1543
1453
  var swizzle = __webpack_require__(/*! simple-swizzle */ "./node_modules/simple-swizzle/index.js");
1544
1454
  var hasOwnProperty = Object.hasOwnProperty;
1545
1455
 
1546
- var reverseNames = {};
1456
+ var reverseNames = Object.create(null);
1547
1457
 
1548
1458
  // create a list of reverse color names
1549
1459
  for (var name in colorNames) {
@@ -1782,14 +1692,13 @@ function hexDouble(num) {
1782
1692
  }
1783
1693
 
1784
1694
 
1785
- /***/ }),
1695
+ /***/ },
1786
1696
 
1787
- /***/ "./node_modules/color/index.js":
1697
+ /***/ "./node_modules/color/index.js"
1788
1698
  /*!*************************************!*\
1789
1699
  !*** ./node_modules/color/index.js ***!
1790
1700
  \*************************************/
1791
- /*! no static exports found */
1792
- /***/ (function(module, exports, __webpack_require__) {
1701
+ (module, __unused_webpack_exports, __webpack_require__) {
1793
1702
 
1794
1703
  "use strict";
1795
1704
 
@@ -2276,14 +2185,13 @@ function zeroArray(arr, length) {
2276
2185
  module.exports = Color;
2277
2186
 
2278
2187
 
2279
- /***/ }),
2188
+ /***/ },
2280
2189
 
2281
- /***/ "./node_modules/is-arrayish/index.js":
2190
+ /***/ "./node_modules/is-arrayish/index.js"
2282
2191
  /*!*******************************************!*\
2283
2192
  !*** ./node_modules/is-arrayish/index.js ***!
2284
2193
  \*******************************************/
2285
- /*! no static exports found */
2286
- /***/ (function(module, exports) {
2194
+ (module) {
2287
2195
 
2288
2196
  module.exports = function isArrayish(obj) {
2289
2197
  if (!obj || typeof obj === 'string') {
@@ -2296,14 +2204,13 @@ module.exports = function isArrayish(obj) {
2296
2204
  };
2297
2205
 
2298
2206
 
2299
- /***/ }),
2207
+ /***/ },
2300
2208
 
2301
- /***/ "./node_modules/simple-swizzle/index.js":
2209
+ /***/ "./node_modules/simple-swizzle/index.js"
2302
2210
  /*!**********************************************!*\
2303
2211
  !*** ./node_modules/simple-swizzle/index.js ***!
2304
2212
  \**********************************************/
2305
- /*! no static exports found */
2306
- /***/ (function(module, exports, __webpack_require__) {
2213
+ (module, __unused_webpack_exports, __webpack_require__) {
2307
2214
 
2308
2215
  "use strict";
2309
2216
 
@@ -2337,310 +2244,27 @@ swizzle.wrap = function (fn) {
2337
2244
  };
2338
2245
 
2339
2246
 
2340
- /***/ }),
2341
-
2342
- /***/ "./src/darkmode.js":
2343
- /*!*************************!*\
2344
- !*** ./src/darkmode.js ***!
2345
- \*************************/
2346
- /*! exports provided: run, init, convertBg, updateStyle, getContrast, extend */
2347
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2348
-
2349
- "use strict";
2350
- __webpack_require__.r(__webpack_exports__);
2351
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "run", function() { return run; });
2352
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
2353
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBg", function() { return convertBg; });
2354
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateStyle", function() { return updateStyle; });
2355
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getContrast", function() { return getContrast; });
2356
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; });
2357
- /* harmony import */ var _modules_constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/constant */ "./src/modules/constant.js");
2358
- /* harmony import */ var _modules_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/config */ "./src/modules/config.js");
2359
- /* harmony import */ var _modules_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/global */ "./src/modules/global.js");
2360
- /* harmony import */ var _modules_domUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/domUtils */ "./src/modules/domUtils.js");
2361
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2362
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2363
- 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); }
2364
- 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; }
2365
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
2366
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2367
- /**
2368
- * @name Darkmode主入口
2369
- *
2370
- * @function run 初始化Dark Mode配置并运行Dark Mode处理
2371
- * @param {DOM Object Array} nodes 要处理的节点列表
2372
- * @param {Object} opt Dark Mode配置,详见init配置说明
2373
- * @return void
2374
- *
2375
- * @function init 初始化Dark Mode配置
2376
- * @param {Function} opt.begin 开始处理时触发的回调
2377
- * @param {Function} opt.showFirstPage 首屏处理完成时触发的回调
2378
- * @param {Function} opt.error 发生error时触发的回调
2379
- * @param {string} opt.mode 强制指定的颜色模式(dark|light), 指定了就不监听系统颜色
2380
- * @param {Object} opt.whitelist 节点白名单
2381
- * @param {Array} opt.whitelist.tagName 标签名列表
2382
- * @param {Array} opt.whitelist.attribute 属性列表
2383
- * @param {boolean} opt.needJudgeFirstPage 是否需要判断首屏
2384
- * @param {boolean} opt.delayBgJudge 是否延迟背景判断
2385
- * @param {DOM Object} opt.container 延迟运行js时使用的容器
2386
- * @param {string} opt.cssSelectorsPrefix css选择器前缀
2387
- * @param {string} opt.defaultLightTextColor 非Dark Mode下字体颜色
2388
- * @param {string} opt.defaultLightBgColor 非Dark Mode下背景颜色
2389
- * @param {string} opt.defaultDarkTextColor Dark Mode下字体颜色
2390
- * @param {string} opt.defaultDarkBgColor Dark Mode下背景颜色
2391
- * @return void
2392
- *
2393
- * @function convertBg 处理背景
2394
- * @param {DOM Object Array} nodes 要处理的节点列表
2395
- * @return void
2396
- *
2397
- * @function updateStyle 更新节点Dark Mode样式
2398
- * @param {DOM Object} node 要更新的节点
2399
- * @param {Object} styles 更新的样式键值对对象,如:{ color: '#ddd' }
2400
- * @return void
2401
- *
2402
- * @function getContrast 获取两个颜色的对比度
2403
- * @param {string} color1 要计算颜色对比度的颜色1,支持css颜色格式
2404
- * @param {string} color2 要计算颜色对比度的颜色2,支持css颜色格式
2405
- * @return {number} 颜色对比度,取值范围为`[1, 21]`
2406
- *
2407
- * @function extend 挂载插件
2408
- * @param {Array} pluginList 插件列表
2409
- * @return void
2410
- *
2411
- */
2412
-
2413
- // 常量
2414
-
2415
- var classReg = new RegExp("".concat(_modules_constant__WEBPACK_IMPORTED_MODULE_0__["CLASS_PREFIX"], "[^ ]+"), 'g');
2416
-
2417
- // Darkmode配置
2418
-
2419
-
2420
-
2421
-
2422
- // Dark Mode切换
2423
- var mql = null;
2424
- var switchToDarkmode = function switchToDarkmode(mqlObj) {
2425
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
2426
- type: 'dom'
2427
- };
2428
- opt.force && (_modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].isFinish = false); // 如果是强制运行Dark Mode处理逻辑,则重置为未运行
2429
-
2430
- if (_modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].isFinish) return; // 已运行过Dark Mode处理逻辑则不再运行
2431
-
2432
- try {
2433
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode = _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode ? _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode === 'dark' : mqlObj.matches;
2434
- if (opt.type === 'dom') {
2435
- // 处理节点
2436
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode && typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].begin === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].begin(_modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].hasDelay());
2437
- Array.prototype.forEach.call(_modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].get(), function (node) {
2438
- if (_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode && node.className && typeof node.className === 'string') {
2439
- node.className = node.className.replace(classReg, ''); // 过滤掉原有的Dark Mode class,避免外部复制文章时把文章内的Dark Mode class也复制过去导致新文章在Dark Mode下样式错乱
2440
- }
2441
-
2442
- if (_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode || _modules_global__WEBPACK_IMPORTED_MODULE_2__["plugins"].length) {
2443
- if (!_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage) {
2444
- // 不需要判断首屏
2445
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].convert(node)); // 写入非首屏样式
2446
- } else {
2447
- // 判断首屏
2448
- var rect = node.getBoundingClientRect();
2449
- var top = rect.top;
2450
- var bottom = rect.bottom;
2451
- if (top <= 0 && bottom <= 0) {
2452
- // 首屏前面
2453
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].convert(node)); // 写入非首屏样式
2454
- } else if (top > 0 && top < _modules_constant__WEBPACK_IMPORTED_MODULE_0__["PAGE_HEIGHT"] || bottom > 0 && bottom < _modules_constant__WEBPACK_IMPORTED_MODULE_0__["PAGE_HEIGHT"]) {
2455
- // 首屏
2456
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].addFirstPageNode(node); // 记录首屏节点
2457
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].convert(node), true); // 写入首屏样式
2458
- } else {
2459
- // 首屏后面,理论上,这里最多只会进来一次
2460
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage = false; // 至此,不需要再判断首屏了
2461
-
2462
- // 显示首屏
2463
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].writeStyle(true); // 写入首屏样式表
2464
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].showFirstPageNodes(); // 显示首屏节点
2465
- typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage(); // 执行首屏回调
2466
-
2467
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].convert(node)); // 写入非首屏样式
2468
- }
2469
- }
2470
- }
2471
- });
2472
-
2473
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["plugins"].loopTimes++;
2474
- } else if (opt.type === 'bg') {
2475
- // 处理背景
2476
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode && _modules_global__WEBPACK_IMPORTED_MODULE_2__["tnQueue"].forEach(function (text) {
2477
- return _modules_global__WEBPACK_IMPORTED_MODULE_2__["bgStack"].contains(text, function (bg) {
2478
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].genCss(bg.className, bg.cssKV)); // 写入非首屏样式
2479
- typeof bg.cb === 'function' && bg.cb(bg);
2480
-
2481
- // 还得处理该背景下的所有新老节点
2482
- [bg.elOld, bg.el].forEach(function (el) {
2483
- var _el$COLORATTR, _el$BGCOLORATTR, _el$ORIGINAL_COLORATT, _el$ORIGINAL_BGCOLORA, _el$BGIMAGEATTR, _el$COMPLEMENTARY_BGI;
2484
- var inheritAttrs = [[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["COLORATTR"], (_el$COLORATTR = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["COLORATTR"]]) !== null && _el$COLORATTR !== void 0 ? _el$COLORATTR : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__["BGCOLORATTR"], (_el$BGCOLORATTR = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["BGCOLORATTR"]]) !== null && _el$BGCOLORATTR !== void 0 ? _el$BGCOLORATTR : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__["ORIGINAL_COLORATTR"], (_el$ORIGINAL_COLORATT = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["ORIGINAL_COLORATTR"]]) !== null && _el$ORIGINAL_COLORATT !== void 0 ? _el$ORIGINAL_COLORATT : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__["ORIGINAL_BGCOLORATTR"], (_el$ORIGINAL_BGCOLORA = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["ORIGINAL_BGCOLORATTR"]]) !== null && _el$ORIGINAL_BGCOLORA !== void 0 ? _el$ORIGINAL_BGCOLORA : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__["BGIMAGEATTR"], (_el$BGIMAGEATTR = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["BGIMAGEATTR"]]) !== null && _el$BGIMAGEATTR !== void 0 ? _el$BGIMAGEATTR : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__["COMPLEMENTARY_BGIMAGECOLORATTR"], (_el$COMPLEMENTARY_BGI = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__["COMPLEMENTARY_BGIMAGECOLORATTR"]]) !== null && _el$COMPLEMENTARY_BGI !== void 0 ? _el$COMPLEMENTARY_BGI : null]];
2485
- var children = Object(_modules_domUtils__WEBPACK_IMPORTED_MODULE_3__["getChildrenAndIt"])(el, true);
2486
- children.forEach(function (child) {
2487
- // 重置继承属性
2488
- inheritAttrs.forEach(function (_ref) {
2489
- var _ref2 = _slicedToArray(_ref, 2),
2490
- attr = _ref2[0],
2491
- value = _ref2[1];
2492
- if (value === null) {
2493
- delete child[attr];
2494
- } else {
2495
- child[attr] = value;
2496
- }
2497
- });
2498
- });
2499
- children.forEach(function (child) {
2500
- // 重新运行Dark Mode处理逻辑
2501
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].convert(child, undefined, false, true));
2502
- });
2503
- });
2504
- });
2505
- });
2506
- }
2507
- if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage || !_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage && !_modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].showFirstPage) {
2508
- // config.needJudgeFirstPage === ture,表示需要判断首屏但是正文长度没超过一屏
2509
- // config.needJudgeFirstPage === false && domUtils.showFirstPage === false,表示不需要判断首屏且没有做首屏优化
2510
- typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage(); // 执行首屏回调
2511
- }
2512
-
2513
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].writeStyle(); // 写入非首屏样式表
2514
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].emptyFirstPageNodes(); // 清空记录的首屏节点
2515
-
2516
- if (!_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode) {
2517
- // 非Dark Mode
2518
- // 首次加载页面时为非Dark Mode,标记为不需要判断首屏
2519
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage = false;
2520
-
2521
- // 首次加载页面时为非Dark Mode,标记为不延迟判断背景
2522
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].delayBgJudge = false;
2523
- if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].container === null && opt.type === 'dom' && _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].length) {
2524
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].delay(); // 将节点转移到延迟处理队列里
2525
- }
2526
- }
2527
- } catch (e) {
2528
- console.log('An error occurred when running the dark mode conversion algorithm\n', e);
2529
- typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].error === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].error(e);
2530
- }
2531
- };
2532
-
2533
- // 初始化Dark Mode配置并运行Dark Mode处理
2534
- function run(nodes, opt) {
2535
- init(opt); // 初始化配置
2536
-
2537
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].set(nodes);
2538
- switchToDarkmode(mql, {
2539
- force: true,
2540
- type: 'dom'
2541
- });
2542
- }
2543
- ;
2544
-
2545
- // 初始化Dark Mode配置
2546
- function init() {
2547
- var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2548
- if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].hasInit) return; // 只可设置一次配置
2549
-
2550
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].hasInit = true; // 记录为配置已设置
2551
-
2552
- var tagName = _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].whitelist.tagName;
2553
- var attribute = _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].whitelist.attribute;
2554
- if (opt.whitelist) {
2555
- opt.whitelist.tagName instanceof Array && opt.whitelist.tagName.forEach(function (item) {
2556
- item = item.toUpperCase();
2557
- tagName.indexOf(item) === -1 && tagName.push(item);
2558
- });
2559
- opt.whitelist.attribute instanceof Array && opt.whitelist.attribute.forEach(function (item) {
2560
- attribute.indexOf(item) === -1 && attribute.push(item);
2561
- });
2562
- }
2563
- if (['dark', 'light'].indexOf(opt.mode) > -1) {
2564
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'mode');
2565
- opt.mode === 'dark' && document.getElementsByTagName('html')[0].classList.add(_modules_constant__WEBPACK_IMPORTED_MODULE_0__["HTML_CLASS"]);
2566
- }
2567
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('function', opt, 'begin');
2568
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('function', opt, 'showFirstPage');
2569
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('function', opt, 'error');
2570
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('boolean', opt, 'needJudgeFirstPage');
2571
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('boolean', opt, 'delayBgJudge');
2572
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('dom', opt, 'container');
2573
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'cssSelectorsPrefix');
2574
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultLightTextColor');
2575
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultLightBgColor');
2576
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultDarkTextColor');
2577
- _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultDarkBgColor');
2578
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].init();
2579
- if (!_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode && mql === null && window.matchMedia) {
2580
- // 匹配媒体查询
2581
- mql = window.matchMedia(_modules_constant__WEBPACK_IMPORTED_MODULE_0__["MEDIA_QUERY"]);
2582
- mql.addListener(switchToDarkmode); // 监听
2583
- }
2584
- }
2585
-
2586
- ;
2587
-
2588
- // 处理背景
2589
- function convertBg(nodes) {
2590
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["domUtils"].set(nodes);
2591
- if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].container !== null) {
2592
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["bgStack"].update(nodes); // 更新背景堆栈
2593
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["tnQueue"].update(nodes); // 更新文字队列
2594
- }
2247
+ /***/ },
2595
2248
 
2596
- switchToDarkmode(mql, {
2597
- force: true,
2598
- type: 'bg'
2599
- });
2600
- }
2601
- ;
2602
-
2603
- // 更新节点Dark Mode样式
2604
- function updateStyle(node, styles) {
2605
- if (!_modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].isFinish) return; // 没有运行过Dark Mode处理逻辑则无需运行
2606
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].convert(node, styles ? Object.keys(styles).map(function (key) {
2607
- return [key, styles[key]];
2608
- }) : undefined, true), false);
2609
- _modules_global__WEBPACK_IMPORTED_MODULE_2__["cssUtils"].writeStyle();
2610
- }
2611
- ;
2612
-
2613
- // 获取两个颜色的对比度
2614
- function getContrast(color1, color2) {
2615
- return _modules_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].getContrast(color1, color2);
2616
- }
2617
- ;
2618
-
2619
- // 挂载插件
2620
- function extend(pluginList) {
2621
- pluginList.forEach(function (plugin) {
2622
- return _modules_global__WEBPACK_IMPORTED_MODULE_2__["plugins"].extend(plugin);
2623
- });
2624
- }
2625
- ;
2626
-
2627
- /***/ }),
2628
-
2629
- /***/ "./src/modules/bgNodeStack.js":
2249
+ /***/ "./src/modules/bgNodeStack.js"
2630
2250
  /*!************************************!*\
2631
2251
  !*** ./src/modules/bgNodeStack.js ***!
2632
2252
  \************************************/
2633
- /*! exports provided: default */
2634
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2253
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2635
2254
 
2636
2255
  "use strict";
2637
2256
  __webpack_require__.r(__webpack_exports__);
2638
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return BgNodeStack; });
2257
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2258
+ /* harmony export */ "default": () => (/* binding */ BgNodeStack)
2259
+ /* harmony export */ });
2639
2260
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./src/modules/config.js");
2640
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2641
- 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); } }
2642
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2643
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2261
+ 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); }
2262
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
2263
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
2264
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
2265
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2266
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
2267
+ 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); }
2644
2268
  /**
2645
2269
  * @name 需要判断位置的背景节点堆栈
2646
2270
  *
@@ -2668,19 +2292,19 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
2668
2292
  // Darkmode配置
2669
2293
 
2670
2294
  var BgNodeStack = /*#__PURE__*/function () {
2671
- // 需要判断位置的背景堆栈,{ elOld, el, className, cssKV, updated, rect }
2672
2295
  // 索引值
2673
2296
 
2674
2297
  function BgNodeStack(prefix) {
2675
2298
  _classCallCheck(this, BgNodeStack);
2676
2299
  _defineProperty(this, "_stack", []);
2300
+ // 需要判断位置的背景堆栈,{ elOld, el, className, cssKV, updated, rect }
2677
2301
  _defineProperty(this, "_idx", 0);
2678
2302
  this._prefix = prefix;
2679
2303
  this.classNameReg = new RegExp("".concat(this._prefix, "\\d+"));
2680
2304
  }
2681
2305
 
2682
2306
  // 背景节点入栈
2683
- _createClass(BgNodeStack, [{
2307
+ return _createClass(BgNodeStack, [{
2684
2308
  key: "push",
2685
2309
  value: function push(el, cssKV, cb) {
2686
2310
  var className = "".concat(this._prefix).concat(this._idx++);
@@ -2736,28 +2360,28 @@ var BgNodeStack = /*#__PURE__*/function () {
2736
2360
  });
2737
2361
  }
2738
2362
  }]);
2739
- return BgNodeStack;
2740
2363
  }();
2741
2364
 
2742
2365
  ;
2743
2366
 
2744
- /***/ }),
2367
+ /***/ },
2745
2368
 
2746
- /***/ "./src/modules/color.js":
2369
+ /***/ "./src/modules/color.js"
2747
2370
  /*!******************************!*\
2748
2371
  !*** ./src/modules/color.js ***!
2749
2372
  \******************************/
2750
- /*! exports provided: ColorParser, parseColorName, parseWebkitFillColorAndStrokeColor, mixColors, getColorPerceivedBrightness, adjustBrightnessTo */
2751
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2373
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2752
2374
 
2753
2375
  "use strict";
2754
2376
  __webpack_require__.r(__webpack_exports__);
2755
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorParser", function() { return ColorParser; });
2756
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseColorName", function() { return parseColorName; });
2757
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseWebkitFillColorAndStrokeColor", function() { return parseWebkitFillColorAndStrokeColor; });
2758
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mixColors", function() { return mixColors; });
2759
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getColorPerceivedBrightness", function() { return getColorPerceivedBrightness; });
2760
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "adjustBrightnessTo", function() { return adjustBrightnessTo; });
2377
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2378
+ /* harmony export */ ColorParser: () => (/* binding */ ColorParser),
2379
+ /* harmony export */ adjustBrightnessTo: () => (/* binding */ adjustBrightnessTo),
2380
+ /* harmony export */ getColorPerceivedBrightness: () => (/* binding */ getColorPerceivedBrightness),
2381
+ /* harmony export */ mixColors: () => (/* binding */ mixColors),
2382
+ /* harmony export */ parseColorName: () => (/* binding */ parseColorName),
2383
+ /* harmony export */ parseWebkitFillColorAndStrokeColor: () => (/* binding */ parseWebkitFillColorAndStrokeColor)
2384
+ /* harmony export */ });
2761
2385
  /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! color */ "./node_modules/color/index.js");
2762
2386
  /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(color__WEBPACK_IMPORTED_MODULE_0__);
2763
2387
  /* harmony import */ var color_name__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
@@ -2798,13 +2422,13 @@ __webpack_require__.r(__webpack_exports__);
2798
2422
 
2799
2423
 
2800
2424
 
2801
- color_name__WEBPACK_IMPORTED_MODULE_1___default.a.windowtext = [0, 0, 0]; // 补上这个colorName
2802
- color_name__WEBPACK_IMPORTED_MODULE_1___default.a.transparent = [255, 255, 255, 0]; // 支持透明,暂定用白色透明度0来表示
2425
+ (color_name__WEBPACK_IMPORTED_MODULE_1___default().windowtext) = [0, 0, 0]; // 补上这个colorName
2426
+ (color_name__WEBPACK_IMPORTED_MODULE_1___default().transparent) = [255, 255, 255, 0]; // 支持透明,暂定用白色透明度0来表示
2803
2427
 
2804
2428
 
2805
2429
  // 常量
2806
2430
 
2807
- var COLOR_NAME_REG = new RegExp(Object.keys(color_name__WEBPACK_IMPORTED_MODULE_1___default.a).map(function (colorName) {
2431
+ var COLOR_NAME_REG = new RegExp(Object.keys((color_name__WEBPACK_IMPORTED_MODULE_1___default())).map(function (colorName) {
2808
2432
  return "\\b".concat(colorName, "\\b");
2809
2433
  }).join('|'), 'ig'); // 生成正则表达式来匹配这些colorName
2810
2434
 
@@ -2827,7 +2451,7 @@ var colorBlend2Color = function colorBlend2Color(colorBlend) {
2827
2451
  var ColorParser = function ColorParser(color) {
2828
2452
  var res = null;
2829
2453
  try {
2830
- res = color instanceof color__WEBPACK_IMPORTED_MODULE_0___default.a ? color : color__WEBPACK_IMPORTED_MODULE_0___default()(color);
2454
+ res = color instanceof (color__WEBPACK_IMPORTED_MODULE_0___default()) ? color : color__WEBPACK_IMPORTED_MODULE_0___default()(color);
2831
2455
  } catch (e) {
2832
2456
  console.log("ignore the invalid color: `".concat(color, "`"));
2833
2457
  }
@@ -2836,10 +2460,10 @@ var ColorParser = function ColorParser(color) {
2836
2460
 
2837
2461
  // 处理颜色,包括清除!important和转换英文定义颜色
2838
2462
  var parseColorName = function parseColorName(color, supportTransparent) {
2839
- return color.replace(_constant__WEBPACK_IMPORTED_MODULE_3__["IMPORTANT_REGEXP"], '').replace(COLOR_NAME_REG, function (match) {
2463
+ return color.replace(_constant__WEBPACK_IMPORTED_MODULE_3__.IMPORTANT_REGEXP, '').replace(COLOR_NAME_REG, function (match) {
2840
2464
  if (!supportTransparent && match === 'transparent') return match; // 如果不支持转换transparent,直接返回transparent
2841
2465
 
2842
- var color = color_name__WEBPACK_IMPORTED_MODULE_1___default.a[match.toLowerCase()];
2466
+ var color = (color_name__WEBPACK_IMPORTED_MODULE_1___default())[match.toLowerCase()];
2843
2467
  return "".concat(color.length > 3 ? 'rgba' : 'rgb', "(").concat(color.toString(), ")");
2844
2468
  });
2845
2469
  };
@@ -2847,7 +2471,7 @@ var parseColorName = function parseColorName(color, supportTransparent) {
2847
2471
  // 处理-webkit-fill-color和-webkit-text-stroke-color,返回处理后的色值,无则返回空字符串
2848
2472
  var parseWebkitFillColorAndStrokeColor = function parseWebkitFillColorAndStrokeColor(color) {
2849
2473
  var newValue = parseColorName(color);
2850
- return _constant__WEBPACK_IMPORTED_MODULE_3__["COLOR_REGEXP"].test(newValue) ? newValue : '';
2474
+ return _constant__WEBPACK_IMPORTED_MODULE_3__.COLOR_REGEXP.test(newValue) ? newValue : '';
2851
2475
  };
2852
2476
 
2853
2477
  // 计算混合颜色
@@ -2894,20 +2518,22 @@ var adjustBrightnessTo = function adjustBrightnessTo(target, rgb) {
2894
2518
  } else if (newTextB === 0 || newTextG === 255) {
2895
2519
  newTextB = (target * 1000 - newTextR * 299 - newTextG * 587) / 114;
2896
2520
  }
2897
- return color__WEBPACK_IMPORTED_MODULE_0___default.a.rgb(newTextR, newTextG, newTextB);
2521
+ return color__WEBPACK_IMPORTED_MODULE_0___default().rgb(newTextR, newTextG, newTextB);
2898
2522
  };
2899
2523
 
2900
- /***/ }),
2524
+ /***/ },
2901
2525
 
2902
- /***/ "./src/modules/config.js":
2526
+ /***/ "./src/modules/config.js"
2903
2527
  /*!*******************************!*\
2904
2528
  !*** ./src/modules/config.js ***!
2905
2529
  \*******************************/
2906
- /*! exports provided: default */
2907
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2530
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2908
2531
 
2909
2532
  "use strict";
2910
2533
  __webpack_require__.r(__webpack_exports__);
2534
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2535
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2536
+ /* harmony export */ });
2911
2537
  /* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constant */ "./src/modules/constant.js");
2912
2538
  /**
2913
2539
  * @name Darkmode配置
@@ -2959,7 +2585,6 @@ var config = {
2959
2585
  // 标签名列表
2960
2586
  attribute: [] // 属性列表
2961
2587
  },
2962
-
2963
2588
  needJudgeFirstPage: true,
2964
2589
  // 是否需要判断首屏
2965
2590
  delayBgJudge: false,
@@ -2968,13 +2593,13 @@ var config = {
2968
2593
  // 延迟运行js时使用的容器
2969
2594
  cssSelectorsPrefix: '',
2970
2595
  // css选择器前缀
2971
- defaultLightTextColor: _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_LIGHT_TEXTCOLOR"],
2596
+ defaultLightTextColor: _constant__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_LIGHT_TEXTCOLOR,
2972
2597
  // 非Dark Mode下字体颜色
2973
- defaultLightBgColor: _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_LIGHT_BGCOLOR"],
2598
+ defaultLightBgColor: _constant__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_LIGHT_BGCOLOR,
2974
2599
  // 非Dark Mode下背景颜色
2975
- defaultDarkTextColor: _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_DARK_TEXTCOLOR"],
2600
+ defaultDarkTextColor: _constant__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_DARK_TEXTCOLOR,
2976
2601
  // Dark Mode下字体颜色
2977
- defaultDarkBgColor: _constant__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_DARK_BGCOLOR"],
2602
+ defaultDarkBgColor: _constant__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_DARK_BGCOLOR,
2978
2603
  // Dark Mode下背景颜色
2979
2604
  // 设置配置
2980
2605
  set: function set(type, opt, key) {
@@ -2996,50 +2621,51 @@ var config = {
2996
2621
  }
2997
2622
  }
2998
2623
  };
2999
- /* harmony default export */ __webpack_exports__["default"] = (config);
2624
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (config);
3000
2625
 
3001
- /***/ }),
2626
+ /***/ },
3002
2627
 
3003
- /***/ "./src/modules/constant.js":
2628
+ /***/ "./src/modules/constant.js"
3004
2629
  /*!*********************************!*\
3005
2630
  !*** ./src/modules/constant.js ***!
3006
2631
  \*********************************/
3007
- /*! exports provided: MEDIA_QUERY, CLASS_PREFIX, DM_CLASSNAME_REGEXP, HTML_CLASS, COLORATTR, BGCOLORATTR, ORIGINAL_COLORATTR, ORIGINAL_BGCOLORATTR, BGIMAGEATTR, COMPLEMENTARY_BGIMAGECOLORATTR, BG_COLOR_DELIMITER, DEFAULT_LIGHT_TEXTCOLOR, DEFAULT_LIGHT_BGCOLOR, DEFAULT_DARK_TEXTCOLOR, DEFAULT_DARK_BGCOLOR, WHITE_LIKE_COLOR_BRIGHTNESS, MAX_LIMIT_BGCOLOR_BRIGHTNESS, MIN_LIMIT_OFFSET_BRIGHTNESS, HIGH_BGCOLOR_BRIGHTNESS, HIGH_BLACKWHITE_HSL_BRIGHTNESS, LOW_BLACKWHITE_HSL_BRIGHTNESS, IGNORE_ALPHA, PAGE_HEIGHT, CSS_PROP_SERIES, CSS_PROP_LIST, TABLE_NAME, IMPORTANT_REGEXP, SEMICOLON_PLACEHOLDER, SEMICOLON_PLACEHOLDER_REGEXP, COLOR_REGEXP, COLOR_REGEXP_GLOBAL */
3008
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2632
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3009
2633
 
3010
2634
  "use strict";
3011
2635
  __webpack_require__.r(__webpack_exports__);
3012
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MEDIA_QUERY", function() { return MEDIA_QUERY; });
3013
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_PREFIX", function() { return CLASS_PREFIX; });
3014
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DM_CLASSNAME_REGEXP", function() { return DM_CLASSNAME_REGEXP; });
3015
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTML_CLASS", function() { return HTML_CLASS; });
3016
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COLORATTR", function() { return COLORATTR; });
3017
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BGCOLORATTR", function() { return BGCOLORATTR; });
3018
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ORIGINAL_COLORATTR", function() { return ORIGINAL_COLORATTR; });
3019
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ORIGINAL_BGCOLORATTR", function() { return ORIGINAL_BGCOLORATTR; });
3020
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BGIMAGEATTR", function() { return BGIMAGEATTR; });
3021
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPLEMENTARY_BGIMAGECOLORATTR", function() { return COMPLEMENTARY_BGIMAGECOLORATTR; });
3022
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BG_COLOR_DELIMITER", function() { return BG_COLOR_DELIMITER; });
3023
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_LIGHT_TEXTCOLOR", function() { return DEFAULT_LIGHT_TEXTCOLOR; });
3024
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_LIGHT_BGCOLOR", function() { return DEFAULT_LIGHT_BGCOLOR; });
3025
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_DARK_TEXTCOLOR", function() { return DEFAULT_DARK_TEXTCOLOR; });
3026
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_DARK_BGCOLOR", function() { return DEFAULT_DARK_BGCOLOR; });
3027
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WHITE_LIKE_COLOR_BRIGHTNESS", function() { return WHITE_LIKE_COLOR_BRIGHTNESS; });
3028
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_LIMIT_BGCOLOR_BRIGHTNESS", function() { return MAX_LIMIT_BGCOLOR_BRIGHTNESS; });
3029
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MIN_LIMIT_OFFSET_BRIGHTNESS", function() { return MIN_LIMIT_OFFSET_BRIGHTNESS; });
3030
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HIGH_BGCOLOR_BRIGHTNESS", function() { return HIGH_BGCOLOR_BRIGHTNESS; });
3031
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HIGH_BLACKWHITE_HSL_BRIGHTNESS", function() { return HIGH_BLACKWHITE_HSL_BRIGHTNESS; });
3032
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOW_BLACKWHITE_HSL_BRIGHTNESS", function() { return LOW_BLACKWHITE_HSL_BRIGHTNESS; });
3033
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IGNORE_ALPHA", function() { return IGNORE_ALPHA; });
3034
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PAGE_HEIGHT", function() { return PAGE_HEIGHT; });
3035
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CSS_PROP_SERIES", function() { return CSS_PROP_SERIES; });
3036
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CSS_PROP_LIST", function() { return CSS_PROP_LIST; });
3037
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TABLE_NAME", function() { return TABLE_NAME; });
3038
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IMPORTANT_REGEXP", function() { return IMPORTANT_REGEXP; });
3039
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SEMICOLON_PLACEHOLDER", function() { return SEMICOLON_PLACEHOLDER; });
3040
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SEMICOLON_PLACEHOLDER_REGEXP", function() { return SEMICOLON_PLACEHOLDER_REGEXP; });
3041
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COLOR_REGEXP", function() { return COLOR_REGEXP; });
3042
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COLOR_REGEXP_GLOBAL", function() { return COLOR_REGEXP_GLOBAL; });
2636
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2637
+ /* harmony export */ BGCOLORATTR: () => (/* binding */ BGCOLORATTR),
2638
+ /* harmony export */ BGIMAGEATTR: () => (/* binding */ BGIMAGEATTR),
2639
+ /* harmony export */ BG_COLOR_DELIMITER: () => (/* binding */ BG_COLOR_DELIMITER),
2640
+ /* harmony export */ CLASS_PREFIX: () => (/* binding */ CLASS_PREFIX),
2641
+ /* harmony export */ COLORATTR: () => (/* binding */ COLORATTR),
2642
+ /* harmony export */ COLOR_REGEXP: () => (/* binding */ COLOR_REGEXP),
2643
+ /* harmony export */ COLOR_REGEXP_GLOBAL: () => (/* binding */ COLOR_REGEXP_GLOBAL),
2644
+ /* harmony export */ COMPLEMENTARY_BGIMAGECOLORATTR: () => (/* binding */ COMPLEMENTARY_BGIMAGECOLORATTR),
2645
+ /* harmony export */ CSS_PROP_LIST: () => (/* binding */ CSS_PROP_LIST),
2646
+ /* harmony export */ CSS_PROP_SERIES: () => (/* binding */ CSS_PROP_SERIES),
2647
+ /* harmony export */ DEFAULT_DARK_BGCOLOR: () => (/* binding */ DEFAULT_DARK_BGCOLOR),
2648
+ /* harmony export */ DEFAULT_DARK_TEXTCOLOR: () => (/* binding */ DEFAULT_DARK_TEXTCOLOR),
2649
+ /* harmony export */ DEFAULT_LIGHT_BGCOLOR: () => (/* binding */ DEFAULT_LIGHT_BGCOLOR),
2650
+ /* harmony export */ DEFAULT_LIGHT_TEXTCOLOR: () => (/* binding */ DEFAULT_LIGHT_TEXTCOLOR),
2651
+ /* harmony export */ DM_CLASSNAME_REGEXP: () => (/* binding */ DM_CLASSNAME_REGEXP),
2652
+ /* harmony export */ HIGH_BGCOLOR_BRIGHTNESS: () => (/* binding */ HIGH_BGCOLOR_BRIGHTNESS),
2653
+ /* harmony export */ HIGH_BLACKWHITE_HSL_BRIGHTNESS: () => (/* binding */ HIGH_BLACKWHITE_HSL_BRIGHTNESS),
2654
+ /* harmony export */ HTML_CLASS: () => (/* binding */ HTML_CLASS),
2655
+ /* harmony export */ IGNORE_ALPHA: () => (/* binding */ IGNORE_ALPHA),
2656
+ /* harmony export */ IMPORTANT_REGEXP: () => (/* binding */ IMPORTANT_REGEXP),
2657
+ /* harmony export */ LOW_BLACKWHITE_HSL_BRIGHTNESS: () => (/* binding */ LOW_BLACKWHITE_HSL_BRIGHTNESS),
2658
+ /* harmony export */ MAX_LIMIT_BGCOLOR_BRIGHTNESS: () => (/* binding */ MAX_LIMIT_BGCOLOR_BRIGHTNESS),
2659
+ /* harmony export */ MEDIA_QUERY: () => (/* binding */ MEDIA_QUERY),
2660
+ /* harmony export */ MIN_LIMIT_OFFSET_BRIGHTNESS: () => (/* binding */ MIN_LIMIT_OFFSET_BRIGHTNESS),
2661
+ /* harmony export */ ORIGINAL_BGCOLORATTR: () => (/* binding */ ORIGINAL_BGCOLORATTR),
2662
+ /* harmony export */ ORIGINAL_COLORATTR: () => (/* binding */ ORIGINAL_COLORATTR),
2663
+ /* harmony export */ PAGE_HEIGHT: () => (/* binding */ PAGE_HEIGHT),
2664
+ /* harmony export */ SEMICOLON_PLACEHOLDER: () => (/* binding */ SEMICOLON_PLACEHOLDER),
2665
+ /* harmony export */ SEMICOLON_PLACEHOLDER_REGEXP: () => (/* binding */ SEMICOLON_PLACEHOLDER_REGEXP),
2666
+ /* harmony export */ TABLE_NAME: () => (/* binding */ TABLE_NAME),
2667
+ /* harmony export */ WHITE_LIKE_COLOR_BRIGHTNESS: () => (/* binding */ WHITE_LIKE_COLOR_BRIGHTNESS)
2668
+ /* harmony export */ });
3043
2669
  /**
3044
2670
  * @name 常量
3045
2671
  *
@@ -3092,7 +2718,6 @@ var CSS_PROP_SERIES = {
3092
2718
  // 'filter'
3093
2719
  // ],
3094
2720
  };
3095
-
3096
2721
  var CSS_PROP_LIST = Object.keys(CSS_PROP_SERIES).map(function (key) {
3097
2722
  return CSS_PROP_SERIES[key].join('|');
3098
2723
  }).join('|').split('|'); // 支持的css属性平铺列表
@@ -3105,31 +2730,35 @@ var SEMICOLON_PLACEHOLDER_REGEXP = /<\$#_SEMICOLON_#\$>/g;
3105
2730
  var COLOR_REGEXP = /\brgba?\([^)]+\)/i;
3106
2731
  var COLOR_REGEXP_GLOBAL = /\brgba?\([^)]+\)/ig;
3107
2732
 
3108
- /***/ }),
2733
+ /***/ },
3109
2734
 
3110
- /***/ "./src/modules/cssUtils.js":
2735
+ /***/ "./src/modules/cssUtils.js"
3111
2736
  /*!*********************************!*\
3112
2737
  !*** ./src/modules/cssUtils.js ***!
3113
2738
  \*********************************/
3114
- /*! exports provided: default */
3115
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2739
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3116
2740
 
3117
2741
  "use strict";
3118
2742
  __webpack_require__.r(__webpack_exports__);
3119
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CssUtils; });
2743
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2744
+ /* harmony export */ "default": () => (/* binding */ CssUtils)
2745
+ /* harmony export */ });
3120
2746
  /* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constant */ "./src/modules/constant.js");
3121
2747
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config */ "./src/modules/config.js");
3122
2748
  /* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./global */ "./src/modules/global.js");
3123
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2749
+ 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); }
2750
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3124
2751
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3125
- 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); }
3126
- 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; }
3127
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3128
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3129
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3130
- 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); } }
3131
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3132
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2752
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
2753
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2754
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
2755
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2756
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
2757
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
2758
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
2759
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2760
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
2761
+ 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); }
3133
2762
  /**
3134
2763
  * @name 样式相关操作工具对象
3135
2764
  *
@@ -3174,26 +2803,25 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
3174
2803
 
3175
2804
 
3176
2805
  var CssUtils = /*#__PURE__*/function () {
3177
- // 首屏样式
3178
- // 非首屏样式
3179
- // 监听器,用于监听生成css键值对
3180
-
3181
2806
  // 是否运行过Dark Mode处理逻辑(写入过非首屏样式表则表示已运行过)
3182
2807
 
3183
2808
  function CssUtils() {
3184
2809
  _classCallCheck(this, CssUtils);
3185
2810
  _defineProperty(this, "_firstPageStyle", '');
2811
+ // 首屏样式
3186
2812
  _defineProperty(this, "_otherPageStyle", '');
2813
+ // 非首屏样式
3187
2814
  _defineProperty(this, "_watcher", {});
2815
+ // 监听器,用于监听生成css键值对
3188
2816
  _defineProperty(this, "isFinish", false);
3189
2817
  }
3190
2818
 
3191
2819
  // 生成css键值对
3192
- _createClass(CssUtils, [{
2820
+ return _createClass(CssUtils, [{
3193
2821
  key: "genCssKV",
3194
2822
  value: function genCssKV(key, val) {
3195
2823
  var _this$_watcher$key, _this$_watcher;
3196
- (_this$_watcher$key = (_this$_watcher = this._watcher)[key]) === null || _this$_watcher$key === void 0 ? void 0 : _this$_watcher$key.call(_this$_watcher);
2824
+ (_this$_watcher$key = (_this$_watcher = this._watcher)[key]) === null || _this$_watcher$key === void 0 || _this$_watcher$key.call(_this$_watcher);
3197
2825
  return "".concat(key, ": ").concat(val, " !important;");
3198
2826
  }
3199
2827
 
@@ -3201,7 +2829,7 @@ var CssUtils = /*#__PURE__*/function () {
3201
2829
  }, {
3202
2830
  key: "genCss",
3203
2831
  value: function genCss(className, cssKV) {
3204
- return "".concat(_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode === 'dark' ? "html.".concat(_constant__WEBPACK_IMPORTED_MODULE_0__["HTML_CLASS"], " ") : '').concat(_config__WEBPACK_IMPORTED_MODULE_1__["default"].cssSelectorsPrefix && "".concat(_config__WEBPACK_IMPORTED_MODULE_1__["default"].cssSelectorsPrefix, " "), ".").concat(className, "{").concat(cssKV, "}");
2832
+ return "".concat(_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode === 'dark' ? "html.".concat(_constant__WEBPACK_IMPORTED_MODULE_0__.HTML_CLASS, " ") : '').concat(_config__WEBPACK_IMPORTED_MODULE_1__["default"].cssSelectorsPrefix && "".concat(_config__WEBPACK_IMPORTED_MODULE_1__["default"].cssSelectorsPrefix, " "), ".").concat(className, "{").concat(cssKV, "}");
3205
2833
  }
3206
2834
 
3207
2835
  // 加入css
@@ -3210,7 +2838,7 @@ var CssUtils = /*#__PURE__*/function () {
3210
2838
  value: function addCss(css) {
3211
2839
  var isFirstPageStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3212
2840
  this[isFirstPageStyle ? '_firstPageStyle' : '_otherPageStyle'] += css;
3213
- _global__WEBPACK_IMPORTED_MODULE_2__["plugins"].addCss(isFirstPageStyle);
2841
+ _global__WEBPACK_IMPORTED_MODULE_2__.plugins.addCss(isFirstPageStyle);
3214
2842
  }
3215
2843
 
3216
2844
  // 写入样式表
@@ -3218,19 +2846,19 @@ var CssUtils = /*#__PURE__*/function () {
3218
2846
  key: "writeStyle",
3219
2847
  value: function writeStyle() {
3220
2848
  var isFirstPageStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3221
- !isFirstPageStyle && _global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode && (this.isFinish = true); // 在Dark Mode下一旦写入了非首屏样式表,则认为已经运行过Dark Mode处理逻辑
2849
+ !isFirstPageStyle && _global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode && (this.isFinish = true); // 在Dark Mode下一旦写入了非首屏样式表,则认为已经运行过Dark Mode处理逻辑
3222
2850
 
3223
2851
  // 获取样式表内容
3224
- var styles = (_global__WEBPACK_IMPORTED_MODULE_2__["sdk"].isDarkmode ? [{
2852
+ var styles = (_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode ? [{
3225
2853
  target: this,
3226
2854
  key: ['_firstPageStyle', '_otherPageStyle'],
3227
2855
  needMediaQuery: true
3228
2856
  }] : []).concat([{
3229
- target: _global__WEBPACK_IMPORTED_MODULE_2__["plugins"],
2857
+ target: _global__WEBPACK_IMPORTED_MODULE_2__.plugins,
3230
2858
  key: ['firstPageStyle', 'otherPageStyle'],
3231
2859
  needMediaQuery: true
3232
2860
  }, {
3233
- target: _global__WEBPACK_IMPORTED_MODULE_2__["plugins"],
2861
+ target: _global__WEBPACK_IMPORTED_MODULE_2__.plugins,
3234
2862
  key: ['firstPageStyleNoMQ', 'otherPageStyleNoMQ'],
3235
2863
  needMediaQuery: false
3236
2864
  }]).map(function (_ref) {
@@ -3251,7 +2879,7 @@ var CssUtils = /*#__PURE__*/function () {
3251
2879
  var style = target[styleKey];
3252
2880
  if (style) {
3253
2881
  target[styleKey] = ''; // 写入样式表后清空内存中的数据
3254
- return _config__WEBPACK_IMPORTED_MODULE_1__["default"].mode === 'dark' || !needMediaQuery ? style : "@media ".concat(_constant__WEBPACK_IMPORTED_MODULE_0__["MEDIA_QUERY"], " {").concat(style, "}");
2882
+ return _config__WEBPACK_IMPORTED_MODULE_1__["default"].mode === 'dark' || !needMediaQuery ? style : "@media ".concat(_constant__WEBPACK_IMPORTED_MODULE_0__.MEDIA_QUERY, " {").concat(style, "}");
3255
2883
  }
3256
2884
  return '';
3257
2885
  }).join('');
@@ -3274,38 +2902,41 @@ var CssUtils = /*#__PURE__*/function () {
3274
2902
  delete this._watcher[key];
3275
2903
  }
3276
2904
  }]);
3277
- return CssUtils;
3278
2905
  }();
3279
2906
 
3280
2907
  ;
3281
2908
 
3282
- /***/ }),
2909
+ /***/ },
3283
2910
 
3284
- /***/ "./src/modules/domUtils.js":
2911
+ /***/ "./src/modules/domUtils.js"
3285
2912
  /*!*********************************!*\
3286
2913
  !*** ./src/modules/domUtils.js ***!
3287
2914
  \*********************************/
3288
- /*! exports provided: getChildrenAndIt, hasTextNode, hasTableClass, DomUtils */
3289
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2915
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3290
2916
 
3291
2917
  "use strict";
3292
2918
  __webpack_require__.r(__webpack_exports__);
3293
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getChildrenAndIt", function() { return getChildrenAndIt; });
3294
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasTextNode", function() { return hasTextNode; });
3295
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasTableClass", function() { return hasTableClass; });
3296
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomUtils", function() { return DomUtils; });
2919
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2920
+ /* harmony export */ DomUtils: () => (/* binding */ DomUtils),
2921
+ /* harmony export */ getChildrenAndIt: () => (/* binding */ getChildrenAndIt),
2922
+ /* harmony export */ hasTableClass: () => (/* binding */ hasTableClass),
2923
+ /* harmony export */ hasTextNode: () => (/* binding */ hasTextNode)
2924
+ /* harmony export */ });
3297
2925
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./src/modules/config.js");
3298
2926
  /* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./global */ "./src/modules/global.js");
3299
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3300
- 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); } }
3301
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3302
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3303
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2927
+ 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); }
2928
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
2929
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
2930
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
2931
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2932
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
2933
+ 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); }
2934
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3304
2935
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3305
- 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); }
3306
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3307
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3308
- 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; }
2936
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
2937
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
2938
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
2939
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3309
2940
  /**
3310
2941
  * @name 节点相关操作工具API
3311
2942
  *
@@ -3402,22 +3033,21 @@ function hasTableClass(el) {
3402
3033
  */
3403
3034
 
3404
3035
  var DomUtils = /*#__PURE__*/function () {
3405
- // 要处理的节点列表
3406
- // 首屏节点列表
3407
- // 延迟处理的节点列表
3408
-
3409
3036
  // 是否已显示首屏
3410
3037
 
3411
3038
  function DomUtils() {
3412
3039
  _classCallCheck(this, DomUtils);
3413
3040
  _defineProperty(this, "_els", []);
3041
+ // 要处理的节点列表
3414
3042
  _defineProperty(this, "_firstPageEls", []);
3043
+ // 首屏节点列表
3415
3044
  _defineProperty(this, "_delayEls", []);
3045
+ // 延迟处理的节点列表
3416
3046
  _defineProperty(this, "showFirstPage", false);
3417
3047
  }
3418
3048
 
3419
3049
  // 要处理的节点列表长度
3420
- _createClass(DomUtils, [{
3050
+ return _createClass(DomUtils, [{
3421
3051
  key: "length",
3422
3052
  get: function get() {
3423
3053
  return this._els.length;
@@ -3439,7 +3069,7 @@ var DomUtils = /*#__PURE__*/function () {
3439
3069
  if (this._els.length) {
3440
3070
  // 有节点
3441
3071
  res = this._els;
3442
- _global__WEBPACK_IMPORTED_MODULE_1__["sdk"].isDarkmode && (this._els = []);
3072
+ _global__WEBPACK_IMPORTED_MODULE_1__.sdk.isDarkmode && (this._els = []);
3443
3073
  } else {
3444
3074
  // 如果没有节点
3445
3075
  if (this._delayEls.length) {
@@ -3497,27 +3127,27 @@ var DomUtils = /*#__PURE__*/function () {
3497
3127
  this._firstPageEls = [];
3498
3128
  }
3499
3129
  }]);
3500
- return DomUtils;
3501
3130
  }();
3502
3131
  ;
3503
3132
 
3504
- /***/ }),
3133
+ /***/ },
3505
3134
 
3506
- /***/ "./src/modules/global.js":
3135
+ /***/ "./src/modules/global.js"
3507
3136
  /*!*******************************!*\
3508
3137
  !*** ./src/modules/global.js ***!
3509
3138
  \*******************************/
3510
- /*! exports provided: plugins, tnQueue, bgStack, cssUtils, domUtils, sdk */
3511
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3139
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3512
3140
 
3513
3141
  "use strict";
3514
3142
  __webpack_require__.r(__webpack_exports__);
3515
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "plugins", function() { return plugins; });
3516
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tnQueue", function() { return tnQueue; });
3517
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bgStack", function() { return bgStack; });
3518
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssUtils", function() { return cssUtils; });
3519
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "domUtils", function() { return domUtils; });
3520
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sdk", function() { return sdk; });
3143
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3144
+ /* harmony export */ bgStack: () => (/* binding */ bgStack),
3145
+ /* harmony export */ cssUtils: () => (/* binding */ cssUtils),
3146
+ /* harmony export */ domUtils: () => (/* binding */ domUtils),
3147
+ /* harmony export */ plugins: () => (/* binding */ plugins),
3148
+ /* harmony export */ sdk: () => (/* binding */ sdk),
3149
+ /* harmony export */ tnQueue: () => (/* binding */ tnQueue)
3150
+ /* harmony export */ });
3521
3151
  /* harmony import */ var _constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constant */ "./src/modules/constant.js");
3522
3152
  /* harmony import */ var _plugins__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./plugins */ "./src/modules/plugins.js");
3523
3153
  /* harmony import */ var _textNodeQueue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./textNodeQueue */ "./src/modules/textNodeQueue.js");
@@ -3539,11 +3169,11 @@ var plugins = new _plugins__WEBPACK_IMPORTED_MODULE_1__["default"]();
3539
3169
 
3540
3170
  // 文本节点队列
3541
3171
 
3542
- var tnQueue = new _textNodeQueue__WEBPACK_IMPORTED_MODULE_2__["default"]("".concat(_constant__WEBPACK_IMPORTED_MODULE_0__["CLASS_PREFIX"], "text__"));
3172
+ var tnQueue = new _textNodeQueue__WEBPACK_IMPORTED_MODULE_2__["default"]("".concat(_constant__WEBPACK_IMPORTED_MODULE_0__.CLASS_PREFIX, "text__"));
3543
3173
 
3544
3174
  // 需要判断位置的背景节点堆栈
3545
3175
 
3546
- var bgStack = new _bgNodeStack__WEBPACK_IMPORTED_MODULE_3__["default"]("".concat(_constant__WEBPACK_IMPORTED_MODULE_0__["CLASS_PREFIX"], "bg__"));
3176
+ var bgStack = new _bgNodeStack__WEBPACK_IMPORTED_MODULE_3__["default"]("".concat(_constant__WEBPACK_IMPORTED_MODULE_0__.CLASS_PREFIX, "bg__"));
3547
3177
 
3548
3178
  // 样式相关操作工具对象
3549
3179
 
@@ -3551,29 +3181,33 @@ var cssUtils = new _cssUtils__WEBPACK_IMPORTED_MODULE_4__["default"]();
3551
3181
 
3552
3182
  // 节点相关操作工具对象
3553
3183
 
3554
- var domUtils = new _domUtils__WEBPACK_IMPORTED_MODULE_5__["DomUtils"]();
3184
+ var domUtils = new _domUtils__WEBPACK_IMPORTED_MODULE_5__.DomUtils();
3555
3185
 
3556
3186
  // sdk
3557
3187
 
3558
3188
  var sdk = new _sdk__WEBPACK_IMPORTED_MODULE_6__["default"]();
3559
3189
 
3560
- /***/ }),
3190
+ /***/ },
3561
3191
 
3562
- /***/ "./src/modules/plugins.js":
3192
+ /***/ "./src/modules/plugins.js"
3563
3193
  /*!********************************!*\
3564
3194
  !*** ./src/modules/plugins.js ***!
3565
3195
  \********************************/
3566
- /*! exports provided: default */
3567
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3196
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3568
3197
 
3569
3198
  "use strict";
3570
3199
  __webpack_require__.r(__webpack_exports__);
3571
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Plugins; });
3200
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3201
+ /* harmony export */ "default": () => (/* binding */ Plugins)
3202
+ /* harmony export */ });
3572
3203
  /* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./global */ "./src/modules/global.js");
3573
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3574
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3575
- 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); } }
3576
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3204
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3205
+ 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); }
3206
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3207
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
3208
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
3209
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
3210
+ 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); }
3577
3211
  /**
3578
3212
  * @name 插件基类
3579
3213
  *
@@ -3600,17 +3234,17 @@ var Plugin = /*#__PURE__*/function () {
3600
3234
  }
3601
3235
 
3602
3236
  // 遍历次数(全部节点遍历结束算一次)
3603
- _createClass(Plugin, [{
3237
+ return _createClass(Plugin, [{
3604
3238
  key: "loopTimes",
3605
3239
  get: function get() {
3606
- return _global__WEBPACK_IMPORTED_MODULE_0__["plugins"].loopTimes;
3240
+ return _global__WEBPACK_IMPORTED_MODULE_0__.plugins.loopTimes;
3607
3241
  }
3608
3242
 
3609
3243
  // 是否为Dark Mode
3610
3244
  }, {
3611
3245
  key: "isDarkmode",
3612
3246
  get: function get() {
3613
- return _global__WEBPACK_IMPORTED_MODULE_0__["sdk"].isDarkmode;
3247
+ return _global__WEBPACK_IMPORTED_MODULE_0__.sdk.isDarkmode;
3614
3248
  }
3615
3249
 
3616
3250
  // 添加样式
@@ -3618,14 +3252,13 @@ var Plugin = /*#__PURE__*/function () {
3618
3252
  key: "addCss",
3619
3253
  value: function addCss(className, kvList) {
3620
3254
  var needMediaQuery = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3621
- (needMediaQuery ? cssNeedMQ : cssNoMQ).push(_global__WEBPACK_IMPORTED_MODULE_0__["cssUtils"].genCss(className, kvList.map(function (_ref) {
3255
+ (needMediaQuery ? cssNeedMQ : cssNoMQ).push(_global__WEBPACK_IMPORTED_MODULE_0__.cssUtils.genCss(className, kvList.map(function (_ref) {
3622
3256
  var key = _ref.key,
3623
3257
  value = _ref.value;
3624
- return _global__WEBPACK_IMPORTED_MODULE_0__["cssUtils"].genCssKV(key, value);
3258
+ return _global__WEBPACK_IMPORTED_MODULE_0__.cssUtils.genCssKV(key, value);
3625
3259
  }).join('')));
3626
3260
  }
3627
3261
  }]);
3628
- return Plugin;
3629
3262
  }();
3630
3263
  /**
3631
3264
  * @name 插件系统
@@ -3657,28 +3290,27 @@ var Plugin = /*#__PURE__*/function () {
3657
3290
  *
3658
3291
  */
3659
3292
  var Plugins = /*#__PURE__*/function () {
3660
- // 已挂载的插件列表
3661
-
3662
- // 已挂载的插件数量
3663
- // 已遍历次数(全部节点遍历结束算一次)
3664
- // 首屏样式
3665
- // 非首屏样式
3666
- // 首屏样式(不需要加媒体查询)
3667
3293
  // 非首屏样式(不需要加媒体查询)
3668
3294
 
3669
3295
  function Plugins() {
3670
3296
  _classCallCheck(this, Plugins);
3671
3297
  _defineProperty(this, "_plugins", []);
3298
+ // 已挂载的插件列表
3672
3299
  _defineProperty(this, "length", 0);
3300
+ // 已挂载的插件数量
3673
3301
  _defineProperty(this, "loopTimes", 0);
3302
+ // 已遍历次数(全部节点遍历结束算一次)
3674
3303
  _defineProperty(this, "firstPageStyle", '');
3304
+ // 首屏样式
3675
3305
  _defineProperty(this, "otherPageStyle", '');
3306
+ // 非首屏样式
3676
3307
  _defineProperty(this, "firstPageStyleNoMQ", '');
3308
+ // 首屏样式(不需要加媒体查询)
3677
3309
  _defineProperty(this, "otherPageStyleNoMQ", '');
3678
3310
  }
3679
3311
 
3680
3312
  // 挂载插件
3681
- _createClass(Plugins, [{
3313
+ return _createClass(Plugins, [{
3682
3314
  key: "extend",
3683
3315
  value: function extend(plugin) {
3684
3316
  this._plugins.push(new (plugin(Plugin))());
@@ -3718,23 +3350,23 @@ var Plugins = /*#__PURE__*/function () {
3718
3350
  cssNoMQ = [];
3719
3351
  }
3720
3352
  }]);
3721
- return Plugins;
3722
3353
  }();
3723
3354
 
3724
3355
  ;
3725
3356
 
3726
- /***/ }),
3357
+ /***/ },
3727
3358
 
3728
- /***/ "./src/modules/sdk.js":
3359
+ /***/ "./src/modules/sdk.js"
3729
3360
  /*!****************************!*\
3730
3361
  !*** ./src/modules/sdk.js ***!
3731
3362
  \****************************/
3732
- /*! exports provided: default */
3733
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3363
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3734
3364
 
3735
3365
  "use strict";
3736
3366
  __webpack_require__.r(__webpack_exports__);
3737
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return SDK; });
3367
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3368
+ /* harmony export */ "default": () => (/* binding */ SDK)
3369
+ /* harmony export */ });
3738
3370
  /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! color */ "./node_modules/color/index.js");
3739
3371
  /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(color__WEBPACK_IMPORTED_MODULE_0__);
3740
3372
  /* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./color */ "./src/modules/color.js");
@@ -3742,20 +3374,23 @@ __webpack_require__.r(__webpack_exports__);
3742
3374
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./config */ "./src/modules/config.js");
3743
3375
  /* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./global */ "./src/modules/global.js");
3744
3376
  /* harmony import */ var _domUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./domUtils */ "./src/modules/domUtils.js");
3745
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3377
+ 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); }
3378
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3746
3379
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3747
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3748
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3749
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3380
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
3381
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
3382
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3750
3383
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3751
- 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); }
3752
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3753
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3754
- 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; }
3755
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3756
- 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); } }
3757
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3758
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3384
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3385
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
3386
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
3387
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
3388
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3389
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
3390
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
3391
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3392
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
3393
+ 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); }
3759
3394
  /**
3760
3395
  * @name 算法SDK
3761
3396
  *
@@ -3791,13 +3426,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
3791
3426
  // 节点相关操作工具API
3792
3427
 
3793
3428
  var SDK = /*#__PURE__*/function () {
3794
- // 索引值
3795
-
3796
3429
  // 当前是否需要运行Darkmode处理
3797
3430
 
3798
3431
  function SDK() {
3799
3432
  _classCallCheck(this, SDK);
3800
3433
  _defineProperty(this, "_idx", 0);
3434
+ // 索引值
3801
3435
  _defineProperty(this, "_defaultDarkTextColorRgb", null);
3802
3436
  _defineProperty(this, "_defaultDarkBgColorRgb", null);
3803
3437
  _defineProperty(this, "_defaultDarkBgColorHSL", null);
@@ -3809,7 +3443,7 @@ var SDK = /*#__PURE__*/function () {
3809
3443
  }
3810
3444
 
3811
3445
  // 调整明度
3812
- _createClass(SDK, [{
3446
+ return _createClass(SDK, [{
3813
3447
  key: "_adjustBrightness",
3814
3448
  value: function _adjustBrightness(color, el, options, isUpdate, needReset) {
3815
3449
  // 背景:
@@ -3831,17 +3465,17 @@ var SDK = /*#__PURE__*/function () {
3831
3465
  var extStyle = '';
3832
3466
  if (options.isBgColor) {
3833
3467
  // 背景色
3834
- if (alpha >= _constant__WEBPACK_IMPORTED_MODULE_2__["IGNORE_ALPHA"]) {
3468
+ if (alpha >= _constant__WEBPACK_IMPORTED_MODULE_2__.IGNORE_ALPHA) {
3835
3469
  // 如果设置背景颜色,取消背景图片的影响
3836
- if (el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]]) delete el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]];
3470
+ if (el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR]) delete el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR];
3837
3471
 
3838
3472
  // 如果有背景图片补色
3839
- if (el[_constant__WEBPACK_IMPORTED_MODULE_2__["COMPLEMENTARY_BGIMAGECOLORATTR"]]) {
3473
+ if (el[_constant__WEBPACK_IMPORTED_MODULE_2__.COMPLEMENTARY_BGIMAGECOLORATTR]) {
3840
3474
  // 背景图片补色和当前背景色一致,则无需处理
3841
3475
  // 根据最小可觉差Just-noticeable difference(即JND,表示人类或动物对于某一特定的感官刺激所能察觉的最小改变)和韦伯-费希纳定律,在特定条件下,人类能感知小至 0.5% - 2% 的变化,0.5%换算成对比度为1.1
3842
3476
  // https://zh.wikipedia.org/wiki/%E6%9C%80%E5%B0%8F%E5%8F%AF%E8%A6%BA%E5%B7%AE 最小可觉差wiki
3843
3477
  // https://zh.wikipedia.org/wiki/%E9%9F%8B%E4%BC%AF-%E8%B2%BB%E5%B8%8C%E7%B4%8D%E5%AE%9A%E7%90%86 韦伯-费希纳定理wiki
3844
- if (el[_constant__WEBPACK_IMPORTED_MODULE_2__["COMPLEMENTARY_BGIMAGECOLORATTR"]] === color.toString() || this.getContrast(el[_constant__WEBPACK_IMPORTED_MODULE_2__["COMPLEMENTARY_BGIMAGECOLORATTR"]], color.toString()) < 1.1) {
3478
+ if (el[_constant__WEBPACK_IMPORTED_MODULE_2__.COMPLEMENTARY_BGIMAGECOLORATTR] === color.toString() || this.getContrast(el[_constant__WEBPACK_IMPORTED_MODULE_2__.COMPLEMENTARY_BGIMAGECOLORATTR], color.toString()) < 1.1) {
3845
3479
  return {
3846
3480
  newColor: needReset ? color.toString() : '',
3847
3481
  extStyle: extStyle
@@ -3849,34 +3483,34 @@ var SDK = /*#__PURE__*/function () {
3849
3483
  }
3850
3484
 
3851
3485
  // 否则取消背景图片补色的影响
3852
- Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(el).forEach(function (dom) {
3853
- delete dom[_constant__WEBPACK_IMPORTED_MODULE_2__["COMPLEMENTARY_BGIMAGECOLORATTR"]];
3486
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
3487
+ delete dom[_constant__WEBPACK_IMPORTED_MODULE_2__.COMPLEMENTARY_BGIMAGECOLORATTR];
3854
3488
  });
3855
3489
  }
3856
3490
  }
3857
3491
  newColor = this._adjustBackgroundBrightness(color);
3858
3492
  if (!options.hasInlineColor) {
3859
- var parentTextColorStr = el[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_COLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightTextColor;
3860
- var parentTextColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(parentTextColorStr);
3493
+ var parentTextColorStr = el[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_COLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightTextColor;
3494
+ var parentTextColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(parentTextColorStr);
3861
3495
  if (parentTextColor) {
3862
3496
  var ret = this._adjustBrightness(parentTextColor, el, {
3863
3497
  isTextColor: true,
3864
3498
  parentElementBgColorStr: newColor || color
3865
3499
  }, isUpdate, needReset);
3866
- if (ret.newColor) {
3867
- extStyle += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('color', ret.newColor);
3868
- } else {
3869
- extStyle += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('color', parentTextColor);
3870
- }
3500
+ extStyle += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('color', ret.newColor || parentTextColor);
3501
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
3502
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.COLORATTR] = ret.newColor || parentTextColor;
3503
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_COLORATTR] = parentTextColor;
3504
+ });
3871
3505
  }
3872
3506
  }
3873
3507
  } else if (options.isTextColor || options.isBorderColor) {
3874
3508
  // 字体色、边框色
3875
- var parentElementBgColorStr = options.parentElementBgColorStr || options.isTextColor && el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGCOLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor;
3876
- var parentElementBgColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(parentElementBgColorStr);
3509
+ var parentElementBgColorStr = options.parentElementBgColorStr || options.isTextColor && el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGCOLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor;
3510
+ var parentElementBgColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(parentElementBgColorStr);
3877
3511
 
3878
3512
  // 无背景图片
3879
- if (parentElementBgColor && !el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]]) {
3513
+ if (parentElementBgColor && !el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR]) {
3880
3514
  newColor = this._adjustTextBrightness(color, parentElementBgColor);
3881
3515
  var emitNameSuffix = '';
3882
3516
  if (isUpdate) {
@@ -3884,7 +3518,7 @@ var SDK = /*#__PURE__*/function () {
3884
3518
  } else if (needReset) {
3885
3519
  emitNameSuffix = 'ByReset';
3886
3520
  }
3887
- _global__WEBPACK_IMPORTED_MODULE_4__["plugins"].emit("afterConvertTextColor".concat(emitNameSuffix), el, {
3521
+ _global__WEBPACK_IMPORTED_MODULE_4__.plugins.emit("afterConvertTextColor".concat(emitNameSuffix), el, {
3888
3522
  // fontColor: color,
3889
3523
  fontColor: newColor,
3890
3524
  bgColor: parentElementBgColor
@@ -3893,11 +3527,10 @@ var SDK = /*#__PURE__*/function () {
3893
3527
  } else if (options.isTextShadow) {
3894
3528
  // 字体阴影
3895
3529
  // 无背景图片
3896
- if (!el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]]) {
3530
+ if (!el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR]) {
3897
3531
  newColor = this._adjustBackgroundBrightness(color); // 按照背景色的方法来处理
3898
3532
  }
3899
3533
  }
3900
-
3901
3534
  return {
3902
3535
  newColor: newColor && color.toString() !== newColor.toString() && newColor.alpha(alpha).rgb(),
3903
3536
  extStyle: extStyle
@@ -3910,40 +3543,40 @@ var SDK = /*#__PURE__*/function () {
3910
3543
  value: function _adjustTextBrightness(textColor, bgColor) {
3911
3544
  var bgColorRgb = bgColor.rgb().array();
3912
3545
  var bgColorAlpha = bgColor.alpha();
3913
- var bgColorPerceivedBrightness = Object(_color__WEBPACK_IMPORTED_MODULE_1__["getColorPerceivedBrightness"])(bgColorRgb);
3546
+ var bgColorPerceivedBrightness = (0,_color__WEBPACK_IMPORTED_MODULE_1__.getColorPerceivedBrightness)(bgColorRgb);
3914
3547
  var bgColorWithOpacityPerceivedBrightness = bgColorPerceivedBrightness * bgColorAlpha + this._defaultDarkBgColorBrightness * (1 - bgColorAlpha);
3915
3548
  var textColorRgb = textColor.rgb().array();
3916
3549
  var textColorHSL = textColor.hsl().array();
3917
3550
  var textColorAlpha = textColor.alpha();
3918
- var textPerceivedBrightness = Object(_color__WEBPACK_IMPORTED_MODULE_1__["getColorPerceivedBrightness"])(textColorRgb);
3551
+ var textPerceivedBrightness = (0,_color__WEBPACK_IMPORTED_MODULE_1__.getColorPerceivedBrightness)(textColorRgb);
3919
3552
  var offsetPerceivedBrightness = Math.abs(bgColorWithOpacityPerceivedBrightness - textPerceivedBrightness);
3920
3553
 
3921
3554
  // 用户设置为高亮字体颜色(接近白色亮度),不处理,保持高亮
3922
- if (textPerceivedBrightness >= _constant__WEBPACK_IMPORTED_MODULE_2__["WHITE_LIKE_COLOR_BRIGHTNESS"]) return textColor;
3555
+ if (textPerceivedBrightness >= _constant__WEBPACK_IMPORTED_MODULE_2__.WHITE_LIKE_COLOR_BRIGHTNESS) return textColor;
3923
3556
  if (offsetPerceivedBrightness > this._maxLimitOffsetBrightness && bgColorWithOpacityPerceivedBrightness <= this._defaultDarkBgColorBrightness + 2) {
3924
- return Object(_color__WEBPACK_IMPORTED_MODULE_1__["adjustBrightnessTo"])(this._maxLimitOffsetBrightness + bgColorWithOpacityPerceivedBrightness, textColorRgb).alpha(textColorAlpha);
3557
+ return (0,_color__WEBPACK_IMPORTED_MODULE_1__.adjustBrightnessTo)(this._maxLimitOffsetBrightness + bgColorWithOpacityPerceivedBrightness, textColorRgb).alpha(textColorAlpha);
3925
3558
  }
3926
3559
 
3927
3560
  // 如果感知亮度差大于阈值,无需调整
3928
- if (offsetPerceivedBrightness >= _constant__WEBPACK_IMPORTED_MODULE_2__["MIN_LIMIT_OFFSET_BRIGHTNESS"]) return textColor;
3929
- if (bgColorWithOpacityPerceivedBrightness >= _constant__WEBPACK_IMPORTED_MODULE_2__["HIGH_BGCOLOR_BRIGHTNESS"]) {
3561
+ if (offsetPerceivedBrightness >= _constant__WEBPACK_IMPORTED_MODULE_2__.MIN_LIMIT_OFFSET_BRIGHTNESS) return textColor;
3562
+ if (bgColorWithOpacityPerceivedBrightness >= _constant__WEBPACK_IMPORTED_MODULE_2__.HIGH_BGCOLOR_BRIGHTNESS) {
3930
3563
  // 亮背景,调暗字体
3931
- if (textColorHSL[2] > 90 - _constant__WEBPACK_IMPORTED_MODULE_2__["HIGH_BLACKWHITE_HSL_BRIGHTNESS"]) {
3564
+ if (textColorHSL[2] > 90 - _constant__WEBPACK_IMPORTED_MODULE_2__.HIGH_BLACKWHITE_HSL_BRIGHTNESS) {
3932
3565
  // 优先调字体的亮度已带到降低感知亮度的目的
3933
3566
  textColorHSL[2] = 90 - textColorHSL[2];
3934
- var tmpTextColor = color__WEBPACK_IMPORTED_MODULE_0___default.a.hsl.apply(color__WEBPACK_IMPORTED_MODULE_0___default.a, _toConsumableArray(textColorHSL)).alpha(textColorAlpha);
3567
+ var tmpTextColor = color__WEBPACK_IMPORTED_MODULE_0___default().hsl.apply((color__WEBPACK_IMPORTED_MODULE_0___default()), _toConsumableArray(textColorHSL)).alpha(textColorAlpha);
3935
3568
  return this._adjustTextBrightness(tmpTextColor, bgColor);
3936
3569
  }
3937
- return Object(_color__WEBPACK_IMPORTED_MODULE_1__["adjustBrightnessTo"])(Math.min(this._maxLimitOffsetBrightness, bgColorWithOpacityPerceivedBrightness - _constant__WEBPACK_IMPORTED_MODULE_2__["MIN_LIMIT_OFFSET_BRIGHTNESS"]), textColorRgb).alpha(textColorAlpha);
3570
+ return (0,_color__WEBPACK_IMPORTED_MODULE_1__.adjustBrightnessTo)(Math.min(this._maxLimitOffsetBrightness, bgColorWithOpacityPerceivedBrightness - _constant__WEBPACK_IMPORTED_MODULE_2__.MIN_LIMIT_OFFSET_BRIGHTNESS), textColorRgb).alpha(textColorAlpha);
3938
3571
  } else {
3939
3572
  // 暗背景,调亮字体
3940
- if (textColorHSL[2] <= _constant__WEBPACK_IMPORTED_MODULE_2__["HIGH_BLACKWHITE_HSL_BRIGHTNESS"]) {
3573
+ if (textColorHSL[2] <= _constant__WEBPACK_IMPORTED_MODULE_2__.HIGH_BLACKWHITE_HSL_BRIGHTNESS) {
3941
3574
  // 优先调字体的亮度已带到提高感知亮度的目的
3942
3575
  textColorHSL[2] = 90 - textColorHSL[2];
3943
- var _tmpTextColor = color__WEBPACK_IMPORTED_MODULE_0___default.a.hsl.apply(color__WEBPACK_IMPORTED_MODULE_0___default.a, _toConsumableArray(textColorHSL)).alpha(textColorAlpha);
3576
+ var _tmpTextColor = color__WEBPACK_IMPORTED_MODULE_0___default().hsl.apply((color__WEBPACK_IMPORTED_MODULE_0___default()), _toConsumableArray(textColorHSL)).alpha(textColorAlpha);
3944
3577
  return this._adjustTextBrightness(_tmpTextColor, bgColor);
3945
3578
  }
3946
- return Object(_color__WEBPACK_IMPORTED_MODULE_1__["adjustBrightnessTo"])(Math.min(this._maxLimitOffsetBrightness, bgColorWithOpacityPerceivedBrightness + _constant__WEBPACK_IMPORTED_MODULE_2__["MIN_LIMIT_OFFSET_BRIGHTNESS"]), textColorRgb).alpha(textColorAlpha);
3579
+ return (0,_color__WEBPACK_IMPORTED_MODULE_1__.adjustBrightnessTo)(Math.min(this._maxLimitOffsetBrightness, bgColorWithOpacityPerceivedBrightness + _constant__WEBPACK_IMPORTED_MODULE_2__.MIN_LIMIT_OFFSET_BRIGHTNESS), textColorRgb).alpha(textColorAlpha);
3947
3580
  }
3948
3581
  }
3949
3582
 
@@ -3954,21 +3587,21 @@ var SDK = /*#__PURE__*/function () {
3954
3587
  var bgColorRgb = bgColor.rgb().array();
3955
3588
  var bgColorHsl = bgColor.hsl().array();
3956
3589
  var bgColorAlpha = bgColor.alpha();
3957
- var bgColorPerceivedBrightness = Object(_color__WEBPACK_IMPORTED_MODULE_1__["getColorPerceivedBrightness"])(bgColorRgb);
3590
+ var bgColorPerceivedBrightness = (0,_color__WEBPACK_IMPORTED_MODULE_1__.getColorPerceivedBrightness)(bgColorRgb);
3958
3591
  var newColor = bgColor;
3959
- if (bgColorHsl[1] === 0 && bgColorHsl[2] > _constant__WEBPACK_IMPORTED_MODULE_2__["HIGH_BLACKWHITE_HSL_BRIGHTNESS"] || bgColorPerceivedBrightness > _constant__WEBPACK_IMPORTED_MODULE_2__["WHITE_LIKE_COLOR_BRIGHTNESS"]) {
3592
+ if (bgColorHsl[1] === 0 && bgColorHsl[2] > _constant__WEBPACK_IMPORTED_MODULE_2__.HIGH_BLACKWHITE_HSL_BRIGHTNESS || bgColorPerceivedBrightness > _constant__WEBPACK_IMPORTED_MODULE_2__.WHITE_LIKE_COLOR_BRIGHTNESS) {
3960
3593
  // 饱和度为0(黑白灰色),亮度大于HIGH_BLACKWHITE_HSL_BRIGHTNESS或感知亮度大于WHITE_LIKE_COLOR_BRIGHTNESS(白色)时,做亮度取反处理
3961
- newColor = color__WEBPACK_IMPORTED_MODULE_0___default.a.hsl(0, 0, Math.min(100, 100 + this._defaultDarkBgColorHslBrightness - bgColorHsl[2]));
3962
- } else if (bgColorPerceivedBrightness > _constant__WEBPACK_IMPORTED_MODULE_2__["MAX_LIMIT_BGCOLOR_BRIGHTNESS"]) {
3594
+ newColor = color__WEBPACK_IMPORTED_MODULE_0___default().hsl(0, 0, Math.min(100, 100 + this._defaultDarkBgColorHslBrightness - bgColorHsl[2]));
3595
+ } else if (bgColorPerceivedBrightness > _constant__WEBPACK_IMPORTED_MODULE_2__.MAX_LIMIT_BGCOLOR_BRIGHTNESS) {
3963
3596
  // 感知亮度大于MAX_LIMIT_BGCOLOR_BRIGHTNESS,将感知亮度设为MAX_LIMIT_BGCOLOR_BRIGHTNESS
3964
- newColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["adjustBrightnessTo"])(_constant__WEBPACK_IMPORTED_MODULE_2__["MAX_LIMIT_BGCOLOR_BRIGHTNESS"], bgColorRgb).alpha(bgColorAlpha);
3597
+ newColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.adjustBrightnessTo)(_constant__WEBPACK_IMPORTED_MODULE_2__.MAX_LIMIT_BGCOLOR_BRIGHTNESS, bgColorRgb).alpha(bgColorAlpha);
3965
3598
  // const ratio = (MAX_LIMIT_BGCOLOR_BRIGHTNESS * 1000)
3966
3599
  // / (bgColorRgb[0] * 299 + bgColorRgb[1] * 587 + bgColorRgb[2] * 114);
3967
3600
  // newColor = Color.rgb(bgColorRgb[0] * ratio, bgColorRgb[1] * ratio, bgColorRgb[2] * ratio);
3968
- } else if (bgColorHsl[2] < _constant__WEBPACK_IMPORTED_MODULE_2__["LOW_BLACKWHITE_HSL_BRIGHTNESS"]) {
3601
+ } else if (bgColorHsl[2] < _constant__WEBPACK_IMPORTED_MODULE_2__.LOW_BLACKWHITE_HSL_BRIGHTNESS) {
3969
3602
  // 亮度小于LOW_BLACKWHITE_HSL_BRIGHTNESS,将亮度设为LOW_BLACKWHITE_HSL_BRIGHTNESS,适当提高亮度
3970
- bgColorHsl[2] = _constant__WEBPACK_IMPORTED_MODULE_2__["LOW_BLACKWHITE_HSL_BRIGHTNESS"];
3971
- newColor = color__WEBPACK_IMPORTED_MODULE_0___default.a.hsl.apply(color__WEBPACK_IMPORTED_MODULE_0___default.a, _toConsumableArray(bgColorHsl));
3603
+ bgColorHsl[2] = _constant__WEBPACK_IMPORTED_MODULE_2__.LOW_BLACKWHITE_HSL_BRIGHTNESS;
3604
+ newColor = color__WEBPACK_IMPORTED_MODULE_0___default().hsl.apply((color__WEBPACK_IMPORTED_MODULE_0___default()), _toConsumableArray(bgColorHsl));
3972
3605
  }
3973
3606
  return newColor.alpha(bgColorAlpha).rgb();
3974
3607
  }
@@ -3977,22 +3610,22 @@ var SDK = /*#__PURE__*/function () {
3977
3610
  }, {
3978
3611
  key: "_updateBgWithGradient",
3979
3612
  value: function _updateBgWithGradient(gradientColor, el, className, cssKVList, hasInlineColor, isUpdate, needReset) {
3980
- var newBgColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["mixColors"])([el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGCOLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor, gradientColor], 'normal');
3981
- var newOriginalBgColor = (el[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_BGCOLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightBgColor).split(_constant__WEBPACK_IMPORTED_MODULE_2__["BG_COLOR_DELIMITER"]).concat(gradientColor.toString()).join(_constant__WEBPACK_IMPORTED_MODULE_2__["BG_COLOR_DELIMITER"]);
3982
- Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(el).forEach(function (dom) {
3983
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["BGCOLORATTR"]] = newBgColor;
3984
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_BGCOLORATTR"]] = newOriginalBgColor;
3613
+ var newBgColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.mixColors)([el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGCOLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor, gradientColor], 'normal');
3614
+ var newOriginalBgColor = (el[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_BGCOLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightBgColor).split(_constant__WEBPACK_IMPORTED_MODULE_2__.BG_COLOR_DELIMITER).concat(gradientColor.toString()).join(_constant__WEBPACK_IMPORTED_MODULE_2__.BG_COLOR_DELIMITER);
3615
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
3616
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.BGCOLORATTR] = newBgColor;
3617
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_BGCOLORATTR] = newOriginalBgColor;
3985
3618
  });
3986
3619
  var lastKV = cssKVList.slice(-1)[0];
3987
3620
  if (lastKV[0] === 'color') {
3988
- var ret = this._adjustBrightness(Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(Object(_color__WEBPACK_IMPORTED_MODULE_1__["parseColorName"])(lastKV[1])), el, {
3621
+ var ret = this._adjustBrightness((0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)((0,_color__WEBPACK_IMPORTED_MODULE_1__.parseColorName)(lastKV[1])), el, {
3989
3622
  isBgColor: false,
3990
3623
  isTextShadow: false,
3991
3624
  isTextColor: true,
3992
3625
  isBorderColor: false,
3993
3626
  hasInlineColor: hasInlineColor
3994
3627
  }, isUpdate, needReset);
3995
- if (ret.newColor) return _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCss(className, _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('color', ret.newColor));
3628
+ if (ret.newColor) return _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCss(className, _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('color', ret.newColor));
3996
3629
  }
3997
3630
  return '';
3998
3631
  }
@@ -4011,11 +3644,11 @@ var SDK = /*#__PURE__*/function () {
4011
3644
  }, {
4012
3645
  key: "init",
4013
3646
  value: function init() {
4014
- this._defaultDarkTextColorRgb = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkTextColor).rgb().array();
4015
- this._defaultDarkBgColorRgb = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor).rgb().array();
4016
- this._defaultDarkBgColorHSL = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor).hsl().array();
4017
- this._defaultDarkTextColorBrightness = Object(_color__WEBPACK_IMPORTED_MODULE_1__["getColorPerceivedBrightness"])(this._defaultDarkTextColorRgb);
4018
- this._defaultDarkBgColorBrightness = Object(_color__WEBPACK_IMPORTED_MODULE_1__["getColorPerceivedBrightness"])(this._defaultDarkBgColorRgb);
3647
+ this._defaultDarkTextColorRgb = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkTextColor).rgb().array();
3648
+ this._defaultDarkBgColorRgb = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor).rgb().array();
3649
+ this._defaultDarkBgColorHSL = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(_config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkBgColor).hsl().array();
3650
+ this._defaultDarkTextColorBrightness = (0,_color__WEBPACK_IMPORTED_MODULE_1__.getColorPerceivedBrightness)(this._defaultDarkTextColorRgb);
3651
+ this._defaultDarkBgColorBrightness = (0,_color__WEBPACK_IMPORTED_MODULE_1__.getColorPerceivedBrightness)(this._defaultDarkBgColorRgb);
4019
3652
  this._defaultDarkBgColorHslBrightness = this._defaultDarkBgColorHSL[2];
4020
3653
  this._maxLimitOffsetBrightness = this._defaultDarkTextColorBrightness - this._defaultDarkBgColorBrightness;
4021
3654
  }
@@ -4025,14 +3658,14 @@ var SDK = /*#__PURE__*/function () {
4025
3658
  key: "convert",
4026
3659
  value: function convert(el, cssKVList, isUpdate, needReset) {
4027
3660
  var _this = this;
4028
- _global__WEBPACK_IMPORTED_MODULE_4__["plugins"].resetCss();
3661
+ _global__WEBPACK_IMPORTED_MODULE_4__.plugins.resetCss();
4029
3662
  var emitNameSuffix = '';
4030
3663
  if (isUpdate) {
4031
3664
  emitNameSuffix = 'ByUpdateStyle';
4032
3665
  } else if (needReset) {
4033
3666
  emitNameSuffix = 'ByReset';
4034
3667
  }
4035
- _global__WEBPACK_IMPORTED_MODULE_4__["plugins"].emit("beforeConvertNode".concat(emitNameSuffix), el);
3668
+ _global__WEBPACK_IMPORTED_MODULE_4__.plugins.emit("beforeConvertNode".concat(emitNameSuffix), el);
4036
3669
  var css = ''; // css
4037
3670
  var bgCss = ''; // 文字底图css
4038
3671
 
@@ -4046,10 +3679,10 @@ var SDK = /*#__PURE__*/function () {
4046
3679
  if (!cssKVList) {
4047
3680
  // 没有传入cssKVList就从内联样式中提取
4048
3681
  // styles.cssText 读出来的颜色统一是rgba格式,除了用英文定义颜色(如:black、white)
4049
- cssKVList = (styles.cssText && styles.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g, "$1$3".concat(_constant__WEBPACK_IMPORTED_MODULE_2__["SEMICOLON_PLACEHOLDER"], "$2$4")).split(';') || []).map(function (cssStr) {
3682
+ cssKVList = (styles.cssText && styles.cssText.replace(/("[^;]*);([^;]*")|('[^;]*);([^;]*')/g, "$1$3".concat(_constant__WEBPACK_IMPORTED_MODULE_2__.SEMICOLON_PLACEHOLDER, "$2$4")).split(';') || []).map(function (cssStr) {
4050
3683
  // 将cssStr转换为[key, value],并清除各个元素的前后空白字符
4051
3684
  var splitIdx = cssStr.indexOf(':');
4052
- return [cssStr.slice(0, splitIdx).toLowerCase(), cssStr.slice(splitIdx + 1).replace(_constant__WEBPACK_IMPORTED_MODULE_2__["SEMICOLON_PLACEHOLDER_REGEXP"], ';')].map(function (item) {
3685
+ return [cssStr.slice(0, splitIdx).toLowerCase(), cssStr.slice(splitIdx + 1).replace(_constant__WEBPACK_IMPORTED_MODULE_2__.SEMICOLON_PLACEHOLDER_REGEXP, ';')].map(function (item) {
4053
3686
  return (item || '').replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
4054
3687
  });
4055
3688
  });
@@ -4078,7 +3711,7 @@ var SDK = /*#__PURE__*/function () {
4078
3711
  }
4079
3712
 
4080
3713
  // 过滤掉一些key
4081
- return _constant__WEBPACK_IMPORTED_MODULE_2__["CSS_PROP_LIST"].indexOf(key) > -1;
3714
+ return _constant__WEBPACK_IMPORTED_MODULE_2__.CSS_PROP_LIST.indexOf(key) > -1;
4082
3715
  }).sort(function (_ref3, _ref4) {
4083
3716
  var _ref5 = _slicedToArray(_ref3, 1),
4084
3717
  key1 = _ref5[0];
@@ -4096,14 +3729,14 @@ var SDK = /*#__PURE__*/function () {
4096
3729
  }
4097
3730
  return -1;
4098
3731
  });
4099
- if (_constant__WEBPACK_IMPORTED_MODULE_2__["TABLE_NAME"].indexOf(nodeName) > -1 && !hasInlineBackground) {
3732
+ if (_constant__WEBPACK_IMPORTED_MODULE_2__.TABLE_NAME.indexOf(nodeName) > -1 && !hasInlineBackground) {
4100
3733
  // 如果table没有内联样式
4101
3734
  this._try(function () {
4102
- var colorStr = Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["hasTableClass"])(el); // 获取class对应的lm色值
3735
+ var colorStr = (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.hasTableClass)(el); // 获取class对应的lm色值
4103
3736
  if (!colorStr) colorStr = el.getAttribute('bgcolor'); // 如果没有class则获取bgcolor的色值
4104
3737
  if (colorStr) {
4105
3738
  // 有色值(class对应的lm色值或者是bgcolor色值),则当做内联样式来处理
4106
- var color = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(colorStr);
3739
+ var color = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(colorStr);
4107
3740
  if (color) {
4108
3741
  cssKVList.unshift(['background-color', color.toString()]);
4109
3742
  hasInlineBackground = true;
@@ -4117,7 +3750,7 @@ var SDK = /*#__PURE__*/function () {
4117
3750
  var colorStr = el.getAttribute('color'); // 获取color的色值
4118
3751
  if (colorStr) {
4119
3752
  // 有色值,则当做内联样式来处理
4120
- var color = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(colorStr);
3753
+ var color = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(colorStr);
4121
3754
  if (color) {
4122
3755
  cssKVList.push(['color', color.toString()]);
4123
3756
  hasInlineColor = true;
@@ -4140,27 +3773,25 @@ var SDK = /*#__PURE__*/function () {
4140
3773
  webkitTextLen = idx; // 记录-webkit-text相关样式的长度
4141
3774
  return true; // 结束遍历
4142
3775
  }
4143
-
4144
3776
  switch (key) {
4145
3777
  case '-webkit-text-fill-color':
4146
- webkitFillColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["parseWebkitFillColorAndStrokeColor"])(value);
3778
+ webkitFillColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.parseWebkitFillColorAndStrokeColor)(value);
4147
3779
  break;
4148
3780
  case '-webkit-text-stroke':
4149
3781
  {
4150
3782
  // 有-webkit-text-stroke时就不会有-webkit-text-stroke-color
4151
3783
  var newValue = value.split(' ');
4152
- newValue.length === 2 && (webkitStrokeColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["parseWebkitFillColorAndStrokeColor"])(newValue[1]));
3784
+ newValue.length === 2 && (webkitStrokeColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.parseWebkitFillColorAndStrokeColor)(newValue[1]));
4153
3785
  break;
4154
3786
  }
4155
3787
  case '-webkit-text-stroke-color':
4156
3788
  // 有-webkit-text-stroke-color时就不会有-webkit-text-stroke
4157
- webkitStrokeColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["parseWebkitFillColorAndStrokeColor"])(value);
3789
+ webkitStrokeColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.parseWebkitFillColorAndStrokeColor)(value);
4158
3790
  break;
4159
3791
  }
4160
3792
  return false; // 继续遍历
4161
3793
  });
4162
3794
  });
4163
-
4164
3795
  if (webkitFillColor) {
4165
3796
  // 有-webkit-text-fill-color,当做color对待
4166
3797
  if (hasInlineColor) {
@@ -4176,70 +3807,69 @@ var SDK = /*#__PURE__*/function () {
4176
3807
  cssKVList.splice(0, webkitTextLen); // 删掉-webkit-text相关样式
4177
3808
  webkitStrokeColor && cssKVList.unshift(['-webkit-text-stroke-color', webkitStrokeColor]); // 如果有-webkit-text-stroke-color,则插入到最前面
4178
3809
  }
4179
-
4180
3810
  var dmClassName = '';
4181
3811
  var dmBgClassName = '';
4182
3812
  if ((isUpdate || needReset) && el.className && typeof el.className === 'string') {
4183
3813
  // 先提取dm className
4184
- var matches = el.className.match(_constant__WEBPACK_IMPORTED_MODULE_2__["DM_CLASSNAME_REGEXP"]);
3814
+ var matches = el.className.match(_constant__WEBPACK_IMPORTED_MODULE_2__.DM_CLASSNAME_REGEXP);
4185
3815
  if (matches) {
4186
3816
  dmClassName = matches[0];
4187
3817
  }
4188
3818
 
4189
3819
  // 再提取dm bg className
4190
- matches = el.className.match(_global__WEBPACK_IMPORTED_MODULE_4__["bgStack"].classNameReg);
3820
+ matches = el.className.match(_global__WEBPACK_IMPORTED_MODULE_4__.bgStack.classNameReg);
4191
3821
  if (matches) {
4192
3822
  dmBgClassName = matches[0];
4193
3823
  }
4194
3824
  }
4195
3825
  var cssKV = ''; // css键值对
4196
3826
  var noColor = needReset;
4197
- noColor && _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].watch('color', function () {
3827
+ noColor && _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.watch('color', function () {
4198
3828
  noColor = false;
4199
- _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].unwatch('color');
3829
+ _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.unwatch('color');
4200
3830
  });
4201
3831
  cssKVList.forEach(function (_ref9) {
4202
- var _ref10 = _slicedToArray(_ref9, 2),
4203
- key = _ref10[0],
4204
- value = _ref10[1];
3832
+ var _ref0 = _slicedToArray(_ref9, 2),
3833
+ key = _ref0[0],
3834
+ value = _ref0[1];
4205
3835
  return _this._try(function () {
4206
3836
  var oldValue = value;
4207
3837
  var cssChange = false;
4208
3838
 
4209
3839
  // 找出色值来处理
4210
- var isBgColor = _constant__WEBPACK_IMPORTED_MODULE_2__["CSS_PROP_SERIES"].BG_COLOR.indexOf(key) > -1;
4211
- var isTextShadow = _constant__WEBPACK_IMPORTED_MODULE_2__["CSS_PROP_SERIES"].TEXT_SHADOW.indexOf(key) > -1;
4212
- var textColorIdx = _constant__WEBPACK_IMPORTED_MODULE_2__["CSS_PROP_SERIES"].TEXT_COLOR.indexOf(key);
4213
- var isBorderColor = _constant__WEBPACK_IMPORTED_MODULE_2__["CSS_PROP_SERIES"].BORDER_COLOR.indexOf(key) > -1;
3840
+ var isBgColor = _constant__WEBPACK_IMPORTED_MODULE_2__.CSS_PROP_SERIES.BG_COLOR.indexOf(key) > -1;
3841
+ var isTextShadow = _constant__WEBPACK_IMPORTED_MODULE_2__.CSS_PROP_SERIES.TEXT_SHADOW.indexOf(key) > -1;
3842
+ var textColorIdx = _constant__WEBPACK_IMPORTED_MODULE_2__.CSS_PROP_SERIES.TEXT_COLOR.indexOf(key);
3843
+ var isBorderColor = _constant__WEBPACK_IMPORTED_MODULE_2__.CSS_PROP_SERIES.BORDER_COLOR.indexOf(key) > -1;
4214
3844
  var isGradient = /gradient/.test(value);
4215
3845
  var gradientColors = [];
4216
3846
  var extStyle = '';
4217
3847
  var gradientMixColor;
4218
3848
 
4219
3849
  // 将英文定义颜色转换为rgb格式
4220
- value = Object(_color__WEBPACK_IMPORTED_MODULE_1__["parseColorName"])(value, isGradient); // 渐变需要处理透明
3850
+ value = (0,_color__WEBPACK_IMPORTED_MODULE_1__.parseColorName)(value, isGradient); // 渐变需要处理透明
4221
3851
 
4222
- if (_constant__WEBPACK_IMPORTED_MODULE_2__["COLOR_REGEXP"].test(value)) {
3852
+ if (_constant__WEBPACK_IMPORTED_MODULE_2__.COLOR_REGEXP.test(value)) {
4223
3853
  if (isGradient) {
4224
3854
  // 把原渐变色取出来
4225
- var _matches = _constant__WEBPACK_IMPORTED_MODULE_2__["COLOR_REGEXP_GLOBAL"].exec(value);
3855
+ var _matches = _constant__WEBPACK_IMPORTED_MODULE_2__.COLOR_REGEXP_GLOBAL.exec(value);
4226
3856
  while (_matches) {
4227
3857
  gradientColors.push(_matches[0]);
4228
- _matches = _constant__WEBPACK_IMPORTED_MODULE_2__["COLOR_REGEXP_GLOBAL"].exec(value);
3858
+ _matches = _constant__WEBPACK_IMPORTED_MODULE_2__.COLOR_REGEXP_GLOBAL.exec(value);
4229
3859
  }
4230
3860
 
4231
3861
  // 计算出一个mix颜色
4232
- gradientMixColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["mixColors"])(gradientColors);
3862
+ gradientMixColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.mixColors)(gradientColors);
4233
3863
  }
4234
3864
  var replaceIndex = 0;
4235
- value = value.replace(_constant__WEBPACK_IMPORTED_MODULE_2__["COLOR_REGEXP_GLOBAL"], function (match) {
3865
+ value = value.replace(_constant__WEBPACK_IMPORTED_MODULE_2__.COLOR_REGEXP_GLOBAL, function (match) {
4236
3866
  // 渐变色统一改成mix纯色
4237
3867
  if (isGradient) {
4238
3868
  match = gradientMixColor;
4239
3869
  cssChange = true;
4240
3870
  }
4241
- var matchColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(match);
4242
- if ((matchColor === null || matchColor === void 0 ? void 0 : matchColor.alpha()) >= _constant__WEBPACK_IMPORTED_MODULE_2__["IGNORE_ALPHA"]) {
3871
+ var matchColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(match);
3872
+ if ((matchColor === null || matchColor === void 0 ? void 0 : matchColor.alpha()) >= _constant__WEBPACK_IMPORTED_MODULE_2__.IGNORE_ALPHA) {
4243
3873
  // 忽略透明度低的色值
4244
3874
  // 使用颜色处理算法
4245
3875
  var ret = _this._adjustBrightness(matchColor, el, {
@@ -4256,19 +3886,19 @@ var SDK = /*#__PURE__*/function () {
4256
3886
  if (isBgColor || textColorIdx >= 5) {
4257
3887
  // 只处理color及之后的属性
4258
3888
  var retColorStr = retColor ? retColor.toString() : match;
4259
- replaceIndex === 0 && Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(el).forEach(function (dom) {
3889
+ replaceIndex === 0 && (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
4260
3890
  if (isBgColor) {
4261
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["BGCOLORATTR"]] = retColorStr;
4262
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_BGCOLORATTR"]] = (dom[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_BGCOLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightBgColor).split(_constant__WEBPACK_IMPORTED_MODULE_2__["BG_COLOR_DELIMITER"]).concat(match).join(_constant__WEBPACK_IMPORTED_MODULE_2__["BG_COLOR_DELIMITER"]);
3891
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.BGCOLORATTR] = retColorStr;
3892
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_BGCOLORATTR] = (dom[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_BGCOLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightBgColor).split(_constant__WEBPACK_IMPORTED_MODULE_2__.BG_COLOR_DELIMITER).concat(match).join(_constant__WEBPACK_IMPORTED_MODULE_2__.BG_COLOR_DELIMITER);
4263
3893
  } else {
4264
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["COLORATTR"]] = retColorStr;
4265
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_COLORATTR"]] = match;
3894
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.COLORATTR] = retColorStr;
3895
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_COLORATTR] = match;
4266
3896
  }
4267
3897
 
4268
3898
  // 如果设置背景颜色,取消背景图片的影响
4269
- var retColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(retColorStr);
4270
- if (isBgColor && (retColor === null || retColor === void 0 ? void 0 : retColor.alpha()) >= _constant__WEBPACK_IMPORTED_MODULE_2__["IGNORE_ALPHA"] && dom[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]]) {
4271
- delete dom[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]];
3899
+ var retColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(retColorStr);
3900
+ if (isBgColor && (retColor === null || retColor === void 0 ? void 0 : retColor.alpha()) >= _constant__WEBPACK_IMPORTED_MODULE_2__.IGNORE_ALPHA && dom[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR]) {
3901
+ delete dom[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR];
4272
3902
  }
4273
3903
  });
4274
3904
  }
@@ -4287,7 +3917,7 @@ var SDK = /*#__PURE__*/function () {
4287
3917
  var isBorderImageAttr = /^(-webkit-)?border-image/.test(key);
4288
3918
  if ((isBackgroundAttr || isBorderImageAttr) && /url\([^)]*\)/i.test(value)) {
4289
3919
  cssChange = true;
4290
- var imgBgColor = Object(_color__WEBPACK_IMPORTED_MODULE_1__["mixColors"])((el[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_BGCOLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightBgColor).split(_constant__WEBPACK_IMPORTED_MODULE_2__["BG_COLOR_DELIMITER"]), 'normal').toString();
3920
+ var imgBgColor = (0,_color__WEBPACK_IMPORTED_MODULE_1__.mixColors)((el[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_BGCOLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightBgColor).split(_constant__WEBPACK_IMPORTED_MODULE_2__.BG_COLOR_DELIMITER), 'normal').toString();
4291
3921
  // const imgBgColor = el[BGCOLORATTR] || config.defaultLightBgColor;
4292
3922
 
4293
3923
  // 在背景图片下加一层原背景颜色:
@@ -4296,37 +3926,40 @@ var SDK = /*#__PURE__*/function () {
4296
3926
  value = value.replace(/^(.*?)url\(([^)]*)\)(.*)$/i, function (matches) {
4297
3927
  var newValue = matches;
4298
3928
  var tmpCssKvStr = '';
4299
- if (!el[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]]) {
3929
+ if (!el[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR]) {
4300
3930
  // 避免重复set
4301
- Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(el).forEach(function (dom) {
4302
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["BGIMAGEATTR"]] = true;
3931
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
3932
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.BGIMAGEATTR] = true;
4303
3933
  });
4304
3934
  }
4305
3935
 
4306
3936
  // background-image
4307
3937
  if (isBackgroundAttr) {
4308
- tmpCssKvStr = _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV(key, imgBgColor ? "".concat(newValue, ",linear-gradient(").concat(imgBgColor, ", ").concat(imgBgColor, ")") : newValue);
3938
+ tmpCssKvStr = _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV(key, imgBgColor ? "".concat(newValue, ",linear-gradient(").concat(imgBgColor, ", ").concat(imgBgColor, ")") : newValue);
4309
3939
  if (elBackgroundPositionAttr) {
4310
- cssKV += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('background-position', elBackgroundPositionAttr);
4311
- tmpCssKvStr += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('background-position', imgBgColor ? "".concat(elBackgroundPositionAttr, ",top left") : elBackgroundPositionAttr);
3940
+ cssKV += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('background-position', elBackgroundPositionAttr);
3941
+ tmpCssKvStr += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('background-position', imgBgColor ? "".concat(elBackgroundPositionAttr, ",top left") : elBackgroundPositionAttr);
4312
3942
  }
4313
3943
  if (elBackgroundSizeAttr) {
4314
- cssKV += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('background-size', elBackgroundSizeAttr);
4315
- tmpCssKvStr += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('background-size', imgBgColor ? "".concat(elBackgroundSizeAttr, ",100%") : elBackgroundSizeAttr);
3944
+ cssKV += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('background-size', elBackgroundSizeAttr);
3945
+ tmpCssKvStr += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('background-size', imgBgColor ? "".concat(elBackgroundSizeAttr, ",100%") : elBackgroundSizeAttr);
4316
3946
  }
4317
3947
  if (!needReset) {
4318
3948
  if (dmBgClassName) {
4319
3949
  // 如果是文字底图,则直接加样式
4320
- bgCss += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCss(dmBgClassName, tmpCssKvStr);
4321
- Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(el).forEach(function (dom) {
4322
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["COMPLEMENTARY_BGIMAGECOLORATTR"]] = imgBgColor || newValue;
3950
+ bgCss += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCss(dmBgClassName, tmpCssKvStr);
3951
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
3952
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.COMPLEMENTARY_BGIMAGECOLORATTR] = imgBgColor || newValue;
4323
3953
  });
4324
3954
  } else {
4325
3955
  // 否则背景图入栈
4326
- _global__WEBPACK_IMPORTED_MODULE_4__["bgStack"].push(el, tmpCssKvStr, function (bgStackItem) {
4327
- [bgStackItem.elOld, bgStackItem.el].forEach(function (bgEl) {
4328
- Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(bgEl).forEach(function (dom) {
4329
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["COMPLEMENTARY_BGIMAGECOLORATTR"]] = imgBgColor || newValue;
3956
+ _global__WEBPACK_IMPORTED_MODULE_4__.bgStack.push(el, tmpCssKvStr, function (bgStackItem) {
3957
+ var els = [bgStackItem.elOld];
3958
+ bgStackItem.el !== bgStackItem.elOld && els.push(bgStackItem.el);
3959
+ els.forEach(function (bgEl) {
3960
+ // 新老节点都要处理
3961
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(bgEl).forEach(function (dom) {
3962
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.COMPLEMENTARY_BGIMAGECOLORATTR] = imgBgColor || newValue;
4330
3963
  });
4331
3964
  });
4332
3965
  });
@@ -4335,44 +3968,43 @@ var SDK = /*#__PURE__*/function () {
4335
3968
  } else {
4336
3969
  // border-image元素,如果当前元素没有背景颜色,补背景颜色
4337
3970
  if (imgBgColor && !hasInlineBackground && !needReset) {
4338
- tmpCssKvStr = _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('background-image', "linear-gradient(".concat(imgBgColor, ", ").concat(imgBgColor, ")"));
3971
+ tmpCssKvStr = _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('background-image', "linear-gradient(".concat(imgBgColor, ", ").concat(imgBgColor, ")"));
4339
3972
  if (dmBgClassName) {
4340
3973
  // 如果是文字底图,则直接加样式
4341
- bgCss += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCss(dmBgClassName, tmpCssKvStr);
3974
+ bgCss += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCss(dmBgClassName, tmpCssKvStr);
4342
3975
  } else {
4343
3976
  // 否则背景图入栈
4344
- _global__WEBPACK_IMPORTED_MODULE_4__["bgStack"].push(el, tmpCssKvStr); // 背景图入栈
3977
+ _global__WEBPACK_IMPORTED_MODULE_4__.bgStack.push(el, tmpCssKvStr); // 背景图入栈
4345
3978
  }
4346
3979
  }
4347
3980
  }
4348
-
4349
3981
  return newValue;
4350
3982
  });
4351
3983
 
4352
3984
  // 没有设置自定义字体颜色,则使用非 Dark Mode 下默认字体颜色
4353
3985
  if (!hasInlineColor) {
4354
- var textColor = el[_constant__WEBPACK_IMPORTED_MODULE_2__["ORIGINAL_COLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightTextColor;
4355
- cssKV += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('color', textColor);
4356
- Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["getChildrenAndIt"])(el).forEach(function (dom) {
4357
- dom[_constant__WEBPACK_IMPORTED_MODULE_2__["COLORATTR"]] = textColor;
3986
+ var textColor = el[_constant__WEBPACK_IMPORTED_MODULE_2__.ORIGINAL_COLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultLightTextColor;
3987
+ cssKV += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('color', textColor);
3988
+ (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.getChildrenAndIt)(el).forEach(function (dom) {
3989
+ dom[_constant__WEBPACK_IMPORTED_MODULE_2__.COLORATTR] = textColor;
4358
3990
  });
4359
3991
  }
4360
3992
  }
4361
3993
  }
4362
3994
  if (cssChange || needReset) {
4363
- !isUpdate && !needReset && _constant__WEBPACK_IMPORTED_MODULE_2__["IMPORTANT_REGEXP"].test(oldValue) && (styles[key] = oldValue.replace(_constant__WEBPACK_IMPORTED_MODULE_2__["IMPORTANT_REGEXP"], '')); // 清除inline style的!important
3995
+ !isUpdate && !needReset && _constant__WEBPACK_IMPORTED_MODULE_2__.IMPORTANT_REGEXP.test(oldValue) && (styles[key] = oldValue.replace(_constant__WEBPACK_IMPORTED_MODULE_2__.IMPORTANT_REGEXP, '')); // 清除inline style的!important
4364
3996
  if (isGradient) {
4365
3997
  if (!needReset) {
4366
3998
  if (dmBgClassName) {
4367
3999
  // 如果是文字底图,则直接加样式
4368
- bgCss += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCss(dmBgClassName, _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV(key, value));
4000
+ bgCss += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCss(dmBgClassName, _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV(key, value));
4369
4001
  if (/^background/.test(key) && !/url\([^)]*\)/i.test(value)) {
4370
4002
  // 是无背景图的渐变,需要重新计算背景色
4371
4003
  css += _this._updateBgWithGradient(gradientMixColor, el, dmBgClassName, cssKVList, hasInlineColor, isUpdate, needReset);
4372
4004
  }
4373
4005
  } else {
4374
4006
  // 否则渐变入栈
4375
- _global__WEBPACK_IMPORTED_MODULE_4__["bgStack"].push(el, _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV(key, value), function (item) {
4007
+ _global__WEBPACK_IMPORTED_MODULE_4__.bgStack.push(el, _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV(key, value), function (item) {
4376
4008
  // 渐变入栈
4377
4009
  if (/^background/.test(key) && !/url\([^)]*\)/i.test(value)) {
4378
4010
  // 是无背景图的渐变,需要重新计算背景色
@@ -4384,41 +4016,41 @@ var SDK = /*#__PURE__*/function () {
4384
4016
  } else {
4385
4017
  if (key === 'color') {
4386
4018
  noColor = false;
4387
- _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].unwatch('color');
4019
+ _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.unwatch('color');
4388
4020
  }
4389
- cssKV += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV(key, !cssChange && needReset ? el.style[key] : value);
4021
+ cssKV += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV(key, !cssChange && needReset ? el.style[key] : value);
4390
4022
  }
4391
4023
  }
4392
4024
  });
4393
4025
  });
4394
4026
  if (noColor) {
4395
- cssKV += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCssKV('color', el.style.color || el[_constant__WEBPACK_IMPORTED_MODULE_2__["COLORATTR"]] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkTextColor);
4396
- _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].unwatch('color');
4027
+ cssKV += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCssKV('color', el.style.color || el[_constant__WEBPACK_IMPORTED_MODULE_2__.COLORATTR] || _config__WEBPACK_IMPORTED_MODULE_3__["default"].defaultDarkTextColor);
4028
+ _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.unwatch('color');
4397
4029
  }
4398
4030
  if (cssKV) {
4399
4031
  // 有处理过或者是背景图片就加class以及css
4400
4032
  if (!dmClassName) {
4401
- dmClassName = "".concat(_constant__WEBPACK_IMPORTED_MODULE_2__["CLASS_PREFIX"]).concat(this._idx++);
4033
+ dmClassName = "".concat(_constant__WEBPACK_IMPORTED_MODULE_2__.CLASS_PREFIX).concat(this._idx++);
4402
4034
  el.classList.add(dmClassName);
4403
4035
  }
4404
- css += cssKV ? _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCss(dmClassName, cssKV) : '';
4036
+ css += cssKV ? _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCss(dmClassName, cssKV) : '';
4405
4037
  }
4406
4038
  css += bgCss; // 追加文字底图样式,要在添加cssKV之后添加,避免被覆盖
4407
4039
 
4408
- if (!isUpdate && Object(_domUtils__WEBPACK_IMPORTED_MODULE_5__["hasTextNode"])(el) && !needReset) {
4040
+ if (!isUpdate && (0,_domUtils__WEBPACK_IMPORTED_MODULE_5__.hasTextNode)(el) && !needReset) {
4409
4041
  // 如果节点里有文本,要判断是否在背景图里
4410
4042
  if (_config__WEBPACK_IMPORTED_MODULE_3__["default"].delayBgJudge) {
4411
4043
  // 延迟背景判断
4412
- _global__WEBPACK_IMPORTED_MODULE_4__["tnQueue"].push(el); // 文字入队
4044
+ _global__WEBPACK_IMPORTED_MODULE_4__.tnQueue.push(el); // 文字入队
4413
4045
  } else {
4414
- _global__WEBPACK_IMPORTED_MODULE_4__["bgStack"].contains(el, function (item) {
4415
- css += _global__WEBPACK_IMPORTED_MODULE_4__["cssUtils"].genCss(item.className, item.cssKV);
4046
+ _global__WEBPACK_IMPORTED_MODULE_4__.bgStack.contains(el, function (item) {
4047
+ css += _global__WEBPACK_IMPORTED_MODULE_4__.cssUtils.genCss(item.className, item.cssKV);
4416
4048
  typeof item.cb === 'function' && item.cb(item);
4417
4049
  });
4418
4050
  }
4419
4051
  }
4420
4052
  }
4421
- _global__WEBPACK_IMPORTED_MODULE_4__["plugins"].emit("afterConvertNode".concat(emitNameSuffix), el);
4053
+ _global__WEBPACK_IMPORTED_MODULE_4__.plugins.emit("afterConvertNode".concat(emitNameSuffix), el);
4422
4054
  return css;
4423
4055
  }
4424
4056
 
@@ -4426,34 +4058,36 @@ var SDK = /*#__PURE__*/function () {
4426
4058
  }, {
4427
4059
  key: "getContrast",
4428
4060
  value: function getContrast(colorStr1, colorStr2) {
4429
- var color1 = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(colorStr1);
4430
- var color2 = Object(_color__WEBPACK_IMPORTED_MODULE_1__["ColorParser"])(colorStr2);
4061
+ var color1 = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(colorStr1);
4062
+ var color2 = (0,_color__WEBPACK_IMPORTED_MODULE_1__.ColorParser)(colorStr2);
4431
4063
  return color1 && color2 ? color1.contrast(color2) : 0;
4432
4064
  }
4433
4065
  }]);
4434
- return SDK;
4435
4066
  }();
4436
4067
 
4437
4068
  ;
4438
4069
 
4439
- /***/ }),
4070
+ /***/ },
4440
4071
 
4441
- /***/ "./src/modules/textNodeQueue.js":
4072
+ /***/ "./src/modules/textNodeQueue.js"
4442
4073
  /*!**************************************!*\
4443
4074
  !*** ./src/modules/textNodeQueue.js ***!
4444
4075
  \**************************************/
4445
- /*! exports provided: default */
4446
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4076
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4447
4077
 
4448
4078
  "use strict";
4449
4079
  __webpack_require__.r(__webpack_exports__);
4450
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TextNodeQueue; });
4080
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4081
+ /* harmony export */ "default": () => (/* binding */ TextNodeQueue)
4082
+ /* harmony export */ });
4451
4083
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./src/modules/config.js");
4452
- 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); }
4453
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4454
- 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); } }
4455
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4456
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4084
+ 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); }
4085
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
4086
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4087
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
4088
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4089
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4090
+ 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); }
4457
4091
  /**
4458
4092
  * @name 文本节点队列
4459
4093
  *
@@ -4481,18 +4115,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4481
4115
  // Darkmode配置
4482
4116
 
4483
4117
  var TextNodeQueue = /*#__PURE__*/function () {
4484
- // 文本节点队列,{ el, className, updated }
4485
4118
  // 索引值
4486
4119
 
4487
4120
  function TextNodeQueue(prefix) {
4488
4121
  _classCallCheck(this, TextNodeQueue);
4489
4122
  _defineProperty(this, "_queue", []);
4123
+ // 文本节点队列,{ el, className, updated }
4490
4124
  _defineProperty(this, "_idx", 0);
4491
4125
  this._prefix = prefix;
4492
4126
  }
4493
4127
 
4494
4128
  // 队列长度
4495
- _createClass(TextNodeQueue, [{
4129
+ return _createClass(TextNodeQueue, [{
4496
4130
  key: "length",
4497
4131
  get: function get() {
4498
4132
  return this._queue.length;
@@ -4546,13 +4180,372 @@ var TextNodeQueue = /*#__PURE__*/function () {
4546
4180
  });
4547
4181
  }
4548
4182
  }]);
4549
- return TextNodeQueue;
4550
4183
  }();
4551
4184
 
4552
4185
  ;
4553
4186
 
4554
- /***/ })
4187
+ /***/ }
4188
+
4189
+ /******/ });
4190
+ /************************************************************************/
4191
+ /******/ // The module cache
4192
+ /******/ var __webpack_module_cache__ = {};
4193
+ /******/
4194
+ /******/ // The require function
4195
+ /******/ function __webpack_require__(moduleId) {
4196
+ /******/ // Check if module is in cache
4197
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
4198
+ /******/ if (cachedModule !== undefined) {
4199
+ /******/ return cachedModule.exports;
4200
+ /******/ }
4201
+ /******/ // Check if module exists (development only)
4202
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
4203
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
4204
+ /******/ e.code = 'MODULE_NOT_FOUND';
4205
+ /******/ throw e;
4206
+ /******/ }
4207
+ /******/ // Create a new module (and put it into the cache)
4208
+ /******/ var module = __webpack_module_cache__[moduleId] = {
4209
+ /******/ // no module.id needed
4210
+ /******/ // no module.loaded needed
4211
+ /******/ exports: {}
4212
+ /******/ };
4213
+ /******/
4214
+ /******/ // Execute the module function
4215
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
4216
+ /******/
4217
+ /******/ // Return the exports of the module
4218
+ /******/ return module.exports;
4219
+ /******/ }
4220
+ /******/
4221
+ /************************************************************************/
4222
+ /******/ /* webpack/runtime/compat get default export */
4223
+ /******/ (() => {
4224
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
4225
+ /******/ __webpack_require__.n = (module) => {
4226
+ /******/ var getter = module && module.__esModule ?
4227
+ /******/ () => (module['default']) :
4228
+ /******/ () => (module);
4229
+ /******/ __webpack_require__.d(getter, { a: getter });
4230
+ /******/ return getter;
4231
+ /******/ };
4232
+ /******/ })();
4233
+ /******/
4234
+ /******/ /* webpack/runtime/define property getters */
4235
+ /******/ (() => {
4236
+ /******/ // define getter functions for harmony exports
4237
+ /******/ __webpack_require__.d = (exports, definition) => {
4238
+ /******/ for(var key in definition) {
4239
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
4240
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
4241
+ /******/ }
4242
+ /******/ }
4243
+ /******/ };
4244
+ /******/ })();
4245
+ /******/
4246
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
4247
+ /******/ (() => {
4248
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
4249
+ /******/ })();
4250
+ /******/
4251
+ /******/ /* webpack/runtime/make namespace object */
4252
+ /******/ (() => {
4253
+ /******/ // define __esModule on exports
4254
+ /******/ __webpack_require__.r = (exports) => {
4255
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
4256
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4257
+ /******/ }
4258
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
4259
+ /******/ };
4260
+ /******/ })();
4261
+ /******/
4262
+ /************************************************************************/
4263
+ var __webpack_exports__ = {};
4264
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
4265
+ (() => {
4266
+ "use strict";
4267
+ /*!*************************!*\
4268
+ !*** ./src/darkmode.js ***!
4269
+ \*************************/
4270
+ __webpack_require__.r(__webpack_exports__);
4271
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4272
+ /* harmony export */ convertBg: () => (/* binding */ convertBg),
4273
+ /* harmony export */ extend: () => (/* binding */ extend),
4274
+ /* harmony export */ getContrast: () => (/* binding */ getContrast),
4275
+ /* harmony export */ init: () => (/* binding */ init),
4276
+ /* harmony export */ run: () => (/* binding */ run),
4277
+ /* harmony export */ updateStyle: () => (/* binding */ updateStyle)
4278
+ /* harmony export */ });
4279
+ /* harmony import */ var _modules_constant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/constant */ "./src/modules/constant.js");
4280
+ /* harmony import */ var _modules_config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/config */ "./src/modules/config.js");
4281
+ /* harmony import */ var _modules_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/global */ "./src/modules/global.js");
4282
+ /* harmony import */ var _modules_domUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/domUtils */ "./src/modules/domUtils.js");
4283
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4284
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4285
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4286
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4287
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4288
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
4289
+ /**
4290
+ * @name Darkmode主入口
4291
+ *
4292
+ * @function run 初始化Dark Mode配置并运行Dark Mode处理
4293
+ * @param {DOM Object Array} nodes 要处理的节点列表
4294
+ * @param {Object} opt Dark Mode配置,详见init配置说明
4295
+ * @return void
4296
+ *
4297
+ * @function init 初始化Dark Mode配置
4298
+ * @param {Function} opt.begin 开始处理时触发的回调
4299
+ * @param {Function} opt.showFirstPage 首屏处理完成时触发的回调
4300
+ * @param {Function} opt.error 发生error时触发的回调
4301
+ * @param {string} opt.mode 强制指定的颜色模式(dark|light), 指定了就不监听系统颜色
4302
+ * @param {Object} opt.whitelist 节点白名单
4303
+ * @param {Array} opt.whitelist.tagName 标签名列表
4304
+ * @param {Array} opt.whitelist.attribute 属性列表
4305
+ * @param {boolean} opt.needJudgeFirstPage 是否需要判断首屏
4306
+ * @param {boolean} opt.delayBgJudge 是否延迟背景判断
4307
+ * @param {DOM Object} opt.container 延迟运行js时使用的容器
4308
+ * @param {string} opt.cssSelectorsPrefix css选择器前缀
4309
+ * @param {string} opt.defaultLightTextColor 非Dark Mode下字体颜色
4310
+ * @param {string} opt.defaultLightBgColor 非Dark Mode下背景颜色
4311
+ * @param {string} opt.defaultDarkTextColor Dark Mode下字体颜色
4312
+ * @param {string} opt.defaultDarkBgColor Dark Mode下背景颜色
4313
+ * @return void
4314
+ *
4315
+ * @function convertBg 处理背景
4316
+ * @param {DOM Object Array} nodes 要处理的节点列表
4317
+ * @return void
4318
+ *
4319
+ * @function updateStyle 更新节点Dark Mode样式
4320
+ * @param {DOM Object} node 要更新的节点
4321
+ * @param {Object} styles 更新的样式键值对对象,如:{ color: '#ddd' }
4322
+ * @return void
4323
+ *
4324
+ * @function getContrast 获取两个颜色的对比度
4325
+ * @param {string} color1 要计算颜色对比度的颜色1,支持css颜色格式
4326
+ * @param {string} color2 要计算颜色对比度的颜色2,支持css颜色格式
4327
+ * @return {number} 颜色对比度,取值范围为`[1, 21]`
4328
+ *
4329
+ * @function extend 挂载插件
4330
+ * @param {Array} pluginList 插件列表
4331
+ * @return void
4332
+ *
4333
+ */
4334
+
4335
+ // 常量
4336
+
4337
+ var classReg = new RegExp("".concat(_modules_constant__WEBPACK_IMPORTED_MODULE_0__.CLASS_PREFIX, "[^ ]+"), 'g');
4338
+
4339
+ // Darkmode配置
4340
+
4341
+
4342
+
4555
4343
 
4556
- /******/ });
4344
+ // Dark Mode切换
4345
+ var mql = null;
4346
+ var switchToDarkmode = function switchToDarkmode(mqlObj) {
4347
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
4348
+ type: 'dom'
4349
+ };
4350
+ opt.force && (_modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.isFinish = false); // 如果是强制运行Dark Mode处理逻辑,则重置为未运行
4351
+
4352
+ if (_modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.isFinish) return; // 已运行过Dark Mode处理逻辑则不再运行
4353
+
4354
+ try {
4355
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode = _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode ? _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode === 'dark' : mqlObj.matches;
4356
+ if (opt.type === 'dom') {
4357
+ // 处理节点
4358
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode && typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].begin === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].begin(_modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.hasDelay());
4359
+ Array.prototype.forEach.call(_modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.get(), function (node) {
4360
+ if (_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode && node.className && typeof node.className === 'string') {
4361
+ node.className = node.className.replace(classReg, ''); // 过滤掉原有的Dark Mode class,避免外部复制文章时把文章内的Dark Mode class也复制过去导致新文章在Dark Mode下样式错乱
4362
+ }
4363
+ if (_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode || _modules_global__WEBPACK_IMPORTED_MODULE_2__.plugins.length) {
4364
+ if (!_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage) {
4365
+ // 不需要判断首屏
4366
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.convert(node)); // 写入非首屏样式
4367
+ } else {
4368
+ // 判断首屏
4369
+ var rect = node.getBoundingClientRect();
4370
+ var top = rect.top;
4371
+ var bottom = rect.bottom;
4372
+ if (top <= 0 && bottom <= 0) {
4373
+ // 首屏前面
4374
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.convert(node)); // 写入非首屏样式
4375
+ } else if (top > 0 && top < _modules_constant__WEBPACK_IMPORTED_MODULE_0__.PAGE_HEIGHT || bottom > 0 && bottom < _modules_constant__WEBPACK_IMPORTED_MODULE_0__.PAGE_HEIGHT) {
4376
+ // 首屏
4377
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.addFirstPageNode(node); // 记录首屏节点
4378
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.convert(node), true); // 写入首屏样式
4379
+ } else {
4380
+ // 首屏后面,理论上,这里最多只会进来一次
4381
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage = false; // 至此,不需要再判断首屏了
4382
+
4383
+ // 显示首屏
4384
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.writeStyle(true); // 写入首屏样式表
4385
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.showFirstPageNodes(); // 显示首屏节点
4386
+ typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage(); // 执行首屏回调
4387
+
4388
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.convert(node)); // 写入非首屏样式
4389
+ }
4390
+ }
4391
+ }
4392
+ });
4393
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.plugins.loopTimes++;
4394
+ } else if (opt.type === 'bg') {
4395
+ // 处理背景
4396
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode && _modules_global__WEBPACK_IMPORTED_MODULE_2__.tnQueue.forEach(function (text) {
4397
+ return _modules_global__WEBPACK_IMPORTED_MODULE_2__.bgStack.contains(text, function (bg) {
4398
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.genCss(bg.className, bg.cssKV)); // 写入非首屏样式
4399
+ typeof bg.cb === 'function' && bg.cb(bg);
4400
+
4401
+ // 还得处理该背景下的所有新老节点
4402
+ var els = [bg.elOld];
4403
+ bg.elOld !== bg.el && els.push(bg.el);
4404
+ els.forEach(function (el) {
4405
+ var _el$COLORATTR, _el$BGCOLORATTR, _el$ORIGINAL_COLORATT, _el$ORIGINAL_BGCOLORA, _el$BGIMAGEATTR, _el$COMPLEMENTARY_BGI;
4406
+ var inheritAttrs = [[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.COLORATTR, (_el$COLORATTR = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.COLORATTR]) !== null && _el$COLORATTR !== void 0 ? _el$COLORATTR : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__.BGCOLORATTR, (_el$BGCOLORATTR = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.BGCOLORATTR]) !== null && _el$BGCOLORATTR !== void 0 ? _el$BGCOLORATTR : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__.ORIGINAL_COLORATTR, (_el$ORIGINAL_COLORATT = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.ORIGINAL_COLORATTR]) !== null && _el$ORIGINAL_COLORATT !== void 0 ? _el$ORIGINAL_COLORATT : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__.ORIGINAL_BGCOLORATTR, (_el$ORIGINAL_BGCOLORA = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.ORIGINAL_BGCOLORATTR]) !== null && _el$ORIGINAL_BGCOLORA !== void 0 ? _el$ORIGINAL_BGCOLORA : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__.BGIMAGEATTR, (_el$BGIMAGEATTR = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.BGIMAGEATTR]) !== null && _el$BGIMAGEATTR !== void 0 ? _el$BGIMAGEATTR : null], [_modules_constant__WEBPACK_IMPORTED_MODULE_0__.COMPLEMENTARY_BGIMAGECOLORATTR, (_el$COMPLEMENTARY_BGI = el[_modules_constant__WEBPACK_IMPORTED_MODULE_0__.COMPLEMENTARY_BGIMAGECOLORATTR]) !== null && _el$COMPLEMENTARY_BGI !== void 0 ? _el$COMPLEMENTARY_BGI : null]];
4407
+ var children = (0,_modules_domUtils__WEBPACK_IMPORTED_MODULE_3__.getChildrenAndIt)(el, true);
4408
+ children.forEach(function (child) {
4409
+ // 重置继承属性
4410
+ inheritAttrs.forEach(function (_ref) {
4411
+ var _ref2 = _slicedToArray(_ref, 2),
4412
+ attr = _ref2[0],
4413
+ value = _ref2[1];
4414
+ if (value === null) {
4415
+ delete child[attr];
4416
+ } else {
4417
+ child[attr] = value;
4418
+ }
4419
+ });
4420
+ });
4421
+ children.forEach(function (child) {
4422
+ // 重新运行Dark Mode处理逻辑
4423
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.convert(child, undefined, false, true));
4424
+ });
4425
+ });
4426
+ });
4427
+ });
4428
+ }
4429
+ if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage || !_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage && !_modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.showFirstPage) {
4430
+ // config.needJudgeFirstPage === ture,表示需要判断首屏但是正文长度没超过一屏
4431
+ // config.needJudgeFirstPage === false && domUtils.showFirstPage === false,表示不需要判断首屏且没有做首屏优化
4432
+ typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].showFirstPage(); // 执行首屏回调
4433
+ }
4434
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.writeStyle(); // 写入非首屏样式表
4435
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.emptyFirstPageNodes(); // 清空记录的首屏节点
4436
+
4437
+ if (!_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.isDarkmode) {
4438
+ // 非Dark Mode
4439
+ // 首次加载页面时为非Dark Mode,标记为不需要判断首屏
4440
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].needJudgeFirstPage = false;
4441
+
4442
+ // 首次加载页面时为非Dark Mode,标记为不延迟判断背景
4443
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].delayBgJudge = false;
4444
+ if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].container === null && opt.type === 'dom' && _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.length) {
4445
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.delay(); // 将节点转移到延迟处理队列里
4446
+ }
4447
+ }
4448
+ } catch (e) {
4449
+ console.log('An error occurred when running the dark mode conversion algorithm\n', e);
4450
+ typeof _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].error === 'function' && _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].error(e);
4451
+ }
4452
+ };
4453
+
4454
+ // 初始化Dark Mode配置并运行Dark Mode处理
4455
+ function run(nodes, opt) {
4456
+ init(opt); // 初始化配置
4457
+
4458
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.set(nodes);
4459
+ switchToDarkmode(mql, {
4460
+ force: true,
4461
+ type: 'dom'
4462
+ });
4463
+ }
4464
+ ;
4465
+
4466
+ // 初始化Dark Mode配置
4467
+ function init() {
4468
+ var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4469
+ if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].hasInit) return; // 只可设置一次配置
4470
+
4471
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].hasInit = true; // 记录为配置已设置
4472
+
4473
+ var tagName = _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].whitelist.tagName;
4474
+ var attribute = _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].whitelist.attribute;
4475
+ if (opt.whitelist) {
4476
+ opt.whitelist.tagName instanceof Array && opt.whitelist.tagName.forEach(function (item) {
4477
+ item = item.toUpperCase();
4478
+ tagName.indexOf(item) === -1 && tagName.push(item);
4479
+ });
4480
+ opt.whitelist.attribute instanceof Array && opt.whitelist.attribute.forEach(function (item) {
4481
+ attribute.indexOf(item) === -1 && attribute.push(item);
4482
+ });
4483
+ }
4484
+ if (['dark', 'light'].indexOf(opt.mode) > -1) {
4485
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'mode');
4486
+ opt.mode === 'dark' && document.getElementsByTagName('html')[0].classList.add(_modules_constant__WEBPACK_IMPORTED_MODULE_0__.HTML_CLASS);
4487
+ }
4488
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('function', opt, 'begin');
4489
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('function', opt, 'showFirstPage');
4490
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('function', opt, 'error');
4491
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('boolean', opt, 'needJudgeFirstPage');
4492
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('boolean', opt, 'delayBgJudge');
4493
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('dom', opt, 'container');
4494
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'cssSelectorsPrefix');
4495
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultLightTextColor');
4496
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultLightBgColor');
4497
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultDarkTextColor');
4498
+ _modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].set('string', opt, 'defaultDarkBgColor');
4499
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.init();
4500
+ if (!_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].mode && mql === null && window.matchMedia) {
4501
+ // 匹配媒体查询
4502
+ mql = window.matchMedia(_modules_constant__WEBPACK_IMPORTED_MODULE_0__.MEDIA_QUERY);
4503
+ mql.addListener(switchToDarkmode); // 监听
4504
+ }
4505
+ }
4506
+ ;
4507
+
4508
+ // 处理背景
4509
+ function convertBg(nodes) {
4510
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.domUtils.set(nodes);
4511
+ if (_modules_config__WEBPACK_IMPORTED_MODULE_1__["default"].container !== null) {
4512
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.bgStack.update(nodes); // 更新背景堆栈
4513
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.tnQueue.update(nodes); // 更新文字队列
4514
+ }
4515
+ switchToDarkmode(mql, {
4516
+ force: true,
4517
+ type: 'bg'
4518
+ });
4519
+ }
4520
+ ;
4521
+
4522
+ // 更新节点Dark Mode样式
4523
+ function updateStyle(node, styles) {
4524
+ if (!_modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.isFinish) return; // 没有运行过Dark Mode处理逻辑则无需运行
4525
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.addCss(_modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.convert(node, styles ? Object.keys(styles).map(function (key) {
4526
+ return [key, styles[key]];
4527
+ }) : undefined, true), false);
4528
+ _modules_global__WEBPACK_IMPORTED_MODULE_2__.cssUtils.writeStyle();
4529
+ }
4530
+ ;
4531
+
4532
+ // 获取两个颜色的对比度
4533
+ function getContrast(color1, color2) {
4534
+ return _modules_global__WEBPACK_IMPORTED_MODULE_2__.sdk.getContrast(color1, color2);
4535
+ }
4536
+ ;
4537
+
4538
+ // 挂载插件
4539
+ function extend(pluginList) {
4540
+ pluginList.forEach(function (plugin) {
4541
+ return _modules_global__WEBPACK_IMPORTED_MODULE_2__.plugins.extend(plugin);
4542
+ });
4543
+ }
4544
+ ;
4545
+ })();
4546
+
4547
+ /******/ return __webpack_exports__;
4548
+ /******/ })()
4549
+ ;
4557
4550
  });
4558
4551
  //# sourceMappingURL=darkmode.js.map