watermark-js-plus 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/es/src/core/watermark.js +49 -53
  2. package/dist/ie/es/node_modules/core-js/internals/array-from.js +11 -3
  3. package/dist/ie/es/node_modules/core-js/internals/array-set-length.js +39 -0
  4. package/dist/ie/es/node_modules/core-js/internals/check-correctness-of-iteration.js +2 -0
  5. package/dist/ie/es/node_modules/core-js/internals/environment-is-ios.js +1 -2
  6. package/dist/ie/es/node_modules/core-js/internals/function-bind-native.js +1 -1
  7. package/dist/ie/es/node_modules/core-js/internals/function-name.js +1 -1
  8. package/dist/ie/es/node_modules/core-js/internals/is-array.js +20 -0
  9. package/dist/ie/es/node_modules/core-js/internals/iterate.js +8 -3
  10. package/dist/ie/es/node_modules/core-js/internals/shared-store.js +3 -3
  11. package/dist/ie/es/node_modules/core-js/internals/to-string-tag-support.js +1 -1
  12. package/dist/ie/es/node_modules/core-js/modules/es.array.fill.js +1 -1
  13. package/dist/ie/es/node_modules/core-js/modules/es.array.from.js +1 -1
  14. package/dist/ie/es/node_modules/core-js/modules/es.array.includes.js +8 -2
  15. package/dist/ie/es/node_modules/core-js/modules/es.promise.js +1 -1
  16. package/dist/ie/es/src/core/watermark.js +49 -53
  17. package/dist/ie/index.cjs.js +135 -69
  18. package/dist/ie/index.cjs.js.map +1 -1
  19. package/dist/ie/index.cjs.min.js +1 -1
  20. package/dist/ie/index.esm.js +135 -69
  21. package/dist/ie/index.esm.js.map +1 -1
  22. package/dist/ie/index.esm.min.js +1 -1
  23. package/dist/ie/index.iife.js +135 -69
  24. package/dist/ie/index.iife.js.map +1 -1
  25. package/dist/ie/index.iife.min.js +1 -1
  26. package/dist/ie/index.umd.js +135 -69
  27. package/dist/ie/index.umd.js.map +1 -1
  28. package/dist/ie/index.umd.min.js +1 -1
  29. package/dist/index.cjs.js +50 -54
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.cjs.min.js +1 -1
  32. package/dist/index.esm.js +50 -54
  33. package/dist/index.esm.js.map +1 -1
  34. package/dist/index.esm.min.js +1 -1
  35. package/dist/index.iife.js +50 -54
  36. package/dist/index.iife.js.map +1 -1
  37. package/dist/index.iife.min.js +1 -1
  38. package/dist/index.umd.js +50 -54
  39. package/dist/index.umd.js.map +1 -1
  40. package/dist/index.umd.min.js +1 -1
  41. package/dist/types/core/watermark.d.ts +3 -2
  42. package/package.json +57 -51
  43. /package/dist/ie/es/_virtual/{es.array.fill2.js → es2.array.fill.js} +0 -0
  44. /package/dist/ie/es/_virtual/{es.array.from2.js → es2.array.from.js} +0 -0
  45. /package/dist/ie/es/_virtual/{es.array.includes2.js → es2.array.includes.js} +0 -0
  46. /package/dist/ie/es/_virtual/{es.promise2.js → es2.promise.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * watermark-js-plus v1.6.3
2
+ * watermark-js-plus v1.6.5
3
3
  * (c) 2022-2024 Michael Sun
4
4
  * Released under the MIT License.
5
5
  */
@@ -75,7 +75,7 @@ function requireFunctionBindNative () {
75
75
 
76
76
  functionBindNative = !fails(function () {
77
77
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
78
- var test = (function () { /* empty */ }).bind();
78
+ var test = function () { /* empty */ }.bind();
79
79
  // eslint-disable-next-line no-prototype-builtins -- safe
80
80
  return typeof test != 'function' || test.hasOwnProperty('prototype');
81
81
  });
@@ -554,10 +554,10 @@ function requireSharedStore () {
554
554
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
555
555
 
556
556
  (store.versions || (store.versions = [])).push({
557
- version: '3.44.0',
557
+ version: '3.49.0',
558
558
  mode: IS_PURE ? 'pure' : 'global',
559
- copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
560
- license: 'https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE',
559
+ copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
560
+ license: 'https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE',
561
561
  source: 'https://github.com/zloirock/core-js'
562
562
  });
563
563
  return sharedStore.exports;
@@ -910,7 +910,7 @@ function requireFunctionName () {
910
910
 
911
911
  var EXISTS = hasOwn(FunctionPrototype, 'name');
912
912
  // additional protection from minified / mangled / dropped function names
913
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
913
+ var PROPER = EXISTS && function something() { /* empty */ }.name === 'something';
914
914
  var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
915
915
 
916
916
  functionName = {
@@ -1652,7 +1652,7 @@ function requireToStringTagSupport () {
1652
1652
 
1653
1653
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1654
1654
  var test = {};
1655
-
1655
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
1656
1656
  test[TO_STRING_TAG] = 'z';
1657
1657
 
1658
1658
  toStringTagSupport = String(test) === '[object z]';
@@ -1774,6 +1774,58 @@ function requireCreateProperty () {
1774
1774
  return createProperty;
1775
1775
  }
1776
1776
 
1777
+ var isArray;
1778
+ var hasRequiredIsArray;
1779
+
1780
+ function requireIsArray () {
1781
+ if (hasRequiredIsArray) return isArray;
1782
+ hasRequiredIsArray = 1;
1783
+ var classof = requireClassofRaw();
1784
+
1785
+ // `IsArray` abstract operation
1786
+ // https://tc39.es/ecma262/#sec-isarray
1787
+ // eslint-disable-next-line es/no-array-isarray -- safe
1788
+ isArray = Array.isArray || function isArray(argument) {
1789
+ return classof(argument) === 'Array';
1790
+ };
1791
+ return isArray;
1792
+ }
1793
+
1794
+ var arraySetLength;
1795
+ var hasRequiredArraySetLength;
1796
+
1797
+ function requireArraySetLength () {
1798
+ if (hasRequiredArraySetLength) return arraySetLength;
1799
+ hasRequiredArraySetLength = 1;
1800
+ var DESCRIPTORS = requireDescriptors();
1801
+ var isArray = requireIsArray();
1802
+
1803
+ var $TypeError = TypeError;
1804
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1805
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1806
+
1807
+ // Safari < 13 does not throw an error in this case
1808
+ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
1809
+ // makes no sense without proper strict mode support
1810
+ if (this !== undefined) return true;
1811
+ try {
1812
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
1813
+ Object.defineProperty([], 'length', { writable: false }).length = 1;
1814
+ } catch (error) {
1815
+ return error instanceof TypeError;
1816
+ }
1817
+ }();
1818
+
1819
+ arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
1820
+ if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
1821
+ throw new $TypeError('Cannot set read only .length');
1822
+ } return O.length = length;
1823
+ } : function (O, length) {
1824
+ return O.length = length;
1825
+ };
1826
+ return arraySetLength;
1827
+ }
1828
+
1777
1829
  var getIteratorMethod;
1778
1830
  var hasRequiredGetIteratorMethod;
1779
1831
 
@@ -1832,20 +1884,22 @@ function requireArrayFrom () {
1832
1884
  var isConstructor = requireIsConstructor();
1833
1885
  var lengthOfArrayLike = requireLengthOfArrayLike();
1834
1886
  var createProperty = requireCreateProperty();
1887
+ var setArrayLength = requireArraySetLength();
1835
1888
  var getIterator = requireGetIterator();
1836
1889
  var getIteratorMethod = requireGetIteratorMethod();
1890
+ var iteratorClose = requireIteratorClose();
1837
1891
 
1838
1892
  var $Array = Array;
1839
1893
 
1840
1894
  // `Array.from` method implementation
1841
1895
  // https://tc39.es/ecma262/#sec-array.from
1842
1896
  arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
1843
- var O = toObject(arrayLike);
1844
1897
  var IS_CONSTRUCTOR = isConstructor(this);
1845
1898
  var argumentsLength = arguments.length;
1846
1899
  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
1847
1900
  var mapping = mapfn !== undefined;
1848
1901
  if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
1902
+ var O = toObject(arrayLike);
1849
1903
  var iteratorMethod = getIteratorMethod(O);
1850
1904
  var index = 0;
1851
1905
  var length, result, step, iterator, next, value;
@@ -1856,7 +1910,11 @@ function requireArrayFrom () {
1856
1910
  next = iterator.next;
1857
1911
  for (;!(step = call(next, iterator)).done; index++) {
1858
1912
  value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
1859
- createProperty(result, index, value);
1913
+ try {
1914
+ createProperty(result, index, value);
1915
+ } catch (error) {
1916
+ iteratorClose(iterator, 'throw', error);
1917
+ }
1860
1918
  }
1861
1919
  } else {
1862
1920
  length = lengthOfArrayLike(O);
@@ -1866,7 +1924,7 @@ function requireArrayFrom () {
1866
1924
  createProperty(result, index, value);
1867
1925
  }
1868
1926
  }
1869
- result.length = index;
1927
+ setArrayLength(result, index);
1870
1928
  return result;
1871
1929
  };
1872
1930
  return arrayFrom;
@@ -1893,6 +1951,7 @@ function requireCheckCorrectnessOfIteration () {
1893
1951
  SAFE_CLOSING = true;
1894
1952
  }
1895
1953
  };
1954
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
1896
1955
  iteratorWithReturn[ITERATOR] = function () {
1897
1956
  return this;
1898
1957
  };
@@ -1907,6 +1966,7 @@ function requireCheckCorrectnessOfIteration () {
1907
1966
  var ITERATION_SUPPORT = false;
1908
1967
  try {
1909
1968
  var object = {};
1969
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
1910
1970
  object[ITERATOR] = function () {
1911
1971
  return {
1912
1972
  next: function () {
@@ -2278,8 +2338,7 @@ function requireEnvironmentIsIos () {
2278
2338
  hasRequiredEnvironmentIsIos = 1;
2279
2339
  var userAgent = requireEnvironmentUserAgent();
2280
2340
 
2281
- // eslint-disable-next-line redos/no-vulnerable -- safe
2282
- environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
2341
+ environmentIsIos = /ipad|iphone|ipod/i.test(userAgent) && /applewebkit/i.test(userAgent);
2283
2342
  return environmentIsIos;
2284
2343
  }
2285
2344
 
@@ -3039,7 +3098,9 @@ function requireIterate () {
3039
3098
  var iterator, iterFn, index, length, result, next, step;
3040
3099
 
3041
3100
  var stop = function (condition) {
3042
- if (iterator) iteratorClose(iterator, 'normal');
3101
+ var $iterator = iterator;
3102
+ iterator = undefined;
3103
+ if ($iterator) iteratorClose($iterator, 'normal');
3043
3104
  return new Result(true, condition);
3044
3105
  };
3045
3106
 
@@ -3069,10 +3130,13 @@ function requireIterate () {
3069
3130
 
3070
3131
  next = IS_RECORD ? iterable.next : iterator.next;
3071
3132
  while (!(step = call(next, iterator)).done) {
3133
+ // `IteratorValue` errors should propagate without closing the iterator
3134
+ var value = step.value;
3072
3135
  try {
3073
- result = callFn(step.value);
3136
+ result = callFn(value);
3074
3137
  } catch (error) {
3075
- iteratorClose(iterator, 'throw', error);
3138
+ if (iterator) iteratorClose(iterator, 'throw', error);
3139
+ else throw error;
3076
3140
  }
3077
3141
  if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
3078
3142
  } return new Result(false);
@@ -3489,9 +3553,15 @@ function requireEs_array_includes () {
3489
3553
  return !Array(1).includes();
3490
3554
  });
3491
3555
 
3556
+ // Safari 26.4- bug
3557
+ var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
3558
+ // eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
3559
+ return [, 1].includes(undefined, 1);
3560
+ });
3561
+
3492
3562
  // `Array.prototype.includes` method
3493
3563
  // https://tc39.es/ecma262/#sec-array.prototype.includes
3494
- $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3564
+ $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
3495
3565
  includes: function includes(el /* , fromIndex = 0 */) {
3496
3566
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
3497
3567
  }
@@ -5205,17 +5275,18 @@ var Watermark = /** @class */ (function () {
5205
5275
  return [2 /*return*/];
5206
5276
  }
5207
5277
  this.isCreating = true;
5278
+ _h.label = 1;
5279
+ case 1:
5280
+ _h.trys.push([1, , 3, 4]);
5208
5281
  if (!this.validateUnique()) {
5209
- this.isCreating = false;
5210
5282
  return [2 /*return*/];
5211
5283
  }
5212
5284
  if (!this.validateContent()) {
5213
- this.isCreating = false;
5214
5285
  return [2 /*return*/];
5215
5286
  }
5216
5287
  firstDraw = isUndefined(this.watermarkDom);
5217
5288
  return [4 /*yield*/, ((_a = this.watermarkCanvas) === null || _a === void 0 ? void 0 : _a.draw())];
5218
- case 1:
5289
+ case 2:
5219
5290
  _h.sent();
5220
5291
  this.layoutCanvas = renderLayout(this.options, (_b = this.watermarkCanvas) === null || _b === void 0 ? void 0 : _b.getCanvas());
5221
5292
  image = convertImage(this.layoutCanvas);
@@ -5225,22 +5296,25 @@ var Watermark = /** @class */ (function () {
5225
5296
  this.watermarkDom.__WATERMARK__ = 'watermark';
5226
5297
  this.watermarkDom.__WATERMARK__INSTANCE__ = this;
5227
5298
  parentElementType = this.checkParentElementType();
5228
- this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
5299
+ this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
5229
5300
  backgroundSize = generateBackgroundSize(this.options);
5230
- watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(generateAnimationStyle(this.options.movable, this.options.backgroundRepeat), "\n ");
5301
+ watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(generateAnimationStyle(this.options.movable, this.options.backgroundRepeat), "\n ");
5231
5302
  this.watermarkDom.appendChild(watermarkInnerDom);
5232
5303
  this.parentElement.appendChild(this.watermarkDom);
5233
5304
  if (this.options.mutationObserve) {
5234
5305
  try {
5235
- this.bindMutationObserve();
5306
+ this.bindMutationObserver();
5236
5307
  }
5237
5308
  catch (_j) {
5238
5309
  (_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
5239
5310
  }
5240
5311
  }
5241
5312
  firstDraw && ((_g = (_f = this.options).onSuccess) === null || _g === void 0 ? void 0 : _g.call(_f));
5313
+ return [3 /*break*/, 4];
5314
+ case 3:
5242
5315
  this.isCreating = false;
5243
- return [2 /*return*/];
5316
+ return [7 /*endfinally*/];
5317
+ case 4: return [2 /*return*/];
5244
5318
  }
5245
5319
  });
5246
5320
  });
@@ -5263,7 +5337,7 @@ var Watermark = /** @class */ (function () {
5263
5337
  var _a, _b, _c, _d, _e, _f, _g, _h;
5264
5338
  (_b = (_a = this.options).onBeforeDestroy) === null || _b === void 0 ? void 0 : _b.call(_a);
5265
5339
  (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
5266
- (_d = this.parentObserve) === null || _d === void 0 ? void 0 : _d.disconnect();
5340
+ (_d = this.parentObserver) === null || _d === void 0 ? void 0 : _d.disconnect();
5267
5341
  (_f = (_e = this.watermarkDom) === null || _e === void 0 ? void 0 : _e.parentNode) === null || _f === void 0 ? void 0 : _f.removeChild(this.watermarkDom);
5268
5342
  (_h = (_g = this.options).onDestroyed) === null || _h === void 0 ? void 0 : _h.call(_g);
5269
5343
  };
@@ -5323,64 +5397,56 @@ var Watermark = /** @class */ (function () {
5323
5397
  }
5324
5398
  return 'custom';
5325
5399
  };
5326
- Watermark.prototype.bindMutationObserve = function () {
5327
- var _this = this;
5328
- if (!this.watermarkDom) {
5329
- return;
5330
- }
5331
- this.observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5332
- return __generator(this, function (_a) {
5333
- switch (_a.label) {
5400
+ Watermark.prototype.recreateOnMutation = function () {
5401
+ return __awaiter(this, void 0, void 0, function () {
5402
+ var _b, _c;
5403
+ return __generator(this, function (_d) {
5404
+ switch (_d.label) {
5334
5405
  case 0:
5335
- if (!(mutationsList.length > 0)) return [3 /*break*/, 2];
5406
+ _d.trys.push([0, 2, , 3]);
5336
5407
  this.remove();
5337
5408
  return [4 /*yield*/, this.create()];
5338
5409
  case 1:
5339
- _a.sent();
5340
- _a.label = 2;
5341
- case 2: return [2 /*return*/];
5410
+ _d.sent();
5411
+ return [3 /*break*/, 3];
5412
+ case 2:
5413
+ _d.sent();
5414
+ (_c = (_b = this.options).onObserveError) === null || _c === void 0 ? void 0 : _c.call(_b);
5415
+ return [3 /*break*/, 3];
5416
+ case 3: return [2 /*return*/];
5342
5417
  }
5343
5418
  });
5344
- }); });
5419
+ });
5420
+ };
5421
+ Watermark.prototype.bindMutationObserver = function () {
5422
+ var _this = this;
5423
+ if (!this.watermarkDom) {
5424
+ return;
5425
+ }
5426
+ this.observer = new MutationObserver(function (mutationsList) {
5427
+ if (mutationsList.length > 0) {
5428
+ void _this.recreateOnMutation();
5429
+ }
5430
+ });
5345
5431
  this.observer.observe(this.watermarkDom, {
5346
5432
  attributes: true, // 属性的变动
5433
+ attributeFilter: ['style', 'class', 'hidden', 'id'], // 仅监听会影响水印展示或标识的属性
5347
5434
  childList: true, // 子节点的变动(指新增,删除或者更改)
5348
5435
  subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5349
5436
  characterData: true, // 节点内容或节点文本的变动。
5350
5437
  });
5351
- this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5352
- var _i, mutationsList_1, item;
5353
- var _a;
5354
- return __generator(this, function (_b) {
5355
- switch (_b.label) {
5356
- case 0:
5357
- _i = 0, mutationsList_1 = mutationsList;
5358
- _b.label = 1;
5359
- case 1:
5360
- if (!(_i < mutationsList_1.length)) return [3 /*break*/, 4];
5361
- item = mutationsList_1[_i];
5362
- if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
5363
- ((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
5364
- (item.type === 'childList' &&
5365
- item.target === this.parentElement &&
5366
- item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
5367
- this.remove();
5368
- return [4 /*yield*/, this.create()];
5369
- case 2:
5370
- _b.sent();
5371
- _b.label = 3;
5372
- case 3:
5373
- _i++;
5374
- return [3 /*break*/, 1];
5375
- case 4: return [2 /*return*/];
5376
- }
5377
- });
5378
- }); });
5379
- this.parentObserve.observe(this.parentElement, {
5380
- attributes: true, // 属性的变动
5438
+ this.parentObserver = new MutationObserver(function (mutationsList) {
5439
+ var watermarkDom = _this.watermarkDom;
5440
+ if (!watermarkDom) {
5441
+ return;
5442
+ }
5443
+ var watermarkRemoved = mutationsList.some(function (item) { return Array.from(item.removedNodes).includes(watermarkDom); });
5444
+ if (watermarkRemoved) {
5445
+ void _this.recreateOnMutation();
5446
+ }
5447
+ });
5448
+ this.parentObserver.observe(this.parentElement, {
5381
5449
  childList: true, // 子节点的变动(指新增,删除或者更改)
5382
- subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5383
- characterData: true, // 节点内容或节点文本的变动。
5384
5450
  });
5385
5451
  };
5386
5452
  return Watermark;