watermark-js-plus 1.6.0 → 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.
- package/dist/es/node_modules/tslib/tslib.es6.js +86 -0
- package/dist/es/src/core/blind.js +82 -0
- package/dist/es/src/core/canvas.js +292 -0
- package/dist/es/src/core/image.js +63 -0
- package/dist/es/src/core/layout/grid.js +36 -0
- package/dist/es/src/core/layout/index.js +25 -0
- package/dist/es/src/core/watermark.js +248 -0
- package/dist/es/src/index.js +3 -0
- package/dist/es/src/utils/index.js +199 -0
- package/dist/es/src/utils/initialization.js +284 -0
- package/dist/es/src/utils/protection.js +13 -0
- package/dist/es/style.css +1 -0
- package/dist/ie/es/_virtual/_commonjsHelpers.js +3 -0
- package/dist/ie/es/_virtual/es.array.fill.js +3 -0
- package/dist/ie/es/_virtual/es.array.fill2.js +3 -0
- package/dist/ie/es/_virtual/es.array.from.js +3 -0
- package/dist/ie/es/_virtual/es.array.from2.js +3 -0
- package/dist/ie/es/_virtual/es.array.includes.js +3 -0
- package/dist/ie/es/_virtual/es.array.includes2.js +3 -0
- package/dist/ie/es/_virtual/es.promise.all.js +3 -0
- package/dist/ie/es/_virtual/es.promise.catch.js +3 -0
- package/dist/ie/es/_virtual/es.promise.constructor.js +3 -0
- package/dist/ie/es/_virtual/es.promise.js +3 -0
- package/dist/ie/es/_virtual/es.promise.race.js +3 -0
- package/dist/ie/es/_virtual/es.promise.reject.js +3 -0
- package/dist/ie/es/_virtual/es.promise.resolve.js +3 -0
- package/dist/ie/es/_virtual/es.promise2.js +3 -0
- package/dist/ie/es/_virtual/make-built-in.js +3 -0
- package/dist/ie/es/_virtual/new-promise-capability.js +3 -0
- package/dist/ie/es/_virtual/object-define-properties.js +3 -0
- package/dist/ie/es/_virtual/object-define-property.js +3 -0
- package/dist/ie/es/_virtual/object-get-own-property-descriptor.js +3 -0
- package/dist/ie/es/_virtual/object-get-own-property-names.js +3 -0
- package/dist/ie/es/_virtual/object-get-own-property-symbols.js +3 -0
- package/dist/ie/es/_virtual/object-property-is-enumerable.js +3 -0
- package/dist/ie/es/_virtual/shared-store.js +3 -0
- package/dist/ie/es/node_modules/core-js/internals/a-callable.js +23 -0
- package/dist/ie/es/node_modules/core-js/internals/a-constructor.js +23 -0
- package/dist/ie/es/node_modules/core-js/internals/a-possible-prototype.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/add-to-unscopables.js +34 -0
- package/dist/ie/es/node_modules/core-js/internals/an-instance.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/an-object.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/array-fill.js +30 -0
- package/dist/ie/es/node_modules/core-js/internals/array-from.js +66 -0
- package/dist/ie/es/node_modules/core-js/internals/array-includes.js +47 -0
- package/dist/ie/es/node_modules/core-js/internals/array-slice.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/call-with-safe-iteration-closing.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/check-correctness-of-iteration.js +52 -0
- package/dist/ie/es/node_modules/core-js/internals/classof-raw.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/classof.js +44 -0
- package/dist/ie/es/node_modules/core-js/internals/copy-constructor-properties.js +31 -0
- package/dist/ie/es/node_modules/core-js/internals/create-non-enumerable-property.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/create-property-descriptor.js +18 -0
- package/dist/ie/es/node_modules/core-js/internals/create-property.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/define-built-in-accessor.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/define-built-in.js +42 -0
- package/dist/ie/es/node_modules/core-js/internals/define-global-property.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/descriptors.js +19 -0
- package/dist/ie/es/node_modules/core-js/internals/document-create-element.js +23 -0
- package/dist/ie/es/node_modules/core-js/internals/enum-bug-keys.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/environment-is-ios-pebble.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/environment-is-ios.js +16 -0
- package/dist/ie/es/node_modules/core-js/internals/environment-is-node.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/environment-is-webos-webkit.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/environment-user-agent.js +18 -0
- package/dist/ie/es/node_modules/core-js/internals/environment-v8-version.js +40 -0
- package/dist/ie/es/node_modules/core-js/internals/environment.js +34 -0
- package/dist/ie/es/node_modules/core-js/internals/export.js +72 -0
- package/dist/ie/es/node_modules/core-js/internals/fails.js +17 -0
- package/dist/ie/es/node_modules/core-js/internals/function-apply.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/function-bind-context.js +27 -0
- package/dist/ie/es/node_modules/core-js/internals/function-bind-native.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/function-call.js +19 -0
- package/dist/ie/es/node_modules/core-js/internals/function-name.js +30 -0
- package/dist/ie/es/node_modules/core-js/internals/function-uncurry-this-accessor.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/function-uncurry-this-clause.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/function-uncurry-this.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/get-built-in.js +23 -0
- package/dist/ie/es/node_modules/core-js/internals/get-iterator-method.js +29 -0
- package/dist/ie/es/node_modules/core-js/internals/get-iterator.js +29 -0
- package/dist/ie/es/node_modules/core-js/internals/get-method.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/global-this.js +27 -0
- package/dist/ie/es/node_modules/core-js/internals/has-own-property.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/hidden-keys.js +11 -0
- package/dist/ie/es/node_modules/core-js/internals/host-report-errors.js +16 -0
- package/dist/ie/es/node_modules/core-js/internals/html.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/ie8-dom-define.js +25 -0
- package/dist/ie/es/node_modules/core-js/internals/indexed-object.js +29 -0
- package/dist/ie/es/node_modules/core-js/internals/inspect-source.js +28 -0
- package/dist/ie/es/node_modules/core-js/internals/internal-state.js +89 -0
- package/dist/ie/es/node_modules/core-js/internals/is-array-iterator-method.js +23 -0
- package/dist/ie/es/node_modules/core-js/internals/is-callable.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/is-constructor.js +68 -0
- package/dist/ie/es/node_modules/core-js/internals/is-forced.js +35 -0
- package/dist/ie/es/node_modules/core-js/internals/is-null-or-undefined.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/is-object.js +17 -0
- package/dist/ie/es/node_modules/core-js/internals/is-possible-prototype.js +17 -0
- package/dist/ie/es/node_modules/core-js/internals/is-pure.js +11 -0
- package/dist/ie/es/node_modules/core-js/internals/is-symbol.js +28 -0
- package/dist/ie/es/node_modules/core-js/internals/iterate.js +89 -0
- package/dist/ie/es/node_modules/core-js/internals/iterator-close.js +37 -0
- package/dist/ie/es/node_modules/core-js/internals/iterators.js +11 -0
- package/dist/ie/es/node_modules/core-js/internals/length-of-array-like.js +19 -0
- package/dist/ie/es/node_modules/core-js/internals/make-built-in.js +73 -0
- package/dist/ie/es/node_modules/core-js/internals/math-trunc.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/microtask.js +98 -0
- package/dist/ie/es/node_modules/core-js/internals/new-promise-capability.js +32 -0
- package/dist/ie/es/node_modules/core-js/internals/object-create.js +102 -0
- package/dist/ie/es/node_modules/core-js/internals/object-define-properties.js +37 -0
- package/dist/ie/es/node_modules/core-js/internals/object-define-property.js +59 -0
- package/dist/ie/es/node_modules/core-js/internals/object-get-own-property-descriptor.js +41 -0
- package/dist/ie/es/node_modules/core-js/internals/object-get-own-property-names.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/object-get-own-property-symbols.js +13 -0
- package/dist/ie/es/node_modules/core-js/internals/object-is-prototype-of.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/object-keys-internal.js +36 -0
- package/dist/ie/es/node_modules/core-js/internals/object-keys.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/object-property-is-enumerable.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/object-set-prototype-of.js +43 -0
- package/dist/ie/es/node_modules/core-js/internals/ordinary-to-primitive.js +29 -0
- package/dist/ie/es/node_modules/core-js/internals/own-keys.js +30 -0
- package/dist/ie/es/node_modules/core-js/internals/perform.js +17 -0
- package/dist/ie/es/node_modules/core-js/internals/promise-constructor-detection.js +66 -0
- package/dist/ie/es/node_modules/core-js/internals/promise-native-constructor.js +15 -0
- package/dist/ie/es/node_modules/core-js/internals/promise-resolve.js +26 -0
- package/dist/ie/es/node_modules/core-js/internals/promise-statics-incorrect-iteration.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/queue.js +34 -0
- package/dist/ie/es/node_modules/core-js/internals/require-object-coercible.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/safe-get-built-in.js +25 -0
- package/dist/ie/es/node_modules/core-js/internals/set-species.js +32 -0
- package/dist/ie/es/node_modules/core-js/internals/set-to-string-tag.js +26 -0
- package/dist/ie/es/node_modules/core-js/internals/shared-key.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/shared-store.js +28 -0
- package/dist/ie/es/node_modules/core-js/internals/shared.js +17 -0
- package/dist/ie/es/node_modules/core-js/internals/species-constructor.js +29 -0
- package/dist/ie/es/node_modules/core-js/internals/symbol-constructor-detection.js +32 -0
- package/dist/ie/es/node_modules/core-js/internals/task.js +139 -0
- package/dist/ie/es/node_modules/core-js/internals/to-absolute-index.js +24 -0
- package/dist/ie/es/node_modules/core-js/internals/to-indexed-object.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/to-integer-or-infinity.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/to-length.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/to-object.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/to-primitive.js +42 -0
- package/dist/ie/es/node_modules/core-js/internals/to-property-key.js +22 -0
- package/dist/ie/es/node_modules/core-js/internals/to-string-tag-support.js +20 -0
- package/dist/ie/es/node_modules/core-js/internals/try-to-string.js +19 -0
- package/dist/ie/es/node_modules/core-js/internals/uid.js +21 -0
- package/dist/ie/es/node_modules/core-js/internals/use-symbol-as-uid.js +18 -0
- package/dist/ie/es/node_modules/core-js/internals/v8-prototype-define-bug.js +25 -0
- package/dist/ie/es/node_modules/core-js/internals/validate-arguments-length.js +16 -0
- package/dist/ie/es/node_modules/core-js/internals/weak-map-basic-detection.js +19 -0
- package/dist/ie/es/node_modules/core-js/internals/well-known-symbol.js +35 -0
- package/dist/ie/es/node_modules/core-js/modules/es.array.fill.js +26 -0
- package/dist/ie/es/node_modules/core-js/modules/es.array.from.js +28 -0
- package/dist/ie/es/node_modules/core-js/modules/es.array.includes.js +36 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.all.js +56 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.catch.js +43 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.constructor.js +323 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.js +24 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.race.js +43 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.reject.js +28 -0
- package/dist/ie/es/node_modules/core-js/modules/es.promise.resolve.js +34 -0
- package/dist/ie/es/node_modules/tslib/tslib.es6.js +86 -0
- package/dist/ie/es/node_modules/whatwg-fetch/fetch.js +643 -0
- package/dist/ie/es/src/core/blind.js +82 -0
- package/dist/ie/es/src/core/canvas.js +292 -0
- package/dist/ie/es/src/core/image.js +63 -0
- package/dist/ie/es/src/core/layout/grid.js +36 -0
- package/dist/ie/es/src/core/layout/index.js +25 -0
- package/dist/ie/es/src/core/watermark.js +248 -0
- package/dist/ie/es/src/index.ie.js +9 -0
- package/dist/ie/es/src/utils/index.js +199 -0
- package/dist/ie/es/src/utils/initialization.js +284 -0
- package/dist/ie/es/src/utils/polyfill.js +5 -0
- package/dist/ie/es/src/utils/protection.js +13 -0
- package/dist/ie/es/style.css +1 -0
- package/dist/ie/index.cjs.js +3 -37
- package/dist/ie/index.cjs.js.map +1 -1
- package/dist/ie/index.cjs.min.js +1 -1
- package/dist/ie/index.esm.js +3 -37
- package/dist/ie/index.esm.js.map +1 -1
- package/dist/ie/index.esm.min.js +1 -1
- package/dist/ie/index.iife.js +3 -37
- package/dist/ie/index.iife.js.map +1 -1
- package/dist/ie/index.iife.min.js +1 -1
- package/dist/ie/index.umd.js +3 -37
- package/dist/ie/index.umd.js.map +1 -1
- package/dist/ie/index.umd.min.js +1 -1
- package/dist/index.cjs.js +1 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.js +1 -35
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +1 -35
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.umd.js +1 -35
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/types/core/watermark.d.ts +0 -4
- package/dist/types/style/index.d.ts +1 -1
- package/package.json +41 -22
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { isUndefined, getMultiLineData } from './index.js';
|
|
2
|
+
|
|
3
|
+
var initialOptions = {
|
|
4
|
+
width: 300,
|
|
5
|
+
height: 300,
|
|
6
|
+
rotate: 45,
|
|
7
|
+
layout: 'default',
|
|
8
|
+
auxiliaryLine: false,
|
|
9
|
+
translatePlacement: 'middle',
|
|
10
|
+
contentType: 'text',
|
|
11
|
+
content: 'hello watermark-js-plus',
|
|
12
|
+
textType: 'fill',
|
|
13
|
+
imageWidth: 0,
|
|
14
|
+
imageHeight: 0,
|
|
15
|
+
lineHeight: 30,
|
|
16
|
+
zIndex: 2147483647,
|
|
17
|
+
backgroundPosition: '0 0',
|
|
18
|
+
backgroundRepeat: 'repeat',
|
|
19
|
+
fontSize: '20px',
|
|
20
|
+
fontFamily: 'sans-serif',
|
|
21
|
+
fontStyle: '',
|
|
22
|
+
fontVariant: '',
|
|
23
|
+
fontColor: '#000',
|
|
24
|
+
fontWeight: 'normal',
|
|
25
|
+
filter: 'none',
|
|
26
|
+
letterSpacing: '0px',
|
|
27
|
+
wordSpacing: '0px',
|
|
28
|
+
globalAlpha: 0.5,
|
|
29
|
+
mode: 'default',
|
|
30
|
+
mutationObserve: true,
|
|
31
|
+
monitorProtection: false,
|
|
32
|
+
movable: false,
|
|
33
|
+
parent: 'body',
|
|
34
|
+
onSuccess: function () { },
|
|
35
|
+
onBeforeDestroy: function () { },
|
|
36
|
+
onDestroyed: function () { },
|
|
37
|
+
onObserveError: function () { },
|
|
38
|
+
};
|
|
39
|
+
var generateRecommendOptions = function (canvas, options, args) {
|
|
40
|
+
var ctx = canvas.getContext('2d');
|
|
41
|
+
if (ctx === null) {
|
|
42
|
+
throw new Error('get context error');
|
|
43
|
+
}
|
|
44
|
+
ctx.font = "".concat(options.fontStyle, " ").concat(options.fontVariant, " ").concat(options.fontWeight, " ").concat(options.fontSize, " ").concat(options.fontFamily);
|
|
45
|
+
ctx.filter = options.filter;
|
|
46
|
+
ctx.letterSpacing = options.letterSpacing;
|
|
47
|
+
ctx.wordSpacing = options.wordSpacing;
|
|
48
|
+
if (options === null || options === void 0 ? void 0 : options.rotate) {
|
|
49
|
+
options.rotate = (360 - (options.rotate % 360)) * (Math.PI / 180);
|
|
50
|
+
}
|
|
51
|
+
if (isUndefined(args.textRowMaxWidth)) {
|
|
52
|
+
options.textRowMaxWidth = options.width;
|
|
53
|
+
}
|
|
54
|
+
var result = {
|
|
55
|
+
image: {
|
|
56
|
+
rect: {
|
|
57
|
+
width: options.imageWidth,
|
|
58
|
+
height: options.imageHeight,
|
|
59
|
+
},
|
|
60
|
+
position: {
|
|
61
|
+
x: 0,
|
|
62
|
+
y: 0,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
textLine: {
|
|
66
|
+
data: [],
|
|
67
|
+
yOffsetValue: 0,
|
|
68
|
+
},
|
|
69
|
+
advancedStyleParams: {
|
|
70
|
+
linear: {
|
|
71
|
+
x0: 0,
|
|
72
|
+
x1: 0,
|
|
73
|
+
},
|
|
74
|
+
radial: {
|
|
75
|
+
x0: 0,
|
|
76
|
+
y0: 0,
|
|
77
|
+
r0: 0,
|
|
78
|
+
x1: 0,
|
|
79
|
+
y1: 0,
|
|
80
|
+
r1: 0,
|
|
81
|
+
},
|
|
82
|
+
conic: {
|
|
83
|
+
x: 0,
|
|
84
|
+
y: 0,
|
|
85
|
+
startAngle: 0,
|
|
86
|
+
},
|
|
87
|
+
pattern: {},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
switch (options.contentType) {
|
|
91
|
+
case 'text':
|
|
92
|
+
result.textLine.data = [options.content];
|
|
93
|
+
break;
|
|
94
|
+
case 'multi-line-text':
|
|
95
|
+
result.textLine.data = getMultiLineData(ctx, options.content, options.textRowMaxWidth);
|
|
96
|
+
break;
|
|
97
|
+
// case 'image':
|
|
98
|
+
// break
|
|
99
|
+
// case 'rich-text':
|
|
100
|
+
// break
|
|
101
|
+
}
|
|
102
|
+
var translateX = options.width / 2;
|
|
103
|
+
var translateY = options.height / 2;
|
|
104
|
+
var textBaseline = 'middle';
|
|
105
|
+
var textAlign = 'center';
|
|
106
|
+
if (!isUndefined(args === null || args === void 0 ? void 0 : args.translateX) && !isUndefined(args === null || args === void 0 ? void 0 : args.translateY)) {
|
|
107
|
+
translateX = args === null || args === void 0 ? void 0 : args.translateX;
|
|
108
|
+
translateY = args === null || args === void 0 ? void 0 : args.translateY;
|
|
109
|
+
textBaseline = 'top';
|
|
110
|
+
textAlign = 'left';
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// default middle
|
|
114
|
+
// translateX = options.width / 2
|
|
115
|
+
// translateY = options.height / 2
|
|
116
|
+
// TextBaselineType = 'middle'
|
|
117
|
+
// textAlign = 'center'
|
|
118
|
+
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
119
|
+
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
120
|
+
// result.advancedStyleParams.radial.x0 = 0
|
|
121
|
+
// result.advancedStyleParams.radial.y0 = 0
|
|
122
|
+
result.advancedStyleParams.radial.r0 = 0;
|
|
123
|
+
// result.advancedStyleParams.radial.x1 = 0
|
|
124
|
+
// result.advancedStyleParams.radial.y1 = 0
|
|
125
|
+
result.advancedStyleParams.radial.r1 = options.width / 2;
|
|
126
|
+
// result.advancedStyleParams.conic.x = 0
|
|
127
|
+
// result.advancedStyleParams.conic.y = 0
|
|
128
|
+
}
|
|
129
|
+
switch (args.translatePlacement) {
|
|
130
|
+
case 'top':
|
|
131
|
+
translateX = options.width / 2;
|
|
132
|
+
translateY = 0;
|
|
133
|
+
textBaseline = 'top';
|
|
134
|
+
// textAlign = 'center'
|
|
135
|
+
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
136
|
+
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
137
|
+
// result.advancedStyleParams.radial.x0 = 0
|
|
138
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
139
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
140
|
+
// result.advancedStyleParams.radial.x1 = 0
|
|
141
|
+
// result.advancedStyleParams.radial.y1 = 0
|
|
142
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
143
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
144
|
+
// result.advancedStyleParams.conic.x = 0
|
|
145
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
146
|
+
break;
|
|
147
|
+
case 'top-start':
|
|
148
|
+
translateX = 0;
|
|
149
|
+
translateY = 0;
|
|
150
|
+
textBaseline = 'top';
|
|
151
|
+
textAlign = 'start';
|
|
152
|
+
result.advancedStyleParams.linear.x0 = 0;
|
|
153
|
+
result.advancedStyleParams.linear.x1 = options.width;
|
|
154
|
+
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
155
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
156
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
157
|
+
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
158
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
159
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
160
|
+
result.advancedStyleParams.conic.x = options.width / 2;
|
|
161
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
162
|
+
break;
|
|
163
|
+
case 'top-end':
|
|
164
|
+
translateX = options.width;
|
|
165
|
+
translateY = 0;
|
|
166
|
+
textBaseline = 'top';
|
|
167
|
+
textAlign = 'end';
|
|
168
|
+
result.advancedStyleParams.linear.x0 = 0;
|
|
169
|
+
result.advancedStyleParams.linear.x1 = -options.width;
|
|
170
|
+
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
171
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
172
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
173
|
+
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
174
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
175
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
176
|
+
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
177
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
178
|
+
break;
|
|
179
|
+
case 'bottom':
|
|
180
|
+
translateX = options.width / 2;
|
|
181
|
+
translateY = options.height;
|
|
182
|
+
textBaseline = 'bottom';
|
|
183
|
+
// textAlign = 'center'
|
|
184
|
+
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
185
|
+
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
186
|
+
// result.advancedStyleParams.radial.x0 = 0
|
|
187
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
188
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
189
|
+
// result.advancedStyleParams.radial.x1 = 0
|
|
190
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
191
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
192
|
+
result.advancedStyleParams.conic.x = 0;
|
|
193
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
194
|
+
break;
|
|
195
|
+
case 'bottom-start':
|
|
196
|
+
translateX = 0;
|
|
197
|
+
translateY = options.height;
|
|
198
|
+
textBaseline = 'bottom';
|
|
199
|
+
textAlign = 'start';
|
|
200
|
+
result.advancedStyleParams.linear.x0 = 0;
|
|
201
|
+
result.advancedStyleParams.linear.x1 = options.width;
|
|
202
|
+
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
203
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
204
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
205
|
+
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
206
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
207
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
208
|
+
result.advancedStyleParams.conic.x = options.width / 2;
|
|
209
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
210
|
+
break;
|
|
211
|
+
case 'bottom-end':
|
|
212
|
+
translateX = options.width;
|
|
213
|
+
translateY = options.height;
|
|
214
|
+
textBaseline = 'bottom';
|
|
215
|
+
textAlign = 'end';
|
|
216
|
+
result.advancedStyleParams.linear.x0 = 0;
|
|
217
|
+
result.advancedStyleParams.linear.x1 = -options.width;
|
|
218
|
+
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
219
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
220
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
221
|
+
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
222
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
223
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
224
|
+
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
225
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
226
|
+
break;
|
|
227
|
+
case 'left':
|
|
228
|
+
translateX = 0;
|
|
229
|
+
translateY = options.height / 2;
|
|
230
|
+
// TextBaselineType = 'middle'
|
|
231
|
+
textAlign = 'start';
|
|
232
|
+
result.advancedStyleParams.linear.x0 = 0;
|
|
233
|
+
result.advancedStyleParams.linear.x1 = options.width;
|
|
234
|
+
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
235
|
+
// result.advancedStyleParams.radial.y0 = 0
|
|
236
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
237
|
+
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
238
|
+
// result.advancedStyleParams.radial.y1 = 0
|
|
239
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
240
|
+
result.advancedStyleParams.conic.x = options.width / 2;
|
|
241
|
+
result.advancedStyleParams.conic.y = 0;
|
|
242
|
+
break;
|
|
243
|
+
case 'right':
|
|
244
|
+
translateX = options.width;
|
|
245
|
+
translateY = options.height / 2;
|
|
246
|
+
// TextBaselineType = 'middle'
|
|
247
|
+
textAlign = 'end';
|
|
248
|
+
result.advancedStyleParams.linear.x0 = 0;
|
|
249
|
+
result.advancedStyleParams.linear.x1 = -options.width;
|
|
250
|
+
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
251
|
+
// result.advancedStyleParams.radial.y0 = 0
|
|
252
|
+
// result.advancedStyleParams.radial.r0 = 0
|
|
253
|
+
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
254
|
+
// result.advancedStyleParams.radial.y1 = 0
|
|
255
|
+
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
256
|
+
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
257
|
+
result.advancedStyleParams.conic.y = 0;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
options.translateX = translateX;
|
|
261
|
+
options.translateY = translateY;
|
|
262
|
+
isUndefined(args === null || args === void 0 ? void 0 : args.textBaseline) && (options.textBaseline = textBaseline);
|
|
263
|
+
isUndefined(args === null || args === void 0 ? void 0 : args.textAlign) && (options.textAlign = textAlign);
|
|
264
|
+
if (['text', 'multi-line-text'].includes(options.contentType)) {
|
|
265
|
+
switch (options.textBaseline) {
|
|
266
|
+
case 'middle':
|
|
267
|
+
result.textLine.yOffsetValue = ((result.textLine.data.length - 1) * options.lineHeight) / 2;
|
|
268
|
+
break;
|
|
269
|
+
case 'bottom':
|
|
270
|
+
case 'alphabetic':
|
|
271
|
+
case 'ideographic':
|
|
272
|
+
result.textLine.yOffsetValue =
|
|
273
|
+
(result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
|
|
274
|
+
break;
|
|
275
|
+
case 'top':
|
|
276
|
+
case 'hanging':
|
|
277
|
+
result.textLine.yOffsetValue = -options.lineHeight / 2 + parseInt(options.fontSize) / 2;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return result;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export { generateRecommendOptions, initialOptions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var protection = (function (need) {
|
|
2
|
+
if (typeof window === 'undefined') {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
if (need) {
|
|
6
|
+
Object.defineProperty(window, 'MutationObserver', {
|
|
7
|
+
writable: false,
|
|
8
|
+
configurable: false,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { protection as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __require as requireIsCallable } from './is-callable.js';
|
|
2
|
+
import { __require as requireTryToString } from './try-to-string.js';
|
|
3
|
+
|
|
4
|
+
var aCallable;
|
|
5
|
+
var hasRequiredACallable;
|
|
6
|
+
|
|
7
|
+
function requireACallable () {
|
|
8
|
+
if (hasRequiredACallable) return aCallable;
|
|
9
|
+
hasRequiredACallable = 1;
|
|
10
|
+
var isCallable = requireIsCallable();
|
|
11
|
+
var tryToString = requireTryToString();
|
|
12
|
+
|
|
13
|
+
var $TypeError = TypeError;
|
|
14
|
+
|
|
15
|
+
// `Assert: IsCallable(argument) is true`
|
|
16
|
+
aCallable = function (argument) {
|
|
17
|
+
if (isCallable(argument)) return argument;
|
|
18
|
+
throw new $TypeError(tryToString(argument) + ' is not a function');
|
|
19
|
+
};
|
|
20
|
+
return aCallable;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { requireACallable as __require };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __require as requireIsConstructor } from './is-constructor.js';
|
|
2
|
+
import { __require as requireTryToString } from './try-to-string.js';
|
|
3
|
+
|
|
4
|
+
var aConstructor;
|
|
5
|
+
var hasRequiredAConstructor;
|
|
6
|
+
|
|
7
|
+
function requireAConstructor () {
|
|
8
|
+
if (hasRequiredAConstructor) return aConstructor;
|
|
9
|
+
hasRequiredAConstructor = 1;
|
|
10
|
+
var isConstructor = requireIsConstructor();
|
|
11
|
+
var tryToString = requireTryToString();
|
|
12
|
+
|
|
13
|
+
var $TypeError = TypeError;
|
|
14
|
+
|
|
15
|
+
// `Assert: IsConstructor(argument) is true`
|
|
16
|
+
aConstructor = function (argument) {
|
|
17
|
+
if (isConstructor(argument)) return argument;
|
|
18
|
+
throw new $TypeError(tryToString(argument) + ' is not a constructor');
|
|
19
|
+
};
|
|
20
|
+
return aConstructor;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { requireAConstructor as __require };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __require as requireIsPossiblePrototype } from './is-possible-prototype.js';
|
|
2
|
+
|
|
3
|
+
var aPossiblePrototype;
|
|
4
|
+
var hasRequiredAPossiblePrototype;
|
|
5
|
+
|
|
6
|
+
function requireAPossiblePrototype () {
|
|
7
|
+
if (hasRequiredAPossiblePrototype) return aPossiblePrototype;
|
|
8
|
+
hasRequiredAPossiblePrototype = 1;
|
|
9
|
+
var isPossiblePrototype = requireIsPossiblePrototype();
|
|
10
|
+
|
|
11
|
+
var $String = String;
|
|
12
|
+
var $TypeError = TypeError;
|
|
13
|
+
|
|
14
|
+
aPossiblePrototype = function (argument) {
|
|
15
|
+
if (isPossiblePrototype(argument)) return argument;
|
|
16
|
+
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
|
|
17
|
+
};
|
|
18
|
+
return aPossiblePrototype;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { requireAPossiblePrototype as __require };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __require as requireWellKnownSymbol } from './well-known-symbol.js';
|
|
2
|
+
import { __require as requireObjectCreate } from './object-create.js';
|
|
3
|
+
import { __require as requireObjectDefineProperty } from './object-define-property.js';
|
|
4
|
+
|
|
5
|
+
var addToUnscopables;
|
|
6
|
+
var hasRequiredAddToUnscopables;
|
|
7
|
+
|
|
8
|
+
function requireAddToUnscopables () {
|
|
9
|
+
if (hasRequiredAddToUnscopables) return addToUnscopables;
|
|
10
|
+
hasRequiredAddToUnscopables = 1;
|
|
11
|
+
var wellKnownSymbol = requireWellKnownSymbol();
|
|
12
|
+
var create = requireObjectCreate();
|
|
13
|
+
var defineProperty = requireObjectDefineProperty().f;
|
|
14
|
+
|
|
15
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
16
|
+
var ArrayPrototype = Array.prototype;
|
|
17
|
+
|
|
18
|
+
// Array.prototype[@@unscopables]
|
|
19
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
20
|
+
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
21
|
+
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
22
|
+
configurable: true,
|
|
23
|
+
value: create(null)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// add a key to Array.prototype[@@unscopables]
|
|
28
|
+
addToUnscopables = function (key) {
|
|
29
|
+
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
30
|
+
};
|
|
31
|
+
return addToUnscopables;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { requireAddToUnscopables as __require };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __require as requireObjectIsPrototypeOf } from './object-is-prototype-of.js';
|
|
2
|
+
|
|
3
|
+
var anInstance;
|
|
4
|
+
var hasRequiredAnInstance;
|
|
5
|
+
|
|
6
|
+
function requireAnInstance () {
|
|
7
|
+
if (hasRequiredAnInstance) return anInstance;
|
|
8
|
+
hasRequiredAnInstance = 1;
|
|
9
|
+
var isPrototypeOf = requireObjectIsPrototypeOf();
|
|
10
|
+
|
|
11
|
+
var $TypeError = TypeError;
|
|
12
|
+
|
|
13
|
+
anInstance = function (it, Prototype) {
|
|
14
|
+
if (isPrototypeOf(Prototype, it)) return it;
|
|
15
|
+
throw new $TypeError('Incorrect invocation');
|
|
16
|
+
};
|
|
17
|
+
return anInstance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { requireAnInstance as __require };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __require as requireIsObject } from './is-object.js';
|
|
2
|
+
|
|
3
|
+
var anObject;
|
|
4
|
+
var hasRequiredAnObject;
|
|
5
|
+
|
|
6
|
+
function requireAnObject () {
|
|
7
|
+
if (hasRequiredAnObject) return anObject;
|
|
8
|
+
hasRequiredAnObject = 1;
|
|
9
|
+
var isObject = requireIsObject();
|
|
10
|
+
|
|
11
|
+
var $String = String;
|
|
12
|
+
var $TypeError = TypeError;
|
|
13
|
+
|
|
14
|
+
// `Assert: Type(argument) is Object`
|
|
15
|
+
anObject = function (argument) {
|
|
16
|
+
if (isObject(argument)) return argument;
|
|
17
|
+
throw new $TypeError($String(argument) + ' is not an object');
|
|
18
|
+
};
|
|
19
|
+
return anObject;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { requireAnObject as __require };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __require as requireToObject } from './to-object.js';
|
|
2
|
+
import { __require as requireToAbsoluteIndex } from './to-absolute-index.js';
|
|
3
|
+
import { __require as requireLengthOfArrayLike } from './length-of-array-like.js';
|
|
4
|
+
|
|
5
|
+
var arrayFill;
|
|
6
|
+
var hasRequiredArrayFill;
|
|
7
|
+
|
|
8
|
+
function requireArrayFill () {
|
|
9
|
+
if (hasRequiredArrayFill) return arrayFill;
|
|
10
|
+
hasRequiredArrayFill = 1;
|
|
11
|
+
var toObject = requireToObject();
|
|
12
|
+
var toAbsoluteIndex = requireToAbsoluteIndex();
|
|
13
|
+
var lengthOfArrayLike = requireLengthOfArrayLike();
|
|
14
|
+
|
|
15
|
+
// `Array.prototype.fill` method implementation
|
|
16
|
+
// https://tc39.es/ecma262/#sec-array.prototype.fill
|
|
17
|
+
arrayFill = function fill(value /* , start = 0, end = @length */) {
|
|
18
|
+
var O = toObject(this);
|
|
19
|
+
var length = lengthOfArrayLike(O);
|
|
20
|
+
var argumentsLength = arguments.length;
|
|
21
|
+
var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
|
22
|
+
var end = argumentsLength > 2 ? arguments[2] : undefined;
|
|
23
|
+
var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
|
24
|
+
while (endPos > index) O[index++] = value;
|
|
25
|
+
return O;
|
|
26
|
+
};
|
|
27
|
+
return arrayFill;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { requireArrayFill as __require };
|