@tsparticles/ember 4.0.0-beta.12

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/.eslintrc.js ADDED
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ root: true,
5
+ parser: 'babel-eslint',
6
+ parserOptions: {
7
+ ecmaVersion: 2018,
8
+ sourceType: 'module',
9
+ ecmaFeatures: {
10
+ legacyDecorators: true,
11
+ },
12
+ },
13
+ plugins: ['ember'],
14
+ extends: [
15
+ 'eslint:recommended',
16
+ 'plugin:ember/recommended',
17
+ 'plugin:prettier/recommended',
18
+ ],
19
+ env: {
20
+ browser: true,
21
+ },
22
+ rules: {},
23
+ overrides: [
24
+ // node files
25
+ {
26
+ files: [
27
+ './.eslintrc.js',
28
+ './.prettierrc.js',
29
+ './.template-lintrc.js',
30
+ './ember-cli-build.js',
31
+ './index.js',
32
+ './testem.js',
33
+ './blueprints/*/index.js',
34
+ './config/**/*.js',
35
+ './tests/dummy/config/**/*.js',
36
+ ],
37
+ parserOptions: {
38
+ sourceType: 'script',
39
+ },
40
+ env: {
41
+ browser: false,
42
+ node: true,
43
+ },
44
+ plugins: ['node'],
45
+ extends: ['plugin:node/recommended'],
46
+ },
47
+ {
48
+ // test files
49
+ files: ['tests/**/*-test.{js,ts}'],
50
+ extends: ['plugin:qunit/recommended'],
51
+ },
52
+ ],
53
+ };
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [4.0.0-beta.12](https://github.com/tsparticles/tsparticles/compare/v4.0.0-beta.11...v4.0.0-beta.12) (2026-04-15)
7
+
8
+ ### Features
9
+
10
+ - improving other wrappers to make them similar to React, Vue and Angular ones ([4dccf8e](https://github.com/tsparticles/tsparticles/commit/4dccf8eb0fe4ac29f8240673c77e0701cdbd15b1))
11
+ - improving other wrappers to make them similar to React, Vue and Angular ones ([e0c9230](https://github.com/tsparticles/tsparticles/commit/e0c9230b751d3a86b8f4eccf10b3660a0a7ddb91))
12
+ - improving other wrappers to make them similar to React, Vue and Angular ones ([981e896](https://github.com/tsparticles/tsparticles/commit/981e896329951c6cdebfeba2406a68278c373996))
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
+
3
+ # @tsparticles/ember
4
+
5
+ [![npm](https://img.shields.io/npm/v/@tsparticles/ember)](https://www.npmjs.com/package/@tsparticles/ember) [![npm](https://img.shields.io/npm/dm/@tsparticles/ember)](https://www.npmjs.com/package/@tsparticles/ember) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ Official Ember component for [tsParticles](https://github.com/tsparticles/tsparticles).
8
+
9
+ ## Compatibility
10
+
11
+ - Ember.js v3.28+
12
+ - Ember CLI v3.28+
13
+ - Node.js v14+
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @tsparticles/ember
19
+ # or
20
+ yarn add @tsparticles/ember
21
+ # or
22
+ pnpm add @tsparticles/ember
23
+ # or
24
+ ember install @tsparticles/ember
25
+ ```
26
+
27
+ If you want the full bundle loader in examples below:
28
+
29
+ ```bash
30
+ npm install tsparticles
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Initialize the engine once in your app lifecycle, then render `<Particles />` where needed.
36
+
37
+ ```ts
38
+ import Controller from '@ember/controller';
39
+ import type { Engine } from '@tsparticles/engine';
40
+ import { loadFull } from 'tsparticles';
41
+ import { initParticlesEngine } from '@tsparticles/ember/utils/init-particles-engine';
42
+
43
+ export default class ApplicationController extends Controller {
44
+ public constructor(...args: unknown[]) {
45
+ super(...args);
46
+
47
+ void initParticlesEngine(async (engine: Engine) => {
48
+ await loadFull(engine);
49
+ });
50
+ }
51
+ }
52
+ ```
53
+
54
+ ```hbs
55
+ <Particles @options={{this.options}} @particlesLoaded={{this.loadedCallback}} />
56
+ ```
57
+
58
+ The component accepts these named args:
59
+
60
+ - `@options`: particles options object
61
+ - `@url`: remote JSON config URL
62
+ - `@particlesLoaded`: callback invoked with the loaded container
63
+
64
+ ### Template import syntax (`.gjs`)
65
+
66
+ ```js
67
+ import type { Engine } from "@tsparticles/engine";
68
+ import { loadFull } from "tsparticles";
69
+ import Particles from "@tsparticles/ember/components/particles";
70
+ import { initParticlesEngine } from "@tsparticles/ember/utils/init-particles-engine";
71
+
72
+ void initParticlesEngine(async (engine: Engine) => {
73
+ await loadFull(engine);
74
+ });
75
+
76
+ const options = {
77
+ particles: {
78
+ links: {
79
+ enable: true,
80
+ },
81
+ move: {
82
+ enable: true,
83
+ },
84
+ },
85
+ };
86
+
87
+ <template>
88
+ <Particles @options={{options}} />
89
+ </template>;
90
+ ```
91
+
92
+ ### Using presets
93
+
94
+ ```bash
95
+ npm install @tsparticles/preset-confetti
96
+ ```
97
+
98
+ ```ts
99
+ import type { Engine } from '@tsparticles/engine';
100
+ import { initParticlesEngine } from '@tsparticles/ember/utils/init-particles-engine';
101
+ import { loadConfettiPreset } from '@tsparticles/preset-confetti';
102
+
103
+ void initParticlesEngine(async (engine: Engine) => {
104
+ await loadConfettiPreset(engine);
105
+ });
106
+ ```
107
+
108
+ ```hbs
109
+ <Particles @options={{hash preset='confetti'}} />
110
+ ```
@@ -0,0 +1,11 @@
1
+ {{!-- template-lint-disable no-implicit-this --}}
2
+ <div
3
+ id='particles-{{unique-id-polyfill}}'
4
+ data-test-id='particles'
5
+ ...attributes
6
+ {{particles
7
+ options=@options
8
+ url=@url
9
+ particlesLoaded=@particlesLoaded
10
+ }}
11
+ ></div>
@@ -0,0 +1,14 @@
1
+ import { helper } from '@ember/component/helper';
2
+
3
+ export default helper(uniqueIdPolyfill);
4
+
5
+ // Copy-pasted from the ember-source implementation:
6
+ // https://github.com/emberjs/ember.js/blob/master/packages/@ember/-internals/glimmer/lib/helpers/unique-id.ts
7
+ function uniqueIdPolyfill() {
8
+ // @ts-expect-error this one-liner abuses weird JavaScript semantics that
9
+ // TypeScript (legitimately) doesn't like, but they're nonetheless valid and
10
+ // specced.
11
+ return ([3e7] + -1e3 + -4e3 + -2e3 + -1e11).replace(/[0-3]/g, (a) =>
12
+ ((a * 4) ^ ((Math.random() * 16) >> (a & 2))).toString(16)
13
+ );
14
+ }
@@ -0,0 +1,55 @@
1
+ import Modifier, { NamedArgs, PositionalArgs } from 'ember-modifier';
2
+ import type { Container, Options } from '@tsparticles/engine';
3
+ import { tsParticles } from '@tsparticles/engine';
4
+ import {
5
+ isParticlesEngineInitialized,
6
+ waitForParticlesEngineInitialization,
7
+ } from '../utils/init-particles-engine';
8
+
9
+ import { registerDestructor } from '@ember/destroyable';
10
+
11
+ interface ParticlesModifierSignature {
12
+ Args: {
13
+ Positional: [];
14
+ Named: {
15
+ options: Options;
16
+ url: string;
17
+ particlesLoaded: (container: Container) => void;
18
+ };
19
+ };
20
+ }
21
+
22
+ export default class ParticlesModifier extends Modifier<ParticlesModifierSignature> {
23
+ async modify(
24
+ element: Element,
25
+ _: PositionalArgs<ParticlesModifierSignature>,
26
+ { options, url, particlesLoaded }: NamedArgs<ParticlesModifierSignature>,
27
+ ) {
28
+ if (!element.id) {
29
+ throw new Error('The specified element must have an id attribute.');
30
+ }
31
+
32
+ await waitForParticlesEngineInitialization();
33
+
34
+ if (!isParticlesEngineInitialized()) {
35
+ throw new Error(
36
+ 'initParticlesEngine(...) must be called once before rendering <Particles /> components.',
37
+ );
38
+ }
39
+
40
+ let container = await tsParticles.load({
41
+ id: element.id,
42
+ options: options ?? {},
43
+ url,
44
+ });
45
+
46
+ if (particlesLoaded && container) {
47
+ particlesLoaded(container);
48
+ }
49
+
50
+ registerDestructor(this, () => {
51
+ container?.destroy();
52
+ container = undefined;
53
+ });
54
+ }
55
+ }
@@ -0,0 +1,55 @@
1
+ import type { Engine } from '@tsparticles/engine';
2
+ import { tsParticles } from '@tsparticles/engine';
3
+
4
+ export type ParticlesPluginRegistrar = (engine: Engine) => Promise<void> | void;
5
+
6
+ let initialized = false;
7
+ let initPromise: Promise<void> | undefined;
8
+ let initCallback: ParticlesPluginRegistrar | undefined;
9
+
10
+ export async function initParticlesEngine(
11
+ init?: ParticlesPluginRegistrar,
12
+ ): Promise<void> {
13
+ if (initialized) {
14
+ return;
15
+ }
16
+
17
+ if (initPromise) {
18
+ if (initCallback !== init) {
19
+ throw new Error(
20
+ 'initParticlesEngine callback must be stable across the app lifecycle.',
21
+ );
22
+ }
23
+
24
+ await initPromise;
25
+
26
+ return;
27
+ }
28
+
29
+ initCallback = init;
30
+ initPromise = (async () => {
31
+ if (init) {
32
+ await init(tsParticles);
33
+ }
34
+
35
+ await tsParticles.init();
36
+
37
+ initialized = true;
38
+ })().catch((error: unknown) => {
39
+ initPromise = undefined;
40
+ initCallback = undefined;
41
+ initialized = false;
42
+
43
+ throw error;
44
+ });
45
+
46
+ await initPromise;
47
+ }
48
+
49
+ export function isParticlesEngineInitialized(): boolean {
50
+ return initialized;
51
+ }
52
+
53
+ export async function waitForParticlesEngineInitialization(): Promise<void> {
54
+ await (initPromise ?? Promise.resolve());
55
+ }
@@ -0,0 +1 @@
1
+ export { default } from '@tsparticles/ember/components/particles';
@@ -0,0 +1 @@
1
+ export { default } from '@tsparticles/ember/helpers/unique-id-polyfill';
@@ -0,0 +1 @@
1
+ export { default } from '@tsparticles/ember/modifiers/particles';
@@ -0,0 +1,5 @@
1
+ export {
2
+ initParticlesEngine,
3
+ isParticlesEngineInitialized,
4
+ waitForParticlesEngineInitialization,
5
+ } from '@tsparticles/ember/utils/init-particles-engine';
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = function (/* environment, appConfig */) {
4
+ return {};
5
+ };
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ name: require('./package').name,
5
+ };
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@tsparticles/ember",
3
+ "version": "4.0.0-beta.12",
4
+ "description": "Ember.js component for using tsParticles",
5
+ "keywords": [
6
+ "ember-addon"
7
+ ],
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/tsparticles/tsparticles.git",
11
+ "directory": "wrappers/ember"
12
+ },
13
+ "license": "MIT",
14
+ "author": "Ignace Maes (https://ignacemaes.com/)",
15
+ "directories": {
16
+ "doc": "doc",
17
+ "test": "tests"
18
+ },
19
+ "scripts": {
20
+ "build": "echo build",
21
+ "lint": "npm-run-all --print-name --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
22
+ "lint:fix": "npm-run-all --print-name --aggregate-output --continue-on-error --parallel \"lint:*:fix\"",
23
+ "lint:hbs": "ember-template-lint .",
24
+ "lint:hbs:fix": "ember-template-lint . --fix",
25
+ "lint:js": "eslint . --cache",
26
+ "lint:js:fix": "eslint . --fix",
27
+ "start": "ember serve",
28
+ "test": "npm-run-all --print-name \"lint\" \"test:*\"",
29
+ "test:ember": "echo test",
30
+ "test:ember-compatibility": "echo ember try:each",
31
+ "prepack": "ember ts:precompile",
32
+ "postpack": "ember ts:clean"
33
+ },
34
+ "dependencies": {
35
+ "@tsparticles/engine": "^4.0.0-beta.12",
36
+ "ember-auto-import": "^2.13.1",
37
+ "ember-cli-babel": "^8.3.1",
38
+ "ember-cli-htmlbars": "^7.0.1",
39
+ "ember-cli-typescript": "^5.3.0",
40
+ "ember-modifier": "^4.3.0",
41
+ "ember-test-selectors": "^7.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@babel/core": "7.29.0",
45
+ "@ember/optional-features": "^3.0.0",
46
+ "@ember/test-helpers": "^5.4.1",
47
+ "@embroider/test-setup": "^4.0.0",
48
+ "@glimmer/component": "^2.1.1",
49
+ "@glimmer/tracking": "^1.1.2",
50
+ "@tsconfig/ember": "^3.0.12",
51
+ "@tsparticles/preset-snow": "^4.0.0-beta.12",
52
+ "@types/ember": "^4.0.11",
53
+ "@types/ember-qunit": "^6.1.3",
54
+ "@types/ember-resolver": "^9.0.2",
55
+ "@types/ember__application": "^4.0.11",
56
+ "@types/ember__array": "^4.0.10",
57
+ "@types/ember__component": "^4.0.22",
58
+ "@types/ember__controller": "^4.0.12",
59
+ "@types/ember__debug": "^4.0.8",
60
+ "@types/ember__destroyable": "^4.0.5",
61
+ "@types/ember__engine": "^4.0.11",
62
+ "@types/ember__error": "^4.0.6",
63
+ "@types/ember__object": "^4.0.12",
64
+ "@types/ember__polyfills": "^4.0.6",
65
+ "@types/ember__routing": "^4.0.23",
66
+ "@types/ember__runloop": "^4.0.10",
67
+ "@types/ember__service": "^4.0.9",
68
+ "@types/ember__string": "^3.0.15",
69
+ "@types/ember__template": "^4.0.7",
70
+ "@types/ember__test": "^4.0.6",
71
+ "@types/ember__test-helpers": "^2.9.3",
72
+ "@types/ember__utils": "^4.0.7",
73
+ "@types/qunit": "^2.19.13",
74
+ "@types/rsvp": "^4.0.9",
75
+ "@types/sinon": "^21.0.1",
76
+ "babel-eslint": "^10.1.0",
77
+ "broccoli-asset-rev": "^3.0.0",
78
+ "ember-cli": "~6.12.0",
79
+ "ember-cli-dependency-checker": "^3.3.3",
80
+ "ember-cli-inject-live-reload": "^2.1.0",
81
+ "ember-cli-sri": "^2.1.1",
82
+ "ember-cli-terser": "^4.0.2",
83
+ "ember-disable-prototype-extensions": "^1.1.3",
84
+ "ember-load-initializers": "^3.0.1",
85
+ "ember-page-title": "^9.0.3",
86
+ "ember-qunit": "^9.0.4",
87
+ "ember-resolver": "^13.2.0",
88
+ "ember-sinon-qunit": "^7.5.0",
89
+ "ember-source": "~6.12.0",
90
+ "ember-source-channel-url": "^3.0.0",
91
+ "ember-template-lint": "^7.9.3",
92
+ "ember-try": "^4.0.0",
93
+ "eslint": "^10.2.0",
94
+ "eslint-config-prettier": "^10.1.8",
95
+ "eslint-plugin-ember": "^12.7.5",
96
+ "eslint-plugin-node": "^11.1.0",
97
+ "eslint-plugin-prettier": "^5.5.5",
98
+ "eslint-plugin-qunit": "^8.2.6",
99
+ "loader.js": "^4.7.0",
100
+ "npm-run-all": "^4.1.5",
101
+ "prettier": "^3.8.2",
102
+ "qunit": "^2.25.0",
103
+ "qunit-dom": "^3.5.0",
104
+ "tsparticles": "^4.0.0-beta.12",
105
+ "typescript": "^6.0.2",
106
+ "webpack": "^5.106.1"
107
+ },
108
+ "engines": {
109
+ "node": "14.* || 16.* || >= 18"
110
+ },
111
+ "ember": {
112
+ "edition": "octane"
113
+ },
114
+ "ember-addon": {
115
+ "configPath": "tests/dummy/config"
116
+ },
117
+ "publishConfig": {
118
+ "access": "public"
119
+ },
120
+ "gitHead": "ebd73f94ae2391c9068de098f2856e1efb26254c"
121
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "extends": "@tsconfig/ember/tsconfig.json",
3
+ "compilerOptions": {
4
+
5
+ // The combination of `baseUrl` with `paths` allows Ember's classic package
6
+ // layout, which is not resolvable with the Node resolution algorithm, to
7
+ // work with TypeScript.
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "dummy/tests/*": [
11
+ "tests/*"
12
+ ],
13
+ "dummy/*": [
14
+ "tests/dummy/app/*",
15
+ "app/*"
16
+ ],
17
+ "@tsparticles/ember": [
18
+ "addon"
19
+ ],
20
+ "@tsparticles/ember/*": [
21
+ "addon/*"
22
+ ],
23
+ "@tsparticles/ember/test-support": [
24
+ "addon-test-support"
25
+ ],
26
+ "@tsparticles/ember/test-support/*": [
27
+ "addon-test-support/*"
28
+ ],
29
+ "*": [
30
+ "types/*"
31
+ ]
32
+ }
33
+ },
34
+ "include": [
35
+ "app/**/*",
36
+ "addon/**/*",
37
+ "tests/**/*",
38
+ "types/**/*",
39
+ "test-support/**/*",
40
+ "addon-test-support/**/*"
41
+ ]
42
+ }
package/typedoc.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "includes": "./markdown",
3
+ "entryPoints": [
4
+ "./src/"
5
+ ],
6
+ "entryPointStrategy": "expand",
7
+ "name": "tsParticles Angular Component",
8
+ "includeVersion": true,
9
+ "hideGenerator": true,
10
+ "out": "./docs",
11
+ "validation": {
12
+ "invalidLink": true,
13
+ "notDocumented": true
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,7 @@
1
+ // Types for compiled templates
2
+ declare module '@tsparticles/ember/templates/*' {
3
+ import { TemplateFactory } from 'ember-cli-htmlbars';
4
+
5
+ const tmpl: TemplateFactory;
6
+ export default tmpl;
7
+ }