@tsparticles/interaction-particles-links 3.0.0-beta.0 → 3.0.0-beta.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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/browser/LinkInstance.js +1 -1
  3. package/browser/Linker.js +2 -2
  4. package/browser/Options/Classes/Links.js +2 -2
  5. package/browser/index.js +8 -8
  6. package/browser/interaction.js +1 -1
  7. package/browser/package.json +1 -0
  8. package/browser/plugin.js +1 -1
  9. package/cjs/LinkInstance.js +5 -5
  10. package/cjs/Linker.js +4 -4
  11. package/cjs/Options/Classes/Links.js +4 -4
  12. package/cjs/index.js +10 -10
  13. package/cjs/interaction.js +2 -2
  14. package/cjs/package.json +1 -0
  15. package/cjs/plugin.js +2 -2
  16. package/esm/LinkInstance.js +1 -1
  17. package/esm/Linker.js +2 -2
  18. package/esm/Options/Classes/Links.js +2 -2
  19. package/esm/index.js +8 -8
  20. package/esm/interaction.js +1 -1
  21. package/esm/package.json +1 -0
  22. package/esm/plugin.js +1 -1
  23. package/package.json +18 -6
  24. package/report.html +23 -5
  25. package/tsparticles.interaction.particles.links.js +1 -1
  26. package/tsparticles.interaction.particles.links.min.js.LICENSE.txt +1 -1
  27. package/types/Interfaces.d.ts +1 -1
  28. package/types/LinkInstance.d.ts +1 -1
  29. package/types/Linker.d.ts +1 -1
  30. package/types/Options/Classes/Links.d.ts +3 -3
  31. package/types/Options/Classes/LinksShadow.d.ts +1 -1
  32. package/types/Options/Classes/LinksTriangle.d.ts +1 -1
  33. package/types/Options/Interfaces/ILinks.d.ts +2 -2
  34. package/types/Types.d.ts +3 -3
  35. package/types/Utils.d.ts +1 -1
  36. package/types/index.d.ts +6 -6
  37. package/umd/LinkInstance.js +6 -6
  38. package/umd/Linker.js +5 -5
  39. package/umd/Options/Classes/Links.js +5 -5
  40. package/umd/index.js +11 -11
  41. package/umd/interaction.js +3 -3
  42. package/umd/plugin.js +3 -3
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![npmjs](https://badge.fury.io/js/@tsparticles/interaction-particles-links.svg)](https://www.npmjs.com/package/@tsparticles/interaction-particles-links)
7
7
  [![npmjs](https://img.shields.io/npm/dt/@tsparticles/interaction-particles-links)](https://www.npmjs.com/package/@tsparticles/interaction-particles-links) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
8
8
 
9
- [tsParticles](https://github.com/matteobruni/tsparticles) interaction plugin for links effect between particles.
9
+ [tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for links effect between particles.
10
10
 
11
11
  ## How to use it
12
12
 
@@ -1,5 +1,5 @@
1
1
  import { getDistance, getLinkColor, getRandom, getRangeValue, rangeColorToRgb, } from "@tsparticles/engine";
2
- import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils";
2
+ import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils.js";
3
3
  export class LinkInstance {
4
4
  constructor(container) {
5
5
  this.container = container;
package/browser/Linker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Circle, ParticlesInteractorBase, getDistances, getLinkRandomColor, } from "@tsparticles/engine";
2
- import { CircleWarp } from "./CircleWarp";
3
- import { Links } from "./Options/Classes/Links";
2
+ import { CircleWarp } from "./CircleWarp.js";
3
+ import { Links } from "./Options/Classes/Links.js";
4
4
  function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
5
5
  const { dx, dy, distance } = getDistances(pos1, pos2);
6
6
  if (!warp || distance <= optDistance) {
@@ -1,6 +1,6 @@
1
1
  import { OptionsColor } from "@tsparticles/engine";
2
- import { LinksShadow } from "./LinksShadow";
3
- import { LinksTriangle } from "./LinksTriangle";
2
+ import { LinksShadow } from "./LinksShadow.js";
3
+ import { LinksTriangle } from "./LinksTriangle.js";
4
4
  export class Links {
5
5
  constructor() {
6
6
  this.blink = false;
package/browser/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { loadLinksInteraction } from "./interaction";
2
- import { loadLinksPlugin } from "./plugin";
1
+ import { loadLinksInteraction } from "./interaction.js";
2
+ import { loadLinksPlugin } from "./plugin.js";
3
3
  export async function loadParticlesLinksInteraction(engine, refresh = true) {
4
4
  await loadLinksInteraction(engine, refresh);
5
5
  await loadLinksPlugin(engine, refresh);
6
6
  }
7
- export * from "./Options/Classes/Links";
8
- export * from "./Options/Classes/LinksShadow";
9
- export * from "./Options/Classes/LinksTriangle";
10
- export * from "./Options/Interfaces/ILinks";
11
- export * from "./Options/Interfaces/ILinksShadow";
12
- export * from "./Options/Interfaces/ILinksTriangle";
7
+ export * from "./Options/Classes/Links.js";
8
+ export * from "./Options/Classes/LinksShadow.js";
9
+ export * from "./Options/Classes/LinksTriangle.js";
10
+ export * from "./Options/Interfaces/ILinks.js";
11
+ export * from "./Options/Interfaces/ILinksShadow.js";
12
+ export * from "./Options/Interfaces/ILinksTriangle.js";
@@ -1,4 +1,4 @@
1
- import { Linker } from "./Linker";
1
+ import { Linker } from "./Linker.js";
2
2
  export async function loadLinksInteraction(engine, refresh = true) {
3
3
  await engine.addInteractor("particlesLinks", (container) => new Linker(container), refresh);
4
4
  }
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/browser/plugin.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LinkInstance } from "./LinkInstance";
1
+ import { LinkInstance } from "./LinkInstance.js";
2
2
  class LinksPlugin {
3
3
  constructor() {
4
4
  this.id = "links";
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LinkInstance = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const Utils_1 = require("./Utils");
5
+ const Utils_js_1 = require("./Utils.js");
6
6
  class LinkInstance {
7
7
  constructor(container) {
8
8
  this.container = container;
@@ -33,7 +33,7 @@ class LinkInstance {
33
33
  return;
34
34
  }
35
35
  const width = p1.retina.linksWidth ?? 0, maxDistance = p1.retina.linksDistance ?? 0, { backgroundMask } = options;
36
- (0, Utils_1.drawLinkLine)({
36
+ (0, Utils_js_1.drawLinkLine)({
37
37
  context: ctx,
38
38
  width,
39
39
  begin: pos1,
@@ -77,7 +77,7 @@ class LinkInstance {
77
77
  if (!colorTriangle) {
78
78
  return;
79
79
  }
80
- (0, Utils_1.drawLinkTriangle)({
80
+ (0, Utils_js_1.drawLinkTriangle)({
81
81
  context: ctx,
82
82
  pos1,
83
83
  pos2,
@@ -111,10 +111,10 @@ class LinkInstance {
111
111
  }
112
112
  };
113
113
  this._getLinkFrequency = (p1, p2) => {
114
- return (0, Utils_1.setLinkFrequency)([p1, p2], this._freqs.links);
114
+ return (0, Utils_js_1.setLinkFrequency)([p1, p2], this._freqs.links);
115
115
  };
116
116
  this._getTriangleFrequency = (p1, p2, p3) => {
117
- return (0, Utils_1.setLinkFrequency)([p1, p2, p3], this._freqs.triangles);
117
+ return (0, Utils_js_1.setLinkFrequency)([p1, p2, p3], this._freqs.triangles);
118
118
  };
119
119
  this._freqs = {
120
120
  links: new Map(),
package/cjs/Linker.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Linker = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const CircleWarp_1 = require("./CircleWarp");
6
- const Links_1 = require("./Options/Classes/Links");
5
+ const CircleWarp_js_1 = require("./CircleWarp.js");
6
+ const Links_js_1 = require("./Options/Classes/Links.js");
7
7
  function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
8
8
  const { dx, dy, distance } = (0, engine_1.getDistances)(pos1, pos2);
9
9
  if (!warp || distance <= optDistance) {
@@ -59,7 +59,7 @@ class Linker extends engine_1.ParticlesInteractorBase {
59
59
  return;
60
60
  }
61
61
  const linkOpt1 = p1.options.links, optOpacity = linkOpt1.opacity, optDistance = p1.retina.linksDistance ?? 0, warp = linkOpt1.warp, range = warp
62
- ? new CircleWarp_1.CircleWarp(pos1.x, pos1.y, optDistance, canvasSize)
62
+ ? new CircleWarp_js_1.CircleWarp(pos1.x, pos1.y, optDistance, canvasSize)
63
63
  : new engine_1.Circle(pos1.x, pos1.y, optDistance), query = container.particles.quadTree.query(range);
64
64
  for (const p2 of query) {
65
65
  const linkOpt2 = p2.options.links;
@@ -94,7 +94,7 @@ class Linker extends engine_1.ParticlesInteractorBase {
94
94
  }
95
95
  loadParticlesOptions(options, ...sources) {
96
96
  if (!options.links) {
97
- options.links = new Links_1.Links();
97
+ options.links = new Links_js_1.Links();
98
98
  }
99
99
  for (const source of sources) {
100
100
  options.links.load(source?.links ?? source?.lineLinked ?? source?.line_linked);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Links = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const LinksShadow_1 = require("./LinksShadow");
6
- const LinksTriangle_1 = require("./LinksTriangle");
5
+ const LinksShadow_js_1 = require("./LinksShadow.js");
6
+ const LinksTriangle_js_1 = require("./LinksTriangle.js");
7
7
  class Links {
8
8
  constructor() {
9
9
  this.blink = false;
@@ -14,8 +14,8 @@ class Links {
14
14
  this.enable = false;
15
15
  this.frequency = 1;
16
16
  this.opacity = 1;
17
- this.shadow = new LinksShadow_1.LinksShadow();
18
- this.triangles = new LinksTriangle_1.LinksTriangle();
17
+ this.shadow = new LinksShadow_js_1.LinksShadow();
18
+ this.triangles = new LinksTriangle_js_1.LinksTriangle();
19
19
  this.width = 1;
20
20
  this.warp = false;
21
21
  }
package/cjs/index.js CHANGED
@@ -15,16 +15,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.loadParticlesLinksInteraction = void 0;
18
- const interaction_1 = require("./interaction");
19
- const plugin_1 = require("./plugin");
18
+ const interaction_js_1 = require("./interaction.js");
19
+ const plugin_js_1 = require("./plugin.js");
20
20
  async function loadParticlesLinksInteraction(engine, refresh = true) {
21
- await (0, interaction_1.loadLinksInteraction)(engine, refresh);
22
- await (0, plugin_1.loadLinksPlugin)(engine, refresh);
21
+ await (0, interaction_js_1.loadLinksInteraction)(engine, refresh);
22
+ await (0, plugin_js_1.loadLinksPlugin)(engine, refresh);
23
23
  }
24
24
  exports.loadParticlesLinksInteraction = loadParticlesLinksInteraction;
25
- __exportStar(require("./Options/Classes/Links"), exports);
26
- __exportStar(require("./Options/Classes/LinksShadow"), exports);
27
- __exportStar(require("./Options/Classes/LinksTriangle"), exports);
28
- __exportStar(require("./Options/Interfaces/ILinks"), exports);
29
- __exportStar(require("./Options/Interfaces/ILinksShadow"), exports);
30
- __exportStar(require("./Options/Interfaces/ILinksTriangle"), exports);
25
+ __exportStar(require("./Options/Classes/Links.js"), exports);
26
+ __exportStar(require("./Options/Classes/LinksShadow.js"), exports);
27
+ __exportStar(require("./Options/Classes/LinksTriangle.js"), exports);
28
+ __exportStar(require("./Options/Interfaces/ILinks.js"), exports);
29
+ __exportStar(require("./Options/Interfaces/ILinksShadow.js"), exports);
30
+ __exportStar(require("./Options/Interfaces/ILinksTriangle.js"), exports);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadLinksInteraction = void 0;
4
- const Linker_1 = require("./Linker");
4
+ const Linker_js_1 = require("./Linker.js");
5
5
  async function loadLinksInteraction(engine, refresh = true) {
6
- await engine.addInteractor("particlesLinks", (container) => new Linker_1.Linker(container), refresh);
6
+ await engine.addInteractor("particlesLinks", (container) => new Linker_js_1.Linker(container), refresh);
7
7
  }
8
8
  exports.loadLinksInteraction = loadLinksInteraction;
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }
package/cjs/plugin.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadLinksPlugin = void 0;
4
- const LinkInstance_1 = require("./LinkInstance");
4
+ const LinkInstance_js_1 = require("./LinkInstance.js");
5
5
  class LinksPlugin {
6
6
  constructor() {
7
7
  this.id = "links";
8
8
  }
9
9
  getPlugin(container) {
10
- return new LinkInstance_1.LinkInstance(container);
10
+ return new LinkInstance_js_1.LinkInstance(container);
11
11
  }
12
12
  loadOptions() {
13
13
  }
@@ -1,5 +1,5 @@
1
1
  import { getDistance, getLinkColor, getRandom, getRangeValue, rangeColorToRgb, } from "@tsparticles/engine";
2
- import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils";
2
+ import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils.js";
3
3
  export class LinkInstance {
4
4
  constructor(container) {
5
5
  this.container = container;
package/esm/Linker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Circle, ParticlesInteractorBase, getDistances, getLinkRandomColor, } from "@tsparticles/engine";
2
- import { CircleWarp } from "./CircleWarp";
3
- import { Links } from "./Options/Classes/Links";
2
+ import { CircleWarp } from "./CircleWarp.js";
3
+ import { Links } from "./Options/Classes/Links.js";
4
4
  function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
5
5
  const { dx, dy, distance } = getDistances(pos1, pos2);
6
6
  if (!warp || distance <= optDistance) {
@@ -1,6 +1,6 @@
1
1
  import { OptionsColor } from "@tsparticles/engine";
2
- import { LinksShadow } from "./LinksShadow";
3
- import { LinksTriangle } from "./LinksTriangle";
2
+ import { LinksShadow } from "./LinksShadow.js";
3
+ import { LinksTriangle } from "./LinksTriangle.js";
4
4
  export class Links {
5
5
  constructor() {
6
6
  this.blink = false;
package/esm/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { loadLinksInteraction } from "./interaction";
2
- import { loadLinksPlugin } from "./plugin";
1
+ import { loadLinksInteraction } from "./interaction.js";
2
+ import { loadLinksPlugin } from "./plugin.js";
3
3
  export async function loadParticlesLinksInteraction(engine, refresh = true) {
4
4
  await loadLinksInteraction(engine, refresh);
5
5
  await loadLinksPlugin(engine, refresh);
6
6
  }
7
- export * from "./Options/Classes/Links";
8
- export * from "./Options/Classes/LinksShadow";
9
- export * from "./Options/Classes/LinksTriangle";
10
- export * from "./Options/Interfaces/ILinks";
11
- export * from "./Options/Interfaces/ILinksShadow";
12
- export * from "./Options/Interfaces/ILinksTriangle";
7
+ export * from "./Options/Classes/Links.js";
8
+ export * from "./Options/Classes/LinksShadow.js";
9
+ export * from "./Options/Classes/LinksTriangle.js";
10
+ export * from "./Options/Interfaces/ILinks.js";
11
+ export * from "./Options/Interfaces/ILinksShadow.js";
12
+ export * from "./Options/Interfaces/ILinksTriangle.js";
@@ -1,4 +1,4 @@
1
- import { Linker } from "./Linker";
1
+ import { Linker } from "./Linker.js";
2
2
  export async function loadLinksInteraction(engine, refresh = true) {
3
3
  await engine.addInteractor("particlesLinks", (container) => new Linker(container), refresh);
4
4
  }
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/esm/plugin.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LinkInstance } from "./LinkInstance";
1
+ import { LinkInstance } from "./LinkInstance.js";
2
2
  class LinksPlugin {
3
3
  constructor() {
4
4
  this.id = "links";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-particles-links",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.2",
4
4
  "description": "tsParticles links particles interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/matteobruni/tsparticles.git",
8
+ "url": "git+https://github.com/tsparticles/tsparticles.git",
9
9
  "directory": "interactions/particles/links"
10
10
  },
11
11
  "keywords": [
@@ -66,16 +66,28 @@
66
66
  "author": "Matteo Bruni <matteo.bruni@me.com>",
67
67
  "license": "MIT",
68
68
  "bugs": {
69
- "url": "https://github.com/matteobruni/tsparticles/issues"
69
+ "url": "https://github.com/tsparticles/tsparticles/issues"
70
70
  },
71
- "main": "cjs/index.js",
71
+ "sideEffects": false,
72
72
  "jsdelivr": "tsparticles.interaction.particles.links.min.js",
73
73
  "unpkg": "tsparticles.interaction.particles.links.min.js",
74
+ "browser": "browser/index.js",
75
+ "main": "cjs/index.js",
74
76
  "module": "esm/index.js",
75
77
  "types": "types/index.d.ts",
76
- "sideEffects": false,
78
+ "exports": {
79
+ ".": {
80
+ "types": "./types/index.d.ts",
81
+ "browser": "./browser/index.js",
82
+ "import": "./esm/index.js",
83
+ "require": "./cjs/index.js",
84
+ "umd": "./umd/index.js",
85
+ "default": "./cjs/index.js"
86
+ },
87
+ "./package.json": "./package.json"
88
+ },
77
89
  "dependencies": {
78
- "@tsparticles/engine": "^3.0.0-beta.0"
90
+ "@tsparticles/engine": "^3.0.0-beta.2"
79
91
  },
80
92
  "publishConfig": {
81
93
  "access": "public"