watermark-js-plus 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __assign, __generator } from '../../node_modules/tslib/tslib.es6.js';
2
- import { isUndefined, convertImage, generateAnimationStyle } from '../utils/index.js';
2
+ import { convertImage, generateAnimationStyle, isUndefined } from '../utils/index.js';
3
3
  import { initialOptions } from '../utils/initialization.js';
4
4
  import protection from '../utils/protection.js';
5
5
  import { renderLayout, generateBackgroundSize } from './layout/index.js';
@@ -123,7 +123,6 @@ var Watermark = /** @class */ (function () {
123
123
  (_b = (_a = this.options).onBeforeDestroy) === null || _b === void 0 ? void 0 : _b.call(_a);
124
124
  (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
125
125
  (_d = this.parentObserve) === null || _d === void 0 ? void 0 : _d.disconnect();
126
- this.unbindCheckWatermarkElementEvent();
127
126
  (_f = (_e = this.watermarkDom) === null || _e === void 0 ? void 0 : _e.parentNode) === null || _f === void 0 ? void 0 : _f.removeChild(this.watermarkDom);
128
127
  (_h = (_g = this.options).onDestroyed) === null || _h === void 0 ? void 0 : _h.call(_g);
129
128
  };
@@ -183,30 +182,11 @@ var Watermark = /** @class */ (function () {
183
182
  }
184
183
  return 'custom';
185
184
  };
186
- Watermark.prototype.checkWatermarkElement = function () {
187
- return __awaiter(this, void 0, void 0, function () {
188
- return __generator(this, function (_a) {
189
- switch (_a.label) {
190
- case 0:
191
- if (!!this.parentElement.contains(this.watermarkDom)) return [3 /*break*/, 2];
192
- this.remove();
193
- return [4 /*yield*/, this.create()];
194
- case 1:
195
- _a.sent();
196
- _a.label = 2;
197
- case 2:
198
- this.bindCheckWatermarkElementEvent();
199
- return [2 /*return*/];
200
- }
201
- });
202
- });
203
- };
204
185
  Watermark.prototype.bindMutationObserve = function () {
205
186
  var _this = this;
206
187
  if (!this.watermarkDom) {
207
188
  return;
208
189
  }
209
- this.bindCheckWatermarkElementEvent();
210
190
  this.observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
211
191
  return __generator(this, function (_a) {
212
192
  switch (_a.label) {
@@ -262,15 +242,6 @@ var Watermark = /** @class */ (function () {
262
242
  characterData: true, // 节点内容或节点文本的变动。
263
243
  });
264
244
  };
265
- Watermark.prototype.bindCheckWatermarkElementEvent = function () {
266
- this.unbindCheckWatermarkElementEvent();
267
- this.checkWatermarkElementRequestID = requestAnimationFrame(this.checkWatermarkElement.bind(this));
268
- };
269
- Watermark.prototype.unbindCheckWatermarkElementEvent = function () {
270
- if (!isUndefined(this.checkWatermarkElementRequestID)) {
271
- cancelAnimationFrame(this.checkWatermarkElementRequestID);
272
- }
273
- };
274
245
  return Watermark;
275
246
  }());
276
247
 
@@ -43,7 +43,6 @@ var generateRecommendOptions = function (canvas, options, args) {
43
43
  }
44
44
  ctx.font = "".concat(options.fontStyle, " ").concat(options.fontVariant, " ").concat(options.fontWeight, " ").concat(options.fontSize, " ").concat(options.fontFamily);
45
45
  ctx.filter = options.filter;
46
- // @ts-ignore
47
46
  ctx.letterSpacing = options.letterSpacing;
48
47
  ctx.wordSpacing = options.wordSpacing;
49
48
  if (options === null || options === void 0 ? void 0 : options.rotate) {
@@ -7,10 +7,6 @@ var protection = (function (need) {
7
7
  writable: false,
8
8
  configurable: false,
9
9
  });
10
- Object.defineProperty(window, 'requestAnimationFrame', {
11
- writable: false,
12
- configurable: false,
13
- });
14
10
  }
15
11
  });
16
12
 
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __assign, __generator } from '../../node_modules/tslib/tslib.es6.js';
2
- import { isUndefined, convertImage, generateAnimationStyle } from '../utils/index.js';
2
+ import { convertImage, generateAnimationStyle, isUndefined } from '../utils/index.js';
3
3
  import { initialOptions } from '../utils/initialization.js';
