@tsparticles/shape-rounded-rect 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/430.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_shape_rounded_rect=this.webpackChunk_tsparticles_shape_rounded_rect||[]).push([[430],{430(e,t,a){a.d(t,{RoundedRectDrawer:()=>u});var r=a(303);let i=Math.sqrt(2);class u{draw(e){let{context:t,particle:a,radius:u}=e,d=u/i,o=d*r.double,s=a.borderRadius??5;"roundRect"in t?t.roundRect(-d,-d,o,o,s):function(e,t,a,r){let{x:i,y:u,width:d,height:o}={x:-t,y:-t,height:a,width:a},s=i+d,c=u+o;e.moveTo(i+r,u),e.lineTo(s-r,u),e.quadraticCurveTo(s,u,s,u+r),e.lineTo(s,u+o-r),e.quadraticCurveTo(s,c,s-r,c),e.lineTo(i+r,c),e.quadraticCurveTo(i,c,i,c-r),e.lineTo(i,u+r),e.quadraticCurveTo(i,u,i+r,u)}(t,d,o,s)}particleInit(e,t){let a=t.shapeData;t.borderRadius=(0,r.getRangeValue)(a?.radius??5)*e.retina.pixelRatio}}}}]);
@@ -1,10 +1,7 @@
1
- import { getRangeValue } from "@tsparticles/engine";
1
+ import { double, getRangeValue } from "@tsparticles/engine";
2
2
  import { drawRoundedRect } from "./Utils.js";
