@tsparticles/shape-path 4.0.0-alpha.2 → 4.0.0-alpha.20

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/549.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_shape_path=this.webpackChunk_tsparticles_shape_path||[]).push([[549],{549(a,t,e){e.d(t,{PathDrawer:()=>s});var h=e(303),p=e(580);class s{draw(a){let{context:t,particle:e,radius:h}=a;e.pathData&&(0,p.drawPath)(t,h,e.pathData)}particleInit(a,t){let e=t.shapeData;e&&(t.pathData=(0,h.deepExtend)({},e))}}}}]);
@@ -1,9 +1,6 @@
1
1
  import { deepExtend } from "@tsparticles/engine";
2
- import { drawPath } from "./Utils.js";
2
+ import { drawPath } from "@tsparticles/path-utils";
3
3
  export class PathDrawer {
4
- constructor() {
5
- this.validTypes = ["path"];
6
- }
7
4
  draw(data) {
8
5
  const { context, particle, radius } = data;
9
6
  if (!particle.pathData) {
package/browser/index.js CHANGED
@@ -1,7 +1,9 @@
1
- export function loadPathShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { PathDrawer } = await import("./PathDrawer.js");
5
- e.addShape(new PathDrawer());
1
+ export async function loadPathShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(e => {
4
+ e.addShape(["path"], async () => {
5
+ const { PathDrawer } = await import("./PathDrawer.js");
6
+ return new PathDrawer();
7
+ });
6
8
  });
7
9
  }
package/cjs/PathDrawer.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import { deepExtend } from "@tsparticles/engine";
2
- import { drawPath } from "./Utils.js";
2
+ import { drawPath } from "@tsparticles/path-utils";
3
3
  export class PathDrawer {
4
- constructor() {
5
- this.validTypes = ["path"];
6
- }
7
4
  draw(data) {
8
5
  const { context, particle, radius } = data;
9
6
  if (!particle.pathData) {
package/cjs/index.js CHANGED
@@ -1,7 +1,9 @@
1
- export function loadPathShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { PathDrawer } = await import("./PathDrawer.js");
5
- e.addShape(new PathDrawer());
1
+ export async function loadPathShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(e => {
4
+ e.addShape(["path"], async () => {
5
+ const { PathDrawer } = await import("./PathDrawer.js");
6
+ return new PathDrawer();
7
+ });
6
8
  });
7
9
  }
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.2
7
+ * v4.0.0-alpha.20
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,27 +23,7 @@
23
23
  \************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PathDrawer: () => (/* binding */ PathDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nclass PathDrawer {\n constructor() {\n this.validTypes = [\"path\"];\n }\n draw(data) {\n const {\n context,\n particle,\n radius\n } = data;\n if (!particle.pathData) {\n return;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawPath)(context, radius, particle.pathData);\n }\n particleInit(_container, particle) {\n const shape = particle.shapeData;\n if (!shape) {\n return;\n }\n particle.pathData = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, shape);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/PathDrawer.js?\n}");
27
-
28
- /***/ },
29
-
30
- /***/ "./dist/browser/SegmentType.js"
31
- /*!*************************************!*\
32
- !*** ./dist/browser/SegmentType.js ***!
33
- \*************************************/
34
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
-
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SegmentType: () => (/* binding */ SegmentType)\n/* harmony export */ });\nvar SegmentType;\n(function (SegmentType) {\n SegmentType[\"line\"] = \"line\";\n SegmentType[\"bezier\"] = \"bezier\";\n SegmentType[\"quadratic\"] = \"quadratic\";\n SegmentType[\"arc\"] = \"arc\";\n SegmentType[\"ellipse\"] = \"ellipse\";\n})(SegmentType || (SegmentType = {}));\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/SegmentType.js?\n}");
37
-
38
- /***/ },
39
-
40
- /***/ "./dist/browser/Utils.js"
41
- /*!*******************************!*\
42
- !*** ./dist/browser/Utils.js ***!
43
- \*******************************/
44
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
45
-
46
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawPath: () => (/* binding */ drawPath)\n/* harmony export */ });\n/* harmony import */ var _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SegmentType.js */ \"./dist/browser/SegmentType.js\");\n\nfunction drawPath(ctx, radius, path) {\n const firstIndex = 0,\n firstSegment = path.segments[firstIndex];\n if (!firstSegment) {\n return;\n }\n const firstValue = firstSegment.values[firstIndex];\n if (!firstValue) {\n return;\n }\n ctx.moveTo(firstValue.x * radius, firstValue.y * radius);\n for (const segment of path.segments) {\n const value = segment.values[firstIndex],\n index2 = 1,\n index3 = 2,\n index4 = 3;\n if (!value) {\n continue;\n }\n const segmentValue2 = segment.values[index2],\n segmentValue3 = segment.values[index3],\n segmentValue4 = segment.values[index4];\n switch (segment.type) {\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.line:\n ctx.lineTo(value.x * radius, value.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier:\n if (!segmentValue2 || !segmentValue3 || !segmentValue4) {\n break;\n }\n ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.quadratic:\n if (!segmentValue2 || !segmentValue3) {\n break;\n }\n ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.arc:\n if (!segmentValue2 || !segmentValue3) {\n break;\n }\n ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.ellipse:\n if (!segmentValue2 || !segmentValue3 || !segmentValue4) {\n break;\n }\n ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);\n }\n }\n if (!path.half) {\n return;\n }\n const lengthOffset = 1,\n minLength = 0;\n for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {\n const segment = path.segments[i];\n if (!segment) {\n continue;\n }\n const value = segment.values[firstIndex],\n index2 = 1,\n index3 = 2,\n segmentValue2 = segment.values[index2],\n segmentValue3 = segment.values[index3];\n switch (segment.type) {\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.line:\n if (!value) {\n break;\n }\n ctx.lineTo(value.x * -radius, value.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier:\n if (!value || !segmentValue2 || !segmentValue3) {\n break;\n }\n ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.quadratic:\n if (!segmentValue2 || !segmentValue3) {\n break;\n }\n ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.arc:\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.ellipse:\n default:\n break;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/Utils.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PathDrawer: () => (/* binding */ PathDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/path-utils */ \"@tsparticles/path-utils\");\n\n\nclass PathDrawer {\n draw(data) {\n const { context, particle, radius } = data;\n if (!particle.pathData) {\n return;\n }\n (0,_tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_1__.drawPath)(context, radius, particle.pathData);\n }\n particleInit(_container, particle) {\n const shape = particle.shapeData;\n if (!shape) {\n return;\n }\n particle.pathData = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, shape);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/PathDrawer.js?\n}");
47
27
 
48
28
  /***/ }
49
29
 
package/esm/PathDrawer.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import { deepExtend } from "@tsparticles/engine";
2
- import { drawPath } from "./Utils.js";
2
+ import { drawPath } from "@tsparticles/path-utils";
3
3
  export class PathDrawer {
4
- constructor() {
5
- this.validTypes = ["path"];
6
- }
7
4
  draw(data) {
8
5
  const { context, particle, radius } = data;
9
6
  if (!particle.pathData) {
package/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
- export function loadPathShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { PathDrawer } = await import("./PathDrawer.js");
5
- e.addShape(new PathDrawer());
1
+ export async function loadPathShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(e => {
4
+ e.addShape(["path"], async () => {
5
+ const { PathDrawer } = await import("./PathDrawer.js");
6
+ return new PathDrawer();
7
+ });
6
8
  });
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-path",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.20",
4
4
  "description": "tsParticles path shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,7 +100,8 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "4.0.0-alpha.2"
103
+ "@tsparticles/engine": "4.0.0-alpha.20",
104
+ "@tsparticles/path-utils": "4.0.0-alpha.20"
104
105
  },
105
106
  "publishConfig": {
106
107
  "access": "public"