@tsparticles/plugin-polygon-mask 4.0.0-alpha.2 → 4.0.0-alpha.21

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 (57) hide show
  1. package/185.min.js +1 -0
  2. package/459.min.js +2 -0
  3. package/browser/Options/Classes/PolygonMask.js +9 -0
  4. package/browser/Options/Classes/PolygonMaskDraw.js +2 -0
  5. package/browser/Options/Classes/PolygonMaskDrawStroke.js +4 -0
  6. package/browser/Options/Classes/PolygonMaskInline.js +1 -0
  7. package/browser/Options/Classes/PolygonMaskLocalSvg.js +2 -0
  8. package/browser/Options/Classes/PolygonMaskMove.js +2 -0
  9. package/browser/PolygonMaskInstance.js +313 -308
  10. package/browser/PolygonMaskPlugin.js +6 -5
  11. package/browser/index.js +3 -3
  12. package/browser/pathseg.js +5 -15
  13. package/browser/utils.js +4 -2
  14. package/cjs/Options/Classes/PolygonMask.js +9 -0
  15. package/cjs/Options/Classes/PolygonMaskDraw.js +2 -0
  16. package/cjs/Options/Classes/PolygonMaskDrawStroke.js +4 -0
  17. package/cjs/Options/Classes/PolygonMaskInline.js +1 -0
  18. package/cjs/Options/Classes/PolygonMaskLocalSvg.js +2 -0
  19. package/cjs/Options/Classes/PolygonMaskMove.js +2 -0
  20. package/cjs/PolygonMaskInstance.js +313 -308
  21. package/cjs/PolygonMaskPlugin.js +6 -5
  22. package/cjs/index.js +3 -3
  23. package/cjs/pathseg.js +5 -15
  24. package/cjs/utils.js +4 -2
  25. package/dist_browser_PolygonMaskInstance_js.js +50 -0
  26. package/dist_browser_PolygonMaskPlugin_js.js +8 -38
  27. package/esm/Options/Classes/PolygonMask.js +9 -0
  28. package/esm/Options/Classes/PolygonMaskDraw.js +2 -0
  29. package/esm/Options/Classes/PolygonMaskDrawStroke.js +4 -0
  30. package/esm/Options/Classes/PolygonMaskInline.js +1 -0
  31. package/esm/Options/Classes/PolygonMaskLocalSvg.js +2 -0
  32. package/esm/Options/Classes/PolygonMaskMove.js +2 -0
  33. package/esm/PolygonMaskInstance.js +313 -308
  34. package/esm/PolygonMaskPlugin.js +6 -5
  35. package/esm/index.js +3 -3
  36. package/esm/pathseg.js +5 -15
  37. package/esm/utils.js +4 -2
  38. package/package.json +2 -2
  39. package/report.html +3 -3
  40. package/tsparticles.plugin.polygon-mask.js +15 -15
  41. package/tsparticles.plugin.polygon-mask.min.js +2 -2
  42. package/types/PolygonMaskPlugin.d.ts +4 -5
  43. package/types/index.d.ts +1 -1
  44. package/umd/Options/Classes/PolygonMask.js +9 -0
  45. package/umd/Options/Classes/PolygonMaskDraw.js +2 -0
  46. package/umd/Options/Classes/PolygonMaskDrawStroke.js +4 -0
  47. package/umd/Options/Classes/PolygonMaskInline.js +1 -0
  48. package/umd/Options/Classes/PolygonMaskLocalSvg.js +2 -0
  49. package/umd/Options/Classes/PolygonMaskMove.js +2 -0
  50. package/umd/PolygonMaskInstance.js +312 -307
  51. package/umd/PolygonMaskPlugin.js +41 -6
  52. package/umd/index.js +3 -3
  53. package/umd/pathseg.js +5 -15
  54. package/umd/utils.js +4 -2
  55. package/409.min.js +0 -2
  56. package/409.min.js.LICENSE.txt +0 -1
  57. package/tsparticles.plugin.polygon-mask.min.js.LICENSE.txt +0 -1
@@ -1166,11 +1166,7 @@
1166
1166
  Source.prototype._isCurrentSpace = function () {
1167
1167
  const character = this._string[this._currentIndex];
1168
1168
  return (character <= " " &&
1169
- (character == " " ||
1170
- character == "\n" ||
1171
- character == "\t" ||
1172
- character == "\r" ||
1173
- character == "\f"));
1169
+ (character == " " || character == "\n" || character == "\t" || character == "\r" || character == "\f"));
1174
1170
  };
1175
1171
  Source.prototype._skipOptionalSpaces = function () {
1176
1172
  while (this._currentIndex < this._endIndex && this._isCurrentSpace())
@@ -1243,10 +1239,7 @@
1243
1239
  }
1244
1240
  };