3
- const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), double = 2, defaultRadius = 5;
3
+ const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), defaultRadius = 5;
4
4
  export class RoundedRectDrawer {
5
- constructor() {
6
- this.validTypes = ["rounded-rect"];
7
- }
8
5
  draw(data) {
9
6
  const { context, particle, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * double, borderRadius = particle.borderRadius ?? defaultRadius;
10
7
  if ("roundRect" in context) {
package/browser/index.js CHANGED
@@ -1,7 +1,9 @@
1
- export function loadRoundedRectShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
5
- e.addShape(new RoundedRectDrawer());
1
+ export async function loadRoundedRectShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(e => {
4
+ e.addShape(["rounded-rect"], async () => {
5
+ const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
6
+ return new RoundedRectDrawer();
7
+ });
6
8
  });
7
9
  }
@@ -1,10 +1,7 @@
1
- import { getRangeValue } from "@tsparticles/engine";
1
+ import { double, getRangeValue } from "@tsparticles/engine";
2
2
  import { drawRoundedRect } from "./Utils.js";
3
- const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), double = 2, defaultRadius = 5;
3
+ const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), defaultRadius = 5;
4
4
  export class RoundedRectDrawer {
5
- constructor() {
6
- this.validTypes = ["rounded-rect"];
7
- }
8
5
  draw(data) {
9
6
  const { context, particle, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * double, borderRadius = particle.borderRadius ?? defaultRadius;
10
7
  if ("roundRect" in context) {
package/cjs/index.js CHANGED
@@ -1,7 +1,9 @@
1
- export function loadRoundedRectShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
5
- e.addShape(new RoundedRectDrawer());
1
+ export async function loadRoundedRectShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(e => {
4
+ e.addShape(["rounded-rect"], async () => {
5
+ const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
6
+ return new RoundedRectDrawer();
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,7 +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 */ RoundedRectDrawer: () => (/* binding */ RoundedRectDrawer)\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\nconst fixFactorSquare = 2,\n fixFactor = Math.sqrt(fixFactorSquare),\n double = 2,\n defaultRadius = 5;\nclass RoundedRectDrawer {\n constructor() {\n this.validTypes = [\"rounded-rect\"];\n }\n draw(data) {\n const {\n context,\n particle,\n radius\n } = data,\n fixedRadius = radius / fixFactor,\n fixedDiameter = fixedRadius * double,\n borderRadius = particle.borderRadius ?? defaultRadius;\n if (\"roundRect\" in context) {\n context.roundRect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter, borderRadius);\n } else {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawRoundedRect)(context, fixedRadius, fixedDiameter, borderRadius);\n }\n }\n particleInit(container, particle) {\n const shapeData = particle.shapeData;\n particle.borderRadius = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.radius ?? defaultRadius) * container.retina.pixelRatio;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-rect/./dist/browser/RoundedRectDrawer.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RoundedRectDrawer: () => (/* binding */ RoundedRectDrawer)\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\nconst fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), defaultRadius = 5;\nclass RoundedRectDrawer {\n draw(data) {\n const { context, particle, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double, borderRadius = particle.borderRadius ?? defaultRadius;\n if (\"roundRect\" in context) {\n context.roundRect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter, borderRadius);\n } else {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawRoundedRect)(context, fixedRadius, fixedDiameter, borderRadius);\n }\n }\n particleInit(container, particle) {\n const shapeData = particle.shapeData;\n particle.borderRadius = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.radius ?? defaultRadius) * container.retina.pixelRatio;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-rect/./dist/browser/RoundedRectDrawer.js?\n}");
27
27
 
28
28
  /***/ },
29
29
 
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
33
33
  \*******************************/
34
34
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
35
 
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawRoundedRect: () => (/* binding */ drawRoundedRect)\n/* harmony export */ });\nfunction drawRoundedRect(ctx, fixedRadius, fixedDiameter, borderRadius) {\n const info = {\n x: -fixedRadius,\n y: -fixedRadius,\n height: fixedDiameter,\n width: fixedDiameter\n },\n radius = {\n topLeft: borderRadius,\n topRight: borderRadius,\n bottomLeft: borderRadius,\n bottomRight: borderRadius\n },\n {\n x,\n y,\n width,\n height\n } = info,\n r = x + width,\n b = y + height;\n ctx.moveTo(x + radius.topLeft, y);\n ctx.lineTo(r - radius.topRight, y);\n ctx.quadraticCurveTo(r, y, r, y + radius.topRight);\n ctx.lineTo(r, y + height - radius.bottomRight);\n ctx.quadraticCurveTo(r, b, r - radius.bottomRight, b);\n ctx.lineTo(x + radius.bottomLeft, b);\n ctx.quadraticCurveTo(x, b, x, b - radius.bottomLeft);\n ctx.lineTo(x, y + radius.topLeft);\n ctx.quadraticCurveTo(x, y, x + radius.topLeft, y);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-rect/./dist/browser/Utils.js?\n}");
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawRoundedRect: () => (/* binding */ drawRoundedRect)\n/* harmony export */ });\nfunction drawRoundedRect(ctx, fixedRadius, fixedDiameter, borderRadius) {\n const info = {\n x: -fixedRadius,\n y: -fixedRadius,\n height: fixedDiameter,\n width: fixedDiameter\n }, radius = {\n topLeft: borderRadius,\n topRight: borderRadius,\n bottomLeft: borderRadius,\n bottomRight: borderRadius\n }, { x, y, width, height } = info, r = x + width, b = y + height;\n ctx.moveTo(x + radius.topLeft, y);\n ctx.lineTo(r - radius.topRight, y);\n ctx.quadraticCurveTo(r, y, r, y + radius.topRight);\n ctx.lineTo(r, y + height - radius.bottomRight);\n ctx.quadraticCurveTo(r, b, r - radius.bottomRight, b);\n ctx.lineTo(x + radius.bottomLeft, b);\n ctx.quadraticCurveTo(x, b, x, b - radius.bottomLeft);\n ctx.lineTo(x, y + radius.topLeft);\n ctx.quadraticCurveTo(x, y, x + radius.topLeft, y);\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-rect/./dist/browser/Utils.js?\n}");
37
37
 
38
38
  /***/ }
39
39
 
@@ -1,10 +1,7 @@
1
- import { getRangeValue } from "@tsparticles/engine";
1
+ import { double, getRangeValue } from "@tsparticles/engine";
2
2
  import { drawRoundedRect } from "./Utils.js";
3
- const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), double = 2, defaultRadius = 5;
3
+ const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), defaultRadius = 5;
4
4
  export class RoundedRectDrawer {
5
- constructor() {
6
- this.validTypes = ["rounded-rect"];
7
- }
8
5
  draw(data) {
9
6
  const { context, particle, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * double, borderRadius = particle.borderRadius ?? defaultRadius;
10
7
  if ("roundRect" in context) {
package/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
- export function loadRoundedRectShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
5
- e.addShape(new RoundedRectDrawer());
1
+ export async function loadRoundedRectShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(e => {
4
+ e.addShape(["rounded-rect"], async () => {
5
+ const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
6
+ return new RoundedRectDrawer();
7
+ });
6
8
  });
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-rounded-rect",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.20",
4
4
  "description": "tsParticles rounded rect shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,7 +100,7 @@
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
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"