@tsparticles/ember 4.1.3 → 4.2.0
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +19 -4
- package/addon/components/particles.hbs +1 -0
- package/addon/modifiers/particles.ts +23 -7
- package/package.dist.json +1 -1
- package/package.json +39 -29
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.2.0](https://github.com/tsparticles/tsparticles/compare/v4.1.3...v4.2.0) (2026-06-17)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- fixed ember wrapper ([ad417d8](https://github.com/tsparticles/tsparticles/commit/ad417d8340661f1a7a12d28e60fb64e98ec84868))
|
|
11
|
+
- various fixes after deeper review ([49e9af4](https://github.com/tsparticles/tsparticles/commit/49e9af44e178ec460934db8485ed624b09527464))
|
|
12
|
+
|
|
6
13
|
## [4.1.3](https://github.com/tsparticles/tsparticles/compare/v4.1.2...v4.1.3) (2026-06-03)
|
|
7
14
|
|
|
8
15
|
**Note:** Version bump only for package @tsparticles/ember
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Matteo Bruni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -52,14 +52,29 @@ export default class ApplicationController extends Controller {
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
```hbs
|
|
55
|
-
<Particles @options={{this.options}} @particlesLoaded={{this.loadedCallback}} />
|
|
55
|
+
<Particles @options={{this.options}} @theme={{this.theme}} @particlesLoaded={{this.loadedCallback}} />
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
The component accepts these named args:
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
| Arg | Type | Description |
|
|
61
|
+
|--------------------|--------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
|
62
|
+
| `@options` | `Options` | Particles options object |
|
|
63
|
+
| `@url` | `string` | Remote JSON config URL |
|
|
64
|
+
| `@particlesLoaded` | `(container?: Container) => void` | Callback invoked when the container is loaded, receives `Container \| undefined` |
|
|
65
|
+
| `@theme` | `string` (optional) | Theme name to apply. Requires `@tsparticles/plugin-themes` to be loaded. Without the plugin, this is a safe no-op. |
|
|
66
|
+
|
|
67
|
+
### Reactive behavior
|
|
68
|
+
|
|
69
|
+
The modifier reloads particles when `@options` or `@url` changes. Changes to `@theme` apply the theme via `loadTheme` without a full reload.
|
|
70
|
+
|
|
71
|
+
### Theme support
|
|
72
|
+
|
|
73
|
+
The `@theme` prop requires the optional `@tsparticles/plugin-themes` package to be registered with the engine. Without it, setting `@theme` is a safe no-op (no crash, no error).
|
|
74
|
+
|
|
75
|
+
### Cleanup
|
|
76
|
+
|
|
77
|
+
When the element is removed from the DOM (or the modifier is torn down), the particles container is automatically destroyed, stopping all animations and freeing resources. The destructor is registered once and runs exactly once to avoid memory leaks.
|
|
63
78
|
|
|
64
79
|
### Template import syntax (`.gjs`)
|
|
65
80
|
|
|
@@ -15,16 +15,20 @@ interface ParticlesModifierSignature {
|
|
|
15
15
|
Named: {
|
|
16
16
|
options: Options;
|
|
17
17
|
url: string;
|
|
18
|
-
particlesLoaded: (container
|
|
18
|
+
particlesLoaded: (container?: Container) => void;
|
|
19
|
+
theme?: string;
|
|
19
20
|
};
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export default class ParticlesModifier extends Modifier<ParticlesModifierSignature> {
|
|
25
|
+
#container?: Container;
|
|
26
|
+
#cleanupRegistered = false;
|
|
27
|
+
|
|
24
28
|
async modify(
|
|
25
29
|
element: Element,
|
|
26
30
|
_: PositionalArgs<ParticlesModifierSignature>,
|
|
27
|
-
{ options, url, particlesLoaded }: NamedArgs<ParticlesModifierSignature>,
|
|
31
|
+
{ options, url, particlesLoaded, theme }: NamedArgs<ParticlesModifierSignature>,
|
|
28
32
|
) {
|
|
29
33
|
if (!element.id) {
|
|
30
34
|
throw new Error('The specified element must have an id attribute.');
|
|
@@ -38,19 +42,31 @@ export default class ParticlesModifier extends Modifier<ParticlesModifierSignatu
|
|
|
38
42
|
);
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
this.#container?.destroy();
|
|
46
|
+
this.#container = undefined;
|
|
47
|
+
|
|
48
|
+
const container = await tsParticles.load({
|
|
42
49
|
id: element.id,
|
|
43
50
|
options: options ?? {},
|
|
44
51
|
url,
|
|
45
52
|
});
|
|
46
53
|
|
|
54
|
+
this.#container = container;
|
|
55
|
+
|
|
56
|
+
if (container && theme) {
|
|
57
|
+
(container as unknown as { loadTheme?: (name?: string) => Promise<void> }).loadTheme?.(theme);
|
|
58
|
+
}
|
|
59
|
+
|
|
47
60
|
if (particlesLoaded && container) {
|
|
48
61
|
particlesLoaded(container);
|
|
49
62
|
}
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
if (!this.#cleanupRegistered) {
|
|
65
|
+
registerDestructor(this, () => {
|
|
66
|
+
this.#container?.destroy();
|
|
67
|
+
this.#container = undefined;
|
|
68
|
+
});
|
|
69
|
+
this.#cleanupRegistered = true;
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
72
|
}
|
package/package.dist.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/ember",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "Ember.js
|
|
3
|
+
"version": "4.2.0",
|
|
4
|
+
"description": "Official tsParticles Ember.js Component - Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"ember-addon"
|
|
6
|
+
"ember-addon",
|
|
7
|
+
"tsparticles",
|
|
8
|
+
"particles",
|
|
9
|
+
"particle",
|
|
10
|
+
"canvas",
|
|
11
|
+
"animation",
|
|
12
|
+
"background",
|
|
13
|
+
"confetti",
|
|
14
|
+
"fireworks",
|
|
15
|
+
"ember",
|
|
16
|
+
"ember.js"
|
|
7
17
|
],
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/tsparticles/tsparticles/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://particles.js.org",
|
|
8
22
|
"repository": {
|
|
9
23
|
"type": "git",
|
|
10
24
|
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
@@ -29,10 +43,11 @@
|
|
|
29
43
|
"test:ember": "echo test",
|
|
30
44
|
"test:ember-compatibility": "echo ember try:each",
|
|
31
45
|
"prepack": "ember ts:precompile",
|
|
32
|
-
"postpack": "ember ts:clean"
|
|
46
|
+
"postpack": "ember ts:clean",
|
|
47
|
+
"version": "node ../../scripts/resolve-dist-package.cjs && git add package.dist.json"
|
|
33
48
|
},
|
|
34
49
|
"dependencies": {
|
|
35
|
-
"@tsparticles/engine": "
|
|
50
|
+
"@tsparticles/engine": "4.2.0",
|
|
36
51
|
"ember-auto-import": "^2.13.1",
|
|
37
52
|
"ember-cli-babel": "^8.3.1",
|
|
38
53
|
"ember-cli-htmlbars": "^7.0.1",
|
|
@@ -41,17 +56,14 @@
|
|
|
41
56
|
"ember-test-selectors": "^7.1.0"
|
|
42
57
|
},
|
|
43
58
|
"devDependencies": {
|
|
44
|
-
"@babel/core": "7.
|
|
59
|
+
"@babel/core": "^7.0.0",
|
|
45
60
|
"@ember/optional-features": "^3.0.0",
|
|
46
|
-
"@ember/test-helpers": "^5.4.
|
|
61
|
+
"@ember/test-helpers": "^5.4.3",
|
|
47
62
|
"@embroider/test-setup": "^4.0.0",
|
|
48
63
|
"@glimmer/component": "^2.1.1",
|
|
49
64
|
"@glimmer/tracking": "^1.1.2",
|
|
50
|
-
"@
|
|
51
|
-
"@tsparticles/preset-snow": "^4.1.3",
|
|
65
|
+
"@tsparticles/preset-snow": "4.2.0",
|
|
52
66
|
"@types/ember": "^4.0.11",
|
|
53
|
-
"@types/ember-qunit": "^6.1.3",
|
|
54
|
-
"@types/ember-resolver": "^9.0.2",
|
|
55
67
|
"@types/ember__application": "^4.0.11",
|
|
56
68
|
"@types/ember__array": "^4.0.10",
|
|
57
69
|
"@types/ember__component": "^4.0.22",
|
|
@@ -65,45 +77,43 @@
|
|
|
65
77
|
"@types/ember__routing": "^4.0.23",
|
|
66
78
|
"@types/ember__runloop": "^4.0.10",
|
|
67
79
|
"@types/ember__service": "^4.0.9",
|
|
68
|
-
"@types/ember__string": "^3.
|
|
80
|
+
"@types/ember__string": "^3.16.3",
|
|
69
81
|
"@types/ember__template": "^4.0.7",
|
|
70
82
|
"@types/ember__test": "^4.0.6",
|
|
71
|
-
"@types/ember__test-helpers": "^2.9.3",
|
|
72
83
|
"@types/ember__utils": "^4.0.7",
|
|
73
|
-
"@types/qunit": "^2.19.
|
|
84
|
+
"@types/qunit": "^2.19.14",
|
|
74
85
|
"@types/rsvp": "^4.0.9",
|
|
75
86
|
"@types/sinon": "^21.0.1",
|
|
76
|
-
"babel-eslint": "^10.1.0",
|
|
77
87
|
"broccoli-asset-rev": "^3.0.0",
|
|
78
|
-
"ember-cli": "~
|
|
79
|
-
"ember-cli-dependency-checker": "^3.
|
|
88
|
+
"ember-cli": "~7.0.1",
|
|
89
|
+
"ember-cli-dependency-checker": "^3.4.0",
|
|
80
90
|
"ember-cli-inject-live-reload": "^2.1.0",
|
|
81
91
|
"ember-cli-sri": "^2.1.1",
|
|
82
92
|
"ember-cli-terser": "^4.0.2",
|
|
83
93
|
"ember-disable-prototype-extensions": "^1.1.3",
|
|
84
94
|
"ember-load-initializers": "^3.0.1",
|
|
85
95
|
"ember-page-title": "^9.0.3",
|
|
86
|
-
"ember-qunit": "^9.0
|
|
96
|
+
"ember-qunit": "^9.1.0",
|
|
87
97
|
"ember-resolver": "^13.2.0",
|
|
88
98
|
"ember-sinon-qunit": "^7.5.0",
|
|
89
|
-
"ember-source": "~
|
|
99
|
+
"ember-source": "~7.0.0",
|
|
90
100
|
"ember-source-channel-url": "^3.0.0",
|
|
91
101
|
"ember-template-lint": "^7.9.3",
|
|
92
102
|
"ember-try": "^4.0.0",
|
|
93
|
-
"eslint": "^10.
|
|
103
|
+
"eslint": "^10.5.0",
|
|
94
104
|
"eslint-config-prettier": "^10.1.8",
|
|
95
|
-
"eslint-plugin-ember": "^
|
|
105
|
+
"eslint-plugin-ember": "^13.3.2",
|
|
96
106
|
"eslint-plugin-node": "^11.1.0",
|
|
97
|
-
"eslint-plugin-prettier": "^5.5.
|
|
107
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
98
108
|
"eslint-plugin-qunit": "^8.2.6",
|
|
99
109
|
"loader.js": "^4.7.0",
|
|
100
110
|
"npm-run-all": "^4.1.5",
|
|
101
|
-
"prettier": "^3.8.
|
|
102
|
-
"qunit": "^2.
|
|
103
|
-
"qunit-dom": "^3.5.
|
|
104
|
-
"tsparticles": "
|
|
105
|
-
"typescript": "^6.0.
|
|
106
|
-
"webpack": "^5.
|
|
111
|
+
"prettier": "^3.8.4",
|
|
112
|
+
"qunit": "^2.26.0",
|
|
113
|
+
"qunit-dom": "^3.5.1",
|
|
114
|
+
"tsparticles": "4.2.0",
|
|
115
|
+
"typescript": "^6.0.3",
|
|
116
|
+
"webpack": "^5.107.2"
|
|
107
117
|
},
|
|
108
118
|
"engines": {
|
|
109
119
|
"node": "14.* || 16.* || >= 18"
|
|
@@ -134,5 +144,5 @@
|
|
|
134
144
|
"peerDependencies": {
|
|
135
145
|
"@tsparticles/engine": "workspace:*"
|
|
136
146
|
},
|
|
137
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "985a346686ce8d7fa09808849bef51140f1b4897"
|
|
138
148
|
}
|