1245
1241
  Source.prototype._nextCommandHelper = function (lookahead, previousCommand) {
1246
- if ((lookahead == "+" ||
1247
- lookahead == "-" ||
1248
- lookahead == "." ||
1249
- (lookahead >= "0" && lookahead <= "9")) &&
1242
+ if ((lookahead == "+" || lookahead == "-" || lookahead == "." || (lookahead >= "0" && lookahead <= "9")) &&
1250
1243
  previousCommand != window.SVGPathSeg.PATHSEG_CLOSEPATH) {
1251
1244
  if (previousCommand == window.SVGPathSeg.PATHSEG_MOVETO_ABS)
1252
1245
  return window.SVGPathSeg.PATHSEG_LINETO_ABS;
@@ -1260,8 +1253,7 @@
1260
1253
  if (!this.hasMoreData())
1261
1254
  return true;
1262
1255
  const command = this.peekSegmentType();
1263
- return (command == window.SVGPathSeg.PATHSEG_MOVETO_ABS ||
1264
- command == window.SVGPathSeg.PATHSEG_MOVETO_REL);
1256
+ return command == window.SVGPathSeg.PATHSEG_MOVETO_ABS || command == window.SVGPathSeg.PATHSEG_MOVETO_REL;
1265
1257
  };
1266
1258
  Source.prototype._parseNumber = function () {
1267
1259
  let exponent = 0;
@@ -1279,8 +1271,7 @@
1279
1271
  sign = -1;
1280
1272
  }
1281
1273
  if (this._currentIndex == this._endIndex ||
1282
- ((this._string.charAt(this._currentIndex) < "0" ||
1283
- this._string.charAt(this._currentIndex) > "9") &&
1274
+ ((this._string.charAt(this._currentIndex) < "0" || this._string.charAt(this._currentIndex) > "9") &&
1284
1275
  this._string.charAt(this._currentIndex) != "."))
1285
1276
  return undefined;
1286
1277
  const startIntPartIndex = this._currentIndex;
@@ -1312,8 +1303,7 @@
1312
1303
  }
1313
1304
  if (this._currentIndex != startIndex &&
1314
1305
  this._currentIndex + 1 < this._endIndex &&
1315
- (this._string.charAt(this._currentIndex) == "e" ||
1316
- this._string.charAt(this._currentIndex) == "E") &&
1306
+ (this._string.charAt(this._currentIndex) == "e" || this._string.charAt(this._currentIndex) == "E") &&
1317
1307
  this._string.charAt(this._currentIndex + 1) != "x" &&
1318
1308
  this._string.charAt(this._currentIndex + 1) != "m") {
1319
1309
  this._currentIndex++;
package/browser/utils.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Vector, getDistances, getStyleFromRgb, rangeColorToRgb, } from "@tsparticles/engine";
1
+ import { Vector, double, getDistances, getStyleFromRgb, rangeColorToRgb, } from "@tsparticles/engine";
2
2
  const squareExp = 2, inSegmentRange = {
3
3
  min: 0,
4
4
  max: 1,
5
- }, double = 2;
5
+ };
6
6
  export function drawPolygonMask(engine, context, rawData, stroke, hdr = false) {
7
7
  const color = rangeColorToRgb(engine, stroke.color);
8
8
  if (!color) {
@@ -88,6 +88,8 @@ export function parsePaths(paths, scale, offset) {
88
88
  case svgPathSeg.PATHSEG_UNKNOWN:
89
89
  case svgPathSeg.PATHSEG_CLOSEPATH:
90
90
  continue;
91
+ default:
92
+ continue;
91
93
  }
92
94
  res.push({
93
95
  x: p.x * scale + offset.x,
@@ -5,6 +5,15 @@ import { PolygonMaskLocalSvg } from "./PolygonMaskLocalSvg.js";
5
5
  import { PolygonMaskMove } from "./PolygonMaskMove.js";
6
6
  import { PolygonMaskType } from "../../Enums/PolygonMaskType.js";
7
7
  export class PolygonMask {
8
+ data;
9
+ draw;
10
+ enable;
11
+ inline;
12
+ move;
13
+ position;
14
+ scale;
15
+ type;
16
+ url;
8
17
  constructor(engine) {
9
18
  this.draw = new PolygonMaskDraw(engine);
10
19
  this.enable = false;
@@ -1,6 +1,8 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  import { PolygonMaskDrawStroke } from "./PolygonMaskDrawStroke.js";
3
3
  export class PolygonMaskDraw {
4
+ enable;
5
+ stroke;
4
6
  constructor(engine) {
5
7
  this.enable = false;
6
8
  this.stroke = new PolygonMaskDrawStroke(engine);
@@ -1,5 +1,9 @@
1
1
  import { OptionsColor, isNull, isString, stringToAlpha, } from "@tsparticles/engine";
2
2
  export class PolygonMaskDrawStroke {
3
+ color;
4
+ opacity;
5
+ width;
6
+ _engine;
3
7
  constructor(engine) {
4
8
  this._engine = engine;
5
9
  this.color = new OptionsColor();
@@ -1,6 +1,7 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  import { PolygonMaskInlineArrangement, } from "../../Enums/PolygonMaskInlineArrangement.js";
3
3
  export class PolygonMaskInline {
4
+ arrangement;
4
5
  constructor() {
5
6
  this.arrangement = PolygonMaskInlineArrangement.onePerPoint;
6
7
  }
@@ -1,5 +1,7 @@
1
1
  import { isNull, } from "@tsparticles/engine";
2
2
  export class PolygonMaskLocalSvg {
3
+ path;
4
+ size;
3
5
  constructor() {
4
6
  this.path = [];
5
7
  this.size = {
@@ -1,6 +1,8 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  import { PolygonMaskMoveType } from "../../Enums/PolygonMaskMoveType.js";
3
3
  export class PolygonMaskMove {
4
+ radius;
5
+ type;
4
6
  constructor() {
5
7
  this.radius = 10;
6
8
  this.type = PolygonMaskMoveType.path;