@tsparticles/shape-text 4.0.0-beta.0 → 4.0.0-beta.10

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.
@@ -1,2 +1,2 @@
1
- "use strict";(this.webpackChunk_tsparticles_shape_text=this.webpackChunk_tsparticles_shape_text||[]).push([[942],{942(t,e,a){a.d(e,{TextDrawer:()=>l});var i=a(303),s=a(183),n=a(425);class l{draw(t){(0,s.m)(t)}async init(t){let e=t.actualOptions;if(s.u.find(t=>(0,i.isInArray)(t,e.particles.shape.type))){let t=s.u.map(t=>e.particles.shape.options[t]).find(t=>!!t),a=[];(0,i.executeOnSingleOrMultiple)(t,t=>{a.push((0,n.loadFont)(t.font,t.weight))}),await Promise.all(a)}}particleInit(t,e){if(!e.shape||!s.u.includes(e.shape))return;let a=e.shapeData;if(void 0===a)return;let n=a.value;n&&(e.textLines=(0,i.itemFromSingleOrMultiple)(n,e.randomIndexData)?.split(`
1
+ "use strict";(this.webpackChunk_tsparticles_shape_text=this.webpackChunk_tsparticles_shape_text||[]).push([[825],{825(t,e,a){a.d(e,{TextDrawer:()=>l});var i=a(303),s=a(206),n=a(425);class l{draw(t){(0,s.m)(t)}async init(t){let e=t.actualOptions;if(s.u.find(t=>(0,i.isInArray)(t,e.particles.shape.type))){let t=s.u.map(t=>e.particles.shape.options[t]).find(t=>!!t),a=[];(0,i.executeOnSingleOrMultiple)(t,t=>{a.push((0,n.loadFont)(t.font,t.weight))}),await Promise.all(a)}}particleInit(t,e){if(!e.shape||!s.u.includes(e.shape))return;let a=e.shapeData;if(void 0===a)return;let n=a.value;n&&(e.textLines=(0,i.itemFromSingleOrMultiple)(n,e.randomIndexData)?.split(`
2
2
  `)??[],e.maxTextLength=e.textLines.length?Math.max(...e.textLines.map(t=>t.length)):e.textLines[0]?.length??0)}}}}]);
package/README.md CHANGED
@@ -8,6 +8,12 @@
8
8
 
9
9
  [tsParticles](https://github.com/tsparticles/tsparticles) additional text shape.
10
10
 
11
+ ## Quick checklist
12
+
13
+ 1. Install `@tsparticles/engine` (or use the CDN bundle below)
14
+ 2. Call the package loader function(s) before `tsParticles.load(...)`
15
+ 3. Apply the package options in your `tsParticles.load(...)` config
16
+
11
17
  ## How to use it
12
18
 
13
19
  ### CDN / Vanilla JS / jQuery
@@ -73,3 +79,32 @@ import { loadTextShape } from "@tsparticles/shape-text";
73
79
  await loadTextShape(tsParticles);
74
80
  })();
75
81
  ```
82
+
83
+ ## Option mapping
84
+
85
+ - Primary options key: `particles.shape.type: "text"`
86
+ - Shape-specific options key: `particles.shape.options.text`
87
+
88
+ ```json
89
+ {
90
+ "particles": {
91
+ "shape": {
92
+ "type": "text",
93
+ "options": {
94
+ "text": {}
95
+ }
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## Common pitfalls
102
+
103
+ - Calling `tsParticles.load(...)` before `loadTextShape(...)`
104
+ - Verify required peer packages before enabling advanced options
105
+ - Change one option group at a time to isolate regressions quickly
106
+
107
+ ## Related docs
108
+
109
+ - All packages catalog: <https://github.com/tsparticles/tsparticles>
110
+ - Main docs: <https://particles.js.org/docs/>
package/browser/Utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { double, half, itemFromSingleOrMultiple } from "@tsparticles/engine";
1
+ import { double, half, itemFromSingleOrMultiple, } from "@tsparticles/engine";
2
2
  export const validTypes = ["text", "character", "char", "multiline-text"];
3
3
  const firstIndex = 0, minLength = 0;
4
4
  export function drawText(data) {
package/browser/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { validTypes } from "./Utils.js";
2
2
  export async function loadTextShape(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(e => {
5
- e.addShape(validTypes, async () => {
3
+ engine.checkVersion("4.0.0-beta.10");
4
+ await engine.pluginManager.register(e => {
5
+ e.pluginManager.addShape(validTypes, async () => {
6
6
  const { TextDrawer } = await import("./TextDrawer.js");
7
7
  return new TextDrawer();
8
8
  });
package/cjs/Utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { double, half, itemFromSingleOrMultiple } from "@tsparticles/engine";
1
+ import { double, half, itemFromSingleOrMultiple, } from "@tsparticles/engine";
2
2
  export const validTypes = ["text", "character", "char", "multiline-text"];
3
3
  const firstIndex = 0, minLength = 0;
4
4
  export function drawText(data) {
package/cjs/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { validTypes } from "./Utils.js";
2
2
  export async function loadTextShape(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(e => {
5
- e.addShape(validTypes, async () => {
3
+ engine.checkVersion("4.0.0-beta.10");
4
+ await engine.pluginManager.register(e => {
5
+ e.pluginManager.addShape(validTypes, async () => {
6
6
  const { TextDrawer } = await import("./TextDrawer.js");
7
7
  return new TextDrawer();
8
8
  });
@@ -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-beta.0
7
+ * v4.0.0-beta.10
8
8
  */
9
9
  "use strict";
10
10
  /*
package/esm/Utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { double, half, itemFromSingleOrMultiple } from "@tsparticles/engine";
1
+ import { double, half, itemFromSingleOrMultiple, } from "@tsparticles/engine";
2
2
  export const validTypes = ["text", "character", "char", "multiline-text"];
3
3
  const firstIndex = 0, minLength = 0;
4
4
  export function drawText(data) {
package/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { validTypes } from "./Utils.js";
2
2
  export async function loadTextShape(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(e => {
5
- e.addShape(validTypes, async () => {
3
+ engine.checkVersion("4.0.0-beta.10");
4
+ await engine.pluginManager.register(e => {
5
+ e.pluginManager.addShape(validTypes, async () => {
6
6
  const { TextDrawer } = await import("./TextDrawer.js");
7
7
  return new TextDrawer();
8
8
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-text",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "tsParticles text shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -53,14 +53,13 @@
53
53
  "browser": "./browser/index.js",
54
54
  "import": "./esm/index.js",
55
55
  "require": "./cjs/index.js",
56
- "umd": "./umd/index.js",
57
- "default": "./cjs/index.js"
56
+ "default": "./esm/index.js"
58
57
  },
59
58
  "./package.json": "./package.json"
60
59
  },
61
- "dependencies": {
62
- "@tsparticles/canvas-utils": "4.0.0-beta.0",
63
- "@tsparticles/engine": "4.0.0-beta.0"
60
+ "peerDependencies": {
61
+ "@tsparticles/canvas-utils": "4.0.0-beta.10",
62
+ "@tsparticles/engine": "4.0.0-beta.10"
64
63
  },
65
64
  "publishConfig": {
66
65
  "access": "public"