4
4
  import protection from '../utils/protection.js';
5
5
  import { renderLayout, generateBackgroundSize } from './layout/index.js';
@@ -123,7 +123,6 @@ var Watermark = /** @class */ (function () {
123
123
  (_b = (_a = this.options).onBeforeDestroy) === null || _b === void 0 ? void 0 : _b.call(_a);
124
124
  (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
125
125
  (_d = this.parentObserve) === null || _d === void 0 ? void 0 : _d.disconnect();
126
- this.unbindCheckWatermarkElementEvent();
127
126
  (_f = (_e = this.watermarkDom) === null || _e === void 0 ? void 0 : _e.parentNode) === null || _f === void 0 ? void 0 : _f.removeChild(this.watermarkDom);
128
127
  (_h = (_g = this.options).onDestroyed) === null || _h === void 0 ? void 0 : _h.call(_g);
129
128
  };
@@ -183,30 +182,11 @@ var Watermark = /** @class */ (function () {
183
182
  }
184
183
  return 'custom';
185
184
  };
186
- Watermark.prototype.checkWatermarkElement = function () {
187
- return __awaiter(this, void 0, void 0, function () {
188
- return __generator(this, function (_a) {
189
- switch (_a.label) {
190
- case 0:
191
- if (!!this.parentElement.contains(this.watermarkDom)) return [3 /*break*/, 2];
192
- this.remove();
193
- return [4 /*yield*/, this.create()];
194
- case 1:
195
- _a.sent();
196
- _a.label = 2;
197
- case 2:
198
- this.bindCheckWatermarkElementEvent();
199
- return [2 /*return*/];
200
- }
201
- });
202
- });
203
- };
204
185
  Watermark.prototype.bindMutationObserve = function () {
205
186
  var _this = this;
206
187
  if (!this.watermarkDom) {
207
188
  return;
208
189
  }
209
- this.bindCheckWatermarkElementEvent();
210
190
  this.observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
211
191
  return __generator(this, function (_a) {
212
192
  switch (_a.label) {
@@ -262,15 +242,6 @@ var Watermark = /** @class */ (function () {
262
242
  characterData: true, // 节点内容或节点文本的变动。
263
243
  });
264
244
  };
265
- Watermark.prototype.bindCheckWatermarkElementEvent = function () {
266
- this.unbindCheckWatermarkElementEvent();
267
- this.checkWatermarkElementRequestID = requestAnimationFrame(this.checkWatermarkElement.bind(this));
268
- };
269
- Watermark.prototype.unbindCheckWatermarkElementEvent = function () {
270
- if (!isUndefined(this.checkWatermarkElementRequestID)) {
271
- cancelAnimationFrame(this.checkWatermarkElementRequestID);
272
- }
273
- };
274
245
  return Watermark;
275
246
  }());
276
247
 
@@ -43,7 +43,6 @@ var generateRecommendOptions = function (canvas, options, args) {
43
43
  }
44
44
  ctx.font = "".concat(options.fontStyle, " ").concat(options.fontVariant, " ").concat(options.fontWeight, " ").concat(options.fontSize, " ").concat(options.fontFamily);
45
45
  ctx.filter = options.filter;
46
- // @ts-ignore
47
46
  ctx.letterSpacing = options.letterSpacing;
48
47
  ctx.wordSpacing = options.wordSpacing;
49
48
  if (options === null || options === void 0 ? void 0 : options.rotate) {
@@ -7,10 +7,6 @@ var protection = (function (need) {
7
7
  writable: false,
8
8
  configurable: false,
9
9
  });
10
- Object.defineProperty(window, 'requestAnimationFrame', {
11
- writable: false,
12
- configurable: false,
13
- });
14
10
  }
15
11
  });
16
12
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * watermark-js-plus v1.6.1
2
+ * watermark-js-plus v1.6.2
3
3
  * (c) 2022-2024 Michael Sun
4
4
  * Released under the MIT License.
5
5
  */
@@ -4542,7 +4542,6 @@ var generateRecommendOptions = function (canvas, options, args) {
4542
4542
  }
4543
4543
  ctx.font = "".concat(options.fontStyle, " ").concat(options.fontVariant, " ").concat(options.fontWeight, " ").concat(options.fontSize, " ").concat(options.fontFamily);
4544
4544
  ctx.filter = options.filter;
4545
- // @ts-ignore
4546
4545
  ctx.letterSpacing = options.letterSpacing;
4547
4546
  ctx.wordSpacing = options.wordSpacing;
4548
4547
  if (options === null || options === void 0 ? void 0 : options.rotate) {
@@ -4790,10 +4789,6 @@ var protection = (function (need) {
4790
4789
  writable: false,
4791
4790
  configurable: false,
4792
4791
  });
4793
- Object.defineProperty(window, 'requestAnimationFrame', {
4794
- writable: false,
4795
- configurable: false,
4796
- });
4797
4792
  }
4798
4793
  });
