@tsparticles/qwik 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/LICENSE +21 -0
- package/README.md +94 -0
- package/lib-types/components/particles/IParticlesProps.d.ts +16 -0
- package/lib-types/components/particles/index.d.ts +6 -0
- package/lib-types/components/particles/particles.d.ts +6 -0
- package/lib-types/entry.dev.d.ts +2 -0
- package/lib-types/entry.ssr.d.ts +14 -0
- package/lib-types/index.d.ts +1 -0
- package/lib-types/root.d.ts +2 -0
- package/lib-types/src/components/particles/IParticlesProps.d.ts +15 -0
- package/lib-types/src/components/particles/index.d.ts +8 -0
- package/lib-types/src/components/particles/initParticlesEngine.d.ts +5 -0
- package/lib-types/src/components/particles/particles.d.ts +6 -0
- package/lib-types/src/entry.dev.d.ts +2 -0
- package/lib-types/src/entry.ssr.d.ts +14 -0
- package/lib-types/src/index.d.ts +1 -0
- package/lib-types/src/root.d.ts +2 -0
- package/package.json +59 -0
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
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
[](https://particles.js.org)
|
|
2
|
+
|
|
3
|
+
# @tsparticles/qwik
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@tsparticles/qwik)
|
|
6
|
+
[](https://www.npmjs.com/package/@tsparticles/qwik)
|
|
7
|
+
|
|
8
|
+
Official Qwik component wrapper for [tsParticles](https://github.com/matteobruni/tsparticles).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @tsparticles/qwik @tsparticles/engine
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
or
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @tsparticles/qwik @tsparticles/engine
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
or
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn add @tsparticles/qwik @tsparticles/engine
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Initialize tsParticles once in your app bootstrap, then use `<Particles />` wherever needed.
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { component$, useSignal } from "@builder.io/qwik";
|
|
34
|
+
import { Particles, initParticlesEngine } from "@tsparticles/qwik";
|
|
35
|
+
import type { Engine } from "@tsparticles/engine";
|
|
36
|
+
|
|
37
|
+
void initParticlesEngine(async (engine: Engine) => {
|
|
38
|
+
const [{ loadSlim }] = await Promise.all([import("@tsparticles/slim")]);
|
|
39
|
+
|
|
40
|
+
await loadSlim(engine);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default component$(() => {
|
|
44
|
+
const loaded = useSignal(false);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Particles
|
|
48
|
+
id="tsparticles"
|
|
49
|
+
options={{
|
|
50
|
+
fullScreen: {
|
|
51
|
+
zIndex: -1,
|
|
52
|
+
},
|
|
53
|
+
particles: {
|
|
54
|
+
number: { value: 80 },
|
|
55
|
+
links: { enable: true },
|
|
56
|
+
move: { enable: true },
|
|
57
|
+
},
|
|
58
|
+
}}
|
|
59
|
+
loaded={async () => {
|
|
60
|
+
loaded.value = true;
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## How init works
|
|
68
|
+
|
|
69
|
+
- `initParticlesEngine` should be called once per app lifecycle.
|
|
70
|
+
- All `<Particles />` instances wait for init completion before loading.
|
|
71
|
+
- You can choose what to load inside init (`@tsparticles/slim`, `tsparticles`, or custom plugins).
|
|
72
|
+
|
|
73
|
+
## Props
|
|
74
|
+
|
|
75
|
+
| Prop | Type | Definition |
|
|
76
|
+
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| id | string | The id of the element. |
|
|
78
|
+
| width | string | The width of the canvas. |
|
|
79
|
+
| height | string | The height of the canvas. |
|
|
80
|
+
| options | object | The options of the particles instance. |
|
|
81
|
+
| url | string | The remote options url, called using an AJAX request |
|
|
82
|
+
| style | object | The style of the canvas element. |
|
|
83
|
+
| class | string | The class name of the canvas wrapper. |
|
|
84
|
+
| canvasClassName | string | The class name of the canvas. |
|
|
85
|
+
| container | object | The instance of the [particles container](https://particles.js.org/docs/modules/Core_Container.html) |
|
|
86
|
+
| loaded | function | This function is called when particles are correctly loaded in canvas, the current container is the parameter and you can customize it here |
|
|
87
|
+
|
|
88
|
+
Find your parameters configuration [here](https://particles.js.org).
|
|
89
|
+
|
|
90
|
+
## Demos
|
|
91
|
+
|
|
92
|
+
The demo website is [here](https://particles.js.org).
|
|
93
|
+
|
|
94
|
+
There is also a CodePen collection actively maintained and updated [here](https://codepen.io/collection/DPOage).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CSSProperties, ClassList, NoSerialize, QRL, Signal } from "@builder.io/qwik";
|
|
2
|
+
import type { Container, Engine, ISourceOptions } from "@tsparticles/engine";
|
|
3
|
+
export interface IParticlesProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
options?: ISourceOptions;
|
|
8
|
+
url?: string;
|
|
9
|
+
params?: ISourceOptions;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
class?: ClassList | Signal<ClassList>;
|
|
12
|
+
canvasClassName?: ClassList | Signal<ClassList>;
|
|
13
|
+
container?: Signal<NoSerialize<Container | undefined>>;
|
|
14
|
+
init?: QRL<(engine: Engine) => Promise<void>>;
|
|
15
|
+
loaded?: QRL<(container?: Container) => Promise<void>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT IS THIS FILE?
|
|
3
|
+
*
|
|
4
|
+
* SSR entry point, in all cases the application is rendered outside the browser, this
|
|
5
|
+
* entry point will be the common one.
|
|
6
|
+
*
|
|
7
|
+
* - Server (express, cloudflare...)
|
|
8
|
+
* - npm run start
|
|
9
|
+
* - npm run preview
|
|
10
|
+
* - npm run build
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { type RenderToStreamOptions } from "@builder.io/qwik/server";
|
|
14
|
+
export default function (opts: RenderToStreamOptions): Promise<import("@builder.io/qwik/server").RenderToStreamResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Particles } from "./components/particles";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties, ClassList, NoSerialize, QRL, Signal } from "@builder.io/qwik";
|
|
2
|
+
import type { Container, ISourceOptions } from "@tsparticles/engine";
|
|
3
|
+
export interface IParticlesProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
options?: ISourceOptions;
|
|
8
|
+
url?: string;
|
|
9
|
+
params?: ISourceOptions;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
class?: ClassList | Signal<ClassList>;
|
|
12
|
+
canvasClassName?: ClassList | Signal<ClassList>;
|
|
13
|
+
container?: Signal<NoSerialize<Container | undefined>>;
|
|
14
|
+
loaded?: QRL<(container?: Container) => Promise<void>>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IParticlesProps } from "./IParticlesProps";
|
|
2
|
+
import { initParticlesEngine, type ParticlesPluginRegistrar } from "./initParticlesEngine";
|
|
3
|
+
import Particles from "./particles";
|
|
4
|
+
export type { IParticlesProps };
|
|
5
|
+
export type ParticlesProps = IParticlesProps;
|
|
6
|
+
export type { ParticlesPluginRegistrar };
|
|
7
|
+
export default Particles;
|
|
8
|
+
export { Particles, initParticlesEngine };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Engine } from "@tsparticles/engine";
|
|
2
|
+
export type ParticlesPluginRegistrar = (engine: Engine) => Promise<void> | void;
|
|
3
|
+
export declare function initParticlesEngine(init?: ParticlesPluginRegistrar): Promise<void>;
|
|
4
|
+
export declare function isParticlesEngineInitialized(): boolean;
|
|
5
|
+
export declare function waitForParticlesEngineInitialization(): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT IS THIS FILE?
|
|
3
|
+
*
|
|
4
|
+
* SSR entry point, in all cases the application is rendered outside the browser, this
|
|
5
|
+
* entry point will be the common one.
|
|
6
|
+
*
|
|
7
|
+
* - Server (express, cloudflare...)
|
|
8
|
+
* - npm run start
|
|
9
|
+
* - npm run preview
|
|
10
|
+
* - npm run build
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { type RenderToStreamOptions } from "@builder.io/qwik/server";
|
|
14
|
+
export default function (opts: RenderToStreamOptions): Promise<import("@builder.io/qwik/server").RenderToStreamResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Particles, initParticlesEngine, type IParticlesProps, type ParticlesPluginRegistrar, } from "./components/particles";
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsparticles/qwik",
|
|
3
|
+
"version": "4.0.0-beta.12",
|
|
4
|
+
"description": "Official tsParticles Qwik Component - Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for Web Components, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, React, Riot.js, Solid.js, Inferno.",
|
|
5
|
+
"main": "./lib/index.qwik.mjs",
|
|
6
|
+
"qwik": "./lib/index.qwik.mjs",
|
|
7
|
+
"types": "./lib-types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./lib/index.qwik.mjs",
|
|
11
|
+
"require": "./lib/index.qwik.cjs",
|
|
12
|
+
"types": "./lib-types/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"lib",
|
|
17
|
+
"lib-types"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=15.0.0"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "echo build",
|
|
25
|
+
"build.lib": "vite build --mode lib",
|
|
26
|
+
"build.types": "tsc --emitDeclarationOnly",
|
|
27
|
+
"dev": "vite --mode ssr",
|
|
28
|
+
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
|
29
|
+
"fmt": "prettier --write .",
|
|
30
|
+
"fmt.check": "prettier --check .",
|
|
31
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
32
|
+
"release": "np",
|
|
33
|
+
"start": "vite --open --mode ssr",
|
|
34
|
+
"qwik": "qwik"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@tsparticles/engine": "^4.0.0-beta.12"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@builder.io/qwik": "1.19.2",
|
|
41
|
+
"@types/eslint": "9.6.1",
|
|
42
|
+
"@types/node": "^25.6.0",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "8.58.2",
|
|
44
|
+
"@typescript-eslint/parser": "8.58.2",
|
|
45
|
+
"eslint": "10.2.0",
|
|
46
|
+
"eslint-plugin-qwik": "latest",
|
|
47
|
+
"np": "11.0.3",
|
|
48
|
+
"prettier": "3.8.2",
|
|
49
|
+
"tsparticles": "^4.0.0-beta.12",
|
|
50
|
+
"typescript": "6.0.2",
|
|
51
|
+
"undici": "8.1.0",
|
|
52
|
+
"vite": "8.0.8",
|
|
53
|
+
"vite-tsconfig-paths": "6.1.1"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "ebd73f94ae2391c9068de098f2856e1efb26254c"
|
|
59
|
+
}
|