watermark-js-plus 0.11.3 → 0.12.1

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/index.cjs.js CHANGED
@@ -181,7 +181,7 @@ var initialOptions = {
181
181
  imageHeight: 0,
182
182
  lineHeight: 30,
183
183
  zIndex: 2147483647,
184
- backgroundPosition: '0 0, 0 0',
184
+ backgroundPosition: '0 0',
185
185
  backgroundRepeat: 'repeat',
186
186
  fontSize: '20px',
187
187
  fontFamily: 'sans-serif',
@@ -193,6 +193,7 @@ var initialOptions = {
193
193
  globalAlpha: 0.5,
194
194
  mode: 'default',
195
195
  mutationObserve: true,
196
+ movable: false,
196
197
  parent: 'body',
197
198
  onSuccess: function () { },
198
199
  onBeforeDestroy: function () { },
@@ -836,7 +837,7 @@ var Watermark = /** @class */ (function () {
836
837
  parentElementType = this.checkParentElementType();
837
838
  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 ");
838
839
  backgroundSize = generateBackgroundSize(this.options);
839
- 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, "!important;\n ");
840
+ 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(this.options.movable ? 'animation: 200s ease 0s infinite normal none running watermark !important;' : '', "\n ");
840
841
  this.watermarkDom.append(watermarkInnerDom);
841
842
  this.parentElement.appendChild(this.watermarkDom);
842
843
  if (this.options.mutationObserve) {
@@ -1135,6 +1136,36 @@ var ImageWatermark = /** @class */ (function () {
1135
1136
  return ImageWatermark;
1136
1137
  }());
1137
1138
 
1139
+ function styleInject(css, ref) {
1140
+ if ( ref === void 0 ) ref = {};
1141
+ var insertAt = ref.insertAt;
1142
+
1143
+ if (!css || typeof document === 'undefined') { return; }
1144
+
1145
+ var head = document.head || document.getElementsByTagName('head')[0];
1146
+ var style = document.createElement('style');
1147
+ style.type = 'text/css';
1148
+
1149
+ if (insertAt === 'top') {
1150
+ if (head.firstChild) {
1151
+ head.insertBefore(style, head.firstChild);
1152
+ } else {
1153
+ head.appendChild(style);
1154
+ }
1155
+ } else {
1156
+ head.appendChild(style);
1157
+ }
1158
+
1159
+ if (style.styleSheet) {
1160
+ style.styleSheet.cssText = css;
1161
+ } else {
1162
+ style.appendChild(document.createTextNode(css));
1163
+ }
1164
+ }
1165
+
1166
+ var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:0 0}75%{background-position:100% -100%}to{background-position:0 0}}";
1167
+ styleInject(css_248z);
1168
+
1138
1169
  exports.BlindWatermark = BlindWatermark;
1139
1170
  exports.ImageWatermark = ImageWatermark;
1140
1171
  exports.Watermark = Watermark;