4799
4794
 
@@ -5256,7 +5251,6 @@ var Watermark = /** @class */ (function () {
5256
5251
  (_b = (_a = this.options).onBeforeDestroy) === null || _b === void 0 ? void 0 : _b.call(_a);
5257
5252
  (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
5258
5253
  (_d = this.parentObserve) === null || _d === void 0 ? void 0 : _d.disconnect();
5259
- this.unbindCheckWatermarkElementEvent();
5260
5254
  (_f = (_e = this.watermarkDom) === null || _e === void 0 ? void 0 : _e.parentNode) === null || _f === void 0 ? void 0 : _f.removeChild(this.watermarkDom);
5261
5255
  (_h = (_g = this.options).onDestroyed) === null || _h === void 0 ? void 0 : _h.call(_g);
5262
5256
  };
@@ -5316,30 +5310,11 @@ var Watermark = /** @class */ (function () {
5316
5310
  }
5317
5311
  return 'custom';
5318
5312
  };
5319
- Watermark.prototype.checkWatermarkElement = function () {
5320
- return __awaiter(this, void 0, void 0, function () {
5321
- return __generator(this, function (_a) {
5322
- switch (_a.label) {
5323
- case 0:
5324
- if (!!this.parentElement.contains(this.watermarkDom)) return [3 /*break*/, 2];
5325
- this.remove();
5326
- return [4 /*yield*/, this.create()];
5327
- case 1:
5328
- _a.sent();
5329
- _a.label = 2;
5330
- case 2:
5331
- this.bindCheckWatermarkElementEvent();
5332
- return [2 /*return*/];
5333
- }
5334
- });
5335
- });
5336
- };
5337
5313
  Watermark.prototype.bindMutationObserve = function () {
5338
5314
  var _this = this;
5339
5315
  if (!this.watermarkDom) {
5340
5316
  return;
5341
5317
  }
5342
- this.bindCheckWatermarkElementEvent();
5343
5318
  this.observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5344
5319
  return __generator(this, function (_a) {
5345
5320
  switch (_a.label) {
@@ -5395,15 +5370,6 @@ var Watermark = /** @class */ (function () {
5395
5370
  characterData: true, // 节点内容或节点文本的变动。
5396
5371
  });
5397
5372
  };
5398
- Watermark.prototype.bindCheckWatermarkElementEvent = function () {
5399
- this.unbindCheckWatermarkElementEvent();
5400
- this.checkWatermarkElementRequestID = requestAnimationFrame(this.checkWatermarkElement.bind(this));
5401
- };
5402
- Watermark.prototype.unbindCheckWatermarkElementEvent = function () {
5403
- if (!isUndefined(this.checkWatermarkElementRequestID)) {
5404
- cancelAnimationFrame(this.checkWatermarkElementRequestID);
5405
- }
5406
- };
5407
5373
  return Watermark;
5408
5374
  }());
5409
5375